42 |
* * |
* * |
43 |
* Revision history: * |
* Revision history: * |
44 |
* * |
* * |
45 |
|
* 29.06.2002 predict_acdc() bounding * |
46 |
* 12.12.2001 improved calc_acdc_prediction; removed need for memcpy * |
* 12.12.2001 improved calc_acdc_prediction; removed need for memcpy * |
47 |
* 15.12.2001 moved pmv displacement to motion estimation * |
* 15.12.2001 moved pmv displacement to motion estimation * |
48 |
* 30.11.2001 mmx cbp support * |
* 30.11.2001 mmx cbp support * |
91 |
int16_t qcoeff[64], |
int16_t qcoeff[64], |
92 |
uint32_t current_quant, |
uint32_t current_quant, |
93 |
int32_t iDcScaler, |
int32_t iDcScaler, |
94 |
int16_t predictors[8]) |
int16_t predictors[8], |
95 |
|
const int bound) |
96 |
|
|
97 |
{ |
{ |
98 |
|
const int mbpos = (y * mb_width) + x; |
99 |
int16_t *left, *top, *diag, *current; |
int16_t *left, *top, *diag, *current; |
100 |
|
|
101 |
int32_t left_quant = current_quant; |
int32_t left_quant = current_quant; |
115 |
|
|
116 |
// left macroblock |
// left macroblock |
117 |
|
|
118 |
if (x && |
if (x && mbpos >= bound + 1 && |
119 |
(pMBs[index - 1].mode == MODE_INTRA || |
(pMBs[index - 1].mode == MODE_INTRA || |
120 |
pMBs[index - 1].mode == MODE_INTRA_Q)) { |
pMBs[index - 1].mode == MODE_INTRA_Q)) { |
121 |
|
|
125 |
} |
} |
126 |
// top macroblock |
// top macroblock |
127 |
|
|
128 |
if (y && |
if (mbpos >= bound + (int)mb_width && |
129 |
(pMBs[index - mb_width].mode == MODE_INTRA || |
(pMBs[index - mb_width].mode == MODE_INTRA || |
130 |
pMBs[index - mb_width].mode == MODE_INTRA_Q)) { |
pMBs[index - mb_width].mode == MODE_INTRA_Q)) { |
131 |
|
|
134 |
} |
} |
135 |
// diag macroblock |
// diag macroblock |
136 |
|
|
137 |
if (x && y && |
if (x && mbpos >= bound + (int)mb_width + 1 && |
138 |
(pMBs[index - 1 - mb_width].mode == MODE_INTRA || |
(pMBs[index - 1 - mb_width].mode == MODE_INTRA || |
139 |
pMBs[index - 1 - mb_width].mode == MODE_INTRA_Q)) { |
pMBs[index - 1 - mb_width].mode == MODE_INTRA_Q)) { |
140 |
|
|
245 |
int16_t *pCurrent = pMB->pred_values[block]; |
int16_t *pCurrent = pMB->pred_values[block]; |
246 |
uint32_t i; |
uint32_t i; |
247 |
|
|
248 |
|
DPRINTF(DPRINTF_COEFF,"predictor[0] %i", predictors[0]); |
249 |
|
|
250 |
dct_codes[0] += predictors[0]; // dc prediction |
dct_codes[0] += predictors[0]; // dc prediction |
251 |
pCurrent[0] = dct_codes[0] * iDcScaler; |
pCurrent[0] = dct_codes[0] * iDcScaler; |
252 |
|
|
254 |
for (i = 1; i < 8; i++) { |
for (i = 1; i < 8; i++) { |
255 |
int level = dct_codes[i] + predictors[i]; |
int level = dct_codes[i] + predictors[i]; |
256 |
|
|
257 |
|
DPRINTF(DPRINTF_COEFF,"predictor[%i] %i",i, predictors[i]); |
258 |
|
|
259 |
dct_codes[i] = level; |
dct_codes[i] = level; |
260 |
pCurrent[i] = level; |
pCurrent[i] = level; |
261 |
pCurrent[i + 7] = dct_codes[i * 8]; |
pCurrent[i + 7] = dct_codes[i * 8]; |
263 |
} else if (acpred_direction == 2) { |
} else if (acpred_direction == 2) { |
264 |
for (i = 1; i < 8; i++) { |
for (i = 1; i < 8; i++) { |
265 |
int level = dct_codes[i * 8] + predictors[i]; |
int level = dct_codes[i * 8] + predictors[i]; |
266 |
|
DPRINTF(DPRINTF_COEFF,"predictor[%i] %i",i*8, predictors[i]); |
267 |
|
|
268 |
dct_codes[i * 8] = level; |
dct_codes[i * 8] = level; |
269 |
pCurrent[i + 7] = level; |
pCurrent[i + 7] = level; |
388 |
iDcScaler = get_dc_scaler(iQuant, (j < 4) ? 1 : 0); |
iDcScaler = get_dc_scaler(iQuant, (j < 4) ? 1 : 0); |
389 |
|
|
390 |
predict_acdc(frame->mbs, x, y, mb_width, j, &qcoeff[j * 64], |
predict_acdc(frame->mbs, x, y, mb_width, j, &qcoeff[j * 64], |
391 |
iQuant, iDcScaler, predictors[j]); |
iQuant, iDcScaler, predictors[j], 0); |
392 |
|
|
393 |
S += calc_acdc(pMB, j, &qcoeff[j * 64], iDcScaler, predictors[j]); |
S += calc_acdc(pMB, j, &qcoeff[j * 64], iDcScaler, predictors[j]); |
394 |
|
|