[cvs] / xvidcore / src / bitstream / ppc_asm / cbp_ppc.s Repository:
ViewVC logotype

Annotation of /xvidcore/src/bitstream/ppc_asm/cbp_ppc.s

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (view) (download)

1 : canard 1.2 # Copyright (C) 2002 Guillaume Morin <guillaume@morinfr.org>, Alcôve
2 : canard 1.1 #
3 :     # 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 :     #
8 :     # 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 :     # $Id: lib.c,v 1.33 2002/03/18 11:14:23 gmorin Exp $
19 :     # $Source: /cvsroot/nss-mysql/nss-mysql/lib.c,v $
20 :     # $Date: 2002/03/18 11:14:23 $
21 :     # $Author: gmorin $
22 : canard 1.2 #
23 :     # This is my first PPC ASM program. So I might do nasty things.
24 :     # Please send any comments to guillaume@morinfr.org
25 :    
26 : canard 1.1
27 : canard 1.2 # 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 : canard 1.1 #{
32 : canard 1.2 # uint32_t i, j;
33 :     # uint32_t cbp = 0;
34 : canard 1.1 #
35 : canard 1.2 # for (i = 0; i < 6; i++) {
36 :     # for (j = 1; j < 61; j+=4) {
37 : canard 1.1 # if (codes[i][j] |codes[i][j+1]|
38 : canard 1.2 # codes[i][j+2]|codes[i][j+3]) {
39 : canard 1.1 # cbp |= 1 << (5 - i);
40 :     # break;
41 :     # }
42 :     # }
43 : canard 1.2 #
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 : canard 1.1 #}
52 :    
53 :     .text
54 :     .global calc_cbp_ppc
55 :     calc_cbp_ppc:
56 : canard 1.2 # r9 will contain coeffs addr
57 : canard 1.1 mr 9,3
58 : canard 1.2 # r8 is the loop counter
59 : canard 1.1 li 8,5
60 : canard 1.2 # r3 contains the result, therefore we set it to 0
61 : canard 1.1 xor 3,3,3
62 :     .loop:
63 : canard 1.2 # r7 is the loop2 counter, FIXME: use CTR
64 : canard 1.1 li 7,14
65 : canard 1.2 # r6 is coeff pointer for this line
66 : canard 1.1 mr 6,9
67 :     .loop2:
68 : canard 1.2 # coeffs is a matrix of 16 bits cells
69 : canard 1.1 lha 4,2(6)
70 :     lha 5,4(6)
71 :     or 4,5,4
72 :     lha 5,6(6)
73 :     or 4,5,4
74 :     lha 5,8(6)
75 : canard 1.2 # or. updates CR0
76 :     or. 4,5,4
77 :     # testing bit 2 (is zero) of CR0
78 :     bc 4,2,.cbp
79 : canard 1.1 addi 6,6,8
80 : canard 1.2 # subic. updates CR0
81 :     subic. 7,7,1
82 :     # testing bit 0 (is negative) of CR0
83 :     bc 12,0,.lastcoeffs
84 : canard 1.1 b .loop2
85 :     .lastcoeffs:
86 :     lha 4,2(6)
87 :     lha 5,4(6)
88 :     or 4,5,4
89 :     lha 5,6(6)
90 : canard 1.2 # or. updates CR0
91 :     or. 4,5,4
92 :     # testing bit 2 (is zero) of CR0
93 :     bc 12,2,.newline
94 : canard 1.1 .cbp:
95 :     li 4,1
96 :     slw 4,4,8
97 :     or 3,3,4
98 :     b .newline
99 :     .newline:
100 :     addi 9,9,128
101 : canard 1.2 # updates CR0, blabla
102 :     subic. 8,8,1
103 :     bc 4,0,.loop
104 : canard 1.1 .end:
105 :     blr

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