26 |
* along with this program; if not, write to the Free Software |
* along with this program; if not, write to the Free Software |
27 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
28 |
* |
* |
29 |
* $Id: motion_est.h,v 1.8 2003-05-14 13:21:47 syskin Exp $ |
* $Id: motion_est.h,v 1.9 2003-06-19 10:06:40 syskin Exp $ |
30 |
* |
* |
31 |
***************************************************************************/ |
***************************************************************************/ |
32 |
|
|
340 |
} |
} |
341 |
bits += (BITS_MULT*BITS_MULT*distortion)/lambda; |
bits += (BITS_MULT*BITS_MULT*distortion)/lambda; |
342 |
|
|
|
|
|
343 |
return bits; |
return bits; |
344 |
} |
} |
345 |
|
|
354 |
int bits, i; |
int bits, i; |
355 |
const int lambda = LAMBDA*quant*quant; |
const int lambda = LAMBDA*quant*quant; |
356 |
int distortion = 0; |
int distortion = 0; |
357 |
uint32_t iDcScaler = get_dc_scaler(quant, block > 3); |
uint32_t iDcScaler = get_dc_scaler(quant, block < 4); |
358 |
int b_dc; |
int b_dc; |
359 |
|
|
360 |
fdct(data); |
fdct(data); |
361 |
data[0] -= 1024; |
data[0] -= 1024; |
362 |
|
|
363 |
if (quant_type == 0) quant_intra(coeff, data, quant, iDcScaler); |
if (quant_type == 0) quant_intra_c(coeff, data, quant, iDcScaler); // MUST BE _C |
364 |
else quant4_intra(coeff, data, quant, iDcScaler); |
else quant4_intra_c(coeff, data, quant, iDcScaler); // MUST BE _C |
365 |
|
|
366 |
b_dc = coeff[0]; |
b_dc = coeff[0]; |
367 |
if (block < 4) { |
if (block < 4) { |
369 |
*dcpred = b_dc; |
*dcpred = b_dc; |
370 |
} |
} |
371 |
|
|
|
*cbp |= 1 << (5 - block); |
|
372 |
bits = BITS_MULT*CodeCoeffIntra_CalcBits(coeff, scan_tables[0]); |
bits = BITS_MULT*CodeCoeffIntra_CalcBits(coeff, scan_tables[0]); |
|
bits += BITS_MULT*dcy_tab[coeff[0] + 255].len; |
|
373 |
if (bits != 0) *cbp |= 1 << (5 - block); |
if (bits != 0) *cbp |= 1 << (5 - block); |
374 |
|
|
375 |
|
if (block < 4) bits += BITS_MULT*dcy_tab[coeff[0] + 255].len; |
376 |
|
else bits += BITS_MULT*dcc_tab[coeff[0] + 255].len; |
377 |
|
|
378 |
coeff[0] = b_dc; |
coeff[0] = b_dc; |
379 |
if (quant_type == 0) dequant_intra(coeff, coeff, quant, iDcScaler); |
if (quant_type == 0) dequant_intra(coeff, coeff, quant, iDcScaler); |
380 |
else dequant4_intra(coeff, coeff, quant, iDcScaler); |
else dequant4_intra(coeff, coeff, quant, iDcScaler); |