h264_direct: use the reference mask from the actual reference

Not from the underlying frame. Fixes races with frame threading in
field-coded files, where decoding would wait for the wrong field (e.g.
random failures in mixed-nal-coding).

Bug-Id: 954
This commit is contained in:
Anton Khirnov 2016-08-02 10:43:39 +02:00
parent e9bfff1cc6
commit 04763c6f87
1 changed files with 7 additions and 7 deletions

View File

@ -160,11 +160,11 @@ void ff_h264_direct_ref_list_init(const H264Context *const h, H264SliceContext *
}
}
static void await_reference_mb_row(const H264Context *const h, H264Picture *ref,
static void await_reference_mb_row(const H264Context *const h, H264Ref *ref,
int mb_y)
{
int ref_field = ref->reference - 1;
int ref_field_picture = ref->field_picture;
int ref_field_picture = ref->parent->field_picture;
int ref_height = 16 * h->mb_height >> ref_field_picture;
if (!HAVE_THREADS || !(h->avctx->active_thread_type & FF_THREAD_FRAME))
@ -173,7 +173,7 @@ static void await_reference_mb_row(const H264Context *const h, H264Picture *ref,
/* FIXME: It can be safe to access mb stuff
* even if pixels aren't deblocked yet. */
ff_thread_await_progress(&ref->tf,
ff_thread_await_progress(&ref->parent->tf,
FFMIN(16 * mb_y >> ref_field_picture,
ref_height - 1),
ref_field_picture && ref_field);
@ -197,7 +197,7 @@ static void pred_spatial_direct_motion(const H264Context *const h, H264SliceCont
assert(sl->ref_list[1][0].reference & 3);
await_reference_mb_row(h, sl->ref_list[1][0].parent,
await_reference_mb_row(h, &sl->ref_list[1][0],
sl->mb_y + !!IS_INTERLACED(*mb_type));
#define MB_TYPE_16x16_OR_INTRA (MB_TYPE_16x16 | MB_TYPE_INTRA4x4 | \
@ -321,7 +321,7 @@ single_col:
}
}
await_reference_mb_row(h, sl->ref_list[1][0].parent, mb_y);
await_reference_mb_row(h, &sl->ref_list[1][0], mb_y);
l1mv0 = &sl->ref_list[1][0].parent->motion_val[0][h->mb2b_xy[mb_xy]];
l1mv1 = &sl->ref_list[1][0].parent->motion_val[1][h->mb2b_xy[mb_xy]];
@ -480,7 +480,7 @@ static void pred_temp_direct_motion(const H264Context *const h, H264SliceContext
assert(sl->ref_list[1][0].reference & 3);
await_reference_mb_row(h, sl->ref_list[1][0].parent,
await_reference_mb_row(h, &sl->ref_list[1][0],
sl->mb_y + !!IS_INTERLACED(*mb_type));
if (IS_INTERLACED(sl->ref_list[1][0].parent->mb_type[mb_xy])) { // AFL/AFR/FR/FL -> AFL/FL
@ -545,7 +545,7 @@ single_col:
}
}
await_reference_mb_row(h, sl->ref_list[1][0].parent, mb_y);
await_reference_mb_row(h, &sl->ref_list[1][0], mb_y);
l1mv0 = &sl->ref_list[1][0].parent->motion_val[0][h->mb2b_xy[mb_xy]];
l1mv1 = &sl->ref_list[1][0].parent->motion_val[1][h->mb2b_xy[mb_xy]];