From patchwork Mon Nov 23 19:37:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 23986 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 A740244A49B for ; Mon, 23 Nov 2020 21:38:17 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9062868BB9B; Mon, 23 Nov 2020 21:38:17 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7192368BB6C for ; Mon, 23 Nov 2020 21:38:09 +0200 (EET) Received: by mail-wm1-f67.google.com with SMTP id h21so394824wmb.2 for ; Mon, 23 Nov 2020 11:38:09 -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:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=8T6iB3EbyhLUSepVBTaTji7VNoXGzfoMwHj+6SdDHvw=; b=RByrn2DIiukvrtu3bMtvZMAA/sIFwbmyqiAiN+gLzWwkkDqRc86+Dj2fQTxyPZunRO K91yjClQU1ezihhld1j6PM3abaza9tF+NCjwygY6fSHj0YkWDn4Ulcd3VEAfy1x18/iF qJCrg0XuuAn0SZHPyPYzj8Hf80nk9EH26Pf56541a4XkC3qmILNeOYiOv1t4hbslprx1 RtcPIQn4DOVPJa4vzsZcIjl+429enZfDKZtrCLl+rqgwyTNT0Y+3LVxU7R5RU/DXLQ39 hp3Fz9JVJXa9qbFmFeYXIiYv8jxE0JOHKsFvRrbTpMBC9jYUl5zTPOdtKD0KOQlxKNqt ubvw== 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:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=8T6iB3EbyhLUSepVBTaTji7VNoXGzfoMwHj+6SdDHvw=; b=D6nyNxaUOFXYHvPDRpOZIKfvq17WRhuiIgMPOWwO/W5gBHLKu/TwFIPMMvSk+q1Bz/ PEJj6yH57JHZn17xRh/LHHrfUisLIxbzpRl/sqDX/hFq55OQrRpo82rHsrdzFgSp/4bR 2WNKvFArNozXKOgN7ylK05ER+lYWb4RMBjCV3TmzF7TE2QrpJP1ZtfnJqj5Rv4TQueya rbZfhei/2MxNHNiSJZK6tp/4fdWV4HO7cUdqrCOnneOLXDwzco3Hebq2obOd6qgQqT8r bj/Lj/jKhUAjMO92xd1xknAYiw5JxfSYN3gc4WvJn+oZA81+VA2ETOFZJZKZ5jaywNRb dJpQ== X-Gm-Message-State: AOAM5304V4XGvlFg0yi3fe9x3Y1YSbAOsHOOu7Nt/1lOSauxR3ji06aq FB1bQ32BStq+tGCMA0z5vQA39ZKUnQgVTQ== X-Google-Smtp-Source: ABdhPJz+RywEKlK5VmWNE4vfP0trDCCIkbIVGIHr92Ge5QNkGdAvWk6fed8qPjJdO35CMHeyXjdkgw== X-Received: by 2002:a7b:cc13:: with SMTP id f19mr493628wmh.44.1606160288605; Mon, 23 Nov 2020 11:38:08 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id e6sm564086wme.27.2020.11.23.11.38.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Nov 2020 11:38:08 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 23 Nov 2020 20:37:14 +0100 Message-Id: <20201123193739.1249300-4-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201120072116.818090-1-andreas.rheinhardt@gmail.com> References: <20201120072116.818090-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 166/191] avcodec/aacdec, sinewin: Move 120 and 960 point sine tables to aacdec 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 is the only user of these tables, so it makes sense to move them there. Furthermore, initializing the ordinary power-of-two sinetables is currently not thread-safe and if the 120- and 960-point sinetables were not moved, one would have to choose whether to guard initializing these two tables with their own AVOnces or not. Doing so would add unnecessary AVOnces as the AAC decoder already guards initializing its static data by an AVOnce; not doing so would be fragile if a second user of these tables were to be added. Signed-off-by: Andreas Rheinhardt --- libavcodec/aacdec.c | 3 +++ libavcodec/aacdec_template.c | 10 +++++----- libavcodec/sinewin.h | 5 ----- libavcodec/sinewin_tablegen.h | 4 ---- libavcodec/sinewin_tablegen_template.c | 2 -- 5 files changed, 8 insertions(+), 16 deletions(-) diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index d17852d8ba..fd4805f6eb 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -69,6 +69,9 @@ # include "mips/aacdec_mips.h" #endif +DECLARE_ALIGNED(32, static INTFLOAT, AAC_RENAME(sine_120))[120]; +DECLARE_ALIGNED(32, static INTFLOAT, AAC_RENAME(sine_960))[960]; + static av_always_inline void reset_predict_state(PredictorState *ps) { ps->r0 = 0.0f; diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index 186175e6e6..e6fe913a27 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -1235,8 +1235,8 @@ static av_cold void aac_static_table_init(void) #if !USE_FIXED AAC_RENAME(ff_kbd_window_init)(AAC_RENAME(ff_aac_kbd_long_960), 4.0, 960); AAC_RENAME(ff_kbd_window_init)(AAC_RENAME(ff_aac_kbd_short_120), 6.0, 120); - AAC_RENAME(ff_sine_window_init)(AAC_RENAME(ff_sine_960), 960); - AAC_RENAME(ff_sine_window_init)(AAC_RENAME(ff_sine_120), 120); + AAC_RENAME(ff_sine_window_init)(AAC_RENAME(sine_960), 960); + AAC_RENAME(ff_sine_window_init)(AAC_RENAME(sine_120), 120); #endif AAC_RENAME(ff_init_ff_sine_windows)(10); AAC_RENAME(ff_init_ff_sine_windows)( 9); @@ -2810,9 +2810,9 @@ static void imdct_and_windowing_960(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_RENAME(ff_aac_kbd_short_120) : AAC_RENAME(ff_sine_120); - const INTFLOAT *lwindow_prev = ics->use_kb_window[1] ? AAC_RENAME(ff_aac_kbd_long_960) : AAC_RENAME(ff_sine_960); - const INTFLOAT *swindow_prev = ics->use_kb_window[1] ? AAC_RENAME(ff_aac_kbd_short_120) : AAC_RENAME(ff_sine_120); + const INTFLOAT *swindow = ics->use_kb_window[0] ? AAC_RENAME(ff_aac_kbd_short_120) : AAC_RENAME(sine_120); + const INTFLOAT *lwindow_prev = ics->use_kb_window[1] ? AAC_RENAME(ff_aac_kbd_long_960) : AAC_RENAME(sine_960); + const INTFLOAT *swindow_prev = ics->use_kb_window[1] ? AAC_RENAME(ff_aac_kbd_short_120) : AAC_RENAME(sine_120); INTFLOAT *buf = ac->buf_mdct; INTFLOAT *temp = ac->temp; int i; diff --git a/libavcodec/sinewin.h b/libavcodec/sinewin.h index 329e9bb5be..7b64096a71 100644 --- a/libavcodec/sinewin.h +++ b/libavcodec/sinewin.h @@ -38,9 +38,6 @@ #define SINETABLE(size) \ SINETABLE_CONST DECLARE_ALIGNED(32, INTFLOAT, AAC_RENAME(ff_sine_##size))[size] -#define SINETABLE120960(size) \ - DECLARE_ALIGNED(32, INTFLOAT, AAC_RENAME(ff_sine_##size))[size] - /** * Generate a sine window. * @param window pointer to half window @@ -55,11 +52,9 @@ void AAC_RENAME(ff_init_ff_sine_windows)(int index); extern SINETABLE( 32); extern SINETABLE( 64); -extern SINETABLE120960(120); extern SINETABLE( 128); extern SINETABLE( 256); extern SINETABLE( 512); -extern SINETABLE120960(960); extern SINETABLE(1024); extern SINETABLE(2048); extern SINETABLE(4096); diff --git a/libavcodec/sinewin_tablegen.h b/libavcodec/sinewin_tablegen.h index 3c11cb6282..1959074189 100644 --- a/libavcodec/sinewin_tablegen.h +++ b/libavcodec/sinewin_tablegen.h @@ -31,10 +31,6 @@ #include "libavutil/attributes.h" #include "libavutil/common.h" -#if !USE_FIXED -SINETABLE120960(120); -SINETABLE120960(960); -#endif #if !CONFIG_HARDCODED_TABLES SINETABLE( 32); SINETABLE( 64); diff --git a/libavcodec/sinewin_tablegen_template.c b/libavcodec/sinewin_tablegen_template.c index b8eb407bd8..43ce1ba82e 100644 --- a/libavcodec/sinewin_tablegen_template.c +++ b/libavcodec/sinewin_tablegen_template.c @@ -33,8 +33,6 @@ #define SINETABLE_CONST #define SINETABLE(size) \ INTFLOAT AAC_RENAME(ff_sine_##size)[size] -#define SINETABLE120960(size) \ - INTFLOAT AAC_RENAME(ff_sine_##size)[size] #define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) #include "sinewin_tablegen.h" #include "tableprint.h"