From patchwork Sun Aug 5 20:29:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 9907 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:104:0:0:0:0:0 with SMTP id c4-v6csp2540470jad; Sun, 5 Aug 2018 13:31:10 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzri4UhXW769vn7lfs/wwi71vOatx7QAZTa4duGGX/NRlqKqLR/+Q+i0flSyoy52vSvEI9c X-Received: by 2002:adf:a354:: with SMTP id d20-v6mr7696477wrb.31.1533501070290; Sun, 05 Aug 2018 13:31:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533501070; cv=none; d=google.com; s=arc-20160816; b=RkWE8G7fum2+r3/4srnYpAVq26gFvG9ErrZPbJ8YRDBCRzXn3HfVeOOQHSXaqZVHA3 AMbLxdkv+1xGfR24tpokn265Fp2q41uBZa5ye+kb2duWh/HMsC9kBlFBVVFnJTWeZTCM 55loS9UqRsW6S9UJewioLp7MUvDUu746ZwB/dL7DOJ1Z67xSiCF6O5x21Njl6RxDMJAS sKLD1gsrxuGpuM5sP/WKYhDzL37ESoKKSNdeDCLAI/mKfdV1M0RWbljK/M10KITOvC9A kiVnhOTcy3bvyj8b8U0uEKPTs531mTD9S+qKQp4vSp10ngNCAUB5saQqJGaQT34tRHKd 7Bow== 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=lsBfcivSSheVfXMlZ11nNTsN+FVfeaz9iYnwjLOn9fA=; b=PLXdnJAzuJYJrqWF4QN9Lc0VtdKoGmD8MQu9j8olgFuDeefK0ieRF9HnrfC40GLGNw FymsvkzyhRBmi4DA+VqE8sOQMaDNDH3E2OGUqDZpXBUIJg3IsqsDEFj7++36G7EgEg8b bsdRMfsLLUpETucRkZfc9dl+S8sXot3OI2mKkkDXxsFDW12SomosqD9cqF6Moy1oFZXL CRLTRvnmCEhLaK5Os19qWe3yHabJ38qQshrTbjIEHRJOD6PxFzju924TZX5j2GigTTYP PHUbrDIy9ZTd9GyX7BhOCfihu+bJ8hYz7ZVucjYCxsajZCnwbc5wTEnUS6AYDQuM9ks+ fybQ== 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 y16-v6si3670673wma.48.2018.08.05.13.31.09; Sun, 05 Aug 2018 13:31:10 -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 75FE568A471; Sun, 5 Aug 2018 23:30:09 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe01-2.mx.upcmail.net (vie01a-qmta-pe01-2.mx.upcmail.net [62.179.121.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6B64968A463 for ; Sun, 5 Aug 2018 23:30:07 +0300 (EEST) Received: from [172.31.218.43] (helo=vie01a-dmta-pe05-1.mx.upcmail.net) by vie01a-pqmta-pe01.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1fmPfW-000147-PF for ffmpeg-devel@ffmpeg.org; Sun, 05 Aug 2018 22:30:26 +0200 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe05.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1fmPfW-0005lV-7v for ffmpeg-devel@ffmpeg.org; Sun, 05 Aug 2018 22:30:26 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id KYWM1y00G0S5wYM01YWNWH; Sun, 05 Aug 2018 22:30:22 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 5 Aug 2018 22:29:36 +0200 Message-Id: <20180805202937.7563-8-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 8/9] avcodec/gdv: Optimize 2x scaling loop a little in gdv_decode_frame() 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, 6 insertions(+), 2 deletions(-) diff --git a/libavcodec/gdv.c b/libavcodec/gdv.c index 1623febd1a..d497f76157 100644 --- a/libavcodec/gdv.c +++ b/libavcodec/gdv.c @@ -481,8 +481,12 @@ static int gdv_decode_frame(AVCodecContext *avctx, void *data, if (!gdv->scale_v) { memcpy(dst + didx, gdv->frame + sidx, avctx->width); } else { - for (x = 0; x < avctx->width; x++) { - dst[didx + x] = gdv->frame[sidx + x/2]; + for (x = 0; x < avctx->width - 1; x+=2) { + dst[didx + x ] = + dst[didx + x + 1] = gdv->frame[sidx + (x>>1)]; + } + for (; x < avctx->width; x++) { + dst[didx + x] = gdv->frame[sidx + (x>>1)]; } } if (!gdv->scale_h || ((y & 1) == 1)) {