mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-05 17:16:50 +08:00
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:
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2015 Rockchip Electronics Co. LTD
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
/*
|
||||
*
|
||||
* Copyright 2015 Rockchip Electronics Co. LTD
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef __MPP_BITREAD_H__
|
||||
#define __MPP_BITREAD_H__
|
||||
@@ -24,55 +24,63 @@
|
||||
#include "mpp_common.h"
|
||||
#include "mpp_err.h"
|
||||
|
||||
#define __BITREAD_ERR __bitread_error
|
||||
typedef void (*LOG_FUN)(void *ctx, ...);
|
||||
#define __BITREAD_ERR __bitread_error
|
||||
typedef void (*LOG_FUN)(void *ctx, ...);
|
||||
|
||||
#define BitReadLog(bitctx, ...)\
|
||||
do {\
|
||||
bitctx->wlog(bitctx->ctx, __FILE__, __LINE__, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
do {\
|
||||
bitctx->wlog(bitctx->ctx, __FILE__, __LINE__, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
|
||||
#define READ_BITS(bitctx, num_bits, out, ...) \
|
||||
do {\
|
||||
bitctx->ret = mpp_read_bits(bitctx, num_bits, (RK_S32 *)out); \
|
||||
BitReadLog(bitctx, "%48s = %10d", ##__VA_ARGS__, *out); \
|
||||
if (bitctx->ret) { mpp_assert(0); goto __BITREAD_ERR; } \
|
||||
} while (0)
|
||||
#define READ_BITS(bitctx, num_bits, out, ...)\
|
||||
do {\
|
||||
RK_S32 _out;\
|
||||
bitctx->ret = mpp_read_bits(bitctx, num_bits, &_out);\
|
||||
BitReadLog(bitctx, "%48s = %10d", ##__VA_ARGS__, _out); \
|
||||
if (!bitctx->ret) { *out = _out; }\
|
||||
else { mpp_assert(0); goto __BITREAD_ERR;}\
|
||||
} while (0)
|
||||
|
||||
|
||||
#define SKIP_BITS(bitctx, num_bits)\
|
||||
do {\
|
||||
bitctx->ret = mpp_skip_bits(bitctx, num_bits);\
|
||||
BitReadLog(bitctx, "%48s", "skip");\
|
||||
if (bitctx->ret) { mpp_assert(0); goto __BITREAD_ERR; }\
|
||||
} while (0)
|
||||
#define SKIP_BITS(bitctx, num_bits)\
|
||||
do {\
|
||||
bitctx->ret = mpp_skip_bits(bitctx, num_bits);\
|
||||
BitReadLog(bitctx, "%48s", "skip");\
|
||||
if (bitctx->ret) { mpp_assert(0); goto __BITREAD_ERR; }\
|
||||
} while (0)
|
||||
|
||||
#define READ_ONEBIT(bitctx, out, ...)\
|
||||
do {\
|
||||
bitctx->ret = mpp_read_bits(bitctx, 1, (RK_S32 *)out);\
|
||||
BitReadLog(bitctx, "%48s = %10d", ##__VA_ARGS__, *out);\
|
||||
if (bitctx->ret) { mpp_assert(0); goto __BITREAD_ERR; }\
|
||||
} while (0)
|
||||
#define READ_ONEBIT(bitctx, out, ...)\
|
||||
do {\
|
||||
RK_S32 _out;\
|
||||
bitctx->ret = mpp_read_bits(bitctx, 1, &_out);\
|
||||
BitReadLog(bitctx, "%48s = %10d", ##__VA_ARGS__, _out);\
|
||||
if (!bitctx->ret) { *out = _out; }\
|
||||
else { mpp_assert(0); goto __BITREAD_ERR;}\
|
||||
} while (0)
|
||||
|
||||
|
||||
|
||||
#define READ_UE(bitctx, out, ...)\
|
||||
do {\
|
||||
bitctx->ret = mpp_read_ue(bitctx, (RK_U32 *)out);\
|
||||
BitReadLog(bitctx, "%48s = %10d", ##__VA_ARGS__, *out);\
|
||||
if (bitctx->ret) { mpp_assert(0); goto __BITREAD_ERR; }\
|
||||
} while (0)
|
||||
#define READ_UE(bitctx, out, ...)\
|
||||
do {\
|
||||
RK_U32 _out;\
|
||||
bitctx->ret = mpp_read_ue(bitctx, &_out);\
|
||||
BitReadLog(bitctx, "%48s = %10d", ##__VA_ARGS__, _out);\
|
||||
if (!bitctx->ret) { *out = _out; }\
|
||||
else { mpp_assert(0); goto __BITREAD_ERR;}\
|
||||
} while (0)
|
||||
|
||||
#define READ_SE(bitctx, out, ...)\
|
||||
do {\
|
||||
bitctx->ret = mpp_read_se(bitctx, (RK_S32 *)out);\
|
||||
BitReadLog(bitctx, "%48s = %10d", ##__VA_ARGS__, *out);\
|
||||
if (bitctx->ret) { mpp_assert(0); goto __BITREAD_ERR; }\
|
||||
} while (0)
|
||||
#define READ_SE(bitctx, out, ...)\
|
||||
do {\
|
||||
RK_S32 _out;\
|
||||
bitctx->ret = mpp_read_se(bitctx, &_out);\
|
||||
BitReadLog(bitctx, "%48s = %10d", ##__VA_ARGS__, _out);\
|
||||
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.
|
||||
RK_U8 *data_;
|
||||
// Bytes left in the stream (without the curr_byte_).
|
||||
@@ -92,10 +100,10 @@ typedef struct bitread_ctx_t{
|
||||
RK_S32 used_bits;
|
||||
RK_U8 *buf;
|
||||
RK_S32 buf_len;
|
||||
// ctx
|
||||
MPP_RET ret;
|
||||
void *ctx;
|
||||
LOG_FUN wlog;
|
||||
// ctx
|
||||
MPP_RET ret;
|
||||
void *ctx;
|
||||
LOG_FUN wlog;
|
||||
} BitReadCtx_t;
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user