From patchwork Fri Nov 20 07:19:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 23777 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 1755544AB58 for ; Fri, 20 Nov 2020 09:29:26 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B144B68BA6E; Fri, 20 Nov 2020 09:24:47 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ed1-f67.google.com (mail-ed1-f67.google.com [209.85.208.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2E4FB68B9FC for ; Fri, 20 Nov 2020 09:24:40 +0200 (EET) Received: by mail-ed1-f67.google.com with SMTP id d18so8468736edt.7 for ; Thu, 19 Nov 2020 23:24:40 -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=TcJwNkZNi876MShid0EZts+eTCyUF8vK8pd9ulu+2Y4=; b=nIRO7qHh7qVPjCabPByJk9NzxCZmMRnAkSxRQOO6ikei1qfvDIGFlmQTIHe6MAp8dm mxBQ4+HxqdHOfpj+O/ThD6dSlna8QAG3AXotKUaS95ZaHDOamU+NC/t8ry2gnBqLXMe/ SVAUd4G040fDPbMp9EW+52RIqC476bPCBdNNJazPUEXNcJXANITti1rvFeq+mearPpz1 DL62+OjG/GXMvGKfxN0/WLsFqWZ7W80IoNgbaW88OdsI7F2A3IQ06uLZbUCKNZWHmGZl tbD+y757NmlZhz9TTFG3lcc0c8RVfPNE1hgqE8brMCyLxJDV+E2jJE2cL1WqRV/1qAZu l5oQ== 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=TcJwNkZNi876MShid0EZts+eTCyUF8vK8pd9ulu+2Y4=; b=ik/1aXXuX2Sf95XC7aCYXHXFMlFB4kY54vV4o4dEu2KmRnIbEFyZnxtaXrNNfQEA87 WqCVy1y1Dy3YM+st/gKeD0mL7jeGfUr0/0L9ewOxv0m6ijW6lvQa7k9+T684uAdluSZ1 QmfuGA8TKV5Gie45l7CiiIaazwQd80oF4ppkYzij8fEH6hmkNUpolxXE0kJWno4CYsdF 355ViWOaRTQXosVilrprd2HV15FrYxtgW5DQa3A0YFFrPgvy/v0AiaVnxuJf7suErkdP zRH2SPL8nmObhXNf8yFHIxsnlr8uNxNH5qjYhBcMGQLXtxOCXEpQMhuxRIVatxdrDj4y d68Q== X-Gm-Message-State: AOAM532Z2xcSp1M/ATqY6X51ZOj8i901i5K0/3UIYN43K2rnl+qBvluf kysWAbTSqBwzXwdsyk+g3oxc7gK9dpzfBA== X-Google-Smtp-Source: ABdhPJxwmRAZwm0Y17TBMQZLuVWPPUtSUI6b9DsHzmFtzjQem8nV5HuqtPHdsQ4XEkpmTsJmZxzCKA== X-Received: by 2002:aa7:ce8d:: with SMTP id y13mr21589079edv.65.1605857078717; Thu, 19 Nov 2020 23:24:38 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id lz27sm779419ejb.39.2020.11.19.23.24.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2020 23:24:37 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 20 Nov 2020 08:19:01 +0100 Message-Id: <20201120072116.818090-29-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 028/162] avcodec/cook: Avoid big length tables for VLC initialization 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" Permuting the tables used to initialize the Cook VLCs so that the code tables are ordered from left to right in the tree revealed that the length of the codes are ascending from left to right. Therefore one can run-length encode them to avoid the big length tables; this saves a bit more than 1KB. Signed-off-by: Andreas Rheinhardt --- libavcodec/cook.c | 38 ++++++--- libavcodec/cookdata.h | 187 +++++++----------------------------------- 2 files changed, 54 insertions(+), 171 deletions(-) diff --git a/libavcodec/cook.c b/libavcodec/cook.c index 7756098d97..4d06488c10 100644 --- a/libavcodec/cook.c +++ b/libavcodec/cook.c @@ -190,6 +190,21 @@ static av_cold void init_gain_table(COOKContext *q) (1.0 / (double) q->gain_size_factor)); } +static av_cold int build_vlc(VLC *vlc, int nb_bits, const uint8_t counts[16], + const void *syms, int symbol_size, int offset, + void *logctx) +{ + uint8_t lens[MAX_COOK_VLC_ENTRIES]; + unsigned num = 0; + + for (int i = 0; i < 16; i++) + for (unsigned count = num + counts[i]; num < count; num++) + lens[num] = i + 1; + + return ff_init_vlc_from_lengths(vlc, nb_bits, num, lens, 1, + syms, symbol_size, symbol_size, + offset, 0, logctx); +} static av_cold int init_cook_vlc_tables(COOKContext *q) { @@ -197,27 +212,24 @@ static av_cold int init_cook_vlc_tables(COOKContext *q) result = 0; for (i = 0; i < 13; i++) { - result |= ff_init_vlc_from_lengths(&q->envelope_quant_index[i], 9, 24, - envelope_quant_index_huffbits[i], 1, - envelope_quant_index_huffsyms[i], 1, 1, - -12, 0, q->avctx); + result |= build_vlc(&q->envelope_quant_index[i], 9, + envelope_quant_index_huffcounts[i], + envelope_quant_index_huffsyms[i], 1, -12, q->avctx); } av_log(q->avctx, AV_LOG_DEBUG, "sqvh VLC init\n"); for (i = 0; i < 7; i++) { int sym_size = 1 + (i == 3); - result |= ff_init_vlc_from_lengths(&q->sqvh[i], vhvlcsize_tab[i], vhsize_tab[i], - cvh_huffbits[i], 1, - cvh_huffsyms[i], sym_size, sym_size, - 0, 0, q->avctx); + result |= build_vlc(&q->sqvh[i], vhvlcsize_tab[i], + cvh_huffcounts[i], + cvh_huffsyms[i], sym_size, 0, q->avctx); } for (i = 0; i < q->num_subpackets; i++) { if (q->subpacket[i].joint_stereo == 1) { - result |= ff_init_vlc_from_lengths(&q->subpacket[i].channel_coupling, 6, - (1 << q->subpacket[i].js_vlc_bits) - 1, - ccpl_huffbits[q->subpacket[i].js_vlc_bits - 2], 1, - ccpl_huffsyms[q->subpacket[i].js_vlc_bits - 2], 1, 1, - 0, 0, q->avctx); + result |= build_vlc(&q->subpacket[i].channel_coupling, 6, + ccpl_huffcounts[q->subpacket[i].js_vlc_bits - 2], + ccpl_huffsyms[q->subpacket[i].js_vlc_bits - 2], 1, + 0, q->avctx); av_log(q->avctx, AV_LOG_DEBUG, "subpacket %i Joint-stereo VLC used.\n", i); } } diff --git a/libavcodec/cookdata.h b/libavcodec/cookdata.h index 05d1eef23b..a4ca1201bf 100644 --- a/libavcodec/cookdata.h +++ b/libavcodec/cookdata.h @@ -70,41 +70,26 @@ static const int vpr_tab[7] = { /* VLC data */ -static const int vhsize_tab[7] = { - 181, 94, 48, 520, 209, 192, 32, -}; +#define MAX_COOK_VLC_ENTRIES 520 static const int vhvlcsize_tab[7] = { 8, 7, 7, 10, 9, 9, 6, }; -static const uint8_t envelope_quant_index_huffbits[13][24] = { - { 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, - 5, 5, 6, 7, 8, 9, 11, 11, 12, 12, 12, 12 }, - { 3, 3, 3, 3, 3, 3, 4, 4, 5, 5, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 15, 15, 15, 16, 16 }, - { 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, - 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 14 }, - { 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, - 7, 7, 7, 9, 9, 9, 10, 11, 13, 13, 13, 13 }, - { 3, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, - 6, 6, 6, 7, 8, 9, 10, 11, 12, 13, 14, 14 }, - { 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, - 7, 7, 8, 8, 8, 9, 10, 11, 12, 13, 14, 14 }, - { 2, 3, 3, 3, 3, 4, 4, 5, 5, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 15, 15, 16, 16, 16, 16 }, - { 2, 3, 3, 3, 3, 4, 4, 5, 5, 5, 7, 7, - 7, 9, 9, 9, 10, 11, 12, 14, 14, 14, 15, 15 }, - { 3, 3, 3, 3, 3, 3, 4, 4, 5, 5, 6, 6, - 7, 7, 8, 8, 9, 9, 9, 10, 11, 12, 13, 13 }, - { 3, 3, 3, 3, 3, 3, 4, 4, 5, 5, 6, 6, - 6, 8, 8, 8, 9, 10, 11, 12, 14, 14, 14, 14 }, - { 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 6, 6, - 6, 8, 8, 9, 9, 9, 10, 11, 12, 13, 14, 14 }, - { 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 16, 16, 16, 16 }, - { 2, 3, 3, 3, 3, 4, 4, 5, 5, 5, 7, 7, - 7, 8, 9, 10, 11, 13, 14, 14, 14, 14, 14, 14 }, +static const uint8_t envelope_quant_index_huffcounts[13][16] = { + { 0, 0, 3, 8, 3, 1, 1, 1, 1, 0, 2, 4, 0, 0, 0, 0 }, + { 0, 0, 6, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 0, 3, 2 }, + { 0, 0, 3, 8, 3, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 0 }, + { 0, 0, 5, 4, 3, 0, 3, 0, 3, 1, 1, 0, 4, 0, 0, 0 }, + { 0, 0, 5, 3, 4, 3, 1, 1, 1, 1, 1, 1, 1, 2, 0, 0 }, + { 0, 0, 5, 4, 3, 0, 2, 3, 1, 1, 1, 1, 1, 2, 0, 0 }, + { 0, 1, 4, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 4 }, + { 0, 1, 4, 2, 3, 0, 3, 0, 3, 1, 1, 1, 0, 3, 2, 0 }, + { 0, 0, 6, 2, 2, 2, 2, 2, 3, 1, 1, 1, 2, 0, 0, 0 }, + { 0, 0, 6, 2, 2, 3, 0, 3, 1, 1, 1, 1, 0, 4, 0, 0 }, + { 0, 1, 3, 4, 2, 3, 0, 2, 3, 1, 1, 1, 1, 2, 0, 0 }, + { 0, 1, 3, 4, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 4 }, + { 0, 1, 4, 2, 3, 0, 3, 1, 1, 1, 1, 0, 1, 6, 0, 0 }, }; static const uint8_t envelope_quant_index_huffsyms[13][24] = { @@ -137,18 +122,14 @@ static const uint8_t envelope_quant_index_huffsyms[13][24] = { }; -static const uint8_t cvh_huffbits0[181] = { - 1, 4, 4, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, - 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, - 16, +static const uint8_t cvh_huffcounts[7][16] = { + { 1, 0, 0, 2, 2, 5, 8, 15, 31, 33, 28, 17, 15, 8, 8, 8 }, + { 1, 0, 0, 2, 4, 5, 7, 16, 18, 12, 11, 7, 3, 5, 1, 2 }, + { 1, 0, 1, 2, 4, 2, 5, 8, 7, 8, 2, 3, 1, 1, 1, 2 }, + { 0, 1, 0, 2, 5, 12, 7, 27, 22, 41, 32, 41, 55, 23, 32, 220 }, + { 0, 1, 0, 5, 7, 4, 8, 9, 17, 10, 13, 17, 12, 14, 92, 0 }, + { 0, 1, 0, 5, 6, 8, 8, 8, 4, 7, 11, 23, 21, 10, 80, 0 }, + { 1, 0, 0, 5, 0, 9, 1, 7, 4, 3, 2, 0, 0, 0, 0, 0 }, }; static const uint8_t cvh_huffsyms0[181] = { @@ -167,16 +148,6 @@ static const uint8_t cvh_huffsyms0[181] = { 190, }; -static const uint8_t cvh_huffbits1[94] = { - 1, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, - 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 14, 14, 14, 14, - 14, 15, 16, 16, -}; - - static const uint8_t cvh_huffsyms1[94] = { 0, 1, 10, 2, 11, 20, 21, 3, 12, 22, 30, 31, 4, 13, 14, 23, 32, 40, 41, 5, 6, 15, 16, 24, 25, 33, 34, 42, 43, 50, 51, 52, 60, 61, 62, 7, 17, 18, @@ -185,50 +156,12 @@ static const uint8_t cvh_huffsyms1[94] = { 39, 58, 67, 75, 76, 85, 93, 49, 68, 94, 59, 77, 78, 86, 95, 69, 87, 96, }; -static const uint8_t cvh_huffbits2[48] = { - 1, 3, 4, 4, 5, 5, 5, 5, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, - 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, - 10, 10, 11, 11, 12, 12, 12, 13, 14, 15, 16, 16, -}; - static const uint8_t cvh_huffsyms2[48] = { 0, 7, 1, 8, 2, 9, 14, 15, 16, 22, 3, 10, 17, 21, 23, 4, 11, 18, 24, 28, 29, 30, 35, 5, 12, 25, 31, 36, 37, 42, 6, 13, 19, 20, 26, 32, 38, 43, 39, 44, 27, 33, 45, 46, 34, 40, 41, 47, }; -static const uint8_t cvh_huffbits3[520] = { - 2, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -}; - static const uint16_t cvh_huffsyms3[520] = { 0, 1, 125, 5, 6, 25, 30, 150, 2, 7, 26, 31, 126, 130, 131, 151, 155, 156, 250, 275, 10, 35, 36, 50, 55, 175, 180, 3, 8, 11, @@ -267,21 +200,6 @@ static const uint16_t cvh_huffsyms3[520] = { 583, 585, 586, 587, 590, 591, 600, 601, 605, 606, }; -static const uint8_t cvh_huffbits4[209] = { - 2, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, - 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, -}; - static const uint8_t cvh_huffsyms4[209] = { 0, 1, 4, 16, 64, 80, 5, 17, 20, 21, 65, 68, 84, 69, 81, 85, 128, 2, 6, 8, 25, 32, 96, 100, 144, 9, 22, 24, 36, 37, @@ -299,20 +217,6 @@ static const uint8_t cvh_huffsyms4[209] = { 218, 220, 221, 225, 226, 228, 229, 230, 232, 233, 240, 241, 244, 245, }; -static const uint8_t cvh_huffbits5[192] = { - 2, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, - 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, - 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, -}; - static const uint8_t cvh_huffsyms5[192] = { 0, 1, 3, 9, 27, 81, 4, 12, 36, 82, 84, 108, 10, 13, 28, 30, 39, 90, 109, 117, 31, 37, 40, 85, 91, 93, 111, 120, 2, 54, @@ -329,11 +233,6 @@ static const uint8_t cvh_huffsyms5[192] = { 205, 207, 208, 210, 211, 217, 219, 220, 225, 226, 228, 229, }; -static const uint8_t cvh_huffbits6[32] = { - 1, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 8, 8, - 8, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 11, 11, -}; - static const uint8_t cvh_huffsyms6[32] = { 0, 1, 2, 4, 8, 16, 3, 5, 6, 9, 10, 12, 17, 20, 24, 18, 7, 11, 14, 19, 22, 26, 28, 13, 21, 25, 30, 15, 27, 29, 23, 31, @@ -344,12 +243,6 @@ static const void* const cvh_huffsyms[7] = { cvh_huffsyms4, cvh_huffsyms5, cvh_huffsyms6, }; -static const uint8_t* const cvh_huffbits[7] = { - cvh_huffbits0, cvh_huffbits1, cvh_huffbits2, cvh_huffbits3, - cvh_huffbits4, cvh_huffbits5, cvh_huffbits6, -}; - - static const uint8_t ccpl_huffsyms2[3] = { 1, 0, 2, }; @@ -374,28 +267,12 @@ static const uint8_t ccpl_huffsyms6[63] = { 2, 60, 61, 1, 0, 62, }; -static const uint8_t ccpl_huffbits2[3] = { - 1, 2, 2, -}; - -static const uint8_t ccpl_huffbits3[7] = { - 1, 2, 3, 4, 5, 6, 6, -}; - -static const uint8_t ccpl_huffbits4[15] = { - 1, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, -}; - -static const uint8_t ccpl_huffbits5[31] = { - 1, 3, 3, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, - 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, -}; - -static const uint8_t ccpl_huffbits6[63] = { - 1, 3, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, - 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 12, - 12, 13, 13, 14, 14, 14, 15, 16, 16, +static const uint8_t ccpl_huffcounts[5][16] = { + { 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 1, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 1, 0, 2, 2, 2, 2, 2, 4, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 1, 0, 2, 0, 4, 4, 4, 4, 4, 8, 0, 0, 0, 0, 0, 0 }, + { 1, 0, 1, 1, 4, 4, 8, 8, 9, 9, 8, 2, 2, 3, 1, 2 }, }; static const uint8_t *const ccpl_huffsyms[5] = { @@ -403,12 +280,6 @@ static const uint8_t *const ccpl_huffsyms[5] = { ccpl_huffsyms4, ccpl_huffsyms5, ccpl_huffsyms6 }; -static const uint8_t* const ccpl_huffbits[5] = { - ccpl_huffbits2,ccpl_huffbits3, - ccpl_huffbits4,ccpl_huffbits5,ccpl_huffbits6 -}; - - //Coupling tables static const int cplband[51] = {