From patchwork Wed Sep 19 16:05:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 10412 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:12c4:0:0:0:0:0 with SMTP id 65-v6csp875865jap; Wed, 19 Sep 2018 09:07:54 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYcczAzCA5DMUcW64DYHcyL7SxDr3DTF9uaUn9BHZ8oVKOPxmXAUSSPzBzyc3rphsSBpJSD X-Received: by 2002:a1c:bc86:: with SMTP id m128-v6mr21395769wmf.147.1537373274005; Wed, 19 Sep 2018 09:07:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537373273; cv=none; d=google.com; s=arc-20160816; b=ZFXM5Xc2dXa2o4ahfDx60UH87fpxtrQDV09tWVulx2JV521ujvUd4b9Z79wNMF1Uti M7OoJ8OQtk4BIy9tSZ37iNKR5VDmGj1Xxufc5hTLmze7lQh2lfQCS5v1o6Qkq9ldahCk nuBlGVKngQ8PoZLU2wDNtjWZbbPEQxusMDeuiAEpiIEGelIAGToFBuP1RhEfC62Sekr4 /TDUz/Q/B3kceapiZ/6yLujF7FNKTT7Uy/woasJd9ruvr2GgK2vu8jTxJLwmKN7dATjK 2xvWdfHqNlZ0vTgfO6VRafpwewpdA1T52M0D2g622p4TKNPXU4wOEsFW8dqhePaVWTxZ Wv1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=CsTpZWJJ9Z/FIkd2VQTqJADWXLxH0TpICcWvG64vOsI=; b=Vxotm9IRNnIeC2OiTKlt+Skc2EsC2Lu4wGi/00U79aeYqsWp/PKuV2toccGxcNfm3t yRiI9G4uKg74nJB1DLOwmsLuQRTrafsjNUPS82GltxnKymTfBDpC+DvZdWD8pGGLrOOn CrRPYShXEsZji0VQDazDb56AVp8rGtKz7s10ykdlV4V6zuTKCpRe6DqjlKehG0nkVF8d f7lZmeLWWenMZ//TwGZ/zU08+N/CfrM+7o/Ziq0qCfzWKwiged/WcoaifKUiQzIfv5NB MLAN7kcUDa4laFr+u5UDsfTGwFEN2B+CSBTqq6whb13sLGNjF57+XzJLYhy5YRvGINM7 XGDA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 78-v6si3086860wmp.200.2018.09.19.09.07.53; Wed, 19 Sep 2018 09:07:53 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0893B68A6C9; Wed, 19 Sep 2018 19:06:23 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe01-1.mx.upcmail.net (vie01a-qmta-pe01-1.mx.upcmail.net [62.179.121.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 55F2A68A67C for ; Wed, 19 Sep 2018 19:06:20 +0300 (EEST) Received: from [172.31.218.48] (helo=vie01a-dmta-pe06-3.mx.upcmail.net) by vie01a-pqmta-pe01.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1g2ezp-0007Xy-N1 for ffmpeg-devel@ffmpeg.org; Wed, 19 Sep 2018 18:06:33 +0200 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe06.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1g2ezp-0005K7-EO for ffmpeg-devel@ffmpeg.org; Wed, 19 Sep 2018 18:06:33 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id dU6S1y00E0S5wYM01U6Tm7; Wed, 19 Sep 2018 18:06:27 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Wed, 19 Sep 2018 18:05:32 +0200 Message-Id: <20180919160532.25760-10-michael@niedermayer.cc> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180919160532.25760-1-michael@niedermayer.cc> References: <20180919160532.25760-1-michael@niedermayer.cc> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 10/10] avcodec/speedhq: Make speedhq_vlc const 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Michael Niedermayer --- libavcodec/speedhq.c | 73 +++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 39 deletions(-) diff --git a/libavcodec/speedhq.c b/libavcodec/speedhq.c index 6d3487ca19..890b8253cd 100644 --- a/libavcodec/speedhq.c +++ b/libavcodec/speedhq.c @@ -58,40 +58,40 @@ typedef struct SHQContext { /* AC codes: Very similar but not identical to MPEG-2. */ -static uint16_t speedhq_vlc[123][2] = { - {0x02, 2}, {0x06, 3}, {0x07, 4}, {0x1c, 5}, - {0x1d, 5}, {0x05, 6}, {0x04, 6}, {0x7b, 7}, - {0x7c, 7}, {0x23, 8}, {0x22, 8}, {0xfa, 8}, - {0xfb, 8}, {0xfe, 8}, {0xff, 8}, {0x1f,14}, - {0x1e,14}, {0x1d,14}, {0x1c,14}, {0x1b,14}, - {0x1a,14}, {0x19,14}, {0x18,14}, {0x17,14}, - {0x16,14}, {0x15,14}, {0x14,14}, {0x13,14}, - {0x12,14}, {0x11,14}, {0x10,14}, {0x18,15}, - {0x17,15}, {0x16,15}, {0x15,15}, {0x14,15}, - {0x13,15}, {0x12,15}, {0x11,15}, {0x10,15}, - {0x02, 3}, {0x06, 5}, {0x79, 7}, {0x27, 8}, - {0x20, 8}, {0x16,13}, {0x15,13}, {0x1f,15}, - {0x1e,15}, {0x1d,15}, {0x1c,15}, {0x1b,15}, - {0x1a,15}, {0x19,15}, {0x13,16}, {0x12,16}, - {0x11,16}, {0x10,16}, {0x18,13}, {0x17,13}, - {0x05, 5}, {0x07, 7}, {0xfc, 8}, {0x0c,10}, - {0x14,13}, {0x18,12}, {0x14,12}, {0x13,12}, - {0x10,12}, {0x1a,13}, {0x19,13}, {0x07, 5}, - {0x26, 8}, {0x1c,12}, {0x13,13}, {0x1b,12}, - {0x06, 6}, {0xfd, 8}, {0x12,12}, {0x1d,12}, - {0x07, 6}, {0x04, 9}, {0x12,13}, {0x06, 7}, - {0x1e,12}, {0x14,16}, {0x04, 7}, {0x15,12}, - {0x05, 7}, {0x11,12}, {0x78, 7}, {0x11,13}, - {0x7a, 7}, {0x10,13}, {0x21, 8}, {0x1a,16}, - {0x25, 8}, {0x19,16}, {0x24, 8}, {0x18,16}, - {0x05, 9}, {0x17,16}, {0x07, 9}, {0x16,16}, - {0x0d,10}, {0x15,16}, {0x1f,12}, {0x1a,12}, - {0x19,12}, {0x17,12}, {0x16,12}, {0x1f,13}, - {0x1e,13}, {0x1d,13}, {0x1c,13}, {0x1b,13}, - {0x1f,16}, {0x1e,16}, {0x1d,16}, {0x1c,16}, - {0x1b,16}, - {0x01,6}, /* escape */ - {0x06,4}, /* EOB */ +static const uint16_t speedhq_vlc[123][2] = { + {0x0001, 2}, {0x0003, 3}, {0x000E, 4}, {0x0007, 5}, + {0x0017, 5}, {0x0028, 6}, {0x0008, 6}, {0x006F, 7}, + {0x001F, 7}, {0x00C4, 8}, {0x0044, 8}, {0x005F, 8}, + {0x00DF, 8}, {0x007F, 8}, {0x00FF, 8}, {0x3E00, 14}, + {0x1E00, 14}, {0x2E00, 14}, {0x0E00, 14}, {0x3600, 14}, + {0x1600, 14}, {0x2600, 14}, {0x0600, 14}, {0x3A00, 14}, + {0x1A00, 14}, {0x2A00, 14}, {0x0A00, 14}, {0x3200, 14}, + {0x1200, 14}, {0x2200, 14}, {0x0200, 14}, {0x0C00, 15}, + {0x7400, 15}, {0x3400, 15}, {0x5400, 15}, {0x1400, 15}, + {0x6400, 15}, {0x2400, 15}, {0x4400, 15}, {0x0400, 15}, + {0x0002, 3}, {0x000C, 5}, {0x004F, 7}, {0x00E4, 8}, + {0x0004, 8}, {0x0D00, 13}, {0x1500, 13}, {0x7C00, 15}, + {0x3C00, 15}, {0x5C00, 15}, {0x1C00, 15}, {0x6C00, 15}, + {0x2C00, 15}, {0x4C00, 15}, {0xC800, 16}, {0x4800, 16}, + {0x8800, 16}, {0x0800, 16}, {0x0300, 13}, {0x1D00, 13}, + {0x0014, 5}, {0x0070, 7}, {0x003F, 8}, {0x00C0, 10}, + {0x0500, 13}, {0x0180, 12}, {0x0280, 12}, {0x0C80, 12}, + {0x0080, 12}, {0x0B00, 13}, {0x1300, 13}, {0x001C, 5}, + {0x0064, 8}, {0x0380, 12}, {0x1900, 13}, {0x0D80, 12}, + {0x0018, 6}, {0x00BF, 8}, {0x0480, 12}, {0x0B80, 12}, + {0x0038, 6}, {0x0040, 9}, {0x0900, 13}, {0x0030, 7}, + {0x0780, 12}, {0x2800, 16}, {0x0010, 7}, {0x0A80, 12}, + {0x0050, 7}, {0x0880, 12}, {0x000F, 7}, {0x1100, 13}, + {0x002F, 7}, {0x0100, 13}, {0x0084, 8}, {0x5800, 16}, + {0x00A4, 8}, {0x9800, 16}, {0x0024, 8}, {0x1800, 16}, + {0x0140, 9}, {0xE800, 16}, {0x01C0, 9}, {0x6800, 16}, + {0x02C0, 10}, {0xA800, 16}, {0x0F80, 12}, {0x0580, 12}, + {0x0980, 12}, {0x0E80, 12}, {0x0680, 12}, {0x1F00, 13}, + {0x0F00, 13}, {0x1700, 13}, {0x0700, 13}, {0x1B00, 13}, + {0xF800, 16}, {0x7800, 16}, {0xB800, 16}, {0x3800, 16}, + {0xD800, 16}, + {0x0020, 6}, /* escape */ + {0x0006, 4} /* EOB */ }; static const uint8_t speedhq_level[121] = { @@ -580,7 +580,6 @@ static av_cold void speedhq_static_init(void) { uint16_t ff_mpeg12_vlc_dc_lum_code_reversed[12]; uint16_t ff_mpeg12_vlc_dc_chroma_code_reversed[12]; - int i; /* Exactly the same as MPEG-2, except little-endian. */ reverse_code(ff_mpeg12_vlc_dc_lum_code, @@ -598,10 +597,6 @@ static av_cold void speedhq_static_init(void) ff_mpeg12_vlc_dc_chroma_bits, 1, 1, ff_mpeg12_vlc_dc_chroma_code_reversed, 2, 2, 514); - /* Reverse the AC VLC, because INIT_VLC_LE wants it in that order. */ - for (i = 0; i < FF_ARRAY_ELEMS(speedhq_vlc); ++i) { - speedhq_vlc[i][0] = reverse(speedhq_vlc[i][0], speedhq_vlc[i][1]); - } ff_rl_init(&ff_rl_speedhq, ff_speedhq_static_rl_table_store); INIT_2D_VLC_RL(ff_rl_speedhq, 674, INIT_VLC_LE);