Go to the documentation of this file.
46 c->bytestream_end = buf + buf_size;
49 c->outstanding_count = 0;
50 c->outstanding_byte = -1;
62 if (
c->low >= 0xFF00) {
64 c->bytestream_end =
c->bytestream;
74 memset(
c->zero_state, 0,
sizeof(
c->zero_state));
75 memset(
c->one_state, 0,
sizeof(
c->one_state));
79 for (
i = 0;
i < 128;
i++) {
80 p8 = (256 * p + one / 2) >> 32;
83 if (last_p8 && last_p8 < 256 && p8 <= max_p)
84 c->one_state[last_p8] = p8;
86 p += ((one - p) *
factor + one / 2) >> 32;
90 for (
i = 256 - max_p;
i <= max_p;
i++) {
94 p = (
i * one + 128) >> 8;
95 p += ((one - p) *
factor + one / 2) >> 32;
96 p8 = (256 * p + one / 2) >> 32;
101 c->one_state[
i] = p8;
104 for (
i = 1;
i < 255;
i++)
105 c->zero_state[
i] = 256 -
c->one_state[256 -
i];
122 return c->bytestream -
c->bytestream_start;
av_cold void ff_init_range_encoder(RangeCoder *c, uint8_t *buf, int buf_size)
int ff_rac_terminate(RangeCoder *c, int version)
Terminates the range coder.
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
av_cold void ff_init_range_decoder(RangeCoder *c, const uint8_t *buf, int buf_size)
void ff_build_rac_states(RangeCoder *c, int factor, int max_p)
#define i(width, name, range_min, range_max)
static void renorm_encoder(RangeCoder *c)
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
static const int factor[16]
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16