[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.3, Sat Nov 2 15:52:30 2002 UTC revision 1.25.2.9, Sat Jan 4 06:14:33 2003 UTC
# Line 52  Line 52 
52    
53  #include <stdlib.h>  #include <stdlib.h>
54  #include "../portab.h"  #include "../portab.h"
55    #include "../global.h"
56  #include "bitstream.h"  #include "bitstream.h"
57  #include "zigzag.h"  #include "zigzag.h"
58  #include "vlc_codes.h"  #include "vlc_codes.h"
# Line 59  Line 60 
60    
61  #include "../utils/mbfunctions.h"  #include "../utils/mbfunctions.h"
62    
63  #define ABS(X) (((X)>0)?(X):-(X))  VLC intra_table[4*2048*64];
64  #define CLIP(X,A) (X > A) ? (A) : (X)  VLC inter_table[4*2048*64];
   
 VLC intra_table[524032];  
 VLC inter_table[524032];  
65    
66  VLC DCT3Dintra[4096];  VLC DCT3Dintra[4096];
67  VLC DCT3Dinter[4096];  VLC DCT3Dinter[4096];
68    
69  /* not really MB related, but VLCs are only available here */  /* not really MB related, but VLCs are only available here */
70  void inline bs_put_spritetrajectory(Bitstream * bs,  void bs_put_spritetrajectory(Bitstream * bs, const int val)
                           const int val)  
71  {  {
72          const int code = sprite_trajectory_code[val+16384].code;          const int code = sprite_trajectory_code[val+16384].code;
73          const int len = sprite_trajectory_code[val+16384].len;          const int len = sprite_trajectory_code[val+16384].len;
# Line 84  Line 81 
81          if (len) BitstreamPutBits(bs, code, len);          if (len) BitstreamPutBits(bs, code, len);
82  }  }
83    
84    int bs_get_spritetrajectory(Bitstream * bs)
85    {
86            int i;
87            for (i = 0; i < 12; i++)
88            {
89                    if (BitstreamShowBits(bs, sprite_trajectory_len[i].len) == sprite_trajectory_len[i].code)
90                    {
91                            BitstreamSkip(bs, sprite_trajectory_len[i].len);
92                            return i;
93                    }
94            }
95            return -1;
96    }
97    
98  void  void
99  init_vlc_tables(void)  init_vlc_tables(void)
# Line 428  Line 438 
438          if (frame->global_flags & XVID_INTERLACING) {          if (frame->global_flags & XVID_INTERLACING) {
439                  if (pMB->cbp) {                  if (pMB->cbp) {
440                          BitstreamPutBit(bs, pMB->field_dct);                          BitstreamPutBit(bs, pMB->field_dct);
441                          DEBUG1("codep: field_dct: ", pMB->field_dct);                          DPRINTF(DPRINTF_MB,"codep: field_dct: %i", pMB->field_dct);
442                  }                  }
443    
444                  // if inter block, write field ME flag                  // if inter block, write field ME flag
445                  if (pMB->mode == MODE_INTER || pMB->mode == MODE_INTER_Q) {                  if (pMB->mode == MODE_INTER || pMB->mode == MODE_INTER_Q) {
446                          BitstreamPutBit(bs, pMB->field_pred);                          BitstreamPutBit(bs, pMB->field_pred);
447                          DEBUG1("codep: field_pred: ", pMB->field_pred);                          DPRINTF(DPRINTF_MB,"codep: field_pred: %i", pMB->field_pred);
448    
449                          // write field prediction references                          // write field prediction references
450                          if (pMB->field_pred) {                          if (pMB->field_pred) {
# Line 671  Line 681 
681    
682          uint32_t index;          uint32_t index;
683    
684          index = CLIP(BitstreamShowBits(bs, 9), 256);          index = MIN(BitstreamShowBits(bs, 9), 256);
685    
686          BitstreamSkip(bs, mcbpc_inter_table[index].len);          BitstreamSkip(bs, mcbpc_inter_table[index].len);
687    
# Line 819  Line 829 
829          do {          do {
830                  level = get_coeff(bs, &run, &last, 1, 0);                  level = get_coeff(bs, &run, &last, 1, 0);
831                  if (run == -1) {                  if (run == -1) {
832                          DEBUG("fatal: invalid run");                          DPRINTF(DPRINTF_ERROR,"fatal: invalid run");
833                          break;                          break;
834                  }                  }
835                  coeff += run;                  coeff += run;
# Line 828  Line 838 
838                  DPRINTF(DPRINTF_COEFF,"block[%i] %i", scan[coeff], level);                  DPRINTF(DPRINTF_COEFF,"block[%i] %i", scan[coeff], level);
839                  //DPRINTF(DPRINTF_COEFF,"block[%i] %i %08x", scan[coeff], level, BitstreamShowBits(bs, 32));                  //DPRINTF(DPRINTF_COEFF,"block[%i] %i %08x", scan[coeff], level, BitstreamShowBits(bs, 32));
840    
841                  if (level < -127 || level > 127) {                  if (level < -2047 || level > 2047) {
842                          DEBUG1("warning: intra_overflow", level);                          DPRINTF(DPRINTF_ERROR,"warning: intra_overflow %i", level);
843                  }                  }
844                  coeff++;                  coeff++;
845          } while (!last);          } while (!last);
# Line 852  Line 862 
862          do {          do {
863                  level = get_coeff(bs, &run, &last, 0, 0);                  level = get_coeff(bs, &run, &last, 0, 0);
864                  if (run == -1) {                  if (run == -1) {
865                          DEBUG("fatal: invalid run");                          DPRINTF(DPRINTF_ERROR,"fatal: invalid run");
866                          break;                          break;
867                  }                  }
868                  p += run;                  p += run;
# Line 862  Line 872 
872                  DPRINTF(DPRINTF_COEFF,"block[%i] %i", scan[p], level);                  DPRINTF(DPRINTF_COEFF,"block[%i] %i", scan[p], level);
873                  // DPRINTF(DPRINTF_COEFF,"block[%i] %i %08x", scan[p], level, BitstreamShowBits(bs, 32));                  // DPRINTF(DPRINTF_COEFF,"block[%i] %i %08x", scan[p], level, BitstreamShowBits(bs, 32));
874    
875                  if (level < -127 || level > 127) {                  if (level < -2047 || level > 2047) {
876                          DEBUG1("warning: inter_overflow", level);                          DPRINTF(DPRINTF_ERROR,"warning: inter overflow %i", level);
877                  }                  }
878                  p++;                  p++;
879          } while (!last);          } while (!last);

Legend:
Removed from v.1.25.2.3  
changed lines
  Added in v.1.25.2.9

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