[svn] / branches / dev-api-4 / xvidcore / src / encoder.c Repository:
ViewVC logotype

Diff of /branches/dev-api-4/xvidcore/src/encoder.c

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

revision 1105, Tue Jul 29 23:02:34 2003 UTC revision 1213, Sun Nov 16 17:41:03 2003 UTC
# Line 21  Line 21 
21   *  along with this program ; if not, write to the Free Software   *  along with this program ; if not, write to the Free Software
22   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
23   *   *
24   * $Id: encoder.c,v 1.95.2.35 2003-07-29 23:02:29 edgomez Exp $   * $Id: encoder.c,v 1.95.2.53 2003-11-16 17:41:03 edgomez Exp $
25   *   *
26   ****************************************************************************/   ****************************************************************************/
27    
# Line 117  Line 117 
117          Encoder *pEnc;          Encoder *pEnc;
118      int n;      int n;
119    
120          if (XVID_MAJOR(create->version) != 1)   /* v1.x.x */          if (XVID_VERSION_MAJOR(create->version) != 1) /* v1.x.x */
121                  return XVID_ERR_VERSION;                  return XVID_ERR_VERSION;
122    
123          if (create->width%2 || create->height%2)          if (create->width%2 || create->height%2)
# Line 188  Line 188 
188          pcreate.zones = pEnc->zones;          pcreate.zones = pEnc->zones;
189          pcreate.width = pEnc->mbParam.width;          pcreate.width = pEnc->mbParam.width;
190          pcreate.height = pEnc->mbParam.height;          pcreate.height = pEnc->mbParam.height;
191            pcreate.mb_width = pEnc->mbParam.mb_width;
192            pcreate.mb_height = pEnc->mbParam.mb_height;
193          pcreate.fincr = pEnc->mbParam.fincr;          pcreate.fincr = pEnc->mbParam.fincr;
194          pcreate.fbase = pEnc->mbParam.fbase;          pcreate.fbase = pEnc->mbParam.fbase;
195          pcreate.param = create->plugins[n].param;          pcreate.param = create->plugins[n].param;
# Line 226  Line 228 
228          pEnc->mbParam.frame_drop_ratio = MAX(create->frame_drop_ratio, 0);          pEnc->mbParam.frame_drop_ratio = MAX(create->frame_drop_ratio, 0);
229    
230      /* max keyframe interval */      /* max keyframe interval */
231      pEnc->mbParam.iMaxKeyInterval = create->max_key_interval <= 0 ?      pEnc->mbParam.iMaxKeyInterval = create->max_key_interval <= 0 ? (10 * (int)pEnc->mbParam.fbase) / (int)pEnc->mbParam.fincr : create->max_key_interval;
                 (10 * pEnc->mbParam.fbase) / pEnc->mbParam.fincr : create->max_key_interval;  
232    
233      /* allocate working frame-image memory */      /* allocate working frame-image memory */
234    
# Line 390  Line 391 
391                  image_null(&pEnc->queue[n].image);                  image_null(&pEnc->queue[n].image);
392    
393    
394          for (n = 0; n < pEnc->mbParam.max_bframes+1; n++)          for (n = 0; n < pEnc->mbParam.max_bframes+1; n++) {
         {  
395                  if (image_create                  if (image_create
396                          (&pEnc->queue[n].image, pEnc->mbParam.edged_width,                          (&pEnc->queue[n].image, pEnc->mbParam.edged_width,
397                           pEnc->mbParam.edged_height) < 0)                           pEnc->mbParam.edged_height) < 0)
398                          goto xvid_err_memory5;                          goto xvid_err_memory5;
   
399          }          }
400    
   
