From patchwork Sun Jan 10 06:15:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 24881 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 82375449CD1 for ; Sun, 10 Jan 2021 08:15:20 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4927468A27A; Sun, 10 Jan 2021 08:15:20 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 56238689C0A for ; Sun, 10 Jan 2021 08:15:14 +0200 (EET) Received: by mail-ej1-f48.google.com with SMTP id jx16so20085073ejb.10 for ; Sat, 09 Jan 2021 22:15:14 -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=4QPvXfcAxValY0wo/tWZb2alAqQnnTBGV96N0a/VX+c=; b=lHpbMfxulJNmB0Bp3EE+BOGtQGSm8fjVTh0ZbNTuI6MoP4msxTo9eako45AqkA6mdX YqbDmAyt03pXRKuC2E/eK+KphLTaANR7Xmf1HVIu9abI2aUOmqARrKODGeIZpZyozgy5 3e5aNXirdoOITm7i2DqR4amrSWlKm2nbG0xjS+Vczl5unwRta5XJiWTJQMmHC3yBc5dC 27yRawe6cQ5h46t2meVwno1EtDdj4pKQlvGk0Oiv05ATvVpNmXzJTZxzb3h8wcy+1V+Z k/pt4UGMLdOwatEtY3x05dSyT8J57GVshkft26xRyK1YRJwM8ptZSscwZVmaBv7X7C6F 2fBg== 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=4QPvXfcAxValY0wo/tWZb2alAqQnnTBGV96N0a/VX+c=; b=IiLDA/O62rfd6fP7XwxL5RyGsLkC5Cbhr9dnPcOzjJy793JVkZAfQlTsbo8hHkXPFf 6nqgVr3n52ukg6yW03aCoYz2jMuriaHWuePn+kGOlWcI+fhWpMOJ/M9/dJpwqEYZdxgw zyLRT+IZCZ+GFqHIuFj22bKzoK/uJ6hB1juOoafqGoyUUuxiwtE9QybjFr3878sfOWtF QdeHwExN1TVyuDSUeQPBXOGtqPm1HUXK6DBI81ZalN0mrH/WX7Nh9XFDzrPMs7FEaQG3 1nZSe7/E0pNpSLh71uM56NJQkJM0MdmT3PEBzxrPeiq36WoBIL8TwJbDLCmmBh5X64xO C83Q== X-Gm-Message-State: AOAM530K4IJFPBwpqCsGV4l24rmqDlq1bVVJqUC9V1Dmy9/RKQhIUF5P sStONxL2RI7utWkZK2phgMcQrxJSExE= X-Google-Smtp-Source: ABdhPJzhfvv1GA0FDFGuuODolBQJLpQ7csePanQ/5WrKCdZ60xDEDcx+N6QH7psFC+zOHJTnHEFCLg== X-Received: by 2002:a17:906:3881:: with SMTP id q1mr7391120ejd.490.1610259313510; Sat, 09 Jan 2021 22:15:13 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id cw7sm3573075ejc.13.2021.01.09.22.15.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Jan 2021 22:15:12 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sun, 10 Jan 2021 07:15:01 +0100 Message-Id: <20210110061501.3863886-1-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avcodec/aacenctab: Simplify exporting array size 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/aacenc.c | 4 ++-- libavcodec/aacenctab.c | 7 ++----- libavcodec/aacenctab.h | 6 ++---- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index 070a2e706a..75e40c9d7f 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -999,8 +999,8 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) break; s->samplerate_index = i; ERROR_IF(s->samplerate_index == 16 || - s->samplerate_index >= ff_aac_swb_size_1024_len || - s->samplerate_index >= ff_aac_swb_size_128_len, + s->samplerate_index >= FF_ARRAY_ELEMS(ff_aac_swb_size_1024) || + s->samplerate_index >= FF_ARRAY_ELEMS(ff_aac_swb_size_128), "Unsupported sample rate %d\n", avctx->sample_rate); /* Bitrate limiting */ diff --git a/libavcodec/aacenctab.c b/libavcodec/aacenctab.c index 874365a593..69458cf1fd 100644 --- a/libavcodec/aacenctab.c +++ b/libavcodec/aacenctab.c @@ -88,7 +88,7 @@ static const uint8_t swb_size_1024_8[] = { 32, 36, 36, 40, 44, 48, 52, 56, 60, 64, 80 }; -const uint8_t *const ff_aac_swb_size_128[] = { +const uint8_t *const ff_aac_swb_size_128[13] = { swb_size_128_96, swb_size_128_96, swb_size_128_64, swb_size_128_48, swb_size_128_48, swb_size_128_48, swb_size_128_24, swb_size_128_24, swb_size_128_16, @@ -96,13 +96,10 @@ const uint8_t *const ff_aac_swb_size_128[] = { swb_size_128_8 }; -const uint8_t *const ff_aac_swb_size_1024[] = { +const uint8_t *const ff_aac_swb_size_1024[13] = { swb_size_1024_96, swb_size_1024_96, swb_size_1024_64, swb_size_1024_48, swb_size_1024_48, swb_size_1024_32, swb_size_1024_24, swb_size_1024_24, swb_size_1024_16, swb_size_1024_16, swb_size_1024_16, swb_size_1024_8, swb_size_1024_8 }; - -const int ff_aac_swb_size_128_len = FF_ARRAY_ELEMS(ff_aac_swb_size_128); -const int ff_aac_swb_size_1024_len = FF_ARRAY_ELEMS(ff_aac_swb_size_1024); diff --git a/libavcodec/aacenctab.h b/libavcodec/aacenctab.h index dbbdf61dfd..39f7e52909 100644 --- a/libavcodec/aacenctab.h +++ b/libavcodec/aacenctab.h @@ -38,10 +38,8 @@ #define AAC_MAX_CHANNELS 16 -extern const uint8_t *const ff_aac_swb_size_1024[]; -extern const int ff_aac_swb_size_1024_len; -extern const uint8_t *const ff_aac_swb_size_128[]; -extern const int ff_aac_swb_size_128_len; +extern const uint8_t *const ff_aac_swb_size_1024[13]; +extern const uint8_t *const ff_aac_swb_size_128[13]; /* Supported layouts without using a PCE */ static const int64_t aac_normal_chan_layouts[7] = {