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

Diff of /xvidcore/src/encoder.c

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

revision 1.91, Sat Feb 15 15:22:17 2003 UTC revision 1.96, Tue Mar 4 10:55:21 2003 UTC
# Line 26  Line 26 
26   *  along with this program; if not, write to the Free Software   *  along with this program; if not, write to the Free Software
27   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
28   *   *
  ****************************************************************************/  
   
 /*****************************************************************************  
  *  
  *  History  
  *  
  *  10.07.2002  added BFRAMES_DEC_DEBUG support  
  *              MinChen <chenm001@163.com>  
  *  20.06.2002 bframe patch  
  *  08.05.2002 fix some problem in DEBUG mode;  
  *             MinChen <chenm001@163.com>  
  *  14.04.2002 added FrameCodeB()  
  *  
29   *  $Id$   *  $Id$
30   *   *
31   ****************************************************************************/   ****************************************************************************/
# Line 129  Line 116 
116  {  {
117          Encoder *pEnc;          Encoder *pEnc;
118          int i;          int i;
   
119          pParam->handle = NULL;          pParam->handle = NULL;
120    
121          ENC_CHECK(pParam);          ENC_CHECK(pParam);
# Line 379  Line 365 
365    
366          pEnc->queue = NULL;          pEnc->queue = NULL;
367    
   
368          if (pEnc->mbParam.max_bframes > 0) {          if (pEnc->mbParam.max_bframes > 0) {
369                  int n;                  int n;
370    
# Line 432  Line 417 
417    
418    xvid_err_memory5:    xvid_err_memory5:
419    
   
420          if (pEnc->mbParam.max_bframes > 0) {          if (pEnc->mbParam.max_bframes > 0) {
421    
422                  for (i = 0; i < pEnc->mbParam.max_bframes; i++) {                  for (i = 0; i < pEnc->mbParam.max_bframes; i++) {
# Line 540  Line 524 
524                  xvid_free(pEnc->queue);                  xvid_free(pEnc->queue);
525          }          }
526    
   
527          if (pEnc->mbParam.max_bframes > 0) {          if (pEnc->mbParam.max_bframes > 0) {
528    
529                  for (i = 0; i < pEnc->mbParam.max_bframes; i++) {                  for (i = 0; i < pEnc->mbParam.max_bframes; i++) {
# Line 605  Line 588 
588    
589  static __inline void inc_frame_num(Encoder * pEnc)  static __inline void inc_frame_num(Encoder * pEnc)
590  {  {
591          pEnc->current->stamp = pEnc->mbParam.m_stamp;   // first frame is zero          pEnc->current->stamp = pEnc->mbParam.m_stamp;   /* first frame is zero */
592          pEnc->mbParam.m_stamp += pEnc->mbParam.fincr;          pEnc->mbParam.m_stamp += pEnc->mbParam.fincr;
593  }  }
594    
# Line 631  Line 614 
614                  return;                  return;
615          stop_conv_timer();          stop_conv_timer();
616    
617            if ((pFrame->general & XVID_CHROMAOPT)) {
618                    image_chroma_optimize(&pEnc->queue[pEnc->queue_tail],
619                            pEnc->mbParam.width, pEnc->mbParam.height, pEnc->mbParam.edged_width);
620            }
621    
622          pEnc->queue_size++;          pEnc->queue_size++;
623          pEnc->queue_tail =  (pEnc->queue_tail + 1) % pEnc->mbParam.max_bframes;          pEnc->queue_tail =  (pEnc->queue_tail + 1) % pEnc->mbParam.max_bframes;
624  }  }
# Line 642  Line 630 
630                  pCur->ticks = (int32_t)pCur->stamp % time_base;                  pCur->ticks = (int32_t)pCur->stamp % time_base;
631                  pCur->seconds =  ((int32_t)pCur->stamp / time_base)     - ((int32_t)pRef->stamp / time_base) ;                  pCur->seconds =  ((int32_t)pCur->stamp / time_base)     - ((int32_t)pRef->stamp / time_base) ;
632    
633                  //HEAVY DEBUG OUTPUT    remove when timecodes prove to be stable                  /* HEAVY DEBUG OUTPUT remove when timecodes prove to be stable */
634    
635  /*              fprintf(stderr,"WriteVop:   %d - %d \n",  /*              fprintf(stderr,"WriteVop:   %d - %d \n",
636                          ((int32_t)pCur->stamp / time_base), ((int32_t)pRef->stamp / time_base));                          ((int32_t)pCur->stamp / time_base), ((int32_t)pRef->stamp / time_base));
# Line 685  Line 673 
673          uint16_t x, y;          uint16_t x, y;
674          Bitstream bs;          Bitstream bs;
675          uint32_t bits;          uint32_t bits;
676          int mode;          int mode = -1; /* Just to shut up compiler warning */
677    
678          int input_valid = 1;          int input_valid = 1;
679          int bframes_count = 0;          int bframes_count = 0;
# Line 776  Line 764 
764                  pEnc->bframenum_head = pEnc->bframenum_tail = 0;                  pEnc->bframenum_head = pEnc->bframenum_tail = 0;
765    
766                  /* write an empty marker to the bitstream.                  /* write an empty marker to the bitstream.
   
767                     for divx5 decoder compatibility, this marker must consist                     for divx5 decoder compatibility, this marker must consist
768                     of a not-coded p-vop, with a time_base of zero, and time_increment                     of a not-coded p-vop, with a time_base of zero, and time_increment
769                     indentical to the future-referece frame.                     indentical to the future-referece frame.
# Line 789  Line 776 
776                                  pEnc->bframenum_head, pEnc->bframenum_tail,                                  pEnc->bframenum_head, pEnc->bframenum_tail,
777                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);
778    
   
779                          tmp = pEnc->current->seconds;                          tmp = pEnc->current->seconds;
780                          pEnc->current->seconds = 0; /* force time_base = 0 */                          pEnc->current->seconds = 0; /* force time_base = 0 */
781    
# Line 850  Line 836 
836                  }                  }
837                  stop_conv_timer();                  stop_conv_timer();
838    
839                  // queue input frame, and dequue next image                  if ((pFrame->general & XVID_CHROMAOPT)) {
840                            image_chroma_optimize(&pEnc->current->image,
841                                    pEnc->mbParam.width, pEnc->mbParam.height, pEnc->mbParam.edged_width);
842                    }
843    
844                    /* queue input frame, and dequue next image */
845                  if (pEnc->queue_size > 0)                  if (pEnc->queue_size > 0)
846                  {                  {
847                          image_swap(&pEnc->current->image, &pEnc->queue[pEnc->queue_tail]);                          image_swap(&pEnc->current->image, &pEnc->queue[pEnc->queue_tail]);
# Line 881  Line 872 
872                                  pEnc->bframenum_head, pEnc->bframenum_tail,                                  pEnc->bframenum_head, pEnc->bframenum_tail,
873                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);
874    
875                            /* That disabled line of code was supposed to inform VirtualDub
876                             * that the frame was a dummy delay frame - now disabled (thx god :-)
877                             */
878                  //      BitstreamPutBits(&bs, 0x7f, 8);                  //      BitstreamPutBits(&bs, 0x7f, 8);
879                          pFrame->intra = 5;                          pFrame->intra = 5;
880    
# Line 903  Line 897 
897                                  pResult->mblks = 0;                                  pResult->mblks = 0;
898                                  pResult->ublks = 0;                                  pResult->ublks = 0;
899                          }                          }
   
900                  } else {                  } else {
901    
902                          if (pResult) {                          if (pResult) {
# Line 927  Line 920 
920    
921          emms();          emms();
922    
923          // only inc frame num, adapt quant, etc. if we havent seen it before          /* only inc frame num, adapt quant, etc. if we havent seen it before */
924          if (pEnc->bframenum_dx50bvop < 0 )          if (pEnc->bframenum_dx50bvop < 0 )
925          {          {
926                  mode = intra2coding_type(pFrame->intra);                  mode = intra2coding_type(pFrame->intra);
# Line 990  Line 983 
983    
984                                          pMB->dquant = iDQtab[temp_dquants[OFFSET(x, y)] + 2];                                          pMB->dquant = iDQtab[temp_dquants[OFFSET(x, y)] + 2];
985                                  }                                  }
   
986  #undef OFFSET  #undef OFFSET
987                          }                          }
   
988                          xvid_free(temp_dquants);                          xvid_free(temp_dquants);
989                  }                  }
   
990          }          }
991    
992          /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%          /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Line 1006  Line 996 
996    
997          if (pEnc->iFrameNum == 0 || pEnc->bframenum_dx50bvop >= 0 ||          if (pEnc->iFrameNum == 0 || pEnc->bframenum_dx50bvop >= 0 ||
998                  (mode < 0 && pEnc->mbParam.iMaxKeyInterval > 0 &&                  (mode < 0 && pEnc->mbParam.iMaxKeyInterval > 0 &&
999                          pEnc->iFrameNum >= pEnc->mbParam.iMaxKeyInterval))                          pEnc->iFrameNum >= pEnc->mbParam.iMaxKeyInterval)) {
         {  
1000                  mode = I_VOP;                  mode = I_VOP;
1001          }else{          }else{
1002                  mode = MEanalysis(&pEnc->reference->image, pEnc->current,                  mode = MEanalysis(&pEnc->reference->image, pEnc->current,
1003                                          &pEnc->mbParam, pEnc->mbParam.iMaxKeyInterval,                                          &pEnc->mbParam, pEnc->mbParam.iMaxKeyInterval,
1004                                          (mode < 0) ? pEnc->iFrameNum : 0,                                          (/*mode < 0*/1/*hack*/) ? pEnc->iFrameNum : 0,
1005                                          bframes_count++);                                          bframes_count++, pFrame->bframe_threshold);
1006          }          }
1007    
1008          if (mode == I_VOP) {          if (mode == I_VOP) {
# Line 1043  Line 1032 
1032                          image_printf(&pEnc->current->image, pEnc->mbParam.edged_width, pEnc->mbParam.height, 5, 200, "IVOP");                          image_printf(&pEnc->current->image, pEnc->mbParam.edged_width, pEnc->mbParam.height, 5, 200, "IVOP");
1033                  }                  }
1034    
1035                  // when we reach an iframe in DX50BVOP mode, encode the last bframe as a pframe                  /* when we reach an iframe in DX50BVOP mode, encode the last bframe as a pframe */
1036    
1037                  if ((pEnc->mbParam.global & XVID_GLOBAL_DX50BVOP) && pEnc->bframenum_tail > 0) {                  if ((pEnc->mbParam.global & XVID_GLOBAL_DX50BVOP) && pEnc->bframenum_tail > 0) {
1038    
# Line 1135  Line 1124 
1124    
1125                  pEnc->bframenum_tail++;                  pEnc->bframenum_tail++;
1126    
1127  // bframe report by koepi                  /* bframe report by koepi */
1128                  pFrame->intra = 2;                  pFrame->intra = 2;
1129                  pFrame->length = 0;                  pFrame->length = 0;
1130    
# Line 1207  Line 1196 
1196          uint16_t write_vol_header = 0;          uint16_t write_vol_header = 0;
1197    
1198          float psnr;          float psnr;
1199          uint8_t temp[128];          char temp[128];
1200    
1201          start_global_timer();          start_global_timer();
1202    
# Line 1238  Line 1227 
1227                  return XVID_ERR_FORMAT;                  return XVID_ERR_FORMAT;
1228          stop_conv_timer();          stop_conv_timer();
1229    
1230            if ((pFrame->general & XVID_CHROMAOPT)) {
1231                    image_chroma_optimize(&pEnc->current->image,
1232                            pEnc->mbParam.width, pEnc->mbParam.height, pEnc->mbParam.edged_width);
1233            }
1234    
1235          if (pFrame->general & XVID_EXTRASTATS)          if (pFrame->general & XVID_EXTRASTATS)
1236          {       image_copy(&pEnc->sOriginal, &pEnc->current->image,          {       image_copy(&pEnc->sOriginal, &pEnc->current->image,
1237                                     pEnc->mbParam.edged_width, pEnc->mbParam.height);                                     pEnc->mbParam.edged_width, pEnc->mbParam.height);
# Line 1334  Line 1328 
1328    
1329          }          }
1330    
1331  //      BitstreamPutBits(&bs, 0xFFFF, 16);          /* Relic from OpenDivX - now disabled
1332  //      BitstreamPutBits(&bs, 0xFFFF, 16);          BitstreamPutBits(&bs, 0xFFFF, 16);
1333            BitstreamPutBits(&bs, 0xFFFF, 16);
1334            */
1335    
1336          BitstreamPadAlways(&bs);          BitstreamPadAlways(&bs);
1337          pFrame->length = BitstreamLength(&bs);          pFrame->length = BitstreamLength(&bs);
1338    
# Line 1426  Line 1423 
1423                  return;                  return;
1424          }          }
1425    
1426          pEnc->current->fcode =          pEnc->current->fcode = (hint->rawhints) ?
1427                  (hint->rawhints) ? hint->mvhint.fcode : BitstreamGetBits(&bs,                  (uint32_t)hint->mvhint.fcode : BitstreamGetBits(&bs, FCODEBITS);
                                                                                                                                  FCODEBITS);  
