[svn] / branches / dev-api-3 / xvidcore / src / motion / motion_est.c Repository:
ViewVC logotype

Diff of /branches/dev-api-3/xvidcore/src/motion/motion_est.c

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

revision 545, Fri Sep 27 17:25:17 2002 UTC revision 574, Wed Oct 2 10:16:36 2002 UTC
# Line 550  Line 550 
550    
551          uint32_t x, y;          uint32_t x, y;
552          uint32_t iIntra = 0;          uint32_t iIntra = 0;
553          int32_t InterBias;          int32_t InterBias, quant = current->quant;
554    
555          // some pre-initialized thingies for SearchP          // some pre-initialized thingies for SearchP
556          int32_t temp[5];          int32_t temp[5];
# Line 577  Line 577 
577                          if (!(current->global_flags & XVID_LUMIMASKING)) {                          if (!(current->global_flags & XVID_LUMIMASKING)) {
578                                  pMB->dquant = NO_CHANGE;                                  pMB->dquant = NO_CHANGE;
579                                  pMB->quant = current->quant; }                                  pMB->quant = current->quant; }
580                            else
581                                    if (pMB->dquant != NO_CHANGE) {
582                                            quant += DQtab[pMB->dquant];
583                                            if (quant > 31) quant = 31;
584                                            else if (quant < 1) quant = 1;
585                                            pMB->quant = quant;
586                                    }
587    
588  //initial skip decision  //initial skip decision
589    
# Line 719  Line 726 
726                  Data->min_dy = EVEN(Data->min_dy);                  Data->min_dy = EVEN(Data->min_dy);
727                  Data->max_dy = EVEN(Data->max_dy); }                  Data->max_dy = EVEN(Data->max_dy); }
728    
729          for(i = 0;  i < 5; i++) Data->iMinSAD[i] = 256*4096;          if (pMB->dquant != NO_CHANGE) inter4v = 0;
730    
731          if (inter4v) CheckCandidate = CheckCandidate16;          if (inter4v) CheckCandidate = CheckCandidate16;
732          else CheckCandidate = CheckCandidate16no4v;          else CheckCandidate = CheckCandidate16no4v;
733    
         (*CheckCandidate)(Data->predMV.x, Data->predMV.y, 0, &iDirection, Data);  
   
734          for(i = 0;  i < 5; i++) Data->currentMV[i].x = Data->currentMV[i].y = 0;          for(i = 0;  i < 5; i++) Data->currentMV[i].x = Data->currentMV[i].y = 0;
735    
736          i = d_mv_bits(Data->predMV.x, Data->predMV.y, Data->iFcode);          i = d_mv_bits(Data->predMV.x, Data->predMV.y, Data->iFcode);
# Line 735  Line 740 
740          Data->iMinSAD[3] = pMB->sad8[2];          Data->iMinSAD[3] = pMB->sad8[2];
741          Data->iMinSAD[4] = pMB->sad8[3];          Data->iMinSAD[4] = pMB->sad8[3];
742    
         if (pMB->dquant != NO_CHANGE) inter4v = 0;  
   
