--- branches/dev-api-4/xvidcore/src/motion/vop_type_decision.c 2003/09/10 22:19:00 1142 +++ branches/dev-api-4/xvidcore/src/motion/vop_type_decision.c 2003/11/16 15:32:38 1212 @@ -19,7 +19,7 @@ * along with this program ; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: vop_type_decision.c,v 1.1.2.1 2003-09-10 22:19:00 edgomez Exp $ + * $Id: vop_type_decision.c,v 1.1.2.4 2003-11-16 15:32:38 edgomez Exp $ * ****************************************************************************/ @@ -33,9 +33,9 @@ #include "motion_inlines.h" -#define INTRA_THRESH 2200 +#define INTRA_THRESH 2000 #define INTER_THRESH 40 -#define INTRA_THRESH2 95 +#define INTRA_THRESH2 90 static void CheckCandidate32I(const int x, const int y, const SearchData * const data, const unsigned int Direction) @@ -137,17 +137,18 @@ MEanalysis( const IMAGE * const pRef, const FRAMEINFO * const Current, const MBParam * const pParam, - const int maxIntra, //maximum number if non-I frames - const int intraCount, //number of non-I frames after last I frame; 0 if we force P/B frame - const int bCount, // number of B frames in a row - const int b_thresh) + const int maxIntra, /* maximum number if non-I frames */ + const int intraCount, /* number of non-I frames after last I frame; 0 if we force P/B frame */ + const int bCount, /* number of B frames in a row */ + const int b_thresh, + const MACROBLOCK * const prev_mbs) { uint32_t x, y, intra = 0; int sSAD = 0; MACROBLOCK * const pMBs = Current->mbs; const IMAGE * const pCurrent = &Current->image; int IntraThresh = INTRA_THRESH, InterThresh = INTER_THRESH + b_thresh; - int blocks = 0; + int blocks = 10; int complexity = 0; int32_t iMinSAD[5], temp[5]; @@ -164,10 +165,10 @@ Data.qpel_precision = 0; if (intraCount != 0) { - if (intraCount < 10) // we're right after an I frame + if (intraCount < 10) /* we're right after an I frame */ IntraThresh += 15* (intraCount - 10) * (intraCount - 10); else - 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 */ IntraThresh -= (IntraThresh * (maxIntra - 8*(maxIntra - intraCount)))/maxIntra; } @@ -182,11 +183,11 @@ blocks += 10; if (bCount == 0) pMBs[x + y * pParam->mb_width].mvs[0] = zeroMV; - else { //extrapolation of the vector found for last frame + else { /* extrapolation of the vector found for last frame */ pMBs[x + y * pParam->mb_width].mvs[0].x = - (pMBs[x + y * pParam->mb_width].mvs[0].x * (bCount+1) ) / bCount; + (prev_mbs[x + y * pParam->mb_width].mvs[0].x * (bCount+1) ) / bCount; pMBs[x + y * pParam->mb_width].mvs[0].y = - (pMBs[x + y * pParam->mb_width].mvs[0].y * (bCount+1) ) / bCount; + (prev_mbs[x + y * pParam->mb_width].mvs[0].y * (bCount+1) ) / bCount; } MEanalyzeMB(pRef->y, pCurrent->y, x, y, pParam, pMBs, &Data); @@ -215,7 +216,7 @@ sSAD /= complexity + 4*blocks; - if (intraCount > 80 && sSAD > INTRA_THRESH2 ) return I_VOP; + if (intraCount > 60 && sSAD > INTRA_THRESH2 ) return I_VOP; if (sSAD > InterThresh ) return P_VOP; emms(); return B_VOP;