lavu/pix_fmt: add pixel format for x2bgr10

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 <code@mstoeckl.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Manuel Stoeckl 2021-09-23 23:22:31 -04:00 committed by Michael Niedermayer
parent ca594df622
commit 0760d9153c
6 changed files with 44 additions and 1 deletions

View File

@ -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().

View File

@ -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,

View File

@ -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.

View File

@ -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, \

View File

@ -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

View File

@ -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