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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 49, Thu Mar 21 23:42:53 2002 UTC revision 655, Sun Nov 17 00:57:58 2002 UTC
# Line 1  Line 1 
1  #    Copyright (C) 2002 Guillaume Morin, 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    # *  (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  #  #
49  #    This program is distributed in the hope that it will be useful,  #    $Id: cbp_ppc.s,v 1.10 2002-11-17 00:57:57 edgomez Exp $
 #    but WITHOUT ANY WARRANTY; without even the implied warranty of  
 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
 #    GNU General Public License for more details.  
 #  
 #    You should have received a copy of the GNU General Public License  
 #    along with this program; if not, write to the Free Software  
 #    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
 #  
 #  
 #    $Id: cbp_ppc.s,v 1.1 2002-03-21 23:42:53 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-21 23:42:53 $  #    $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.
55    #    Please send any comments to <guillaume@morinfr.org>
56    
57    
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])  #uint32_t calc_cbp_c(const int16_t codes[6][64])
62  #{  #{
63  #    uint32_t i, j;  #    uint32_t i, j;
64  #    uint32_t cbp = 0;  #    uint32_t cbp = 0;
65  #  #
66  #    for (i = 0; i < 6; i++) {  #    for (i = 0; i < 6; i++) {
67  #               for (j = 1; j < 64/4; j+=4) {  #               for (j = 1; j < 61; j+=4) {
68  #                       if (codes[i][j]  |codes[i][j+1]|  #                       if (codes[i][j]  |codes[i][j+1]|
69  #                               codes[i][j+2]|codes[i][j+3]) {  #                               codes[i][j+2]|codes[i][j+3]) {
70  #                               cbp |= 1 << (5 - i);  #                               cbp |= 1 << (5 - i);
71  #                               break;  #                               break;
72  #                       }  #                       }
73  #               }  #               }
74    #
75    #               if(codes[i][j]|codes[i][j+1]|codes[i][j+2])
76    #                       cbp |= 1 << (5 - i);
77    #
78  #    }  #    }
79    #
80  #    return cbp;  #    return cbp;
81    #
82  #}  #}
83    
84    .data
85    .skip:
86            .word 0,-1
87    .align 4
88    
89  .text  .text
90  .global calc_cbp_ppc  .global calc_cbp_ppc
91  calc_cbp_ppc:  calc_cbp_ppc:
92          mr 9,3          # r9 will contain coeffs addr
93          li 8,5          mr %r9,%r3
94          xor 3,3,3          # r8 is the loop counter (rows)
95            li %r8,5
96            # r3 contains the result, therefore we set it to 0
97            li %r3,0
98  .loop:  .loop:
99          li 7,14          # CTR is the loop2 counter
100          mr 6,9          li %r4,16
101            mtctr %r4
102            # r6 is coeff pointer for this line
103            mr %r6,%r9
104            lis %r7,.skip@ha
105            addi %r7,%r7,.skip@l
106            lwz %r7,0(%r7)
107  .loop2:  .loop2:
108          lha 4,2(6)          # coeffs is a matrix of 16 bits cells
109          lha 5,4(6)          lwz %r4,0(%r6)
110          or 4,5,4          and %r4,%r4,%r7
111          lha 5,6(6)          li %r7,-1
112          or 4,5,4  
113          lha 5,8(6)          lwz %r5,4(%r6)
114          or 4,5,4          # or. updates CR0
115          cmpwi 4,0          or. %r4,%r5,%r4
116          bne .cbp          # testing bit 2 (is zero) of CR0
117          addi 6,6,8          bf 2,.cbp
118          subi 7,7,1          addi %r6,%r6,8
119          cmpwi 7,-1          bdnz .loop2
         beq .lastcoeffs  
         b .loop2  
 .lastcoeffs:  
         lha 4,2(6)  
         lha 5,4(6)  
         or 4,5,4  
         lha 5,6(6)  
         or 4,5,4  
         cmpwi 4,0  
         beq .newline  
 .cbp:  
         li 4,1  
         slw 4,4,8  
         or 3,3,4  
120          b .newline          b .newline
121    .cbp:
122            li %r4,1
123            slw %r4,%r4,%r8
124            or %r3,%r3,%r4
125  .newline:  .newline:
126          addi 9,9,128          addi %r9,%r9,128
127          subi 8,8,1          # updates CR0, blabla
128          cmpwi 8,-1          subic. %r8,%r8,1
129          bne .loop          bf 0,.loop
 .end:  
130          blr          blr

Legend:
Removed from v.49  
changed lines
  Added in v.655

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