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

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

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

revision 1382, Mon Mar 22 22:36:25 2004 UTC revision 1472, Sat Jun 12 13:02:12 2004 UTC
# Line 20  Line 20 
20   *  along with this program ; if not, write to the Free Software   *  along with this program ; if not, write to the Free Software
21   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
22   *   *
23   * $Id: estimation_rd_based.c,v 1.2 2004-03-22 22:36:24 edgomez Exp $   * $Id: estimation_rd_based.c,v 1.5 2004-06-12 13:02:12 edgomez Exp $
24   *   *
25   ****************************************************************************/   ****************************************************************************/
26    
# Line 135  Line 135 
135    
136          /* store current coeffs to pred_values[] for future prediction */          /* store current coeffs to pred_values[] for future prediction */
137          pCurrent[0] = qcoeff[0] * iDcScaler;          pCurrent[0] = qcoeff[0] * iDcScaler;
138            pCurrent[0] = CLIP(pCurrent[0], -2048, 2047);
139          for (i = 1; i < 8; i++) {          for (i = 1; i < 8; i++) {
140                  pCurrent[i] = qcoeff[i];                  pCurrent[i] = qcoeff[i];
141                  pCurrent[i + 7] = qcoeff[i * 8];                  pCurrent[i + 7] = qcoeff[i * 8];
# Line 312  Line 313 
313                  xvid_me_SquareSearch(Data->currentMV->x, Data->currentMV->y, Data, 255, CheckCandidateRD16);                  xvid_me_SquareSearch(Data->currentMV->x, Data->currentMV->y, Data, 255, CheckCandidateRD16);
314    
315          if (MotionFlags&XVID_ME_HALFPELREFINE16_RD)          if (MotionFlags&XVID_ME_HALFPELREFINE16_RD)
316                  xvid_me_SubpelRefine(Data, CheckCandidateRD16);                  xvid_me_SubpelRefine(Data, CheckCandidateRD16, 0);
317    
318          if (Data->qpel) {          if (Data->qpel) {
319                  if (MotionFlags&(XVID_ME_EXTSEARCH_RD | XVID_ME_HALFPELREFINE16_RD)) { /* there was halfpel-precision search */                  if (MotionFlags&(XVID_ME_EXTSEARCH_RD | XVID_ME_HALFPELREFINE16_RD)) { /* there was halfpel-precision search */
# Line 326  Line 327 
327                          get_range(&Data->min_dx, &Data->max_dx, &Data->min_dy, &Data->max_dy, x, y, 4,                          get_range(&Data->min_dx, &Data->max_dx, &Data->min_dy, &Data->max_dy, x, y, 4,
328                                          pParam->width, pParam->height, Data->iFcode, 2, 0);                                          pParam->width, pParam->height, Data->iFcode, 2, 0);
329                  }                  }
330                  if (MotionFlags&XVID_ME_QUARTERPELREFINE16_RD)                  if (MotionFlags & XVID_ME_QUARTERPELREFINE16_RD) {
331                          xvid_me_SubpelRefine(Data, CheckCandidateRD16);                          if (MotionFlags & XVID_ME_FASTREFINE16)
332                                    FullRefine_Fast(Data, CheckCandidateRD16, 0);
333                            else
334                                    xvid_me_SubpelRefine(Data, CheckCandidateRD16, 0);
335                    }
336          }          }
337    
338          if (MotionFlags&XVID_ME_CHECKPREDICTION_RD) { /* let's check vector equal to prediction */          if (MotionFlags&XVID_ME_CHECKPREDICTION_RD) { /* let's check vector equal to prediction */
# Line 390  Line 395 
395                  }                  }
396    
397                  if (Data8->qpel) {                  if (Data8->qpel) {
398                          if (MotionFlags&XVID_ME_HALFPELREFINE8_RD || (MotionFlags&XVID_ME_EXTSEARCH8 && MotionFlags&XVID_ME_EXTSEARCH_RD)) { /* halfpixel motion search follows */                          int bsad = Data8->iMinSAD[0];
399                                  int32_t s = *Data8->iMinSAD;                          int bx = Data8->currentQMV->x;
400                            int by = Data8->currentQMV->y;
401    
402                                  Data8->currentMV->x = Data8->currentQMV->x/2;                                  Data8->currentMV->x = Data8->currentQMV->x/2;
403                                  Data8->currentMV->y = Data8->currentQMV->y/2;                                  Data8->currentMV->y = Data8->currentQMV->y/2;
404    
405                            if (MotionFlags&XVID_ME_HALFPELREFINE8_RD || (MotionFlags&XVID_ME_EXTSEARCH8 && MotionFlags&XVID_ME_EXTSEARCH_RD)) { /* halfpixel motion search follows */
406                                  Data8->qpel_precision = 0;                                  Data8->qpel_precision = 0;
407                                  get_range(&Data8->min_dx, &Data8->max_dx, &Data8->min_dy, &Data8->max_dy, 2*x + (i&1), 2*y + (i>>1), 3,                                  get_range(&Data8->min_dx, &Data8->max_dx, &Data8->min_dy, &Data8->max_dy, 2*x + (i&1), 2*y + (i>>1), 3,
408                                                          pParam->width, pParam->height, Data8->iFcode - 1, 1, 0);                                                          pParam->width, pParam->height, Data8->iFcode - 1, 1, 0);
# Line 405  Line 414 
414                                          xvid_me_SquareSearch(Data8->currentMV->x, Data8->currentMV->x, Data8, 255, CheckCandidateRD8);                                          xvid_me_SquareSearch(Data8->currentMV->x, Data8->currentMV->x, Data8, 255, CheckCandidateRD8);
415    
416                                  if (MotionFlags & XVID_ME_HALFPELREFINE8_RD)                                  if (MotionFlags & XVID_ME_HALFPELREFINE8_RD)
417                                          xvid_me_SubpelRefine(Data8, CheckCandidateRD8);                                          xvid_me_SubpelRefine(Data8, CheckCandidateRD8, 0);
418    
419                                  if(s > *Data8->iMinSAD) { /* we have found a better match */                                  if(bsad > *Data8->iMinSAD) { /* we have found a better match */
420                                          Data8->currentQMV->x = 2*Data8->currentMV->x;                                          bx = Data8->currentQMV->x = 2*Data8->currentMV->x;
421                                          Data8->currentQMV->y = 2*Data8->currentMV->y;                                          by = Data8->currentQMV->y = 2*Data8->currentMV->y;
422                                            bsad = Data8->iMinSAD[0];
423                                  }                                  }
424    
425                                  Data8->qpel_precision = 1;                                  Data8->qpel_precision = 1;
# Line 417  Line 427 
427                                                          pParam->width, pParam->height, Data8->iFcode, 2, 0);                                                          pParam->width, pParam->height, Data8->iFcode, 2, 0);
428    
429                          }                          }
430                          if (MotionFlags & XVID_ME_QUARTERPELREFINE8_RD)  
431                                  xvid_me_SubpelRefine(Data8, CheckCandidateRD8);                          if (MotionFlags & XVID_ME_QUARTERPELREFINE8_RD) {
432                                    if (MotionFlags & XVID_ME_FASTREFINE8)
433                                            FullRefine_Fast(Data8, CheckCandidateRD8, 0);
434                                    else xvid_me_SubpelRefine(Data8, CheckCandidateRD8, 0);
435                            }
436    
437                            if (bsad <= Data->iMinSAD[0]) {
438                                    /* we have not found a better match */
439                                    Data8->iMinSAD[0] = bsad;
440                                    Data8->currentQMV->x = bx;
441                                    Data8->currentQMV->y = by;
442                            }
443    
444                  } else { /* not qpel */                  } else { /* not qpel */
445    
# Line 426  Line 447 
447                                  xvid_me_SquareSearch(Data8->currentMV->x, Data8->currentMV->x, Data8, 255, CheckCandidateRD8);                                  xvid_me_SquareSearch(Data8->currentMV->x, Data8->currentMV->x, Data8, 255, CheckCandidateRD8);
448    
449                          if (MotionFlags & XVID_ME_HALFPELREFINE8_RD)                          if (MotionFlags & XVID_ME_HALFPELREFINE8_RD)
450                                  xvid_me_SubpelRefine(Data8, CheckCandidateRD8); /* halfpel refinement */                                  xvid_me_SubpelRefine(Data8, CheckCandidateRD8, 0); /* halfpel refinement */
451                  }                  }
452    
453                  /* checking vector equal to predicion */                  /* checking vector equal to predicion */

Legend:
Removed from v.1382  
changed lines
  Added in v.1472

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