[svn] / trunk / xvidcore / src / quant / x86_asm / quantize_mpeg_mmx.asm Repository:
ViewVC logotype

Diff of /trunk/xvidcore/src/quant/x86_asm/quantize_mpeg_mmx.asm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1719, Tue Jul 11 10:01:27 2006 UTC revision 1793, Tue Nov 11 20:46:24 2008 UTC
# Line 21  Line 21 
21  ; *  along with this program ; if not, write to the Free Software  ; *  along with this program ; if not, write to the Free Software
22  ; *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA  ; *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
23  ; *  ; *
24  ; * $Id: quantize_mpeg_mmx.asm,v 1.7 2006-07-11 10:01:27 chl Exp $  ; * $Id: quantize_mpeg_mmx.asm,v 1.10 2008-11-11 20:46:24 Isibaar Exp $
25  ; *  ; *
26  ; *************************************************************************/  ; *************************************************************************/
27    
# Line 34  Line 34 
34                  %ifdef MARK_FUNCS                  %ifdef MARK_FUNCS
35                          global _%1:function %1.endfunc-%1                          global _%1:function %1.endfunc-%1
36                          %define %1 _%1:function %1.endfunc-%1                          %define %1 _%1:function %1.endfunc-%1
37                            %define ENDFUNC .endfunc
38                  %else                  %else
39                          global _%1                          global _%1
40                          %define %1 _%1                          %define %1 _%1
41                            %define ENDFUNC
42                  %endif                  %endif
43          %else          %else
44                  %ifdef MARK_FUNCS                  %ifdef MARK_FUNCS
45                          global %1:function %1.endfunc-%1                          global %1:function %1.endfunc-%1
46                            %define ENDFUNC .endfunc
47                  %else                  %else
48                          global %1                          global %1
49                            %define ENDFUNC
50                  %endif                  %endif
51          %endif          %endif
52  %endmacro  %endmacro
# Line 221  Line 225 
225    ; calculate DC    ; calculate DC
226    movsx eax, word [eax]     ; data[0]    movsx eax, word [eax]     ; data[0]
227    mov ecx, [esp + 4 + 16]   ; dcscalar    mov ecx, [esp + 4 + 16]   ; dcscalar
228    mov edx, ecx    mov edx, eax
229    shr edx, 1                ; edx = dcscalar /2    mov edi, ecx
230    mov edi, edx    shr ecx, 1                ; ecx = dcscalar/2
231    neg edi    sar edx, 31               ; edx = sign extend of eax (ready for division too)
232      xor ecx, edx              ; adjust ecx according to the sign of data[0]
233    cmp eax, 0    sub ecx, edx
234    cmovg edx, edi    add eax, ecx
235    sub eax, edx  
236      mov ecx, [esp + 4 + 4]        ; coeff again
237    mov edi, [esp + 4 + 4]        ; coeff again    idiv edi                  ; eax = edx:eax / dcscalar
238      mov [ecx], ax             ; coeff[0] = ax
   cdq                       ; expand eax -> edx:eax  
   idiv ecx                  ; eax = edx:eax / dcscalar  
   
   mov [edi], ax             ; coeff[0] = ax  
