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

Diff of /trunk/xvidcore/src/motion/estimation_pvop.c

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

revision 1441, Tue Apr 20 06:10:40 2004 UTC revision 1478, Thu Jul 8 07:12:54 2004 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: estimation_pvop.c,v 1.4 2004-04-20 06:10:40 syskin Exp $   * $Id: estimation_pvop.c,v 1.8 2004-07-08 07:12:54 syskin Exp $
25   *   *
26   ****************************************************************************/   ****************************************************************************/
27    
# Line 42  Line 42 
42    
43  static const int xvid_me_lambda_vec8[32] =  static const int xvid_me_lambda_vec8[32] =
44          {     0    ,(int)(1.00235 * NEIGH_TEND_8X8 + 0.5),          {     0    ,(int)(1.00235 * NEIGH_TEND_8X8 + 0.5),
45          (int)(1.15582 + NEIGH_TEND_8X8 + 0.5), (int)(1.31976*NEIGH_TEND_8X8 + 0.5),          (int)(1.15582*NEIGH_TEND_8X8 + 0.5), (int)(1.31976*NEIGH_TEND_8X8 + 0.5),
46          (int)(1.49591*NEIGH_TEND_8X8 + 0.5), (int)(1.68601*NEIGH_TEND_8X8 + 0.5),          (int)(1.49591*NEIGH_TEND_8X8 + 0.5), (int)(1.68601*NEIGH_TEND_8X8 + 0.5),
47          (int)(1.89187*NEIGH_TEND_8X8 + 0.5), (int)(2.11542*NEIGH_TEND_8X8 + 0.5),          (int)(1.89187*NEIGH_TEND_8X8 + 0.5), (int)(2.11542*NEIGH_TEND_8X8 + 0.5),
48          (int)(2.35878*NEIGH_TEND_8X8 + 0.5), (int)(2.62429*NEIGH_TEND_8X8 + 0.5),          (int)(2.35878*NEIGH_TEND_8X8 + 0.5), (int)(2.62429*NEIGH_TEND_8X8 + 0.5),
# Line 312  Line 312 
312                                  const IMAGE * const pCurrent,                                  const IMAGE * const pCurrent,
313                                  const IMAGE * const pRef,                                  const IMAGE * const pRef,
314                                  const IMAGE * const vGMC,                                  const IMAGE * const vGMC,
315                                  const int coding_type)                                  const int coding_type,
316                                    const int skip_sad)
317  {  {
318          int mode = MODE_INTER;          int mode = MODE_INTER;
319          int mcsel = 0;          int mcsel = 0;
# Line 338  Line 339 
339          }          }
340    
341          /* final skip decision, a.k.a. "the vector you found, really that good?" */          /* final skip decision, a.k.a. "the vector you found, really that good?" */
342          if (skip_possible && (pMB->sad16 < (int)iQuant * MAX_SAD00_FOR_SKIP))          if (skip_possible && (skip_sad < (int)iQuant * MAX_SAD00_FOR_SKIP))
343                  if ( (100*sad)/(pMB->sad16+1) > FINAL_SKIP_THRESH)                  if ( (100*skip_sad)/(pMB->sad16+1) > FINAL_SKIP_THRESH)
344                          if (Data->chroma || xvid_me_SkipDecisionP(pCurrent, pRef, x, y, Data->iEdgedWidth/2, iQuant, Data->rrv)) {                          if (Data->chroma || xvid_me_SkipDecisionP(pCurrent, pRef, x, y, Data->iEdgedWidth/2, iQuant, Data->rrv)) {
345                                  mode = MODE_NOT_CODED;                                  mode = MODE_NOT_CODED;
346                                  sad = 0;                                  sad = 0;
# Line 529  Line 530 
530                  if(!Data->qpel) {                  if(!Data->qpel) {
531                          /* halfpel mode */                          /* halfpel mode */
532                          if (MotionFlags & XVID_ME_HALFPELREFINE8)                          if (MotionFlags & XVID_ME_HALFPELREFINE8)
533                                  xvid_me_SubpelRefine(Data, CheckCandidate, 0); /* perform halfpel refine of current best vector */                                  /* perform halfpel refine of current best vector */
534                                    xvid_me_SubpelRefine(Data->currentMV[0], Data, CheckCandidate, 0);
535                  } else {                  } else {
536                          /* qpel mode */                          /* qpel mode */
537                          Data->currentQMV->x = 2*Data->currentMV->x;                          Data->currentQMV->x = 2*Data->currentMV->x;
# Line 543  Line 545 
545                          } else if(MotionFlags & XVID_ME_QUARTERPELREFINE8) {                          } else if(MotionFlags & XVID_ME_QUARTERPELREFINE8) {
546                                  /* full */                                  /* full */
547                                  if (MotionFlags & XVID_ME_HALFPELREFINE8) {                                  if (MotionFlags & XVID_ME_HALFPELREFINE8) {
548                                          xvid_me_SubpelRefine(Data, CheckCandidate8, 0); /* hpel part */                                          xvid_me_SubpelRefine(Data->currentMV[0], Data, CheckCandidate8, 0); /* hpel part */
549                                          Data->currentQMV->x = 2*Data->currentMV->x;                                          Data->currentQMV->x = 2*Data->currentMV->x;
550                                          Data->currentQMV->y = 2*Data->currentMV->y;                                          Data->currentQMV->y = 2*Data->currentMV->y;
551                                  }                                  }
# Line 552  Line 554 
554                                          pParam->width, pParam->height, Data->iFcode, 2, 0);                                          pParam->width, pParam->height, Data->iFcode, 2, 0);
555                                  Data->qpel_precision = 1;                                  Data->qpel_precision = 1;
556    
557                                  xvid_me_SubpelRefine(Data, CheckCandidate8, 0); /* qpel part */                                  xvid_me_SubpelRefine(Data->currentQMV[0], Data, CheckCandidate8, 0); /* qpel part */
558                          }                          }
559                  }                  }
560    
# Line 721  Line 723 
723          if(!Data->qpel) {          if(!Data->qpel) {
724                  /* halfpel mode */                  /* halfpel mode */
725                  if (MotionFlags & XVID_ME_HALFPELREFINE16)                  if (MotionFlags & XVID_ME_HALFPELREFINE16)
726                                  xvid_me_SubpelRefine(Data, CheckCandidate, 0);                                  xvid_me_SubpelRefine(Data->currentMV[0], Data, CheckCandidate, 0);
727          } else {          } else {
728                  /* qpel mode */                  /* qpel mode */
729    
# Line 738  Line 740 
740                          if(MotionFlags & (XVID_ME_QUARTERPELREFINE16 | XVID_ME_QUARTERPELREFINE16_RD)) {                          if(MotionFlags & (XVID_ME_QUARTERPELREFINE16 | XVID_ME_QUARTERPELREFINE16_RD)) {
741                                  /* full */                                  /* full */
742                                  if (MotionFlags & XVID_ME_HALFPELREFINE16) {                                  if (MotionFlags & XVID_ME_HALFPELREFINE16) {
743                                          xvid_me_SubpelRefine(Data, CheckCandidate, 0); /* hpel part */                                          xvid_me_SubpelRefine(Data->currentMV[0], Data, CheckCandidate, 0); /* hpel part */
744                                          for(i = 0; i < 5; i++) {                                          for(i = 0; i < 5; i++) {
745                                                  Data->currentQMV[i].x = 2 * Data->currentMV[i].x;                                                  Data->currentQMV[i].x = 2 * Data->currentMV[i].x;
746                                                  Data->currentQMV[i].y = 2 * Data->currentMV[i].y;                                                  Data->currentQMV[i].y = 2 * Data->currentMV[i].y;
# Line 748  Line 750 
750                                                          pParam->width, pParam->height, Data->iFcode, 2, 0);                                                          pParam->width, pParam->height, Data->iFcode, 2, 0);
751                                  Data->qpel_precision = 1;                                  Data->qpel_precision = 1;
752                                  if(MotionFlags & XVID_ME_QUARTERPELREFINE16)                                  if(MotionFlags & XVID_ME_QUARTERPELREFINE16)
753                                          xvid_me_SubpelRefine(Data, CheckCandidate, 0); /* qpel part */                                          xvid_me_SubpelRefine(Data->currentQMV[0], Data, CheckCandidate, 0); /* qpel part */
754                          }                          }
755                  }                  }
756          }          }
# Line 897  Line 899 
899                                                          pRef->y + (x + y * iEdgedWidth) * 32,                                                          pRef->y + (x + y * iEdgedWidth) * 32,
900                                                          pParam->edged_width, pMB->sad8 );                                                          pParam->edged_width, pMB->sad8 );
901    
902                            sad00 = 4*MAX(MAX(pMB->sad8[0], pMB->sad8[1]), MAX(pMB->sad8[2], pMB->sad8[3]));
903    
904                          if (Data.chroma) {                          if (Data.chroma) {
905                                  Data.chromaSAD = sad8(pCurrent->u + x*8 + y*(iEdgedWidth/2)*8,                                  Data.chromaSAD = sad8(pCurrent->u + x*8 + y*(iEdgedWidth/2)*8,
906                                                                          pRef->u + x*8 + y*(iEdgedWidth/2)*8, iEdgedWidth/2)                                                                          pRef->u + x*8 + y*(iEdgedWidth/2)*8, iEdgedWidth/2)
907                                                                  + sad8(pCurrent->v + (x + y*(iEdgedWidth/2))*8,                                                                  + sad8(pCurrent->v + (x + y*(iEdgedWidth/2))*8,
908                                                                          pRef->v + (x + y*(iEdgedWidth/2))*8, iEdgedWidth/2);                                                                          pRef->v + (x + y*(iEdgedWidth/2))*8, iEdgedWidth/2);
909                                  pMB->sad16 += Data.chromaSAD;                                  pMB->sad16 += Data.chromaSAD;
910                                    sad00 += Data.chromaSAD;
911                          }                          }
912    
                         sad00 = pMB->sad16;  
   
