147 |
const uint32_t quant, |
const uint32_t quant, |
148 |
const uint32_t intra_dc_threshold) |
const uint32_t intra_dc_threshold) |
149 |
{ |
{ |
150 |
#ifdef LINUX |
|
151 |
DECLARE_ALIGNED_MATRIX(block,6,64,int16_t,16); |
DECLARE_ALIGNED_MATRIX(block, 6, 64, int16_t, CACHE_LINE); |
152 |
DECLARE_ALIGNED_MATRIX(data,6,64,int16_t,16); |
DECLARE_ALIGNED_MATRIX(data, 6, 64, int16_t, CACHE_LINE); |
153 |
#else |
|
|
CACHE_ALIGN int16_t block[6][64]; |
|
|
CACHE_ALIGN int16_t data[6][64]; |
|
|
#endif |
|
154 |
const uint32_t stride = dec->edged_width; |
const uint32_t stride = dec->edged_width; |
155 |
uint32_t i; |
uint32_t i; |
156 |
uint32_t iQuant = pMB->quant; |
uint32_t iQuant = pMB->quant; |
160 |
pU_Cur = dec->cur.u + (y_pos << 3) * (stride >> 1) + (x_pos << 3); |
pU_Cur = dec->cur.u + (y_pos << 3) * (stride >> 1) + (x_pos << 3); |
161 |
pV_Cur = dec->cur.v + (y_pos << 3) * (stride >> 1) + (x_pos << 3); |
pV_Cur = dec->cur.v + (y_pos << 3) * (stride >> 1) + (x_pos << 3); |
162 |
|
|
163 |
#ifdef LINUX |
memset(block, 0, 6*64*sizeof(int16_t)); // clear |
|
memset(block,0,sizeof(int16_t)*6*64); |
|
|
#else |
|
|
memset(block, 0, sizeof(block)); // clear |
|
|
#endif |
|
164 |
|
|
165 |
for (i = 0; i < 6; i++) |
for (i = 0; i < 6; i++) |
166 |
{ |
{ |
169 |
int start_coeff; |
int start_coeff; |
170 |
|
|
171 |
start_timer(); |
start_timer(); |
172 |
predict_acdc(dec->mbs, x_pos, y_pos, dec->mb_width, i, block[i], iQuant, iDcScaler, predictors); |
predict_acdc(dec->mbs, x_pos, y_pos, dec->mb_width, i, &block[i*64], iQuant, iDcScaler, predictors); |
173 |
if (!acpred_flag) |
if (!acpred_flag) |
174 |
{ |
{ |
175 |
pMB->acpred_directions[i] = 0; |
pMB->acpred_directions[i] = 0; |
189 |
BitstreamSkip(bs, 1); // marker |
BitstreamSkip(bs, 1); // marker |
190 |
} |
} |
191 |
|
|
192 |
block[i][0] = dc_dif; |
block[i*64 + 0] = dc_dif; |
193 |
start_coeff = 1; |
start_coeff = 1; |
194 |
} |
} |
195 |
else |
else |
200 |
start_timer(); |
start_timer(); |
201 |
if (cbp & (1 << (5-i))) // coded |
if (cbp & (1 << (5-i))) // coded |
202 |
{ |
{ |
203 |
get_intra_block(bs, block[i], pMB->acpred_directions[i], start_coeff); |
get_intra_block(bs, &block[i*64], pMB->acpred_directions[i], start_coeff); |
204 |
} |
} |
205 |
stop_coding_timer(); |
stop_coding_timer(); |
206 |
|
|
207 |
start_timer(); |
start_timer(); |
208 |
add_acdc(pMB, i, block[i], iDcScaler, predictors); |
add_acdc(pMB, i, &block[i*64], iDcScaler, predictors); |
209 |
stop_prediction_timer(); |
stop_prediction_timer(); |
210 |
|
|
211 |
start_timer(); |
start_timer(); |
212 |
if (dec->quant_type == 0) |
if (dec->quant_type == 0) |
213 |
{ |
{ |
214 |
dequant_intra(data[i], block[i], iQuant, iDcScaler); |
dequant_intra(&data[i*64], &block[i*64], iQuant, iDcScaler); |
215 |
} |
} |
216 |
else |
else |
217 |
{ |
{ |
218 |
dequant4_intra(data[i], block[i], iQuant, iDcScaler); |
dequant4_intra(&data[i*64], &block[i*64], iQuant, iDcScaler); |
219 |
} |
} |
220 |
stop_iquant_timer(); |
stop_iquant_timer(); |
221 |
|
|
222 |
start_timer(); |
start_timer(); |
223 |
idct(data[i]); |
idct(&data[i*64]); |
224 |
stop_idct_timer(); |
stop_idct_timer(); |
225 |
} |
} |
226 |
|
|
232 |
stop_interlacing_timer(); |
stop_interlacing_timer(); |
233 |
|
|
234 |
start_timer(); |
start_timer(); |
235 |
transfer_16to8copy(pY_Cur, data[0], stride); |
transfer_16to8copy(pY_Cur, &data[0*64], stride); |
236 |
transfer_16to8copy(pY_Cur + 8, data[1], stride); |
transfer_16to8copy(pY_Cur + 8, &data[1*64], stride); |
237 |
transfer_16to8copy(pY_Cur + 8 * stride, data[2], stride); |
transfer_16to8copy(pY_Cur + 8 * stride, &data[2*64], stride); |
238 |
transfer_16to8copy(pY_Cur + 8 + 8 * stride, data[3], stride); |
transfer_16to8copy(pY_Cur + 8 + 8 * stride, &data[3*64], stride); |
239 |
transfer_16to8copy(pU_Cur, data[4], stride / 2); |
transfer_16to8copy(pU_Cur, &data[4*64], stride / 2); |
240 |
transfer_16to8copy(pV_Cur, data[5], stride / 2); |
transfer_16to8copy(pV_Cur, &data[5*64], stride / 2); |
241 |
stop_transfer_timer(); |
stop_transfer_timer(); |
242 |
} |
} |
243 |
|
|
263 |
const uint32_t quant, |
const uint32_t quant, |
264 |
const uint32_t rounding) |
const uint32_t rounding) |
265 |
{ |
{ |
266 |
#ifdef LINUX |
|
267 |
DECLARE_ALIGNED_MATRIX(block,6,64,int16_t,16); |
DECLARE_ALIGNED_MATRIX(block,6, 64, int16_t, CACHE_LINE); |
268 |
DECLARE_ALIGNED_MATRIX(data,6,64,int16_t,16); |
DECLARE_ALIGNED_MATRIX(data, 6, 64, int16_t, CACHE_LINE); |
|
#else |
|
|
CACHE_ALIGN int16_t block[6][64]; |
|
|
CACHE_ALIGN int16_t data[6][64]; |
|
|
#endif |
|
269 |
|
|
270 |
const uint32_t stride = dec->edged_width; |
const uint32_t stride = dec->edged_width; |
271 |
const uint32_t stride2 = dec->edged_width / 2; |
const uint32_t stride2 = dec->edged_width / 2; |
309 |
{ |
{ |
310 |
if (cbp & (1 << (5-i))) // coded |
if (cbp & (1 << (5-i))) // coded |
311 |
{ |
{ |
312 |
memset(block[i], 0, 64 * sizeof(int16_t)); // clear |
memset(&block[i*64], 0, 64 * sizeof(int16_t)); // clear |
313 |
|
|
314 |
start_timer(); |
start_timer(); |
315 |
get_inter_block(bs, block[i]); |
get_inter_block(bs, &block[i*64]); |
316 |
stop_coding_timer(); |
stop_coding_timer(); |
317 |
|
|
318 |
start_timer(); |
start_timer(); |
319 |
if (dec->quant_type == 0) |
if (dec->quant_type == 0) |
320 |
{ |
{ |
321 |
dequant_inter(data[i], block[i], iQuant); |
dequant_inter(&data[i*64], &block[i*64], iQuant); |
322 |
} |
} |
323 |
else |
else |
324 |
{ |
{ |
325 |
dequant4_inter(data[i], block[i], iQuant); |
dequant4_inter(&data[i*64], &block[i*64], iQuant); |
326 |
} |
} |
327 |
stop_iquant_timer(); |
stop_iquant_timer(); |
328 |
|
|
329 |
start_timer(); |
start_timer(); |
330 |
idct(data[i]); |
idct(&data[i*64]); |
331 |
stop_idct_timer(); |
stop_idct_timer(); |
332 |
} |
} |
333 |
} |
} |
341 |
|
|
342 |
start_timer(); |
start_timer(); |
343 |
if (cbp & 32) |
if (cbp & 32) |
344 |
transfer_16to8add(pY_Cur, data[0], stride); |
transfer_16to8add(pY_Cur, &data[0*64], stride); |
345 |
if (cbp & 16) |
if (cbp & 16) |
346 |
transfer_16to8add(pY_Cur + 8, data[1], stride); |
transfer_16to8add(pY_Cur + 8, &data[1*64], stride); |
347 |
if (cbp & 8) |
if (cbp & 8) |
348 |
transfer_16to8add(pY_Cur + 8 * stride, data[2], stride); |
transfer_16to8add(pY_Cur + 8 * stride, &data[2*64], stride); |
349 |
if (cbp & 4) |
if (cbp & 4) |
350 |
transfer_16to8add(pY_Cur + 8 + 8 * stride, data[3], stride); |
transfer_16to8add(pY_Cur + 8 + 8 * stride, &data[3*64], stride); |
351 |
if (cbp & 2) |
if (cbp & 2) |
352 |
transfer_16to8add(pU_Cur, data[4], stride / 2); |
transfer_16to8add(pU_Cur, &data[4*64], stride / 2); |
353 |
if (cbp & 1) |
if (cbp & 1) |
354 |
transfer_16to8add(pV_Cur, data[5], stride / 2); |
transfer_16to8add(pV_Cur, &data[5*64], stride / 2); |
355 |
stop_transfer_timer(); |
stop_transfer_timer(); |
356 |
} |
} |
357 |
|
|
358 |
|
|
359 |
void decoder_iframe(DECODER * dec, Bitstream * bs, int quant, int intra_dc_threshold) |
void decoder_iframe(DECODER * dec, Bitstream * bs, int quant, int intra_dc_threshold) |
360 |
{ |
{ |
361 |
|
|
362 |
uint32_t x, y; |
uint32_t x, y; |
363 |
|
|
364 |
for (y = 0; y < dec->mb_height; y++) |
for (y = 0; y < dec->mb_height; y++) |
411 |
decoder_mbintra(dec, mb, x, y, acpred_flag, cbp, bs, quant, intra_dc_threshold); |
decoder_mbintra(dec, mb, x, y, acpred_flag, cbp, bs, quant, intra_dc_threshold); |
412 |
} |
} |
413 |
} |
} |
414 |
|
|
415 |
} |
} |
416 |
|
|
417 |
|
|
418 |
void get_motion_vector(DECODER *dec, Bitstream *bs, int x, int y, int k, VECTOR * mv, int fcode) |
void get_motion_vector(DECODER *dec, Bitstream *bs, int x, int y, int k, VECTOR * mv, int fcode) |
419 |
{ |
{ |
420 |
|
|
421 |
int scale_fac = 1 << (fcode - 1); |
int scale_fac = 1 << (fcode - 1); |
422 |
int high = (32 * scale_fac) - 1; |
int high = (32 * scale_fac) - 1; |
423 |
int low = ((-32) * scale_fac); |
int low = ((-32) * scale_fac); |
467 |
|
|
468 |
void decoder_pframe(DECODER * dec, Bitstream * bs, int rounding, int quant, int fcode, int intra_dc_threshold) |
void decoder_pframe(DECODER * dec, Bitstream * bs, int rounding, int quant, int fcode, int intra_dc_threshold) |
469 |
{ |
{ |
470 |
|
|
471 |
uint32_t x, y; |
uint32_t x, y; |
472 |
|
|
473 |
image_swap(&dec->cur, &dec->refn); |
image_swap(&dec->cur, &dec->refn); |
620 |
|
|
621 |
int decoder_decode(DECODER * dec, XVID_DEC_FRAME * frame) |
int decoder_decode(DECODER * dec, XVID_DEC_FRAME * frame) |
622 |
{ |
{ |
623 |
|
|
624 |
Bitstream bs; |
Bitstream bs; |
625 |
uint32_t rounding; |
uint32_t rounding; |
626 |
uint32_t quant; |
uint32_t quant; |
664 |
stop_global_timer(); |
stop_global_timer(); |
665 |
|
|
666 |
return XVID_ERR_OK; |
return XVID_ERR_OK; |
667 |
|
|
668 |
} |
} |