#include "avcodec.h"
#include "internal.h"
#include "bitstream.h"
#include "dsputil.h"
#include "lpc.h"
#include "aac.h"
#include "aactab.h"
#include "aacdectab.h"
#include "mpeg4audio.h"
#include "aac_parser.h"
#include <assert.h>
#include <errno.h>
#include <math.h>
#include <string.h>
Go to the source code of this file.
Functions | |
static ChannelElement * | get_che (AACContext *ac, int type, int elem_id) |
static int | output_configure (AACContext *ac, enum ChannelPosition che_pos[4][MAX_ELEM_ID], enum ChannelPosition new_che_pos[4][MAX_ELEM_ID], int channel_config) |
Configure output channel order based on the current program configuration element. | |
static void | decode_channel_map (enum ChannelPosition *cpe_map, enum ChannelPosition *sce_map, enum ChannelPosition type, GetBitContext *gb, int n) |
Decode an array of 4 bit element IDs, optionally interleaved with a stereo/mono switching bit. | |
static int | decode_pce (AACContext *ac, enum ChannelPosition new_che_pos[4][MAX_ELEM_ID], GetBitContext *gb) |
Decode program configuration element; reference: table 4.2. | |
static int | set_default_channel_config (AACContext *ac, enum ChannelPosition new_che_pos[4][MAX_ELEM_ID], int channel_config) |
Set up channel positions based on a default channel configuration as specified in table 1.17. | |
static int | decode_ga_specific_config (AACContext *ac, GetBitContext *gb, int channel_config) |
Decode GA "General Audio" specific configuration; reference: table 4.1. | |
static int | decode_audio_specific_config (AACContext *ac, void *data, int data_size) |
Decode audio specific configuration; reference: table 1.13. | |
static av_always_inline int | lcg_random (int previous_val) |
linear congruential pseudorandom number generator | |
static void | reset_predict_state (PredictorState *ps) |
static void | reset_all_predictors (PredictorState *ps) |
static void | reset_predictor_group (PredictorState *ps, int group_num) |
static av_cold int | aac_decode_init (AVCodecContext *avccontext) |
static void | skip_data_stream_element (GetBitContext *gb) |
Skip data_stream_element; reference: table 4.10. | |
static int | decode_prediction (AACContext *ac, IndividualChannelStream *ics, GetBitContext *gb) |
static int | decode_ics_info (AACContext *ac, IndividualChannelStream *ics, GetBitContext *gb, int common_window) |
Decode Individual Channel Stream info; reference: table 4.6. | |
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. | |
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. | |
static int | decode_pulses (Pulse *pulse, GetBitContext *gb, const uint16_t *swb_offset, int num_swb) |
Decode pulse data; reference: table 4.7. | |
static int | decode_tns (AACContext *ac, TemporalNoiseShaping *tns, GetBitContext *gb, const IndividualChannelStream *ics) |
Decode Temporal Noise Shaping data; reference: table 4.48. | |
static void | decode_mid_side_stereo (ChannelElement *cpe, GetBitContext *gb, int ms_present) |
Decode Mid/Side data; reference: table 4.54. | |
static int | decode_spectrum_and_dequant (AACContext *ac, float coef[1024], GetBitContext *gb, float sf[120], int pulse_present, const Pulse *pulse, const IndividualChannelStream *ics, enum BandType band_type[120]) |
Decode spectral data; reference: table 4.50. | |
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 void | predict (AACContext *ac, PredictorState *ps, float *coef, int output_enable) |
static void | apply_prediction (AACContext *ac, SingleChannelElement *sce) |
Apply AAC-Main style frequency domain prediction. | |
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. | |
static void | apply_mid_side_stereo (ChannelElement *cpe) |
Mid/Side stereo decoding; reference: 4.6.8.1.3. | |
static void | apply_intensity_stereo (ChannelElement *cpe, int ms_present) |
intensity stereo decoding; reference: 4.6.8.2.3 | |
static int | decode_cpe (AACContext *ac, GetBitContext *gb, ChannelElement *cpe) |
Decode a channel_pair_element; reference: table 4.4. | |
static int | decode_cce (AACContext *ac, GetBitContext *gb, ChannelElement *che) |
Decode coupling_channel_element; reference: table 4.8. | |
static int | decode_sbr_extension (AACContext *ac, GetBitContext *gb, int crc, int cnt) |
Decode Spectral Band Replication extension data; reference: table 4.55. | |
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. | |
static int | decode_dynamic_range (DynamicRangeControl *che_drc, GetBitContext *gb, int cnt) |
Decode dynamic range information; reference: table 4.52. | |
static int | decode_extension_payload (AACContext *ac, GetBitContext *gb, int cnt) |
Decode extension data (incomplete); reference: table 4.51. | |
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. | |
static void | imdct_and_windowing (AACContext *ac, SingleChannelElement *sce) |
Conduct IMDCT and windowing. | |
static void | apply_dependent_coupling (AACContext *ac, SingleChannelElement *target, ChannelElement *cce, int index) |
Apply dependent channel coupling (applied before IMDCT). | |
static void | apply_independent_coupling (AACContext *ac, SingleChannelElement *target, ChannelElement *cce, int index) |
Apply independent channel coupling (applied after IMDCT). | |
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 | |
static void | spectral_to_sample (AACContext *ac) |
Convert spectral data to float samples, applying all supported tools as appropriate. | |
static int | parse_adts_frame_header (AACContext *ac, GetBitContext *gb) |
static int | aac_decode_frame (AVCodecContext *avccontext, void *data, int *data_size, const uint8_t *buf, int buf_size) |
static av_cold int | aac_decode_close (AVCodecContext *avccontext) |
Variables | |
static VLC | vlc_scalefactors |
static VLC | vlc_spectral [11] |
AVCodec | aac_decoder |
Definition in file aac.c.
static av_cold int aac_decode_close | ( | AVCodecContext * | avccontext | ) | [static] |
static int aac_decode_frame | ( | AVCodecContext * | avccontext, | |
void * | data, | |||
int * | data_size, | |||
const uint8_t * | buf, | |||
int | buf_size | |||
) | [static] |
static av_cold int aac_decode_init | ( | AVCodecContext * | avccontext | ) | [static] |
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
index | index into coupling gain array | |
apply_coupling_method | pointer to (in)dependent coupling function |
Definition at line 1531 of file aac.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).
index | index into coupling gain array |
Definition at line 1482 of file aac.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).
index | index into coupling gain array |
Definition at line 1514 of file aac.c.
Referenced by spectral_to_sample().
static void apply_intensity_stereo | ( | ChannelElement * | cpe, | |
int | ms_present | |||
) | [static] |
intensity stereo decoding; reference: 4.6.8.2.3
ms_present | Indicates 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 1098 of file aac.c.
Referenced by decode_cpe().
static void apply_mid_side_stereo | ( | ChannelElement * | cpe | ) | [static] |
Mid/Side stereo decoding; reference: 4.6.8.1.3.
Definition at line 1067 of file aac.c.
Referenced by decode_cpe().
static void apply_prediction | ( | AACContext * | ac, | |
SingleChannelElement * | sce | |||
) | [static] |
Apply AAC-Main style frequency domain prediction.
Definition at line 982 of file aac.c.
Referenced by decode_cpe(), and decode_ics().
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.
decode | 1 if tool is used normally, 0 if tool is used in LTP. | |
coef | spectral coefficients |
Definition at line 1371 of file aac.c.
Referenced by spectral_to_sample().
static int decode_audio_specific_config | ( | AACContext * | ac, | |
void * | data, | |||
int | data_size | |||
) | [static] |
Decode audio specific configuration; reference: table 1.13.
data | pointer to AVCodecContext extradata | |
data_size | size of AVCCodecContext extradata |
Definition at line 380 of file aac.c.
Referenced by aac_decode_init().
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.
band_type | array of the used band type | |
band_type_run_end | array of the last scalefactor band of a band type run |
Definition at line 624 of file aac.c.
Referenced by decode_ics().
static int decode_cce | ( | AACContext * | ac, | |
GetBitContext * | gb, | |||
ChannelElement * | che | |||
) | [static] |
Decode coupling_channel_element; reference: table 4.8.
elem_id | Identifies the instance of a syntax element. |
Definition at line 1179 of file aac.c.
Referenced by aac_decode_frame().
static void decode_channel_map | ( | enum ChannelPosition * | cpe_map, | |
enum ChannelPosition * | sce_map, | |||
enum ChannelPosition | type, | |||
GetBitContext * | gb, | |||
int | n | |||
) | [static] |
Decode an array of 4 bit element IDs, optionally interleaved with a stereo/mono switching bit.
cpe_map | Stereo (Channel Pair Element) map, NULL if stereo bit is not present. | |
sce_map | mono (Single Channel Element) map | |
type | speaker type/position for these channels |
Definition at line 213 of file aac.c.
Referenced by decode_pce().
static int decode_cpe | ( | AACContext * | ac, | |
GetBitContext * | gb, | |||
ChannelElement * | cpe | |||
) | [static] |
Decode a channel_pair_element; reference: table 4.4.
elem_id | Identifies the instance of a syntax element. |
Definition at line 1137 of file aac.c.
Referenced by aac_decode_frame().
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.
Definition at line 1272 of file aac.c.
Referenced by decode_dynamic_range().
static int decode_dynamic_range | ( | DynamicRangeControl * | che_drc, | |
GetBitContext * | gb, | |||
int | cnt | |||
) | [static] |
Decode dynamic range information; reference: table 4.52.
cnt | length of TYPE_FIL syntactic element in bytes |
Definition at line 1291 of file aac.c.
Referenced by decode_extension_payload().
static int decode_extension_payload | ( | AACContext * | ac, | |
GetBitContext * | gb, | |||
int | cnt | |||
) | [static] |
Decode extension data (incomplete); reference: table 4.51.
cnt | length of TYPE_FIL syntactic element in bytes |
Definition at line 1343 of file aac.c.
Referenced by aac_decode_frame().
static int decode_ga_specific_config | ( | AACContext * | ac, | |
GetBitContext * | gb, | |||
int | channel_config | |||
) | [static] |
Decode GA "General Audio" specific configuration; reference: table 4.1.
Definition at line 322 of file aac.c.
Referenced by decode_audio_specific_config().
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.
common_window | Channels have independent [0], or shared [1], Individual Channel Stream information. | |
scale_flag | scalable [1] or non-scalable [0] AAC (Unused until scalable AAC is implemented.) |
Definition at line 1011 of file aac.c.
Referenced by aac_decode_frame(), decode_cce(), and decode_cpe().
static int decode_ics_info | ( | AACContext * | ac, | |
IndividualChannelStream * | ics, | |||
GetBitContext * | gb, | |||
int | common_window | |||
) | [static] |
Decode Individual Channel Stream info; reference: table 4.6.
common_window | Channels have independent [0], or shared [1], Individual Channel Stream information. |
Definition at line 551 of file aac.c.
Referenced by decode_cpe(), and decode_ics().
static void decode_mid_side_stereo | ( | ChannelElement * | cpe, | |
GetBitContext * | gb, | |||
int | ms_present | |||
) | [static] |
Decode Mid/Side data; reference: table 4.54.
ms_present | Indicates 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 788 of file aac.c.
Referenced by decode_cpe().
static int decode_pce | ( | AACContext * | ac, | |
enum ChannelPosition | new_che_pos[4][MAX_ELEM_ID], | |||
GetBitContext * | gb | |||
) | [static] |
Decode program configuration element; reference: table 4.2.
new_che_pos | New channel position configuration - we only do something if it differs from the current one. |
Definition at line 228 of file aac.c.
Referenced by aac_decode_frame(), and decode_ga_specific_config().
static int decode_prediction | ( | AACContext * | ac, | |
IndividualChannelStream * | ics, | |||
GetBitContext * | gb | |||
) | [static] |
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 722 of file aac.c.
Referenced by decode_ics().
static int decode_sbr_extension | ( | AACContext * | ac, | |
GetBitContext * | gb, | |||
int | crc, | |||
int | cnt | |||
) | [static] |
Decode Spectral Band Replication extension data; reference: table 4.55.
crc | flag indicating the presence of CRC checksum | |
cnt | length of TYPE_FIL syntactic element in bytes |
Definition at line 1260 of file aac.c.
Referenced by decode_extension_payload().
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.
global_gain | first scalefactor value as scalefactors are differentially coded | |
band_type | array of the used band type | |
band_type_run_end | array of the last scalefactor band of a band type run | |
sf | array of scalefactors or intensity stereo positions |
Definition at line 666 of file aac.c.
Referenced by decode_ics().
static int decode_spectrum_and_dequant | ( | AACContext * | ac, | |
float | coef[1024], | |||
GetBitContext * | gb, | |||
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.
coef | array of dequantized, scaled spectral data | |
sf | array of scalefactors or intensity stereo positions | |
pulse_present | set if pulses are present | |
pulse | pointer to pulse data struct | |
band_type | array of the used band type |
Definition at line 811 of file aac.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.
Definition at line 747 of file aac.c.
Referenced by decode_ics().
static av_always_inline float flt16_even | ( | float | pf | ) | [static] |
static av_always_inline float flt16_round | ( | float | pf | ) | [static] |
static av_always_inline float flt16_trunc | ( | float | pf | ) | [static] |
static ChannelElement* get_che | ( | AACContext * | ac, | |
int | type, | |||
int | elem_id | |||
) | [static] |
static void imdct_and_windowing | ( | AACContext * | ac, | |
SingleChannelElement * | sce | |||
) | [static] |
Conduct IMDCT and windowing.
Definition at line 1411 of file aac.c.
Referenced by spectral_to_sample().
static av_always_inline int lcg_random | ( | int | previous_val | ) | [static] |
linear congruential pseudorandom number generator
previous_val | pointer to the current state of the generator |
Definition at line 416 of file aac.c.
Referenced by decode_spectrum_and_dequant().
static int output_configure | ( | AACContext * | ac, | |
enum ChannelPosition | che_pos[4][MAX_ELEM_ID], | |||
enum ChannelPosition | new_che_pos[4][MAX_ELEM_ID], | |||
int | channel_config | |||
) | [static] |
Configure output channel order based on the current program configuration element.
che_pos | current channel position configuration | |
new_che_pos | New channel position configuration - we only do something if it differs from the current one. |
Definition at line 158 of file aac.c.
Referenced by aac_decode_frame(), aac_decode_init(), and decode_ga_specific_config().
static int parse_adts_frame_header | ( | AACContext * | ac, | |
GetBitContext * | gb | |||
) | [static] |
static void predict | ( | AACContext * | ac, | |
PredictorState * | ps, | |||
float * | coef, | |||
int | output_enable | |||
) | [static] |
static void reset_all_predictors | ( | PredictorState * | ps | ) | [static] |
static void reset_predict_state | ( | PredictorState * | ps | ) | [static] |
Definition at line 420 of file aac.c.
Referenced by reset_all_predictors(), and reset_predictor_group().
static void reset_predictor_group | ( | PredictorState * | ps, | |
int | group_num | |||
) | [static] |
static int set_default_channel_config | ( | AACContext * | ac, | |
enum ChannelPosition | new_che_pos[4][MAX_ELEM_ID], | |||
int | channel_config | |||
) | [static] |
Set up channel positions based on a default channel configuration as specified in table 1.17.
new_che_pos | New channel position configuration - we only do something if it differs from the current one. |
Definition at line 280 of file aac.c.
Referenced by aac_decode_init(), and decode_ga_specific_config().
static void skip_data_stream_element | ( | GetBitContext * | gb | ) | [static] |
Skip data_stream_element; reference: table 4.10.
Definition at line 521 of file aac.c.
Referenced by aac_decode_frame().
static void spectral_to_sample | ( | AACContext * | ac | ) | [static] |
Convert spectral data to float samples, applying all supported tools as appropriate.
Definition at line 1563 of file aac.c.
Referenced by aac_decode_frame().
Initial value:
{ "aac", CODEC_TYPE_AUDIO, CODEC_ID_AAC, sizeof(AACContext), aac_decode_init, NULL, aac_decode_close, aac_decode_frame, .long_name = NULL_IF_CONFIG_SMALL("Advanced Audio Coding"), .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, }
VLC vlc_scalefactors [static] |
VLC vlc_spectral[11] [static] |