913                          /* initial skip decision */                          /* initial skip decision */
914                          /* no early skip for GMC (global vector = skip vector is unknown!)  */                          /* no early skip for GMC (global vector = skip vector is unknown!)  */
915                          if (current->coding_type != S_VOP)      { /* no fast SKIP for S(GMC)-VOPs */                          if (current->coding_type != S_VOP)      { /* no fast SKIP for S(GMC)-VOPs */
916                                  if (pMB->dquant == 0                                  if (pMB->dquant == 0 && sad00 < pMB->quant * skip_thresh)
                                         && pMB->sad8[0] < pMB->quant * skip_thresh  
                                         && pMB->sad8[1] < pMB->quant * skip_thresh  
                                         && pMB->sad8[2] < pMB->quant * skip_thresh  
                                         && pMB->sad8[3] < pMB->quant * skip_thresh)  
   
917                                          if (Data.chroma || xvid_me_SkipDecisionP(pCurrent, pRef, x, y, iEdgedWidth/2, pMB->quant, Data.rrv)) {                                          if (Data.chroma || xvid_me_SkipDecisionP(pCurrent, pRef, x, y, iEdgedWidth/2, pMB->quant, Data.rrv)) {
918                                                  ZeroMacroblockP(pMB, sad00);                                                  ZeroMacroblockP(pMB, sad00);
919                                                  pMB->mode = MODE_NOT_CODED;                                                  pMB->mode = MODE_NOT_CODED;
# Line 965  Line 963 
963                          else                          else
964                                  ModeDecision_SAD(&Data, pMB, pMBs, x, y, pParam,                                  ModeDecision_SAD(&Data, pMB, pMBs, x, y, pParam,
965                                                                  MotionFlags, current->vop_flags, current->vol_flags,                                                                  MotionFlags, current->vop_flags, current->vol_flags,
966                                                                  pCurrent, pRef, pGMC, current->coding_type);                                                                  pCurrent, pRef, pGMC, current->coding_type, sad00);
967    
968    
969                          if (pMB->mode == MODE_INTRA)                          if (pMB->mode == MODE_INTRA)

Legend:
Removed from v.1441  
changed lines
  Added in v.1478

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