mpeg12: Ignore slice threading if hwaccel is active

Slice threading does not work with hardware acceleration, as decoding
is per-picture.  This fixes Bugzilla #542.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
(cherry picked from commit 93a51984a27f3ba84d4e6f13d0c704ee9891603e)

Conflicts:
	libavcodec/mpeg12dec.c
avformat/dtsdec: Improve probe, reject things looking like analoge signals

Fixes Ticket2810

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6663205338f57eedb2392263dde48e2717c6e980)
jpeg2000: Initialize only once mqc arrays

Increases encoding and decoding speed

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit dd1382ac9534bd9b5ec7833eed9ab6f383e68a50)
jpeg2000: fix overflow in dequantization

Fixes decoding of file generated with:
ffmpeg -f lavfi -i smptehdbars=hd720 -pix_fmt rgb48 /tmp/o.jp2

Reviewed-by: Nicolas BERTRAND <nicoinattendu@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f57119b8e58cb5437c3ab40d797293ecb9b4a894)
Fix pix_fmt detection in the native jpeg2000 decoder.

Based on b7a928b by Michael Bradshaw.
Fixes ticket #2683.

Reviewed-by: Nicolas Bertrand
(cherry picked from commit b39a6bbe7f43710d8e7163757c5aeef596878712)
jpeg2000dec: parse CDEF

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

Conflicts:

	libavcodec/jpeg2000dec.c

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 99de97cabf35c035b628943b865ab991583a6ea5)
jpeg2000dec: Support non subsampled 8bit planar pixel formats

Fixes file2.jp2

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit fc6de70c44be05eb0368ab519bfb790431d8dee5)
jpeg2000dec: silence unused variable warning

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit db33010483a024f1343bfb516415fe9ef77e82d9)
jpeg2000dec: Support non subsampled 9-16bit planar pixel formats

This applies changes similar to fc6de70c44be05eb0368ab519bfb790431d8dee5
to the >8bit codepath

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 1434df3b93fde086be729d174ffbbee1e25792b3)
Revert "pnm: remove nonsense code"

Breaks decoding pgms with 255 < maxval < 65535.

Found-by: Carl Eugen Hoyos <cehoyos@ag.or.at>.

This reverts commit a0348d0966a81a66f3a1bf061576b24d5296b933.
(cherry picked from commit 768e40b451a459fefaceed6b1b3d6e70c93596ac)
avcodec/kmvc: fix MV checks

Fixes Ticket2813
Fixes regression since 70b5583

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3cd8aaa2b2e78faf039691e1c31ff4f8d94e3bc6)
avfilter: fix plane validity checks

Fixes out of array accesses

(cherry picked from commit e43a0a232dbf6d3c161823c2e07c52e76227a1bc)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avutil/mem: Fix flipped condition

Fixes return code and later null pointer dereference

Found-by: Laurent Butti <laurentb@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c94f9e854228e0ea00e1de8769d8d3f7cab84a55)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avformat/paf: Fix integer overflow and out of array read

Found-by:  Laurent Butti <laurentb@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f58cd2867a8af2eed13acdd21d067b48249b14a1)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avfilter/vf_separatefields: fix ;;

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
lavf/matroskaenc: Check for valid metadata before creating tags

Tags must have at least one SimpleTag element to be spec conformant.
Updated lavf-mkv and seek-lavf-mkv FATE references as the tests were affected by
this.

Fixes ticket #2785

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 088ed5314694031e07e02e9d364c9d486a60e704)
matroskaenc: simplify mkv_check_tag()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 066111bf19518a9f4d836991b34dbfc5ab72a41a)
ttaenc: fix packet size

Signed-off-by: Paul B Mahol <onemda@gmail.com>
(cherry picked from commit bc2187cfdb5eeb82e3caf42a81a00d1ee4c16d8e)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
sgidec: safer check for buffer overflow

Signed-off-by: Paul B Mahol <onemda@gmail.com>
(cherry picked from commit 86e722ab97d7f5f0552c8a0958f7910dfcf3c5b7)

Conflicts:

	libavcodec/sgidec.c

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

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

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