Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Niklas Haas <ffmpeg@haasn.xyz>
To: ffmpeg-devel@ffmpeg.org
Cc: Niklas Haas <git@haasn.dev>
Subject: [FFmpeg-devel] [PATCH v2 2/5] avutil/pixdesc: add AV_PIX_FMT_FLAG_XYZ
Date: Thu, 26 Oct 2023 16:23:24 +0200
Message-ID: <20231026142327.52694-2-ffmpeg@haasn.xyz> (raw)
In-Reply-To: <20231026142327.52694-1-ffmpeg@haasn.xyz>

From: Niklas Haas <git@haasn.dev>

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.
---
 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 9b109e6fa7..c0d6ee0b29 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-26 - xxxxxxxxxx - lavu 58.28.100 - pixdesc.h
+  Add AV_PIX_FMT_FLAG_XYZ.
+
 2023-10-06 - xxxxxxxxxx - lavc 60.30.101 - avcodec.h
   AVCodecContext.coded_side_data may now be used during decoding, to be set
   by user before calling avcodec_open2() for initialization.
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 4c0c545d40..279e54c394 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  58
-#define LIBAVUTIL_VERSION_MINOR  27
+#define LIBAVUTIL_VERSION_MINOR  28
 #define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
-- 
2.42.0

_______________________________________________
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:[~2023-10-26 14:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-26 14:23 [FFmpeg-devel] [PATCH v2 1/5] avfilter/drawutils: ban XYZ formats Niklas Haas
2023-10-26 14:23 ` Niklas Haas [this message]
2023-10-26 14:23 ` [FFmpeg-devel] [PATCH v2 3/5] avfilter/drawutils: remove redundant xyz format check Niklas Haas
2023-10-26 14:23 ` [FFmpeg-devel] [PATCH v2 4/5] avutil/pixdesc: simplify xyz pixfmt check Niklas Haas
2023-10-26 14:23 ` [FFmpeg-devel] [PATCH v2 5/5] avformat/vf_vapoursynth: simplify xyz format check Niklas Haas
2023-10-30 14:23 ` [FFmpeg-devel] [PATCH v2 1/5] avfilter/drawutils: ban XYZ formats Niklas Haas

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=20231026142327.52694-2-ffmpeg@haasn.xyz \
    --to=ffmpeg@haasn.xyz \
    --cc=ffmpeg-devel@ffmpeg.org \
    --cc=git@haasn.dev \
    /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