Fix a bug around image pyramid invalidation
In commit 674eaa06, av1_realloc_and_scale_if_required() was changed so
that it invalidated the image pyramid attached to the unscaled frame
if it was going to return that frame.
This change turned out to cause a bug when using frame-parallel
multithreading. The issue was that one thread could call
av1_realloc_and_scale_if_required(), and invalidate the pyramid
attached to a frame buffer, while another thread was still using
that pyramid for global motion estimation.
On further investigation, there is no need for the pyramid to be
invalidated by av1_realloc_and_scale_if_required() in the first place,
so we can just remove that call.
Change-Id: I7454ebe63144104550d38b12c375c43e3f064962
diff --git a/av1/common/resize.c b/av1/common/resize.c
index 4188355..930eaf0 100644
--- a/av1/common/resize.c
+++ b/av1/common/resize.c
@@ -1421,12 +1421,8 @@
}
#endif
return scaled;
- } else {
-#if CONFIG_AV1_ENCODER && !CONFIG_REALTIME_ONLY
- aom_invalidate_pyramid(unscaled->y_pyramid);
-#endif // CONFIG_AV1_ENCODER && !CONFIG_REALTIME_ONLY
- return unscaled;
}
+ return unscaled;
}
// Calculates the scaled dimension given the original dimension and the scale
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index 9746277..332556a 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -2726,9 +2726,7 @@
cpi->sf.interp_sf.adaptive_interp_filter_search)
cpi->interp_search_flags.interp_filter_search_mask =
av1_setup_interp_filter_search_mask(cpi);
-#if !CONFIG_REALTIME_ONLY
aom_invalidate_pyramid(cpi->source->y_pyramid);
-#endif // !CONFIG_REALTIME_ONLY
av1_setup_frame_size(cpi);