1 |
# Copyright (C) 2002 Guillaume Morin <guillaume@morinfr.org>, Alcôve |
# Copyright (C) 2002 Guillaume Morin <guillaume@morinfr.org>, Alcôve |
2 |
# |
# |
3 |
# This program is free software; you can redistribute it and/or modify |
# * This file is part of XviD, a free MPEG-4 video encoder/decoder |
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 |
# * XviD is free software; you can redistribute it and/or modify it |
6 |
# (at your option) any later version. |
# * 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 |
# This program is distributed in the hope that it will be useful, |
# * (at your option) any later version. |
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
# * |
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# * This program is distributed in the hope that it will be useful, |
11 |
# GNU General Public License for more details. |
# * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 |
# |
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 |
# You should have received a copy of the GNU General Public License |
# * GNU General Public License for more details. |
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 |
# * 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 |
# |
# |
49 |
# |
# $Id: cbp_altivec.s,v 1.3 2002-11-17 00:57:57 edgomez Exp $ |
|
# $Id: cbp_altivec.s,v 1.1 2002-03-26 23:21:02 canard Exp $ |
|
50 |
# $Source: /home/xvid/cvs_copy/cvs-server-root/xvid/xvidcore/src/bitstream/ppc_asm/cbp_altivec.s,v $ |
# $Source: /home/xvid/cvs_copy/cvs-server-root/xvid/xvidcore/src/bitstream/ppc_asm/cbp_altivec.s,v $ |
51 |
# $Date: 2002-03-26 23:21:02 $ |
# $Date: 2002-11-17 00:57:57 $ |
52 |
# $Author: canard $ |
# $Author: edgomez $ |
53 |
# |
# |
54 |
# This is my first PPC ASM attempt. So I might do nasty things. |
# This is my first PPC ASM attempt. So I might do nasty things. |
55 |
# Please send any comments to <guillaume@morinfr.org> |
# Please send any comments to <guillaume@morinfr.org> |
89 |
.text |
.text |
90 |
.global calc_cbp_altivec |
.global calc_cbp_altivec |
91 |
calc_cbp_altivec: |
calc_cbp_altivec: |
92 |
|
# Set VRSAVE |
93 |
|
li %r4,0xFFFFFFFF |
94 |
|
mtspr 256,%r4 |
95 |
|
|
96 |
# r9 will contain coeffs addr |
# r9 will contain coeffs addr |
97 |
mr 9,3 |
mr %r9,%r3 |
98 |
# r3 contains the result, therefore we set it to 0 |
# r3 contains the result, therefore we set it to 0 |
99 |
xor 3,3,3 |
li %r3,0 |
100 |
|
|
101 |
# CTR is the loop counter (rows) |
# CTR is the loop counter (rows) |
102 |
li 4,6 |
li %r4,6 |
103 |
mtctr 4 |
mtctr %r4 |
104 |
vxor 12,12,12 |
|
105 |
lis 4,.skip@ha |
# VR9 contains 0 |
106 |
addi 4,4,.skip@l |
vxor 9,9,9 |
107 |
lvx 10,0,4 |
|
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 |
.loop: |
.loop: |
113 |
mr 6,9 |
mr %r6,%r9 |
114 |
# coeffs is a matrix of 16 bits cells |
|
115 |
lvxl 1,0,6 |
lvxl 1,0,%r6 |
116 |
|
# Set the first 16 bits to 0 |
117 |
vand 1,1,10 |
vand 1,1,10 |
118 |
|
|
119 |
addi 6,6,16 |
addi %r6,%r6,16 |
120 |
lvxl 2,0,6 |
lvxl 2,0,6 |
121 |
|
|
122 |
addi 6,6,16 |
addi %r6,%r6,16 |
123 |
lvxl 3,0,6 |
lvxl 3,0,6 |
124 |
|
|
125 |
addi 6,6,16 |
addi %r6,%r6,16 |
126 |
lvxl 4,0,6 |
lvxl 4,0,6 |
127 |
|
|
128 |
addi 6,6,16 |
addi %r6,%r6,16 |
129 |
lvxl 5,0,6 |
lvxl 5,0,6 |
130 |
|
|
131 |
addi 6,6,16 |
addi %r6,%r6,16 |
132 |
lvxl 6,0,6 |
lvxl 6,0,6 |
133 |
|
|
134 |
addi 6,6,16 |
addi %r6,%r6,16 |
135 |
lvxl 7,0,6 |
lvxl 7,0,6 |
136 |
|
|
137 |
addi 6,6,16 |
addi %r6,%r6,16 |
138 |
lvxl 8,0,6 |
lvxl 8,0,6 |
139 |
|
|
140 |
vor 1,2,1 |
vor 1,2,1 |
145 |
vor 1,7,1 |
vor 1,7,1 |
146 |
vor 1,8,1 |
vor 1,8,1 |
147 |
|
|
148 |
vcmpequw. 3,1,12 |
# is VR1 == 0 |
149 |
|
vcmpequw. 3,1,9 |
150 |
bt 24,.newline |
bt 24,.newline |
151 |
.cbp: |
.cbp: |
152 |
mfctr 5 |
# cbp calc |
153 |
subi 5,5,1 |
mfctr %r5 |
154 |
li 4,1 |
subi %r5,%r5,1 |
155 |
slw 4,4,5 |
li %r4,1 |
156 |
or 3,3,4 |
slw %r4,%r4,%r5 |
157 |
|
or %r3,%r3,%r4 |
158 |
.newline: |
.newline: |
159 |
addi 9,9,128 |
addi %r9,%r9,128 |
160 |
bdnz .loop |
bdnz .loop |
161 |
blr |
blr |