From patchwork Sun Aug 21 23:12:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ffmpeg@mstoeckl.com X-Patchwork-Id: 37379 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp999978pzh; Sun, 21 Aug 2022 16:13:17 -0700 (PDT) X-Google-Smtp-Source: AA6agR6SqNsTwgN2gNLi4DFM4DBBgbSYgJRQuFyT24YVb1FKuyp2UycAqjnjQGiCE2Qckg3zYPcK X-Received: by 2002:a05:6402:5252:b0:43e:14ec:46f with SMTP id t18-20020a056402525200b0043e14ec046fmr13884379edd.398.1661123597001; Sun, 21 Aug 2022 16:13:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661123596; cv=none; d=google.com; s=arc-20160816; b=ckAKGpbaiInVxvayj1VtRyiWu6Rq204CKLY91UKBypW/l7Vqh4Ex56+M0jZfTdPqrf AqDKMDUdK8fv4T6HjAy3Nh6EqiGb2qIeSDXRPYUcQmzDBqcksUXnd27EkK48bPDHB+R8 KDP1pOJrg41eE8vUnQBhg9XHjTeqtjfjrudni1BFqXuU9Z0hgFKPosvhmMO+N/lfMkyt ksXuPaK5YUYHcpu//SLQ9EBvjnA2CLZ6LJ1aKU9QMF6g/EQt3wgLzgCKeggD2ajdEB5m 1GrexYO4UfihKeTPL7L3EBTsZx07qzEyzIaKk6xnGAsUwTMo658B1wgGFRSdp05Dc+DR 43jg== 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:message-id:date:to:from :delivered-to; bh=8LVUji546WOmH1J2RyqT7Qqgmu9xa03NBIzOe6qpDQU=; b=foKAyaKOQb4cH9lPqGaaNABj60qUmaLwL0X1l0JxYr+/gFJv5zUqI/OMcfxjCZSdq0 Se4DLAxoyGZH1uJWu1nnf6z42I2yWEgqbWY42U9VawoX0rRgJqWutZ8nSP3F+b2dAAwC y0tPdT91/o2ywthokYEOftxeYhDAuG1OVW9oqUd4iIXLuxmaJgrS6TDslNWT4Lrr/JLF gH3/YRqQr3nzHZYi8XgLi1YsFI1oDepHc+j/cgwskAm45rQ4fNZ/XSzFwHRmMNUdWUGL +zZQmqQiR7KKvNZOmw8uFR3BPwezYx9AmsI+tLX7ioyQeQ9p/FUJ5VUtR3AUdtuc3KYf +Qog== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id s23-20020a170906a19700b00736ce5254f9si7333567ejy.335.2022.08.21.16.13.05; Sun, 21 Aug 2022 16:13:16 -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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A90DA68B98D; Mon, 22 Aug 2022 02:13:01 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6295968B2C8 for ; Mon, 22 Aug 2022 02:12:55 +0300 (EEST) Received: from smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4M9rr60LTjz9sQr; Mon, 22 Aug 2022 01:12:54 +0200 (CEST) From: ffmpeg@mstoeckl.com To: ffmpeg-devel@ffmpeg.org Date: Sun, 21 Aug 2022 19:12:47 -0400 Message-Id: <20220821231248.34688-1-ffmpeg@mstoeckl.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] lavu/pix_fmt: add rgbx64 and bgrx64 pixel 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: Manuel Stoeckl Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: YcEyYrdrhLW+ From: Manuel Stoeckl These new formats are equivalent to rgba64 and bgra64, except that the contents of the alpha channel are ignored. These formats are equivalent to the Linux DRM formats XBGR16161616 and XRGB16161616; these are used by Wayland compositors to either provide high bit depth image data for a DRM plane, or receive such data from applications. Programs that make video recordings of the screen or individual windows on Wayland will encounter such formats; adding support for them in libavutil will simplify such programs' implementations. Signed-off-by: Manuel Stoeckl --- doc/APIchanges | 3 ++ libavutil/pixdesc.c | 48 ++++++++++++++++++++++++++++++++ libavutil/pixfmt.h | 7 +++++ libavutil/version.h | 4 +-- tests/ref/fate/imgutils | 4 +++ tests/ref/fate/sws-pixdesc-query | 22 +++++++++++++++ 6 files changed, 86 insertions(+), 2 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 2df65a521d..17aff90af7 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,9 @@ libavutil: 2021-04-27 API changes, most recent first: +2022-08-xx - xxxxxxxxxx - lavu 57.34.100 - pixfmt.h + Add AV_PIX_FMT_RGBX64 and AV_PIX_FMT_BGRX64 pixel formats. + 2022-08-19 - 352799dca8 - lavc 59.42.102 - codec_id.h Deprecate AV_CODEC_ID_AYUV and ayuv decoder/encoder. The rawvideo codec and vuya pixel format combination will be used instead from now on. diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index f7558ff8b9..c0f0234cad 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -1156,6 +1156,30 @@ 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_RGBX64BE] = { + .name = "rgbx64be", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 8, 0, 0, 16 }, /* R */ + { 0, 8, 2, 0, 16 }, /* G */ + { 0, 8, 4, 0, 16 }, /* B */ + }, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB, + }, + [AV_PIX_FMT_RGBX64LE] = { + .name = "rgbx64le", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 8, 0, 0, 16 }, /* R */ + { 0, 8, 2, 0, 16 }, /* G */ + { 0, 8, 4, 0, 16 }, /* B */ + }, + .flags = AV_PIX_FMT_FLAG_RGB, + }, [AV_PIX_FMT_RGB565BE] = { .name = "rgb565be", .nb_components = 3, @@ -1278,6 +1302,30 @@ 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_BGRX64BE] = { + .name = "bgrx64be", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 8, 4, 0, 16 }, /* R */ + { 0, 8, 2, 0, 16 }, /* G */ + { 0, 8, 0, 0, 16 }, /* B */ + }, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB, + }, + [AV_PIX_FMT_BGRX64LE] = { + .name = "bgrx64le", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 8, 4, 0, 16 }, /* R */ + { 0, 8, 2, 0, 16 }, /* G */ + { 0, 8, 0, 0, 16 }, /* B */ + }, + .flags = AV_PIX_FMT_FLAG_RGB, + }, [AV_PIX_FMT_BGR565BE] = { .name = "bgr565be", .nb_components = 3, diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index 86c9bdefeb..2b8c2ffdd4 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -372,6 +372,11 @@ 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_RGBX64BE, ///< packed RGB 16:16:16, 64bpp, 16R, 16G, 16B, 16X, the 2-byte value for each R/G/B component is stored as big-endian + AV_PIX_FMT_RGBX64LE, ///< packed RGB 16:16:16, 64bpp, 16R, 16G, 16B, 16X, the 2-byte value for each R/G/B component is stored as little-endian + AV_PIX_FMT_BGRX64BE, ///< packed RGB 16:16:16, 64bpp, 16B, 16G, 16R, 16X, the 2-byte value for each R/G/B component is stored as big-endian + AV_PIX_FMT_BGRX64LE, ///< packed RGB 16:16:16, 64bpp, 16B, 16G, 16R, 16X, the 2-byte value for each R/G/B component is stored as 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 }; @@ -399,11 +404,13 @@ enum AVPixelFormat { #define AV_PIX_FMT_RGB555 AV_PIX_FMT_NE(RGB555BE, RGB555LE) #define AV_PIX_FMT_RGB444 AV_PIX_FMT_NE(RGB444BE, RGB444LE) #define AV_PIX_FMT_RGBA64 AV_PIX_FMT_NE(RGBA64BE, RGBA64LE) +#define AV_PIX_FMT_RGBX64 AV_PIX_FMT_NE(RGBX64BE, RGBX64LE) #define AV_PIX_FMT_BGR48 AV_PIX_FMT_NE(BGR48BE, BGR48LE) #define AV_PIX_FMT_BGR565 AV_PIX_FMT_NE(BGR565BE, BGR565LE) #define AV_PIX_FMT_BGR555 AV_PIX_FMT_NE(BGR555BE, BGR555LE) #define AV_PIX_FMT_BGR444 AV_PIX_FMT_NE(BGR444BE, BGR444LE) #define AV_PIX_FMT_BGRA64 AV_PIX_FMT_NE(BGRA64BE, BGRA64LE) +#define AV_PIX_FMT_BGRX64 AV_PIX_FMT_NE(BGRX64BE, BGRX64LE) #define AV_PIX_FMT_YUV420P9 AV_PIX_FMT_NE(YUV420P9BE , YUV420P9LE) #define AV_PIX_FMT_YUV422P9 AV_PIX_FMT_NE(YUV422P9BE , YUV422P9LE) diff --git a/libavutil/version.h b/libavutil/version.h index 05661922b3..5d0df781cc 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,8 +79,8 @@ */ #define LIBAVUTIL_VERSION_MAJOR 57 -#define LIBAVUTIL_VERSION_MINOR 33 -#define LIBAVUTIL_VERSION_MICRO 101 +#define LIBAVUTIL_VERSION_MINOR 34 +#define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \ diff --git a/tests/ref/fate/imgutils b/tests/ref/fate/imgutils index 01c9877de5..7661f2cdaa 100644 --- a/tests/ref/fate/imgutils +++ b/tests/ref/fate/imgutils @@ -249,3 +249,7 @@ 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 +rgbx64be planes: 1, linesizes: 512 0 0 0, plane_sizes: 24576 0 0 0, plane_offsets: 0 0 0, total_size: 24576 +rgbx64le planes: 1, linesizes: 512 0 0 0, plane_sizes: 24576 0 0 0, plane_offsets: 0 0 0, total_size: 24576 +bgrx64be planes: 1, linesizes: 512 0 0 0, plane_sizes: 24576 0 0 0, plane_offsets: 0 0 0, total_size: 24576 +bgrx64le 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..02cc1bf916 100644 --- a/tests/ref/fate/sws-pixdesc-query +++ b/tests/ref/fate/sws-pixdesc-query @@ -5,6 +5,8 @@ is16BPS: bgr48le bgra64be bgra64le + bgrx64be + bgrx64le gbrap16be gbrap16le gbrp16be @@ -23,6 +25,8 @@ is16BPS: rgba64le rgbaf16be rgbaf16le + rgbx64be + rgbx64le ya16be ya16le yuv420p16be @@ -131,6 +135,7 @@ isBE: bgr555be bgr565be bgra64be + bgrx64be gbrap10be gbrap12be gbrap16be @@ -160,6 +165,7 @@ isBE: rgb565be rgba64be rgbaf16be + rgbx64be x2bgr10be x2rgb10be xyz12be @@ -443,6 +449,8 @@ isRGB: bgr8 bgra64be bgra64le + bgrx64be + bgrx64le gbrap gbrap10be gbrap10le @@ -484,6 +492,8 @@ isRGB: rgba64le rgbaf16be rgbaf16le + rgbx64be + rgbx64le x2bgr10be x2bgr10le x2rgb10be @@ -593,6 +603,8 @@ AnyRGB: bgr8 bgra64be bgra64le + bgrx64be + bgrx64le gbrap gbrap10be gbrap10le @@ -636,6 +648,8 @@ AnyRGB: rgba64le rgbaf16be rgbaf16le + rgbx64be + rgbx64le x2bgr10be x2bgr10le x2rgb10be @@ -728,6 +742,8 @@ Packed: bgr8 bgra64be bgra64le + bgrx64be + bgrx64le monob monow pal8 @@ -750,6 +766,8 @@ Packed: rgba64le rgbaf16be rgbaf16le + rgbx64be + rgbx64le uyvy422 uyyvyy411 vuya @@ -912,6 +930,8 @@ PackedRGB: bgr8 bgra64be bgra64le + bgrx64be + bgrx64le rgb0 rgb24 rgb32 @@ -931,6 +951,8 @@ PackedRGB: rgba64le rgbaf16be rgbaf16le + rgbx64be + rgbx64le x2bgr10be x2bgr10le x2rgb10be