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;
Macro definitions for various function/variable attributes.
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
Libavcodec external API header.
int ff_rac_terminate(RangeCoder *c, int version)
Terminates the range coder.
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)
av_cold void ff_init_range_encoder(RangeCoder *c, uint8_t *buf, int buf_size)
static void renorm_encoder(RangeCoder *c)
static const int factor[16]