add temp value in READ_BITS ect macro define

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@343 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
DingWei
2015-10-09 23:43:24 +00:00
parent 8ebb8eb139
commit 12b80ea667

View File

@@ -28,51 +28,59 @@
typedef void (*LOG_FUN)(void *ctx, ...); typedef void (*LOG_FUN)(void *ctx, ...);
#define BitReadLog(bitctx, ...)\ #define BitReadLog(bitctx, ...)\
do {\ do {\
bitctx->wlog(bitctx->ctx, __FILE__, __LINE__, ##__VA_ARGS__);\ bitctx->wlog(bitctx->ctx, __FILE__, __LINE__, ##__VA_ARGS__);\
} while (0) } while (0)
#define READ_BITS(bitctx, num_bits, out, ...) \ #define READ_BITS(bitctx, num_bits, out, ...)\
do {\ do {\
bitctx->ret = mpp_read_bits(bitctx, num_bits, (RK_S32 *)out); \ RK_S32 _out;\
BitReadLog(bitctx, "%48s = %10d", ##__VA_ARGS__, *out); \ bitctx->ret = mpp_read_bits(bitctx, num_bits, &_out);\
if (bitctx->ret) { mpp_assert(0); goto __BITREAD_ERR; } \ BitReadLog(bitctx, "%48s = %10d", ##__VA_ARGS__, _out); \
} while (0) if (!bitctx->ret) { *out = _out; }\
else { mpp_assert(0); goto __BITREAD_ERR;}\
} while (0)
#define SKIP_BITS(bitctx, num_bits)\ #define SKIP_BITS(bitctx, num_bits)\
do {\ do {\
bitctx->ret = mpp_skip_bits(bitctx, num_bits);\ bitctx->ret = mpp_skip_bits(bitctx, num_bits);\
BitReadLog(bitctx, "%48s", "skip");\ BitReadLog(bitctx, "%48s", "skip");\
if (bitctx->ret) { mpp_assert(0); goto __BITREAD_ERR; }\ if (bitctx->ret) { mpp_assert(0); goto __BITREAD_ERR; }\
} while (0) } while (0)
#define READ_ONEBIT(bitctx, out, ...)\ #define READ_ONEBIT(bitctx, out, ...)\
do {\ do {\
bitctx->ret = mpp_read_bits(bitctx, 1, (RK_S32 *)out);\ RK_S32 _out;\
BitReadLog(bitctx, "%48s = %10d", ##__VA_ARGS__, *out);\ bitctx->ret = mpp_read_bits(bitctx, 1, &_out);\
if (bitctx->ret) { mpp_assert(0); goto __BITREAD_ERR; }\ BitReadLog(bitctx, "%48s = %10d", ##__VA_ARGS__, _out);\
} while (0) if (!bitctx->ret) { *out = _out; }\
else { mpp_assert(0); goto __BITREAD_ERR;}\
} while (0)
#define READ_UE(bitctx, out, ...)\ #define READ_UE(bitctx, out, ...)\
do {\ do {\
bitctx->ret = mpp_read_ue(bitctx, (RK_U32 *)out);\ RK_U32 _out;\
BitReadLog(bitctx, "%48s = %10d", ##__VA_ARGS__, *out);\ bitctx->ret = mpp_read_ue(bitctx, &_out);\
if (bitctx->ret) { mpp_assert(0); goto __BITREAD_ERR; }\ BitReadLog(bitctx, "%48s = %10d", ##__VA_ARGS__, _out);\
} while (0) if (!bitctx->ret) { *out = _out; }\
else { mpp_assert(0); goto __BITREAD_ERR;}\
} while (0)
#define READ_SE(bitctx, out, ...)\ #define READ_SE(bitctx, out, ...)\
do {\ do {\
bitctx->ret = mpp_read_se(bitctx, (RK_S32 *)out);\ RK_S32 _out;\
BitReadLog(bitctx, "%48s = %10d", ##__VA_ARGS__, *out);\ bitctx->ret = mpp_read_se(bitctx, &_out);\
if (bitctx->ret) { mpp_assert(0); goto __BITREAD_ERR; }\ BitReadLog(bitctx, "%48s = %10d", ##__VA_ARGS__, _out);\
} while (0) if (!bitctx->ret) { *out = _out; }\
else { mpp_assert(0); goto __BITREAD_ERR;}\
} while (0)
typedef struct bitread_ctx_t{ typedef struct bitread_ctx_t {
// Pointer to the next unread (not in curr_byte_) byte in the stream. // Pointer to the next unread (not in curr_byte_) byte in the stream.
RK_U8 *data_; RK_U8 *data_;
// Bytes left in the stream (without the curr_byte_). // Bytes left in the stream (without the curr_byte_).
@@ -92,10 +100,10 @@ typedef struct bitread_ctx_t{
RK_S32 used_bits; RK_S32 used_bits;
RK_U8 *buf; RK_U8 *buf;
RK_S32 buf_len; RK_S32 buf_len;
// ctx // ctx
MPP_RET ret; MPP_RET ret;
void *ctx; void *ctx;
LOG_FUN wlog; LOG_FUN wlog;
} BitReadCtx_t; } BitReadCtx_t;