269 |
const uint8_t *ReferenceB; |
const uint8_t *ReferenceB; |
270 |
VECTOR mvs, b_mvs; |
VECTOR mvs, b_mvs; |
271 |
|
|
272 |
if (( x > 31) || ( x < -31) || ( y > 31) || (y < -31)) return; |
if (( x > 31) || ( x < -32) || ( y > 31) || (y < -32)) return; |
273 |
|
|
274 |
sad = lambda_vec16[data->iQuant] * d_mv_bits(x, y, 1); |
sad = lambda_vec16[data->iQuant] * d_mv_bits(x, y, 1); |
275 |
|
|
550 |
|
|
551 |
uint32_t x, y; |
uint32_t x, y; |
552 |
uint32_t iIntra = 0; |
uint32_t iIntra = 0; |
553 |
int32_t InterBias; |
int32_t InterBias, quant = current->quant; |
554 |
|
|
555 |
// some pre-initialized thingies for SearchP |
// some pre-initialized thingies for SearchP |
556 |
int32_t temp[5]; |
int32_t temp[5]; |
577 |
if (!(current->global_flags & XVID_LUMIMASKING)) { |
if (!(current->global_flags & XVID_LUMIMASKING)) { |
578 |
pMB->dquant = NO_CHANGE; |
pMB->dquant = NO_CHANGE; |
579 |
pMB->quant = current->quant; } |
pMB->quant = current->quant; } |
580 |
|
else |
581 |
|
if (pMB->dquant != NO_CHANGE) { |
582 |
|
quant += DQtab[pMB->dquant]; |
583 |
|
if (quant > 31) quant = 31; |
584 |
|
else if (quant < 1) quant = 1; |
585 |
|
pMB->quant = quant; |
586 |
|
} |
587 |
|
|
588 |
//initial skip decision |
//initial skip decision |
589 |
|
|
1576 |
const IMAGE *const pRef = &reference->image; |
const IMAGE *const pRef = &reference->image; |
1577 |
|
|
1578 |
uint32_t x, y; |
uint32_t x, y; |
1579 |
int32_t temp[5]; |
int32_t temp[5], quant = current->quant; |
1580 |
int32_t iMinSAD[5]; |
int32_t iMinSAD[5]; |
1581 |
VECTOR currentMV[5]; |
VECTOR currentMV[5]; |
1582 |
SearchData Data; |
SearchData Data; |
1596 |
//intra mode is copied from the first pass. At least for the time being |
//intra mode is copied from the first pass. At least for the time being |
1597 |
if ((pMB->mode == MODE_INTRA) || (pMB->mode == MODE_NOT_CODED) ) continue; |
if ((pMB->mode == MODE_INTRA) || (pMB->mode == MODE_NOT_CODED) ) continue; |
1598 |
|
|
1599 |
|
|
1600 |
if (!(current->global_flags & XVID_LUMIMASKING)) { |
if (!(current->global_flags & XVID_LUMIMASKING)) { |
1601 |
pMB->dquant = NO_CHANGE; |
pMB->dquant = NO_CHANGE; |
1602 |
pMB->quant = current->quant; } |
pMB->quant = current->quant; } |
1603 |
|
else |
1604 |
|
if (pMB->dquant != NO_CHANGE) { |
1605 |
|
quant += DQtab[pMB->dquant]; |
1606 |
|
if (quant > 31) quant = 31; |
1607 |
|
else if (quant < 1) quant = 1; |
1608 |
|
pMB->quant = quant; |
1609 |
|
} |
1610 |
|
|
1611 |
SearchPhinted(pRef->y, pRefH->y, pRefV->y, pRefHV->y, pCurrent, x, |
SearchPhinted(pRef->y, pRefH->y, pRefV->y, pRefHV->y, pCurrent, x, |
1612 |
y, current->motion_flags, pMB->quant, |
y, current->motion_flags, pMB->quant, |
1711 |
return 0; // B frame |
return 0; // B frame |
1712 |
|
|
1713 |
} |
} |
1714 |
|
|
1715 |
|
int |
1716 |
|
FindFcode( const MBParam * const pParam, |
1717 |
|
const FRAMEINFO * const current) |
1718 |
|
{ |
1719 |
|
uint32_t x, y; |
1720 |
|
int max = 0, min = 0, i; |
1721 |
|
|
1722 |
|
for (y = 0; y < pParam->mb_height; y++) { |
1723 |
|
for (x = 0; x < pParam->mb_width; x++) { |
1724 |
|
|
1725 |
|
MACROBLOCK *pMB = ¤t->mbs[x + y * pParam->mb_width]; |
1726 |
|
for(i = 0; i < (pMB->mode == MODE_INTER4V ? 4:1); i++) { |
1727 |
|
if (pMB->mvs[i].x > max) max = pMB->mvs[i].x; |
1728 |
|
if (pMB->mvs[i].y > max) max = pMB->mvs[i].y; |
1729 |
|
|
1730 |
|
if (pMB->mvs[i].x < min) min = pMB->mvs[i].x; |
1731 |
|
if (pMB->mvs[i].y < min) min = pMB->mvs[i].y; |
1732 |
|
} |
1733 |
|
} |
1734 |
|
} |
1735 |
|
|
1736 |
|
min = -min; |
1737 |
|
max += 1; |
1738 |
|
if (min > max) max = min; |
1739 |
|
|
1740 |
|
for (i = 1; (max > 32 << (i - 1)); i++); |
1741 |
|
return i; |
1742 |
|
} |