From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 65B5349B6C for ; Sun, 3 Mar 2024 21:45:04 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5970868D3DC; Sun, 3 Mar 2024 23:45:02 +0200 (EET) Received: from w4.tutanota.de (w4.tutanota.de [81.3.6.165]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 40FC468D3B1 for ; Sun, 3 Mar 2024 23:44:56 +0200 (EET) Received: from tutadb.w10.tutanota.de (unknown [192.168.1.10]) by w4.tutanota.de (Postfix) with ESMTP id D5C491060122 for ; Sun, 3 Mar 2024 21:44:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1709502295; s=s1; d=lynne.ee; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:References:Sender; bh=eWFVO2ycCHesqoxTWuNP/LiXf7nfdJIyQZAnI4hjx0I=; b=nFTK0E8Yl0lFwy+0tfpFAYFVL7wGeKH890JmJMX1K0LhfMDWVO61AzwiLoErGf5w xPTInbSe+pXly/VSzgizgQvYFTg50FMnLSgWHFps3OIi3rSUXTuUUcT/yytv27L7dFw uhTmqSes9nRgH/tBN50hpeMHmClxh9FGX7XoPM2IhyqHjNVjdKOarkYwi760ZeHLbm8 4fU4Y0WhfG5eOcLsEXsQmCsXtJJHarTJAYtBOPjl6FWNpIUwogBM0DRyeRit27h25AL NjHmJIF6vcjExavQ/If388eEXvfazJ3IxS9uAUOMHS5oq5ITv5cmXTHnUZMcZeA5AJ4 AQ9YKv4i9g== Date: Sun, 3 Mar 2024 22:44:55 +0100 (CET) From: Lynne To: FFmpeg development discussions and patches Message-ID: In-Reply-To: References: MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 1/4] avcodec/lpc: Don't use AAC defines directly X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Mar 3, 2024, 19:43 by andreas.rheinhardt@outlook.com: > Andreas Rheinhardt: > >> It leads to defines for the AAC decoder being included >> outside of the AAC decoder. >> >> Signed-off-by: Andreas Rheinhardt >> --- >> libavcodec/aac_defines.h | 11 +++++++++-- >> libavcodec/aacdec_fixed.c | 2 +- >> libavcodec/aacdec_template.c | 2 +- >> libavcodec/lpc.h | 27 ++++++++++++++++++--------- >> 4 files changed, 29 insertions(+), 13 deletions(-) >> >> diff --git a/libavcodec/aac_defines.h b/libavcodec/aac_defines.h >> index 59528f1f0d..8765939731 100644 >> --- a/libavcodec/aac_defines.h >> +++ b/libavcodec/aac_defines.h >> @@ -71,7 +71,15 @@ typedef int AAC_SIGNE; >> ((int64_t)(y) * (z)) + \ >> 0x40000000) >> 31) >> #define AAC_HALF_SUM(x, y) (((x) >> 1) + ((y) >> 1)) >> -#define AAC_SRA_R(x, y) (int)(((x) + (1 << ((y) - 1))) >> (y)) >> + >> +#ifdef LPC_USE_FIXED >> +#error aac_defines.h must be included before lpc.h for fixed point decoder >> +#endif >> + >> +#define LPC_USE_FIXED 1 >> +#define LPC_MUL26(x, y) AAC_MUL26((x), (y)) >> +#define LPC_FIXR(x) FIXR(x) >> +#define LPC_SRA_R(x, y) (int)(((x) + (1 << ((y) - 1))) >> (y)) >> >> #else >> >> @@ -103,7 +111,6 @@ typedef unsigned AAC_SIGNE; >> (c) * (d) - (e) * (f)) >> #define AAC_MSUB31_V3(x, y, z) ((x) - (y)) * (z) >> #define AAC_HALF_SUM(x, y) ((x) + (y)) * 0.5f >> -#define AAC_SRA_R(x, y) (x) >> >> #endif /* USE_FIXED */ >> >> diff --git a/libavcodec/aacdec_fixed.c b/libavcodec/aacdec_fixed.c >> index 57d3fc8bab..08343bf157 100644 >> --- a/libavcodec/aacdec_fixed.c >> +++ b/libavcodec/aacdec_fixed.c >> @@ -66,7 +66,6 @@ >> #include "avcodec.h" >> #include "codec_internal.h" >> #include "get_bits.h" >> -#include "lpc.h" >> #include "kbdwin.h" >> #include "sinewin_fixed_tablegen.h" >> >> @@ -76,6 +75,7 @@ >> #include "aacdectab.h" >> #include "adts_header.h" >> #include "cbrt_data.h" >> +#include "lpc.h" >> #include "sbr.h" >> #include "aacsbr.h" >> #include "mpeg4audio.h" >> diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c >> index 72c6e206a6..fb3a954aad 100644 >> --- a/libavcodec/aacdec_template.c >> +++ b/libavcodec/aacdec_template.c >> @@ -2516,7 +2516,7 @@ static void apply_tns(INTFLOAT coef_param[1024], TemporalNoiseShaping *tns, >> continue; >> >> // tns_decode_coef >> - AAC_RENAME(compute_lpc_coefs)(tns->coef[w][filt], order, lpc, 0, 0, 0); >> + compute_lpc_coefs(tns->coef[w][filt], order, lpc, 0, 0, 0); >> >> start = ics->swb_offset[FFMIN(bottom, mmm)]; >> end = ics->swb_offset[FFMIN( top, mmm)]; >> diff --git a/libavcodec/lpc.h b/libavcodec/lpc.h >> index 0200baea5c..907fab7508 100644 >> --- a/libavcodec/lpc.h >> +++ b/libavcodec/lpc.h >> @@ -26,7 +26,6 @@ >> #include >> #include "libavutil/avassert.h" >> #include "libavutil/lls.h" >> -#include "aac_defines.h" >> >> #define ORDER_METHOD_EST 0 >> #define ORDER_METHOD_2LEVEL 1 >> @@ -117,10 +116,20 @@ void ff_lpc_init_x86(LPCContext *s); >> */ >> void ff_lpc_end(LPCContext *s); >> >> -#if USE_FIXED >> +#ifndef LPC_USE_FIXED >> +#define LPC_USE_FIXED 0 >> +#endif >> + >> +#if LPC_USE_FIXED >> typedef int LPC_TYPE; >> typedef unsigned LPC_TYPE_U; >> #else >> +#ifndef LPC_SRA_R >> +#define LPC_SRA_R(x, y) (x) >> +#define LPC_MUL26(x, y) ((x) * (y)) >> +#define LPC_FIXR(x) ((float)(x)) >> +#endif >> + >> #ifdef LPC_USE_DOUBLE >> typedef double LPC_TYPE; >> typedef double LPC_TYPE_U; >> @@ -145,7 +154,7 @@ static inline void compute_ref_coefs(const LPC_TYPE *autoc, int max_order, >> gen0[i] = gen1[i] = autoc[i + 1]; >> >> err = autoc[0]; >> - ref[0] = -gen1[0] / ((USE_FIXED || err) ? err : 1); >> + ref[0] = -gen1[0] / ((LPC_USE_FIXED || err) ? err : 1); >> err += gen1[0] * ref[0]; >> if (error) >> error[0] = err; >> @@ -154,7 +163,7 @@ static inline void compute_ref_coefs(const LPC_TYPE *autoc, int max_order, >> gen1[j] = gen1[j + 1] + ref[i - 1] * gen0[j]; >> gen0[j] = gen1[j + 1] * ref[i - 1] + gen0[j]; >> } >> - ref[i] = -gen1[0] / ((USE_FIXED || err) ? err : 1); >> + ref[i] = -gen1[0] / ((LPC_USE_FIXED || err) ? err : 1); >> err += gen1[0] * ref[i]; >> if (error) >> error[i] = err; >> @@ -165,7 +174,7 @@ static inline void compute_ref_coefs(const LPC_TYPE *autoc, int max_order, >> * Levinson-Durbin recursion. >> * Produce LPC coefficients from autocorrelation data. >> */ >> -static inline int AAC_RENAME(compute_lpc_coefs)(const LPC_TYPE *autoc, int max_order, >> +static inline int compute_lpc_coefs(const LPC_TYPE *autoc, int max_order, >> LPC_TYPE *lpc, int lpc_stride, int fail, >> int normalize) >> { >> @@ -182,7 +191,7 @@ static inline int AAC_RENAME(compute_lpc_coefs)(const LPC_TYPE *autoc, int max_o >> return -1; >> >> for(i=0; i> - LPC_TYPE r = AAC_SRA_R(-autoc[i], 5); >> + LPC_TYPE r = LPC_SRA_R(-autoc[i], 5); >> >> if (normalize) { >> for(j=0; j> @@ -190,7 +199,7 @@ static inline int AAC_RENAME(compute_lpc_coefs)(const LPC_TYPE *autoc, int max_o >> >> if (err) >> r /= err; >> - err *= FIXR(1.0) - (r * r); >> + err *= LPC_FIXR(1.0) - (r * r); >> } >> >> lpc[i] = r; >> @@ -198,8 +207,8 @@ static inline int AAC_RENAME(compute_lpc_coefs)(const LPC_TYPE *autoc, int max_o >> for(j=0; j < (i+1)>>1; j++) { >> LPC_TYPE f = lpc_last[ j]; >> LPC_TYPE b = lpc_last[i-1-j]; >> - lpc[ j] = f + (LPC_TYPE_U)AAC_MUL26(r, b); >> - lpc[i-1-j] = b + (LPC_TYPE_U)AAC_MUL26(r, f); >> + lpc[ j] = f + (LPC_TYPE_U)LPC_MUL26(r, b); >> + lpc[i-1-j] = b + (LPC_TYPE_U)LPC_MUL26(r, f); >> } >> >> if (fail && err < 0) >> > > Will apply this patchset tomorrow unless there are objections. > Patchset LGTM Thanks _______________________________________________ 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".