Message ID | 20241013180356.1276753-4-ms+git@mur.at |
---|---|
State | New |
Headers | show |
Series | RGB Float16/32 improvements | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
On Sun, Oct 13, 2024 at 08:03:56PM +0200, Martin Schitter wrote: > --- > libavutil/pixdesc.c | 25 +++++++++++++++++++++++++ > libavutil/pixfmt.h | 4 ++++ > libavutil/version.h | 2 +- > tests/ref/fate/imgutils | 4 ++++ > tests/ref/fate/sws-pixdesc-query | 11 +++++++++++ > 5 files changed, 45 insertions(+), 1 deletion(-) > [...] > diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h > index 3caa183..4efc4cb 100644 > --- a/libavutil/pixfmt.h > +++ b/libavutil/pixfmt.h > @@ -400,6 +400,9 @@ enum AVPixelFormat { > > AV_PIX_FMT_VUYA, ///< packed VUYA 4:4:4:4, 32bpp (1 Cr & Cb sample per 1x1 Y & A samples), VUYAVUYA... > > + AV_PIX_FMT_RGBF16BE, ///< IEEE-754 half precision packed RGB 16:16:16, 48bpp, RGBRGB..., big-endian > + AV_PIX_FMT_RGBF16LE, ///< IEEE-754 half precision packed RGB 16:16:16, 48bpp, RGBRGB..., little-endian > + > 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 this would change the values of AV_PIX_FMT_RGBAF16BE and later which would break ABI new values have to be added so nothing changes (that generally means adding them before AV_PIX_FMT_NB, but sometimes soms enums have fixed entries before which additions are possible) thx [...]
On 14.10.24 00:45, Michael Niedermayer wrote: > On Sun, Oct 13, 2024 at 08:03:56PM +0200, Martin Schitter wrote: >> --- >> libavutil/pixdesc.c | 25 +++++++++++++++++++++++++ >> libavutil/pixfmt.h | 4 ++++ >> libavutil/version.h | 2 +- >> tests/ref/fate/imgutils | 4 ++++ >> tests/ref/fate/sws-pixdesc-query | 11 +++++++++++ >> 5 files changed, 45 insertions(+), 1 deletion(-) >>AV_PIX_FMT_VULKAN > [...] >> diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h >> index 3caa183..4efc4cb 100644 >> --- a/libavutil/pixfmt.h >> +++ b/libavutil/pixfmt.h >> @@ -400,6 +400,9 @@ enum AVPixelFormat { >> >> AV_PIX_FMT_VUYA, ///< packed VUYA 4:4:4:4, 32bpp (1 Cr & Cb sample per 1x1 Y & A samples), VUYAVUYA... >> >> + AV_PIX_FMT_RGBF16BE, ///< IEEE-754 half precision packed RGB 16:16:16, 48bpp, RGBRGB..., big-endian >> + AV_PIX_FMT_RGBF16LE, ///< IEEE-754 half precision packed RGB 16:16:16, 48bpp, RGBRGB..., little-endian >> + >> 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 > > this would change the values of AV_PIX_FMT_RGBAF16BE and later > which would break ABI O.k. -- I'll simply move it down to the end of the list without much grumbling. > new values have to be added so nothing changes (that generally means adding them > before AV_PIX_FMT_NB, but sometimes soms enums have fixed entries before > which additions are possible) In fact I can't find any entry with such a fixed enum value resp. useful group separator in this list! This makes it very hard to place new entries into the semantic context of one of these hinted hw accel related sections resp. at the end of such a group. And I also don't get, why the section of hw accel independent formats isn't placed at the end of the list or another section gets reserved for arbitrary new entries to prevent that all additions look like members of the last defined hw specific accel group? But simply accepting the compatibility requirements of this list and their unmediated use in multiple libraries is indeed more important. Martin
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index 43b9c08..e73600f 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -2630,6 +2630,31 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { { 0, 4, 0, 0, 8 }, /* V */ }, }, + [AV_PIX_FMT_RGBF16BE] = { + .name = "rgbf16be", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 6, 0, 0, 16 }, /* R */ + { 0, 6, 2, 0, 16 }, /* G */ + { 0, 6, 4, 0, 16 }, /* B */ + }, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | + AV_PIX_FMT_FLAG_FLOAT, + }, + [AV_PIX_FMT_RGBF16LE] = { + .name = "rgbf16le", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 6, 0, 0, 16 }, /* R */ + { 0, 6, 2, 0, 16 }, /* G */ + { 0, 6, 4, 0, 16 }, /* B */ + }, + .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT + }, [AV_PIX_FMT_RGBAF16BE] = { .name = "rgbaf16be", .nb_components = 4, diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index 3caa183..4efc4cb 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -400,6 +400,9 @@ enum AVPixelFormat { AV_PIX_FMT_VUYA, ///< packed VUYA 4:4:4:4, 32bpp (1 Cr & Cb sample per 1x1 Y & A samples), VUYAVUYA... + AV_PIX_FMT_RGBF16BE, ///< IEEE-754 half precision packed RGB 16:16:16, 48bpp, RGBRGB..., big-endian + AV_PIX_FMT_RGBF16LE, ///< IEEE-754 half precision packed RGB 16:16:16, 48bpp, RGBRGB..., little-endian + 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 @@ -553,6 +556,7 @@ enum AVPixelFormat { #define AV_PIX_FMT_P216 AV_PIX_FMT_NE(P216BE, P216LE) #define AV_PIX_FMT_P416 AV_PIX_FMT_NE(P416BE, P416LE) +#define AV_PIX_FMT_RGBF16 AV_PIX_FMT_NE(RGBF16BE, RGBF16LE) #define AV_PIX_FMT_RGBAF16 AV_PIX_FMT_NE(RGBAF16BE, RGBAF16LE) #define AV_PIX_FMT_RGBF32 AV_PIX_FMT_NE(RGBF32BE, RGBF32LE) diff --git a/libavutil/version.h b/libavutil/version.h index 7eca46c..772addf 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 59 -#define LIBAVUTIL_VERSION_MINOR 42 +#define LIBAVUTIL_VERSION_MINOR 43 #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 fd5a510..eae6ee9 100644 --- a/tests/ref/fate/imgutils +++ b/tests/ref/fate/imgutils @@ -248,6 +248,8 @@ p216le planes: 2, linesizes: 128 128 0 0, plane_sizes: 6144 6144 p416be planes: 2, linesizes: 128 256 0 0, plane_sizes: 6144 12288 0 0, plane_offsets: 6144 0 0, total_size: 18432 p416le planes: 2, linesizes: 128 256 0 0, plane_sizes: 6144 12288 0 0, plane_offsets: 6144 0 0, total_size: 18432 vuya planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 +rgbf16be planes: 1, linesizes: 384 0 0 0, plane_sizes: 18432 0 0 0, plane_offsets: 0 0 0, total_size: 18432 +rgbf16le planes: 1, linesizes: 384 0 0 0, plane_sizes: 18432 0 0 0, plane_offsets: 0 0 0, total_size: 18432 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 vuyx planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 @@ -469,6 +471,8 @@ p216le total_size: 12288, black_unknown_crc: 0x6582d6cf, black_tv_cr p416be total_size: 18432, black_unknown_crc: 0x26991800, black_tv_crc: 0x26991800, black_pc_crc: 0xfe7f6700 p416le total_size: 18432, black_unknown_crc: 0x4028ac30, black_tv_crc: 0x4028ac30, black_pc_crc: 0xab7c7698 vuya total_size: 12288, black_unknown_crc: 0x60db2d2c, black_tv_crc: 0x60db2d2c, black_pc_crc: 0x2dae630a +rgbf16be total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +rgbf16le total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 rgbaf16be total_size: 24576, black_unknown_crc: 0x76fd69af, black_tv_crc: 0x76fd69af, black_pc_crc: 0x76fd69af rgbaf16le total_size: 24576, black_unknown_crc: 0x21283f40, black_tv_crc: 0x21283f40, black_pc_crc: 0x21283f40 vuyx total_size: 12288, black_unknown_crc: 0x9181c808, black_tv_crc: 0x9181c808, black_pc_crc: 0xdcf4862e diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query index f153ed3..ae206ce 100644 --- a/tests/ref/fate/sws-pixdesc-query +++ b/tests/ref/fate/sws-pixdesc-query @@ -23,6 +23,8 @@ is16BPS: rgba64le rgbaf16be rgbaf16le + rgbf16be + rgbf16le ya16be ya16le yuv420p16be @@ -181,6 +183,7 @@ isBE: rgba64be rgbaf16be rgbaf32be + rgbf16be rgbf32be v30xbe x2bgr10be @@ -544,6 +547,8 @@ isRGB: rgbaf16le rgbaf32be rgbaf32le + rgbf16be + rgbf16le rgbf32be rgbf32le x2bgr10be @@ -702,6 +707,8 @@ AnyRGB: rgbaf16le rgbaf32be rgbaf32le + rgbf16be + rgbf16le rgbf32be rgbf32le x2bgr10be @@ -827,6 +834,8 @@ Packed: rgbaf16le rgbaf32be rgbaf32le + rgbf16be + rgbf16le rgbf32be rgbf32le uyva @@ -1031,6 +1040,8 @@ PackedRGB: rgbaf16le rgbaf32be rgbaf32le + rgbf16be + rgbf16le rgbf32be rgbf32le x2bgr10be