[FFmpeg-devel] [PATCH v2 1/2] avutil/pixdesc: add alpha component information to pixfmts with reserved but undefined alpha bits

James Almer jamrial at gmail.com
Thu Oct 17 22:36:11 EEST 2024


This can be useful to simplify certain processes that need to know how many
reserved bits there are and where they are placed, even if they are ultimately
unused, as will be shown in the next commit.
For any other case where the user simply looks at nb_components components, it
will make no difference.

Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavutil/pixdesc.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index d73c3f0d58..164b20ff79 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -285,6 +285,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
             { 0, 4, 2, 4, 10 },       /* R */
             { 0, 4, 1, 2, 10 },       /* G */
             { 0, 4, 0, 0, 10 },       /* B */
+            { 0, 4, 3, 6,  2 },       /* X */
         },
         .flags = AV_PIX_FMT_FLAG_RGB,
     },
@@ -297,6 +298,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
             { 0, 4, 0, 4, 10 },       /* R */
             { 0, 4, 1, 2, 10 },       /* G */
             { 0, 4, 2, 0, 10 },       /* B */
+            { 0, 4, 3, 6,  2 },       /* X */
         },
         .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BE,
     },
@@ -309,6 +311,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
             { 0, 4, 0, 0, 10 },       /* R */
             { 0, 4, 1, 2, 10 },       /* G */
             { 0, 4, 2, 4, 10 },       /* B */
+            { 0, 4, 3, 6,  2 },       /* X */
         },
         .flags = AV_PIX_FMT_FLAG_RGB,
     },
@@ -321,6 +324,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
             { 0, 4, 2, 0, 10 },       /* R */
             { 0, 4, 1, 2, 10 },       /* G */
             { 0, 4, 0, 4, 10 },       /* B */
+            { 0, 4, 3, 6,  2 },       /* X */
         },
         .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BE,
     },
@@ -639,6 +643,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
             { 0, 4, 1, 0, 8 },        /* R */
             { 0, 4, 2, 0, 8 },        /* G */
             { 0, 4, 3, 0, 8 },        /* B */
+            { 0, 4, 0, 0, 8 },        /* X */
         },
         .flags = AV_PIX_FMT_FLAG_RGB,
     },
@@ -651,6 +656,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
             { 0, 4, 0, 0, 8 },        /* R */
             { 0, 4, 1, 0, 8 },        /* G */
             { 0, 4, 2, 0, 8 },        /* B */
+            { 0, 4, 3, 0, 8 },        /* X */
         },
         .flags = AV_PIX_FMT_FLAG_RGB,
     },
@@ -663,6 +669,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
             { 0, 4, 3, 0, 8 },        /* R */
             { 0, 4, 2, 0, 8 },        /* G */
             { 0, 4, 1, 0, 8 },        /* B */
+            { 0, 4, 0, 0, 8 },        /* X */
         },
         .flags = AV_PIX_FMT_FLAG_RGB,
     },
@@ -675,6 +682,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
             { 0, 4, 2, 0, 8 },        /* R */
             { 0, 4, 1, 0, 8 },        /* G */
             { 0, 4, 0, 0, 8 },        /* B */
+            { 0, 4, 3, 0, 8 },        /* X */
         },
         .flags = AV_PIX_FMT_FLAG_RGB,
     },
@@ -2628,6 +2636,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
             { 0, 4, 2, 0, 8 },        /* Y */
             { 0, 4, 1, 0, 8 },        /* U */
             { 0, 4, 0, 0, 8 },        /* V */
+            { 0, 4, 3, 0, 8 },        /* X */
         },
     },
     [AV_PIX_FMT_RGBF16BE] = {
@@ -2715,6 +2724,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
             { 0, 4, 1, 2, 10 },       /* Y */
             { 0, 4, 0, 0, 10 },       /* U */
             { 0, 4, 2, 4, 10 },       /* V */
+            { 0, 4, 3, 6,  2 },       /* X */
         },
     },
     [AV_PIX_FMT_XV30BE] = {
@@ -2726,6 +2736,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
             { 0, 32, 10, 0, 10 },       /* Y */
             { 0, 32,  0, 0, 10 },       /* U */
             { 0, 32, 20, 0, 10 },       /* V */
+            { 0, 32, 30, 0,  2 },       /* X */
         },
         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_BITSTREAM,
     },
@@ -2738,6 +2749,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
             { 0, 8, 2, 4, 12 },       /* Y */
             { 0, 8, 0, 4, 12 },       /* U */
             { 0, 8, 4, 4, 12 },       /* V */
+            { 0, 8, 6, 4, 12 },       /* X */
         },
     },
     [AV_PIX_FMT_XV36BE] = {
@@ -2749,6 +2761,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
             { 0, 8, 2, 4, 12 },       /* Y */
             { 0, 8, 0, 4, 12 },       /* U */
             { 0, 8, 4, 4, 12 },       /* V */
+            { 0, 8, 6, 4, 12 },       /* X */
         },
         .flags = AV_PIX_FMT_FLAG_BE,
     },
@@ -2761,6 +2774,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
             { 0, 4, 1, 4, 10 },       /* Y */
             { 0, 4, 0, 2, 10 },       /* U */
             { 0, 4, 2, 6, 10 },       /* V */
+            { 0, 4, 0, 0,  2 },       /* X */
         },
     },
     [AV_PIX_FMT_V30XBE] = {
@@ -2772,6 +2786,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
             { 0, 32, 12, 0, 10 },     /* Y */
             { 0, 32,  2, 0, 10 },     /* U */
             { 0, 32, 22, 0, 10 },     /* V */
+            { 0, 32,  0, 0,  2 },     /* X */
         },
         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_BITSTREAM,
     },
-- 
2.47.0



More information about the ffmpeg-devel mailing list