From 789587d59502d705d7dd75d9f145b73713697262 Mon Sep 17 00:00:00 2001 From: Fabrice Bellard Date: Tue, 8 Oct 2002 17:42:33 +0000 Subject: minimum support for YUV411P (new combined scaler/converter will handle that better...) Originally committed as revision 1013 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/imgconvert.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'libavcodec/imgconvert.c') diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c index 48d6c014c4..45bc540568 100644 --- a/libavcodec/imgconvert.c +++ b/libavcodec/imgconvert.c @@ -399,6 +399,31 @@ static void grow22(UINT8 *dst, int dst_wrap, } } +/* 1x2 -> 2x1. width and height are given for the source picture */ +static void conv411(UINT8 *dst, int dst_wrap, + UINT8 *src, int src_wrap, + int width, int height) +{ + int w, c; + UINT8 *s1, *s2, *d; + + for(;height > 0; height -= 2) { + s1 = src; + s2 = src + src_wrap; + d = dst; + for(w = width;w > 0; w--) { + c = (s1[0] + s2[0]) >> 1; + d[0] = c; + d[1] = c; + s1++; + s2++; + d += 2; + } + src += src_wrap * 2; + dst += dst_wrap; + } +} + static void img_copy(UINT8 *dst, int dst_wrap, UINT8 *src, int src_wrap, int width, int height) @@ -628,6 +653,17 @@ int img_convert(AVPicture *dst, int dst_pix_fmt, } else if (dst_pix_fmt == PIX_FMT_YUV420P) { switch(pix_fmt) { + case PIX_FMT_YUV411P: + img_copy(dst->data[0], dst->linesize[0], + src->data[0], src->linesize[0], + width, height); + conv411(dst->data[1], dst->linesize[1], + src->data[1], src->linesize[1], + width / 4, height); + conv411(dst->data[2], dst->linesize[2], + src->data[2], src->linesize[2], + width / 4, height); + break; case PIX_FMT_YUV410P: img_copy(dst->data[0], dst->linesize[0], src->data[0], src->linesize[0], -- cgit v1.2.3