From patchwork Wed Sep 22 03:40:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manuel Stoeckl X-Patchwork-Id: 30452 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6506:0:0:0:0:0 with SMTP id z6csp127307iob; Tue, 21 Sep 2021 20:40:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbGZWUtf/SqsMgp6s8VAzJeFsGddk1jPxT9KnDvS/SVX+wwDTekXiCM45Ox9WgJlOVWRrm X-Received: by 2002:a17:906:1d43:: with SMTP id o3mr21150549ejh.118.1632282050284; Tue, 21 Sep 2021 20:40:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632282050; cv=none; d=google.com; s=arc-20160816; b=bLME0o4ColP12rBMmKwJjnLZzwLAlY/7r1FBLtFYzjKckTuUZqvvCyEHpK6hz5U37P u16hBUXkpBGs7rFrSGOdeu7jAJIYRSqAky3ki6VwJCJlHZxgDKC0fNh+WRU9m377loy2 /qXfhyA5xOqvRNChxTq5GIyklEtB64DzI7CXa+rjWbb4VMuiNVngK99PqUJb9b0uh5jA y60HNaeNDZvjUsz3WTdDAzDxR0TwGc/ttvJCGoI4Pj5lZFnTAgXVcQz/Qcaygvx52gpP kncN4X0WejjCu7GCSWvn4NRNJET28IRmhbCYWDFsUvYoEkx74gZDsHaouZC2FqVYp4qs OxfQ== 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:delivered-to; bh=y8XGyHjd3dnvtz4OI6fs8hIJarUfN8MGepAehD+HVuA=; b=AWmEtTKv9vowz6DLmTZEF8OOSfb87CDu1ZNXOQIhRasusHskj+mjQQrrcmdVR+3olE /WDOHCRrfIyzNuowottnrwWdjZ0stA1fem/Fut3sJYNLiTswbl+jjn4vevBTe2P/SJda K/ZIA01ui2nlWcj7yf1h0VWKoiIK8m+kHBGBJIiGewKT8uiLI+yXxxul5BkU3J5gr75m A+V8dp1569gDBMOAOj0QTNdFfjL9izIojTWXJJA/eraQEu+a8I+sc8zGE+xniENSI1BL cxZi8Fd1CveyZ2OJke0WoUKpDRXXmz6QTmVq0y7CaWuyKxzK1so2QsCAC5ObBZtGqyYi ZpHQ== 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 f21si1306092ejl.103.2021.09.21.20.40.49; Tue, 21 Sep 2021 20:40:50 -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 0677568B119; Wed, 22 Sep 2021 06:40:47 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mout-p-103.mailbox.org (mout-p-103.mailbox.org [80.241.56.161]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 105CF68A8F3 for ; Wed, 22 Sep 2021 06:40:40 +0300 (EEST) Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:105:465:1:4:0]) (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-103.mailbox.org (Postfix) with ESMTPS id 4HDkbC4CsXzQjf7; Wed, 22 Sep 2021 05:40:39 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de From: Manuel Stoeckl To: ffmpeg-devel@ffmpeg.org Date: Tue, 21 Sep 2021 23:40:15 -0400 Message-Id: <20210922034015.62959-1-code@mstoeckl.com> In-Reply-To: <20210919222837.313b34bf@shale> References: <20210919222837.313b34bf@shale> MIME-Version: 1.0 X-Rspamd-Queue-Id: C576F274 Subject: [FFmpeg-devel] [PATCH v2 1/2] lavu/pix_fmt: add pixel format for x2bgr10 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: T/f4qFye9IK7 The new format (given in big/little endian forms) matches the existing X2RGB10 format, except with B and R channels switched. AV_PIX_FMT_X2BGR10 data often is created by OpenGL programs whose buffers use the GL_RGB10 internal format. Signed-off-by: Manuel Stoeckl --- doc/APIchanges | 3 +++ libavutil/pixdesc.c | 24 ++++++++++++++++++++++++ libavutil/pixfmt.h | 3 +++ libavutil/version.h | 2 +- tests/ref/fate/imgutils | 2 ++ tests/ref/fate/sws-pixdesc-query | 11 +++++++++++ 6 files changed, 44 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index 5b5c2a6f11..7b267a79ac 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,9 @@ libavutil: 2021-04-27 API changes, most recent first: +2021-09-21 - xxxxxxxxxx - lavu 57.7.100 - pixfmt.h + Add AV_PIX_FMT_X2BGR10. + 2021-09-20 - xxxxxxxxxx - lavu 57.6.100 - mem.h Deprecate av_mallocz_array() as it is identical to av_calloc(). diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index 2346138d04..69cb198646 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -272,6 +272,30 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { }, .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BE, }, + [AV_PIX_FMT_X2BGR10LE] = { + .name = "x2bgr10le", + .nb_components= 3, + .log2_chroma_w= 0, + .log2_chroma_h= 0, + .comp = { + { 0, 4, 0, 0, 10 }, /* R */ + { 0, 4, 1, 2, 10 }, /* G */ + { 0, 4, 2, 4, 10 }, /* B */ + }, + .flags = AV_PIX_FMT_FLAG_RGB, + }, + [AV_PIX_FMT_X2BGR10BE] = { + .name = "x2bgr10be", + .nb_components= 3, + .log2_chroma_w= 0, + .log2_chroma_h= 0, + .comp = { + { 0, 4, 2, 0, 10 }, /* R */ + { 0, 4, 1, 2, 10 }, /* G */ + { 0, 4, 0, 4, 10 }, /* B */ + }, + .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BE, + }, [AV_PIX_FMT_YUV422P] = { .name = "yuv422p", .nb_components = 3, diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index 5814f3f3da..53bdecfcb7 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -350,6 +350,8 @@ enum AVPixelFormat { AV_PIX_FMT_X2RGB10LE, ///< packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 10B(lsb), little-endian, X=unused/undefined AV_PIX_FMT_X2RGB10BE, ///< packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 10B(lsb), big-endian, X=unused/undefined + AV_PIX_FMT_X2BGR10LE, ///< packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G 10R(lsb), little-endian, X=unused/undefined + AV_PIX_FMT_X2BGR10BE, ///< packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G 10R(lsb), big-endian, X=unused/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 }; @@ -440,6 +442,7 @@ enum AVPixelFormat { #define AV_PIX_FMT_Y210 AV_PIX_FMT_NE(Y210BE, Y210LE) #define AV_PIX_FMT_X2RGB10 AV_PIX_FMT_NE(X2RGB10BE, X2RGB10LE) +#define AV_PIX_FMT_X2BGR10 AV_PIX_FMT_NE(X2BGR10BE, X2BGR10LE) /** * Chromaticity coordinates of the source primaries. diff --git a/libavutil/version.h b/libavutil/version.h index a62f73639b..896e348d80 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 57 -#define LIBAVUTIL_VERSION_MINOR 6 +#define LIBAVUTIL_VERSION_MINOR 7 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ diff --git a/tests/ref/fate/imgutils b/tests/ref/fate/imgutils index f510150ea1..495bbd46f0 100644 --- a/tests/ref/fate/imgutils +++ b/tests/ref/fate/imgutils @@ -236,3 +236,5 @@ y210be planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 y210le planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 x2rgb10le planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 x2rgb10be planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 +x2bgr10le planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 +x2bgr10be 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/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query index c3cccfa492..a74109c3d7 100644 --- a/tests/ref/fate/sws-pixdesc-query +++ b/tests/ref/fate/sws-pixdesc-query @@ -57,6 +57,8 @@ isNBPS: nv20le p010be p010le + x2bgr10be + x2bgr10le x2rgb10be x2rgb10le xyz12be @@ -143,6 +145,7 @@ isBE: rgb555be rgb565be rgba64be + x2bgr10be x2rgb10be xyz12be y210be @@ -439,6 +442,8 @@ isRGB: rgb8 rgba64be rgba64le + x2bgr10be + x2bgr10le x2rgb10be x2rgb10le @@ -587,6 +592,8 @@ AnyRGB: rgb8 rgba64be rgba64le + x2bgr10be + x2bgr10le x2rgb10be x2rgb10le @@ -696,6 +703,8 @@ Packed: rgba64le uyvy422 uyyvyy411 + x2bgr10be + x2bgr10le x2rgb10be x2rgb10le xyz12be @@ -862,6 +871,8 @@ PackedRGB: rgb8 rgba64be rgba64le + x2bgr10be + x2bgr10le x2rgb10be x2rgb10le