diff options
author | Roman Shaposhnik <roman@shaposhnik.org> | 2004-10-22 02:04:30 +0000 |
---|---|---|
committer | Roman Shaposhnik <roman@shaposhnik.org> | 2004-10-22 02:04:30 +0000 |
commit | f02be79d61022f399bb08573fd42d068cdf75b7b (patch) | |
tree | eda5af9278e46245d3b56d96d89513466502ddc8 /libavcodec/imgconvert.c | |
parent | 5ba7c3d7c9c53afad5e13203011619cff579b7ba (diff) | |
download | ffmpeg-f02be79d61022f399bb08573fd42d068cdf75b7b.tar.gz |
* Introducing IIDC1394 grabbing interface.
Use it with -grab dc1394
* Introducing yet another packed pix_fmt in order to support some of
the IIDC1394 modes: uyvy411 (Cb Y0 Y1 Cr Y2 Y3).
Originally committed as revision 3621 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/imgconvert.c')
-rw-r--r-- | libavcodec/imgconvert.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c index 7bcb8ee23d..040b2c7939 100644 --- a/libavcodec/imgconvert.c +++ b/libavcodec/imgconvert.c @@ -227,6 +227,14 @@ static PixFmtInfo pix_fmt_info[PIX_FMT_NB] = { [PIX_FMT_XVMC_MPEG2_IDCT] = { .name = "xvmcidct", }, + [PIX_FMT_UYVY411] = { + .name = "uyvy411", + .nb_channels = 1, + .color_type = FF_COLOR_YUV, + .pixel_type = FF_PIXEL_PACKED, + .depth = 8, + .x_chroma_shift = 2, .y_chroma_shift = 0, + }, }; void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift) @@ -308,6 +316,12 @@ int avpicture_fill(AVPicture *picture, uint8_t *ptr, picture->data[2] = NULL; picture->linesize[0] = width * 2; return size * 2; + case PIX_FMT_UYVY411: + picture->data[0] = ptr; + picture->data[1] = NULL; + picture->data[2] = NULL; + picture->linesize[0] = width + width/2; + return size + size/2; case PIX_FMT_GRAY8: picture->data[0] = ptr; picture->data[1] = NULL; @@ -355,6 +369,8 @@ int avpicture_layout(const AVPicture* src, int pix_fmt, int width, int height, pix_fmt == PIX_FMT_RGB565 || pix_fmt == PIX_FMT_RGB555) w = width * 2; + else if (pix_fmt == PIX_FMT_UYVY411) + w = width + width/2; else if (pix_fmt == PIX_FMT_PAL8) w = width; else @@ -466,6 +482,9 @@ static int avg_bits_per_pixel(int pix_fmt) case PIX_FMT_RGB555: bits = 16; break; + case PIX_FMT_UYVY411: + bits = 12; + break; default: bits = pf->depth * pf->nb_channels; break; @@ -579,6 +598,9 @@ void img_copy(AVPicture *dst, const AVPicture *src, case PIX_FMT_RGB555: bits = 16; break; + case PIX_FMT_UYVY411: + bits = 12; + break; default: bits = pf->depth * pf->nb_channels; break; @@ -864,6 +886,40 @@ static void yuv422p_to_uyvy422(AVPicture *dst, const AVPicture *src, } } +static void uyvy411_to_yuv411p(AVPicture *dst, const AVPicture *src, + int width, int height) +{ + const uint8_t *p, *p1; + uint8_t *lum, *cr, *cb, *lum1, *cr1, *cb1; + int w; + + p1 = src->data[0]; + lum1 = dst->data[0]; + cb1 = dst->data[1]; + cr1 = dst->data[2]; + for(;height > 0; height--) { + p = p1; + lum = lum1; + cb = cb1; + cr = cr1; + for(w = width; w >= 4; w -= 4) { + cb[0] = p[0]; + lum[0] = p[1]; + lum[1] = p[2]; + cr[0] = p[3]; + lum[2] = p[4]; + lum[3] = p[5]; + p += 6; + lum += 4; + cb++; + cr++; + } + p1 += src->linesize[0]; + lum1 += dst->linesize[0]; + cb1 += dst->linesize[1]; + cr1 += dst->linesize[2]; + } +} #define SCALEBITS 10 @@ -1777,6 +1833,12 @@ static ConvertEntry convert_table[PIX_FMT_NB][PIX_FMT_NB] = { .convert = pal8_to_rgba32 }, }, + [PIX_FMT_UYVY411] = { + [PIX_FMT_YUV411P] = { + .convert = uyvy411_to_yuv411p, + }, + }, + }; int avpicture_alloc(AVPicture *picture, @@ -2003,6 +2065,10 @@ int img_convert(AVPicture *dst, int dst_pix_fmt, dst_pix_fmt == PIX_FMT_UYVY422) { /* specific case: convert to YUV422P first */ int_pix_fmt = PIX_FMT_YUV422P; + } else if (src_pix_fmt == PIX_FMT_UYVY411 || + dst_pix_fmt == PIX_FMT_UYVY411) { + /* specific case: convert to YUV411P first */ + int_pix_fmt = PIX_FMT_YUV411P; } else if ((src_pix->color_type == FF_COLOR_GRAY && src_pix_fmt != PIX_FMT_GRAY8) || (dst_pix->color_type == FF_COLOR_GRAY && |