719 |
Data->min_dy = EVEN(Data->min_dy); |
Data->min_dy = EVEN(Data->min_dy); |
720 |
Data->max_dy = EVEN(Data->max_dy); } |
Data->max_dy = EVEN(Data->max_dy); } |
721 |
|
|
722 |
for(i = 0; i < 5; i++) Data->iMinSAD[i] = 256*4096; |
if (pMB->dquant != NO_CHANGE) inter4v = 0; |
723 |
|
|
724 |
if (inter4v) CheckCandidate = CheckCandidate16; |
if (inter4v) CheckCandidate = CheckCandidate16; |
725 |
else CheckCandidate = CheckCandidate16no4v; |
else CheckCandidate = CheckCandidate16no4v; |
726 |
|
|
|
(*CheckCandidate)(Data->predMV.x, Data->predMV.y, 0, &iDirection, Data); |
|
|
|
|
727 |
for(i = 0; i < 5; i++) Data->currentMV[i].x = Data->currentMV[i].y = 0; |
for(i = 0; i < 5; i++) Data->currentMV[i].x = Data->currentMV[i].y = 0; |
728 |
|
|
729 |
i = d_mv_bits(Data->predMV.x, Data->predMV.y, Data->iFcode); |
i = d_mv_bits(Data->predMV.x, Data->predMV.y, Data->iFcode); |
733 |
Data->iMinSAD[3] = pMB->sad8[2]; |
Data->iMinSAD[3] = pMB->sad8[2]; |
734 |
Data->iMinSAD[4] = pMB->sad8[3]; |
Data->iMinSAD[4] = pMB->sad8[3]; |
735 |
|
|
|
if (pMB->dquant != NO_CHANGE) inter4v = 0; |
|
|
|
|
736 |
if ((x == 0) && (y == 0)) threshA = 512; |
if ((x == 0) && (y == 0)) threshA = 512; |
737 |
else { |
else { |
738 |
threshA = Data->temp[0] + 20; |
threshA = Data->temp[0]; // that's when we keep this SAD atm |
739 |
if (threshA < 512) threshA = 512; |
if (threshA < 512) threshA = 512; |
740 |
if (threshA > 1024) threshA = 1024; } |
if (threshA > 1024) threshA = 1024; } |
741 |
|
|
742 |
PreparePredictionsP(pmv, x, y, pParam->mb_width, pParam->mb_height, |
PreparePredictionsP(pmv, x, y, pParam->mb_width, pParam->mb_height, |
743 |
prevMBs + x + y * pParam->mb_width); |
prevMBs + x + y * pParam->mb_width); |
744 |
|
|
745 |
|
if (inter4v) CheckCandidate = CheckCandidate16; |
746 |
|
else CheckCandidate = CheckCandidate16no4v; |
747 |
|
|
748 |
|
|
749 |
/* main loop. checking all predictions */ |
/* main loop. checking all predictions */ |
750 |
|
|
751 |
for (i = 1; i < 7; i++) { |
for (i = 1; i < 7; i++) { |
752 |
if (!(mask = make_mask(pmv, i)) ) continue; |
if (!(mask = make_mask(pmv, i)) ) continue; |
753 |
CheckCandidate16(pmv[i].x, pmv[i].y, mask, &iDirection, Data); |
(*CheckCandidate)(pmv[i].x, pmv[i].y, mask, &iDirection, Data); |
754 |
if (Data->iMinSAD[0] <= threshA) break; |
if (Data->iMinSAD[0] <= threshA) break; |
755 |
} |
} |
756 |
|
|
1467 |
const MACROBLOCK * const pMBs, |
const MACROBLOCK * const pMBs, |
1468 |
int inter4v, |
int inter4v, |
1469 |
MACROBLOCK * const pMB, |
MACROBLOCK * const pMB, |
1470 |
SearchData * Data) |
SearchData * const Data) |
1471 |
{ |
{ |
1472 |
|
|
1473 |
const int32_t iEdgedWidth = pParam->edged_width; |
const int32_t iEdgedWidth = pParam->edged_width; |
1474 |
|
|
1475 |
int i; |
int i, t; |
1476 |
MainSearchFunc * MainSearchPtr; |
MainSearchFunc * MainSearchPtr; |
1477 |
|
|
1478 |
Data->predMV = get_pmv2(pMBs, pParam->mb_width, 0, x, y, 0); |
Data->predMV = get_pmv2(pMBs, pParam->mb_width, 0, x, y, 0); |
1509 |
if (pMB->mvs[0].y > Data->max_dy) pMB->mvs[0].y = Data->max_dy; |
if (pMB->mvs[0].y > Data->max_dy) pMB->mvs[0].y = Data->max_dy; |
1510 |
if (pMB->mvs[0].y < Data->min_dy) pMB->mvs[0].y = Data->min_dy; |
if (pMB->mvs[0].y < Data->min_dy) pMB->mvs[0].y = Data->min_dy; |
1511 |
|
|
1512 |
(*CheckCandidate)(pMB->mvs[0].x, pMB->mvs[0].y, 0, &i, Data); |
(*CheckCandidate)(pMB->mvs[0].x, pMB->mvs[0].y, 0, &t, Data); |
1513 |
|
|
1514 |
if (pMB->mode == MODE_INTER4V) |
if (pMB->mode == MODE_INTER4V) |
1515 |
for (i = 1; i < 4; i++) { // all four vectors will be used as four predictions for 16x16 search |
for (i = 1; i < 4; i++) { // all four vectors will be used as four predictions for 16x16 search |
1516 |
pMB->mvs[i].x = EVEN(pMB->mvs[i].x); |
pMB->mvs[i].x = EVEN(pMB->mvs[i].x); |
1517 |
pMB->mvs[i].y = EVEN(pMB->mvs[i].y); |
pMB->mvs[i].y = EVEN(pMB->mvs[i].y); |
1518 |
if (!(make_mask(pMB->mvs, i))) |
if (!(make_mask(pMB->mvs, i))) |
1519 |
(*CheckCandidate)(pMB->mvs[i].x, pMB->mvs[i].y, 0, &i, Data); |
(*CheckCandidate)(pMB->mvs[i].x, pMB->mvs[i].y, 0, &t, Data); |
1520 |
} |
} |
1521 |
|
|
1522 |
if (MotionFlags & PMV_USESQUARES16) |
if (MotionFlags & PMV_USESQUARES16) |