# HG changeset patch # User romansh # Date 1098410670 0 # Node ID 550ae8914fd36c69115e43f0f3e1e1434c76a4ce # Parent de38526a1f3f99c0a8e251d3dcaf8e6ac27d6c6c * 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). diff -r de38526a1f3f -r 550ae8914fd3 avcodec.h --- a/avcodec.h Thu Oct 21 21:07:40 2004 +0000 +++ b/avcodec.h Fri Oct 22 02:04:30 2004 +0000 @@ -203,6 +203,7 @@ PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing(xvmc_render.h) PIX_FMT_XVMC_MPEG2_IDCT, PIX_FMT_UYVY422, ///< Packed pixel, Cb Y0 Cr Y1 + PIX_FMT_UYVY411, ///< Packed pixel, Cb Y0 Y1 Cr Y2 Y3 PIX_FMT_NB, }; diff -r de38526a1f3f -r 550ae8914fd3 imgconvert.c --- a/imgconvert.c Thu Oct 21 21:07:40 2004 +0000 +++ b/imgconvert.c Fri Oct 22 02:04:30 2004 +0000 @@ -227,6 +227,14 @@ [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 @@ 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 @@ 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 @@ 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 @@ 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 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 @@ .convert = pal8_to_rgba32 }, }, + [PIX_FMT_UYVY411] = { + [PIX_FMT_YUV411P] = { + .convert = uyvy411_to_yuv411p, + }, + }, + }; int avpicture_alloc(AVPicture *picture, @@ -2003,6 +2065,10 @@ 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 && diff -r de38526a1f3f -r 550ae8914fd3 utils.c --- a/utils.c Thu Oct 21 21:07:40 2004 +0000 +++ b/utils.c Fri Oct 22 02:04:30 2004 +0000 @@ -159,6 +159,7 @@ h_align= 16; break; case PIX_FMT_YUV411P: + case PIX_FMT_UYVY411: w_align=32; h_align=8; break;