FFmpeg
aacdec_fixed.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013
3  * MIPS Technologies, Inc., California.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the MIPS Technologies, Inc., nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE MIPS TECHNOLOGIES, INC. ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE MIPS TECHNOLOGIES, INC. BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  *
29  * AAC decoder fixed-point implementation
30  *
31  * Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
32  * Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com )
33  *
34  * This file is part of FFmpeg.
35  *
36  * FFmpeg is free software; you can redistribute it and/or
37  * modify it under the terms of the GNU Lesser General Public
38  * License as published by the Free Software Foundation; either
39  * version 2.1 of the License, or (at your option) any later version.
40  *
41  * FFmpeg is distributed in the hope that it will be useful,
42  * but WITHOUT ANY WARRANTY; without even the implied warranty of
43  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
44  * Lesser General Public License for more details.
45  *
46  * You should have received a copy of the GNU Lesser General Public
47  * License along with FFmpeg; if not, write to the Free Software
48  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
49  */
50 
51 /**
52  * @file
53  * AAC decoder
54  * @author Oded Shimon ( ods15 ods15 dyndns org )
55  * @author Maxim Gavrilov ( maxim.gavrilov gmail com )
56  *
57  * Fixed point implementation
58  * @author Stanislav Ocovaj ( stanislav.ocovaj imgtec com )
59  */
60 
61 #define USE_FIXED 1
62 #define TX_TYPE AV_TX_INT32_MDCT
63 
64 #include "libavutil/fixed_dsp.h"
65 #include "libavutil/opt.h"
66 #include "avcodec.h"
67 #include "codec_internal.h"
68 #include "get_bits.h"
69 #include "lpc.h"
70 #include "kbdwin.h"
71 #include "sinewin_fixed_tablegen.h"
72 
73 #include "aac.h"
74 #include "aacdec.h"
75 #include "aactab.h"
76 #include "aacdectab.h"
77 #include "adts_header.h"
78 #include "cbrt_data.h"
79 #include "sbr.h"
80 #include "aacsbr.h"
81 #include "mpeg4audio.h"
82 #include "profiles.h"
83 #include "libavutil/intfloat.h"
84 
85 #include <math.h>
86 #include <string.h>
87 
88 DECLARE_ALIGNED(32, static int, AAC_RENAME2(aac_kbd_long_1024))[1024];
89 DECLARE_ALIGNED(32, static int, AAC_RENAME2(aac_kbd_short_128))[128];
92 
94 {
95  ps->r0.mant = 0;
96  ps->r0.exp = 0;
97  ps->r1.mant = 0;
98  ps->r1.exp = 0;
99  ps->cor0.mant = 0;
100  ps->cor0.exp = 0;
101  ps->cor1.mant = 0;
102  ps->cor1.exp = 0;
103  ps->var0.mant = 0x20000000;
104  ps->var0.exp = 1;
105  ps->var1.mant = 0x20000000;
106  ps->var1.exp = 1;
107 }
108 
109 static const int exp2tab[4] = { Q31(1.0000000000/2), Q31(1.1892071150/2), Q31(1.4142135624/2), Q31(1.6817928305/2) }; // 2^0, 2^0.25, 2^0.5, 2^0.75
110 
111 static inline int *DEC_SPAIR(int *dst, unsigned idx)
112 {
113  dst[0] = (idx & 15) - 4;
114  dst[1] = (idx >> 4 & 15) - 4;
115 
116  return dst + 2;
117 }
118 
119 static inline int *DEC_SQUAD(int *dst, unsigned idx)
120 {
121  dst[0] = (idx & 3) - 1;
122  dst[1] = (idx >> 2 & 3) - 1;
123  dst[2] = (idx >> 4 & 3) - 1;
124  dst[3] = (idx >> 6 & 3) - 1;
125 
126  return dst + 4;
127 }
128 
129 static inline int *DEC_UPAIR(int *dst, unsigned idx, unsigned sign)
130 {
131  dst[0] = (idx & 15) * (1 - (sign & 0xFFFFFFFE));
132  dst[1] = (idx >> 4 & 15) * (1 - ((sign & 1) * 2));
133 
134  return dst + 2;
135 }
136 
137 static inline int *DEC_UQUAD(int *dst, unsigned idx, unsigned sign)
138 {
139  unsigned nz = idx >> 12;
140 
141  dst[0] = (idx & 3) * (1 + (((int)sign >> 31) * 2));
142  sign <<= nz & 1;
143  nz >>= 1;
144  dst[1] = (idx >> 2 & 3) * (1 + (((int)sign >> 31) * 2));
145  sign <<= nz & 1;
146  nz >>= 1;
147  dst[2] = (idx >> 4 & 3) * (1 + (((int)sign >> 31) * 2));
148  sign <<= nz & 1;
149  nz >>= 1;
150  dst[3] = (idx >> 6 & 3) * (1 + (((int)sign >> 31) * 2));
151 
152  return dst + 4;
153 }
154 
155 static void vector_pow43(int *coefs, int len)
156 {
157  int i, coef;
158 
159  for (i=0; i<len; i++) {
160  coef = coefs[i];
161  if (coef < 0)
162  coef = -(int)ff_cbrt_tab_fixed[(-coef) & 8191];
163  else
164  coef = (int)ff_cbrt_tab_fixed[ coef & 8191];
165  coefs[i] = coef;
166  }
167 }
168 
169 static void subband_scale(int *dst, int *src, int scale, int offset, int len, void *log_context)
170 {
171  int ssign = scale < 0 ? -1 : 1;
172  int s = FFABS(scale);
173  unsigned int round;
174  int i, out, c = exp2tab[s & 3];
175 
176  s = offset - (s >> 2);
177 
178  if (s > 31) {
179  for (i=0; i<len; i++) {
180  dst[i] = 0;
181  }
182  } else if (s > 0) {
183  round = 1 << (s-1);
184  for (i=0; i<len; i++) {
185  out = (int)(((int64_t)src[i] * c) >> 32);
186  dst[i] = ((int)(out+round) >> s) * ssign;
187  }
188  } else if (s > -32) {
189  s = s + 32;
190  round = 1U << (s-1);
191  for (i=0; i<len; i++) {
192  out = (int)((int64_t)((int64_t)src[i] * c + round) >> s);
193  dst[i] = out * (unsigned)ssign;
194  }
195  } else {
196  av_log(log_context, AV_LOG_ERROR, "Overflow in subband_scale()\n");
197  }
198 }
199 
200 static void noise_scale(int *coefs, int scale, int band_energy, int len)
201 {
202  int s = -scale;
203  unsigned int round;
204  int i, out, c = exp2tab[s & 3];
205  int nlz = 0;
206 
207  av_assert0(s >= 0);
208  while (band_energy > 0x7fff) {
209  band_energy >>= 1;
210  nlz++;
211  }
212  c /= band_energy;
213  s = 21 + nlz - (s >> 2);
214 
215  if (s > 31) {
216  for (i=0; i<len; i++) {
217  coefs[i] = 0;
218  }
219  } else if (s >= 0) {
220  round = s ? 1 << (s-1) : 0;
221  for (i=0; i<len; i++) {
222  out = (int)(((int64_t)coefs[i] * c) >> 32);
223  coefs[i] = -((int)(out+round) >> s);
224  }
225  }
226  else {
227  s = s + 32;
228  if (s > 0) {
229  round = 1 << (s-1);
230  for (i=0; i<len; i++) {
231  out = (int)((int64_t)((int64_t)coefs[i] * c + round) >> s);
232  coefs[i] = -out;
233  }
234  } else {
235  for (i=0; i<len; i++)
236  coefs[i] = -(int64_t)coefs[i] * c * (1 << -s);
237  }
238  }
239 }
240 
242 {
243  SoftFloat tmp;
244  int s;
245 
246  tmp.exp = pf.exp;
247  s = pf.mant >> 31;
248  tmp.mant = (pf.mant ^ s) - s;
249  tmp.mant = (tmp.mant + 0x00200000U) & 0xFFC00000U;
250  tmp.mant = (tmp.mant ^ s) - s;
251 
252  return tmp;
253 }
254 
256 {
257  SoftFloat tmp;
258  int s;
259 
260  tmp.exp = pf.exp;
261  s = pf.mant >> 31;
262  tmp.mant = (pf.mant ^ s) - s;
263  tmp.mant = (tmp.mant + 0x001FFFFFU + (tmp.mant & 0x00400000U >> 16)) & 0xFFC00000U;
264  tmp.mant = (tmp.mant ^ s) - s;
265 
266  return tmp;
267 }
268 
270 {
271  SoftFloat pun;
272  int s;
273 
274  pun.exp = pf.exp;
275  s = pf.mant >> 31;
276  pun.mant = (pf.mant ^ s) - s;
277  pun.mant = pun.mant & 0xFFC00000U;
278  pun.mant = (pun.mant ^ s) - s;
279 
280  return pun;
281 }
282 
283 static av_always_inline void predict(PredictorState *ps, int *coef,
284  int output_enable)
285 {
286  const SoftFloat a = { 1023410176, 0 }; // 61.0 / 64
287  const SoftFloat alpha = { 973078528, 0 }; // 29.0 / 32
288  SoftFloat e0, e1;
289  SoftFloat pv;
290  SoftFloat k1, k2;
291  SoftFloat r0 = ps->r0, r1 = ps->r1;
292  SoftFloat cor0 = ps->cor0, cor1 = ps->cor1;
293  SoftFloat var0 = ps->var0, var1 = ps->var1;
294  SoftFloat tmp;
295 
296  if (var0.exp > 1 || (var0.exp == 1 && var0.mant > 0x20000000)) {
297  k1 = av_mul_sf(cor0, flt16_even(av_div_sf(a, var0)));
298  }
299  else {
300  k1.mant = 0;
301  k1.exp = 0;
302  }
303 
304  if (var1.exp > 1 || (var1.exp == 1 && var1.mant > 0x20000000)) {
305  k2 = av_mul_sf(cor1, flt16_even(av_div_sf(a, var1)));
306  }
307  else {
308  k2.mant = 0;
309  k2.exp = 0;
310  }
311 
312  tmp = av_mul_sf(k1, r0);
313  pv = flt16_round(av_add_sf(tmp, av_mul_sf(k2, r1)));
314  if (output_enable) {
315  int shift = 28 - pv.exp;
316 
317  if (shift < 31) {
318  if (shift > 0) {
319  *coef += (unsigned)((pv.mant + (1 << (shift - 1))) >> shift);
320  } else
321  *coef += (unsigned)pv.mant << -shift;
322  }
323  }
324 
325  e0 = av_int2sf(*coef, 2);
326  e1 = av_sub_sf(e0, tmp);
327 
328  ps->cor1 = flt16_trunc(av_add_sf(av_mul_sf(alpha, cor1), av_mul_sf(r1, e1)));
329  tmp = av_add_sf(av_mul_sf(r1, r1), av_mul_sf(e1, e1));
330  tmp.exp--;
331  ps->var1 = flt16_trunc(av_add_sf(av_mul_sf(alpha, var1), tmp));
332  ps->cor0 = flt16_trunc(av_add_sf(av_mul_sf(alpha, cor0), av_mul_sf(r0, e0)));
333  tmp = av_add_sf(av_mul_sf(r0, r0), av_mul_sf(e0, e0));
334  tmp.exp--;
335  ps->var0 = flt16_trunc(av_add_sf(av_mul_sf(alpha, var0), tmp));
336 
337  ps->r1 = flt16_trunc(av_mul_sf(a, av_sub_sf(r0, av_mul_sf(k1, e0))));
338  ps->r0 = flt16_trunc(av_mul_sf(a, e0));
339 }
340 
341 
342 static const int cce_scale_fixed[8] = {
343  Q30(1.0), //2^(0/8)
344  Q30(1.0905077327), //2^(1/8)
345  Q30(1.1892071150), //2^(2/8)
346  Q30(1.2968395547), //2^(3/8)
347  Q30(1.4142135624), //2^(4/8)
348  Q30(1.5422108254), //2^(5/8)
349  Q30(1.6817928305), //2^(6/8)
350  Q30(1.8340080864), //2^(7/8)
351 };
352 
353 /**
354  * Apply dependent channel coupling (applied before IMDCT).
355  *
356  * @param index index into coupling gain array
357  */
359  SingleChannelElement *target,
360  ChannelElement *cce, int index)
361 {
362  IndividualChannelStream *ics = &cce->ch[0].ics;
363  const uint16_t *offsets = ics->swb_offset;
364  int *dest = target->coeffs;
365  const int *src = cce->ch[0].coeffs;
366  int g, i, group, k, idx = 0;
367  if (ac->oc[1].m4ac.object_type == AOT_AAC_LTP) {
369  "Dependent coupling is not supported together with LTP\n");
370  return;
371  }
372  for (g = 0; g < ics->num_window_groups; g++) {
373  for (i = 0; i < ics->max_sfb; i++, idx++) {
374  if (cce->ch[0].band_type[idx] != ZERO_BT) {
375  const int gain = cce->coup.gain[index][idx];
376  int shift, round, c, tmp;
377 
378  if (gain < 0) {
379  c = -cce_scale_fixed[-gain & 7];
380  shift = (-gain-1024) >> 3;
381  }
382  else {
383  c = cce_scale_fixed[gain & 7];
384  shift = (gain-1024) >> 3;
385  }
386 
387  if (shift < -31) {
388  // Nothing to do
389  } else if (shift < 0) {
390  shift = -shift;
391  round = 1 << (shift - 1);
392 
393  for (group = 0; group < ics->group_len[g]; group++) {
394  for (k = offsets[i]; k < offsets[i + 1]; k++) {
395  tmp = (int)(((int64_t)src[group * 128 + k] * c + \
396  (int64_t)0x1000000000) >> 37);
397  dest[group * 128 + k] += (tmp + (int64_t)round) >> shift;
398  }
399  }
400  }
401  else {
402  for (group = 0; group < ics->group_len[g]; group++) {
403  for (k = offsets[i]; k < offsets[i + 1]; k++) {
404  tmp = (int)(((int64_t)src[group * 128 + k] * c + \
405  (int64_t)0x1000000000) >> 37);
406  dest[group * 128 + k] += tmp * (1U << shift);
407  }
408  }
409  }
410  }
411  }
412  dest += ics->group_len[g] * 128;
413  src += ics->group_len[g] * 128;
414  }
415 }
416 
417 /**
418  * Apply independent channel coupling (applied after IMDCT).
419  *
420  * @param index index into coupling gain array
421  */
423  SingleChannelElement *target,
424  ChannelElement *cce, int index)
425 {
426  int i, c, shift, round, tmp;
427  const int gain = cce->coup.gain[index][0];
428  const int *src = cce->ch[0].ret;
429  unsigned int *dest = target->ret;
430  const int len = 1024 << (ac->oc[1].m4ac.sbr == 1);
431 
432  c = cce_scale_fixed[gain & 7];
433  shift = (gain-1024) >> 3;
434  if (shift < -31) {
435  return;
436  } else if (shift < 0) {
437  shift = -shift;
438  round = 1 << (shift - 1);
439 
440  for (i = 0; i < len; i++) {
441  tmp = (int)(((int64_t)src[i] * c + (int64_t)0x1000000000) >> 37);
442  dest[i] += (tmp + round) >> shift;
443  }
444  }
445  else {
446  for (i = 0; i < len; i++) {
447  tmp = (int)(((int64_t)src[i] * c + (int64_t)0x1000000000) >> 37);
448  dest[i] += tmp * (1U << shift);
449  }
450  }
451 }
452 
453 #include "aacdec_template.c"
454 
456  .p.name = "aac_fixed",
457  CODEC_LONG_NAME("AAC (Advanced Audio Coding)"),
458  .p.type = AVMEDIA_TYPE_AUDIO,
459  .p.id = AV_CODEC_ID_AAC,
460  .priv_data_size = sizeof(AACDecContext),
462  .close = aac_decode_close,
464  .p.sample_fmts = (const enum AVSampleFormat[]) {
466  },
467  .p.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
468  .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
469  CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(ff_aac_channel_layout)
470  .p.ch_layouts = ff_aac_ch_layout,
471  .p.priv_class = &aac_decoder_class,
472  .p.profiles = NULL_IF_CONFIG_SMALL(ff_aac_profiles),
473  .flush = flush,
474 };
vector_pow43
static void vector_pow43(int *coefs, int len)
Definition: aacdec_fixed.c:155
flt16_even
static av_always_inline SoftFloat flt16_even(SoftFloat pf)
Definition: aacdec_fixed.c:255
FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: codec_internal.h:42
opt.h
out
FILE * out
Definition: movenc.c:54
aac_decode_init
static av_cold int aac_decode_init(AVCodecContext *avctx)
Definition: aacdec_template.c:1154
aac_kbd_short_120
static INTFLOAT aac_kbd_short_120[120]
Definition: aacdec.c:73
PredictorState::var1
AAC_FLOAT var1
Definition: aac.h:95
aacsbr.h
tmp
static uint8_t tmp[11]
Definition: aes_ctr.c:28
PredictorState::var0
AAC_FLOAT var0
Definition: aac.h:94
av_sub_sf
static av_const SoftFloat av_sub_sf(SoftFloat a, SoftFloat b)
Definition: softfloat.h:173
aacdectab.h
AV_SAMPLE_FMT_S32P
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
Definition: samplefmt.h:65
FFCodec
Definition: codec_internal.h:127
ff_aac_profiles
const AVProfile ff_aac_profiles[]
Definition: profiles.c:26
SoftFloat::mant
int32_t mant
Definition: softfloat.h:35
DEC_SQUAD
static int * DEC_SQUAD(int *dst, unsigned idx)
Definition: aacdec_fixed.c:119
lpc.h
SingleChannelElement::ret
INTFLOAT * ret
PCM output.
Definition: aacdec.h:142
intfloat.h
ChannelElement::ch
SingleChannelElement ch[2]
Definition: aacdec.h:153
sbr.h
apply_independent_coupling_fixed
static void apply_independent_coupling_fixed(AACDecContext *ac, SingleChannelElement *target, ChannelElement *cce, int index)
Apply independent channel coupling (applied after IMDCT).
Definition: aacdec_fixed.c:422
FFCodec::p
AVCodec p
The public AVCodec.
Definition: codec_internal.h:131
mpeg4audio.h
ChannelElement::coup
ChannelCoupling coup
Definition: aacdec.h:155
av_div_sf
static av_const SoftFloat av_div_sf(SoftFloat a, SoftFloat b)
b has to be normalized and not zero.
Definition: softfloat.h:116
PredictorState::r0
AAC_FLOAT r0
Definition: aac.h:96
SingleChannelElement::ics
IndividualChannelStream ics
Definition: aacdec.h:132
aac_decode_frame
static int aac_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
Definition: aacdec_template.c:3319
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
ZERO_BT
@ ZERO_BT
Scalefactors and spectral data are all zero.
Definition: aac.h:70
ff_cbrt_tab_fixed
uint32_t ff_cbrt_tab_fixed[1<< 13]
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:306
aac_decoder_class
static const AVClass aac_decoder_class
Definition: aacdec_template.c:3451
s
#define s(width, name)
Definition: cbs_vp9.c:198
SingleChannelElement::coeffs
INTFLOAT coeffs[1024]
coefficients for IMDCT, maybe processed
Definition: aacdec.h:137
offsets
static const int offsets[]
Definition: hevc_pel.c:34
g
const char * g
Definition: vf_curves.c:127
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:40
PredictorState
Predictor State.
Definition: aac.h:91
get_bits.h
predict
static av_always_inline void predict(PredictorState *ps, int *coef, int output_enable)
Definition: aacdec_fixed.c:283
kbdwin.h
ff_aac_ch_layout
const AVChannelLayout ff_aac_ch_layout[]
Definition: aacdec_common.c:112
fixed_dsp.h
IndividualChannelStream
Individual Channel Stream.
Definition: aacdec.h:84
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:272
FFABS
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
Definition: common.h:72
IndividualChannelStream::num_window_groups
int num_window_groups
Definition: aacdec.h:88
apply_dependent_coupling_fixed
static void apply_dependent_coupling_fixed(AACDecContext *ac, SingleChannelElement *target, ChannelElement *cce, int index)
Apply dependent channel coupling (applied before IMDCT).
Definition: aacdec_fixed.c:358
sinewin_fixed_tablegen.h
aac_decode_close
static av_cold int aac_decode_close(AVCodecContext *avctx)
Definition: aacdec_template.c:3382
profiles.h
flush
void(* flush)(AVBSFContext *ctx)
Definition: dts2pts.c:367
aac.h
aactab.h
SoftFloat::exp
int32_t exp
Definition: softfloat.h:36
PredictorState::r1
AAC_FLOAT r1
Definition: aac.h:97
index
int index
Definition: gxfenc.c:89
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
AV_CODEC_CAP_CHANNEL_CONF
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
Definition: codec.h:106
AV_CODEC_ID_AAC
@ AV_CODEC_ID_AAC
Definition: codec_id.h:445
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:365
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
scale
static void scale(int *out, const int *in, const int w, const int h, const int shift)
Definition: vvc_intra.c:291
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:106
reset_predict_state
static av_always_inline void reset_predict_state(PredictorState *ps)
Definition: aacdec_fixed.c:93
codec_internal.h
DECLARE_ALIGNED
#define DECLARE_ALIGNED(n, t, v)
Definition: mem_internal.h:109
shift
static int shift(int a, int b)
Definition: bonk.c:262
noise_scale
static void noise_scale(int *coefs, int scale, int band_energy, int len)
Definition: aacdec_fixed.c:200
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:56
AAC_RENAME2
#define AAC_RENAME2(x)
Definition: aac_defines.h:79
a
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
Definition: undefined.txt:41
offset
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
Definition: writing_filters.txt:86
SingleChannelElement::band_type
enum BandType band_type[128]
band types
Definition: aacdec.h:134
cbrt_data.h
aac_kbd_long_960
static INTFLOAT aac_kbd_long_960[960]
Definition: aacdec.c:72
cce_scale_fixed
static const int cce_scale_fixed[8]
Definition: aacdec_fixed.c:342
CODEC_OLD_CHANNEL_LAYOUTS_ARRAY
#define CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(array)
Definition: codec_internal.h:303
SoftFloat
Definition: softfloat.h:34
SingleChannelElement
Single Channel Element - used for both SCE and LFE elements.
Definition: aacdec.h:131
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
round
static av_always_inline av_const double round(double x)
Definition: libm.h:444
ChannelElement
channel element - generic struct for SCE/CPE/CCE/LFE
Definition: aacdec.h:148
IndividualChannelStream::swb_offset
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:91
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:55
av_always_inline
#define av_always_inline
Definition: attributes.h:49
av_int2sf
static av_const SoftFloat av_int2sf(int v, int frac_bits)
Converts a mantisse and exponent to a SoftFloat.
Definition: softfloat.h:185
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:194
len
int len
Definition: vorbis_enc_data.h:426
AACDecContext::oc
OutputConfiguration oc[2]
Definition: aacdec.h:259
ff_aac_fixed_decoder
const FFCodec ff_aac_fixed_decoder
Definition: aacdec_fixed.c:455
subband_scale
static void subband_scale(int *dst, int *src, int scale, int offset, int len, void *log_context)
Definition: aacdec_fixed.c:169
avcodec.h
pv
#define pv
Definition: regdef.h:60
exp2tab
static const int exp2tab[4]
Definition: aacdec_fixed.c:109
MPEG4AudioConfig::object_type
int object_type
Definition: mpeg4audio.h:30
U
#define U(x)
Definition: vpx_arith.h:37
aacdec.h
AACDecContext
main AAC decoding context
Definition: aacdec.h:186
AACDecContext::avctx
struct AVCodecContext * avctx
Definition: aacdec.h:188
av_add_sf
static av_const SoftFloat av_add_sf(SoftFloat a, SoftFloat b)
Definition: softfloat.h:162
ChannelCoupling::gain
INTFLOAT gain[16][120]
Definition: aacdec.h:125
MPEG4AudioConfig::sbr
int sbr
-1 implicit, 1 presence
Definition: mpeg4audio.h:34
Q31
#define Q31(x)
Definition: aac_defines.h:90
OutputConfiguration::m4ac
MPEG4AudioConfig m4ac
Definition: aacdec.h:160
DEC_UQUAD
static int * DEC_UQUAD(int *dst, unsigned idx, unsigned sign)
Definition: aacdec_fixed.c:137
aacdec_template.c
PredictorState::cor1
AAC_FLOAT cor1
Definition: aac.h:93
adts_header.h
alpha
static const int16_t alpha[]
Definition: ilbcdata.h:55
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
IndividualChannelStream::max_sfb
uint8_t max_sfb
number of scalefactor bands per group
Definition: aacdec.h:85
flt16_round
static av_always_inline SoftFloat flt16_round(SoftFloat pf)
Definition: aacdec_fixed.c:241
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
DEC_UPAIR
static int * DEC_UPAIR(int *dst, unsigned idx, unsigned sign)
Definition: aacdec_fixed.c:129
DEC_SPAIR
static int * DEC_SPAIR(int *dst, unsigned idx)
Definition: aacdec_fixed.c:111
int
int
Definition: ffmpeg_filter.c:424
IndividualChannelStream::group_len
uint8_t group_len[8]
Definition: aacdec.h:89
av_mul_sf
static av_const SoftFloat av_mul_sf(SoftFloat a, SoftFloat b)
Definition: softfloat.h:102
flt16_trunc
static av_always_inline SoftFloat flt16_trunc(SoftFloat pf)
Definition: aacdec_fixed.c:269
AOT_AAC_LTP
@ AOT_AAC_LTP
Y Long Term Prediction.
Definition: mpeg4audio.h:76
Q30
#define Q30(x)
Definition: aac_defines.h:89
PredictorState::cor0
AAC_FLOAT cor0
Definition: aac.h:92