239    
240    pop edi    pop edi
241    
242    xor eax, eax              ; return(0);    xor eax, eax              ; return(0);
243    ret    ret
244  .endfunc  ENDFUNC
245    
246    
247  ;-----------------------------------------------------------------------------  ;-----------------------------------------------------------------------------
# Line 279  Line 279 
279    movq mm7, [mmx_div + eax * 8 - 8] ; divider    movq mm7, [mmx_div + eax * 8 - 8] ; divider
280    
281  ALIGN 16  ALIGN 16
282  .loop  .loop:
283    movq mm0, [esi + 8*ecx]       ; mm0 = [1st]    movq mm0, [esi + 8*ecx]       ; mm0 = [1st]
284    movq mm3, [esi + 8*ecx + 8]   ;    movq mm3, [esi + 8*ecx + 8]   ;
285    pxor mm1, mm1                 ; mm1 = 0    pxor mm1, mm1                 ; mm1 = 0
# Line 319  Line 319 
319    cmp ecx, 16    cmp ecx, 16
320    jnz near .loop    jnz near .loop
321    
322  .done  .done:
323    pmaddwd mm5, [mmx_one]    pmaddwd mm5, [mmx_one]
324    movq mm0, mm5    movq mm0, mm5
325    psrlq mm5, 32    psrlq mm5, 32
# Line 334  Line 334 
334    ret    ret
335    
336  ALIGN 16  ALIGN 16
337  .q1loop  .q1loop:
338    movq mm0, [esi + 8*ecx]       ; mm0 = [1st]    movq mm0, [esi + 8*ecx]       ; mm0 = [1st]
339    movq mm3, [esi + 8*ecx+ 8]    movq mm3, [esi + 8*ecx+ 8]
340    pxor mm1, mm1                 ; mm1 = 0    pxor mm1, mm1                 ; mm1 = 0
# Line 375  Line 375 
375    jmp .done    jmp .done
376    
377  ALIGN 16  ALIGN 16
378  .q2loop  .q2loop:
379    movq mm0, [esi + 8*ecx]       ; mm0 = [1st]    movq mm0, [esi + 8*ecx]       ; mm0 = [1st]
380    movq mm3, [esi + 8*ecx+ 8]    movq mm3, [esi + 8*ecx+ 8]
381    pxor mm1, mm1                 ; mm1 = 0    pxor mm1, mm1                 ; mm1 = 0
# Line 414  Line 414 
414    jnz near .q2loop    jnz near .q2loop
415    
416    jmp .done    jmp .done
417  .endfunc  ENDFUNC
418    
419    
420  ;-----------------------------------------------------------------------------  ;-----------------------------------------------------------------------------
# Line 482  Line 482 
482    pxor mm6, mm6     ; this is a NOP    pxor mm6, mm6     ; this is a NOP
483    
484  ALIGN 16  ALIGN 16
485  .loop  .loop:
486    movq mm0, [ecx+8*eax + 8*16]   ; mm0 = c  = coeff[i]    movq mm0, [ecx+8*eax + 8*16]   ; mm0 = c  = coeff[i]
487    movq mm3, [ecx+8*eax + 8*16 +8]; mm3 = c' = coeff[i+1]    movq mm3, [ecx+8*eax + 8*16 +8]; mm3 = c' = coeff[i+1]
488    pxor mm1, mm1    pxor mm1, mm1
# Line 554  Line 554 
554    pop ebx    pop ebx
555    
556    ret    ret
557  .endfunc  ENDFUNC
558    
559  ;-----------------------------------------------------------------------------  ;-----------------------------------------------------------------------------
560  ;  ;
# Line 586  Line 586 
586    pxor mm6, mm6     ; mismatch sum    pxor mm6, mm6     ; mismatch sum
587    
588  ALIGN 16  ALIGN 16
589  .loop  .loop:
590    movq mm0, [ecx+8*eax + 8*16   ]   ; mm0 = coeff[i]    movq mm0, [ecx+8*eax + 8*16   ]   ; mm0 = coeff[i]
591    movq mm2, [ecx+8*eax + 8*16 +8]   ; mm2 = coeff[i+1]    movq mm2, [ecx+8*eax + 8*16 +8]   ; mm2 = coeff[i+1]
592    add eax, 2    add eax, 2
# Line 668  Line 668 
668    pop ebx    pop ebx
669    
670    ret    ret
671  .endfunc  ENDFUNC
672    
673    
674    %ifidn __OUTPUT_FORMAT__,elf
675    section ".note.GNU-stack" noalloc noexec nowrite progbits
676    %endif
677    

Legend:
Removed from v.1719  
changed lines
  Added in v.1793

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4