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

Diff of /trunk/xvidcore/src/encoder.c

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

revision 853, Sat Feb 15 18:48:15 2003 UTC revision 979, Wed Apr 9 12:02:26 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   *   *
29   ****************************************************************************/   *  $Id: encoder.c,v 1.99 2003-04-09 12:02:26 syskin Exp $
   
 /*****************************************************************************  
  *  
  *  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()  
  *  
  *  $Id: encoder.c,v 1.92 2003-02-15 18:48:15 edgomez Exp $  
30   *   *
31   ****************************************************************************/   ****************************************************************************/
32    
# 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 647  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 690  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 769  Line 752 
752                          pResult->ublks = pEnc->current->sStat.ublks;                          pResult->ublks = pEnc->current->sStat.ublks;
753                  }                  }
754    
755                    emms();
756    
757                    if (pFrame->quant == 0) {
758                            RateControlUpdate(&pEnc->rate_control, pEnc->current->quant,
759                                                              pFrame->length, pFrame->intra);
760                    }
761    
762                  if (input_valid)                  if (input_valid)
763                          queue_image(pEnc, pFrame);                          queue_image(pEnc, pFrame);
764    
# Line 781  Line 771 
771                  pEnc->bframenum_head = pEnc->bframenum_tail = 0;                  pEnc->bframenum_head = pEnc->bframenum_tail = 0;
772    
773                  /* write an empty marker to the bitstream.                  /* write an empty marker to the bitstream.
   
774                     for divx5 decoder compatibility, this marker must consist                     for divx5 decoder compatibility, this marker must consist
775                     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
776                     indentical to the future-referece frame.                     indentical to the future-referece frame.
# Line 794  Line 783 
783                                  pEnc->bframenum_head, pEnc->bframenum_tail,                                  pEnc->bframenum_head, pEnc->bframenum_tail,
784                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);
785    
   
786                          tmp = pEnc->current->seconds;                          tmp = pEnc->current->seconds;
787                          pEnc->current->seconds = 0; /* force time_base = 0 */                          pEnc->current->seconds = 0; /* force time_base = 0 */
788    
# Line 813  Line 801 
801                                  pResult->ublks = pEnc->current->sStat.ublks;                                  pResult->ublks = pEnc->current->sStat.ublks;
802                          }                          }
803    
804                            emms();
805    
806                            if (pFrame->quant == 0) {
807                                    RateControlUpdate(&pEnc->rate_control, pEnc->current->quant,
808                                                                      pFrame->length, pFrame->intra);
809                            }
810    
811                          if (input_valid)                          if (input_valid)
812                                  queue_image(pEnc, pFrame);                                  queue_image(pEnc, pFrame);
813    
# Line 860  Line 855 
855                                  pEnc->mbParam.width, pEnc->mbParam.height, pEnc->mbParam.edged_width);                                  pEnc->mbParam.width, pEnc->mbParam.height, pEnc->mbParam.edged_width);
856                  }                  }
857    
858                  // queue input frame, and dequue next image                  /* queue input frame, and dequue next image */
859                  if (pEnc->queue_size > 0)                  if (pEnc->queue_size > 0)
860                  {                  {
861                          image_swap(&pEnc->current->image, &pEnc->queue[pEnc->queue_tail]);                          image_swap(&pEnc->current->image, &pEnc->queue[pEnc->queue_tail]);
# Line 891  Line 886 
886                                  pEnc->bframenum_head, pEnc->bframenum_tail,                                  pEnc->bframenum_head, pEnc->bframenum_tail,
887                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);
888    
889                            /* That disabled line of code was supposed to inform VirtualDub
890                             * that the frame was a dummy delay frame - now disabled (thx god :-)
891                             */
892                  //      BitstreamPutBits(&bs, 0x7f, 8);                  //      BitstreamPutBits(&bs, 0x7f, 8);
893                          pFrame->intra = 5;                          pFrame->intra = 5;
894    
# Line 913  Line 911 
911                                  pResult->mblks = 0;                                  pResult->mblks = 0;
912                                  pResult->ublks = 0;                                  pResult->ublks = 0;
913                          }                          }
   
