Commit d04fdff1 authored by Zdenek Kabelac's avatar Zdenek Kabelac

* oops - reversed last commit

Originally committed as revision 1868 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 4704097a
...@@ -83,21 +83,16 @@ static int RENAME(dct_quantize)(MpegEncContext *s, ...@@ -83,21 +83,16 @@ static int RENAME(dct_quantize)(MpegEncContext *s,
} }
if(s->out_format == FMT_H263 && s->mpeg_quant==0){ if(s->out_format == FMT_H263 && s->mpeg_quant==0){
/* PROLOGUE */
asm volatile( asm volatile(
"movd %%eax, %%mm3 \n\t" // last_non_zero_p1 "movd %%eax, %%mm3 \n\t" // last_non_zero_p1
SPREADW(%%mm3) SPREADW(%%mm3)
"pxor %%mm7, %%mm7 \n\t" // 0 "pxor %%mm7, %%mm7 \n\t" // 0
"pxor %%mm4, %%mm4 \n\t" // 0 "pxor %%mm4, %%mm4 \n\t" // 0
"movq (%1), %%mm5 \n\t" // qmat[0] "movq (%2), %%mm5 \n\t" // qmat[0]
"pxor %%mm6, %%mm6 \n\t" "pxor %%mm6, %%mm6 \n\t"
"psubw (%2), %%mm6 \n\t" // -bias[0] "psubw (%3), %%mm6 \n\t" // -bias[0]
"movl $-128, %%eax \n\t" "movl $-128, %%eax \n\t"
: "+a" (last_non_zero_p1)
: "r" (qmat), "r" (bias)
);
/* CORE */
asm volatile(
".balign 16 \n\t" ".balign 16 \n\t"
"1: \n\t" "1: \n\t"
"pxor %%mm1, %%mm1 \n\t" // 0 "pxor %%mm1, %%mm1 \n\t" // 0
...@@ -110,19 +105,14 @@ static int RENAME(dct_quantize)(MpegEncContext *s, ...@@ -110,19 +105,14 @@ static int RENAME(dct_quantize)(MpegEncContext *s,
"por %%mm0, %%mm4 \n\t" "por %%mm0, %%mm4 \n\t"
"pxor %%mm1, %%mm0 \n\t" "pxor %%mm1, %%mm0 \n\t"
"psubw %%mm1, %%mm0 \n\t" // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i]) "psubw %%mm1, %%mm0 \n\t" // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i])
"movq %%mm0, (%3, %%eax) \n\t" "movq %%mm0, (%5, %%eax) \n\t"
"pcmpeqw %%mm7, %%mm0 \n\t" // out==0 ? 0xFF : 0x00 "pcmpeqw %%mm7, %%mm0 \n\t" // out==0 ? 0xFF : 0x00
"movq (%2, %%eax), %%mm1 \n\t" "movq (%4, %%eax), %%mm1 \n\t"
"movq %%mm7, (%1, %%eax) \n\t" // 0 "movq %%mm7, (%1, %%eax) \n\t" // 0
"pandn %%mm1, %%mm0 \n\t" "pandn %%mm1, %%mm0 \n\t"
PMAXW(%%mm0, %%mm3) PMAXW(%%mm0, %%mm3)
"addl $8, %%eax \n\t" "addl $8, %%eax \n\t"
" js 1b \n\t" " js 1b \n\t"
: "+a" (last_non_zero_p1)
: "r" (block+64), "r" (inv_zigzag_direct16+64), "r" (temp_block+64)
);
/* EPILOGUE */
asm volatile(
"movq %%mm3, %%mm0 \n\t" "movq %%mm3, %%mm0 \n\t"
"psrlq $32, %%mm3 \n\t" "psrlq $32, %%mm3 \n\t"
PMAXW(%%mm0, %%mm3) PMAXW(%%mm0, %%mm3)
...@@ -131,46 +121,48 @@ static int RENAME(dct_quantize)(MpegEncContext *s, ...@@ -131,46 +121,48 @@ static int RENAME(dct_quantize)(MpegEncContext *s,
PMAXW(%%mm0, %%mm3) PMAXW(%%mm0, %%mm3)
"movd %%mm3, %%eax \n\t" "movd %%mm3, %%eax \n\t"
"movzbl %%al, %%eax \n\t" // last_non_zero_p1 "movzbl %%al, %%eax \n\t" // last_non_zero_p1
"movd %2, %%mm1 \n\t" // max_qcoeff : "+a" (last_non_zero_p1)
: "r" (block+64), "r" (qmat), "r" (bias),
"r" (inv_zigzag_direct16+64), "r" (temp_block+64)
);
// note the asm is split cuz gcc doesnt like that many operands ...
asm volatile(
"movd %1, %%mm1 \n\t" // max_qcoeff
SPREADW(%%mm1) SPREADW(%%mm1)
"psubusw %%mm1, %%mm4 \n\t" "psubusw %%mm1, %%mm4 \n\t"
"packuswb %%mm4, %%mm4 \n\t" "packuswb %%mm4, %%mm4 \n\t"
"movd %%mm4, %1 \n\t" // *overflow "movd %%mm4, %0 \n\t" // *overflow
: "+a" (last_non_zero_p1), "=r" (*overflow) : "=g" (*overflow)
: "r" (s->max_qcoeff) : "g" (s->max_qcoeff)
); );
}else{ // FMT_H263 }else{ // FMT_H263
asm volatile( asm volatile(
"pushl %%ebp \n\t" "movd %%eax, %%mm3 \n\t" // last_non_zero_p1
"pushl %%ebx \n\t"
"movl %0, %%ebp \n\t"
"movl (%%ebp), %%ebx \n\t"
"movd %%ebx, %%mm3 \n\t" // last_non_zero_p1
SPREADW(%%mm3) SPREADW(%%mm3)
"pxor %%mm7, %%mm7 \n\t" // 0 "pxor %%mm7, %%mm7 \n\t" // 0
"pxor %%mm4, %%mm4 \n\t" // 0 "pxor %%mm4, %%mm4 \n\t" // 0
"movl $-128, %%ebx \n\t" "movl $-128, %%eax \n\t"
".balign 16 \n\t" ".balign 16 \n\t"
"1: \n\t" "1: \n\t"
"pxor %%mm1, %%mm1 \n\t" // 0 "pxor %%mm1, %%mm1 \n\t" // 0
"movq (%1, %%ebx), %%mm0 \n\t" // block[i] "movq (%1, %%eax), %%mm0 \n\t" // block[i]
"pcmpgtw %%mm0, %%mm1 \n\t" // block[i] <= 0 ? 0xFF : 0x00 "pcmpgtw %%mm0, %%mm1 \n\t" // block[i] <= 0 ? 0xFF : 0x00
"pxor %%mm1, %%mm0 \n\t" "pxor %%mm1, %%mm0 \n\t"
"psubw %%mm1, %%mm0 \n\t" // ABS(block[i]) "psubw %%mm1, %%mm0 \n\t" // ABS(block[i])
"movq (%3, %%ebx), %%mm6 \n\t" // bias[0] "movq (%3, %%eax), %%mm6 \n\t" // bias[0]
"paddusw %%mm6, %%mm0 \n\t" // ABS(block[i]) + bias[0] "paddusw %%mm6, %%mm0 \n\t" // ABS(block[i]) + bias[0]
"movq (%2, %%ebx), %%mm5 \n\t" // qmat[i] "movq (%2, %%eax), %%mm5 \n\t" // qmat[i]
"pmulhw %%mm5, %%mm0 \n\t" // (ABS(block[i])*qmat[0] + bias[0]*qmat[0])>>16 "pmulhw %%mm5, %%mm0 \n\t" // (ABS(block[i])*qmat[0] + bias[0]*qmat[0])>>16
"por %%mm0, %%mm4 \n\t" "por %%mm0, %%mm4 \n\t"
"pxor %%mm1, %%mm0 \n\t" "pxor %%mm1, %%mm0 \n\t"
"psubw %%mm1, %%mm0 \n\t" // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i]) "psubw %%mm1, %%mm0 \n\t" // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i])
"movq %%mm0, (%5, %%ebx) \n\t" "movq %%mm0, (%5, %%eax) \n\t"
"pcmpeqw %%mm7, %%mm0 \n\t" // out==0 ? 0xFF : 0x00 "pcmpeqw %%mm7, %%mm0 \n\t" // out==0 ? 0xFF : 0x00
"movq (%4, %%ebx), %%mm1 \n\t" "movq (%4, %%eax), %%mm1 \n\t"
"movq %%mm7, (%1, %%ebx) \n\t" // 0 "movq %%mm7, (%1, %%eax) \n\t" // 0
"pandn %%mm1, %%mm0 \n\t" "pandn %%mm1, %%mm0 \n\t"
PMAXW(%%mm0, %%mm3) PMAXW(%%mm0, %%mm3)
"addl $8, %%ebx \n\t" "addl $8, %%eax \n\t"
" js 1b \n\t" " js 1b \n\t"
"movq %%mm3, %%mm0 \n\t" "movq %%mm3, %%mm0 \n\t"
"psrlq $32, %%mm3 \n\t" "psrlq $32, %%mm3 \n\t"
...@@ -178,14 +170,10 @@ static int RENAME(dct_quantize)(MpegEncContext *s, ...@@ -178,14 +170,10 @@ static int RENAME(dct_quantize)(MpegEncContext *s,
"movq %%mm3, %%mm0 \n\t" "movq %%mm3, %%mm0 \n\t"
"psrlq $16, %%mm3 \n\t" "psrlq $16, %%mm3 \n\t"
PMAXW(%%mm0, %%mm3) PMAXW(%%mm0, %%mm3)
"movd %%mm3, %%ebx \n\t" "movd %%mm3, %%eax \n\t"
"movzbl %%bl, %%ebx \n\t" // last_non_zero_p1 "movzbl %%al, %%eax \n\t" // last_non_zero_p1
"movl %%ebx, (%%ebp) \n\t" : "+a" (last_non_zero_p1)
"popl %%ebx \n\t" : "r" (block+64), "r" (qmat+64), "r" (bias+64),
"popl %%ebp \n\t"
:
: "m" (last_non_zero_p1),
"r" (block+64), "r" (qmat+64), "r" (bias+64),
"r" (inv_zigzag_direct16+64), "r" (temp_block+64) "r" (inv_zigzag_direct16+64), "r" (temp_block+64)
); );
// note the asm is split cuz gcc doesnt like that many operands ... // note the asm is split cuz gcc doesnt like that many operands ...
...@@ -195,8 +183,8 @@ static int RENAME(dct_quantize)(MpegEncContext *s, ...@@ -195,8 +183,8 @@ static int RENAME(dct_quantize)(MpegEncContext *s,
"psubusw %%mm1, %%mm4 \n\t" "psubusw %%mm1, %%mm4 \n\t"
"packuswb %%mm4, %%mm4 \n\t" "packuswb %%mm4, %%mm4 \n\t"
"movd %%mm4, %0 \n\t" // *overflow "movd %%mm4, %0 \n\t" // *overflow
: "=r" (*overflow) : "=g" (*overflow)
: "r" (s->max_qcoeff) : "g" (s->max_qcoeff)
); );
} }
......
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