[cvs] / xvidcore / src / bitstream / cbp.c Repository:
ViewVC logotype

Diff of /xvidcore/src/bitstream/cbp.c

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

revision 1.10.2.3, Wed Oct 1 23:23:01 2003 UTC revision 1.11, Sun Mar 9 11:30:24 2003 UTC
# Line 1  Line 1 
 /*****************************************************************************  
  *  
  *  XVID MPEG-4 VIDEO CODEC  
  *  - CBP related function  -  
  *  
  *  Copyright(C) 2002-2003 Edouard Gomez <ed.gomez@free.fr>  
  *               2003      Christoph Lampert <gruel@web.de>  
  *  
  *  This program is free software ; you can redistribute it and/or modify  
  *  it under the terms of the GNU General Public License as published by  
  *  the Free Software Foundation ; either version 2 of the License, or  
  *  (at your option) any later version.  
  *  
  *  This program is distributed in the hope that it will be useful,  
  *  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$  
  *  
  ****************************************************************************/  
   
1  #include "../portab.h"  #include "../portab.h"
2  #include "cbp.h"  #include "cbp.h"
3    
# Line 56  Line 30 
30  uint32_t  uint32_t
31  calc_cbp_c(const int16_t codes[6 * 64])  calc_cbp_c(const int16_t codes[6 * 64])
32  {  {
33          unsigned int i=6;          int i, j;
34          uint32_t cbp = 0;          uint32_t cbp = 0;
35    /* if definition is changed (e.g. from int16_t to something like int) this routine
36       is not possible anymore! */
37    
38  /* uses fixed relation: 4*codes = 1*codes64 */     for (i = 5; i >= 0; i--, codes += 64) {
 /* if prototype is changed (e.g. from int16_t to something like int32) this routine  
    has to be changed! */  
   
         do  {  
                 uint64_t *codes64 = (uint64_t*)codes;   /* the compiler doesn't really make this */  
                 uint32_t *codes32 = (uint32_t*)codes;   /* variables, just "addressing modes" */  
39    
40                    uint64_t *codes64 = (uint64_t*)codes;
41                  cbp += cbp;                  cbp += cbp;
42          if (codes[1] || codes32[1]) {          if (codes[1] || codes[2] || codes[3]) {
43                          cbp++;                          cbp++;
44                            continue;
45                  }                  }
46          else if (codes64[1] | codes64[2] | codes64[3]) {          if (codes64[1] | codes64[2] | codes64[3]) {
47                          cbp++;                          cbp++;
48                            continue;
49                  }                  }
50          else if (codes64[4] | codes64[5] | codes64[6] | codes64[7]) {          if (codes64[4] | codes64[5] | codes64[6] | codes64[7]) {
51                          cbp++;                          cbp++;
52                            continue;
53                  }                  }
54          else if (codes64[8] | codes64[9] | codes64[10] | codes64[11]) {          if (codes64[8] | codes64[9] | codes64[10] | codes64[11]) {
55                          cbp++;                          cbp++;
56                            continue;
57                  }                  }
58          else if (codes64[12] | codes64[13] | codes64[14] | codes64[15]) {          if (codes64[12] | codes64[13] | codes64[14] | codes64[15]) {
59                          cbp++;                          cbp++;
60                            continue;
61                    }
62                  }                  }
                 codes += 64;  
                 i--;  
     } while (i != 0);  
63    
64          return cbp;          return cbp;
65  }  }
# Line 94  Line 68 
68    
69    
70  /* older code maybe better on some plattforms? */  /* older code maybe better on some plattforms? */
71  #if 0  #if (0==1)
72          for (i = 5; i >= 0; i--) {          for (i = 5; i >= 0; i--) {
73                  if (codes[1] | codes[2] | codes[3])                  if (codes[1] | codes[2] | codes[3])
74                          cbp |= 1 << i;                          cbp |= 1 << i;

Legend:
Removed from v.1.10.2.3  
changed lines
  Added in v.1.11

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