--- branches/dev-api-4/xvidcore/src/quant/x86_asm/quantize_mpeg_xmm.asm 2003/11/30 09:45:52 1229 +++ branches/dev-api-4/xvidcore/src/quant/x86_asm/quantize_mpeg_xmm.asm 2003/11/30 16:13:16 1230 @@ -20,7 +20,7 @@ ; * along with this program ; if not, write to the Free Software ; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ; * -; * $Id: quantize_mpeg_xmm.asm,v 1.1.2.4 2003-11-03 15:51:50 edgomez Exp $ +; * $Id: quantize_mpeg_xmm.asm,v 1.1.2.5 2003-11-30 16:13:16 edgomez Exp $ ; * ; ***************************************************************************/ @@ -89,32 +89,10 @@ %assign quant quant+1 %endrep - -;----------------------------------------------------------------------------- -; intra matrix -; (TODO remove dependency on external tables for instance safiness) -;----------------------------------------------------------------------------- - %macro FIXX 1 dw (1 << 16) / (%1) + 1 %endmacro -cextern intra_matrix_fixl -cextern intra_matrix_fix -cextern intra_matrix1 -cextern intra_matrix - -;----------------------------------------------------------------------------- -; inter matrix -; (TODO remove dependency on external tables for instance safiness) -;----------------------------------------------------------------------------- - -cextern inter_matrix1 -cextern inter_matrix -cextern inter_matrix_fix -cextern inter_matrix_fixl - - %define nop4 db 08Dh, 074h, 026h,0 %define nop3 add esp, byte 0 %define nop2 mov esp, esp @@ -188,7 +166,8 @@ ; uint32_t quant_mpeg_intra_xmm(int16_t * coeff, ; const int16_t const * data, ; const uint32_t quant, -; const uint32_t dcscalar); +; const uint32_t dcscalar, +; const uint16_t *mpeg_matrices); ; ;----------------------------------------------------------------------------- @@ -201,7 +180,7 @@ push edi push ebx nop - mov edi, mmzero + mov edi, [esp + 12 + 20] ; mpeg_quant_matrices mov esi, -14 pxor mm0, mm0 pxor mm3, mm3 @@ -224,15 +203,15 @@ psraw mm4, 15 psllw mm0, 4 ;level << 4 ; psllw mm3, 4 - paddw mm0, [intra_matrix1 + 8*esi+112] - paddw mm3, [intra_matrix1 + 8*esi+120] - movq mm5, [intra_matrix_fixl + 8*esi+112] - movq mm7, [intra_matrix_fixl + 8*esi+120] + paddw mm0, [edi + 128 + 8*esi+112] + paddw mm3, [edi + 128 + 8*esi+120] + movq mm5, [edi + 384 + 8*esi+112] + movq mm7, [edi + 384 + 8*esi+120] pmulhuw mm5, mm0 pmulhuw mm7, mm3 mov esp, esp - movq mm2, [intra_matrix + 8*esi+112] - movq mm6, [intra_matrix + 8*esi+120] + movq mm2, [edi + 8*esi+112] + movq mm6, [edi + 8*esi+120] pmullw mm2, mm5 pmullw mm6, mm7 psubw mm0, mm2 @@ -243,12 +222,12 @@ paddw mm5, mm2 paddw mm7, mm2 mov esp, esp - pmulhuw mm0, [intra_matrix_fix + 8*esi+112] - pmulhuw mm3, [intra_matrix_fix + 8*esi+120] + pmulhuw mm0, [edi + 256 + 8*esi+112] + pmulhuw mm3, [edi + 256 + 8*esi+120] paddw mm5, mm0 paddw mm7, mm3 - movq mm0, [edi] - movq mm3, [edi] + pxor mm0, mm0 + pxor mm3, mm3 pmulhuw mm5, mm6 ; mm0 = (mm0 / 2Q) >> 16 pmulhuw mm7, mm6 ; (level + quantd) / quant (0> 16 pmulhuw mm7, mm6 ; (level + quantd) / quant (0> 16 pmulhuw mm7, mm6 ; (level ) / quant (0> 16 pmulhuw mm7, mm6 ; (level ) / quant (0