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

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

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

revision 1381, Thu Mar 18 16:11:28 2004 UTC revision 1382, Mon Mar 22 22:36:25 2004 UTC
# Line 1  Line 1 
1  ;/**************************************************************************  ;/*****************************************************************************
2  ; *  ; *
3  ; *     XVID MPEG-4 VIDEO CODEC  ; *     XVID MPEG-4 VIDEO CODEC
4  ; *     mmx 8x8 block-based halfpel interpolation  ; *  - mmx 8x8 block-based halfpel interpolation -
5    ; *
6    ; *  Copyright(C) 2001 Peter Ross <pross@xvid.org>
7    ; *               2002 Michael Militzer <isibaar@xvid.org>
8  ; *  ; *
9  ; *     This program is free software; you can redistribute it and/or modify  ; *     This program is free software; you can redistribute it and/or modify
10  ; *     it under the terms of the GNU General Public License as published by  ; *     it under the terms of the GNU General Public License as published by
# Line 15  Line 18 
18  ; *  ; *
19  ; *     You should have received a copy of the GNU General Public License  ; *     You should have received a copy of the GNU General Public License
20  ; *     along with this program; if not, write to the Free Software  ; *     along with this program; if not, write to the Free Software
21  ; *     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  ; *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 ; *  
 ; *************************************************************************/  
   
 ;/**************************************************************************  
 ; *  
 ; *     History:  
22  ; *  ; *
23  ; * 05.10.2002  added some qpel mmx code - Isibaar  ; ****************************************************************************/
 ; * 06.07.2002  mmx cleanup - Isibaar  
 ; *     22.12.2001      inital version; (c)2001 peter ross <pross@cs.rmit.edu.au>  
 ; *  
 ; *************************************************************************/  
   
24    
25  bits 32  BITS 32
26    
27  %macro cglobal 1  %macro cglobal 1
28          %ifdef PREFIX          %ifdef PREFIX
# Line 41  Line 33 
33          %endif          %endif
34  %endmacro  %endmacro
35    
36  section .data  ;=============================================================================
37    ; Read only data
38    ;=============================================================================
39    
40  align 16  %ifdef FORMAT_COFF
41    SECTION .rodata data
42    %else
43    SECTION .rodata data align=16
44    %endif
45    
46  ;===========================================================================  ;-----------------------------------------------------------------------------
47  ; (16 - r) rounding table  ; (16 - r) rounding table
48  ;===========================================================================  ;-----------------------------------------------------------------------------
49    
50  rounding_lowpass_mmx  ALIGN 16
51    rounding_lowpass_mmx:
52  times 4 dw 16  times 4 dw 16
53  times 4 dw 15  times 4 dw 15
54    
55  ;===========================================================================  ;-----------------------------------------------------------------------------
56  ; (1 - r) rounding table  ; (1 - r) rounding table
57  ;===========================================================================  ;-----------------------------------------------------------------------------
58    
59  rounding1_mmx  rounding1_mmx:
60  times 4 dw 1  times 4 dw 1
61  times 4 dw 0  times 4 dw 0
62    
63  ;===========================================================================  ;-----------------------------------------------------------------------------
64  ; (2 - r) rounding table  ; (2 - r) rounding table
65  ;===========================================================================  ;-----------------------------------------------------------------------------
66    
67  rounding2_mmx  rounding2_mmx:
68  times 4 dw 2  times 4 dw 2
69  times 4 dw 1  times 4 dw 1
70    
71  mmx_one  mmx_one:
72  times 8 db 1  times 8 db 1
73    
74  mmx_two  mmx_two:
75  times 8 db 2  times 8 db 2
76    
77  mmx_three  mmx_three:
78  times 8 db 3  times 8 db 3
79    
80  mmx_five  mmx_five:
81  times 4 dw 5  times 4 dw 5
82    
83  mmx_mask  mmx_mask:
84  times 8 db 254  times 8 db 254
85    
86  mmx_mask2  mmx_mask2:
87  times 8 db 252  times 8 db 252
88    
89  section .text  ;=============================================================================
90    ; Code
91    ;=============================================================================
92    
93    SECTION .text
94    
95    cglobal interpolate8x8_halfpel_h_mmx
96    cglobal interpolate8x8_halfpel_v_mmx
97    cglobal interpolate8x8_halfpel_hv_mmx
98    cglobal interpolate8x8_avg4_mmx
99    cglobal interpolate8x8_avg2_mmx
100    cglobal interpolate8x8_6tap_lowpass_h_mmx
101    cglobal interpolate8x8_6tap_lowpass_v_mmx
102    
103  %macro  CALC_AVG 6  %macro  CALC_AVG 6
104          punpcklbw %3, %6          punpcklbw %3, %6
# Line 100  Line 111 
111    
112          psrlw %1, 1                     ; mm01 >>= 1          psrlw %1, 1                     ; mm01 >>= 1
113          psrlw %2, 1          psrlw %2, 1
   