914                  } else {                  } else {
915    
916                          if (pResult) {                          if (pResult) {
# Line 937  Line 934 
934    
935          emms();          emms();
936    
937          // 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 */
938          if (pEnc->bframenum_dx50bvop < 0 )          if (pEnc->bframenum_dx50bvop < 0 )
939          {          {
940                  mode = intra2coding_type(pFrame->intra);                  mode = intra2coding_type(pFrame->intra);
# Line 1000  Line 997 
997    
998                                          pMB->dquant = iDQtab[temp_dquants[OFFSET(x, y)] + 2];                                          pMB->dquant = iDQtab[temp_dquants[OFFSET(x, y)] + 2];
999                                  }                                  }
   
1000  #undef OFFSET  #undef OFFSET
1001                          }                          }
   
1002                          xvid_free(temp_dquants);                          xvid_free(temp_dquants);
1003                  }                  }
   
1004          }          }
1005    
1006          /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%          /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Line 1016  Line 1010 
1010    
1011          if (pEnc->iFrameNum == 0 || pEnc->bframenum_dx50bvop >= 0 ||          if (pEnc->iFrameNum == 0 || pEnc->bframenum_dx50bvop >= 0 ||
1012                  (mode < 0 && pEnc->mbParam.iMaxKeyInterval > 0 &&                  (mode < 0 && pEnc->mbParam.iMaxKeyInterval > 0 &&
1013                          pEnc->iFrameNum >= pEnc->mbParam.iMaxKeyInterval))                          pEnc->iFrameNum >= pEnc->mbParam.iMaxKeyInterval)) {
         {  
1014                  mode = I_VOP;                  mode = I_VOP;
1015          }else{          }else{
1016                  mode = MEanalysis(&pEnc->reference->image, pEnc->current,                  mode = MEanalysis(&pEnc->reference->image, pEnc->current,
1017                                          &pEnc->mbParam, pEnc->mbParam.iMaxKeyInterval,                                          &pEnc->mbParam, pEnc->mbParam.iMaxKeyInterval,
1018                                          (mode < 0) ? pEnc->iFrameNum : 0,                                          (/*mode < 0*/1/*hack*/) ? pEnc->iFrameNum : 0,
1019                                          bframes_count++);                                          bframes_count++, pFrame->bframe_threshold);
1020          }          }
1021    
1022          if (mode == I_VOP) {          if (mode == I_VOP) {
# Line 1053  Line 1046 
1046                          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");
1047                  }                  }
1048    
1049                  // 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 */
1050    
1051                  if ((pEnc->mbParam.global & XVID_GLOBAL_DX50BVOP) && pEnc->bframenum_tail > 0) {                  if ((pEnc->mbParam.global & XVID_GLOBAL_DX50BVOP) && pEnc->bframenum_tail > 0) {
1052    
# Line 1145  Line 1138 
1138    
1139                  pEnc->bframenum_tail++;                  pEnc->bframenum_tail++;
1140    
1141  // bframe report by koepi                  /* bframe report by koepi */
1142                  pFrame->intra = 2;                  pFrame->intra = 2;
1143                  pFrame->length = 0;                  pFrame->length = 0;
1144    
# Line 1217  Line 1210 
1210          uint16_t write_vol_header = 0;          uint16_t write_vol_header = 0;
1211    
1212          float psnr;          float psnr;
1213          uint8_t temp[128];          char temp[128];
1214    
1215          start_global_timer();          start_global_timer();
1216    
# Line 1349  Line 1342 
1342    
1343          }          }
1344    
1345  //      BitstreamPutBits(&bs, 0xFFFF, 16);          /* Relic from OpenDivX - now disabled
1346  //      BitstreamPutBits(&bs, 0xFFFF, 16);          BitstreamPutBits(&bs, 0xFFFF, 16);
1347            BitstreamPutBits(&bs, 0xFFFF, 16);
1348            */
1349    
1350          BitstreamPadAlways(&bs);          BitstreamPadAlways(&bs);
1351          pFrame->length = BitstreamLength(&bs);          pFrame->length = BitstreamLength(&bs);
1352    
# Line 1441  Line 1437 
1437                  return;                  return;
1438          }          }
1439    
1440          pEnc->current->fcode =          pEnc->current->fcode = (hint->rawhints) ?
1441                  (hint->rawhints) ? hint->mvhint.fcode : BitstreamGetBits(&bs,                  (uint32_t)hint->mvhint.fcode : BitstreamGetBits(&bs, FCODEBITS);
                                                                                                                                  FCODEBITS);  
