66 const int64_t one = 1LL << 32;
75 for (i = 0; i < 128; i++) {
76 p8 = (256 * p + one / 2) >> 32;
79 if (last_p8 && last_p8 < 256 && p8 <= max_p)
82 p += ((one - p) * factor + one / 2) >> 32;
86 for (i = 256 - max_p; i <= max_p; i++) {
90 p = (i * one + 128) >> 8;
91 p += ((one - p) * factor + one / 2) >> 32;
92 p8 = (256 * p + one / 2) >> 32;
100 for (i = 1; i < 255; i++)
140 memset(state, 128,
sizeof(state));
142 for (i = 0; i <
SIZE; i++)
145 for (i = 0; i <
SIZE; i++)
152 memset(state, 128,
sizeof(state));
154 for (i = 0; i <
SIZE; i++)
155 if ((
r[i] & 1) !=
get_rac(&c, state)) {
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
Macro definitions for various function/variable attributes.
int ff_rac_terminate(RangeCoder *c)
static int get_rac(RangeCoder *c, uint8_t *const state)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static void renorm_encoder(RangeCoder *c)
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.
void ff_build_rac_states(RangeCoder *c, int factor, int max_p)
Libavcodec external API header.
static unsigned int av_lfg_get(AVLFG *c)
Get the next random unsigned 32-bit number using an ALFG.
av_cold void ff_init_range_encoder(RangeCoder *c, uint8_t *buf, int buf_size)
av_cold void ff_init_range_decoder(RangeCoder *c, const uint8_t *buf, int buf_size)
static const int factor[16]
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
uint8_t * bytestream_start
int main(int argc, char **argv)