comparison imgconvert.c @ 2366:270666128b07 libavcodec

YUV420P to UYVY422 conversion patch by (Luca Abeni <lucabe72 >< email >< it>)
author michael
date Wed, 24 Nov 2004 22:54:16 +0000
parents fe1986d6230f
children 18b8b2dcc037
comparison
equal deleted inserted replaced
2365:b76a4977447a 2366:270666128b07
953 cb2 += src->linesize[1]; 953 cb2 += src->linesize[1];
954 cr2 += src->linesize[2]; 954 cr2 += src->linesize[2];
955 } 955 }
956 } 956 }
957 957
958 static void yuv420p_to_uyvy422(AVPicture *dst, const AVPicture *src,
959 int width, int height)
960 {
961 int w, h;
962 uint8_t *line1, *line2, *linesrc = dst->data[0];
963 uint8_t *lum1, *lum2, *lumsrc = src->data[0];
964 uint8_t *cb1, *cb2 = src->data[1];
965 uint8_t *cr1, *cr2 = src->data[2];
966
967 for(h = height / 2; h--;) {
968 line1 = linesrc;
969 line2 = linesrc + dst->linesize[0];
970
971 lum1 = lumsrc;
972 lum2 = lumsrc + src->linesize[0];
973
974 cb1 = cb2;
975 cr1 = cr2;
976
977 for(w = width / 2; w--;) {
978 *line1++ = *line2++ = *cb1++;
979 *line1++ = *lum1++; *line2++ = *lum2++;
980 *line1++ = *line2++ = *cr1++;
981 *line1++ = *lum1++; *line2++ = *lum2++;
982 }
983
984 linesrc += dst->linesize[0] * 2;
985 lumsrc += src->linesize[0] * 2;
986 cb2 += src->linesize[1];
987 cr2 += src->linesize[2];
988 }
989 }
990
958 #define SCALEBITS 10 991 #define SCALEBITS 10
959 #define ONE_HALF (1 << (SCALEBITS - 1)) 992 #define ONE_HALF (1 << (SCALEBITS - 1))
960 #define FIX(x) ((int) ((x) * (1<<SCALEBITS) + 0.5)) 993 #define FIX(x) ((int) ((x) * (1<<SCALEBITS) + 0.5))
961 994
962 #define YUV_TO_RGB1_CCIR(cb1, cr1)\ 995 #define YUV_TO_RGB1_CCIR(cb1, cr1)\
1679 [PIX_FMT_RGB24] = { 1712 [PIX_FMT_RGB24] = {
1680 .convert = yuv420p_to_rgb24 1713 .convert = yuv420p_to_rgb24
1681 }, 1714 },
1682 [PIX_FMT_RGBA32] = { 1715 [PIX_FMT_RGBA32] = {
1683 .convert = yuv420p_to_rgba32 1716 .convert = yuv420p_to_rgba32
1717 },
1718 [PIX_FMT_UYVY422] = {
1719 .convert = yuv420p_to_uyvy422,
1684 }, 1720 },
1685 }, 1721 },
1686 [PIX_FMT_YUV422P] = { 1722 [PIX_FMT_YUV422P] = {
1687 [PIX_FMT_YUV422] = { 1723 [PIX_FMT_YUV422] = {
1688 .convert = yuv422p_to_yuv422, 1724 .convert = yuv422p_to_yuv422,