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

1 : canard 1.2 # Copyright (C) 2002 Guillaume Morin <guillaume@morinfr.org>, Alcôve
2 : canard 1.1 #
3 : edgomez 1.11 # 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 : canard 1.1 #
18 : edgomez 1.13 # $Id: cbp_ppc.s,v 1.12 2004/03/22 22:36:23 edgomez Exp $
19 :     # $Source: /xvid/xvidcore/src/bitstream/ppc_asm/cbp_ppc.s,v $
20 :     # $Date: 2004/03/22 22:36:23 $
21 :     # $Author: edgomez $
22 : canard 1.2 #
23 : canard 1.5 # This is my first PPC ASM attempt. So I might do nasty things.
24 :     # Please send any comments to <guillaume@morinfr.org>
25 : canard 1.2
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 : canard 1.8 .data
54 :     .skip:
55 :     .word 0,-1
56 :     .align 4
57 :    
58 : canard 1.1 .text
59 :     .global calc_cbp_ppc
60 :     calc_cbp_ppc:
61 : canard 1.2 # r9 will contain coeffs addr
62 : canard 1.9 mr %r9,%r3
63 : canard 1.4 # r8 is the loop counter (rows)
64 : canard 1.9 li %r8,5
65 : canard 1.2 # r3 contains the result, therefore we set it to 0
66 : canard 1.9 li %r3,0
67 : canard 1.1 .loop:
68 : canard 1.5 # CTR is the loop2 counter
69 : canard 1.9 li %r4,16
70 :     mtctr %r4
71 : canard 1.2 # r6 is coeff pointer for this line
72 : canard 1.9 mr %r6,%r9
73 :     lis %r7,.skip@ha
74 :     addi %r7,%r7,.skip@l
75 :     lwz %r7,0(%r7)
76 : canard 1.1 .loop2:
77 : canard 1.2 # coeffs is a matrix of 16 bits cells
78 : canard 1.9 lwz %r4,0(%r6)
79 :     and %r4,%r4,%r7
80 :     li %r7,-1
81 : canard 1.8
82 : canard 1.9 lwz %r5,4(%r6)
83 : canard 1.2 # or. updates CR0
84 : canard 1.9 or. %r4,%r5,%r4
85 : canard 1.2 # testing bit 2 (is zero) of CR0
86 : canard 1.3 bf 2,.cbp
87 : canard 1.9 addi %r6,%r6,8
88 : canard 1.5 bdnz .loop2
89 : canard 1.8 b .newline
90 : canard 1.1 .cbp:
91 : canard 1.9 li %r4,1
92 :     slw %r4,%r4,%r8
93 :     or %r3,%r3,%r4
94 : canard 1.1 .newline:
95 : canard 1.9 addi %r9,%r9,128
96 : canard 1.2 # updates CR0, blabla
97 : canard 1.9 subic. %r8,%r8,1
98 : canard 1.3 bf 0,.loop
99 : canard 1.1 blr

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