FFmpeg
aacps.c
Go to the documentation of this file.
1 /*
2  * MPEG-4 Parametric Stereo decoding functions
3  * Copyright (c) 2010 Alex Converse <alex.converse@gmail.com>
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  * Note: Rounding-to-nearest used unless otherwise stated
22  *
23  */
24 
25 #include <stdint.h>
26 #include "libavutil/common.h"
27 #include "libavutil/mathematics.h"
28 #include "libavutil/mem_internal.h"
29 #include "avcodec.h"
30 #include "aacps.h"
31 #if USE_FIXED
32 #include "aacps_fixed_tablegen.h"
33 #else
34 #include "libavutil/internal.h"
35 #include "aacps_tablegen.h"
36 #endif /* USE_FIXED */
37 
38 static const INTFLOAT g1_Q2[] = {
39  Q31(0.0f), Q31(0.01899487526049f), Q31(0.0f), Q31(-0.07293139167538f),
40  Q31(0.0f), Q31(0.30596630545168f), Q31(0.5f)
41 };
42 
43 static void ipdopd_reset(int8_t *ipd_hist, int8_t *opd_hist)
44 {
45  int i;
46  for (i = 0; i < PS_MAX_NR_IPDOPD; i++) {
47  opd_hist[i] = 0;
48  ipd_hist[i] = 0;
49  }
50 }
51 
52 /** Split one subband into 2 subsubbands with a symmetric real filter.
53  * The filter must have its non-center even coefficients equal to zero. */
54 static void hybrid2_re(INTFLOAT (*in)[2], INTFLOAT (*out)[32][2],
55  const INTFLOAT filter[7], int len, int reverse)
56 {
57  int i, j;
58  for (i = 0; i < len; i++, in++) {
59  INT64FLOAT re_in = AAC_MUL31(filter[6], in[6][0]); //real inphase
60  INT64FLOAT re_op = 0.0f; //real out of phase
61  INT64FLOAT im_in = AAC_MUL31(filter[6], in[6][1]); //imag inphase
62  INT64FLOAT im_op = 0.0f; //imag out of phase
63  for (j = 0; j < 6; j += 2) {
64  re_op += (INT64FLOAT)filter[j+1] * (in[j+1][0] + in[12-j-1][0]);
65  im_op += (INT64FLOAT)filter[j+1] * (in[j+1][1] + in[12-j-1][1]);
66  }
67 
68 #if USE_FIXED
69  re_op = (re_op + 0x40000000) >> 31;
70  im_op = (im_op + 0x40000000) >> 31;
71 #endif /* USE_FIXED */
72 
73  out[ reverse][i][0] = (INTFLOAT)(re_in + re_op);
74  out[ reverse][i][1] = (INTFLOAT)(im_in + im_op);
75  out[!reverse][i][0] = (INTFLOAT)(re_in - re_op);
76  out[!reverse][i][1] = (INTFLOAT)(im_in - im_op);
77  }
78 }
79 
80 /** Split one subband into 6 subsubbands with a complex filter */
81 static void hybrid6_cx(PSDSPContext *dsp, INTFLOAT (*in)[2], INTFLOAT (*out)[32][2],
82  TABLE_CONST INTFLOAT (*filter)[8][2], int len)
83 {
84  int i;
85  int N = 8;
86  LOCAL_ALIGNED_16(INTFLOAT, temp, [8], [2]);
87 
88  for (i = 0; i < len; i++, in++) {
89  dsp->hybrid_analysis(temp, in, (const INTFLOAT (*)[8][2]) filter, 1, N);
90  out[0][i][0] = temp[6][0];
91  out[0][i][1] = temp[6][1];
92  out[1][i][0] = temp[7][0];
93  out[1][i][1] = temp[7][1];
94  out[2][i][0] = temp[0][0];
95  out[2][i][1] = temp[0][1];
96  out[3][i][0] = temp[1][0];
97  out[3][i][1] = temp[1][1];
98  out[4][i][0] = temp[2][0] + temp[5][0];
99  out[4][i][1] = temp[2][1] + temp[5][1];
100  out[5][i][0] = temp[3][0] + temp[4][0];
101  out[5][i][1] = temp[3][1] + temp[4][1];
102  }
103 }
104 
105 static void hybrid4_8_12_cx(PSDSPContext *dsp,
106  INTFLOAT (*in)[2], INTFLOAT (*out)[32][2],
107  TABLE_CONST INTFLOAT (*filter)[8][2], int N, int len)
108 {
109  int i;
110 
111  for (i = 0; i < len; i++, in++) {
112  dsp->hybrid_analysis(out[0] + i, in, (const INTFLOAT (*)[8][2]) filter, 32, N);
113  }
114 }
115 
116 static void hybrid_analysis(PSDSPContext *dsp, INTFLOAT out[91][32][2],
117  INTFLOAT in[5][44][2], INTFLOAT L[2][38][64],
118  int is34, int len)
119 {
120  int i, j;
121  for (i = 0; i < 5; i++) {
122  for (j = 0; j < 38; j++) {
123  in[i][j+6][0] = L[0][j][i];
124  in[i][j+6][1] = L[1][j][i];
125  }
126  }
127  if (is34) {
128  hybrid4_8_12_cx(dsp, in[0], out, f34_0_12, 12, len);
129  hybrid4_8_12_cx(dsp, in[1], out+12, f34_1_8, 8, len);
130  hybrid4_8_12_cx(dsp, in[2], out+20, f34_2_4, 4, len);
131  hybrid4_8_12_cx(dsp, in[3], out+24, f34_2_4, 4, len);
132  hybrid4_8_12_cx(dsp, in[4], out+28, f34_2_4, 4, len);
133  dsp->hybrid_analysis_ileave(out + 27, L, 5, len);
134  } else {
135  hybrid6_cx(dsp, in[0], out, f20_0_8, len);
136  hybrid2_re(in[1], out+6, g1_Q2, len, 1);
137  hybrid2_re(in[2], out+8, g1_Q2, len, 0);
138  dsp->hybrid_analysis_ileave(out + 7, L, 3, len);
139  }
140  //update in_buf
141  for (i = 0; i < 5; i++) {
142  memcpy(in[i], in[i]+32, 6 * sizeof(in[i][0]));
143  }
144 }
145 
146 static void hybrid_synthesis(PSDSPContext *dsp, INTFLOAT out[2][38][64],
147  INTFLOAT in[91][32][2], int is34, int len)
148 {
149  int i, n;
150  if (is34) {
151  for (n = 0; n < len; n++) {
152  memset(out[0][n], 0, 5*sizeof(out[0][n][0]));
153  memset(out[1][n], 0, 5*sizeof(out[1][n][0]));
154  for (i = 0; i < 12; i++) {
155  out[0][n][0] += (UINTFLOAT)in[ i][n][0];
156  out[1][n][0] += (UINTFLOAT)in[ i][n][1];
157  }
158  for (i = 0; i < 8; i++) {
159  out[0][n][1] += (UINTFLOAT)in[12+i][n][0];
160  out[1][n][1] += (UINTFLOAT)in[12+i][n][1];
161  }
162  for (i = 0; i < 4; i++) {
163  out[0][n][2] += (UINTFLOAT)in[20+i][n][0];
164  out[1][n][2] += (UINTFLOAT)in[20+i][n][1];
165  out[0][n][3] += (UINTFLOAT)in[24+i][n][0];
166  out[1][n][3] += (UINTFLOAT)in[24+i][n][1];
167  out[0][n][4] += (UINTFLOAT)in[28+i][n][0];
168  out[1][n][4] += (UINTFLOAT)in[28+i][n][1];
169  }
170  }
171  dsp->hybrid_synthesis_deint(out, in + 27, 5, len);
172  } else {
173  for (n = 0; n < len; n++) {
174  out[0][n][0] = (UINTFLOAT)in[0][n][0] + in[1][n][0] + in[2][n][0] +
175  (UINTFLOAT)in[3][n][0] + in[4][n][0] + in[5][n][0];
176  out[1][n][0] = (UINTFLOAT)in[0][n][1] + in[1][n][1] + in[2][n][1] +
177  (UINTFLOAT)in[3][n][1] + in[4][n][1] + in[5][n][1];
178  out[0][n][1] = (UINTFLOAT)in[6][n][0] + in[7][n][0];
179  out[1][n][1] = (UINTFLOAT)in[6][n][1] + in[7][n][1];
180  out[0][n][2] = (UINTFLOAT)in[8][n][0] + in[9][n][0];
181  out[1][n][2] = (UINTFLOAT)in[8][n][1] + in[9][n][1];
182  }
183  dsp->hybrid_synthesis_deint(out, in + 7, 3, len);
184  }
185 }
186 
187 /// All-pass filter decay slope
188 #define DECAY_SLOPE Q30(0.05f)
189 /// Number of frequency bands that can be addressed by the parameter index, b(k)
190 static const int NR_PAR_BANDS[] = { 20, 34 };
191 static const int NR_IPDOPD_BANDS[] = { 11, 17 };
192 /// Number of frequency bands that can be addressed by the sub subband index, k
193 static const int NR_BANDS[] = { 71, 91 };
194 /// Start frequency band for the all-pass filter decay slope
195 static const int DECAY_CUTOFF[] = { 10, 32 };
196 /// Number of all-pass filer bands
197 static const int NR_ALLPASS_BANDS[] = { 30, 50 };
198 /// First stereo band using the short one sample delay
199 static const int SHORT_DELAY_BAND[] = { 42, 62 };
200 
201 /** Table 8.46 */
202 static void map_idx_10_to_20(int8_t *par_mapped, const int8_t *par, int full)
203 {
204  int b;
205  if (full)
206  b = 9;
207  else {
208  b = 4;
209  par_mapped[10] = 0;
210  }
211  for (; b >= 0; b--) {
212  par_mapped[2*b+1] = par_mapped[2*b] = par[b];
213  }
214 }
215 
216 static void map_idx_34_to_20(int8_t *par_mapped, const int8_t *par, int full)
217 {
218  par_mapped[ 0] = (2*par[ 0] + par[ 1]) / 3;
219  par_mapped[ 1] = ( par[ 1] + 2*par[ 2]) / 3;
220  par_mapped[ 2] = (2*par[ 3] + par[ 4]) / 3;
221  par_mapped[ 3] = ( par[ 4] + 2*par[ 5]) / 3;
222  par_mapped[ 4] = ( par[ 6] + par[ 7]) / 2;
223  par_mapped[ 5] = ( par[ 8] + par[ 9]) / 2;
224  par_mapped[ 6] = par[10];
225  par_mapped[ 7] = par[11];
226  par_mapped[ 8] = ( par[12] + par[13]) / 2;
227  par_mapped[ 9] = ( par[14] + par[15]) / 2;
228  par_mapped[10] = par[16];
229  if (full) {
230  par_mapped[11] = par[17];
231  par_mapped[12] = par[18];
232  par_mapped[13] = par[19];
233  par_mapped[14] = ( par[20] + par[21]) / 2;
234  par_mapped[15] = ( par[22] + par[23]) / 2;
235  par_mapped[16] = ( par[24] + par[25]) / 2;
236  par_mapped[17] = ( par[26] + par[27]) / 2;
237  par_mapped[18] = ( par[28] + par[29] + par[30] + par[31]) / 4;
238  par_mapped[19] = ( par[32] + par[33]) / 2;
239  }
240 }
241 
243 {
244 #if USE_FIXED
245  par[ 0] = (int)(((int64_t)(par[ 0] + (unsigned)(par[ 1]>>1)) * 1431655765 + \
246  0x40000000) >> 31);
247  par[ 1] = (int)(((int64_t)((par[ 1]>>1) + (unsigned)par[ 2]) * 1431655765 + \
248  0x40000000) >> 31);
249  par[ 2] = (int)(((int64_t)(par[ 3] + (unsigned)(par[ 4]>>1)) * 1431655765 + \
250  0x40000000) >> 31);
251  par[ 3] = (int)(((int64_t)((par[ 4]>>1) + (unsigned)par[ 5]) * 1431655765 + \
252  0x40000000) >> 31);
253 #else
254  par[ 0] = (2*par[ 0] + par[ 1]) * 0.33333333f;
255  par[ 1] = ( par[ 1] + 2*par[ 2]) * 0.33333333f;
256  par[ 2] = (2*par[ 3] + par[ 4]) * 0.33333333f;
257  par[ 3] = ( par[ 4] + 2*par[ 5]) * 0.33333333f;
258 #endif /* USE_FIXED */
259  par[ 4] = AAC_HALF_SUM(par[ 6], par[ 7]);
260  par[ 5] = AAC_HALF_SUM(par[ 8], par[ 9]);
261  par[ 6] = par[10];
262  par[ 7] = par[11];
263  par[ 8] = AAC_HALF_SUM(par[12], par[13]);
264  par[ 9] = AAC_HALF_SUM(par[14], par[15]);
265  par[10] = par[16];
266  par[11] = par[17];
267  par[12] = par[18];
268  par[13] = par[19];
269  par[14] = AAC_HALF_SUM(par[20], par[21]);
270  par[15] = AAC_HALF_SUM(par[22], par[23]);
271  par[16] = AAC_HALF_SUM(par[24], par[25]);
272  par[17] = AAC_HALF_SUM(par[26], par[27]);
273 #if USE_FIXED
274  par[18] = (((par[28]+2)>>2) + ((par[29]+2)>>2) + ((par[30]+2)>>2) + ((par[31]+2)>>2));
275 #else
276  par[18] = ( par[28] + par[29] + par[30] + par[31]) * 0.25f;
277 #endif /* USE_FIXED */
278  par[19] = AAC_HALF_SUM(par[32], par[33]);
279 }
280 
281 static void map_idx_10_to_34(int8_t *par_mapped, const int8_t *par, int full)
282 {
283  if (full) {
284  par_mapped[33] = par[9];
285  par_mapped[32] = par[9];
286  par_mapped[31] = par[9];
287  par_mapped[30] = par[9];
288  par_mapped[29] = par[9];
289  par_mapped[28] = par[9];
290  par_mapped[27] = par[8];
291  par_mapped[26] = par[8];
292  par_mapped[25] = par[8];
293  par_mapped[24] = par[8];
294  par_mapped[23] = par[7];
295  par_mapped[22] = par[7];
296  par_mapped[21] = par[7];
297  par_mapped[20] = par[7];
298  par_mapped[19] = par[6];
299  par_mapped[18] = par[6];
300  par_mapped[17] = par[5];
301  par_mapped[16] = par[5];
302  } else {
303  par_mapped[16] = 0;
304  }
305  par_mapped[15] = par[4];
306  par_mapped[14] = par[4];
307  par_mapped[13] = par[4];
308  par_mapped[12] = par[4];
309  par_mapped[11] = par[3];
310  par_mapped[10] = par[3];
311  par_mapped[ 9] = par[2];
312  par_mapped[ 8] = par[2];
313  par_mapped[ 7] = par[2];
314  par_mapped[ 6] = par[2];
315  par_mapped[ 5] = par[1];
316  par_mapped[ 4] = par[1];
317  par_mapped[ 3] = par[1];
318  par_mapped[ 2] = par[0];
319  par_mapped[ 1] = par[0];
320  par_mapped[ 0] = par[0];
321 }
322 
323 static void map_idx_20_to_34(int8_t *par_mapped, const int8_t *par, int full)
324 {
325  if (full) {
326  par_mapped[33] = par[19];
327  par_mapped[32] = par[19];
328  par_mapped[31] = par[18];
329  par_mapped[30] = par[18];
330  par_mapped[29] = par[18];
331  par_mapped[28] = par[18];
332  par_mapped[27] = par[17];
333  par_mapped[26] = par[17];
334  par_mapped[25] = par[16];
335  par_mapped[24] = par[16];
336  par_mapped[23] = par[15];
337  par_mapped[22] = par[15];
338  par_mapped[21] = par[14];
339  par_mapped[20] = par[14];
340  par_mapped[19] = par[13];
341  par_mapped[18] = par[12];
342  par_mapped[17] = par[11];
343  }
344  par_mapped[16] = par[10];
345  par_mapped[15] = par[ 9];
346  par_mapped[14] = par[ 9];
347  par_mapped[13] = par[ 8];
348  par_mapped[12] = par[ 8];
349  par_mapped[11] = par[ 7];
350  par_mapped[10] = par[ 6];
351  par_mapped[ 9] = par[ 5];
352  par_mapped[ 8] = par[ 5];
353  par_mapped[ 7] = par[ 4];
354  par_mapped[ 6] = par[ 4];
355  par_mapped[ 5] = par[ 3];
356  par_mapped[ 4] = (par[ 2] + par[ 3]) / 2;
357  par_mapped[ 3] = par[ 2];
358  par_mapped[ 2] = par[ 1];
359  par_mapped[ 1] = (par[ 0] + par[ 1]) / 2;
360  par_mapped[ 0] = par[ 0];
361 }
362 
364 {
365  par[33] = par[19];
366  par[32] = par[19];
367  par[31] = par[18];
368  par[30] = par[18];
369  par[29] = par[18];
370  par[28] = par[18];
371  par[27] = par[17];
372  par[26] = par[17];
373  par[25] = par[16];
374  par[24] = par[16];
375  par[23] = par[15];
376  par[22] = par[15];
377  par[21] = par[14];
378  par[20] = par[14];
379  par[19] = par[13];
380  par[18] = par[12];
381  par[17] = par[11];
382  par[16] = par[10];
383  par[15] = par[ 9];
384  par[14] = par[ 9];
385  par[13] = par[ 8];
386  par[12] = par[ 8];
387  par[11] = par[ 7];
388  par[10] = par[ 6];
389  par[ 9] = par[ 5];
390  par[ 8] = par[ 5];
391  par[ 7] = par[ 4];
392  par[ 6] = par[ 4];
393  par[ 5] = par[ 3];
394  par[ 4] = AAC_HALF_SUM(par[ 2], par[ 3]);
395  par[ 3] = par[ 2];
396  par[ 2] = par[ 1];
397  par[ 1] = AAC_HALF_SUM(par[ 0], par[ 1]);
398 }
399 
400 static void decorrelation(PSContext *ps, INTFLOAT (*out)[32][2], const INTFLOAT (*s)[32][2], int is34)
401 {
403  LOCAL_ALIGNED_16(INTFLOAT, transient_gain, [34], [PS_QMF_TIME_SLOTS]);
404  INTFLOAT *peak_decay_nrg = ps->peak_decay_nrg;
405  INTFLOAT *power_smooth = ps->power_smooth;
406  INTFLOAT *peak_decay_diff_smooth = ps->peak_decay_diff_smooth;
407  INTFLOAT (*delay)[PS_QMF_TIME_SLOTS + PS_MAX_DELAY][2] = ps->delay;
409 #if !USE_FIXED
410  const float transient_impact = 1.5f;
411  const float a_smooth = 0.25f; ///< Smoothing coefficient
412 #endif /* USE_FIXED */
413  const int8_t *const k_to_i = is34 ? ff_k_to_i_34 : ff_k_to_i_20;
414  int i, k, m, n;
415  int n0 = 0, nL = 32;
416  const INTFLOAT peak_decay_factor = Q31(0.76592833836465f);
417 
418  memset(power, 0, 34 * sizeof(*power));
419 
420  if (is34 != ps->common.is34bands_old) {
421  memset(ps->peak_decay_nrg, 0, sizeof(ps->peak_decay_nrg));
422  memset(ps->power_smooth, 0, sizeof(ps->power_smooth));
423  memset(ps->peak_decay_diff_smooth, 0, sizeof(ps->peak_decay_diff_smooth));
424  memset(ps->delay, 0, sizeof(ps->delay));
425  memset(ps->ap_delay, 0, sizeof(ps->ap_delay));
426  }
427 
428  for (k = 0; k < NR_BANDS[is34]; k++) {
429  int i = k_to_i[k];
430  ps->dsp.add_squares(power[i], s[k], nL - n0);
431  }
432 
433  //Transient detection
434 #if USE_FIXED
435  for (i = 0; i < NR_PAR_BANDS[is34]; i++) {
436  for (n = n0; n < nL; n++) {
437  int decayed_peak;
438  decayed_peak = (int)(((int64_t)peak_decay_factor * \
439  peak_decay_nrg[i] + 0x40000000) >> 31);
440  peak_decay_nrg[i] = FFMAX(decayed_peak, power[i][n]);
441  power_smooth[i] += (power[i][n] + 2LL - power_smooth[i]) >> 2;
442  peak_decay_diff_smooth[i] += (peak_decay_nrg[i] + 2LL - power[i][n] - \
443  peak_decay_diff_smooth[i]) >> 2;
444 
445  if (peak_decay_diff_smooth[i]) {
446  transient_gain[i][n] = FFMIN(power_smooth[i]*43691LL / peak_decay_diff_smooth[i], 1<<16);
447  } else
448  transient_gain[i][n] = 1 << 16;
449  }
450  }
451 #else
452  for (i = 0; i < NR_PAR_BANDS[is34]; i++) {
453  for (n = n0; n < nL; n++) {
454  float decayed_peak = peak_decay_factor * peak_decay_nrg[i];
455  float denom;
456  peak_decay_nrg[i] = FFMAX(decayed_peak, power[i][n]);
457  power_smooth[i] += a_smooth * (power[i][n] - power_smooth[i]);
458  peak_decay_diff_smooth[i] += a_smooth * (peak_decay_nrg[i] - power[i][n] - peak_decay_diff_smooth[i]);
459  denom = transient_impact * peak_decay_diff_smooth[i];
460  transient_gain[i][n] = (denom > power_smooth[i]) ?
461  power_smooth[i] / denom : 1.0f;
462  }
463  }
464 
465 #endif /* USE_FIXED */
466  //Decorrelation and transient reduction
467  // PS_AP_LINKS - 1
468  // -----
469  // | | Q_fract_allpass[k][m]*z^-link_delay[m] - a[m]*g_decay_slope[k]
470  //H[k][z] = z^-2 * phi_fract[k] * | | ----------------------------------------------------------------
471  // | | 1 - a[m]*g_decay_slope[k]*Q_fract_allpass[k][m]*z^-link_delay[m]
472  // m = 0
473  //d[k][z] (out) = transient_gain_mapped[k][z] * H[k][z] * s[k][z]
474  for (k = 0; k < NR_ALLPASS_BANDS[is34]; k++) {
475  int b = k_to_i[k];
476 #if USE_FIXED
477  int g_decay_slope;
478 
479  if (k - DECAY_CUTOFF[is34] <= 0) {
480  g_decay_slope = 1 << 30;
481  }
482  else if (k - DECAY_CUTOFF[is34] >= 20) {
483  g_decay_slope = 0;
484  }
485  else {
486  g_decay_slope = (1 << 30) - DECAY_SLOPE * (k - DECAY_CUTOFF[is34]);
487  }
488 #else
489  float g_decay_slope = 1.f - DECAY_SLOPE * (k - DECAY_CUTOFF[is34]);
490  g_decay_slope = av_clipf(g_decay_slope, 0.f, 1.f);
491 #endif /* USE_FIXED */
492  memcpy(delay[k], delay[k]+nL, PS_MAX_DELAY*sizeof(delay[k][0]));
493  memcpy(delay[k]+PS_MAX_DELAY, s[k], numQMFSlots*sizeof(delay[k][0]));
494  for (m = 0; m < PS_AP_LINKS; m++) {
495  memcpy(ap_delay[k][m], ap_delay[k][m]+numQMFSlots, 5*sizeof(ap_delay[k][m][0]));
496  }
497  ps->dsp.decorrelate(out[k], delay[k] + PS_MAX_DELAY - 2, ap_delay[k],
498  phi_fract[is34][k],
499  (const INTFLOAT (*)[2]) Q_fract_allpass[is34][k],
500  transient_gain[b], g_decay_slope, nL - n0);
501  }
502  for (; k < SHORT_DELAY_BAND[is34]; k++) {
503  int i = k_to_i[k];
504  memcpy(delay[k], delay[k]+nL, PS_MAX_DELAY*sizeof(delay[k][0]));
505  memcpy(delay[k]+PS_MAX_DELAY, s[k], numQMFSlots*sizeof(delay[k][0]));
506  //H = delay 14
507  ps->dsp.mul_pair_single(out[k], delay[k] + PS_MAX_DELAY - 14,
508  transient_gain[i], nL - n0);
509  }
510  for (; k < NR_BANDS[is34]; k++) {
511  int i = k_to_i[k];
512  memcpy(delay[k], delay[k]+nL, PS_MAX_DELAY*sizeof(delay[k][0]));
513  memcpy(delay[k]+PS_MAX_DELAY, s[k], numQMFSlots*sizeof(delay[k][0]));
514  //H = delay 1
515  ps->dsp.mul_pair_single(out[k], delay[k] + PS_MAX_DELAY - 1,
516  transient_gain[i], nL - n0);
517  }
518 }
519 
520 static void remap34(int8_t (**p_par_mapped)[PS_MAX_NR_IIDICC],
521  int8_t (*par)[PS_MAX_NR_IIDICC],
522  int num_par, int num_env, int full)
523 {
524  int8_t (*par_mapped)[PS_MAX_NR_IIDICC] = *p_par_mapped;
525  int e;
526  if (num_par == 20 || num_par == 11) {
527  for (e = 0; e < num_env; e++) {
528  map_idx_20_to_34(par_mapped[e], par[e], full);
529  }
530  } else if (num_par == 10 || num_par == 5) {
531  for (e = 0; e < num_env; e++) {
532  map_idx_10_to_34(par_mapped[e], par[e], full);
533  }
534  } else {
535  *p_par_mapped = par;
536  }
537 }
538 
539 static void remap20(int8_t (**p_par_mapped)[PS_MAX_NR_IIDICC],
540  int8_t (*par)[PS_MAX_NR_IIDICC],
541  int num_par, int num_env, int full)
542 {
543  int8_t (*par_mapped)[PS_MAX_NR_IIDICC] = *p_par_mapped;
544  int e;
545  if (num_par == 34 || num_par == 17) {
546  for (e = 0; e < num_env; e++) {
547  map_idx_34_to_20(par_mapped[e], par[e], full);
548  }
549  } else if (num_par == 10 || num_par == 5) {
550  for (e = 0; e < num_env; e++) {
551  map_idx_10_to_20(par_mapped[e], par[e], full);
552  }
553  } else {
554  *p_par_mapped = par;
555  }
556 }
557 
558 static void stereo_processing(PSContext *ps, INTFLOAT (*l)[32][2], INTFLOAT (*r)[32][2], int is34)
559 {
560  int e, b, k;
561 
562  PSCommonContext *const ps2 = &ps->common;
563  INTFLOAT (*H11)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H11;
564  INTFLOAT (*H12)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H12;
565  INTFLOAT (*H21)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H21;
566  INTFLOAT (*H22)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H22;
567  int8_t *opd_hist = ps->opd_hist;
568  int8_t *ipd_hist = ps->ipd_hist;
569  int8_t iid_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];
570  int8_t icc_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];
571  int8_t ipd_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];
572  int8_t opd_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];
573  int8_t (*iid_mapped)[PS_MAX_NR_IIDICC] = iid_mapped_buf;
574  int8_t (*icc_mapped)[PS_MAX_NR_IIDICC] = icc_mapped_buf;
575  int8_t (*ipd_mapped)[PS_MAX_NR_IIDICC] = ipd_mapped_buf;
576  int8_t (*opd_mapped)[PS_MAX_NR_IIDICC] = opd_mapped_buf;
577  const int8_t *const k_to_i = is34 ? ff_k_to_i_34 : ff_k_to_i_20;
578  TABLE_CONST INTFLOAT (*H_LUT)[8][4] = (PS_BASELINE || ps2->icc_mode < 3) ? HA : HB;
579 
580  //Remapping
581  if (ps2->num_env_old) {
582  memcpy(H11[0][0], H11[0][ps2->num_env_old], sizeof(H11[0][0]));
583  memcpy(H11[1][0], H11[1][ps2->num_env_old], sizeof(H11[1][0]));
584  memcpy(H12[0][0], H12[0][ps2->num_env_old], sizeof(H12[0][0]));
585  memcpy(H12[1][0], H12[1][ps2->num_env_old], sizeof(H12[1][0]));
586  memcpy(H21[0][0], H21[0][ps2->num_env_old], sizeof(H21[0][0]));
587  memcpy(H21[1][0], H21[1][ps2->num_env_old], sizeof(H21[1][0]));
588  memcpy(H22[0][0], H22[0][ps2->num_env_old], sizeof(H22[0][0]));
589  memcpy(H22[1][0], H22[1][ps2->num_env_old], sizeof(H22[1][0]));
590  }
591 
592  if (is34) {
593  remap34(&iid_mapped, ps2->iid_par, ps2->nr_iid_par, ps2->num_env, 1);
594  remap34(&icc_mapped, ps2->icc_par, ps2->nr_icc_par, ps2->num_env, 1);
595  if (ps2->enable_ipdopd) {
596  remap34(&ipd_mapped, ps2->ipd_par, ps2->nr_ipdopd_par, ps2->num_env, 0);
597  remap34(&opd_mapped, ps2->opd_par, ps2->nr_ipdopd_par, ps2->num_env, 0);
598  }
599  if (!ps2->is34bands_old) {
600  map_val_20_to_34(H11[0][0]);
601  map_val_20_to_34(H11[1][0]);
602  map_val_20_to_34(H12[0][0]);
603  map_val_20_to_34(H12[1][0]);
604  map_val_20_to_34(H21[0][0]);
605  map_val_20_to_34(H21[1][0]);
606  map_val_20_to_34(H22[0][0]);
607  map_val_20_to_34(H22[1][0]);
608  ipdopd_reset(ipd_hist, opd_hist);
609  }
610  } else {
611  remap20(&iid_mapped, ps2->iid_par, ps2->nr_iid_par, ps2->num_env, 1);
612  remap20(&icc_mapped, ps2->icc_par, ps2->nr_icc_par, ps2->num_env, 1);
613  if (ps2->enable_ipdopd) {
614  remap20(&ipd_mapped, ps2->ipd_par, ps2->nr_ipdopd_par, ps2->num_env, 0);
615  remap20(&opd_mapped, ps2->opd_par, ps2->nr_ipdopd_par, ps2->num_env, 0);
616  }
617  if (ps2->is34bands_old) {
618  map_val_34_to_20(H11[0][0]);
619  map_val_34_to_20(H11[1][0]);
620  map_val_34_to_20(H12[0][0]);
621  map_val_34_to_20(H12[1][0]);
622  map_val_34_to_20(H21[0][0]);
623  map_val_34_to_20(H21[1][0]);
624  map_val_34_to_20(H22[0][0]);
625  map_val_34_to_20(H22[1][0]);
626  ipdopd_reset(ipd_hist, opd_hist);
627  }
628  }
629 
630  //Mixing
631  for (e = 0; e < ps2->num_env; e++) {
632  for (b = 0; b < NR_PAR_BANDS[is34]; b++) {
633  INTFLOAT h11, h12, h21, h22;
634  h11 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps2->iid_quant][icc_mapped[e][b]][0];
635  h12 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps2->iid_quant][icc_mapped[e][b]][1];
636  h21 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps2->iid_quant][icc_mapped[e][b]][2];
637  h22 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps2->iid_quant][icc_mapped[e][b]][3];
638 
639  if (!PS_BASELINE && ps2->enable_ipdopd && b < NR_IPDOPD_BANDS[is34]) {
640  //The spec say says to only run this smoother when enable_ipdopd
641  //is set but the reference decoder appears to run it constantly
642  INTFLOAT h11i, h12i, h21i, h22i;
643  INTFLOAT ipd_adj_re, ipd_adj_im;
644  int opd_idx = opd_hist[b] * 8 + opd_mapped[e][b];
645  int ipd_idx = ipd_hist[b] * 8 + ipd_mapped[e][b];
646  INTFLOAT opd_re = pd_re_smooth[opd_idx];
647  INTFLOAT opd_im = pd_im_smooth[opd_idx];
648  INTFLOAT ipd_re = pd_re_smooth[ipd_idx];
649  INTFLOAT ipd_im = pd_im_smooth[ipd_idx];
650  opd_hist[b] = opd_idx & 0x3F;
651  ipd_hist[b] = ipd_idx & 0x3F;
652 
653  ipd_adj_re = AAC_MADD30(opd_re, ipd_re, opd_im, ipd_im);
654  ipd_adj_im = AAC_MSUB30(opd_im, ipd_re, opd_re, ipd_im);
655  h11i = AAC_MUL30(h11, opd_im);
656  h11 = AAC_MUL30(h11, opd_re);
657  h12i = AAC_MUL30(h12, ipd_adj_im);
658  h12 = AAC_MUL30(h12, ipd_adj_re);
659  h21i = AAC_MUL30(h21, opd_im);
660  h21 = AAC_MUL30(h21, opd_re);
661  h22i = AAC_MUL30(h22, ipd_adj_im);
662  h22 = AAC_MUL30(h22, ipd_adj_re);
663  H11[1][e+1][b] = h11i;
664  H12[1][e+1][b] = h12i;
665  H21[1][e+1][b] = h21i;
666  H22[1][e+1][b] = h22i;
667  }
668  H11[0][e+1][b] = h11;
669  H12[0][e+1][b] = h12;
670  H21[0][e+1][b] = h21;
671  H22[0][e+1][b] = h22;
672  }
673  for (k = 0; k < NR_BANDS[is34]; k++) {
674  LOCAL_ALIGNED_16(INTFLOAT, h, [2], [4]);
675  LOCAL_ALIGNED_16(INTFLOAT, h_step, [2], [4]);
676  int start = ps2->border_position[e];
677  int stop = ps2->border_position[e+1];
678  INTFLOAT width = Q30(1.f) / ((stop - start) ? (stop - start) : 1);
679 #if USE_FIXED
680  width = FFMIN(2U*width, INT_MAX);
681 #endif
682  b = k_to_i[k];
683  h[0][0] = H11[0][e][b];
684  h[0][1] = H12[0][e][b];
685  h[0][2] = H21[0][e][b];
686  h[0][3] = H22[0][e][b];
687  if (!PS_BASELINE && ps2->enable_ipdopd) {
688  //Is this necessary? ps_04_new seems unchanged
689  if ((is34 && k <= 13 && k >= 9) || (!is34 && k <= 1)) {
690  h[1][0] = -H11[1][e][b];
691  h[1][1] = -H12[1][e][b];
692  h[1][2] = -H21[1][e][b];
693  h[1][3] = -H22[1][e][b];
694  } else {
695  h[1][0] = H11[1][e][b];
696  h[1][1] = H12[1][e][b];
697  h[1][2] = H21[1][e][b];
698  h[1][3] = H22[1][e][b];
699  }
700  }
701  //Interpolation
702  h_step[0][0] = AAC_MSUB31_V3(H11[0][e+1][b], h[0][0], width);
703  h_step[0][1] = AAC_MSUB31_V3(H12[0][e+1][b], h[0][1], width);
704  h_step[0][2] = AAC_MSUB31_V3(H21[0][e+1][b], h[0][2], width);
705  h_step[0][3] = AAC_MSUB31_V3(H22[0][e+1][b], h[0][3], width);
706  if (!PS_BASELINE && ps2->enable_ipdopd) {
707  h_step[1][0] = AAC_MSUB31_V3(H11[1][e+1][b], h[1][0], width);
708  h_step[1][1] = AAC_MSUB31_V3(H12[1][e+1][b], h[1][1], width);
709  h_step[1][2] = AAC_MSUB31_V3(H21[1][e+1][b], h[1][2], width);
710  h_step[1][3] = AAC_MSUB31_V3(H22[1][e+1][b], h[1][3], width);
711  }
712  if (stop - start)
714  l[k] + 1 + start, r[k] + 1 + start,
715  h, h_step, stop - start);
716  }
717  }
718 }
719 
720 int AAC_RENAME(ff_ps_apply)(AVCodecContext *avctx, PSContext *ps, INTFLOAT L[2][38][64], INTFLOAT R[2][38][64], int top)
721 {
722  INTFLOAT (*Lbuf)[32][2] = ps->Lbuf;
723  INTFLOAT (*Rbuf)[32][2] = ps->Rbuf;
724  const int len = 32;
725  int is34 = ps->common.is34bands;
726 
727  top += NR_BANDS[is34] - 64;
728  memset(ps->delay+top, 0, (NR_BANDS[is34] - top)*sizeof(ps->delay[0]));
729  if (top < NR_ALLPASS_BANDS[is34])
730  memset(ps->ap_delay + top, 0, (NR_ALLPASS_BANDS[is34] - top)*sizeof(ps->ap_delay[0]));
731 
732  hybrid_analysis(&ps->dsp, Lbuf, ps->in_buf, L, is34, len);
733  decorrelation(ps, Rbuf, (const INTFLOAT (*)[32][2]) Lbuf, is34);
734  stereo_processing(ps, Lbuf, Rbuf, is34);
735  hybrid_synthesis(&ps->dsp, L, Lbuf, is34, len);
736  hybrid_synthesis(&ps->dsp, R, Rbuf, is34, len);
737 
738  return 0;
739 }
740 
742  ps_tableinit();
744 }
745 
747 {
748  AAC_RENAME(ff_psdsp_init)(&ps->dsp);
749 }
TABLE_CONST
#define TABLE_CONST
Definition: aacps_fixed_tablegen.h:51
map_idx_34_to_20
static void map_idx_34_to_20(int8_t *par_mapped, const int8_t *par, int full)
Definition: aacps.c:216
AAC_MADD30
#define AAC_MADD30(x, y, a, b)
Definition: aac_defines.h:104
INTFLOAT
#define INTFLOAT
Definition: dct32_template.c:44
r
const char * r
Definition: vf_curves.c:116
PS_MAX_NR_IIDICC
#define PS_MAX_NR_IIDICC
Definition: aacps.h:34
mem_internal.h
f34_2_4
static int f34_2_4[4][8][2]
Definition: aacps_fixed_tablegen.h:59
out
FILE * out
Definition: movenc.c:54
pd_im_smooth
static int pd_im_smooth[8 *8 *8]
Definition: aacps_fixed_tablegen.h:53
PS_MAX_NR_IPDOPD
#define PS_MAX_NR_IPDOPD
Definition: aacps.h:35
PSContext::peak_decay_diff_smooth
INTFLOAT peak_decay_diff_smooth[34]
Definition: aacps.h:80
Q_fract_allpass
static TABLE_CONST int Q_fract_allpass[2][50][3][2]
Definition: aacps_fixed_tablegen.h:60
PSCommonContext
Definition: aacps.h:48
R
#define R
Definition: huffyuvdsp.h:34
b
#define b
Definition: input.c:34
aacps_fixed_tablegen.h
PSDSPContext::decorrelate
void(* decorrelate)(INTFLOAT(*out)[2], INTFLOAT(*delay)[2], INTFLOAT(*ap_delay)[PS_QMF_TIME_SLOTS+PS_MAX_AP_DELAY][2], const INTFLOAT phi_fract[2], const INTFLOAT(*Q_fract)[2], const INTFLOAT *transient_gain, INTFLOAT g_decay_slope, int len)
Definition: aacpsdsp.h:43
f20_0_8
static int f20_0_8[8][8][2]
Definition: aacps_fixed_tablegen.h:56
ff_ps_init
av_cold void AAC_RENAME() ff_ps_init(void)
Definition: aacps.c:741
NR_PAR_BANDS
static const int NR_PAR_BANDS[]
Number of frequency bands that can be addressed by the parameter index, b(k)
Definition: aacps.c:190
ff_k_to_i_34
const int8_t ff_k_to_i_34[]
Table 8.49.
Definition: aacpsdata.c:152
PS_QMF_TIME_SLOTS
#define PS_QMF_TIME_SLOTS
Definition: aacps.h:38
f34_0_12
static int f34_0_12[12][8][2]
Definition: aacps_fixed_tablegen.h:57
mathematics.h
filter
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 then the filter should push the output frames on the output link immediately As an exception to the previous rule if the input frame is enough to produce several output frames then the filter needs output only at least one per link The additional frames can be left buffered in the filter
Definition: filter_design.txt:228
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
PSCommonContext::border_position
int border_position[PS_MAX_NUM_ENV+1]
Definition: aacps.h:62
PSContext::ipd_hist
int8_t ipd_hist[PS_MAX_NR_IIDICC]
Definition: aacps.h:88
PSCommonContext::opd_par
int8_t opd_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]
Overall Phase Difference Parameters.
Definition: aacps.h:67
aacps.h
pd_re_smooth
static int pd_re_smooth[8 *8 *8]
Definition: aacps_fixed_tablegen.h:52
DECAY_SLOPE
#define DECAY_SLOPE
All-pass filter decay slope.
Definition: aacps.c:188
U
#define U(x)
Definition: vp56_arith.h:37
PSDSPContext::add_squares
void(* add_squares)(INTFLOAT *dst, const INTFLOAT(*src)[2], int n)
Definition: aacpsdsp.h:33
PSContext::H12
INTFLOAT H12[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC]
Definition: aacps.h:82
hybrid_synthesis
static void hybrid_synthesis(PSDSPContext *dsp, INTFLOAT out[2][38][64], INTFLOAT in[91][32][2], int is34, int len)
Definition: aacps.c:146
PSCommonContext::num_env_old
int num_env_old
Definition: aacps.h:59
map_idx_10_to_20
static void map_idx_10_to_20(int8_t *par_mapped, const int8_t *par, int full)
Table 8.46.
Definition: aacps.c:202
NR_BANDS
static const int NR_BANDS[]
Number of frequency bands that can be addressed by the sub subband index, k.
Definition: aacps.c:193
PSContext::common
PSCommonContext common
Definition: aacps.h:73
av_cold
#define av_cold
Definition: attributes.h:90
AAC_MUL31
#define AAC_MUL31(x, y)
Definition: aac_defines.h:102
PSContext::dsp
PSDSPContext dsp
Definition: aacps.h:89
NR_ALLPASS_BANDS
static const int NR_ALLPASS_BANDS[]
Number of all-pass filer bands.
Definition: aacps.c:197
PSCommonContext::num_env
int num_env
Definition: aacps.h:60
width
#define width
aacps_tablegen.h
ff_ps_init_common
void ff_ps_init_common(void)
Definition: aacps_common.c:321
s
#define s(width, name)
Definition: cbs_vp9.c:256
PS_AP_LINKS
#define PS_AP_LINKS
Definition: aacps.h:40
PSCommonContext::enable_ipdopd
int enable_ipdopd
Definition: aacps.h:61
AAC_MUL30
#define AAC_MUL30(x, y)
Definition: aac_defines.h:101
hybrid2_re
static void hybrid2_re(INTFLOAT(*in)[2], INTFLOAT(*out)[32][2], const INTFLOAT filter[7], int len, int reverse)
Split one subband into 2 subsubbands with a symmetric real filter.
Definition: aacps.c:54
AAC_HALF_SUM
#define AAC_HALF_SUM(x, y)
Definition: aac_defines.h:111
PSContext::delay
INTFLOAT delay[PS_MAX_SSB][PS_QMF_TIME_SLOTS+PS_MAX_DELAY][2]
Definition: aacps.h:76
hybrid6_cx
static void hybrid6_cx(PSDSPContext *dsp, INTFLOAT(*in)[2], INTFLOAT(*out)[32][2], TABLE_CONST INTFLOAT(*filter)[8][2], int len)
Split one subband into 6 subsubbands with a complex filter.
Definition: aacps.c:81
LOCAL_ALIGNED_16
#define LOCAL_ALIGNED_16(t, v,...)
Definition: mem_internal.h:130
PSCommonContext::nr_ipdopd_par
int nr_ipdopd_par
Definition: aacps.h:53
AAC_MSUB30
#define AAC_MSUB30(x, y, a, b)
Definition: aac_defines.h:107
map_val_20_to_34
static void map_val_20_to_34(INTFLOAT par[PS_MAX_NR_IIDICC])
Definition: aacps.c:363
SHORT_DELAY_BAND
static const int SHORT_DELAY_BAND[]
First stereo band using the short one sample delay.
Definition: aacps.c:199
map_val_34_to_20
static void map_val_34_to_20(INTFLOAT par[PS_MAX_NR_IIDICC])
Definition: aacps.c:242
HA
static int HA[46][8][4]
Definition: aacps_fixed_tablegen.h:54
PSContext::ap_delay
INTFLOAT ap_delay[PS_MAX_AP_BANDS][PS_AP_LINKS][PS_QMF_TIME_SLOTS+PS_MAX_AP_DELAY][2]
Definition: aacps.h:77
NR_IPDOPD_BANDS
static const int NR_IPDOPD_BANDS[]
Definition: aacps.c:191
map_idx_10_to_34
static void map_idx_10_to_34(int8_t *par_mapped, const int8_t *par, int full)
Definition: aacps.c:281
PS_MAX_DELAY
#define PS_MAX_DELAY
Definition: aacps.h:39
PSContext::power_smooth
INTFLOAT power_smooth[34]
Definition: aacps.h:79
PSDSPContext::hybrid_synthesis_deint
void(* hybrid_synthesis_deint)(INTFLOAT out[2][38][64], INTFLOAT(*in)[32][2], int i, int len)
Definition: aacpsdsp.h:41
f34_1_8
static int f34_1_8[8][8][2]
Definition: aacps_fixed_tablegen.h:58
av_clipf
av_clipf
Definition: af_crystalizer.c:122
g1_Q2
static const INTFLOAT g1_Q2[]
Definition: aacps.c:38
PS_MAX_AP_DELAY
#define PS_MAX_AP_DELAY
Definition: aacps.h:41
PSDSPContext::mul_pair_single
void(* mul_pair_single)(INTFLOAT(*dst)[2], INTFLOAT(*src0)[2], INTFLOAT *src1, int n)
Definition: aacpsdsp.h:34
PSDSPContext::hybrid_analysis_ileave
void(* hybrid_analysis_ileave)(INTFLOAT(*out)[32][2], INTFLOAT L[2][38][64], int i, int len)
Definition: aacpsdsp.h:39
PSCommonContext::nr_icc_par
int nr_icc_par
Definition: aacps.h:56
HB
static int HB[46][8][4]
Definition: aacps_fixed_tablegen.h:55
f
f
Definition: af_crystalizer.c:122
map_idx_20_to_34
static void map_idx_20_to_34(int8_t *par_mapped, const int8_t *par, int full)
Definition: aacps.c:323
DECAY_CUTOFF
static const int DECAY_CUTOFF[]
Start frequency band for the all-pass filter decay slope.
Definition: aacps.c:195
PSCommonContext::nr_iid_par
int nr_iid_par
Definition: aacps.h:52
ff_k_to_i_20
const int8_t ff_k_to_i_20[]
Table 8.48.
Definition: aacpsdata.c:145
ff_ps_ctx_init
av_cold void AAC_RENAME() ff_ps_ctx_init(PSContext *ps)
Definition: aacps.c:746
INT64FLOAT
float INT64FLOAT
Definition: aac_defines.h:88
N
#define N
Definition: af_mcompand.c:53
PSContext::H22
INTFLOAT H22[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC]
Definition: aacps.h:84
AAC_MSUB31_V3
#define AAC_MSUB31_V3(x, y, z)
Definition: aac_defines.h:110
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
internal.h
PSContext
Definition: aacps.h:72
PSCommonContext::is34bands_old
int is34bands_old
Definition: aacps.h:69
common.h
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
PSContext::opd_hist
int8_t opd_hist[PS_MAX_NR_IIDICC]
Definition: aacps.h:87
AAC_RENAME
#define AAC_RENAME(x)
Definition: aac_defines.h:83
len
int len
Definition: vorbis_enc_data.h:426
UINTFLOAT
float UINTFLOAT
Definition: aac_defines.h:87
hybrid_analysis
static void hybrid_analysis(PSDSPContext *dsp, INTFLOAT out[91][32][2], INTFLOAT in[5][44][2], INTFLOAT L[2][38][64], int is34, int len)
Definition: aacps.c:116
avcodec.h
PSCommonContext::ipd_par
int8_t ipd_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]
Inter-channel Phase Difference Parameters.
Definition: aacps.h:66
hybrid4_8_12_cx
static void hybrid4_8_12_cx(PSDSPContext *dsp, INTFLOAT(*in)[2], INTFLOAT(*out)[32][2], TABLE_CONST INTFLOAT(*filter)[8][2], int N, int len)
Definition: aacps.c:105
L
#define L(x)
Definition: vp56_arith.h:36
PSDSPContext::stereo_interpolate
void(* stereo_interpolate[2])(INTFLOAT(*l)[2], INTFLOAT(*r)[2], INTFLOAT h[2][4], INTFLOAT h_step[2][4], int len)
Definition: aacpsdsp.h:49
PS_MAX_NUM_ENV
#define PS_MAX_NUM_ENV
Definition: aacps.h:33
ff_psdsp_init
void AAC_RENAME() ff_psdsp_init(PSDSPContext *s)
Definition: aacpsdsp_template.c:212
AVCodecContext
main external API structure.
Definition: avcodec.h:389
power
static float power(float r, float g, float b, float max)
Definition: preserve_color.h:45
phi_fract
static int phi_fract[2][50][2]
Definition: aacps_fixed_tablegen.h:61
PSDSPContext
Definition: aacpsdsp.h:32
ps_tableinit
static void ps_tableinit(void)
Definition: aacps_fixed_tablegen.h:140
temp
else temp
Definition: vf_mcdeint.c:248
Q31
#define Q31(x)
Definition: aac_defines.h:96
PSCommonContext::iid_par
int8_t iid_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]
Inter-channel Intensity Difference Parameters.
Definition: aacps.h:63
remap20
static void remap20(int8_t(**p_par_mapped)[PS_MAX_NR_IIDICC], int8_t(*par)[PS_MAX_NR_IIDICC], int num_par, int num_env, int full)
Definition: aacps.c:539
ipdopd_reset
static void ipdopd_reset(int8_t *ipd_hist, int8_t *opd_hist)
Definition: aacps.c:43
ff_ps_apply
int AAC_RENAME() ff_ps_apply(AVCodecContext *avctx, PSContext *ps, INTFLOAT L[2][38][64], INTFLOAT R[2][38][64], int top)
Definition: aacps.c:720
h
h
Definition: vp9dsp_template.c:2038
PSContext::H11
INTFLOAT H11[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC]
Definition: aacps.h:81
PSCommonContext::icc_mode
int icc_mode
Definition: aacps.h:55
PS_BASELINE
#define PS_BASELINE
Operate in Baseline PS mode.
Definition: aacps.h:42
PSDSPContext::hybrid_analysis
void(* hybrid_analysis)(INTFLOAT(*out)[2], INTFLOAT(*in)[2], const INTFLOAT(*filter)[8][2], ptrdiff_t stride, int n)
Definition: aacpsdsp.h:36
PSCommonContext::iid_quant
int iid_quant
Definition: aacps.h:51
int
int
Definition: ffmpeg_filter.c:153
stereo_processing
static void stereo_processing(PSContext *ps, INTFLOAT(*l)[32][2], INTFLOAT(*r)[32][2], int is34)
Definition: aacps.c:558
PSCommonContext::icc_par
int8_t icc_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]
Inter-Channel Coherence Parameters.
Definition: aacps.h:64
PSContext::peak_decay_nrg
INTFLOAT peak_decay_nrg[34]
Definition: aacps.h:78
INTFLOAT
float INTFLOAT
Definition: aac_defines.h:86
numQMFSlots
#define numQMFSlots
Definition: aacps.h:46
Q30
#define Q30(x)
Definition: aac_defines.h:95
remap34
static void remap34(int8_t(**p_par_mapped)[PS_MAX_NR_IIDICC], int8_t(*par)[PS_MAX_NR_IIDICC], int num_par, int num_env, int full)
Definition: aacps.c:520
decorrelation
static void decorrelation(PSContext *ps, INTFLOAT(*out)[32][2], const INTFLOAT(*s)[32][2], int is34)
Definition: aacps.c:400
PSContext::H21
INTFLOAT H21[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC]
Definition: aacps.h:83