Mercurial > libavcodec.hg
comparison imgconvert.c @ 5363:1a25f2f6316e libavcodec
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
author | benoit |
---|---|
date | Wed, 18 Jul 2007 08:11:16 +0000 |
parents | 45d083bbbbe7 |
children | 3e8764a25c53 |
comparison
equal
deleted
inserted
replaced
5362:e0b7c248c33e | 5363:1a25f2f6316e |
---|---|
118 .color_type = FF_COLOR_YUV, | 118 .color_type = FF_COLOR_YUV, |
119 .pixel_type = FF_PIXEL_PLANAR, | 119 .pixel_type = FF_PIXEL_PLANAR, |
120 .depth = 8, | 120 .depth = 8, |
121 .x_chroma_shift = 2, .y_chroma_shift = 0, | 121 .x_chroma_shift = 2, .y_chroma_shift = 0, |
122 }, | 122 }, |
123 [PIX_FMT_YUV440P] = { | |
124 .name = "yuv440p", | |
125 .nb_channels = 3, | |
126 .color_type = FF_COLOR_YUV, | |
127 .pixel_type = FF_PIXEL_PLANAR, | |
128 .depth = 8, | |
129 .x_chroma_shift = 0, .y_chroma_shift = 1, | |
130 }, | |
123 | 131 |
124 /* JPEG YUV */ | 132 /* JPEG YUV */ |
125 [PIX_FMT_YUVJ420P] = { | 133 [PIX_FMT_YUVJ420P] = { |
126 .name = "yuvj420p", | 134 .name = "yuvj420p", |
127 .nb_channels = 3, | 135 .nb_channels = 3, |
143 .nb_channels = 3, | 151 .nb_channels = 3, |
144 .color_type = FF_COLOR_YUV_JPEG, | 152 .color_type = FF_COLOR_YUV_JPEG, |
145 .pixel_type = FF_PIXEL_PLANAR, | 153 .pixel_type = FF_PIXEL_PLANAR, |
146 .depth = 8, | 154 .depth = 8, |
147 .x_chroma_shift = 0, .y_chroma_shift = 0, | 155 .x_chroma_shift = 0, .y_chroma_shift = 0, |
156 }, | |
157 [PIX_FMT_YUVJ440P] = { | |
158 .name = "yuvj440p", | |
159 .nb_channels = 3, | |
160 .color_type = FF_COLOR_YUV_JPEG, | |
161 .pixel_type = FF_PIXEL_PLANAR, | |
162 .depth = 8, | |
163 .x_chroma_shift = 0, .y_chroma_shift = 1, | |
148 }, | 164 }, |
149 | 165 |
150 /* RGB formats */ | 166 /* RGB formats */ |
151 [PIX_FMT_RGB24] = { | 167 [PIX_FMT_RGB24] = { |
152 .name = "rgb24", | 168 .name = "rgb24", |
415 case PIX_FMT_YUV420P: | 431 case PIX_FMT_YUV420P: |
416 case PIX_FMT_YUV422P: | 432 case PIX_FMT_YUV422P: |
417 case PIX_FMT_YUV444P: | 433 case PIX_FMT_YUV444P: |
418 case PIX_FMT_YUV410P: | 434 case PIX_FMT_YUV410P: |
419 case PIX_FMT_YUV411P: | 435 case PIX_FMT_YUV411P: |
436 case PIX_FMT_YUV440P: | |
420 case PIX_FMT_YUVJ420P: | 437 case PIX_FMT_YUVJ420P: |
421 case PIX_FMT_YUVJ422P: | 438 case PIX_FMT_YUVJ422P: |
422 case PIX_FMT_YUVJ444P: | 439 case PIX_FMT_YUVJ444P: |
440 case PIX_FMT_YUVJ440P: | |
423 w2 = (width + (1 << pinfo->x_chroma_shift) - 1) >> pinfo->x_chroma_shift; | 441 w2 = (width + (1 << pinfo->x_chroma_shift) - 1) >> pinfo->x_chroma_shift; |
424 h2 = (height + (1 << pinfo->y_chroma_shift) - 1) >> pinfo->y_chroma_shift; | 442 h2 = (height + (1 << pinfo->y_chroma_shift) - 1) >> pinfo->y_chroma_shift; |
425 size2 = w2 * h2; | 443 size2 = w2 * h2; |
426 picture->data[0] = ptr; | 444 picture->data[0] = ptr; |
427 picture->data[1] = picture->data[0] + size; | 445 picture->data[1] = picture->data[0] + size; |
1436 src += src_wrap; | 1454 src += src_wrap; |
1437 dst += dst_wrap; | 1455 dst += dst_wrap; |
1438 } | 1456 } |
1439 } | 1457 } |
1440 | 1458 |
1459 /* 1x1 -> 1x2 */ | |
1460 static void grow12(uint8_t *dst, int dst_wrap, | |
1461 const uint8_t *src, int src_wrap, | |
1462 int width, int height) | |
1463 { | |
1464 for(;height > 0; height-=2) { | |
1465 memcpy(dst, src, width); | |
1466 dst += dst_wrap; | |
1467 memcpy(dst, src, width); | |
1468 dst += dst_wrap; | |
1469 src += src_wrap; | |
1470 } | |
1471 } | |
1472 | |
1441 /* 1x1 -> 2x2 */ | 1473 /* 1x1 -> 2x2 */ |
1442 static void grow22(uint8_t *dst, int dst_wrap, | 1474 static void grow22(uint8_t *dst, int dst_wrap, |
1443 const uint8_t *src, int src_wrap, | 1475 const uint8_t *src, int src_wrap, |
1444 int width, int height) | 1476 int width, int height) |
1445 { | 1477 { |
2387 case 0x22: | 2419 case 0x22: |
2388 resize_func = ff_shrink44; | 2420 resize_func = ff_shrink44; |
2389 break; | 2421 break; |
2390 case 0xf0: | 2422 case 0xf0: |
2391 resize_func = grow21; | 2423 resize_func = grow21; |
2424 break; | |
2425 case 0x0f: | |
2426 resize_func = grow12; | |
2392 break; | 2427 break; |
2393 case 0xe0: | 2428 case 0xe0: |
2394 resize_func = grow41; | 2429 resize_func = grow41; |
2395 break; | 2430 break; |
2396 case 0xff: | 2431 case 0xff: |