[FFmpeg-cvslog] libavutil/swscale: YUV444P10/YUV444P9 support.
Ronald S. Bultje
git at videolan.org
Sat Jun 11 04:16:59 CEST 2011
ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Wed Jun 8 19:16:39 2011 -0700| [103278f7b0b037a4a6184865ca9b8d021ec9be85] | committer: Ronald S. Bultje
libavutil/swscale: YUV444P10/YUV444P9 support.
Also add missing glue code for recently added YUV422P10 formats
to swscale.
Signed-off-by: Ronald S. Bultje <rsbultje at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=103278f7b0b037a4a6184865ca9b8d021ec9be85
---
libavutil/pixdesc.c | 46 +++++++++++++++++++++++++++++++++++++++++
libavutil/pixfmt.h | 6 +++++
libswscale/swscale.c | 14 +++++++++++-
libswscale/swscale_internal.h | 12 ++++++++++
libswscale/utils.c | 6 +++++
5 files changed, 83 insertions(+), 1 deletions(-)
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 7758475..efc7c7e 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -878,6 +878,52 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_BE,
},
+ [PIX_FMT_YUV444P10LE] = {
+ .name = "yuv444p10le",
+ .nb_components= 3,
+ .log2_chroma_w= 0,
+ .log2_chroma_h= 0,
+ .comp = {
+ {0,1,1,0,9}, /* Y */
+ {1,1,1,0,9}, /* U */
+ {2,1,1,0,9}, /* V */
+ },
+ },
+ [PIX_FMT_YUV444P10BE] = {
+ .name = "yuv444p10be",
+ .nb_components= 3,
+ .log2_chroma_w= 0,
+ .log2_chroma_h= 0,
+ .comp = {
+ {0,1,1,0,9}, /* Y */
+ {1,1,1,0,9}, /* U */
+ {2,1,1,0,9}, /* V */
+ },
+ .flags = PIX_FMT_BE,
+ },
+ [PIX_FMT_YUV444P9LE] = {
+ .name = "yuv444p9le",
+ .nb_components= 3,
+ .log2_chroma_w= 0,
+ .log2_chroma_h= 0,
+ .comp = {
+ {0,1,1,0,8}, /* Y */
+ {1,1,1,0,8}, /* U */
+ {2,1,1,0,8}, /* V */
+ },
+ },
+ [PIX_FMT_YUV444P9BE] = {
+ .name = "yuv444p9be",
+ .nb_components= 3,
+ .log2_chroma_w= 0,
+ .log2_chroma_h= 0,
+ .comp = {
+ {0,1,1,0,9}, /* Y */
+ {1,1,1,0,9}, /* U */
+ {2,1,1,0,9}, /* V */
+ },
+ .flags = PIX_FMT_BE,
+ },
[PIX_FMT_DXVA2_VLD] = {
.name = "dxva2_vld",
.log2_chroma_w = 1,
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index d88775f..e852d85 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -141,6 +141,10 @@ enum PixelFormat {
PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
+ PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
+ PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
+ PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
+ PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
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
};
@@ -166,8 +170,10 @@ enum PixelFormat {
#define PIX_FMT_BGR444 PIX_FMT_NE(BGR444BE, BGR444LE)
#define PIX_FMT_YUV420P9 PIX_FMT_NE(YUV420P9BE , YUV420P9LE)
+#define PIX_FMT_YUV444P9 PIX_FMT_NE(YUV444P9BE , YUV444P9LE)
#define PIX_FMT_YUV420P10 PIX_FMT_NE(YUV420P10BE, YUV420P10LE)
#define PIX_FMT_YUV422P10 PIX_FMT_NE(YUV422P10BE, YUV422P10LE)
+#define PIX_FMT_YUV444P10 PIX_FMT_NE(YUV444P10BE, YUV444P10LE)
#define PIX_FMT_YUV420P16 PIX_FMT_NE(YUV420P16BE, YUV420P16LE)
#define PIX_FMT_YUV422P16 PIX_FMT_NE(YUV422P16BE, YUV422P16LE)
#define PIX_FMT_YUV444P16 PIX_FMT_NE(YUV444P16BE, YUV444P16LE)
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index bc076dd..ba89a0f 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -1821,7 +1821,7 @@ find_c_packed_planar_out_funcs(SwsContext *c,
} else if (is16BPS(dstFormat)) {
*yuv2yuvX = isBE(dstFormat) ? yuv2yuvX16BE_c : yuv2yuvX16LE_c;
} else if (is9_OR_10BPS(dstFormat)) {
- if (dstFormat == PIX_FMT_YUV420P9BE || dstFormat == PIX_FMT_YUV420P9LE) {
+ if (av_pix_fmt_descriptors[dstFormat].comp[0].depth_minus1 == 8) {
*yuv2yuvX = isBE(dstFormat) ? yuv2yuvX9BE_c : yuv2yuvX9LE_c;
} else {
*yuv2yuvX = isBE(dstFormat) ? yuv2yuvX10BE_c : yuv2yuvX10LE_c;
@@ -2161,9 +2161,15 @@ static av_cold void sws_init_swScale_c(SwsContext *c)
case PIX_FMT_PAL8 :
case PIX_FMT_BGR4_BYTE:
case PIX_FMT_RGB4_BYTE: c->chrToYV12 = palToUV_c; break;
+ case PIX_FMT_YUV444P9BE:
case PIX_FMT_YUV420P9BE: c->chrToYV12 = BE9ToUV_c; break;
+ case PIX_FMT_YUV444P9LE:
case PIX_FMT_YUV420P9LE: c->chrToYV12 = LE9ToUV_c; break;
+ case PIX_FMT_YUV444P10BE:
+ case PIX_FMT_YUV422P10BE:
case PIX_FMT_YUV420P10BE: c->chrToYV12 = BE10ToUV_c; break;
+ case PIX_FMT_YUV422P10LE:
+ case PIX_FMT_YUV444P10LE:
case PIX_FMT_YUV420P10LE: c->chrToYV12 = LE10ToUV_c; break;
case PIX_FMT_YUV420P16BE:
case PIX_FMT_YUV422P16BE:
@@ -2219,9 +2225,15 @@ static av_cold void sws_init_swScale_c(SwsContext *c)
c->lumToYV12 = NULL;
c->alpToYV12 = NULL;
switch (srcFormat) {
+ case PIX_FMT_YUV444P9BE:
case PIX_FMT_YUV420P9BE: c->lumToYV12 = BE9ToY_c; break;
+ case PIX_FMT_YUV444P9LE:
case PIX_FMT_YUV420P9LE: c->lumToYV12 = LE9ToY_c; break;
+ case PIX_FMT_YUV444P10BE:
+ case PIX_FMT_YUV422P10BE:
case PIX_FMT_YUV420P10BE: c->lumToYV12 = BE10ToY_c; break;
+ case PIX_FMT_YUV444P10LE:
+ case PIX_FMT_YUV422P10LE:
case PIX_FMT_YUV420P10LE: c->lumToYV12 = LE10ToY_c; break;
case PIX_FMT_YUYV422 :
case PIX_FMT_YUV420P16BE:
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index 013eef9..483842e 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -355,6 +355,12 @@ const char *sws_format_name(enum PixelFormat format);
#define is9_OR_10BPS(x) ( \
(x)==PIX_FMT_YUV420P9LE \
|| (x)==PIX_FMT_YUV420P9BE \
+ || (x)==PIX_FMT_YUV444P9BE \
+ || (x)==PIX_FMT_YUV444P9LE \
+ || (x)==PIX_FMT_YUV422P10BE \
+ || (x)==PIX_FMT_YUV422P10LE \
+ || (x)==PIX_FMT_YUV444P10BE \
+ || (x)==PIX_FMT_YUV444P10LE \
|| (x)==PIX_FMT_YUV420P10LE \
|| (x)==PIX_FMT_YUV420P10BE \
)
@@ -373,12 +379,18 @@ const char *sws_format_name(enum PixelFormat format);
#define isPlanarYUV(x) ( \
isPlanar8YUV(x) \
|| (x)==PIX_FMT_YUV420P9LE \
+ || (x)==PIX_FMT_YUV444P9LE \
|| (x)==PIX_FMT_YUV420P10LE \
+ || (x)==PIX_FMT_YUV422P10LE \
+ || (x)==PIX_FMT_YUV444P10LE \
|| (x)==PIX_FMT_YUV420P16LE \
|| (x)==PIX_FMT_YUV422P16LE \
|| (x)==PIX_FMT_YUV444P16LE \
|| (x)==PIX_FMT_YUV420P9BE \
+ || (x)==PIX_FMT_YUV444P9BE \
|| (x)==PIX_FMT_YUV420P10BE \
+ || (x)==PIX_FMT_YUV422P10BE \
+ || (x)==PIX_FMT_YUV444P10BE \
|| (x)==PIX_FMT_YUV420P16BE \
|| (x)==PIX_FMT_YUV422P16BE \
|| (x)==PIX_FMT_YUV444P16BE \
diff --git a/libswscale/utils.c b/libswscale/utils.c
index d552330..213bf3a 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -110,12 +110,18 @@ const char *swscale_license(void)
|| (x)==PIX_FMT_MONOWHITE \
|| (x)==PIX_FMT_MONOBLACK \
|| (x)==PIX_FMT_YUV420P9LE \
+ || (x)==PIX_FMT_YUV444P9LE \
|| (x)==PIX_FMT_YUV420P10LE \
+ || (x)==PIX_FMT_YUV422P10LE \
+ || (x)==PIX_FMT_YUV444P10LE \
|| (x)==PIX_FMT_YUV420P16LE \
|| (x)==PIX_FMT_YUV422P16LE \
|| (x)==PIX_FMT_YUV444P16LE \
|| (x)==PIX_FMT_YUV420P9BE \
+ || (x)==PIX_FMT_YUV444P9BE \
|| (x)==PIX_FMT_YUV420P10BE \
+ || (x)==PIX_FMT_YUV444P10BE \
+ || (x)==PIX_FMT_YUV422P10BE \
|| (x)==PIX_FMT_YUV420P16BE \
|| (x)==PIX_FMT_YUV422P16BE \
|| (x)==PIX_FMT_YUV444P16BE \
More information about the ffmpeg-cvslog
mailing list