OSDN Git Service

h264: don't clobber mmco opcode tables for non-first slice headers.
authorRonald S. Bultje <rsbultje@gmail.com>
Mon, 14 Jan 2013 05:46:44 +0000 (21:46 -0800)
committerLuca Barbato <lu_zero@gentoo.org>
Mon, 14 Jan 2013 18:20:47 +0000 (19:20 +0100)
commitbad446e251405dc250c3cbee199072e083a1e4b9
treebf9827e9f235d35909dae2bd23e00ae81d54a0ba
parent3f111804eb5c603a344706b84b7164cbf7b4e0df
h264: don't clobber mmco opcode tables for non-first slice headers.

Clobbering these tables will temporarily clobber the template used
as a basis for other threads to start decoding from. If the other
decoding thread updates from the template right at that moment,
subsequent threads will get invalid (or, usually, none at all) mmco
tables. This leads to invalid reference lists and subsequent decode
failures.

Therefore, instead, decode the mmco tables only for the first slice in
a field or frame. For other slices, decode the bits and ensure they
are identical to the mmco tables in the first slice, but don't ever
clobber the context state. This prevents other threads from using a
clobbered/invalid template as starting point for decoding, and thus
fixes decoding in these cases.

This fixes occasional (~1%) failures of h264-conformance-mr1_bt_a with
frame-multithreading enabled.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
libavcodec/h264.c
libavcodec/h264.h
libavcodec/h264_refs.c