FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
aacdec.c File Reference

AAC decoder. More...

#include "libavutil/float_dsp.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "internal.h"
#include "get_bits.h"
#include "fft.h"
#include "imdct15.h"
#include "lpc.h"
#include "kbdwin.h"
#include "sinewin.h"
#include "aac.h"
#include "aactab.h"
#include "aacdectab.h"
#include "cbrt_tablegen.h"
#include "sbr.h"
#include "aacsbr.h"
#include "mpeg4audio.h"
#include "aacadtsdec.h"
#include "libavutil/intfloat.h"
#include <errno.h>
#include <math.h>
#include <stdint.h>
#include <string.h>

Go to the source code of this file.

Data Structures

struct  elem_to_channel
 
struct  LATMContext
 

Macros

#define overread_err   "Input buffer exhausted before END element found\n"
 
#define AAC_INIT_VLC_STATIC(num, size)
 
#define LOAS_SYNC_WORD   0x2b7
 11 bits LOAS sync word More...
 
#define AACDEC_FLAGS   AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM
 AVOptions for Japanese DTV specific extensions (ADTS only) More...
 

Functions

static int output_configure (AACContext *ac, uint8_t layout_map[MAX_ELEM_ID *4][3], int tags, enum OCStatus oc_type, int get_new_frame)
 Configure output channel order based on the current program configuration element. More...
 
static int count_channels (uint8_t(*layout)[3], int tags)
 
static av_cold int che_configure (AACContext *ac, enum ChannelPosition che_pos, int type, int id, int *channels)
 Check for the channel element in the current channel position configuration. More...
 
static int frame_configure_elements (AVCodecContext *avctx)
 
static int assign_pair (struct elem_to_channel e2c_vec[MAX_ELEM_ID], uint8_t(*layout_map)[3], int offset, uint64_t left, uint64_t right, int pos)
 
static int count_paired_channels (uint8_t(*layout_map)[3], int tags, int pos, int *current)
 
static uint64_t sniff_channel_order (uint8_t(*layout_map)[3], int tags)
 
static void push_output_configuration (AACContext *ac)
 Save current output configuration if and only if it has been locked. More...
 
static void pop_output_configuration (AACContext *ac)
 Restore the previous output configuration if and only if the current configuration is unlocked. More...
 
static void flush (AVCodecContext *avctx)
 
static int set_default_channel_config (AVCodecContext *avctx, uint8_t(*layout_map)[3], int *tags, int channel_config)
 Set up channel positions based on a default channel configuration as specified in table 1.17. More...
 
static ChannelElementget_che (AACContext *ac, int type, int elem_id)
 
static void decode_channel_map (uint8_t layout_map[][3], enum ChannelPosition type, GetBitContext *gb, int n)
 Decode an array of 4 bit element IDs, optionally interleaved with a stereo/mono switching bit. More...
 
static int decode_pce (AVCodecContext *avctx, MPEG4AudioConfig *m4ac, uint8_t(*layout_map)[3], GetBitContext *gb)
 Decode program configuration element; reference: table 4.2. More...
 
static int decode_ga_specific_config (AACContext *ac, AVCodecContext *avctx, GetBitContext *gb, MPEG4AudioConfig *m4ac, int channel_config)
 Decode GA "General Audio" specific configuration; reference: table 4.1. More...
 
static int decode_eld_specific_config (AACContext *ac, AVCodecContext *avctx, GetBitContext *gb, MPEG4AudioConfig *m4ac, int channel_config)
 
static int decode_audio_specific_config (AACContext *ac, AVCodecContext *avctx, MPEG4AudioConfig *m4ac, const uint8_t *data, int bit_size, int sync_extension)
 Decode audio specific configuration; reference: table 1.13. More...
 
static av_always_inline int lcg_random (unsigned previous_val)
 linear congruential pseudorandom number generator More...
 
static av_always_inline void reset_predict_state (PredictorState *ps)
 
static void reset_all_predictors (PredictorState *ps)
 
static int sample_rate_idx (int rate)
 
static void reset_predictor_group (PredictorState *ps, int group_num)
 
static void aacdec_init (AACContext *ac)
 
static av_cold int aac_decode_init (AVCodecContext *avctx)
 
static int skip_data_stream_element (AACContext *ac, GetBitContext *gb)
 Skip data_stream_element; reference: table 4.10. More...
 
static int decode_prediction (AACContext *ac, IndividualChannelStream *ics, GetBitContext *gb)
 
static void decode_ltp (LongTermPrediction *ltp, GetBitContext *gb, uint8_t max_sfb)
 Decode Long Term Prediction data; reference: table 4.xx. More...
 
static int decode_ics_info (AACContext *ac, IndividualChannelStream *ics, GetBitContext *gb)
 Decode Individual Channel Stream info; reference: table 4.6. More...
 
static int decode_band_types (AACContext *ac, enum BandType band_type[120], int band_type_run_end[120], GetBitContext *gb, IndividualChannelStream *ics)
 Decode band types (section_data payload); reference: table 4.46. More...
 
