FFmpeg
Loading...
Searching...
No Matches
aaccoder.c
Go to the documentation of this file.
1/*
2 * AAC coefficients encoder
3 * Copyright (C) 2008-2009 Konstantin Shishkov
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22/**
23 * @file
24 * AAC coefficients encoder
25 */
26
27/***********************************
28 * TODOs:
29 * speedup quantizer selection
30 * add sane pulse detection
31 ***********************************/
32
33#include <math.h> // brought forward to work around cygwin header breakage
34
35#include <float.h>
36
38#include "mathops.h"
39#include "avcodec.h"
40#include "put_bits.h"
41#include "aac.h"
42#include "aacenc.h"
43#include "aactab.h"
44#include "aacenctab.h"
45#include "aacenc_utils.h"
46#include "aacenc_quantization.h"
47
48#include "aacenc_is.h"
49#include "aacenc_tns.h"
50
52
53/* Parameter of f(x) = a*(lambda/100), defines the maximum fourier spread
54 * beyond which no PNS is used (since the SFBs contain tone rather than noise) */
55#define NOISE_SPREAD_THRESHOLD 0.9f
56
57/* Parameter of f(x) = a*(100/lambda), defines how much PNS is allowed to
58 * replace low energy non zero bands */
59#define NOISE_LAMBDA_REPLACE 1.948f
60
63
64/* c * cbrtf(c), the reconstruction of every escape magnitude c */
65static float esc_pow43[1 << 13];
66
68{
69 for (int c = 0; c < FF_ARRAY_ELEMS(esc_pow43); c++)
70 esc_pow43[c] = c * cbrtf(c);
71}
72
74 const float *in, float *quant, const float *scaled,
75 int size, int scale_idx, int cb,
76 const float lambda, const float uplim,
77 int *bits, float *energy);
78
79/**
80 * Calculate rate distortion cost for quantizing with given codebook
81 *
82 * @return quantization distortion
83 */
85 struct AACEncContext *s,
86 PutBitContext *pb, const float *in, float *out,
87 const float *scaled, int size, int scale_idx,
88 int cb, const float lambda, const float uplim,
89 int *bits, float *energy, int BT_ZERO, int BT_UNSIGNED,
90 int BT_PAIR, int BT_ESC, int BT_NOISE, int BT_STEREO,
91 const float ROUNDING)
92{
93 const int q_idx = POW_SF2_ZERO - scale_idx + SCALE_ONE_POS - SCALE_DIV_512;
94 const float Q = ff_aac_pow2sf_tab [q_idx];
95 const float Q34 = ff_aac_pow34sf_tab[q_idx];
96 const float IQ = ff_aac_pow2sf_tab [POW_SF2_ZERO + scale_idx - SCALE_ONE_POS + SCALE_DIV_512];
97 const float CLIPPED_ESCAPE = 165140.0f*IQ;
98 float cost = 0;
99 float qenergy = 0;
100 const int dim = BT_PAIR ? 2 : 4;
101 int resbits = 0;
102 int off;
103
104 if (BT_ZERO || BT_NOISE || BT_STEREO) {
105 for (int i = 0; i < size; i++)
106 cost += in[i]*in[i];
107 if (bits)
108 *bits = 0;
109 if (energy)
110 *energy = qenergy;
111 if (out) {
112 for (int i = 0; i < size; i += dim)
113 for (int j = 0; j < dim; j++)
114 out[i+j] = 0.0f;
115 }
116 return cost * lambda;
117 }
118 if (!scaled) {
119 s->aacdsp.abs_pow34(s->scoefs, in, size);
120 scaled = s->scoefs;
121 }
122 s->aacdsp.quant_bands(s->qcoefs, in, scaled, size, !BT_UNSIGNED, aac_cb_maxval[cb], Q34, ROUNDING);
123 if (BT_UNSIGNED) {
124 off = 0;
125 } else {
126 off = aac_cb_maxval[cb];
127 }
128 for (int i = 0; i < size; i += dim) {
129 const float *vec;
130 int *quants = s->qcoefs + i;
131 int curidx = 0;
132 int curbits;
133 float quantized, rd = 0.0f;
134 for (int j = 0; j < dim; j++) {
135 curidx *= aac_cb_range[cb];
136 curidx += quants[j] + off;
137 }
138 curbits = ff_aac_spectral_bits[cb-1][curidx];
139 vec = &ff_aac_codebook_vectors[cb-1][curidx*dim];
140 if (BT_UNSIGNED) {
141 for (int j = 0; j < dim; j++) {
142 float t = fabsf(in[i+j]);
143 float di;
144 if (BT_ESC && vec[j] == 64.0f) { //FIXME: slow
145 if (t >= CLIPPED_ESCAPE) {
146 quantized = CLIPPED_ESCAPE;
147 curbits += 21;
148 } else {
149 int c = av_clip_uintp2(quant(t, Q, ROUNDING), 13);
150 quantized = esc_pow43[c]*IQ;
151 curbits += av_log2(c)*2 - 4 + 1;
152 }
153 } else {
154 quantized = vec[j]*IQ;
155 }
156 di = t - quantized;
157 if (out)
158 out[i+j] = in[i+j] >= 0 ? quantized : -quantized;
159 if (vec[j] != 0.0f)
160 curbits++;
161 qenergy += quantized*quantized;
162 rd += di*di;
163 }
164 } else {
165 for (int j = 0; j < dim; j++) {
166 quantized = vec[j]*IQ;
167 qenergy += quantized*quantized;
168 if (out)
169 out[i+j] = quantized;
170 rd += (in[i+j] - quantized)*(in[i+j] - quantized);
171 }
172 }
173 cost += rd * lambda + curbits;
174 resbits += curbits;
175 if (cost >= uplim)
176 return uplim;
177 if (pb) {
179 if (BT_UNSIGNED)
180 for (int j = 0; j < dim; j++)
181 if (ff_aac_codebook_vectors[cb-1][curidx*dim+j] != 0.0f)
182 put_bits(pb, 1, in[i+j] < 0.0f);
183 if (BT_ESC) {
184 for (int j = 0; j < 2; j++) {
185 if (ff_aac_codebook_vectors[cb-1][curidx*2+j] == 64.0f) {
186 int coef = av_clip(quant(fabsf(in[i+j]), Q, ROUNDING), 16, (1 << 13) - 1);
187 int len = av_log2(coef);
188
189 put_bits(pb, len - 4 + 1, (1 << (len - 4 + 1)) - 2);
190 put_sbits(pb, len, coef);
191 }
192 }
193 }
194 }
195 }
196
197 if (bits)
198 *bits = resbits;
199 if (energy)
200 *energy = qenergy;
201 return cost;
202}
203
205 const float *in, float *quant, const float *scaled,
206 int size, int scale_idx, int cb,
207 const float lambda, const float uplim,
208 int *bits, float *energy) {
209 av_assert0(0);
210 return 0.0f;
211}
212
213#define QUANTIZE_AND_ENCODE_BAND_COST_FUNC(NAME, BT_ZERO, BT_UNSIGNED, BT_PAIR, BT_ESC, BT_NOISE, BT_STEREO, ROUNDING) \
214static float quantize_and_encode_band_cost_ ## NAME( \
215 struct AACEncContext *s, \
216 PutBitContext *pb, const float *in, float *quant, \
217 const float *scaled, int size, int scale_idx, \
218 int cb, const float lambda, const float uplim, \
219 int *bits, float *energy) { \
220 return quantize_and_encode_band_cost_template( \
221 s, pb, in, quant, scaled, size, scale_idx, \
222 BT_ESC ? ESC_BT : cb, lambda, uplim, bits, energy, \
223 BT_ZERO, BT_UNSIGNED, BT_PAIR, BT_ESC, BT_NOISE, BT_STEREO, \
224 ROUNDING); \
225}
226
233QUANTIZE_AND_ENCODE_BAND_COST_FUNC(ESC_RTZ, 0, 1, 1, 1, 0, 0, ROUND_TO_ZERO)
236
238{
239 quantize_and_encode_band_cost_ZERO,
240 quantize_and_encode_band_cost_SQUAD,
241 quantize_and_encode_band_cost_SQUAD,
242 quantize_and_encode_band_cost_UQUAD,
243 quantize_and_encode_band_cost_UQUAD,
244 quantize_and_encode_band_cost_SPAIR,
245 quantize_and_encode_band_cost_SPAIR,
246 quantize_and_encode_band_cost_UPAIR,
247 quantize_and_encode_band_cost_UPAIR,
248 quantize_and_encode_band_cost_UPAIR,
249 quantize_and_encode_band_cost_UPAIR,
250 quantize_and_encode_band_cost_ESC,
251 quantize_and_encode_band_cost_NONE, /* CB 12 doesn't exist */
252 quantize_and_encode_band_cost_NOISE,
253 quantize_and_encode_band_cost_STEREO,
254 quantize_and_encode_band_cost_STEREO,
255};
256
258{
259 quantize_and_encode_band_cost_ZERO,
260 quantize_and_encode_band_cost_SQUAD,
261 quantize_and_encode_band_cost_SQUAD,
262 quantize_and_encode_band_cost_UQUAD,
263 quantize_and_encode_band_cost_UQUAD,
264 quantize_and_encode_band_cost_SPAIR,
265 quantize_and_encode_band_cost_SPAIR,
266 quantize_and_encode_band_cost_UPAIR,
267 quantize_and_encode_band_cost_UPAIR,
268 quantize_and_encode_band_cost_UPAIR,
269 quantize_and_encode_band_cost_UPAIR,
270 quantize_and_encode_band_cost_ESC_RTZ,
271 quantize_and_encode_band_cost_NONE, /* CB 12 doesn't exist */
272 quantize_and_encode_band_cost_NOISE,
273 quantize_and_encode_band_cost_STEREO,
274 quantize_and_encode_band_cost_STEREO,
275};
276
278 const float *in, float *quant, const float *scaled,
279 int size, int scale_idx, int cb,
280 const float lambda, const float uplim,
281 int *bits, float *energy)
282{
283 return quantize_and_encode_band_cost_arr[cb](s, pb, in, quant, scaled, size,
284 scale_idx, cb, lambda, uplim,
285 bits, energy);
286}
287
289 const float *in, float *out, int size, int scale_idx,
290 int cb, const float lambda, int rtz)
291{
294}
295
296/**
297 * structure used in optimal codebook search
298 */
299typedef struct BandCodingPath {
300 int prev_idx; ///< pointer to the previous path point
301 float cost; ///< path cost
302 int run;
304
305typedef struct TrellisPath {
306 float cost;
307 int prev;
309
310#define TRELLIS_STAGES 121
311#define TRELLIS_STATES (SCALE_MAX_DIFF+1)
312
314{
315 int w, g;
316 int prevscaler_n = -255, prevscaler_i = 0;
317 int bands = 0;
318
319 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
320 for (g = 0; g < sce->ics.num_swb; g++) {
321 if (sce->zeroes[w*16+g])
322 continue;
323 if (sce->band_type[w*16+g] == INTENSITY_BT || sce->band_type[w*16+g] == INTENSITY_BT2) {
324 sce->sf_idx[w*16+g] = av_clip(roundf(log2f(sce->is_ener[w*16+g])*2), -155, 100);
325 bands++;
326 } else if (sce->band_type[w*16+g] == NOISE_BT) {
327 sce->sf_idx[w*16+g] = av_clip(3+ceilf(log2f(sce->pns_ener[w*16+g])*2), -100, 155);
328 if (prevscaler_n == -255)
329 prevscaler_n = sce->sf_idx[w*16+g];
330 bands++;
331 }
332 }
333 }
334
335 if (!bands)
336 return;
337
338 /* Clip the scalefactor indices */
339 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
340 for (g = 0; g < sce->ics.num_swb; g++) {
341 if (sce->zeroes[w*16+g])
342 continue;
343 if (sce->band_type[w*16+g] == INTENSITY_BT || sce->band_type[w*16+g] == INTENSITY_BT2) {
344 sce->sf_idx[w*16+g] = prevscaler_i = av_clip(sce->sf_idx[w*16+g], prevscaler_i - SCALE_MAX_DIFF, prevscaler_i + SCALE_MAX_DIFF);
345 } else if (sce->band_type[w*16+g] == NOISE_BT) {
346 sce->sf_idx[w*16+g] = prevscaler_n = av_clip(sce->sf_idx[w*16+g], prevscaler_n - SCALE_MAX_DIFF, prevscaler_n + SCALE_MAX_DIFF);
347 }
348 }
349 }
350}
351
354 const float lambda)
355{
356 int start = 0, i, w, w2, g;
357 int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->ch_layout.nb_channels * (lambda / 120.f);
358 float dists[128] = { 0 }, uplims[128] = { 0 };
359 float maxvals[128];
360 int fflag, minscaler;
361 int its = 0;
362 int allz = 0;
363 float minthr = INFINITY;
364
365 // for values above this the decoder might end up in an endless loop
366 // due to always having more bits than what can be encoded.
367 destbits = FFMIN(destbits, 5800);
368 //some heuristic to determine initial quantizers will reduce search time
369 //determine zero bands and upper limits
370 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
371 start = 0;
372 for (g = 0; g < sce->ics.num_swb; g++) {
373 int nz = 0;
374 float uplim = 0.0f;
375 for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
376 FFPsyBand *band = &s->psy.ch[s->cur_channel].psy_bands[(w+w2)*16+g];
377 uplim += band->threshold;
378 if (band->energy <= band->threshold || band->threshold == 0.0f) {
379 sce->zeroes[(w+w2)*16+g] = 1;
380 continue;
381 }
382 nz = 1;
383 }
384 uplims[w*16+g] = uplim *512;
385 sce->band_type[w*16+g] = 0;
386 sce->zeroes[w*16+g] = !nz;
387 if (nz)
388 minthr = FFMIN(minthr, uplim);
389 allz |= nz;
390 start += sce->ics.swb_sizes[g];
391 }
392 }
393 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
394 for (g = 0; g < sce->ics.num_swb; g++) {
395 if (sce->zeroes[w*16+g]) {
396 sce->sf_idx[w*16+g] = SCALE_ONE_POS;
397 continue;
398 }
399 sce->sf_idx[w*16+g] = SCALE_ONE_POS + FFMIN(log2f(uplims[w*16+g]/minthr)*4,59);
400 }
401 }
402
403 if (!allz)
404 return;
405 s->aacdsp.abs_pow34(s->scoefs, sce->coeffs, 1024);
407
408 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
409 start = w*128;
410 for (g = 0; g < sce->ics.num_swb; g++) {
411 const float *scaled = s->scoefs + start;
412 maxvals[w*16+g] = find_max_val(sce->ics.group_len[w], sce->ics.swb_sizes[g], scaled);
413 start += sce->ics.swb_sizes[g];
414 }
415 }
416
417 //perform two-loop search
418 //outer loop - improve quality
419 do {
420 int tbits, qstep;
421 minscaler = sce->sf_idx[0];
422 //inner loop - quantize spectrum to fit into given number of bits
423 qstep = its ? 1 : 32;
424 do {
425 int prev = -1;
426 tbits = 0;
427 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
428 start = w*128;
429 for (g = 0; g < sce->ics.num_swb; g++) {
430 const float *coefs = sce->coeffs + start;
431 const float *scaled = s->scoefs + start;
432 int bits = 0;
433 int cb;
434 float dist = 0.0f;
435
436 if (sce->zeroes[w*16+g] || sce->sf_idx[w*16+g] >= 218) {
437 start += sce->ics.swb_sizes[g];
438 continue;
439 }
440 minscaler = FFMIN(minscaler, sce->sf_idx[w*16+g]);
441 cb = find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]);
442 for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
443 int b;
444 dist += quantize_band_cost_cached(s, w + w2, g,
445 coefs + w2*128,
446 scaled + w2*128,
447 sce->ics.swb_sizes[g],
448 sce->sf_idx[w*16+g],
449 cb, 1.0f, INFINITY,
450 &b, NULL, 0);
451 bits += b;
452 }
453 dists[w*16+g] = dist - bits;
454 if (prev != -1) {
456 }
457 tbits += bits;
458 start += sce->ics.swb_sizes[g];
459 prev = sce->sf_idx[w*16+g];
460 }
461 }
462 if (tbits > destbits) {
463 for (i = 0; i < 128; i++)
464 if (sce->sf_idx[i] < 218 - qstep)
465 sce->sf_idx[i] += qstep;
466 } else {
467 for (i = 0; i < 128; i++)
468 if (sce->sf_idx[i] > 60 - qstep)
469 sce->sf_idx[i] -= qstep;
470 }
471 qstep >>= 1;
472 if (!qstep && tbits > destbits*1.02 && sce->sf_idx[0] < 217)
473 qstep = 1;
474 } while (qstep);
475
476 fflag = 0;
477 minscaler = av_clip(minscaler, 60, 255 - SCALE_MAX_DIFF);
478
479 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
480 for (g = 0; g < sce->ics.num_swb; g++) {
481 int prevsc = sce->sf_idx[w*16+g];
482 if (dists[w*16+g] > uplims[w*16+g] && sce->sf_idx[w*16+g] > 60) {
483 if (find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]-1))
484 sce->sf_idx[w*16+g]--;
485 else //Try to make sure there is some energy in every band
486 sce->sf_idx[w*16+g]-=2;
487 }
488 sce->sf_idx[w*16+g] = av_clip(sce->sf_idx[w*16+g], minscaler, minscaler + SCALE_MAX_DIFF);
489 sce->sf_idx[w*16+g] = FFMIN(sce->sf_idx[w*16+g], 219);
490 if (sce->sf_idx[w*16+g] != prevsc)
491 fflag = 1;
492 sce->band_type[w*16+g] = find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]);
493 }
494 }
495 its++;
496 } while (fflag && its < 10);
497}
498
500{
501 FFPsyBand *band;
502 int w, g, w2, i;
503 int wlen = 1024 / sce->ics.num_windows;
504 int bandwidth, cutoff;
505 float *PNS = &s->scoefs[0*128], *PNS34 = &s->scoefs[1*128];
506 float *NOR34 = &s->scoefs[3*128];
507 uint8_t nextband[128];
508 const float lambda = s->lambda;
509 const float freq_mult = avctx->sample_rate*0.5f/wlen;
510 const float thr_mult = NOISE_LAMBDA_REPLACE*(100.0f/lambda);
511 const float spread_threshold = FFMIN(0.75f, NOISE_SPREAD_THRESHOLD*FFMAX(0.5f, lambda/100.f));
512 const float dist_bias = av_clipf(4.f * 120 / lambda, 0.25f, 4.0f);
513 const float pns_transient_energy_r = FFMIN(0.7f, lambda / 140.f);
514
515 int prev = -1000, prev_sf = -1;
516
517 /* PNS candidacy must use the coder's actual coding bandwidth (s->bandwidth,
518 * fixed at init), not a separate heuristic, or it evaluates a different band
519 * range than the coder later codes. */
520 bandwidth = s->bandwidth;
521 cutoff = bandwidth * 2 * wlen / avctx->sample_rate;
522
523 memcpy(sce->band_alt, sce->band_type, sizeof(sce->band_type));
524 ff_init_nextband_map(sce, nextband);
525 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
526 int wstart = w*128;
527 for (g = 0; g < sce->ics.num_swb; g++) {
528 int noise_sfi;
529 float dist1 = 0.0f, dist2 = 0.0f, noise_amp;
530 float pns_energy = 0.0f, pns_tgt_energy, energy_ratio, dist_thresh;
531 float sfb_energy = 0.0f, threshold = 0.0f, spread = 2.0f;
532 float min_energy = -1.0f, max_energy = 0.0f;
533 const int start = wstart+sce->ics.swb_offset[g];
534 const float freq = (start-wstart)*freq_mult;
535 const float freq_boost = FFMAX(0.88f*freq/NOISE_LOW_LIMIT, 1.0f);
536 if (freq < NOISE_LOW_LIMIT || (start-wstart) >= cutoff) {
537 if (!sce->zeroes[w*16+g])
538 prev_sf = sce->sf_idx[w*16+g];
539 continue;
540 }
541 for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
542 band = &s->psy.ch[s->cur_channel].psy_bands[(w+w2)*16+g];
543 sfb_energy += band->energy;
544 spread = FFMIN(spread, band->spread);
545 threshold += band->threshold;
546 if (!w2) {
547 min_energy = max_energy = band->energy;
548 } else {
549 min_energy = FFMIN(min_energy, band->energy);
550 max_energy = FFMAX(max_energy, band->energy);
551 }
552 }
553
554 /* Ramps down at ~8000Hz and loosens the dist threshold */
555 dist_thresh = av_clipf(2.5f*NOISE_LOW_LIMIT/freq, 0.5f, 2.5f) * dist_bias;
556
557 /* PNS is acceptable when all of these are true:
558 * 1. high spread energy (noise-like band)
559 * 2. near-threshold energy (high PE means the random nature of PNS content will be noticed)
560 * 3. on short window groups, all windows have similar energy (variations in energy would be destroyed by PNS)
561 *
562 * At this stage, point 2 is relaxed for zeroed bands near the noise threshold (hole avoidance is more important)
563 */
564 if ((!sce->zeroes[w*16+g] && !ff_sfdelta_can_remove_band(sce, nextband, prev_sf, w*16+g)) ||
565 ((sce->zeroes[w*16+g] || !sce->band_alt[w*16+g]) && sfb_energy < threshold*sqrtf(1.0f/freq_boost)) || spread < spread_threshold ||
566 (!sce->zeroes[w*16+g] && sce->band_alt[w*16+g] && sfb_energy > threshold*thr_mult*freq_boost) ||
567 min_energy < pns_transient_energy_r * max_energy ) {
568 sce->pns_ener[w*16+g] = sfb_energy;
569 if (!sce->zeroes[w*16+g])
570 prev_sf = sce->sf_idx[w*16+g];
571 continue;
572 }
573
574 pns_tgt_energy = sfb_energy*FFMIN(1.0f, spread*spread);
575 noise_sfi = av_clip(roundf(log2f(pns_tgt_energy)*2), -100, 155); /* Quantize */
576 noise_amp = -ff_aac_pow2sf_tab[noise_sfi + POW_SF2_ZERO]; /* Dequantize */
577 if (prev != -1000) {
578 int noise_sfdiff = noise_sfi - prev + SCALE_DIFF_ZERO;
579 if (noise_sfdiff < 0 || noise_sfdiff > 2*SCALE_MAX_DIFF) {
580 if (!sce->zeroes[w*16+g])
581 prev_sf = sce->sf_idx[w*16+g];
582 continue;
583 }
584 }
585 for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
586 float band_energy, scale, pns_senergy;
587 const int start_c = (w+w2)*128+sce->ics.swb_offset[g];
588 band = &s->psy.ch[s->cur_channel].psy_bands[(w+w2)*16+g];
589 for (i = 0; i < sce->ics.swb_sizes[g]; i++) {
590 s->random_state = lcg_random(s->random_state);
591 PNS[i] = s->random_state;
592 }
593 band_energy = s->fdsp->scalarproduct_float(PNS, PNS, sce->ics.swb_sizes[g]);
594 scale = noise_amp/sqrtf(band_energy);
595 s->fdsp->vector_fmul_scalar(PNS, PNS, scale, sce->ics.swb_sizes[g]);
596 pns_senergy = s->fdsp->scalarproduct_float(PNS, PNS, sce->ics.swb_sizes[g]);
597 pns_energy += pns_senergy;
598 s->aacdsp.abs_pow34(NOR34, &sce->coeffs[start_c], sce->ics.swb_sizes[g]);
599 s->aacdsp.abs_pow34(PNS34, PNS, sce->ics.swb_sizes[g]);
600 dist1 += quantize_band_cost(s, &sce->coeffs[start_c],
601 NOR34,
602 sce->ics.swb_sizes[g],
603 sce->sf_idx[(w+w2)*16+g],
604 sce->band_alt[(w+w2)*16+g],
605 lambda/band->threshold, INFINITY, NULL, NULL);
606 /* Estimate rd on average as 5 bits for SF, 4 for the CB, plus spread energy * lambda/thr */
607 dist2 += band->energy/(band->spread*band->spread)*lambda*dist_thresh/band->threshold;
608 }
609 if (g && sce->band_type[w*16+g-1] == NOISE_BT) {
610 dist2 += 5;
611 } else {
612 dist2 += 9;
613 }
614 energy_ratio = pns_tgt_energy/pns_energy; /* Compensates for quantization error */
615 sce->pns_ener[w*16+g] = energy_ratio*pns_tgt_energy;
616 if (sce->zeroes[w*16+g] || !sce->band_alt[w*16+g] || (energy_ratio > 0.85f && energy_ratio < 1.25f && dist2 < dist1)) {
617 sce->band_type[w*16+g] = NOISE_BT;
618 sce->zeroes[w*16+g] = 0;
619 prev = noise_sfi;
620 } else {
621 if (!sce->zeroes[w*16+g])
622 prev_sf = sce->sf_idx[w*16+g];
623 }
624 }
625 }
626}
627
629{
630 FFPsyBand *band;
631 int w, g, w2;
632 int wlen = 1024 / sce->ics.num_windows;
633 int bandwidth, cutoff;
634 const float lambda = s->lambda;
635 const float freq_mult = avctx->sample_rate*0.5f/wlen;
636 const float spread_threshold = FFMIN(0.75f, NOISE_SPREAD_THRESHOLD*FFMAX(0.5f, lambda/100.f));
637 const float pns_transient_energy_r = FFMIN(0.7f, lambda / 140.f);
638
639 /* PNS candidacy must use the coder's actual coding bandwidth (s->bandwidth,
640 * fixed at init), not a separate heuristic, or it evaluates a different band
641 * range than the coder later codes (NMR relies on this output directly). */
642 bandwidth = s->bandwidth;
643 cutoff = bandwidth * 2 * wlen / avctx->sample_rate;
644
645 memcpy(sce->band_alt, sce->band_type, sizeof(sce->band_type));
646 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
647 for (g = 0; g < sce->ics.num_swb; g++) {
648 float sfb_energy = 0.0f, threshold = 0.0f, spread = 2.0f;
649 float min_energy = -1.0f, max_energy = 0.0f;
650 const int start = sce->ics.swb_offset[g];
651 const float freq = start*freq_mult;
652 const float freq_boost = FFMAX(0.88f*freq/NOISE_LOW_LIMIT, 1.0f);
653 if (freq < NOISE_LOW_LIMIT || start >= cutoff) {
654 sce->can_pns[w*16+g] = 0;
655 continue;
656 }
657 for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
658 band = &s->psy.ch[s->cur_channel].psy_bands[(w+w2)*16+g];
659 sfb_energy += band->energy;
660 spread = FFMIN(spread, band->spread);
661 threshold += band->threshold;
662 if (!w2) {
663 min_energy = max_energy = band->energy;
664 } else {
665 min_energy = FFMIN(min_energy, band->energy);
666 max_energy = FFMAX(max_energy, band->energy);
667 }
668 }
669
670 /* PNS is acceptable when all of these are true:
671 * 1. high spread energy (noise-like band)
672 * 2. near-threshold energy (high PE means the random nature of PNS content will be noticed)
673 * 3. on short window groups, all windows have similar energy (variations in energy would be destroyed by PNS)
674 */
675 sce->pns_ener[w*16+g] = sfb_energy;
676 {
677 /* near-mask PNS class (E in [thr/4, 2*thr]): deletion
678 * candidates go to noise, not silence (AAC_PNSHOLE) */
679 int near = sfb_energy < 2.0f * threshold &&
680 sfb_energy > threshold * 0.25f;
681 if (near) {
682 /* deletion candidate: noise beats the ~silent rendition */
683 sce->can_pns[w*16+g] = spread >= spread_threshold &&
684 min_energy >= 0.2f * max_energy;
685 } else if (sfb_energy < threshold*sqrtf(1.5f/freq_boost) || spread < spread_threshold || min_energy < pns_transient_energy_r * max_energy) {
686 sce->can_pns[w*16+g] = 0;
687 } else {
688 sce->can_pns[w*16+g] = 1;
689 }
690 }
691 }
692 }
693}
694
696{
697 int start = 0, i, w, w2, g, sid_sf_boost, prev_mid, prev_side;
698 uint8_t nextband0[128], nextband1[128];
699 float *M = s->scoefs + 128*0, *S = s->scoefs + 128*1;
700 float *L34 = s->scoefs + 128*2, *R34 = s->scoefs + 128*3;
701 float *M34 = s->scoefs + 128*4, *S34 = s->scoefs + 128*5;
702 const float lambda = s->lambda;
703 const float mslambda = FFMIN(1.0f, lambda / 120.f);
704 SingleChannelElement *sce0 = &cpe->ch[0];
705 SingleChannelElement *sce1 = &cpe->ch[1];
706 if (!cpe->common_window)
707 return;
708
709 /** Scout out next nonzero bands */
710 ff_init_nextband_map(sce0, nextband0);
711 ff_init_nextband_map(sce1, nextband1);
712
713 prev_mid = sce0->sf_idx[0];
714 prev_side = sce1->sf_idx[0];
715 for (w = 0; w < sce0->ics.num_windows; w += sce0->ics.group_len[w]) {
716 start = 0;
717 for (g = 0; g < sce0->ics.num_swb; g++) {
718 float bmax = bval2bmax(g * 17.0f / sce0->ics.num_swb) / 0.0045f;
719 if (!cpe->is_mask[w*16+g])
720 cpe->ms_mask[w*16+g] = 0;
721 if (!sce0->zeroes[w*16+g] && !sce1->zeroes[w*16+g] && !cpe->is_mask[w*16+g]) {
722 float Mmax = 0.0f, Smax = 0.0f;
723
724 /* Must compute mid/side SF and book for the whole window group */
725 for (w2 = 0; w2 < sce0->ics.group_len[w]; w2++) {
726 for (i = 0; i < sce0->ics.swb_sizes[g]; i++) {
727 M[i] = (sce0->coeffs[start+(w+w2)*128+i]
728 + sce1->coeffs[start+(w+w2)*128+i]) * 0.5;
729 S[i] = M[i]
730 - sce1->coeffs[start+(w+w2)*128+i];
731 }
732 s->aacdsp.abs_pow34(M34, M, sce0->ics.swb_sizes[g]);
733 s->aacdsp.abs_pow34(S34, S, sce0->ics.swb_sizes[g]);
734 for (i = 0; i < sce0->ics.swb_sizes[g]; i++ ) {
735 Mmax = FFMAX(Mmax, M34[i]);
736 Smax = FFMAX(Smax, S34[i]);
737 }
738 }
739
740 for (sid_sf_boost = 0; sid_sf_boost < 4; sid_sf_boost++) {
741 float dist1 = 0.0f, dist2 = 0.0f;
742 int B0 = 0, B1 = 0;
743 int minidx;
744 int mididx, sididx;
745 int midcb, sidcb;
746
747 minidx = FFMIN(sce0->sf_idx[w*16+g], sce1->sf_idx[w*16+g]);
748 mididx = av_clip(minidx, 0, SCALE_MAX_POS - SCALE_DIV_512);
749 sididx = av_clip(minidx - sid_sf_boost * 3, 0, SCALE_MAX_POS - SCALE_DIV_512);
750 if (sce0->band_type[w*16+g] != NOISE_BT && sce1->band_type[w*16+g] != NOISE_BT
751 && ( !ff_sfdelta_can_replace(sce0, nextband0, prev_mid, mididx, w*16+g)
752 || !ff_sfdelta_can_replace(sce1, nextband1, prev_side, sididx, w*16+g))) {
753 /* scalefactor range violation, bad stuff, will decrease quality unacceptably */
754 continue;
755 }
756
757 midcb = find_min_book(Mmax, mididx);
758 sidcb = find_min_book(Smax, sididx);
759
760 /* No CB can be zero */
761 midcb = FFMAX(1,midcb);
762 sidcb = FFMAX(1,sidcb);
763
764 for (w2 = 0; w2 < sce0->ics.group_len[w]; w2++) {
765 FFPsyBand *band0 = &s->psy.ch[s->cur_channel+0].psy_bands[(w+w2)*16+g];
766 FFPsyBand *band1 = &s->psy.ch[s->cur_channel+1].psy_bands[(w+w2)*16+g];
767 float minthr = FFMIN(band0->threshold, band1->threshold);
768 int b1,b2,b3,b4;
769 for (i = 0; i < sce0->ics.swb_sizes[g]; i++) {
770 M[i] = (sce0->coeffs[start+(w+w2)*128+i]
771 + sce1->coeffs[start+(w+w2)*128+i]) * 0.5;
772 S[i] = M[i]
773 - sce1->coeffs[start+(w+w2)*128+i];
774 }
775
776 s->aacdsp.abs_pow34(L34, sce0->coeffs+start+(w+w2)*128, sce0->ics.swb_sizes[g]);
777 s->aacdsp.abs_pow34(R34, sce1->coeffs+start+(w+w2)*128, sce0->ics.swb_sizes[g]);
778 s->aacdsp.abs_pow34(M34, M, sce0->ics.swb_sizes[g]);
779 s->aacdsp.abs_pow34(S34, S, sce0->ics.swb_sizes[g]);
780 dist1 += quantize_band_cost(s, &sce0->coeffs[start + (w+w2)*128],
781 L34,
782 sce0->ics.swb_sizes[g],
783 sce0->sf_idx[w*16+g],
784 sce0->band_type[w*16+g],
785 lambda / (band0->threshold + FLT_MIN), INFINITY, &b1, NULL);
786 dist1 += quantize_band_cost(s, &sce1->coeffs[start + (w+w2)*128],
787 R34,
788 sce1->ics.swb_sizes[g],
789 sce1->sf_idx[w*16+g],
790 sce1->band_type[w*16+g],
791 lambda / (band1->threshold + FLT_MIN), INFINITY, &b2, NULL);
792 dist2 += quantize_band_cost(s, M,
793 M34,
794 sce0->ics.swb_sizes[g],
795 mididx,
796 midcb,
797 lambda / (minthr + FLT_MIN), INFINITY, &b3, NULL);
798 dist2 += quantize_band_cost(s, S,
799 S34,
800 sce1->ics.swb_sizes[g],
801 sididx,
802 sidcb,
803 mslambda / (minthr * bmax + FLT_MIN), INFINITY, &b4, NULL);
804 B0 += b1+b2;
805 B1 += b3+b4;
806 dist1 -= b1+b2;
807 dist2 -= b3+b4;
808 }
809 cpe->ms_mask[w*16+g] = dist2 <= dist1 && B1 < B0;
810 if (cpe->ms_mask[w*16+g]) {
811 if (sce0->band_type[w*16+g] != NOISE_BT && sce1->band_type[w*16+g] != NOISE_BT) {
812 sce0->sf_idx[w*16+g] = mididx;
813 sce1->sf_idx[w*16+g] = sididx;
814 sce0->band_type[w*16+g] = midcb;
815 sce1->band_type[w*16+g] = sidcb;
816 } else if ((sce0->band_type[w*16+g] != NOISE_BT) ^ (sce1->band_type[w*16+g] != NOISE_BT)) {
817 /* ms_mask unneeded, and it confuses some decoders */
818 cpe->ms_mask[w*16+g] = 0;
819 }
820 break;
821 } else if (B1 > B0) {
822 /* More boost won't fix this */
823 break;
824 }
825 }
826 }
827 if (!sce0->zeroes[w*16+g] && sce0->band_type[w*16+g] < RESERVED_BT)
828 prev_mid = sce0->sf_idx[w*16+g];
829 if (!sce1->zeroes[w*16+g] && !cpe->is_mask[w*16+g] && sce1->band_type[w*16+g] < RESERVED_BT)
830 prev_side = sce1->sf_idx[w*16+g];
831 start += sce0->ics.swb_sizes[g];
832 }
833 }
834}
835
AAC definitions and structures.
#define SCALE_MAX_DIFF
maximum scalefactor difference allowed by standard
Definition aac.h:94
@ INTENSITY_BT
Scalefactor data are intensity stereo positions (in phase).
Definition aac.h:77
@ INTENSITY_BT2
Scalefactor data are intensity stereo positions (out of phase).
Definition aac.h:76
@ RESERVED_BT
Band types following are encoded differently from others.
Definition aac.h:74
@ NOISE_BT
Spectral data are scaled white noise not coded in the bitstream.
Definition aac.h:75
#define SCALE_MAX_POS
scalefactor index maximum value
Definition aac.h:93
#define SCALE_DIV_512
scalefactor difference that corresponds to scale difference in 512 times
Definition aac.h:91
#define SCALE_ONE_POS
scalefactor index that corresponds to scale=1.0
Definition aac.h:92
#define SCALE_DIFF_ZERO
codebook index corresponding to zero scalefactor indices difference
Definition aac.h:95
#define POW_SF2_ZERO
ff_aac_pow2sf_tab index corresponding to pow(2, 0);
Definition aac.h:97
float(* quantize_and_encode_band_func)(struct AACEncContext *s, PutBitContext *pb, const float *in, float *quant, const float *scaled, int size, int scale_idx, int cb, const float lambda, const float uplim, int *bits, float *energy)
Definition aaccoder.c:73
float ff_quantize_and_encode_band_cost(struct AACEncContext *s, PutBitContext *pb, const float *in, float *quant, const float *scaled, int size, int scale_idx, int cb, const float lambda, const float uplim, int *bits, float *energy)
Definition aaccoder.c:277
static const quantize_and_encode_band_func quantize_and_encode_band_cost_arr[]
Definition aaccoder.c:237
static void search_for_pns(AACEncContext *s, AVCodecContext *avctx, SingleChannelElement *sce)
Definition aaccoder.c:499
static av_always_inline float quantize_and_encode_band_cost_template(struct AACEncContext *s, PutBitContext *pb, const float *in, float *out, const float *scaled, int size, int scale_idx, int cb, const float lambda, const float uplim, int *bits, float *energy, int BT_ZERO, int BT_UNSIGNED, int BT_PAIR, int BT_ESC, int BT_NOISE, int BT_STEREO, const float ROUNDING)
Calculate rate distortion cost for quantizing with given codebook.
Definition aaccoder.c:84
const AACCoefficientsEncoder ff_aac_coders[AAC_CODER_NB]
Definition aaccoder.c:836
static void mark_pns(AACEncContext *s, AVCodecContext *avctx, SingleChannelElement *sce)
Definition aaccoder.c:628
static void search_for_quantizers_fast(AVCodecContext *avctx, AACEncContext *s, SingleChannelElement *sce, const float lambda)
Definition aaccoder.c:352
static void set_special_band_scalefactors(AACEncContext *s, SingleChannelElement *sce)
Definition aaccoder.c:313
static void search_for_ms(AACEncContext *s, ChannelElement *cpe)
Definition aaccoder.c:695
static void quantize_and_encode_band(struct AACEncContext *s, PutBitContext *pb, const float *in, float *out, int size, int scale_idx, int cb, const float lambda, int rtz)
Definition aaccoder.c:288
static const quantize_and_encode_band_func quantize_and_encode_band_cost_rtz_arr[]
Definition aaccoder.c:257
#define QUANTIZE_AND_ENCODE_BAND_COST_FUNC(NAME, BT_ZERO, BT_UNSIGNED, BT_PAIR, BT_ESC, BT_NOISE, BT_STEREO, ROUNDING)
Definition aaccoder.c:213
static float quantize_and_encode_band_cost_NONE(struct AACEncContext *s, PutBitContext *pb, const float *in, float *quant, const float *scaled, int size, int scale_idx, int cb, const float lambda, const float uplim, int *bits, float *energy)
Definition aaccoder.c:204
av_cold void ff_aac_coder_init_tables(void)
Definition aaccoder.c:67
#define NOISE_LAMBDA_REPLACE
Definition aaccoder.c:59
#define NOISE_SPREAD_THRESHOLD
Definition aaccoder.c:55
static float esc_pow43[1<< 13]
Definition aaccoder.c:65
static void search_for_quantizers_nmr(AVCodecContext *avctx, AACEncContext *s, SingleChannelElement *sce, const float lambda)
AAC encoder trellis codebook selector.
static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, int win, int group_len, const float lambda)
AAC encoder twoloop coder.
static void search_for_quantizers_twoloop(AVCodecContext *avctx, AACEncContext *s, SingleChannelElement *sce, const float lambda)
two-loop quantizers search taken from ISO 13818-7 Appendix C
#define NOISE_LOW_LIMIT
This file contains a template for the twoloop coder function.
static av_always_inline int lcg_random(unsigned previous_val)
linear congruential pseudorandom number generator
void ff_quantize_band_cost_cache_init(struct AACEncContext *s)
Definition aacenc.c:558
@ AAC_CODER_FAST
Definition aacenc.h:46
@ AAC_CODER_NMR
Definition aacenc.h:47
@ AAC_CODER_NB
Definition aacenc.h:49
@ AAC_CODER_TWOLOOP
Definition aacenc.h:45
void ff_aac_search_for_is(AACEncContext *s, AVCodecContext *avctx, ChannelElement *cpe)
Definition aacenc_is.c:109
AAC encoder Intensity Stereo.
AAC encoder quantizer.
static float quantize_band_cost(struct AACEncContext *s, const float *in, const float *scaled, int size, int scale_idx, int cb, const float lambda, const float uplim, int *bits, float *energy)
static float quantize_band_cost_cached(struct AACEncContext *s, int w, int g, const float *in, const float *scaled, int size, int scale_idx, int cb, const float lambda, const float uplim, int *bits, float *energy, int rtz)
void ff_aac_search_for_tns(AACEncContext *s, SingleChannelElement *sce)
Definition aacenc_tns.c:282
void ff_aac_encode_tns_info(AACEncContext *s, SingleChannelElement *sce)
Encode TNS data.
Definition aacenc_tns.c:72
void ff_aac_apply_tns(AACEncContext *s, SingleChannelElement *sce)
Definition aacenc_tns.c:113
AAC encoder temporal noise shaping.
AAC encoder utilities.
static void ff_init_nextband_map(const SingleChannelElement *sce, uint8_t *nextband)
static av_always_inline float bval2bmax(float b)
approximates exp10f(-3.0f*(0.5f + 0.5f * cosf(FFMIN(b,15.5f) / 15.5f)))
static int find_min_book(float maxval, int sf)
static float find_max_val(int group_len, int swb_size, const float *scaled)
#define ROUND_TO_ZERO
static int ff_sfdelta_can_replace(const SingleChannelElement *sce, const uint8_t *nextband, int prev_sf, int new_sf, int band)
#define ROUND_STANDARD
static int ff_sfdelta_can_remove_band(const SingleChannelElement *sce, const uint8_t *nextband, int prev_sf, int band)
AAC encoder data.
static const uint8_t aac_cb_maxval[12]
Definition aacenctab.h:139
static const uint8_t aac_cb_range[12]
Definition aacenctab.h:138
const float *const ff_aac_codebook_vectors[]
Definition aactab.c:1026
const uint8_t ff_aac_scalefactor_bits[121]
Definition aactab.c:200
const uint8_t *const ff_aac_spectral_bits[11]
Definition aactab.c:530
const uint16_t *const ff_aac_spectral_codes[11]
Definition aactab.c:525
AAC data declarations.
float ff_aac_pow2sf_tab[428]
float ff_aac_pow34sf_tab[428]
#define ZERO
static const float bands[]
#define log2f(x)
Definition math.h:27
static FILE * out
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition avassert.h:42
Libavcodec external API header.
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define s(width, name)
Definition cbs_vp9.c:198
#define av_clip
Definition common.h:100
#define av_clip_uintp2
Definition common.h:124
#define av_clipf
Definition common.h:145
#define STEREO
Definition cook.c:65
#define NULL
Definition coverity.c:32
static __device__ float sqrtf(float a)
static __device__ float fabsf(float a)
static __device__ float ceilf(float a)
#define M(chr)
Definition exr.c:177
#define B1
Definition faandct.c:43
#define B0
Definition faandct.c:42
static const uint8_t bits[8]
Definition fastaudio.c:100
#define S(s, c, i)
static av_always_inline void scale(vec_s32 res[4], vec_s16 res_packed[2], const int shift)
#define Q(q)
#define b
Definition input.c:43
#define av_log2
Definition intmath.h:84
#define ESC
Definition iterm2enc.c:32
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
Definition j2kenc.c:154
#define av_always_inline
Definition attributes.h:72
#define av_cold
Definition attributes.h:117
uint8_t w
Definition llvidencdsp.c:39
#define FFMIN(a, b)
Definition macros.h:49
#define FFMAX(a, b)
Definition macros.h:47
#define INFINITY
bitstream writer API
static void put_sbits(PutBitContext *pb, int n, int32_t value)
Definition put_bits.h:291
#define FF_ARRAY_ELEMS(a)
AAC encoder context.
Definition aacenc.h:281
float lambda
Definition aacenc.h:308
PutBitContext pb
Definition aacenc.h:284
int nb_channels
Number of channels in this layout.
main external API structure.
Definition avcodec.h:443
AVChannelLayout ch_layout
Audio channel layout.
Definition avcodec.h:1059
int64_t bit_rate
the average bitrate
Definition avcodec.h:493
int sample_rate
samples per second
Definition avcodec.h:1044
structure used in optimal codebook search
Definition aaccoder.c:299
float cost
path cost
Definition aaccoder.c:301
int prev_idx
pointer to the previous path point
Definition aaccoder.c:300
channel element - generic struct for SCE/CPE/CCE/LFE
Definition aacdec.h:296
uint8_t ms_mask[128]
Set if mid/side stereo is used for each scalefactor window band.
Definition aacdec.h:300
SingleChannelElement ch[2]
Definition aacdec.h:302
uint8_t is_mask[128]
Set if intensity stereo is used.
Definition aacenc.h:137
int common_window
Set if channels share a common 'IndividualChannelStream' in bitstream.
Definition aacenc.h:133
single band psychoacoustic information
Definition psymodel.h:50
float spread
Definition psymodel.h:54
float threshold
Definition psymodel.h:53
float energy
Definition psymodel.h:52
int num_swb
number of scalefactor window bands
Definition aacdec.h:178
uint8_t group_len[8]
Definition aacdec.h:175
const uint8_t * swb_sizes
table of scalefactor band sizes for a particular window
Definition aacenc.h:87
const uint16_t * swb_offset
table of offsets to the lowest spectral coefficient of a scalefactor band, sfb, for a particular wind...
Definition aacdec.h:177
Single Channel Element - used for both SCE and LFE elements.
Definition aacdec.h:217
uint8_t zeroes[128]
band is not coded
Definition aacenc.h:118
float coeffs[1024]
coefficients for IMDCT, maybe processed
Definition aacenc.h:123
float is_ener[128]
Intensity stereo pos.
Definition aacenc.h:120
uint8_t can_pns[128]
band is allowed to PNS (informative)
Definition aacenc.h:119
float pns_ener[128]
Noise energy values.
Definition aacenc.h:121
enum BandType band_alt[128]
alternative band type
Definition aacenc.h:116
enum BandType band_type[128]
band types
Definition aacdec.h:221
IndividualChannelStream ics
Definition aacdec.h:218
int sf_idx[128]
scalefactor indices
Definition aacenc.h:117
float cost
Definition aaccoder.c:306
int size
const char * g
Definition vf_curves.c:128
static double cb(void *priv, double x, double y)
Definition vf_geq.c:247
static double b1(void *priv, double x, double y)
Definition vf_xfade.c:2041
static double b2(void *priv, double x, double y)
Definition vf_xfade.c:2042
static double b3(void *priv, double x, double y)
Definition vf_xfade.c:2043
static const uint8_t quant[64]
Definition vmixdec.c:71
int dim
int len
static double c[64]