From patchwork Sat May 25 02:04:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ross X-Patchwork-Id: 13284 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 B906B44908E for ; Sat, 25 May 2019 05:05:14 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 96B396898BD; Sat, 25 May 2019 05:05:14 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mx.sdf.org (ol.sdf.org [205.166.94.20]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5196A6882FF for ; Sat, 25 May 2019 05:05:08 +0300 (EEST) Received: from 8649cc8d27b85f4cbae6bf536357691b (pa49-184-210-187.pa.vic.optusnet.com.au [49.184.210.187]) (authenticated (128 bits)) by mx.sdf.org (8.15.2/8.14.5) with ESMTPSA id x4P24tms011176 (using TLSv1.2 with cipher AES256-GCM-SHA384 (256 bits) verified NO) for ; Sat, 25 May 2019 02:05:03 GMT Date: Sat, 25 May 2019 12:04:49 +1000 From: Peter Ross To: ffmpeg-devel@ffmpeg.org Message-ID: MIME-Version: 1.0 User-Agent: Mutt/1.10.1 (2018-07-13) Subject: [FFmpeg-devel] [PATCH] avcodec/vp3data: combine eob_run_base and eob_run_get_bits tables 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" --- This provides a small readability improvement. I observe no performance change on x86_64 or arm6. libavcodec/vp3.c | 6 +++--- libavcodec/vp3data.h | 9 ++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c index b248c90413..63f60c9109 100644 --- a/libavcodec/vp3.c +++ b/libavcodec/vp3.c @@ -988,9 +988,9 @@ static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb, token = get_vlc2(gb, vlc_table, 11, 3); /* use the token to get a zero run, a coefficient, and an eob run */ if ((unsigned) token <= 6U) { - eob_run = eob_run_base[token]; - if (eob_run_get_bits[token]) - eob_run += get_bits(gb, eob_run_get_bits[token]); + eob_run = eob_run_table[token].base; + if (eob_run_table[token].bits) + eob_run += get_bits(gb, eob_run_table[token].bits); if (!eob_run) eob_run = INT_MAX; diff --git a/libavcodec/vp3data.h b/libavcodec/vp3data.h index c82b1b3a86..d520a10c76 100644 --- a/libavcodec/vp3data.h +++ b/libavcodec/vp3data.h @@ -198,11 +198,10 @@ static const int8_t fixed_motion_vector_table[64] = { }; /* only tokens 0..6 indicate eob runs */ -static const uint8_t eob_run_base[7] = { - 1, 2, 3, 4, 8, 16, 0 -}; -static const uint8_t eob_run_get_bits[7] = { - 0, 0, 0, 2, 3, 4, 12 +static const struct { + uint8_t base, bits; +} eob_run_table[7] = { + {1, 0}, {2, 0}, {3, 0}, {4, 2}, {8, 3}, {16, 4}, {0, 12} }; static const uint8_t zero_run_base[32] = {