* [FFmpeg-devel] [PATCH 2/8] avocdec/aac: Move decoder-only stuff to new header aacdec.h
2024-02-26 1:20 [FFmpeg-devel] [PATCH 1/8] avcodec/aacdec_template: Don't use intermediate void* Andreas Rheinhardt
@ 2024-02-26 1:26 ` Andreas Rheinhardt
2024-02-26 1:26 ` [FFmpeg-devel] [PATCH 3/8] avcodec/aacsbr: Remove unused parameter from sbr_gain_calc Andreas Rheinhardt
` (5 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Andreas Rheinhardt @ 2024-02-26 1:26 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
AACContext is not used by the encoder at all.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/aac.h | 143 ---------------------------
libavcodec/aacdec.c | 1 +
libavcodec/aacdec.h | 179 ++++++++++++++++++++++++++++++++++
libavcodec/aacdec_fixed.c | 1 +
libavcodec/aacsbr_template.c | 2 +
libavcodec/mips/aacdec_mips.c | 2 +-
libavcodec/mips/aacdec_mips.h | 2 +-
libavcodec/mips/aacsbr_mips.c | 2 +-
libavcodec/mips/aacsbr_mips.h | 2 +-
9 files changed, 187 insertions(+), 147 deletions(-)
create mode 100644 libavcodec/aacdec.h
diff --git a/libavcodec/aac.h b/libavcodec/aac.h
index 285d3b7482..da683b0071 100644
--- a/libavcodec/aac.h
+++ b/libavcodec/aac.h
@@ -33,12 +33,7 @@
#include "aac_defines.h"
#include "libavutil/channel_layout.h"
-#include "libavutil/float_dsp.h"
-#include "libavutil/fixed_dsp.h"
#include "libavutil/mem_internal.h"
-#include "libavutil/tx.h"
-#include "avcodec.h"
-#include "mpeg4audio.h"
#include "sbr.h"
#include <stdint.h>
@@ -108,25 +103,6 @@ enum CouplingPoint {
AFTER_IMDCT = 3,
};
-/**
- * Output configuration status
- */
-enum OCStatus {
- OC_NONE, ///< Output unconfigured
- OC_TRIAL_PCE, ///< Output configuration under trial specified by an inband PCE
- OC_TRIAL_FRAME, ///< Output configuration under trial specified by a frame header
- OC_GLOBAL_HDR, ///< Output configuration set in a global header but not yet locked
- 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;
- AVChannelLayout ch_layout;
- enum OCStatus status;
-} OutputConfiguration;
-
/**
* Predictor State
*/
@@ -203,22 +179,6 @@ typedef struct TemporalNoiseShaping {
INTFLOAT coef[8][4][TNS_MAX_ORDER];
} TemporalNoiseShaping;
-/**
- * Dynamic Range Control - decoded from the bitstream but not processed further.
- */
-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
- int exclude_mask[MAX_CHANNELS]; ///< Channels to be excluded from DRC processing.
- int band_incr; ///< Number of DRC bands greater than 1 having DRC info.
- int interpolation_scheme; ///< Indicates the interpolation scheme used in the SBR QMF domain.
- int band_top[17]; ///< Indicates the top of the i-th DRC band in units of 4 spectral lines.
- int prog_ref_level; /**< A reference level for the long-term program audio level for all
- * channels combined.
- */
-} DynamicRangeControl;
-
typedef struct Pulse {
int num_pulse;
int start;
@@ -285,107 +245,4 @@ typedef struct ChannelElement {
SpectralBandReplication sbr;
} ChannelElement;
-enum AACOutputChannelOrder {
- CHANNEL_ORDER_DEFAULT,
- CHANNEL_ORDER_CODED,
-};
-
-/**
- * main AAC context
- */
-struct AACContext {
- AVClass *class;
- AVCodecContext *avctx;
- AVFrame *frame;
-
- int is_saved; ///< Set if elements have stored overlap from previous frame.
- DynamicRangeControl che_drc;
-
- /**
- * @name Channel element related data
- * @{
- */
- ChannelElement *che[4][MAX_ELEM_ID];
- ChannelElement *tag_che_map[4][MAX_ELEM_ID];
- int tags_mapped;
- int warned_remapping_once;
- /** @} */
-
- /**
- * @name temporary aligned temporary buffers
- * (We do not want to have these on the stack.)
- * @{
- */
- DECLARE_ALIGNED(32, INTFLOAT, buf_mdct)[1024];
- /** @} */
-
- /**
- * @name Computed / set up during initialization
- * @{
- */
- AVTXContext *mdct120;
- AVTXContext *mdct128;
- AVTXContext *mdct480;
- AVTXContext *mdct512;
- AVTXContext *mdct960;
- AVTXContext *mdct1024;
- AVTXContext *mdct_ltp;
-
- av_tx_fn mdct120_fn;
- av_tx_fn mdct128_fn;
- av_tx_fn mdct480_fn;
- av_tx_fn mdct512_fn;
- av_tx_fn mdct960_fn;
- av_tx_fn mdct1024_fn;
- av_tx_fn mdct_ltp_fn;
-#if USE_FIXED
- AVFixedDSPContext *fdsp;
-#else
- AVFloatDSPContext *fdsp;
-#endif /* USE_FIXED */
- int random_state;
- /** @} */
-
- /**
- * @name Members used for output
- * @{
- */
- SingleChannelElement *output_element[MAX_CHANNELS]; ///< Points to each SingleChannelElement
- /** @} */
-
-
- /**
- * @name Japanese DTV specific extension
- * @{
- */
- int force_dmono_mode;///< 0->not dmono, 1->use first channel, 2->use second channel
- int dmono_mode; ///< 0->not dmono, 1->use first channel, 2->use second channel
- /** @} */
-
- enum AACOutputChannelOrder output_channel_order;
-
- DECLARE_ALIGNED(32, INTFLOAT, temp)[128];
-
- OutputConfiguration oc[2];
- int warned_num_aac_frames;
- int warned_960_sbr;
- unsigned warned_71_wide;
- int warned_gain_control;
- int warned_he_aac_mono;
-
- /* aacdec functions pointers */
- void (*imdct_and_windowing)(AACContext *ac, SingleChannelElement *sce);
- void (*apply_ltp)(AACContext *ac, SingleChannelElement *sce);
- void (*apply_tns)(INTFLOAT coef[1024], TemporalNoiseShaping *tns,
- IndividualChannelStream *ics, int decode);
- void (*windowing_and_mdct_ltp)(AACContext *ac, INTFLOAT *out,
- INTFLOAT *in, IndividualChannelStream *ics);
- void (*update_ltp)(AACContext *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);
-
-};
-
-void ff_aacdec_init_mips(AACContext *c);
-
#endif /* AVCODEC_AAC_H */
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index d66ebf4a7c..962b1705c6 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -45,6 +45,7 @@
#include "sinewin.h"
#include "aac.h"
+#include "aacdec.h"
#include "aactab.h"
#include "aacdectab.h"
#include "adts_header.h"
diff --git a/libavcodec/aacdec.h b/libavcodec/aacdec.h
new file mode 100644
index 0000000000..c4ac63e2fb
--- /dev/null
+++ b/libavcodec/aacdec.h
@@ -0,0 +1,179 @@
+/*
+ * AAC decoder definitions and structures
+ * Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
+ * Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com )
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * AAC decoder definitions and structures
+ * @author Oded Shimon ( ods15 ods15 dyndns org )
+ * @author Maxim Gavrilov ( maxim.gavrilov gmail com )
+ */
+
+#ifndef AVCODEC_AACDEC_H
+#define AVCODEC_AACDEC_H
+
+#include "libavutil/float_dsp.h"
+#include "libavutil/fixed_dsp.h"
+#include "libavutil/mem_internal.h"
+#include "libavutil/tx.h"
+
+#include "aac.h"
+#include "mpeg4audio.h"
+
+/**
+ * Output configuration status
+ */
+enum OCStatus {
+ OC_NONE, ///< Output unconfigured
+ OC_TRIAL_PCE, ///< Output configuration under trial specified by an inband PCE
+ OC_TRIAL_FRAME, ///< Output configuration under trial specified by a frame header
+ OC_GLOBAL_HDR, ///< Output configuration set in a global header but not yet locked
+ OC_LOCKED, ///< Output configuration locked in place
+};
+
+enum AACOutputChannelOrder {
+ CHANNEL_ORDER_DEFAULT,
+ CHANNEL_ORDER_CODED,
+};
+
+typedef struct OutputConfiguration {
+ MPEG4AudioConfig m4ac;
+ uint8_t layout_map[MAX_ELEM_ID*4][3];
+ int layout_map_tags;
+ AVChannelLayout ch_layout;
+ enum OCStatus status;
+} OutputConfiguration;
+
+/**
+ * Dynamic Range Control - decoded from the bitstream but not processed further.
+ */
+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
+ int exclude_mask[MAX_CHANNELS]; ///< Channels to be excluded from DRC processing.
+ int band_incr; ///< Number of DRC bands greater than 1 having DRC info.
+ int interpolation_scheme; ///< Indicates the interpolation scheme used in the SBR QMF domain.
+ int band_top[17]; ///< Indicates the top of the i-th DRC band in units of 4 spectral lines.
+ int prog_ref_level; /**< A reference level for the long-term program audio level for all
+ * channels combined.
+ */
+} DynamicRangeControl;
+
+/**
+ * main AAC decoding context
+ */
+struct AACContext {
+ const struct AVClass *class;
+ struct AVCodecContext *avctx;
+ struct AVFrame *frame;
+
+ int is_saved; ///< Set if elements have stored overlap from previous frame.
+ DynamicRangeControl che_drc;
+
+ /**
+ * @name Channel element related data
+ * @{
+ */
+ ChannelElement *che[4][MAX_ELEM_ID];
+ ChannelElement *tag_che_map[4][MAX_ELEM_ID];
+ int tags_mapped;
+ int warned_remapping_once;
+ /** @} */
+
+ /**
+ * @name temporary aligned temporary buffers
+ * (We do not want to have these on the stack.)
+ * @{
+ */
+ DECLARE_ALIGNED(32, INTFLOAT, buf_mdct)[1024];
+ /** @} */
+
+ /**
+ * @name Computed / set up during initialization
+ * @{
+ */
+ AVTXContext *mdct120;
+ AVTXContext *mdct128;
+ AVTXContext *mdct480;
+ AVTXContext *mdct512;
+ AVTXContext *mdct960;
+ AVTXContext *mdct1024;
+ AVTXContext *mdct_ltp;
+
+ av_tx_fn mdct120_fn;
+ av_tx_fn mdct128_fn;
+ av_tx_fn mdct480_fn;
+ av_tx_fn mdct512_fn;
+ av_tx_fn mdct960_fn;
+ av_tx_fn mdct1024_fn;
+ av_tx_fn mdct_ltp_fn;
+#if USE_FIXED
+ AVFixedDSPContext *fdsp;
+#else
+ AVFloatDSPContext *fdsp;
+#endif /* USE_FIXED */
+ int random_state;
+ /** @} */
+
+ /**
+ * @name Members used for output
+ * @{
+ */
+ SingleChannelElement *output_element[MAX_CHANNELS]; ///< Points to each SingleChannelElement
+ /** @} */
+
+
+ /**
+ * @name Japanese DTV specific extension
+ * @{
+ */
+ int force_dmono_mode;///< 0->not dmono, 1->use first channel, 2->use second channel
+ int dmono_mode; ///< 0->not dmono, 1->use first channel, 2->use second channel
+ /** @} */
+
+ enum AACOutputChannelOrder output_channel_order;
+
+ DECLARE_ALIGNED(32, INTFLOAT, temp)[128];
+
+ OutputConfiguration oc[2];
+ int warned_num_aac_frames;
+ int warned_960_sbr;
+ unsigned warned_71_wide;
+ int warned_gain_control;
+ int warned_he_aac_mono;
+
+ /* aacdec functions pointers */
+ void (*imdct_and_windowing)(AACContext *ac, SingleChannelElement *sce);
+ void (*apply_ltp)(AACContext *ac, SingleChannelElement *sce);
+ void (*apply_tns)(INTFLOAT coef[1024], TemporalNoiseShaping *tns,
+ IndividualChannelStream *ics, int decode);
+ void (*windowing_and_mdct_ltp)(AACContext *ac, INTFLOAT *out,
+ INTFLOAT *in, IndividualChannelStream *ics);
+ void (*update_ltp)(AACContext *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);
+
+};
+
+void ff_aacdec_init_mips(AACContext *c);
+
+#endif /* AVCODEC_AACDEC_H */
diff --git a/libavcodec/aacdec_fixed.c b/libavcodec/aacdec_fixed.c
index 2b8ac67659..19662cb7e6 100644
--- a/libavcodec/aacdec_fixed.c
+++ b/libavcodec/aacdec_fixed.c
@@ -71,6 +71,7 @@
#include "sinewin_fixed_tablegen.h"
#include "aac.h"
+#include "aacdec.h"
#include "aactab.h"
#include "aacdectab.h"
#include "adts_header.h"
diff --git a/libavcodec/aacsbr_template.c b/libavcodec/aacsbr_template.c
index 98e9fd8fed..ba8e3495b4 100644
--- a/libavcodec/aacsbr_template.c
+++ b/libavcodec/aacsbr_template.c
@@ -32,7 +32,9 @@
* @author Zoran Basaric ( zoran.basaric@imgtec.com )
*/
+#include "aacdec.h"
#include "aacdectab.h"
+#include "avcodec.h"
#include "libavutil/qsort.h"
static av_cold void aacsbr_tableinit(void)
diff --git a/libavcodec/mips/aacdec_mips.c b/libavcodec/mips/aacdec_mips.c
index cd357cedbc..f4b0767e3b 100644
--- a/libavcodec/mips/aacdec_mips.c
+++ b/libavcodec/mips/aacdec_mips.c
@@ -53,7 +53,7 @@
*/
#include "libavutil/attributes.h"
-#include "libavcodec/aac.h"
+#include "libavcodec/aacdec.h"
#include "aacdec_mips.h"
#include "libavcodec/aactab.h"
#include "libavcodec/sinewin.h"
diff --git a/libavcodec/mips/aacdec_mips.h b/libavcodec/mips/aacdec_mips.h
index 758266fc16..71581986dc 100644
--- a/libavcodec/mips/aacdec_mips.h
+++ b/libavcodec/mips/aacdec_mips.h
@@ -57,7 +57,7 @@
#ifndef AVCODEC_MIPS_AACDEC_MIPS_H
#define AVCODEC_MIPS_AACDEC_MIPS_H
-#include "libavcodec/aac.h"
+#include "libavcodec/aacdec.h"
#include "libavutil/mips/asmdefs.h"
#if HAVE_INLINE_ASM && HAVE_MIPSFPU
diff --git a/libavcodec/mips/aacsbr_mips.c b/libavcodec/mips/aacsbr_mips.c
index 33fd9b229e..546e528895 100644
--- a/libavcodec/mips/aacsbr_mips.c
+++ b/libavcodec/mips/aacsbr_mips.c
@@ -51,7 +51,7 @@
* Reference: libavcodec/aacsbr.c
*/
-#include "libavcodec/aac.h"
+#include "libavcodec/aacdec.h"
#include "libavcodec/aacsbr.h"
#include "libavutil/mem_internal.h"
#include "libavutil/mips/asmdefs.h"
diff --git a/libavcodec/mips/aacsbr_mips.h b/libavcodec/mips/aacsbr_mips.h
index 4750c94024..447393164a 100644
--- a/libavcodec/mips/aacsbr_mips.h
+++ b/libavcodec/mips/aacsbr_mips.h
@@ -54,7 +54,7 @@
#ifndef AVCODEC_MIPS_AACSBR_MIPS_H
#define AVCODEC_MIPS_AACSBR_MIPS_H
-#include "libavcodec/aac.h"
+#include "libavcodec/aacdec.h"
#include "libavcodec/sbr.h"
#include "libavutil/mips/asmdefs.h"
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 10+ messages in thread
* [FFmpeg-devel] [PATCH 3/8] avcodec/aacsbr: Remove unused parameter from sbr_gain_calc
2024-02-26 1:20 [FFmpeg-devel] [PATCH 1/8] avcodec/aacdec_template: Don't use intermediate void* Andreas Rheinhardt
2024-02-26 1:26 ` [FFmpeg-devel] [PATCH 2/8] avocdec/aac: Move decoder-only stuff to new header aacdec.h Andreas Rheinhardt
@ 2024-02-26 1:26 ` Andreas Rheinhardt
2024-02-26 1:26 ` [FFmpeg-devel] [PATCH 4/8] avcodec/aacdec: Rename AACContext to AACDecContext Andreas Rheinhardt
` (4 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Andreas Rheinhardt @ 2024-02-26 1:26 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/aacsbr.c | 2 +-
libavcodec/aacsbr_fixed.c | 2 +-
libavcodec/aacsbr_template.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c
index da9e160a57..aafc00049a 100644
--- a/libavcodec/aacsbr.c
+++ b/libavcodec/aacsbr.c
@@ -233,7 +233,7 @@ static void sbr_chirp(SpectralBandReplication *sbr, SBRData *ch_data)
* Calculation of levels of additional HF signal components (14496-3 sp04 p219)
* and Calculation of gain (14496-3 sp04 p219)
*/
-static void sbr_gain_calc(AACContext *ac, SpectralBandReplication *sbr,
+static void sbr_gain_calc(SpectralBandReplication *sbr,
SBRData *ch_data, const int e_a[2])
{
int e, k, m;
diff --git a/libavcodec/aacsbr_fixed.c b/libavcodec/aacsbr_fixed.c
index 3dbda32447..06d07e1941 100644
--- a/libavcodec/aacsbr_fixed.c
+++ b/libavcodec/aacsbr_fixed.c
@@ -394,7 +394,7 @@ static void sbr_chirp(SpectralBandReplication *sbr, SBRData *ch_data)
* Calculation of levels of additional HF signal components (14496-3 sp04 p219)
* and Calculation of gain (14496-3 sp04 p219)
*/
-static void sbr_gain_calc(AACContext *ac, SpectralBandReplication *sbr,
+static void sbr_gain_calc(SpectralBandReplication *sbr,
SBRData *ch_data, const int e_a[2])
{
int e, k, m;
diff --git a/libavcodec/aacsbr_template.c b/libavcodec/aacsbr_template.c
index ba8e3495b4..e0725b6363 100644
--- a/libavcodec/aacsbr_template.c
+++ b/libavcodec/aacsbr_template.c
@@ -1513,7 +1513,7 @@ void AAC_RENAME(ff_sbr_apply)(AACContext *ac, SpectralBandReplication *sbr, int
err = sbr_mapping(ac, sbr, &sbr->data[ch], sbr->data[ch].e_a);
if (!err) {
sbr_env_estimate(sbr->e_curr, sbr->X_high, sbr, &sbr->data[ch]);
- sbr_gain_calc(ac, sbr, &sbr->data[ch], sbr->data[ch].e_a);
+ sbr_gain_calc(sbr, &sbr->data[ch], sbr->data[ch].e_a);
sbr->c.sbr_hf_assemble(sbr->data[ch].Y[sbr->data[ch].Ypos],
(const INTFLOAT (*)[40][2]) sbr->X_high,
sbr, &sbr->data[ch],
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 10+ messages in thread
* [FFmpeg-devel] [PATCH 4/8] avcodec/aacdec: Rename AACContext to AACDecContext
2024-02-26 1:20 [FFmpeg-devel] [PATCH 1/8] avcodec/aacdec_template: Don't use intermediate void* Andreas Rheinhardt
2024-02-26 1:26 ` [FFmpeg-devel] [PATCH 2/8] avocdec/aac: Move decoder-only stuff to new header aacdec.h Andreas Rheinhardt
2024-02-26 1:26 ` [FFmpeg-devel] [PATCH 3/8] avcodec/aacsbr: Remove unused parameter from sbr_gain_calc Andreas Rheinhardt
@ 2024-02-26 1:26 ` Andreas Rheinhardt
2024-02-26 1:26 ` [FFmpeg-devel] [PATCH 5/8] avcodec/aacps: Inline ff_ps_ctx_init() Andreas Rheinhardt
` (3 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Andreas Rheinhardt @ 2024-02-26 1:26 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
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@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
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 10+ messages in thread
* [FFmpeg-devel] [PATCH 5/8] avcodec/aacps: Inline ff_ps_ctx_init()
2024-02-26 1:20 [FFmpeg-devel] [PATCH 1/8] avcodec/aacdec_template: Don't use intermediate void* Andreas Rheinhardt
` (2 preceding siblings ...)
2024-02-26 1:26 ` [FFmpeg-devel] [PATCH 4/8] avcodec/aacdec: Rename AACContext to AACDecContext Andreas Rheinhardt
@ 2024-02-26 1:26 ` Andreas Rheinhardt
2024-02-26 1:26 ` [FFmpeg-devel] [PATCH 6/8] avcodec/aacsbr_template: Avoid using AACDecContext; pass logctx directly Andreas Rheinhardt
` (2 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Andreas Rheinhardt @ 2024-02-26 1:26 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/aacps.c | 5 -----
libavcodec/aacps.h | 7 ++++++-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/libavcodec/aacps.c b/libavcodec/aacps.c
index 5a3e6b3dfd..6008edd332 100644
--- a/libavcodec/aacps.c
+++ b/libavcodec/aacps.c
@@ -740,8 +740,3 @@ int AAC_RENAME(ff_ps_apply)(PSContext *ps, INTFLOAT L[2][38][64], INTFLOAT R[2][
av_cold void AAC_RENAME(ff_ps_init)(void) {
ps_tableinit();
}
-
-av_cold void AAC_RENAME(ff_ps_ctx_init)(PSContext *ps)
-{
- AAC_RENAME(ff_psdsp_init)(&ps->dsp);
-}
diff --git a/libavcodec/aacps.h b/libavcodec/aacps.h
index c8814b4c3d..08c92dc404 100644
--- a/libavcodec/aacps.h
+++ b/libavcodec/aacps.h
@@ -93,7 +93,12 @@ extern const int8_t ff_k_to_i_34[];
void ff_ps_init_common(void);
void AAC_RENAME(ff_ps_init)(void);
-void AAC_RENAME(ff_ps_ctx_init)(PSContext *ps);
+
+static inline void AAC_RENAME(ff_ps_ctx_init)(PSContext *ps)
+{
+ AAC_RENAME(ff_psdsp_init)(&ps->dsp);
+}
+
int ff_ps_read_data(void *logctx, GetBitContext *gb,
PSCommonContext *ps, int bits_left);
int AAC_RENAME(ff_ps_apply)(PSContext *ps, INTFLOAT L[2][38][64], INTFLOAT R[2][38][64], int top);
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 10+ messages in thread
* [FFmpeg-devel] [PATCH 6/8] avcodec/aacsbr_template: Avoid using AACDecContext; pass logctx directly
2024-02-26 1:20 [FFmpeg-devel] [PATCH 1/8] avcodec/aacdec_template: Don't use intermediate void* Andreas Rheinhardt
` (3 preceding siblings ...)
2024-02-26 1:26 ` [FFmpeg-devel] [PATCH 5/8] avcodec/aacps: Inline ff_ps_ctx_init() Andreas Rheinhardt
@ 2024-02-26 1:26 ` Andreas Rheinhardt
2024-02-26 14:43 ` Lynne
2024-02-26 1:26 ` [FFmpeg-devel] [PATCH 7/8] avcodec/sbr: Remove unused AACDecContext* parameter from sbr_lf_gen_mips Andreas Rheinhardt
2024-02-26 1:26 ` [FFmpeg-devel] [PATCH 8/8] avcodec/aac: Split ChannelElement in decoder and encoder structs Andreas Rheinhardt
6 siblings, 1 reply; 10+ messages in thread
From: Andreas Rheinhardt @ 2024-02-26 1:26 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/aacsbr_template.c | 131 ++++++++++++++++++-----------------
1 file changed, 66 insertions(+), 65 deletions(-)
diff --git a/libavcodec/aacsbr_template.c b/libavcodec/aacsbr_template.c
index ce3834e2dc..72bec96d2c 100644
--- a/libavcodec/aacsbr_template.c
+++ b/libavcodec/aacsbr_template.c
@@ -237,15 +237,15 @@ static int array_min_int16(const int16_t *array, int nel)
return min;
}
-static int check_n_master(AVCodecContext *avctx, int n_master, int bs_xover_band)
+static int check_n_master(void *logctx, int n_master, int bs_xover_band)
{
// Requirements (14496-3 sp04 p205)
if (n_master <= 0) {
- av_log(avctx, AV_LOG_ERROR, "Invalid n_master: %d\n", n_master);
+ av_log(logctx, AV_LOG_ERROR, "Invalid n_master: %d\n", n_master);
return -1;
}
if (bs_xover_band >= n_master) {
- av_log(avctx, AV_LOG_ERROR,
+ av_log(logctx, AV_LOG_ERROR,
"Invalid bitstream, crossover band index beyond array bounds: %d\n",
bs_xover_band);
return -1;
@@ -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(AACDecContext *ac, SpectralBandReplication *sbr,
+static int sbr_make_f_master(void *logctx, SpectralBandReplication *sbr,
SpectrumParameters *spectrum)
{
unsigned int temp, max_qmf_subbands = 0;
@@ -283,7 +283,7 @@ static int sbr_make_f_master(AACDecContext *ac, SpectralBandReplication *sbr,
sbr_offset_ptr = sbr_offset[5];
break;
default:
- av_log(ac->avctx, AV_LOG_ERROR,
+ av_log(logctx, AV_LOG_ERROR,
"Unsupported sample rate for SBR: %d\n", sbr->sample_rate);
return -1;
}
@@ -311,7 +311,7 @@ static int sbr_make_f_master(AACDecContext *ac, SpectralBandReplication *sbr,
} else if (spectrum->bs_stop_freq == 15) {
sbr->k[2] = 3*sbr->k[0];
} else {
- av_log(ac->avctx, AV_LOG_ERROR,
+ av_log(logctx, AV_LOG_ERROR,
"Invalid bs_stop_freq: %d\n", spectrum->bs_stop_freq);
return -1;
}
@@ -328,7 +328,7 @@ static int sbr_make_f_master(AACDecContext *ac, SpectralBandReplication *sbr,
av_assert0(0);
if (sbr->k[2] - sbr->k[0] > max_qmf_subbands) {
- av_log(ac->avctx, AV_LOG_ERROR,
+ av_log(logctx, AV_LOG_ERROR,
"Invalid bitstream, too many QMF subbands: %d\n", sbr->k[2] - sbr->k[0]);
return -1;
}
@@ -338,7 +338,7 @@ static int sbr_make_f_master(AACDecContext *ac, SpectralBandReplication *sbr,
dk = spectrum->bs_alter_scale + 1;
sbr->n_master = ((sbr->k[2] - sbr->k[0] + (dk&2)) >> dk) << 1;
- if (check_n_master(ac->avctx, sbr->n_master, sbr->spectrum_params.bs_xover_band))
+ if (check_n_master(logctx, sbr->n_master, sbr->spectrum_params.bs_xover_band))
return -1;
for (k = 1; k <= sbr->n_master; k++)
@@ -388,7 +388,7 @@ static int sbr_make_f_master(AACDecContext *ac, SpectralBandReplication *sbr,
#endif /* USE_FIXED */
if (num_bands_0 <= 0) { // Requirements (14496-3 sp04 p205)
- av_log(ac->avctx, AV_LOG_ERROR, "Invalid num_bands_0: %d\n", num_bands_0);
+ av_log(logctx, AV_LOG_ERROR, "Invalid num_bands_0: %d\n", num_bands_0);
return -1;
}
@@ -402,7 +402,7 @@ static int sbr_make_f_master(AACDecContext *ac, SpectralBandReplication *sbr,
vk0[0] = sbr->k[0];
for (k = 1; k <= num_bands_0; k++) {
if (vk0[k] <= 0) { // Requirements (14496-3 sp04 p205)
- av_log(ac->avctx, AV_LOG_ERROR, "Invalid vDk0[%d]: %d\n", k, vk0[k]);
+ av_log(logctx, AV_LOG_ERROR, "Invalid vDk0[%d]: %d\n", k, vk0[k]);
return -1;
}
vk0[k] += vk0[k-1];
@@ -448,14 +448,14 @@ static int sbr_make_f_master(AACDecContext *ac, SpectralBandReplication *sbr,
vk1[0] = sbr->k[1];
for (k = 1; k <= num_bands_1; k++) {
if (vk1[k] <= 0) { // Requirements (14496-3 sp04 p205)
- av_log(ac->avctx, AV_LOG_ERROR, "Invalid vDk1[%d]: %d\n", k, vk1[k]);
+ av_log(logctx, AV_LOG_ERROR, "Invalid vDk1[%d]: %d\n", k, vk1[k]);
return -1;
}
vk1[k] += vk1[k-1];
}
sbr->n_master = num_bands_0 + num_bands_1;
- if (check_n_master(ac->avctx, sbr->n_master, sbr->spectrum_params.bs_xover_band))
+ if (check_n_master(logctx, sbr->n_master, sbr->spectrum_params.bs_xover_band))
return -1;
memcpy(&sbr->f_master[0], vk0,
(num_bands_0 + 1) * sizeof(sbr->f_master[0]));
@@ -464,7 +464,7 @@ static int sbr_make_f_master(AACDecContext *ac, SpectralBandReplication *sbr,
} else {
sbr->n_master = num_bands_0;
- if (check_n_master(ac->avctx, sbr->n_master, sbr->spectrum_params.bs_xover_band))
+ if (check_n_master(logctx, sbr->n_master, sbr->spectrum_params.bs_xover_band))
return -1;
memcpy(sbr->f_master, vk0, (num_bands_0 + 1) * sizeof(sbr->f_master[0]));
}
@@ -474,7 +474,7 @@ static int sbr_make_f_master(AACDecContext *ac, SpectralBandReplication *sbr,
}
/// High Frequency Generation - Patch Construction (14496-3 sp04 p216 fig. 4.46)
-static int sbr_hf_calc_npatches(AACDecContext *ac, SpectralBandReplication *sbr)
+static int sbr_hf_calc_npatches(void *logctx, SpectralBandReplication *sbr)
{
int i, k, last_k = -1, last_msb = -1, sb = 0;
int msb = sbr->k[0];
@@ -491,7 +491,7 @@ static int sbr_hf_calc_npatches(AACDecContext *ac, SpectralBandReplication *sbr)
do {
int odd = 0;
if (k == last_k && msb == last_msb) {
- av_log(ac->avctx, AV_LOG_ERROR, "patch construction failed\n");
+ av_log(logctx, AV_LOG_ERROR, "patch construction failed\n");
return AVERROR_INVALIDDATA;
}
last_k = k;
@@ -506,7 +506,7 @@ static int sbr_hf_calc_npatches(AACDecContext *ac, SpectralBandReplication *sbr)
// illegal however the Coding Technologies decoder check stream has a final
// count of 6 patches
if (sbr->num_patches > 5) {
- av_log(ac->avctx, AV_LOG_ERROR, "Too many patches: %d\n", sbr->num_patches);
+ av_log(logctx, AV_LOG_ERROR, "Too many patches: %d\n", sbr->num_patches);
return -1;
}
@@ -532,7 +532,7 @@ static int sbr_hf_calc_npatches(AACDecContext *ac, SpectralBandReplication *sbr)
}
/// Derived Frequency Band Tables (14496-3 sp04 p197)
-static int sbr_make_f_derived(AACDecContext *ac, SpectralBandReplication *sbr)
+static int sbr_make_f_derived(void *logctx, SpectralBandReplication *sbr)
{
int k, temp;
#if USE_FIXED
@@ -549,12 +549,12 @@ static int sbr_make_f_derived(AACDecContext *ac, SpectralBandReplication *sbr)
// Requirements (14496-3 sp04 p205)
if (sbr->kx[1] + sbr->m[1] > 64) {
- av_log(ac->avctx, AV_LOG_ERROR,
+ av_log(logctx, AV_LOG_ERROR,
"Stop frequency border too high: %d\n", sbr->kx[1] + sbr->m[1]);
return -1;
}
if (sbr->kx[1] > 32) {
- av_log(ac->avctx, AV_LOG_ERROR, "Start frequency border too high: %d\n", sbr->kx[1]);
+ av_log(logctx, AV_LOG_ERROR, "Start frequency border too high: %d\n", sbr->kx[1]);
return -1;
}
@@ -581,7 +581,7 @@ static int sbr_make_f_derived(AACDecContext *ac, SpectralBandReplication *sbr)
#endif /* USE_FIXED */
if (sbr->n_q > 5) {
- av_log(ac->avctx, AV_LOG_ERROR, "Too many noise floor scale factors: %d\n", sbr->n_q);
+ av_log(logctx, AV_LOG_ERROR, "Too many noise floor scale factors: %d\n", sbr->n_q);
return -1;
}
@@ -592,7 +592,7 @@ static int sbr_make_f_derived(AACDecContext *ac, SpectralBandReplication *sbr)
sbr->f_tablenoise[k] = sbr->f_tablelow[temp];
}
- if (sbr_hf_calc_npatches(ac, sbr) < 0)
+ if (sbr_hf_calc_npatches(logctx, sbr) < 0)
return -1;
sbr_make_f_tablelim(sbr);
@@ -617,7 +617,7 @@ static const int8_t ceil_log2[] = {
0, 1, 2, 2, 3, 3,
};
-static int read_sbr_grid(AACDecContext *ac, SpectralBandReplication *sbr,
+static int read_sbr_grid(void *logctx, SpectralBandReplication *sbr,
GetBitContext *gb, SBRData *ch_data)
{
int i;
@@ -636,7 +636,7 @@ static int read_sbr_grid(AACDecContext *ac, SpectralBandReplication *sbr,
case FIXFIX:
bs_num_env = 1 << get_bits(gb, 2);
if (bs_num_env > 4) {
- av_log(ac->avctx, AV_LOG_ERROR,
+ av_log(logctx, AV_LOG_ERROR,
"Invalid bitstream, too many SBR envelopes in FIXFIX type SBR frame: %d\n",
bs_num_env);
return -1;
@@ -696,7 +696,7 @@ static int read_sbr_grid(AACDecContext *ac, SpectralBandReplication *sbr,
bs_num_env = num_rel_lead + num_rel_trail + 1;
if (bs_num_env > 5) {
- av_log(ac->avctx, AV_LOG_ERROR,
+ av_log(logctx, AV_LOG_ERROR,
"Invalid bitstream, too many SBR envelopes in VARVAR type SBR frame: %d\n",
bs_num_env);
return -1;
@@ -720,7 +720,7 @@ static int read_sbr_grid(AACDecContext *ac, SpectralBandReplication *sbr,
av_assert0(bs_pointer >= 0);
if (bs_pointer > ch_data->bs_num_env + 1) {
- av_log(ac->avctx, AV_LOG_ERROR,
+ av_log(logctx, AV_LOG_ERROR,
"Invalid bitstream, bs_pointer points to a middle noise border outside the time borders table: %d\n",
bs_pointer);
return -1;
@@ -728,7 +728,7 @@ static int read_sbr_grid(AACDecContext *ac, SpectralBandReplication *sbr,
for (i = 1; i <= ch_data->bs_num_env; i++) {
if (ch_data->t_env[i-1] >= ch_data->t_env[i]) {
- av_log(ac->avctx, AV_LOG_ERROR, "Not strictly monotone time borders\n");
+ av_log(logctx, AV_LOG_ERROR, "Not strictly monotone time borders\n");
return -1;
}
}
@@ -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(AACDecContext *ac, SpectralBandReplication *sbr, GetBitContext *gb,
+static int read_sbr_envelope(void *logctx, SpectralBandReplication *sbr, GetBitContext *gb,
SBRData *ch_data, int ch)
{
int bits;
@@ -838,7 +838,7 @@ static int read_sbr_envelope(AACDecContext *ac, SpectralBandReplication *sbr, Ge
for (j = 0; j < sbr->n[ch_data->bs_freq_res[i + 1]]; j++) {
ch_data->env_facs_q[i + 1][j] = ch_data->env_facs_q[i][j] + delta * get_vlc2(gb, t_huff, 9, 3);
if (ch_data->env_facs_q[i + 1][j] > 127U) {
- av_log(ac->avctx, AV_LOG_ERROR, "env_facs_q %d is invalid\n", ch_data->env_facs_q[i + 1][j]);
+ av_log(logctx, AV_LOG_ERROR, "env_facs_q %d is invalid\n", ch_data->env_facs_q[i + 1][j]);
return AVERROR_INVALIDDATA;
}
}
@@ -847,7 +847,7 @@ static int read_sbr_envelope(AACDecContext *ac, SpectralBandReplication *sbr, Ge
k = (j + odd) >> 1; // find k such that f_tablelow[k] <= f_tablehigh[j] < f_tablelow[k + 1]
ch_data->env_facs_q[i + 1][j] = ch_data->env_facs_q[i][k] + delta * get_vlc2(gb, t_huff, 9, 3);
if (ch_data->env_facs_q[i + 1][j] > 127U) {
- av_log(ac->avctx, AV_LOG_ERROR, "env_facs_q %d is invalid\n", ch_data->env_facs_q[i + 1][j]);
+ av_log(logctx, AV_LOG_ERROR, "env_facs_q %d is invalid\n", ch_data->env_facs_q[i + 1][j]);
return AVERROR_INVALIDDATA;
}
}
@@ -856,7 +856,7 @@ static int read_sbr_envelope(AACDecContext *ac, SpectralBandReplication *sbr, Ge
k = j ? 2*j - odd : 0; // find k such that f_tablehigh[k] == f_tablelow[j]
ch_data->env_facs_q[i + 1][j] = ch_data->env_facs_q[i][k] + delta * get_vlc2(gb, t_huff, 9, 3);
if (ch_data->env_facs_q[i + 1][j] > 127U) {
- av_log(ac->avctx, AV_LOG_ERROR, "env_facs_q %d is invalid\n", ch_data->env_facs_q[i + 1][j]);
+ av_log(logctx, AV_LOG_ERROR, "env_facs_q %d is invalid\n", ch_data->env_facs_q[i + 1][j]);
return AVERROR_INVALIDDATA;
}
}
@@ -866,7 +866,7 @@ static int read_sbr_envelope(AACDecContext *ac, SpectralBandReplication *sbr, Ge
for (j = 1; j < sbr->n[ch_data->bs_freq_res[i + 1]]; j++) {
ch_data->env_facs_q[i + 1][j] = ch_data->env_facs_q[i + 1][j - 1] + delta * get_vlc2(gb, f_huff, 9, 3);
if (ch_data->env_facs_q[i + 1][j] > 127U) {
- av_log(ac->avctx, AV_LOG_ERROR, "env_facs_q %d is invalid\n", ch_data->env_facs_q[i + 1][j]);
+ av_log(logctx, AV_LOG_ERROR, "env_facs_q %d is invalid\n", ch_data->env_facs_q[i + 1][j]);
return AVERROR_INVALIDDATA;
}
}
@@ -880,7 +880,7 @@ static int read_sbr_envelope(AACDecContext *ac, SpectralBandReplication *sbr, Ge
return 0;
}
-static int read_sbr_noise(AACDecContext *ac, SpectralBandReplication *sbr, GetBitContext *gb,
+static int read_sbr_noise(void *logctx, SpectralBandReplication *sbr, GetBitContext *gb,
SBRData *ch_data, int ch)
{
int i, j;
@@ -900,7 +900,7 @@ static int read_sbr_noise(AACDecContext *ac, SpectralBandReplication *sbr, GetBi
for (j = 0; j < sbr->n_q; j++) {
ch_data->noise_facs_q[i + 1][j] = ch_data->noise_facs_q[i][j] + delta * get_vlc2(gb, t_huff, 9, 2);
if (ch_data->noise_facs_q[i + 1][j] > 30U) {
- av_log(ac->avctx, AV_LOG_ERROR, "noise_facs_q %d is invalid\n", ch_data->noise_facs_q[i + 1][j]);
+ av_log(logctx, AV_LOG_ERROR, "noise_facs_q %d is invalid\n", ch_data->noise_facs_q[i + 1][j]);
return AVERROR_INVALIDDATA;
}
}
@@ -909,7 +909,7 @@ static int read_sbr_noise(AACDecContext *ac, SpectralBandReplication *sbr, GetBi
for (j = 1; j < sbr->n_q; j++) {
ch_data->noise_facs_q[i + 1][j] = ch_data->noise_facs_q[i + 1][j - 1] + delta * get_vlc2(gb, f_huff, 9, 3);
if (ch_data->noise_facs_q[i + 1][j] > 30U) {
- av_log(ac->avctx, AV_LOG_ERROR, "noise_facs_q %d is invalid\n", ch_data->noise_facs_q[i + 1][j]);
+ av_log(logctx, AV_LOG_ERROR, "noise_facs_q %d is invalid\n", ch_data->noise_facs_q[i + 1][j]);
return AVERROR_INVALIDDATA;
}
}
@@ -949,7 +949,7 @@ static void read_sbr_extension(AACDecContext *ac, SpectralBandReplication *sbr,
}
}
-static int read_sbr_single_channel_element(AACDecContext *ac,
+static int read_sbr_single_channel_element(void *logctx,
SpectralBandReplication *sbr,
GetBitContext *gb)
{
@@ -958,13 +958,13 @@ static int read_sbr_single_channel_element(AACDecContext *ac,
if (get_bits1(gb)) // bs_data_extra
skip_bits(gb, 4); // bs_reserved
- if (read_sbr_grid(ac, sbr, gb, &sbr->data[0]))
+ if (read_sbr_grid(logctx, sbr, gb, &sbr->data[0]))
return -1;
read_sbr_dtdf(sbr, gb, &sbr->data[0]);
read_sbr_invf(sbr, gb, &sbr->data[0]);
- if((ret = read_sbr_envelope(ac, sbr, gb, &sbr->data[0], 0)) < 0)
+ if((ret = read_sbr_envelope(logctx, sbr, gb, &sbr->data[0], 0)) < 0)
return ret;
- if((ret = read_sbr_noise(ac, sbr, gb, &sbr->data[0], 0)) < 0)
+ if((ret = read_sbr_noise(logctx, sbr, gb, &sbr->data[0], 0)) < 0)
return ret;
if ((sbr->data[0].bs_add_harmonic_flag = get_bits1(gb)))
@@ -973,7 +973,7 @@ static int read_sbr_single_channel_element(AACDecContext *ac,
return 0;
}
-static int read_sbr_channel_pair_element(AACDecContext *ac,
+static int read_sbr_channel_pair_element(void *logctx,
SpectralBandReplication *sbr,
GetBitContext *gb)
{
@@ -983,7 +983,7 @@ static int read_sbr_channel_pair_element(AACDecContext *ac,
skip_bits(gb, 8); // bs_reserved
if ((sbr->bs_coupling = get_bits1(gb))) {
- if (read_sbr_grid(ac, sbr, gb, &sbr->data[0]))
+ if (read_sbr_grid(logctx, sbr, gb, &sbr->data[0]))
return -1;
copy_sbr_grid(&sbr->data[1], &sbr->data[0]);
read_sbr_dtdf(sbr, gb, &sbr->data[0]);
@@ -991,29 +991,29 @@ static int read_sbr_channel_pair_element(AACDecContext *ac,
read_sbr_invf(sbr, gb, &sbr->data[0]);
memcpy(sbr->data[1].bs_invf_mode[1], sbr->data[1].bs_invf_mode[0], sizeof(sbr->data[1].bs_invf_mode[0]));
memcpy(sbr->data[1].bs_invf_mode[0], sbr->data[0].bs_invf_mode[0], sizeof(sbr->data[1].bs_invf_mode[0]));
- if((ret = read_sbr_envelope(ac, sbr, gb, &sbr->data[0], 0)) < 0)
+ if((ret = read_sbr_envelope(logctx, sbr, gb, &sbr->data[0], 0)) < 0)
return ret;
- if((ret = read_sbr_noise(ac, sbr, gb, &sbr->data[0], 0)) < 0)
+ if((ret = read_sbr_noise(logctx, sbr, gb, &sbr->data[0], 0)) < 0)
return ret;
- if((ret = read_sbr_envelope(ac, sbr, gb, &sbr->data[1], 1)) < 0)
+ if((ret = read_sbr_envelope(logctx, sbr, gb, &sbr->data[1], 1)) < 0)
return ret;
- if((ret = read_sbr_noise(ac, sbr, gb, &sbr->data[1], 1)) < 0)
+ if((ret = read_sbr_noise(logctx, sbr, gb, &sbr->data[1], 1)) < 0)
return ret;
} else {
- if (read_sbr_grid(ac, sbr, gb, &sbr->data[0]) ||
- read_sbr_grid(ac, sbr, gb, &sbr->data[1]))
+ if (read_sbr_grid(logctx, sbr, gb, &sbr->data[0]) ||
+ read_sbr_grid(logctx, sbr, gb, &sbr->data[1]))
return -1;
read_sbr_dtdf(sbr, gb, &sbr->data[0]);
read_sbr_dtdf(sbr, gb, &sbr->data[1]);
read_sbr_invf(sbr, gb, &sbr->data[0]);
read_sbr_invf(sbr, gb, &sbr->data[1]);
- if((ret = read_sbr_envelope(ac, sbr, gb, &sbr->data[0], 0)) < 0)
+ if((ret = read_sbr_envelope(logctx, sbr, gb, &sbr->data[0], 0)) < 0)
return ret;
- if((ret = read_sbr_envelope(ac, sbr, gb, &sbr->data[1], 1)) < 0)
+ if((ret = read_sbr_envelope(logctx, sbr, gb, &sbr->data[1], 1)) < 0)
return ret;
- if((ret = read_sbr_noise(ac, sbr, gb, &sbr->data[0], 0)) < 0)
+ if((ret = read_sbr_noise(logctx, sbr, gb, &sbr->data[0], 0)) < 0)
return ret;
- if((ret = read_sbr_noise(ac, sbr, gb, &sbr->data[1], 1)) < 0)
+ if((ret = read_sbr_noise(logctx, sbr, gb, &sbr->data[1], 1)) < 0)
return ret;
}
@@ -1029,22 +1029,23 @@ static unsigned int read_sbr_data(AACDecContext *ac, SpectralBandReplication *sb
GetBitContext *gb, int id_aac)
{
unsigned int cnt = get_bits_count(gb);
+ void *logctx = ac->avctx;
sbr->id_aac = id_aac;
sbr->ready_for_dequant = 1;
if (id_aac == TYPE_SCE || id_aac == TYPE_CCE) {
- if (read_sbr_single_channel_element(ac, sbr, gb)) {
+ if (read_sbr_single_channel_element(logctx, sbr, gb)) {
sbr_turnoff(sbr);
return get_bits_count(gb) - cnt;
}
} else if (id_aac == TYPE_CPE) {
- if (read_sbr_channel_pair_element(ac, sbr, gb)) {
+ if (read_sbr_channel_pair_element(logctx, sbr, gb)) {
sbr_turnoff(sbr);
return get_bits_count(gb) - cnt;
}
} else {
- av_log(ac->avctx, AV_LOG_ERROR,
+ av_log(logctx, AV_LOG_ERROR,
"Invalid bitstream - cannot apply SBR to element type %d\n", id_aac);
sbr_turnoff(sbr);
return get_bits_count(gb) - cnt;
@@ -1060,7 +1061,7 @@ static unsigned int read_sbr_data(AACDecContext *ac, SpectralBandReplication *sb
read_sbr_extension(ac, sbr, gb, get_bits(gb, 2), &num_bits_left); // bs_extension_id
}
if (num_bits_left < 0) {
- av_log(ac->avctx, AV_LOG_ERROR, "SBR Extension over read.\n");
+ av_log(logctx, AV_LOG_ERROR, "SBR Extension over read.\n");
}
if (num_bits_left > 0)
skip_bits(gb, num_bits_left);
@@ -1069,14 +1070,14 @@ static unsigned int read_sbr_data(AACDecContext *ac, SpectralBandReplication *sb
return get_bits_count(gb) - cnt;
}
-static void sbr_reset(AACDecContext *ac, SpectralBandReplication *sbr)
+static void sbr_reset(void *logctx, SpectralBandReplication *sbr)
{
int err;
- err = sbr_make_f_master(ac, sbr, &sbr->spectrum_params);
+ err = sbr_make_f_master(logctx, sbr, &sbr->spectrum_params);
if (err >= 0)
- err = sbr_make_f_derived(ac, sbr);
+ err = sbr_make_f_derived(logctx, sbr);
if (err < 0) {
- av_log(ac->avctx, AV_LOG_ERROR,
+ av_log(logctx, AV_LOG_ERROR,
"SBR reset failed. Switching SBR to pure upsampling mode.\n");
sbr_turnoff(sbr);
}
@@ -1120,7 +1121,7 @@ int AAC_RENAME(ff_decode_sbr_extension)(AACDecContext *ac, SpectralBandReplicati
num_sbr_bits += read_sbr_header(sbr, gb);
if (sbr->reset)
- sbr_reset(ac, sbr);
+ sbr_reset(ac->avctx, sbr);
if (sbr->start)
num_sbr_bits += read_sbr_data(ac, sbr, gb, id_aac);
@@ -1268,7 +1269,7 @@ static int sbr_lf_gen(AACDecContext *ac, SpectralBandReplication *sbr,
}
/// High Frequency Generator (14496-3 sp04 p215)
-static int sbr_hf_gen(AACDecContext *ac, SpectralBandReplication *sbr,
+static int sbr_hf_gen(void *logctx, 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,
@@ -1285,7 +1286,7 @@ static int sbr_hf_gen(AACDecContext *ac, SpectralBandReplication *sbr,
g--;
if (g < 0) {
- av_log(ac->avctx, AV_LOG_ERROR,
+ av_log(logctx, AV_LOG_ERROR,
"ERROR : no subband found for frequency %d\n", k);
return -1;
}
@@ -1342,7 +1343,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(AACDecContext *ac, SpectralBandReplication *sbr,
+static int sbr_mapping(void *logctx, SpectralBandReplication *sbr,
SBRData *ch_data, int e_a[2])
{
int e, i, m;
@@ -1354,7 +1355,7 @@ static int sbr_mapping(AACDecContext *ac, SpectralBandReplication *sbr,
int k;
if (sbr->kx[1] != table[0]) {
- av_log(ac->avctx, AV_LOG_ERROR, "kx != f_table{high,low}[0]. "
+ av_log(logctx, AV_LOG_ERROR, "kx != f_table{high,low}[0]. "
"Derived frequency tables were not regenerated.\n");
sbr_turnoff(sbr);
return AVERROR_BUG;
@@ -1502,7 +1503,7 @@ void AAC_RENAME(ff_sbr_apply)(AACDecContext *ac, SpectralBandReplication *sbr, i
(const INTFLOAT (*)[40][2]) sbr->X_low, sbr->k[0]);
sbr_chirp(sbr, &sbr->data[ch]);
av_assert0(sbr->data[ch].bs_num_env > 0);
- sbr_hf_gen(ac, sbr, sbr->X_high,
+ sbr_hf_gen(ac->avctx, sbr, sbr->X_high,
(const INTFLOAT (*)[40][2]) sbr->X_low,
(const INTFLOAT (*)[2]) sbr->alpha0,
(const INTFLOAT (*)[2]) sbr->alpha1,
@@ -1510,7 +1511,7 @@ void AAC_RENAME(ff_sbr_apply)(AACDecContext *ac, SpectralBandReplication *sbr, i
sbr->data[ch].bs_num_env);
// hf_adj
- err = sbr_mapping(ac, sbr, &sbr->data[ch], sbr->data[ch].e_a);
+ err = sbr_mapping(ac->avctx, sbr, &sbr->data[ch], sbr->data[ch].e_a);
if (!err) {
sbr_env_estimate(sbr->e_curr, sbr->X_high, sbr, &sbr->data[ch]);
sbr_gain_calc(sbr, &sbr->data[ch], sbr->data[ch].e_a);
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [FFmpeg-devel] [PATCH 6/8] avcodec/aacsbr_template: Avoid using AACDecContext; pass logctx directly
2024-02-26 1:26 ` [FFmpeg-devel] [PATCH 6/8] avcodec/aacsbr_template: Avoid using AACDecContext; pass logctx directly Andreas Rheinhardt
@ 2024-02-26 14:43 ` Lynne
2024-02-26 23:13 ` Andreas Rheinhardt
0 siblings, 1 reply; 10+ messages in thread
From: Lynne @ 2024-02-26 14:43 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Feb 26, 2024, 02:25 by andreas.rheinhardt@outlook.com:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> libavcodec/aacsbr_template.c | 131 ++++++++++++++++++-----------------
> 1 file changed, 66 insertions(+), 65 deletions(-)
>
> diff --git a/libavcodec/aacsbr_template.c b/libavcodec/aacsbr_template.c
> index ce3834e2dc..72bec96d2c 100644
> --- a/libavcodec/aacsbr_template.c
> +++ b/libavcodec/aacsbr_template.c
> @@ -237,15 +237,15 @@ static int array_min_int16(const int16_t *array, int nel)
> return min;
> }
>
Patchset LGTM, except this commit. Would you mind leaving
AACDecContext usage here? SBR is still technically part of the decoder,
and it has been useful for 2 of my unmerged patches to have
access to the header.
I think SBR went too hard on abstracting itself, maybe for a hypothetical
sbr mp3 reuse.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [FFmpeg-devel] [PATCH 6/8] avcodec/aacsbr_template: Avoid using AACDecContext; pass logctx directly
2024-02-26 14:43 ` Lynne
@ 2024-02-26 23:13 ` Andreas Rheinhardt
0 siblings, 0 replies; 10+ messages in thread
From: Andreas Rheinhardt @ 2024-02-26 23:13 UTC (permalink / raw)
To: ffmpeg-devel
Lynne:
> Feb 26, 2024, 02:25 by andreas.rheinhardt@outlook.com:
>
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
>> ---
>> libavcodec/aacsbr_template.c | 131 ++++++++++++++++++-----------------
>> 1 file changed, 66 insertions(+), 65 deletions(-)
>>
>> diff --git a/libavcodec/aacsbr_template.c b/libavcodec/aacsbr_template.c
>> index ce3834e2dc..72bec96d2c 100644
>> --- a/libavcodec/aacsbr_template.c
>> +++ b/libavcodec/aacsbr_template.c
>> @@ -237,15 +237,15 @@ static int array_min_int16(const int16_t *array, int nel)
>> return min;
>> }
>>
>
> Patchset LGTM, except this commit. Would you mind leaving
> AACDecContext usage here? SBR is still technically part of the decoder,
> and it has been useful for 2 of my unmerged patches to have
> access to the header.
Ok, applied the set without this patch.
Thanks for the review.
> I think SBR went too hard on abstracting itself, maybe for a hypothetical
> sbr mp3 reuse.
+1
- Andreas
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 10+ messages in thread
* [FFmpeg-devel] [PATCH 7/8] avcodec/sbr: Remove unused AACDecContext* parameter from sbr_lf_gen_mips
2024-02-26 1:20 [FFmpeg-devel] [PATCH 1/8] avcodec/aacdec_template: Don't use intermediate void* Andreas Rheinhardt
` (4 preceding siblings ...)
2024-02-26 1:26 ` [FFmpeg-devel] [PATCH 6/8] avcodec/aacsbr_template: Avoid using AACDecContext; pass logctx directly Andreas Rheinhardt
@ 2024-02-26 1:26 ` Andreas Rheinhardt
2024-02-26 1:26 ` [FFmpeg-devel] [PATCH 8/8] avcodec/aac: Split ChannelElement in decoder and encoder structs Andreas Rheinhardt
6 siblings, 0 replies; 10+ messages in thread
From: Andreas Rheinhardt @ 2024-02-26 1:26 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/aacsbr.h | 2 ++
libavcodec/aacsbr_template.c | 4 ++--
libavcodec/mips/aacsbr_mips.c | 2 +-
libavcodec/sbr.h | 4 +---
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/libavcodec/aacsbr.h b/libavcodec/aacsbr.h
index ad4935d734..cb680cc548 100644
--- a/libavcodec/aacsbr.h
+++ b/libavcodec/aacsbr.h
@@ -36,6 +36,8 @@
#define ENVELOPE_ADJUSTMENT_OFFSET 2
#define NOISE_FLOOR_OFFSET 6
+struct AACDecContext;
+
/**
* SBR VLC tables
*/
diff --git a/libavcodec/aacsbr_template.c b/libavcodec/aacsbr_template.c
index 72bec96d2c..6a5b471e7a 100644
--- a/libavcodec/aacsbr_template.c
+++ b/libavcodec/aacsbr_template.c
@@ -1244,7 +1244,7 @@ static void sbr_qmf_synthesis(AVTXContext *mdct, av_tx_fn mdct_fn,
#endif
/// Generate the subband filtered lowband
-static int sbr_lf_gen(AACDecContext *ac, SpectralBandReplication *sbr,
+static int sbr_lf_gen(SpectralBandReplication *sbr,
INTFLOAT X_low[32][40][2], const INTFLOAT W[2][32][32][2],
int buf_idx)
{
@@ -1494,7 +1494,7 @@ void AAC_RENAME(ff_sbr_apply)(AACDecContext *ac, SpectralBandReplication *sbr, i
ch ? R : L, sbr->data[ch].analysis_filterbank_samples,
(INTFLOAT*)sbr->qmf_filter_scratch,
sbr->data[ch].W, sbr->data[ch].Ypos);
- sbr->c.sbr_lf_gen(ac, sbr, sbr->X_low,
+ sbr->c.sbr_lf_gen(sbr, sbr->X_low,
(const INTFLOAT (*)[32][32][2]) sbr->data[ch].W,
sbr->data[ch].Ypos);
sbr->data[ch].Ypos ^= 1;
diff --git a/libavcodec/mips/aacsbr_mips.c b/libavcodec/mips/aacsbr_mips.c
index 0dc09130b7..e0715491e6 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(AACDecContext *ac, SpectralBandReplication *sbr,
+static int sbr_lf_gen_mips(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 46c68615c8..fe3a39603a 100644
--- a/libavcodec/sbr.h
+++ b/libavcodec/sbr.h
@@ -37,8 +37,6 @@
#include "aacps.h"
#include "sbrdsp.h"
-struct AACDecContext;
-
/**
* Spectral Band Replication header - spectrum parameters that invoke a reset if they differ from the previous header.
*/
@@ -121,7 +119,7 @@ typedef struct SpectralBandReplication SpectralBandReplication;
* aacsbr functions pointers
*/
typedef struct AACSBRContext {
- int (*sbr_lf_gen)(struct AACDecContext *ac, SpectralBandReplication *sbr,
+ int (*sbr_lf_gen)(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
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 10+ messages in thread
* [FFmpeg-devel] [PATCH 8/8] avcodec/aac: Split ChannelElement in decoder and encoder structs
2024-02-26 1:20 [FFmpeg-devel] [PATCH 1/8] avcodec/aacdec_template: Don't use intermediate void* Andreas Rheinhardt
` (5 preceding siblings ...)
2024-02-26 1:26 ` [FFmpeg-devel] [PATCH 7/8] avcodec/sbr: Remove unused AACDecContext* parameter from sbr_lf_gen_mips Andreas Rheinhardt
@ 2024-02-26 1:26 ` Andreas Rheinhardt
6 siblings, 0 replies; 10+ messages in thread
From: Andreas Rheinhardt @ 2024-02-26 1:26 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
The AAC decoders share no common code with the AAC encoder,
so they are not restricted to using the same structures.
This implies that one can use different structs for each
component and remove elements not used by the decoders/
the encoder. This leads to quite sizeable savings:
sizeof(ChannelElement) for the encoder went down to 134432B
here from 547552B; for the decoder it went down to 512800B.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/aac.h | 125 -----------------------------------
libavcodec/aacdec.h | 102 ++++++++++++++++++++++++++++
libavcodec/aacenc.h | 89 +++++++++++++++++++++++++
libavcodec/aacenc_utils.h | 2 +-
libavcodec/aacenctab.h | 1 +
libavcodec/sbrdsp_template.c | 2 +
6 files changed, 195 insertions(+), 126 deletions(-)
diff --git a/libavcodec/aac.h b/libavcodec/aac.h
index da683b0071..89f838eab5 100644
--- a/libavcodec/aac.h
+++ b/libavcodec/aac.h
@@ -32,11 +32,6 @@
#include "aac_defines.h"
-#include "libavutil/channel_layout.h"
-#include "libavutil/mem_internal.h"
-#include "sbr.h"
-
-#include <stdint.h>
#define MAX_CHANNELS 64
#define MAX_ELEM_ID 16
@@ -44,8 +39,6 @@
#define TNS_MAX_ORDER 20
#define MAX_LTP_LONG_SFB 40
-#define CLIP_AVOIDANCE_FACTOR 0.95f
-
enum RawDataBlockType {
TYPE_SCE,
TYPE_CPE,
@@ -83,8 +76,6 @@ enum BandType {
INTENSITY_BT = 15, ///< Scalefactor data are intensity stereo positions (in phase).
};
-#define IS_CODEBOOK_UNSIGNED(x) (((x) - 1) & 10)
-
enum ChannelPosition {
AAC_CHANNEL_OFF = 0,
AAC_CHANNEL_FRONT = 1,
@@ -94,15 +85,6 @@ enum ChannelPosition {
AAC_CHANNEL_CC = 5,
};
-/**
- * The point during decoding at which channel coupling is applied.
- */
-enum CouplingPoint {
- BEFORE_TNS,
- BETWEEN_TNS_AND_IMDCT,
- AFTER_IMDCT = 3,
-};
-
/**
* Predictor State
*/
@@ -131,54 +113,6 @@ typedef struct PredictorState {
#define NOISE_PRE_BITS 9 ///< length of preamble
#define NOISE_OFFSET 90 ///< subtracted from global gain, used as offset for the preamble
-/**
- * Long Term Prediction
- */
-typedef struct LongTermPrediction {
- int8_t present;
- int16_t lag;
- int coef_idx;
- INTFLOAT coef;
- int8_t used[MAX_LTP_LONG_SFB];
-} LongTermPrediction;
-
-/**
- * Individual Channel Stream
- */
-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 sine window.
- int num_window_groups;
- uint8_t group_len[8];
- LongTermPrediction ltp;
- const uint16_t *swb_offset; ///< table of offsets to the lowest spectral coefficient of a scalefactor band, sfb, for a particular window
- const uint8_t *swb_sizes; ///< table of scalefactor band sizes for a particular window
- int num_swb; ///< number of scalefactor window bands
- int num_windows;
- int tns_max_bands;
- int predictor_present;
- int predictor_initialized;
- int predictor_reset_group;
- int predictor_reset_count[31]; ///< used by encoder to count prediction resets
- uint8_t prediction_used[41];
- uint8_t window_clipping[8]; ///< set if a certain window is near clipping
- float clip_avoidance_factor; ///< set if any window is near clipping to the necessary atennuation factor to avoid it
-} IndividualChannelStream;
-
-/**
- * Temporal Noise Shaping
- */
-typedef struct TemporalNoiseShaping {
- int present;
- int n_filt[8];
- int length[8][4];
- int direction[8][4];
- int order[8][4];
- int coef_idx[8][4][TNS_MAX_ORDER];
- INTFLOAT coef[8][4][TNS_MAX_ORDER];
-} TemporalNoiseShaping;
-
typedef struct Pulse {
int num_pulse;
int start;
@@ -186,63 +120,4 @@ typedef struct Pulse {
int amp[4];
} Pulse;
-/**
- * coupling parameters
- */
-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.
- int id_select[8]; ///< element id
- int ch_select[8]; /**< [0] shared list of gains; [1] list of gains for right channel;
- * [2] list of gains for left channel; [3] lists of gains for both channels
- */
- INTFLOAT gain[16][120];
-} ChannelCoupling;
-
-/**
- * Single Channel Element - used for both SCE and LFE elements.
- */
-typedef struct SingleChannelElement {
- IndividualChannelStream ics;
- TemporalNoiseShaping tns;
- Pulse pulse;
- enum BandType band_type[128]; ///< band types
- enum BandType band_alt[128]; ///< alternative band type (used by encoder)
- int band_type_run_end[120]; ///< band type run end points
- INTFLOAT sf[120]; ///< scalefactors
- int sf_idx[128]; ///< scalefactor indices (used by encoder)
- uint8_t zeroes[128]; ///< band is not coded (used by encoder)
- uint8_t can_pns[128]; ///< band is allowed to PNS (informative)
- float is_ener[128]; ///< Intensity stereo pos (used by encoder)
- float pns_ener[128]; ///< Noise energy values (used by encoder)
- DECLARE_ALIGNED(32, INTFLOAT, pcoeffs)[1024]; ///< coefficients for IMDCT, pristine
- DECLARE_ALIGNED(32, INTFLOAT, coeffs)[1024]; ///< coefficients for IMDCT, maybe processed
- DECLARE_ALIGNED(32, INTFLOAT, saved)[1536]; ///< overlap
- DECLARE_ALIGNED(32, INTFLOAT, ret_buf)[2048]; ///< PCM output buffer
- DECLARE_ALIGNED(16, INTFLOAT, ltp_state)[3072]; ///< time signal for LTP
- DECLARE_ALIGNED(32, AAC_FLOAT, lcoeffs)[1024]; ///< MDCT of LTP coefficients (used by encoder)
- DECLARE_ALIGNED(32, AAC_FLOAT, prcoeffs)[1024]; ///< Main prediction coefs (used by encoder)
- PredictorState predictor_state[MAX_PREDICTORS];
- INTFLOAT *ret; ///< PCM output
-} SingleChannelElement;
-
-/**
- * channel element - generic struct for SCE/CPE/CCE/LFE
- */
-typedef struct ChannelElement {
- int present;
- // 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)
- uint8_t is_mode; ///< Set if any bands have been encoded using intensity stereo (used by encoder)
- uint8_t ms_mask[128]; ///< Set if mid/side stereo is used for each scalefactor window band
- uint8_t is_mask[128]; ///< Set if intensity stereo is used (used by encoder)
- // shared
- SingleChannelElement ch[2];
- // CCE specific
- ChannelCoupling coup;
- SpectralBandReplication sbr;
-} ChannelElement;
-
#endif /* AVCODEC_AAC_H */
diff --git a/libavcodec/aacdec.h b/libavcodec/aacdec.h
index 37a318659e..e23310b5b1 100644
--- a/libavcodec/aacdec.h
+++ b/libavcodec/aacdec.h
@@ -30,13 +30,18 @@
#ifndef AVCODEC_AACDEC_H
#define AVCODEC_AACDEC_H
+#include <stdint.h>
+
+#include "libavutil/channel_layout.h"
#include "libavutil/float_dsp.h"
#include "libavutil/fixed_dsp.h"
#include "libavutil/mem_internal.h"
#include "libavutil/tx.h"
#include "aac.h"
+#include "aac_defines.h"
#include "mpeg4audio.h"
+#include "sbr.h"
/**
* Output configuration status
@@ -54,6 +59,103 @@ enum AACOutputChannelOrder {
CHANNEL_ORDER_CODED,
};
+/**
+ * The point during decoding at which channel coupling is applied.
+ */
+enum CouplingPoint {
+ BEFORE_TNS,
+ BETWEEN_TNS_AND_IMDCT,
+ AFTER_IMDCT = 3,
+};
+
+/**
+ * Long Term Prediction
+ */
+typedef struct LongTermPrediction {
+ int8_t present;
+ int16_t lag;
+ INTFLOAT coef;
+ int8_t used[MAX_LTP_LONG_SFB];
+} LongTermPrediction;
+
+/**
+ * Individual Channel Stream
+ */
+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 sine window.
+ int num_window_groups;
+ uint8_t group_len[8];
+ LongTermPrediction ltp;
+ const uint16_t *swb_offset; ///< table of offsets to the lowest spectral coefficient of a scalefactor band, sfb, for a particular window
+ int num_swb; ///< number of scalefactor window bands
+ int num_windows;
+ int tns_max_bands;
+ int predictor_present;
+ int predictor_initialized;
+ int predictor_reset_group;
+ uint8_t prediction_used[41];
+ uint8_t window_clipping[8]; ///< set if a certain window is near clipping
+} IndividualChannelStream;
+
+/**
+ * Temporal Noise Shaping
+ */
+typedef struct TemporalNoiseShaping {
+ int present;
+ int n_filt[8];
+ int length[8][4];
+ int direction[8][4];
+ int order[8][4];
+ INTFLOAT coef[8][4][TNS_MAX_ORDER];
+} TemporalNoiseShaping;
+
+/**
+ * coupling parameters
+ */
+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.
+ int id_select[8]; ///< element id
+ int ch_select[8]; /**< [0] shared list of gains; [1] list of gains for right channel;
+ * [2] list of gains for left channel; [3] lists of gains for both channels
+ */
+ INTFLOAT gain[16][120];
+} ChannelCoupling;
+
+/**
+ * Single Channel Element - used for both SCE and LFE elements.
+ */
+typedef struct SingleChannelElement {
+ IndividualChannelStream ics;
+ TemporalNoiseShaping tns;
+ enum BandType band_type[128]; ///< band types
+ int band_type_run_end[120]; ///< band type run end points
+ INTFLOAT sf[120]; ///< scalefactors
+ DECLARE_ALIGNED(32, INTFLOAT, coeffs)[1024]; ///< coefficients for IMDCT, maybe processed
+ DECLARE_ALIGNED(32, INTFLOAT, saved)[1536]; ///< overlap
+ DECLARE_ALIGNED(32, INTFLOAT, ret_buf)[2048]; ///< PCM output buffer
+ DECLARE_ALIGNED(16, INTFLOAT, ltp_state)[3072]; ///< time signal for LTP
+ PredictorState predictor_state[MAX_PREDICTORS];
+ INTFLOAT *ret; ///< PCM output
+} SingleChannelElement;
+
+/**
+ * channel element - generic struct for SCE/CPE/CCE/LFE
+ */
+typedef struct ChannelElement {
+ int present;
+ // CPE specific
+ uint8_t ms_mask[128]; ///< Set if mid/side stereo is used for each scalefactor window band
+ // shared
+ SingleChannelElement ch[2];
+ // CCE specific
+ ChannelCoupling coup;
+ SpectralBandReplication sbr;
+} ChannelElement;
+
typedef struct OutputConfiguration {
MPEG4AudioConfig m4ac;
uint8_t layout_map[MAX_ELEM_ID*4][3];
diff --git a/libavcodec/aacenc.h b/libavcodec/aacenc.h
index 18b424736d..752f1c26b2 100644
--- a/libavcodec/aacenc.h
+++ b/libavcodec/aacenc.h
@@ -22,9 +22,12 @@
#ifndef AVCODEC_AACENC_H
#define AVCODEC_AACENC_H
+#include <stdint.h>
+
#include "libavutil/channel_layout.h"
#include "libavutil/float_dsp.h"
#include "libavutil/mem_internal.h"
+#include "libavutil/tx.h"
#include "avcodec.h"
#include "put_bits.h"
@@ -35,6 +38,8 @@
#include "lpc.h"
+#define CLIP_AVOIDANCE_FACTOR 0.95f
+
typedef enum AACCoder {
AAC_CODER_ANMR = 0,
AAC_CODER_TWOLOOP,
@@ -54,6 +59,90 @@ typedef struct AACEncOptions {
int intensity_stereo;
} AACEncOptions;
+/**
+ * Long Term Prediction
+ */
+typedef struct LongTermPrediction {
+ int8_t present;
+ int16_t lag;
+ int coef_idx;
+ float coef;
+ int8_t used[MAX_LTP_LONG_SFB];
+} LongTermPrediction;
+
+/**
+ * Individual Channel Stream
+ */
+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 sine window.
+ uint8_t group_len[8];
+ LongTermPrediction ltp;
+ const uint16_t *swb_offset; ///< table of offsets to the lowest spectral coefficient of a scalefactor band, sfb, for a particular window
+ const uint8_t *swb_sizes; ///< table of scalefactor band sizes for a particular window
+ int num_swb; ///< number of scalefactor window bands
+ int num_windows;
+ int tns_max_bands;
+ int predictor_present;
+ int predictor_initialized;
+ int predictor_reset_group;
+ int predictor_reset_count[31]; ///< used to count prediction resets
+ uint8_t prediction_used[41];
+ uint8_t window_clipping[8]; ///< set if a certain window is near clipping
+ float clip_avoidance_factor; ///< set if any window is near clipping to the necessary atennuation factor to avoid it
+} IndividualChannelStream;
+
+/**
+ * Temporal Noise Shaping
+ */
+typedef struct TemporalNoiseShaping {
+ int present;
+ int n_filt[8];
+ int length[8][4];
+ int direction[8][4];
+ int order[8][4];
+ int coef_idx[8][4][TNS_MAX_ORDER];
+ float coef[8][4][TNS_MAX_ORDER];
+} TemporalNoiseShaping;
+
+/**
+ * Single Channel Element - used for both SCE and LFE elements.
+ */
+typedef struct SingleChannelElement {
+ IndividualChannelStream ics;
+ TemporalNoiseShaping tns;
+ Pulse pulse;
+ enum BandType band_type[128]; ///< band types
+ enum BandType band_alt[128]; ///< alternative band type
+ int sf_idx[128]; ///< scalefactor indices
+ uint8_t zeroes[128]; ///< band is not coded
+ uint8_t can_pns[128]; ///< band is allowed to PNS (informative)
+ float is_ener[128]; ///< Intensity stereo pos
+ float pns_ener[128]; ///< Noise energy values
+ DECLARE_ALIGNED(32, float, pcoeffs)[1024]; ///< coefficients for IMDCT, pristine
+ DECLARE_ALIGNED(32, float, coeffs)[1024]; ///< coefficients for IMDCT, maybe processed
+ DECLARE_ALIGNED(32, float, ret_buf)[2048]; ///< PCM output buffer
+ DECLARE_ALIGNED(16, float, ltp_state)[3072]; ///< time signal for LTP
+ DECLARE_ALIGNED(32, float, lcoeffs)[1024]; ///< MDCT of LTP coefficients
+ DECLARE_ALIGNED(32, float, prcoeffs)[1024]; ///< Main prediction coefs
+ PredictorState predictor_state[MAX_PREDICTORS];
+} SingleChannelElement;
+
+/**
+ * channel element - generic struct for SCE/CPE/CCE/LFE
+ */
+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
+ uint8_t is_mode; ///< Set if any bands have been encoded using intensity stereo
+ uint8_t ms_mask[128]; ///< Set if mid/side stereo is used for each scalefactor window band
+ uint8_t is_mask[128]; ///< Set if intensity stereo is used
+ // shared
+ SingleChannelElement ch[2];
+} ChannelElement;
+
struct AACEncContext;
typedef struct AACCoefficientsEncoder {
diff --git a/libavcodec/aacenc_utils.h b/libavcodec/aacenc_utils.h
index bef4c103f3..ef2218e036 100644
--- a/libavcodec/aacenc_utils.h
+++ b/libavcodec/aacenc_utils.h
@@ -29,7 +29,7 @@
#define AVCODEC_AACENC_UTILS_H
#include "libavutil/ffmath.h"
-#include "aac.h"
+#include "aacenc.h"
#include "aacenctab.h"
#include "aactab.h"
diff --git a/libavcodec/aacenctab.h b/libavcodec/aacenctab.h
index 20e47ea900..f2d6f597bc 100644
--- a/libavcodec/aacenctab.h
+++ b/libavcodec/aacenctab.h
@@ -30,6 +30,7 @@
#include "libavutil/channel_layout.h"
#include "aac.h"
+#include "defs.h"
/** Total number of usable codebooks **/
#define CB_TOT 12
diff --git a/libavcodec/sbrdsp_template.c b/libavcodec/sbrdsp_template.c
index 79cd2156d9..c1e583ea56 100644
--- a/libavcodec/sbrdsp_template.c
+++ b/libavcodec/sbrdsp_template.c
@@ -20,7 +20,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "config.h"
#include "libavutil/attributes_internal.h"
+#include "libavutil/mem_internal.h"
static void sbr_sum64x5_c(INTFLOAT *z)
{
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 10+ messages in thread