Commit a56fb88b authored by benoit's avatar benoit

add YUV440P and YUVJ440P support

patch by Andreas Öman: \andreas olebyn nu/
original thread: [FFmpeg-devel] half vertical chroma resolution from JPEGs..
date: 07/03/2007 01:29 PM


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@9732 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 42fc3823
...@@ -120,6 +120,14 @@ static const PixFmtInfo pix_fmt_info[PIX_FMT_NB] = { ...@@ -120,6 +120,14 @@ static const PixFmtInfo pix_fmt_info[PIX_FMT_NB] = {
.depth = 8, .depth = 8,
.x_chroma_shift = 2, .y_chroma_shift = 0, .x_chroma_shift = 2, .y_chroma_shift = 0,
}, },
[PIX_FMT_YUV440P] = {
.name = "yuv440p",
.nb_channels = 3,
.color_type = FF_COLOR_YUV,
.pixel_type = FF_PIXEL_PLANAR,
.depth = 8,
.x_chroma_shift = 0, .y_chroma_shift = 1,
},
/* JPEG YUV */ /* JPEG YUV */
[PIX_FMT_YUVJ420P] = { [PIX_FMT_YUVJ420P] = {
...@@ -146,6 +154,14 @@ static const PixFmtInfo pix_fmt_info[PIX_FMT_NB] = { ...@@ -146,6 +154,14 @@ static const PixFmtInfo pix_fmt_info[PIX_FMT_NB] = {
.depth = 8, .depth = 8,
.x_chroma_shift = 0, .y_chroma_shift = 0, .x_chroma_shift = 0, .y_chroma_shift = 0,
}, },
[PIX_FMT_YUVJ440P] = {
.name = "yuvj440p",
.nb_channels = 3,
.color_type = FF_COLOR_YUV_JPEG,
.pixel_type = FF_PIXEL_PLANAR,
.depth = 8,
.x_chroma_shift = 0, .y_chroma_shift = 1,
},
/* RGB formats */ /* RGB formats */
[PIX_FMT_RGB24] = { [PIX_FMT_RGB24] = {
...@@ -417,9 +433,11 @@ int avpicture_fill(AVPicture *picture, uint8_t *ptr, ...@@ -417,9 +433,11 @@ int avpicture_fill(AVPicture *picture, uint8_t *ptr,
case PIX_FMT_YUV444P: case PIX_FMT_YUV444P:
case PIX_FMT_YUV410P: case PIX_FMT_YUV410P:
case PIX_FMT_YUV411P: case PIX_FMT_YUV411P:
case PIX_FMT_YUV440P:
case PIX_FMT_YUVJ420P: case PIX_FMT_YUVJ420P:
case PIX_FMT_YUVJ422P: case PIX_FMT_YUVJ422P:
case PIX_FMT_YUVJ444P: case PIX_FMT_YUVJ444P:
case PIX_FMT_YUVJ440P:
w2 = (width + (1 << pinfo->x_chroma_shift) - 1) >> pinfo->x_chroma_shift; w2 = (width + (1 << pinfo->x_chroma_shift) - 1) >> pinfo->x_chroma_shift;
h2 = (height + (1 << pinfo->y_chroma_shift) - 1) >> pinfo->y_chroma_shift; h2 = (height + (1 << pinfo->y_chroma_shift) - 1) >> pinfo->y_chroma_shift;
size2 = w2 * h2; size2 = w2 * h2;
...@@ -1438,6 +1456,20 @@ static void grow21(uint8_t *dst, int dst_wrap, ...@@ -1438,6 +1456,20 @@ static void grow21(uint8_t *dst, int dst_wrap,
} }
} }
/* 1x1 -> 1x2 */
static void grow12(uint8_t *dst, int dst_wrap,
const uint8_t *src, int src_wrap,
int width, int height)
{
for(;height > 0; height-=2) {
memcpy(dst, src, width);
dst += dst_wrap;
memcpy(dst, src, width);
dst += dst_wrap;
src += src_wrap;
}
}
/* 1x1 -> 2x2 */ /* 1x1 -> 2x2 */
static void grow22(uint8_t *dst, int dst_wrap, static void grow22(uint8_t *dst, int dst_wrap,
const uint8_t *src, int src_wrap, const uint8_t *src, int src_wrap,
...@@ -2390,6 +2422,9 @@ int img_convert(AVPicture *dst, int dst_pix_fmt, ...@@ -2390,6 +2422,9 @@ int img_convert(AVPicture *dst, int dst_pix_fmt,
case 0xf0: case 0xf0:
resize_func = grow21; resize_func = grow21;
break; break;
case 0x0f:
resize_func = grow12;
break;
case 0xe0: case 0xe0:
resize_func = grow41; resize_func = grow41;
break; break;
......
...@@ -298,6 +298,9 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) ...@@ -298,6 +298,9 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
else else
s->avctx->pix_fmt = PIX_FMT_GRAY8; s->avctx->pix_fmt = PIX_FMT_GRAY8;
break; break;
case 0x121111:
s->avctx->pix_fmt = s->cs_itu601 ? PIX_FMT_YUV440P : PIX_FMT_YUVJ440P;
break;
case 0x211111: case 0x211111:
case 0x221212: case 0x221212:
s->avctx->pix_fmt = s->cs_itu601 ? PIX_FMT_YUV422P : PIX_FMT_YUVJ422P; s->avctx->pix_fmt = s->cs_itu601 ? PIX_FMT_YUV422P : PIX_FMT_YUVJ422P;
......
...@@ -103,6 +103,8 @@ enum PixelFormat { ...@@ -103,6 +103,8 @@ enum PixelFormat {
PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian
PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian
PIX_FMT_YUV440P, ///< Planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
PIX_FMT_YUVJ440P, ///< Planar YUV 4:4:0 full scale (jpeg)
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
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment