From patchwork Tue Nov 10 10:47:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 23528 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 432EF44AA20 for ; Tue, 10 Nov 2020 13:00:56 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 402D168BED6; Tue, 10 Nov 2020 12:50:23 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1CAC768BE8F for ; Tue, 10 Nov 2020 12:50:12 +0200 (EET) Received: by mail-wm1-f53.google.com with SMTP id p19so1738817wmg.0 for ; Tue, 10 Nov 2020 02:50:12 -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=KEh2KgwHs/OE/Rzx+cuSBx3YlGZMQ4JXrzRhgEmlhro=; b=I6eY9cqrxFUvrA/tX8QAdTRxQl8mabIiOms6VLbcnrfpT/fv8XjjP7Ps4YQWUdhncb 94JszDJ7I3/0V9I2FQfUG4Xsdz4DWvNwXgUsku9eGZp1dkpFi20073gSvjDv2A3xvqfq Ll7ZigyxTnLavZOn+Lp48Ih8Qx3QYvgKa6gJDyjopRMcVVGW/TUvdh6sa7iD9ynOoG+h PHbn2cbBIg6iieS7T9vZnW+GCEf0pFUv7YQ/HxOIqKmPVdYNWZ+gPyfycJYgclAma91Z 5RsI+TVXNpWnxyw+wohCEoNnVeb3eOgrfmwMcZ8qj4klGwBKx8va8og9tX+Qwvof9M77 YzBA== 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=KEh2KgwHs/OE/Rzx+cuSBx3YlGZMQ4JXrzRhgEmlhro=; b=RPFEuhoSvmJt5le1IUTe7gw0e7EsZ7h+yfLlIl2PDIqtmyRsHKk4Q6J+DtsYrTiLci m6TVRnFr5Xz2JkPS15tFoDGoHLiRCm4aONJOfM1FnECZ1Nr7UJMoY48p919D/HoC2vuy hFCGKovDlqVsLHS9KD8JScZYPYnYfMS+kfhltrmRGGs++hYSlVd/FwU7L6POJyQk4fmB 6lnKegebqNr1wIv1GaLP4EkXLwaDZ8cuJUnL/oRm4ZJk94I1vaMtFP+6ukOqvlyY2/RV Jso9FnYv25fxTxRChZj/aQ+ZYQdcinojUHPB3AX86wOs6grJ+a8iOButlocYEpsbf2Ao B6yw== X-Gm-Message-State: AOAM5319MRGzvpJ1gG0/Eol85yHgXr90XAIAArkNZxktUYXmc9Z0eoiM dMo8APVEAPebW1cQG+7A6p4njxvaMPg= X-Google-Smtp-Source: ABdhPJztCZMnRUO2KLuvjAvRL8Cb7RqmDPi+fYgmZVlVXxoYwzIqXy3vbABD4jLJ6Y2PgaXRqXGrww== X-Received: by 2002:a7b:c1d8:: with SMTP id a24mr3886324wmj.112.1605005411317; Tue, 10 Nov 2020 02:50:11 -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.50.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2020 02:50:10 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 10 Nov 2020 11:47:49 +0100 Message-Id: <20201110104851.321029-53-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 052/114] avcodec/qdm2: Initialize array of VLCs in a loop 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/qdm2_tablegen.h | 12 +++++++----- libavcodec/qdm2data.h | 28 ++++++++++------------------ 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/libavcodec/qdm2_tablegen.h b/libavcodec/qdm2_tablegen.h index aaa7356caf..b60989e343 100644 --- a/libavcodec/qdm2_tablegen.h +++ b/libavcodec/qdm2_tablegen.h @@ -127,6 +127,8 @@ static av_cold void build_vlc(VLC *vlc, int nb_bits, int nb_codes, int idx, static av_cold void qdm2_init_vlc(void) { + const uint8_t (*tab)[2] = tab_fft_tone_offset; + build_vlc(&vlc_tab_level, 8, 24, 0, tab_level); build_vlc(&vlc_tab_diff, 8, 33, 1, tab_diff); build_vlc(&vlc_tab_run, 5, 6, 2, tab_run); @@ -144,11 +146,11 @@ static av_cold void qdm2_init_vlc(void) build_vlc(&vlc_tab_type30, 6, 9, 10, tab_type30); build_vlc(&vlc_tab_type34, 5, 10, 11, tab_type34); - build_vlc(&vlc_tab_fft_tone_offset[0], 8, 23, 12, tab_fft_tone_offset_0); - build_vlc(&vlc_tab_fft_tone_offset[1], 8, 28, 13, tab_fft_tone_offset_1); - build_vlc(&vlc_tab_fft_tone_offset[2], 8, 31, 14, tab_fft_tone_offset_2); - build_vlc(&vlc_tab_fft_tone_offset[3], 8, 34, 15, tab_fft_tone_offset_3); - build_vlc(&vlc_tab_fft_tone_offset[4], 8, 37, 16, tab_fft_tone_offset_4); + for (int i = 0; i < 5; i++) { + build_vlc(&vlc_tab_fft_tone_offset[i], 8, tab_fft_tone_offset_sizes[i], + 12 + i, tab); + tab += tab_fft_tone_offset_sizes[i]; + } } #endif /* CONFIG_HARDCODED_TABLES */ diff --git a/libavcodec/qdm2data.h b/libavcodec/qdm2data.h index 69f66b4571..713f584269 100644 --- a/libavcodec/qdm2data.h +++ b/libavcodec/qdm2data.h @@ -91,45 +91,37 @@ static const uint8_t tab_type34[10][2] = { { 4, 3 }, { 6, 3 }, { 5, 3 }, }; -/* values in this table range from -1..22; adjust retrieved value by -1 */ -static const uint8_t tab_fft_tone_offset_0[23][2] = { +static const uint8_t tab_fft_tone_offset_sizes[] = { + 23, 28, 31, 34, 37 +}; + +static const uint8_t tab_fft_tone_offset[][2] = { + /* First table - 23 entries with range -1..21 */ { 2, 2 }, { 7, 7 }, { 15, 8 }, { 21, 8 }, { 3, 6 }, { 6, 6 }, { 13, 7 }, { 14, 8 }, { 18, 8 }, { 4, 4 }, { 5, 5 }, { 11, 7 }, { 10, 7 }, { 20, 6 }, { 12, 8 }, { 16, 9 }, { 22, 10 }, { 0, 10 }, { 17, 7 }, { 19, 6 }, { 8, 6 }, { 9, 6 }, { 1, 1 }, -}; - -/* values in this table range from -1..27; adjust retrieved value by -1 */ -static const uint8_t tab_fft_tone_offset_1[28][2] = { + /* Second table - 28 entries with range -1..26 */ { 8, 6 }, { 2, 6 }, { 7, 6 }, { 23, 7 }, { 12, 7 }, { 5, 4 }, { 10, 6 }, { 20, 8 }, { 25, 9 }, { 26, 10 }, { 27, 11 }, { 0, 11 }, { 22, 7 }, { 9, 5 }, { 13, 6 }, { 17, 6 }, { 4, 5 }, { 14, 6 }, { 19, 7 }, { 24, 7 }, { 3, 6 }, { 11, 6 }, { 21, 6 }, { 18, 6 }, { 16, 6 }, { 15, 6 }, { 6, 3 }, { 1, 1 }, -}; - -/* values in this table range from -1..31; adjust retrieved value by -1 */ -static const uint8_t tab_fft_tone_offset_2[31][2] = { + /* Third table - 31 entries with range -1..30 (1 omitted) */ { 14, 7 }, { 17, 7 }, { 15, 7 }, { 23, 9 }, { 28, 10 }, { 29, 11 }, { 30, 13 }, { 0, 13 }, { 31, 12 }, { 25, 8 }, { 10, 5 }, { 8, 4 }, { 9, 4 }, { 4, 4 }, { 22, 8 }, { 3, 8 }, { 21, 8 }, { 26, 9 }, { 27, 9 }, { 12, 6 }, { 11, 5 }, { 16, 7 }, { 18, 7 }, { 20, 8 }, { 24, 8 }, { 19, 7 }, { 13, 5 }, { 5, 3 }, { 1, 2 }, { 6, 3 }, { 7, 3 }, -}; - -/* values in this table range from -1..34; adjust retrieved value by -1 */ -static const uint8_t tab_fft_tone_offset_3[34][2] = { + /* Fourth table - 34 entries with range -1..33 (1 omitted) */ { 4, 4 }, { 7, 4 }, { 10, 4 }, { 3, 10 }, { 27, 10 }, { 29, 10 }, { 28, 10 }, { 22, 8 }, { 21, 7 }, { 15, 6 }, { 14, 5 }, { 8, 4 }, { 16, 6 }, { 19, 7 }, { 23, 8 }, { 26, 9 }, { 30, 10 }, { 33, 13 }, { 34, 14 }, { 0, 14 }, { 32, 12 }, { 31, 11 }, { 12, 5 }, { 5, 3 }, { 9, 3 }, { 1, 4 }, { 20, 7 }, { 25, 8 }, { 24, 8 }, { 18, 6 }, { 17, 5 }, { 6, 3 }, { 11, 4 }, { 13, 4 }, -}; - -/* values in this table range from -1..37; adjust retrieved value by -1 */ -static const uint8_t tab_fft_tone_offset_4[37][2] = { + /* Fifth table - 37 entries with range -1..36 (1 omitted) */ { 5, 3 }, { 4, 3 }, { 19, 8 }, { 33, 12 }, { 31, 12 }, { 28, 11 }, { 34, 14 }, { 37, 14 }, { 35, 15 }, { 0, 15 }, { 36, 14 }, { 32, 12 }, { 30, 11 }, { 24, 9 }, { 22, 8 }, { 23, 9 }, { 29, 10 }, { 27, 10 },