[svn] / trunk / xvidcore / src / image / x86_asm / interpolate8x8_3dn.asm Repository:
ViewVC logotype

Diff of /trunk/xvidcore/src/image/x86_asm/interpolate8x8_3dn.asm

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

revision 1535, Sun Aug 22 11:46:10 2004 UTC revision 1790, Tue Aug 19 09:06:48 2008 UTC
# Line 28  Line 28 
28  %macro cglobal 1  %macro cglobal 1
29          %ifdef PREFIX          %ifdef PREFIX
30                  %ifdef MARK_FUNCS                  %ifdef MARK_FUNCS
31                          global _%1:function                          global _%1:function %1.endfunc-%1
32                          %define %1 _%1:function                          %define %1 _%1:function %1.endfunc-%1
33                  %else                  %else
34                          global _%1                          global _%1
35                          %define %1 _%1                          %define %1 _%1
36                  %endif                  %endif
37          %else          %else
38                  %ifdef MARK_FUNCS                  %ifdef MARK_FUNCS
39                          global %1:function                          global %1:function %1.endfunc-%1
40                  %else                  %else
41                          global %1                          global %1
42                  %endif                  %endif
# Line 67  Line 67 
67  cglobal interpolate8x8_halfpel_v_3dn  cglobal interpolate8x8_halfpel_v_3dn
68  cglobal interpolate8x8_halfpel_hv_3dn  cglobal interpolate8x8_halfpel_hv_3dn
69    
70    cglobal interpolate8x4_halfpel_h_3dn
71    cglobal interpolate8x4_halfpel_v_3dn
72    cglobal interpolate8x4_halfpel_hv_3dn
73    
74  ;-----------------------------------------------------------------------------  ;-----------------------------------------------------------------------------
75  ;  ;
76  ; void interpolate8x8_halfpel_h_3dn(uint8_t * const dst,  ; void interpolate8x8_halfpel_h_3dn(uint8_t * const dst,
# Line 137  Line 141 
141    lea ecx, [ecx+2*edx]    lea ecx, [ecx+2*edx]
142    COPY_H_3DN_RND1    COPY_H_3DN_RND1
143    ret    ret
144    .endfunc
145    
146    
147  ;-----------------------------------------------------------------------------  ;-----------------------------------------------------------------------------
# Line 213  Line 218 
218    lea ecx, [ecx+2*edx]    lea ecx, [ecx+2*edx]
219    COPY_V_3DN_RND1    COPY_V_3DN_RND1
220    ret    ret
221    .endfunc
222    
223    
224  ;-----------------------------------------------------------------------------  ;-----------------------------------------------------------------------------
# Line 352  Line 358 
358    add ecx, edx    add ecx, edx
359    COPY_HV_3DN_RND1    COPY_HV_3DN_RND1
360    ret    ret
361    .endfunc
362    
363    ;-----------------------------------------------------------------------------
364    ;
365    ; void interpolate8x4_halfpel_h_3dn(uint8_t * const dst,
366    ;                       const uint8_t * const src,
367    ;                       const uint32_t stride,
368    ;                       const uint32_t rounding);
369    ;
370    ;-----------------------------------------------------------------------------
371    
372    ALIGN 16
373    interpolate8x4_halfpel_h_3dn:
374    
375      mov eax, [esp+16] ; rounding
376      mov ecx, [esp+ 4] ; Dst
377      test eax, eax
378      mov eax, [esp+ 8] ; Src
379      mov edx, [esp+12] ; stride
380    
381      jnz near .rounding1
382    
383      COPY_H_3DN_RND0
384      lea ecx, [ecx+2*edx]
385      COPY_H_3DN_RND0
386      ret
387    
388    .rounding1
389      ; we use: (i+j)/2 = ( i+j+1 )/2 - (i^j)&1
390      movq mm7, [mmx_one]
391      COPY_H_3DN_RND1
392      lea ecx, [ecx+2*edx]
393      COPY_H_3DN_RND1
394      ret
395    .endfunc
396    
397    
398    ;-----------------------------------------------------------------------------
399    ;
400    ; void interpolate8x4_halfpel_v_3dn(uint8_t * const dst,
401    ;                       const uint8_t * const src,
402    ;                       const uint32_t stride,
403    ;                       const uint32_t rounding);
404    ;
405    ;-----------------------------------------------------------------------------
406    
407    ALIGN 16
408    interpolate8x4_halfpel_v_3dn:
409    
410      mov eax, [esp+16] ; rounding
411      mov ecx, [esp+ 4] ; Dst
412      test eax,eax
413      mov eax, [esp+ 8] ; Src
414      mov edx, [esp+12] ; stride
415    
416        ; we process 2 line at a time
417    
418      jnz near .rounding1
419    
420      COPY_V_3DN_RND0
421      lea ecx, [ecx+2*edx]
422      COPY_V_3DN_RND0
423      ret
424    
425    .rounding1
426     ; we use: (i+j)/2 = ( i+j+1 )/2 - (i^j)&1
427      movq mm7, [mmx_one]
428      movq mm2, [eax]       ; loop invariant
429      add eax, edx
430    
431      COPY_V_3DN_RND1
432      lea ecx, [ecx+2*edx]
433      COPY_V_3DN_RND1
434      ret
435    .endfunc
436    
437    
438    ;-----------------------------------------------------------------------------
439    ;
440    ; void interpolate8x4_halfpel_hv_3dn(uint8_t * const dst,
441    ;                       const uint8_t * const src,
442    ;                       const uint32_t stride,
443    ;                       const uint32_t rounding);
444    ;
445    ;
446    ;-----------------------------------------------------------------------------
447    
448    ; The trick is to correct the result of 'pavgusb' with some combination of the
449    ; lsb's of the 4 input values i,j,k,l, and their intermediate 'pavgusb' (s and t).
450    ; The boolean relations are:
451    ;   (i+j+k+l+3)/4 = (s+t+1)/2 - (ij&kl)&st
452    ;   (i+j+k+l+2)/4 = (s+t+1)/2 - (ij|kl)&st
453    ;   (i+j+k+l+1)/4 = (s+t+1)/2 - (ij&kl)|st
454    ;   (i+j+k+l+0)/4 = (s+t+1)/2 - (ij|kl)|st
455    ; with  s=(i+j+1)/2, t=(k+l+1)/2, ij = i^j, kl = k^l, st = s^t.
456    
457    ALIGN 16
458    interpolate8x4_halfpel_hv_3dn
459      mov eax, [esp+16] ; rounding
460      mov ecx, [esp+ 4] ; Dst
461      test eax, eax
462      mov eax, [esp+ 8] ; Src
463      mov edx, [esp+12] ; stride
464    
465      movq mm7, [mmx_one]
466    
467        ; loop invariants: mm2=(i+j+1)/2  and  mm3= i^j
468      movq mm2, [eax]
469      movq mm3, [eax+1]
470      movq mm6, mm2
471      pavgusb mm2, mm3
472      pxor mm3, mm6     ; mm2/mm3 ready
473    
474      jnz near .rounding1
475    
476      COPY_HV_3DN_RND0
477      add ecx, edx
478      COPY_HV_3DN_RND0
479      ret
480    
481    .rounding1
482      COPY_HV_3DN_RND1
483      add ecx, edx
484      COPY_HV_3DN_RND1
485      ret
486    .endfunc
487    
488    
489    %ifidn __OUTPUT_FORMAT__,elf
490    section ".note.GNU-stack" noalloc noexec nowrite progbits
491    %endif
492    

Legend:
Removed from v.1535  
changed lines
  Added in v.1790

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