FFmpeg
Macros | Functions
rc.c File Reference
#include "rc.h"

Go to the source code of this file.

Macros

#define OPUS_RC_BITS   32
 
#define OPUS_RC_SYM   8
 
#define OPUS_RC_CEIL   ((1 << OPUS_RC_SYM) - 1)
 
#define OPUS_RC_TOP   (1u << 31)
 
#define OPUS_RC_BOT   (OPUS_RC_TOP >> OPUS_RC_SYM)
 
#define OPUS_RC_SHIFT   (OPUS_RC_BITS - OPUS_RC_SYM - 1)
 

Functions

static av_always_inline void opus_rc_enc_carryout (OpusRangeCoder *rc, int cbuf)
 
static av_always_inline void opus_rc_dec_normalize (OpusRangeCoder *rc)
 
static av_always_inline void opus_rc_enc_normalize (OpusRangeCoder *rc)
 
static av_always_inline void opus_rc_dec_update (OpusRangeCoder *rc, uint32_t scale, uint32_t low, uint32_t high, uint32_t total)
 
static av_always_inline void opus_rc_enc_update (OpusRangeCoder *rc, uint32_t b, uint32_t p, uint32_t p_tot, const int ptwo)
 
uint32_t ff_opus_rc_dec_cdf (OpusRangeCoder *rc, const uint16_t *cdf)
 
void ff_opus_rc_enc_cdf (OpusRangeCoder *rc, int val, const uint16_t *cdf)
 
uint32_t ff_opus_rc_dec_log (OpusRangeCoder *rc, uint32_t bits)
 
void ff_opus_rc_enc_log (OpusRangeCoder *rc, int val, uint32_t bits)
 
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. More...
 
void ff_opus_rc_put_raw (OpusRangeCoder *rc, uint32_t val, uint32_t count)
 CELT: write 0 - 31 bits to the rawbits buffer. More...
 
uint32_t ff_opus_rc_dec_uint (OpusRangeCoder *rc, uint32_t size)
 CELT: read a uniform distribution. More...
 
void ff_opus_rc_enc_uint (OpusRangeCoder *rc, uint32_t val, uint32_t size)
 CELT: write a uniformly distributed integer. More...
 
uint32_t ff_opus_rc_dec_uint_step (OpusRangeCoder *rc, int k0)
 
void ff_opus_rc_enc_uint_step (OpusRangeCoder *rc, uint32_t val, int k0)
 
uint32_t ff_opus_rc_dec_uint_tri (OpusRangeCoder *rc, int qn)
 
void ff_opus_rc_enc_uint_tri (OpusRangeCoder *rc, uint32_t k, int qn)
 
int ff_opus_rc_dec_laplace (OpusRangeCoder *rc, uint32_t symbol, int decay)
 
void ff_opus_rc_enc_laplace (OpusRangeCoder *rc, int *value, uint32_t symbol, int decay)
 
int ff_opus_rc_dec_init (OpusRangeCoder *rc, const uint8_t *data, int size)
 
void ff_opus_rc_dec_raw_init (OpusRangeCoder *rc, const uint8_t *rightend, uint32_t bytes)
 
void ff_opus_rc_enc_end (OpusRangeCoder *rc, uint8_t *dst, int size)
 
void ff_opus_rc_enc_init (OpusRangeCoder *rc)
 

Macro Definition Documentation

◆ OPUS_RC_BITS

#define OPUS_RC_BITS   32

Definition at line 25 of file rc.c.

◆ OPUS_RC_SYM

#define OPUS_RC_SYM   8

Definition at line 26 of file rc.c.

◆ OPUS_RC_CEIL

#define OPUS_RC_CEIL   ((1 << OPUS_RC_SYM) - 1)

Definition at line 27 of file rc.c.

◆ OPUS_RC_TOP

#define OPUS_RC_TOP   (1u << 31)

Definition at line 28 of file rc.c.

◆ OPUS_RC_BOT

#define OPUS_RC_BOT   (OPUS_RC_TOP >> OPUS_RC_SYM)

Definition at line 29 of file rc.c.

◆ OPUS_RC_SHIFT

#define OPUS_RC_SHIFT   (OPUS_RC_BITS - OPUS_RC_SYM - 1)

Definition at line 30 of file rc.c.

Function Documentation

◆ opus_rc_enc_carryout()

static av_always_inline void opus_rc_enc_carryout ( OpusRangeCoder rc,
int  cbuf 
)
static

Definition at line 32 of file rc.c.

Referenced by ff_opus_rc_enc_end(), and opus_rc_enc_normalize().

◆ opus_rc_dec_normalize()

static av_always_inline void opus_rc_dec_normalize ( OpusRangeCoder rc)
static

Definition at line 47 of file rc.c.

Referenced by ff_opus_rc_dec_init(), ff_opus_rc_dec_log(), and opus_rc_dec_update().

◆ opus_rc_enc_normalize()

static av_always_inline void opus_rc_enc_normalize ( OpusRangeCoder rc)
static

Definition at line 56 of file rc.c.

Referenced by opus_rc_enc_update().

◆ opus_rc_dec_update()

static av_always_inline void opus_rc_dec_update ( OpusRangeCoder rc,
uint32_t  scale,
uint32_t  low,
uint32_t  high,
uint32_t  total 
)
static