static int decode_scalefactors (AACContext *ac, float sf[120], GetBitContext *gb, unsigned int global_gain, IndividualChannelStream *ics, enum BandType band_type[120], int band_type_run_end[120])
 Decode scalefactors; reference: table 4.47. More...
 
static int decode_pulses (Pulse *pulse, GetBitContext *gb, const uint16_t *swb_offset, int num_swb)
 Decode pulse data; reference: table 4.7. More...
 
static int decode_tns (AACContext *ac, TemporalNoiseShaping *tns, GetBitContext *gb, const IndividualChannelStream *ics)
 Decode Temporal Noise Shaping data; reference: table 4.48. More...
 
static void decode_mid_side_stereo (ChannelElement *cpe, GetBitContext *gb, int ms_present)
 Decode Mid/Side data; reference: table 4.54. More...
 
static float * VMUL2 (float *dst, const float *v, unsigned idx, const float *scale)
 
static float * VMUL4 (float *dst, const float *v, unsigned idx, const float *scale)
 
static float * VMUL2S (float *dst, const float *v, unsigned idx, unsigned sign, const float *scale)
 
static float * VMUL4S (float *dst, const float *v, unsigned idx, unsigned sign, const float *scale)
 
static int decode_spectrum_and_dequant (AACContext *ac, float coef[1024], GetBitContext *gb, const float sf[120], int pulse_present, const Pulse *pulse, const IndividualChannelStream *ics, enum BandType band_type[120])
 Decode spectral data; reference: table 4.50. More...
 
static av_always_inline float flt16_round (float pf)
 
static av_always_inline float flt16_even (float pf)
 
static av_always_inline float flt16_trunc (float pf)
 
static av_always_inline void predict (PredictorState *ps, float *coef, int output_enable)
 
static void apply_prediction (AACContext *ac, SingleChannelElement *sce)
 Apply AAC-Main style frequency domain prediction. More...
 
static int decode_ics (AACContext *ac, SingleChannelElement *sce, GetBitContext *gb, int common_window, int scale_flag)
 Decode an individual_channel_stream payload; reference: table 4.44. More...
 
static void apply_mid_side_stereo (AACContext *ac, ChannelElement *cpe)
 Mid/Side stereo decoding; reference: 4.6.8.1.3. More...
 
static void apply_intensity_stereo (AACContext *ac, ChannelElement *cpe, int ms_present)
 intensity stereo decoding; reference: 4.6.8.2.3 More...
 
static int decode_cpe (AACContext *ac, GetBitContext *gb, ChannelElement *cpe)
 Decode a channel_pair_element; reference: table 4.4. More...
 
static int decode_cce (AACContext *ac, GetBitContext *gb, ChannelElement *che)
 Decode coupling_channel_element; reference: table 4.8. More...
 
static int decode_drc_channel_exclusions (DynamicRangeControl *che_drc, GetBitContext *gb)
 Parse whether channels are to be excluded from Dynamic Range Compression; reference: table 4.53. More...
 
static int decode_dynamic_range (DynamicRangeControl *che_drc, GetBitContext *gb)
 Decode dynamic range information; reference: table 4.52. More...
 
static int decode_fill (AACContext *ac, GetBitContext *gb, int len)
 
static int decode_extension_payload (AACContext *ac, GetBitContext *gb, int cnt, ChannelElement *che, enum RawDataBlockType elem_type)
 Decode extension data (incomplete); reference: table 4.51. More...
 
static void apply_tns (float coef[1024], TemporalNoiseShaping *tns, IndividualChannelStream *ics, int decode)
 Decode Temporal Noise Shaping filter coefficients and apply all-pole filters; reference: 4.6.9.3. More...
 
static void windowing_and_mdct_ltp (AACContext *ac, float *out, float *in, IndividualChannelStream *ics)
 Apply windowing and MDCT to obtain the spectral coefficient from the predicted sample by LTP. More...
 
static void apply_ltp (AACContext *ac, SingleChannelElement *sce)
 Apply the long term prediction. More...
 
static void update_ltp (AACContext *ac, SingleChannelElement *sce)
 Update the LTP buffer for next frame. More...
 
static void imdct_and_windowing (AACContext *ac, SingleChannelElement *sce)
 Conduct IMDCT and windowing. More...
 
static void imdct_and_windowing_ld (AACContext *ac, SingleChannelElement *sce)
 
static void imdct_and_windowing_eld (AACContext *ac, SingleChannelElement *sce)
 
static void apply_dependent_coupling (AACContext *ac, SingleChannelElement *target, ChannelElement *cce, int index)
 Apply dependent channel coupling (applied before IMDCT). More...
 
static void apply_independent_coupling (AACContext *ac, SingleChannelElement *target, ChannelElement *cce, int index)
 Apply independent channel coupling (applied after IMDCT). More...
 
static void apply_channel_coupling (AACContext *ac, ChannelElement *cc, enum RawDataBlockType type, int elem_id, enum CouplingPoint coupling_point, void(*apply_coupling_method)(AACContext *ac, SingleChannelElement *target, ChannelElement *cce, int index))
 channel coupling transformation interface More...
 
