[FFmpeg-cvslog] avutil/pixdesc: add AV_PIX_FMT_FLAG_XYZ

Niklas Haas git at videolan.org
Tue Oct 31 16:50:20 EET 2023


ffmpeg | branch: master | Niklas Haas <git at haasn.dev> | Tue Oct 31 15:46:07 2023 +0100| [57c16323f26f6d726edb2fd7f83836187f058ed7] | committer: Niklas Haas

avutil/pixdesc: add AV_PIX_FMT_FLAG_XYZ

There are already several places in the codebase that match desc->name
against "xyz", and many downstream clients replicate this behavior.
I have no idea why this is not just a flag.

Motivated by my desire to add yet another check for XYZ to the codebase,
and I'd rather not keep copy/pasting a string comparison hack.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=57c16323f26f6d726edb2fd7f83836187f058ed7
---

 doc/APIchanges      | 3 +++
 libavutil/pixdesc.c | 6 +++---
 libavutil/pixdesc.h | 5 +++++
 libavutil/version.h | 2 +-
 4 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 438a43e057..d4511ce2dd 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09
 
 API changes, most recent first:
 
+2023-10-31 - xxxxxxxxxx - lavu 58.31.100 - pixdesc.h
+  Add AV_PIX_FMT_FLAG_XYZ.
+
 -------- 8< --------- FFmpeg 6.1 was cut here -------- 8< ---------
 
 2023-10-27 - xxxxxxxxxx - lavu 58.28.100 - channel_layout.h
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 6ded9467b0..f2647d3d55 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -1977,8 +1977,8 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
             { 0, 6, 0, 4, 12 },       /* X */
             { 0, 6, 2, 4, 12 },       /* Y */
             { 0, 6, 4, 4, 12 },       /* Z */
-      },
-      /*.flags = -- not used*/
+        },
+        .flags = AV_PIX_FMT_FLAG_XYZ,
     },
     [AV_PIX_FMT_XYZ12BE] = {
         .name = "xyz12be",
@@ -1990,7 +1990,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
             { 0, 6, 2, 4, 12 },       /* Y */
             { 0, 6, 4, 4, 12 },       /* Z */
        },
-        .flags = AV_PIX_FMT_FLAG_BE,
+        .flags = AV_PIX_FMT_FLAG_XYZ | AV_PIX_FMT_FLAG_BE,
     },
 
 #define BAYER8_DESC_COMMON \
diff --git a/libavutil/pixdesc.h b/libavutil/pixdesc.h
index 0df73e6efe..ba2f632814 100644
--- a/libavutil/pixdesc.h
+++ b/libavutil/pixdesc.h
@@ -157,6 +157,11 @@ typedef struct AVPixFmtDescriptor {
  */
 #define AV_PIX_FMT_FLAG_FLOAT        (1 << 9)
 
+/**
+ * The pixel format contains XYZ-like data (as opposed to YUV/RGB/grayscale).
+ */
+#define AV_PIX_FMT_FLAG_XYZ          (1 << 10)
+
 /**
  * Return the number of bits per pixel used by the pixel format
  * described by pixdesc. Note that this is not the same as the number
diff --git a/libavutil/version.h b/libavutil/version.h
index 4549a4cd51..589a42b0fa 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  58
-#define LIBAVUTIL_VERSION_MINOR  30
+#define LIBAVUTIL_VERSION_MINOR  31
 #define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \



More information about the ffmpeg-cvslog mailing list