27 #ifndef AVCODEC_CABAC_FUNCTIONS_H
28 #define AVCODEC_CABAC_FUNCTIONS_H
36 #ifndef UNCHECKED_BITSTREAM_READER
37 #define UNCHECKED_BITSTREAM_READER !CONFIG_SAFE_BITSTREAM_READER
58 #if !defined(get_cabac_bypass) || !defined(get_cabac_terminate)
61 c->low+= (
c->bytestream[0]<<9) + (
c->bytestream[1]<<1);
63 c->low+=
c->bytestream[0]<<1;
66 #if !UNCHECKED_BITSTREAM_READER
67 if (
c->bytestream <
c->bytestream_end)
73 #ifndef get_cabac_terminate
75 int shift= (uint32_t)(
c->range - 0x100)>>31;
83 #ifndef get_cabac_inline
88 x=
c->low ^ (
c->low-1);
97 x+= (
c->bytestream[0]<<9) + (
c->bytestream[1]<<1);
99 x+=
c->bytestream[0]<<1;
103 #if !UNCHECKED_BITSTREAM_READER
104 if (
c->bytestream <
c->bytestream_end)
110 #ifndef get_cabac_inline
116 c->range -= RangeLPS;
120 c->range += (RangeLPS -
c->range) & lps_mask;
127 c->range<<= lps_mask;
143 #ifndef get_cabac_bypass
161 #ifndef get_cabac_bypass_sign
181 #ifndef get_cabac_terminate
188 return c->bytestream -
c->bytestream_start;
207 if ((
int) (
c->bytestream_end - ptr) < n)
static double val(void *priv, double ch)
int ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size)
#define H264_LAST_COEFF_FLAG_OFFSET_8x8_OFFSET
#define H264_LPS_RANGE_OFFSET
#define H264_MLPS_STATE_OFFSET
#define H264_NORM_SHIFT_OFFSET
const uint8_t ff_h264_cabac_tables[512+4 *2 *64+4 *64+63]
static int av_unused get_cabac(CABACContext *c, uint8_t *const state)
static void refill(CABACContext *c)
static void refill2(CABACContext *c)
static void renorm_cabac_decoder_once(CABACContext *c)
static const uint8_t *const ff_h264_last_coeff_flag_offset_8x8
static const uint8_t *const ff_h264_norm_shift
static int av_noinline av_unused get_cabac_noinline(CABACContext *c, uint8_t *const state)
static av_always_inline int get_cabac_bypass_sign(CABACContext *c, int val)
static const uint8_t *const ff_h264_lps_range
static av_always_inline int get_cabac_inline(CABACContext *c, uint8_t *const state)
static int av_unused get_cabac_bypass(CABACContext *c)
static av_unused const uint8_t * skip_bytes(CABACContext *c, int n)
Skip n bytes and reset the decoder.
static const uint8_t *const ff_h264_mlps_state
static int av_unused get_cabac_terminate(CABACContext *c)
#define bit(string, value)
static const uint16_t mask[17]
static int shift(int a, int b)