static void spectral_to_sample (AACContext *ac)
 Convert spectral data to float samples, applying all supported tools as appropriate. More...
 
static int parse_adts_frame_header (AACContext *ac, GetBitContext *gb)
 
static int aac_decode_er_frame (AVCodecContext *avctx, void *data, int *got_frame_ptr, GetBitContext *gb)
 
static int aac_decode_frame_int (AVCodecContext *avctx, void *data, int *got_frame_ptr, GetBitContext *gb, AVPacket *avpkt)
 
static int aac_decode_frame (AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
 
static av_cold int aac_decode_close (AVCodecContext *avctx)
 
static uint32_t latm_get_value (GetBitContext *b)
 
static int latm_decode_audio_specific_config (struct LATMContext *latmctx, GetBitContext *gb, int asclen)
 
static int read_stream_mux_config (struct LATMContext *latmctx, GetBitContext *gb)
 
static int read_payload_length_info (struct LATMContext *ctx, GetBitContext *gb)
 
static int read_audio_mux_element (struct LATMContext *latmctx, GetBitContext *gb)
 
static int latm_decode_frame (AVCodecContext *avctx, void *out, int *got_frame_ptr, AVPacket *avpkt)
 
static av_cold int latm_decode_init (AVCodecContext *avctx)
 

Variables

static VLC vlc_scalefactors
 
static VLC vlc_spectral [11]
 
static const float cce_scale []
 
static const AVOption options []
 
static const AVClass aac_decoder_class
 
static const AVProfile profiles []
 
AVCodec ff_aac_decoder
 
AVCodec ff_aac_latm_decoder
 

Detailed Description

AAC decoder.

Author
Oded Shimon ( ods15 ods15 dyndns org )
Maxim Gavrilov ( maxim.gavrilov gmail com )

Definition in file aacdec.c.

Macro Definition Documentation

#define overread_err   "Input buffer exhausted before END element found\n"
#define AAC_INIT_VLC_STATIC (   num,
  size 
)
Value:
ff_aac_spectral_bits[num], sizeof(ff_aac_spectral_bits[num][0]), \
sizeof(ff_aac_spectral_bits[num][0]), \
sizeof(ff_aac_spectral_codes[num][0]), \
size);
#define INIT_VLC_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size)
Definition: get_bits.h:476
ptrdiff_t size
Definition: opengl_enc.c:101
const uint16_t ff_aac_spectral_sizes[11]
Definition: aactab.c:413
const uint8_t *const ff_aac_spectral_bits[11]
Definition: aactab.c:408
const uint16_t *const ff_aac_spectral_codes[11]
Definition: aactab.c:403
static VLC vlc_spectral[11]
Definition: aacdec.c:117

Definition at line 1079 of file aacdec.c.

Referenced by aac_decode_init().

#define LOAS_SYNC_WORD   0x2b7

11 bits LOAS sync word

Definition at line 3228 of file aacdec.c.

Referenced by latm_decode_frame().

AVOptions for Japanese DTV specific extensions (ADTS only)

Definition at line 3522 of file aacdec.c.

Function Documentation

static int output_configure ( AACContext ac,
uint8_t  layout_map[MAX_ELEM_ID *4][3],
int  tags,
enum OCStatus  oc_type,
int  get_new_frame 
)
static

Configure output channel order based on the current program configuration element.

Returns
Returns error status. 0 - OK, !0 - error

Definition at line 458 of file aacdec.c.

Referenced by aac_decode_frame_int(), aac_decode_init(), decode_eld_specific_config(), decode_extension_payload(), decode_ga_specific_config(), get_che(), parse_adts_frame_header(), and pop_output_configuration().

static int count_channels ( uint8_t(*)  layout[3],
int  tags 
)
static

Definition at line 125 of file aacdec.c.

Referenced by decode_ga_specific_config().

static av_cold int che_configure ( AACContext ac,
enum ChannelPosition  che_pos,
int  type,
int  id,
int *  channels 
)
static

Check for the channel element in the current channel position configuration.

If it exists, make sure the appropriate element is allocated and map the channel order to match the internal FFmpeg channel layout.

Parameters
che_poscurrent channel position configuration
typechannel element type
idchannel element id
channelscount of the number of channels in the configuration
Returns
Returns error status. 0 - OK, !0 - error

Definition at line 149 of file aacdec.c.

Referenced by output_configure().

static int frame_configure_elements ( AVCodecContext avctx)
static

Definition at line 180 of file aacdec.c.

Referenced by aac_decode_er_frame(), aac_decode_frame_int(), and output_configure().

static int assign_pair ( struct elem_to_channel  e2c_vec[MAX_ELEM_ID],
uint8_t(*)  layout_map[3],
int  offset,
uint64_t  left,
uint64_t  right,
int  pos 
)
static

Definition at line 221 of file aacdec.c.

Referenced by sniff_channel_order().

static int count_paired_channels ( uint8_t(*)  layout_map[3],
int  tags,
int  pos,
int *  current 
)
static

Definition at line 250 of file aacdec.c.

Referenced by sniff_channel_order().

