From 0155db7f6ce338d7f75fe91d26c117f70eef7af7 Mon Sep 17 00:00:00 2001 From: Nick Kurshev Date: Tue, 6 Nov 2001 13:53:43 +0000 Subject: [PATCH] rgb24to32 now is faster Originally committed as revision 2739 to svn://svn.mplayerhq.hu/mplayer/trunk/postproc --- postproc/rgb2rgb.c | 64 ++++++++++++++++++++++++++++++++----- postproc/rgb2rgb_template.c | 64 ++++++++++++++++++++++++++++++++----- 2 files changed, 112 insertions(+), 16 deletions(-) diff --git a/postproc/rgb2rgb.c b/postproc/rgb2rgb.c index 959988245b..d38a2a95d1 100644 --- a/postproc/rgb2rgb.c +++ b/postproc/rgb2rgb.c @@ -40,20 +40,26 @@ void rgb24to32(const uint8_t *src,uint8_t *dst,unsigned src_size) __asm __volatile( PREFETCH" 32%1\n\t" "movd %1, %%mm0\n\t" - "movd 3%1, %%mm1\n\t" - "movd 6%1, %%mm2\n\t" - "movd 9%1, %%mm3\n\t" - "punpckldq %%mm1, %%mm0\n\t" - "punpckldq %%mm3, %%mm2\n\t" + "punpckldq 3%1, %%mm0\n\t" + "movd 6%1, %%mm1\n\t" + "punpckldq 9%1, %%mm1\n\t" + "movd 12%1, %%mm2\n\t" + "punpckldq 15%1, %%mm2\n\t" + "movd 18%1, %%mm3\n\t" + "punpckldq 21%1, %%mm3\n\t" "pand %%mm7, %%mm0\n\t" + "pand %%mm7, %%mm1\n\t" "pand %%mm7, %%mm2\n\t" + "pand %%mm7, %%mm3\n\t" MOVNTQ" %%mm0, %0\n\t" - MOVNTQ" %%mm2, 8%0" + MOVNTQ" %%mm1, 8%0\n\t" + MOVNTQ" %%mm2, 16%0\n\t" + MOVNTQ" %%mm3, 24%0" :"=m"(*dest) :"m"(*s) :"memory"); - dest += 16; - s += 12; + dest += 32; + s += 24; } __asm __volatile(SFENCE:::"memory"); __asm __volatile(EMMS:::"memory"); @@ -249,6 +255,48 @@ void rgb24to16(const uint8_t *src, uint8_t *dst, unsigned src_size) { unsigned j,i,num_pixels=src_size/3; uint16_t *d = (uint16_t *)dst; +#if 0/*def HAVE_MMX*/ + unsigned mm_npix; + const uint64_t mm_fc = 0xFCFCFCFCFCFCFCFCULL, mm_f8 = 0xF8F8F8F8F8F8F8F8ULL; + mm_npix = ((num_pixels)/(MMREG_SIZE*2))*(MMREG_SIZE*2); + num_pixels -= mm_npix; + __asm __volatile(PREFETCH" %0"::"m"(*src):"memory"); + __asm __volatile( + "movq %0, %%mm7\n\t" + "movq %1, %%mm6\n\t" + ::"m"(mm_fc),"m"(mm_f8)); + + for(j=0,i=0;j