History

avocdec/aac: Move decoder-only stuff to new header aacdec.h

AACContext is not used by the encoder at all.

Andreas Rheinhardt committed 2 years ago

Commit a0fa6b61 parent c6cf2539 files · +187 −147Browse files

Unified · Split

9 files
  1. libavcodec/aac.h +0 −143
  2. libavcodec/aacdec.c +1 −0
  3. libavcodec/aacdec.h +179 −0
  4. libavcodec/aacdec_fixed.c +1 −0
  5. libavcodec/aacsbr_template.c +2 −0
  6. libavcodec/mips/aacdec_mips.c +1 −1
  7. libavcodec/mips/aacdec_mips.h +1 −1
  8. libavcodec/mips/aacsbr_mips.c +1 −1
  9. libavcodec/mips/aacsbr_mips.h +1 −1
libavcodec/aac.h+0−143
@@ -33,12 +33,7 @@ · 32 unmodified lines
3333
3434 #include "aac_defines.h"
3535 #include "libavutil/channel_layout.h"
36−#include "libavutil/float_dsp.h"
37−#include "libavutil/fixed_dsp.h"
3836 #include "libavutil/mem_internal.h"
39−#include "libavutil/tx.h"
40−#include "avcodec.h"
41−#include "mpeg4audio.h"
4237 #include "sbr.h"
4338
4439 #include <stdint.h>
@@ -108,25 +103,6 @@ enum CouplingPoint { · 63 unmodified lines
108103 AFTER_IMDCT = 3,
109104 };
110105
111−/**
112− * Output configuration status
113− */
114−enum OCStatus {
115− OC_NONE, ///< Output unconfigured
116− OC_TRIAL_PCE, ///< Output configuration under trial specified by an inband PCE
117− OC_TRIAL_FRAME, ///< Output configuration under trial specified by a frame header
118− OC_GLOBAL_HDR, ///< Output configuration set in a global header but not yet locked
119− OC_LOCKED, ///< Output configuration locked in place
120−};
121−
122−typedef struct OutputConfiguration {
123− MPEG4AudioConfig m4ac;
124− uint8_t layout_map[MAX_ELEM_ID*4][3];
125− int layout_map_tags;
126− AVChannelLayout ch_layout;
127− enum OCStatus status;
128−} OutputConfiguration;
129−
130106 /**
131107 * Predictor State
132108 */
@@ -203,22 +179,6 @@ typedef struct TemporalNoiseShaping { · 70 unmodified lines
203179 INTFLOAT coef[8][4][TNS_MAX_ORDER];
204180 } TemporalNoiseShaping;
205181
206−/**
207− * Dynamic Range Control - decoded from the bitstream but not processed further.
208− */
209−typedef struct DynamicRangeControl {
210− int pce_instance_tag; ///< Indicates with which program the DRC info is associated.
211− int dyn_rng_sgn[17]; ///< DRC sign information; 0 - positive, 1 - negative
212− int dyn_rng_ctl[17]; ///< DRC magnitude information
213− int exclude_mask[MAX_CHANNELS]; ///< Channels to be excluded from DRC processing.
214− int band_incr; ///< Number of DRC bands greater than 1 having DRC info.
215− int interpolation_scheme; ///< Indicates the interpolation scheme used in the SBR QMF domain.
216− int band_top[17]; ///< Indicates the top of the i-th DRC band in units of 4 spectral lines.
217− int prog_ref_level; /**< A reference level for the long-term program audio level for all
218− * channels combined.
219− */
220−} DynamicRangeControl;
221−
222182 typedef struct Pulse {
223183 int num_pulse;
224184 int start;
@@ -285,107 +245,4 @@ typedef struct ChannelElement { · 60 unmodified lines
285245 SpectralBandReplication sbr;
286246 } ChannelElement;
287247
288−enum AACOutputChannelOrder {
289− CHANNEL_ORDER_DEFAULT,
290− CHANNEL_ORDER_CODED,
291−};
292−
293−/**
294− * main AAC context
295− */
296−struct AACContext {
297− AVClass *class;
298− AVCodecContext *avctx;
299− AVFrame *frame;
300−
301− int is_saved; ///< Set if elements have stored overlap from previous frame.
302− DynamicRangeControl che_drc;
303−
304− /**
305− * @name Channel element related data
306− * @{
307− */
308− ChannelElement *che[4][MAX_ELEM_ID];
309− ChannelElement *tag_che_map[4][MAX_ELEM_ID];
310− int tags_mapped;
311− int warned_remapping_once;
312− /** @} */
313−
314− /**
315− * @name temporary aligned temporary buffers
316− * (We do not want to have these on the stack.)
317− * @{
318− */
319− DECLARE_ALIGNED(32, INTFLOAT, buf_mdct)[1024];
320− /** @} */
321−
322− /**
323− * @name Computed / set up during initialization
324− * @{
325− */
326− AVTXContext *mdct120;
327− AVTXContext *mdct128;
328− AVTXContext *mdct480;
329− AVTXContext *mdct512;
330− AVTXContext *mdct960;
331− AVTXContext *mdct1024;
332− AVTXContext *mdct_ltp;
333−
334− av_tx_fn mdct120_fn;
335− av_tx_fn mdct128_fn;
336− av_tx_fn mdct480_fn;
337− av_tx_fn mdct512_fn;
338− av_tx_fn mdct960_fn;
339− av_tx_fn mdct1024_fn;
340− av_tx_fn mdct_ltp_fn;
341−#if USE_FIXED
342− AVFixedDSPContext *fdsp;
343−#else
344− AVFloatDSPContext *fdsp;
345−#endif /* USE_FIXED */
346− int random_state;
347− /** @} */
348−
349− /**
350− * @name Members used for output
351− * @{
352− */
353− SingleChannelElement *output_element[MAX_CHANNELS]; ///< Points to each SingleChannelElement
354− /** @} */
355−
356−
357− /**
358− * @name Japanese DTV specific extension
359− * @{
360− */
361− int force_dmono_mode;///< 0->not dmono, 1->use first channel, 2->use second channel
362− int dmono_mode; ///< 0->not dmono, 1->use first channel, 2->use second channel
363− /** @} */
364−
365− enum AACOutputChannelOrder output_channel_order;
366−
367− DECLARE_ALIGNED(32, INTFLOAT, temp)[128];
368−
369− OutputConfiguration oc[2];
370− int warned_num_aac_frames;
371− int warned_960_sbr;
372− unsigned warned_71_wide;
373− int warned_gain_control;
374− int warned_he_aac_mono;
375−
376− /* aacdec functions pointers */
377− void (*imdct_and_windowing)(AACContext *ac, SingleChannelElement *sce);
378− void (*apply_ltp)(AACContext *ac, SingleChannelElement *sce);
379− void (*apply_tns)(INTFLOAT coef[1024], TemporalNoiseShaping *tns,
380− IndividualChannelStream *ics, int decode);
381− void (*windowing_and_mdct_ltp)(AACContext *ac, INTFLOAT *out,
382− INTFLOAT *in, IndividualChannelStream *ics);
383− void (*update_ltp)(AACContext *ac, SingleChannelElement *sce);
384− void (*vector_pow43)(int *coefs, int len);
385− void (*subband_scale)(int *dst, int *src, int scale, int offset, int len, void *log_context);
386−
387−};
388−
389−void ff_aacdec_init_mips(AACContext *c);
390−
391248 #endif /* AVCODEC_AAC_H */
libavcodec/aacdec.c+1−0
@@ -45,6 +45,7 @@ · 44 unmodified lines
4545 #include "sinewin.h"
4646
4747 #include "aac.h"
48+#include "aacdec.h"
4849 #include "aactab.h"
4950 #include "aacdectab.h"
5051 #include "adts_header.h"
libavcodec/aacdec.h+179−0
@@ -0,0 +1,179 @@
1+/*
2+ * AAC decoder definitions and structures
3+ * Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
4+ * Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com )
5+ *
6+ * This file is part of FFmpeg.
7+ *
8+ * FFmpeg is free software; you can redistribute it and/or
9+ * modify it under the terms of the GNU Lesser General Public
10+ * License as published by the Free Software Foundation; either
11+ * version 2.1 of the License, or (at your option) any later version.
12+ *
13+ * FFmpeg is distributed in the hope that it will be useful,
14+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16+ * Lesser General Public License for more details.
17+ *
18+ * You should have received a copy of the GNU Lesser General Public
19+ * License along with FFmpeg; if not, write to the Free Software
20+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21+ */
22+
23+/**
24+ * @file
25+ * AAC decoder definitions and structures
26+ * @author Oded Shimon ( ods15 ods15 dyndns org )
27+ * @author Maxim Gavrilov ( maxim.gavrilov gmail com )
28+ */
29+
30+#ifndef AVCODEC_AACDEC_H
31+#define AVCODEC_AACDEC_H
32+
33+#include "libavutil/float_dsp.h"
34+#include "libavutil/fixed_dsp.h"
35+#include "libavutil/mem_internal.h"
36+#include "libavutil/tx.h"
37+
38+#include "aac.h"
39+#include "mpeg4audio.h"
40+
41+/**
42+ * Output configuration status
43+ */
44+enum OCStatus {
45+ OC_NONE, ///< Output unconfigured
46+ OC_TRIAL_PCE, ///< Output configuration under trial specified by an inband PCE
47+ OC_TRIAL_FRAME, ///< Output configuration under trial specified by a frame header
48+ OC_GLOBAL_HDR, ///< Output configuration set in a global header but not yet locked
49+ OC_LOCKED, ///< Output configuration locked in place
50+};
51+
52+enum AACOutputChannelOrder {
53+ CHANNEL_ORDER_DEFAULT,
54+ CHANNEL_ORDER_CODED,
55+};
56+
57+typedef struct OutputConfiguration {
58+ MPEG4AudioConfig m4ac;
59+ uint8_t layout_map[MAX_ELEM_ID*4][3];
60+ int layout_map_tags;
61+ AVChannelLayout ch_layout;
62+ enum OCStatus status;
63+} OutputConfiguration;
64+
65+/**
66+ * Dynamic Range Control - decoded from the bitstream but not processed further.
67+ */
68+typedef struct DynamicRangeControl {
69+ int pce_instance_tag; ///< Indicates with which program the DRC info is associated.
70+ int dyn_rng_sgn[17]; ///< DRC sign information; 0 - positive, 1 - negative
71+ int dyn_rng_ctl[17]; ///< DRC magnitude information
72+ int exclude_mask[MAX_CHANNELS]; ///< Channels to be excluded from DRC processing.
73+ int band_incr; ///< Number of DRC bands greater than 1 having DRC info.
74+ int interpolation_scheme; ///< Indicates the interpolation scheme used in the SBR QMF domain.
75+ int band_top[17]; ///< Indicates the top of the i-th DRC band in units of 4 spectral lines.
76+ int prog_ref_level; /**< A reference level for the long-term program audio level for all
77+ * channels combined.
78+ */
79+} DynamicRangeControl;
80+
81+/**
82+ * main AAC decoding context
83+ */
84+struct AACContext {
85+ const struct AVClass *class;
86+ struct AVCodecContext *avctx;
87+ struct AVFrame *frame;
88+
89+ int is_saved; ///< Set if elements have stored overlap from previous frame.
90+ DynamicRangeControl che_drc;
91+
92+ /**
93+ * @name Channel element related data
94+ * @{
95+ */
96+ ChannelElement *che[4][MAX_ELEM_ID];
97+ ChannelElement *tag_che_map[4][MAX_ELEM_ID];
98+ int tags_mapped;
99+ int warned_remapping_once;
100+ /** @} */
101+
102+ /**
103+ * @name temporary aligned temporary buffers
104+ * (We do not want to have these on the stack.)
105+ * @{
106+ */
107+ DECLARE_ALIGNED(32, INTFLOAT, buf_mdct)[1024];
108+ /** @} */
109+
110+ /**
111+ * @name Computed / set up during initialization
112+ * @{
113+ */
114+ AVTXContext *mdct120;
115+ AVTXContext *mdct128;
116+ AVTXContext *mdct480;
117+ AVTXContext *mdct512;
118+ AVTXContext *mdct960;
119+ AVTXContext *mdct1024;
120+ AVTXContext *mdct_ltp;
121+
122+ av_tx_fn mdct120_fn;
123+ av_tx_fn mdct128_fn;
124+ av_tx_fn mdct480_fn;
125+ av_tx_fn mdct512_fn;
126+ av_tx_fn mdct960_fn;
127+ av_tx_fn mdct1024_fn;
128+ av_tx_fn mdct_ltp_fn;
129+#if USE_FIXED
130+ AVFixedDSPContext *fdsp;
131+#else
132+ AVFloatDSPContext *fdsp;
133+#endif /* USE_FIXED */
134+ int random_state;
135+ /** @} */
136+
137+ /**
138+ * @name Members used for output
139+ * @{
140+ */
141+ SingleChannelElement *output_element[MAX_CHANNELS]; ///< Points to each SingleChannelElement
142+ /** @} */
143+
144+
145+ /**
146+ * @name Japanese DTV specific extension
147+ * @{
148+ */
149+ int force_dmono_mode;///< 0->not dmono, 1->use first channel, 2->use second channel
150+ int dmono_mode; ///< 0->not dmono, 1->use first channel, 2->use second channel
151+ /** @} */
152+
153+ enum AACOutputChannelOrder output_channel_order;
154+
155+ DECLARE_ALIGNED(32, INTFLOAT, temp)[128];
156+
157+ OutputConfiguration oc[2];
158+ int warned_num_aac_frames;
159+ int warned_960_sbr;
160+ unsigned warned_71_wide;
161+ int warned_gain_control;
162+ int warned_he_aac_mono;
163+
164+ /* aacdec functions pointers */
165+ void (*imdct_and_windowing)(AACContext *ac, SingleChannelElement *sce);
166+ void (*apply_ltp)(AACContext *ac, SingleChannelElement *sce);
167+ void (*apply_tns)(INTFLOAT coef[1024], TemporalNoiseShaping *tns,
168+ IndividualChannelStream *ics, int decode);
169+ void (*windowing_and_mdct_ltp)(AACContext *ac, INTFLOAT *out,
170+ INTFLOAT *in, IndividualChannelStream *ics);
171+ void (*update_ltp)(AACContext *ac, SingleChannelElement *sce);
172+ void (*vector_pow43)(int *coefs, int len);
173+ void (*subband_scale)(int *dst, int *src, int scale, int offset, int len, void *log_context);
174+
175+};
176+
177+void ff_aacdec_init_mips(AACContext *c);
178+
179+#endif /* AVCODEC_AACDEC_H */
libavcodec/aacdec_fixed.c+1−0
@@ -71,6 +71,7 @@ · 70 unmodified lines
7171 #include "sinewin_fixed_tablegen.h"
7272
7373 #include "aac.h"
74+#include "aacdec.h"
7475 #include "aactab.h"
7576 #include "aacdectab.h"
7677 #include "adts_header.h"
libavcodec/aacsbr_template.c+2−0
@@ -32,7 +32,9 @@ · 31 unmodified lines
3232 * @author Zoran Basaric ( zoran.basaric@imgtec.com )
3333 */
3434
35+#include "aacdec.h"
3536 #include "aacdectab.h"
37+#include "avcodec.h"
3638 #include "libavutil/qsort.h"
3739
3840 static av_cold void aacsbr_tableinit(void)
libavcodec/mips/aacdec_mips.c+1−1
@@ -53,7 +53,7 @@ · 52 unmodified lines
5353 */
5454
5555 #include "libavutil/attributes.h"
56−#include "libavcodec/aac.h"
56+#include "libavcodec/aacdec.h"
5757 #include "aacdec_mips.h"
5858 #include "libavcodec/aactab.h"
5959 #include "libavcodec/sinewin.h"
libavcodec/mips/aacdec_mips.h+1−1
@@ -57,7 +57,7 @@ · 56 unmodified lines
5757 #ifndef AVCODEC_MIPS_AACDEC_MIPS_H
5858 #define AVCODEC_MIPS_AACDEC_MIPS_H
5959
60−#include "libavcodec/aac.h"
60+#include "libavcodec/aacdec.h"
6161 #include "libavutil/mips/asmdefs.h"
6262
6363 #if HAVE_INLINE_ASM && HAVE_MIPSFPU
libavcodec/mips/aacsbr_mips.c+1−1
@@ -51,7 +51,7 @@ · 50 unmodified lines
5151 * Reference: libavcodec/aacsbr.c
5252 */
5353
54−#include "libavcodec/aac.h"
54+#include "libavcodec/aacdec.h"
5555 #include "libavcodec/aacsbr.h"
5656 #include "libavutil/mem_internal.h"
5757 #include "libavutil/mips/asmdefs.h"
libavcodec/mips/aacsbr_mips.h+1−1
@@ -54,7 +54,7 @@ · 53 unmodified lines
5454 #ifndef AVCODEC_MIPS_AACSBR_MIPS_H
5555 #define AVCODEC_MIPS_AACSBR_MIPS_H
5656
57−#include "libavcodec/aac.h"
57+#include "libavcodec/aacdec.h"
5858 #include "libavcodec/sbr.h"
5959 #include "libavutil/mips/asmdefs.h"
6060

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