Add 420,422 and 444 planar 16bit per component pix formats.
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 21 Apr 2009 01:02:48 +0000 (01:02 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 21 Apr 2009 01:02:48 +0000 (01:02 +0000)
Originally committed as revision 18636 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/imgconvert.c
libavutil/pixfmt.h

index bd9d07a..3f457fe 100644 (file)
@@ -130,6 +130,55 @@ static const PixFmtInfo pix_fmt_info[PIX_FMT_NB] = {
         .depth = 8,
         .x_chroma_shift = 0, .y_chroma_shift = 1,
     },
         .depth = 8,
         .x_chroma_shift = 0, .y_chroma_shift = 1,
     },
+    [PIX_FMT_YUV420PLE] = {
+        .name = "yuv420ple",
+        .nb_channels = 3,
+        .color_type = FF_COLOR_YUV,
+        .pixel_type = FF_PIXEL_PLANAR,
+        .depth = 16,
+        .x_chroma_shift = 1, .y_chroma_shift = 1,
+    },
+    [PIX_FMT_YUV422PLE] = {
+        .name = "yuv422ple",
+        .nb_channels = 3,
+        .color_type = FF_COLOR_YUV,
+        .pixel_type = FF_PIXEL_PLANAR,
+        .depth = 16,
+        .x_chroma_shift = 1, .y_chroma_shift = 0,
+    },
+    [PIX_FMT_YUV444PLE] = {
+        .name = "yuv444ple",
+        .nb_channels = 3,
+        .color_type = FF_COLOR_YUV,
+        .pixel_type = FF_PIXEL_PLANAR,
+        .depth = 16,
+        .x_chroma_shift = 0, .y_chroma_shift = 0,
+    },
+    [PIX_FMT_YUV420PBE] = {
+        .name = "yuv420pbe",
+        .nb_channels = 3,
+        .color_type = FF_COLOR_YUV,
+        .pixel_type = FF_PIXEL_PLANAR,
+        .depth = 16,
+        .x_chroma_shift = 1, .y_chroma_shift = 1,
+    },
+    [PIX_FMT_YUV422PBE] = {
+        .name = "yuv422pbe",
+        .nb_channels = 3,
+        .color_type = FF_COLOR_YUV,
+        .pixel_type = FF_PIXEL_PLANAR,
+        .depth = 16,
+        .x_chroma_shift = 1, .y_chroma_shift = 0,
+    },
+    [PIX_FMT_YUV444PBE] = {
+        .name = "yuv444pbe",
+        .nb_channels = 3,
+        .color_type = FF_COLOR_YUV,
+        .pixel_type = FF_PIXEL_PLANAR,
+        .depth = 16,
+        .x_chroma_shift = 0, .y_chroma_shift = 0,
+    },
+
 
     /* YUV formats with alpha plane */
     [PIX_FMT_YUVA420P] = {
 
     /* YUV formats with alpha plane */
     [PIX_FMT_YUVA420P] = {
@@ -613,6 +662,17 @@ int ff_fill_linesize(AVPicture *picture, enum PixelFormat pix_fmt, int width)
         picture->linesize[1] = w2;
         picture->linesize[2] = w2;
         break;
         picture->linesize[1] = w2;
         picture->linesize[2] = w2;
         break;
+    case PIX_FMT_YUV420PLE:
+    case PIX_FMT_YUV422PLE:
+    case PIX_FMT_YUV444PLE:
+    case PIX_FMT_YUV420PBE:
+    case PIX_FMT_YUV422PBE:
+    case PIX_FMT_YUV444PBE:
+        w2 = (width + (1 << pinfo->x_chroma_shift) - 1) >> pinfo->x_chroma_shift;
+        picture->linesize[0] = 2*width;
+        picture->linesize[1] = 2*w2;
+        picture->linesize[2] = 2*w2;
+        break;
     case PIX_FMT_YUVA420P:
         w2 = (width + (1 << pinfo->x_chroma_shift) - 1) >> pinfo->x_chroma_shift;
         picture->linesize[0] = width;
     case PIX_FMT_YUVA420P:
         w2 = (width + (1 << pinfo->x_chroma_shift) - 1) >> pinfo->x_chroma_shift;
         picture->linesize[0] = width;
@@ -696,6 +756,12 @@ int ff_fill_pointer(AVPicture *picture, uint8_t *ptr, enum PixelFormat pix_fmt,
     case PIX_FMT_YUVJ422P:
     case PIX_FMT_YUVJ444P:
     case PIX_FMT_YUVJ440P:
     case PIX_FMT_YUVJ422P:
     case PIX_FMT_YUVJ444P:
     case PIX_FMT_YUVJ440P:
+    case PIX_FMT_YUV420PLE:
+    case PIX_FMT_YUV422PLE:
+    case PIX_FMT_YUV444PLE:
+    case PIX_FMT_YUV420PBE:
+    case PIX_FMT_YUV422PBE:
+    case PIX_FMT_YUV444PBE:
         h2 = (height + (1 << pinfo->y_chroma_shift) - 1) >> pinfo->y_chroma_shift;
         size2 = picture->linesize[1] * h2;
         picture->data[0] = ptr;
         h2 = (height + (1 << pinfo->y_chroma_shift) - 1) >> pinfo->y_chroma_shift;
         size2 = picture->linesize[1] * h2;
         picture->data[0] = ptr;
index 21a72a8..fed57f1 100644 (file)
@@ -116,6 +116,13 @@ enum PixelFormat {
     PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers
     PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers
     PIX_FMT_VAAPI_VLD,  ///< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
     PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers
     PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers
     PIX_FMT_VAAPI_VLD,  ///< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
+
+    PIX_FMT_YUV420PLE,  ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
+    PIX_FMT_YUV420PBE,  ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
+    PIX_FMT_YUV422PLE,  ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
+    PIX_FMT_YUV422PBE,  ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
+    PIX_FMT_YUV444PLE,  ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
+    PIX_FMT_YUV444PBE,  ///< planar YUV 4:4:4, 48bpp, (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
 };
 
     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
 };
 
@@ -137,4 +144,8 @@ enum PixelFormat {
 #define PIX_FMT_BGR565 PIX_FMT_NE(BGR565BE, BGR565LE)
 #define PIX_FMT_BGR555 PIX_FMT_NE(BGR555BE, BGR555LE)
 
 #define PIX_FMT_BGR565 PIX_FMT_NE(BGR565BE, BGR565LE)
 #define PIX_FMT_BGR555 PIX_FMT_NE(BGR555BE, BGR555LE)
 
+#define PIX_FMT_YUV420P16 PIX_FMT_NE(PIX_FMT_YUV420PBE, PIX_FMT_YUV420PLE)
+#define PIX_FMT_YUV422P16 PIX_FMT_NE(PIX_FMT_YUV422PBE, PIX_FMT_YUV422PLE)
+#define PIX_FMT_YUV444P16 PIX_FMT_NE(PIX_FMT_YUV444PBE, PIX_FMT_YUV444PLE)
+
 #endif /* AVUTIL_PIXFMT_H */
 #endif /* AVUTIL_PIXFMT_H */