From: Thomas D. <tj...@us...> - 2005-01-24 16:58:56
|
Update of /cvsroot/dirac/compress/libdirac_motionest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13953/libdirac_motionest Modified Files: me_mode_decn.cpp Log Message: Changed prediction of block modes to be bitwise - bit 0 indicates the presence of a Ref1 MV, and bit 1 indicated the presence of a Ref2 MV. This is also reflected in selecting modes in motion estimation. Index: me_mode_decn.cpp =================================================================== RCS file: /cvsroot/dirac/compress/libdirac_motionest/me_mode_decn.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** me_mode_decn.cpp 24 Jan 2005 16:06:58 -0000 1.13 --- me_mode_decn.cpp 24 Jan 2005 16:58:47 -0000 1.14 *************** *** 504,508 **** { MB_cost[REF2_ONLY] += me_data.PredCosts(2)[j][i].total; ! // MB_cost[REF1AND2] += me_data.BiPredCosts()[j][i].total; } }// i --- 504,508 ---- { MB_cost[REF2_ONLY] += me_data.PredCosts(2)[j][i].total; ! MB_cost[REF1AND2] += me_data.BiPredCosts()[j][i].total; } }// i *************** *** 519,524 **** if ( MB_cost[REF2_ONLY]<MB_cost[predmode] ) predmode = REF2_ONLY; ! // if ( MB_cost[REF1AND2]<MB_cost[predmode] ) ! // predmode = REF1AND2; } --- 519,524 ---- if ( MB_cost[REF2_ONLY]<MB_cost[predmode] ) predmode = REF2_ONLY; ! if ( MB_cost[REF1AND2]<MB_cost[predmode] ) ! predmode = REF1AND2; } *************** *** 547,582 **** { // Computes the variation of the given mode, predmode, from its immediate neighbours ! // Currently, includes branches to cope with blocks on the edge of the picture. ! int i ,j; ! float diff; ! float var = 0.0; ! i = xindex-1; ! j = yindex; ! if ( i>=0) { ! diff = static_cast<float>( m_me_data_set[2]->Mode()[j][i] - predmode ); ! var = std::abs( diff ); ! } ! i = xindex-1; ! j = yindex-1; ! if ( i>=0 && j>=0) ! { ! diff = static_cast<float>( m_me_data_set[2]->Mode()[j][i] - predmode); ! var += std::abs( diff ); ! } ! i = xindex; ! j = yindex-1; ! if ( j>=0 ) ! { ! diff = static_cast<float>( m_me_data_set[2]->Mode()[j][i] - predmode ); ! var += std::abs( diff ); } return var*m_me_data_set[2]->LambdaMap()[yindex][xindex]; } float ModeDecider::GetDCVar( const ValueType dc_val , const ValueType dc_pred) { --- 547,584 ---- { // Computes the variation of the given mode, predmode, from its immediate neighbours ! // First, get a prediction for the mode ! unsigned int mode_predictor = (unsigned int)(REF1_ONLY); ! const TwoDArray<PredMode>& preddata( m_me_data_set[2]->Mode() ); ! ! unsigned int num_ref1_nbrs( 0 ); ! unsigned int num_ref2_nbrs( 0 ); ! ! if (xindex > 0 && yindex > 0) { ! num_ref1_nbrs += ((unsigned int)( preddata[yindex-1][xindex] ) ) & 1; ! num_ref1_nbrs += ((unsigned int)( preddata[yindex-1][xindex-1] ) ) & 1; ! num_ref1_nbrs += ((unsigned int)( preddata[yindex][xindex-1] ) ) & 1; ! mode_predictor = num_ref1_nbrs>>1; ! num_ref2_nbrs += ((unsigned int)( preddata[yindex-1][xindex] ) ) & 2; ! num_ref2_nbrs += ((unsigned int)( preddata[yindex-1][xindex-1] ) ) & 2; ! num_ref2_nbrs += ((unsigned int)( preddata[yindex][xindex-1] ) ) & 2; ! num_ref2_nbrs >>= 1; ! ! mode_predictor ^= ( (num_ref2_nbrs>>1)<<1 ); } + else if (xindex > 0 && yindex == 0) + mode_predictor = (unsigned int)( preddata[0][xindex-1] ); + else if (xindex == 0 && yindex > 0) + mode_predictor = (unsigned int)( preddata[yindex-1][0] ); + + unsigned int var = (mode_predictor & 1)+((mode_predictor>>1) &1); return var*m_me_data_set[2]->LambdaMap()[yindex][xindex]; } + float ModeDecider::GetDCVar( const ValueType dc_val , const ValueType dc_pred) { |