255 |
{ |
{ |
256 |
int * temp_dquants = (int *) xvid_malloc(pEnc->mbParam.mb_width * pEnc->mbParam.mb_height * sizeof(int), CACHE_LINE); |
int * temp_dquants = (int *) xvid_malloc(pEnc->mbParam.mb_width * pEnc->mbParam.mb_height * sizeof(int), CACHE_LINE); |
257 |
|
|
258 |
pEnc->mbParam.quant = adaptive_quantization(pEnc->sCurrent.y, pEnc->mbParam.width, |
pEnc->mbParam.quant = adaptive_quantization(pEnc->sCurrent.y, |
259 |
temp_dquants, pFrame->quant, pFrame->quant, |
pEnc->mbParam.width, |
260 |
2*pFrame->quant, pEnc->mbParam.mb_width, pEnc->mbParam.mb_height); |
temp_dquants, |
261 |
|
pFrame->quant, |
262 |
|
pFrame->quant, |
263 |
|
2*pFrame->quant, |
264 |
|
pEnc->mbParam.mb_width, |
265 |
|
pEnc->mbParam.mb_height); |
266 |
|
|
267 |
for (y = 0; y < pEnc->mbParam.mb_height; y++) |
for (y = 0; y < pEnc->mbParam.mb_height; y++) |
268 |
for (x = 0; x < pEnc->mbParam.mb_width; x++) |
for (x = 0; x < pEnc->mbParam.mb_width; x++) |
281 |
else if(pEnc->mbParam.global_flags & XVID_MPEGQUANT) { |
else if(pEnc->mbParam.global_flags & XVID_MPEGQUANT) { |
282 |
int ret1, ret2; |
int ret1, ret2; |
283 |
|
|
284 |
|
ret1 = ret2 = 0; |
285 |
|
|
286 |
if(pEnc->mbParam.quant_type != MPEG4_QUANT) |
if(pEnc->mbParam.quant_type != MPEG4_QUANT) |
287 |
write_vol_header = 1; |
write_vol_header = 1; |
288 |
|
|
371 |
|
|
372 |
static int FrameCodeI(Encoder * pEnc, Bitstream * bs, uint32_t *pBits) |
static int FrameCodeI(Encoder * pEnc, Bitstream * bs, uint32_t *pBits) |
373 |
{ |
{ |
374 |
CACHE_ALIGN int16_t dct_codes[6][64]; |
|
375 |
CACHE_ALIGN int16_t qcoeff[6][64]; |
DECLARE_ALIGNED_MATRIX(dct_codes, 6, 64, int16_t, CACHE_LINE); |
376 |
|
DECLARE_ALIGNED_MATRIX(qcoeff, 6, 64, int16_t, CACHE_LINE); |
377 |
|
|
378 |
uint16_t x, y; |
uint16_t x, y; |
379 |
|
|
380 |
pEnc->iFrameNum = 0; |
pEnc->iFrameNum = 0; |
426 |
{ |
{ |
427 |
float fSigma; |
float fSigma; |
428 |
|
|
429 |
CACHE_ALIGN int16_t dct_codes[6][64]; |
DECLARE_ALIGNED_MATRIX(dct_codes, 6, 64, int16_t, CACHE_LINE); |
430 |
CACHE_ALIGN int16_t qcoeff[6][64]; |
DECLARE_ALIGNED_MATRIX(qcoeff, 6, 64, int16_t, CACHE_LINE); |
431 |
|
|
432 |
int iLimit; |
int iLimit; |
433 |
uint32_t x, y; |
uint32_t x, y; |
438 |
IMAGE *pRef = &pEnc->sReference; |
IMAGE *pRef = &pEnc->sReference; |
439 |
|
|
440 |
start_timer(); |
start_timer(); |
441 |
image_setedges(pRef,pEnc->mbParam.edged_width, pEnc->mbParam.edged_height, pEnc->mbParam.width, pEnc->mbParam.height, pEnc->mbParam.global_flags & XVID_INTERLACING); |
image_setedges(pRef, |
442 |
|
pEnc->mbParam.edged_width, |
443 |
|
pEnc->mbParam.edged_height, |
444 |
|
pEnc->mbParam.width, |
445 |
|
pEnc->mbParam.height, |
446 |
|
pEnc->mbParam.global_flags & XVID_INTERLACING); |
447 |
stop_edges_timer(); |
stop_edges_timer(); |
448 |
|
|
449 |
pEnc->mbParam.rounding_type = 1 - pEnc->mbParam.rounding_type; |
pEnc->mbParam.rounding_type = 1 - pEnc->mbParam.rounding_type; |
495 |
if (!bIntra) |
if (!bIntra) |
496 |
{ |
{ |
497 |
start_timer(); |
start_timer(); |
498 |
MBMotionCompensation(pMB, x, y, &pEnc->sReference, |
MBMotionCompensation(pMB, |
499 |
&pEnc->vInterH, &pEnc->vInterV, |
x, y, |
500 |
&pEnc->vInterHV, &pEnc->sCurrent, dct_codes, |
&pEnc->sReference, |
501 |
|
&pEnc->vInterH, |
502 |
|
&pEnc->vInterV, |
503 |
|
&pEnc->vInterHV, |
504 |
|
&pEnc->sCurrent, |
505 |
|
dct_codes, |
506 |
pEnc->mbParam.width, |
pEnc->mbParam.width, |
507 |
pEnc->mbParam.height, |
pEnc->mbParam.height, |
508 |
pEnc->mbParam.edged_width, |
pEnc->mbParam.edged_width, |