static uint64_t sniff_channel_order ( uint8_t(*)  layout_map[3],
int  tags 
)
static

Definition at line 282 of file aacdec.c.

Referenced by output_configure().

static void push_output_configuration ( AACContext ac)
static

Save current output configuration if and only if it has been locked.

Definition at line 431 of file aacdec.c.

Referenced by aac_decode_frame(), aac_decode_frame_int(), get_che(), latm_decode_frame(), and parse_adts_frame_header().

static void pop_output_configuration ( AACContext ac)
static

Restore the previous output configuration if and only if the current configuration is unlocked.

Definition at line 442 of file aacdec.c.

Referenced by aac_decode_frame(), aac_decode_frame_int(), and latm_decode_frame().

static void flush ( AVCodecContext avctx)
static
static int set_default_channel_config ( AVCodecContext avctx,
uint8_t(*)  layout_map[3],
int *  tags,
int  channel_config 
)
static

Set up channel positions based on a default channel configuration as specified in table 1.17.

Returns
Returns error status. 0 - OK, !0 - error

Definition at line 537 of file aacdec.c.

Referenced by aac_decode_init(), decode_eld_specific_config(), decode_ga_specific_config(), get_che(), and parse_adts_frame_header().

static ChannelElement* get_che ( AACContext ac,
int  type,
int  elem_id 
)
static

Definition at line 574 of file aacdec.c.

Referenced by aac_decode_er_frame(), and aac_decode_frame_int().

static void decode_channel_map ( uint8_t  layout_map[][3],
enum ChannelPosition  type,
GetBitContext gb,
int  n 
)
static

Decode an array of 4 bit element IDs, optionally interleaved with a stereo/mono switching bit.

Parameters
typespeaker type/position for these channels

Definition at line 706 of file aacdec.c.

Referenced by decode_pce().

static int decode_pce ( AVCodecContext avctx,
MPEG4AudioConfig m4ac,
uint8_t(*)  layout_map[3],
GetBitContext gb 
)
static

Decode program configuration element; reference: table 4.2.

Returns
Returns error status. 0 - OK, !0 - error

Definition at line 741 of file aacdec.c.

Referenced by aac_decode_frame_int(), and decode_ga_specific_config().

static int decode_ga_specific_config ( AACContext ac,
AVCodecContext avctx,
GetBitContext gb,
MPEG4AudioConfig m4ac,
int  channel_config 
)
static

Decode GA "General Audio" specific configuration; reference: table 4.1.

Parameters
acpointer to AACContext, may be null
avctxpointer to AVCCodecContext, used for logging
Returns
Returns error status. 0 - OK, !0 - error

Definition at line 811 of file aacdec.c.

Referenced by decode_audio_specific_config().

static int decode_eld_specific_config ( AACContext ac,
AVCodecContext avctx,
GetBitContext gb,
MPEG4AudioConfig m4ac,
int  channel_config 
)
static

Definition at line 889 of file aacdec.c.

Referenced by decode_audio_specific_config().

static int decode_audio_specific_config ( AACContext ac,
AVCodecContext avctx,
MPEG4AudioConfig m4ac,
const uint8_t data,
int  bit_size,
int  sync_extension 
)
static

Decode audio specific configuration; reference: table 1.13.

Parameters
acpointer to AACContext, may be null
avctxpointer to AVCCodecContext, used for logging
m4acpointer to MPEG4AudioConfig, used for parsing
datapointer to buffer holding an audio specific config
bit_sizesize of audio specific config or data in bits
sync_extensionlook for an appended sync extension
Returns
Returns error status or number of consumed bits. <0 - error

Definition at line 958 of file aacdec.c.

Referenced by aac_decode_frame(), aac_decode_init(), latm_decode_audio_specific_config(), and latm_decode_frame().

static av_always_inline int lcg_random ( unsigned  previous_val)
static

linear congruential pseudorandom number generator

Parameters
previous_valpointer to the current state of the generator
Returns
Returns a 32-bit pseudorandom integer

Definition at line 1033 of file aacdec.c.

Referenced by decode_spectrum_and_dequant().

static av_always_inline void reset_predict_state ( PredictorState ps)
static

Definition at line 1039 of file aacdec.c.

Referenced by reset_all_predictors(), and reset_predictor_group().

static void reset_all_predictors ( PredictorState ps)
static

Definition at line 1049 of file aacdec.c.

Referenced by apply_prediction().

static int sample_rate_idx ( int  rate)
static

Definition at line 1056 of file aacdec.c.

Referenced by aac_decode_init().

static void reset_predictor_group ( PredictorState ps,
int  group_num 
)
static

Definition at line 1072 of file aacdec.c.

Referenced by apply_prediction().

static void aacdec_init ( AACContext ac)
static

Definition at line 3508 of file aacdec.c.

Referenced by aac_decode_init().

static av_cold int aac_decode_init ( AVCodecContext avctx)
static

Definition at line 1089 of file aacdec.c.

Referenced by latm_decode_init().

static int skip_data_stream_element ( AACContext ac,
GetBitContext gb 
)
static

