From patchwork Fri Nov 20 07:32:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 23877 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 75EAE449298 for ; Fri, 20 Nov 2020 09:49:13 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 78A8C68BD1A; Fri, 20 Nov 2020 09:34:43 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ej1-f65.google.com (mail-ej1-f65.google.com [209.85.218.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BCEEA68BB03 for ; Fri, 20 Nov 2020 09:34:31 +0200 (EET) Received: by mail-ej1-f65.google.com with SMTP id lv15so5670583ejb.12 for ; Thu, 19 Nov 2020 23:34:31 -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=8Y2GlnOv+j+kxRP0Z82B+hQPJUKX9gg+8I1g9GXthDc=; b=ccZdSzgay8toU9qWvbMHJVb7ZG/pbGyum3hESDj3eSucWjlAol/tzygsQh2OX+r0Qc cgF9n68irz7DLTmtPiz5sAqTA4R15WgA019LE9VxqtjCtGIDzxWSEmaTowem+Ug73PtM 8AkEuFEO/oRWv/c9kVhnUNCiPgZ86Ymp+nb/vi/8rzIRBMO64t/zFq6miVbSqvsYtsy4 e+oX9fVszG1zGj3cCS8vQsaQsOkyzU0ZJCzblB14ibMt6UMF3mwqYTKigHIrlw3PYNwX hZIlulaPTrkA88kQT82HINzcsBv5c1pMoPsEDm0o5+E2NYUT5S9ZKr4VG26PtBwlomjW yjUg== 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=8Y2GlnOv+j+kxRP0Z82B+hQPJUKX9gg+8I1g9GXthDc=; b=sTLKsBXelqLYv72q/mT9UCZFK5llZAHzoDfDfy3FJfWh1lREonRV8hVF3CJmOvQAWU MPz4jeBBvRPEBr9cN4kd02G887xkHYiVPT6rt1ZZkQ7nlHsv6FAcaFL0bmHRp4+1jbDp sS3OnmcgXnSOStAwjkz9VAuDTLzuFOoSPZVhLgQesB6aJA/jTaaJjP06OBpfPDMb6C3O v7H314K+WD5syIh2P8hmoHisbWjMDATKuSrkM7+fbQbgR1AHLBLgS/dcHZbc4qpsxkeV SBo2yDLZ8FdjI7Q6pZL2zIGTrSEX1YAx/PK/RRZuoM6mwsbtPM4aFR3O4rsVo/VJA300 Mv5w== X-Gm-Message-State: AOAM532rbaS0lsgp13qRQAknRJBmXYDuoKb3orGo3WP1ELYnyl7rs3b6 GfazE3HGLnpdV21cJzndsIjbCUo1QtdeCQ== X-Google-Smtp-Source: ABdhPJyDy1gDrQpix40kmTMW9qK/KfGMApPbg9aY7pdxPooekgnzPL3C/O1JA+ozSxaL7r7nfN8PcQ== X-Received: by 2002:a17:906:7016:: with SMTP id n22mr33394014ejj.402.1605857670742; Thu, 19 Nov 2020 23:34:30 -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.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2020 23:34:30 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 20 Nov 2020 08:32:52 +0100 Message-Id: <20201120073327.820745-28-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 127/162] avcodec/intrax8: Remove VLC offsets table 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/intrax8.c | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c index 390c10272e..2a93e5efd7 100644 --- a/libavcodec/intrax8.c +++ b/libavcodec/intrax8.c @@ -50,18 +50,6 @@ static av_cold void x8_vlc_init(void) { int i; int offset = 0; - int sizeidx = 0; - static const uint16_t sizes[8 * 4 + 8 * 2 + 2 + 4] = { - 576, 548, 582, 618, 546, 616, 560, 642, - 584, 582, 704, 664, 512, 544, 656, 640, - 512, 648, 582, 566, 532, 614, 596, 648, - 586, 552, 584, 590, 544, 578, 584, 624, - - 528, 528, 526, 528, 536, 528, 526, 544, - 544, 512, 512, 528, 528, 544, 512, 544, - - 128, 128, 128, 128, 128, 128, - }; static VLC_TYPE table[28150][2]; @@ -69,10 +57,10 @@ static av_cold void x8_vlc_init(void) #define init_ac_vlc(dst, src) \ do { \ dst.table = &table[offset]; \ - dst.table_allocated = sizes[sizeidx]; \ - offset += sizes[sizeidx++]; \ + dst.table_allocated = FF_ARRAY_ELEMS(table) - offset; \ init_vlc(&dst, AC_VLC_BITS, 77, &src[1], 4, 2, &src[0], 4, 2, \ - INIT_VLC_USE_NEW_STATIC); \ + INIT_VLC_STATIC_OVERLONG); \ + offset += dst.table_size; \ } while(0) for (i = 0; i < 8; i++) { @@ -87,10 +75,10 @@ static av_cold void x8_vlc_init(void) #define init_dc_vlc(dst, src) \ do { \ dst.table = &table[offset]; \ - dst.table_allocated = sizes[sizeidx]; \ - offset += sizes[sizeidx++]; \ + dst.table_allocated = FF_ARRAY_ELEMS(table) - offset; \ init_vlc(&dst, DC_VLC_BITS, 34, &src[1], 4, 2, &src[0], 4, 2, \ - INIT_VLC_USE_NEW_STATIC); \ + INIT_VLC_STATIC_OVERLONG); \ + offset += dst.table_size; \ } while(0) for (i = 0; i < 8; i++) { @@ -103,10 +91,10 @@ static av_cold void x8_vlc_init(void) #define init_or_vlc(dst, src) \ do { \ dst.table = &table[offset]; \ - dst.table_allocated = sizes[sizeidx]; \ - offset += sizes[sizeidx++]; \ + dst.table_allocated = FF_ARRAY_ELEMS(table) - offset; \ init_vlc(&dst, OR_VLC_BITS, 12, &src[1], 4, 2, &src[0], 4, 2, \ - INIT_VLC_USE_NEW_STATIC); \ + INIT_VLC_STATIC_OVERLONG); \ + offset += dst.table_size; \ } while(0) for (i = 0; i < 2; i++)