[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.23, Wed Jul 24 23:07:45 2002 UTC revision 1.25.2.1, Mon Sep 23 20:36:01 2002 UTC
# Line 280  Line 280 
280  }  }
281    
282    
283  static void  static __inline void
284  CodeBlockIntra(const FRAMEINFO * frame,  CodeBlockIntra(const FRAMEINFO * frame,
285                             const MACROBLOCK * pMB,                             const MACROBLOCK * pMB,
286                             int16_t qcoeff[6 * 64],                             int16_t qcoeff[6 * 64],
# Line 370  Line 370 
370    
371          // interlacing          // interlacing
372          if (frame->global_flags & XVID_INTERLACING) {          if (frame->global_flags & XVID_INTERLACING) {
373                    if (pMB->cbp) {
374                  BitstreamPutBit(bs, pMB->field_dct);                  BitstreamPutBit(bs, pMB->field_dct);
375                  DEBUG1("codep: field_dct: ", pMB->field_dct);                  DEBUG1("codep: field_dct: ", pMB->field_dct);
376                    }
377    
378                  // if inter block, write field ME flag                  // if inter block, write field ME flag
379                  if (pMB->mode == MODE_INTER || pMB->mode == MODE_INTER_Q) {                  if (pMB->mode == MODE_INTER || pMB->mode == MODE_INTER_Q) {
# Line 413  Line 415 
415  {  {
416    
417          if (frame->coding_type == P_VOP) {          if (frame->coding_type == P_VOP) {
                 if (pMB->cbp == 0 && pMB->mode == MODE_INTER && pMB->mvs[0].x == 0 &&  
                         pMB->mvs[0].y == 0) {  
   
 #ifdef _DISABLE_SKIP  
 /* disable SKIP when Bframes active until some workaround for the B-SKIP problem is found */  
                         BitstreamPutBit(bs, 0); // always coded!  
 #else  
                         BitstreamPutBit(bs, 1); // not_coded  
   
                         return;  
 #endif  
                 } else  
418                          BitstreamPutBit(bs, 0); // coded                          BitstreamPutBit(bs, 0); // coded
419          }          }
420    
# Line 435  Line 425 
425    
426  }  }
427    
428    /*
429    // moved to mbcoding.h so that in can be 'static __inline'
430    void
431    MBSkip(Bitstream * bs)
432    {
433            BitstreamPutBit(bs, 1); // not coded
434    }
435    */
436    
437  /***************************************************************  /***************************************************************
438   * bframe encoding start   * bframe encoding start
439   ***************************************************************/   ***************************************************************/
# Line 447  Line 446 
446          3       0001b   forward mc+q            dbquant, mvdf          3       0001b   forward mc+q            dbquant, mvdf
447  */  */
448    
449  void  static __inline void
450  put_bvop_mbtype(Bitstream * bs,  put_bvop_mbtype(Bitstream * bs,
451                                  int value)                                  int value)
452  {  {
453          switch (value) {          switch (value) {
454          case 0:                  case MODE_FORWARD:
                 BitstreamPutBit(bs, 1);  
                 return;  
   
         case 1:  
455                  BitstreamPutBit(bs, 0);                  BitstreamPutBit(bs, 0);
456                  BitstreamPutBit(bs, 1);                  case MODE_BACKWARD:
                 return;  
   
         case 2:  
457                  BitstreamPutBit(bs, 0);                  BitstreamPutBit(bs, 0);
458                    case MODE_INTERPOLATE:
459                  BitstreamPutBit(bs, 0);                  BitstreamPutBit(bs, 0);
460                    case MODE_DIRECT:
461                  BitstreamPutBit(bs, 1);                  BitstreamPutBit(bs, 1);
462                  return;                  default:
463                            break;
         case 3:  
                 BitstreamPutBit(bs, 0);  
                 BitstreamPutBit(bs, 0);  
                 BitstreamPutBit(bs, 0);  
                 BitstreamPutBit(bs, 1);  
                 return;  
   
         default:;                                       // invalid!  
   
464          }          }
   
465  }  }
466    
467  /*  /*
# Line 487  Line 471 
471          +2      11b          +2      11b
472  */  */
473    
474  void  static __inline void
475  put_bvop_dbquant(Bitstream * bs,  put_bvop_dbquant(Bitstream * bs,
476                                   int value)                                   int value)
477  {  {
# Line 520  Line 504 
504                           Bitstream * bs,                           Bitstream * bs,
505                           Statistics * pStat)                           Statistics * pStat)
506  {  {
507          int i;          int vcode = fcode;
508            unsigned int i;
509    
510  /*      ------------------------------------------------------------------  /*      ------------------------------------------------------------------
511                  when a block is skipped it is decoded DIRECT(0,0)                  when a block is skipped it is decoded DIRECT(0,0)
# Line 550  Line 535 
535                  put_bvop_dbquant(bs, 0);        // todo: mb->dquant = 0                  put_bvop_dbquant(bs, 0);        // todo: mb->dquant = 0
536          }          }
537    
538          if (mb->mode == MODE_INTERPOLATE || mb->mode == MODE_FORWARD) {          switch (mb->mode) {
539                  CodeVector(bs, mb->pmvs[0].x, fcode, pStat);                  case MODE_INTERPOLATE:
540                  CodeVector(bs, mb->pmvs[0].y, fcode, pStat);                          CodeVector(bs, mb->pmvs[1].x, vcode, pStat); //forward vector of interpolate mode
541          }                          CodeVector(bs, mb->pmvs[1].y, vcode, pStat);
542                    case MODE_BACKWARD:
543          if (mb->mode == MODE_INTERPOLATE || mb->mode == MODE_BACKWARD) {                          vcode = bcode;
544                  CodeVector(bs, mb->b_pmvs[0].x, bcode, pStat);                  case MODE_FORWARD:
545                  CodeVector(bs, mb->b_pmvs[0].y, bcode, pStat);                          CodeVector(bs, mb->pmvs[0].x, vcode, pStat);
546          }                          CodeVector(bs, mb->pmvs[0].y, vcode, pStat);
547                            break;
548          if (mb->mode == MODE_DIRECT) {                  case MODE_DIRECT:
549                  CodeVector(bs, mb->deltamv.x, 1, pStat);                /* fcode is always 1 for delta vector */                          CodeVector(bs, mb->pmvs[3].x, 1, pStat);        // fcode is always 1 for delta vector
550                  CodeVector(bs, mb->deltamv.y, 1, pStat);                /* prediction is always (0,0) */                          CodeVector(bs, mb->pmvs[3].y, 1, pStat);        // prediction is always (0,0)
551                    default: break;
552          }          }
553    
554          for (i = 0; i < 6; i++) {          for (i = 0; i < 6; i++) {
# Line 650  Line 636 
636    
637  }  }
638    
639  int  static __inline int
640  get_mv_data(Bitstream * bs)  get_mv_data(Bitstream * bs)
641  {  {
642    
# Line 767  Line 753 
753  {  {
754    
755          const uint16_t *scan = scan_tables[direction];          const uint16_t *scan = scan_tables[direction];
756          int level;          int level, run, last;
         int run;  
         int last;  
757    
758          do {          do {
759                  level = get_coeff(bs, &run, &last, 1, 0);                  level = get_coeff(bs, &run, &last, 1, 0);

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.25.2.1

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