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

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

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

revision 1214, Tue Nov 18 21:41:21 2003 UTC revision 1215, Wed Nov 19 12:24:25 2003 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.1.2.9 2003-11-13 23:11:24 edgomez Exp $   * $Id: estimation_rd_based.c,v 1.1.2.10 2003-11-19 12:24:25 syskin Exp $
24   *   *
25   ****************************************************************************/   ****************************************************************************/
26    
# Line 172  Line 172 
172    
173    
174  static void  static void
175  CheckCandidateRD16(const int x, const int y, const SearchData * const data, const unsigned int Direction)  CheckCandidateRD16(const int x, const int y, SearchData * const data, const unsigned int Direction)
176  {  {
177    
178          int16_t *in = data->dctSpace, *coeff = data->dctSpace + 64;          int16_t *in = data->dctSpace, *coeff = data->dctSpace + 64;
179          int32_t rd = 0;          int32_t rd = 0;
180          VECTOR * current;          VECTOR * current;
181          const uint8_t * ptr;          const uint8_t * ptr;
182          int i, cbp = 0, t, xc, yc;          int i, t, xc, yc;
183            unsigned cbp = 0;
184    
185          if ( (x > data->max_dx) || (x < data->min_dx)          if ( (x > data->max_dx) || (x < data->min_dx)
186                  || (y > data->max_dy) || (y < data->min_dy) ) return;                  || (y > data->max_dy) || (y < data->min_dy) ) return;
# Line 235  Line 236 
236          if (rd < data->iMinSAD[0]) {          if (rd < data->iMinSAD[0]) {
237                  data->iMinSAD[0] = rd;                  data->iMinSAD[0] = rd;
238                  current[0].x = x; current[0].y = y;                  current[0].x = x; current[0].y = y;
239                  *data->dir = Direction;                  data->dir = Direction;
240                  *data->cbp = cbp;                  *data->cbp = cbp;
241          }          }
242  }  }
243    
244  static void  static void
245  CheckCandidateRD8(const int x, const int y, const SearchData * const data, const unsigned int Direction)  CheckCandidateRD8(const int x, const int y, SearchData * const data, const unsigned int Direction)
246  {  {
247    
248          int16_t *in = data->dctSpace, *coeff = data->dctSpace + 64;          int16_t *in = data->dctSpace, *coeff = data->dctSpace + 64;
249          int32_t rd;          int32_t rd;
250          VECTOR * current;          VECTOR * current;
251          const uint8_t * ptr;          const uint8_t * ptr;
252          int cbp = 0;          unsigned int cbp = 0;
253    
254          if ( (x > data->max_dx) || (x < data->min_dx)          if ( (x > data->max_dx) || (x < data->min_dx)
255                  || (y > data->max_dy) || (y < data->min_dy) ) return;                  || (y > data->max_dy) || (y < data->min_dy) ) return;
# Line 269  Line 270 
270                  *data->cbp = cbp;                  *data->cbp = cbp;
271                  data->iMinSAD[0] = rd;                  data->iMinSAD[0] = rd;
272                  current[0].x = x; current[0].y = y;                  current[0].x = x; current[0].y = y;
273                  *data->dir = Direction;                  data->dir = Direction;
274          }          }
275  }  }
276    
# Line 336  Line 337 
337  }  }
338    
339  static int  static int
340  findRD_inter4v(const SearchData * const Data,  findRD_inter4v(SearchData * const Data,
341                                  MACROBLOCK * const pMB, const MACROBLOCK * const pMBs,                                  MACROBLOCK * const pMB, const MACROBLOCK * const pMBs,
342                                  const int x, const int y,                                  const int x, const int y,
343                                  const MBParam * const pParam, const uint32_t MotionFlags,                                  const MBParam * const pParam, const uint32_t MotionFlags,
344                                  const VECTOR * const backup)                                  const VECTOR * const backup)
345  {  {
346    
347          int cbp = 0, bits = 0, t = 0, i;          unsigned int cbp = 0, bits = 0, t = 0, i;
348          SearchData Data2, *Data8 = &Data2;          SearchData Data2, *Data8 = &Data2;
349          int sumx = 0, sumy = 0;          int sumx = 0, sumy = 0;
350          int16_t *in = Data->dctSpace, *coeff = Data->dctSpace + 64;          int16_t *in = Data->dctSpace, *coeff = Data->dctSpace + 64;
# Line 353  Line 354 
354    
355          for (i = 0; i < 4; i++) { /* for all luma blocks */          for (i = 0; i < 4; i++) { /* for all luma blocks */
356    
357                  Data8->iMinSAD = Data->iMinSAD + i + 1;                  *Data8->iMinSAD = *(Data->iMinSAD + i + 1);
358                  Data8->currentMV = Data->currentMV + i + 1;                  *Data8->currentMV = *(Data->currentMV + i + 1);
359                  Data8->currentQMV = Data->currentQMV + i + 1;                  *Data8->currentQMV = *(Data->currentQMV + i + 1);
360                  Data8->Cur = Data->Cur + 8*((i&1) + (i>>1)*Data->iEdgedWidth);                  Data8->Cur = Data->Cur + 8*((i&1) + (i>>1)*Data->iEdgedWidth);
361                  Data8->RefP[0] = Data->RefP[0] + 8*((i&1) + (i>>1)*Data->iEdgedWidth);                  Data8->RefP[0] = Data->RefP[0] + 8*((i&1) + (i>>1)*Data->iEdgedWidth);
362                  Data8->RefP[2] = Data->RefP[2] + 8*((i&1) + (i>>1)*Data->iEdgedWidth);                  Data8->RefP[2] = Data->RefP[2] + 8*((i&1) + (i>>1)*Data->iEdgedWidth);
# Line 480  Line 481 
481  }  }
482    
483  static int  static int
484  findRD_intra(const SearchData * const Data, MACROBLOCK * pMB,  findRD_intra(SearchData * const Data, MACROBLOCK * pMB,
485                           const int x, const int y, const int mb_width)                           const int x, const int y, const int mb_width)
486  {  {
487          int cbp[2] = {0, 0}, bits[2], i;          unsigned int cbp[2] = {0, 0}, bits[2], i;
488          int bits1 = BITS_MULT*1, bits2 = BITS_MULT*1; /* this one is ac/dc prediction flag bit */          unsigned int bits1 = BITS_MULT*1, bits2 = BITS_MULT*1; /* this one is ac/dc prediction flag bit */
489          int distortion = 0;          unsigned int distortion = 0;
490    
491          int16_t *in = Data->dctSpace, * coeff = Data->dctSpace + 64, * dqcoeff = Data->dctSpace + 128;          int16_t *in = Data->dctSpace, * coeff = Data->dctSpace + 64, * dqcoeff = Data->dctSpace + 128;
492          const uint32_t iQuant = Data->iQuant;          const uint32_t iQuant = Data->iQuant;
# Line 536  Line 537 
537    
538    
539  static int  static int
540  findRD_gmc(const SearchData * const Data, const IMAGE * const vGMC, const int x, const int y)  findRD_gmc(SearchData * const Data, const IMAGE * const vGMC, const int x, const int y)
541  {  {
542          int bits = BITS_MULT*1; /* this one is mcsel */          int bits = BITS_MULT*1; /* this one is mcsel */
543          int cbp = 0, i;          unsigned int cbp = 0, i;
544          int16_t *in = Data->dctSpace, * coeff = Data->dctSpace + 64;          int16_t *in = Data->dctSpace, * coeff = Data->dctSpace + 64;
545    
546          for(i = 0; i < 4; i++) {          for(i = 0; i < 4; i++) {
# Line 587  Line 588 
588          int inter4v = (VopFlags & XVID_VOP_INTER4V) && (pMB->dquant == 0);          int inter4v = (VopFlags & XVID_VOP_INTER4V) && (pMB->dquant == 0);
589          const uint32_t iQuant = pMB->quant;          const uint32_t iQuant = pMB->quant;
590    
591          int min_rd, intra_rd, i, cbp, c[2] = {0, 0};          int min_rd, intra_rd, i, cbp;
592          VECTOR backup[5], *v;          VECTOR backup[5], *v;
593          Data->iQuant = iQuant;          Data->iQuant = iQuant;
         Data->cbp = c;  
594          Data->scan_table = VopFlags & XVID_VOP_ALTERNATESCAN ?          Data->scan_table = VopFlags & XVID_VOP_ALTERNATESCAN ?
595                                                  scan_tables[2] : scan_tables[0];                                                  scan_tables[2] : scan_tables[0];
596    
# Line 694  Line 694 
694          const uint32_t iQuant = pMB->quant;          const uint32_t iQuant = pMB->quant;
695          const int skip_possible = (coding_type == P_VOP) && (pMB->dquant == 0);          const int skip_possible = (coding_type == P_VOP) && (pMB->dquant == 0);
696      int sad;      int sad;
697          int min_rd = -1, intra_rd, i, cbp = 63, c[2] = {0, 0};          int min_rd = -1, intra_rd, i, cbp = 63;
698          VECTOR backup[5], *v;          VECTOR backup[5], *v;
699          int sad_backup[5];          int sad_backup[5];
700          int InterBias = MV16_INTER_BIAS;          int InterBias = MV16_INTER_BIAS;
# Line 748  Line 748 
748                  }                  }
749          } else { /* Rate-Distortion INTER<->INTER4V */          } else { /* Rate-Distortion INTER<->INTER4V */
750                  Data->iQuant = iQuant;                  Data->iQuant = iQuant;
                 Data->cbp = c;  
751                  v = Data->qpel ? Data->currentQMV : Data->currentMV;                  v = Data->qpel ? Data->currentQMV : Data->currentMV;
752    
753                  /* 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?" */
# Line 849  Line 848 
848          } else { /* Rate-Distortion INTRA<->INTER */          } else { /* Rate-Distortion INTRA<->INTER */
849                  if(min_rd < 0) {                  if(min_rd < 0) {
850                          Data->iQuant = iQuant;                          Data->iQuant = iQuant;
                         Data->cbp = c;  
851                          v = Data->qpel ? Data->currentQMV : Data->currentMV;                          v = Data->qpel ? Data->currentQMV : Data->currentMV;
852    
853                          for (i = 0; i < 5; i++) {                          for (i = 0; i < 5; i++) {

Legend:
Removed from v.1214  
changed lines
  Added in v.1215

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