Skip data_stream_element; reference: table 4.10.

Definition at line 1198 of file aacdec.c.

Referenced by aac_decode_frame_int().

static int decode_prediction ( AACContext ac,
IndividualChannelStream ics,
GetBitContext gb 
)
static

Definition at line 1215 of file aacdec.c.

Referenced by decode_ics_info().

static void decode_ltp ( LongTermPrediction ltp,
GetBitContext gb,
uint8_t  max_sfb 
)
static

Decode Long Term Prediction data; reference: table 4.xx.

Definition at line 1237 of file aacdec.c.

Referenced by decode_cpe(), and decode_ics_info().

static int decode_ics_info ( AACContext ac,
IndividualChannelStream ics,
GetBitContext gb 
)
static

Decode Individual Channel Stream info; reference: table 4.6.

Definition at line 1251 of file aacdec.c.

Referenced by decode_cpe(), and decode_ics().

static int decode_band_types ( AACContext ac,
enum BandType  band_type[120],
int  band_type_run_end[120],
GetBitContext gb,
IndividualChannelStream ics 
)
static

Decode band types (section_data payload); reference: table 4.46.

Parameters
band_typearray of the used band type
band_type_run_endarray of the last scalefactor band of a band type run
Returns
Returns error status. 0 - OK, !0 - error

Definition at line 1362 of file aacdec.c.

Referenced by decode_ics().

static int decode_scalefactors ( AACContext ac,
float  sf[120],
GetBitContext gb,
unsigned int  global_gain,
IndividualChannelStream ics,
enum BandType  band_type[120],
int  band_type_run_end[120] 
)
static

Decode scalefactors; reference: table 4.47.

Parameters
global_gainfirst scalefactor value as scalefactors are differentially coded
band_typearray of the used band type
band_type_run_endarray of the last scalefactor band of a band type run
sfarray of scalefactors or intensity stereo positions
Returns
Returns error status. 0 - OK, !0 - error

Definition at line 1411 of file aacdec.c.

Referenced by decode_ics().

static int decode_pulses ( Pulse pulse,
GetBitContext gb,
const uint16_t *  swb_offset,
int  num_swb 
)
static

Decode pulse data; reference: table 4.7.

Definition at line 1474 of file aacdec.c.

Referenced by decode_ics().

static int decode_tns ( AACContext ac,
TemporalNoiseShaping tns,
GetBitContext gb,
const IndividualChannelStream ics 
)
static

Decode Temporal Noise Shaping data; reference: table 4.48.

Returns
Returns error status. 0 - OK, !0 - error

Definition at line 1501 of file aacdec.c.

Referenced by decode_ics().

static void decode_mid_side_stereo ( ChannelElement cpe,
GetBitContext gb,
int  ms_present 
)
static

Decode Mid/Side data; reference: table 4.54.

Parameters
ms_presentIndicates mid/side stereo presence. [0] mask is all 0s; [1] mask is decoded from bitstream; [2] mask is all 1s; [3] reserved for scalable AAC

Definition at line 1544 of file aacdec.c.

Referenced by decode_cpe().

static float* VMUL2 ( float *  dst,
const float *  v,
unsigned  idx,
const float *  scale 
)
inlinestatic

Definition at line 1558 of file aacdec.c.

Referenced by decode_spectrum_and_dequant().

static float* VMUL4 ( float *  dst,
const float *  v,
unsigned  idx,
const float *  scale 
)
inlinestatic

Definition at line 1569 of file aacdec.c.

Referenced by decode_spectrum_and_dequant().

static float* VMUL2S ( float *  dst,
const float *  v,
unsigned  idx,
unsigned  sign,
const float *  scale 
)
inlinestatic

Definition at line 1582 of file aacdec.c.

Referenced by decode_spectrum_and_dequant().

static float* VMUL4S ( float *  dst,
const float *  v,
unsigned  idx,
unsigned  sign,
const float *  scale 
)
inlinestatic

Definition at line 1599 of file aacdec.c.

Referenced by decode_spectrum_and_dequant().

static int decode_spectrum_and_dequant ( AACContext ac,
float  coef[1024],
GetBitContext gb,
const float  sf[120],
int  pulse_present,
const Pulse pulse,
const IndividualChannelStream ics,
enum BandType  band_type[120] 
)
static

Decode spectral data; reference: table 4.50.

Dequantize and scale spectral data; reference: 4.6.3.3.

Parameters
coefarray of dequantized, scaled spectral data
sfarray of scalefactors or intensity stereo positions
pulse_presentset if pulses are present
pulsepointer to pulse data struct
band_typearray of the used band type
Returns
Returns error status. 0 - OK, !0 - error

Definition at line 1637 of file aacdec.c.

Referenced by decode_ics().

static av_always_inline float flt16_round ( float  pf)
static

Definition at line 1852 of file aacdec.c.

Referenced by predict().

static av_always_inline float flt16_even ( float  pf)
static

Definition at line 1860 of file aacdec.c.

Referenced by predict().

static av_always_inline float flt16_trunc ( float  pf)
static

Definition at line 1868 of file aacdec.c.