401          /* timestamp stuff */          /* timestamp stuff */
402    
403          pEnc->mbParam.m_stamp = 0;          pEnc->mbParam.m_stamp = 0;
# Line 424  Line 422 
422    
423    xvid_err_memory5:    xvid_err_memory5:
424    
425          if (pEnc->mbParam.max_bframes > 0) {          for (n = 0; n < pEnc->mbParam.max_bframes+1; n++) {
426          int i;                          image_destroy(&pEnc->queue[n].image, pEnc->mbParam.edged_width,
   
                 for (i = 0; i < pEnc->mbParam.max_bframes+1; i++) {  
                         image_destroy(&pEnc->queue[i].image, pEnc->mbParam.edged_width,  
427                                                    pEnc->mbParam.edged_height);                                                    pEnc->mbParam.edged_height);
428                  }                  }
429    
430                  xvid_free(pEnc->queue);                  xvid_free(pEnc->queue);
         }  
431    
432    xvid_err_memory4:    xvid_err_memory4:
433    
# Line 446  Line 441 
441    
442                          image_destroy(&pEnc->bframes[i]->image, pEnc->mbParam.edged_width,                          image_destroy(&pEnc->bframes[i]->image, pEnc->mbParam.edged_width,
443                                                    pEnc->mbParam.edged_height);                                                    pEnc->mbParam.edged_height);
   
444                          xvid_free(pEnc->bframes[i]->mbs);                          xvid_free(pEnc->bframes[i]->mbs);
   
445                          xvid_free(pEnc->bframes[i]);                          xvid_free(pEnc->bframes[i]);
   
446                  }                  }
447    
448                  xvid_free(pEnc->bframes);                  xvid_free(pEnc->bframes);
# Line 539  Line 531 
531          int i;          int i;
532    
533          /* B Frames specific */          /* B Frames specific */
         if (pEnc->mbParam.max_bframes > 0) {  
   
534                  for (i = 0; i < pEnc->mbParam.max_bframes+1; i++) {                  for (i = 0; i < pEnc->mbParam.max_bframes+1; i++) {
   
535                          image_destroy(&pEnc->queue[i].image, pEnc->mbParam.edged_width,                          image_destroy(&pEnc->queue[i].image, pEnc->mbParam.edged_width,
536                                            pEnc->mbParam.edged_height);                                            pEnc->mbParam.edged_height);
537                  }                  }
                 xvid_free(pEnc->queue);  
         }  
