comparison imgconvert.c @ 736:918756bffda2 libavcodec

minimum support for YUV411P (new combined scaler/converter will handle that better...)
author bellard
date Tue, 08 Oct 2002 17:42:33 +0000
parents d6955d0d7d27
children f720b01c0fd5
comparison
equal deleted inserted replaced
735:b4bf95260ffe 736:918756bffda2
393 s1 ++; 393 s1 ++;
394 d++; 394 d++;
395 } 395 }
396 if (height%2) 396 if (height%2)
397 src += src_wrap; 397 src += src_wrap;
398 dst += dst_wrap;
399 }
400 }
401
402 /* 1x2 -> 2x1. width and height are given for the source picture */
403 static void conv411(UINT8 *dst, int dst_wrap,
404 UINT8 *src, int src_wrap,
405 int width, int height)
406 {
407 int w, c;
408 UINT8 *s1, *s2, *d;
409
410 for(;height > 0; height -= 2) {
411 s1 = src;
412 s2 = src + src_wrap;
413 d = dst;
414 for(w = width;w > 0; w--) {
415 c = (s1[0] + s2[0]) >> 1;
416 d[0] = c;
417 d[1] = c;
418 s1++;
419 s2++;
420 d += 2;
421 }
422 src += src_wrap * 2;
398 dst += dst_wrap; 423 dst += dst_wrap;
399 } 424 }
400 } 425 }
401 426
402 static void img_copy(UINT8 *dst, int dst_wrap, 427 static void img_copy(UINT8 *dst, int dst_wrap,
626 return -1; 651 return -1;
627 } 652 }
628 } else if (dst_pix_fmt == PIX_FMT_YUV420P) { 653 } else if (dst_pix_fmt == PIX_FMT_YUV420P) {
629 654
630 switch(pix_fmt) { 655 switch(pix_fmt) {
656 case PIX_FMT_YUV411P:
657 img_copy(dst->data[0], dst->linesize[0],
658 src->data[0], src->linesize[0],
659 width, height);
660 conv411(dst->data[1], dst->linesize[1],
661 src->data[1], src->linesize[1],
662 width / 4, height);
663 conv411(dst->data[2], dst->linesize[2],
664 src->data[2], src->linesize[2],
665 width / 4, height);
666 break;
631 case PIX_FMT_YUV410P: 667 case PIX_FMT_YUV410P:
632 img_copy(dst->data[0], dst->linesize[0], 668 img_copy(dst->data[0], dst->linesize[0],
633 src->data[0], src->linesize[0], 669 src->data[0], src->linesize[0],
634 width, height); 670 width, height);
635 grow22(dst->data[1], dst->linesize[1], 671 grow22(dst->data[1], dst->linesize[1],