From patchwork Fri Nov 20 07:33:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 23891 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 DD61544A412 for ; Fri, 20 Nov 2020 09:51:53 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C8EFC68BD63; Fri, 20 Nov 2020 09:34:56 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ej1-f67.google.com (mail-ej1-f67.google.com [209.85.218.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2DD4C68BCF9 for ; Fri, 20 Nov 2020 09:34:46 +0200 (EET) Received: by mail-ej1-f67.google.com with SMTP id o21so11523108ejb.3 for ; Thu, 19 Nov 2020 23:34:46 -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=HQX6poTq2NrdZPHW8iRvg46XxBpP4YhSVvwoXsf+B9E=; b=Unk5jqICA7P8siZPRwM9z/I5rt8NGLNjwPfywy8enjmHnqbVyap2tGvd3eWjIg6h/x yQudCDhp4qG+U83JGIaz5j2nY0UmRIk8faXuyhNixNoWrLpWsxqVL/Y91Br6lZq5wJL3 wsIC9LRaFEHmfcADuMRNxSCClvgIiD2ZKb9EWQVbVIdQ8VLmepc+Aob/mOf2NTGTZPaZ v4PnLswdz6ao2oy2KpLfRIv2FFlZ3ea/7KBqE3v/rYZn42u8EiBcES4hlY79rfSzUaHG vzZ9IfMkv9fxAavnuTsFOpQ6IIXv0qKJVpgdjscXYNglrsd/uwl0wUyNwnziih00T6ky gCvw== 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=HQX6poTq2NrdZPHW8iRvg46XxBpP4YhSVvwoXsf+B9E=; b=Jov4yEqxNfc/hUkutU3AF+I4z90E0Sf3mU9leHc0DfeFX+l6EjMwSuTwZHyM1tAa75 WR/KMy3k+4VtHT7Yhb6O0neHza5HOkn/fhf22S2c7gx/9yqUbKXM6QNvjkpy5Yeu4CkG Povl1TYwnPO3s2XWwZlOLP0+qxNpffXiiK+rbz458V6uRiGT0GXNxF8QmSYX2lIRQhlN 8MkzHlONLRaB17XG9G7BFo9MY+Fn9SBviXG0sT1q32DhXzw9k5OqIUWoO74i9Lxi2VmW wvCoinCfqxa0r9/bDij3D10r+uGnsfbVsdG/YbC0IV9jEApM8mkPfaAGQAMxgCPB9gYt eBTg== X-Gm-Message-State: AOAM5333s+k94JfDGRmXm0hbpm21aGeUP5eex/CnHPi5UwiNMoAwcIji EeobO44hKVX610B/aojgHCiy4L0PlyUyqw== X-Google-Smtp-Source: ABdhPJydKgYDSNAyKdgI1+jEyeaA2t9AP7PVTrkTitnooW6gUxyP17qeXeB9/RMl0zOio6wFKgXaFA== X-Received: by 2002:a17:906:7016:: with SMTP id n22mr33394710ejj.402.1605857685481; Thu, 19 Nov 2020 23:34:45 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id i13sm769110ejv.84.2020.11.19.23.34.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2020 23:34:44 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 20 Nov 2020 08:33:05 +0100 Message-Id: <20201120073327.820745-41-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 v2 140/162] avcodec/aacdec_template: Avoid code duplication when initializing VLCs 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" Signed-off-by: Andreas Rheinhardt --- libavcodec/aacdec_template.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index 76fffedfcb..473a075201 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -1195,29 +1195,23 @@ static void reset_predictor_group(PredictorState *ps, int group_num) reset_predict_state(&ps[i]); } -#define AAC_INIT_VLC_STATIC(num, size) \ - INIT_VLC_STATIC(&vlc_spectral[num], 8, ff_aac_spectral_sizes[num], \ - ff_aac_spectral_bits[num], sizeof(ff_aac_spectral_bits[num][0]), \ - sizeof(ff_aac_spectral_bits[num][0]), \ - ff_aac_spectral_codes[num], sizeof(ff_aac_spectral_codes[num][0]), \ - sizeof(ff_aac_spectral_codes[num][0]), \ - size); - static void aacdec_init(AACContext *ac); static av_cold void aac_static_table_init(void) { - AAC_INIT_VLC_STATIC( 0, 304); - AAC_INIT_VLC_STATIC( 1, 270); - AAC_INIT_VLC_STATIC( 2, 550); - AAC_INIT_VLC_STATIC( 3, 300); - AAC_INIT_VLC_STATIC( 4, 328); - AAC_INIT_VLC_STATIC( 5, 294); - AAC_INIT_VLC_STATIC( 6, 306); - AAC_INIT_VLC_STATIC( 7, 268); - AAC_INIT_VLC_STATIC( 8, 510); - AAC_INIT_VLC_STATIC( 9, 366); - AAC_INIT_VLC_STATIC(10, 462); + static VLC_TYPE vlc_buf[304 + 270 + 550 + 300 + 328 + + 294 + 306 + 268 + 510 + 366 + 462][2]; + for (unsigned i = 0, offset = 0; i < 11; i++) { + vlc_spectral[i].table = &vlc_buf[offset]; + vlc_spectral[i].table_allocated = FF_ARRAY_ELEMS(vlc_buf) - offset; + init_vlc(&vlc_spectral[i], 8, ff_aac_spectral_sizes[i], + ff_aac_spectral_bits[i], sizeof(ff_aac_spectral_bits[i][0]), + sizeof(ff_aac_spectral_bits[i][0]), + ff_aac_spectral_codes[i], sizeof(ff_aac_spectral_codes[i][0]), + sizeof(ff_aac_spectral_codes[i][0]), + INIT_VLC_STATIC_OVERLONG); + offset += vlc_spectral[i].table_size; + } AAC_RENAME(ff_aac_sbr_init)();