[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 655, Sun Nov 17 00:57:58 2002 UTC revision 1877, Wed Sep 16 17:11:39 2009 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 file is part of XviD, a free MPEG-4 video encoder/decoder  ; *  Copyright (C) 2005      Carlo Bramini <carlo.bramix@libero.it>
7    ; *                2001-2003 Peter Ross <pross@xvid.org>
8    ; *                2002-2003 Pascal Massimino <skal@planet-d.net>
9  ; *  ; *
10  ; *  XviD is free software; you can redistribute it and/or modify it  ; *  This program is free software ; you can redistribute it and/or modify
11  ; *  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
12  ; *  the Free Software Foundation; either version 2 of the License, or  ; *  the Free Software Foundation; either version 2 of the License, or
13  ; *  (at your option) any later version.  ; *  (at your option) any later version.
14  ; *  ; *
# Line 19  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  ; *  Under section 8 of the GNU General Public License, the copyright  ; * $Id: cbp_mmx.asm,v 1.19 2009-09-16 17:07:58 Isibaar Exp $
25  ; *  holders of XVID explicitly forbid distribution in the following  ; *
26  ; *  countries:  ; ***************************************************************************/
 ; *  
 ; *    - Japan  
 ; *    - United States of America  
 ; *  
 ; *  Linking XviD statically or dynamically with other modules is making a  
 ; *  combined work based on XviD.  Thus, the terms and conditions of the  
 ; *  GNU General Public License cover the whole combination.  
 ; *  
 ; *  As a special exception, the copyright holders of XviD give you  
 ; *  permission to link XviD with independent modules that communicate with  
 ; *  XviD solely through the VFW1.1 and DShow interfaces, regardless of the  
 ; *  license terms of these independent modules, and to copy and distribute  
 ; *  the resulting combined work under terms of your choice, provided that  
 ; *  every copy of the combined work is accompanied by a complete copy of  
 ; *  the source code of XviD (the version of XviD used to produce the  
 ; *  combined work), being distributed under the terms of the GNU General  
 ; *  Public License plus this exception.  An independent module is a module  
 ; *  which is not derived from or based on XviD.  
 ; *  
 ; *  Note that people who make modified versions of XviD are not obligated  
 ; *  to grant this special exception for their modified versions; it is  
 ; *  their choice whether to do so.  The GNU General Public License gives  
 ; *  permission to release a modified version without this exception; this  
 ; *  exception also makes it possible to release a modified version which  
 ; *  carries forward this exception.  
 ; *  
 ; * $Id: cbp_mmx.asm,v 1.7 2002-11-17 00:57:57 edgomez Exp $  
 ; *  
 ; *************************************************************************/  
   
 bits 32  
   
 section .data  
   
 %macro cglobal 1  
         %ifdef PREFIX  
                 global _%1  
                 %define %1 _%1  
         %else  
                 global %1  
         %endif  
 %endmacro  
27    
28  align 16  ;=============================================================================
29    ; Macros
30    ;=============================================================================
31    
32  ignore_dc       dw              0, -1, -1, -1, -1, -1, -1, -1  %include "nasm.inc"
33    
34  section .text  ;=============================================================================
35    ; Local data
36    ;=============================================================================
37    
38  cglobal calc_cbp_mmx  DATA
39    
40  ;===========================================================================  ALIGN SECTION_ALIGN
 ;  
 ; uint32_t calc_cbp_mmx(const int16_t coeff[6][64]);  
 ;  
 ;===========================================================================  
41    
42  align 16  mult_mask:
43  calc_cbp_mmx:    db 0x10,0x20,0x04,0x08,0x01,0x02,0x00,0x00
44    push  ebx  ignore_dc:
45    push  esi    dw 0, -1, -1, -1
46    
47    mov       esi, [esp + 8 + 4]  ; coeff  ;=============================================================================
48    xor           eax, eax                        ; cbp = 0  ; Code
49    mov           edx, (1 << 5)  ;=============================================================================
50    
51    movq          mm7, [ignore_dc]  TEXT
52    
53  .loop  cglobal calc_cbp_mmx
   movq          mm0, [esi]  
   movq          mm1, [esi+8]  
   pand          mm0, mm7  
   
   por           mm0, [esi+16]  
   por           mm1, [esi+24]  
   
   por           mm0, [esi+32]  
   por           mm1, [esi+40]  
   
   por           mm0, [esi+48]  
   por           mm1, [esi+56]  
54    
55    por           mm0, [esi+64]  ;-----------------------------------------------------------------------------
56    por           mm1, [esi+72]  ; uint32_t calc_cbp_mmx(const int16_t coeff[6][64]);
57    ;-----------------------------------------------------------------------------
58    
59    por           mm0, [esi+80]  %macro      MAKE_LOAD         2
60    por           mm1, [esi+88]    por mm0, [%2-128*1+%1*8]
61      por mm1, [%2+128*0+%1*8]
62      por mm2, [%2+128*1+%1*8]
63      por mm3, [%2+128*2+%1*8]
64      por mm4, [%2+128*3+%1*8]
65      por mm5, [%2+128*4+%1*8]
66    %endmacro
67    
68    por           mm0, [esi+96]  ALIGN SECTION_ALIGN
69    por           mm1, [esi+104]  calc_cbp_mmx:
70      mov _EAX, prm1            ; coeff
71    
72    por           mm0, [esi+112]    movq mm7, [ignore_dc]
73    por           mm1, [esi+120]    pxor mm6, mm6                ; used only for comparing
74      movq mm0, [_EAX+128*0]
75      movq mm1, [_EAX+128*1]
76      movq mm2, [_EAX+128*2]
77      movq mm3, [_EAX+128*3]
78      movq mm4, [_EAX+128*4]
79      movq mm5, [_EAX+128*5]
80      add _EAX, 8+128
81      pand mm0, mm7
82      pand mm1, mm7
83      pand mm2, mm7
84      pand mm3, mm7
85      pand mm4, mm7
86      pand mm5, mm7
87    
88      MAKE_LOAD 0, _EAX
89      MAKE_LOAD 1, _EAX
90      MAKE_LOAD 2, _EAX
91      MAKE_LOAD 3, _EAX
92      MAKE_LOAD 4, _EAX
93      MAKE_LOAD 5, _EAX
94      MAKE_LOAD 6, _EAX
95      MAKE_LOAD 7, _EAX
96      MAKE_LOAD 8, _EAX
97      MAKE_LOAD 9, _EAX
98      MAKE_LOAD 10, _EAX
99      MAKE_LOAD 11, _EAX
100      MAKE_LOAD 12, _EAX
101      MAKE_LOAD 13, _EAX
102      MAKE_LOAD 14, _EAX
103    
104      movq mm7, [mult_mask]
105      packssdw mm0, mm1
106      packssdw mm2, mm3
107      packssdw mm4, mm5
108      packssdw mm0, mm2
109      packssdw mm4, mm6
110      pcmpeqw mm0, mm6
111      pcmpeqw mm4, mm6
112      pcmpeqw mm0, mm6
113      pcmpeqw mm4, mm6
114      psrlw mm0, 15
115      psrlw mm4, 15
116      packuswb mm0, mm4
117      pmaddwd mm0, mm7
118    
   por           mm0, mm1  
119    movq          mm1, mm0    movq          mm1, mm0
120    psrlq         mm1, 32    psrlq         mm1, 32
121    lea           esi, [esi + 128]    paddusb mm0, mm1
   
   por           mm0, mm1  
   movd          ebx, mm0  
   
   test          ebx, ebx  
   jz            .next  
   or            eax, edx     ; cbp |= 1 << (5-i)  
   
 .next  
   shr           edx,1  
   jnc           .loop  
   
   pop           esi  
   pop           ebx  
122    
123      movd eax, mm0
124      shr _EAX, 8
125      and _EAX, 0x3F
126    ret    ret
127    ENDFUNC
128    
129    NON_EXEC_STACK

Legend:
Removed from v.655  
changed lines
  Added in v.1877

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