Go to the documentation of this file.
23 #ifndef AVCODEC_OPUS_RC_H
24 #define AVCODEC_OPUS_RC_H
29 #define OPUS_MAX_PACKET_SIZE 1275
31 #define opus_ilog(i) (av_log2(i) + !!(i))
68 uint32_t
i, total_bits, rcbuffer, range;
72 range = rc->
range >> (rcbuffer-16);
74 for (
i = 0;
i < 3;
i++) {
76 range = range * range >> 15;
78 rcbuffer = rcbuffer << 1 |
bit;
82 return total_bits - rcbuffer;
112 #define OPUS_RC_CHECKPOINT_UPDATE(rc) \
113 rc_rollback_bits = opus_rc_tell_frac(rc); \
114 rc_rollback_ctx = *rc
116 #define OPUS_RC_CHECKPOINT_SPAWN(rc) \
117 uint32_t rc_rollback_bits = opus_rc_tell_frac(rc); \
118 OpusRangeCoder rc_rollback_ctx = *rc \
120 #define OPUS_RC_CHECKPOINT_BITS(rc) \
121 (opus_rc_tell_frac(rc) - rc_rollback_bits)
123 #define OPUS_RC_CHECKPOINT_ROLLBACK(rc) \
124 memcpy(rc, &rc_rollback_ctx, sizeof(OpusRangeCoder)); \
void ff_opus_rc_enc_laplace(OpusRangeCoder *rc, int *value, uint32_t symbol, int decay)
void ff_opus_rc_put_raw(OpusRangeCoder *rc, uint32_t val, uint32_t count)
CELT: write 0 - 31 bits to the rawbits buffer.
void ff_opus_rc_enc_init(OpusRangeCoder *rc)
uint32_t ff_opus_rc_dec_uint_step(OpusRangeCoder *rc, int k0)
static av_always_inline uint32_t opus_rc_tell(const OpusRangeCoder *rc)
CELT: estimate bits of entropy that have thus far been consumed for the current CELT frame,...
int ff_opus_rc_dec_init(OpusRangeCoder *rc, const uint8_t *data, int size)
#define bit(string, value)
void ff_opus_rc_enc_cdf(OpusRangeCoder *rc, int val, const uint16_t *cdf)
uint32_t ff_opus_rc_dec_cdf(OpusRangeCoder *rc, const uint16_t *cdf)
void ff_opus_rc_enc_uint_step(OpusRangeCoder *rc, uint32_t val, int k0)
static double val(void *priv, double ch)
int ff_opus_rc_dec_laplace(OpusRangeCoder *rc, uint32_t symbol, int decay)
uint32_t ff_opus_rc_get_raw(OpusRangeCoder *rc, uint32_t count)
CELT: read 1-25 raw bits at the end of the frame, backwards byte-wise.
void ff_opus_rc_dec_raw_init(OpusRangeCoder *rc, const uint8_t *rightend, uint32_t bytes)
uint32_t ff_opus_rc_dec_log(OpusRangeCoder *rc, uint32_t bits)
#define OPUS_MAX_PACKET_SIZE
void ff_opus_rc_enc_log(OpusRangeCoder *rc, int val, uint32_t bits)
void ff_opus_rc_enc_uint(OpusRangeCoder *rc, uint32_t val, uint32_t size)
CELT: write a uniformly distributed integer.
#define i(width, name, range_min, range_max)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
static av_always_inline uint32_t opus_rc_tell_frac(const OpusRangeCoder *rc)
void ff_opus_rc_enc_end(OpusRangeCoder *rc, uint8_t *dst, int size)
void ff_opus_rc_enc_uint_tri(OpusRangeCoder *rc, uint32_t k, int qn)
uint32_t ff_opus_rc_dec_uint_tri(OpusRangeCoder *rc, int qn)
uint32_t ff_opus_rc_dec_uint(OpusRangeCoder *rc, uint32_t size)
CELT: read a uniform distribution.
uint8_t buf[OPUS_MAX_PACKET_SIZE+12]