966 |
pMB->sad16 = pMB->sad8[0] = pMB->sad8[1] = pMB->sad8[2] = pMB->sad8[3] = sad; |
pMB->sad16 = pMB->sad8[0] = pMB->sad8[1] = pMB->sad8[2] = pMB->sad8[3] = sad; |
967 |
} |
} |
968 |
|
|
969 |
|
static __inline void |
970 |
|
ZeroMacroblockP(MACROBLOCK *pMB, const int32_t sad) |
971 |
|
{ |
972 |
|
pMB->mode = MODE_INTER; |
973 |
|
pMB->mvs[0] = pMB->mvs[1] = pMB->mvs[2] = pMB->mvs[3] = zeroMV; |
974 |
|
pMB->qmvs[0] = pMB->qmvs[1] = pMB->qmvs[2] = pMB->qmvs[3] = zeroMV; |
975 |
|
pMB->sad16 = pMB->sad8[0] = pMB->sad8[1] = pMB->sad8[2] = pMB->sad8[3] = sad; |
976 |
|
} |
977 |
|
|
978 |
bool |
bool |
979 |
MotionEstimation(MBParam * const pParam, |
MotionEstimation(MBParam * const pParam, |
980 |
FRAMEINFO * const current, |
FRAMEINFO * const current, |
1074 |
} |
} |
1075 |
} |
} |
1076 |
|
|
1077 |
|
if ((current->global_flags & XVID_CARTOON_MODE) && |
1078 |
|
(sad00 < pMB->quant * 4 * skip_thresh)) { /* favorize (0,0) vector for cartoons */ |
1079 |
|
ZeroMacroblockP(pMB, sad00); |
1080 |
|
continue; |
1081 |
|
} |
1082 |
|
|
1083 |
SearchP(pRef, pRefH->y, pRefV->y, pRefHV->y, pCurrent, x, |
SearchP(pRef, pRefH->y, pRefV->y, pRefHV->y, pCurrent, x, |
1084 |
y, MotionFlags, current->global_flags, pMB->quant, |
y, MotionFlags, current->global_flags, pMB->quant, |
1085 |
&Data, pParam, pMBs, reference->mbs, |
&Data, pParam, pMBs, reference->mbs, |
2195 |
} |
} |
2196 |
} |
} |
2197 |
|
|
2198 |
#define INTRA_THRESH 2050 |
#define INTRA_THRESH 1800 |
2199 |
#define INTER_THRESH 1200 |
#define INTER_THRESH 1200 |
2200 |
|
|
2201 |
int |
int |
2225 |
CheckCandidate = CheckCandidate32I; |
CheckCandidate = CheckCandidate32I; |
2226 |
|
|
2227 |
if (intraCount != 0 && intraCount < 10) // we're right after an I frame |
if (intraCount != 0 && intraCount < 10) // we're right after an I frame |
2228 |
IntraThresh += 8 * (intraCount - 10) * (intraCount - 10); |
IntraThresh += 15 * (intraCount - 10) * (intraCount - 10); |
2229 |
else |
else |
2230 |
if ( 5*(maxIntra - intraCount) < maxIntra) // we're close to maximum. 2 sec when max is 10 sec |
if ( 5*(maxIntra - intraCount) < maxIntra) // we're close to maximum. 2 sec when max is 10 sec |
2231 |
IntraThresh -= (IntraThresh * (maxIntra - 5*(maxIntra - intraCount)))/maxIntra; |
IntraThresh -= (IntraThresh * (maxIntra - 8*(maxIntra - intraCount)))/maxIntra; |
2232 |
|
|
2233 |
InterThresh -= (350 - 8*b_thresh) * bCount; |
InterThresh -= (350 - 8*b_thresh) * bCount; |
2234 |
if (InterThresh < 300 + 5*b_thresh) InterThresh = 300 + 5*b_thresh; |
if (InterThresh < 300 + 5*b_thresh) InterThresh = 300 + 5*b_thresh; |