1428    
1429          length = pEnc->current->fcode + 5;          length = pEnc->current->fcode + 5;
1430          high = 1 << (length - 1);          high = 1 << (length - 1);
# Line 1443  Line 1439 
1439                          VECTOR tmp;                          VECTOR tmp;
1440                          int vec;                          int vec;
1441    
1442                          pMB->mode =                          pMB->mode =     (hint->rawhints) ?
1443                                  (hint->rawhints) ? bhint->mode : BitstreamGetBits(&bs,                                  (uint32_t)bhint->mode : BitstreamGetBits(&bs, MODEBITS);
                                                                                                                                   MODEBITS);  
1444    
1445                          pMB->mode = (pMB->mode == MODE_INTER_Q) ? MODE_INTER : pMB->mode;                          pMB->mode = (pMB->mode == MODE_INTER_Q) ? MODE_INTER : pMB->mode;
1446                          pMB->mode = (pMB->mode == MODE_INTRA_Q) ? MODE_INTRA : pMB->mode;                          pMB->mode = (pMB->mode == MODE_INTRA_Q) ? MODE_INTRA : pMB->mode;
1447    
1448                          if (pMB->mode == MODE_INTER) {                          if (pMB->mode == MODE_INTER) {
1449                                  tmp.x =                                  tmp.x = (hint->rawhints) ?
1450                                          (hint->rawhints) ? bhint->mvs[0].x : BitstreamGetBits(&bs,                                          bhint->mvs[0].x : (int)BitstreamGetBits(&bs, length);
1451                                                                                                                                                    length);                                  tmp.y = (hint->rawhints) ?
1452                                  tmp.y =                                          bhint->mvs[0].y : (int)BitstreamGetBits(&bs, length);
                                         (hint->rawhints) ? bhint->mvs[0].y : BitstreamGetBits(&bs,  
                                                                                                                                                   length);  
1453                                  tmp.x -= (tmp.x >= high) ? high * 2 : 0;                                  tmp.x -= (tmp.x >= high) ? high * 2 : 0;
1454                                  tmp.y -= (tmp.y >= high) ? high * 2 : 0;                                  tmp.y -= (tmp.y >= high) ? high * 2 : 0;
1455    
# Line 1470  Line 1463 
1463                                  }                                  }
1464                          } else if (pMB->mode == MODE_INTER4V) {                          } else if (pMB->mode == MODE_INTER4V) {
1465                                  for (vec = 0; vec < 4; ++vec) {                                  for (vec = 0; vec < 4; ++vec) {
1466                                          tmp.x =                                          tmp.x = (hint->rawhints) ?
1467                                                  (hint->rawhints) ? bhint->mvs[vec].                                                  bhint->mvs[vec].x : (int)BitstreamGetBits(&bs, length);
1468                                                  x : BitstreamGetBits(&bs, length);                                          tmp.y = (hint->rawhints) ?
1469                                          tmp.y =                                                  bhint->mvs[vec].y : (int)BitstreamGetBits(&bs, length);
                                                 (hint->rawhints) ? bhint->mvs[vec].  
                                                 y : BitstreamGetBits(&bs, length);  
1470                                          tmp.x -= (tmp.x >= high) ? high * 2 : 0;                                          tmp.x -= (tmp.x >= high) ? high * 2 : 0;
1471                                          tmp.y -= (tmp.y >= high) ? high * 2 : 0;                                          tmp.y -= (tmp.y >= high) ? high * 2 : 0;
1472    
# Line 1486  Line 1477 
1477                                          pMB->pmvs[vec].x = pMB->mvs[vec].x - pred.x;                                          pMB->pmvs[vec].x = pMB->mvs[vec].x - pred.x;
1478                                          pMB->pmvs[vec].y = pMB->mvs[vec].y - pred.y;                                          pMB->pmvs[vec].y = pMB->mvs[vec].y - pred.y;
1479                                  }                                  }
1480                          } else                          // intra / stuffing / not_coded                          } else                          /* intra / stuffing / not_coded */
1481                          {                          {
1482                                  for (vec = 0; vec < 4; ++vec) {                                  for (vec = 0; vec < 4; ++vec) {
1483                                          pMB->mvs[vec].x = pMB->mvs[vec].y = 0;                                          pMB->mvs[vec].x = pMB->mvs[vec].y = 0;
# Line 1623  Line 1614 
1614                          pEnc->mbParam.width, pEnc->mbParam.height);                          pEnc->mbParam.width, pEnc->mbParam.height);
1615                  stop_edges_timer();                  stop_edges_timer();
1616          }          }
   
