[svn] / branches / dev-api-4 / xvidcore / src / quant / x86_asm / quantize_h263_3dne.asm Repository:
ViewVC logotype

Diff of /branches/dev-api-4/xvidcore/src/quant/x86_asm/quantize_h263_3dne.asm

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

revision 1175, Tue Oct 7 14:16:29 2003 UTC revision 1176, Thu Oct 9 18:50:22 2003 UTC
# Line 1  Line 1 
1  ;/**************************************************************************  ;/**************************************************************************
2  ; *  ; *
3  ; *  XVID MPEG-4 VIDEO CODEC  ; *  XVID MPEG-4 VIDEO CODEC
4  ; *  - mmx quantization/dequantization -  ; *  - 3dne Quantization/Dequantization -
5  ; *  ; *
6  ; *  Copyright(C) 2001-2003 XviD Team <xvid-devel@xvid.org>  ; *  Copyright(C) 2002-2003 Jaan Kalda
7  ; *  ; *
8  ; *  This program is free software ; you can redistribute it and/or modify  ; *  This program is free software ; you can redistribute it and/or modify
9  ; *  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 19  Line 19 
19  ; *  along with this program ; if not, write to the Free Software  ; *  along with this program ; if not, write to the Free Software
20  ; *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA  ; *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21  ; *  ; *
22  ; * $Id: quantize_h263_3dne.asm,v 1.1.2.1 2003-10-07 13:02:35 edgomez Exp $  ; * $Id: quantize_h263_3dne.asm,v 1.1.2.2 2003-10-09 18:50:22 edgomez Exp $
23  ; *  ; *
24  ; *************************************************************************/  ; *************************************************************************/
25    ;
26  ; these 3dne functions are compatible with iSSE, but are optimized specifically for  ; these 3dne functions are compatible with iSSE, but are optimized specifically for
27  ; K7 pipelines  ; K7 pipelines
 ;  
 ;------------------------------------------------------------------------------  
 ; 09.12.2002  Athlon optimizations contributed by Jaan Kalda  
 ;------------------------------------------------------------------------------  
28    
29  ; enable dequant saturate [-2048,2047], test purposes only.  ; enable dequant saturate [-2048,2047], test purposes only.
30  %define SATURATE  %define SATURATE
# Line 37  Line 34 
34    
35  bits 32  bits 32
36    
 %ifdef FORMAT_COFF  
 section .data data  
 %else  
 section .data data align=16  
 %endif  
   
37  %macro cglobal 1  %macro cglobal 1
38          %ifdef PREFIX          %ifdef PREFIX
39                  global _%1                  global _%1
# Line 51  Line 42 
42                  global %1                  global %1
43          %endif          %endif
44  %endmacro  %endmacro
45    
46    ;***************************************************************************
47    ; Local data
48    ;***************************************************************************
49    
50    %ifdef FORMAT_COFF
51    section .data data
52    %else
53    section .data data align=16
54    %endif
55    
56  align 4  align 4
57  int_div  int_div:
58  dd 0  dd 0
59  %assign i 1  %assign i 1
60  %rep 255  %rep 255
# Line 61  Line 63 
63  %endrep  %endrep
64    
65  align 16  align 16
66    plus_one:
67  plus_one times 8        dw       1          times 8 dw 1
68    
69  ;===========================================================================  ;===========================================================================
70  ;  ;
# Line 70  Line 72 
72  ;  ;
73  ;===========================================================================  ;===========================================================================
74    
 %macro MMX_SUB  1  
 times 4 dw %1 / 2  
 %endmacro  
   
   
75  align 16  align 16
76  mmx_sub  mmx_sub:
77  %assign i 1  %assign i 1
78  %rep 31  %rep 31
79          times 4 dw i / 2          times 4 dw i / 2
# Line 95  Line 92 
92  ;===========================================================================  ;===========================================================================
93    
94  align 16  align 16
95  mmx_div  mmx_div:
   
96  %assign i 1  %assign i 1
97  %rep 31  %rep 31
98          times 4 dw  (1 << 16) / (i * 2) + 1          times 4 dw  (1 << 16) / (i * 2) + 1
# Line 109  Line 105 
105  ;  ;
106  ;===========================================================================  ;===========================================================================
107    
 %macro MMX_ADD  1  
 %if %1 % 2 != 0  
 times 4 dw %1  
 %else  
 times 4 dw %1 - 1  
 %endif  
 %endmacro  
   
108  align 16  align 16
109  mmx_add  mmx_add:
   
110  %assign i 1  %assign i 1
111  %rep 31  %rep 31
112          MMX_ADD i          %if i % 2 != 0
113            times 4 dw i
114            %else
115            times 4 dw i - 1
116            %endif
117          %assign i i+1          %assign i i+1
118  %endrep  %endrep
119    
# Line 132  Line 123 
123  ;  ;
124  ;===========================================================================  ;===========================================================================
125    
 %macro MMX_MUL  1  
 times 4 dw %1 * 2  
 %endmacro  
   
126  align 16  align 16
127  mmx_mul  mmx_mul:
   
