120 |
unsigned int lambda, |
unsigned int lambda, |
121 |
const uint16_t * mpeg_quant_matrices, |
const uint16_t * mpeg_quant_matrices, |
122 |
const unsigned int quant_sq, |
const unsigned int quant_sq, |
123 |
const unsigned int metric) |
const unsigned int metric, |
124 |
|
const int bound) |
125 |
{ |
{ |
126 |
int direction; |
int direction; |
127 |
int16_t *pCurrent; |
int16_t *pCurrent; |
140 |
} |
} |
141 |
|
|
142 |
predict_acdc(pMB-(x+mb_width*y), x, y, mb_width, block, qcoeff, |
predict_acdc(pMB-(x+mb_width*y), x, y, mb_width, block, qcoeff, |
143 |
quant, iDcScaler, predictors, 0); |
quant, iDcScaler, predictors, bound); |
144 |
|
|
145 |
direction = pMB->acpred_directions[block]; |
direction = pMB->acpred_directions[block]; |
146 |
pCurrent = (int16_t*)pMB->pred_values[block]; |
pCurrent = (int16_t*)pMB->pred_values[block]; |
536 |
|
|
537 |
static int |
static int |
538 |
findRD_intra(SearchData * const Data, MACROBLOCK * pMB, |
findRD_intra(SearchData * const Data, MACROBLOCK * pMB, |
539 |
const int x, const int y, const int mb_width) |
const int x, const int y, const int mb_width, const int bound) |
540 |
{ |
{ |
541 |
unsigned int cbp[2] = {0, 0}, bits[2], i; |
unsigned int cbp[2] = {0, 0}, bits[2], i; |
542 |
/* minimum number of bits that WILL be coded in intra - mcbpc 5, cby 2 acdc flag - 1 and DC coeffs - 4*3+2*2 */ |
/* minimum number of bits that WILL be coded in intra - mcbpc 5, cby 2 acdc flag - 1 and DC coeffs - 4*3+2*2 */ |
554 |
|
|
555 |
distortion = Block_CalcBitsIntra(pMB, x, y, mb_width, i, in, coeff, dqcoeff, |
distortion = Block_CalcBitsIntra(pMB, x, y, mb_width, i, in, coeff, dqcoeff, |
556 |
predictors[i], iQuant, Data->quant_type, bits, cbp, |
predictors[i], iQuant, Data->quant_type, bits, cbp, |
557 |
Data->lambda[i], Data->mpeg_quant_matrices, Data->quant_sq, Data->metric); |
Data->lambda[i], Data->mpeg_quant_matrices, Data->quant_sq, |
558 |
|
Data->metric, bound); |
559 |
bits1 += distortion + BITS_MULT * bits[0]; |
bits1 += distortion + BITS_MULT * bits[0]; |
560 |
bits2 += distortion + BITS_MULT * bits[1]; |
bits2 += distortion + BITS_MULT * bits[1]; |
561 |
|
|
570 |
transfer_8to16copy(in, Data->CurU, Data->iEdgedWidth/2); |
transfer_8to16copy(in, Data->CurU, Data->iEdgedWidth/2); |
571 |
distortion = Block_CalcBitsIntra(pMB, x, y, mb_width, 4, in, coeff, dqcoeff, |
distortion = Block_CalcBitsIntra(pMB, x, y, mb_width, 4, in, coeff, dqcoeff, |
572 |
predictors[4], iQuant, Data->quant_type, bits, cbp, |
predictors[4], iQuant, Data->quant_type, bits, cbp, |
573 |
Data->lambda[4], Data->mpeg_quant_matrices, Data->quant_sq, Data->metric); |
Data->lambda[4], Data->mpeg_quant_matrices, Data->quant_sq, |
574 |
|
Data->metric, bound); |
575 |
bits1 += distortion + BITS_MULT * bits[0]; |
bits1 += distortion + BITS_MULT * bits[0]; |
576 |
bits2 += distortion + BITS_MULT * bits[1]; |
bits2 += distortion + BITS_MULT * bits[1]; |
577 |
|
|
582 |
transfer_8to16copy(in, Data->CurV, Data->iEdgedWidth/2); |
transfer_8to16copy(in, Data->CurV, Data->iEdgedWidth/2); |
583 |
distortion = Block_CalcBitsIntra(pMB, x, y, mb_width, 5, in, coeff, dqcoeff, |
distortion = Block_CalcBitsIntra(pMB, x, y, mb_width, 5, in, coeff, dqcoeff, |
584 |
predictors[5], iQuant, Data->quant_type, bits, cbp, |
predictors[5], iQuant, Data->quant_type, bits, cbp, |
585 |
Data->lambda[5], Data->mpeg_quant_matrices, Data->quant_sq, Data->metric); |
Data->lambda[5], Data->mpeg_quant_matrices, Data->quant_sq, |
586 |
|
Data->metric, bound); |
587 |
|
|
588 |
bits1 += distortion + BITS_MULT * bits[0]; |
bits1 += distortion + BITS_MULT * bits[0]; |
589 |
bits2 += distortion + BITS_MULT * bits[1]; |
bits2 += distortion + BITS_MULT * bits[1]; |
704 |
|
|
705 |
/* there is no way for INTRA to take less than 24 bits - go to findRD_intra() for calculations */ |
/* there is no way for INTRA to take less than 24 bits - go to findRD_intra() for calculations */ |
706 |
if (min_rd > 24*BITS_MULT) { |
if (min_rd > 24*BITS_MULT) { |
707 |
intra_rd = findRD_intra(Data, pMB, x, y, pParam->mb_width); |
intra_rd = findRD_intra(Data, pMB, x, y, pParam->mb_width, bound); |
708 |
if (intra_rd < min_rd) { |
if (intra_rd < min_rd) { |
709 |
*Data->iMinSAD = min_rd = intra_rd; |
*Data->iMinSAD = min_rd = intra_rd; |
710 |
mode = MODE_INTRA; |
mode = MODE_INTRA; |
956 |
} |
} |
957 |
} |
} |
958 |
|
|
959 |
intra_rd = findRD_intra(Data, pMB, x, y, pParam->mb_width); |
intra_rd = findRD_intra(Data, pMB, x, y, pParam->mb_width, bound); |
960 |
if (intra_rd < min_rd) { |
if (intra_rd < min_rd) { |
961 |
*Data->iMinSAD = min_rd = intra_rd; |
*Data->iMinSAD = min_rd = intra_rd; |
962 |
mode = MODE_INTRA; |
mode = MODE_INTRA; |