[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 655 - (view) (download)

1 : canard 70 # Copyright (C) 2002 Guillaume Morin <guillaume@morinfr.org>, Alc˘ve
2 :     #
3 : edgomez 655 # * This file is part of XviD, a free MPEG-4 video encoder/decoder
4 :     # *
5 :     # * XviD is free software; you can redistribute it and/or modify it
6 :     # * under the terms of the GNU General Public License as published by
7 :     # * the Free Software Foundation; either version 2 of the License, or
8 :     # * (at your option) any later version.
9 :     # *
10 :     # * This program is distributed in the hope that it will be useful,
11 :     # * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 :     # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 :     # * GNU General Public License for more details.
14 :     # *
15 :     # * You should have received a copy of the GNU General Public License
16 :     # * along with this program; if not, write to the Free Software
17 :     # * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 :     # *
19 :     # * Under section 8 of the GNU General Public License, the copyright
20 :     # * holders of XVID explicitly forbid distribution in the following
21 :     # * countries:
22 :     # *
23 :     # * - Japan
24 :     # * - United States of America
25 :     # *
26 :     # * Linking XviD statically or dynamically with other modules is making a
27 :     # * combined work based on XviD. Thus, the terms and conditions of the
28 :     # * GNU General Public License cover the whole combination.
29 :     # *
30 :     # * As a special exception, the copyright holders of XviD give you
31 :     # * permission to link XviD with independent modules that communicate with
32 :     # * XviD solely through the VFW1.1 and DShow interfaces, regardless of the
33 :     # * license terms of these independent modules, and to copy and distribute
34 :     # * the resulting combined work under terms of your choice, provided that
35 :     # * every copy of the combined work is accompanied by a complete copy of
36 :     # * the source code of XviD (the version of XviD used to produce the
37 :     # * combined work), being distributed under the terms of the GNU General
38 :     # * Public License plus this exception. An independent module is a module
39 :     # * which is not derived from or based on XviD.
40 :     # *
41 :     # * Note that people who make modified versions of XviD are not obligated
42 :     # * to grant this special exception for their modified versions; it is
43 :     # * their choice whether to do so. The GNU General Public License gives
44 :     # * permission to release a modified version without this exception; this
45 :     # * exception also makes it possible to release a modified version which
46 :     # * carries forward this exception.
47 :     # *
48 : canard 70 #
49 : edgomez 655 # $Id: cbp_altivec.s,v 1.3 2002-11-17 00:57:57 edgomez Exp $
50 : canard 70 # $Source: /home/xvid/cvs_copy/cvs-server-root/xvid/xvidcore/src/bitstream/ppc_asm/cbp_altivec.s,v $
51 : edgomez 655 # $Date: 2002-11-17 00:57:57 $
52 :     # $Author: edgomez $
53 : canard 70 #
54 :     # This is my first PPC ASM attempt. So I might do nasty things.
55 :     # Please send any comments to <guillaume@morinfr.org>
56 :    
57 :    
58 :     # Returns a field of bits that indicates non zero ac blocks
59 :     # for this macro block
60 :     #
61 :     # uint32_t calc_cbp_c(const int16_t codes[6][64])
62 :     #{
63 :     # uint32_t i, j;
64 :     # uint32_t cbp = 0;
65 :     #
66 :     # for (i = 0; i < 6; i++) {
67 :     # for (j = 1; j < 61; j+=4) {
68 :     # if (codes[i][j] |codes[i][j+1]|
69 :     # codes[i][j+2]|codes[i][j+3]) {
70 :     # cbp |= 1 << (5 - i);
71 :     # break;
72 :     # }
73 :     # }
74 :     #
75 :     # if(codes[i][j]|codes[i][j+1]|codes[i][j+2])
76 :     # cbp |= 1 << (5 - i);
77 :     #
78 :     # }
79 :     #
80 :     # return cbp;
81 :     #
82 :     #}
83 :    
84 :     .data
85 :     .skip:
86 :     .quad 0x0000FFFFFFFFFFFF,-1
87 :     .align 4
88 :    
89 :     .text
90 :     .global calc_cbp_altivec
91 :     calc_cbp_altivec:
92 : canard 75 # Set VRSAVE
93 :     li %r4,0xFFFFFFFF
94 :     mtspr 256,%r4
95 :    
96 : canard 70 # r9 will contain coeffs addr
97 : canard 75 mr %r9,%r3
98 : canard 70 # r3 contains the result, therefore we set it to 0
99 : canard 75 li %r3,0
100 : canard 70
101 :     # CTR is the loop counter (rows)
102 : canard 75 li %r4,6
103 :     mtctr %r4
104 :    
105 :     # VR9 contains 0
106 :     vxor 9,9,9
107 :    
108 :     # VR10 will help us to remove the first 16 bits of each row
109 :     lis %r4,.skip@ha
110 :     addi %r4,4,.skip@l
111 :     lvx 10,0,%r4
112 : canard 70 .loop:
113 : canard 75 mr %r6,%r9
114 :    
115 :     lvxl 1,0,%r6
116 :     # Set the first 16 bits to 0
117 : canard 70 vand 1,1,10
118 :    
119 : canard 75 addi %r6,%r6,16
120 : canard 70 lvxl 2,0,6
121 :    
122 : canard 75 addi %r6,%r6,16
123 : canard 70 lvxl 3,0,6
124 :    
125 : canard 75 addi %r6,%r6,16
126 : canard 70 lvxl 4,0,6
127 :    
128 : canard 75 addi %r6,%r6,16
129 : canard 70 lvxl 5,0,6
130 :    
131 : canard 75 addi %r6,%r6,16
132 : canard 70 lvxl 6,0,6
133 :    
134 : canard 75 addi %r6,%r6,16
135 : canard 70 lvxl 7,0,6
136 :    
137 : canard 75 addi %r6,%r6,16
138 : canard 70 lvxl 8,0,6
139 :    
140 :     vor 1,2,1
141 :     vor 1,3,1
142 :     vor 1,4,1
143 :     vor 1,5,1
144 :     vor 1,6,1
145 :     vor 1,7,1
146 :     vor 1,8,1
147 :    
148 : canard 75 # is VR1 == 0
149 :     vcmpequw. 3,1,9
150 : canard 70 bt 24,.newline
151 :     .cbp:
152 : canard 75 # cbp calc
153 :     mfctr %r5
154 :     subi %r5,%r5,1
155 :     li %r4,1
156 :     slw %r4,%r4,%r5
157 :     or %r3,%r3,%r4
158 : canard 70 .newline:
159 : canard 75 addi %r9,%r9,128
160 : canard 70 bdnz .loop
161 :     blr

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