From patchwork Fri Nov 20 07:19:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 23821 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 6B3FE44B51D for ; Fri, 20 Nov 2020 09:36:41 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D981A68BB3B; Fri, 20 Nov 2020 09:25:31 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3FD4F68BB61 for ; Fri, 20 Nov 2020 09:25:18 +0200 (EET) Received: by mail-ed1-f43.google.com with SMTP id q16so8461311edv.10 for ; Thu, 19 Nov 2020 23:25:18 -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=qyJ/An+0y8uYB8mxtbDfWAQcs1N6jLZzmizvJrUIB3U=; b=Y8DZoaYj3CEowYSfrcs4+AseeuHUXiMDoMQR5/pdG8YbZv761WUprvK8znPkB76JT7 GhV0cnHcWRu5DZrgBpRDtmsySIK4lN4n0M/KDoawF3erPB5LDVpg9EUiM8O1hd0tmjT5 oarZz1Z1Rsh63wLihjRd2aRIV9cRMqVyX87psRFM+0J2BaRy40nrN4RG1w7G5y5tnFTE 9FBZMDWQrI59yWbLOPLD/w9J+ySdx7vd9a9MqJ8aNxh/Uv1ou1GLc1BqajNaWuGEROG/ mdm/tzSqUga8dRaC92sa6c+NCuLDcfCzWJzeurOQ4tGBwnOFlJ41gPT61TdEPgs4RxMr buZA== 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=qyJ/An+0y8uYB8mxtbDfWAQcs1N6jLZzmizvJrUIB3U=; b=ocjO3AerEGLKCEHqDQFywfiTkSWL2JdEKQcOiins3GTlsZP0x1k4Uhe0837xwLJrX4 obkNIfgz3SI6DyESZ2cyKoMcKBJaT0O7xOcitQljXgfxbc1V5j377ZXcw5Cjj7HPQK1A uu/D+q32Y/v9buduOyAr0GqHuKRjffhCTLRlzq1eYdG9cqbBT+rzSWgYnPT0lrkP5QXU wzDNBd4nd1Ja/TXwiCfRF/uyOGqPxtjVJdLn6cauyxKkuoWjnh8gUvQxLU9NN0priCKN Ak/mAVTKHE1INelrBAdPPyjn7pKotpvKRMS54CyJf/R07V6Znhc6hesnYgfviy11476L W8Vw== X-Gm-Message-State: AOAM53192FHJuTu0AOKSiND8VCsLgcUjk2tH18UsOA8mq4NQV1gishrD 35+6bVcn1gPzt3y/HACvZRJ4dZL1xs8Qmw== X-Google-Smtp-Source: ABdhPJyR2YS4GrB6qrHc3qYejp5EHha4gn1xbcd90xlkHBM6gxzFpUc2jAdQeAQ5WL+obVRIPU/ifw== X-Received: by 2002:aa7:d6c2:: with SMTP id x2mr32975681edr.206.1605857117262; Thu, 19 Nov 2020 23:25:17 -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.25.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2020 23:25:16 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 20 Nov 2020 08:19:40 +0100 Message-Id: <20201120072116.818090-68-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 067/162] 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 e948e92295..2ae8449c14 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 },