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

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

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

revision 1508, Sun Jul 18 12:22:31 2004 UTC revision 1576, Fri Dec 17 11:57:59 2004 UTC
# Line 160  Line 160 
160                  xc = x/2; yc = y/2;                  xc = x/2; yc = y/2;
161          }          }
162    
163          rd += BITS_MULT*d_mv_bits(x, y, data->predMV, data->iFcode, data->qpel^data->qpel_precision, 0);          rd += BITS_MULT*d_mv_bits(x, y, data->predMV, data->iFcode, data->qpel^data->qpel_precision);
164    
165          for(i = 0; i < 4; i++) {          for(i = 0; i < 4; i++) {
166                  int s = 8*((i&1) + (i>>1)*data->iEdgedWidth);                  int s = 8*((i&1) + (i>>1)*data->iEdgedWidth);
# Line 267  Line 267 
267          if (cbp)          if (cbp)
268                  rd += BITS_MULT * 6;                  rd += BITS_MULT * 6;
269          if (cbp || x != 0 || y != 0)          if (cbp || x != 0 || y != 0)
270                  rd += BITS_MULT * d_mv_bits(x, y, zeroMV, 1, 0, 0);                  rd += BITS_MULT * d_mv_bits(x, y, zeroMV, 1, 0);
271    
272          if (rd < *(data->iMinSAD)) {          if (rd < *(data->iMinSAD)) {
273                  *data->iMinSAD = rd;                  *data->iMinSAD = rd;
# Line 322  Line 322 
322                  xcb = xb/2; ycb = yb/2;                  xcb = xb/2; ycb = yb/2;
323          }          }
324    
325          rd += BITS_MULT * (d_mv_bits(xf, yf, data->predMV, data->iFcode, data->qpel^data->qpel_precision, 0)          rd += BITS_MULT * (d_mv_bits(xf, yf, data->predMV, data->iFcode, data->qpel^data->qpel_precision)
326                                          + d_mv_bits(xb, yb, data->bpredMV, data->iFcode, data->qpel^data->qpel_precision, 0));                                          + d_mv_bits(xb, yb, data->bpredMV, data->iFcode, data->qpel^data->qpel_precision));
327    
328    
329          for(i = 0; i < 4; i++) {          for(i = 0; i < 4; i++) {
# Line 375  Line 375 
375          Data->iMinSAD[0] = *best_sad;          Data->iMinSAD[0] = *best_sad;
376    
377          get_range(&Data->min_dx, &Data->max_dx, &Data->min_dy, &Data->max_dy,          get_range(&Data->min_dx, &Data->max_dx, &Data->min_dy, &Data->max_dy,
378                  x, y, 4, pParam->width, pParam->height, Data->iFcode, 1 + Data->qpel, 0);                  x, y, 4, pParam->width, pParam->height, Data->iFcode, 1 + Data->qpel);
379    
380          Data->qpel_precision = Data->qpel;          Data->qpel_precision = Data->qpel;
381    
# Line 418  Line 418 
418          Data->iMinSAD[0] = *best_sad;          Data->iMinSAD[0] = *best_sad;
419    
420          get_range(&Data->min_dx, &Data->max_dx, &Data->min_dy, &Data->max_dy,          get_range(&Data->min_dx, &Data->max_dx, &Data->min_dy, &Data->max_dy,
421                  x, y, 4, pParam->width, pParam->height, Data->iFcode, 1 + Data->qpel, 0);                  x, y, 4, pParam->width, pParam->height, Data->iFcode, 1 + Data->qpel);
422    
423          Data->qpel_precision = Data->qpel;          Data->qpel_precision = Data->qpel;
424    
# Line 460  Line 460 
460                                           VECTOR * b_predMV,                                           VECTOR * b_predMV,
461                                           const uint32_t MotionFlags,                                           const uint32_t MotionFlags,
462                                           const MBParam * const pParam,                                           const MBParam * const pParam,
463                                           int x, int y)                                           int x, int y,
464                                             int best_sad)
465  {  {
466          int mode = MODE_DIRECT, k;          int mode = MODE_DIRECT, k;
467          int f_rd, b_rd, i_rd, d_rd, best_rd;          int f_rd, b_rd, i_rd, d_rd, best_rd;
# Line 468  Line 469 
469          const uint32_t iQuant = Data_d->iQuant;          const uint32_t iQuant = Data_d->iQuant;
470          int i;          int i;
471          int ref_quant = b_mb->quant;          int ref_quant = b_mb->quant;
472            int no_of_checks = 0;
473    
474          int order[4] = {MODE_DIRECT, MODE_FORWARD, MODE_BACKWARD, MODE_INTERPOLATE};          int order[4] = {MODE_DIRECT, MODE_FORWARD, MODE_BACKWARD, MODE_INTERPOLATE};
475    
476          Data_d->scan_table = Data_b->scan_table = Data_f->scan_table = Data_i->scan_table          Data_d->scan_table = Data_b->scan_table = Data_f->scan_table = Data_i->scan_table
477                  = /*VopFlags & XVID_VOP_ALTERNATESCAN ? scan_tables[2] : */scan_tables[0];                  = /*VopFlags & XVID_VOP_ALTERNATESCAN ? scan_tables[2] : */scan_tables[0];
478            *Data_f->cbp = *Data_b->cbp = *Data_i->cbp = *Data_d->cbp = 63;
479    
480          f_rd = b_rd = i_rd = d_rd = best_rd = 256*4096;          f_rd = b_rd = i_rd = d_rd = best_rd = 256*4096;
481    
# Line 500  Line 503 
503                  }                  }
504          }          }
505    
506            for(i = 0; i < 4; i++)
507                    if (get_sad_for_mode(order[i], Data_d, Data_b, Data_f, Data_i) < 2*best_sad)
508                            no_of_checks++;
509    
510            if (no_of_checks > 1) {
511          /* evaluate cost of all modes */          /* evaluate cost of all modes */
512          for (i = 0; i < 4; i++) {                  for (i = 0; i < no_of_checks; i++) {
513                  int rd;                  int rd;
514                            if (2*best_sad < get_sad_for_mode(order[i], Data_d, Data_b, Data_f, Data_i))
515                                    break; /* further SADs are too big */
516    
517                  switch (order[i]) {                  switch (order[i]) {
518                  case MODE_DIRECT:                  case MODE_DIRECT:
# Line 524  Line 534 
534                          best_rd = rd;                          best_rd = rd;
535                  }                  }
536          }          }
537            } else {
538                    /* only 1 mode is below the threshold */
539                    mode = order[0];
540                    best_rd = 0;
541            }
542    
543          pMB->sad16 = best_rd;          pMB->sad16 = best_rd;
544          pMB->mode = mode;          pMB->mode = mode;
# Line 576  Line 591 
591                  }                  }
592                  pMB->mvs[0] = *Data_f->currentMV;                  pMB->mvs[0] = *Data_f->currentMV;
593                  pMB->cbp = *Data_f->cbp;                  pMB->cbp = *Data_f->cbp;
594                    pMB->b_mvs[0] = *Data_b->currentMV; /* hint for future searches */
595                  break;                  break;
596    
597          case MODE_BACKWARD:          case MODE_BACKWARD:
# Line 591  Line 607 
607                  }                  }
608                  pMB->b_mvs[0] = *Data_b->currentMV;                  pMB->b_mvs[0] = *Data_b->currentMV;
609                  pMB->cbp = *Data_b->cbp;                  pMB->cbp = *Data_b->cbp;
610                    pMB->mvs[0] = *Data_f->currentMV; /* hint for future searches */
611                  break;                  break;
612    
613    

Legend:
Removed from v.1508  
changed lines
  Added in v.1576

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