From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id DB9FB41126 for ; Sun, 14 Aug 2022 21:33:51 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8628668B94F; Mon, 15 Aug 2022 00:33:33 +0300 (EEST) Received: from mail.overt.org (mail.overt.org [157.230.92.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5A95968AAD7 for ; Mon, 15 Aug 2022 00:33:25 +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 9E7D53F89D; Sun, 14 Aug 2022 16:33:22 -0500 (CDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=overt.org; s=mail; t=1660512802; bh=U8apedp61h6ZDGi6gI/+XGp45eOLWtN6eJg0L16oLLI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EfO6KT3rbkDYceo7cykCDEv+rTTQZFkJOxXqu1JzrvfMuk+3AxkPs0QSlLMv8S0BP Is+9JsiNFaseOs+uQZp6SZrxyZw5jelhHG5F5l5PwqOs+KmARJantSqwybi05GzMsB s36akGYxTh6aa/CwPmLb9aD+3PITVLPBtCLY7fRA6MkNLZLlbInqPOXQkZ564yuWLV yK/Ynz8UwWL4HfINgGl4IoDMJqYLgv2i3/ybJ3y746AMkBiOUi1KOEVW7PgfmktVrF D1gfaSVufWgF2ToeHg+9F44Uh54iW+vB9NiHdTbRw0BQ/O43YJ1gA5q9Nsd7trlNhE 87Hm11qPIfhHA== From: Philip Langdale To: ffmpeg-devel@ffmpeg.org Date: Sun, 14 Aug 2022 14:33:11 -0700 Message-Id: <20220814213313.37948-2-philipl@overt.org> In-Reply-To: <20220814213313.37948-1-philipl@overt.org> References: <20220814213313.37948-1-philipl@overt.org> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/3] lavu/pixfmt: Add Y216, Y410, and Y416 formats 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: These are the formats returned by the Intel VAAPI decoder for 12bit 4:2:2, 10bit 4:4:4, and 12bit 4:4:4 respectively. As with the already supported Y210 and YUVA (AVUY) formats, they are the formats Microsoft picked as their preferred 4:2:2 and 4:4:4 video formats, and Intel ran with it. Y216 is simply an extension of Y210 to say all 16bits will be used, and Y416 is a normal looking packed 4 channel format. Y410 is an annoying format that packs three 10bit channels into 32bits with 2bits of alpha. As a result, I had to define Y410 as a bitstream format, even though each pixel is byte-aligned. If it is in-fact possible to define as a normal byte-aligned format, please let me know how. As with VUYA, I have kept the formal definition of Y410 and Y416 as formats with alpha channels to maintain fidelity. The Intel folks say they prefer this and they would rather explicitly use a format defined as not having alpha than to silently drop it. The hardware decoder does at least ensure the alpha channel is set to full opacity. Signed-off-by: Philip Langdale --- libavutil/pixdesc.c | 77 +++++++++++++++++++++++++++++++- libavutil/pixfmt.h | 12 +++++ tests/ref/fate/imgutils | 6 +++ tests/ref/fate/sws-pixdesc-query | 25 +++++++++++ 4 files changed, 119 insertions(+), 1 deletion(-) diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index f7558ff8b9..5dee3a95d3 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -2532,6 +2532,81 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA | AV_PIX_FMT_FLAG_FLOAT, }, + [AV_PIX_FMT_Y216LE] = { + .name = "y216le", + .nb_components = 3, + .log2_chroma_w = 1, + .log2_chroma_h = 0, + .comp = { + { 0, 4, 0, 0, 16 }, /* Y */ + { 0, 8, 2, 0, 16 }, /* U */ + { 0, 8, 6, 0, 16 }, /* V */ + }, + }, + [AV_PIX_FMT_Y216BE] = { + .name = "y216be", + .nb_components = 3, + .log2_chroma_w = 1, + .log2_chroma_h = 0, + .comp = { + { 0, 4, 0, 0, 16 }, /* Y */ + { 0, 8, 2, 0, 16 }, /* U */ + { 0, 8, 6, 0, 16 }, /* V */ + }, + .flags = AV_PIX_FMT_FLAG_BE, + }, + [AV_PIX_FMT_Y410LE] = { + .name = "y410le", + .nb_components= 4, + .log2_chroma_w= 0, + .log2_chroma_h= 0, + .comp = { + { 0, 32, 10, 0, 10 }, /* Y */ + { 0, 32, 0, 0, 10 }, /* U */ + { 0, 32, 20, 0, 10 }, /* V */ + { 0, 32, 30, 0, 2 }, /* A */ + }, + .flags = AV_PIX_FMT_FLAG_ALPHA | AV_PIX_FMT_FLAG_BITSTREAM, + }, + [AV_PIX_FMT_Y410BE] = { + .name = "y410be", + .nb_components= 4, + .log2_chroma_w= 0, + .log2_chroma_h= 0, + .comp = { + { 0, 32, 10, 0, 10 }, /* Y */ + { 0, 32, 0, 0, 10 }, /* U */ + { 0, 32, 20, 0, 10 }, /* V */ + { 0, 32, 30, 0, 2 }, /* A */ + }, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA | AV_PIX_FMT_FLAG_BITSTREAM, + }, + [AV_PIX_FMT_Y416LE] = { + .name = "y416le", + .nb_components= 4, + .log2_chroma_w= 0, + .log2_chroma_h= 0, + .comp = { + { 0, 8, 2, 0, 16 }, /* Y */ + { 0, 8, 0, 0, 16 }, /* U */ + { 0, 8, 4, 0, 16 }, /* V */ + { 0, 8, 6, 0, 16 }, /* A */ + }, + .flags = AV_PIX_FMT_FLAG_ALPHA, + }, + [AV_PIX_FMT_Y416BE] = { + .name = "y416be", + .nb_components= 4, + .log2_chroma_w= 0, + .log2_chroma_h= 0, + .comp = { + { 0, 8, 2, 0, 16 }, /* Y */ + { 0, 8, 0, 0, 16 }, /* U */ + { 0, 8, 4, 0, 16 }, /* V */ + { 0, 8, 6, 0, 16 }, /* A */ + }, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA, + }, }; static const char * const color_range_names[] = { @@ -2767,7 +2842,7 @@ void ff_check_pixfmt_descriptors(void){ if (!d->name && !d->nb_components && !d->log2_chroma_w && !d->log2_chroma_h && !d->flags) continue; -// av_log(NULL, AV_LOG_DEBUG, "Checking: %s\n", d->name); + av_log(NULL, AV_LOG_INFO, "Checking: %s\n", d->name); av_assert0(d->log2_chroma_w <= 3); av_assert0(d->log2_chroma_h <= 3); av_assert0(d->nb_components <= 4); diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index 86c9bdefeb..485655f0c0 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -372,6 +372,15 @@ 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_Y216BE, ///< packed YUV 4:2:2 like YUYV422, 32bpp, big-endian + AV_PIX_FMT_Y216LE, ///< packed YUV 4:2:2 like YUYV422, 32bpp, big-endian + + AV_PIX_FMT_Y410BE, ///< packed AVYU 2:10:10:10, 32bpp, (msb)2A 10V 10Y 10U(lsb), big-endian + AV_PIX_FMT_Y410LE, ///< packed AVYU 2:10:10:10, 32bpp, (msb)2A 10V 10Y 10U(lsb), little-endian + + AV_PIX_FMT_Y416BE, ///< packed AVYU 16:16:16:16, 64bpp, big-endian + AV_PIX_FMT_Y416LE, ///< packed AVYU 16:16:16:16, 64bpp, little-endian + 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 }; @@ -461,6 +470,9 @@ enum AVPixelFormat { #define AV_PIX_FMT_P016 AV_PIX_FMT_NE(P016BE, P016LE) #define AV_PIX_FMT_Y210 AV_PIX_FMT_NE(Y210BE, Y210LE) +#define AV_PIX_FMT_Y216 AV_PIX_FMT_NE(Y216BE, Y216LE) +#define AV_PIX_FMT_Y410 AV_PIX_FMT_NE(Y410BE, Y410LE) +#define AV_PIX_FMT_Y416 AV_PIX_FMT_NE(Y416BE, Y416LE) #define AV_PIX_FMT_X2RGB10 AV_PIX_FMT_NE(X2RGB10BE, X2RGB10LE) #define AV_PIX_FMT_X2BGR10 AV_PIX_FMT_NE(X2BGR10BE, X2BGR10LE) diff --git a/tests/ref/fate/imgutils b/tests/ref/fate/imgutils index 01c9877de5..ea959c26b1 100644 --- a/tests/ref/fate/imgutils +++ b/tests/ref/fate/imgutils @@ -249,3 +249,9 @@ 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 +y216be planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 +y216le planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 +y410be planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 +y410le planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 +y416be planes: 1, linesizes: 512 0 0 0, plane_sizes: 24576 0 0 0, plane_offsets: 0 0 0, total_size: 24576 +y416le planes: 1, linesizes: 512 0 0 0, plane_sizes: 24576 0 0 0, plane_offsets: 0 0 0, total_size: 24576 diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query index f79d99e513..2dea9c5a3c 100644 --- a/tests/ref/fate/sws-pixdesc-query +++ b/tests/ref/fate/sws-pixdesc-query @@ -23,6 +23,10 @@ is16BPS: rgba64le rgbaf16be rgbaf16le + y216be + y216le + y416be + y416le ya16be ya16le yuv420p16be @@ -75,6 +79,8 @@ isNBPS: xyz12le y210be y210le + y410be + y410le yuv420p10be yuv420p10le yuv420p12be @@ -164,6 +170,9 @@ isBE: x2rgb10be xyz12be y210be + y216be + y410be + y416be ya16be yuv420p10be yuv420p12be @@ -223,6 +232,12 @@ isYUV: xyz12le y210be y210le + y216be + y216le + y410be + y410le + y416be + y416le ya16be ya16le ya8 @@ -665,6 +680,10 @@ ALPHA: rgbaf16be rgbaf16le vuya + y410be + y410le + y416be + y416le ya16be ya16le ya8 @@ -761,6 +780,12 @@ Packed: xyz12le y210be y210le + y216be + y216le + y410be + y410le + y416be + y416le ya16be ya16le ya8 -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".