diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2001-10-25 22:50:03 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2001-10-25 22:50:03 +0000 |
commit | e0f8ffae998bc34de88191c476fdd3020ed3c3ac (patch) | |
tree | 0a7cf346a70611afd1a71dd82bba8bb0a20eba3d /postproc | |
parent | cf76316aa3c8e63476d1e1663687c41c09fb4ac4 (diff) | |
download | ffmpeg-e0f8ffae998bc34de88191c476fdd3020ed3c3ac.tar.gz |
3dnow dering
Originally committed as revision 2476 to svn://svn.mplayerhq.hu/mplayer/trunk/postproc
Diffstat (limited to 'postproc')
-rw-r--r-- | postproc/postprocess.c | 42 | ||||
-rw-r--r-- | postproc/postprocess_template.c | 42 |
2 files changed, 64 insertions, 20 deletions
diff --git a/postproc/postprocess.c b/postproc/postprocess.c index e872c55b8c..dbe60191fb 100644 --- a/postproc/postprocess.c +++ b/postproc/postprocess.c @@ -26,7 +26,7 @@ isHorizDC Ec Ec isHorizMinMaxOk a E doHorizLowPass E e e doHorizDefFilter Ec Ec Ec -deRing e +deRing e e* Vertical RKAlgo1 E a a Horizontal RKAlgo1 a a Vertical X1 a E E @@ -1808,7 +1808,7 @@ Implemented Exact 7-Tap static inline void dering(uint8_t src[], int stride, int QP) { -#ifdef HAVE_MMX2 +#if defined (HAVE_MMX2) || defined (HAVE_3DNOW) asm volatile( "movq pQPb, %%mm0 \n\t" "paddusb %%mm0, %%mm0 \n\t" @@ -1821,11 +1821,20 @@ static inline void dering(uint8_t src[], int stride, int QP) "pcmpeqb %%mm6, %%mm6 \n\t" "pxor %%mm7, %%mm7 \n\t" - +#ifdef HAVE_MMX2 #define FIND_MIN_MAX(addr)\ "movq " #addr ", %%mm0 \n\t"\ "pminub %%mm0, %%mm6 \n\t"\ "pmaxub %%mm0, %%mm7 \n\t" +#else +#define FIND_MIN_MAX(addr)\ + "movq " #addr ", %%mm0 \n\t"\ + "movq %%mm6, %%mm1 \n\t"\ + "psubusb %%mm0, %%mm7 \n\t"\ + "paddb %%mm0, %%mm7 \n\t"\ + "psubusb %%mm0, %%mm1 \n\t"\ + "psubb %%mm1, %%mm6 \n\t" +#endif FIND_MIN_MAX((%%eax)) FIND_MIN_MAX((%%eax, %1)) @@ -1838,36 +1847,49 @@ FIND_MIN_MAX((%0, %1, 8)) "movq %%mm6, %%mm4 \n\t" "psrlq $8, %%mm6 \n\t" - "pminub %%mm4, %%mm6 \n\t" // min of pixels #ifdef HAVE_MMX2 + "pminub %%mm4, %%mm6 \n\t" // min of pixels "pshufw $0xF9, %%mm6, %%mm4 \n\t" "pminub %%mm4, %%mm6 \n\t" // min of pixels "pshufw $0xFE, %%mm6, %%mm4 \n\t" + "pminub %%mm4, %%mm6 \n\t" #else + "movq %%mm6, %%mm1 \n\t" + "psubusb %%mm4, %%mm1 \n\t" + "psubb %%mm1, %%mm6 \n\t" "movq %%mm6, %%mm4 \n\t" "psrlq $16, %%mm6 \n\t" - "pminub %%mm4, %%mm6 \n\t" + "movq %%mm6, %%mm1 \n\t" + "psubusb %%mm4, %%mm1 \n\t" + "psubb %%mm1, %%mm6 \n\t" "movq %%mm6, %%mm4 \n\t" "psrlq $32, %%mm6 \n\t" + "movq %%mm6, %%mm1 \n\t" + "psubusb %%mm4, %%mm1 \n\t" + "psubb %%mm1, %%mm6 \n\t" #endif - "pminub %%mm4, %%mm6 \n\t" "movq %%mm7, %%mm4 \n\t" "psrlq $8, %%mm7 \n\t" - "pmaxub %%mm4, %%mm7 \n\t" // max of pixels #ifdef HAVE_MMX2 + "pmaxub %%mm4, %%mm7 \n\t" // max of pixels "pshufw $0xF9, %%mm7, %%mm4 \n\t" - "pmaxub %%mm4, %%mm7 \n\t" // min of pixels + "pmaxub %%mm4, %%mm7 \n\t" "pshufw $0xFE, %%mm7, %%mm4 \n\t" + "pmaxub %%mm4, %%mm7 \n\t" #else + "psubusb %%mm4, %%mm7 \n\t" + "paddb %%mm4, %%mm7 \n\t" "movq %%mm7, %%mm4 \n\t" "psrlq $16, %%mm7 \n\t" - "pmaxub %%mm4, %%mm7 \n\t" + "psubusb %%mm4, %%mm7 \n\t" + "paddb %%mm4, %%mm7 \n\t" "movq %%mm7, %%mm4 \n\t" "psrlq $32, %%mm7 \n\t" + "psubusb %%mm4, %%mm7 \n\t" + "paddb %%mm4, %%mm7 \n\t" #endif - "pmaxub %%mm4, %%mm7 \n\t" PAVGB(%%mm6, %%mm7) // a=(max + min)/2 "punpcklbw %%mm7, %%mm7 \n\t" "punpcklbw %%mm7, %%mm7 \n\t" diff --git a/postproc/postprocess_template.c b/postproc/postprocess_template.c index e872c55b8c..dbe60191fb 100644 --- a/postproc/postprocess_template.c +++ b/postproc/postprocess_template.c @@ -26,7 +26,7 @@ isHorizDC Ec Ec isHorizMinMaxOk a E doHorizLowPass E e e doHorizDefFilter Ec Ec Ec -deRing e +deRing e e* Vertical RKAlgo1 E a a Horizontal RKAlgo1 a a Vertical X1 a E E @@ -1808,7 +1808,7 @@ Implemented Exact 7-Tap static inline void dering(uint8_t src[], int stride, int QP) { -#ifdef HAVE_MMX2 +#if defined (HAVE_MMX2) || defined (HAVE_3DNOW) asm volatile( "movq pQPb, %%mm0 \n\t" "paddusb %%mm0, %%mm0 \n\t" @@ -1821,11 +1821,20 @@ static inline void dering(uint8_t src[], int stride, int QP) "pcmpeqb %%mm6, %%mm6 \n\t" "pxor %%mm7, %%mm7 \n\t" - +#ifdef HAVE_MMX2 #define FIND_MIN_MAX(addr)\ "movq " #addr ", %%mm0 \n\t"\ "pminub %%mm0, %%mm6 \n\t"\ "pmaxub %%mm0, %%mm7 \n\t" +#else +#define FIND_MIN_MAX(addr)\ + "movq " #addr ", %%mm0 \n\t"\ + "movq %%mm6, %%mm1 \n\t"\ + "psubusb %%mm0, %%mm7 \n\t"\ + "paddb %%mm0, %%mm7 \n\t"\ + "psubusb %%mm0, %%mm1 \n\t"\ + "psubb %%mm1, %%mm6 \n\t" +#endif FIND_MIN_MAX((%%eax)) FIND_MIN_MAX((%%eax, %1)) @@ -1838,36 +1847,49 @@ FIND_MIN_MAX((%0, %1, 8)) "movq %%mm6, %%mm4 \n\t" "psrlq $8, %%mm6 \n\t" - "pminub %%mm4, %%mm6 \n\t" // min of pixels #ifdef HAVE_MMX2 + "pminub %%mm4, %%mm6 \n\t" // min of pixels "pshufw $0xF9, %%mm6, %%mm4 \n\t" "pminub %%mm4, %%mm6 \n\t" // min of pixels "pshufw $0xFE, %%mm6, %%mm4 \n\t" + "pminub %%mm4, %%mm6 \n\t" #else + "movq %%mm6, %%mm1 \n\t" + "psubusb %%mm4, %%mm1 \n\t" + "psubb %%mm1, %%mm6 \n\t" "movq %%mm6, %%mm4 \n\t" "psrlq $16, %%mm6 \n\t" - "pminub %%mm4, %%mm6 \n\t" + "movq %%mm6, %%mm1 \n\t" + "psubusb %%mm4, %%mm1 \n\t" + "psubb %%mm1, %%mm6 \n\t" "movq %%mm6, %%mm4 \n\t" "psrlq $32, %%mm6 \n\t" + "movq %%mm6, %%mm1 \n\t" + "psubusb %%mm4, %%mm1 \n\t" + "psubb %%mm1, %%mm6 \n\t" #endif - "pminub %%mm4, %%mm6 \n\t" "movq %%mm7, %%mm4 \n\t" "psrlq $8, %%mm7 \n\t" - "pmaxub %%mm4, %%mm7 \n\t" // max of pixels #ifdef HAVE_MMX2 + "pmaxub %%mm4, %%mm7 \n\t" // max of pixels "pshufw $0xF9, %%mm7, %%mm4 \n\t" - "pmaxub %%mm4, %%mm7 \n\t" // min of pixels + "pmaxub %%mm4, %%mm7 \n\t" "pshufw $0xFE, %%mm7, %%mm4 \n\t" + "pmaxub %%mm4, %%mm7 \n\t" #else + "psubusb %%mm4, %%mm7 \n\t" + "paddb %%mm4, %%mm7 \n\t" "movq %%mm7, %%mm4 \n\t" "psrlq $16, %%mm7 \n\t" - "pmaxub %%mm4, %%mm7 \n\t" + "psubusb %%mm4, %%mm7 \n\t" + "paddb %%mm4, %%mm7 \n\t" "movq %%mm7, %%mm4 \n\t" "psrlq $32, %%mm7 \n\t" + "psubusb %%mm4, %%mm7 \n\t" + "paddb %%mm4, %%mm7 \n\t" #endif - "pmaxub %%mm4, %%mm7 \n\t" PAVGB(%%mm6, %%mm7) // a=(max + min)/2 "punpcklbw %%mm7, %%mm7 \n\t" "punpcklbw %%mm7, %%mm7 \n\t" |