[svn] / trunk / xvidcore / src / bitstream / x86_asm / cbp_mmx.asm Repository:
ViewVC logotype

Diff of /trunk/xvidcore/src/bitstream/x86_asm/cbp_mmx.asm

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

revision 53, Fri Mar 22 04:37:03 2002 UTC revision 1535, Sun Aug 22 11:46:10 2004 UTC
# Line 1  Line 1 
1  ;/**************************************************************************  ;/****************************************************************************
2  ; *  ; *
3  ; *     XVID MPEG-4 VIDEO CODEC  ; *     XVID MPEG-4 VIDEO CODEC
4  ; *     mmx cbp calc  ; *  - MMX CBP computation -
5  ; *  ; *
6  ; *     This program is an implementation of a part of one or more MPEG-4  ; *  Copyright (C) 2001-2003 Peter Ross <pross@xvid.org>
7  ; *     Video tools as specified in ISO/IEC 14496-2 standard.  Those intending  ; *                2002-2003 Pascal Massimino <skal@planet-d.net>
 ; *     to use this software module in hardware or software products are  
 ; *     advised that its use may infringe existing patents or copyrights, and  
 ; *     any such use would be at such party's own risk.  The original  
 ; *     developer of this software module and his/her company, and subsequent  
 ; *     editors and their companies, will have no liability for use of this  
 ; *     software or modifications or derivatives thereof.  
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 24  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
22  ; *  ; *
23  ; *************************************************************************/  ; * $Id: cbp_mmx.asm,v 1.11 2004-08-22 11:46:09 edgomez Exp $
   
 ;/**************************************************************************  
 ; *  
 ; *     History:  
24  ; *  ; *
25  ; *     22.03.2002      0.01          ; Min Chen <chenm001@163.com>  ; ***************************************************************************/
 ; *                                   ; use 386 cpu's 'BTS' to replace 'cbp |= 1 << (edx-1)'  
 ; *     24.11.2001      inital version; (c)2001 peter ross <pross@cs.rmit.edu.au>  
 ; *  
 ; *************************************************************************/  
   
26    
27  bits 32  BITS 32
28    
29  section .data  ;=============================================================================
30    ; Macros
31    ;=============================================================================
32    
33  %macro cglobal 1  %macro cglobal 1
34  %ifdef PREFIX  %ifdef PREFIX
35                    %ifdef MARK_FUNCS
36                            global _%1:function
37                            %define %1 _%1:function
38                    %else
39  global _%1  global _%1
40  %define %1 _%1  %define %1 _%1
41                    %endif
42            %else
43                    %ifdef MARK_FUNCS
44                            global %1:function
45  %else  %else
46  global %1  global %1
47  %endif  %endif
48            %endif
49  %endmacro  %endmacro
50    
51  ignore_dc       dw              0, -1, -1, -1  ;=============================================================================
52    ; Local data
53    ;=============================================================================
54    
55    %ifdef FORMAT_COFF
56    SECTION .rodata
57    %else
58    SECTION .rodata align=16
59    %endif
60    
61    ALIGN 16
62    
63  section .text  ignore_dc:
64            dw 0, -1, -1, -1, -1, -1, -1, -1
65    
66    ;=============================================================================
67    ; Code
68    ;=============================================================================
69    
70  ;===========================================================================  SECTION .text
 ;  
 ; uint32_t calc_cbp_mmx(const int16_t coeff[6][64]);  
 ;  
 ;===========================================================================  
71    
 align 16  
72  cglobal calc_cbp_mmx  cglobal calc_cbp_mmx
73  calc_cbp_mmx  
74    ;-----------------------------------------------------------------------------
75    ; uint32_t calc_cbp_mmx(const int16_t coeff[6][64]);
76    ;-----------------------------------------------------------------------------
77    
78    ALIGN 16
79    calc_cbp_mmx:
80                                  push    ebx                                  push    ebx
                                 push    ecx  
                                 push    edx  
81                                  push    esi                                  push    esi
82    
83                  mov     esi, [esp + 16 + 4]              ; coeff    mov esi, [esp + 8 + 4]        ; coeff
84      xor eax, eax                  ; cbp = 0
85      mov edx, (1 << 5)
86    
87                                  movq    mm7, [ignore_dc]                                  movq    mm7, [ignore_dc]
88    
                                 xor             eax, eax                ; cbp = 0  
                                 mov             edx, 6  
89  .loop  .loop
90                  movq    mm0, [esi]                  movq    mm0, [esi]
                                 pand    mm0, mm7  
91                  movq    mm1, [esi+8]                  movq    mm1, [esi+8]
92      pand mm0, mm7
93    
94                  por     mm0, [esi+16]                  por     mm0, [esi+16]
95                  por     mm1, [esi+24]                  por     mm1, [esi+24]
# Line 106  Line 115 
115                  por     mm0, mm1                  por     mm0, mm1
116                  movq    mm1, mm0                  movq    mm1, mm0
117                  psrlq   mm1, 32                  psrlq   mm1, 32
118      lea esi, [esi + 128]
119    
120                  por     mm0, mm1                  por     mm0, mm1
121                                  movd    ebx, mm0                                  movd    ebx, mm0
122    
123                                  add             esi, 128    test ebx, ebx
124      jz .next
125                                  or              ebx, ebx    or eax, edx     ; cbp |= 1 << (5-i)
126                                  jz              .iterate  
127    .next
128                                  ; cbp |= 1 << (edx-1)    shr edx,1
129      jnc .loop
                                 ; Change by Chenm001 <chenm001@163.com>  
                                 ;mov             ecx, edx  
                                 ;dec             ecx  
                                 ;mov             ebx, 1  
                                 ;shl             ebx, cl  
                                 ;or              eax, ebx  
                                 lea             ebx,[edx-1]  
                                 bts             eax,ebx  
   
 .iterate                dec     edx  
                                 jnz             .loop  
130    
131                                  pop     esi                                  pop     esi
                                 pop     edx  
                                 pop     ecx  
132                                  pop     ebx                                  pop     ebx
133    
134                                  ret                                  ret

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

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