# HG changeset patch # User michaelni # Date 1027238093 0 # Node ID 9aa5f0d0124efe70f8623ecf5bc76c2f68d2c720 # Parent 23eee7d73c4b904565cb2f2fe255b9bc81a82d2e YUV410P to YUV420P patch by Franois Revol diff -r 23eee7d73c4b -r 9aa5f0d0124e imgconvert.c --- a/imgconvert.c Sun Jul 21 01:34:05 2002 +0000 +++ b/imgconvert.c Sun Jul 21 07:54:53 2002 +0000 @@ -245,6 +245,34 @@ } } +/* 1x1 -> 2x2 */ +static void grow22(UINT8 *dst, int dst_wrap, + UINT8 *src, int src_wrap, + int width, int height) +{ + int w; + UINT8 *s1, *d; + + for(;height > 0; height--) { + s1 = src; + d = dst; + for(w = width;w >= 4; w-=4) { + d[1] = d[0] = s1[0]; + d[3] = d[2] = s1[1]; + s1 += 2; + d += 4; + } + for(;w > 0; w--) { + d[0] = s1[0]; + s1 ++; + d++; + } + if (height%2) + src += src_wrap; + dst += dst_wrap; + } +} + static void img_copy(UINT8 *dst, int dst_wrap, UINT8 *src, int src_wrap, int width, int height) @@ -382,6 +410,17 @@ } else if (dst_pix_fmt == PIX_FMT_YUV420P) { switch(pix_fmt) { + case PIX_FMT_YUV410P: + img_copy(dst->data[0], dst->linesize[0], + src->data[0], src->linesize[0], + width, height); + grow22(dst->data[1], dst->linesize[1], + src->data[1], src->linesize[1], + width/2, height/2); + grow22(dst->data[2], dst->linesize[2], + src->data[2], src->linesize[2], + width/2, height/2); + break; case PIX_FMT_YUV420P: for(i=0;i<3;i++) { img_copy(dst->data[i], dst->linesize[i],