From patchwork Tue Jun 27 19:47:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 4139 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.1.76 with SMTP id 73csp2418595vsb; Tue, 27 Jun 2017 12:48:03 -0700 (PDT) X-Received: by 10.28.232.141 with SMTP id f13mr4291715wmi.59.1498592883822; Tue, 27 Jun 2017 12:48:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498592883; cv=none; d=google.com; s=arc-20160816; b=PO0AUIJVmnuNybQRhkGA5nm+pmI1jFHdt7LHm6hAJoWH48rw+r3m1keDF0SRCbohqo sZmS2cKTBVPyo3Dg46lLwqTw9wGyNxZyALbHEGXRAITk/nzrOWCrPvbVZQIVOEuCtS+o iu4uvnmKnIKSNNKNT4lRlvt4slLsrCPYw59lau05q+vUvqMhYPh2CPEu9gWXHxEUKbxz OLJU4x39Px2UN2yd9W3+wUMj7KXu2XldBG5mgWmGtPE05mxJhJ8BtBskLeGmuqZDpfT+ 8S4jCGisyU2TPQSJaLAb7Q8tWsgBP361uK9rp62o3bXkfb3xZprAMS6ksqcjywI2aaSq TVZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to:arc-authentication-results; bh=kSJezNaK/0xuKPR+QbS+cI10/h10uyinXRO0sDLPZ40=; b=F4Ywg13YS1IEL6MblrGtAXiY7wQNxy4Inmuz8Uq8lar0x+UhbCoQLYFqs6NoSEYBeb 3cqM51Brfz+LoVHAfwS+RorUKlm3J+SJOgNMyd79ltxn1ojfpk6NCJH0Wmm5/fm78nj9 r6B8lln+9xqiga5+XsHOIu2o3byvI8tgHH7EVyVTqUs3367GULNhDf3cn2eqVORJqAgu QJuXKyuCfr9qpzcwYC4sE7+/LvjtzQuN7/gQ8LzJh2tnu5YJk+UUucXD/ChEBVEOJQGu 3NXvJVvFpraETY/GTFLXJ0n1FyctvDxwbcmfMpczO0x8zbgYJ+u3srTkwgA0Xx+pC/UK tZZg== 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 62si93408wrg.61.2017.06.27.12.48.03; Tue, 27 Jun 2017 12:48:03 -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 D6D9768A4AA; Tue, 27 Jun 2017 22:47:49 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe05-1.mx.upcmail.net (vie01a-dmta-pe06-1.mx.upcmail.net [84.116.36.14]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7498D68A48E for ; Tue, 27 Jun 2017 22:47:43 +0300 (EEST) 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 1dPwSe-00087L-OU for ffmpeg-devel@ffmpeg.org; Tue, 27 Jun 2017 21:47:44 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id dvni1v0180S5wYM01vnj6o; Tue, 27 Jun 2017 21:47:43 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 27 Jun 2017 21:47:32 +0200 Message-Id: <20170627194735.27533-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170627194735.27533-1-michael@niedermayer.cc> References: <20170627194735.27533-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 2/5] avcodec/utvideodec: hardcode vlc bits 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 2.5% faster vlc decoding Signed-off-by: Michael Niedermayer --- libavcodec/utvideodec.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c index 815b71cfb6..411df47730 100644 --- a/libavcodec/utvideodec.c +++ b/libavcodec/utvideodec.c @@ -73,8 +73,8 @@ static int build_huff10(const uint8_t *src, VLC *vlc, int *fsym) syms[i] = he[i].sym; code += 0x80000000u >> (he[i].len - 1); } - - return ff_init_vlc_sparse(vlc, FFMIN(he[last].len, 11), last + 1, +#define VLC_BITS 11 + return ff_init_vlc_sparse(vlc, VLC_BITS, last + 1, bits, sizeof(*bits), sizeof(*bits), codes, sizeof(*codes), sizeof(*codes), syms, sizeof(*syms), sizeof(*syms), 0); @@ -117,7 +117,8 @@ static int build_huff(const uint8_t *src, VLC *vlc, int *fsym) code += 0x80000000u >> (he[i].len - 1); } - return ff_init_vlc_sparse(vlc, FFMIN(he[last].len, 11), last + 1, +#define VLC_BITS 11 + return ff_init_vlc_sparse(vlc, VLC_BITS, last + 1, bits, sizeof(*bits), sizeof(*bits), codes, sizeof(*codes), sizeof(*codes), syms, sizeof(*syms), sizeof(*syms), 0); @@ -196,7 +197,7 @@ static int decode_plane10(UtvideoContext *c, int plane_no, prev = 0x200; for (j = sstart; j < send; j++) { for (i = 0; i < width * step; i += step) { - pix = get_vlc2(&gb, vlc.table, vlc.bits, 3); + pix = get_vlc2(&gb, vlc.table, VLC_BITS, 3); if (pix < 0) { av_log(c->avctx, AV_LOG_ERROR, "Decoding error\n"); goto fail; @@ -302,7 +303,7 @@ static int decode_plane(UtvideoContext *c, int plane_no, prev = 0x80; for (j = sstart; j < send; j++) { for (i = 0; i < width * step; i += step) { - pix = get_vlc2(&gb, vlc.table, vlc.bits, 3); + pix = get_vlc2(&gb, vlc.table, VLC_BITS, 3); if (pix < 0) { av_log(c->avctx, AV_LOG_ERROR, "Decoding error\n"); goto fail;