summaryrefslogtreecommitdiffstats
path: root/postproc
diff options
context:
space:
mode:
authormichael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-10-23 01:46:50 +0000
committermichael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-10-23 01:46:50 +0000
commit3c0fdf13164623978f4a7db18f7ff6767990f9e8 (patch)
treec296f4296ef57629d698f6254b8f2616eb617630 /postproc
parent67850eee3b2e74884412ea015661dfcb3fd8111b (diff)
downloadmpv-3c0fdf13164623978f4a7db18f7ff6767990f9e8.tar.bz2
mpv-3c0fdf13164623978f4a7db18f7ff6767990f9e8.tar.xz
brightness / contrast fix/copy optimizations +2% speedup
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2402 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'postproc')
-rw-r--r--postproc/postprocess.c36
-rw-r--r--postproc/postprocess_template.c36
2 files changed, 30 insertions, 42 deletions
diff --git a/postproc/postprocess.c b/postproc/postprocess.c
index 3ea0031d00..df2cd3cb3b 100644
--- a/postproc/postprocess.c
+++ b/postproc/postprocess.c
@@ -2478,8 +2478,6 @@ int getPpModeForQuality(int quality){
return modes[quality];
}
-//} // extern "C"
-
/**
* Copies a block from src to dst and fixes the blacklevel
* numLines must be a multiple of 4
@@ -2493,8 +2491,6 @@ static inline void blockCopy(uint8_t dst[], int dstStride, uint8_t src[], int sr
{
#ifdef HAVE_MMX
asm volatile(
- "movl %4, %%eax \n\t"
- "movl %%eax, temp0\n\t"
"pushl %0 \n\t"
"pushl %1 \n\t"
"leal (%2,%2), %%eax \n\t"
@@ -2505,47 +2501,45 @@ static inline void blockCopy(uint8_t dst[], int dstStride, uint8_t src[], int sr
#define SCALED_CPY \
"movq (%0), %%mm0 \n\t"\
- "movq (%0,%2), %%mm1 \n\t"\
- "movq %%mm0, %%mm5 \n\t"\
+ "movq (%0), %%mm5 \n\t"\
"punpcklbw %%mm4, %%mm0 \n\t"\
"punpckhbw %%mm4, %%mm5 \n\t"\
"psubw %%mm2, %%mm0 \n\t"\
"psubw %%mm2, %%mm5 \n\t"\
+ "movq (%0,%2), %%mm1 \n\t"\
"psllw $6, %%mm0 \n\t"\
"psllw $6, %%mm5 \n\t"\
"pmulhw %%mm3, %%mm0 \n\t"\
+ "movq (%0,%2), %%mm6 \n\t"\
"pmulhw %%mm3, %%mm5 \n\t"\
- "packuswb %%mm5, %%mm0 \n\t"\
- "movq %%mm0, (%1) \n\t"\
- "movq %%mm1, %%mm5 \n\t"\
"punpcklbw %%mm4, %%mm1 \n\t"\
- "punpckhbw %%mm4, %%mm5 \n\t"\
+ "punpckhbw %%mm4, %%mm6 \n\t"\
"psubw %%mm2, %%mm1 \n\t"\
- "psubw %%mm2, %%mm5 \n\t"\
+ "psubw %%mm2, %%mm6 \n\t"\
"psllw $6, %%mm1 \n\t"\
- "psllw $6, %%mm5 \n\t"\
+ "psllw $6, %%mm6 \n\t"\
"pmulhw %%mm3, %%mm1 \n\t"\
- "pmulhw %%mm3, %%mm5 \n\t"\
- "packuswb %%mm5, %%mm1 \n\t"\
+ "pmulhw %%mm3, %%mm6 \n\t"\
+ "addl %%eax, %0 \n\t"\
+ "packuswb %%mm5, %%mm0 \n\t"\
+ "packuswb %%mm6, %%mm1 \n\t"\
+ "movq %%mm0, (%1) \n\t"\
"movq %%mm1, (%1, %3) \n\t"\
- "1: \n\t"
SCALED_CPY
- "addl %%eax, %0 \n\t"
"addl %%ebx, %1 \n\t"
SCALED_CPY
- "addl %%eax, %0 \n\t"
"addl %%ebx, %1 \n\t"
- "decl temp0 \n\t"
- "jnz 1b \n\t"
+SCALED_CPY
+ "addl %%ebx, %1 \n\t"
+SCALED_CPY
"popl %1 \n\t"
"popl %0 \n\t"
: : "r" (src),
"r" (dst),
"r" (srcStride),
- "r" (dstStride),
- "m" (numLines>>2)
+ "r" (dstStride)
: "%eax", "%ebx"
);
#else
diff --git a/postproc/postprocess_template.c b/postproc/postprocess_template.c
index 3ea0031d00..df2cd3cb3b 100644
--- a/postproc/postprocess_template.c
+++ b/postproc/postprocess_template.c
@@ -2478,8 +2478,6 @@ int getPpModeForQuality(int quality){
return modes[quality];
}
-//} // extern "C"
-
/**
* Copies a block from src to dst and fixes the blacklevel
* numLines must be a multiple of 4
@@ -2493,8 +2491,6 @@ static inline void blockCopy(uint8_t dst[], int dstStride, uint8_t src[], int sr
{
#ifdef HAVE_MMX
asm volatile(
- "movl %4, %%eax \n\t"
- "movl %%eax, temp0\n\t"
"pushl %0 \n\t"
"pushl %1 \n\t"
"leal (%2,%2), %%eax \n\t"
@@ -2505,47 +2501,45 @@ static inline void blockCopy(uint8_t dst[], int dstStride, uint8_t src[], int sr
#define SCALED_CPY \
"movq (%0), %%mm0 \n\t"\
- "movq (%0,%2), %%mm1 \n\t"\
- "movq %%mm0, %%mm5 \n\t"\
+ "movq (%0), %%mm5 \n\t"\
"punpcklbw %%mm4, %%mm0 \n\t"\
"punpckhbw %%mm4, %%mm5 \n\t"\
"psubw %%mm2, %%mm0 \n\t"\
"psubw %%mm2, %%mm5 \n\t"\
+ "movq (%0,%2), %%mm1 \n\t"\
"psllw $6, %%mm0 \n\t"\
"psllw $6, %%mm5 \n\t"\
"pmulhw %%mm3, %%mm0 \n\t"\
+ "movq (%0,%2), %%mm6 \n\t"\
"pmulhw %%mm3, %%mm5 \n\t"\
- "packuswb %%mm5, %%mm0 \n\t"\
- "movq %%mm0, (%1) \n\t"\
- "movq %%mm1, %%mm5 \n\t"\
"punpcklbw %%mm4, %%mm1 \n\t"\
- "punpckhbw %%mm4, %%mm5 \n\t"\
+ "punpckhbw %%mm4, %%mm6 \n\t"\
"psubw %%mm2, %%mm1 \n\t"\
- "psubw %%mm2, %%mm5 \n\t"\
+ "psubw %%mm2, %%mm6 \n\t"\
"psllw $6, %%mm1 \n\t"\
- "psllw $6, %%mm5 \n\t"\
+ "psllw $6, %%mm6 \n\t"\
"pmulhw %%mm3, %%mm1 \n\t"\
- "pmulhw %%mm3, %%mm5 \n\t"\
- "packuswb %%mm5, %%mm1 \n\t"\
+ "pmulhw %%mm3, %%mm6 \n\t"\
+ "addl %%eax, %0 \n\t"\
+ "packuswb %%mm5, %%mm0 \n\t"\
+ "packuswb %%mm6, %%mm1 \n\t"\
+ "movq %%mm0, (%1) \n\t"\
"movq %%mm1, (%1, %3) \n\t"\
- "1: \n\t"
SCALED_CPY
- "addl %%eax, %0 \n\t"
"addl %%ebx, %1 \n\t"
SCALED_CPY
- "addl %%eax, %0 \n\t"
"addl %%ebx, %1 \n\t"
- "decl temp0 \n\t"
- "jnz 1b \n\t"
+SCALED_CPY
+ "addl %%ebx, %1 \n\t"
+SCALED_CPY
"popl %1 \n\t"
"popl %0 \n\t"
: : "r" (src),
"r" (dst),
"r" (srcStride),
- "r" (dstStride),
- "m" (numLines>>2)
+ "r" (dstStride)
: "%eax", "%ebx"
);
#else