# HG changeset patch # User bellard # Date 1043101579 0 # Node ID d651df6678983bd008f5d598d5e5c87875589d0d # Parent 2d7c9f5738def87efa0039892c8b3d980e805cde added gray<->RGB functions - fixed rgb<->yuv functions for non RGB24 case diff -r 2d7c9f5738de -r d651df667898 imgconvert.c --- a/imgconvert.c Mon Jan 20 20:37:24 2003 +0000 +++ b/imgconvert.c Mon Jan 20 22:26:19 2003 +0000 @@ -520,7 +520,7 @@ 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