FFmpeg
|
#include "libavutil/channel_layout.h"
#include "libavutil/thread.h"
#include "decode.h"
#include "internal.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... | |
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, 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 (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 (AACContext *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 ChannelElement * | get_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 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 (AACContext *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 (AACContext *ac, AVCodecContext *avctx, GetBitContext *gb, MPEG4AudioConfig *m4ac, int channel_config) |
static int | decode_audio_specific_config_gb (AACContext *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 (AACContext *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 (AACContext *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 (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, 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 (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 int | decode_spectrum_and_dequant (AACContext *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 (AACContext *ac, SingleChannelElement *sce) |
Apply AAC-Main style frequency domain prediction. More... | |
static void | decode_gain_control (SingleChannelElement *sce, GetBitContext *gb) |
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 (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 (AACContext *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 (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_960 (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_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, int samples) |
Convert spectral data to 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, 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 VLC | vlc_scalefactors |
static VLC | vlc_spectral [11] |
static AVOnce | aac_table_init = AV_ONCE_INIT |
static const float | cce_scale [] |
static const AVOption | options [] |
static const AVClass | aac_decoder_class |
Definition at line 104 of file aacdec_template.c.
#define AACDEC_FLAGS AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM |
AVOptions for Japanese DTV specific extensions (ADTS only)
Definition at line 3455 of file aacdec_template.c.
|
static |
Configure output channel order based on the current program configuration element.
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().
Definition at line 106 of file aacdec_template.c.
Referenced by decode_ga_specific_config().
|
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.
che_pos | current channel position configuration |
type | channel element type |
id | channel element id |
channels | count of the number of channels in the configuration |
Definition at line 130 of file aacdec_template.c.
Referenced by output_configure().
|
static |
Definition at line 164 of file aacdec_template.c.
Referenced by aac_decode_er_frame(), aac_decode_frame_int(), and output_configure().
|
static |
Definition at line 205 of file aacdec_template.c.
Referenced by assign_channels().
|
static |
Definition at line 243 of file aacdec_template.c.
Referenced by assign_channels().
|
static |
Definition at line 275 of file aacdec_template.c.
Referenced by sniff_channel_order().
|
static |
Definition at line 353 of file aacdec_template.c.
Referenced by output_configure().
|
static |
Save current output configuration if and only if it has been locked.
Definition at line 417 of file aacdec_template.c.
Referenced by aac_decode_frame_int(), get_che(), latm_decode_frame(), and parse_adts_frame_header().
|
static |
Restore the previous output configuration if and only if the current configuration is unlocked.
Definition at line 432 of file aacdec_template.c.
Referenced by aac_decode_frame_int(), and latm_decode_frame().
|
static |
Definition at line 520 of file aacdec_template.c.
|
static |
Set up channel positions based on a default channel configuration as specified in table 1.17.
Definition at line 543 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().
|
static |
Definition at line 583 of file aacdec_template.c.
Referenced by aac_decode_er_frame(), and aac_decode_frame_int().
|
static |
Decode an array of 4 bit element IDs, optionally interleaved with a stereo/mono switching bit.
type | speaker type/position for these channels |
Definition at line 729 of file aacdec_template.c.
Referenced by decode_pce().
|
inlinestatic |
Definition at line 759 of file aacdec_template.c.
Referenced by decode_pce().
|
static |
Decode program configuration element; reference: table 4.2.
Definition at line 771 of file aacdec_template.c.
Referenced by aac_decode_frame_int(), and decode_ga_specific_config().
|
static |
Decode GA "General Audio" specific configuration; reference: table 4.1.
ac | pointer to AACContext, may be null |
avctx | pointer to AVCCodecContext, used for logging |
Definition at line 841 of file aacdec_template.c.
Referenced by decode_audio_specific_config_gb().
|
static |
Definition at line 922 of file aacdec_template.c.
Referenced by decode_audio_specific_config_gb().
|
static |
Decode audio specific configuration; reference: table 1.13.
ac | pointer to AACContext, may be null |
avctx | pointer to AVCCodecContext, used for logging |
m4ac | pointer to MPEG4AudioConfig, used for parsing |
gb | buffer holding an audio specific config |
get_bit_alignment | relative alignment for byte align operations |
sync_extension | look for an appended sync extension |
Definition at line 991 of file aacdec_template.c.
Referenced by decode_audio_specific_config(), and latm_decode_audio_specific_config().
|
static |
Definition at line 1058 of file aacdec_template.c.
Referenced by aac_decode_frame(), aac_decode_init(), and latm_decode_frame().
|
static |
linear congruential pseudorandom number generator
previous_val | pointer to the current state of the generator |
Definition at line 1091 of file aacdec_template.c.
Referenced by decode_spectrum_and_dequant(), and search_for_pns().
|
static |
Definition at line 1097 of file aacdec_template.c.
Referenced by apply_prediction().
Definition at line 1104 of file aacdec_template.c.
Referenced by aac_decode_init().
|
static |
Definition at line 1120 of file aacdec_template.c.
Referenced by apply_prediction().
|
static |
Definition at line 3434 of file aacdec_template.c.
Referenced by aac_decode_init().
|
static |
Definition at line 1129 of file aacdec_template.c.
Referenced by aac_decode_init().
|
static |
Definition at line 1181 of file aacdec_template.c.
Referenced by latm_decode_init().
|
static |
Skip data_stream_element; reference: table 4.10.
Definition at line 1282 of file aacdec_template.c.
Referenced by aac_decode_frame_int().
|
static |
Definition at line 1299 of file aacdec_template.c.
Referenced by decode_ics_info().
|
static |
Decode Long Term Prediction data; reference: table 4.xx.
Definition at line 1321 of file aacdec_template.c.
Referenced by decode_cpe(), and decode_ics_info().
|
static |
Decode Individual Channel Stream info; reference: table 4.6.
Definition at line 1335 of file aacdec_template.c.
Referenced by decode_cpe(), and decode_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 1461 of file aacdec_template.c.
Referenced by decode_ics().
|
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 1510 of file aacdec_template.c.
Referenced by decode_ics().
|
static |
Decode pulse data; reference: table 4.7.
Definition at line 1585 of file aacdec_template.c.
Referenced by decode_ics().
|
static |
Decode Temporal Noise Shaping data; reference: table 4.48.
Definition at line 1612 of file aacdec_template.c.
Referenced by decode_ics().
|
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 1655 of file aacdec_template.c.
Referenced by decode_cpe().
|
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 1680 of file aacdec_template.c.
Referenced by decode_ics().
|
static |
Apply AAC-Main style frequency domain prediction.
Definition at line 1975 of file aacdec_template.c.
Referenced by decode_cpe(), and decode_ics().
|
static |
Definition at line 2003 of file aacdec_template.c.
Referenced by decode_ics().
|
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 2038 of file aacdec_template.c.
Referenced by aac_decode_er_frame(), aac_decode_frame_int(), decode_cce(), and decode_cpe().
|
static |
Mid/Side stereo decoding; reference: 4.6.8.1.3.
Definition at line 2129 of file aacdec_template.c.
Referenced by decode_cpe().
|
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 2167 of file aacdec_template.c.
Referenced by decode_cpe().
|
static |
Decode a channel_pair_element; reference: table 4.4.
Definition at line 2217 of file aacdec_template.c.
Referenced by aac_decode_er_frame(), and aac_decode_frame_int().
|
static |
Decode coupling_channel_element; reference: table 4.8.
Definition at line 2270 of file aacdec_template.c.
Referenced by aac_decode_frame_int().
|
static |
Parse whether channels are to be excluded from Dynamic Range Compression; reference: table 4.53.
Definition at line 2354 of file aacdec_template.c.
Referenced by decode_dynamic_range().
|
static |
Decode dynamic range information; reference: table 4.52.
Definition at line 2373 of file aacdec_template.c.
Referenced by decode_extension_payload().
|
static |
Definition at line 2420 of file aacdec_template.c.
Referenced by decode_extension_payload().
|
static |
Decode extension data (incomplete); reference: table 4.51.
cnt | length of TYPE_FIL syntactic element in bytes |
Definition at line 2453 of file aacdec_template.c.
Referenced by aac_decode_frame_int().
|
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 2523 of file aacdec_template.c.
Referenced by aacdec_init().
|
static |
Apply windowing and MDCT to obtain the spectral coefficient from the predicted sample by LTP.
Definition at line 2583 of file aacdec_template.c.
Referenced by aacdec_init().
|
static |
Apply the long term prediction.
Definition at line 2609 of file aacdec_template.c.
Referenced by aacdec_init().
|
static |
Update the LTP buffer for next frame.
Definition at line 2641 of file aacdec_template.c.
Referenced by aacdec_init().
|
static |
Conduct IMDCT and windowing.
Definition at line 2679 of file aacdec_template.c.
Referenced by aacdec_init().
|
static |
Conduct IMDCT and windowing.
Definition at line 2743 of file aacdec_template.c.
Referenced by spectral_to_sample().
|
static |
Definition at line 2804 of file aacdec_template.c.
Referenced by spectral_to_sample().
|
static |
Definition at line 2829 of file aacdec_template.c.
Referenced by spectral_to_sample().
|
static |
channel coupling transformation interface
apply_coupling_method | pointer to (in)dependent coupling function |
Definition at line 2897 of file aacdec_template.c.
Referenced by spectral_to_sample().
|
static |
Convert spectral data to samples, applying all supported tools as appropriate.
Definition at line 2930 of file aacdec_template.c.
Referenced by aac_decode_er_frame(), and aac_decode_frame_int().
|
static |
dual mono frames in Japanese DTV can have chan_config 0 WITHOUT specifying PCE. thus, set dual mono as default.
Definition at line 3002 of file aacdec_template.c.
Referenced by aac_decode_frame_int().
|
static |
Definition at line 3064 of file aacdec_template.c.
Referenced by aac_decode_frame(), and latm_decode_frame().
|
static |
Definition at line 3136 of file aacdec_template.c.
Referenced by aac_decode_frame(), and latm_decode_frame().
|
static |
Definition at line 3346 of file aacdec_template.c.
|
static |
Definition at line 3409 of file aacdec_template.c.
|
static |
Definition at line 97 of file aacdec_template.c.
Referenced by aac_static_table_init(), decode_cce(), and decode_scalefactors().
|
static |
Definition at line 98 of file aacdec_template.c.
Referenced by aac_static_table_init(), and decode_spectrum_and_dequant().
|
static |
Definition at line 1179 of file aacdec_template.c.
Referenced by aac_decode_init().
|
static |
Definition at line 2258 of file aacdec_template.c.
Referenced by decode_cce().
|
static |
Definition at line 3456 of file aacdec_template.c.
|
static |
Definition at line 3477 of file aacdec_template.c.