1442    
1443          length = pEnc->current->fcode + 5;          length = pEnc->current->fcode + 5;
1444          high = 1 << (length - 1);          high = 1 << (length - 1);
# Line 1458  Line 1453 
1453                          VECTOR tmp;                          VECTOR tmp;
1454                          int vec;                          int vec;
1455    
1456                          pMB->mode =                          pMB->mode =     (hint->rawhints) ?
1457                                  (hint->rawhints) ? bhint->mode : BitstreamGetBits(&bs,                                  (uint32_t)bhint->mode : BitstreamGetBits(&bs, MODEBITS);
                                                                                                                                   MODEBITS);  
1458    
1459                          pMB->mode = (pMB->mode == MODE_INTER_Q) ? MODE_INTER : pMB->mode;                          pMB->mode = (pMB->mode == MODE_INTER_Q) ? MODE_INTER : pMB->mode;
1460                          pMB->mode = (pMB->mode == MODE_INTRA_Q) ? MODE_INTRA : pMB->mode;                          pMB->mode = (pMB->mode == MODE_INTRA_Q) ? MODE_INTRA : pMB->mode;
1461    
1462                          if (pMB->mode == MODE_INTER) {                          if (pMB->mode == MODE_INTER) {
1463                                  tmp.x =                                  tmp.x = (hint->rawhints) ?
1464                                          (hint->rawhints) ? bhint->mvs[0].x : BitstreamGetBits(&bs,                                          bhint->mvs[0].x : (int)BitstreamGetBits(&bs, length);
1465                                                                                                                                                    length);                                  tmp.y = (hint->rawhints) ?
1466                                  tmp.y =                                          bhint->mvs[0].y : (int)BitstreamGetBits(&bs, length);
                                         (hint->rawhints) ? bhint->mvs[0].y : BitstreamGetBits(&bs,  
                                                                                                                                                   length);  
1467                                  tmp.x -= (tmp.x >= high) ? high * 2 : 0;                                  tmp.x -= (tmp.x >= high) ? high * 2 : 0;
1468                                  tmp.y -= (tmp.y >= high) ? high * 2 : 0;                                  tmp.y -= (tmp.y >= high) ? high * 2 : 0;
1469    
# Line 1485  Line 1477 
1477                                  }                                  }
1478                          } else if (pMB->mode == MODE_INTER4V) {                          } else if (pMB->mode == MODE_INTER4V) {
1479                                  for (vec = 0; vec < 4; ++vec) {                                  for (vec = 0; vec < 4; ++vec) {
1480                                          tmp.x =                                          tmp.x = (hint->rawhints) ?
1481                                                  (hint->rawhints) ? bhint->mvs[vec].                                                  bhint->mvs[vec].x : (int)BitstreamGetBits(&bs, length);
1482                                                  x : BitstreamGetBits(&bs, length);                                          tmp.y = (hint->rawhints) ?
1483                                          tmp.y =                                                  bhint->mvs[vec].y : (int)BitstreamGetBits(&bs, length);
                                                 (hint->rawhints) ? bhint->mvs[vec].  
                                                 y : BitstreamGetBits(&bs, length);  
1484                                          tmp.x -= (tmp.x >= high) ? high * 2 : 0;                                          tmp.x -= (tmp.x >= high) ? high * 2 : 0;
1485                                          tmp.y -= (tmp.y >= high) ? high * 2 : 0;                                          tmp.y -= (tmp.y >= high) ? high * 2 : 0;
1486    
# Line 1501  Line 1491 
1491                                          pMB->pmvs[vec].x = pMB->mvs[vec].x - pred.x;                                          pMB->pmvs[vec].x = pMB->mvs[vec].x - pred.x;
1492                                          pMB->pmvs[vec].y = pMB->mvs[vec].y - pred.y;                                          pMB->pmvs[vec].y = pMB->mvs[vec].y - pred.y;
1493                                  }                                  }
1494                          } else                          // intra / stuffing / not_coded                          } else                          /* intra / stuffing / not_coded */
1495                          {                          {
1496                                  for (vec = 0; vec < 4; ++vec) {                                  for (vec = 0; vec < 4; ++vec) {
1497                                          pMB->mvs[vec].x = pMB->mvs[vec].y = 0;                                          pMB->mvs[vec].x = pMB->mvs[vec].y = 0;
# Line 1638  Line 1628 
1628                          pEnc->mbParam.width, pEnc->mbParam.height);                          pEnc->mbParam.width, pEnc->mbParam.height);
1629                  stop_edges_timer();                  stop_edges_timer();
1630          }          }
   
