summaryrefslogtreecommitdiff
path: root/libavcodec/imgconvert.c
diff options
context:
space:
mode:
authorFabrice Bellard <fabrice@bellard.org>2002-10-08 17:42:33 +0000
committerFabrice Bellard <fabrice@bellard.org>2002-10-08 17:42:33 +0000
commit789587d59502d705d7dd75d9f145b73713697262 (patch)
treeb90a82f94b6af9ce75c7289d78d128a19e68aa77 /libavcodec/imgconvert.c
parent47fa9c203aaa577208064ee157007a732c6bb8a9 (diff)
minimum support for YUV411P (new combined scaler/converter will handle that better...)
Originally committed as revision 1013 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/imgconvert.c')
-rw-r--r--libavcodec/imgconvert.c36
1 files changed, 36 insertions, 0 deletions
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],