[FFmpeg-devel] [PATCH 4/8] avcodec/aacdec: Rename AACContext to AACDecContext

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Mon Feb 26 03:26:52 EET 2024


It is decoder-only; furthermore, there is already
an AACContext in use by libfdk-aacenc.
Also make aacdec.h provide the typedef for AACContext;
up until now, this has been done by sbr.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavcodec/aacdec.c           |  10 ++--
 libavcodec/aacdec.h           |  15 +++--
 libavcodec/aacdec_fixed.c     |   6 +-
 libavcodec/aacdec_template.c  | 105 +++++++++++++++++-----------------
 libavcodec/aacsbr.h           |   6 +-
 libavcodec/aacsbr_template.c  |  34 +++++------
 libavcodec/mips/aacdec_mips.c |   8 +--
 libavcodec/mips/aacsbr_mips.c |   2 +-
 libavcodec/sbr.h              |   4 +-
 9 files changed, 96 insertions(+), 94 deletions(-)

diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index 962b1705c6..b1bce7542b 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -210,7 +210,7 @@ static av_always_inline void predict(PredictorState *ps, float *coef,
  *
  * @param   index   index into coupling gain array
  */
-static void apply_dependent_coupling(AACContext *ac,
+static void apply_dependent_coupling(AACDecContext *ac,
                                      SingleChannelElement *target,
                                      ChannelElement *cce, int index)
 {
@@ -246,7 +246,7 @@ static void apply_dependent_coupling(AACContext *ac,
  *
  * @param   index   index into coupling gain array
  */
-static void apply_independent_coupling(AACContext *ac,
+static void apply_independent_coupling(AACDecContext *ac,
                                        SingleChannelElement *target,
                                        ChannelElement *cce, int index)
 {
@@ -263,7 +263,7 @@ static void apply_independent_coupling(AACContext *ac,
 #define LOAS_SYNC_WORD   0x2b7       ///< 11 bits LOAS sync word
 
 struct LATMContext {
-    AACContext aac_ctx;     ///< containing AACContext
+    AACDecContext aac_ctx;  ///< containing AACContext
     int initialized;        ///< initialized after a valid extradata was seen
 
     // parser data
@@ -282,7 +282,7 @@ static inline uint32_t latm_get_value(GetBitContext *b)
 static int latm_decode_audio_specific_config(struct LATMContext *latmctx,
                                              GetBitContext *gb, int asclen)
 {
-    AACContext *ac        = &latmctx->aac_ctx;
+    AACDecContext *ac     = &latmctx->aac_ctx;
     AVCodecContext *avctx = ac->avctx;
     MPEG4AudioConfig m4ac = { 0 };
     GetBitContext gbc;
@@ -556,7 +556,7 @@ const FFCodec ff_aac_decoder = {
     CODEC_LONG_NAME("AAC (Advanced Audio Coding)"),
     .p.type          = AVMEDIA_TYPE_AUDIO,
     .p.id            = AV_CODEC_ID_AAC,
-    .priv_data_size  = sizeof(AACContext),
+    .priv_data_size  = sizeof(AACDecContext),
     .init            = aac_decode_init,
     .close           = aac_decode_close,
     FF_CODEC_DECODE_CB(aac_decode_frame),
diff --git a/libavcodec/aacdec.h b/libavcodec/aacdec.h
index c4ac63e2fb..37a318659e 100644
--- a/libavcodec/aacdec.h
+++ b/libavcodec/aacdec.h
@@ -81,7 +81,7 @@ typedef struct DynamicRangeControl {
 /**
  * main AAC decoding context
  */
-struct AACContext {
+typedef struct AACDecContext {
     const struct AVClass  *class;
     struct AVCodecContext *avctx;
     struct AVFrame *frame;
@@ -162,18 +162,17 @@ struct AACContext {
     int warned_he_aac_mono;
 
     /* aacdec functions pointers */
-    void (*imdct_and_windowing)(AACContext *ac, SingleChannelElement *sce);
-    void (*apply_ltp)(AACContext *ac, SingleChannelElement *sce);
+    void (*imdct_and_windowing)(struct AACDecContext *ac, SingleChannelElement *sce);
+    void (*apply_ltp)(struct AACDecContext *ac, SingleChannelElement *sce);
     void (*apply_tns)(INTFLOAT coef[1024], TemporalNoiseShaping *tns,
                       IndividualChannelStream *ics, int decode);
-    void (*windowing_and_mdct_ltp)(AACContext *ac, INTFLOAT *out,
+    void (*windowing_and_mdct_ltp)(struct AACDecContext *ac, INTFLOAT *out,
                                    INTFLOAT *in, IndividualChannelStream *ics);
-    void (*update_ltp)(AACContext *ac, SingleChannelElement *sce);
+    void (*update_ltp)(struct AACDecContext *ac, SingleChannelElement *sce);
     void (*vector_pow43)(int *coefs, int len);
     void (*subband_scale)(int *dst, int *src, int scale, int offset, int len, void *log_context);
+} AACDecContext;
 
-};
-
-void ff_aacdec_init_mips(AACContext *c);
+void ff_aacdec_init_mips(AACDecContext *c);
 
 #endif /* AVCODEC_AACDEC_H */
diff --git a/libavcodec/aacdec_fixed.c b/libavcodec/aacdec_fixed.c
index 19662cb7e6..57d3fc8bab 100644
--- a/libavcodec/aacdec_fixed.c
+++ b/libavcodec/aacdec_fixed.c
@@ -355,7 +355,7 @@ static const int cce_scale_fixed[8] = {
  *
  * @param   index   index into coupling gain array
  */
-static void apply_dependent_coupling_fixed(AACContext *ac,
+static void apply_dependent_coupling_fixed(AACDecContext *ac,
                                      SingleChannelElement *target,
                                      ChannelElement *cce, int index)
 {
@@ -419,7 +419,7 @@ static void apply_dependent_coupling_fixed(AACContext *ac,
  *
  * @param   index   index into coupling gain array
  */
-static void apply_independent_coupling_fixed(AACContext *ac,
+static void apply_independent_coupling_fixed(AACDecContext *ac,
                                        SingleChannelElement *target,
                                        ChannelElement *cce, int index)
 {
@@ -457,7 +457,7 @@ const FFCodec ff_aac_fixed_decoder = {
     CODEC_LONG_NAME("AAC (Advanced Audio Coding)"),
     .p.type          = AVMEDIA_TYPE_AUDIO,
     .p.id            = AV_CODEC_ID_AAC,
-    .priv_data_size  = sizeof(AACContext),
+    .priv_data_size  = sizeof(AACDecContext),
     .init            = aac_decode_init,
     .close           = aac_decode_close,
     FF_CODEC_DECODE_CB(aac_decode_frame),
diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
index cfaa25873f..72c6e206a6 100644
--- a/libavcodec/aacdec_template.c
+++ b/libavcodec/aacdec_template.c
@@ -94,7 +94,7 @@
 #include "decode.h"
 #include "internal.h"
 
-static int output_configure(AACContext *ac,
+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);
 
@@ -124,7 +124,7 @@ static int count_channels(uint8_t (*layout)[3], int tags)
  *
  * @return  Returns error status. 0 - OK, !0 - error
  */
-static av_cold int che_configure(AACContext *ac,
+static av_cold int che_configure(AACDecContext *ac,
                                  enum ChannelPosition che_pos,
                                  int type, int id, int *channels)
 {
@@ -160,7 +160,7 @@ static av_cold int che_configure(AACContext *ac,
 
 static int frame_configure_elements(AVCodecContext *avctx)
 {
-    AACContext *ac = avctx->priv_data;
+    AACDecContext *ac = avctx->priv_data;
     int type, id, ch, ret;
 
     /* set channel pointers to internal buffers by default */
@@ -411,7 +411,8 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags)
 /**
  * Save current output configuration if and only if it has been locked.
  */
-static int push_output_configuration(AACContext *ac) {
+static int push_output_configuration(AACDecContext *ac)
+{
     int pushed = 0;
 
     if (ac->oc[1].status == OC_LOCKED || ac->oc[0].status == OC_NONE) {
@@ -426,7 +427,8 @@ static int push_output_configuration(AACContext *ac) {
  * Restore the previous output configuration if and only if the current
  * configuration is unlocked.
  */
-static void pop_output_configuration(AACContext *ac) {
+static void pop_output_configuration(AACDecContext *ac)
+{
     if (ac->oc[1].status != OC_LOCKED && ac->oc[0].status != OC_NONE) {
         ac->oc[1] = ac->oc[0];
         ac->avctx->ch_layout = ac->oc[1].ch_layout;
@@ -441,7 +443,7 @@ static void pop_output_configuration(AACContext *ac) {
  *
  * @return  Returns error status. 0 - OK, !0 - error
  */
-static int output_configure(AACContext *ac,
+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)
 {
@@ -516,7 +518,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 
 static void flush(AVCodecContext *avctx)
 {
-    AACContext *ac= avctx->priv_data;
+    AACDecContext *ac= avctx->priv_data;
     int type, i, j;
 
     for (type = 3; type >= 0; type--) {
@@ -537,7 +539,7 @@ static void flush(AVCodecContext *avctx)
  *
  * @return  Returns error status. 0 - OK, !0 - error
  */
-static int set_default_channel_config(AACContext *ac, AVCodecContext *avctx,
+static int set_default_channel_config(AACDecContext *ac, AVCodecContext *avctx,
                                       uint8_t (*layout_map)[3],
                                       int *tags,
                                       int channel_config)
@@ -577,7 +579,7 @@ static int set_default_channel_config(AACContext *ac, AVCodecContext *avctx,
     return 0;
 }
 
-static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
+static ChannelElement *get_che(AACDecContext *ac, int type, int elem_id)
 {
     /* For PCE based channel configurations map the channels solely based
      * on tags. */
@@ -830,12 +832,12 @@ static int decode_pce(AVCodecContext *avctx, MPEG4AudioConfig *m4ac,
 /**
  * Decode GA "General Audio" specific configuration; reference: table 4.1.
  *
- * @param   ac          pointer to AACContext, may be null
+ * @param   ac          pointer to AACDecContext, may be null
  * @param   avctx       pointer to AVCCodecContext, used for logging
  *
  * @return  Returns error status. 0 - OK, !0 - error
  */
-static int decode_ga_specific_config(AACContext *ac, AVCodecContext *avctx,
+static int decode_ga_specific_config(AACDecContext *ac, AVCodecContext *avctx,
                                      GetBitContext *gb,
                                      int get_bit_alignment,
                                      MPEG4AudioConfig *m4ac,
@@ -916,7 +918,7 @@ static int decode_ga_specific_config(AACContext *ac, AVCodecContext *avctx,
     return 0;
 }
 
-static int decode_eld_specific_config(AACContext *ac, AVCodecContext *avctx,
+static int decode_eld_specific_config(AACDecContext *ac, AVCodecContext *avctx,
                                      GetBitContext *gb,
                                      MPEG4AudioConfig *m4ac,
                                      int channel_config)
@@ -976,7 +978,7 @@ static int decode_eld_specific_config(AACContext *ac, AVCodecContext *avctx,
 /**
  * Decode audio specific configuration; reference: table 1.13.
  *
- * @param   ac          pointer to AACContext, may be null
+ * @param   ac          pointer to AACDecContext, may be null
  * @param   avctx       pointer to AVCCodecContext, used for logging
  * @param   m4ac        pointer to MPEG4AudioConfig, used for parsing
  * @param   gb          buffer holding an audio specific config
@@ -985,7 +987,7 @@ static int decode_eld_specific_config(AACContext *ac, AVCodecContext *avctx,
  *
  * @return  Returns error status or number of consumed bits. <0 - error
  */
-static int decode_audio_specific_config_gb(AACContext *ac,
+static int decode_audio_specific_config_gb(AACDecContext *ac,
                                            AVCodecContext *avctx,
                                            MPEG4AudioConfig *m4ac,
                                            GetBitContext *gb,
@@ -1052,7 +1054,7 @@ static int decode_audio_specific_config_gb(AACContext *ac,
     return get_bits_count(gb);
 }
 
-static int decode_audio_specific_config(AACContext *ac,
+static int decode_audio_specific_config(AACDecContext *ac,
                                         AVCodecContext *avctx,
                                         MPEG4AudioConfig *m4ac,
                                         const uint8_t *data, int64_t bit_size,
@@ -1121,7 +1123,7 @@ static void reset_predictor_group(PredictorState *ps, int group_num)
         reset_predict_state(&ps[i]);
 }
 
-static void aacdec_init(AACContext *ac);
+static void aacdec_init(AACDecContext *ac);
 
 static av_cold void aac_static_table_init(void)
 {
@@ -1152,7 +1154,7 @@ static AVOnce aac_table_init = AV_ONCE_INIT;
 static av_cold int aac_decode_init(AVCodecContext *avctx)
 {
     float scale;
-    AACContext *ac = avctx->priv_data;
+    AACDecContext *ac = avctx->priv_data;
     int ret;
 
     if (avctx->sample_rate > 96000)
@@ -1250,7 +1252,7 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
 /**
  * Skip data_stream_element; reference: table 4.10.
  */
-static int skip_data_stream_element(AACContext *ac, GetBitContext *gb)
+static int skip_data_stream_element(AACDecContext *ac, GetBitContext *gb)
 {
     int byte_align = get_bits1(gb);
     int count = get_bits(gb, 8);
@@ -1267,7 +1269,7 @@ static int skip_data_stream_element(AACContext *ac, GetBitContext *gb)
     return 0;
 }
 
-static int decode_prediction(AACContext *ac, IndividualChannelStream *ics,
+static int decode_prediction(AACDecContext *ac, IndividualChannelStream *ics,
                              GetBitContext *gb)
 {
     int sfb;
@@ -1303,7 +1305,7 @@ static void decode_ltp(LongTermPrediction *ltp,
 /**
  * Decode Individual Channel Stream info; reference: table 4.6.
  */
-static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics,
+static int decode_ics_info(AACDecContext *ac, IndividualChannelStream *ics,
                            GetBitContext *gb)
 {
     const MPEG4AudioConfig *const m4ac = &ac->oc[1].m4ac;
@@ -1429,7 +1431,7 @@ fail:
  *
  * @return  Returns error status. 0 - OK, !0 - error
  */
-static int decode_band_types(AACContext *ac, enum BandType band_type[120],
+static int decode_band_types(AACDecContext *ac, enum BandType band_type[120],
                              int band_type_run_end[120], GetBitContext *gb,
                              IndividualChannelStream *ics)
 {
@@ -1478,7 +1480,7 @@ static int decode_band_types(AACContext *ac, enum BandType band_type[120],
  *
  * @return  Returns error status. 0 - OK, !0 - error
  */
-static int decode_scalefactors(AACContext *ac, INTFLOAT sf[120], GetBitContext *gb,
+static int decode_scalefactors(AACDecContext *ac, INTFLOAT sf[120], GetBitContext *gb,
                                unsigned int global_gain,
                                IndividualChannelStream *ics,
                                enum BandType band_type[120],
@@ -1580,7 +1582,7 @@ static int decode_pulses(Pulse *pulse, GetBitContext *gb,
  *
  * @return  Returns error status. 0 - OK, !0 - error
  */
-static int decode_tns(AACContext *ac, TemporalNoiseShaping *tns,
+static int decode_tns(AACDecContext *ac, TemporalNoiseShaping *tns,
                       GetBitContext *gb, const IndividualChannelStream *ics)
 {
     int w, filt, i, coef_len, coef_res, coef_compress;
@@ -1648,7 +1650,7 @@ static void decode_mid_side_stereo(ChannelElement *cpe, GetBitContext *gb,
  *
  * @return  Returns error status. 0 - OK, !0 - error
  */
-static int decode_spectrum_and_dequant(AACContext *ac, INTFLOAT coef[1024],
+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,
@@ -1943,7 +1945,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, INTFLOAT coef[1024],
 /**
  * Apply AAC-Main style frequency domain prediction.
  */
-static void apply_prediction(AACContext *ac, SingleChannelElement *sce)
+static void apply_prediction(AACDecContext *ac, SingleChannelElement *sce)
 {
     int sfb, k;
 
@@ -2006,7 +2008,7 @@ static void decode_gain_control(SingleChannelElement * sce, GetBitContext * gb)
  *
  * @return  Returns error status. 0 - OK, !0 - error
  */
-static int decode_ics(AACContext *ac, SingleChannelElement *sce,
+static int decode_ics(AACDecContext *ac, SingleChannelElement *sce,
                       GetBitContext *gb, int common_window, int scale_flag)
 {
     Pulse pulse;
@@ -2097,7 +2099,7 @@ fail:
 /**
  * Mid/Side stereo decoding; reference: 4.6.8.1.3.
  */
-static void apply_mid_side_stereo(AACContext *ac, ChannelElement *cpe)
+static void apply_mid_side_stereo(AACDecContext *ac, ChannelElement *cpe)
 {
     const IndividualChannelStream *ics = &cpe->ch[0].ics;
     INTFLOAT *ch0 = cpe->ch[0].coeffs;
@@ -2135,7 +2137,7 @@ static void apply_mid_side_stereo(AACContext *ac, ChannelElement *cpe)
  *                      [1] mask is decoded from bitstream; [2] mask is all 1s;
  *                      [3] reserved for scalable AAC
  */
-static void apply_intensity_stereo(AACContext *ac,
+static void apply_intensity_stereo(AACDecContext *ac,
                                    ChannelElement *cpe, int ms_present)
 {
     const IndividualChannelStream *ics = &cpe->ch[1].ics;
@@ -2185,7 +2187,7 @@ static void apply_intensity_stereo(AACContext *ac,
  *
  * @return  Returns error status. 0 - OK, !0 - error
  */
-static int decode_cpe(AACContext *ac, GetBitContext *gb, ChannelElement *cpe)
+static int decode_cpe(AACDecContext *ac, GetBitContext *gb, ChannelElement *cpe)
 {
     int i, ret, common_window, ms_present = 0;
     int eld_syntax = ac->oc[1].m4ac.object_type == AOT_ER_AAC_ELD;
@@ -2238,7 +2240,7 @@ static const float cce_scale[] = {
  *
  * @return  Returns error status. 0 - OK, !0 - error
  */
-static int decode_cce(AACContext *ac, GetBitContext *gb, ChannelElement *che)
+static int decode_cce(AACDecContext *ac, GetBitContext *gb, ChannelElement *che)
 {
     int num_gain = 0;
     int c, g, sfb, ret;
@@ -2388,7 +2390,7 @@ static int decode_dynamic_range(DynamicRangeControl *che_drc,
     return n;
 }
 
-static int decode_fill(AACContext *ac, GetBitContext *gb, int len) {
+static int decode_fill(AACDecContext *ac, GetBitContext *gb, int len) {
     uint8_t buf[256];
     int i, major, minor;
 
@@ -2421,7 +2423,7 @@ unknown:
  *
  * @return Returns number of bytes consumed
  */
-static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt,
+static int decode_extension_payload(AACDecContext *ac, GetBitContext *gb, int cnt,
                                     ChannelElement *che, enum RawDataBlockType elem_type)
 {
     int crc_flag = 0;
@@ -2551,7 +2553,7 @@ static void apply_tns(INTFLOAT coef_param[1024], TemporalNoiseShaping *tns,
  *  Apply windowing and MDCT to obtain the spectral
  *  coefficient from the predicted sample by LTP.
  */
-static void windowing_and_mdct_ltp(AACContext *ac, INTFLOAT *out,
+static void windowing_and_mdct_ltp(AACDecContext *ac, INTFLOAT *out,
                                    INTFLOAT *in, IndividualChannelStream *ics)
 {
     const INTFLOAT *lwindow      = ics->use_kb_window[0] ? AAC_RENAME2(aac_kbd_long_1024) : AAC_RENAME2(sine_1024);
@@ -2577,7 +2579,7 @@ static void windowing_and_mdct_ltp(AACContext *ac, INTFLOAT *out,
 /**
  * Apply the long term prediction
  */
-static void apply_ltp(AACContext *ac, SingleChannelElement *sce)
+static void apply_ltp(AACDecContext *ac, SingleChannelElement *sce)
 {
     const LongTermPrediction *ltp = &sce->ics.ltp;
     const uint16_t *offsets = sce->ics.swb_offset;
@@ -2609,7 +2611,7 @@ static void apply_ltp(AACContext *ac, SingleChannelElement *sce)
 /**
  * Update the LTP buffer for next frame
  */
-static void update_ltp(AACContext *ac, SingleChannelElement *sce)
+static void update_ltp(AACDecContext *ac, SingleChannelElement *sce)
 {
     IndividualChannelStream *ics = &sce->ics;
     INTFLOAT *saved     = sce->saved;
@@ -2647,7 +2649,7 @@ static void update_ltp(AACContext *ac, SingleChannelElement *sce)
 /**
  * Conduct IMDCT and windowing.
  */
-static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce)
+static void imdct_and_windowing(AACDecContext *ac, SingleChannelElement *sce)
 {
     IndividualChannelStream *ics = &sce->ics;
     INTFLOAT *in    = sce->coeffs;
@@ -2711,7 +2713,7 @@ static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce)
 /**
  * Conduct IMDCT and windowing.
  */
-static void imdct_and_windowing_960(AACContext *ac, SingleChannelElement *sce)
+static void imdct_and_windowing_960(AACDecContext *ac, SingleChannelElement *sce)
 {
     IndividualChannelStream *ics = &sce->ics;
     INTFLOAT *in    = sce->coeffs;
@@ -2772,7 +2774,7 @@ static void imdct_and_windowing_960(AACContext *ac, SingleChannelElement *sce)
         memcpy(                      saved,       buf + 480,        480 * sizeof(*saved));
     }
 }
-static void imdct_and_windowing_ld(AACContext *ac, SingleChannelElement *sce)
+static void imdct_and_windowing_ld(AACDecContext *ac, SingleChannelElement *sce)
 {
     IndividualChannelStream *ics = &sce->ics;
     INTFLOAT *in    = sce->coeffs;
@@ -2797,7 +2799,7 @@ static void imdct_and_windowing_ld(AACContext *ac, SingleChannelElement *sce)
     memcpy(saved, buf + 256, 256 * sizeof(*saved));
 }
 
-static void imdct_and_windowing_eld(AACContext *ac, SingleChannelElement *sce)
+static void imdct_and_windowing_eld(AACDecContext *ac, SingleChannelElement *sce)
 {
     UINTFLOAT *in   = sce->coeffs;
     INTFLOAT *out   = sce->ret;
@@ -2865,10 +2867,10 @@ static void imdct_and_windowing_eld(AACContext *ac, SingleChannelElement *sce)
  *
  * @param   apply_coupling_method   pointer to (in)dependent coupling function
  */
-static void apply_channel_coupling(AACContext *ac, ChannelElement *cc,
+static void apply_channel_coupling(AACDecContext *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))
+                                   void (*apply_coupling_method)(AACDecContext *ac, SingleChannelElement *target, ChannelElement *cce, int index))
 {
     int i, c;
 
@@ -2898,10 +2900,10 @@ static void apply_channel_coupling(AACContext *ac, ChannelElement *cc,
 /**
  * Convert spectral data to samples, applying all supported tools as appropriate.
  */
-static void spectral_to_sample(AACContext *ac, int samples)
+static void spectral_to_sample(AACDecContext *ac, int samples)
 {
     int i, type;
-    void (*imdct_and_window)(AACContext *ac, SingleChannelElement *sce);
+    void (*imdct_and_window)(AACDecContext *ac, SingleChannelElement *sce);
     switch (ac->oc[1].m4ac.object_type) {
     case AOT_ER_AAC_LD:
         imdct_and_window = imdct_and_windowing_ld;
@@ -2970,7 +2972,7 @@ static void spectral_to_sample(AACContext *ac, int samples)
     }
 }
 
-static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb)
+static int parse_adts_frame_header(AACDecContext *ac, GetBitContext *gb)
 {
     int size;
     AACADTSHeaderInfo hdr_info;
@@ -3035,7 +3037,7 @@ static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb)
 static int aac_decode_er_frame(AVCodecContext *avctx, AVFrame *frame,
                                int *got_frame_ptr, GetBitContext *gb)
 {
-    AACContext *ac = avctx->priv_data;
+    AACDecContext *ac = avctx->priv_data;
     const MPEG4AudioConfig *const m4ac = &ac->oc[1].m4ac;
     ChannelElement *che;
     int err, i;
@@ -3108,7 +3110,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, AVFrame *frame,
                                 int *got_frame_ptr, GetBitContext *gb,
                                 const AVPacket *avpkt)
 {
-    AACContext *ac = avctx->priv_data;
+    AACDecContext *ac = avctx->priv_data;
     ChannelElement *che = NULL, *che_prev = NULL;
     enum RawDataBlockType elem_type, che_prev_type = TYPE_END;
     int err, elem_id;
@@ -3317,7 +3319,7 @@ fail:
 static int aac_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                             int *got_frame_ptr, AVPacket *avpkt)
 {
-    AACContext *ac = avctx->priv_data;
+    AACDecContext *ac = avctx->priv_data;
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     GetBitContext gb;
@@ -3379,7 +3381,7 @@ static int aac_decode_frame(AVCodecContext *avctx, AVFrame *frame,
 
 static av_cold int aac_decode_close(AVCodecContext *avctx)
 {
-    AACContext *ac = avctx->priv_data;
+    AACDecContext *ac = avctx->priv_data;
     int i, type;
 
     for (i = 0; i < MAX_ELEM_ID; i++) {
@@ -3402,7 +3404,7 @@ static av_cold int aac_decode_close(AVCodecContext *avctx)
     return 0;
 }
 
-static void aacdec_init(AACContext *c)
+static void aacdec_init(AACDecContext *c)
 {
     c->imdct_and_windowing                      = imdct_and_windowing;
     c->apply_ltp                                = apply_ltp;
@@ -3424,9 +3426,10 @@ static void aacdec_init(AACContext *c)
  * AVOptions for Japanese DTV specific extensions (ADTS only)
  */
 #define AACDEC_FLAGS AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM
+#define OFF(field) offsetof(AACDecContext, field)
 static const AVOption options[] = {
     {"dual_mono_mode", "Select the channel to decode for dual mono",
-     offsetof(AACContext, force_dmono_mode), AV_OPT_TYPE_INT, {.i64=-1}, -1, 2,
+     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"},
@@ -3435,7 +3438,7 @@ static const AVOption options[] = {
     {"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",
-        offsetof(AACContext, output_channel_order), AV_OPT_TYPE_INT,
+        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" },
diff --git a/libavcodec/aacsbr.h b/libavcodec/aacsbr.h
index 3a19fe1c7e..ad4935d734 100644
--- a/libavcodec/aacsbr.h
+++ b/libavcodec/aacsbr.h
@@ -69,14 +69,14 @@ enum {
 /** Initialize SBR. */
 void AAC_RENAME(ff_aac_sbr_init)(void);
 /** Initialize one SBR context. */
-int AAC_RENAME(ff_aac_sbr_ctx_init)(AACContext *ac, SpectralBandReplication *sbr, int id_aac);
+int AAC_RENAME(ff_aac_sbr_ctx_init)(struct AACDecContext *ac, SpectralBandReplication *sbr, int id_aac);
 /** Close one SBR context. */
 void AAC_RENAME(ff_aac_sbr_ctx_close)(SpectralBandReplication *sbr);
 /** Decode one SBR element. */
-int AAC_RENAME(ff_decode_sbr_extension)(AACContext *ac, SpectralBandReplication *sbr,
+int AAC_RENAME(ff_decode_sbr_extension)(struct AACDecContext *ac, SpectralBandReplication *sbr,
                             GetBitContext *gb, int crc, int cnt, int id_aac);
 /** Apply one SBR element to one AAC element. */
-void AAC_RENAME(ff_sbr_apply)(AACContext *ac, SpectralBandReplication *sbr, int id_aac,
+void AAC_RENAME(ff_sbr_apply)(struct AACDecContext *ac, SpectralBandReplication *sbr, int id_aac,
                   INTFLOAT* L, INTFLOAT *R);
 
 void ff_aacsbr_func_ptr_init_mips(AACSBRContext *c);
diff --git a/libavcodec/aacsbr_template.c b/libavcodec/aacsbr_template.c
index e0725b6363..ce3834e2dc 100644
--- a/libavcodec/aacsbr_template.c
+++ b/libavcodec/aacsbr_template.c
@@ -64,7 +64,7 @@ static void sbr_turnoff(SpectralBandReplication *sbr) {
     memset(&sbr->spectrum_params, -1, sizeof(SpectrumParameters));
 }
 
-av_cold int AAC_RENAME(ff_aac_sbr_ctx_init)(AACContext *ac, SpectralBandReplication *sbr, int id_aac)
+av_cold int AAC_RENAME(ff_aac_sbr_ctx_init)(AACDecContext *ac, SpectralBandReplication *sbr, int id_aac)
 {
     int ret;
     float scale;
@@ -254,7 +254,7 @@ static int check_n_master(AVCodecContext *avctx, int n_master, int bs_xover_band
 }
 
 /// Master Frequency Band Table (14496-3 sp04 p194)
-static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr,
+static int sbr_make_f_master(AACDecContext *ac, SpectralBandReplication *sbr,
                              SpectrumParameters *spectrum)
 {
     unsigned int temp, max_qmf_subbands = 0;
@@ -474,7 +474,7 @@ static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr,
 }
 
 /// High Frequency Generation - Patch Construction (14496-3 sp04 p216 fig. 4.46)
-static int sbr_hf_calc_npatches(AACContext *ac, SpectralBandReplication *sbr)
+static int sbr_hf_calc_npatches(AACDecContext *ac, SpectralBandReplication *sbr)
 {
     int i, k, last_k = -1, last_msb = -1, sb = 0;
     int msb = sbr->k[0];
@@ -532,7 +532,7 @@ static int sbr_hf_calc_npatches(AACContext *ac, SpectralBandReplication *sbr)
 }
 
 /// Derived Frequency Band Tables (14496-3 sp04 p197)
-static int sbr_make_f_derived(AACContext *ac, SpectralBandReplication *sbr)
+static int sbr_make_f_derived(AACDecContext *ac, SpectralBandReplication *sbr)
 {
     int k, temp;
 #if USE_FIXED
@@ -617,7 +617,7 @@ static const int8_t ceil_log2[] = {
     0, 1, 2, 2, 3, 3,
 };
 
-static int read_sbr_grid(AACContext *ac, SpectralBandReplication *sbr,
+static int read_sbr_grid(AACDecContext *ac, SpectralBandReplication *sbr,
                          GetBitContext *gb, SBRData *ch_data)
 {
     int i;
@@ -800,7 +800,7 @@ static void read_sbr_invf(SpectralBandReplication *sbr, GetBitContext *gb,
         ch_data->bs_invf_mode[0][i] = get_bits(gb, 2);
 }
 
-static int read_sbr_envelope(AACContext *ac, SpectralBandReplication *sbr, GetBitContext *gb,
+static int read_sbr_envelope(AACDecContext *ac, SpectralBandReplication *sbr, GetBitContext *gb,
                               SBRData *ch_data, int ch)
 {
     int bits;
@@ -880,7 +880,7 @@ static int read_sbr_envelope(AACContext *ac, SpectralBandReplication *sbr, GetBi
     return 0;
 }
 
-static int read_sbr_noise(AACContext *ac, SpectralBandReplication *sbr, GetBitContext *gb,
+static int read_sbr_noise(AACDecContext *ac, SpectralBandReplication *sbr, GetBitContext *gb,
                            SBRData *ch_data, int ch)
 {
     int i, j;
@@ -922,7 +922,7 @@ static int read_sbr_noise(AACContext *ac, SpectralBandReplication *sbr, GetBitCo
     return 0;
 }
 
-static void read_sbr_extension(AACContext *ac, SpectralBandReplication *sbr,
+static void read_sbr_extension(AACDecContext *ac, SpectralBandReplication *sbr,
                                GetBitContext *gb,
                                int bs_extension_id, int *num_bits_left)
 {
@@ -949,7 +949,7 @@ static void read_sbr_extension(AACContext *ac, SpectralBandReplication *sbr,
     }
 }
 
-static int read_sbr_single_channel_element(AACContext *ac,
+static int read_sbr_single_channel_element(AACDecContext *ac,
                                             SpectralBandReplication *sbr,
                                             GetBitContext *gb)
 {
@@ -973,7 +973,7 @@ static int read_sbr_single_channel_element(AACContext *ac,
     return 0;
 }
 
-static int read_sbr_channel_pair_element(AACContext *ac,
+static int read_sbr_channel_pair_element(AACDecContext *ac,
                                           SpectralBandReplication *sbr,
                                           GetBitContext *gb)
 {
@@ -1025,7 +1025,7 @@ static int read_sbr_channel_pair_element(AACContext *ac,
     return 0;
 }
 
-static unsigned int read_sbr_data(AACContext *ac, SpectralBandReplication *sbr,
+static unsigned int read_sbr_data(AACDecContext *ac, SpectralBandReplication *sbr,
                                   GetBitContext *gb, int id_aac)
 {
     unsigned int cnt = get_bits_count(gb);
@@ -1069,7 +1069,7 @@ static unsigned int read_sbr_data(AACContext *ac, SpectralBandReplication *sbr,
     return get_bits_count(gb) - cnt;
 }
 
-static void sbr_reset(AACContext *ac, SpectralBandReplication *sbr)
+static void sbr_reset(AACDecContext *ac, SpectralBandReplication *sbr)
 {
     int err;
     err = sbr_make_f_master(ac, sbr, &sbr->spectrum_params);
@@ -1090,7 +1090,7 @@ static void sbr_reset(AACContext *ac, SpectralBandReplication *sbr)
  *
  * @return  Returns number of bytes consumed from the TYPE_FIL element.
  */
-int AAC_RENAME(ff_decode_sbr_extension)(AACContext *ac, SpectralBandReplication *sbr,
+int AAC_RENAME(ff_decode_sbr_extension)(AACDecContext *ac, SpectralBandReplication *sbr,
                             GetBitContext *gb_host, int crc, int cnt, int id_aac)
 {
     unsigned int num_sbr_bits = 0, num_align_bits;
@@ -1243,7 +1243,7 @@ static void sbr_qmf_synthesis(AVTXContext *mdct, av_tx_fn mdct_fn,
 #endif
 
 /// Generate the subband filtered lowband
-static int sbr_lf_gen(AACContext *ac, SpectralBandReplication *sbr,
+static int sbr_lf_gen(AACDecContext *ac, SpectralBandReplication *sbr,
                       INTFLOAT X_low[32][40][2], const INTFLOAT W[2][32][32][2],
                       int buf_idx)
 {
@@ -1268,7 +1268,7 @@ static int sbr_lf_gen(AACContext *ac, SpectralBandReplication *sbr,
 }
 
 /// High Frequency Generator (14496-3 sp04 p215)
-static int sbr_hf_gen(AACContext *ac, SpectralBandReplication *sbr,
+static int sbr_hf_gen(AACDecContext *ac, SpectralBandReplication *sbr,
                       INTFLOAT X_high[64][40][2], const INTFLOAT X_low[32][40][2],
                       const INTFLOAT (*alpha0)[2], const INTFLOAT (*alpha1)[2],
                       const INTFLOAT bw_array[5], const uint8_t *t_env,
@@ -1342,7 +1342,7 @@ static int sbr_x_gen(SpectralBandReplication *sbr, INTFLOAT X[2][38][64],
 /** High Frequency Adjustment (14496-3 sp04 p217) and Mapping
  * (14496-3 sp04 p217)
  */
-static int sbr_mapping(AACContext *ac, SpectralBandReplication *sbr,
+static int sbr_mapping(AACDecContext *ac, SpectralBandReplication *sbr,
                         SBRData *ch_data, int e_a[2])
 {
     int e, i, m;
@@ -1456,7 +1456,7 @@ static void sbr_env_estimate(AAC_FLOAT (*e_curr)[48], INTFLOAT X_high[64][40][2]
     }
 }
 
-void AAC_RENAME(ff_sbr_apply)(AACContext *ac, SpectralBandReplication *sbr, int id_aac,
+void AAC_RENAME(ff_sbr_apply)(AACDecContext *ac, SpectralBandReplication *sbr, int id_aac,
                   INTFLOAT* L, INTFLOAT* R)
 {
     int downsampled = ac->oc[1].m4ac.ext_sample_rate < sbr->sample_rate;
diff --git a/libavcodec/mips/aacdec_mips.c b/libavcodec/mips/aacdec_mips.c
index f4b0767e3b..456e270915 100644
--- a/libavcodec/mips/aacdec_mips.c
+++ b/libavcodec/mips/aacdec_mips.c
@@ -112,7 +112,7 @@ static av_always_inline int lcg_random(unsigned previous_val)
     return v.s;
 }
 
-static void imdct_and_windowing_mips(AACContext *ac, SingleChannelElement *sce)
+static void imdct_and_windowing_mips(AACDecContext *ac, SingleChannelElement *sce)
 {
     IndividualChannelStream *ics = &sce->ics;
     float *in    = sce->coeffs;
@@ -224,7 +224,7 @@ static void imdct_and_windowing_mips(AACContext *ac, SingleChannelElement *sce)
     }
 }
 
-static void apply_ltp_mips(AACContext *ac, SingleChannelElement *sce)
+static void apply_ltp_mips(AACDecContext *ac, SingleChannelElement *sce)
 {
     const LongTermPrediction *ltp = &sce->ics.ltp;
     const uint16_t *offsets = sce->ics.swb_offset;
@@ -334,7 +334,7 @@ static av_always_inline void fmul_and_reverse(float *dst, const float *src0, con
     }
 }
 
-static void update_ltp_mips(AACContext *ac, SingleChannelElement *sce)
+static void update_ltp_mips(AACDecContext *ac, SingleChannelElement *sce)
 {
     IndividualChannelStream *ics = &sce->ics;
     float *saved     = sce->saved;
@@ -431,7 +431,7 @@ static void update_ltp_mips(AACContext *ac, SingleChannelElement *sce)
 #endif /* HAVE_MIPSFPU */
 #endif /* HAVE_INLINE_ASM */
 
-void ff_aacdec_init_mips(AACContext *c)
+void ff_aacdec_init_mips(AACDecContext *c)
 {
 #if HAVE_INLINE_ASM
 #if HAVE_MIPSFPU
diff --git a/libavcodec/mips/aacsbr_mips.c b/libavcodec/mips/aacsbr_mips.c
index 546e528895..0dc09130b7 100644
--- a/libavcodec/mips/aacsbr_mips.c
+++ b/libavcodec/mips/aacsbr_mips.c
@@ -60,7 +60,7 @@
 
 #if HAVE_INLINE_ASM
 #if HAVE_MIPSFPU
-static int sbr_lf_gen_mips(AACContext *ac, SpectralBandReplication *sbr,
+static int sbr_lf_gen_mips(AACDecContext *ac, SpectralBandReplication *sbr,
                       float X_low[32][40][2], const float W[2][32][32][2],
                       int buf_idx)
 {
diff --git a/libavcodec/sbr.h b/libavcodec/sbr.h
index f949465ef5..46c68615c8 100644
--- a/libavcodec/sbr.h
+++ b/libavcodec/sbr.h
@@ -37,7 +37,7 @@
 #include "aacps.h"
 #include "sbrdsp.h"
 
-typedef struct AACContext AACContext;
+struct AACDecContext;
 
 /**
  * Spectral Band Replication header - spectrum parameters that invoke a reset if they differ from the previous header.
@@ -121,7 +121,7 @@ typedef struct SpectralBandReplication SpectralBandReplication;
  * aacsbr functions pointers
  */
 typedef struct AACSBRContext {
-    int (*sbr_lf_gen)(AACContext *ac, SpectralBandReplication *sbr,
+    int (*sbr_lf_gen)(struct AACDecContext *ac, SpectralBandReplication *sbr,
                       INTFLOAT X_low[32][40][2], const INTFLOAT W[2][32][32][2],
                       int buf_idx);
     void (*sbr_hf_assemble)(INTFLOAT Y1[38][64][2],
-- 
2.40.1



More information about the ffmpeg-devel mailing list