FFmpeg
Data Structures | Macros | Functions | Variables
aacdec_template.c File Reference
#include "libavutil/channel_layout.h"
#include "libavutil/thread.h"
#include "decode.h"
#include "internal.h"
#include "lpc_functions.h"

Go to the source code of this file.

Data Structures

struct  elem_to_channel
 

Macros

#define overread_err   "Input buffer exhausted before END element found\n"
 
#define MDCT_INIT(s, fn, len, sval)
 
#define AACDEC_FLAGS   AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM
 AVOptions for Japanese DTV specific extensions (ADTS only) More...
 
#define OFF(field)   offsetof(AACDecContext, field)
 

Functions

static int output_configure (AACDecContext *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 (AACDecContext *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, uint64_t *layout)
 
static int count_paired_channels (uint8_t(*layout_map)[3], int tags, int pos, int current)
 
static int assign_channels (struct elem_to_channel e2c_vec[MAX_ELEM_ID], uint8_t(*layout_map)[3], uint64_t *layout, int tags, int layer, int pos, int *current)
 
static uint64_t sniff_channel_order (uint8_t(*layout_map)[3], int tags)
 
static int push_output_configuration (AACDecContext *ac)
 Save current output configuration if and only if it has been locked. More...
 
static void pop_output_configuration (AACDecContext *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 (AACDecContext *ac, 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 (AACDecContext *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 void relative_align_get_bits (GetBitContext *gb, int reference_position)
 
static int decode_pce (AVCodecContext *avctx, MPEG4AudioConfig *m4ac, uint8_t(*layout_map)[3], GetBitContext *gb, int byte_align_ref)
 Decode program configuration element; reference: table 4.2. More...
 
static int decode_ga_specific_config (AACDecContext *ac, AVCodecContext *avctx, GetBitContext *gb, int get_bit_alignment, MPEG4AudioConfig *m4ac, int channel_config)
 Decode GA "General Audio" specific configuration; reference: table 4.1. More...
 
static int decode_eld_specific_config (AACDecContext *ac, AVCodecContext *avctx, GetBitContext *gb, MPEG4AudioConfig *m4ac, int channel_config)
 
static int decode_audio_specific_config_gb (AACDecContext *ac, AVCodecContext *avctx, MPEG4AudioConfig *m4ac, GetBitContext *gb, int get_bit_alignment, int sync_extension)
 Decode audio specific configuration; reference: table 1.13. More...
 
static int decode_audio_specific_config (AACDecContext *ac, AVCodecContext *avctx, MPEG4AudioConfig *m4ac, const uint8_t *data, int64_t bit_size, int sync_extension)
 
static av_always_inline int lcg_random (unsigned previous_val)
 linear congruential pseudorandom number generator More...
 
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 (AACDecContext *ac)
 
static av_cold void aac_static_table_init (void)
 
static av_cold int aac_decode_init (AVCodecContext *avctx)
 
static int skip_data_stream_element (AACDecContext *ac, GetBitContext *gb)
 Skip data_stream_element; reference: table 4.10. More...
 
static int decode_prediction (AACDecContext *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 (AACDecContext *ac, IndividualChannelStream *ics, GetBitContext *gb)
 Decode Individual Channel Stream info; reference: table 4.6. More...
 
static int decode_band_types (AACDecContext *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 (AACDecContext *ac, INTFLOAT 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 (AACDecContext *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 int decode_spectrum_and_dequant (AACDecContext *ac, INTFLOAT coef[1024], GetBitContext *gb, const INTFLOAT 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 void apply_prediction (AACDecContext *ac, SingleChannelElement *sce)
 Apply AAC-Main style frequency domain prediction. More...
 
static void decode_gain_control (SingleChannelElement *sce, GetBitContext *gb)
 
static int decode_ics (AACDecContext *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 (AACDecContext *ac, ChannelElement *cpe)
 Mid/Side stereo decoding; reference: 4.6.8.1.3. More...
 
static void apply_intensity_stereo (AACDecContext *ac, ChannelElement *cpe, int ms_present)
 intensity stereo decoding; reference: 4.6.8.2.3 More...
 
static int decode_cpe (AACDecContext *ac, GetBitContext *gb, ChannelElement *cpe)
 Decode a channel_pair_element; reference: table 4.4. More...
 
static int decode_cce (AACDecContext *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 (AACDecContext *ac, GetBitContext *gb, int len)
 
static int decode_extension_payload (AACDecContext *ac, GetBitContext *gb, int cnt, ChannelElement *che, enum RawDataBlockType elem_type)
 Decode extension data (incomplete); reference: table 4.51. More...
 
static void apply_tns (INTFLOAT coef_param[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 (AACDecContext *ac, INTFLOAT *out, INTFLOAT *in, IndividualChannelStream *ics)
 Apply windowing and MDCT to obtain the spectral coefficient from the predicted sample by LTP. More...
 
static void apply_ltp (AACDecContext *ac, SingleChannelElement *sce)
 Apply the long term prediction. More...
 
static void update_ltp (AACDecContext *ac, SingleChannelElement *sce)
 Update the LTP buffer for next frame. More...
 
static void imdct_and_windowing (AACDecContext *ac, SingleChannelElement *sce)
 Conduct IMDCT and windowing. More...
 
static void imdct_and_windowing_960 (AACDecContext *ac, SingleChannelElement *sce)
 Conduct IMDCT and windowing. More...
 
static void imdct_and_windowing_ld (AACDecContext *ac, SingleChannelElement *sce)
 
static void imdct_and_windowing_eld (AACDecContext *ac, SingleChannelElement *sce)
 
static void apply_channel_coupling (AACDecContext *ac, ChannelElement *cc, enum RawDataBlockType type, int elem_id, enum CouplingPoint coupling_point, void(*apply_coupling_method)(AACDecContext *ac, SingleChannelElement *target, ChannelElement *cce, int index))
 channel coupling transformation interface More...
 
static void spectral_to_sample (AACDecContext *ac, int samples)
 Convert spectral data to samples, applying all supported tools as appropriate. More...
 
static int parse_adts_frame_header (AACDecContext *ac, GetBitContext *gb)
 
static int aac_decode_er_frame (AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, GetBitContext *gb)
 
static int aac_decode_frame_int (AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, GetBitContext *gb, const AVPacket *avpkt)
 
static int aac_decode_frame (AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
 
static av_cold int aac_decode_close (AVCodecContext *avctx)
 

Variables

static AVOnce aac_table_init = AV_ONCE_INIT
 
static const float cce_scale []
 
static const AVOption options []
 
static const AVClass aac_decoder_class
 

Detailed Description

AAC decoder

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

AAC decoder fixed-point implementation

Author
Stanislav Ocovaj ( stanislav.ocovaj imgtec com )
Nedeljko Babic ( nedeljko.babic imgtec com )

Definition in file aacdec_template.c.

Macro Definition Documentation

◆ overread_err

#define overread_err   "Input buffer exhausted before END element found\n"

Definition at line 102 of file aacdec_template.c.

◆ MDCT_INIT

#define MDCT_INIT (   s,
  fn,
  len,
  sval 
)
Value:
scale = sval; \
ret = av_tx_init(&s, &fn, TX_TYPE, 1, len, &scale, 0); \
if (ret < 0) \
return ret;

◆ AACDEC_FLAGS

AVOptions for Japanese DTV specific extensions (ADTS only)

Definition at line 3422 of file aacdec_template.c.

◆ OFF

#define OFF (   field)    offsetof(AACDecContext, field)

Definition at line 3423 of file aacdec_template.c.

Function Documentation

◆ output_configure()

static int output_configure ( AACDecContext 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 447 of file aacdec_template.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().

◆ count_channels()

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

Definition at line 104 of file aacdec_template.c.

Referenced by decode_ga_specific_config().

◆ che_configure()

static av_cold int che_configure ( AACDecContext 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 128 of file aacdec_template.c.

Referenced by output_configure().

◆ frame_configure_elements()

static int frame_configure_elements ( AVCodecContext avctx)
static

Definition at line 162 of file aacdec_template.c.

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

◆ assign_pair()

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,
uint64_t *  layout 
)
static

Definition at line 203 of file aacdec_template.c.

Referenced by assign_channels().

◆ count_paired_channels()

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

Definition at line 241 of file aacdec_template.c.

Referenced by assign_channels().

◆ assign_channels()

static int assign_channels ( struct elem_to_channel  e2c_vec[MAX_ELEM_ID],
uint8_t(*)  layout_map[3],
uint64_t *  layout,
int  tags,
int  layer,
int  pos,
int current 
)
static

Definition at line 273 of file aacdec_template.c.

Referenced by sniff_channel_order().

◆ sniff_channel_order()

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

Definition at line 351 of file aacdec_template.c.

Referenced by output_configure().

◆ push_output_configuration()

static int push_output_configuration ( AACDecContext ac)
static

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

Definition at line 415 of file aacdec_template.c.

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

◆ pop_output_configuration()

static void pop_output_configuration ( AACDecContext ac)
static

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

Definition at line 431 of file aacdec_template.c.

Referenced by aac_decode_frame_int(), and latm_decode_frame().

◆ flush()

static void flush ( AVCodecContext avctx)
static

Definition at line 513 of file aacdec_template.c.

◆ set_default_channel_config()

static int set_default_channel_config ( AACDecContext ac,
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 536 of file aacdec_template.c.

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

◆ get_che()

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

Definition at line 576 of file aacdec_template.c.

Referenced by aac_decode_er_frame(), and aac_decode_frame_int().

◆ decode_channel_map()

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 722 of file aacdec_template.c.

Referenced by decode_pce().

◆ relative_align_get_bits()

static void relative_align_get_bits ( GetBitContext gb,
int  reference_position 
)
inlinestatic

Definition at line 752 of file aacdec_template.c.

Referenced by decode_pce().

◆ decode_pce()

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

Decode program configuration element; reference: table 4.2.

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

Definition at line 764 of file aacdec_template.c.

Referenced by aac_decode_frame_int(), and decode_ga_specific_config().

◆ decode_ga_specific_config()

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

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

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

Definition at line 834 of file aacdec_template.c.

Referenced by decode_audio_specific_config_gb().

◆ decode_eld_specific_config()

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

Definition at line 915 of file aacdec_template.c.

Referenced by decode_audio_specific_config_gb().

◆ decode_audio_specific_config_gb()

static int decode_audio_specific_config_gb ( AACDecContext ac,
AVCodecContext avctx,
MPEG4AudioConfig m4ac,
GetBitContext gb,
int  get_bit_alignment,
int  sync_extension 
)
static

Decode audio specific configuration; reference: table 1.13.

Parameters
acpointer to AACDecContext, may be null
avctxpointer to AVCCodecContext, used for logging
m4acpointer to MPEG4AudioConfig, used for parsing
gbbuffer holding an audio specific config
get_bit_alignmentrelative alignment for byte align operations
sync_extensionlook for an appended sync extension
Returns
Returns error status or number of consumed bits. <0 - error

Definition at line 984 of file aacdec_template.c.

Referenced by decode_audio_specific_config(), and latm_decode_audio_specific_config().

◆ decode_audio_specific_config()

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

Definition at line 1051 of file aacdec_template.c.

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

◆ lcg_random()

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 1084 of file aacdec_template.c.

Referenced by decode_spectrum_and_dequant(), and search_for_pns().

◆ reset_all_predictors()

static void reset_all_predictors ( PredictorState ps)
static

Definition at line 1090 of file aacdec_template.c.

Referenced by apply_prediction().

◆ sample_rate_idx()

static int sample_rate_idx ( int  rate)
static

Definition at line 1097 of file aacdec_template.c.

Referenced by aac_decode_init().

◆ reset_predictor_group()

static void reset_predictor_group ( PredictorState ps,
int  group_num 
)
static

Definition at line 1113 of file aacdec_template.c.

Referenced by apply_prediction().

◆ aacdec_init()

static void aacdec_init ( AACDecContext ac)
static

Definition at line 3401 of file aacdec_template.c.

Referenced by aac_decode_init().

◆ aac_static_table_init()

static av_cold void aac_static_table_init ( void  )
static

Definition at line 1122 of file aacdec_template.c.

Referenced by aac_decode_init().

◆ aac_decode_init()

static av_cold int aac_decode_init ( AVCodecContext avctx)
static

Definition at line 1148 of file aacdec_template.c.

Referenced by latm_decode_init().

◆ skip_data_stream_element()

static int skip_data_stream_element ( AACDecContext ac,
GetBitContext gb 
)
static

Skip data_stream_element; reference: table 4.10.

Definition at line 1249 of file aacdec_template.c.

Referenced by aac_decode_frame_int().

◆ decode_prediction()

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

Definition at line 1266 of file aacdec_template.c.

Referenced by decode_ics_info().

◆ decode_ltp()

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 1288 of file aacdec_template.c.

Referenced by decode_cpe(), and decode_ics_info().

◆ decode_ics_info()

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

Decode Individual Channel Stream info; reference: table 4.6.

Definition at line 1302 of file aacdec_template.c.

Referenced by decode_cpe(), and decode_ics().

◆ decode_band_types()

static int decode_band_types ( AACDecContext 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 1428 of file aacdec_template.c.

Referenced by decode_ics().

◆ decode_scalefactors()

static int decode_scalefactors ( AACDecContext ac,
INTFLOAT  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 1477 of file aacdec_template.c.

Referenced by decode_ics().

◆ decode_pulses()

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 1552 of file aacdec_template.c.

Referenced by decode_ics().

◆ decode_tns()

static int decode_tns ( AACDecContext 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 1579 of file aacdec_template.c.

Referenced by decode_ics().

◆ decode_mid_side_stereo()

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 1622 of file aacdec_template.c.

Referenced by decode_cpe().

◆ decode_spectrum_and_dequant()

static int decode_spectrum_and_dequant ( AACDecContext ac,
INTFLOAT  coef[1024],
GetBitContext gb,
const INTFLOAT  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 1647 of file aacdec_template.c.

Referenced by decode_ics().

◆ apply_prediction()

static void apply_prediction ( AACDecContext ac,
SingleChannelElement sce 
)
static

Apply AAC-Main style frequency domain prediction.

Definition at line 1942 of file aacdec_template.c.

Referenced by decode_cpe(), and decode_ics().

◆ decode_gain_control()

static void decode_gain_control ( SingleChannelElement sce,
GetBitContext gb 
)
static

Definition at line 1970 of file aacdec_template.c.

Referenced by decode_ics().

◆ decode_ics()

static int decode_ics ( AACDecContext 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 2005 of file aacdec_template.c.

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

◆ apply_mid_side_stereo()

static void apply_mid_side_stereo ( AACDecContext ac,
ChannelElement cpe 
)
static

Mid/Side stereo decoding; reference: 4.6.8.1.3.

Definition at line 2096 of file aacdec_template.c.

Referenced by decode_cpe().

◆ apply_intensity_stereo()

static void apply_intensity_stereo ( AACDecContext 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 2134 of file aacdec_template.c.

Referenced by decode_cpe().

◆ decode_cpe()

static int decode_cpe ( AACDecContext 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 2184 of file aacdec_template.c.

Referenced by aac_decode_er_frame(), and aac_decode_frame_int().

◆ decode_cce()

static int decode_cce ( AACDecContext 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 2237 of file aacdec_template.c.

Referenced by aac_decode_frame_int().

◆ decode_drc_channel_exclusions()

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 2321 of file aacdec_template.c.

Referenced by decode_dynamic_range().

◆ 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 2340 of file aacdec_template.c.

Referenced by decode_extension_payload().

◆ decode_fill()

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

Definition at line 2387 of file aacdec_template.c.

Referenced by decode_extension_payload().

◆ decode_extension_payload()

static int decode_extension_payload ( AACDecContext 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 2420 of file aacdec_template.c.

Referenced by aac_decode_frame_int().

◆ apply_tns()

static void apply_tns ( INTFLOAT  coef_param[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 2490 of file aacdec_template.c.

Referenced by aacdec_init().

◆ windowing_and_mdct_ltp()

static void windowing_and_mdct_ltp ( AACDecContext ac,
INTFLOAT out,
INTFLOAT in,
IndividualChannelStream ics 
)
static

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

Definition at line 2550 of file aacdec_template.c.

Referenced by aacdec_init().

◆ apply_ltp()

static void apply_ltp ( AACDecContext ac,
SingleChannelElement sce 
)
static

Apply the long term prediction.

Definition at line 2576 of file aacdec_template.c.

Referenced by aacdec_init().

◆ update_ltp()

static void update_ltp ( AACDecContext ac,
SingleChannelElement sce 
)
static

Update the LTP buffer for next frame.

Definition at line 2608 of file aacdec_template.c.

Referenced by aacdec_init().

◆ imdct_and_windowing()

static void imdct_and_windowing ( AACDecContext ac,
SingleChannelElement sce 
)
static

Conduct IMDCT and windowing.

Definition at line 2646 of file aacdec_template.c.

Referenced by aacdec_init().

◆ imdct_and_windowing_960()

static void imdct_and_windowing_960 ( AACDecContext ac,
SingleChannelElement sce 
)
static

Conduct IMDCT and windowing.

Definition at line 2710 of file aacdec_template.c.

Referenced by spectral_to_sample().

◆ imdct_and_windowing_ld()

static void imdct_and_windowing_ld ( AACDecContext ac,
SingleChannelElement sce 
)
static

Definition at line 2771 of file aacdec_template.c.

Referenced by spectral_to_sample().

◆ imdct_and_windowing_eld()

static void imdct_and_windowing_eld ( AACDecContext ac,
SingleChannelElement sce 
)
static

Definition at line 2796 of file aacdec_template.c.

Referenced by spectral_to_sample().

◆ apply_channel_coupling()

static void apply_channel_coupling ( AACDecContext ac,
ChannelElement cc,
enum RawDataBlockType  type,
int  elem_id,
enum CouplingPoint  coupling_point,
void(*)(AACDecContext *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 2864 of file aacdec_template.c.

Referenced by spectral_to_sample().

◆ spectral_to_sample()

static void spectral_to_sample ( AACDecContext ac,
int  samples 
)
static

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

Definition at line 2897 of file aacdec_template.c.

Referenced by aac_decode_er_frame(), and aac_decode_frame_int().

◆ parse_adts_frame_header()

static int parse_adts_frame_header ( AACDecContext 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 2969 of file aacdec_template.c.

Referenced by aac_decode_frame_int().

◆ aac_decode_er_frame()

static int aac_decode_er_frame ( AVCodecContext avctx,
AVFrame frame,
int got_frame_ptr,
GetBitContext gb 
)
static

Definition at line 3031 of file aacdec_template.c.

Referenced by aac_decode_frame(), and latm_decode_frame().

◆ aac_decode_frame_int()

static int aac_decode_frame_int ( AVCodecContext avctx,
AVFrame frame,
int got_frame_ptr,
GetBitContext gb,
const AVPacket avpkt 
)
static

Definition at line 3103 of file aacdec_template.c.

Referenced by aac_decode_frame(), and latm_decode_frame().

◆ aac_decode_frame()

static int aac_decode_frame ( AVCodecContext avctx,
AVFrame frame,
int got_frame_ptr,
AVPacket avpkt 
)
static

Definition at line 3313 of file aacdec_template.c.

◆ aac_decode_close()

static av_cold int aac_decode_close ( AVCodecContext avctx)
static

Definition at line 3376 of file aacdec_template.c.

Variable Documentation

◆ aac_table_init

AVOnce aac_table_init = AV_ONCE_INIT
static

Definition at line 1146 of file aacdec_template.c.

Referenced by aac_decode_init().

◆ cce_scale

const float cce_scale[]
static
Initial value:
= {
1.09050773266525765921,
1.18920711500272106672,
2,
}

Definition at line 2225 of file aacdec_template.c.

Referenced by decode_cce().

◆ options

const AVOption options[]
static
Initial value:
= {
{"dual_mono_mode", "Select the channel to decode for dual mono",
OFF(force_dmono_mode), AV_OPT_TYPE_INT, {.i64=-1}, -1, 2,
AACDEC_FLAGS, .unit = "dual_mono_mode"},
{"auto", "autoselection", 0, AV_OPT_TYPE_CONST, {.i64=-1}, INT_MIN, INT_MAX, AACDEC_FLAGS, .unit = "dual_mono_mode"},
{"main", "Select Main/Left channel", 0, AV_OPT_TYPE_CONST, {.i64= 1}, INT_MIN, INT_MAX, AACDEC_FLAGS, .unit = "dual_mono_mode"},
{"sub" , "Select Sub/Right channel", 0, AV_OPT_TYPE_CONST, {.i64= 2}, INT_MIN, INT_MAX, AACDEC_FLAGS, .unit = "dual_mono_mode"},
{"both", "Select both channels", 0, AV_OPT_TYPE_CONST, {.i64= 0}, INT_MIN, INT_MAX, AACDEC_FLAGS, .unit = "dual_mono_mode"},
{ "channel_order", "Order in which the channels are to be exported",
OFF(output_channel_order), AV_OPT_TYPE_INT,
{ .i64 = CHANNEL_ORDER_DEFAULT }, 0, 1, AACDEC_FLAGS, .unit = "channel_order" },
{ "default", "normal libavcodec channel order", 0, AV_OPT_TYPE_CONST,
{ .i64 = CHANNEL_ORDER_DEFAULT }, .flags = AACDEC_FLAGS, .unit = "channel_order" },
{ "coded", "order in which the channels are coded in the bitstream",
0, AV_OPT_TYPE_CONST, { .i64 = CHANNEL_ORDER_CODED }, .flags = AACDEC_FLAGS, .unit = "channel_order" },
{NULL},
}

Definition at line 3424 of file aacdec_template.c.

◆ aac_decoder_class

const AVClass aac_decoder_class
static
Initial value:
= {
.class_name = "AAC decoder",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 3445 of file aacdec_template.c.

av_tx_init
av_cold int av_tx_init(AVTXContext **ctx, av_tx_fn *tx, enum AVTXType type, int inv, int len, const void *scale, uint64_t flags)
Initialize a transform context with the given configuration (i)MDCTs with an odd length are currently...
Definition: tx.c:902
s
#define s(width, name)
Definition: cbs_vp9.c:198
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
OFF
#define OFF(field)
Definition: aacdec_template.c:3423
NULL
#define NULL
Definition: coverity.c:32
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
scale
static void scale(int *out, const int *in, const int w, const int h, const int shift)
Definition: vvc_intra.c:291
fn
#define fn(a)
Definition: aap_template.c:37
CHANNEL_ORDER_CODED
@ CHANNEL_ORDER_CODED
Definition: aacdec.h:59
options
static const AVOption options[]
Definition: aacdec_template.c:3424
len
int len
Definition: vorbis_enc_data.h:426
ret
ret
Definition: filter_design.txt:187
AACDEC_FLAGS
#define AACDEC_FLAGS
AVOptions for Japanese DTV specific extensions (ADTS only)
Definition: aacdec_template.c:3422
CHANNEL_ORDER_DEFAULT
@ CHANNEL_ORDER_DEFAULT
Definition: aacdec.h:58
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
M_SQRT2
#define M_SQRT2
Definition: mathematics.h:109
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:244
TX_TYPE
#define TX_TYPE
Definition: aacdec.c:36