AACContext is not used by the encoder at all.
Unified · Split
| @@ -33,12 +33,7 @@ · 32 unmodified lines | ||
| 33 | 33 | |
| 34 | 34 | #include "aac_defines.h" |
| 35 | 35 | #include "libavutil/channel_layout.h" |
| 36 | −#include "libavutil/float_dsp.h" | |
| 37 | −#include "libavutil/fixed_dsp.h" | |
| 38 | 36 | #include "libavutil/mem_internal.h" |
| 39 | −#include "libavutil/tx.h" | |
| 40 | −#include "avcodec.h" | |
| 41 | −#include "mpeg4audio.h" | |
| 42 | 37 | #include "sbr.h" |
| 43 | 38 | |
| 44 | 39 | #include <stdint.h> |
| @@ -108,25 +103,6 @@ enum CouplingPoint { · 63 unmodified lines | ||
| 108 | 103 | AFTER_IMDCT = 3, |
| 109 | 104 | }; |
| 110 | 105 | |
| 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 | − | |
| 130 | 106 | /** |
| 131 | 107 | * Predictor State |
| 132 | 108 | */ |
| @@ -203,22 +179,6 @@ typedef struct TemporalNoiseShaping { · 70 unmodified lines | ||
| 203 | 179 | INTFLOAT coef[8][4][TNS_MAX_ORDER]; |
| 204 | 180 | } TemporalNoiseShaping; |
| 205 | 181 | |
| 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 | − | |
| 222 | 182 | typedef struct Pulse { |
| 223 | 183 | int num_pulse; |
| 224 | 184 | int start; |
| @@ -285,107 +245,4 @@ typedef struct ChannelElement { · 60 unmodified lines | ||
| 285 | 245 | SpectralBandReplication sbr; |
| 286 | 246 | } ChannelElement; |
| 287 | 247 | |
| 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 | − | |
| 391 | 248 | #endif /* AVCODEC_AAC_H */ |
| @@ -45,6 +45,7 @@ · 44 unmodified lines | ||
| 45 | 45 | #include "sinewin.h" |
| 46 | 46 | |
| 47 | 47 | #include "aac.h" |
| 48 | +#include "aacdec.h" | |
| 48 | 49 | #include "aactab.h" |
| 49 | 50 | #include "aacdectab.h" |
| 50 | 51 | #include "adts_header.h" |
| @@ -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 */ | |
| @@ -71,6 +71,7 @@ · 70 unmodified lines | ||
| 71 | 71 | #include "sinewin_fixed_tablegen.h" |
| 72 | 72 | |
| 73 | 73 | #include "aac.h" |
| 74 | +#include "aacdec.h" | |
| 74 | 75 | #include "aactab.h" |
| 75 | 76 | #include "aacdectab.h" |
| 76 | 77 | #include "adts_header.h" |
| @@ -32,7 +32,9 @@ · 31 unmodified lines | ||
| 32 | 32 | * @author Zoran Basaric ( zoran.basaric@imgtec.com ) |
| 33 | 33 | */ |
| 34 | 34 | |
| 35 | +#include "aacdec.h" | |
| 35 | 36 | #include "aacdectab.h" |
| 37 | +#include "avcodec.h" | |
| 36 | 38 | #include "libavutil/qsort.h" |
| 37 | 39 | |
| 38 | 40 | static av_cold void aacsbr_tableinit(void) |
| @@ -53,7 +53,7 @@ · 52 unmodified lines | ||
| 53 | 53 | */ |
| 54 | 54 | |
| 55 | 55 | #include "libavutil/attributes.h" |
| 56 | −#include "libavcodec/aac.h" | |
| 56 | +#include "libavcodec/aacdec.h" | |
| 57 | 57 | #include "aacdec_mips.h" |
| 58 | 58 | #include "libavcodec/aactab.h" |
| 59 | 59 | #include "libavcodec/sinewin.h" |
| @@ -57,7 +57,7 @@ · 56 unmodified lines | ||
| 57 | 57 | #ifndef AVCODEC_MIPS_AACDEC_MIPS_H |
| 58 | 58 | #define AVCODEC_MIPS_AACDEC_MIPS_H |
| 59 | 59 | |
| 60 | −#include "libavcodec/aac.h" | |
| 60 | +#include "libavcodec/aacdec.h" | |
| 61 | 61 | #include "libavutil/mips/asmdefs.h" |
| 62 | 62 | |
| 63 | 63 | #if HAVE_INLINE_ASM && HAVE_MIPSFPU |
| @@ -51,7 +51,7 @@ · 50 unmodified lines | ||
| 51 | 51 | * Reference: libavcodec/aacsbr.c |
| 52 | 52 | */ |
| 53 | 53 | |
| 54 | −#include "libavcodec/aac.h" | |
| 54 | +#include "libavcodec/aacdec.h" | |
| 55 | 55 | #include "libavcodec/aacsbr.h" |
| 56 | 56 | #include "libavutil/mem_internal.h" |
| 57 | 57 | #include "libavutil/mips/asmdefs.h" |
| @@ -54,7 +54,7 @@ · 53 unmodified lines | ||
| 54 | 54 | #ifndef AVCODEC_MIPS_AACSBR_MIPS_H |
| 55 | 55 | #define AVCODEC_MIPS_AACSBR_MIPS_H |
| 56 | 56 | |
| 57 | −#include "libavcodec/aac.h" | |
| 57 | +#include "libavcodec/aacdec.h" | |
| 58 | 58 | #include "libavcodec/sbr.h" |
| 59 | 59 | #include "libavutil/mips/asmdefs.h" |
| 60 | 60 | |