[svn] / branches / dev-api-3 / xvidcore / src / bitstream / mbcoding.c Repository:
ViewVC logotype

Diff of /branches/dev-api-3/xvidcore/src/bitstream/mbcoding.c

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

revision 721, Sat Dec 14 09:39:42 2002 UTC revision 769, Sat Jan 11 14:59:24 2003 UTC
# Line 41  Line 41 
41    *                                                                                                                                                        *    *                                                                                                                                                        *
42    *  Revision history:                                                         *    *  Revision history:                                                         *
43    *                                                                            *    *                                                                            *
44    *  28.10.2002 GMC support - gruel                                                                                        *    *  04.01.2003 GMC support - gruel                                                                                        *
45    *  28.06.2002 added check_resync_marker()                                    *    *  28.06.2002 added check_resync_marker()                                    *
46    *  14.04.2002 bframe encoding                                                                                            *    *  14.04.2002 bframe encoding                                                                                            *
47    *  08.03.2002 initial version; isibaar                                                           *    *  08.03.2002 initial version; isibaar                                                           *
# Line 49  Line 49 
49    ******************************************************************************/    ******************************************************************************/
50    
51    
52    #include <stdio.h>
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];
# Line 408  Line 406 
406    
407          int32_t i;          int32_t i;
408          uint32_t bits, mcbpc, cbpy;          uint32_t bits, mcbpc, cbpy;
         int mcsel=0;  
409    
410          mcbpc = (pMB->mode & 7) | ((pMB->cbp & 3) << 3);          mcbpc = (pMB->mode & 7) | ((pMB->cbp & 3) << 3);
411          cbpy = 15 - (pMB->cbp >> 2);          cbpy = 15 - (pMB->cbp >> 2);
# Line 419  Line 416 
416    
417          if ( (frame->coding_type == S_VOP) && (pMB->mode == MODE_INTER || pMB->mode == MODE_INTER_Q) )          if ( (frame->coding_type == S_VOP) && (pMB->mode == MODE_INTER || pMB->mode == MODE_INTER_Q) )
418          {          {
419                  if (frame->quarterpel) {                          /* decision on GMC is done in encoder.c now */
420                          if ( (pMB->qmvs[0].x == frame->GMC_MV.x) && (pMB->qmvs[0].y == frame->GMC_MV.y) )                  BitstreamPutBit(bs, pMB->mcsel);                // mcsel: '0'=local motion, '1'=GMC
                                 mcsel=1;  
                 } else {  
                         if ( (pMB->mvs[0].x == frame->GMC_MV.x) && (pMB->mvs[0].y == frame->GMC_MV.y) )  
                                 mcsel=1;  
                 }  
                 BitstreamPutBit(bs, mcsel);             // mcsel: '0'=local motion, '1'=GMC  
421          }          }
422    
423          // write cbpy          // write cbpy
# Line 456  Line 447 
447                  }                  }
448          }          }
449          // code motion vector(s) if motion is local          // code motion vector(s) if motion is local
450          if (mcsel==0)          if (!pMB->mcsel)
451                  for (i = 0; i < (pMB->mode == MODE_INTER4V ? 4 : 1); i++) {                  for (i = 0; i < (pMB->mode == MODE_INTER4V ? 4 : 1); i++) {
452                          CodeVector(bs, pMB->pmvs[i].x, frame->fcode, pStat);                          CodeVector(bs, pMB->pmvs[i].x, frame->fcode, pStat);
453                          CodeVector(bs, pMB->pmvs[i].y, frame->fcode, pStat);                          CodeVector(bs, pMB->pmvs[i].y, frame->fcode, pStat);
# Line 683  Line 674 
674    
675          uint32_t index;          uint32_t index;
676    
677          index = CLIP(BitstreamShowBits(bs, 9), 256);          index = MIN(BitstreamShowBits(bs, 9), 256);
678    
679          BitstreamSkip(bs, mcbpc_inter_table[index].len);          BitstreamSkip(bs, mcbpc_inter_table[index].len);
680    
# Line 840  Line 831 
831                  DPRINTF(DPRINTF_COEFF,"block[%i] %i", scan[coeff], level);                  DPRINTF(DPRINTF_COEFF,"block[%i] %i", scan[coeff], level);
832                  //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));
833    
834                  if (level < -127 || level > 127) {                  if (level < -2047 || level > 2047) {
835                          DPRINTF(DPRINTF_ERROR,"warning: intra_overflow %i", level);                          DPRINTF(DPRINTF_ERROR,"warning: intra_overflow %i", level);
836                  }                  }
837                  coeff++;                  coeff++;
# Line 874  Line 865 
865                  DPRINTF(DPRINTF_COEFF,"block[%i] %i", scan[p], level);                  DPRINTF(DPRINTF_COEFF,"block[%i] %i", scan[p], level);
866                  // 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));
867    
868                  if (level < -127 || level > 127) {                  if (level < -2047 || level > 2047) {
869                          DPRINTF(DPRINTF_ERROR,"warning: inter overflow %i", level);                          DPRINTF(DPRINTF_ERROR,"warning: inter overflow %i", level);
870                  }                  }
871                  p++;                  p++;

Legend:
Removed from v.721  
changed lines
  Added in v.769

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