Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 1/3] avutil/pixfmt: add YAF16 and YAF32 pixel formats
Date: Wed,  5 Mar 2025 17:44:11 -0300
Message-ID: <20250305204413.36950-1-jamrial@gmail.com> (raw)

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavutil/pixdesc.c              | 44 ++++++++++++++++++++++++++++++++
 libavutil/pixfmt.h               |  9 +++++++
 tests/ref/fate/imgutils          |  8 ++++++
 tests/ref/fate/sws-pixdesc-query | 20 +++++++++++++++
 4 files changed, 81 insertions(+)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 7ffc8f3b2e..1917ae74d8 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2543,6 +2543,50 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
         },
         .flags = AV_PIX_FMT_FLAG_FLOAT,
     },
+    [AV_PIX_FMT_YAF32BE] = {
+        .name = "yaf32be",
+        .nb_components = 2,
+        .log2_chroma_w = 0,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 0, 8, 0, 0, 32 },       /* Y */
+            { 0, 8, 4, 0, 32 },       /* A */
+        },
+        .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_FLOAT | AV_PIX_FMT_FLAG_ALPHA,
+    },
+    [AV_PIX_FMT_YAF32LE] = {
+        .name = "yaf32le",
+        .nb_components = 2,
+        .log2_chroma_w = 0,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 0, 8, 0, 0, 32 },       /* Y */
+            { 0, 8, 4, 0, 32 },       /* A */
+        },
+        .flags = AV_PIX_FMT_FLAG_FLOAT | AV_PIX_FMT_FLAG_ALPHA,
+    },
+    [AV_PIX_FMT_YAF16BE] = {
+        .name = "yaf16be",
+        .nb_components = 2,
+        .log2_chroma_w = 0,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 0, 4, 0, 0, 16 },       /* Y */
+            { 0, 4, 2, 0, 16 },       /* A */
+        },
+        .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_FLOAT | AV_PIX_FMT_FLAG_ALPHA,
+    },
+    [AV_PIX_FMT_YAF16LE] = {
+        .name = "yaf16le",
+        .nb_components = 2,
+        .log2_chroma_w = 0,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 0, 4, 0, 0, 16 },       /* Y */
+            { 0, 4, 2, 0, 16 },       /* A */
+        },
+        .flags = AV_PIX_FMT_FLAG_FLOAT | AV_PIX_FMT_FLAG_ALPHA,
+    },
     [AV_PIX_FMT_YUVA422P12BE] = {
         .name = "yuva422p12be",
         .nb_components = 4,
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index ca1b22762b..6f343cb026 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -479,6 +479,12 @@ enum AVPixelFormat {
     AV_PIX_FMT_GRAY32BE,    ///<         Y        , 32bpp, big-endian
     AV_PIX_FMT_GRAY32LE,    ///<         Y        , 32bpp, little-endian
 
+    AV_PIX_FMT_YAF32BE,  ///< IEEE-754 half precision packed YA, 32 bits gray, 32 bits alpha, 64bpp, big-endian
+    AV_PIX_FMT_YAF32LE,  ///< IEEE-754 half precision packed YA, 32 bits gray, 32 bits alpha, 64bpp, little-endian
+
+    AV_PIX_FMT_YAF16BE,  ///< IEEE-754 half precision packed YA, 16 bits gray, 16 bits alpha, 32bpp, big-endian
+    AV_PIX_FMT_YAF16LE,  ///< IEEE-754 half precision packed YA, 16 bits gray, 16 bits alpha, 32bpp, 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
 };
 
@@ -554,6 +560,9 @@ enum AVPixelFormat {
 #define AV_PIX_FMT_GRAYF16    AV_PIX_FMT_NE(GRAYF16BE, GRAYF16LE)
 #define AV_PIX_FMT_GRAYF32    AV_PIX_FMT_NE(GRAYF32BE, GRAYF32LE)
 
+#define AV_PIX_FMT_YAF16      AV_PIX_FMT_NE(YAF16BE, YAF16LE)
+#define AV_PIX_FMT_YAF32      AV_PIX_FMT_NE(YAF32BE, YAF32LE)
+
 #define AV_PIX_FMT_YUVA420P9  AV_PIX_FMT_NE(YUVA420P9BE , YUVA420P9LE)
 #define AV_PIX_FMT_YUVA422P9  AV_PIX_FMT_NE(YUVA422P9BE , YUVA422P9LE)
 #define AV_PIX_FMT_YUVA444P9  AV_PIX_FMT_NE(YUVA444P9BE , YUVA444P9LE)
diff --git a/tests/ref/fate/imgutils b/tests/ref/fate/imgutils
index 0951bab161..79e31e80ac 100644
--- a/tests/ref/fate/imgutils
+++ b/tests/ref/fate/imgutils
@@ -292,6 +292,10 @@ grayf16be       planes: 1, linesizes: 128   0   0   0, plane_sizes:  6144     0
 grayf16le       planes: 1, linesizes: 128   0   0   0, plane_sizes:  6144     0     0     0, plane_offsets:     0     0     0, total_size: 6144
 gray32be        planes: 1, linesizes: 256   0   0   0, plane_sizes: 12288     0     0     0, plane_offsets:     0     0     0, total_size: 12288
 gray32le        planes: 1, linesizes: 256   0   0   0, plane_sizes: 12288     0     0     0, plane_offsets:     0     0     0, total_size: 12288
+yaf32be         planes: 1, linesizes: 512   0   0   0, plane_sizes: 24576     0     0     0, plane_offsets:     0     0     0, total_size: 24576
+yaf32le         planes: 1, linesizes: 512   0   0   0, plane_sizes: 24576     0     0     0, plane_offsets:     0     0     0, total_size: 24576
+yaf16be         planes: 1, linesizes: 256   0   0   0, plane_sizes: 12288     0     0     0, plane_offsets:     0     0     0, total_size: 12288
+yaf16le         planes: 1, linesizes: 256   0   0   0, plane_sizes: 12288     0     0     0, plane_offsets:     0     0     0, total_size: 12288
 
 image_fill_black tests
 yuv420p         total_size:   4608,  black_unknown_crc: 0xd00f6cc6,  black_tv_crc: 0xd00f6cc6,  black_pc_crc: 0x234969af
@@ -531,3 +535,7 @@ grayf16be       total_size:   6144,  black_unknown_crc: 0x72aa7ce2,  black_tv_cr
 grayf16le       total_size:   6144,  black_unknown_crc: 0xad1b67c6,  black_tv_crc: 0xad1b67c6,  black_pc_crc: 0x00000000
 gray32be        total_size:  12288,  black_unknown_crc: 0x52baa2c6,  black_tv_crc: 0x52baa2c6,  black_pc_crc: 0x00000000
 gray32le        total_size:  12288,  black_unknown_crc: 0xc72f7e60,  black_tv_crc: 0xc72f7e60,  black_pc_crc: 0x00000000
+yaf32be         total_size:  24576,  black_unknown_crc: 0xa3dc1529,  black_tv_crc: 0xa3dc1529,  black_pc_crc: 0x0bbcb13e
+yaf32le         total_size:  24576,  black_unknown_crc: 0xfd900236,  black_tv_crc: 0xfd900236,  black_pc_crc: 0xdcaf0cb1
+yaf16be         total_size:  12288,  black_unknown_crc: 0x7afe9aae,  black_tv_crc: 0x7afe9aae,  black_pc_crc: 0x0fc0a5d0
+yaf16le         total_size:  12288,  black_unknown_crc: 0x94c0068b,  black_tv_crc: 0x94c0068b,  black_pc_crc: 0xc05ce449
diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query
index 9a1d0d4b52..426794b7f2 100644
--- a/tests/ref/fate/sws-pixdesc-query
+++ b/tests/ref/fate/sws-pixdesc-query
@@ -37,6 +37,8 @@ is16BPS:
   y216le
   ya16be
   ya16le
+  yaf16be
+  yaf16le
   yuv420p16be
   yuv420p16le
   yuv422p16be
@@ -212,6 +214,8 @@ isBE:
   y212be
   y216be
   ya16be
+  yaf16be
+  yaf32be
   yuv420p10be
   yuv420p12be
   yuv420p14be
@@ -295,6 +299,10 @@ isYUV:
   ya16be
   ya16le
   ya8
+  yaf16be
+  yaf16le
+  yaf32be
+  yaf32le
   yuv410p
   yuv411p
   yuv420p
@@ -607,6 +615,10 @@ Gray:
   ya16be
   ya16le
   ya8
+  yaf16be
+  yaf16le
+  yaf32be
+  yaf32le
 
 RGBinInt:
   monob
@@ -795,6 +807,10 @@ ALPHA:
   ya16be
   ya16le
   ya8
+  yaf16be
+  yaf16le
+  yaf32be
+  yaf32le
   yuva420p
   yuva420p10be
   yuva420p10le
@@ -917,6 +933,10 @@ Packed:
   ya16be
   ya16le
   ya8
+  yaf16be
+  yaf16le
+  yaf32be
+  yaf32le
   yuyv422
   yvyu422
 
-- 
2.48.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

             reply	other threads:[~2025-03-05 20:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-05 20:44 James Almer [this message]
2025-03-05 20:44 ` [FFmpeg-devel] [PATCH 2/3] swscale/input: add support for YAF16 and YAF32 James Almer
2025-03-05 20:44 ` [FFmpeg-devel] [PATCH 3/3] avcodec/exr: use luma+alpha float pixel formats James Almer
2025-03-05 21:33   ` [FFmpeg-devel] [PATCH v2 " James Almer
2025-03-05 21:41     ` Andreas Rheinhardt
2025-03-05 22:03       ` James Almer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250305204413.36950-1-jamrial@gmail.com \
    --to=jamrial@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git