From patchwork Sat Sep 18 18:55:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manuel Stoeckl X-Patchwork-Id: 30360 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6506:0:0:0:0:0 with SMTP id z6csp120066iob; Sat, 18 Sep 2021 11:56:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyk8R/q8X78rWHJrM5IYTCexpa2PmZkDR1CqUZf0P4ekgDvQ8m3LtD+4AY9KABM6+c0VW6M X-Received: by 2002:a17:907:628d:: with SMTP id nd13mr19885416ejc.7.1631991366418; Sat, 18 Sep 2021 11:56:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631991366; cv=none; d=google.com; s=arc-20160816; b=FxFYEkC0OWBRGw0oP66J6uPqIzyHq4sKjSOR4+n1s7V2k6eQX1z6X/tIZc0IGGvYJy 7IVbVlo9DQbLF3Ibv41f6GiEfDUGp2FNbfyKFclZO1rVX9VgElxZZ4DIhCA38EV5NtSB 6NEJ93Jm3D9j7SGCD1aHEhDH6KiIgwWh/aWT8FlRx3HJXaJ91NFxgKs4cD9uucO21YXb W05LxwzV2YqYu5V3RQH2Ayva0V0u54QmmeRTMV3FYe31nBWSLZ6fxj4iJojWTE39BM9J GBN6gQGr9ry6j86zC+bFg1aC2JXD1vySIY3+z/QqVwPiiOFl5QhBIj7ai60+qz34jZPm g9fw== 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=RUvrTha9f9XQtm9JZKQSQvKEayX9ax/8PavnL0xo9OA=; b=nXPBC6nAKUurKUgBgaE+yDorileU+TyoVBX8l5/Bq/TN7dCu11c/zhZR1UhlGRQ2ax Qw/RBAJ8Y2EBuv2K40kbLKAYccPj4rH6b4VMinP5zD5GenCZVT7CE9H+rZAzAYoUAm5x r06CY8kY0+UYbYlxk+9UfsIdZBqbU7JMtrMQAfTHhxBx3f0x7uIabSiMMv6G0Ft4o9ms ax+qjD/txppz/73aE9Akv6Q/qAHZjbTT0lwatpLckDnopk9Pq2FSjeXLsIgafOYG2bMi DdLhgmV3l4P0z9sM15B/M8fwu3oGvcMmMbLFM0Celjj78wB27GiqacWrAhpXjM/ZpQgh OO3w== 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 30si11979785eji.702.2021.09.18.11.56.06; Sat, 18 Sep 2021 11:56:06 -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 BAE3968AEAE; Sat, 18 Sep 2021 21:55:53 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1786968AEAE for ; Sat, 18 Sep 2021 21:55:47 +0300 (EEST) Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (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-101.mailbox.org (Postfix) with ESMTPS id 4HBg4y54ZWzQkBD; Sat, 18 Sep 2021 20:55:46 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de From: Manuel Stoeckl To: ffmpeg-devel@ffmpeg.org Date: Sat, 18 Sep 2021 14:55:33 -0400 Message-Id: <20210918185534.50715-1-code@mstoeckl.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 899461838 Subject: [FFmpeg-devel] [PATCH 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: gAlwjJ4wiKZP 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 | 4 ++-- tests/ref/fate/imgutils | 2 ++ tests/ref/fate/sws-pixdesc-query | 11 +++++++++++ 6 files changed, 45 insertions(+), 2 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index cf6105c99e..0ae6495b4d 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,9 @@ libavutil: 2021-04-27 API changes, most recent first: +2021-09-18 - xxxxxxxxxx - lavu 57.6.100 - pixfmt.h + Add AV_PIX_FMT_X2BGR10. + 2021-09-17 - xxxxxxxxxx - lavu 57.5.101 - buffer.h Constified the input parameters in av_buffer_replace(), av_buffer_ref(), and av_buffer_pool_buffer_get_opaque(). 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 1e6a80f86e..2b5ac540a4 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,8 +79,8 @@ */ #define LIBAVUTIL_VERSION_MAJOR 57 -#define LIBAVUTIL_VERSION_MINOR 5 -#define LIBAVUTIL_VERSION_MICRO 101 +#define LIBAVUTIL_VERSION_MINOR 6 +#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 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 From patchwork Sat Sep 18 18:55:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manuel Stoeckl X-Patchwork-Id: 30361 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6506:0:0:0:0:0 with SMTP id z6csp119960iob; Sat, 18 Sep 2021 11:55:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPU6s4YX+BeTX2Z3M1MWYDVz50Tc8c0wnTvGJ5jJXdx6FgCnA2uZMesIuikXBXjmYndDmR X-Received: by 2002:a05:6402:5c2:: with SMTP id n2mr19804939edx.239.1631991355953; Sat, 18 Sep 2021 11:55:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631991355; cv=none; d=google.com; s=arc-20160816; b=JN1NNKl7kUiR4lv8OKgl/hmolaqSTdtLPaT5fPRXvtZYvkTj1cotitayFTGs7w+vOB 6ctDPCaC2nCipMoB/KA1/EL/NmFnaoVBbZkp0OvJ8NBt2DlffB5IGlD+9Cl7EdxA2gZJ cIbESL1DvXzgu591Sh+KSTcEWcfByhcUCzEIPVhLQiowynbddb4c3wFXAgb+1fzruYwZ o/xoB9hw139yhJK5jHWtrazuMoowm/qHCBh9/8r5jxuPUuXChA/YhJDZBOkVZL0vZoNe Gc4P44IcX32nRhPSh+zEcAschqQL4IObc9Y+hGUX2bjsMhyOw2yEQE5npBuRjgjrelep 0a5Q== 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=OlxYRY0WiWMjBZOPMwKWCLoV8V4S8OiIuZp26HR1TC0=; b=rcjmOj4tymjPqlAzkrPdtEt0CeII7bWZBjdmHYrjIJEdQt5NsQx6I/dZZ8xXNnxFZT IKP+bkTGageHSOWcCCFwqdNuM/JXVJPjWwLmI9NifCryn4wuyqnfGdXcKnRdgXwx+Brd xKQdlHN5C8qthtgg4aQBc1zpG1ZqDJ5OH+arwm5mH97guBhmjfh5TZHgRHmFJ9Mxqe8N PH5gnLfhDamNOPVmskMsmFuckECmiqxqQbpjiCwQMEjKAnyworEe6QmDkQS5zNT5QwSR 7YNvi/X8uZdDpKq+wwH19nTW++oYTcE9UZplB/OBqn0g2lj9e83WQ3l4/EjRWBKUrJHf jYlQ== 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 m1si13107994ejj.616.2021.09.18.11.55.55; Sat, 18 Sep 2021 11:55:55 -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 A2AAD68AEE2; Sat, 18 Sep 2021 21:55:50 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C02B168AC57 for ; Sat, 18 Sep 2021 21:55:43 +0300 (EEST) Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (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-101.mailbox.org (Postfix) with ESMTPS id 4HBg4v3307zQk38; Sat, 18 Sep 2021 20:55:43 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de From: Manuel Stoeckl To: ffmpeg-devel@ffmpeg.org Date: Sat, 18 Sep 2021 14:55:34 -0400 Message-Id: <20210918185534.50715-2-code@mstoeckl.com> In-Reply-To: <20210918185534.50715-1-code@mstoeckl.com> References: <20210918185534.50715-1-code@mstoeckl.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 45E8E1838 Subject: [FFmpeg-devel] [PATCH 2/2] swscale: add input/output support for X2BGR10LE 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: wCx6sPAQxv9c Signed-off-by: Manuel Stoeckl --- libswscale/input.c | 15 +++++++++++++-- libswscale/output.c | 9 ++++++++- libswscale/utils.c | 1 + libswscale/yuv2rgb.c | 9 ++++++--- tests/ref/fate/filter-pixdesc-x2bgr10le | 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 + 16 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 tests/ref/fate/filter-pixdesc-x2bgr10le diff --git a/libswscale/input.c b/libswscale/input.c index b65aaf7c06..477dc3d6b2 100644 --- a/libswscale/input.c +++ b/libswscale/input.c @@ -245,7 +245,8 @@ rgb48funcs(bgr, BE, AV_PIX_FMT_BGR48BE) origin == AV_PIX_FMT_ARGB || \ origin == AV_PIX_FMT_ABGR) \ ? AV_RN32A(&src[(i) * 4]) \ - : ((origin == AV_PIX_FMT_X2RGB10LE) \ + : ((origin == AV_PIX_FMT_X2RGB10LE || \ + origin == AV_PIX_FMT_X2BGR10LE) \ ? AV_RL32(&src[(i) * 4]) \ : (isBE(origin) ? AV_RB16(&src[(i) * 2]) \ : AV_RL16(&src[(i) * 2])))) @@ -393,6 +394,7 @@ rgb16_32_wrapper(AV_PIX_FMT_RGB565BE, rgb16be, 0, 0, 0, 0, 0xF800, 0x07E0, rgb16_32_wrapper(AV_PIX_FMT_RGB555BE, rgb15be, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, 0, 5, 10, RGB2YUV_SHIFT + 7) rgb16_32_wrapper(AV_PIX_FMT_RGB444BE, rgb12be, 0, 0, 0, 0, 0x0F00, 0x00F0, 0x000F, 0, 4, 8, RGB2YUV_SHIFT + 4) rgb16_32_wrapper(AV_PIX_FMT_X2RGB10LE, rgb30le, 16, 6, 0, 0, 0x3FF00000, 0xFFC00, 0x3FF, 0, 0, 4, RGB2YUV_SHIFT + 6) +rgb16_32_wrapper(AV_PIX_FMT_X2BGR10LE, bgr30le, 0, 6, 16, 0, 0x3FF, 0xFFC00, 0x3FF00000, 4, 0, 0, RGB2YUV_SHIFT + 6) static void gbr24pToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *gsrc, const uint8_t *bsrc, const uint8_t *rsrc, @@ -1344,6 +1346,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_X2RGB10LE: c->chrToYV12 = rgb30leToUV_half_c; break; + case AV_PIX_FMT_X2BGR10LE: + c->chrToYV12 = bgr30leToUV_half_c; + break; } } else { switch (srcFormat) { @@ -1428,6 +1433,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_X2RGB10LE: c->chrToYV12 = rgb30leToUV_c; break; + case AV_PIX_FMT_X2BGR10LE: + c->chrToYV12 = bgr30leToUV_c; + break; } } @@ -1708,7 +1716,10 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) c->lumToYV12 = y210le_Y_c; break; case AV_PIX_FMT_X2RGB10LE: - c->lumToYV12 =rgb30leToY_c; + c->lumToYV12 = rgb30leToY_c; + break; + case AV_PIX_FMT_X2BGR10LE: + c->lumToYV12 = bgr30leToY_c; break; } if (c->needAlpha) { diff --git a/libswscale/output.c b/libswscale/output.c index f1d9a61d53..58b10f85a5 100644 --- a/libswscale/output.c +++ b/libswscale/output.c @@ -1603,7 +1603,7 @@ yuv2rgb_write(uint8_t *_dest, int i, int Y1, int Y2, dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1]; dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]; - } else if (target == AV_PIX_FMT_X2RGB10) { + } else if (target == AV_PIX_FMT_X2RGB10 || target == AV_PIX_FMT_X2BGR10) { uint32_t *dest = (uint32_t *) _dest; const uint32_t *r = (const uint32_t *) _r; const uint32_t *g = (const uint32_t *) _g; @@ -1848,6 +1848,7 @@ YUV2RGBWRAPPER(yuv2rgb,, 8, AV_PIX_FMT_RGB8, 0) YUV2RGBWRAPPER(yuv2rgb,, 4, AV_PIX_FMT_RGB4, 0) YUV2RGBWRAPPER(yuv2rgb,, 4b, AV_PIX_FMT_RGB4_BYTE, 0) YUV2RGBWRAPPER(yuv2, rgb, x2rgb10, AV_PIX_FMT_X2RGB10, 0) +YUV2RGBWRAPPER(yuv2, rgb, x2bgr10, AV_PIX_FMT_X2BGR10, 0) static av_always_inline void yuv2rgb_write_full(SwsContext *c, uint8_t *dest, int i, int Y, int A, int U, int V, @@ -3000,6 +3001,12 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c, *yuv2packed2 = yuv2x2rgb10_2_c; *yuv2packedX = yuv2x2rgb10_X_c; break; + case AV_PIX_FMT_X2BGR10LE: + case AV_PIX_FMT_X2BGR10BE: + *yuv2packed1 = yuv2x2bgr10_1_c; + *yuv2packed2 = yuv2x2bgr10_2_c; + *yuv2packedX = yuv2x2bgr10_X_c; + break; } } switch (dstFormat) { diff --git a/libswscale/utils.c b/libswscale/utils.c index 25051ead72..e65dba0f0b 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -267,6 +267,7 @@ static const FormatEntry format_entries[] = { [AV_PIX_FMT_NV42] = { 1, 1 }, [AV_PIX_FMT_Y210LE] = { 1, 0 }, [AV_PIX_FMT_X2RGB10LE] = { 1, 1 }, + [AV_PIX_FMT_X2BGR10LE] = { 1, 1 }, }; int sws_isSupportedInput(enum AVPixelFormat pix_fmt) diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c index cac82f4c6f..b13a22fc5c 100644 --- a/libswscale/yuv2rgb.c +++ b/libswscale/yuv2rgb.c @@ -783,6 +783,8 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], c->dstFormat == AV_PIX_FMT_RGB555LE || c->dstFormat == AV_PIX_FMT_RGB444BE || c->dstFormat == AV_PIX_FMT_RGB444LE || + c->dstFormat == AV_PIX_FMT_X2RGB10BE || + c->dstFormat == AV_PIX_FMT_X2RGB10LE || c->dstFormat == AV_PIX_FMT_RGB8 || c->dstFormat == AV_PIX_FMT_RGB4 || c->dstFormat == AV_PIX_FMT_RGB4_BYTE || @@ -793,7 +795,8 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], c->dstFormat == AV_PIX_FMT_NE(BGR565LE, BGR565BE) || c->dstFormat == AV_PIX_FMT_NE(BGR555LE, BGR555BE) || c->dstFormat == AV_PIX_FMT_NE(BGR444LE, BGR444BE) || - c->dstFormat == AV_PIX_FMT_NE(X2RGB10LE, X2RGB10BE); + c->dstFormat == AV_PIX_FMT_NE(X2RGB10LE, X2RGB10BE) || + c->dstFormat == AV_PIX_FMT_NE(X2BGR10LE, X2BGR10BE); const int bpp = c->dstFormatBpp; uint8_t *y_table; uint16_t *y_table16; @@ -966,9 +969,9 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], fill_gv_table(c->table_gV, 1, cgv); break; case 30: - rbase = 20; + rbase = isRgb ? 20 : 0; gbase = 10; - bbase = 0; + bbase = isRgb ? 0 : 20; needAlpha = CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat); if (!needAlpha) abase = 30; diff --git a/tests/ref/fate/filter-pixdesc-x2bgr10le b/tests/ref/fate/filter-pixdesc-x2bgr10le new file mode 100644 index 0000000000..777fd7b93e --- /dev/null +++ b/tests/ref/fate/filter-pixdesc-x2bgr10le @@ -0,0 +1 @@ +pixdesc-x2bgr10le 32a35dc7248558018c34f888a251e684 diff --git a/tests/ref/fate/filter-pixfmts-copy b/tests/ref/fate/filter-pixfmts-copy index 1d7657c2af..8d508b75f1 100644 --- a/tests/ref/fate/filter-pixfmts-copy +++ b/tests/ref/fate/filter-pixfmts-copy @@ -80,6 +80,7 @@ rgba b6e1b441c365e03b5ffdf9b7b68d9a0c rgba64be ae2ae04b5efedca3505f47c4dd6ea6ea rgba64le b91e1d77f799eb92241a2d2d28437b15 uyvy422 3bcf3c80047592f2211fae3260b1b65d +x2bgr10le 2368626dbaafdd0feb56e2cb50f03c29 x2rgb10le b0a0c8056521beeaa3fea4985ca87176 xyz12be a1ef56bf746d71f59669c28e48fc8450 xyz12le 831ff03c1ba4ef19374686f16a064d8c diff --git a/tests/ref/fate/filter-pixfmts-crop b/tests/ref/fate/filter-pixfmts-crop index 8fc7614192..2b7ad58822 100644 --- a/tests/ref/fate/filter-pixfmts-crop +++ b/tests/ref/fate/filter-pixfmts-crop @@ -77,6 +77,7 @@ rgb8 9b364a8f112ad9459fec47a51cc03b30 rgba 9488ac85abceaf99a9309eac5a87697e rgba64be 89910046972ab3c68e2a348302cc8ca9 rgba64le fea8ebfc869b52adf353778f29eac7a7 +x2bgr10le 832bf5c3fe02ee76078472fa2d5ba56e x2rgb10le 5c0789f76a713f343c2ed42a371d441d xyz12be cb4571f9aaa7b59f999ef327276104b7 xyz12le cd6aae8d26b18bdb4b9d068586276d91 diff --git a/tests/ref/fate/filter-pixfmts-field b/tests/ref/fate/filter-pixfmts-field index ce8e53571f..70b4577888 100644 --- a/tests/ref/fate/filter-pixfmts-field +++ b/tests/ref/fate/filter-pixfmts-field @@ -80,6 +80,7 @@ rgba ee616262ca6d67b7ecfba4b36c602ce3 rgba64be 23c8c0edaabe3eaec89ce69633fb0048 rgba64le dfdba4de4a7cac9abf08852666c341d3 uyvy422 1c49e44ab3f060e85fc4a3a9464f045e +x2bgr10le dee1ad6684ed252be7bd40ffca5c4b77 x2rgb10le a7a5dcdfe1d4b6bd71e40b01c735f144 xyz12be d2fa69ec91d3ed862f2dac3f8e7a3437 xyz12le 02bccd5e0b6824779a1f848b0ea3e3b5 diff --git a/tests/ref/fate/filter-pixfmts-fieldorder b/tests/ref/fate/filter-pixfmts-fieldorder index 90d36add83..08c08aedb4 100644 --- a/tests/ref/fate/filter-pixfmts-fieldorder +++ b/tests/ref/fate/filter-pixfmts-fieldorder @@ -71,6 +71,7 @@ rgba 1fdf872a087a32cd35b80cc7be399578 rgba64be 5598f44514d122b9a57c5c92c20bbc61 rgba64le b34e6e30621ae579519a2d91a96a0acf uyvy422 75de70e31c435dde878002d3f22b238a +x2bgr10le fea0f9d1ded57960b7edeee9b0bdf394 x2rgb10le 636c90498c64abba1cc0624c5209a61f xyz12be 15f5cda71de5fef9cec5e75e3833b6bc xyz12le 7be6c8781f38c21a6b8f602f62ca31e6 diff --git a/tests/ref/fate/filter-pixfmts-hflip b/tests/ref/fate/filter-pixfmts-hflip index 0d40b93e97..62f453e2a0 100644 --- a/tests/ref/fate/filter-pixfmts-hflip +++ b/tests/ref/fate/filter-pixfmts-hflip @@ -77,6 +77,7 @@ rgb8 68a3a575badadd9e4f90226209f11699 rgba 51961c723ea6707e0a410cd3f21f15d3 rgba64be c910444019f4cfbf4d995227af55da8d rgba64le 0c810d8b3a6bca10321788e1cb145340 +x2bgr10le d0b303f88fa73beb13b1277b735ef64b x2rgb10le 9f99dce306383daf25cd1542b2517fef xyz12be 25f90259ff8a226befdaec3dfe82996e xyz12le 926c0791d59aaff61b2778e8ada3316d diff --git a/tests/ref/fate/filter-pixfmts-il b/tests/ref/fate/filter-pixfmts-il index d1bc866957..bc4c9b952d 100644 --- a/tests/ref/fate/filter-pixfmts-il +++ b/tests/ref/fate/filter-pixfmts-il @@ -79,6 +79,7 @@ rgba 625d8f4bd39c4bdbf61eb5e4713aecc9 rgba64be db70d33aa6c06f3e0a1c77bd11284261 rgba64le a8a2daae04374a27219bc1c890204007 uyvy422 d6ee3ca43356d08c392382b24b22cda5 +x2bgr10le 4ff543998175b5ceb4bb377220109f30 x2rgb10le a01ea7dd339e028780e04971012d826d xyz12be 7c7d54c55f136cbbc50b18029f3be0b3 xyz12le 090ba6b1170baf2b1358b43b971d33b0 diff --git a/tests/ref/fate/filter-pixfmts-null b/tests/ref/fate/filter-pixfmts-null index 1d7657c2af..8d508b75f1 100644 --- a/tests/ref/fate/filter-pixfmts-null +++ b/tests/ref/fate/filter-pixfmts-null @@ -80,6 +80,7 @@ rgba b6e1b441c365e03b5ffdf9b7b68d9a0c rgba64be ae2ae04b5efedca3505f47c4dd6ea6ea rgba64le b91e1d77f799eb92241a2d2d28437b15 uyvy422 3bcf3c80047592f2211fae3260b1b65d +x2bgr10le 2368626dbaafdd0feb56e2cb50f03c29 x2rgb10le b0a0c8056521beeaa3fea4985ca87176 xyz12be a1ef56bf746d71f59669c28e48fc8450 xyz12le 831ff03c1ba4ef19374686f16a064d8c diff --git a/tests/ref/fate/filter-pixfmts-pad b/tests/ref/fate/filter-pixfmts-pad index 9a5db82543..16c0bbec26 100644 --- a/tests/ref/fate/filter-pixfmts-pad +++ b/tests/ref/fate/filter-pixfmts-pad @@ -28,6 +28,7 @@ nv42 1738ad3c31c6c16e17679f5b09ce4677 rgb0 78d500c8361ab6423a4826a00268c908 rgb24 17f9e2e0c609009acaf2175c42d4a2a5 rgba b157c90191463d34fb3ce77b36c96386 +x2bgr10le a90a784d1ecd2ed4813aef0dcb00dba9 x2rgb10le c240f8a8dfa647c57c0974d061c9652a xyz12le 85abf80b77a9236a76ba0b00fcbdea2d ya16le 940fafa240b9916de5f73cb20a552f24 diff --git a/tests/ref/fate/filter-pixfmts-scale b/tests/ref/fate/filter-pixfmts-scale index f47c9b887f..100e991435 100644 --- a/tests/ref/fate/filter-pixfmts-scale +++ b/tests/ref/fate/filter-pixfmts-scale @@ -80,6 +80,7 @@ rgba 85bb5d03cea1c6e8002ced3373904336 rgba64be ee73e57923af984b31cc7795d13929da rgba64le 783d2779adfafe3548bdb671ec0de69e uyvy422 aeb4ba4f9f003ae21f6d18089198244f +x2bgr10le 8de0b40880ffa801414a5111d5aa75f3 x2rgb10le 591fe7942544c8fc40e5d30e0e589f49 xyz12be c7ba8345998c0141ddc079cdd29b1a40 xyz12le 95f5d3a0de834cc495c9032a14987cde diff --git a/tests/ref/fate/filter-pixfmts-transpose b/tests/ref/fate/filter-pixfmts-transpose index 0a8542b2a9..21e1dba357 100644 --- a/tests/ref/fate/filter-pixfmts-transpose +++ b/tests/ref/fate/filter-pixfmts-transpose @@ -76,6 +76,7 @@ rgb8 c90feb30c3c9391ef5f470209d7b7a15 rgba 4d76a9542143752a4ac30f82f88f68f1 rgba64be a60041217f4c0cd796d19d3940a12a41 rgba64le ad47197774858858ae7b0c177dffa459 +x2bgr10le 399e33c606fbfc74acf0c10db194fc3a x2rgb10le a64d4d901b09bea9d59eda58be5e88ff xyz12be 68e5cba640f6e4ef72dff950e88b5342 xyz12le 8b6b6a6db4d7561e80db88ccaecce7a9 diff --git a/tests/ref/fate/filter-pixfmts-vflip b/tests/ref/fate/filter-pixfmts-vflip index 732db8d331..aee832ba56 100644 --- a/tests/ref/fate/filter-pixfmts-vflip +++ b/tests/ref/fate/filter-pixfmts-vflip @@ -80,6 +80,7 @@ rgba c1a5908572737f2ae1e5d8218af65f4b rgba64be 17e6273323b5779b5f3f775f150c1011 rgba64le 48f45b10503b7dd140329c3dd0d54c98 uyvy422 3a237e8376264e0cfa78f8a3fdadec8a +x2bgr10le 6315a25ebc9dc4e513ee4aded8648d7c x2rgb10le 332a6f5f5012008a562cb031836da028 xyz12be 810644e008deb231850d779aaa27cc7e xyz12le 829701db461b43533cf9241e0743bc61