[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, Wed Sep 4 03:23:28 2002 UTC revision 1.25.2.2, Thu Sep 26 01:54:54 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 330  Line 330 
330                                                           dcc_tab[qcoeff[i * 64 + 0] + 255].len);                                                           dcc_tab[qcoeff[i * 64 + 0] + 255].len);
331    
332                  if (pMB->cbp & (1 << (5 - i))) {                  if (pMB->cbp & (1 << (5 - i))) {
333                            const uint16_t *scan_table =
334                                    frame->global_flags & XVID_ALTERNATESCAN ?
335                                    scan_tables[2] : scan_tables[pMB->acpred_directions[i]];
336    
337                          bits = BitstreamPos(bs);                          bits = BitstreamPos(bs);
338    
339                          CodeCoeff(bs, &qcoeff[i * 64], intra_table,                          CodeCoeff(bs, &qcoeff[i * 64], intra_table, scan_table, 1);
                                           scan_tables[pMB->acpred_directions[i]], 1);  
340    
341                          bits = BitstreamPos(bs) - bits;                          bits = BitstreamPos(bs) - bits;
342                          pStat->iTextBits += bits;                          pStat->iTextBits += bits;
# Line 398  Line 401 
401          // code block coeffs          // code block coeffs
402          for (i = 0; i < 6; i++)          for (i = 0; i < 6; i++)
403                  if (pMB->cbp & (1 << (5 - i)))                  if (pMB->cbp & (1 << (5 - i)))
404                          CodeCoeff(bs, &qcoeff[i * 64], inter_table, scan_tables[0], 0);                  {
405                            const uint16_t *scan_table =
406                                    frame->global_flags & XVID_ALTERNATESCAN ?
407                                    scan_tables[2] : scan_tables[0];
408    
409                            CodeCoeff(bs, &qcoeff[i * 64], inter_table, scan_table, 0);
410                    }
411    
412          bits = BitstreamPos(bs) - bits;          bits = BitstreamPos(bs) - bits;
413          pStat->iTextBits += bits;          pStat->iTextBits += bits;
# Line 425  Line 434 
434    
435  }  }
436    
437    /*
438    // moved to mbcoding.h so that in can be 'static __inline'
439  void  void
440  MBSkip(Bitstream * bs)  MBSkip(Bitstream * bs)
441  {  {
442          BitstreamPutBit(bs, 1); // not coded          BitstreamPutBit(bs, 1); // not coded
         return;  
443  }  }
444    */
445    
446  /***************************************************************  /***************************************************************
447   * bframe encoding start   * bframe encoding start
# Line 446  Line 455 
455          3       0001b   forward mc+q            dbquant, mvdf          3       0001b   forward mc+q            dbquant, mvdf
456  */  */
457    
458  void  static __inline void
459  put_bvop_mbtype(Bitstream * bs,  put_bvop_mbtype(Bitstream * bs,
460                                  int value)                                  int value)
461  {  {
462          switch (value) {          switch (value) {
463          case 0:                  case MODE_FORWARD:
                 BitstreamPutBit(bs, 1);  
                 return;  
   
         case 1:  
464                  BitstreamPutBit(bs, 0);                  BitstreamPutBit(bs, 0);
465                  BitstreamPutBit(bs, 1);                  case MODE_BACKWARD:
                 return;  
   
         case 2:  
466                  BitstreamPutBit(bs, 0);                  BitstreamPutBit(bs, 0);
467                    case MODE_INTERPOLATE:
468                  BitstreamPutBit(bs, 0);                  BitstreamPutBit(bs, 0);
469                    case MODE_DIRECT:
470                  BitstreamPutBit(bs, 1);                  BitstreamPutBit(bs, 1);
471                  return;                  default:
472                            break;
         case 3:  
                 BitstreamPutBit(bs, 0);  
                 BitstreamPutBit(bs, 0);  
                 BitstreamPutBit(bs, 0);  
                 BitstreamPutBit(bs, 1);  
                 return;  
   
         default:;                                       // invalid!  
   
473          }          }
   
474  }  }
475    
476  /*  /*
# Line 486  Line 480 
480          +2      11b          +2      11b
481  */  */
482    
483  void  static __inline void
484  put_bvop_dbquant(Bitstream * bs,  put_bvop_dbquant(Bitstream * bs,
485                                   int value)                                   int value)
486  {  {
# Line 517  Line 511 
511                           const int32_t fcode,                           const int32_t fcode,
512                           const int32_t bcode,                           const int32_t bcode,
513                           Bitstream * bs,                           Bitstream * bs,
514                           Statistics * pStat)                           Statistics * pStat,
515                             int direction)
516  {  {
517          int i;          int vcode = fcode;
518            unsigned int i;
519    
520  /*      ------------------------------------------------------------------  /*      ------------------------------------------------------------------
521                  when a block is skipped it is decoded DIRECT(0,0)                  when a block is skipped it is decoded DIRECT(0,0)
# Line 549  Line 545 
545                  put_bvop_dbquant(bs, 0);        // todo: mb->dquant = 0                  put_bvop_dbquant(bs, 0);        // todo: mb->dquant = 0
546          }          }
547    
548          if (mb->mode == MODE_INTERPOLATE || mb->mode == MODE_FORWARD) {          switch (mb->mode) {
549                  CodeVector(bs, mb->pmvs[0].x, fcode, pStat);                  case MODE_INTERPOLATE:
550                  CodeVector(bs, mb->pmvs[0].y, fcode, pStat);                          CodeVector(bs, mb->pmvs[1].x, vcode, pStat); //forward vector of interpolate mode
551          }                          CodeVector(bs, mb->pmvs[1].y, vcode, pStat);
552                    case MODE_BACKWARD:
553          if (mb->mode == MODE_INTERPOLATE || mb->mode == MODE_BACKWARD) {                          vcode = bcode;
554                  CodeVector(bs, mb->b_pmvs[0].x, bcode, pStat);                  case MODE_FORWARD:
555                  CodeVector(bs, mb->b_pmvs[0].y, bcode, pStat);                          CodeVector(bs, mb->pmvs[0].x, vcode, pStat);
556          }                          CodeVector(bs, mb->pmvs[0].y, vcode, pStat);
557                            break;
558          if (mb->mode == MODE_DIRECT) {                  case MODE_DIRECT:
559                  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
560                  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)
561                    default: break;
562          }          }
563    
564          for (i = 0; i < 6; i++) {          for (i = 0; i < 6; i++) {
565                  if (mb->cbp & (1 << (5 - i))) {                  if (mb->cbp & (1 << (5 - i))) {
566                          CodeCoeff(bs, &qcoeff[i * 64], inter_table, scan_tables[0], 0);                          CodeCoeff(bs, &qcoeff[i * 64], inter_table, scan_tables[direction], 0);
567                  }                  }
568          }          }
569  }  }
# Line 649  Line 646 
646    
647  }  }
648    
649  int  static __inline int
650  get_mv_data(Bitstream * bs)  get_mv_data(Bitstream * bs)
651  {  {
652    
# Line 766  Line 763 
763  {  {
764    
765          const uint16_t *scan = scan_tables[direction];          const uint16_t *scan = scan_tables[direction];
766          int level;          int level, run, last;
         int run;  
         int last;  
767    
768          do {          do {
769                  level = get_coeff(bs, &run, &last, 1, 0);                  level = get_coeff(bs, &run, &last, 1, 0);
# Line 792  Line 787 
787    
788  void  void
789  get_inter_block(Bitstream * bs,  get_inter_block(Bitstream * bs,
790                                  int16_t * block)                                  int16_t * block,
791                                    int direction)
792  {  {
793    
794          const uint16_t *scan = scan_tables[0];          const uint16_t *scan = scan_tables[direction];
795          int p;          int p;
796          int level;          int level;
797          int run;          int run;

Legend:
Removed from v.1.25  
changed lines
  Added in v.1.25.2.2

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