From patchwork Sat Aug 4 00:58: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: 9884 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:104:0:0:0:0:0 with SMTP id c4-v6csp737608jad; Fri, 3 Aug 2018 17:59:30 -0700 (PDT) X-Google-Smtp-Source: AAOMgpezAP7GJPTGdFrNnIzbS2c/D56RMp0TF2qmZqEz8rYuJhYHzXMAAHbDXUxKvFhzZPILzqIJ X-Received: by 2002:a1c:7c0c:: with SMTP id x12-v6mr6303343wmc.58.1533344370683; Fri, 03 Aug 2018 17:59:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533344370; cv=none; d=google.com; s=arc-20160816; b=B0RVJ1IC0OV+iwUzNMbCy43o1pEhta3++p2i2utYpIlwBeEdiV5QlPYI1JINcX4r5h mQ/UfrLxR2XUBqbOXUdtrr8xQMRojugaLXjCdcDvbi7IMLl0h96+XFMb0H4242usnoko isNiqUdLmzIY9oorY9aXt7F2asWv9r7fEox8WoLn7JAbzdEkI6DRLDg2E38CRTiJA8Im VV04YbmHQaEy+6skR2kBRGZ+PyQo7F8cpmRPPDaYAMwah4mHAZP++DOgI5mmbI8NFi0x gzfPXPm5Oeo7t5AE9Ja7dpdiNJwc0GV/9Diz2KfA61Q1JbvbQ0Zb/fiM12PWvKkLEWWC SYMA== 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=9g366RClbSVGbvtq+sLXXcgZu/Z8iYfGBkK6XwWbIKU=; b=InFDNJ0a9m5hEehIQYvGko2ZRPR0RvAvazlNVdgwzNotBgvrv2jdDuJHCJx0PFEGWp 7EsFDbu99VtYBWGStOdDcaLM57tRwNX3FvrskDEGFlCe7FFUQB0lJchlZXyXicrEo8x8 PCcBPRFa/twkk5XXViwlvc783Rtf1pVK87nALUbEx/R629sd076df/+gdDbPo1VyHihZ XTxDavPcx8HTelMrsDEP1sPtcepUF+rbsdMI+cDdoLoB9QA8RiFMPd8SvQdtIaXVYuRz YhSulhCPWz7Ke2sW6rCWIxyG17uyeefpXfuUQsNd5sO2s9Hv7WQLsWbV2+JH+z70H+IG g8dA== 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 a83-v6si526343wmf.135.2018.08.03.17.59.30; Fri, 03 Aug 2018 17:59:30 -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 4A9DC689EB0; Sat, 4 Aug 2018 03:58:58 +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 F25FF689DB4 for ; Sat, 4 Aug 2018 03:58:50 +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 1flkuT-0004L0-RE for ffmpeg-devel@ffmpeg.org; Sat, 04 Aug 2018 02:59:09 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id Joz61y01Z0S5wYM01oz74U; Sat, 04 Aug 2018 02:59:07 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 4 Aug 2018 02:58:32 +0200 Message-Id: <20180804005833.16836-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180804005833.16836-1-michael@niedermayer.cc> References: <20180804005833.16836-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 3/4] avcodec/ivi: Only clip samples when needed in ivi_output_plane() 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" 435740 -> 396078 dezicycles Signed-off-by: Michael Niedermayer --- libavcodec/ivi.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libavcodec/ivi.c b/libavcodec/ivi.c index cea40d82ca..ebb7f03007 100644 --- a/libavcodec/ivi.c +++ b/libavcodec/ivi.c @@ -913,8 +913,15 @@ static void ivi_output_plane(IVIPlaneDesc *plane, uint8_t *dst, ptrdiff_t dst_pi return; for (y = 0; y < plane->height; y++) { - for (x = 0; x < plane->width; x++) - dst[x] = av_clip_uint8(src[x] + 128); + int m = 0; + for (x = 0; x < plane->width; x++) { + int t = src[x] + 128; + dst[x] = t; + m |= t; + } + if (m & ~255) + for (x = 0; x < plane->width; x++) + dst[x] = av_clip_uint8(src[x] + 128); src += pitch; dst += dst_pitch; }