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_ppc.s,v 1.10 2002-11-17 00:57:57 edgomez Exp $ |
|
# $Id: cbp_ppc.s,v 1.8 2002-03-27 15:06:14 canard Exp $ |
|
50 |
# $Source: /home/xvid/cvs_copy/cvs-server-root/xvid/xvidcore/src/bitstream/ppc_asm/cbp_ppc.s,v $ |
# $Source: /home/xvid/cvs_copy/cvs-server-root/xvid/xvidcore/src/bitstream/ppc_asm/cbp_ppc.s,v $ |
51 |
# $Date: 2002-03-27 15:06:14 $ |
# $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> |
90 |
.global calc_cbp_ppc |
.global calc_cbp_ppc |
91 |
calc_cbp_ppc: |
calc_cbp_ppc: |
92 |
# r9 will contain coeffs addr |
# r9 will contain coeffs addr |
93 |
mr 9,3 |
mr %r9,%r3 |
94 |
# r8 is the loop counter (rows) |
# r8 is the loop counter (rows) |
95 |
li 8,5 |
li %r8,5 |
96 |
# r3 contains the result, therefore we set it to 0 |
# r3 contains the result, therefore we set it to 0 |
97 |
li 3,0 |
li %r3,0 |
98 |
.loop: |
.loop: |
99 |
# CTR is the loop2 counter |
# CTR is the loop2 counter |
100 |
li 4,16 |
li %r4,16 |
101 |
mtctr 4 |
mtctr %r4 |
102 |
# r6 is coeff pointer for this line |
# r6 is coeff pointer for this line |
103 |
mr 6,9 |
mr %r6,%r9 |
104 |
lis 7,.skip@ha |
lis %r7,.skip@ha |
105 |
addi 7,7,.skip@l |
addi %r7,%r7,.skip@l |
106 |
lwz 7,0(7) |
lwz %r7,0(%r7) |
107 |
.loop2: |
.loop2: |
108 |
# coeffs is a matrix of 16 bits cells |
# coeffs is a matrix of 16 bits cells |
109 |
lwz 4,0(6) |
lwz %r4,0(%r6) |
110 |
and 4,4,7 |
and %r4,%r4,%r7 |
111 |
li 7,-1 |
li %r7,-1 |
112 |
|
|
113 |
lwz 5,4(6) |
lwz %r5,4(%r6) |
114 |
# or. updates CR0 |
# or. updates CR0 |
115 |
or. 4,5,4 |
or. %r4,%r5,%r4 |
116 |
# testing bit 2 (is zero) of CR0 |
# testing bit 2 (is zero) of CR0 |
117 |
bf 2,.cbp |
bf 2,.cbp |
118 |
addi 6,6,8 |
addi %r6,%r6,8 |
119 |
bdnz .loop2 |
bdnz .loop2 |
120 |
b .newline |
b .newline |
121 |
.cbp: |
.cbp: |
122 |
li 4,1 |
li %r4,1 |
123 |
slw 4,4,8 |
slw %r4,%r4,%r8 |
124 |
or 3,3,4 |
or %r3,%r3,%r4 |
125 |
.newline: |
.newline: |
126 |
addi 9,9,128 |
addi %r9,%r9,128 |
127 |
# updates CR0, blabla |
# updates CR0, blabla |
128 |
subic. 8,8,1 |
subic. %r8,%r8,1 |
129 |
bf 0,.loop |
bf 0,.loop |
130 |
blr |
blr |