15 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
16 |
# |
# |
17 |
# |
# |
18 |
# $Id: cbp_ppc.s,v 1.4 2002-03-22 12:24:07 canard Exp $ |
# $Id: cbp_ppc.s,v 1.7 2002-03-22 13:39:01 canard Exp $ |
19 |
# $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 $ |
20 |
# $Date: 2002-03-22 12:24:07 $ |
# $Date: 2002-03-22 13:39:01 $ |
21 |
# $Author: canard $ |
# $Author: canard $ |
22 |
# |
# |
23 |
# This is the PPC ASM code I write. So I might do nasty things. |
# This is my first PPC ASM attempt. So I might do nasty things. |
24 |
# Please send any comments to guillaume@morinfr.org |
# Please send any comments to <guillaume@morinfr.org> |
25 |
|
|
26 |
|
|
27 |
# Returns a field of bits that indicates non zero ac blocks |
# Returns a field of bits that indicates non zero ac blocks |
60 |
# r3 contains the result, therefore we set it to 0 |
# r3 contains the result, therefore we set it to 0 |
61 |
xor 3,3,3 |
xor 3,3,3 |
62 |
.loop: |
.loop: |
63 |
# r7 is the loop2 counter (columns), FIXME: use CTR |
# CTR is the loop2 counter |
64 |
li 7,14 |
li 4,15 |
65 |
|
mtctr 4 |
66 |
# r6 is coeff pointer for this line |
# r6 is coeff pointer for this line |
67 |
mr 6,9 |
mr 6,9 |
68 |
.loop2: |
.loop2: |
69 |
# coeffs is a matrix of 16 bits cells |
# coeffs is a matrix of 16 bits cells |
70 |
lha 4,2(6) |
lwz 4,2(6) |
71 |
lha 5,4(6) |
lwz 5,6(6) |
|
or 4,5,4 |
|
|
lha 5,6(6) |
|
|
or 4,5,4 |
|
|
lha 5,8(6) |
|
72 |
# or. updates CR0 |
# or. updates CR0 |
73 |
or. 4,5,4 |
or. 4,5,4 |
74 |
# testing bit 2 (is zero) of CR0 |
# testing bit 2 (is zero) of CR0 |
75 |
bf 2,.cbp |
bf 2,.cbp |
76 |
addi 6,6,8 |
addi 6,6,8 |
77 |
# subic. updates CR0 |
bdnz .loop2 |
78 |
subic. 7,7,1 |
# latest line coeffs |
79 |
# testing bit 0 (is negative) of CR0 |
lwz 4,2(6) |
80 |
bt 0,.lastcoeffs |
lhz 5,6(6) |
|
b .loop2 |
|
|
.lastcoeffs: |
|
|
lha 4,2(6) |
|
|
lha 5,4(6) |
|
|
or 4,5,4 |
|
|
lha 5,6(6) |
|
81 |
# or. updates CR0 |
# or. updates CR0 |
82 |
or. 4,5,4 |
or. 4,5,4 |
83 |
# testing bit 2 (is zero) of CR0 |
# testing bit 2 (is zero) of CR0 |