1631          pEnc->iFrameNum = 0;          pEnc->iFrameNum = 0;
1632          pEnc->mbParam.m_rounding_type = 1;          pEnc->mbParam.m_rounding_type = 1;
1633          pEnc->current->rounding_type = pEnc->mbParam.m_rounding_type;          pEnc->current->rounding_type = pEnc->mbParam.m_rounding_type;
# Line 1698  Line 1687 
1687                  HintedMEGet(pEnc, 1);                  HintedMEGet(pEnc, 1);
1688          }          }
1689    
1690          return 1;                                       // intra          return 1;                                       /* intra */
1691  }  }
1692    
1693    
# Line 1736  Line 1725 
1725                  mb_height = (pEnc->mbParam.height + 31) / 32;                  mb_height = (pEnc->mbParam.height + 31) / 32;
1726          }          }
1727    
   
1728          start_timer();          start_timer();
1729          image_setedges(pRef, pEnc->mbParam.edged_width, pEnc->mbParam.edged_height,          image_setedges(pRef, pEnc->mbParam.edged_width, pEnc->mbParam.edged_height,
1730                                     pEnc->mbParam.width, pEnc->mbParam.height);                                     pEnc->mbParam.width, pEnc->mbParam.height);
# Line 2036  Line 2024 
2024          iSearchRange = 1 << (3 + pEnc->mbParam.m_fcode);          iSearchRange = 1 << (3 + pEnc->mbParam.m_fcode);
2025    
2026          if ((fSigma > iSearchRange / 3)          if ((fSigma > iSearchRange / 3)
2027                  && (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 */
2028          {          {
2029                  pEnc->mbParam.m_fcode++;                  pEnc->mbParam.m_fcode++;
2030                  iSearchRange *= 2;                  iSearchRange *= 2;
2031          } else if ((fSigma < iSearchRange / 6)          } else if ((fSigma < iSearchRange / 6)
2032                             && (pEnc->fMvPrevSigma >= 0)                             && (pEnc->fMvPrevSigma >= 0)
2033                             && (pEnc->fMvPrevSigma < iSearchRange / 6)                             && (pEnc->fMvPrevSigma < iSearchRange / 6)
2034                          && (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 */
2035          {          {
2036                  pEnc->mbParam.m_fcode--;                  pEnc->mbParam.m_fcode--;
2037                  iSearchRange /= 2;                  iSearchRange /= 2;
# Line 2064  Line 2052 
2052                  set_timecodes(pEnc->current,pEnc->reference,pEnc->mbParam.fbase);                  set_timecodes(pEnc->current,pEnc->reference,pEnc->mbParam.fbase);
2053                  BitstreamWriteVopHeader(bs, &pEnc->mbParam, pEnc->current, 0);                  BitstreamWriteVopHeader(bs, &pEnc->mbParam, pEnc->current, 0);
2054    
2055                  // copy reference frame details into the current frame                  /* copy reference frame details into the current frame */
2056                  pEnc->current->quant = pEnc->reference->quant;                  pEnc->current->quant = pEnc->reference->quant;
2057                  pEnc->current->motion_flags = pEnc->reference->motion_flags;                  pEnc->current->motion_flags = pEnc->reference->motion_flags;
2058                  pEnc->current->rounding_type = pEnc->reference->rounding_type;                  pEnc->current->rounding_type = pEnc->reference->rounding_type;
# Line 2093  Line 2081 
2081    
2082          *pBits = BitstreamPos(bs) - *pBits;          *pBits = BitstreamPos(bs) - *pBits;
2083    
2084          return 0;                                       // inter          return 0;                                       /* inter */
2085  }  }
2086    
2087    
# Line 2126  Line 2114 
2114    
2115          frame->quarterpel =  pEnc->mbParam.m_quarterpel;          frame->quarterpel =  pEnc->mbParam.m_quarterpel;
2116    
2117          // forward          /* forward  */
2118          image_setedges(f_ref, pEnc->mbParam.edged_width,          image_setedges(f_ref, pEnc->mbParam.edged_width,
2119                                     pEnc->mbParam.edged_height, pEnc->mbParam.width,                                     pEnc->mbParam.edged_height, pEnc->mbParam.width,
2120                                     pEnc->mbParam.height);                                     pEnc->mbParam.height);
# Line 2136  Line 2124 
2124                                            pEnc->mbParam.m_quarterpel, 0);                                            pEnc->mbParam.m_quarterpel, 0);
2125          stop_inter_timer();          stop_inter_timer();
2126    
2127          // backward          /* backward */
2128          image_setedges(b_ref, pEnc->mbParam.edged_width,          image_setedges(b_ref, pEnc->mbParam.edged_width,
2129                                     pEnc->mbParam.edged_height, pEnc->mbParam.width,                                     pEnc->mbParam.edged_height, pEnc->mbParam.width,
2130                                     pEnc->mbParam.height);                                     pEnc->mbParam.height);
# Line 2149  Line 2137 
2137          start_timer();          start_timer();
2138    
2139          MotionEstimationBVOP(&pEnc->mbParam, frame,          MotionEstimationBVOP(&pEnc->mbParam, frame,
2140                  ((int32_t)(pEnc->current->stamp - frame->stamp)),                               // time_bp                                                   ((int32_t)(pEnc->current->stamp - frame->stamp)),                              /* time_bp */
2141                  ((int32_t)(pEnc->current->stamp - pEnc->reference->stamp)),     // time_pp                                                   ((int32_t)(pEnc->current->stamp - pEnc->reference->stamp)),    /* time_pp */
2142                          pEnc->reference->mbs, f_ref,                          pEnc->reference->mbs, f_ref,
2143                                                   &pEnc->f_refh, &pEnc->f_refv, &pEnc->f_refhv,                                                   &pEnc->f_refh, &pEnc->f_refv, &pEnc->f_refhv,
2144                                                   pEnc->current, b_ref, &pEnc->vInterH,                                                   pEnc->current, b_ref, &pEnc->vInterH,
# Line 2158  Line 2146 
2146    
2147    
2148          stop_motion_timer();          stop_motion_timer();
2149            /*
2150          /*if (test_quant_type(&pEnc->mbParam, pEnc->current))          if (test_quant_type(&pEnc->mbParam, pEnc->current)) {
            {  
2151             BitstreamWriteVolHeader(bs, pEnc->mbParam.width, pEnc->mbParam.height, pEnc->mbParam.quant_type);             BitstreamWriteVolHeader(bs, pEnc->mbParam.width, pEnc->mbParam.height, pEnc->mbParam.quant_type);
2152             } */          }
2153            */
2154    
2155          frame->coding_type = B_VOP;          frame->coding_type = B_VOP;
2156    
# Line 2182  Line 2170 
2170                          MACROBLOCK * const mb = &frame->mbs[x + y * pEnc->mbParam.mb_width];                          MACROBLOCK * const mb = &frame->mbs[x + y * pEnc->mbParam.mb_width];
2171                          int direction = pEnc->mbParam.global & XVID_ALTERNATESCAN ? 2 : 0;                          int direction = pEnc->mbParam.global & XVID_ALTERNATESCAN ? 2 : 0;
2172    
2173                          // decoder ignores mb when refence block is INTER(0,0), CBP=0                          /* decoder ignores mb when refence block is INTER(0,0), CBP=0 */
2174                          if (mb->mode == MODE_NOT_CODED) {                          if (mb->mode == MODE_NOT_CODED) {
2175                                  //mb->mvs[0].x = mb->mvs[0].y = mb->cbp = 0;                                  /* mb->mvs[0].x = mb->mvs[0].y = mb->cbp = 0; */
2176                                  continue;                                  continue;
2177                          }                          }
2178    
# Line 2203  Line 2191 
2191    
2192                                  if ( (mb->mode == MODE_DIRECT) && (mb->cbp == 0)                                  if ( (mb->mode == MODE_DIRECT) && (mb->cbp == 0)
2193                                          && (mb->pmvs[3].x == 0) && (mb->pmvs[3].y == 0) ) {                                          && (mb->pmvs[3].x == 0) && (mb->pmvs[3].y == 0) ) {
2194                                          mb->mode = MODE_DIRECT_NONE_MV; // skipped                                          mb->mode = MODE_DIRECT_NONE_MV; /* skipped */
2195                                  }                                  }
2196                          }                          }
2197    
# Line 2219  Line 2207 
2207    
2208          emms();          emms();
2209    
2210          // TODO: dynamic fcode/bcode ???          /* TODO: dynamic fcode/bcode ??? */
2211    
2212          *pBits = BitstreamPos(bs) - *pBits;          *pBits = BitstreamPos(bs) - *pBits;
2213    

Legend:
Removed from v.853  
changed lines
  Added in v.979

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