From 25269b997de12a1731daa44c6c54c6fb61e890de Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Date: Wed, 2 Apr 2025 11:35:55 +0200 Subject: [PATCH 17/23] avcodec/aacenc_is: Make ff_aac_is_encoding_err() static Possible since 9b11fefb88c770b9c1d4d4583c61c6abde6c033c. Also remove a now always-zero parameter. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/aacenc_is.c | 31 +++++++++++++++++++++---------- libavcodec/aacenc_is.h | 16 ---------------- 2 files changed, 21 insertions(+), 26 deletions(-) diff --git a/libavcodec/aacenc_is.c b/libavcodec/aacenc_is.c index 4943b6450c..4e711382dc 100644 --- a/libavcodec/aacenc_is.c +++ b/libavcodec/aacenc_is.c @@ -30,16 +30,27 @@ #include "aacenc_is.h" #include "aacenc_quantization.h" -struct AACISError ff_aac_is_encoding_err(AACEncContext *s, ChannelElement *cpe, - int start, int w, int g, float ener0, - float ener1, float ener01, - int use_pcoeffs, int phase) +/** Frequency in Hz for lower limit of intensity stereo **/ +#define INT_STEREO_LOW_LIMIT 6100 + +struct AACISError { + int pass; /* 1 if dist2 <= dist1 */ + int phase; /* -1 or +1 */ + float error; /* fabs(dist1 - dist2) */ + float dist1; /* From original coeffs */ + float dist2; /* From IS'd coeffs */ + float ener01; +}; + +static struct AACISError aac_is_encoding_err(AACEncContext *s, ChannelElement *cpe, + int start, int w, int g, float ener0, + float ener1, float ener01, int phase) { int i, w2; SingleChannelElement *sce0 = &cpe->ch[0]; SingleChannelElement *sce1 = &cpe->ch[1]; - float *L = use_pcoeffs ? sce0->pcoeffs : sce0->coeffs; - float *R = use_pcoeffs ? sce1->pcoeffs : sce1->coeffs; + float *L = sce0->coeffs; + float *R = sce1->coeffs; float *L34 = &s->scoefs[256*0], *R34 = &s->scoefs[256*1]; float *IS = &s->scoefs[256*2], *I34 = &s->scoefs[256*3]; float dist1 = 0.0f, dist2 = 0.0f; @@ -128,10 +139,10 @@ void ff_aac_search_for_is(AACEncContext *s, AVCodecContext *avctx, ChannelElemen ener01p += (coef0 - coef1)*(coef0 - coef1); } } - ph_err1 = ff_aac_is_encoding_err(s, cpe, start, w, g, - ener0, ener1, ener01p, 0, -1); - ph_err2 = ff_aac_is_encoding_err(s, cpe, start, w, g, - ener0, ener1, ener01, 0, +1); + ph_err1 = aac_is_encoding_err(s, cpe, start, w, g, + ener0, ener1, ener01p, -1); + ph_err2 = aac_is_encoding_err(s, cpe, start, w, g, + ener0, ener1, ener01, +1); best = (ph_err1.pass && ph_err1.error < ph_err2.error) ? &ph_err1 : &ph_err2; if (best->pass) { cpe->is_mask[w*16+g] = 1; diff --git a/libavcodec/aacenc_is.h b/libavcodec/aacenc_is.h index 269fd1a9c9..beaa70c790 100644 --- a/libavcodec/aacenc_is.h +++ b/libavcodec/aacenc_is.h @@ -30,22 +30,6 @@ #include "aacenc.h" -/** Frequency in Hz for lower limit of intensity stereo **/ -#define INT_STEREO_LOW_LIMIT 6100 - -struct AACISError { - int pass; /* 1 if dist2 <= dist1 */ - int phase; /* -1 or +1 */ - float error; /* fabs(dist1 - dist2) */ - float dist1; /* From original coeffs */ - float dist2; /* From IS'd coeffs */ - float ener01; -}; - -struct AACISError ff_aac_is_encoding_err(AACEncContext *s, ChannelElement *cpe, - int start, int w, int g, float ener0, - float ener1, float ener01, - int use_pcoeffs, int phase); void ff_aac_search_for_is(AACEncContext *s, AVCodecContext *avctx, ChannelElement *cpe); #endif /* AVCODEC_AACENC_IS_H */ -- 2.45.2