Go to the documentation of this file.
   40     float prev[2] = { 0 };
 
   48         beta  = 1.0f - (4915.0f/32768.0f);
 
   53         for (j = 0; j < 
f->channels; j++) {
 
   58             if (i < f->start_band || 
i >= 
f->end_band) {
 
   70                 value = (x>>1) ^ -(x&1);
 
   76             prev[j] += beta * 
value;
 
   84     for (
i = 
f->start_band; i < f->end_band; 
i++) {
 
   89         for (j = 0; j < 
f->channels; j++) {
 
   94             offset = (q2 + 0.5f) * (1 << (14 - 
f->fine_bits[
i])) / 16384.0
f - 0.5
f;
 
  105     for (priority = 0; priority < 2; priority++) {
 
  106         for (
i = 
f->start_band; i < f->end_band && 
bits_left >= 
f->channels; 
i++) {
 
  110             for (j = 0; j < 
f->channels; j++) {
 
  114                 offset = (q2 - 0.5f) * (1 << (14 - 
f->fine_bits[
i] - 1)) / 16384.0
f;
 
  124     int i, 
diff = 0, tf_select = 0, tf_changed = 0, tf_select_bit;
 
  125     int consumed, 
bits = 
f->transient ? 2 : 4;
 
  128     tf_select_bit = (
f->size != 0 && consumed+
bits+1 <= 
f->framebits);
 
  130     for (
i = 
f->start_band; i < f->end_band; 
i++) {
 
  131         if (consumed+
bits+tf_select_bit <= f->framebits) {
 
  137         bits = 
f->transient ? 4 : 5;
 
  144     for (
i = 
f->start_band; i < f->end_band; 
i++) {
 
  153     for (
i = 
f->start_band; i < f->end_band; 
i++) {
 
  165     const int T0 = 
block->pf_period_old;
 
  166     const int T1 = 
block->pf_period;
 
  171     float x0, x1, x2, x3, x4;
 
  175     if (
block->pf_gains[0]     == 0.0 &&
 
  176         block->pf_gains_old[0] == 0.0)
 
  179     g00 = 
block->pf_gains_old[0];
 
  180     g01 = 
block->pf_gains_old[1];
 
  181     g02 = 
block->pf_gains_old[2];
 
  182     g10 = 
block->pf_gains[0];
 
  183     g11 = 
block->pf_gains[1];
 
  184     g12 = 
block->pf_gains[2];
 
  193         x0 = 
data[
i - T1 + 2];
 
  196                     (1.0 - 
w) * g01 * (
data[
i - T0 - 1] + 
data[
i - T0 + 1]) +
 
  197                     (1.0 - 
w) * g02 * (
data[
i - T0 - 2] + 
data[
i - T0 + 2]) +
 
  199                     w         * g11 * (x1 + x3)                             +
 
  210     int len = 
f->blocksize * 
f->blocks;
 
  224         if (
block->pf_gains[0] > FLT_EPSILON && filter_len > 0)
 
  240     memset(
f->block[0].pf_gains_new, 0, 
sizeof(
f->block[0].pf_gains_new));
 
  241     memset(
f->block[1].pf_gains_new, 0, 
sizeof(
f->block[1].pf_gains_new));
 
  243     if (
f->start_band == 0 && consumed + 16 <= 
f->framebits) {
 
  245         if (has_postfilter) {
 
  247             int tapset, octave, 
period;
 
  255             for (
i = 0; 
i < 2; 
i++) {
 
  275     for (
i = 
f->start_band; i < f->end_band; 
i++) {
 
  280         float thresh, sqrt_1;
 
  285         thresh = 
exp2f(-1.0 - 0.125
f * depth);
 
  290         prev[0] = 
block->prev_energy[0][
i];
 
  291         prev[1] = 
block->prev_energy[1][
i];
 
  292         if (
f->channels == 1) {
 
  298         Ediff = 
block->energy[
i] - 
FFMIN(prev[0], prev[1]);
 
  299         Ediff = 
FFMAX(0, Ediff);
 
  307         for (k = 0; k < 1 << 
f->size; k++) {
 
  309             if (!(
block->collapse_masks[
i] & 1 << k)) {
 
  312                     xptr[(j << 
f->size) + k] = (
celt_rng(
f) & 0x8000) ? 
r : -
r;
 
  325                          int start_band,  
int end_band)
 
  327     int i, j, downmix = 0;
 
  337     if (start_band < 0 || start_band > end_band || end_band > 
CELT_MAX_BANDS) {
 
  339                start_band, end_band);
 
  348     f->start_band     = start_band;
 
  349     f->end_band       = end_band;
 
  360     if (!
f->output_channels)
 
  363     for (
i = 0; 
i < 
f->channels; 
i++) {
 
  364         memset(
f->block[
i].coeffs,         0, 
sizeof(
f->block[
i].coeffs));
 
  365         memset(
f->block[
i].collapse_masks, 0, 
sizeof(
f->block[
i].collapse_masks));
 
  371     if (consumed >= 
f->framebits)
 
  373     else if (consumed == 1)
 
  378         consumed = 
f->framebits;
 
  386     if (
f->size != 0 && consumed+3 <= 
f->framebits)
 
  389     f->blocks    = 
f->transient ? 1 << 
f->size : 1;
 
  392     imdct = 
f->tx[
f->transient ? 0 : 
f->size];
 
  393     imdct_fn = 
f->tx_fn[
f->transient ? 0 : 
f->size];
 
  397             f->block[0].energy[
i] = 
FFMAX(
f->block[0].energy[
i], 
f->block[1].energy[
i]);
 
  406     if (
f->anticollapse_needed)
 
  413     for (
i = 0; 
i < 
f->channels; 
i++) {
 
  423     if (
f->output_channels < 
f->channels) {
 
  424         f->dsp->vector_fmac_scalar(
f->block[0].coeffs, 
f->block[1].coeffs, 1.0, 
FFALIGN(
frame_size, 16));
 
  426     } 
else if (
f->output_channels > 
f->channels)
 
  427         memcpy(
f->block[1].coeffs, 
f->block[0].coeffs, 
frame_size * 
sizeof(
float));
 
  430         for (
i = 0; 
i < 2; 
i++) {
 
  436         memset(
f->block[0].coeffs, 0, 
sizeof(
f->block[0].coeffs));
 
  437         memset(
f->block[1].coeffs, 0, 
sizeof(
f->block[1].coeffs));
 
  441     for (
i = 0; 
i < 
f->output_channels; 
i++) {
 
  445         for (j = 0; j < 
f->blocks; j++) {
 
  446             float *
dst  = 
block->buf + 1024 + j * 
f->blocksize;
 
  449                      sizeof(
float)*
f->blocks);
 
  469         memcpy(
f->block[1].energy, 
f->block[0].energy, 
sizeof(
f->block[0].energy));
 
  471     for (
i = 0; 
i < 2; 
i++ ) {
 
  475             memcpy(
block->prev_energy[1], 
block->prev_energy[0], 
sizeof(
block->prev_energy[0]));
 
  476             memcpy(
block->prev_energy[0], 
block->energy,         
sizeof(
block->prev_energy[0]));
 
  482         for (j = 0; j < 
f->start_band; j++) {
 
  484             block->energy[j]         = 0.0;
 
  488             block->energy[j]         = 0.0;
 
  504     for (
i = 0; 
i < 2; 
i++) {
 
  510         memset(
block->energy, 0, 
sizeof(
block->energy));
 
  513         memset(
block->pf_gains,     0, 
sizeof(
block->pf_gains));
 
  514         memset(
block->pf_gains_old, 0, 
sizeof(
block->pf_gains_old));
 
  515         memset(
block->pf_gains_new, 0, 
sizeof(
block->pf_gains_new));
 
  551     if (output_channels != 1 && output_channels != 2) {
 
  566         const float scale = -1.0f/32768;
 
  
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.
 
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
 
#define CELT_ENERGY_SILENCE
 
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,...
 
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce output
 
#define CELT_MAX_FINE_BITS
 
static av_always_inline void celt_renormalize_vector(float *X, int N, float gain)
 
void ff_celt_free(CeltFrame **f)
 
const float ff_opus_deemph_weights[]
 
av_cold int av_tx_init(AVTXContext **ctx, av_tx_fn *tx, enum AVTXType type, int inv, int len, const void *scale, uint64_t flags)
Initialize a transform context with the given configuration (i)MDCTs with an odd length are currently...
 
uint32_t ff_opus_rc_dec_uint(OpusRangeCoder *rc, uint32_t size)
CELT: read a uniform distribution.
 
int flags
AV_CODEC_FLAG_*.
 
const uint16_t ff_celt_model_tapset[]
 
static av_always_inline uint32_t celt_rng(CeltFrame *f)
 
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
 
#define FF_ARRAY_ELEMS(a)
 
const float ff_celt_postfilter_taps[3][3]
 
void(* av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride)
Function pointer to a function to perform the transform.
 
@ AV_TX_FLOAT_MDCT
Standard MDCT with a sample data type of float, double or int32_t, respecively.
 
static void celt_postfilter(CeltFrame *f, CeltBlock *block)
 
void av_cold ff_celt_pvq_uninit(CeltPVQ **pvq)
 
const int8_t ff_celt_tf_select[4][2][2][2]
 
const uint8_t ff_celt_freq_range[]
 
void ff_celt_flush(CeltFrame *f)
 
static void celt_decode_final_energy(CeltFrame *f, OpusRangeCoder *rc)
 
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 minimum maximum flags name is the option keep it simple and lowercase description are in without period
 
uint32_t ff_opus_rc_dec_log(OpusRangeCoder *rc, uint32_t bits)
 
static __device__ float sqrtf(float a)
 
#define CELT_POSTFILTER_MINPERIOD
 
const uint8_t ff_celt_coarse_energy_dist[4][2][42]
 
const float ff_celt_beta_coef[]
 
#define CELT_MAX_LOG_BLOCKS
 
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
 
static const float *const ff_celt_window
 
av_cold void ff_opus_dsp_init(OpusDSP *ctx)
 
int ff_celt_init(AVCodecContext *avctx, CeltFrame **f, int output_channels, int apply_phase_inv)
 
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)
 
static int16_t block1[64]
 
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 offset
 
void ff_celt_quant_bands(CeltFrame *f, OpusRangeCoder *rc)
 
uint32_t ff_opus_rc_dec_cdf(OpusRangeCoder *rc, const uint16_t *cdf)
 
av_cold void av_tx_uninit(AVTXContext **ctx)
Frees a context and sets *ctx to NULL, does nothing when *ctx == NULL.
 
static void celt_decode_tf_changes(CeltFrame *f, OpusRangeCoder *rc)
 
#define i(width, name, range_min, range_max)
 
static void celt_decode_fine_energy(CeltFrame *f, OpusRangeCoder *rc)
 
#define CELT_SHORT_BLOCKSIZE
 
int ff_opus_rc_dec_laplace(OpusRangeCoder *rc, uint32_t symbol, int decay)
 
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
 
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
 
static void celt_decode_coarse_energy(CeltFrame *f, OpusRangeCoder *rc)
 
const uint16_t ff_celt_model_energy_small[]
 
void ff_celt_bitalloc(CeltFrame *f, OpusRangeCoder *rc, int encode)
 
static void celt_denormalize(CeltFrame *f, CeltBlock *block, float *data)
 
main external API structure.
 
const float ff_celt_alpha_coef[]
 
static void celt_postfilter_apply_transition(CeltBlock *block, float *data)
 
int ff_celt_decode_frame(CeltFrame *f, OpusRangeCoder *rc, float **output, int channels, int frame_size, int start_band, int end_band)
 
const float ff_celt_mean_energy[]
 
#define AV_CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
 
static void scale(int *out, const int *in, const int w, const int h, const int shift)
 
static const int16_t alpha[]
 
av_cold AVFloatDSPContext * avpriv_float_dsp_alloc(int bit_exact)
Allocate a float DSP context.
 
int av_cold ff_celt_pvq_init(CeltPVQ **pvq, int encode)
 
The exact code depends on how similar the blocks are and how related they are to the block
 
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
 
static void process_anticollapse(CeltFrame *f, CeltBlock *block, float *X)
 
const uint8_t ff_celt_freq_bands[]
 
static int parse_postfilter(CeltFrame *f, OpusRangeCoder *rc, int consumed)
 
const float ff_celt_window2[120]