Index: rgb2rgb_template.c =================================================================== RCS file: /cvsroot/mplayer/main/postproc/rgb2rgb_template.c,v retrieving revision 1.69 diff -u -r1.69 rgb2rgb_template.c --- rgb2rgb_template.c 2 May 2004 14:26:28 -0000 1.69 +++ rgb2rgb_template.c 10 Aug 2004 13:19:18 -0000 @@ -2056,9 +2056,8 @@ /** * - * height should be a multiple of 2 and width should be a multiple of 2 (if this is a - * problem for anyone then tell me, and ill fix it) - * chrominance data is only taken from every secound line others are ignored in the C version FIXME write HQ version + * if width and height aren't a multiple of two the last line / column is + * silently ignored */ static inline void RENAME(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, unsigned int width, unsigned int height, @@ -2066,9 +2065,11 @@ { unsigned y; const unsigned chromWidth= width>>1; -#ifdef HAVE_MMX - for(y=0; y>RGB2YUV_SHIFT) + 16; - unsigned int V = ((RV*r + GV*g + BV*b)>>RGB2YUV_SHIFT) + 128; - unsigned int U = ((RU*r + GU*g + BU*b)>>RGB2YUV_SHIFT) + 128; + V = RV*r + GV*g + BV*b; + U = RU*r + GU*g + BU*b; - udst[i] = U; - vdst[i] = V; ydst[2*i] = Y; b= src[6*i+3]; @@ -2328,6 +2320,10 @@ r= src[6*i+5]; Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16; +#ifndef FAST_BGR2YV12 + V += RV*r + GV*g + BV*b; + U += RU*r + GU*g + BU*b; +#endif ydst[2*i+1] = Y; } ydst += lumStride; @@ -2341,6 +2337,10 @@ unsigned int Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16; +#ifndef FAST_BGR2YV12 + V += RV*r + GV*g + BV*b; + U += RU*r + GU*g + BU*b; +#endif ydst[2*i] = Y; b= src[6*i+3]; @@ -2348,13 +2348,34 @@ r= src[6*i+5]; Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16; +#ifndef FAST_BGR2YV12 + V += RV*r + GV*g + BV*b; + U += RU*r + GU*g + BU*b; +#endif ydst[2*i+1] = Y; + +#ifndef FAST_BGR2YV12 + V = (V >> (RGB2YUV_SHIFT + 2)) + 128; + U = (U >> (RGB2YUV_SHIFT + 2)) + 128; +#else + V = (V >> RGB2YUV_SHIFT) + 128; + U = (U >> RGB2YUV_SHIFT) + 128; +#endif + vdst[i] = V; + udst[i] = U; } udst += chromStride; vdst += chromStride; ydst += lumStride; src += srcStride; +#endif } + +#ifdef HAVE_MMX + asm volatile( EMMS" \n\t" + SFENCE" \n\t" + :::"memory"); +#endif } void RENAME(interleaveBytes)(uint8_t *src1, uint8_t *src2, uint8_t *dest,