From patchwork Fri Nov 20 07:33:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 23904 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 BB3F144AB03 for ; Fri, 20 Nov 2020 09:54:10 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C3A0C68BDC3; Fri, 20 Nov 2020 09:35:09 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ej1-f66.google.com (mail-ej1-f66.google.com [209.85.218.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BA83268BD88 for ; Fri, 20 Nov 2020 09:34:57 +0200 (EET) Received: by mail-ej1-f66.google.com with SMTP id lv15so5671852ejb.12 for ; Thu, 19 Nov 2020 23:34:57 -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=vL44dhGOeuqMmGtlv1p8q1ZEpy/SGjr50z59i2hLITg=; b=ZU+yu/UYs+rbD7Qbns5GjtU6RKoiPMuAOA8BHLPfW8U/XXNK416usJL03ErB8U08F6 ttArGTqTiUsHHtOB0C0RaJ+fgQ0MU9Pei12ILkOmRSw50pMLfBsAqi5Q7qa6H8NmEH6O CR+y2d3yCnD5oQenf9Y0SYqywOpEQx06y+ikRdeQpLdBRvXdND324EMcFxj3vJ4feoNb SftMP3jfzxuB4lYDDJ1cn9dwukvikQ4fHBETSNGAXWkNzgQEQe6OxGAJcylTrxDHe+4p gETSK8Y91P7q3pk8H+pTkhoE/sbWUzUvfJrec+oXRJg6eMq9+LQqZXlbyq1sH6xZA+1C oDGA== 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=vL44dhGOeuqMmGtlv1p8q1ZEpy/SGjr50z59i2hLITg=; b=MnmjoFAsFf3/fGrMllz0H6vIAgD7boJNnUWPQKaO34xXJO7wzVWK2cfqF5nn17A9ru 9XGEDQokPhV/yxTmCTisOE2Wp4stcVi43USQL/Ek00FTUS8pA7Ze/aVlUSKQYeihi8Vb CIlEZOZxi7G1Tw41LmisFtqPi7d8iowd/eop3xy35S3IUH91BgVngn+CVTd/8a7ijTZ8 Sd/HxtnJeZaP3JSjQXyki7qjhEM8YFEoqKe7xOvIqZ3oVkjPfsZAZWSJbN+eS4Pu1fxF nyCxVcxfBE9654+qGAyu/D/u6Ih8i7rplAtZkUQQ4WAD+7Z8jK2LiME9ogfkl5ZPyB67 +/Ig== X-Gm-Message-State: AOAM532zMTtqz+SLukMQybBG8QP5CQzgSFZR19ly56XLCs3AjHlRf16v dNW6Lxm7bvHVlQPcRWccMKnEOERN0LT9UA== X-Google-Smtp-Source: ABdhPJyeMlIVlfNWvvSyegZZgGMkzM9UVSd37LpnXl7lyOjuiEGJEdGFq9Od/GTSd89sX9u+q3djOA== X-Received: by 2002:a17:906:e254:: with SMTP id gq20mr32188586ejb.520.1605857696983; Thu, 19 Nov 2020 23:34:56 -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.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2020 23:34:56 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 20 Nov 2020 08:33:17 +0100 Message-Id: <20201120073327.820745-53-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 152/162] avcodec/mpegaudiodec_template: Avoid VLC size tables 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/mpegaudiodec_template.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/libavcodec/mpegaudiodec_template.c b/libavcodec/mpegaudiodec_template.c index 0634f70b05..53db13d0d4 100644 --- a/libavcodec/mpegaudiodec_template.c +++ b/libavcodec/mpegaudiodec_template.c @@ -103,13 +103,8 @@ static VLC_TYPE huff_vlc_tables[ 0 + 128 + 128 + 128 + 130 + 128 + 154 + 166 + 142 + 204 + 190 + 170 + 542 + 460 + 662 + 414 ][2]; -static const int huff_vlc_tables_sizes[16] = { - 0, 128, 128, 128, 130, 128, 154, 166, - 142, 204, 190, 170, 542, 460, 662, 414 -}; static VLC huff_quad_vlc[2]; static VLC_TYPE huff_quad_vlc_tables[64+16][2]; -static const int huff_quad_vlc_tables_sizes[2] = { 64, 16 }; /* computed from band_size_long */ static uint16_t band_index_long[9][23]; #include "mpegaudio_tablegen.h" @@ -309,22 +304,23 @@ static av_cold void decode_init_static(void) /* XXX: fail test */ huff_vlc[i].table = huff_vlc_tables+offset; - huff_vlc[i].table_allocated = huff_vlc_tables_sizes[i]; + huff_vlc[i].table_allocated = FF_ARRAY_ELEMS(huff_vlc_tables) - offset; init_vlc(&huff_vlc[i], 7, 512, tmp_bits, 1, 1, tmp_codes, 2, 2, - INIT_VLC_USE_NEW_STATIC); - offset += huff_vlc_tables_sizes[i]; + INIT_VLC_STATIC_OVERLONG); + offset += huff_vlc[i].table_size; } av_assert0(offset == FF_ARRAY_ELEMS(huff_vlc_tables)); offset = 0; for (i = 0; i < 2; i++) { + int bits = i == 0 ? 6 : 4; huff_quad_vlc[i].table = huff_quad_vlc_tables+offset; - huff_quad_vlc[i].table_allocated = huff_quad_vlc_tables_sizes[i]; - init_vlc(&huff_quad_vlc[i], i == 0 ? 6 : 4, 16, + huff_quad_vlc[i].table_allocated = 1 << bits; + offset += 1 << bits; + init_vlc(&huff_quad_vlc[i], bits, 16, mpa_quad_bits[i], 1, 1, mpa_quad_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); - offset += huff_quad_vlc_tables_sizes[i]; } av_assert0(offset == FF_ARRAY_ELEMS(huff_quad_vlc_tables));