114  %endmacro  %endmacro
115    
116    
117  ;===========================================================================  ;-----------------------------------------------------------------------------
118  ;  ;
119  ; void interpolate8x8_halfpel_h_mmx(uint8_t * const dst,  ; void interpolate8x8_halfpel_h_mmx(uint8_t * const dst,
120  ;                                               const uint8_t * const src,  ;                                               const uint8_t * const src,
121  ;                                               const uint32_t stride,  ;                                               const uint32_t stride,
122  ;                                               const uint32_t rounding);  ;                                               const uint32_t rounding);
123  ;  ;
124  ;===========================================================================  ;-----------------------------------------------------------------------------
125    
126  %macro COPY_H_MMX 0  %macro COPY_H_MMX 0
127                  movq mm0, [esi]                  movq mm0, [esi]
# Line 131  Line 141 
141                  add edi, edx            ; dst += stride                  add edi, edx            ; dst += stride
142  %endmacro  %endmacro
143    
144  align 16  ALIGN 16
145  cglobal interpolate8x8_halfpel_h_mmx  interpolate8x8_halfpel_h_mmx:
 interpolate8x8_halfpel_h_mmx  
146    
147                  push    esi                  push    esi
148                  push    edi                  push    edi
   
149                  mov     eax, [esp + 8 + 16]             ; rounding                  mov     eax, [esp + 8 + 16]             ; rounding
150    
 interpolate8x8_halfpel_h_mmx.start  
151                  movq mm7, [rounding1_mmx + eax * 8]                  movq mm7, [rounding1_mmx + eax * 8]
152    
153                  mov     edi, [esp + 8 + 4]              ; dst                  mov     edi, [esp + 8 + 4]              ; dst
# Line 164  Line 171 
171                  ret                  ret
172    
173    
174  ;===========================================================================  ;-----------------------------------------------------------------------------
175  ;  ;
176  ; void interpolate8x8_halfpel_v_mmx(uint8_t * const dst,  ; void interpolate8x8_halfpel_v_mmx(uint8_t * const dst,
177  ;                                               const uint8_t * const src,  ;                                               const uint8_t * const src,
178  ;                                               const uint32_t stride,  ;                                               const uint32_t stride,
179  ;                                               const uint32_t rounding);  ;                                               const uint32_t rounding);
180  ;  ;
181  ;===========================================================================  ;-----------------------------------------------------------------------------
182    
183  %macro COPY_V_MMX 0  %macro COPY_V_MMX 0
184                  movq mm0, [esi]                  movq mm0, [esi]
# Line 191  Line 198 
198                  add edi, edx            ; dst += stride                  add edi, edx            ; dst += stride
199  %endmacro  %endmacro
200    
201  align 16  ALIGN 16
202  cglobal interpolate8x8_halfpel_v_mmx  interpolate8x8_halfpel_v_mmx:
 interpolate8x8_halfpel_v_mmx  
203    
204                  push    esi                  push    esi
205                  push    edi                  push    edi
206    
207                  mov     eax, [esp + 8 + 16]             ; rounding                  mov     eax, [esp + 8 + 16]             ; rounding
208    
 interpolate8x8_halfpel_v_mmx.start  
