comparison imgconvert.c @ 1052:f529b09e64b7 libavcodec

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.]
author philipjsg
date Sat, 08 Feb 2003 15:34:25 +0000
parents 3f316a471019
children 6261fdd1f69d
comparison
equal deleted inserted replaced
1051:e5a9dbf597d4 1052:f529b09e64b7
572 \ 572 \
573 lum = dst->data[0]; \ 573 lum = dst->data[0]; \
574 cb = dst->data[1]; \ 574 cb = dst->data[1]; \
575 cr = dst->data[2]; \ 575 cr = dst->data[2]; \
576 \ 576 \
577 wrap = width; \ 577 wrap = dst->linesize[0]; \
578 wrap3 = width * BPP; \ 578 wrap3 = src->linesize[0]; \
579 p = src->data[0]; \ 579 p = src->data[0]; \
580 for(y=0;y<height;y+=2) { \ 580 for(y=0;y<height;y+=2) { \
581 for(x=0;x<width;x+=2) { \ 581 for(x=0;x<width;x+=2) { \
582 RGB_IN(r, g, b, p); \ 582 RGB_IN(r, g, b, p); \
583 r1 = r; \ 583 r1 = r; \
618 cb++; \ 618 cb++; \
619 cr++; \ 619 cr++; \
620 p += -wrap3 + 2 * BPP; \ 620 p += -wrap3 + 2 * BPP; \
621 lum += -wrap + 2; \ 621 lum += -wrap + 2; \
622 } \ 622 } \
623 p += wrap3; \ 623 p += wrap3 + (wrap3 - width * BPP); \
624 lum += wrap; \ 624 lum += wrap + (wrap - width); \
625 cb += dst->linesize[1] - width / 2; \
626 cr += dst->linesize[2] - width / 2; \
625 } \ 627 } \
626 } \ 628 } \
627 \ 629 \
628 static void rgb_name ## _to_gray(AVPicture *dst, AVPicture *src, \ 630 static void rgb_name ## _to_gray(AVPicture *dst, AVPicture *src, \
629 int width, int height) \ 631 int width, int height) \