---
This could be interesting to mark gray pixel formats category. so that
applications should be able to detect rgb/yuv/gray/mono color types only
by looking at pixdesc.flags.

I'll add version bump and doc at commit time, if this patch is deemed useful
Vittorio

 libavutil/pixdesc.c | 11 ++++++-----
 libavutil/pixdesc.h |  4 ++++
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 14f84d7..082a041 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -244,7 +244,7 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
         .comp = {
             { 0, 1, 0, 0, 8, 0, 7, 1 },        /* Y */
         },
-        .flags = AV_PIX_FMT_FLAG_PSEUDOPAL,
+        .flags = AV_PIX_FMT_FLAG_PSEUDOPAL | AV_PIX_FMT_FLAG_GRAY,
         .alias = "gray8,y8",
     },
     [AV_PIX_FMT_MONOWHITE] = {
@@ -501,7 +501,7 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
         .comp = {
             { 0, 2, 0, 0, 16, 1, 15, 1 },       /* Y */
         },
-        .flags = AV_PIX_FMT_FLAG_BE,
+        .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_GRAY,
         .alias = "y16be",
     },
     [AV_PIX_FMT_GRAY16LE] = {
@@ -512,6 +512,7 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
         .comp = {
             { 0, 2, 0, 0, 16, 1, 15, 1 },       /* Y */
         },
+        .flags = AV_PIX_FMT_FLAG_GRAY,
         .alias = "y16le",
     },
     [AV_PIX_FMT_YUV440P] = {
@@ -1352,7 +1353,7 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
             { 0, 2, 0, 0, 8, 1, 7, 1 },        /* Y */
             { 0, 2, 1, 0, 8, 1, 7, 2 },        /* A */
         },
-        .flags = AV_PIX_FMT_FLAG_ALPHA,
+        .flags = AV_PIX_FMT_FLAG_ALPHA | AV_PIX_FMT_FLAG_GRAY,
         .alias = "gray8a",
     },
     [AV_PIX_FMT_YA16LE] = {
@@ -1362,7 +1363,7 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
             { 0, 4, 0, 0, 16, 3, 15, 1 },        /* Y */
             { 0, 4, 2, 0, 16, 3, 15, 3 },        /* A */
         },
-        .flags = AV_PIX_FMT_FLAG_ALPHA,
+        .flags = AV_PIX_FMT_FLAG_ALPHA | AV_PIX_FMT_FLAG_GRAY,
     },
     [AV_PIX_FMT_YA16BE] = {
         .name = "ya16be",
@@ -1371,7 +1372,7 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
             { 0, 4, 0, 0, 16, 3, 15, 1 },        /* Y */
             { 0, 4, 2, 0, 16, 3, 15, 3 },        /* A */
         },
-        .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA,
+        .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA | 
AV_PIX_FMT_FLAG_GRAY,
     },
     [AV_PIX_FMT_GBRP] = {
         .name = "gbrp",
diff --git a/libavutil/pixdesc.h b/libavutil/pixdesc.h
index ea84fd3..7ebec09 100644
--- a/libavutil/pixdesc.h
+++ b/libavutil/pixdesc.h
@@ -151,6 +151,10 @@ typedef struct AVPixFmtDescriptor {
  * The pixel format has an alpha channel.
  */
 #define AV_PIX_FMT_FLAG_ALPHA        (1 << 7)
+/**
+ * The pixel format is grayscale.
+ */
+#define AV_PIX_FMT_FLAG_GRAY         (1 << 8)
 
 /**
  * Read a line from an image, and write the values of the
-- 
1.9.5 (Apple Git-50.3)

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to