Referenced by predict().

static av_always_inline void predict ( PredictorState ps,
float *  coef,
int  output_enable 
)
static

Definition at line 1876 of file aacdec.c.

Referenced by apply_prediction(), decode_line(), and encode_line().

static void apply_prediction ( AACContext ac,
SingleChannelElement sce 
)
static

Apply AAC-Main style frequency domain prediction.

Definition at line 1910 of file aacdec.c.

Referenced by decode_cpe(), and decode_ics().

static int decode_ics ( AACContext ac,
SingleChannelElement sce,
GetBitContext gb,
int  common_window,
int  scale_flag 
)
static

Decode an individual_channel_stream payload; reference: table 4.44.

Parameters
common_windowChannels have independent [0], or shared [1], Individual Channel Stream information.
scale_flagscalable [1] or non-scalable [0] AAC (Unused until scalable AAC is implemented.)
Returns
Returns error status. 0 - OK, !0 - error

Definition at line 1946 of file aacdec.c.

Referenced by aac_decode_er_frame(), aac_decode_frame_int(), decode_cce(), and decode_cpe().

static void apply_mid_side_stereo ( AACContext ac,
ChannelElement cpe 
)
static

Mid/Side stereo decoding; reference: 4.6.8.1.3.

Definition at line 2023 of file aacdec.c.

Referenced by decode_cpe().

static void apply_intensity_stereo ( AACContext ac,
ChannelElement cpe,
int  ms_present 
)
static

intensity stereo decoding; reference: 4.6.8.2.3

Parameters
ms_presentIndicates mid/side stereo presence. [0] mask is all 0s; [1] mask is decoded from bitstream; [2] mask is all 1s; [3] reserved for scalable AAC

Definition at line 2054 of file aacdec.c.

Referenced by decode_cpe().

static int decode_cpe ( AACContext ac,
GetBitContext gb,
ChannelElement cpe 
)
static

Decode a channel_pair_element; reference: table 4.4.

Returns
Returns error status. 0 - OK, !0 - error

Definition at line 2096 of file aacdec.c.

Referenced by aac_decode_er_frame(), and aac_decode_frame_int().

static int decode_cce ( AACContext ac,
GetBitContext gb,
ChannelElement che 
)
static

Decode coupling_channel_element; reference: table 4.8.

Returns
Returns error status. 0 - OK, !0 - error

Definition at line 2149 of file aacdec.c.

Referenced by aac_decode_frame_int().

static int decode_drc_channel_exclusions ( DynamicRangeControl che_drc,
GetBitContext gb 
)
static

Parse whether channels are to be excluded from Dynamic Range Compression; reference: table 4.53.

Returns
Returns number of bytes consumed.

Definition at line 2221 of file aacdec.c.

Referenced by decode_dynamic_range().

static int decode_dynamic_range ( DynamicRangeControl che_drc,
GetBitContext gb 
)
static

Decode dynamic range information; reference: table 4.52.

Returns
Returns number of bytes consumed.

Definition at line 2240 of file aacdec.c.

Referenced by decode_extension_payload().

static int decode_fill ( AACContext ac,
GetBitContext gb,
int  len 
)
static

Definition at line 2287 of file aacdec.c.

Referenced by decode_extension_payload().

static int decode_extension_payload ( AACContext ac,
GetBitContext gb,
int  cnt,
ChannelElement che,
enum RawDataBlockType  elem_type 
)
static

Decode extension data (incomplete); reference: table 4.51.

Parameters
cntlength of TYPE_FIL syntactic element in bytes
Returns
Returns number of bytes consumed

Definition at line 2320 of file aacdec.c.

Referenced by aac_decode_frame_int().

static void apply_tns ( float  coef[1024],
TemporalNoiseShaping tns,
IndividualChannelStream ics,
int  decode 
)
static

Decode Temporal Noise Shaping filter coefficients and apply all-pole filters; reference: 4.6.9.3.

Parameters
decode1 if tool is used normally, 0 if tool is used in LTP.
coefspectral coefficients

Definition at line 2378 of file aacdec.c.

Referenced by aacdec_init().

static void windowing_and_mdct_ltp ( AACContext ac,
float *  out,
float *  in,
IndividualChannelStream ics 
)
static

Apply windowing and MDCT to obtain the spectral coefficient from the predicted sample by LTP.

Definition at line 2434 of file aacdec.c.

Referenced by aacdec_init().

static void apply_ltp ( AACContext ac,
SingleChannelElement sce 
)
static

Apply the long term prediction.

Definition at line 2460 of file aacdec.c.

Referenced by aacdec_init().

static void update_ltp ( AACContext ac,
SingleChannelElement sce 
)
static

Update the LTP buffer for next frame.

Definition at line 2492 of file aacdec.c.

Referenced by aacdec_init().

static void imdct_and_windowing ( AACContext ac,
SingleChannelElement sce 
)
static

Conduct IMDCT and windowing.

Definition at line 2527 of file aacdec.c.

Referenced by aacdec_init().

static void imdct_and_windowing_ld ( AACContext ac,
SingleChannelElement sce 
)
static