743          if ((x == 0) && (y == 0)) threshA = 512;          if ((x == 0) && (y == 0)) threshA = 512;
744          else {          else {
745                  threshA = Data->temp[0] + 20;                  threshA = Data->temp[0]; // that's when we keep this SAD atm
746                  if (threshA < 512) threshA = 512;                  if (threshA < 512) threshA = 512;
747                  if (threshA > 1024) threshA = 1024; }                  if (threshA > 1024) threshA = 1024; }
748    
749          PreparePredictionsP(pmv, x, y, pParam->mb_width, pParam->mb_height,          PreparePredictionsP(pmv, x, y, pParam->mb_width, pParam->mb_height,
750                                          prevMBs + x + y * pParam->mb_width);                                          prevMBs + x + y * pParam->mb_width);
751    
752            if (inter4v) CheckCandidate = CheckCandidate16;
753            else CheckCandidate = CheckCandidate16no4v;
754    
755    
756  /* main loop. checking all predictions */  /* main loop. checking all predictions */
757    
758          for (i = 1; i < 7; i++) {          for (i = 1; i < 7; i++) {
759                  if (!(mask = make_mask(pmv, i)) ) continue;                  if (!(mask = make_mask(pmv, i)) ) continue;
760                  CheckCandidate16(pmv[i].x, pmv[i].y, mask, &iDirection, Data);                  (*CheckCandidate)(pmv[i].x, pmv[i].y, mask, &iDirection, Data);
761                  if (Data->iMinSAD[0] <= threshA) break;                  if (Data->iMinSAD[0] <= threshA) break;
762          }          }
763    
# Line 1467  Line 1474 
1474                                  const MACROBLOCK * const pMBs,                                  const MACROBLOCK * const pMBs,
1475                                  int inter4v,                                  int inter4v,
1476                                  MACROBLOCK * const pMB,                                  MACROBLOCK * const pMB,
1477                                  SearchData * Data)                                  SearchData * const Data)
1478  {  {
1479    
1480          const int32_t iEdgedWidth = pParam->edged_width;          const int32_t iEdgedWidth = pParam->edged_width;
1481    
1482          int i;          int i, t;
1483          MainSearchFunc * MainSearchPtr;          MainSearchFunc * MainSearchPtr;
1484    
1485          Data->predMV = get_pmv2(pMBs, pParam->mb_width, 0, x, y, 0);          Data->predMV = get_pmv2(pMBs, pParam->mb_width, 0, x, y, 0);
# Line 1509  Line 1516 
1516          if (pMB->mvs[0].y > Data->max_dy) pMB->mvs[0].y = Data->max_dy;          if (pMB->mvs[0].y > Data->max_dy) pMB->mvs[0].y = Data->max_dy;
1517          if (pMB->mvs[0].y < Data->min_dy) pMB->mvs[0].y = Data->min_dy;          if (pMB->mvs[0].y < Data->min_dy) pMB->mvs[0].y = Data->min_dy;
1518    
1519          (*CheckCandidate)(pMB->mvs[0].x, pMB->mvs[0].y, 0, &i, Data);          (*CheckCandidate)(pMB->mvs[0].x, pMB->mvs[0].y, 0, &t, Data);
1520    
1521          if (pMB->mode == MODE_INTER4V)          if (pMB->mode == MODE_INTER4V)
1522                  for (i = 1; i < 4; i++) { // all four vectors will be used as four predictions for 16x16 search                  for (i = 1; i < 4; i++) { // all four vectors will be used as four predictions for 16x16 search
1523                          pMB->mvs[i].x = EVEN(pMB->mvs[i].x);                          pMB->mvs[i].x = EVEN(pMB->mvs[i].x);
1524                          pMB->mvs[i].y = EVEN(pMB->mvs[i].y);                          pMB->mvs[i].y = EVEN(pMB->mvs[i].y);
1525                          if (!(make_mask(pMB->mvs, i)))                          if (!(make_mask(pMB->mvs, i)))
1526                                  (*CheckCandidate)(pMB->mvs[i].x, pMB->mvs[i].y, 0, &i, Data);                                  (*CheckCandidate)(pMB->mvs[i].x, pMB->mvs[i].y, 0, &t, Data);
1527                  }                  }
1528    
1529          if (MotionFlags & PMV_USESQUARES16)          if (MotionFlags & PMV_USESQUARES16)
# Line 1569  Line 1576 
1576          const IMAGE *const pRef = &reference->image;          const IMAGE *const pRef = &reference->image;
1577    
1578          uint32_t x, y;          uint32_t x, y;
1579          int32_t temp[5];          int32_t temp[5], quant = current->quant;
1580          int32_t iMinSAD[5];          int32_t iMinSAD[5];
1581          VECTOR currentMV[5];          VECTOR currentMV[5];
1582          SearchData Data;          SearchData Data;
# Line 1589  Line 1596 
1596  //intra mode is copied from the first pass. At least for the time being  //intra mode is copied from the first pass. At least for the time being
1597                          if  ((pMB->mode == MODE_INTRA) || (pMB->mode == MODE_NOT_CODED) ) continue;                          if  ((pMB->mode == MODE_INTRA) || (pMB->mode == MODE_NOT_CODED) ) continue;
1598    
1599    
1600                          if (!(current->global_flags & XVID_LUMIMASKING)) {                          if (!(current->global_flags & XVID_LUMIMASKING)) {
1601                                  pMB->dquant = NO_CHANGE;                                  pMB->dquant = NO_CHANGE;
1602                                  pMB->quant = current->quant; }                                  pMB->quant = current->quant; }
1603                            else
1604                                    if (pMB->dquant != NO_CHANGE) {
1605                                            quant += DQtab[pMB->dquant];
1606                                            if (quant > 31) quant = 31;
1607                                            else if (quant < 1) quant = 1;
1608                                            pMB->quant = quant;
1609                                    }
1610    
1611                          SearchPhinted(pRef->y, pRefH->y, pRefV->y, pRefHV->y, pCurrent, x,                          SearchPhinted(pRef->y, pRefH->y, pRefV->y, pRefHV->y, pCurrent, x,
1612                                                          y, current->motion_flags, pMB->quant,                                                          y, current->motion_flags, pMB->quant,

Legend:
Removed from v.545  
changed lines
  Added in v.574

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