@@ -1080,6 +1080,53 @@ static bool check_fixWeightedSSE( RdCost* ref, RdCost* opt, unsigned num_cases,
10801080 return passed;
10811081}
10821082
1083+ static bool check_SADwMask ( RdCost* ref, RdCost* opt, unsigned num_cases, int width, int height )
1084+ {
1085+ std::ostringstream sstm;
1086+ sstm << " RdCost::m_afpDistortFunc[0][DF_SAD_WITH_MASK] " << " w=" << width << " h=" << height;
1087+ printf ( " Testing %s\n " , sstm.str ().c_str ());
1088+
1089+ DimensionGenerator rng;
1090+ InputGenerator<Pel> g1{ 1 , /* is_signed=*/ false }; // Masks are either 0 or 1.
1091+ InputGenerator<Pel> g10{ 10 , /* is_signed=*/ false };
1092+
1093+ bool passed = true ;
1094+ for ( unsigned i = 0 ; i < num_cases; i++ )
1095+ {
1096+ int org_stride = rng.get ( width, 1024 );
1097+ int cur_stride = rng.get ( width, 1024 );
1098+ int mask_stride = rng.get ( width, 1024 );
1099+ std::vector<Pel> orgBuf ( org_stride * height );
1100+ std::vector<Pel> curBuf ( cur_stride * height );
1101+ std::vector<Pel> maskBuf ( mask_stride * height );
1102+ bool negStepX = rng.get ( 0 , 1 ) != 0 ;
1103+
1104+ DistParam dtParam;
1105+ dtParam.org .buf = orgBuf.data ();
1106+ dtParam.org .stride = org_stride;
1107+ dtParam.cur .buf = curBuf.data ();
1108+ dtParam.cur .stride = cur_stride;
1109+ dtParam.mask = maskBuf.data () + (negStepX ? width : 0 );
1110+ dtParam.maskStride = mask_stride;
1111+ dtParam.maskStride2 = negStepX ? width : -width;
1112+ dtParam.org .width = width;
1113+ dtParam.org .height = height;
1114+ dtParam.bitDepth = 10 ;
1115+ dtParam.subShift = rng.get ( 0 , 1 );
1116+ dtParam.applyWeight = 0 ; // applyWeight appears to be always zero.
1117+ dtParam.stepX = negStepX ? -1 : 1 ;
1118+
1119+ std::generate ( orgBuf.begin (), orgBuf.end (), g10 );
1120+ std::generate ( curBuf.begin (), curBuf.end (), g10 );
1121+ std::generate ( maskBuf.begin (), maskBuf.end (), g1);
1122+
1123+ Distortion sum_ref = ref->m_afpDistortFunc [0 ][DF_SAD_WITH_MASK]( dtParam );
1124+ Distortion sum_opt = opt->m_afpDistortFunc [0 ][DF_SAD_WITH_MASK]( dtParam );
1125+ passed = compare_value ( sstm.str (), sum_ref, sum_opt ) && passed;
1126+ }
1127+ return passed;
1128+ }
1129+
10831130static bool test_RdCost ()
10841131{
10851132 RdCost ref;
@@ -1097,13 +1144,12 @@ static bool test_RdCost()
10971144 for ( int w : widths )
10981145 {
10991146 passed = check_lumaWeightedSSE ( &ref, &opt, num_cases, w, h ) && passed;
1100- }
1101- }
1102- for ( int h : heights )
1103- {
1104- for ( int w : widths )
1105- {
11061147 passed = check_fixWeightedSSE ( &ref, &opt, num_cases, w, h ) && passed;
1148+
1149+ if (w >= 8 && h >= 8 )
1150+ {
1151+ passed = check_SADwMask ( &ref, &opt, num_cases, w, h ) && passed;
1152+ }
11071153 }
11081154 }
11091155 return passed;
0 commit comments