comparison imgconvert.c @ 1353:cfc80b3a4ada libavcodec

flash video (flv) support patch by (Garrick Meeker <gmeeker at theoryllc dot com>)
author michaelni
date Wed, 09 Jul 2003 23:10:59 +0000
parents 8988af3ae1e8
children f53d31c5eac9
comparison
equal deleted inserted replaced
1352:e8ff4783f188 1353:cfc80b3a4ada
591 static void yuv422_to_yuv420p(AVPicture *dst, AVPicture *src, 591 static void yuv422_to_yuv420p(AVPicture *dst, AVPicture *src,
592 int width, int height) 592 int width, int height)
593 { 593 {
594 const uint8_t *p, *p1; 594 const uint8_t *p, *p1;
595 uint8_t *lum, *cr, *cb, *lum1, *cr1, *cb1; 595 uint8_t *lum, *cr, *cb, *lum1, *cr1, *cb1;
596 int x; 596 int w;
597 597
598 p1 = src->data[0]; 598 p1 = src->data[0];
599 lum1 = dst->data[0]; 599 lum1 = dst->data[0];
600 cb1 = dst->data[1]; 600 cb1 = dst->data[1];
601 cr1 = dst->data[2]; 601 cr1 = dst->data[2];
602 602
603 for(;height >= 2; height -= 2) { 603 for(;height >= 1; height -= 2) {
604 p = p1; 604 p = p1;
605 lum = lum1; 605 lum = lum1;
606 cb = cb1; 606 cb = cb1;
607 cr = cr1; 607 cr = cr1;
608 for(x=0;x<width;x+=2) { 608 for(w = width; w >= 2; w -= 2) {
609 lum[0] = p[0]; 609 lum[0] = p[0];
610 cb[0] = p[1]; 610 cb[0] = p[1];
611 lum[1] = p[2]; 611 lum[1] = p[2];
612 cr[0] = p[3]; 612 cr[0] = p[3];
613 p += 4; 613 p += 4;
614 lum += 2; 614 lum += 2;
615 cb++; 615 cb++;
616 cr++; 616 cr++;
617 } 617 }
618 if (w) {
619 lum[0] = p[0];
620 cb[0] = p[1];
621 cr[0] = p[3];
622 cb++;
623 cr++;
624 }
618 p1 += src->linesize[0]; 625 p1 += src->linesize[0];
619 lum1 += dst->linesize[0]; 626 lum1 += dst->linesize[0];
620 p = p1; 627 if (height>1) {
621 lum = lum1; 628 p = p1;
622 for(x=0;x<width;x+=2) { 629 lum = lum1;
623 lum[0] = p[0]; 630 for(w = width; w >= 2; w -= 2) {
624 lum[1] = p[2]; 631 lum[0] = p[0];
625 p += 4; 632 lum[1] = p[2];
626 lum += 2; 633 p += 4;
627 } 634 lum += 2;
628 p1 += src->linesize[0]; 635 }
629 lum1 += dst->linesize[0]; 636 if (w) {
637 lum[0] = p[0];
638 }
639 p1 += src->linesize[0];
640 lum1 += dst->linesize[0];
641 }
630 cb1 += dst->linesize[1]; 642 cb1 += dst->linesize[1];
631 cr1 += dst->linesize[2]; 643 cr1 += dst->linesize[2];
632 } 644 }
633 } 645 }
634 646