209                  movq mm7, [rounding1_mmx + eax * 8]                  movq mm7, [rounding1_mmx + eax * 8]
210    
211                  mov     edi, [esp + 8 + 4]              ; dst                  mov     edi, [esp + 8 + 4]              ; dst
# Line 225  Line 230 
230                  ret                  ret
231    
232    
233  ;===========================================================================  ;-----------------------------------------------------------------------------
234  ;  ;
235  ; void interpolate8x8_halfpel_hv_mmx(uint8_t * const dst,  ; void interpolate8x8_halfpel_hv_mmx(uint8_t * const dst,
236  ;                                               const uint8_t * const src,  ;                                               const uint8_t * const src,
# Line 233  Line 238 
238  ;                                               const uint32_t rounding);  ;                                               const uint32_t rounding);
239  ;  ;
240  ;  ;
241  ;===========================================================================  ;-----------------------------------------------------------------------------
242    
243  %macro COPY_HV_MMX 0  %macro COPY_HV_MMX 0
244                  ; current row                  ; current row
   
245                  movq mm0, [esi]                  movq mm0, [esi]
246                  movq mm2, [esi + 1]                  movq mm2, [esi + 1]
247    
# Line 253  Line 257 
257                  paddusw mm1, mm3                  paddusw mm1, mm3
258    
259                  ; next row                  ; next row
   
260                  movq mm4, [esi + edx]                  movq mm4, [esi + edx]
261                  movq mm2, [esi + edx + 1]                  movq mm2, [esi + edx + 1]
262    
# Line 269  Line 272 
272                  paddusw mm5, mm3                  paddusw mm5, mm3
273    
274                  ; add current + next row                  ; add current + next row
   
275                  paddusw mm0, mm4                ; mm01 += mm45                  paddusw mm0, mm4                ; mm01 += mm45
276                  paddusw mm1, mm5                  paddusw mm1, mm5
277                  paddusw mm0, mm7                ; mm01 += rounding2                  paddusw mm0, mm7                ; mm01 += rounding2
# Line 285  Line 287 
287                  add edi, edx            ; dst += stride                  add edi, edx            ; dst += stride
288  %endmacro  %endmacro
289    
290  align 16  ALIGN 16
291  cglobal interpolate8x8_halfpel_hv_mmx  interpolate8x8_halfpel_hv_mmx:
 interpolate8x8_halfpel_hv_mmx  
292    
293                  push    esi                  push    esi
294                  push    edi                  push    edi
295    
296                  mov     eax, [esp + 8 + 16]             ; rounding                  mov     eax, [esp + 8 + 16]             ; rounding
 interpolate8x8_halfpel_hv_mmx.start  
297    
298                  movq mm7, [rounding2_mmx + eax * 8]                  movq mm7, [rounding2_mmx + eax * 8]
299    
# Line 320  Line 320 
320    
321                  ret                  ret
322    
323  ;===========================================================================  ;-----------------------------------------------------------------------------
324  ;  ;
325  ; void interpolate8x8_avg2_mmx(uint8_t const *dst,  ; void interpolate8x8_avg2_mmx(uint8_t const *dst,
326  ;                                                          const uint8_t * const src1,  ;                                                          const uint8_t * const src1,
# Line 329  Line 329 
329  ;                                                          const uint32_t rounding,  ;                                                          const uint32_t rounding,
330  ;                                                          const uint32_t height);  ;                                                          const uint32_t height);
331  ;  ;
332  ;===========================================================================  ;-----------------------------------------------------------------------------
333    
334  %macro AVG2_MMX_RND0 0  %macro AVG2_MMX_RND0 0
335          movq    mm0, [eax]                      ; src1 -> mm0          movq    mm0, [eax]                      ; src1 -> mm0
# Line 425  Line 425 
425          movq    [ecx+edx], mm4          movq    [ecx+edx], mm4
426  %endmacro  %endmacro
427    
428  align 16  ALIGN 16
429  cglobal interpolate8x8_avg2_mmx  interpolate8x8_avg2_mmx:
 interpolate8x8_avg2_mmx  
