void MBPrediction(FRAMEINFO * frame, uint32_t x, uint32_t y, uint32_t mb_width, int16_t qcoeff[6 * 64], const int bound) { int32_t j; int32_t iDcScaler, iQuant; int S = 0; int16_t predictors[6][8]; MACROBLOCK *pMB = &frame->mbs[x + y * mb_width]; iQuant = pMB->quant; if ((pMB->mode == MODE_INTRA) || (pMB->mode == MODE_INTRA_Q)) { for (j = 0; j < 6; j++) { iDcScaler = get_dc_scaler(iQuant, j<4); predict_acdc(frame->mbs, x, y, mb_width, j, &qcoeff[j * 64], iQuant, iDcScaler, predictors[j], bound); if ((frame->vop_flags & XVID_VOP_HQACPRED)) S += calc_acdc_bits(pMB, j, &qcoeff[j * 64], iDcScaler, predictors[j]); else S += calc_acdc_coeff(pMB, j, &qcoeff[j * 64], iDcScaler, predictors[j]); } if (S<=0) { /* dont predict */ for (j = 0; j < 6; j++) pMB->acpred_directions[j] = 0; }else{ for (j = 0; j < 6; j++) apply_acdc(pMB, j, &qcoeff[j * 64], predictors[j]); } pMB->cbp = calc_cbp(qcoeff); } }
void MBPrediction(FRAMEINFO * frame, uint32_t x, uint32_t y, uint32_t mb_width, int16_t qcoeff[6 * 64]) { int32_t j; int32_t iDcScaler, iQuant = frame->quant; int32_t S = 0; int16_t predictors[6][8]; MACROBLOCK *pMB = &frame->mbs[x + y * mb_width]; if ((pMB->mode == MODE_INTRA) || (pMB->mode == MODE_INTRA_Q)) { for (j = 0; j < 6; j++) { iDcScaler = get_dc_scaler(iQuant, (j < 4) ? 1 : 0); predict_acdc(frame->mbs, x, y, mb_width, j, &qcoeff[j * 64], iQuant, iDcScaler, predictors[j], 0); S += calc_acdc(pMB, j, &qcoeff[j * 64], iDcScaler, predictors[j]); } if (S < 0) /* dont predict */ { for (j = 0; j < 6; j++) { pMB->acpred_directions[j] = 0; } } else { for (j = 0; j < 6; j++) { apply_acdc(pMB, j, &qcoeff[j * 64], predictors[j]); } } pMB->cbp = calc_cbp(qcoeff); } }