diff options
author | Philip Gladstone <philipjsg@users.sourceforge.net> | 2003-02-08 15:34:25 +0000 |
---|---|---|
committer | Philip Gladstone <philipjsg@users.sourceforge.net> | 2003-02-08 15:34:25 +0000 |
commit | 16e83cbbc4023ab89c0ac7c193ab02e22ce72790 (patch) | |
tree | 5e45590d789deb89aec48e9be136f23ae3b67d20 /libavcodec/imgconvert.c | |
parent | 04bbd31b9f308532ade0ecbbd5ed11d4f7435adc (diff) | |
download | ffmpeg-16e83cbbc4023ab89c0ac7c193ab02e22ce72790.tar.gz |
Fix a bug in the conversion of rgba32->yuv420p. This resulted in garbage images
when this conversion was used. I suspect that the same bug may be lurking in
other conversions. [The assumption was that the linesize was equal to the width
for both the source and destination images. This turns out not to be true
in some cases.]
Originally committed as revision 1556 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/imgconvert.c')
-rw-r--r-- | libavcodec/imgconvert.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c index 4019631932..5a09486aa8 100644 --- a/libavcodec/imgconvert.c +++ b/libavcodec/imgconvert.c @@ -574,8 +574,8 @@ static void rgb_name ## _to_yuv420p(AVPicture *dst, AVPicture *src, \ cb = dst->data[1]; \ cr = dst->data[2]; \ \ - wrap = width; \ - wrap3 = width * BPP; \ + wrap = dst->linesize[0]; \ + wrap3 = src->linesize[0]; \ p = src->data[0]; \ for(y=0;y<height;y+=2) { \ for(x=0;x<width;x+=2) { \ @@ -620,8 +620,10 @@ static void rgb_name ## _to_yuv420p(AVPicture *dst, AVPicture *src, \ p += -wrap3 + 2 * BPP; \ lum += -wrap + 2; \ } \ - p += wrap3; \ - lum += wrap; \ + p += wrap3 + (wrap3 - width * BPP); \ + lum += wrap + (wrap - width); \ + cb += dst->linesize[1] - width / 2; \ + cr += dst->linesize[2] - width / 2; \ } \ } \ \ |