From 29b673bdcfe1cd37de40b1714bfbcc03817cef7e Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Wed, 27 Sep 2023 16:13:16 +0200 Subject: [PATCH] swscale: add GBRAP14 format support --- libavcodec/raw.c | 2 ++ libavformat/nut.c | 2 ++ libswscale/input.c | 7 +++++++ libswscale/output.c | 2 ++ libswscale/swscale_unscaled.c | 3 +++ libswscale/utils.c | 6 ++++++ libswscale/version.h | 2 +- tests/ref/fate/filter-pixdesc-gbrap14be | 1 + tests/ref/fate/filter-pixdesc-gbrap14le | 1 + tests/ref/fate/filter-pixfmts-copy | 2 ++ tests/ref/fate/filter-pixfmts-crop | 2 ++ tests/ref/fate/filter-pixfmts-field | 2 ++ tests/ref/fate/filter-pixfmts-fieldorder | 2 ++ tests/ref/fate/filter-pixfmts-hflip | 2 ++ tests/ref/fate/filter-pixfmts-il | 2 ++ tests/ref/fate/filter-pixfmts-null | 2 ++ tests/ref/fate/filter-pixfmts-pad | 1 + tests/ref/fate/filter-pixfmts-scale | 2 ++ tests/ref/fate/filter-pixfmts-transpose | 2 ++ tests/ref/fate/filter-pixfmts-vflip | 2 ++ 20 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 tests/ref/fate/filter-pixdesc-gbrap14be create mode 100644 tests/ref/fate/filter-pixdesc-gbrap14le diff --git a/libavcodec/raw.c b/libavcodec/raw.c index 1e5b48d1e0..b73b80e5fd 100644 --- a/libavcodec/raw.c +++ b/libavcodec/raw.c @@ -206,6 +206,8 @@ static const PixelFormatTag raw_pix_fmt_tags[] = { { AV_PIX_FMT_GBRAP10BE, MKTAG(10 , 00 , '4', 'G') }, { AV_PIX_FMT_GBRAP12LE, MKTAG('G', '4', 00 , 12 ) }, { AV_PIX_FMT_GBRAP12BE, MKTAG(12 , 00 , '4', 'G') }, + { AV_PIX_FMT_GBRAP14LE, MKTAG('G', '4', 00 , 14 ) }, + { AV_PIX_FMT_GBRAP14BE, MKTAG(14 , 00 , '4', 'G') }, { AV_PIX_FMT_GBRAP16LE, MKTAG('G', '4', 00 , 16 ) }, { AV_PIX_FMT_GBRAP16BE, MKTAG(16 , 00 , '4', 'G') }, diff --git a/libavformat/nut.c b/libavformat/nut.c index 47ed152529..a0bf257c7d 100644 --- a/libavformat/nut.c +++ b/libavformat/nut.c @@ -184,6 +184,8 @@ const AVCodecTag ff_nut_video_tags[] = { { AV_CODEC_ID_RAWVIDEO, MKTAG(10 , 00 , '4', 'G') }, { AV_CODEC_ID_RAWVIDEO, MKTAG('G', '4', 00 , 12 ) }, { AV_CODEC_ID_RAWVIDEO, MKTAG(12 , 00 , '4', 'G') }, + { AV_CODEC_ID_RAWVIDEO, MKTAG('G', '4', 00 , 14 ) }, + { AV_CODEC_ID_RAWVIDEO, MKTAG(14 , 00 , '4', 'G') }, { AV_CODEC_ID_RAWVIDEO, MKTAG('G', '4', 00 , 16 ) }, { AV_CODEC_ID_RAWVIDEO, MKTAG(16 , 00 , '4', 'G') }, diff --git a/libswscale/input.c b/libswscale/input.c index 41795c636e..d171394bb2 100644 --- a/libswscale/input.c +++ b/libswscale/input.c @@ -1149,6 +1149,7 @@ rgb9plus_planar_funcs(16) rgb9plus_planar_transparency_funcs(10) rgb9plus_planar_transparency_funcs(12) +rgb9plus_planar_transparency_funcs(14) rgb9plus_planar_transparency_funcs(16) #define rgbf32_planar_funcs_endian(endian_name, endian) \ @@ -1326,6 +1327,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_GBRP12LE: c->readChrPlanar = planar_rgb12le_to_uv; break; + case AV_PIX_FMT_GBRAP14LE: case AV_PIX_FMT_GBRP14LE: c->readChrPlanar = planar_rgb14le_to_uv; break; @@ -1348,6 +1350,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_GBRP12BE: c->readChrPlanar = planar_rgb12be_to_uv; break; + case AV_PIX_FMT_GBRAP14BE: case AV_PIX_FMT_GBRP14BE: c->readChrPlanar = planar_rgb14be_to_uv; break; @@ -1686,6 +1689,8 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_GBRP12LE: c->readLumPlanar = planar_rgb12le_to_y; break; + case AV_PIX_FMT_GBRAP14LE: + c->readAlpPlanar = planar_rgb14le_to_a; case AV_PIX_FMT_GBRP14LE: c->readLumPlanar = planar_rgb14le_to_y; break; @@ -1712,6 +1717,8 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_GBRP12BE: c->readLumPlanar = planar_rgb12be_to_y; break; + case AV_PIX_FMT_GBRAP14BE: + c->readAlpPlanar = planar_rgb14be_to_a; case AV_PIX_FMT_GBRP14BE: c->readLumPlanar = planar_rgb14be_to_y; break; diff --git a/libswscale/output.c b/libswscale/output.c index 5c85bff971..8849a3201a 100644 --- a/libswscale/output.c +++ b/libswscale/output.c @@ -3047,6 +3047,8 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c, case AV_PIX_FMT_GBRAP10LE: case AV_PIX_FMT_GBRAP12BE: case AV_PIX_FMT_GBRAP12LE: + case AV_PIX_FMT_GBRAP14BE: + case AV_PIX_FMT_GBRAP14LE: *yuv2anyX = yuv2gbrp_full_X_c; break; case AV_PIX_FMT_GBRP16BE: diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index 9af2e7ecc3..a5c9917799 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -2073,6 +2073,7 @@ void ff_get_unscaled_swscale(SwsContext *c) dstFormat == AV_PIX_FMT_GBRP16LE || dstFormat == AV_PIX_FMT_GBRP16BE || dstFormat == AV_PIX_FMT_GBRAP10LE || dstFormat == AV_PIX_FMT_GBRAP10BE || dstFormat == AV_PIX_FMT_GBRAP12LE || dstFormat == AV_PIX_FMT_GBRAP12BE || + dstFormat == AV_PIX_FMT_GBRAP14LE || dstFormat == AV_PIX_FMT_GBRAP14BE || dstFormat == AV_PIX_FMT_GBRAP16LE || dstFormat == AV_PIX_FMT_GBRAP16BE )) c->convert_unscaled = Rgb16ToPlanarRgb16Wrapper; @@ -2083,6 +2084,7 @@ void ff_get_unscaled_swscale(SwsContext *c) srcFormat == AV_PIX_FMT_GBRP14LE || srcFormat == AV_PIX_FMT_GBRP14BE || srcFormat == AV_PIX_FMT_GBRAP10LE || srcFormat == AV_PIX_FMT_GBRAP10BE || srcFormat == AV_PIX_FMT_GBRAP12LE || srcFormat == AV_PIX_FMT_GBRAP12BE || + srcFormat == AV_PIX_FMT_GBRAP14LE || srcFormat == AV_PIX_FMT_GBRAP14BE || srcFormat == AV_PIX_FMT_GBRAP16LE || srcFormat == AV_PIX_FMT_GBRAP16BE) && (dstFormat == AV_PIX_FMT_RGB48LE || dstFormat == AV_PIX_FMT_RGB48BE || dstFormat == AV_PIX_FMT_BGR48LE || dstFormat == AV_PIX_FMT_BGR48BE || @@ -2132,6 +2134,7 @@ void ff_get_unscaled_swscale(SwsContext *c) IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP16) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRAP10) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRAP12) || + IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRAP14) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRAP16) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_RGB444) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_RGB48) || diff --git a/libswscale/utils.c b/libswscale/utils.c index b3cc74331f..e1ad685972 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -204,6 +204,8 @@ static const FormatEntry format_entries[] = { [AV_PIX_FMT_GBRAP12BE] = { 1, 1 }, [AV_PIX_FMT_GBRP14LE] = { 1, 1 }, [AV_PIX_FMT_GBRP14BE] = { 1, 1 }, + [AV_PIX_FMT_GBRAP14LE] = { 1, 1 }, + [AV_PIX_FMT_GBRAP14BE] = { 1, 1 }, [AV_PIX_FMT_GBRP16LE] = { 1, 1 }, [AV_PIX_FMT_GBRP16BE] = { 1, 1 }, [AV_PIX_FMT_GBRPF32LE] = { 1, 1 }, @@ -1228,6 +1230,9 @@ static enum AVPixelFormat alphaless_fmt(enum AVPixelFormat fmt) case AV_PIX_FMT_GBRAP12LE: return AV_PIX_FMT_GBRP12; case AV_PIX_FMT_GBRAP12BE: return AV_PIX_FMT_GBRP12; + case AV_PIX_FMT_GBRAP14LE: return AV_PIX_FMT_GBRP14; + case AV_PIX_FMT_GBRAP14BE: return AV_PIX_FMT_GBRP14; + case AV_PIX_FMT_GBRAP16LE: return AV_PIX_FMT_GBRP16; case AV_PIX_FMT_GBRAP16BE: return AV_PIX_FMT_GBRP16; @@ -1496,6 +1501,7 @@ static av_cold int sws_init_single_context(SwsContext *c, SwsFilter *srcFilter, srcFormat != AV_PIX_FMT_GBRAP10BE && srcFormat != AV_PIX_FMT_GBRAP10LE && srcFormat != AV_PIX_FMT_GBRP12BE && srcFormat != AV_PIX_FMT_GBRP12LE && srcFormat != AV_PIX_FMT_GBRAP12BE && srcFormat != AV_PIX_FMT_GBRAP12LE && + srcFormat != AV_PIX_FMT_GBRAP14BE && srcFormat != AV_PIX_FMT_GBRAP14LE && srcFormat != AV_PIX_FMT_GBRP14BE && srcFormat != AV_PIX_FMT_GBRP14LE && srcFormat != AV_PIX_FMT_GBRP16BE && srcFormat != AV_PIX_FMT_GBRP16LE && srcFormat != AV_PIX_FMT_GBRAP16BE && srcFormat != AV_PIX_FMT_GBRAP16LE && diff --git a/libswscale/version.h b/libswscale/version.h index 51eb013a29..12412bd538 100644 --- a/libswscale/version.h +++ b/libswscale/version.h @@ -28,7 +28,7 @@ #include "version_major.h" -#define LIBSWSCALE_VERSION_MINOR 3 +#define LIBSWSCALE_VERSION_MINOR 4 #define LIBSWSCALE_VERSION_MICRO 100 #define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \ diff --git a/tests/ref/fate/filter-pixdesc-gbrap14be b/tests/ref/fate/filter-pixdesc-gbrap14be new file mode 100644 index 0000000000..72ccf37005 --- /dev/null +++ b/tests/ref/fate/filter-pixdesc-gbrap14be @@ -0,0 +1 @@ +pixdesc-gbrap14be 31cab6d8ee655ff61cf44ea458268e4c diff --git a/tests/ref/fate/filter-pixdesc-gbrap14le b/tests/ref/fate/filter-pixdesc-gbrap14le new file mode 100644 index 0000000000..196c451dfa --- /dev/null +++ b/tests/ref/fate/filter-pixdesc-gbrap14le @@ -0,0 +1 @@ +pixdesc-gbrap14le db6b141efe8f0d9cfa8f77937e577b50 diff --git a/tests/ref/fate/filter-pixfmts-copy b/tests/ref/fate/filter-pixfmts-copy index 27f12e8f97..eb3e61b4f2 100644 --- a/tests/ref/fate/filter-pixfmts-copy +++ b/tests/ref/fate/filter-pixfmts-copy @@ -23,6 +23,8 @@ gbrap10be edcffb185e44b6dae5c2ead5505b7125 gbrap10le 2a7392e14b21b1f9457526a071236a6d gbrap12be 0c4c1f8af361571265ca259d5f70f026 gbrap12le 5f1d8c663d4c28863e687192433b34a4 +gbrap14be 25694ddb34dceabec5143a7677c8072d +gbrap14le 0eba343fc6f713d310db3d67f7d5a06b gbrap16be e4edca4361d643794034e5aa9ef290b1 gbrap16le 9a95b389d2bf556179e8f4b27fb550ab gbrapf32be d908f0950d3735863fe6f0793fa24f76 diff --git a/tests/ref/fate/filter-pixfmts-crop b/tests/ref/fate/filter-pixfmts-crop index 7bd0cfcb89..01cb88bc54 100644 --- a/tests/ref/fate/filter-pixfmts-crop +++ b/tests/ref/fate/filter-pixfmts-crop @@ -23,6 +23,8 @@ gbrap10be 1880c4856d9cc6492b8b859f2711aaf1 gbrap10le c2b6e35f8b7ca363a7ec021ccdf31d1f gbrap12be c9769d18733cdc2664d8b9af09a03f6d gbrap12le 3f80453c1ac6c5d1b2febf3ef141b476 +gbrap14be 11238485c208bd064730fd4469869e98 +gbrap14le 59f0ae68812ac2c0b0ac04def7161ab7 gbrap16be 21c98d0d7e7de2a93f9f095e5bb5c227 gbrap16le ea9a96870c1b742dd9f065c5db568184 gbrapf32be ec06b3b168dc74048100f29a4412da90 diff --git a/tests/ref/fate/filter-pixfmts-field b/tests/ref/fate/filter-pixfmts-field index 0c40a4d90f..c7d9b8f133 100644 --- a/tests/ref/fate/filter-pixfmts-field +++ b/tests/ref/fate/filter-pixfmts-field @@ -23,6 +23,8 @@ gbrap10be 29d46cbf021b233f5f1886e5d5fe21b4 gbrap10le 4017c5d8c124438eb9aefa107db58d3b gbrap12be e7f471132628b1c034199cc109b84bc2 gbrap12le 886207e5aa379a0312485b94e5fd5edd +gbrap14be 6c56b7c47dbc7707e09d93f06eb34624 +gbrap14le e6077974ee36f906987319364b2a72a8 gbrap16be eaa0158f27ebc40cde9e3d6eef1e2ba1 gbrap16le 6cf68992d4fcac2aa025d1014b669d24 gbrapf32be 37c627796dee55ca6f4e7ca965460680 diff --git a/tests/ref/fate/filter-pixfmts-fieldorder b/tests/ref/fate/filter-pixfmts-fieldorder index 8c024784e3..2f64bd3b14 100644 --- a/tests/ref/fate/filter-pixfmts-fieldorder +++ b/tests/ref/fate/filter-pixfmts-fieldorder @@ -23,6 +23,8 @@ gbrap10be 8b27254a69cd0e25fa55262a743f95e6 gbrap10le 52278021718ec370903dccc923dc8bf6 gbrap12be 302b353dff696ec9fd0d85a0cc14802b gbrap12le ae2d6db2c9c825f06d92389de21263d2 +gbrap14be 1d28d4af2b00d08a17278ca0a316f24a +gbrap14le 07bc3e6abb0ee23876c9605fd81e8a83 gbrap16be 52c10d8046d123dfc4a478276906467c gbrap16le 2317737b8f5140add27d121de8f5ba95 gbrapf32be 6781751ef9d444d150cb0a1e1cefe141 diff --git a/tests/ref/fate/filter-pixfmts-hflip b/tests/ref/fate/filter-pixfmts-hflip index a80b1abd5b..66274890a7 100644 --- a/tests/ref/fate/filter-pixfmts-hflip +++ b/tests/ref/fate/filter-pixfmts-hflip @@ -23,6 +23,8 @@ gbrap10be f188dc23756469cbdd172fe97ad58121 gbrap10le 262f0501633ea4670020fae8ac6835e2 gbrap12be ffe9aa4cbcc42f71757efe18826764ac gbrap12le 88a85c1b3c5e19e299fdd209b73ac1ba +gbrap14be e4aedeb3aadedbe93cc415db0a65c1a2 +gbrap14le d6183b778f950a1255e27efe658127e4 gbrap16be 3117e84b258433a7efb9288bbb8815d4 gbrap16le 3ad08cf8b49d8eb31a1b356ec4b7b88b gbrapf32be d82e48eb62c1e2d2ce5d614aeda38a99 diff --git a/tests/ref/fate/filter-pixfmts-il b/tests/ref/fate/filter-pixfmts-il index 461b2b1720..03519f2a9d 100644 --- a/tests/ref/fate/filter-pixfmts-il +++ b/tests/ref/fate/filter-pixfmts-il @@ -23,6 +23,8 @@ gbrap10be bafa57a2e4331d8a39f6f0087c85d4b1 gbrap10le 553a1f439d8184dc400432d3f786fbce gbrap12be 48609d6b61ff6313939fa2d9c3ebb6d9 gbrap12le e3b5342c8e47820f2de7e2dd61872312 +gbrap14be 213d656dd43193eac7711cdcc91ed2d1 +gbrap14le 350ae0639e73f20efa867cfba5dd7afd gbrap16be 696c84c8b009c7320cad7f3847bb35da gbrap16le 9bacb81fbbe9cdfd04d71eb55a9719d2 gbrapf32be 5995aba2bf66254f63d5413cd9860353 diff --git a/tests/ref/fate/filter-pixfmts-null b/tests/ref/fate/filter-pixfmts-null index 27f12e8f97..eb3e61b4f2 100644 --- a/tests/ref/fate/filter-pixfmts-null +++ b/tests/ref/fate/filter-pixfmts-null @@ -23,6 +23,8 @@ gbrap10be edcffb185e44b6dae5c2ead5505b7125 gbrap10le 2a7392e14b21b1f9457526a071236a6d gbrap12be 0c4c1f8af361571265ca259d5f70f026 gbrap12le 5f1d8c663d4c28863e687192433b34a4 +gbrap14be 25694ddb34dceabec5143a7677c8072d +gbrap14le 0eba343fc6f713d310db3d67f7d5a06b gbrap16be e4edca4361d643794034e5aa9ef290b1 gbrap16le 9a95b389d2bf556179e8f4b27fb550ab gbrapf32be d908f0950d3735863fe6f0793fa24f76 diff --git a/tests/ref/fate/filter-pixfmts-pad b/tests/ref/fate/filter-pixfmts-pad index 8394622257..dd01059c59 100644 --- a/tests/ref/fate/filter-pixfmts-pad +++ b/tests/ref/fate/filter-pixfmts-pad @@ -9,6 +9,7 @@ bgra 929aac15e848038e367c250037575f9f gbrap 5f16cccab5a17cb766c882e865995167 gbrap10le e63e0a1ae9afd7e6a732f18be194e761 gbrap12le eb7a5ff44a9b5b46bb9829838224ed8e +gbrap14le 4c8b549942e66f442de0f5c1d21e9b8e gbrap16le d0f6fc33cb75588327aec1b5ad6ab4f0 gbrp 3c94d39256db2409015df913fd330a90 gbrp10le 5b356737cd8a396f39bbdadb7cb35e06 diff --git a/tests/ref/fate/filter-pixfmts-scale b/tests/ref/fate/filter-pixfmts-scale index 6435cc6ef2..b11384068b 100644 --- a/tests/ref/fate/filter-pixfmts-scale +++ b/tests/ref/fate/filter-pixfmts-scale @@ -23,6 +23,8 @@ gbrap10be 50735fbc471a5ac5a6645c85881f3670 gbrap10le 6e1cba57029fdf0f9d46b5e5cd55112b gbrap12be 58170165829484b3db4a3b9165198987 gbrap12le 24f5ecb32435b73353517e017c165e31 +gbrap14be 6addff84e986e7ea28aa3cdb80f44137 +gbrap14le a753ce2fc6d36920d678411434bed9b1 gbrap16be 31968e6872a46e8174fb57f8920ed10d gbrap16le 8c6758f33671b673b6d30969fc05a23d gbrapf32be 366b804d5697276e8c481c4bdf05a00b diff --git a/tests/ref/fate/filter-pixfmts-transpose b/tests/ref/fate/filter-pixfmts-transpose index 169f2708ec..ec157dee0c 100644 --- a/tests/ref/fate/filter-pixfmts-transpose +++ b/tests/ref/fate/filter-pixfmts-transpose @@ -23,6 +23,8 @@ gbrap10be 3e3be2d8f9aa5f449a1df404e27d0054 gbrap10le db4e4861010cbbf726492fad282d5813 gbrap12be 1518c9a565d1ba1a45dd369acc1aa75e gbrap12le 714fe318af81a46f83655c6e7e13351e +gbrap14be 929c440a44fbeab41111ebbf1d724464 +gbrap14le 577112fe137e056b4fb145403d5846e6 gbrap16be 39d488528aacff466aac7539c9b948a8 gbrap16le 5426ac9457289927bfe2ec03038a8780 gbrapf32be ea02b3912372c8671ff4eacbcbda740a diff --git a/tests/ref/fate/filter-pixfmts-vflip b/tests/ref/fate/filter-pixfmts-vflip index 705ab1a050..9a7972d6cf 100644 --- a/tests/ref/fate/filter-pixfmts-vflip +++ b/tests/ref/fate/filter-pixfmts-vflip @@ -23,6 +23,8 @@ gbrap10be e8134b72acc090b093b4d9b4d4703c7e gbrap10le 43bde7bd6a676c6ac33dbcc4c72762f3 gbrap12be 16a3d105ba852a9fa23ea5232db51b48 gbrap12le 6ef8a3ac4129ec23c34aec14ac41f249 +gbrap14be b5a84309c1ca113d950ca7aa4e64bad4 +gbrap14le 561babad7e222cc004250cabfd17a605 gbrap16be 70b020b6b9e1896b72f890de3570ffda gbrap16le e0cf341cdbaf1f5c40016f181bc9d7d4 gbrapf32be e82323abcb665014346a3a34a4b084c3