Add zero neighborhood check to TZ search
Adds an additional grid search step that starts from the zero motion
vector after the normal grid search. The search range for this step is
half of the normal range.
@@ -643,6 +643,19 @@ static void tz_search(inter_search_info_t *info, vector2d_t extra_mv)
if (rounds_without_improvement >= 3) break;
}
+ if (start.x != 0 || start.y != 0) {
+ // repeat step 2 starting from the zero MV
+ start.x = 0;
+ start.y = 0;
+ rounds_without_improvement = 0;
+ for (int iDist = 1; iDist <= iSearchRange/2; iDist *= 2) {
+ kvz_tz_pattern_search(info, step2_type, iDist, start, &best_dist);
+
+ if (best_dist != iDist) rounds_without_improvement++;
+ if (rounds_without_improvement >= 3) break;
+ }
+ }
+
//step 3, raster scan
if (best_dist > iRaster) {
best_dist = iRaster;