128  %assign i 1  %assign i 1
129  %rep 31  %rep 31
130          times 4 dw i * 2          times 4 dw i * 2
# Line 152  Line 138 
138  ;===========================================================================  ;===========================================================================
139    
140  align 8  align 8
141  mmx_32768_minus_2048                            times 4 dw (32768-2048)  mmx_32768_minus_2048:
142  mmx_32767_minus_2047                            times 4 dw (32767-2047)          times 4 dw (32768-2048)
143    mmx_32767_minus_2047:
144            times 4 dw (32767-2047)
145    
146  align 16  align 16
147  mmx_2047 times 4 dw 2047  mmx_2047:
148            times 4 dw 2047
149    
150  align 8  align 8
151  mmzero dd 0, 0  mmzero:
152  int2047 dd 2047          dd 0, 0
153  int_2048 dd -2048  int2047:
154            dd 2047
155    int_2048:
156            dd -2048
157    
158    ;***************************************************************************
159    ; Code
160    ;***************************************************************************
161    
162  section .text  section .text
163    
164    
165  ;===========================================================================  ;===========================================================================
166  ;  ;
167  ; void quant_intra_3dne(int16_t * coeff,  ; uint32_t quant_h263_intra_3dne(int16_t * coeff,
168  ;                                       const int16_t const * data,  ;                                       const int16_t const * data,
169  ;                                       const uint32_t quant,  ;                                       const uint32_t quant,
170  ;                                       const uint32_t dcscalar);  ;                                       const uint32_t dcscalar);
171  ;  ;
172  ;===========================================================================  ;===========================================================================
173  ;This is Athlon-optimized code (ca 70 clk per call)  ;This is Athlon-optimized code (ca 70 clk per call)
 ;Optimized by Jaan, 30 Nov 2002  
174    
175  %macro quant_intra1  1  %macro quant_intra1  1
176    
# Line 379  Line 374 
374          movq    [edx + 3 * 32 + 16], mm5        ;C9          movq    [edx + 3 * 32 + 16], mm5        ;C9
375          movq    [edx + 3 * 32 + 24], mm7        ;D9          movq    [edx + 3 * 32 + 24], mm7        ;D9
376    
377            xor             eax, eax
378          ret          ret
379    
380          align 16          align 16
# Line 414  Line 410 
410          movq    [edx + 3 * 32 + 16], mm5        ;C9          movq    [edx + 3 * 32 + 16], mm5        ;C9
411          movq    [edx + 3 * 32 + 24], mm7        ;D9          movq    [edx + 3 * 32 + 24], mm7        ;D9
412    
413            xor             eax, eax
414          ret          ret
415    
416    
# Line 421  Line 418 
418    
419  ;===========================================================================  ;===========================================================================
420  ;  ;
421  ; uint32_t quant_inter_3dne(int16_t * coeff,  ; uint32_t quant_h263_inter_3dne(int16_t * coeff,
422  ;                                       const int16_t const * data,  ;                                       const int16_t const * data,
423  ;                                       const uint32_t quant);  ;                                       const uint32_t quant);
424  ;  ;
# Line 573  Line 570 
570    
571  ;===========================================================================  ;===========================================================================
572  ;  ;
573  ; void dequant_intra_3dne(int16_t *data,  ; uint32_t dequant_h263_intra_3dne(int16_t *data,
574  ;                                       const int16_t const *coeff,  ;                                       const int16_t const *coeff,
575  ;                                       const uint32_t quant,  ;                                       const uint32_t quant,
576  ;                                       const uint32_t dcscalar);  ;                                       const uint32_t dcscalar);
# Line 717  Line 714 
714          pxor    mm3, mm2                ;B13 (6th+)          pxor    mm3, mm2                ;B13 (6th+)
715          movq    [edx+4*24+8], mm3       ;B14 (7th)          movq    [edx+4*24+8], mm3       ;B14 (7th)
716          mov     [edx], ax          mov     [edx], ax
717    
718            xor             eax, eax
719          ret          ret
720    
721  ;===========================================================================  ;===========================================================================
722  ;  ;
723  ; void dequant_inter_3dne(int16_t * data,  ; uint32_t dequant_h263_inter_3dne(int16_t * data,
724  ;                                       const int16_t * const coeff,  ;                                       const int16_t * const coeff,
725  ;                                       const uint32_t quant);  ;                                       const uint32_t quant);
726  ;  ;
# Line 730  Line 729 
729  ; this is the same as dequant_inter_3dne,  ; this is the same as dequant_inter_3dne,
730  ; except that we're saturating using 'pminsw' (saves 2 cycles/loop)  ; except that we're saturating using 'pminsw' (saves 2 cycles/loop)
731  ;This is Athlon-optimized code (ca 100 clk per call)  ;This is Athlon-optimized code (ca 100 clk per call)
 ;Optimized by Jaan, 30 Nov 2002  
732    
733  align ALIGN  align ALIGN
734  cglobal dequant_h263_inter_3dne  cglobal dequant_h263_inter_3dne
# Line 778  Line 776 
776          pxor    mm3, mm2                ;B13 (6th+)          pxor    mm3, mm2                ;B13 (6th+)
777          movq    [edx+4*24+8], mm3       ;B14 (7th)          movq    [edx+4*24+8], mm3       ;B14 (7th)
778    
779            xor             eax, eax
780          ret          ret

Legend:
Removed from v.1175  
changed lines
  Added in v.1176

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