FFmpeg  4.0
Data Structures | Macros | Functions
opus_rc.h File Reference
#include <stdint.h>
#include "get_bits.h"

Go to the source code of this file.

Data Structures

struct  RawBitsContext
 
struct  OpusRangeCoder
 

Macros

#define OPUS_MAX_PACKET_SIZE   1275
 
#define opus_ilog(i)   (av_log2(i) + !!(i))
 
#define OPUS_RC_CHECKPOINT_UPDATE(rc)
 
#define OPUS_RC_CHECKPOINT_SPAWN(rc)
 
#define OPUS_RC_CHECKPOINT_BITS(rc)   (opus_rc_tell_frac(rc) - rc_rollback_bits)
 
#define OPUS_RC_CHECKPOINT_ROLLBACK(rc)   memcpy(rc, &rc_rollback_ctx, sizeof(OpusRangeCoder)); \
 

Functions

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, to integer and fractional (1/8th bit) precision. More...
 
static av_always_inline uint32_t opus_rc_tell_frac (const OpusRangeCoder *rc)
 
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_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)
 
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_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...
 
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_MAX_PACKET_SIZE

#define OPUS_MAX_PACKET_SIZE   1275

Definition at line 29 of file opus_rc.h.

Referenced by celt_gauge_psy_weight(), ff_opus_rc_enc_end(), and ff_opus_rc_enc_init().

◆ opus_ilog

#define opus_ilog (   i)    (av_log2(i) + !!(i))

◆ OPUS_RC_CHECKPOINT_UPDATE

#define OPUS_RC_CHECKPOINT_UPDATE (   rc)
Value:
rc_rollback_bits = opus_rc_tell_frac(rc); \
rc_rollback_ctx = *rc
static av_always_inline uint32_t opus_rc_tell_frac(const OpusRangeCoder *rc)
Definition: opus_rc.h:66

Definition at line 112 of file opus_rc.h.

◆ OPUS_RC_CHECKPOINT_SPAWN

#define OPUS_RC_CHECKPOINT_SPAWN (   rc)
Value:
uint32_t rc_rollback_bits = opus_rc_tell_frac(rc); \
OpusRangeCoder rc_rollback_ctx = *rc \
static av_always_inline uint32_t opus_rc_tell_frac(const OpusRangeCoder *rc)
Definition: opus_rc.h:66

Definition at line 116 of file opus_rc.h.

Referenced by celt_quant_coarse(), and pvq_band_cost().

◆ OPUS_RC_CHECKPOINT_BITS

#define OPUS_RC_CHECKPOINT_BITS (   rc)    (opus_rc_tell_frac(rc) - rc_rollback_bits)

Definition at line 120 of file opus_rc.h.

Referenced by celt_quant_coarse(), and pvq_band_cost().

◆ OPUS_RC_CHECKPOINT_ROLLBACK

#define OPUS_RC_CHECKPOINT_ROLLBACK (   rc)    memcpy(rc, &rc_rollback_ctx, sizeof(OpusRangeCoder)); \

Definition at line 123 of file opus_rc.h.

Referenced by celt_quant_coarse(), and pvq_band_cost().

Function Documentation

◆ opus_rc_tell()

static av_always_inline uint32_t opus_rc_tell ( const OpusRangeCoder rc)
static

CELT: estimate bits of entropy that have thus far been consumed for the current CELT frame, to integer and fractional (1/8th bit) precision.

Definition at line 61 of file opus_rc.h.

Referenced by celt_decode_coarse_energy(), celt_decode_final_energy(), celt_decode_tf_changes(), celt_enc_quant_pfilter(), celt_enc_tf(), celt_encode_frame(), celt_quant_final(), exp_quant_coarse(), ff_celt_bitalloc(), ff_celt_decode_frame(), opus_decode_frame(), and parse_postfilter().

◆ opus_rc_tell_frac()

static av_always_inline uint32_t opus_rc_tell_frac ( const OpusRangeCoder rc)
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 
)

◆ 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_dec_uint_step()

uint32_t ff_opus_rc_dec_uint_step ( OpusRangeCoder rc,
int  k0 
)

Definition at line 211 of file opus_rc.c.

Referenced by opus_rc_tell_frac(), and 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 opus_rc.c.

Referenced by opus_rc_tell_frac(), and 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 opus_rc.c.

Referenced by opus_rc_tell_frac(), and 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 opus_rc.c.

Referenced by opus_rc_tell_frac(), 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 opus_rc.c.

Referenced by celt_decode_pulses(), ff_celt_bitalloc(), opus_decode_frame(), opus_rc_tell_frac(), 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 opus_rc.c.

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

◆ 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 opus_rc.c.

Referenced by celt_decode_final_energy(), celt_decode_fine_energy(), ff_celt_decode_frame(), ff_opus_rc_dec_uint(), opus_rc_tell_frac(), 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 
)

◆ ff_opus_rc_dec_laplace()

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

Definition at line 275 of file opus_rc.c.

Referenced by celt_decode_coarse_energy(), and opus_rc_tell_frac().

◆ 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 opus_rc.c.

Referenced by exp_quant_coarse(), and opus_rc_tell_frac().

◆ 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 opus_rc.c.

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

◆ ff_opus_rc_dec_raw_init()

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

◆ ff_opus_rc_enc_end()

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

Definition at line 360 of file opus_rc.c.

Referenced by opus_packet_assembler(), and opus_rc_tell_frac().

◆ ff_opus_rc_enc_init()

void ff_opus_rc_enc_init ( OpusRangeCoder rc)

Definition at line 402 of file opus_rc.c.

Referenced by bands_dist(), celt_encode_frame(), and opus_rc_tell_frac().