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

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

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

revision 1.25.2.14, Sun Feb 9 06:33:51 2003 UTC revision 1.42, Sat Feb 15 15:22:18 2003 UTC
# Line 110  Line 110 
110  void  void
111  init_vlc_tables(void)  init_vlc_tables(void)
112  {  {
113          ptr_t i, j, k, intra, last, run,  run_esc, level, level_esc, escape, escape_len, offset;          uint32_t i, j, k, intra, last, run,  run_esc, level, level_esc, escape, escape_len, offset;
114          int32_t l;          int32_t l;
115    
116  #ifdef BIGLUT  #ifdef BIGLUT
# Line 127  Line 127 
127                  for (last = 0; last < 2; last++)                  for (last = 0; last < 2; last++)
128                  {                  {
129                          for (run = 0; run < 63 + last; run++)                          for (run = 0; run < 63 + last; run++)
130                                  for (level = 0; level < 32 << intra; level++)                                  for (level = 0; level < (uint32_t)(32 << intra); level++)
131                                  {                                  {
132  #ifdef BIGLUT  #ifdef BIGLUT
133                                          offset = LEVELOFFSET;                                          offset = LEVELOFFSET;
# Line 146  Line 146 
146  #else  #else
147                          offset = !intra * LEVELOFFSET;                          offset = !intra * LEVELOFFSET;
148  #endif  #endif
149                          for (j = 0; j < 1 << (12 - coeff_tab[intra][i].vlc.len); j++)                          for (j = 0; j < (uint32_t)(1 << (12 - coeff_tab[intra][i].vlc.len)); j++)
150                          {                          {
151                                  DCT3D[intra][(coeff_tab[intra][i].vlc.code << (12 - coeff_tab[intra][i].vlc.len)) | j].len       = coeff_tab[intra][i].vlc.len;                                  DCT3D[intra][(coeff_tab[intra][i].vlc.code << (12 - coeff_tab[intra][i].vlc.len)) | j].len       = coeff_tab[intra][i].vlc.len;
152                                  DCT3D[intra][(coeff_tab[intra][i].vlc.code << (12 - coeff_tab[intra][i].vlc.len)) | j].event = coeff_tab[intra][i].event;                                  DCT3D[intra][(coeff_tab[intra][i].vlc.code << (12 - coeff_tab[intra][i].vlc.len)) | j].event = coeff_tab[intra][i].event;
# Line 171  Line 171 
171                  for (last = 0; last < 2; last++)                  for (last = 0; last < 2; last++)
172                          for (run = 0; run < 63 + last; run++)                          for (run = 0; run < 63 + last; run++)
173                          {                          {
174                                  for (level = 1; level < 32 << intra; level++)                                  for (level = 1; level < (uint32_t)(32 << intra); level++)
175                                  {                                  {
176                                          if (level <= max_level[intra][last][run] && run <= max_run[intra][last][level])                                          if (level <= max_level[intra][last][run] && run <= max_run[intra][last][level])
177                                              continue;                                              continue;
# Line 196  Line 196 
196                                          }                                          }
197                                          else                                          else
198                                          {                                          {
199                                                  if (level <= max_level[intra][last][run_esc] && run_esc <= max_run[intra][last][level])                                                  if (run_esc <= max_run[intra][last][level] && level <= max_level[intra][last][run_esc])
200                                                  {                                                  {
201                                                          escape     = ESCAPE2;                                                          escape     = ESCAPE2;
202                                                          escape_len = 7 + 2;                                                          escape_len = 7 + 2;
# Line 580  Line 580 
580          return bits;          return bits;
581  }  }
582    
583    int
584    CodeCoeffInter_CalcBits(const int16_t qcoeff[64], const uint16_t * zigzag)
585    {
586            uint32_t i, run, prev_run, len;
587            int32_t level, prev_level, level_shifted;
588            int bits = 0;
589    
590            i       = 0;
591            run = 0;
592    
593            while (!(level = qcoeff[zigzag[i++]]))
594                    run++;
595    
596            prev_level = level;
597            prev_run   = run;
598            run = 0;
599    
600            while (i < 64) {
601                    if ((level = qcoeff[zigzag[i++]]) != 0) {
602                            level_shifted = prev_level + 32;
603                            if (!(level_shifted & -64))
604                                    len      = coeff_VLC[0][0][level_shifted][prev_run].len;
605                            else
606                                    len  = 30;
607    
608                            bits += len;
609                            prev_level = level;
610                            prev_run   = run;
611                            run = 0;
612                    }
613                    else
614                            run++;
615            }
616    
617            level_shifted = prev_level + 32;
618            if (!(level_shifted & -64))
619                    len      = coeff_VLC[0][1][level_shifted][prev_run].len;
620            else
621                    len  = 30;
622            bits += len;
623    
624            return bits;
625    }
626    
627    
628  #endif  #endif
629    

Legend:
Removed from v.1.25.2.14  
changed lines
  Added in v.1.42

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