From patchwork Sat Nov 21 12:17:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 23932 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 8315D449863 for ; Sat, 21 Nov 2020 14:18:03 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6C2A868B93B; Sat, 21 Nov 2020 14:18:03 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 15CCF68B93B for ; Sat, 21 Nov 2020 14:17:57 +0200 (EET) Received: by mail-wr1-f65.google.com with SMTP id t4so697392wrr.12 for ; Sat, 21 Nov 2020 04:17:57 -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 :mime-version:content-transfer-encoding; bh=o7BLwDVPB97/07j9J8FU3UdgPx5TJw8+IFF5+GqAQ8s=; b=r7uAeM95CyYWrILbiAU5ic87meq7oiuWng5bJjMlXa3jH/tFVCH4T5d2qRlUQcSE0v ty0RpWa6pYWpNRA1hJNzqVaIuYL8Zwq2/jFqJ2ii7W8FWdn/EpMIy+UkzN8CqD7nrMQY j9xptbqsqjgS1O6FdR5/FwMH+ZH3LrmvFfIN/DUfSdCIsRGP8xuj3Nb6r1+kG1vI2bkv A789h/xOVWK8cOtePatjiPnRN5aeU2RzWqzha9FKIFdrDur72rOvic/FFGf592yTVq0G 6RUjKow76jXPCCSN6DvhzPjhSRru8BvmWiD23eusFji5dTbVrCPo3eHGdCeK4OKgF/cL ileg== 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:mime-version:content-transfer-encoding; bh=o7BLwDVPB97/07j9J8FU3UdgPx5TJw8+IFF5+GqAQ8s=; b=qAyUfcVXe/23/ZAmSLg8siKF2xrK2pYPS8/NAgRZkobH1yi2y3Xq5xGJYZMWCYbJUX o8Rl8XAk3ToUv+RUnCb/sJln3tprustRQSaSHh9XNNV06YI+R7jbx9twI5KqcLEE+hio VqTgzimpiu6+I9Jkloqir+X6gNciWok7Nya/Ds4BM61RvRVe5okVkL3Uhqu4uXLtV24T Qgt14CIhxrwXgEpJz9u76zALxqiO33D4Nmic9nlwCT0sj+4IQe5JxRKn+L+7W6WbOKTc fnH+iMRHZ7dptWJhKmokymIBl0ioOrhv/YdJmWiDmNEKqM1HG87nA28yI321kjOnyz8k 2NyQ== X-Gm-Message-State: AOAM530P+Sx/olXreA6bsssoE42vKQG618hj/ev9AGTfkSzNDqOe/x3T dSlDLfhft0FWeyyfuF8Ctu9Be4xtEyg+XA== X-Google-Smtp-Source: ABdhPJxWlhCu64H2tIQRfHlhqKmqPOM80ZS4jBeBBgXT9qEGepz1Apy0lg8eNLrzK9XC6jLLsFd8Yg== X-Received: by 2002:adf:fe46:: with SMTP id m6mr22609892wrs.254.1605961076425; Sat, 21 Nov 2020 04:17:56 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id 9sm4586092wmo.34.2020.11.21.04.17.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Nov 2020 04:17:55 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 21 Nov 2020 13:17:28 +0100 Message-Id: <20201121121728.1018014-3-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201121121728.1018014-1-andreas.rheinhardt@gmail.com> References: <20201121121728.1018014-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/3] avcodec/mlpdec: Avoid code duplication when initializing 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/mlpdec.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c index ec346868c6..ed25b71d2d 100644 --- a/libavcodec/mlpdec.c +++ b/libavcodec/mlpdec.c @@ -206,15 +206,14 @@ static VLC huff_vlc[3]; static av_cold void init_static(void) { - INIT_VLC_STATIC(&huff_vlc[0], VLC_BITS, 18, - &ff_mlp_huffman_tables[0][0][1], 2, 1, - &ff_mlp_huffman_tables[0][0][0], 2, 1, VLC_STATIC_SIZE); - INIT_VLC_STATIC(&huff_vlc[1], VLC_BITS, 16, - &ff_mlp_huffman_tables[1][0][1], 2, 1, - &ff_mlp_huffman_tables[1][0][0], 2, 1, VLC_STATIC_SIZE); - INIT_VLC_STATIC(&huff_vlc[2], VLC_BITS, 15, - &ff_mlp_huffman_tables[2][0][1], 2, 1, - &ff_mlp_huffman_tables[2][0][0], 2, 1, VLC_STATIC_SIZE); + for (int i = 0; i < 3; i++) { + static VLC_TYPE vlc_buf[3 * VLC_STATIC_SIZE][2]; + huff_vlc[i].table = &vlc_buf[i * VLC_STATIC_SIZE]; + huff_vlc[i].table_allocated = VLC_STATIC_SIZE; + init_vlc(&huff_vlc[i], VLC_BITS, 18, + &ff_mlp_huffman_tables[i][0][1], 2, 1, + &ff_mlp_huffman_tables[i][0][0], 2, 1, INIT_VLC_USE_NEW_STATIC); + } ff_mlp_init_crc(); }