◆ opus_rc_enc_update()

static av_always_inline void opus_rc_enc_update ( OpusRangeCoder rc,
uint32_t  b,
uint32_t  p,
uint32_t  p_tot,
const int  ptwo 
)
static

◆ ff_opus_rc_dec_cdf()

uint32_t ff_opus_rc_dec_cdf ( OpusRangeCoder rc,
const uint16_t *  cdf 
)

◆ ff_opus_rc_enc_cdf()

void ff_opus_rc_enc_cdf ( OpusRangeCoder rc,
int  val,
const uint16_t *  cdf 
)

Definition at line 109 of file rc.c.

Referenced by celt_enc_quant_pfilter(), exp_quant_coarse(), and ff_celt_bitalloc().

◆ ff_opus_rc_dec_log()

uint32_t ff_opus_rc_dec_log ( OpusRangeCoder rc,
uint32_t  bits 
)

◆ ff_opus_rc_enc_log()

void ff_opus_rc_enc_log ( OpusRangeCoder rc,
int  val,
uint32_t  bits 
)

◆ ff_opus_rc_get_raw()

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.

Definition at line 140 of file rc.c.

Referenced by celt_decode_final_energy(), celt_decode_fine_energy(), ff_celt_decode_frame(), ff_opus_rc_dec_uint(), parse_postfilter(), and quant_band_template().

◆ ff_opus_rc_put_raw()

void ff_opus_rc_put_raw ( OpusRangeCoder rc,
uint32_t  val,
uint32_t  count 
)

CELT: write 0 - 31 bits to the rawbits buffer.

Definition at line 161 of file rc.c.

Referenced by celt_enc_quant_pfilter(), celt_encode_frame(), celt_quant_final(), celt_quant_fine(), ff_opus_rc_enc_end(), ff_opus_rc_enc_uint(), and quant_band_template().

◆ ff_opus_rc_dec_uint()

uint32_t ff_opus_rc_dec_uint ( OpusRangeCoder rc,
uint32_t  size 
)

CELT: read a uniform distribution.

Definition at line 182 of file rc.c.

Referenced by celt_decode_pulses(), ff_celt_bitalloc(), opus_decode_frame(), parse_postfilter(), and quant_band_template().

◆ ff_opus_rc_enc_uint()

void ff_opus_rc_enc_uint ( OpusRangeCoder rc,
uint32_t  val,
uint32_t  size 
)

CELT: write a uniformly distributed integer.

Definition at line 204 of file rc.c.

Referenced by celt_enc_quant_pfilter(), celt_encode_pulses(), ff_celt_bitalloc(), and quant_band_template().

◆ ff_opus_rc_dec_uint_step()

uint32_t ff_opus_rc_dec_uint_step ( OpusRangeCoder rc,
int  k0 
)

Definition at line 211 of file rc.c.

Referenced by quant_band_template().

◆ ff_opus_rc_enc_uint_step()

void ff_opus_rc_enc_uint_step ( OpusRangeCoder rc,
uint32_t  val,
int  k0 
)

Definition at line 226 of file rc.c.

Referenced by quant_band_template().

◆ ff_opus_rc_dec_uint_tri()

uint32_t ff_opus_rc_dec_uint_tri ( OpusRangeCoder rc,
int  qn 
)

Definition at line 234 of file rc.c.

Referenced by quant_band_template().

◆ ff_opus_rc_enc_uint_tri()

void ff_opus_rc_enc_uint_tri ( OpusRangeCoder rc,
uint32_t  k,
int  qn 
)

Definition at line 258 of file rc.c.

Referenced by quant_band_template().

◆ ff_opus_rc_dec_laplace()

int ff_opus_rc_dec_laplace ( OpusRangeCoder rc,
uint32_t  symbol,
int  decay 
)

Definition at line 275 of file rc.c.

Referenced by celt_decode_coarse_energy().

◆ ff_opus_rc_enc_laplace()

void ff_opus_rc_enc_laplace ( OpusRangeCoder rc,
int *  value,
uint32_t  symbol,
int  decay 
)

Definition at line 314 of file rc.c.

Referenced by exp_quant_coarse().

◆ ff_opus_rc_dec_init()

int ff_opus_rc_dec_init ( OpusRangeCoder rc,
const uint8_t *  data,
int  size 
)

Definition at line 338 of file rc.c.

Referenced by opus_decode_frame(), and opus_decode_redundancy().

◆ ff_opus_rc_dec_raw_init()

void ff_opus_rc_dec_raw_init ( OpusRangeCoder rc,
const uint8_t *  rightend,
uint32_t  bytes 
)

Definition at line 352 of file rc.c.

Referenced by ff_opus_rc_enc_init(), opus_decode_frame(), and opus_decode_redundancy().

◆ ff_opus_rc_enc_end()

void ff_opus_rc_enc_end ( OpusRangeCoder rc,
uint8_t *  dst,
int  size 
)

Definition at line 360 of file rc.c.

Referenced by opus_packet_assembler().

◆ ff_opus_rc_enc_init()

void ff_opus_rc_enc_init ( OpusRangeCoder rc)

Definition at line 402 of file rc.c.

Referenced by bands_dist(), and celt_encode_frame().