1617          pEnc->iFrameNum = 0;          pEnc->iFrameNum = 0;
1618          pEnc->mbParam.m_rounding_type = 1;          pEnc->mbParam.m_rounding_type = 1;
1619          pEnc->current->rounding_type = pEnc->mbParam.m_rounding_type;          pEnc->current->rounding_type = pEnc->mbParam.m_rounding_type;
# Line 1683  Line 1673 
1673                  HintedMEGet(pEnc, 1);                  HintedMEGet(pEnc, 1);
1674          }          }
1675    
1676          return 1;                                       // intra          return 1;                                       /* intra */
1677  }  }
1678    
1679    
# Line 1721  Line 1711 
1711                  mb_height = (pEnc->mbParam.height + 31) / 32;                  mb_height = (pEnc->mbParam.height + 31) / 32;
1712          }          }
1713    
   
1714          start_timer();          start_timer();
1715          image_setedges(pRef, pEnc->mbParam.edged_width, pEnc->mbParam.edged_height,          image_setedges(pRef, pEnc->mbParam.edged_width, pEnc->mbParam.edged_height,
1716                                     pEnc->mbParam.width, pEnc->mbParam.height);                                     pEnc->mbParam.width, pEnc->mbParam.height);
# Line 2021  Line 2010 
2010          iSearchRange = 1 << (3 + pEnc->mbParam.m_fcode);          iSearchRange = 1 << (3 + pEnc->mbParam.m_fcode);
2011    
2012          if ((fSigma > iSearchRange / 3)          if ((fSigma > iSearchRange / 3)
2013                  && (pEnc->mbParam.m_fcode <= (3 + pEnc->mbParam.m_quarterpel))) // maximum search range 128                  && (pEnc->mbParam.m_fcode <= (3 + pEnc->mbParam.m_quarterpel))) /* maximum search range 128 */
2014          {          {
2015                  pEnc->mbParam.m_fcode++;                  pEnc->mbParam.m_fcode++;
2016                  iSearchRange *= 2;                  iSearchRange *= 2;
2017          } else if ((fSigma < iSearchRange / 6)          } else if ((fSigma < iSearchRange / 6)
2018                             && (pEnc->fMvPrevSigma >= 0)                             && (pEnc->fMvPrevSigma >= 0)
2019                             && (pEnc->fMvPrevSigma < iSearchRange / 6)                             && (pEnc->fMvPrevSigma < iSearchRange / 6)
2020                          && (pEnc->mbParam.m_fcode >= (2 + pEnc->mbParam.m_quarterpel))) // minimum search range 16                             && (pEnc->mbParam.m_fcode >= (2 + pEnc->mbParam.m_quarterpel)))      /* minimum search range 16 */
2021          {          {
2022                  pEnc->mbParam.m_fcode--;                  pEnc->mbParam.m_fcode--;
2023                  iSearchRange /= 2;                  iSearchRange /= 2;
# Line 2049  Line 2038 
2038                  set_timecodes(pEnc->current,pEnc->reference,pEnc->mbParam.fbase);                  set_timecodes(pEnc->current,pEnc->reference,pEnc->mbParam.fbase);
2039                  BitstreamWriteVopHeader(bs, &pEnc->mbParam, pEnc->current, 0);                  BitstreamWriteVopHeader(bs, &pEnc->mbParam, pEnc->current, 0);
2040    
2041                  // copy reference frame details into the current frame                  /* copy reference frame details into the current frame */
2042                  pEnc->current->quant = pEnc->reference->quant;                  pEnc->current->quant = pEnc->reference->quant;
2043                  pEnc->current->motion_flags = pEnc->reference->motion_flags;                  pEnc->current->motion_flags = pEnc->reference->motion_flags;
2044                  pEnc->current->rounding_type = pEnc->reference->rounding_type;                  pEnc->current->rounding_type = pEnc->reference->rounding_type;
# Line 2078  Line 2067 
2067    
2068          *pBits = BitstreamPos(bs) - *pBits;          *pBits = BitstreamPos(bs) - *pBits;
2069    
2070          return 0;                                       // inter          return 0;                                       /* inter */
2071  }  }
2072    
2073    
# Line 2111  Line 2100 
2100    
2101          frame->quarterpel =  pEnc->mbParam.m_quarterpel;          frame->quarterpel =  pEnc->mbParam.m_quarterpel;
2102    
2103          // forward          /* forward  */
2104          image_setedges(f_ref, pEnc->mbParam.edged_width,          image_setedges(f_ref, pEnc->mbParam.edged_width,
2105                                     pEnc->mbParam.edged_height, pEnc->mbParam.width,                                     pEnc->mbParam.edged_height, pEnc->mbParam.width,
2106                                     pEnc->mbParam.height);                                     pEnc->mbParam.height);
# Line 2121  Line 2110 
2110                                            pEnc->mbParam.m_quarterpel, 0);                                            pEnc->mbParam.m_quarterpel, 0);
2111          stop_inter_timer();          stop_inter_timer();
2112    
2113          // backward          /* backward */
2114          image_setedges(b_ref, pEnc->mbParam.edged_width,          image_setedges(b_ref, pEnc->mbParam.edged_width,
2115                                     pEnc->mbParam.edged_height, pEnc->mbParam.width,                                     pEnc->mbParam.edged_height, pEnc->mbParam.width,
2116                                     pEnc->mbParam.height);                                     pEnc->mbParam.height);
# Line 2134  Line 2123 
2123          start_timer();          start_timer();
2124    
2125          MotionEstimationBVOP(&pEnc->mbParam, frame,          MotionEstimationBVOP(&pEnc->mbParam, frame,
2126                  ((int32_t)(pEnc->current->stamp - frame->stamp)),                               // time_bp                                                   ((int32_t)(pEnc->current->stamp - frame->stamp)),                              /* time_bp */
2127                  ((int32_t)(pEnc->current->stamp - pEnc->reference->stamp)),     // time_pp                                                   ((int32_t)(pEnc->current->stamp - pEnc->reference->stamp)),    /* time_pp */
2128                          pEnc->reference->mbs, f_ref,                          pEnc->reference->mbs, f_ref,
2129                                                   &pEnc->f_refh, &pEnc->f_refv, &pEnc->f_refhv,                                                   &pEnc->f_refh, &pEnc->f_refv, &pEnc->f_refhv,
2130                                                   pEnc->current, b_ref, &pEnc->vInterH,                                                   pEnc->current, b_ref, &pEnc->vInterH,
# Line 2143  Line 2132 
2132    
2133    
2134          stop_motion_timer();          stop_motion_timer();
2135            /*
2136          /*if (test_quant_type(&pEnc->mbParam, pEnc->current))          if (test_quant_type(&pEnc->mbParam, pEnc->current)) {
            {  
2137             BitstreamWriteVolHeader(bs, pEnc->mbParam.width, pEnc->mbParam.height, pEnc->mbParam.quant_type);             BitstreamWriteVolHeader(bs, pEnc->mbParam.width, pEnc->mbParam.height, pEnc->mbParam.quant_type);
2138             } */          }
2139            */
2140    
2141          frame->coding_type = B_VOP;          frame->coding_type = B_VOP;
2142    
# Line 2167  Line 2156 
2156                          MACROBLOCK * const mb = &frame->mbs[x + y * pEnc->mbParam.mb_width];                          MACROBLOCK * const mb = &frame->mbs[x + y * pEnc->mbParam.mb_width];
2157                          int direction = pEnc->mbParam.global & XVID_ALTERNATESCAN ? 2 : 0;                          int direction = pEnc->mbParam.global & XVID_ALTERNATESCAN ? 2 : 0;
2158    
2159                          // decoder ignores mb when refence block is INTER(0,0), CBP=0                          /* decoder ignores mb when refence block is INTER(0,0), CBP=0 */
2160                          if (mb->mode == MODE_NOT_CODED) {                          if (mb->mode == MODE_NOT_CODED) {
2161                                  //mb->mvs[0].x = mb->mvs[0].y = mb->cbp = 0;                                  /* mb->mvs[0].x = mb->mvs[0].y = mb->cbp = 0; */
2162                                  continue;                                  continue;
2163                          }                          }
2164    
# Line 2188  Line 2177 
2177    
2178                                  if ( (mb->mode == MODE_DIRECT) && (mb->cbp == 0)                                  if ( (mb->mode == MODE_DIRECT) && (mb->cbp == 0)
2179                                          && (mb->pmvs[3].x == 0) && (mb->pmvs[3].y == 0) ) {                                          && (mb->pmvs[3].x == 0) && (mb->pmvs[3].y == 0) ) {
2180                                          mb->mode = MODE_DIRECT_NONE_MV; // skipped                                          mb->mode = MODE_DIRECT_NONE_MV; /* skipped */
2181                                  }                                  }
2182                          }                          }
2183    
# Line 2204  Line 2193 
2193    
2194          emms();          emms();
2195    
2196          // TODO: dynamic fcode/bcode ???          /* TODO: dynamic fcode/bcode ??? */
2197    
2198          *pBits = BitstreamPos(bs) - *pBits;          *pBits = BitstreamPos(bs) - *pBits;
2199    

Legend:
Removed from v.1.91  
changed lines
  Added in v.1.96

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