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.

(cherry picked from commit bad446e251405dc250c3cbee199072e083a1e4b9)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
h264: fix ff_generate_sliding_window_mmcos() prototype.

It's been returning an error value since
bad446e251405dc250c3cbee199072e083a1e4b9

Also check for the errors it returns.
(cherry picked from commit ea382767ad2191acbe97e90624059723e15f0e4b)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
h264: add 3 pixels below for subpixel filter wait position

If the motion vector is at a subpixel position, we need 3 pixels below
the motion vector's wholepel position available, not 2, since the MC
filter is a sixtap filter for the hpel position, and then a bilin filter
for the qpel position.

This patch fixes highly irreproducible (0.1%) fate failures in frame 2
and 4 of h264-conformance-cama2_vtc_b (e.g. first P-frame, first field,
last line of MB x=40,y=2 and second field and last lines of MBs x=39-40,
y=3). These used pre-loopfilter instead of post-loopfilter data because
the await_progress() waited for one line too little in that field, and
the motion vector of these particular MBs happened to align exactly to a
position where that demonstrates the bug.

CC: libav-stable@libav.org

(cherry picked from commit fb845ffdd335a1efd6dfd43e8adeb530397b348e)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
theora: Skip zero-sized headers

This fixes a regression since d9cf5f51/7a2ee770f5 with theora
over RTP (possibly with other variants of theora as well).

In theora over RTP, the second of the 3 headers turns out to be
0 bytes long, which prior to d9cf5f51 worked just fine. After
d9cf5f51, reading from the bitstream reader fails (since the reader
wasn't initialized but returned an error if initialized with 0 bits).

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit e33db35b4a91ad543d9dde3a981a89118ba68937)

Signed-off-by: Martin Storsjö <martin@martin.st>
libcdio: support recent cdio-paranoia

Upstream decided to split the paranoia interface and move the headers
accordingly.
(cherry picked from commit 57224e425c567a87798b66425acc383c6dd37331)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
rv30: fix masking in rv30_loop_filter()

The mask `x && (1 << y)' is incorrect and always yields true.

The correct form should be `x & (1 << y)'.

CC: libav-stable@libav.org

Signed-off-by: Xi Wang <xi.wang@gmail.com>
(cherry picked from commit 783e37f7ef3b3cdcfe7aa927a25b4184ae46cd53)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
fate: update ref after rv30_loop_filter fix

(cherry picked from commit 56ef1ef1f7580f41d6819ac63081a02f52752903)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
mpeg12: Support decoding dimensions that are a multiple of 4096

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
mpeg12enc: Correctly mask dimensions

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
mpeg12enc: check dimension validity

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
swr: fix handling of timestamps that cause multiple drops or silence injections

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d676598f879ba01ddb62f9abe8e17b2e94cb91cd)
doc/examples: fix assignments in if()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 48a7981e6f93a27c9caca99d0bfb39e6244606a5)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
aacenc: Fix assignments in if()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 98fed59427cec17ce55ac137e7e250cff7db81cf)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libfaac: Fix assignments in if()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 68a25c64cda16e12ef3a051ff8661c71ef574683)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libfdk-aacenc: Fix assignments in if()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 9302ad1ac89d5443505cf0418f9d62786513032e)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libmp3lame: Fix assignments in if()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 871b6ec01d27a74702b7cf1d61446709de037948)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libopencore-amr: Fix assignments in if()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d6180aa29741334cf69f691b27ffceb33f49d36a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libspeexenc: Fix assignments in if()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3b8d66d5317d91288751869206b3acbb84dc44c7)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libvo-aacenc: Fix assignments in if()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 0ccb31dcad5a1543fbb284d66b0410b91ebd171d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libvorbisenc: Fix assignments in if()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit bdd71abe5f34ca37612e17d912060f4dc9b94796)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>