Definition at line 2587 of file aacdec.c.

Referenced by spectral_to_sample().

static void imdct_and_windowing_eld ( AACContext ac,
SingleChannelElement sce 
)
static

Definition at line 2612 of file aacdec.c.

Referenced by spectral_to_sample().

static void apply_dependent_coupling ( AACContext ac,
SingleChannelElement target,
ChannelElement cce,
int  index 
)
static

Apply dependent channel coupling (applied before IMDCT).

Parameters
indexindex into coupling gain array

Definition at line 2677 of file aacdec.c.

Referenced by spectral_to_sample().

static void apply_independent_coupling ( AACContext ac,
SingleChannelElement target,
ChannelElement cce,
int  index 
)
static

Apply independent channel coupling (applied after IMDCT).

Parameters
indexindex into coupling gain array

Definition at line 2713 of file aacdec.c.

Referenced by spectral_to_sample().

static void apply_channel_coupling ( AACContext ac,
ChannelElement cc,
enum RawDataBlockType  type,
int  elem_id,
enum CouplingPoint  coupling_point,
void(*)(AACContext *ac, SingleChannelElement *target, ChannelElement *cce, int index apply_coupling_method 
)
static

channel coupling transformation interface

Parameters
apply_coupling_methodpointer to (in)dependent coupling function

Definition at line 2732 of file aacdec.c.

Referenced by spectral_to_sample().

static void spectral_to_sample ( AACContext ac)
static

Convert spectral data to float samples, applying all supported tools as appropriate.

Definition at line 2765 of file aacdec.c.

Referenced by aac_decode_er_frame(), and aac_decode_frame_int().

static int parse_adts_frame_header ( AACContext ac,
GetBitContext gb 
)
static

dual mono frames in Japanese DTV can have chan_config 0 WITHOUT specifying PCE. thus, set dual mono as default.

Definition at line 2822 of file aacdec.c.

Referenced by aac_decode_frame_int().

static int aac_decode_er_frame ( AVCodecContext avctx,
void data,
int *  got_frame_ptr,
GetBitContext gb 
)
static

Definition at line 2884 of file aacdec.c.

Referenced by aac_decode_frame(), and latm_decode_frame().

static int aac_decode_frame_int ( AVCodecContext avctx,
void data,
int *  got_frame_ptr,
GetBitContext gb,
AVPacket avpkt 
)
static

Definition at line 2951 of file aacdec.c.

Referenced by aac_decode_frame(), and latm_decode_frame().

static int aac_decode_frame ( AVCodecContext avctx,
void data,
int *  got_frame_ptr,
AVPacket avpkt 
)
static

Definition at line 3136 of file aacdec.c.

static av_cold int aac_decode_close ( AVCodecContext avctx)
static

Definition at line 3205 of file aacdec.c.

static uint32_t latm_get_value ( GetBitContext b)
inlinestatic

Definition at line 3240 of file aacdec.c.

Referenced by read_stream_mux_config().

static int latm_decode_audio_specific_config ( struct LATMContext latmctx,
GetBitContext gb,
int  asclen 
)
static

Definition at line 3247 of file aacdec.c.

Referenced by read_stream_mux_config().

static int read_stream_mux_config ( struct LATMContext latmctx,
GetBitContext gb 
)
static

Definition at line 3306 of file aacdec.c.

Referenced by read_audio_mux_element().

static int read_payload_length_info ( struct LATMContext ctx,
GetBitContext gb 
)
static

Definition at line 3386 of file aacdec.c.

Referenced by read_audio_mux_element().

static int read_audio_mux_element ( struct LATMContext latmctx,
GetBitContext gb 
)
static

Definition at line 3407 of file aacdec.c.

Referenced by latm_decode_frame().

static int latm_decode_frame ( AVCodecContext avctx,
void out,
int *  got_frame_ptr,
AVPacket avpkt 
)
static

Definition at line 3436 of file aacdec.c.

static av_cold int latm_decode_init ( AVCodecContext avctx)
static

Definition at line 3497 of file aacdec.c.

Variable Documentation

VLC vlc_scalefactors
static

Definition at line 116 of file aacdec.c.

VLC vlc_spectral[11]
static

Definition at line 117 of file aacdec.c.

const float cce_scale[]
static
Initial value:
= {
1.09050773266525765921,
1.18920711500272106672,
2,
}
#define M_SQRT2
Definition: mathematics.h:55

Definition at line 2137 of file aacdec.c.

const AVOption options[]
static
Initial value:
= {
{"dual_mono_mode", "Select the channel to decode for dual mono",
0x42, AV_OPT_TYPE_INT, {.i64=-1}, -1, 2,
AACDEC_FLAGS, "dual_mono_mode"},
{"auto", "autoselection", 0, AV_OPT_TYPE_CONST, {.i64=-1}, INT_MIN, INT_MAX, AACDEC_FLAGS, "dual_mono_mode"},
{"main", "Select Main/Left channel", 0, AV_OPT_TYPE_CONST, {.i64= 1}, INT_MIN, INT_MAX, AACDEC_FLAGS, "dual_mono_mode"},
{"sub" , "Select Sub/Right channel", 0, AV_OPT_TYPE_CONST, {.i64= 2}, INT_MIN, INT_MAX, AACDEC_FLAGS, "dual_mono_mode"},
{"both", "Select both channels", 0, AV_OPT_TYPE_CONST, {.i64= 0}, INT_MIN, INT_MAX, AACDEC_FLAGS, "dual_mono_mode"},
{NULL},
}
#define NULL
Definition: coverity.c:32
#define AACDEC_FLAGS
AVOptions for Japanese DTV specific extensions (ADTS only)
Definition: aacdec.c:3522

Definition at line 3523 of file aacdec.c.

const AVClass aac_decoder_class
static
Initial value:
= {
.class_name = "AAC decoder",
.item_name = av_default_item_name,
.option = options,
}
#define LIBAVUTIL_VERSION_INT
Definition: version.h:62
av_default_item_name
static const AVOption options[]
Definition: aacdec.c:3523

Definition at line 3536 of file aacdec.c.

const AVProfile profiles[]
static
Initial value:
= {
{ FF_PROFILE_AAC_MAIN, "Main" },
{ FF_PROFILE_AAC_LOW, "LC" },
{ FF_PROFILE_AAC_SSR, "SSR" },
{ FF_PROFILE_AAC_LTP, "LTP" },
{ FF_PROFILE_AAC_HE, "HE-AAC" },
{ FF_PROFILE_AAC_HE_V2, "HE-AACv2" },
{ FF_PROFILE_AAC_LD, "LD" },
{ FF_PROFILE_AAC_ELD, "ELD" },
}
#define FF_PROFILE_AAC_SSR
Definition: avcodec.h:2841
#define FF_PROFILE_AAC_ELD
Definition: avcodec.h:2846
#define FF_PROFILE_UNKNOWN
Definition: avcodec.h:2836
#define FF_PROFILE_AAC_HE
Definition: avcodec.h:2843
#define FF_PROFILE_AAC_HE_V2
Definition: avcodec.h:2844
#define FF_PROFILE_AAC_MAIN
Definition: avcodec.h:2839
#define FF_PROFILE_AAC_LTP
Definition: avcodec.h:2842
#define FF_PROFILE_AAC_LOW
Definition: avcodec.h:2840
#define FF_PROFILE_AAC_LD
Definition: avcodec.h:2845

Definition at line 3543 of file aacdec.c.

AVCodec ff_aac_decoder
Initial value:
= {
.name = "aac",
.long_name = NULL_IF_CONFIG_SMALL("AAC (Advanced Audio Coding)"),
.priv_data_size = sizeof(AACContext),
.close = aac_decode_close,
.sample_fmts = (const enum AVSampleFormat[]) {
},
.channel_layouts = aac_channel_layout,
.flush = flush,
.priv_class = &aac_decoder_class,
.profiles = profiles,
}
float, planar
Definition: samplefmt.h:70
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:789
static av_cold int aac_decode_close(AVCodecContext *avctx)
Definition: aacdec.c:3205
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:175
static const uint64_t aac_channel_layout[16]
Definition: aacdectab.h:100
static void flush(AVCodecContext *avctx)
Definition: aacdec.c:514
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:59
static const AVProfile profiles[]
Definition: aacdec.c:3543
static const AVClass aac_decoder_class
Definition: aacdec.c:3536
main AAC context
Definition: aac.h:268
static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
Definition: ccaption_dec.c:522
#define CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
Definition: avcodec.h:856
static av_cold int aac_decode_init(AVCodecContext *avctx)
Definition: aacdec.c:1089
static enum AVSampleFormat sample_fmts[]
Definition: adpcmenc.c:701
static int aac_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
Definition: aacdec.c:3136

Definition at line 3555 of file aacdec.c.

AVCodec ff_aac_latm_decoder
Initial value:
= {
.name = "aac_latm",
.long_name = NULL_IF_CONFIG_SMALL("AAC LATM (Advanced Audio Coding LATM syntax)"),
.priv_data_size = sizeof(struct LATMContext),
.close = aac_decode_close,
.decode = latm_decode_frame,
.sample_fmts = (const enum AVSampleFormat[]) {
},
.channel_layouts = aac_channel_layout,
.flush = flush,
.profiles = profiles,
}
float, planar
Definition: samplefmt.h:70
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:789
static av_cold int aac_decode_close(AVCodecContext *avctx)
Definition: aacdec.c:3205
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:175
static int latm_decode_frame(AVCodecContext *avctx, void *out, int *got_frame_ptr, AVPacket *avpkt)
Definition: aacdec.c:3436
static const uint64_t aac_channel_layout[16]
Definition: aacdectab.h:100
static void flush(AVCodecContext *avctx)
Definition: aacdec.c:514
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:59
static const AVProfile profiles[]
Definition: aacdec.c:3543
static av_cold int latm_decode_init(AVCodecContext *avctx)
Definition: aacdec.c:3497
#define CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
Definition: avcodec.h:856

Definition at line 3579 of file aacdec.c.