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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 655 - (view) (download)

1 : canard 54 # Copyright (C) 2002 Guillaume Morin <guillaume@morinfr.org>, Alc˘ve
2 : canard 49 #
3 : edgomez 655 # * This file is part of XviD, a free MPEG-4 video encoder/decoder
4 :     # *
5 :     # * XviD is free software; you can redistribute it and/or modify it
6 :     # * 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 :     # * (at your option) any later version.
9 :     # *
10 :     # * This program is distributed in the hope that it will be useful,
11 :     # * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 :     # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 :     # * GNU General Public License for more details.
14 :     # *
15 :     # * 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 : canard 49 #
49 : edgomez 655 # $Id: cbp_ppc.s,v 1.10 2002-11-17 00:57:57 edgomez Exp $
50 : canard 49 # $Source: /home/xvid/cvs_copy/cvs-server-root/xvid/xvidcore/src/bitstream/ppc_asm/cbp_ppc.s,v $
51 : edgomez 655 # $Date: 2002-11-17 00:57:57 $
52 :     # $Author: edgomez $
53 : canard 54 #
54 : canard 57 # This is my first PPC ASM attempt. So I might do nasty things.
55 :     # Please send any comments to <guillaume@morinfr.org>
56 : canard 49
57 : canard 54
58 :     # Returns a field of bits that indicates non zero ac blocks
59 :     # for this macro block
60 :     #
61 :     # uint32_t calc_cbp_c(const int16_t codes[6][64])
62 : canard 49 #{
63 : canard 54 # uint32_t i, j;
64 :     # uint32_t cbp = 0;
65 : canard 49 #
66 : canard 54 # for (i = 0; i < 6; i++) {
67 :     # for (j = 1; j < 61; j+=4) {
68 : canard 49 # if (codes[i][j] |codes[i][j+1]|
69 : canard 54 # codes[i][j+2]|codes[i][j+3]) {
70 : canard 49 # cbp |= 1 << (5 - i);
71 :     # break;
72 :     # }
73 :     # }
74 : canard 54 #
75 :     # if(codes[i][j]|codes[i][j+1]|codes[i][j+2])
76 :     # cbp |= 1 << (5 - i);
77 :     #
78 :     # }
79 :     #
80 :     # return cbp;
81 :     #
82 : canard 49 #}
83 :    
84 : canard 72 .data
85 :     .skip:
86 :     .word 0,-1
87 :     .align 4
88 :    
89 : canard 49 .text
90 :     .global calc_cbp_ppc
91 :     calc_cbp_ppc:
92 : canard 54 # r9 will contain coeffs addr
93 : canard 75 mr %r9,%r3
94 : canard 56 # r8 is the loop counter (rows)
95 : canard 75 li %r8,5
96 : canard 54 # r3 contains the result, therefore we set it to 0
97 : canard 75 li %r3,0
98 : canard 49 .loop:
99 : canard 57 # CTR is the loop2 counter
100 : canard 75 li %r4,16
101 :     mtctr %r4
102 : canard 54 # r6 is coeff pointer for this line
103 : canard 75 mr %r6,%r9
104 :     lis %r7,.skip@ha
105 :     addi %r7,%r7,.skip@l
106 :     lwz %r7,0(%r7)
107 : canard 49 .loop2:
108 : canard 54 # coeffs is a matrix of 16 bits cells
109 : canard 75 lwz %r4,0(%r6)
110 :     and %r4,%r4,%r7
111 :     li %r7,-1
112 : canard 72
113 : canard 75 lwz %r5,4(%r6)
114 : canard 54 # or. updates CR0
115 : canard 75 or. %r4,%r5,%r4
116 : canard 54 # testing bit 2 (is zero) of CR0
117 : canard 55 bf 2,.cbp
118 : canard 75 addi %r6,%r6,8
119 : canard 57 bdnz .loop2
120 : canard 72 b .newline
121 : canard 49 .cbp:
122 : canard 75 li %r4,1
123 :     slw %r4,%r4,%r8
124 :     or %r3,%r3,%r4
125 : canard 49 .newline:
126 : canard 75 addi %r9,%r9,128
127 : canard 54 # updates CR0, blabla
128 : canard 75 subic. %r8,%r8,1
129 : canard 55 bf 0,.loop
130 : canard 49 blr

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