From patchwork Sun Aug 5 20:29:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 9905 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:104:0:0:0:0:0 with SMTP id c4-v6csp2540569jad; Sun, 5 Aug 2018 13:31:18 -0700 (PDT) X-Google-Smtp-Source: AAOMgpefJZ47xSpu9dabfntNWwvjJwIkpzQxwJhXXMz4tJ1VcMmv0y1PpY1dHfE8DbTia8jUoWPy X-Received: by 2002:a1c:1fc6:: with SMTP id f189-v6mr9545620wmf.12.1533501077993; Sun, 05 Aug 2018 13:31:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533501077; cv=none; d=google.com; s=arc-20160816; b=uHbiImDCIzGaIF34KEqer8B/uqlM6G8SffK3hTLMG50dSe0VdMLH+E/dKy/hTtTpo4 Gxxc7tnFJ3ih2opJ8r4zaCvLknVVr8N+7fjUYK4ZimdWz8BbObG9wuii0dQfj8EhgD1D +zvSjvnesCF++VJeQ+uSFAqtVZOTkuTqEUdkyRTFEWvOH2oWtRUlYi7MJy+e7a/+h85B +iBisHt2PPiD+5l13Ps3MWm1EuR+mysHwp+1diFU4RzBxs3iQgzOHEH+yBfK3Sen4DFM bJLTTek9JHo7rjCs8Zu+fWK0kJ5TaZizBiL/Y1EWxfxW9pfW/Euy80HqcZ0Gz582KkWE nMtw== 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=3tVjg1CqRvFcl0/6l4TOOhBY4I0eIXlsH2aR5Yz5ROY=; b=z//20lQT4uCY1OVpPNDAz9n51JSQ2mag7vqttu/n9XyBsJCvMuNAHNVBE9sH02VNQm gbGsnwN77398/3ghUqc2h0rXORD9EfZd7rgxBKrG+Te+ffgbwxvFpPHhlQKazHFAgVDH SIc5j3vNkJldPoOjMxcHaBeeL+uKQURCWrn+qogw5xL3A0aTdYk8PRC5PdlhJDNkO4rv MV4QaxoZWomJuA0iyzpP0AT44BnQCxy1KWGdbZzUHERluED6s32sNdDyVvOPDgKrQ1vg kjN4sY88j+8R4YHBR89IHRmEN8XlVhiqimO9u+eRx+bV5IV8LlFvglDLve53D8seICxa PsxQ== 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 k130-v6si4012213wma.11.2018.08.05.13.31.17; Sun, 05 Aug 2018 13:31:17 -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 49371689C85; Sun, 5 Aug 2018 23:30:11 +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 7513F68A47A for ; Sun, 5 Aug 2018 23:30:03 +0300 (EEST) Received: from [172.31.218.52] (helo=vie01a-dmta-pe08-1.mx.upcmail.net) by vie01a-pqmta-pe01.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1fmPfS-00005Y-OO for ffmpeg-devel@ffmpeg.org; Sun, 05 Aug 2018 22:30:22 +0200 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe08.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1fmPfN-0003TW-EN for ffmpeg-devel@ffmpeg.org; Sun, 05 Aug 2018 22:30:17 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id KYWE1y00e0S5wYM01YWFUY; Sun, 05 Aug 2018 22:30:15 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 5 Aug 2018 22:29:32 +0200 Message-Id: <20180805202937.7563-4-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 4/9] avcodec/gdv: Combine first and 3rd case 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" Simplifies code Signed-off-by: Michael Niedermayer --- libavcodec/gdv.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/libavcodec/gdv.c b/libavcodec/gdv.c index 274552a7be..1efc64b1dc 100644 --- a/libavcodec/gdv.c +++ b/libavcodec/gdv.c @@ -80,11 +80,11 @@ static void rescale(GDVContext *gdv, uint8_t *dst, int w, int h, int scale_v, in return; } - if (gdv->scale_h && gdv->scale_v) { + if (gdv->scale_v) { for (j = 0; j < h; j++) { int y = h - j - 1; uint8_t *dst1 = dst + PREAMBLE_SIZE + y * w; - uint8_t *src1 = dst + PREAMBLE_SIZE + (y>>1) * (w>>1); + uint8_t *src1 = dst + PREAMBLE_SIZE + (y>>!!gdv->scale_h) * (w>>1); for (i = 0; i < w; i++) { int x = w - i - 1; dst1[x] = src1[(x>>1)]; @@ -97,16 +97,6 @@ static void rescale(GDVContext *gdv, uint8_t *dst, int w, int h, int scale_v, in uint8_t *src1 = dst + PREAMBLE_SIZE + (y>>1) * w; memcpy(dst1, src1, w); } - } else if (gdv->scale_v) { - for (j = 0; j < h; j++) { - int y = h - j - 1; - uint8_t *dst1 = dst + PREAMBLE_SIZE + y * w; - uint8_t *src1 = dst + PREAMBLE_SIZE + y * (w>>1); - for (i = 0; i < w; i++) { - int x = w - i - 1; - dst1[x] = src1[(x>>1)]; - } - } } if (scale_h && scale_v) {