comparison imgconvert.c @ 2326:fe1986d6230f libavcodec

YUV420P to YUV422 conversion routine by (Danny Laarmans <dlaarmans at androme dot com>)
author michael
date Wed, 27 Oct 2004 21:42:26 +0000
parents 760e8105e766
children 270666128b07
comparison
equal deleted inserted replaced
2325:1180a04d64c5 2326:fe1986d6230f
920 cr1 += dst->linesize[2]; 920 cr1 += dst->linesize[2];
921 } 921 }
922 } 922 }
923 923
924 924
925 static void yuv420p_to_yuv422(AVPicture *dst, const AVPicture *src,
926 int width, int height)
927 {
928 int w, h;
929 uint8_t *line1, *line2, *linesrc = dst->data[0];
930 uint8_t *lum1, *lum2, *lumsrc = src->data[0];
931 uint8_t *cb1, *cb2 = src->data[1];
932 uint8_t *cr1, *cr2 = src->data[2];
933
934 for(h = height / 2; h--;) {
935 line1 = linesrc;
936 line2 = linesrc + dst->linesize[0];
937
938 lum1 = lumsrc;
939 lum2 = lumsrc + src->linesize[0];
940
941 cb1 = cb2;
942 cr1 = cr2;
943
944 for(w = width / 2; w--;) {
945 *line1++ = *lum1++; *line2++ = *lum2++;
946 *line1++ = *line2++ = *cb1++;
947 *line1++ = *lum1++; *line2++ = *lum2++;
948 *line1++ = *line2++ = *cr1++;
949 }
950
951 linesrc += dst->linesize[0] * 2;
952 lumsrc += src->linesize[0] * 2;
953 cb2 += src->linesize[1];
954 cr2 += src->linesize[2];
955 }
956 }
957
925 #define SCALEBITS 10 958 #define SCALEBITS 10
926 #define ONE_HALF (1 << (SCALEBITS - 1)) 959 #define ONE_HALF (1 << (SCALEBITS - 1))
927 #define FIX(x) ((int) ((x) * (1<<SCALEBITS) + 0.5)) 960 #define FIX(x) ((int) ((x) * (1<<SCALEBITS) + 0.5))
928 961
929 #define YUV_TO_RGB1_CCIR(cb1, cr1)\ 962 #define YUV_TO_RGB1_CCIR(cb1, cr1)\
1629 1662
1630 The other conversion functions are just optimisations for common cases. 1663 The other conversion functions are just optimisations for common cases.
1631 */ 1664 */
1632 static ConvertEntry convert_table[PIX_FMT_NB][PIX_FMT_NB] = { 1665 static ConvertEntry convert_table[PIX_FMT_NB][PIX_FMT_NB] = {
1633 [PIX_FMT_YUV420P] = { 1666 [PIX_FMT_YUV420P] = {
1667 [PIX_FMT_YUV422] = {
1668 .convert = yuv420p_to_yuv422,
1669 },
1634 [PIX_FMT_RGB555] = { 1670 [PIX_FMT_RGB555] = {
1635 .convert = yuv420p_to_rgb555 1671 .convert = yuv420p_to_rgb555
1636 }, 1672 },
1637 [PIX_FMT_RGB565] = { 1673 [PIX_FMT_RGB565] = {
1638 .convert = yuv420p_to_rgb565 1674 .convert = yuv420p_to_rgb565