From patchwork Thu Jan 28 16:26:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 25235 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 2368444BC03 for ; Thu, 28 Jan 2021 18:27:18 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E27C368A29C; Thu, 28 Jan 2021 18:27:17 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5F910689CFA for ; Thu, 28 Jan 2021 18:27:11 +0200 (EET) Received: by mail-ed1-f48.google.com with SMTP id d22so7318108edy.1 for ; Thu, 28 Jan 2021 08:27:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=V/hPKbyyDYMZy29tz8zeCKdSsR5xDP5MwxZGtBM/6z4=; b=CN83s5M84EOE/BGKuZOlzQ7an9IfKlBhZoh2Y+Kd3bvNw5QdISQtUewVG6bZV6qLaY 2cMjTYLw0Ght/IHPmdU4wXuJiPcBhgIDSEGj2AiIEBJ0CE9UbSQ7ZXWTMwRtisRzgTY0 ijZ8t6tj7bRmplEWF4eRaZWxauAvJQQpkKdQ4QtwrYmCD9INUmDJFCTmtSTLkUhRxcl6 IUHq1hyR3inXFSxJMkFVStkTTBSXJ3QCh3QIFSThD7uGFczqP4+7IYeo+QimZYptkUWK +D3Nf8HS2qMffbJKMXoa7P5PL7/KHZYHoDleCAD6lOtxuO6hHbDmCMjz+O/JmtxxxDLV BrHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=V/hPKbyyDYMZy29tz8zeCKdSsR5xDP5MwxZGtBM/6z4=; b=QUkm0mG82CgAZc6c5EeF0dvCwJNcGJeJotp2o3nnqKKOeTQI+aC3YGSmkyj+JD5yW1 miLmCfDn/mDoVx1s0e2F8+H/XaJXCfo9cRwwAZ/Rx7KuB3RYGlWzmKKWSueWHW68BguJ XQzhSflxuNsbEXyZkOmYrExNS5Rp6wogakrDnQXlFZv6uZ6QNW+ok07ge+EC50DaZCkl pWeWOpVzNo7OgVRMqt5juSn/kX3Ijsj/HgG14RpPGU3jo50lelvklS2ElOb5GOVFEdH5 VxQXIrnUp7d+f30ASVgngIJp3ZsMaf0bOn3O9cMRjjGqllZfKOdRNPAr/eOPTP+7LvAZ OSkg== X-Gm-Message-State: AOAM53361XEZIgWEklqXvEv1FowO/tqawk08evxxcHO74xHOeeZIqBZh BYZ8UDaRCHns2DupowS7hqTNJi6GMy8= X-Google-Smtp-Source: ABdhPJxmdItziU8eYb/1jpb+AjW5QnxBJq4qNEpK03inQ5Q2TRHmGbfnm0nDAWb6BohTg6tbkWntRQ== X-Received: by 2002:a50:ee94:: with SMTP id f20mr376046edr.222.1611851230493; Thu, 28 Jan 2021 08:27:10 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id dj25sm3185288edb.5.2021.01.28.08.27.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jan 2021 08:27:08 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 Jan 2021 17:26:41 +0100 Message-Id: <20210128162646.2811269-1-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/6] avcodec/aac_defines: Make macro more general X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" The floating point AAC decoder shares lots of stuff (mainly tables) with other components; this is not so much true for the fixed point AAC decoder: There are tables for which the fixed point decoder is the only user whereas the floating point analogue is shared with other components. This can be exploited to make the fixed point tables static and because this has only been done for several KBD tables, the macro is designed for them. This commit makes it more general. Signed-off-by: Andreas Rheinhardt --- libavcodec/aac_defines.h | 4 ++-- libavcodec/aacdec_fixed.c | 4 ++-- libavcodec/aacdec_template.c | 22 +++++++++++----------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/libavcodec/aac_defines.h b/libavcodec/aac_defines.h index 74ac011785..e94475ac54 100644 --- a/libavcodec/aac_defines.h +++ b/libavcodec/aac_defines.h @@ -34,7 +34,7 @@ #define AAC_RENAME(x) x ## _fixed #define AAC_RENAME_32(x) x ## _fixed_32 -#define AAC_KBD_RENAME(x) aac_ ## x ## _fixed +#define AAC_RENAME2(x) x ## _fixed typedef int INTFLOAT; typedef unsigned UINTFLOAT; ///< Equivalent to INTFLOAT, Used as temporal cast to avoid undefined sign overflow operations. typedef int64_t INT64FLOAT; @@ -84,7 +84,7 @@ typedef int AAC_SIGNE; #define AAC_RENAME(x) x #define AAC_RENAME_32(x) x -#define AAC_KBD_RENAME(x) ff_aac_ ## x +#define AAC_RENAME2(x) ff_ ## x typedef float INTFLOAT; typedef float UINTFLOAT; typedef float INT64FLOAT; diff --git a/libavcodec/aacdec_fixed.c b/libavcodec/aacdec_fixed.c index 4d82b7b1aa..e555dac362 100644 --- a/libavcodec/aacdec_fixed.c +++ b/libavcodec/aacdec_fixed.c @@ -86,8 +86,8 @@ #include #include -DECLARE_ALIGNED(32, static int, AAC_KBD_RENAME(kbd_long_1024))[1024]; -DECLARE_ALIGNED(32, static int, AAC_KBD_RENAME(kbd_short_128))[128]; +DECLARE_ALIGNED(32, static int, AAC_RENAME2(aac_kbd_long_1024))[1024]; +DECLARE_ALIGNED(32, static int, AAC_RENAME2(aac_kbd_short_128))[128]; static av_always_inline void reset_predict_state(PredictorState *ps) { diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index fbe3074071..ea39f547b0 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -1237,8 +1237,8 @@ static av_cold void aac_static_table_init(void) AAC_RENAME(ff_sine_window_init)(AAC_RENAME(sine_120), 120); ff_aac_float_common_init(); #else - AAC_RENAME(ff_kbd_window_init)(AAC_KBD_RENAME(kbd_long_1024), 4.0, 1024); - AAC_RENAME(ff_kbd_window_init)(AAC_KBD_RENAME(kbd_short_128), 6.0, 128); + AAC_RENAME(ff_kbd_window_init)(AAC_RENAME2(aac_kbd_long_1024), 4.0, 1024); + AAC_RENAME(ff_kbd_window_init)(AAC_RENAME2(aac_kbd_short_128), 6.0, 128); AAC_RENAME(ff_init_ff_sine_windows)(10); AAC_RENAME(ff_init_ff_sine_windows)( 7); #endif @@ -2644,10 +2644,10 @@ static void apply_tns(INTFLOAT coef_param[1024], TemporalNoiseShaping *tns, static void windowing_and_mdct_ltp(AACContext *ac, INTFLOAT *out, INTFLOAT *in, IndividualChannelStream *ics) { - const INTFLOAT *lwindow = ics->use_kb_window[0] ? AAC_KBD_RENAME(kbd_long_1024) : AAC_RENAME(ff_sine_1024); - const INTFLOAT *swindow = ics->use_kb_window[0] ? AAC_KBD_RENAME(kbd_short_128) : AAC_RENAME(ff_sine_128); - const INTFLOAT *lwindow_prev = ics->use_kb_window[1] ? AAC_KBD_RENAME(kbd_long_1024) : AAC_RENAME(ff_sine_1024); - const INTFLOAT *swindow_prev = ics->use_kb_window[1] ? AAC_KBD_RENAME(kbd_short_128) : AAC_RENAME(ff_sine_128); + const INTFLOAT *lwindow = ics->use_kb_window[0] ? AAC_RENAME2(aac_kbd_long_1024) : AAC_RENAME(ff_sine_1024); + const INTFLOAT *swindow = ics->use_kb_window[0] ? AAC_RENAME2(aac_kbd_short_128) : AAC_RENAME(ff_sine_128); + const INTFLOAT *lwindow_prev = ics->use_kb_window[1] ? AAC_RENAME2(aac_kbd_long_1024) : AAC_RENAME(ff_sine_1024); + const INTFLOAT *swindow_prev = ics->use_kb_window[1] ? AAC_RENAME2(aac_kbd_short_128) : AAC_RENAME(ff_sine_128); if (ics->window_sequence[0] != LONG_STOP_SEQUENCE) { ac->fdsp->vector_fmul(in, in, lwindow_prev, 1024); @@ -2704,8 +2704,8 @@ static void update_ltp(AACContext *ac, SingleChannelElement *sce) IndividualChannelStream *ics = &sce->ics; INTFLOAT *saved = sce->saved; INTFLOAT *saved_ltp = sce->coeffs; - const INTFLOAT *lwindow = ics->use_kb_window[0] ? AAC_KBD_RENAME(kbd_long_1024) : AAC_RENAME(ff_sine_1024); - const INTFLOAT *swindow = ics->use_kb_window[0] ? AAC_KBD_RENAME(kbd_short_128) : AAC_RENAME(ff_sine_128); + const INTFLOAT *lwindow = ics->use_kb_window[0] ? AAC_RENAME2(aac_kbd_long_1024) : AAC_RENAME(ff_sine_1024); + const INTFLOAT *swindow = ics->use_kb_window[0] ? AAC_RENAME2(aac_kbd_short_128) : AAC_RENAME(ff_sine_128); int i; if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { @@ -2743,9 +2743,9 @@ static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce) INTFLOAT *in = sce->coeffs; INTFLOAT *out = sce->ret; INTFLOAT *saved = sce->saved; - const INTFLOAT *swindow = ics->use_kb_window[0] ? AAC_KBD_RENAME(kbd_short_128) : AAC_RENAME(ff_sine_128); - const INTFLOAT *lwindow_prev = ics->use_kb_window[1] ? AAC_KBD_RENAME(kbd_long_1024) : AAC_RENAME(ff_sine_1024); - const INTFLOAT *swindow_prev = ics->use_kb_window[1] ? AAC_KBD_RENAME(kbd_short_128) : AAC_RENAME(ff_sine_128); + const INTFLOAT *swindow = ics->use_kb_window[0] ? AAC_RENAME2(aac_kbd_short_128) : AAC_RENAME(ff_sine_128); + const INTFLOAT *lwindow_prev = ics->use_kb_window[1] ? AAC_RENAME2(aac_kbd_long_1024) : AAC_RENAME(ff_sine_1024); + const INTFLOAT *swindow_prev = ics->use_kb_window[1] ? AAC_RENAME2(aac_kbd_short_128) : AAC_RENAME(ff_sine_128); INTFLOAT *buf = ac->buf_mdct; INTFLOAT *temp = ac->temp; int i;