From patchwork Tue Nov 10 10:47:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 23475 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 B2146449B06 for ; Tue, 10 Nov 2020 12:49:42 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9D54B68BDF3; Tue, 10 Nov 2020 12:49:42 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6351368BDB7 for ; Tue, 10 Nov 2020 12:49:32 +0200 (EET) Received: by mail-wm1-f66.google.com with SMTP id h62so2532947wme.3 for ; Tue, 10 Nov 2020 02:49:32 -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=fms6BVsb9lAjMcYe3YHbXwMNWhCV5cwv3KNn8k9w+Qs=; b=DsS/+6DeimlH5ILsXS5pCHkJOV0zAIvBZGVs6TGYVDbL5lGdE0TyctsDhmP2UxGR3O beXbbQDLJdS7tJo5Ijz5w/i2ckBJX0xIgr+B4Szg2Mk6fjmGFNu+hkFL6Bxjd9TXp9vw pZ0kyl48OOX6sZ3P/BozYFCvDJ2hZwnBvB8eJFxvVjtxdlgdaf0fN8J51EoER+N7xpix 28D38kx/fLEFIFeqfhlVj6bw8tp1zZV9e+yZFRSMlyFP9kylsf/Yw5N197SNKRdvzDzp hYzgdJh9kz4vXbZt1zhWVlZQRm16gW31XZPBo4R9weCVWO+FiGSJOPuweIMY8bbRf5eF fxUw== 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=fms6BVsb9lAjMcYe3YHbXwMNWhCV5cwv3KNn8k9w+Qs=; b=e6/Xn0kmqT6nCnJW3of7vL5svD6XgOwbWfyFCLCAuP3IXP16maZTYaHTVPMeCCsEUl m/l+I4x3FC4zWSSg44cgjMqY9AANSx+/07QgEMh1Sd1t6+6wqm+X6Sl7+Jptv586lprW LVf0nxRBtYhek0o2VAzGb5YNO5FuyWHVY8Uho1Tmw5w7IfSt5KEUH7hsWlz4jpj6PI19 A3zCCSD5f0r0w5Gjv+FHBifWMPKJ9PZXqjZXCGiDBYVwBoL6tEbJpjrhzM84knn17KvP NuzYpAE3vCsqRzYuToxU6Oxv+LHp3fC/W+5A7KCxKUZfnjum+eTCMQ+cxrkDkqP94okk wD0g== X-Gm-Message-State: AOAM530lIWqDN0+C/i6/85/IZUbg3fVOgDKDs4Hx9m02ejlVd4cRiB/p psGYcmMJX+rkxsy1v90z8Y8yLu+H9s4= X-Google-Smtp-Source: ABdhPJzYKoOMR60NGl92qFdAVT85Xmt9t6ObgYFOsQ88oGSBkFzEcOaL/8NlcEvrXy+xGfuWYqUFJg== X-Received: by 2002:a7b:cc13:: with SMTP id f19mr3970364wmh.44.1605005371529; Tue, 10 Nov 2020 02:49:31 -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.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2020 02:49:30 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 10 Nov 2020 11:47:09 +0100 Message-Id: <20201110104851.321029-13-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 012/114] avcodec/imc: Avoid offsets table when creating VLCs 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/imc.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/libavcodec/imc.c b/libavcodec/imc.c index 19a323e17d..a9e8a9c7e3 100644 --- a/libavcodec/imc.c +++ b/libavcodec/imc.c @@ -113,11 +113,6 @@ static VLC huffman_vlc[4][4]; #define IMC_VLC_BITS 9 #define VLC_TABLES_SIZE 9512 -static const int vlc_offsets[17] = { - 0, 640, 1156, 1732, 2308, 2852, 3396, 3924, - 4452, 5220, 5860, 6628, 7268, 7908, 8424, 8936, VLC_TABLES_SIZE -}; - static VLC_TYPE vlc_tables[VLC_TABLES_SIZE][2]; static inline double freq2bark(double freq) @@ -235,14 +230,15 @@ static av_cold int imc_decode_init(AVCodecContext *avctx) q->sqrt_tab[i] = sqrt(i); /* initialize the VLC tables */ - for (i = 0; i < 4 ; i++) { + for (int i = 0, offset = 0; i < 4 ; i++) { for (j = 0; j < 4; j++) { - huffman_vlc[i][j].table = &vlc_tables[vlc_offsets[i * 4 + j]]; - huffman_vlc[i][j].table_allocated = vlc_offsets[i * 4 + j + 1] - vlc_offsets[i * 4 + j]; + huffman_vlc[i][j].table = &vlc_tables[offset]; + huffman_vlc[i][j].table_allocated = VLC_TABLES_SIZE - offset;; ff_init_vlc_from_lengths(&huffman_vlc[i][j], IMC_VLC_BITS, imc_huffman_sizes[i], imc_huffman_lens[i][j], 1, imc_huffman_syms[i][j], 1, 1, 0, INIT_VLC_USE_NEW_STATIC); + offset += huffman_vlc[i][j].table_size; } }