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

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

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

revision 1.11, Sat Dec 18 06:51:14 2004 UTC revision 1.13, Tue Nov 22 10:23:01 2005 UTC
# Line 64  Line 64 
64          int bits;          int bits;
65          int distortion = 0;          int distortion = 0;
66    
67          fdct(data);          fdct((short * const)data);
68    
69          if (quant_type) sum = quant_h263_inter(coeff, data, quant, mpeg_quant_matrices);          if (quant_type) sum = quant_h263_inter(coeff, data, quant, mpeg_quant_matrices);
70          else sum = quant_mpeg_inter(coeff, data, quant, mpeg_quant_matrices);          else sum = quant_mpeg_inter(coeff, data, quant, mpeg_quant_matrices);
# Line 121  Line 121 
121          unsigned int distortion = 0;          unsigned int distortion = 0;
122          const uint32_t iDcScaler = get_dc_scaler(quant, block < 4);          const uint32_t iDcScaler = get_dc_scaler(quant, block < 4);
123    
124          fdct(coeff);          fdct((short * const)coeff);
125    
126          if (quant_type) {          if (quant_type) {
127                  quant_h263_intra(qcoeff, coeff, quant, iDcScaler, mpeg_quant_matrices);                  quant_h263_intra(qcoeff, coeff, quant, iDcScaler, mpeg_quant_matrices);
# Line 135  Line 135 
135                                  quant, iDcScaler, predictors, 0);                                  quant, iDcScaler, predictors, 0);
136    
137          direction = pMB->acpred_directions[block];          direction = pMB->acpred_directions[block];
138          pCurrent = pMB->pred_values[block];          pCurrent = (int16_t*)pMB->pred_values[block];
139    
140          /* store current coeffs to pred_values[] for future prediction */          /* store current coeffs to pred_values[] for future prediction */
141          pCurrent[0] = qcoeff[0] * iDcScaler;          pCurrent[0] = qcoeff[0] * iDcScaler;
# Line 148  Line 148 
148          /* dc prediction */          /* dc prediction */
149          qcoeff[0] = qcoeff[0] - predictors[0];          qcoeff[0] = qcoeff[0] - predictors[0];
150    
151          if (block < 4) bits[1] = bits[0] = dcy_tab[qcoeff[0] + 255].len;          if (block < 4) bits[1] = bits[0] = dcy_tab[qcoeff[0] + 255].len - 3; /* 3 bits added before (4 times) */
152          else bits[1] = bits[0] = dcc_tab[qcoeff[0] + 255].len;          else bits[1] = bits[0] = dcc_tab[qcoeff[0] + 255].len - 2; /* 2 bits added before (2 times)*/
153    
154          /* calc cost before ac prediction */          /* calc cost before ac prediction */
155          bits[0] += coded = CodeCoeffIntra_CalcBits(qcoeff, scan_tables[0]);          bits[0] += coded = CodeCoeffIntra_CalcBits(qcoeff, scan_tables[0]);
# Line 529  Line 529 
529                           const int x, const int y, const int mb_width)                           const int x, const int y, const int mb_width)
530  {  {
531          unsigned int cbp[2] = {0, 0}, bits[2], i;          unsigned int cbp[2] = {0, 0}, bits[2], i;
532          /* minimum number of bits that WILL be coded in intra - MODE 5, CBP 2 and AC/DC pred - 1 */          /* minimum number of bits that WILL be coded in intra - mcbpc 5, cby 2 acdc flag - 1 and DC coeffs - 4*3+2*2 */
533          int bits1 = BITS_MULT*(5+2+1), bits2 = BITS_MULT*(5+2+1);          int bits1 = BITS_MULT*(5+2+1+4*3+2*2), bits2 = BITS_MULT*(5+2+1+4*3+2*2);
534          unsigned int distortion = 0;          unsigned int distortion = 0;
535    
536          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;
# Line 684  Line 684 
684                  }                  }
685          }          }
686    
687            /* there is no way for INTRA to take less than 24 bits - go to findRD_intra() for calculations */
688            if (min_rd > 24*BITS_MULT) {
689          intra_rd = findRD_intra(Data, pMB, x, y, pParam->mb_width);          intra_rd = findRD_intra(Data, pMB, x, y, pParam->mb_width);
690          if (intra_rd < min_rd) {          if (intra_rd < min_rd) {
691                  *Data->iMinSAD = min_rd = intra_rd;                  *Data->iMinSAD = min_rd = intra_rd;
692                  mode = MODE_INTRA;                  mode = MODE_INTRA;
693                  cbp = *Data->cbp;                  cbp = *Data->cbp;
694          }          }
695            }
696    
697          pMB->sad16 = pMB->sad8[0] = pMB->sad8[1] = pMB->sad8[2] = pMB->sad8[3] = 0;          pMB->sad16 = pMB->sad8[0] = pMB->sad8[1] = pMB->sad8[2] = pMB->sad8[3] = 0;
698          pMB->cbp = cbp;          pMB->cbp = cbp;

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.13

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