Go to the documentation of this file.
26 #ifndef AVCODEC_VPX_RAC_H
27 #define AVCODEC_VPX_RAC_H
53 if (
c->end <=
c->buffer &&
c->bits >= 0)
55 return c->end_reached > 10;
62 unsigned int code_word =
c->code_word;
67 if(
bits >= 0 &&
c->buffer <
c->end) {
68 code_word |= bytestream_get_be16(&
c->buffer) <<
bits;
81 #ifndef vpx_rac_get_prob
82 #define vpx_rac_get_prob vpx_rac_get_prob
86 unsigned int low = 1 + (((
c->high - 1) *
prob) >> 8);
87 unsigned int low_shift = low << 16;
88 int bit = code_word >= low_shift;
90 c->high =
bit ?
c->high - low : low;
91 c->code_word =
bit ? code_word - low_shift : code_word;
97 #ifndef vpx_rac_get_prob_branchy
102 unsigned low = 1 + (((
c->high - 1) *
prob) >> 8);
103 unsigned low_shift = low << 16;
105 if (code_word >= low_shift) {
107 c->code_word = code_word - low_shift;
112 c->code_word = code_word;
121 int low = (
c->high + 1) >> 1;
122 unsigned int low_shift = low << 16;
123 int bit = code_word >= low_shift;
126 code_word -= low_shift;
131 c->code_word = code_word;
#define bit(string, value)
static av_always_inline unsigned int vpx_rac_renorm(VPXRangeCoder *c)
const uint8_t ff_vpx_norm_shift[256]
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
static int shift(int a, int b)
static av_always_inline int vpx_rac_is_end(VPXRangeCoder *c)
returns 1 if the end of the stream has been reached, 0 otherwise.
static av_always_inline int vpx_rac_get_prob_branchy(VPXRangeCoder *c, int prob)
#define prob(name, subs,...)
int ff_vpx_init_range_decoder(VPXRangeCoder *c, const uint8_t *buf, int buf_size)
static av_always_inline int vpx_rac_get(VPXRangeCoder *c)