| 1 |
/* $Id: deinterlace-rgb.cpp,v 1.7 2007/07/18 14:54:50 kabi Exp $ */ |
| 2 |
|
| 3 |
#include <config.h> |
| 4 |
#include <string.h> |
| 5 |
|
| 6 |
/* copied from qtrenderer.c in avifile package samples/qtvidcap */ |
| 7 |
|
| 8 |
void copy_deinterlace_24(void* outpic, const void* inpic, int xdim, int height) |
| 9 |
{ |
| 10 |
#ifdef ARCH_X86_32 |
| 11 |
for(int i=0; i<height; i++) |
| 12 |
{ |
| 13 |
char* outp=((char*)outpic)+i*xdim; |
| 14 |
const char* inp=((const char*)inpic)+i*xdim; |
| 15 |
if((i==0) || (i==height-1)) |
| 16 |
{ |
| 17 |
memcpy(outp, inp, xdim); |
| 18 |
continue; |
| 19 |
} |
| 20 |
int count=xdim/8; |
| 21 |
__asm__ __volatile__ ( |
| 22 |
"movl %2, %%esi\n\t" |
| 23 |
"movl %3, %%edi\n\t" |
| 24 |
"pxor %%mm3, %%mm3\n\t" |
| 25 |
"1:\n\t" |
| 26 |
"movq (%%ecx, %%esi), %%mm0\n\t" |
| 27 |
"movq (%%ecx), %%mm1\n\t" |
| 28 |
"movq %%mm1, %%mm2\n\t" |
| 29 |
"pavgb %%mm0, %%mm2\n\t" |
| 30 |
"psadbw %%mm2, %%mm3\n\t" |
| 31 |
"movd %%mm3, %%eax\n\t" |
| 32 |
"cmpl $48, %%eax\n\t" |
| 33 |
"jb 2f\n\t" |
| 34 |
"pavgb %%mm1, %%mm0\n\t" |
| 35 |
"2:\n\t" |
| 36 |
"movq %%mm0, (%%edx)\n\t" |
| 37 |
"addl $8, %%ecx\n\t" |
| 38 |
"addl $8, %%edx\n\t" |
| 39 |
"decl %%edi\n\t" |
| 40 |
"jnz 1b\n\t" |
| 41 |
: |
| 42 |
: "c" (inp-xdim), "d" (outp), "r" (xdim), "r" (count) |
| 43 |
: "esi", "edi" |
| 44 |
); |
| 45 |
} |
| 46 |
__asm__ __volatile__ ("emms\n\t"); |
| 47 |
#else |
| 48 |
#warning missing copy_deinterlace_24 |
| 49 |
#endif |
| 50 |
} |