From patchwork Tue Nov 10 10:47:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 23495 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 B4AE944B61D for ; Tue, 10 Nov 2020 12:54:55 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 09AD068BE34; Tue, 10 Nov 2020 12:49:57 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5F41568BE04 for ; Tue, 10 Nov 2020 12:49:45 +0200 (EET) Received: by mail-wm1-f68.google.com with SMTP id 10so2533418wml.2 for ; Tue, 10 Nov 2020 02:49:45 -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=cfPHmBDYR3NQoj5F41+EVJvh+jiefZ6omdeODsVnC5M=; b=l5pUEvRUS9snab+rE7T64HOEKTjrZ1gtlfwcDsGhvpbfMtzmUomz3BCxbIUztc+YBl Hvym1xwn+94fbH3JkPcU6KUFTPuTByaTFIk0kdnuWscNSaEuPIwgWSDtjRBd/12XJMRN 4cMTFOYUfPclx9LGtJXa1wPHo0u79fu3vr4KYTV5vxT2iMR+y4M35wI1DtSLMhwt7fA6 PdkRkBRFnDqOlBngKR5nDuKqaoTNdcDaphkZeqNfPVqane+safd7Zk1zZxN/gdd4VVTR d98yIFn9S+smhl7XzS+xjTIW0laOwUFvztZWmwNKZBY48FTQHDJuAjjCzpfl/BM7NUzH TIpg== 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=cfPHmBDYR3NQoj5F41+EVJvh+jiefZ6omdeODsVnC5M=; b=G9GBHgodZd7VRSmD+Mqq8ttnyMKFuhOAHaU9aq87R37lSeWbrHHa0yoK9YZTCt6vO1 oC1oEV8SIFfSk/qf8NsTtRv8wpcgUWnBSGza9i1mtr+8/5PoOiyh/lx7dxDl1ewWspGS hA/GOjwhJlH32MhaUKJEt9WNhFDZ/qS5k76evkQF0uK8zmEKfXA3+ndvEyKGAyFBnMES naXzfPMBRyW4/t/NT05E0MaKDj1EuP98y6yDIFMWUC9xDMORIkunuwZHKDRkmnB2l7gJ 4+ZhGGWwHamjvdfYa72LpR3+R4GQg1uSL1lU/qXzl6Mn3Aa98LsbzC76NSQgblZlDxNk mDxQ== X-Gm-Message-State: AOAM532H6biOwlKXCw9R115mNdvRNpT4rAYQQT5sIE5vKUpRFbB0hKRk 0pNqUYBVQ2aD39h8ZkhUVnXIlWg/jOE= X-Google-Smtp-Source: ABdhPJz8eeGp9yJN2x7xZ6XLuwOpsykRCdUkdZedYj4meXEeREXjYi/bpFHpOLHcPyOuGWb1fNVJmA== X-Received: by 2002:a1c:230e:: with SMTP id j14mr3947974wmj.187.1605005384188; Tue, 10 Nov 2020 02:49:44 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id l24sm2572543wmi.7.2020.11.10.02.49.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2020 02:49:43 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 10 Nov 2020 11:47:21 +0100 Message-Id: <20201110104851.321029-25-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201110104851.321029-1-andreas.rheinhardt@gmail.com> References: <20201110104851.321029-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 024/114] 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 | 36 +++++--- libavcodec/cookdata.h | 187 +++++++----------------------------------- 2 files changed, 52 insertions(+), 171 deletions(-) diff --git a/libavcodec/cook.c b/libavcodec/cook.c index 9f44df5332..75422d18aa 100644 --- a/libavcodec/cook.c +++ b/libavcodec/cook.c @@ -190,6 +190,19 @@ 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) +{ + 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); +} static av_cold int init_cook_vlc_tables(COOKContext *q) { @@ -197,27 +210,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); + result |= build_vlc(&q->envelope_quant_index[i], 9, + envelope_quant_index_huffcounts[i], + envelope_quant_index_huffsyms[i], 1, -12); } 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); + result |= build_vlc(&q->sqvh[i], vhvlcsize_tab[i], + cvh_huffcounts[i], + cvh_huffsyms[i], sym_size, 0); } 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); + 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); 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] = {