From 69572401adec1b8eb67f91c217e0052717fe66f1 Mon Sep 17 00:00:00 2001 From: Fabrice Bellard Date: Mon, 20 Jan 2003 22:26:19 +0000 Subject: added gray<->RGB functions - fixed rgb<->yuv functions for non RGB24 case Originally committed as revision 1483 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/imgconvert.c | 145 +++++++++++++++++++++++++++--------------------- 1 file changed, 81 insertions(+), 64 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c index 6ac5dd7292..c02afc76c8 100644 --- a/libavcodec/imgconvert.c +++ b/libavcodec/imgconvert.c @@ -520,7 +520,7 @@ static void rgb_name ## _to_yuv420p(AVPicture *dst, AVPicture *src, \ cr = dst->data[2]; \ \ wrap = width; \ - wrap3 = width * 3; \ + wrap3 = width * BPP; \ p = src->data[0]; \ for(y=0;ydata[0]; \ + src_wrap = src->linesize[0] - BPP * width; \ + \ + q = dst->data[0]; \ + dst_wrap = dst->linesize[0] - width; \ + \ + for(y=0;y> SCALEBITS; \ + q++; \ + p += BPP; \ + } \ + p += src_wrap; \ + q += dst_wrap; \ + } \ +} \ + \ +static void gray_to_ ## rgb_name(AVPicture *dst, AVPicture *src, \ + int width, int height) \ +{ \ + const unsigned char *p; \ + unsigned char *q; \ + int r, dst_wrap, src_wrap; \ + int x, y; \ + \ + p = src->data[0]; \ + src_wrap = src->linesize[0] - width; \ + \ + q = dst->data[0]; \ + dst_wrap = dst->linesize[0] - BPP * width; \ + \ + for(y=0;ydata[0]; - src_wrap = src->linesize[0] - 3 * width; - - q = dst->data[0]; - dst_wrap = dst->linesize[0] - width; - - for(y=0;y> SCALEBITS; - q++; - p += 3; - } - p += src_wrap; - q += dst_wrap; - } -} - -static void gray_to_rgb24(AVPicture *dst, AVPicture *src, - int width, int height) -{ - const unsigned char *p; - unsigned char *q; - int r, dst_wrap, src_wrap; - int x, y; - - p = src->data[0]; - src_wrap = src->linesize[0] - width; - - q = dst->data[0]; - dst_wrap = dst->linesize[0] - 3 * width; - - for(y=0;y