X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Faac.h;h=6c5d962dd8a4e13eb3e7438a0f52240212fc1964;hb=0e02b381b4850bbc5b8e1ce6e17447968a2ae8b5;hp=49def78979bc83d0357e47fa39dbd0b9af1d8065;hpb=37bed6ff3f7f48e25d1e0c3efdf8cbb90bcf9514;p=ffmpeg diff --git a/libavcodec/aac.h b/libavcodec/aac.h index 49def78979b..6c5d962dd8a 100644 --- a/libavcodec/aac.h +++ b/libavcodec/aac.h @@ -30,6 +30,7 @@ #ifndef AVCODEC_AAC_H #define AVCODEC_AAC_H +#include "libavutil/float_dsp.h" #include "avcodec.h" #include "dsputil.h" #include "fft.h" @@ -112,10 +113,19 @@ enum OCStatus { OC_LOCKED, ///< Output configuration locked in place }; +typedef struct OutputConfiguration { + MPEG4AudioConfig m4ac; + uint8_t layout_map[MAX_ELEM_ID*4][3]; + int layout_map_tags; + int channels; + uint64_t channel_layout; + enum OCStatus status; +} OutputConfiguration; + /** * Predictor State */ -typedef struct { +typedef struct PredictorState { float cor0; float cor1; float var0; @@ -131,12 +141,11 @@ typedef struct { #define SCALE_MAX_POS 255 ///< scalefactor index maximum value #define SCALE_MAX_DIFF 60 ///< maximum scalefactor difference allowed by standard #define SCALE_DIFF_ZERO 60 ///< codebook index corresponding to zero scalefactor indices difference -#define POW_SF2_ZERO 200 ///< ff_aac_pow2sf_tab index corresponding to pow(2, 0); /** * Long Term Prediction */ -typedef struct { +typedef struct LongTermPrediction { int8_t present; int16_t lag; float coef; @@ -146,7 +155,7 @@ typedef struct { /** * Individual Channel Stream */ -typedef struct { +typedef struct IndividualChannelStream { uint8_t max_sfb; ///< number of scalefactor bands per group enum WindowSequence window_sequence[2]; uint8_t use_kb_window[2]; ///< If set, use Kaiser-Bessel window, otherwise use a sinus window. @@ -167,7 +176,7 @@ typedef struct { /** * Temporal Noise Shaping */ -typedef struct { +typedef struct TemporalNoiseShaping { int present; int n_filt[8]; int length[8][4]; @@ -179,7 +188,7 @@ typedef struct { /** * Dynamic Range Control - decoded from the bitstream but not processed further. */ -typedef struct { +typedef struct DynamicRangeControl { int pce_instance_tag; ///< Indicates with which program the DRC info is associated. int dyn_rng_sgn[17]; ///< DRC sign information; 0 - positive, 1 - negative int dyn_rng_ctl[17]; ///< DRC magnitude information @@ -192,7 +201,7 @@ typedef struct { */ } DynamicRangeControl; -typedef struct { +typedef struct Pulse { int num_pulse; int start; int pos[4]; @@ -202,7 +211,7 @@ typedef struct { /** * coupling parameters */ -typedef struct { +typedef struct ChannelCoupling { enum CouplingPoint coupling_point; ///< The point during decoding at which coupling is applied. int num_coupled; ///< number of target elements enum RawDataBlockType type[8]; ///< Type of channel element to be coupled - SCE or CPE. @@ -216,7 +225,7 @@ typedef struct { /** * Single Channel Element - used for both SCE and LFE elements. */ -typedef struct { +typedef struct SingleChannelElement { IndividualChannelStream ics; TemporalNoiseShaping tns; Pulse pulse; @@ -227,15 +236,16 @@ typedef struct { uint8_t zeroes[128]; ///< band is not coded (used by encoder) DECLARE_ALIGNED(32, float, coeffs)[1024]; ///< coefficients for IMDCT DECLARE_ALIGNED(32, float, saved)[1024]; ///< overlap - DECLARE_ALIGNED(32, float, ret)[2048]; ///< PCM output + DECLARE_ALIGNED(32, float, ret_buf)[2048]; ///< PCM output buffer DECLARE_ALIGNED(16, float, ltp_state)[3072]; ///< time signal for LTP PredictorState predictor_state[MAX_PREDICTORS]; + float *ret; ///< PCM output } SingleChannelElement; /** * channel element - generic struct for SCE/CPE/CCE/LFE */ -typedef struct { +typedef struct ChannelElement { // CPE specific int common_window; ///< Set if channels share a common 'IndividualChannelStream' in bitstream. int ms_mode; ///< Signals mid/side stereo flags coding mode (used by encoder) @@ -250,12 +260,10 @@ typedef struct { /** * main AAC context */ -typedef struct { +typedef struct AACContext { AVCodecContext *avctx; AVFrame frame; - MPEG4AudioConfig m4ac; - int is_saved; ///< Set if elements have stored overlap from previous frame. DynamicRangeControl che_drc; @@ -263,8 +271,6 @@ typedef struct { * @name Channel element related data * @{ */ - uint8_t layout_map[MAX_ELEM_ID*4][3]; - int layout_map_tags; ChannelElement *che[4][MAX_ELEM_ID]; ChannelElement *tag_che_map[4][MAX_ELEM_ID]; int tags_mapped; @@ -287,19 +293,20 @@ typedef struct { FFTContext mdct_ltp; DSPContext dsp; FmtConvertContext fmt_conv; + AVFloatDSPContext fdsp; int random_state; /** @} */ /** - * @name Members used for output interleaving + * @name Members used for output * @{ */ - float *output_data[MAX_CHANNELS]; ///< Points to each element's 'ret' buffer (PCM output). + SingleChannelElement *output_element[MAX_CHANNELS]; ///< Points to each SingleChannelElement /** @} */ DECLARE_ALIGNED(32, float, temp)[128]; - enum OCStatus output_configured; + OutputConfiguration oc[2]; } AACContext; #endif /* AVCODEC_AAC_H */