From patchwork Sun Aug 5 20:29:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 9903 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:104:0:0:0:0:0 with SMTP id c4-v6csp2540165jad; Sun, 5 Aug 2018 13:30:45 -0700 (PDT) X-Google-Smtp-Source: AAOMgpewnhqOcW4LZpBK5Sqqu9dK4I50wURy5KM+R87+QmUdY+in0056VSjkPSIQmCEJOulTr01S X-Received: by 2002:a1c:f306:: with SMTP id q6-v6mr9821939wmq.111.1533501045337; Sun, 05 Aug 2018 13:30:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533501045; cv=none; d=google.com; s=arc-20160816; b=xSXX2OxBn6JH5V213RmwzjaF1k3RixnsCXBTGHNCT60wUghEo3Kd7qLSxXTehbiY2x 6Cp6zUZLqyfJAvuA3uy+4HAZBPTjS6OuCFKuSReJkPwDglswP7cvZ1EEqEmh+Z6d7nK5 dikYX5nuLj6+rpNzbH/lLNp6Gm+gy642UXNsP7T7qA43kY3hK8OtnkjCaLgLDNmqkmnd sejtlnBDrxKz3MjKJQtTOBwlMBrjRrDRtpPXx5m9JJEfWZAeoZrugS4Odzv49O9c/XVw vfmTy9X6x6ydffb5RPECT7A3ouriFEs6LTgcRrH2VfUBrtKSng+8+FtUlx3yfCo2oazW TeEg== 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=+GiroruECt2zcQz/nErzeqEPzuRTnXV5Y6PE4dCOQ6M=; b=WYgzmn1IuiIlnmgQfAHNq7E4h2wOmRvgDT2xjbr//OPOwa0MyMP8imGuI7PVcYDlnu gz6TNYtYmZER/87d5HvFvPHh+jQyhK2AIvzPWAQ3Jz94F4a10dYZV4FSxrbkOC+0muxR DDAfVC61umBAuulAlkn39eAxoCGMJP88aug1hxS3AnLrTLP9OHIb8eERPrcdoih4MrLI pJ9RLP4yTqz3ZofskVcEoeBgY6eiQPT7g76orqVGp+QpVRPYjuERDgkr8DIFOofFMFi+ uA3Wzr1EZ0LToxSTlyTpvZM2LXdM/WuFOeRUd6BOMYDZi36Gep1+5BeBbrchNcRb0iJ5 l3eg== 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 p5-v6si7280985wre.361.2018.08.05.13.30.45; Sun, 05 Aug 2018 13:30:45 -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 503A668A45F; Sun, 5 Aug 2018 23:30:07 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe04-1.mx.upcmail.net (vie01a-dmta-pe04-1.mx.upcmail.net [62.179.121.163]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6EF44680758 for ; Sun, 5 Aug 2018 23:30:06 +0300 (EEST) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe04.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1fmPfV-0006b2-O4 for ffmpeg-devel@ffmpeg.org; Sun, 05 Aug 2018 22:30:25 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id KYWG1y01r0S5wYM01YWHVH; Sun, 05 Aug 2018 22:30:17 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 5 Aug 2018 22:29:34 +0200 Message-Id: <20180805202937.7563-6-michael@niedermayer.cc> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180805202937.7563-1-michael@niedermayer.cc> References: <20180805202937.7563-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 6/9] avcodec/gdv: Eliminate 50% of the reads in the first inner loop in rescale() 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" Signed-off-by: Michael Niedermayer --- libavcodec/gdv.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavcodec/gdv.c b/libavcodec/gdv.c index 595d8ff4e4..aea15a88ef 100644 --- a/libavcodec/gdv.c +++ b/libavcodec/gdv.c @@ -85,9 +85,15 @@ static void rescale(GDVContext *gdv, uint8_t *dst, int w, int h, int scale_v, in int y = h - j - 1; uint8_t *dst1 = dst + PREAMBLE_SIZE + y * w; uint8_t *src1 = dst + PREAMBLE_SIZE + (y>>!!gdv->scale_h) * (w>>1); - for (x = w - 1; x >= 0; x--) { + + for (x = w - 1; x >= 0 && !(x&1); x--) { dst1[x] = src1[(x>>1)]; } + + for (x--; x >= 0; x-=2) { + dst1[x ] = + dst1[x+1] = src1[(x>>1)]; + } } } else if (gdv->scale_h) { for (j = 0; j < h; j++) {