History

aacdec: move spectrum decode and dequantization to a new file

Lynne committed 2 years ago

Commit 41ae2b01 parent 5c026e610 files · +626 −531Browse files

Showing the changes to libavcodec/aac (6 of 10 files). Show all

Unified · Split

6 files
  1. libavcodec/aac/aacdec.c +4 −0
  2. libavcodec/aac/aacdec_dsp_template.c +1 −1
  3. libavcodec/aac/aacdec_fixed.c +5 −0
  4. libavcodec/aac/aacdec_fixed_dequant.h +174 −0
  5. libavcodec/aac/aacdec_float.c +74 −0
  6. libavcodec/aac/aacdec_proc_template.c +354 −0
libavcodec/aac/aacdec.c+4−0
@@ -48,6 +48,9 @@ · 47 unmodified lines
4848 extern const AACDecDSP aac_dsp;
4949 extern const AACDecDSP aac_dsp_fixed;
5050
51+extern const AACDecProc aac_proc;
52+extern const AACDecProc aac_proc_fixed;
53+
5154 av_cold int ff_aac_decode_close(AVCodecContext *avctx)
5255 {
5356 AACDecContext *ac = avctx->priv_data;
@@ -119,6 +122,7 @@ av_cold int ff_aac_decode_init_common(AVCodecContext *avctx) · 65 unmodified lines
119122 return ret;
120123
121124 ac->dsp = is_fixed ? aac_dsp_fixed : aac_dsp;
125+ ac->proc = is_fixed ? aac_proc_fixed : aac_proc;
122126
123127 ac->dsp.init_tables();
124128
libavcodec/aac/aacdec_dsp_template.c+1−1
@@ -151,7 +151,7 @@ static void AAC_RENAME(apply_intensity_stereo)(AACDecContext *ac, · 150 unmodified lines
151151 scale = c * sce1->AAC_RENAME(sf)[idx];
152152 for (group = 0; group < ics->group_len[g]; group++)
153153 #if USE_FIXED
154− ac->subband_scale(coef1 + group * 128 + offsets[i],
154+ subband_scale(coef1 + group * 128 + offsets[i],
155155 coef0 + group * 128 + offsets[i],
156156 scale,
157157 23,
libavcodec/aac/aacdec_fixed.c+5−0
@@ -38,6 +38,7 @@ · 37 unmodified lines
3838 #include "libavcodec/aactab.h"
3939 #include "libavcodec/sinewin_fixed_tablegen.h"
4040 #include "libavcodec/kbdwin.h"
41+#include "libavcodec/cbrt_data.h"
4142
4243 DECLARE_ALIGNED(32, static INTFLOAT, AAC_RENAME2(aac_kbd_long_1024))[1024];
4344 DECLARE_ALIGNED(32, static INTFLOAT, AAC_RENAME2(aac_kbd_short_128))[128];
@@ -61,4 +62,8 @@ static void init_tables_fixed(void) · 17 unmodified lines
6162 ff_thread_once(&init_fixed_once, init_tables_fixed_fn);
6263 }
6364
65+/** Dequantization-related */
66+#include "aacdec_fixed_dequant.h"
67+
6468 #include "aacdec_dsp_template.c"
69+#include "aacdec_proc_template.c"
libavcodec/aac/aacdec_fixed_dequant.h+174−0
@@ -0,0 +1,174 @@
1+/*
2+ * AAC decoder
3+ * Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
4+ * Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com )
5+ * Copyright (c) 2008-2013 Alex Converse <alex.converse@gmail.com>
6+ *
7+ * AAC LATM decoder
8+ * Copyright (c) 2008-2010 Paul Kendall <paul@kcbbs.gen.nz>
9+ * Copyright (c) 2010 Janne Grunau <janne-libav@jannau.net>
10+ *
11+ * AAC decoder fixed-point implementation
12+ * Copyright (c) 2013
13+ * MIPS Technologies, Inc., California.
14+ *
15+ * This file is part of FFmpeg.
16+ *
17+ * FFmpeg is free software; you can redistribute it and/or
18+ * modify it under the terms of the GNU Lesser General Public
19+ * License as published by the Free Software Foundation; either
20+ * version 2.1 of the License, or (at your option) any later version.
21+ *
22+ * FFmpeg is distributed in the hope that it will be useful,
23+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
24+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25+ * Lesser General Public License for more details.
26+ *
27+ * You should have received a copy of the GNU Lesser General Public
28+ * License along with FFmpeg; if not, write to the Free Software
29+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
30+ */
31+
32+#ifndef AVCODEC_AAC_AACDEC_FIXED_DEQUANT_H
33+#define AVCODEC_AAC_AACDEC_FIXED_DEQUANT_H
34+
35+#include "aacdec_tab.h"
36+
37+static void inline vector_pow43(int *coefs, int len)
38+{
39+ int i, coef;
40+
41+ for (i=0; i<len; i++) {
42+ coef = coefs[i];
43+ if (coef < 0)
44+ coef = -(int)ff_cbrt_tab_fixed[(-coef) & 8191];
45+ else
46+ coef = (int)ff_cbrt_tab_fixed[ coef & 8191];
47+ coefs[i] = coef;
48+ }
49+}
50+
51+/* 2^0, 2^0.25, 2^0.5, 2^0.75 */
52+static const int exp2tab[4] = {
53+ Q31(1.0000000000/2), Q31(1.1892071150/2),
54+ Q31(1.4142135624/2), Q31(1.6817928305/2)
55+};
56+
57+static void inline subband_scale(int *dst, int *src, int scale,
58+ int offset, int len, void *log_context)
59+{
60+ int ssign = scale < 0 ? -1 : 1;
61+ int s = FFABS(scale);
62+ unsigned int round;
63+ int i, out, c = exp2tab[s & 3];
64+
65+ s = offset - (s >> 2);
66+
67+ if (s > 31) {
68+ for (i=0; i<len; i++) {
69+ dst[i] = 0;
70+ }
71+ } else if (s > 0) {
72+ round = 1 << (s-1);
73+ for (i=0; i<len; i++) {
74+ out = (int)(((int64_t)src[i] * c) >> 32);
75+ dst[i] = ((int)(out+round) >> s) * ssign;
76+ }
77+ } else if (s > -32) {
78+ s = s + 32;
79+ round = 1U << (s-1);
80+ for (i=0; i<len; i++) {
81+ out = (int)((int64_t)((int64_t)src[i] * c + round) >> s);
82+ dst[i] = out * (unsigned)ssign;
83+ }
84+ } else {
85+ av_log(log_context, AV_LOG_ERROR, "Overflow in subband_scale()\n");
86+ }
87+}
88+
89+static void noise_scale(int *coefs, int scale, int band_energy, int len)
90+{
91+ int s = -scale;
92+ unsigned int round;
93+ int i, out, c = exp2tab[s & 3];
94+ int nlz = 0;
95+
96+ av_assert0(s >= 0);
97+ while (band_energy > 0x7fff) {
98+ band_energy >>= 1;
99+ nlz++;
100+ }
101+ c /= band_energy;
102+ s = 21 + nlz - (s >> 2);
103+
104+ if (s > 31) {
105+ for (i=0; i<len; i++) {
106+ coefs[i] = 0;
107+ }
108+ } else if (s >= 0) {
109+ round = s ? 1 << (s-1) : 0;
110+ for (i=0; i<len; i++) {
111+ out = (int)(((int64_t)coefs[i] * c) >> 32);
112+ coefs[i] = -((int)(out+round) >> s);
113+ }
114+ }
115+ else {
116+ s = s + 32;
117+ if (s > 0) {
118+ round = 1 << (s-1);
119+ for (i=0; i<len; i++) {
120+ out = (int)((int64_t)((int64_t)coefs[i] * c + round) >> s);
121+ coefs[i] = -out;
122+ }
123+ } else {
124+ for (i=0; i<len; i++)
125+ coefs[i] = -(int64_t)coefs[i] * c * (1 << -s);
126+ }
127+ }
128+}
129+
130+static inline int *DEC_SPAIR(int *dst, unsigned idx)
131+{
132+ dst[0] = (idx & 15) - 4;
133+ dst[1] = (idx >> 4 & 15) - 4;
134+
135+ return dst + 2;
136+}
137+
138+static inline int *DEC_SQUAD(int *dst, unsigned idx)
139+{
140+ dst[0] = (idx & 3) - 1;
141+ dst[1] = (idx >> 2 & 3) - 1;
142+ dst[2] = (idx >> 4 & 3) - 1;
143+ dst[3] = (idx >> 6 & 3) - 1;
144+
145+ return dst + 4;
146+}
147+
148+static inline int *DEC_UPAIR(int *dst, unsigned idx, unsigned sign)
149+{
150+ dst[0] = (idx & 15) * (1 - (sign & 0xFFFFFFFE));
151+ dst[1] = (idx >> 4 & 15) * (1 - ((sign & 1) * 2));
152+
153+ return dst + 2;
154+}
155+
156+static inline int *DEC_UQUAD(int *dst, unsigned idx, unsigned sign)
157+{
158+ unsigned nz = idx >> 12;
159+
160+ dst[0] = (idx & 3) * (1 + (((int)sign >> 31) * 2));
161+ sign <<= nz & 1;
162+ nz >>= 1;
163+ dst[1] = (idx >> 2 & 3) * (1 + (((int)sign >> 31) * 2));
164+ sign <<= nz & 1;
165+ nz >>= 1;
166+ dst[2] = (idx >> 4 & 3) * (1 + (((int)sign >> 31) * 2));
167+ sign <<= nz & 1;
168+ nz >>= 1;
169+ dst[3] = (idx >> 6 & 3) * (1 + (((int)sign >> 31) * 2));
170+
171+ return dst + 4;
172+}
173+
174+#endif /* AVCODEC_AAC_AACDEC_FIXED_DEQUANT_H */
libavcodec/aac/aacdec_float.c+74−0
@@ -38,6 +38,7 @@ · 37 unmodified lines
3838 #include "libavcodec/aactab.h"
3939 #include "libavcodec/sinewin.h"
4040 #include "libavcodec/kbdwin.h"
41+#include "libavcodec/cbrt_data.h"
4142
4243 DECLARE_ALIGNED(32, static float, sine_120)[120];
4344 DECLARE_ALIGNED(32, static float, sine_960)[960];
@@ -63,4 +64,77 @@ static void init_tables(void) · 19 unmodified lines
6364 ff_thread_once(&init_float_once, init_tables_float_fn);
6465 }
6566
67+/** Dequantization-related **/
68+#include "aacdec_tab.h"
69+#include "libavutil/intfloat.h"
70+
71+#ifndef VMUL2
72+static inline float *VMUL2(float *dst, const float *v, unsigned idx,
73+ const float *scale)
74+{
75+ float s = *scale;
76+ *dst++ = v[idx & 15] * s;
77+ *dst++ = v[idx>>4 & 15] * s;
78+ return dst;
79+}
80+#endif
81+
82+#ifndef VMUL4
83+static inline float *VMUL4(float *dst, const float *v, unsigned idx,
84+ const float *scale)
85+{
86+ float s = *scale;
87+ *dst++ = v[idx & 3] * s;
88+ *dst++ = v[idx>>2 & 3] * s;
89+ *dst++ = v[idx>>4 & 3] * s;
90+ *dst++ = v[idx>>6 & 3] * s;
91+ return dst;
92+}
93+#endif
94+
95+#ifndef VMUL2S
96+static inline float *VMUL2S(float *dst, const float *v, unsigned idx,
97+ unsigned sign, const float *scale)
98+{
99+ union av_intfloat32 s0, s1;
100+
101+ s0.f = s1.f = *scale;
102+ s0.i ^= sign >> 1 << 31;
103+ s1.i ^= sign << 31;
104+
105+ *dst++ = v[idx & 15] * s0.f;
106+ *dst++ = v[idx>>4 & 15] * s1.f;
107+
108+ return dst;
109+}
110+#endif
111+
112+#ifndef VMUL4S
113+static inline float *VMUL4S(float *dst, const float *v, unsigned idx,
114+ unsigned sign, const float *scale)
115+{
116+ unsigned nz = idx >> 12;
117+ union av_intfloat32 s = { .f = *scale };
118+ union av_intfloat32 t;
119+
120+ t.i = s.i ^ (sign & 1U<<31);
121+ *dst++ = v[idx & 3] * t.f;
122+
123+ sign <<= nz & 1; nz >>= 1;
124+ t.i = s.i ^ (sign & 1U<<31);
125+ *dst++ = v[idx>>2 & 3] * t.f;
126+
127+ sign <<= nz & 1; nz >>= 1;
128+ t.i = s.i ^ (sign & 1U<<31);
129+ *dst++ = v[idx>>4 & 3] * t.f;
130+
131+ sign <<= nz & 1;
132+ t.i = s.i ^ (sign & 1U<<31);
133+ *dst++ = v[idx>>6 & 3] * t.f;
134+
135+ return dst;
136+}
137+#endif
138+
66139 #include "aacdec_dsp_template.c"
140+#include "aacdec_proc_template.c"
libavcodec/aac/aacdec_proc_template.c+354−0
@@ -0,0 +1,354 @@
1+/*
2+ * AAC decoder
3+ * Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
4+ * Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com )
5+ * Copyright (c) 2008-2013 Alex Converse <alex.converse@gmail.com>
6+ *
7+ * AAC LATM decoder
8+ * Copyright (c) 2008-2010 Paul Kendall <paul@kcbbs.gen.nz>
9+ * Copyright (c) 2010 Janne Grunau <janne-libav@jannau.net>
10+ *
11+ * AAC decoder fixed-point implementation
12+ * Copyright (c) 2013
13+ * MIPS Technologies, Inc., California.
14+ *
15+ * This file is part of FFmpeg.
16+ *
17+ * FFmpeg is free software; you can redistribute it and/or
18+ * modify it under the terms of the GNU Lesser General Public
19+ * License as published by the Free Software Foundation; either
20+ * version 2.1 of the License, or (at your option) any later version.
21+ *
22+ * FFmpeg is distributed in the hope that it will be useful,
23+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
24+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25+ * Lesser General Public License for more details.
26+ *
27+ * You should have received a copy of the GNU Lesser General Public
28+ * License along with FFmpeg; if not, write to the Free Software
29+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
30+ */
31+
32+/**
33+ * linear congruential pseudorandom number generator
34+ *
35+ * @param previous_val pointer to the current state of the generator
36+ *
37+ * @return Returns a 32-bit pseudorandom integer
38+ */
39+static av_always_inline int lcg_random(unsigned previous_val)
40+{
41+ union { unsigned u; int s; } v = { previous_val * 1664525u + 1013904223 };
42+ return v.s;
43+}
44+
45+/**
46+ * Decode spectral data; reference: table 4.50.
47+ * Dequantize and scale spectral data; reference: 4.6.3.3.
48+ *
49+ * @param coef array of dequantized, scaled spectral data
50+ * @param sf array of scalefactors or intensity stereo positions
51+ * @param pulse_present set if pulses are present
52+ * @param pulse pointer to pulse data struct
53+ * @param band_type array of the used band type
54+ *
55+ * @return Returns error status. 0 - OK, !0 - error
56+ */
57+static int AAC_RENAME(decode_spectrum_and_dequant)(AACDecContext *ac,
58+ GetBitContext *gb,
59+ const Pulse *pulse,
60+ SingleChannelElement *sce)
61+{
62+ int i, k, g, idx = 0;
63+ INTFLOAT *coef = sce->AAC_RENAME(coeffs);
64+ IndividualChannelStream *ics = &sce->ics;
65+ const int c = 1024 / ics->num_windows;
66+ const uint16_t *offsets = ics->swb_offset;
67+ const INTFLOAT *sf = sce->AAC_RENAME(sf);
68+ const enum BandType *band_type = sce->band_type;
69+ INTFLOAT *coef_base = coef;
70+
71+ for (g = 0; g < ics->num_windows; g++)
72+ memset(coef + g * 128 + offsets[ics->max_sfb], 0,
73+ sizeof(INTFLOAT) * (c - offsets[ics->max_sfb]));
74+
75+ for (g = 0; g < ics->num_window_groups; g++) {
76+ unsigned g_len = ics->group_len[g];
77+
78+ for (i = 0; i < ics->max_sfb; i++, idx++) {
79+ const unsigned cbt_m1 = band_type[idx] - 1;
80+ INTFLOAT *cfo = coef + offsets[i];
81+ int off_len = offsets[i + 1] - offsets[i];
82+ int group;
83+
84+ if (cbt_m1 >= INTENSITY_BT2 - 1) {
85+ for (group = 0; group < (AAC_SIGNE)g_len; group++, cfo+=128) {
86+ memset(cfo, 0, off_len * sizeof(*cfo));
87+ }
88+ } else if (cbt_m1 == NOISE_BT - 1) {
89+ for (group = 0; group < (AAC_SIGNE)g_len; group++, cfo+=128) {
90+ INTFLOAT band_energy;
91+#if USE_FIXED
92+ for (k = 0; k < off_len; k++) {
93+ ac->random_state = lcg_random(ac->random_state);
94+ cfo[k] = ac->random_state >> 3;
95+ }
96+
97+ band_energy = ac->fdsp->scalarproduct_fixed(cfo, cfo, off_len);
98+ band_energy = fixed_sqrt(band_energy, 31);
99+ noise_scale(cfo, sf[idx], band_energy, off_len);
100+#else
101+ float scale;
102+
103+ for (k = 0; k < off_len; k++) {
104+ ac->random_state = lcg_random(ac->random_state);
105+ cfo[k] = ac->random_state;
106+ }
107+
108+ band_energy = ac->fdsp->scalarproduct_float(cfo, cfo, off_len);
109+ scale = sf[idx] / sqrtf(band_energy);
110+ ac->fdsp->vector_fmul_scalar(cfo, cfo, scale, off_len);
111+#endif /* USE_FIXED */
112+ }
113+ } else {
114+#if !USE_FIXED
115+ const float *vq = ff_aac_codebook_vector_vals[cbt_m1];
116+#endif /* !USE_FIXED */
117+ const VLCElem *vlc_tab = ff_vlc_spectral[cbt_m1];
118+ OPEN_READER(re, gb);
119+
120+ switch (cbt_m1 >> 1) {
121+ case 0:
122+ for (group = 0; group < (AAC_SIGNE)g_len; group++, cfo+=128) {
123+ INTFLOAT *cf = cfo;
124+ int len = off_len;
125+
126+ do {
127+ int code;
128+ unsigned cb_idx;
129+
130+ UPDATE_CACHE(re, gb);
131+ GET_VLC(code, re, gb, vlc_tab, 8, 2);
132+ cb_idx = code;
133+#if USE_FIXED
134+ cf = DEC_SQUAD(cf, cb_idx);
135+#else
136+ cf = VMUL4(cf, vq, cb_idx, sf + idx);
137+#endif /* USE_FIXED */
138+ } while (len -= 4);
139+ }
140+ break;
141+
142+ case 1:
143+ for (group = 0; group < (AAC_SIGNE)g_len; group++, cfo+=128) {
144+ INTFLOAT *cf = cfo;
145+ int len = off_len;
146+
147+ do {
148+ int code;
149+ unsigned nnz;
150+ unsigned cb_idx;
151+ uint32_t bits;
152+
153+ UPDATE_CACHE(re, gb);
154+ GET_VLC(code, re, gb, vlc_tab, 8, 2);
155+ cb_idx = code;
156+ nnz = cb_idx >> 8 & 15;
157+ bits = nnz ? GET_CACHE(re, gb) : 0;
158+ LAST_SKIP_BITS(re, gb, nnz);
159+#if USE_FIXED
160+ cf = DEC_UQUAD(cf, cb_idx, bits);
161+#else
162+ cf = VMUL4S(cf, vq, cb_idx, bits, sf + idx);
163+#endif /* USE_FIXED */
164+ } while (len -= 4);
165+ }
166+ break;
167+
168+ case 2:
169+ for (group = 0; group < (AAC_SIGNE)g_len; group++, cfo+=128) {
170+ INTFLOAT *cf = cfo;
171+ int len = off_len;
172+
173+ do {
174+ int code;
175+ unsigned cb_idx;
176+
177+ UPDATE_CACHE(re, gb);
178+ GET_VLC(code, re, gb, vlc_tab, 8, 2);
179+ cb_idx = code;
180+#if USE_FIXED
181+ cf = DEC_SPAIR(cf, cb_idx);
182+#else
183+ cf = VMUL2(cf, vq, cb_idx, sf + idx);
184+#endif /* USE_FIXED */
185+ } while (len -= 2);
186+ }
187+ break;
188+
189+ case 3:
190+ case 4:
191+ for (group = 0; group < (AAC_SIGNE)g_len; group++, cfo+=128) {
192+ INTFLOAT *cf = cfo;
193+ int len = off_len;
194+
195+ do {
196+ int code;
197+ unsigned nnz;
198+ unsigned cb_idx;
199+ unsigned sign;
200+
201+ UPDATE_CACHE(re, gb);
202+ GET_VLC(code, re, gb, vlc_tab, 8, 2);
203+ cb_idx = code;
204+ nnz = cb_idx >> 8 & 15;
205+ sign = nnz ? SHOW_UBITS(re, gb, nnz) << (cb_idx >> 12) : 0;
206+ LAST_SKIP_BITS(re, gb, nnz);
207+#if USE_FIXED
208+ cf = DEC_UPAIR(cf, cb_idx, sign);
209+#else
210+ cf = VMUL2S(cf, vq, cb_idx, sign, sf + idx);
211+#endif /* USE_FIXED */
212+ } while (len -= 2);
213+ }
214+ break;
215+
216+ default:
217+ for (group = 0; group < (AAC_SIGNE)g_len; group++, cfo+=128) {
218+#if USE_FIXED
219+ int *icf = cfo;
220+ int v;
221+#else
222+ float *cf = cfo;
223+ uint32_t *icf = (uint32_t *) cf;
224+#endif /* USE_FIXED */
225+ int len = off_len;
226+
227+ do {
228+ int code;
229+ unsigned nzt, nnz;
230+ unsigned cb_idx;
231+ uint32_t bits;
232+ int j;
233+
234+ UPDATE_CACHE(re, gb);
235+ GET_VLC(code, re, gb, vlc_tab, 8, 2);
236+ cb_idx = code;
237+
238+ if (cb_idx == 0x0000) {
239+ *icf++ = 0;
240+ *icf++ = 0;
241+ continue;
242+ }
243+
244+ nnz = cb_idx >> 12;
245+ nzt = cb_idx >> 8;
246+ bits = SHOW_UBITS(re, gb, nnz) << (32-nnz);
247+ LAST_SKIP_BITS(re, gb, nnz);
248+
249+ for (j = 0; j < 2; j++) {
250+ if (nzt & 1<<j) {
251+ uint32_t b;
252+ int n;
253+ /* The total length of escape_sequence must be < 22 bits according
254+ to the specification (i.e. max is 111111110xxxxxxxxxxxx). */
255+ UPDATE_CACHE(re, gb);
256+ b = GET_CACHE(re, gb);
257+ b = 31 - av_log2(~b);
258+
259+ if (b > 8) {
260+ av_log(ac->avctx, AV_LOG_ERROR, "error in spectral data, ESC overflow\n");
261+ return AVERROR_INVALIDDATA;
262+ }
263+
264+ SKIP_BITS(re, gb, b + 1);
265+ b += 4;
266+ n = (1 << b) + SHOW_UBITS(re, gb, b);
267+ LAST_SKIP_BITS(re, gb, b);
268+#if USE_FIXED
269+ v = n;
270+ if (bits & 1U<<31)
271+ v = -v;
272+ *icf++ = v;
273+#else
274+ *icf++ = ff_cbrt_tab[n] | (bits & 1U<<31);
275+#endif /* USE_FIXED */
276+ bits <<= 1;
277+ } else {
278+#if USE_FIXED
279+ v = cb_idx & 15;
280+ if (bits & 1U<<31)
281+ v = -v;
282+ *icf++ = v;
283+#else
284+ unsigned v = ((const uint32_t*)vq)[cb_idx & 15];
285+ *icf++ = (bits & 1U<<31) | v;
286+#endif /* USE_FIXED */
287+ bits <<= !!v;
288+ }
289+ cb_idx >>= 4;
290+ }
291+ } while (len -= 2);
292+#if !USE_FIXED
293+ ac->fdsp->vector_fmul_scalar(cfo, cfo, sf[idx], off_len);
294+#endif /* !USE_FIXED */
295+ }
296+ }
297+
298+ CLOSE_READER(re, gb);
299+ }
300+ }
301+ coef += g_len << 7;
302+ }
303+
304+ if (pulse) {
305+ idx = 0;
306+ for (i = 0; i < pulse->num_pulse; i++) {
307+ INTFLOAT co = coef_base[ pulse->pos[i] ];
308+ while (offsets[idx + 1] <= pulse->pos[i])
309+ idx++;
310+ if (band_type[idx] != NOISE_BT && sf[idx]) {
311+ INTFLOAT ico = -pulse->amp[i];
312+#if USE_FIXED
313+ if (co) {
314+ ico = co + (co > 0 ? -ico : ico);
315+ }
316+ coef_base[ pulse->pos[i] ] = ico;
317+#else
318+ if (co) {
319+ co /= sf[idx];
320+ ico = co / sqrtf(sqrtf(fabsf(co))) + (co > 0 ? -ico : ico);
321+ }
322+ coef_base[ pulse->pos[i] ] = cbrtf(fabsf(ico)) * ico * sf[idx];
323+#endif /* USE_FIXED */
324+ }
325+ }
326+ }
327+#if USE_FIXED
328+ coef = coef_base;
329+ idx = 0;
330+ for (g = 0; g < ics->num_window_groups; g++) {
331+ unsigned g_len = ics->group_len[g];
332+
333+ for (i = 0; i < ics->max_sfb; i++, idx++) {
334+ const unsigned cbt_m1 = band_type[idx] - 1;
335+ int *cfo = coef + offsets[i];
336+ int off_len = offsets[i + 1] - offsets[i];
337+ int group;
338+
339+ if (cbt_m1 < NOISE_BT - 1) {
340+ for (group = 0; group < (int)g_len; group++, cfo+=128) {
341+ vector_pow43(cfo, off_len);
342+ subband_scale(cfo, cfo, sf[idx], 34, off_len, ac->avctx);
343+ }
344+ }
345+ }
346+ coef += g_len << 7;
347+ }
348+#endif /* USE_FIXED */
349+ return 0;
350+}
351+
352+const AACDecProc AAC_RENAME(aac_proc) = {
353+ .decode_spectrum_and_dequant = AAC_RENAME(decode_spectrum_and_dequant),
354+};

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t