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

@@ -33,11 +33,13 @@ typedef void (*LOG_FUN)(void *ctx, ...);
} 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); \
if (!bitctx->ret) { *out = _out; }\
else { mpp_assert(0); goto __BITREAD_ERR;}\
} while (0) } while (0)
@@ -50,29 +52,35 @@ typedef void (*LOG_FUN)(void *ctx, ...);
#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);\
if (!bitctx->ret) { *out = _out; }\
else { mpp_assert(0); goto __BITREAD_ERR;}\
} while (0) } 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);\
if (!bitctx->ret) { *out = _out; }\
else { mpp_assert(0); goto __BITREAD_ERR;}\
} while (0) } 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);\
if (!bitctx->ret) { *out = _out; }\
else { mpp_assert(0); goto __BITREAD_ERR;}\
} while (0) } 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_).