From patchwork Thu Sep 13 02:24:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 10309 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:12c4:0:0:0:0:0 with SMTP id 65-v6csp92505jap; Wed, 12 Sep 2018 19:25:48 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYxeyvRjK1+N8DcJyT3FzTFf++946v5ppgZWADEorDG4MBbQIydYzka/YoUuycoFvvDFkJY X-Received: by 2002:a1c:9d02:: with SMTP id g2-v6mr3508440wme.122.1536805548814; Wed, 12 Sep 2018 19:25:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536805548; cv=none; d=google.com; s=arc-20160816; b=ULq7FcfpmKa7n7W8DHrSLTd5tYx4Qc3YAhMnUBHag1ok+ghNWXA6NSVv44vIizda9A yXTiB056igTJkOA3zrVNi8uyfGdlWQGyN7CW9tjogeNjxfLLqZixQBJwpCnRg8hELpRK XqNkzZC5I7PsUWnsLPrKdLuBLXrsnlCA3BKAauYuOz3pVROFMchYdEnespwej7nJFWXD fu8C4GMYFuB/4tT3Gma0ZE9QKn0yRgkEVBz8jH8eDzXq6Q3lHdqVypTkbsiS3tLqwiMg WcQ4t7meP1jK2UvGLuJTf0eRTOl3n9ih7PNBkyeldImpRMXzoBhNFgwsY/zZK1Pbanoe P/iw== 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:message-id:date:to:from:delivered-to; bh=zA9BoFbnlqSby/LP41iutfWZWrzbnGiXMRLSRbT2vvo=; b=nv23UO+dqJWGi2QToBw4dySYic9iV9qUT16iihbGGAKj4yQ00LFad/z9Y+iQqfee7V phtMv9mCNa9G0RQx/S6GP3LR2Z3y9LnW7kmJWf87JpQSxkNDP06w0kepRtrd3LZKwhdN P3Yxfi5iSQAbBR9iqwckpynasAtVgw6rthDIj0TjQnRlRfvR2ssKdnh8RwbN+16OU+Ua ZMr2j+HY8pzt4ZG4U9IVn6MDmKKTSi02qWV/reUzNvdNr3cdI7yFRF7mvjIz80cG04Zx tEPQ1lBeHEpH2mdeKks9TzwvESOEpmkfNdkBaQ5SGqEr+AHmUVlesCL4nPfXUF/3lbjK LNrQ== 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 a15-v6si2562504wrf.312.2018.09.12.19.25.48; Wed, 12 Sep 2018 19:25:48 -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 E1FE368A587; Thu, 13 Sep 2018 05:25:29 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe07-2.mx.upcmail.net (vie01a-dmta-pe07-2.mx.upcmail.net [84.116.36.18]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E05686802DB for ; Thu, 13 Sep 2018 05:25:23 +0300 (EEST) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe07.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1g0HK2-0006Kq-7y for ffmpeg-devel@ffmpeg.org; Thu, 13 Sep 2018 04:25:34 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id aqRR1y00i0S5wYM01qRSQl; Thu, 13 Sep 2018 04:25:27 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 13 Sep 2018 04:24:49 +0200 Message-Id: <20180913022450.19376-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.18.0 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/dvdsubdec: Avoid branch in decode_run_8bit() 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" Speed improvment 35.5 sec -> 34.7sec Signed-off-by: Michael Niedermayer --- libavcodec/dvdsubdec.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c index f1ac9e353e..13d52c8c68 100644 --- a/libavcodec/dvdsubdec.c +++ b/libavcodec/dvdsubdec.c @@ -83,10 +83,7 @@ static int decode_run_8bit(GetBitContext *gb, int *color) { int len; int has_run = get_bits1(gb); - if (get_bits1(gb)) - *color = get_bits(gb, 8); - else - *color = get_bits(gb, 2); + *color = get_bits(gb, 2 + 6*get_bits1(gb)); if (has_run) { if (get_bits1(gb)) { len = get_bits(gb, 7);