From 63bb6d6a9b64f78e0cfbbc008947c9e0bf2fc409 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Wed, 14 Sep 2022 14:09:02 +0200 Subject: [PATCH] avutil: add RGB single-precision float formats --- libavutil/pixdesc.c | 25 +++++++++++++++++++++++++ libavutil/pixfmt.h | 3 +++ tests/ref/fate/imgutils | 2 ++ tests/ref/fate/sws-pixdesc-query | 9 +++++++++ 4 files changed, 39 insertions(+) diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index b472a94f60..248d5f29cd 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -2636,6 +2636,31 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { }, .flags = AV_PIX_FMT_FLAG_BE, }, + [AV_PIX_FMT_RGBF32BE] = { + .name = "rgbf32be", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 12, 0, 0, 32 }, /* R */ + { 0, 12, 4, 0, 32 }, /* G */ + { 0, 12, 8, 0, 32 }, /* B */ + }, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | + AV_PIX_FMT_FLAG_FLOAT, + }, + [AV_PIX_FMT_RGBF32LE] = { + .name = "rgbf32le", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 12, 0, 0, 32 }, /* R */ + { 0, 12, 4, 0, 32 }, /* G */ + { 0, 12, 8, 0, 32 }, /* B */ + }, + .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT, + }, }; static const char * const color_range_names[] = { diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index a1c4c9fb75..3c34d73e2c 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -386,6 +386,9 @@ enum AVPixelFormat { AV_PIX_FMT_XV36BE, ///< packed XVYU 4:4:4, 48bpp, data in the high bits, zeros in the low bits, big-endian, variant of Y412 where alpha channel is left undefined AV_PIX_FMT_XV36LE, ///< packed XVYU 4:4:4, 48bpp, data in the high bits, zeros in the low bits, little-endian, variant of Y412 where alpha channel is left undefined + AV_PIX_FMT_RGBF32BE, ///< IEEE-754 single precision packed RGB 32:32:32, 96bpp, RGBRGB..., big-endian + AV_PIX_FMT_RGBF32LE, ///< IEEE-754 single precision packed RGB 32:32:32, 96bpp, RGBRGB..., 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 }; diff --git a/tests/ref/fate/imgutils b/tests/ref/fate/imgutils index de73513e7c..8ad5615ed8 100644 --- a/tests/ref/fate/imgutils +++ b/tests/ref/fate/imgutils @@ -258,3 +258,5 @@ xv30be planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 xv30le planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 xv36be planes: 1, linesizes: 512 0 0 0, plane_sizes: 24576 0 0 0, plane_offsets: 0 0 0, total_size: 24576 xv36le planes: 1, linesizes: 512 0 0 0, plane_sizes: 24576 0 0 0, plane_offsets: 0 0 0, total_size: 24576 +rgbf32be planes: 1, linesizes: 768 0 0 0, plane_sizes: 36864 0 0 0, plane_offsets: 0 0 0, total_size: 36864 +rgbf32le planes: 1, linesizes: 768 0 0 0, plane_sizes: 36864 0 0 0, plane_offsets: 0 0 0, total_size: 36864 diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query index 20fc596ce9..e850d52d12 100644 --- a/tests/ref/fate/sws-pixdesc-query +++ b/tests/ref/fate/sws-pixdesc-query @@ -169,6 +169,7 @@ isBE: rgb565be rgba64be rgbaf16be + rgbf32be x2bgr10be x2rgb10be xv30be @@ -509,6 +510,8 @@ isRGB: rgba64le rgbaf16be rgbaf16le + rgbf32be + rgbf32le x2bgr10be x2bgr10le x2rgb10be @@ -661,6 +664,8 @@ AnyRGB: rgba64le rgbaf16be rgbaf16le + rgbf32be + rgbf32le x2bgr10be x2bgr10le x2rgb10be @@ -775,6 +780,8 @@ Packed: rgba64le rgbaf16be rgbaf16le + rgbf32be + rgbf32le uyvy422 uyyvyy411 vuya @@ -965,6 +972,8 @@ PackedRGB: rgba64le rgbaf16be rgbaf16le + rgbf32be + rgbf32le x2bgr10be x2bgr10le x2rgb10be