36 #include "libavutil/attributes.h"
63 const int64_t one = 1LL << 32;
72 for (i = 0; i < 128; i++) {
73 p8 = (256 * p + one / 2) >> 32;
76 if (last_p8 && last_p8 < 256 && p8 <= max_p)
79 p += ((one - p) * factor + one / 2) >> 32;
83 for (i = 256 - max_p; i <= max_p; i++) {
87 p = (i * one + 128) >> 8;
88 p += ((one - p) * factor + one / 2) >> 32;
89 p8 = (256 * p + one / 2) >> 32;
97 for (i = 1; i < 255; i++)
111 assert(c->
range >= 0x100);
119 #include "libavutil/lfg.h"
120 #include "libavutil/log.h"
136 memset(state, 128,
sizeof(state));
138 for (i = 0; i <
SIZE; i++)
141 for (i = 0; i <
SIZE; i++)
148 memset(state, 128,
sizeof(state));
150 for (i = 0; i <
SIZE; i++)
151 if ((r[i] & 1) !=
get_rac(&c, state)) {
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
int ff_rac_terminate(RangeCoder *c)
static int get_rac(RangeCoder *c, uint8_t *const state)
static unsigned int av_lfg_get(AVLFG *c)
Get the next random unsigned 32-bit number using an ALFG.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static void renorm_encoder(RangeCoder *c)
int main(int argc, char **argv)
Libavcodec external API header.
void ff_build_rac_states(RangeCoder *c, int factor, int max_p)
void av_lfg_init(AVLFG *c, unsigned int seed)
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)
uint8_t * bytestream_start