Prepare for 10.1 Release
golomb: Fix the implementation of get_se_golomb_long

This was only used in hevc muxing code so far.

This makes the return values match what get_se_golomb returns for
the same bitstream reader instances.

The logic for producing a signed golomb code out of an unsigned one
was based on the corresponding code in get_se_golomb, which operated
directly on the bitstream reader buffer - not on the equivalent
return value from get_ue_golomb.

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 508a84e6726ab94a740c160b30fd8162265d1fef)
Signed-off-by: Martin Storsjö <martin@martin.st>
Merge commit 'a014b9614e6165fb8df9e756f46a95d516794678' into release/2.2

* commit 'a014b9614e6165fb8df9e756f46a95d516794678':
  Prepare for 10.1 Release

Conflicts:
	RELEASE

Merged-by: Michael Niedermayer <michaelni@gmx.at>
Merge commit 'e0aa76d38a02090245284fc157afb9074e9ff073' into release/2.2

* commit 'e0aa76d38a02090245284fc157afb9074e9ff073':
  golomb: Fix the implementation of get_se_golomb_long

Merged-by: Michael Niedermayer <michaelni@gmx.at>
avcodec/libx264: move where x264opts is applied down so it isnt overridden by avctx & defaults

fixes x264opts opengop=1

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

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

Fixes segfault
Fixes Ticket3469

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avcodec/h264: clear cur_pic structure instead of duplicating it in ff_h264_update_thread_context()

Fixes crash

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

Conflicts:

	libavcodec/h264_slice.c
lavu/opt: validate range before dereference

This change make error handling simplier.
av_opt_freep_ranges may be called when some ranges are NULL,
for example after memory allocation fail.

Signed-off-by: Lukasz Marek <lukasz.m.luki@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3aac5fcfa9d3748659d78ab2a66d0ccce22cfd4f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avcodec/wma: use av_freep(), do not leave stale pointers in memory

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avformat/omadec: fix probetest failure

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
examples/avio_reading: fix null dereference on error

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avcodec/pthread_frame: fix missing unlock on error

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avcodec/msrle: check return code for success before use

The check is possibly redundant, but better to check for errors
that dont occur than to skip the check and crash

Fixes CID1197060

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
swresample/resample: Limit filter length

Related to CID1197063

The limit choosen is arbitrary and much larger than what makes sense.
It avoids the need for checking arithmetic operations with the length for overflow

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
swresample/dither: use av_malloc_array()

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
swresample/resample: use av_malloc_array() where appropriate

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
swscale/x86/swscale_template: loose hardcoded dstw_offset

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avcodec/dirac_arith: Fix build with PIC and stack-check options

Fixes Ticket3540

The function dirac_get_arith_bit in libavcodec/dirac_arith.h can't be
built with PIC and check-stack because the asm code needs 6 registers
and PIC and check-stack options take 1 each and x86 is quite limited
in this area.

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

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