27#ifndef AVCODEC_RANGECODER_H
28#define AVCODEC_RANGECODER_H
64 if (
c->low - 0xFF01 >= 0x10000 - 0xFF01U) {
65 int mask =
c->low - 0xFF01 >> 31;
66 *
c->bytestream =
c->outstanding_byte + 1 +
mask;
67 c->bytestream +=
c->outstanding_byte >= 0;
68 for (;
c->outstanding_count;
c->outstanding_count--)
69 *
c->bytestream++ =
mask;
70 c->outstanding_byte =
c->low >> 8;
72 c->outstanding_count++;
75 c->low = (
c->low & 0xFF) << 8;
81 int x =
c->bytestream -
c->bytestream_start +
c->outstanding_count;
82 if (
c->outstanding_byte >= 0)
89 int range1 = (
c->range * (*state)) >> 8;
98 c->low +=
c->range - range1;
103 if (
c->range < 0x100)
111 if (
c->bytestream <
c->bytestream_end) {
112 c->low +=
c->bytestream[0];
120 int range1 = (
c->range * (*state)) >> 8;
123 if (
c->low <
c->range) {
125 if (
c->range < 0x100)
132 if (
c->range < 0x100)
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
#define bit(string, value)
static struct @346255127015250356166251341105367306144006377143 state
static const int factor[16]
static const uint16_t mask[17]
int ff_rac_terminate(RangeCoder *c, int version)
Terminates the range coder.
static void renorm_encoder(RangeCoder *c)
void ff_init_range_decoder(RangeCoder *c, const uint8_t *buf, int buf_size)
static void refill(RangeCoder *c)
static int get_rac_count(RangeCoder *c)
static int get_rac(RangeCoder *c, uint8_t *const state)
void ff_init_range_encoder(RangeCoder *c, uint8_t *buf, int buf_size)
void ff_build_rac_states(RangeCoder *c, int factor, int max_p)
uint8_t * bytestream_start