@@ -197,6 +197,25 @@ static void await_reference_mb_row(const
H264Context *const h, H264Ref *ref,
ref_field_picture && ref_field);
}
+/* Waits until it is also safe to access ref->parent->mb_type[mb_xy]. */
+static void await_reference_mb_row_both_fields(const H264Context *const h,
+ H264Ref *ref, int mb_y)
+{
+ int ref_field_picture = ref->parent->field_picture;
+ int ref_height = 16 * h->mb_height >> ref_field_picture;
+ int row = 16 * mb_y >> ref_field_picture;
+
+ if (!HAVE_THREADS || !(h->avctx->active_thread_type & FF_THREAD_FRAME))
+ return;
+
+ /* FIXME: This is an educated guess. Is this right? */
+ ff_thread_await_progress(&ref->parent->tf, FFMIN(row, ref_height - 1), 0);
+ if (ref_field_picture) {
+ ff_thread_await_progress(&ref->parent->tf, FFMIN(row, ref_height - 1),
+ 1);
+ }
+}
+
static void pred_spatial_direct_motion(const H264Context *const h,
H264SliceContext *sl,