538    
539            xvid_free(pEnc->queue);
540    
541          if (pEnc->mbParam.max_bframes > 0) {          if (pEnc->mbParam.max_bframes > 0) {
542    
# Line 559  Line 547 
547    
548                          image_destroy(&pEnc->bframes[i]->image, pEnc->mbParam.edged_width,                          image_destroy(&pEnc->bframes[i]->image, pEnc->mbParam.edged_width,
549                                            pEnc->mbParam.edged_height);                                            pEnc->mbParam.edged_height);
   
550                          xvid_free(pEnc->bframes[i]->mbs);                          xvid_free(pEnc->bframes[i]->mbs);
   
551                          xvid_free(pEnc->bframes[i]);                          xvid_free(pEnc->bframes[i]);
552                  }                  }
553    
# Line 664  Line 650 
650      data.mb_height = pEnc->mbParam.mb_height;      data.mb_height = pEnc->mbParam.mb_height;
651      data.fincr = frame->fincr;      data.fincr = frame->fincr;
652      data.fbase = pEnc->mbParam.fbase;      data.fbase = pEnc->mbParam.fbase;
653            data.bquant_ratio = pEnc->mbParam.bquant_ratio;
654            data.bquant_offset = pEnc->mbParam.bquant_offset;
655    
656      for (i=0; i<3; i++) {      for (i=0; i<3; i++) {
657          data.min_quant[i] = pEnc->mbParam.min_quant[i];          data.min_quant[i] = pEnc->mbParam.min_quant[i];
# Line 741  Line 729 
729    
730              for (j=0; j<pEnc->mbParam.mb_height; j++)              for (j=0; j<pEnc->mbParam.mb_height; j++)
731              for (i=0; i<pEnc->mbParam.mb_width; i++) {              for (i=0; i<pEnc->mbParam.mb_width; i++) {
732                  data.dquant[j*data.dquant_stride + i] = frame->mbs[j*pEnc->mbParam.mb_width + i].dquant;;                  data.dquant[j*data.dquant_stride + i] = frame->mbs[j*pEnc->mbParam.mb_width + i].dquant;
733              }              }
734          }          }
735    
# Line 771  Line 759 
759      }      }
760    
761      /* call plugins */      /* call plugins */
762      for (i=0; i<pEnc->num_plugins;i++) {      for (i=0; i<(unsigned int)pEnc->num_plugins;i++) {
763          emms();          emms();
764          if (pEnc->plugins[i].func) {          if (pEnc->plugins[i].func) {
765              if (pEnc->plugins[i].func(pEnc->plugins[i].param, opt, &data, 0) < 0) {              if (pEnc->plugins[i].func(pEnc->plugins[i].param, opt, &data, 0) < 0) {
# Line 867  Line 855 
855          int type;          int type;
856          Bitstream bs;          Bitstream bs;
857    
858          if (XVID_MAJOR(xFrame->version) != 1 || (stats && XVID_MAJOR(stats->version) != 1))     /* v1.x.x */          if (XVID_VERSION_MAJOR(xFrame->version) != 1 || (stats && XVID_VERSION_MAJOR(stats->version) != 1))     /* v1.x.x */
859                  return XVID_ERR_VERSION;                  return XVID_ERR_VERSION;
860    
861          xFrame->out_flags = 0;          xFrame->out_flags = 0;
# Line 1010  Line 998 
998                                  SWAP(FRAMEINFO*, pEnc->current, pEnc->bframes[pEnc->bframenum_tail]);                                  SWAP(FRAMEINFO*, pEnc->current, pEnc->bframes[pEnc->bframenum_tail]);
999    
1000                                  /* convert B-VOP to P-VOP */                                  /* convert B-VOP to P-VOP */
1001                  pEnc->current->quant = ((pEnc->current->quant*100) - pEnc->mbParam.bquant_offset) / pEnc->mbParam.bquant_ratio;                  pEnc->current->quant  = 100*pEnc->current->quant - pEnc->mbParam.bquant_offset;
1002                                    pEnc->current->quant += pEnc->mbParam.bquant_ratio - 1; /* to avoid rouding issues */
1003                                    pEnc->current->quant /= pEnc->mbParam.bquant_ratio;
1004    
1005                  if ((pEnc->mbParam.plugin_flags & XVID_REQORIGINAL)) {                  if ((pEnc->mbParam.plugin_flags & XVID_REQORIGINAL)) {
1006                              image_copy(&pEnc->sOriginal, &pEnc->current->image,                              image_copy(&pEnc->sOriginal, &pEnc->current->image,
# Line 1085  Line 1075 
1075                  }else{                  }else{
1076                          type = MEanalysis(&pEnc->reference->image, pEnc->current,                          type = MEanalysis(&pEnc->reference->image, pEnc->current,
1077                                          &pEnc->mbParam, pEnc->mbParam.iMaxKeyInterval,                                          &pEnc->mbParam, pEnc->mbParam.iMaxKeyInterval,
1078                                          pEnc->iFrameNum, pEnc->bframenum_tail, xFrame->bframe_threshold);                                                            pEnc->iFrameNum, pEnc->bframenum_tail, xFrame->bframe_threshold,
1079                                                              (pEnc->bframes) ? pEnc->bframes[pEnc->bframenum_head]->mbs: NULL);
1080                  }                  }
1081          }          }
1082    
# Line 1098  Line 1089 
1089    
1090          if ((pEnc->current->vop_flags & XVID_VOP_DEBUG)) {          if ((pEnc->current->vop_flags & XVID_VOP_DEBUG)) {
1091                  image_printf(&pEnc->current->image, pEnc->mbParam.edged_width, pEnc->mbParam.height, 5, 5,                  image_printf(&pEnc->current->image, pEnc->mbParam.edged_width, pEnc->mbParam.height, 5, 5,
1092                          "%i  st:%i  if:%i", pEnc->current->frame_num, pEnc->current->stamp, pEnc->iFrameNum);                          "%d  st:%lld  if:%d", pEnc->current->frame_num, pEnc->current->stamp, pEnc->iFrameNum);
1093          }          }
1094    
1095          /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%          /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Line 1177  Line 1168 
1168                  }                  }
1169    
1170                  /* convert B-VOP quant to P-VOP */                  /* convert B-VOP quant to P-VOP */
1171                  pEnc->current->quant = ((pEnc->current->quant*100) - pEnc->mbParam.bquant_offset) / pEnc->mbParam.bquant_ratio;                  pEnc->current->quant  = 100*pEnc->current->quant - pEnc->mbParam.bquant_offset;
1172                    pEnc->current->quant += pEnc->mbParam.bquant_ratio - 1; /* to avoid rouding issues */
1173                    pEnc->current->quant /= pEnc->mbParam.bquant_ratio;
1174          type = P_VOP;          type = P_VOP;
1175      }      }
1176    
# Line 1200  Line 1193 
1193    
1194                  /* ---- update vol flags at IVOP ----------- */                  /* ---- update vol flags at IVOP ----------- */
1195                  pEnc->current->vol_flags = pEnc->mbParam.vol_flags = frame->vol_flags;                  pEnc->current->vol_flags = pEnc->mbParam.vol_flags = frame->vol_flags;
1196                    switch(frame->par) {
1197                    case XVID_PAR_11_VGA:
1198                    case XVID_PAR_43_PAL:
1199                    case XVID_PAR_43_NTSC:
1200                    case XVID_PAR_169_PAL:
1201                    case XVID_PAR_169_NTSC:
1202                    case XVID_PAR_EXT:
1203                            pEnc->mbParam.par = frame->par;
1204                            break;
1205                    default:
1206                            pEnc->mbParam.par = XVID_PAR_EXT;
1207                            break;
1208                    }
1209                    pEnc->mbParam.par_width = (frame->par_width)?frame->par_width:1;
1210                    pEnc->mbParam.par_height = (frame->par_height)?frame->par_height:1;
1211    
1212          if ((pEnc->mbParam.vol_flags & XVID_VOL_MPEGQUANT)) {          if ((pEnc->mbParam.vol_flags & XVID_VOL_MPEGQUANT)) {
1213                          if (frame->quant_intra_matrix != NULL)                          if (frame->quant_intra_matrix != NULL)
# Line 1253  Line 1261 
1261           * on next enc_encode call we must flush bframes           * on next enc_encode call we must flush bframes
1262           * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */           * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */
1263    
1264  done_flush:  /*done_flush:*/
1265    
1266      pEnc->flush_bframes = 1;      pEnc->flush_bframes = 1;
1267    
# Line 1285  Line 1293 
1293  {  {
1294      unsigned int i,j;      unsigned int i,j;
1295      int quant = frame->quant;      int quant = frame->quant;
1296        if (quant > 31)
1297                    frame->quant = quant = 31;
1298            else if (quant < 1)
1299                    frame->quant = quant = 1;
1300    
1301      for (j=0; j<pParam->mb_height; j++)      for (j=0; j<pParam->mb_height; j++)
1302      for (i=0; i<pParam->mb_width; i++) {      for (i=0; i<pParam->mb_width; i++) {
# Line 1292  Line 1304 
1304          quant += pMB->dquant;          quant += pMB->dquant;
1305          if (quant > 31)          if (quant > 31)
1306                          quant = 31;                          quant = 31;
1307                  if (quant < 1)                  else if (quant < 1)
1308                          quant = 1;                          quant = 1;
1309          pMB->quant = quant;          pMB->quant = quant;
1310      }      }
# Line 1403  Line 1415 
1415          pEnc->fMvPrevSigma = -1;          pEnc->fMvPrevSigma = -1;
1416          pEnc->mbParam.m_fcode = 2;          pEnc->mbParam.m_fcode = 2;
1417    
1418            pEnc->current->is_edged = 0; /* not edged */
1419            pEnc->current->is_interpolated = -1; /* not interpolated (fake rounding -1) */
1420    
1421          return 1;                                       /* intra */          return 1;                                       /* intra */
1422  }  }
1423    
# Line 1445  Line 1460 
1460          }          }
1461    
1462    
1463            if (!reference->is_edged) {
1464          start_timer();          start_timer();
1465          image_setedges(pRef, pParam->edged_width, pParam->edged_height,          image_setedges(pRef, pParam->edged_width, pParam->edged_height,
1466                                     pParam->width, pParam->height);                                     pParam->width, pParam->height);
1467          stop_edges_timer();          stop_edges_timer();
1468                    reference->is_edged = 1;
1469            }
1470    
1471          pParam->m_rounding_type = 1 - pParam->m_rounding_type;          pParam->m_rounding_type = 1 - pParam->m_rounding_type;
1472          current->rounding_type = pParam->m_rounding_type;          current->rounding_type = pParam->m_rounding_type;
# Line 1460  Line 1478 
1478                  iLimit = mb_width * mb_height + 1;                  iLimit = mb_width * mb_height + 1;
1479    
1480          if ((current->vop_flags & XVID_VOP_HALFPEL)) {          if ((current->vop_flags & XVID_VOP_HALFPEL)) {
1481                    if (reference->is_interpolated != current->rounding_type) {
1482                  start_timer();                  start_timer();
1483                  image_interpolate(pRef, &pEnc->vInterH, &pEnc->vInterV,                  image_interpolate(pRef, &pEnc->vInterH, &pEnc->vInterV,
1484                                                    &pEnc->vInterHV, pParam->edged_width,                                                    &pEnc->vInterHV, pParam->edged_width,
# Line 1467  Line 1486 
1486                                                    (pParam->vol_flags & XVID_VOL_QUARTERPEL),                                                    (pParam->vol_flags & XVID_VOL_QUARTERPEL),
1487                                                    current->rounding_type);                                                    current->rounding_type);
1488                  stop_inter_timer();                  stop_inter_timer();
1489                            reference->is_interpolated = current->rounding_type;
1490                    }
1491          }          }
1492    
1493          current->coding_type = P_VOP;          current->coding_type = P_VOP;
# Line 1480  Line 1501 
1501                  current->warp = GlobalMotionEst( current->mbs, pParam, current, reference,                  current->warp = GlobalMotionEst( current->mbs, pParam, current, reference,
1502                                                                   &pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV);                                                                   &pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV);
1503    
1504                  if (current->motion_flags & XVID_GME_REFINE) {                  if (current->motion_flags & XVID_ME_GME_REFINE) {
1505                          gmcval = GlobalMotionEstRefine(&current->warp,                          gmcval = GlobalMotionEstRefine(&current->warp,
1506                                                                  current->mbs, pParam,                                                                  current->mbs, pParam,
1507                                                                  current, reference,                                                                  current, reference,
# Line 1489  Line 1510 
1510                                                                  &pEnc->vInterH,                                                                  &pEnc->vInterH,
1511                                                                  &pEnc->vInterV,                                                                  &pEnc->vInterV,
1512                                                                  &pEnc->vInterHV);                                                                  &pEnc->vInterHV);
1513                          gmcval += /*current->quant */ 2 * (int)(pParam->mb_width*pParam->mb_height);                  } else {
                 }  
   
1514                  gmcval = globalSAD(&current->warp, pParam, current->mbs,                  gmcval = globalSAD(&current->warp, pParam, current->mbs,
1515                                                          current,                                                          current,
1516                                                          &reference->image,                                                          &reference->image,
1517                                                          &current->image,                                                          &current->image,
1518                                                          pEnc->vGMC.y);                                                          pEnc->vGMC.y);
1519                    }
1520    
1521                  gmcval += /*current->quant*/ 2 * (int)(pParam->mb_width*pParam->mb_height);                  gmcval += /*current->quant*/ 2 * (int)(pParam->mb_width*pParam->mb_height);
1522    
1523  /* 1st '3': 3 warpoints, 2nd '3': 16th pel res (2<<3) */  /* 1st '3': 3 warpoints, 2nd '3': 16th pel res (2<<3) */
# Line 1565  Line 1586 
1586    
1587                                  current->sStat.kblks++;                                  current->sStat.kblks++;
1588    
1589                                    if (pEnc->current->vop_flags & XVID_VOP_GREYSCALE)
1590                                    {       pMB->cbp &= 0x3C;               /* keep only bits 5-2 */
1591                                            qcoeff[4*64+0]=0;               /* zero, because for INTRA MBs DC value is saved */
1592                                            qcoeff[5*64+0]=0;
1593                                    }
1594                                  MBCoding(current, pMB, qcoeff, bs, &current->sStat);                                  MBCoding(current, pMB, qcoeff, bs, &current->sStat);
1595                                  stop_coding_timer();                                  stop_coding_timer();
1596                                  continue;                                  continue;
# Line 1769  Line 1795 
1795                  memcpy(current->mbs, reference->mbs, sizeof(MACROBLOCK) * mb_width * mb_height);                  memcpy(current->mbs, reference->mbs, sizeof(MACROBLOCK) * mb_width * mb_height);
1796          }          }
1797    
1798            pEnc->current->is_edged = 0; /* not edged */
1799            pEnc->current->is_interpolated = -1; /* not interpolated (fake rounding -1) */
1800    
1801            /* what was this frame's interpolated reference will become
1802                    forward (past) reference in b-frame coding */
1803    
1804            image_swap(&pEnc->vInterH, &pEnc->f_refh);
1805            image_swap(&pEnc->vInterV, &pEnc->f_refv);
1806            image_swap(&pEnc->vInterHV, &pEnc->f_refhv);
1807    
1808    
1809          /* XXX: debug          /* XXX: debug
1810          {          {
1811                  char s[100];                  char s[100];
# Line 1820  Line 1857 
1857  #endif  #endif
1858    
1859          /* forward  */          /* forward  */
1860            if (!pEnc->reference->is_edged) {
1861          image_setedges(f_ref, pEnc->mbParam.edged_width,          image_setedges(f_ref, pEnc->mbParam.edged_width,
1862                                     pEnc->mbParam.edged_height, pEnc->mbParam.width,                                     pEnc->mbParam.edged_height, pEnc->mbParam.width,
1863                                     pEnc->mbParam.height);                                     pEnc->mbParam.height);
1864                    pEnc->current->is_edged = 1;
1865            }
1866    
1867            if (pEnc->reference->is_interpolated != 0) {
1868          start_timer();          start_timer();
1869          image_interpolate(f_ref, &pEnc->f_refh, &pEnc->f_refv, &pEnc->f_refhv,          image_interpolate(f_ref, &pEnc->f_refh, &pEnc->f_refv, &pEnc->f_refhv,
1870                                            pEnc->mbParam.edged_width, pEnc->mbParam.edged_height,                                            pEnc->mbParam.edged_width, pEnc->mbParam.edged_height,
1871                                            (pEnc->mbParam.vol_flags & XVID_VOL_QUARTERPEL), 0);                                            (pEnc->mbParam.vol_flags & XVID_VOL_QUARTERPEL), 0);
1872          stop_inter_timer();          stop_inter_timer();
1873                    pEnc->reference->is_interpolated = 0;
1874            }
1875    
1876          /* backward */          /* backward */
1877            if (!pEnc->current->is_edged) {
1878          image_setedges(b_ref, pEnc->mbParam.edged_width,          image_setedges(b_ref, pEnc->mbParam.edged_width,
1879                                     pEnc->mbParam.edged_height, pEnc->mbParam.width,                                     pEnc->mbParam.edged_height, pEnc->mbParam.width,
1880                                     pEnc->mbParam.height);                                     pEnc->mbParam.height);
1881                    pEnc->current->is_edged = 1;
1882            }
1883    
1884            if (pEnc->current->is_interpolated != 0) {
1885          start_timer();          start_timer();
1886          image_interpolate(b_ref, &pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV,          image_interpolate(b_ref, &pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV,
1887                                            pEnc->mbParam.edged_width, pEnc->mbParam.edged_height,                                            pEnc->mbParam.edged_width, pEnc->mbParam.edged_height,
1888                                            (pEnc->mbParam.vol_flags & XVID_VOL_QUARTERPEL), 0);                                            (pEnc->mbParam.vol_flags & XVID_VOL_QUARTERPEL), 0);
1889          stop_inter_timer();          stop_inter_timer();
1890                    pEnc->current->is_interpolated = 0;
1891            }
1892    
1893          start_timer();          start_timer();
1894          MotionEstimationBVOP(&pEnc->mbParam, frame,          MotionEstimationBVOP(&pEnc->mbParam, frame,
# Line 1864  Line 1915 
1915          for (y = 0; y < pEnc->mbParam.mb_height; y++) {          for (y = 0; y < pEnc->mbParam.mb_height; y++) {
1916                  for (x = 0; x < pEnc->mbParam.mb_width; x++) {                  for (x = 0; x < pEnc->mbParam.mb_width; x++) {
1917                          MACROBLOCK * const mb = &frame->mbs[x + y * pEnc->mbParam.mb_width];                          MACROBLOCK * const mb = &frame->mbs[x + y * pEnc->mbParam.mb_width];
                         int direction = frame->vop_flags & XVID_VOP_ALTERNATESCAN ? 2 : 0;  
1918    
1919                          /* decoder ignores mb when refence block is INTER(0,0), CBP=0 */                          /* decoder ignores mb when refence block is INTER(0,0), CBP=0 */
1920                          if (mb->mode == MODE_NOT_CODED) {                          if (mb->mode == MODE_NOT_CODED) {
1921                                  /* mb->mvs[0].x = mb->mvs[0].y = mb->cbp = 0; */                                  if (pEnc->mbParam.plugin_flags & XVID_REQORIGINAL) {
1922                                            MBMotionCompensation(mb, x, y, f_ref, NULL, f_ref, NULL, NULL, &frame->image,
1923                                                                                            NULL, 0, 0, pEnc->mbParam.edged_width, 0, 0, 0);
1924                                    }
1925    
1926                                  continue;                                  continue;
1927                          }                          }
1928    
# Line 1891  Line 1945 
1945                                  }                                  }
1946                          }                          }
1947    
1948  #ifdef BFRAMES_DEC_DEBUG                          /* keep only bits 5-2 -- Chroma blocks will just be skipped by the
1949          BFRAME_DEBUG                           * coding function for BFrames, that's why we don't zero teh DC
1950  #endif                           * coeffs */
1951                            if ((frame->vop_flags & XVID_VOP_GREYSCALE))
1952                                    mb->cbp &= 0x3C;
1953    
1954                          start_timer();                          start_timer();
1955                          MBCodingBVOP(mb, qcoeff, frame->fcode, frame->bcode, bs,                          MBCodingBVOP(frame, mb, qcoeff, frame->fcode, frame->bcode, bs,
1956                                                   &frame->sStat, direction);                                                   &frame->sStat);
1957                          stop_coding_timer();                          stop_coding_timer();
1958                  }                  }
1959          }          }

Legend:
Removed from v.1105  
changed lines
  Added in v.1213

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