From patchwork Sat Aug 20 02:14:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Langdale X-Patchwork-Id: 37363 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp115974pzh; Fri, 19 Aug 2022 19:15:08 -0700 (PDT) X-Google-Smtp-Source: AA6agR771LzrrK7NGWdK2eQMwIkMF+NZijXAxf4U1pRR1VomNaPpWW49qAl3ySMM09q+giopEL2Y X-Received: by 2002:aa7:dc13:0:b0:443:3f15:8440 with SMTP id b19-20020aa7dc13000000b004433f158440mr7725453edu.274.1660961708257; Fri, 19 Aug 2022 19:15:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660961708; cv=none; d=google.com; s=arc-20160816; b=jPgSH2PMxW/KyYLj0KkjXgXo3evd/2orrlnjU160Vm5h5pMRu4Pcc5rSC6OyOLA6cx PW/4npj7wXLkcuO59r/RDDCNX+zUEBpsug/02Ws5bQU/sdBvxKpgv3HIgbauQJ/Q1V8a PDT5hIN9TzrSqgSFm889IllmgGz09RByw4DjeZR6Uyug3E0ZlbTPWspuIg3tzPx+3jQx zOHF++hz6fwJvHbQAVgGuR3dKEgPIf1INupj3T9Ghy/NZRrUMIeM7SMijLV+F1u4W/hT 7tfZ1BuDN6lm21JB55BO1xo2F8AFrbUek8IzyI4AKQaC68nTxZCZpmf8ojE63GE1UrWL 5gsw== 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=ZnC+GUd6dhlpt3L1Jo4dY4YtAGY5JRJrZSYTTVfbkW0=; b=yUpTZ00Lo2o5USaunWANWtzVxXvBqc+qtWRAYeuRgo8ZPc2kFNO73mwq8W6yWQeYZF Jqi6AEWgG5dFjAUt5BGBzu7ngxBRJtT9nZv1V+AcVWafgANIe8VfTe01BWehtG1udqcX 8eU9SPL3dcqgvHDYdd9jgzz2mf6xct1KLUSI0fURD2dFalz98SRGyFO4zI5+VeR4AFfC zROz/fKDCoKTUv1/9LmwhVIqWwCfzqS0gDDARjUc5zZW6iN1IV5HqBItbTmzgoTRVeiY Q9G383oou5ZKCw15Key9fuMK54gu8E6gOvxVXdbcjaw6bSee7rDBgYDi3WQzilZwpz0z xn9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@overt.org header.s=mail header.b=Zx1VHU5t; 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 h20-20020a170906855400b0072f3efb9687si3429643ejy.242.2022.08.19.19.15.05; Fri, 19 Aug 2022 19:15:08 -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=Zx1VHU5t; 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 E51AB68B988; Sat, 20 Aug 2022 05:14:53 +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 772EE68B556 for ; Sat, 20 Aug 2022 05:14:46 +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 1723F3F22B; Fri, 19 Aug 2022 21:14:45 -0500 (CDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=overt.org; s=mail; t=1660961685; bh=+KY3pOLwJCoq9BeVirGgGpakldhUK+wQti6Mv2gqMS0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zx1VHU5tPbSyjv0rpJqC1FndoqaJY1KbN3TqjEUq+knPoH9H4L0JyZATniqdtWoTy ohI1gvDjqRxZmgl33q6UDoFqNZ6N3ygLD6L0t+PsydrXYbx0mU9TYWUAGMTuCfsShI knXApH28nILdDCdNFELQfGnVAg864Kk7HBD0hTMVIFsOMTxOcHnGLC3GpWMaw/gUsJ 0Rsa4+2Imd3hO9u27cYrX1F++MFlhVStr4EffVkmRX1jcAK1pPqukk7FtfA/3fsMNI LdEjqpUGf22XO/G1/87zp8k7hA3Bcni74VaiMppn4WZ9/y/KJk4bWV7I2vi9i7JQHd 6kccgRmxpKbtQ== From: Philip Langdale To: ffmpeg-devel@ffmpeg.org Date: Fri, 19 Aug 2022 19:14:34 -0700 Message-Id: <20220820021436.1224908-2-philipl@overt.org> In-Reply-To: <20220820021436.1224908-1-philipl@overt.org> References: <20220820021436.1224908-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: bFMy6RbJFtzP 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 | 12 ++++++++++++ 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, 20 insertions(+), 1 deletion(-) diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index f7558ff8b9..a7aadc18cc 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -2504,6 +2504,18 @@ 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 */ + }, + .flags = AV_PIX_FMT_FLAG_ALPHA, + }, [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..045f751831 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 @@ -665,6 +666,7 @@ ALPHA: rgbaf16be rgbaf16le vuya + vuyx ya16be ya16le ya8 @@ -753,6 +755,7 @@ Packed: uyvy422 uyyvyy411 vuya + vuyx x2bgr10be x2bgr10le x2rgb10be From patchwork Sat Aug 20 02:14:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Langdale X-Patchwork-Id: 37364 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp116006pzh; Fri, 19 Aug 2022 19:15:15 -0700 (PDT) X-Google-Smtp-Source: AA6agR4c9A1NQi9hcAkiXanr0TjICEeXv8rEifaP5uiMgdrgvHJiehEPjpa+kG07+kT+VSqHQIk0 X-Received: by 2002:a17:907:60c7:b0:739:52ba:cbd0 with SMTP id hv7-20020a17090760c700b0073952bacbd0mr6597902ejc.152.1660961715759; Fri, 19 Aug 2022 19:15:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660961715; cv=none; d=google.com; s=arc-20160816; b=EFKOYQxjwkkL50pshowrtEQhP/eo3slztp7V7hZYfvWpfjgHq0EZCqDj9ckD3guKOF hkpfdeewvB/KHHvDpK/I9wii/2a+lSZZqGg2cMONNKqUlRFnlwc0fK+pfSxAIwXbhgvX S2AFs50dv6m+rLyYSIDBvT0NTvIiO5aaM9n19/TWwsxT1r5AyyOCPGfmzMuE6o2jE0Ww 6e4ZdMNCFZIUsICGtSx1wsd5VvtRoViREIyUJeOhXfze64sQ+NFW7lmDj99McJURKQ8t hABYwnpqRjoRiUhrJO8hgXcRS+y/WoH8GcB1Q839Ms74Di7am0z7oHYo/R4zlj+9YHfr nEMQ== 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=N+QF+N6POFPx3qpqGhPTmZ2IZ/i6SPgPOPUajIMxslF4UUKXAuQ910wHGM9Qc5nGWD GZiQBj72Z1ihKDMeszbhwYlXmY2pfuaDW9DUKkoiuhoAPu+UYp5hi5gDwqEM53xOyZ33 3PrF8pLgkquBIAltRQf9A0h5W7ksH59WL4qpVmfqDgcI/120Cri3qSddP4pN17JVyK5O nP6NY6+9TDL2uufC+7Oui2P63zxlipcezsOe/kIqYKBxmiB5HWbbaMbNM5uq9HR8k8z0 RY9ht5Rrh3NkK2GCXHtj8AsjfNpjoRMQVQwc61aqeu32aLlRK2sCbW5AM28cIiCBiyhT YyeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@overt.org header.s=mail header.b=gv95Vk2z; 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 l3-20020a170907914300b00730a1a86524si3023626ejs.112.2022.08.19.19.15.15; Fri, 19 Aug 2022 19:15:15 -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=gv95Vk2z; 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 01DC868B993; Sat, 20 Aug 2022 05:14:55 +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 DFA4068B67D for ; Sat, 20 Aug 2022 05:14:46 +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 98E8F3F3EB; Fri, 19 Aug 2022 21:14:45 -0500 (CDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=overt.org; s=mail; t=1660961685; bh=iuZPdX/9PoMGFPMqIV5hxq1ZjVSVSlbRq+oyJmSobZo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gv95Vk2zEoZq9rD0J8vUtswK77vvtUEbU8KBNKRQV/aj/LwRNoQzTAN9M4GY4uL6l hkZadWdSSdImwldmos7Va5JWgc5Qq3gtNe64QeJiFygcJrpqfzS0w2RmFXZtjphLuZ P2eQ5AtXoEcLHU/gENy/hwTteOAE7xM0qtMpjUEI97Kc5wX2SFkQT02luxm99wI73z 5cXXqqfuG62FMPiogUMbHInlprcnIr4ZovK3oW1LCY2zBMaRlcTpxuc5weIbTnBQ2x NpYjlL+IVi24RmIw+fLvfaBQWJGDrZzOnFnHJZvU/TLTPq2XHu7XsAtxbSS6AeqXAR ycuOOTjs+8d9A== From: Philip Langdale To: ffmpeg-devel@ffmpeg.org Date: Fri, 19 Aug 2022 19:14:35 -0700 Message-Id: <20220820021436.1224908-3-philipl@overt.org> In-Reply-To: <20220820021436.1224908-1-philipl@overt.org> References: <20220820021436.1224908-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: 1LeIxy8x2EdZ 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 02:14:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Langdale X-Patchwork-Id: 37365 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp116048pzh; Fri, 19 Aug 2022 19:15:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR5zVlhdOoqki1CTObXIZgqBPOH7ye53SU60rUQOYFV4SIcMv1hIbkisLD7lRfs6ocxqQqBB X-Received: by 2002:a17:906:8a45:b0:730:9715:369d with SMTP id gx5-20020a1709068a4500b007309715369dmr6532167ejc.105.1660961725851; Fri, 19 Aug 2022 19:15:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660961725; cv=none; d=google.com; s=arc-20160816; b=JxKt2u6Ysd1bKxSx7iJnV78cDUHuC1BzHg0jCCCk7JLGLLylaSxd0hOgkL5/3jpYWU /3eoK+AEH5y3ygysqIqWXJdE89/v+lnTJ6/bHWqX/msbOvtLx88lfhEwOaKDxGxHBCNx yNxlzoUW5Iy/2ImkEn6BbuF3B18pTQvhC9j+e4mT/iAp2Wu24hc45GShgqVULxetvHye Y18Ci7SVZXLemwzXaRxO7svoYqSaFdCkR2MWse2LY85NpJjF2Ho9iuS2KOMAlubElknC iHQ+dhT3k9mCe/MEOdaS17V87zVizcMfCAhS4U6KSiN6Fm3c+EHwv26r87p6BSz4bUju LDiw== 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=VUOvuFUbcel669JlddQ3TkWhU0p8VPZllI8UQU01ADiDoeGWuMHw2kJycz/Y4nr4DC ltCCopdE8Wiw1UQ6sqk2VCmEfuFMlF667xF7SUXrRiwQ4DzT0ym2c3BHfV8lIU2Nw+HV 3vlkWyXQiSrTzhQX+EIs1CiyukiOB8bfOsMPE2gXlQYQRhqsF+sMh4wCglZIPpa4vHMy Gsmi00GottWLiy1rOT7fomBEklda1LPTKkeIVoOs+UpBRr1WdUOHeiN/U1eHtD05Qh+z vlqQxbEqidDVkICyy7U21t129a6Grw1XjmRqxSOgZAJdOJ1jHVY9dr7DHJ/6Y4KsVGMw a8dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@overt.org header.s=mail header.b=fXFA5jXr; 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 g15-20020a056402320f00b00443d8fae31csi1631024eda.593.2022.08.19.19.15.25; Fri, 19 Aug 2022 19:15:25 -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=fXFA5jXr; 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 1C2AB68B97E; Sat, 20 Aug 2022 05:14:56 +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 77C6268B67D for ; Sat, 20 Aug 2022 05:14:47 +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 26E5C3F6B1; Fri, 19 Aug 2022 21:14:46 -0500 (CDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=overt.org; s=mail; t=1660961686; bh=MVyKh7RgkNqE849vTT+jyKd8/KQtRZIFrD3XSaQT2tk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fXFA5jXr8UXFYGfsejBUGfMVecdAZv+A8p8iXb+RQTi8BeAaee+s2jIlMbMnnBgsv d/73SE/cUthAB2gFeiZpaRnFytTRqyqy38boo2CCm4TnuTGPXX+Z1SWxi/VmspAv39 O37e4aXEzU+wjVBjF4IToKuOtOAPgQ2co3Y/uhmMkDBvB5GzsS0+TyzVvgvwvBLhUO 0jqJvXmljrCD+i7RHUP6R3ihvDiK9lTQ4QjcQFgYvraVPqfB7Mo05MbX9/RJ+HNEgm 4DSU/ywof9KR3nLJdlxZLzkpDaaXd/Wq3ya0CSk1w24z8HoT/WHP5grtwmCt1U5Zcx WNERrOrEHaB9Q== From: Philip Langdale To: ffmpeg-devel@ffmpeg.org Date: Fri, 19 Aug 2022 19:14:36 -0700 Message-Id: <20220820021436.1224908-4-philipl@overt.org> In-Reply-To: <20220820021436.1224908-1-philipl@overt.org> References: <20220820021436.1224908-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: Iv6QrP+aWINb 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 } };