[svn] / trunk / xvidcore / src / bitstream / ppc_asm / cbp_altivec.s Repository:
ViewVC logotype

Annotation of /trunk/xvidcore/src/bitstream/ppc_asm/cbp_altivec.s

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1382 - (view) (download)

1 : canard 70 # Copyright (C) 2002 Guillaume Morin <guillaume@morinfr.org>, Alcôve
2 :     #
3 : edgomez 851 # This program is free software; you can redistribute it and/or modify
4 :     # it under the terms of the GNU General Public License as published by
5 :     # the Free Software Foundation; either version 2 of the License, or
6 :     # (at your option) any later version.
7 : canard 70 #
8 : edgomez 851 # This program is distributed in the hope that it will be useful,
9 :     # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 :     # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 :     # GNU General Public License for more details.
12 :     #
13 :     # You should have received a copy of the GNU General Public License
14 :     # along with this program; if not, write to the Free Software
15 :     # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 :     #
17 :     #
18 : edgomez 1382 # $Id: cbp_altivec.s,v 1.5 2004-03-22 22:36:23 edgomez Exp $
19 : canard 70 # $Source: /home/xvid/cvs_copy/cvs-server-root/xvid/xvidcore/src/bitstream/ppc_asm/cbp_altivec.s,v $
20 : edgomez 1382 # $Date: 2004-03-22 22:36:23 $
21 : edgomez 655 # $Author: edgomez $
22 : canard 70 #
23 :     # This is my first PPC ASM attempt. So I might do nasty things.
24 :     # Please send any comments to <guillaume@morinfr.org>
25 :    
26 :    
27 :     # Returns a field of bits that indicates non zero ac blocks
28 :     # for this macro block
29 :     #
30 :     # uint32_t calc_cbp_c(const int16_t codes[6][64])
31 :     #{
32 :     # uint32_t i, j;
33 :     # uint32_t cbp = 0;
34 :     #
35 :     # for (i = 0; i < 6; i++) {
36 :     # for (j = 1; j < 61; j+=4) {
37 :     # if (codes[i][j] |codes[i][j+1]|
38 :     # codes[i][j+2]|codes[i][j+3]) {
39 :     # cbp |= 1 << (5 - i);
40 :     # break;
41 :     # }
42 :     # }
43 :     #
44 :     # if(codes[i][j]|codes[i][j+1]|codes[i][j+2])
45 :     # cbp |= 1 << (5 - i);
46 :     #
47 :     # }
48 :     #
49 :     # return cbp;
50 :     #
51 :     #}
52 :    
53 :     .data
54 :     .skip:
55 :     .quad 0x0000FFFFFFFFFFFF,-1
56 :     .align 4
57 :    
58 :     .text
59 :     .global calc_cbp_altivec
60 :     calc_cbp_altivec:
61 : canard 75 # Set VRSAVE
62 :     li %r4,0xFFFFFFFF
63 :     mtspr 256,%r4
64 :    
65 : canard 70 # r9 will contain coeffs addr
66 : canard 75 mr %r9,%r3
67 : canard 70 # r3 contains the result, therefore we set it to 0
68 : canard 75 li %r3,0
69 : canard 70
70 :     # CTR is the loop counter (rows)
71 : canard 75 li %r4,6
72 :     mtctr %r4
73 :    
74 :     # VR9 contains 0
75 :     vxor 9,9,9
76 :    
77 :     # VR10 will help us to remove the first 16 bits of each row
78 :     lis %r4,.skip@ha
79 :     addi %r4,4,.skip@l
80 :     lvx 10,0,%r4
81 : canard 70 .loop:
82 : canard 75 mr %r6,%r9
83 :    
84 :     lvxl 1,0,%r6
85 :     # Set the first 16 bits to 0
86 : canard 70 vand 1,1,10
87 :    
88 : canard 75 addi %r6,%r6,16
89 : canard 70 lvxl 2,0,6
90 :    
91 : canard 75 addi %r6,%r6,16
92 : canard 70 lvxl 3,0,6
93 :    
94 : canard 75 addi %r6,%r6,16
95 : canard 70 lvxl 4,0,6
96 :    
97 : canard 75 addi %r6,%r6,16
98 : canard 70 lvxl 5,0,6
99 :    
100 : canard 75 addi %r6,%r6,16
101 : canard 70 lvxl 6,0,6
102 :    
103 : canard 75 addi %r6,%r6,16
104 : canard 70 lvxl 7,0,6
105 :    
106 : canard 75 addi %r6,%r6,16
107 : canard 70 lvxl 8,0,6
108 :    
109 :     vor 1,2,1
110 :     vor 1,3,1
111 :     vor 1,4,1
112 :     vor 1,5,1
113 :     vor 1,6,1
114 :     vor 1,7,1
115 :     vor 1,8,1
116 :    
117 : canard 75 # is VR1 == 0
118 :     vcmpequw. 3,1,9
119 : canard 70 bt 24,.newline
120 :     .cbp:
121 : canard 75 # cbp calc
122 :     mfctr %r5
123 :     subi %r5,%r5,1
124 :     li %r4,1
125 :     slw %r4,%r4,%r5
126 :     or %r3,%r3,%r4
127 : canard 70 .newline:
128 : canard 75 addi %r9,%r9,128
129 : canard 70 bdnz .loop
130 :     blr

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