Commit 34cc9aa4 authored by michael's avatar michael

fixed yv12toyuy2


git-svn-id: file:///var/local/repositories/mplayer/trunk/postproc@2724 b3059339-0415-0410-9bf9-f77b7e298cf2
parent 9fa387d8
......@@ -291,11 +291,17 @@ void palette8torgb15(const uint8_t *src, uint8_t *dst, unsigned num_pixels, cons
}
/**
*
* num_pixels must be a multiple of 16 for the MMX version
* width must be a multiple of 16 for the MMX version
*/
void yv12toyuy2(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, unsigned num_pixels)
void yv12toyuy2(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
int width, int height, int lumStride, int chromStride, int dstStride)
{
int y;
const int chromWidth= width>>1;
for(y=0; y<height; y++)
{
#ifdef HAVE_MMX
//FIXME handle 2 lines a once (fewer prefetch, reuse some chrom, but very likely limited by mem anyway)
asm volatile(
"xorl %%eax, %%eax \n\t"
"1: \n\t"
......@@ -325,22 +331,31 @@ void yv12toyuy2(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, u
"addl $8, %%eax \n\t"
"cmpl %4, %%eax \n\t"
" jb 1b \n\t"
EMMS" \n\t"
SFENCE
::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "r" (num_pixels>>1)
: "memory", "%eax"
::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "r" (chromWidth)
: "%eax"
);
#else
int i;
num_pixels>>=1;
for(i=0; i<num_pixels; i++)
for(i=0; i<chromWidth; i++)
{
dst[4*i+0] = ysrc[2*i+0];
dst[4*i+1] = usrc[i];
dst[4*i+2] = ysrc[2*i+1];
dst[4*i+3] = vsrc[i];
}
#endif
if(y&1)
{
usrc += chromStride;
vsrc += chromStride;
}
ysrc += lumStride;
dst += dstStride;
}
#ifdef HAVE_MMX
asm( EMMS" \n\t"
SFENCE" \n\t"
:::"memory");
#endif
}
......
......@@ -21,8 +21,8 @@ extern void palette8torgb16(const uint8_t *src, uint8_t *dst, unsigned num_pixel
extern void palette8torgb15(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette);
extern void palette8torgb24(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette);
extern void yv12toyuy2(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, unsigned num_pixels);
extern void yv12toyuy2(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
int width, int height, int lumStride, int chromStride, int dstStride);
extern void yuy2toyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, unsigned num_pixels);
#endif
......@@ -291,11 +291,17 @@ void palette8torgb15(const uint8_t *src, uint8_t *dst, unsigned num_pixels, cons
}
/**
*
* num_pixels must be a multiple of 16 for the MMX version
* width must be a multiple of 16 for the MMX version
*/
void yv12toyuy2(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, unsigned num_pixels)
void yv12toyuy2(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
int width, int height, int lumStride, int chromStride, int dstStride)
{
int y;
const int chromWidth= width>>1;
for(y=0; y<height; y++)
{
#ifdef HAVE_MMX
//FIXME handle 2 lines a once (fewer prefetch, reuse some chrom, but very likely limited by mem anyway)
asm volatile(
"xorl %%eax, %%eax \n\t"
"1: \n\t"
......@@ -325,22 +331,31 @@ void yv12toyuy2(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, u
"addl $8, %%eax \n\t"
"cmpl %4, %%eax \n\t"
" jb 1b \n\t"
EMMS" \n\t"
SFENCE
::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "r" (num_pixels>>1)
: "memory", "%eax"
::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "r" (chromWidth)
: "%eax"
);
#else
int i;
num_pixels>>=1;
for(i=0; i<num_pixels; i++)
for(i=0; i<chromWidth; i++)
{
dst[4*i+0] = ysrc[2*i+0];
dst[4*i+1] = usrc[i];
dst[4*i+2] = ysrc[2*i+1];
dst[4*i+3] = vsrc[i];
}
#endif
if(y&1)
{
usrc += chromStride;
vsrc += chromStride;
}
ysrc += lumStride;
dst += dstStride;
}
#ifdef HAVE_MMX
asm( EMMS" \n\t"
SFENCE" \n\t"
:::"memory");
#endif
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment