[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 72, Wed Mar 27 15:06:14 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 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  #    it under the terms of the GNU General Public License as published by
# Line 15  Line 15 
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.1 2002-03-21 23:42:53 canard Exp $  #    $Id: cbp_ppc.s,v 1.8 2002-03-27 15:06:14 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-21 23:42:53 $  #    $Date: 2002-03-27 15:06:14 $
21  #    $Author: canard $  #    $Author: canard $
22    #
23    #    This is my first PPC ASM attempt. So I might do nasty things.
24    #    Please send any comments to <guillaume@morinfr.org>
25    
26    
27    # 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])  #uint32_t calc_cbp_c(const int16_t codes[6][64])
31  #{  #{
32  #    uint32_t i, j;  #    uint32_t i, j;
33  #    uint32_t cbp = 0;  #    uint32_t cbp = 0;
34  #  #
35  #    for (i = 0; i < 6; i++) {  #    for (i = 0; i < 6; i++) {
36  #               for (j = 1; j < 64/4; j+=4) {  #               for (j = 1; j < 61; j+=4) {
37  #                       if (codes[i][j]  |codes[i][j+1]|  #                       if (codes[i][j]  |codes[i][j+1]|
38  #                               codes[i][j+2]|codes[i][j+3]) {  #                               codes[i][j+2]|codes[i][j+3]) {
39  #                               cbp |= 1 << (5 - i);  #                               cbp |= 1 << (5 - i);
40  #                               break;  #                               break;
41  #                       }  #                       }
42  #               }  #               }
43    #
44    #               if(codes[i][j]|codes[i][j+1]|codes[i][j+2])
45    #                       cbp |= 1 << (5 - i);
46    #
47  #    }  #    }
48    #
49  #    return cbp;  #    return cbp;
50    #
51  #}  #}
52    
53    .data
54    .skip:
55            .word 0,-1
56    .align 4
57    
58  .text  .text
59  .global calc_cbp_ppc  .global calc_cbp_ppc
60  calc_cbp_ppc:  calc_cbp_ppc:
61            # r9 will contain coeffs addr
62          mr 9,3          mr 9,3
63            # r8 is the loop counter (rows)
64          li 8,5          li 8,5
65          xor 3,3,3          # r3 contains the result, therefore we set it to 0
66            li 3,0
67  .loop:  .loop:
68          li 7,14          # CTR is the loop2 counter
69            li 4,16
70            mtctr 4
71            # r6 is coeff pointer for this line
72          mr 6,9          mr 6,9
73            lis 7,.skip@ha
74            addi 7,7,.skip@l
75            lwz 7,0(7)
76  .loop2:  .loop2:
77          lha 4,2(6)          # coeffs is a matrix of 16 bits cells
78          lha 5,4(6)          lwz 4,0(6)
79          or 4,5,4          and 4,4,7
80          lha 5,6(6)          li 7,-1
81          or 4,5,4  
82          lha 5,8(6)          lwz 5,4(6)
83          or 4,5,4          # or. updates CR0
84          cmpwi 4,0          or. 4,5,4
85          bne .cbp          # testing bit 2 (is zero) of CR0
86            bf 2,.cbp
87          addi 6,6,8          addi 6,6,8
88          subi 7,7,1          bdnz .loop2
89          cmpwi 7,-1          b .newline
         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  
90  .cbp:  .cbp:
91          li 4,1          li 4,1
92          slw 4,4,8          slw 4,4,8
93          or 3,3,4          or 3,3,4
         b .newline  
94  .newline:  .newline:
95          addi 9,9,128          addi 9,9,128
96          subi 8,8,1          # updates CR0, blabla
97          cmpwi 8,-1          subic. 8,8,1
98          bne .loop          bf 0,.loop
 .end:  
99          blr          blr

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

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