From patchwork Sat Aug 20 04:31:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Langdale X-Patchwork-Id: 37366 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp156345pzh; Fri, 19 Aug 2022 21:32:18 -0700 (PDT) X-Google-Smtp-Source: AA6agR54ZE7RXVw6hffL9sN7BstpRjzilaoKa1uQ6mhWPCzYy5WAUPvKgbXoLnLkMppJMnGu2Wyf X-Received: by 2002:a05:6402:4511:b0:43b:a182:8a0a with SMTP id ez17-20020a056402451100b0043ba1828a0amr8445815edb.410.1660969938668; Fri, 19 Aug 2022 21:32:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660969938; cv=none; d=google.com; s=arc-20160816; b=Sv1rw3i68ogle+LtEZrw96YkU54J040vjkIgUrkEzPoYvbUSIpXXg2AUeC55LzWk0t s1V21QAfHJGiTuAiZNoh+9zTAQ5ML1+QBZIrjzqsUiYY5ZdDrA9SMGWAkKLx5TdSl5XT hcoc5sva8eash/om7/hvRNYe7tKEHE8e45+0dqJAa3su4E4W3Wg4tbtS013GeHXs+X/3 YyuphTzVLD2Z3AXpz8ZukHRJa1wrNKRhsBB7tZadxUEvxiPZxpKjTu3V6+oLGab5N45V AciMTosw372RwsdS/iopwTn0yI4CXvJ4tU52d1gIzIKe8U9il39LLL3ct9ZWD0UxYlWK thkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=ZHhKAkUH+gpJ2zB+dCaG6SddU3MKju5krFSyg7HDm+k=; b=He7UQxrRRH9lPJGLga6ygsm/NLvbbIAYIN4xkg18P6Rn4RAW3ZG9Gp/IJTX85VWFAY fwj7EtupdjbMR1t96NCRIxTlKbuOGIuUzSyLS/FhzwaRJGFpOnr56HdngdlrnnCY7/G6 pjyP1unFT8W3KmPk6P5dH+pqBW16VA9qz7yQP3SsRkhsRyl0+6uX8ArZHkd2tlN4lnu7 R8weUiMrHjVXAMTS4VlJOq9tQov9XMUl8mI12rrUqL55pI9D5NjJAfd4TEFaSdtt3pn1 4MifAml/y5yOvj/XolhLmkQ17GIsN/c5LuQKNu2OVBwEERLpYkLwDcCvimu1D0NU5BOS f78g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@overt.org header.s=mail header.b=Fds3Ftqk; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=overt.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id q12-20020a056402518c00b0044665ff00fdsi1383881edd.558.2022.08.19.21.32.18; Fri, 19 Aug 2022 21:32:18 -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; dkim=neutral (body hash did not verify) header.i=@overt.org header.s=mail header.b=Fds3Ftqk; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=overt.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A166C68B98E; Sat, 20 Aug 2022 07:32:04 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.overt.org (mail.overt.org [157.230.92.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C6FAF68B54C for ; Sat, 20 Aug 2022 07:31:56 +0300 (EEST) Received: from authenticated-user (mail.overt.org [157.230.92.47]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by mail.overt.org (Postfix) with ESMTPSA id 629923F22B; Fri, 19 Aug 2022 23:31:55 -0500 (CDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=overt.org; s=mail; t=1660969915; bh=0p/xIchCzLf02a5+Ma/Mq012C21/TVBfWZYnZCAqI6Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fds3FtqkRY9ENQYkEOt+7l4Ca41PrabrKd3qgPSjzRwSTxnlELvpASmsnmEANFcCW Pz4ID9XLMW6JUbM/0H858BH1d+Ub5prdKoD3FdXSaVrbNy6L2NsFlJ5VrsfY8Lr9F7 koOGEWJe7SFdF2oLJYIZ3ADPlXywovp12cP46X4l7JzK6U1ZRQ12/A2lOfzwGf9Tor yRudFW7+uwxwu+w+uuVkKZszMmhBeijfcwvmpRKjtkOcrD8kvpj8XwuschwqtOi64c D/9ETn6mcDKTAGTEBljzdqokQgQZsViYWSn9kMrHrb8X+1JC27idauAUeudRCof8CS QPFl3jaLyVK/w== From: Philip Langdale To: ffmpeg-devel@ffmpeg.org Date: Fri, 19 Aug 2022 21:31:44 -0700 Message-Id: <20220820043146.398996-2-philipl@overt.org> In-Reply-To: <20220820043146.398996-1-philipl@overt.org> References: <20220820043146.398996-1-philipl@overt.org> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/3] lavu/pixfmt: Introduce VUYX format X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: Philip Langdale Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: bm2MFS4oAF4t This is the alphaless version of VUYA that I introduced recently. After further discussion and noting that the Intel vaapi driver explicitly lists XYUV as a support format for encoding and decoding 8bit 444 content, we decided to switch our usage and avoid the overhead of having a declared alpha channel around. Note that I am not removing VUYA, as this turned out to have another use, which was to replace the need for v408enc/dec when dealing with the format. The vaapi switching will happen in the next change Signed-off-by: Philip Langdale --- libavutil/pixdesc.c | 11 +++++++++++ libavutil/pixfmt.h | 2 ++ libavutil/tests/pixfmt_best.c | 1 + tests/ref/fate/imgutils | 1 + tests/ref/fate/pixfmt_best | 2 +- tests/ref/fate/sws-pixdesc-query | 3 +++ 6 files changed, 19 insertions(+), 1 deletion(-) diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index f7558ff8b9..79ebfd3f16 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -2504,6 +2504,17 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { }, .flags = AV_PIX_FMT_FLAG_ALPHA, }, + [AV_PIX_FMT_VUYX] = { + .name = "vuyx", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 4, 2, 0, 8 }, /* Y */ + { 0, 4, 1, 0, 8 }, /* U */ + { 0, 4, 0, 0, 8 }, /* V */ + }, + }, [AV_PIX_FMT_RGBAF16BE] = { .name = "rgbaf16be", .nb_components = 4, diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index 86c9bdefeb..7d45561395 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -372,6 +372,8 @@ enum AVPixelFormat { AV_PIX_FMT_RGBAF16BE, ///< IEEE-754 half precision packed RGBA 16:16:16:16, 64bpp, RGBARGBA..., big-endian AV_PIX_FMT_RGBAF16LE, ///< IEEE-754 half precision packed RGBA 16:16:16:16, 64bpp, RGBARGBA..., little-endian + AV_PIX_FMT_VUYX, ///< packed VUYX 4:4:4, 32bpp, Variant of VUYA where alpha channel is left undefined + AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions }; diff --git a/libavutil/tests/pixfmt_best.c b/libavutil/tests/pixfmt_best.c index de53baf092..0542af494f 100644 --- a/libavutil/tests/pixfmt_best.c +++ b/libavutil/tests/pixfmt_best.c @@ -84,6 +84,7 @@ int main(void) TEST(AV_PIX_FMT_GBRP, AV_PIX_FMT_RGB24); TEST(AV_PIX_FMT_0RGB, AV_PIX_FMT_RGB24); TEST(AV_PIX_FMT_GBRP16, AV_PIX_FMT_RGB48); + TEST(AV_PIX_FMT_VUYX, AV_PIX_FMT_YUV444P); // Formats additionally containing alpha (here ignored). TEST(AV_PIX_FMT_YA8, AV_PIX_FMT_GRAY8); diff --git a/tests/ref/fate/imgutils b/tests/ref/fate/imgutils index 01c9877de5..47b73b1b64 100644 --- a/tests/ref/fate/imgutils +++ b/tests/ref/fate/imgutils @@ -249,3 +249,4 @@ p416le planes: 2, linesizes: 128 256 0 0, plane_sizes: 6144 12288 vuya planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 rgbaf16be planes: 1, linesizes: 512 0 0 0, plane_sizes: 24576 0 0 0, plane_offsets: 0 0 0, total_size: 24576 rgbaf16le planes: 1, linesizes: 512 0 0 0, plane_sizes: 24576 0 0 0, plane_offsets: 0 0 0, total_size: 24576 +vuyx planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 diff --git a/tests/ref/fate/pixfmt_best b/tests/ref/fate/pixfmt_best index 1da1846275..783c5fe640 100644 --- a/tests/ref/fate/pixfmt_best +++ b/tests/ref/fate/pixfmt_best @@ -1 +1 @@ -74 tests passed, 0 tests failed. +75 tests passed, 0 tests failed. diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query index f79d99e513..f54372d364 100644 --- a/tests/ref/fate/sws-pixdesc-query +++ b/tests/ref/fate/sws-pixdesc-query @@ -219,6 +219,7 @@ isYUV: uyvy422 uyyvyy411 vuya + vuyx xyz12be xyz12le y210be @@ -753,6 +754,7 @@ Packed: uyvy422 uyyvyy411 vuya + vuyx x2bgr10be x2bgr10le x2rgb10be @@ -984,5 +986,6 @@ SwappedChroma: nv21 nv42 vuya + vuyx yvyu422 From patchwork Sat Aug 20 04:31:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Langdale X-Patchwork-Id: 37367 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp156418pzh; Fri, 19 Aug 2022 21:32:27 -0700 (PDT) X-Google-Smtp-Source: AA6agR7bOKI9TId5ck8k+F0VAOSrrgzMjm44FUvWrZj2E4K6P6Jr/PlEV8T5c4rRQDu6LGlXb/w+ X-Received: by 2002:a05:6402:e86:b0:440:d1be:20c7 with SMTP id h6-20020a0564020e8600b00440d1be20c7mr8372623eda.349.1660969947215; Fri, 19 Aug 2022 21:32:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660969947; cv=none; d=google.com; s=arc-20160816; b=lmK4eXPcv2xSKKizLwvzpVqvpnw+7/7mUhn9n5K5dbcekPX4IMhdr3nkO1JqnQypnB dp7HjkHBgDi0EpbzmASrl5xlIFlFWWG1ryWm+b9w7KEjY8rRjZJjRrthe6wJPg16PXwj r9pNn/S9LAbmTT+EGKSUT48VQwaFqGDBnt8z91QPIGX/VdnZdOueIYipawIVO4PgSQW6 Effvdsb5nfVAY5KrClYrMz3zBWXQDDxEXfHW1T1doVGhhp0IzVvbn5goP1HTrleL7+TO gkpeXZT+IRES7e4bX7hylU32a//ZJDx9wSufY4TwHF/+excP+jQLeFufRpBTt8G3udyv 3bdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=dxLS8Fu1eZyrvhI+ybRA1//TxGhbzziXsC+QWSc7nps=; b=RwM2Z9VfIFsaILhBDnCgN21W2qj9I91gHO2I4HwqUBMwn8Hbz82KuBlK0HmpVfdpfu rKj+lwlF044QYAxcRoIe+nfJuDMDaqhAOGq2IpdSFpCzsWOLvlGEDRvF18UqqmL2/sqr vI7G2TGExm/xBuKElDswRBWmA4kzH4YBF9kxFxKed25fHqUIOmFUzymzAYM9Ip2dxBdJ 1K3TetKjQ0tVHS7Gqagz88SBh8RENbw6cs99sY5AQrWiRvnATG/99+TxVVG+0NIHziad XVMS9SAIJ4tJRPsQUMFPBFAAyfcm/Jm/e/rjuYZ90EY6Asp4G/Uj/FNodb7bM8sRmpZA vpUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@overt.org header.s=mail header.b=FTfbOeqE; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=overt.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id dd16-20020a1709069b9000b0072fb108db55si4887145ejc.895.2022.08.19.21.32.26; Fri, 19 Aug 2022 21:32:27 -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; dkim=neutral (body hash did not verify) header.i=@overt.org header.s=mail header.b=FTfbOeqE; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=overt.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A546F68B993; Sat, 20 Aug 2022 07:32:05 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.overt.org (mail.overt.org [157.230.92.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3034168B937 for ; Sat, 20 Aug 2022 07:31:57 +0300 (EEST) Received: from authenticated-user (mail.overt.org [157.230.92.47]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by mail.overt.org (Postfix) with ESMTPSA id E20083F3EB; Fri, 19 Aug 2022 23:31:55 -0500 (CDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=overt.org; s=mail; t=1660969916; bh=iuZPdX/9PoMGFPMqIV5hxq1ZjVSVSlbRq+oyJmSobZo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FTfbOeqECAmGOcoNcosgIVJSumq2hYxEzffwnin+qjETEx+EtZeAlaZXw60E94T0Y vHVqxEVFXnF2RfywRtaRJF6dz3xDwbPEbMUNqrZAMztuIoWONF3a8gCQcD65rc+fq0 3VLduCu8qxHrSqbp/yBOVJakkHVvpH/snr8ju320moVM+GkWANYFfW2zfGlA1wvXQy LyIvAg5Twmx+8x4vMZX/F0zL7IxasMaecNhEEMzGUerQ5qbN0sLzgutKcvCvFnA/ov u4IfTR776okC2euIL/UJuWw9VrMtu475AVpTLlXzgfQM0RPVD7IeGYF2OzLwjMScbp wQDVrpWGja5xw== From: Philip Langdale To: ffmpeg-devel@ffmpeg.org Date: Fri, 19 Aug 2022 21:31:45 -0700 Message-Id: <20220820043146.398996-3-philipl@overt.org> In-Reply-To: <20220820043146.398996-1-philipl@overt.org> References: <20220820043146.398996-1-philipl@overt.org> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] libswscale: add support for VUYX format X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: Philip Langdale Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 8EqIiACOzo24 As we already have support for VUYA, I figured I should do the small amount of work to support VUYX as well. That means a little refactoring to share code. Signed-off-by: Philip Langdale --- libswscale/input.c | 10 ++++--- libswscale/output.c | 35 +++++++++++++++++++++--- libswscale/utils.c | 1 + tests/ref/fate/filter-pixdesc-vuyx | 1 + tests/ref/fate/filter-pixfmts-copy | 1 + tests/ref/fate/filter-pixfmts-crop | 1 + tests/ref/fate/filter-pixfmts-field | 1 + tests/ref/fate/filter-pixfmts-fieldorder | 1 + tests/ref/fate/filter-pixfmts-hflip | 1 + tests/ref/fate/filter-pixfmts-il | 1 + tests/ref/fate/filter-pixfmts-null | 1 + tests/ref/fate/filter-pixfmts-pad | 1 + tests/ref/fate/filter-pixfmts-scale | 1 + tests/ref/fate/filter-pixfmts-transpose | 1 + tests/ref/fate/filter-pixfmts-vflip | 1 + 15 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 tests/ref/fate/filter-pixdesc-vuyx diff --git a/libswscale/input.c b/libswscale/input.c index 1077d01e91..92681c9c53 100644 --- a/libswscale/input.c +++ b/libswscale/input.c @@ -659,7 +659,7 @@ static void read_ayuv64le_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *u AV_WN16(dst + i * 2, AV_RL16(src + i * 8)); } -static void read_vuya_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src, +static void read_vuyx_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src, const uint8_t *unused1, int width, uint32_t *unused2, void *opq) { int i; @@ -669,7 +669,7 @@ static void read_vuya_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, } } -static void read_vuya_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width, +static void read_vuyx_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width, uint32_t *unused2, void *opq) { int i; @@ -1375,7 +1375,8 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) break; #endif case AV_PIX_FMT_VUYA: - c->chrToYV12 = read_vuya_UV_c; + case AV_PIX_FMT_VUYX: + c->chrToYV12 = read_vuyx_UV_c; break; case AV_PIX_FMT_AYUV64LE: c->chrToYV12 = read_ayuv64le_UV_c; @@ -1752,7 +1753,8 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) c->lumToYV12 = read_ya16be_gray_c; break; case AV_PIX_FMT_VUYA: - c->lumToYV12 = read_vuya_Y_c; + case AV_PIX_FMT_VUYX: + c->lumToYV12 = read_vuyx_Y_c; break; case AV_PIX_FMT_AYUV64LE: c->lumToYV12 = read_ayuv64le_Y_c; diff --git a/libswscale/output.c b/libswscale/output.c index 74f992ae80..40a4476c6d 100644 --- a/libswscale/output.c +++ b/libswscale/output.c @@ -2585,13 +2585,14 @@ yuv2ayuv64le_X_c(SwsContext *c, const int16_t *lumFilter, } static void -yuv2vuya_X_c(SwsContext *c, const int16_t *lumFilter, +yuv2vuyX_X_c(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, - const int16_t **alpSrc, uint8_t *dest, int dstW, int y) + const int16_t **alpSrc, uint8_t *dest, int dstW, int y, + int destHasAlpha) { - int hasAlpha = !!alpSrc; + int hasAlpha = destHasAlpha && (!!alpSrc); int i; for (i = 0; i < dstW; i++) { @@ -2634,10 +2635,33 @@ yuv2vuya_X_c(SwsContext *c, const int16_t *lumFilter, dest[4 * i ] = V; dest[4 * i + 1] = U; dest[4 * i + 2] = Y; - dest[4 * i + 3] = A; + if (destHasAlpha) + dest[4 * i + 3] = A; } } +static void +yuv2vuya_X_c(SwsContext *c, const int16_t *lumFilter, + const int16_t **lumSrc, int lumFilterSize, + const int16_t *chrFilter, const int16_t **chrUSrc, + const int16_t **chrVSrc, int chrFilterSize, + const int16_t **alpSrc, uint8_t *dest, int dstW, int y) +{ + yuv2vuyX_X_c(c, lumFilter, lumSrc, lumFilterSize, chrFilter, + chrUSrc, chrVSrc, chrFilterSize, alpSrc, dest, dstW, y, 1); +} + +static void +yuv2vuyx_X_c(SwsContext *c, const int16_t *lumFilter, + const int16_t **lumSrc, int lumFilterSize, + const int16_t *chrFilter, const int16_t **chrUSrc, + const int16_t **chrVSrc, int chrFilterSize, + const int16_t **alpSrc, uint8_t *dest, int dstW, int y) +{ + yuv2vuyX_X_c(c, lumFilter, lumSrc, lumFilterSize, chrFilter, + chrUSrc, chrVSrc, chrFilterSize, alpSrc, dest, dstW, y, 0); +} + av_cold void ff_sws_init_output_funcs(SwsContext *c, yuv2planar1_fn *yuv2plane1, yuv2planarX_fn *yuv2planeX, @@ -3143,5 +3167,8 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c, case AV_PIX_FMT_VUYA: *yuv2packedX = yuv2vuya_X_c; break; + case AV_PIX_FMT_VUYX: + *yuv2packedX = yuv2vuyx_X_c; + break; } } diff --git a/libswscale/utils.c b/libswscale/utils.c index 9ef157c006..a621a35862 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -259,6 +259,7 @@ static const FormatEntry format_entries[] = { [AV_PIX_FMT_P416LE] = { 1, 1 }, [AV_PIX_FMT_NV16] = { 1, 1 }, [AV_PIX_FMT_VUYA] = { 1, 1 }, + [AV_PIX_FMT_VUYX] = { 1, 1 }, [AV_PIX_FMT_RGBAF16BE] = { 1, 0 }, [AV_PIX_FMT_RGBAF16LE] = { 1, 0 }, }; diff --git a/tests/ref/fate/filter-pixdesc-vuyx b/tests/ref/fate/filter-pixdesc-vuyx new file mode 100644 index 0000000000..99871e05d0 --- /dev/null +++ b/tests/ref/fate/filter-pixdesc-vuyx @@ -0,0 +1 @@ +pixdesc-vuyx ebc83f9793eb4eddbb0a37fdcb67a33d diff --git a/tests/ref/fate/filter-pixfmts-copy b/tests/ref/fate/filter-pixfmts-copy index 93dd611f97..371b94c62e 100644 --- a/tests/ref/fate/filter-pixfmts-copy +++ b/tests/ref/fate/filter-pixfmts-copy @@ -90,6 +90,7 @@ rgba64be ae2ae04b5efedca3505f47c4dd6ea6ea rgba64le b91e1d77f799eb92241a2d2d28437b15 uyvy422 3bcf3c80047592f2211fae3260b1b65d vuya 3d5e934651cae1ce334001cb1829ad22 +vuyx 3f68ea6ec492b30d867cb5401562264e x2bgr10le 550c0d190cf695afa4eaacb644db6b75 x2rgb10le c1e3ac21be04a16bb157b22784524520 xyz12be a1ef56bf746d71f59669c28e48fc8450 diff --git a/tests/ref/fate/filter-pixfmts-crop b/tests/ref/fate/filter-pixfmts-crop index 739b99713a..364e881aef 100644 --- a/tests/ref/fate/filter-pixfmts-crop +++ b/tests/ref/fate/filter-pixfmts-crop @@ -87,6 +87,7 @@ rgba 9488ac85abceaf99a9309eac5a87697e rgba64be 89910046972ab3c68e2a348302cc8ca9 rgba64le fea8ebfc869b52adf353778f29eac7a7 vuya 76578a705ff3a37559653c1289bd03dd +vuyx 5d2bae51a2f4892bd5f177f190cc323b x2bgr10le 84de725b85662c362862820dc4a309aa x2rgb10le f4265aca7a67dbfa9354370098ca6f33 xyz12be cb4571f9aaa7b59f999ef327276104b7 diff --git a/tests/ref/fate/filter-pixfmts-field b/tests/ref/fate/filter-pixfmts-field index e08161bc0d..768b3f474a 100644 --- a/tests/ref/fate/filter-pixfmts-field +++ b/tests/ref/fate/filter-pixfmts-field @@ -90,6 +90,7 @@ rgba64be 23c8c0edaabe3eaec89ce69633fb0048 rgba64le dfdba4de4a7cac9abf08852666c341d3 uyvy422 1c49e44ab3f060e85fc4a3a9464f045e vuya f72bcf29d75cd143d0c565f7cc49119a +vuyx 6257cd1ce11330660e9fa9c675acbdcc x2bgr10le dbe21538d7cb1744914f6bd46ec09b55 x2rgb10le a18bc4ae5274e0a8cca9137ecd50c677 xyz12be d2fa69ec91d3ed862f2dac3f8e7a3437 diff --git a/tests/ref/fate/filter-pixfmts-fieldorder b/tests/ref/fate/filter-pixfmts-fieldorder index de5c4fe59b..258c8563f0 100644 --- a/tests/ref/fate/filter-pixfmts-fieldorder +++ b/tests/ref/fate/filter-pixfmts-fieldorder @@ -81,6 +81,7 @@ rgba64be 5598f44514d122b9a57c5c92c20bbc61 rgba64le b34e6e30621ae579519a2d91a96a0acf uyvy422 75de70e31c435dde878002d3f22b238a vuya a3891d4168ff208948fd0b3ba0910495 +vuyx d7a900e970c9a69ed41f8b220114b9fa x2bgr10le 86474d84f26c5c51d6f75bf7e1de8da8 x2rgb10le cdf6a9e8a8d081aa768c6ae2e6221676 xyz12be 15f5cda71de5fef9cec5e75e3833b6bc diff --git a/tests/ref/fate/filter-pixfmts-hflip b/tests/ref/fate/filter-pixfmts-hflip index b0f6754bbf..6fbc472a4e 100644 --- a/tests/ref/fate/filter-pixfmts-hflip +++ b/tests/ref/fate/filter-pixfmts-hflip @@ -87,6 +87,7 @@ rgba 51961c723ea6707e0a410cd3f21f15d3 rgba64be c910444019f4cfbf4d995227af55da8d rgba64le 0c810d8b3a6bca10321788e1cb145340 vuya 7e530261e7ac4eae4fd616fd7572d0b8 +vuyx 3ce9890363cad3984521293be1eb679c x2bgr10le 827cc659f29378e00c5a7d2c0ada8f9a x2rgb10le d4a8189b65395a88d0a38a7053f3359f xyz12be 25f90259ff8a226befdaec3dfe82996e diff --git a/tests/ref/fate/filter-pixfmts-il b/tests/ref/fate/filter-pixfmts-il index 04efcb8a56..09748c2d08 100644 --- a/tests/ref/fate/filter-pixfmts-il +++ b/tests/ref/fate/filter-pixfmts-il @@ -89,6 +89,7 @@ rgba64be db70d33aa6c06f3e0a1c77bd11284261 rgba64le a8a2daae04374a27219bc1c890204007 uyvy422 d6ee3ca43356d08c392382b24b22cda5 vuya b9deab5ba249dd608b709c09255a4932 +vuyx 49cc92fcc002ec0f312017014dd68c0c x2bgr10le 135acaff8318cf9861bb0f7849a9e5e9 x2rgb10le 517fb186f523dc7cdc5c5c6967cfbe94 xyz12be 7c7d54c55f136cbbc50b18029f3be0b3 diff --git a/tests/ref/fate/filter-pixfmts-null b/tests/ref/fate/filter-pixfmts-null index 93dd611f97..371b94c62e 100644 --- a/tests/ref/fate/filter-pixfmts-null +++ b/tests/ref/fate/filter-pixfmts-null @@ -90,6 +90,7 @@ rgba64be ae2ae04b5efedca3505f47c4dd6ea6ea rgba64le b91e1d77f799eb92241a2d2d28437b15 uyvy422 3bcf3c80047592f2211fae3260b1b65d vuya 3d5e934651cae1ce334001cb1829ad22 +vuyx 3f68ea6ec492b30d867cb5401562264e x2bgr10le 550c0d190cf695afa4eaacb644db6b75 x2rgb10le c1e3ac21be04a16bb157b22784524520 xyz12be a1ef56bf746d71f59669c28e48fc8450 diff --git a/tests/ref/fate/filter-pixfmts-pad b/tests/ref/fate/filter-pixfmts-pad index 0f00affdce..07aaea6b06 100644 --- a/tests/ref/fate/filter-pixfmts-pad +++ b/tests/ref/fate/filter-pixfmts-pad @@ -36,6 +36,7 @@ rgb0 0984eb985dabbe757ed6beb53db84eff rgb24 17f9e2e0c609009acaf2175c42d4a2a5 rgba b157c90191463d34fb3ce77b36c96386 vuya 44368c0a758ee68e24ce976e3b1b8535 +vuyx bc7c4f693a22cd1ac95e33d473086474 xyz12le 23dadbbba70b2925ce75fb8ba8080ba3 ya16le 8dbfcb586abf626da7d1aca887a581b9 ya8 495daaca2dcb4f7aeba7652768b41ced diff --git a/tests/ref/fate/filter-pixfmts-scale b/tests/ref/fate/filter-pixfmts-scale index f4822f5bae..e1bbe961e1 100644 --- a/tests/ref/fate/filter-pixfmts-scale +++ b/tests/ref/fate/filter-pixfmts-scale @@ -90,6 +90,7 @@ rgba64be ee73e57923af984b31cc7795d13929da rgba64le 783d2779adfafe3548bdb671ec0de69e uyvy422 aeb4ba4f9f003ae21f6d18089198244f vuya ffa817e283bf6a0b6fba21b07523ccaa +vuyx ba182200e20e0c82765eba15217848d3 x2bgr10le d57b9a99033cc7b65ddd111578f2d385 x2rgb10le d56bdb23fa6a8e12a0b4394987f89935 xyz12be c7ba8345998c0141ddc079cdd29b1a40 diff --git a/tests/ref/fate/filter-pixfmts-transpose b/tests/ref/fate/filter-pixfmts-transpose index b3f2d5c5a0..0c2993d5b0 100644 --- a/tests/ref/fate/filter-pixfmts-transpose +++ b/tests/ref/fate/filter-pixfmts-transpose @@ -81,6 +81,7 @@ rgba 4d76a9542143752a4ac30f82f88f68f1 rgba64be a60041217f4c0cd796d19d3940a12a41 rgba64le ad47197774858858ae7b0c177dffa459 vuya 9ece18a345beb17cd19e09e443eca4bf +vuyx 4c2929cd1c6e5512f62e802f482f0ef2 x2bgr10le 4aa774b6d8f6d446a64f1f288e5c97eb x2rgb10le 09cb1d98fe17ad8a6d9d3bec97ddc845 xyz12be 68e5cba640f6e4ef72dff950e88b5342 diff --git a/tests/ref/fate/filter-pixfmts-vflip b/tests/ref/fate/filter-pixfmts-vflip index 9081ce4f18..5cac61a9d2 100644 --- a/tests/ref/fate/filter-pixfmts-vflip +++ b/tests/ref/fate/filter-pixfmts-vflip @@ -90,6 +90,7 @@ rgba64be 17e6273323b5779b5f3f775f150c1011 rgba64le 48f45b10503b7dd140329c3dd0d54c98 uyvy422 3a237e8376264e0cfa78f8a3fdadec8a vuya fb849f76e56181e005c31fce75d7038c +vuyx 7a8079a97610e2c1c97aa8832b58a102 x2bgr10le 795b66a5fc83cd2cf300aae51c230f80 x2rgb10le 262c502230cf3724f8e2cf4737f18a42 xyz12be 810644e008deb231850d779aaa27cc7e From patchwork Sat Aug 20 04:31:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Langdale X-Patchwork-Id: 37368 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp156464pzh; Fri, 19 Aug 2022 21:32:36 -0700 (PDT) X-Google-Smtp-Source: AA6agR5ni2h4ih780oRh+ZFu5VSiDGiolITN1qD7b6zKJ5Ts4dpv7fNFzPVEUBYLcYaA7lHrrgVR X-Received: by 2002:a05:6402:447:b0:440:d482:495f with SMTP id p7-20020a056402044700b00440d482495fmr8523275edw.264.1660969956114; Fri, 19 Aug 2022 21:32:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660969956; cv=none; d=google.com; s=arc-20160816; b=PEDVJTyaHd9CsgHEtmwNKcm2r0DXtqx93Jo0zeDm3kFEJGO8PPnjryeV0t54dbmb0k 5q/5DQuBUi3X2ywltEP8c8AhnYQO0xSypqXR5S81rRF+rdubhHCNVY/Wtv4anHJ1hvCP fFBR6ujqfCOeYkHJR8sA+IxE2T1NWAOQ2e8r3e0vupx0Yz06rvmBgaML9Uws7o2/SgMz d+Qfdoi8ziRu3cUA7wwmxvWbDuKW1I5p5oR0+a8gob9R5wRpOchlGaR4znhyuF/B6tQn 4A11UpCyrq6d3CbscWYw9Fvpe+G4HW4gOsmppo0Iq7vPztB3BZVq5z56OXgs+6pDBwBJ nQfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=nispg+EuPDZRZrIwV3DZR/749F0a/grADZg/mIjZaUY=; b=NbrCq0szJJQDBWoKZLfQrGYu+Ts0/s9Loec4MQHyWzMoW36+tlqt1WWNOzNKZFUv3H rLbXy3zzOCSP4Tx60FNNDj+n+rjnjqyGNoCfucy3ZTQCnxI5F4nN2KKikGTYBpOWFPxQ +SxyuvDWB1BYpRQ3E8myL+ayc9L5TwOjzbcOqJIBSdDzIq3fgHNpW6T49Py97kZdRX3G qZ9rslBZOUvpy/73hC6W6wjV1PKwPeaaH074849sA/+GN+T+7z7m8QS/78JGajyo2z0v LQG8QhmkCTlNikjTasg6MQSFU+nvzFW5ShfzOr5S0wzJqrM4BZ14BkPI17b+/uTIWffD u/yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@overt.org header.s=mail header.b=on5fEcXC; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=overt.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id u1-20020a1709064ac100b00707ad2d64edsi3950485ejt.98.2022.08.19.21.32.35; Fri, 19 Aug 2022 21:32:36 -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; dkim=neutral (body hash did not verify) header.i=@overt.org header.s=mail header.b=on5fEcXC; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=overt.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AD03568B937; Sat, 20 Aug 2022 07:32:06 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.overt.org (mail.overt.org [157.230.92.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B7A9E68B920 for ; Sat, 20 Aug 2022 07:31:57 +0300 (EEST) Received: from authenticated-user (mail.overt.org [157.230.92.47]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by mail.overt.org (Postfix) with ESMTPSA id 6F79D3F6B0; Fri, 19 Aug 2022 23:31:56 -0500 (CDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=overt.org; s=mail; t=1660969916; bh=MVyKh7RgkNqE849vTT+jyKd8/KQtRZIFrD3XSaQT2tk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=on5fEcXCwaWwDot3UfCPGpTi2v0pTRFYzbov7iuOleRSAdiHNYZJaw3AWI3wZ1ixM lBcFw3n9MSOv6eUTfN19JfdMDNT56ZQ9ZqULbZZXAF3zkR6qg0Xys3AgiHYW3Qupgo 7ZG+eQHptpFc3bBGniICxNjSm6Ov7vjrXPiYWdhpPK1OKEF5yEA+vueBnrfxHQTbTj +LyccYGGib65urAb2zSazZuzvr6Ko7Hg76CuXBOy0kEVgrarDOcTumby8g/aWJVMJW tWpipajxX3DC2aJuXA/zUgm/JaygjJE12f1fN/i+wI85cW4o7VcF7zg1Mj6hx4BKbo CK6clwRhLfNjg== From: Philip Langdale To: ffmpeg-devel@ffmpeg.org Date: Fri, 19 Aug 2022 21:31:46 -0700 Message-Id: <20220820043146.398996-4-philipl@overt.org> In-Reply-To: <20220820043146.398996-1-philipl@overt.org> References: <20220820043146.398996-1-philipl@overt.org> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/3] lavc/vaapi: Switch preferred 8bit 444 format to VUYX X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: Philip Langdale Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 1wWi4eh/K8KN As vaapi doesn't actually do anything useful with the alpha channel, and we have an alphaless format available, let's use that instead. The changes here are mostly 1:1 switching, but do note the explicit change in the number of declared channels from 4 to 3 to reflect that the alpha is being ignored. Signed-off-by: Philip Langdale --- libavcodec/vaapi_decode.c | 4 +++- libavcodec/vaapi_encode.c | 2 +- libavcodec/vaapi_encode_h265.c | 3 +-- libavcodec/vaapi_encode_vp9.c | 3 +-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c index bc2d3ed803..8c13a4f098 100644 --- a/libavcodec/vaapi_decode.c +++ b/libavcodec/vaapi_decode.c @@ -267,7 +267,9 @@ static const struct { MAP(422V, YUV440P), // 4:4:4 MAP(444P, YUV444P), - MAP(AYUV, VUYA), +#ifdef VA_FOURCC_XYUV + MAP(XYUV, VUYX), +#endif // 4:2:0 10-bit #ifdef VA_FOURCC_P010 MAP(P010, P010), diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index f13daa5cff..2dc5c96f7b 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -1308,7 +1308,7 @@ static const VAAPIEncodeRTFormat vaapi_encode_rt_formats[] = { { "YUV422_10", VA_RT_FORMAT_YUV422_10, 10, 3, 1, 0 }, #endif { "YUV444", VA_RT_FORMAT_YUV444, 8, 3, 0, 0 }, - { "AYUV", VA_RT_FORMAT_YUV444, 8, 4, 0, 0 }, + { "XYUV", VA_RT_FORMAT_YUV444, 8, 3, 0, 0 }, { "YUV411", VA_RT_FORMAT_YUV411, 8, 3, 2, 0 }, #if VA_CHECK_VERSION(0, 38, 1) { "YUV420_10", VA_RT_FORMAT_YUV420_10BPP, 10, 3, 1, 1 }, diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c index 1de323af78..967d71e998 100644 --- a/libavcodec/vaapi_encode_h265.c +++ b/libavcodec/vaapi_encode_h265.c @@ -1278,8 +1278,7 @@ static const VAAPIEncodeProfile vaapi_encode_h265_profiles[] = { #if VA_CHECK_VERSION(1, 2, 0) { FF_PROFILE_HEVC_REXT, 8, 3, 1, 0, VAProfileHEVCMain422_10 }, { FF_PROFILE_HEVC_REXT, 10, 3, 1, 0, VAProfileHEVCMain422_10 }, - // Four channels because this uses the AYUV format which has Alpha - { FF_PROFILE_HEVC_REXT, 8, 4, 0, 0, VAProfileHEVCMain444 }, + { FF_PROFILE_HEVC_REXT, 8, 3, 0, 0, VAProfileHEVCMain444 }, #endif { FF_PROFILE_UNKNOWN } }; diff --git a/libavcodec/vaapi_encode_vp9.c b/libavcodec/vaapi_encode_vp9.c index 9b455e10c9..9530b2f462 100644 --- a/libavcodec/vaapi_encode_vp9.c +++ b/libavcodec/vaapi_encode_vp9.c @@ -228,8 +228,7 @@ static av_cold int vaapi_encode_vp9_configure(AVCodecContext *avctx) static const VAAPIEncodeProfile vaapi_encode_vp9_profiles[] = { { FF_PROFILE_VP9_0, 8, 3, 1, 1, VAProfileVP9Profile0 }, - // Four channels because this uses the AYUV format which has Alpha - { FF_PROFILE_VP9_1, 8, 4, 0, 0, VAProfileVP9Profile1 }, + { FF_PROFILE_VP9_1, 8, 3, 0, 0, VAProfileVP9Profile1 }, { FF_PROFILE_VP9_2, 10, 3, 1, 1, VAProfileVP9Profile2 }, { FF_PROFILE_UNKNOWN } };