From patchwork Thu Sep 26 15:45:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 15314 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 70A7144924E for ; Thu, 26 Sep 2019 18:46:41 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 607D468A530; Thu, 26 Sep 2019 18:46:41 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe05-2.mx.upcmail.net (vie01a-dmta-pe05-2.mx.upcmail.net [84.116.36.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7638468A2B1 for ; Thu, 26 Sep 2019 18:46:33 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe05.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1iDVyT-0009sW-1v for ffmpeg-devel@ffmpeg.org; Thu, 26 Sep 2019 17:46:33 +0200 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id DVxViDxuIwlysDVxViERzj; Thu, 26 Sep 2019 17:45:33 +0200 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.68.29 X-CNFS-Analysis: v=2.3 cv=E5OzWpVl c=1 sm=1 tr=0 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=jg8nFVCvOkeRVMIyQh4A:9 a=pHzHmUro8NiASowvMSCR:22 a=xoEH_sTeL_Rfw54TyV31:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 26 Sep 2019 17:45:02 +0200 Message-Id: <20190926154502.24843-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190926154502.24843-1-michael@niedermayer.cc> References: <20190926154502.24843-1-michael@niedermayer.cc> MIME-Version: 1.0 X-CMAE-Envelope: MS4wfPPS32Ihbclnaeu1piLIcODZ8j+28x7Yi12rPkwQWcdetzf4BHtuN7jqIqBkpsz927XzyUQBASpmE6ZY/tzb1+svCddBBPHsI15kAdJNtWpwlEef+l2I wqnwmrdg8TM6x6pcWnXwenB9LbD5VIbOONPVGv/Dd0xDgoCGF4q4PH2T Subject: [FFmpeg-devel] [PATCH 3/3] swscale/output: Avoid 64bit in Alpha in yuv2ya16_X_c_template() 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Michael Niedermayer --- libswscale/output.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libswscale/output.c b/libswscale/output.c index ed8a69287c..d192ea854b 100644 --- a/libswscale/output.c +++ b/libswscale/output.c @@ -905,7 +905,7 @@ yuv2ya16_X_c_template(SwsContext *c, const int16_t *lumFilter, for (i = 0; i < dstW; i++) { int j; int Y = -0x40000000; - int64_t A = 0xffff; + int A = 0xffff; for (j = 0; j < lumFilterSize; j++) Y += lumSrc[j][i] * lumFilter[j]; @@ -915,11 +915,12 @@ yuv2ya16_X_c_template(SwsContext *c, const int16_t *lumFilter, Y = av_clip_uint16(Y); if (hasAlpha) { - A = 1<<14; + A = -0x40000000 + (1<<14); for (j = 0; j < lumFilterSize; j++) A += alpSrc[j][i] * lumFilter[j]; A >>= 15; + A += 0x8000; A = av_clip_uint16(A); }