430    
431          push ebx          push ebx
432    
# Line 496  Line 495 
495          ret          ret
496    
497    
498  ;===========================================================================  ;-----------------------------------------------------------------------------
499  ;  ;
500  ; void interpolate8x8_avg4_mmx(uint8_t const *dst,  ; void interpolate8x8_avg4_mmx(uint8_t const *dst,
501  ;                                                          const uint8_t * const src1,  ;                                                          const uint8_t * const src1,
# Line 506  Line 505 
505  ;                                                          const uint32_t stride,  ;                                                          const uint32_t stride,
506  ;                                                          const uint32_t rounding);  ;                                                          const uint32_t rounding);
507  ;  ;
508  ;===========================================================================  ;-----------------------------------------------------------------------------
509    
510  %macro AVG4_MMX_RND0 0  %macro AVG4_MMX_RND0 0
511          movq    mm0, [eax]                      ; src1 -> mm0          movq    mm0, [eax]                      ; src1 -> mm0
# Line 618  Line 617 
617          movq    [ecx], mm0                      ; (src1 + src2 + src3 + src4 + 2) / 4 -> dst          movq    [ecx], mm0                      ; (src1 + src2 + src3 + src4 + 2) / 4 -> dst
618  %endmacro  %endmacro
619    
620  align 16  ALIGN 16
621  cglobal interpolate8x8_avg4_mmx  interpolate8x8_avg4_mmx:
 interpolate8x8_avg4_mmx  
622    
623          push ebx          push ebx
624          push edi          push edi
# Line 685  Line 683 
683          ret          ret
684    
685    
686  ;===========================================================================  ;-----------------------------------------------------------------------------
687  ;  ;
688  ; void interpolate8x8_6tap_lowpass_h_mmx(uint8_t const *dst,  ; void interpolate8x8_6tap_lowpass_h_mmx(uint8_t const *dst,
689  ;                                                                            const uint8_t * const src,  ;                                                                            const uint8_t * const src,
690  ;                                                                            const uint32_t stride,  ;                                                                            const uint32_t stride,
691  ;                                                                            const uint32_t rounding);  ;                                                                            const uint32_t rounding);
692  ;  ;
693  ;===========================================================================  ;-----------------------------------------------------------------------------
694    
695  %macro LOWPASS_6TAP_H_MMX 0  %macro LOWPASS_6TAP_H_MMX 0
696          movq    mm0, [eax]          movq    mm0, [eax]
# Line 763  Line 761 
761          movq    [ecx], mm0          movq    [ecx], mm0
762  %endmacro  %endmacro
763    
764  align 16  ALIGN 16
765  cglobal interpolate8x8_6tap_lowpass_h_mmx  interpolate8x8_6tap_lowpass_h_mmx:
 interpolate8x8_6tap_lowpass_h_mmx  
766    
767          mov     eax, [esp + 16]                 ; rounding          mov     eax, [esp + 16]                 ; rounding
768    
# Line 795  Line 792 
792    
793          ret          ret
794    
795  ;===========================================================================  ;-----------------------------------------------------------------------------
796  ;  ;
797  ; void interpolate8x8_6tap_lowpass_v_mmx(uint8_t const *dst,  ; void interpolate8x8_6tap_lowpass_v_mmx(uint8_t const *dst,
798  ;                                                                                const uint8_t * const src,  ;                                                                                const uint8_t * const src,
799  ;                                                                                const uint32_t stride,  ;                                                                                const uint32_t stride,
800  ;                                                                            const uint32_t rounding);  ;                                                                            const uint32_t rounding);
801  ;  ;
802  ;===========================================================================  ;-----------------------------------------------------------------------------
803    
804  %macro LOWPASS_6TAP_V_MMX 0  %macro LOWPASS_6TAP_V_MMX 0
805          movq    mm0, [eax]          movq    mm0, [eax]
# Line 874  Line 871 
871          movq    [ecx], mm0          movq    [ecx], mm0
872  %endmacro  %endmacro
873    
874  align 16  ALIGN 16
875  cglobal interpolate8x8_6tap_lowpass_v_mmx  interpolate8x8_6tap_lowpass_v_mmx:
 interpolate8x8_6tap_lowpass_v_mmx  
876    
877          push ebx          push ebx
878    

Legend:
Removed from v.1381  
changed lines
  Added in v.1382

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