From patchwork Sat Sep 12 09:07:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Reid X-Patchwork-Id: 22300 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 0F51444B659 for ; Sat, 12 Sep 2020 12:07:28 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EA9BE68BB3D; Sat, 12 Sep 2020 12:07:27 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4CD2168BB15 for ; Sat, 12 Sep 2020 12:07:20 +0300 (EEST) Received: by mail-pj1-f51.google.com with SMTP id a9so2902351pjg.1 for ; Sat, 12 Sep 2020 02:07:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nZUFXh4BhhanRYwv8TGkgl6/EYRZ+OMpZQuurYCqqRg=; b=ijDCrSLTkzpVJSTKaGLbosOAvNMuxOGwNcKCh0Zcp9EHdxRpo5BS11IroVhjATA6Af v9z+EscBKQdDpznXyLCWrWGLOSnQwdTW3KZwgDiDJDSsAhG9ZfPgL2GlOhh2//koPtB3 3RxZRJXcaShOE7cu2hrHFnXKiLndHI3MoAa0cZsmNp24Sxbjvrxwa1pKIqDgffluMqIE SzmOZoiUiZQYU+rgmU/3xrVsK4rZN3q5XnxkCXLCkRgf2UeAuXXajnZdsy+NbAdhvmu/ 0827coxc/ktOVAQOvTNUO/69hMrmI4z3vLuwQ7Cjeqn/i+g0ViVjaBp9WkG/wHwn8XNK EEfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nZUFXh4BhhanRYwv8TGkgl6/EYRZ+OMpZQuurYCqqRg=; b=maApFbs9JZ48xwMO9hiKvIes7CjIIuaQrUHs5IZOwOpG3QObIH63cBGtxmXdZCx/Ng 60AHh7uT74l8BSWsQVAbZY7GJQnWeBLOlzXGxhn0oEcpOF58hwnSKLDNbwe/06Nxg+Oh DG0MYnoETsMOt5ZfWJ3tGpjJSglnr4emdGpI8q4mKqmCxxqASlXmcje66ns2Ae4BMK3Q TT4qVNE+iEDyGBiljKRk2wkYdy7jLM5x5nEw0CbVppXFZdbWTLe4Bv75em1MAVCcglU5 UKNQdy1GOawqdVgRD1GT1HardEMgwguLRm4zY/MLe6kS0IdGShWwvi/BWzUDqmJj+qJH zbXQ== X-Gm-Message-State: AOAM530ZG1CDN2TW8ONBh+amC9p7mtQKi6fu3h87Bm+ek6SjVMXx6aJ9 XjET1YDuemy6+Ck6k37pRK5Y1uz1KFc= X-Google-Smtp-Source: ABdhPJzpV/tWNBuCDcqCj00JdeAVMf8wCN4jYf/1HuyAxwAKbnxgA7JpiAXW3Fgvbd9qGwdakIJJMQ== X-Received: by 2002:a17:90a:ee0d:: with SMTP id e13mr5982834pjy.227.1599901638622; Sat, 12 Sep 2020 02:07:18 -0700 (PDT) Received: from MRMacbook.hitronhub.home (S01069050ca607903.vc.shawcable.net. [174.7.236.190]) by smtp.gmail.com with ESMTPSA id a18sm3558044pgw.50.2020.09.12.02.07.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 Sep 2020 02:07:17 -0700 (PDT) From: mindmark@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Sat, 12 Sep 2020 02:07:13 -0700 Message-Id: <20200912090714.66582-2-mindmark@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200912090714.66582-1-mindmark@gmail.com> References: <20200912090714.66582-1-mindmark@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] fate: use correct uint32 layer 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 Cc: Mark Reid Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Mark Reid --- tests/fate/image.mak | 2 +- tests/ref/fate/exr-rgb-scanline-pxr24-half-uint32-13x9 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/fate/image.mak b/tests/fate/image.mak index 756d01c667..69b4ea5431 100644 --- a/tests/fate/image.mak +++ b/tests/fate/image.mak @@ -221,7 +221,7 @@ FATE_EXR += fate-exr-rgb-scanline-pxr24-float-half-l2 fate-exr-rgb-scanline-pxr24-float-half-l2: CMD = framecrc -layer "VRaySamplerInfo" -i $(TARGET_SAMPLES)/exr/rgb_scanline_pxr24_float_half.exr -pix_fmt gbrapf32le FATE_EXR += fate-exr-rgb-scanline-pxr24-half-uint32-13x9 -fate-exr-rgb-scanline-pxr24-half-uint32-13x9: CMD = framecrc -i $(TARGET_SAMPLES)/exr/rgb_scanline_pxr24_half_uint32_13x9.exr -pix_fmt rgb48le -vf scale +fate-exr-rgb-scanline-pxr24-half-uint32-13x9: CMD = framecrc -layer "VRaySamplerInfo" -i $(TARGET_SAMPLES)/exr/rgb_scanline_pxr24_half_uint32_13x9.exr -pix_fmt rgb48le -vf scale FATE_EXR += fate-exr-rgb-scanline-zip-half-float-l1 fate-exr-rgb-scanline-zip-half-float-l1: CMD = framecrc -i $(TARGET_SAMPLES)/exr/rgb_scanline_zip_half_float.exr -pix_fmt gbrpf32le diff --git a/tests/ref/fate/exr-rgb-scanline-pxr24-half-uint32-13x9 b/tests/ref/fate/exr-rgb-scanline-pxr24-half-uint32-13x9 index 523ed9c88b..2d209d8a63 100644 --- a/tests/ref/fate/exr-rgb-scanline-pxr24-half-uint32-13x9 +++ b/tests/ref/fate/exr-rgb-scanline-pxr24-half-uint32-13x9 @@ -3,4 +3,4 @@ #codec_id 0: rawvideo #dimensions 0: 13x9 #sar 0: 9/10 -0, 0, 0, 1, 702, 0x68c1450d +0, 0, 0, 1, 702, 0x86132f10 From patchwork Sat Sep 12 09:07:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Reid X-Patchwork-Id: 22301 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 1D33944B659 for ; Sat, 12 Sep 2020 12:07:31 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 01CB568BB44; Sat, 12 Sep 2020 12:07:31 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7D3D068BAD8 for ; Sat, 12 Sep 2020 12:07:21 +0300 (EEST) Received: by mail-pl1-f176.google.com with SMTP id bh1so2053983plb.12 for ; Sat, 12 Sep 2020 02:07:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=U2qWWuzSjw5TaCVZdcuHqYnIdPh5sefq+JnK7n9Zzqo=; b=FOl8Alwsg3459Wqt19/3elzPnfSEH6nUnUUhoBwYPKMK2XRY3QObSaBTx3A8rpcOLV zaUN8lypg8Nl2vpqLRG5qwfoy8B4zIPGU6IvFoe8CwQ2m5ayqXrLpgtnwvzdwBVZf04x +7csmtrzET4VPN/s1e1zvtcE2y3VW45ueLdbofo0aL2gvFxm0Z/VZ5gQrtGVmfkvMkL0 l4ytP9cnvXYS5CcpKz/jqzTj4DbNdyORwDO200rKnsUhjMu7Mg1QuZxDS5cYaYb+/BLH eCAlHhhQm+G0Eenh/psxQGrBPMY4l4KXEuY/Xxnyp580cj/A/VKgiO8GKw7xWfZt51sM O0BQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=U2qWWuzSjw5TaCVZdcuHqYnIdPh5sefq+JnK7n9Zzqo=; b=lswPfkz81IQ404Erav7LiFwmX4NQNmNT4/FRQwYKu3J8pRiJK9SvV7tXnp6hCfR/4G xS+itcUI8rS5UL/ucyjHnBzLBCR4OKH9hAMN0Csw+1OiqIOfN2cuOHH+iEKhDon6tuYu 6xvELrBUr85QhTp8QG+hcQvomeNyewDqMZ8KYiIMquw3OOmMwtRT3cSxreNBv8cjK22b +QuBtNOg9cedKMB2C6ZGDEgLVgyPCrGrNMPdb+JWpFEy2pZesrjVV1iyzDR6GX9KAN4n UZ3xI5dvxqLVGVPOQaXUtdvcWa59MQhNsIXh7rQEf+pZKB9OdoxygLWKqQeH2Foh+oWP cTXA== X-Gm-Message-State: AOAM530AGDJGLQ4VPK7ZMywUPC/ppGtxKkIqh5BR7EMhapMf862Bh+Oa n3gtUcMhkmhWS/Okjd5nXiX5YlcmkPY= X-Google-Smtp-Source: ABdhPJwydizTWV7fYvyavKNB6TijytBfLhmKad4IoLOJyRMgIq2OMiIKdXnw0kZBYyWf6ETSCWlzMg== X-Received: by 2002:a17:902:ee0b:: with SMTP id z11mr5615925plb.116.1599901639434; Sat, 12 Sep 2020 02:07:19 -0700 (PDT) Received: from MRMacbook.hitronhub.home (S01069050ca607903.vc.shawcable.net. [174.7.236.190]) by smtp.gmail.com with ESMTPSA id a18sm3558044pgw.50.2020.09.12.02.07.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 Sep 2020 02:07:18 -0700 (PDT) From: mindmark@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Sat, 12 Sep 2020 02:07:14 -0700 Message-Id: <20200912090714.66582-3-mindmark@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200912090714.66582-1-mindmark@gmail.com> References: <20200912090714.66582-1-mindmark@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] libswcale/input: fix incorrect rgbf32 yuv conversions 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 Cc: Mark Reid Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Mark Reid --- libswscale/input.c | 12 +++++------- tests/ref/fate/filter-pixfmts-scale | 8 ++++---- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/libswscale/input.c b/libswscale/input.c index 064ed5902f..67a85b0418 100644 --- a/libswscale/input.c +++ b/libswscale/input.c @@ -984,15 +984,14 @@ static av_always_inline void planar_rgbf32_to_uv(uint8_t *_dstU, uint8_t *_dstV, uint16_t *dstV = (uint16_t *)_dstV; int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX]; int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX]; - int bpc = 16; - int shift = 14; + for (i = 0; i < width; i++) { int g = av_clip_uint16(lrintf(65535.0f * rdpx(src[0] + i))); int b = av_clip_uint16(lrintf(65535.0f * rdpx(src[1] + i))); int r = av_clip_uint16(lrintf(65535.0f * rdpx(src[2] + i))); - dstU[i] = (ru*r + gu*g + bu*b + (257 << (RGB2YUV_SHIFT + bpc - 9))) >> (RGB2YUV_SHIFT + shift - 14); - dstV[i] = (rv*r + gv*g + bv*b + (257 << (RGB2YUV_SHIFT + bpc - 9))) >> (RGB2YUV_SHIFT + shift - 14); + dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT; + dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT; } } @@ -1003,14 +1002,13 @@ static av_always_inline void planar_rgbf32_to_y(uint8_t *_dst, const uint8_t *_s uint16_t *dst = (uint16_t *)_dst; int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX]; - int bpc = 16; - int shift = 14; + for (i = 0; i < width; i++) { int g = av_clip_uint16(lrintf(65535.0f * rdpx(src[0] + i))); int b = av_clip_uint16(lrintf(65535.0f * rdpx(src[1] + i))); int r = av_clip_uint16(lrintf(65535.0f * rdpx(src[2] + i))); - dst[i] = ((ry*r + gy*g + by*b + (33 << (RGB2YUV_SHIFT + bpc - 9))) >> (RGB2YUV_SHIFT + shift - 14)); + dst[i] = (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT; } } diff --git a/tests/ref/fate/filter-pixfmts-scale b/tests/ref/fate/filter-pixfmts-scale index d7020ad2c3..30e7cd5b06 100644 --- a/tests/ref/fate/filter-pixfmts-scale +++ b/tests/ref/fate/filter-pixfmts-scale @@ -25,8 +25,8 @@ gbrap12be 1d9b57766ba9c2192403f43967cb9af0 gbrap12le bb1ba1c157717db3dd612a76d38a018e gbrap16be c72b935a6e57a8e1c37bff08c2db55b1 gbrap16le 13eb0e62b1ac9c1c86c81521eaefab5f -gbrapf32be 42e53d9edccbd9e09c4cd78780ba92f3 -gbrapf32le eebf3973ef94c841f0a1ceb1ed61621d +gbrapf32be 366b804d5697276e8c481c4bdf05a00b +gbrapf32le 558a268e6d6b907449d1056afab78f29 gbrp dc3387f925f972c61aae7eb23cdc19f0 gbrp10be 0277d4c3a8498d75e2783fb81379e481 gbrp10le f3d70f8ab845c3c9b8f7452e4a6e285a @@ -38,8 +38,8 @@ gbrp16be 5fc826cfabebfc1442cb793c4b6303e2 gbrp16le 1b3e0b63d47a3e1b6b20931316883bf2 gbrp9be d9c88968001e1452ff31fbc8d16b18a0 gbrp9le 2ccfed0816bf6bd4bb3a5b7591d9603a -gbrpf32be 4614d32e4417f80e0adcc1bdcf6cde42 -gbrpf32le 1366ee77e5559672260bbe51040e28b2 +gbrpf32be f3d0cefdf11c861001880772d817aac8 +gbrpf32le 290468205c1c18a0667edfca45061aee gray 221201cc7cfc4964eacd8b3e426fd276 gray10be 9452756d0b37f4f5c7cae7635e22d747 gray10le 37fd2e1ec6b66410212d39a342e864df