--- branches/dev-api-4/xvidcore/src/motion/motion_est.c 2003/02/22 08:24:01 889 +++ branches/dev-api-4/xvidcore/src/motion/motion_est.c 2003/02/22 08:49:45 890 @@ -995,7 +995,7 @@ uint32_t mb_width = pParam->mb_width; uint32_t mb_height = pParam->mb_height; const uint32_t iEdgedWidth = pParam->edged_width; - const uint32_t MotionFlags = MakeGoodMotionFlags(current->motion_flags, current->global_flags); + const uint32_t MotionFlags = MakeGoodMotionFlags(current->motion_flags, current->vop_flags, current->vol_flags); uint32_t x, y; uint32_t iIntra = 0; @@ -1015,11 +1015,11 @@ Data.temp = temp; Data.iFcode = current->fcode; Data.rounding = pParam->m_rounding_type; - Data.qpel = pParam->m_quarterpel; + Data.qpel = current->vol_flags & XVID_QUARTERPEL; Data.chroma = MotionFlags & PMV_CHROMA16; - Data.rrv = current->global_flags & XVID_REDUCED; + Data.rrv = current->vop_flags & XVID_REDUCED; - if ((current->global_flags & XVID_REDUCED)) { + if ((current->vop_flags & XVID_REDUCED)) { mb_width = (pParam->width + 31) / 32; mb_height = (pParam->height + 31) / 32; Data.qpel = 0; @@ -1052,7 +1052,7 @@ sad00 = pMB->sad16; - if (!(current->global_flags & XVID_LUMIMASKING)) { + if (!(current->vop_flags & XVID_LUMIMASKING)) { pMB->dquant = NO_CHANGE; } else { if (pMB->dquant != NO_CHANGE) { @@ -1065,7 +1065,7 @@ //initial skip decision /* no early skip for GMC (global vector = skip vector is unknown!) */ - if (!(current->global_flags & XVID_GMC)) { /* no fast SKIP for S(GMC)-VOPs */ + if (!(current->vol_flags & XVID_GMC)) { /* no fast SKIP for S(GMC)-VOPs */ if (pMB->dquant == NO_CHANGE && sad00 < pMB->quant * INITIAL_SKIP_THRESH * (Data.rrv ? 4:1) ) if (Data.chroma || SkipDecisionP(pCurrent, pRef, x, y, iEdgedWidth/2, pMB->quant, Data.rrv)) { SkipMacroblockP(pMB, sad00); @@ -1074,14 +1074,14 @@ } SearchP(pRef, pRefH->y, pRefV->y, pRefHV->y, pCurrent, x, - y, MotionFlags, current->global_flags, pMB->quant, + y, MotionFlags, current->vol_flags, pMB->quant, &Data, pParam, pMBs, reference->mbs, - current->global_flags & XVID_INTER4V, pMB); + current->vop_flags & XVID_INTER4V, pMB); /* final skip decision, a.k.a. "the vector you found, really that good?" */ - if (!(current->global_flags & XVID_GMC)) { + if (!(current->vol_flags & XVID_GMC)) { if ( pMB->dquant == NO_CHANGE && sad00 < pMB->quant * MAX_SAD00_FOR_SKIP) { - if (!(current->global_flags & XVID_MODEDECISION_BITS)) { + if (!(current->vop_flags & XVID_MODEDECISION_BITS)) { if ( (100*pMB->sad16)/(sad00+1) > FINAL_SKIP_THRESH * (Data.rrv ? 4:1) ) if (Data.chroma || SkipDecisionP(pCurrent, pRef, x, y, iEdgedWidth/2, pMB->quant, Data.rrv)) SkipMacroblockP(pMB, sad00); @@ -1097,7 +1097,7 @@ } } - if (current->global_flags & XVID_GMC ) /* GMC only for S(GMC)-VOPs */ + if (current->vol_flags & XVID_GMC ) /* GMC only for S(GMC)-VOPs */ { current->warp = GlobalMotionEst( pMBs, pParam, current, reference, pRefH, pRefV, pRefHV); } @@ -1172,12 +1172,12 @@ const int x, const int y, const MBParam * const pParam, const uint32_t MotionFlags, - const uint32_t GlobalFlags) + const uint32_t VopFlags) { int mode = MODE_INTER; - if (!(GlobalFlags & XVID_MODEDECISION_BITS)) { //normal, fast, SAD-based mode decision + if (!(VopFlags & XVID_MODEDECISION_BITS)) { //normal, fast, SAD-based mode decision // int intra = 0; int sad; int InterBias = MV16_INTER_BIAS; @@ -1220,7 +1220,7 @@ int bits, intra, i; VECTOR backup[5], *v; Data->lambda16 = iQuant; - Data->lambda8 = pParam->m_quant_type; + Data->lambda8 = (pParam->vol_flags & XVID_MPEGQUANT)?1:0; v = Data->qpel ? Data->currentQMV : Data->currentMV; for (i = 0; i < 5; i++) { @@ -1254,7 +1254,7 @@ const int x, const int y, const uint32_t MotionFlags, - const uint32_t GlobalFlags, + const uint32_t VopFlags, const uint32_t iQuant, SearchData * const Data, const MBParam * const pParam, @@ -1304,7 +1304,7 @@ Data->iMinSAD[3] = pMB->sad8[2]; Data->iMinSAD[4] = pMB->sad8[3]; - if ((!(GlobalFlags & XVID_MODEDECISION_BITS)) || (x | y)) { + if ((!(VopFlags & XVID_MODEDECISION_BITS)) || (x | y)) { threshA = Data->temp[0]; // that's where we keep this SAD atm if (threshA < 512) threshA = 512; else if (threshA > 1024) threshA = 1024; @@ -1330,7 +1330,7 @@ if ((Data->iMinSAD[0] <= threshA) || (MVequal(Data->currentMV[0], (prevMBs+x+y*pParam->mb_width)->mvs[0]) && (Data->iMinSAD[0] < (prevMBs+x+y*pParam->mb_width)->sad16))) { - if (!(GlobalFlags & XVID_MODEDECISION_BITS)) inter4v = 0; } + if (!(VopFlags & XVID_MODEDECISION_BITS)) inter4v = 0; } else { MainSearchFunc * MainSearchPtr; @@ -1393,9 +1393,9 @@ SubpelRefine(Data); } - if ((!(GlobalFlags & XVID_MODEDECISION_BITS)) && (Data->iMinSAD[0] < (int32_t)iQuant * 30)) inter4v = 0; + if ((!(VopFlags & XVID_MODEDECISION_BITS)) && (Data->iMinSAD[0] < (int32_t)iQuant * 30)) inter4v = 0; - if (inter4v && (!(GlobalFlags & XVID_MODEDECISION_BITS) || + if (inter4v && (!(VopFlags & XVID_MODEDECISION_BITS) || (!(MotionFlags & QUARTERPELREFINE8_BITS)) || (!(MotionFlags & HALFPELREFINE8_BITS)) || ((!(MotionFlags & EXTSEARCH_BITS)) && (!(MotionFlags&PMV_EXTSEARCH8)) ))) { // if decision is BITS-based and all refinement steps will be done in BITS domain, there is no reason to call this loop @@ -1408,7 +1408,7 @@ Search8(Data, 2*x, 2*y + 1, MotionFlags, pParam, pMB, pMBs, 2, &Data8); Search8(Data, 2*x + 1, 2*y + 1, MotionFlags, pParam, pMB, pMBs, 3, &Data8); - if ((Data->chroma) && (!(GlobalFlags & XVID_MODEDECISION_BITS))) { + if ((Data->chroma) && (!(VopFlags & XVID_MODEDECISION_BITS))) { // chroma is only used for comparsion to INTER. if the comparsion will be done in BITS domain, there is no reason to compute it int sumx = 0, sumy = 0; const int div = 1 + Data->qpel; @@ -1424,7 +1424,7 @@ } } - inter4v = ModeDecision(iQuant, Data, inter4v, pMB, pMBs, x, y, pParam, MotionFlags, GlobalFlags); + inter4v = ModeDecision(iQuant, Data, inter4v, pMB, pMBs, x, y, pParam, MotionFlags, VopFlags); if (Data->rrv) { Data->currentMV[0].x = RRV_MV_SCALEDOWN(Data->currentMV[0].x); @@ -2038,7 +2038,7 @@ Data.currentMV = currentMV; Data.currentQMV = currentQMV; Data.iMinSAD = &iMinSAD; Data.lambda16 = lambda_vec16[frame->quant]; - Data.qpel = pParam->m_quarterpel; + Data.qpel = pParam->vol_flags & XVID_QUARTERPEL; Data.rounding = 0; Data.chroma = frame->motion_flags & PMV_CHROMA8; Data.temp = temp; @@ -2163,7 +2163,7 @@ else Data->predMV = get_pmv2(pMBs, pParam->mb_width, 0, x, y, 0); //else median get_range(&Data->min_dx, &Data->max_dx, &Data->min_dy, &Data->max_dy, x, y, 16, - pParam->width, pParam->height, Data->iFcode - pParam->m_quarterpel, 0, Data->rrv); + pParam->width, pParam->height, Data->iFcode - (pParam->vol_flags&XVID_QUARTERPEL?1:0), 0, Data->rrv); Data->Cur = pCur + (x + y * pParam->edged_width) * 16; Data->Ref = pRef + (x + y * pParam->edged_width) * 16; @@ -2220,7 +2220,7 @@ Data.currentMV = currentMV; Data.iMinSAD = iMinSAD; Data.iFcode = Current->fcode; - Data.rrv = Current->global_flags & XVID_REDUCED; + Data.rrv = Current->vop_flags & XVID_REDUCED; Data.temp = temp; CheckCandidate = CheckCandidate32I;