ffmpeg.git
3 years agolavd/opengl_enc: Support BGR48.
Carl Eugen Hoyos [Tue, 21 Feb 2017 01:06:06 +0000 (02:06 +0100)]
lavd/opengl_enc: Support BGR48.

3 years agoavcodec/qdrw: add support for 2bpp and 4bpp packed pallette format
Paul B Mahol [Tue, 21 Feb 2017 18:45:44 +0000 (19:45 +0100)]
avcodec/qdrw: add support for 2bpp and 4bpp packed pallette format

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agoavcodec/qdrw: fix writing past end of row
Paul B Mahol [Tue, 21 Feb 2017 18:16:35 +0000 (19:16 +0100)]
avcodec/qdrw: fix writing past end of row

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agoavcodec/ituh263dec: Fix runtime error: left shift of negative value -22
Michael Niedermayer [Tue, 21 Feb 2017 16:32:56 +0000 (17:32 +0100)]
avcodec/ituh263dec: Fix runtime error: left shift of negative value -22

Fixes: 639/clusterfuzz-testcase-5143866241974272

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/gsmdec_template: Fix runtime error: signed integer overflow: -22527 * 99113...
Michael Niedermayer [Tue, 21 Feb 2017 15:38:00 +0000 (16:38 +0100)]
avcodec/gsmdec_template: Fix runtime error: signed integer overflow: -22527 * 99113 cannot be represented in type 'int'

Fixes: 636/clusterfuzz-testcase-6520876646268928
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/bmp: Fix runtime error: negation of -2147483648 cannot be represented in...
Michael Niedermayer [Tue, 21 Feb 2017 15:22:47 +0000 (16:22 +0100)]
avcodec/bmp: Fix runtime error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself

There is code checking height and width later, leaving an invalid value invalid
is thus fine.

Fixes: 635/clusterfuzz-testcase-6225161437052928
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/sierravmd: Support for Shivers 2 stereo tracks
Nicolas Roy-Renaud [Sat, 18 Feb 2017 03:50:11 +0000 (22:50 -0500)]
avformat/sierravmd: Support for Shivers 2 stereo tracks

Signed-off-by: Nicolas Roy-Renaud <nicolas.roy-renaud.1@ens.etsmtl.ca>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agolavfi/buffersrc: fix directly setting channel layout
Rostislav Pehlivanov [Tue, 21 Feb 2017 06:51:46 +0000 (06:51 +0000)]
lavfi/buffersrc: fix directly setting channel layout

When setting the channel layout directly using AVBufferSrcParameters
the channel layout was correctly set however the init function still
expected the old string format to set the number of channels (when it
hadn't already been specified).

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
3 years agoavformat/hlsenc: fix cid 1401346 Dereferencing pointer error
Steven Liu [Tue, 21 Feb 2017 15:38:39 +0000 (23:38 +0800)]
avformat/hlsenc: fix cid 1401346  Dereferencing pointer error

check if proto is null before av_strcasecmp
CID:  1401346

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
3 years agoavcodec/h264_ps: Check delta scale for validity
Michael Niedermayer [Tue, 21 Feb 2017 02:51:17 +0000 (03:51 +0100)]
avcodec/h264_ps: Check delta scale for validity

Fixes: signed integer overflow: 5 + 2147483646 cannot be represented in type 'int'
Fixes: 634/clusterfuzz-testcase-5285420445204480

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/simple_idct: Fix runtime error: left shift of negative value -6395
Michael Niedermayer [Tue, 21 Feb 2017 02:14:49 +0000 (03:14 +0100)]
avcodec/simple_idct: Fix runtime error: left shift of negative value -6395

Fixes: 633/clusterfuzz-testcase-4553133554401280

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/rv40: Fix runtime error: left shift of negative value
Michael Niedermayer [Tue, 21 Feb 2017 02:05:32 +0000 (03:05 +0100)]
avcodec/rv40: Fix runtime error: left shift of negative value

Fixes: 630/clusterfuzz-testcase-6608718928019456

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/qdrw: add support for decoding rgb555
Paul B Mahol [Tue, 21 Feb 2017 11:17:21 +0000 (12:17 +0100)]
avcodec/qdrw: add support for decoding rgb555

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agoavformat/mpl2dec: skip BOM when probing
Paul B Mahol [Sat, 11 Feb 2017 10:47:22 +0000 (11:47 +0100)]
avformat/mpl2dec: skip BOM when probing

Fixes #5442.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agolavf/mpeg: Initialize a stack variable used by memcmp().
Carl Eugen Hoyos [Sun, 19 Feb 2017 15:15:34 +0000 (16:15 +0100)]
lavf/mpeg: Initialize a stack variable used by memcmp().

Silence a valgrind warning.

Fixes ticket #6160.

3 years agoavcodec/dca_xll: Fix runtime error: signed integer overflow: -1073741824 * 32768...
Michael Niedermayer [Mon, 20 Feb 2017 23:11:19 +0000 (00:11 +0100)]
avcodec/dca_xll: Fix runtime error: signed integer overflow: -1073741824 * 32768 cannot be represented in type 'int'

Fixes: 629/clusterfuzz-testcase-6697457381539840

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/flacdec: reduce limit for golomb so that the max value does not overflow
Michael Niedermayer [Mon, 20 Feb 2017 22:59:26 +0000 (23:59 +0100)]
avcodec/flacdec: reduce limit for golomb so that the max value does not overflow

Fixes: runtime error: left shift of 32 by 26 places cannot be represented in type 'int'

Fixes: 628/clusterfuzz-testcase-6187747641393152
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/dca_xll: signed integer overflow: 255251 * 32768 cannot be represented in...
Michael Niedermayer [Mon, 20 Feb 2017 19:22:26 +0000 (20:22 +0100)]
avcodec/dca_xll: signed integer overflow: 255251 * 32768 cannot be represented in type 'int'

Fixes: 627/clusterfuzz-testcase-5020897033322496
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoFactorize CHECK/SUINT code
Michael Niedermayer [Mon, 20 Feb 2017 18:34:54 +0000 (19:34 +0100)]
Factorize CHECK/SUINT code

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agospeedhq: fix decoding artifacts
Steinar H. Gunderson [Sat, 18 Feb 2017 18:41:02 +0000 (19:41 +0100)]
speedhq: fix decoding artifacts

The quantization table is stored in the natural order, but when we
access it, we use an index that's in zigzag order, causing us to read
the wrong value. This causes artifacts, especially in areas with
horizontal or vertical edges. The artifacts look a lot like the
DCT ringing artifacts you'd expect to see from a low-bitrate file,
but when comparing to NewTek's own decoder, it's obvious they're not
supposed to be there.

Fix by simply storing the scaled quantization table in zigzag order.
Performance is unchanged.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agofate/source: Check for cases that could use av_clip_uintp2() and av_clip_intp2()
Michael Niedermayer [Fri, 17 Feb 2017 00:59:08 +0000 (01:59 +0100)]
fate/source: Check for cases that could use av_clip_uintp2() and av_clip_intp2()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/nvenc: allow forcing keyframes by default
Timo Rothenpieler [Mon, 20 Feb 2017 21:38:39 +0000 (22:38 +0100)]
avcodec/nvenc: allow forcing keyframes by default

3 years agolavf/mov.c: Correct keyframe search in edit list to return the very first keyframe...
Sasi Inguva [Wed, 15 Feb 2017 20:07:55 +0000 (12:07 -0800)]
lavf/mov.c: Correct keyframe search in edit list to return the very first keyframe/frame with matching timestamp. Fixes ticket#5904

Signed-off-by: Sasi Inguva <isasi@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/mpegaudiodec: Eliminate many undefined operations
Michael Niedermayer [Mon, 20 Feb 2017 12:42:33 +0000 (13:42 +0100)]
avcodec/mpegaudiodec: Eliminate many undefined operations

Fixes: 625/clusterfuzz-testcase-4574924406521856
Fixes: 626/clusterfuzz-testcase-4738718621499392

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/pictordec: Do not read more than nb_planes
Michael Niedermayer [Mon, 20 Feb 2017 11:31:43 +0000 (12:31 +0100)]
avcodec/pictordec: Do not read more than nb_planes

Fixes undefined behavior
Fixes: 622/clusterfuzz-testcase-5745722022428672

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavfilter/af_atempo: fix drift calculation, ticket #6157
Pavel Koshevoy [Mon, 20 Feb 2017 02:51:28 +0000 (10:51 +0800)]
avfilter/af_atempo: fix drift calculation, ticket #6157

ticket #6157

Reported-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Pavel Koshevoy <pkoshevoy@gmail.com>
3 years agoavcodec/ituh263dec: Check cbpy in ff_h263_decode_mb()
Michael Niedermayer [Sun, 19 Feb 2017 23:49:03 +0000 (00:49 +0100)]
avcodec/ituh263dec: Check cbpy in ff_h263_decode_mb()

Fixes: 618/clusterfuzz-testcase-6594990333493248

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/srtdec: Fix signed integer overflow: 1811992524 * 384 cannot be represented...
Michael Niedermayer [Sun, 19 Feb 2017 22:37:53 +0000 (23:37 +0100)]
avcodec/srtdec: Fix signed integer overflow: 1811992524 * 384 cannot be represented in type 'int'

Fixes: 617/clusterfuzz-testcase-6413875723370496

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/h264_ps: Fix runtime error: signed integer overflow: -1094995528 * 2 cannot...
Michael Niedermayer [Sun, 19 Feb 2017 21:54:30 +0000 (22:54 +0100)]
avcodec/h264_ps: Fix runtime error: signed integer overflow: -1094995528 * 2 cannot be represented in type 'int'

Fixes: 615/clusterfuzz-testcase-5488002644049920
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/h264_cabac: runtime error: signed integer overflow: 2147483647 + 14 cannot...
Michael Niedermayer [Sun, 19 Feb 2017 21:40:29 +0000 (22:40 +0100)]
avcodec/h264_cabac: runtime error: signed integer overflow: 2147483647 + 14 cannot be represented in type 'int'

Fixes: 614/clusterfuzz-testcase-4931860079575040

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/mpeg4videodec: Fix runtime error: shift exponent -2 is negative
Michael Niedermayer [Sun, 19 Feb 2017 20:33:27 +0000 (21:33 +0100)]
avcodec/mpeg4videodec: Fix runtime error: shift exponent -2 is negative

Fixes: 612/clusterfuzz-testcase-4707817137111040

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/mjpegdec: Fix runtime error: left shift of negative value -507
Michael Niedermayer [Sun, 19 Feb 2017 19:39:13 +0000 (20:39 +0100)]
avcodec/mjpegdec: Fix runtime error: left shift of negative value -507

Fixes: 611/clusterfuzz-testcase-5613455820193792

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/eac3dec: Fix runtime error: left shift of negative value
Michael Niedermayer [Sun, 19 Feb 2017 19:32:48 +0000 (20:32 +0100)]
avcodec/eac3dec: Fix runtime error: left shift of negative value

Fixes: 610/clusterfuzz-testcase-4831030085156864

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoopus_pvq: fix PVQ search for K < 5 and low Ns
Rostislav Pehlivanov [Sun, 19 Feb 2017 18:20:39 +0000 (18:20 +0000)]
opus_pvq: fix PVQ search for K < 5 and low Ns

If the PVQ search picked a place to increment/decrement on the y[]
vector which had no pulse then it would cause a desync since it would
change the sum in the wrong direction. Fix this by not considering
places without pulses as viable.

This makes the PVQ search slightly worse at K < 5 which isn't all that
common. Still, this is a workaround to prevent making broken files until
I can think of a better way of fixing it.

Also add an assertion, which can be removed or moved to assert1/2 once
the PVQ search is stable.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
3 years agoavcodec/pngdec: Check bit depth for validity
Michael Niedermayer [Sun, 19 Feb 2017 18:12:25 +0000 (19:12 +0100)]
avcodec/pngdec: Check bit depth for validity

Fixes: runtime error: shift exponent 132 is too large for 32-bit type 'int'
Fixes: 609/clusterfuzz-testcase-4825202619842560

See 11.2.2 IHDR Image header

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/mpeg12dec: Fix runtime error: left shift of negative value
Michael Niedermayer [Sun, 19 Feb 2017 17:47:13 +0000 (18:47 +0100)]
avcodec/mpeg12dec: Fix runtime error: left shift of negative value

Fixes: 608/clusterfuzz-testcase-603978286392934

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavfilter/f_setcmd: fix null pointer dereference on using dash as interval
Marton Balint [Wed, 8 Feb 2017 23:03:21 +0000 (00:03 +0100)]
avfilter/f_setcmd: fix null pointer dereference on using dash as interval

Fixes Coverity CID 1396259.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavdevice/iec61883: free packet on buffer allocation error
Marton Balint [Wed, 8 Feb 2017 22:37:42 +0000 (23:37 +0100)]
avdevice/iec61883: free packet on buffer allocation error

Fixes Coverity CID 1396416.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavformat/fifo: assert on disallowed message type and state combinations
Marton Balint [Wed, 8 Feb 2017 22:28:21 +0000 (23:28 +0100)]
avformat/fifo: assert on disallowed message type and state combinations

Fixes Coverity CID 1396277.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavcodec/huffyuvencdsp: use an actual unsigned long constant
James Almer [Mon, 6 Feb 2017 22:57:53 +0000 (19:57 -0300)]
avcodec/huffyuvencdsp: use an actual unsigned long constant

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/huffyuvdsp: use an actual unsigned long constant
James Almer [Mon, 6 Feb 2017 22:57:30 +0000 (19:57 -0300)]
avcodec/huffyuvdsp: use an actual unsigned long constant

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/wavpacl: Fix runtime error: left shift of negative value -1
Michael Niedermayer [Sun, 19 Feb 2017 14:09:34 +0000 (15:09 +0100)]
avcodec/wavpacl: Fix runtime error: left shift of negative value -1

Fixes: 607/clusterfuzz-testcase-5108792465293312

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/flac: Fix several integer overflows
Michael Niedermayer [Sun, 19 Feb 2017 13:34:55 +0000 (14:34 +0100)]
avcodec/flac: Fix several integer overflows

Fixes: 686513-media
Found-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoFactor CHECKED out of DEBUG so it can be set seperatly
Michael Niedermayer [Sun, 19 Feb 2017 11:49:45 +0000 (12:49 +0100)]
Factor CHECKED out of DEBUG so it can be set seperatly

Suggested-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/pngdec: Store metadata directly into AVFrame
Michael Niedermayer [Thu, 2 Feb 2017 20:48:05 +0000 (21:48 +0100)]
avcodec/pngdec: Store metadata directly into AVFrame

Fixes memleak
Fixes: 500/clusterfuzz-testcase-6315221727576064

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/utils: Also fill dts==RELATIVE_TS_BASE packets in update_initial_durations()
Michael Niedermayer [Sat, 18 Feb 2017 23:31:09 +0000 (00:31 +0100)]
avformat/utils: Also fill dts==RELATIVE_TS_BASE packets in update_initial_durations()

This dts value can end up in the list in the absence of durations and is in that
case semantically identical to AV_NOPTS_VALUE. We can alternatively prevent
storing RELATIVE_TS_BASE if there is no duration.

Fixes Ticket3640

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/mpeg12dec: Provide debug level log on skiped P/B frames
Michael Niedermayer [Sat, 18 Feb 2017 18:03:39 +0000 (19:03 +0100)]
avcodec/mpeg12dec: Provide debug level log on skiped P/B frames

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/h264: sse2, avx h luma mbaff deblock/loop filter
James Darnley [Fri, 10 Feb 2017 22:17:57 +0000 (23:17 +0100)]
avcodec/h264: sse2, avx h luma mbaff deblock/loop filter

x86-64 only

Yorkfield:
- sse2: ~2.17x (434 vs. 200 cycles)

Nehalem:
- sse2: ~2.94x (409 vs. 139 cycles)

Skylake:
- sse2: ~3.10x (370 vs. 119 cycles)
- avx:  ~3.29x (370 vs. 112 cycles)

3 years agox86util: import MOVHL macro
James Darnley [Sat, 11 Feb 2017 12:25:09 +0000 (13:25 +0100)]
x86util: import MOVHL macro

Originally committed to x264 in 1637239a by Henrik Gramner who has
agreed to re-license it as LGPL.  Original commit message follows.

    x86: Avoid some bypass delays and false dependencies

    A bypass delay of 1-3 clock cycles may occur on some CPUs when transitioning
    between int and float domains, so try to avoid that if possible.

3 years agoavcodec/h264: add named parameters to x86 function
James Darnley [Fri, 10 Feb 2017 19:13:50 +0000 (20:13 +0100)]
avcodec/h264: add named parameters to x86 function

3 years agoavcodec/x86: deduplicate PASS8ROWS macro
James Darnley [Thu, 9 Feb 2017 21:06:17 +0000 (22:06 +0100)]
avcodec/x86: deduplicate PASS8ROWS macro

3 years agotests/fate/hevc: remove vsync drop from where it is not needed anymore
Michael Niedermayer [Sat, 18 Feb 2017 15:29:14 +0000 (16:29 +0100)]
tests/fate/hevc: remove vsync drop from where it is not needed anymore

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/cuvid: add drop_second_field as input option
Miroslav Slugeň [Sun, 12 Feb 2017 20:22:46 +0000 (21:22 +0100)]
avcodec/cuvid: add drop_second_field as input option

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
3 years agoavcodec/cuvid: don't overwrite deinterlace at progressive input
Miroslav Slugeň [Sun, 12 Feb 2017 17:47:07 +0000 (18:47 +0100)]
avcodec/cuvid: don't overwrite deinterlace at progressive input

If there is progressive input it will disable deinterlacing in cuvid for
all future frames even those interlaced.

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
3 years agoavformat/m4vdec: Detect raw mpeg4video with unidentified non mpeg headers with a...
Michael Niedermayer [Sat, 18 Feb 2017 02:31:14 +0000 (03:31 +0100)]
avformat/m4vdec: Detect raw mpeg4video with unidentified non mpeg headers with a very low score

Fixes Ticket 6018

This fixes a regression, and allows playback of files containing mpeg4video that are otherwise
not supported

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/hlsenc: set default http method to PUT when method is null
Steven Liu [Sat, 18 Feb 2017 01:42:51 +0000 (09:42 +0800)]
avformat/hlsenc: set default http method to PUT when method is null

When the http method is not set, the method will use POST for ts,
PUT for m3u8, it is not unify, now set it unify.
This ticket id: #5315

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Reviewed-by: Moritz Barsnick <barsnick@gmx.net>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
3 years agoopusenc: initialize the emphasis coefficients on init
Rostislav Pehlivanov [Sat, 18 Feb 2017 01:11:58 +0000 (01:11 +0000)]
opusenc: initialize the emphasis coefficients on init

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
3 years agolavf/riff: Support decoding files with broken mediasubtype base guid.
Thierry Foucu [Thu, 16 Feb 2017 13:03:38 +0000 (14:03 +0100)]
lavf/riff: Support decoding files with broken mediasubtype base guid.

Fixes ticket #6100.

3 years agoavcodec/opus: Check count of ambisonic channels
Michael Niedermayer [Fri, 17 Feb 2017 10:18:30 +0000 (11:18 +0100)]
avcodec/opus: Check count of ambisonic channels

https://tools.ietf.org/html/draft-ietf-codec-ambisonics-01#section-3.1
specifies the maximum as 227

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agolibopus: decode ambisonics with non-diegetic sources
Felicia [Mon, 6 Feb 2017 23:49:36 +0000 (15:49 -0800)]
libopus: decode ambisonics with non-diegetic sources

Channel mapping 2 additionally supports a non-diegetic stereo track
appended to the end of a full-order ambisonics signal, such that the
total channel count is either
  (n + 1) ^ 2, or
  (n + 1) ^ 2 + 2
where n is the ambisonics order

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/fmvc: fix decoding of odd size videos
Paul B Mahol [Fri, 17 Feb 2017 09:46:52 +0000 (10:46 +0100)]
avcodec/fmvc: fix decoding of odd size videos

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agolavc/avpacket: Initialize a variable in error path.
Carl Eugen Hoyos [Thu, 16 Feb 2017 23:46:14 +0000 (00:46 +0100)]
lavc/avpacket: Initialize a variable in error path.

Fixes ticket #6153.

Tested-by: Tyson Smith
3 years agowmaprodec: fix leaking fdsp on init failure
Andreas Cadhalpun [Wed, 15 Feb 2017 23:54:31 +0000 (00:54 +0100)]
wmaprodec: fix leaking fdsp on init failure

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
3 years agompegaudiodec_template: fix leaking fdsp for mp3on4float
Andreas Cadhalpun [Wed, 15 Feb 2017 23:37:51 +0000 (00:37 +0100)]
mpegaudiodec_template: fix leaking fdsp for mp3on4float

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
3 years agovaapi_vp8: Use VP8_MAX_QUANT instead of magic number
Mark Thompson [Thu, 16 Feb 2017 20:40:55 +0000 (20:40 +0000)]
vaapi_vp8: Use VP8_MAX_QUANT instead of magic number

3 years agodoc: correct order of options for channelmap filter
Mulvya [Thu, 16 Feb 2017 18:57:32 +0000 (00:27 +0530)]
doc: correct order of options for channelmap filter

Signed-off-by: Mulvya <mulvya@gmail.com>
3 years agoChangelog: add entry for the native Opus encoder
Rostislav Pehlivanov [Thu, 16 Feb 2017 16:28:10 +0000 (16:28 +0000)]
Changelog: add entry for the native Opus encoder

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
3 years agoavcodec/opusenc: Add () protecting macro arguments
Michael Niedermayer [Thu, 16 Feb 2017 12:24:11 +0000 (13:24 +0100)]
avcodec/opusenc: Add () protecting macro arguments

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/error_resilience: Fix "assignment from incompatible pointer type" warning
Michael Niedermayer [Thu, 16 Feb 2017 11:28:42 +0000 (12:28 +0100)]
avcodec/error_resilience: Fix "assignment from incompatible pointer type" warning

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agolavc/vda_h264_dec.c Fix NULL pointer dereference
Pavel Koshevoy [Fri, 10 Feb 2017 03:20:14 +0000 (20:20 -0700)]
lavc/vda_h264_dec.c Fix NULL pointer dereference

ps.sps_list entries may be NULL, so check before dereferencing

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoswr/aarch64: add missing ret to ff_resample_common_apply_filter_x8_float_neon
Matthieu Bouron [Thu, 16 Feb 2017 10:50:58 +0000 (11:50 +0100)]
swr/aarch64: add missing ret to ff_resample_common_apply_filter_x8_float_neon

3 years agoconfigure: add missing mdct15 dependency
James Almer [Thu, 16 Feb 2017 04:17:06 +0000 (01:17 -0300)]
configure: add missing mdct15 dependency

3 years agoconfigure: remove unnecessary opus encoder dependency
James Almer [Thu, 16 Feb 2017 04:15:59 +0000 (01:15 -0300)]
configure: remove unnecessary opus encoder dependency

audiodsp is not used by the encoder.

3 years agoopusenc: fix coarse energy quantization with 2 bits left
Rostislav Pehlivanov [Wed, 15 Feb 2017 22:51:37 +0000 (22:51 +0000)]
opusenc: fix coarse energy quantization with 2 bits left

Fixes CID1400584

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
3 years agoopus_pvq: fix uninitialized variable usage
Rostislav Pehlivanov [Wed, 15 Feb 2017 21:11:41 +0000 (21:11 +0000)]
opus_pvq: fix uninitialized variable usage

Fixes CID1400586

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
3 years agodoc: correct table end for metadata filter
Mulvya [Wed, 15 Feb 2017 19:02:27 +0000 (00:32 +0530)]
doc: correct table end for metadata filter

Signed-off-by: Mulvya <mulvya@gmail.com>
3 years agoadpcm: fix clipping for yamaha
Paul B Mahol [Wed, 15 Feb 2017 11:36:24 +0000 (12:36 +0100)]
adpcm: fix clipping for yamaha

According to specification max value allowed is 0x6000.
Fixes #5862.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agoavcodec/h264_sei: Check actual presence of SEI picture timing instead of implying it
Michael Niedermayer [Tue, 14 Feb 2017 22:45:01 +0000 (23:45 +0100)]
avcodec/h264_sei: Check actual presence of SEI picture timing instead of implying it

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/dashenc: Only use temporary files when outputting to file protocol
Thomas Stephens [Tue, 7 Feb 2017 20:20:32 +0000 (14:20 -0600)]
avformat/dashenc: Only use temporary files when outputting to file protocol

Skips using temporary files when outputting to a protocol other than
"file", which enables dash to output content over network
protocols. The logic has been copied from the HLS format.

Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/hevc_parser: export framerate, remove one dependency on the decoder
Michael Niedermayer [Tue, 14 Feb 2017 15:33:53 +0000 (16:33 +0100)]
avcodec/hevc_parser: export framerate, remove one dependency on the decoder

Fixes Ticket6090

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoHTTP: improve performance by reducing forward seeks
Joel Cunningham [Mon, 30 Jan 2017 16:00:44 +0000 (10:00 -0600)]
HTTP: improve performance by reducing forward seeks

This commit optimizes HTTP performance by reducing forward seeks, instead
favoring a read-ahead and discard on the current connection (referred to
as a short seek) for seeks that are within a TCP window's worth of data.
This improves performance because with TCP flow control, a window's worth
of data will be in the local socket buffer already or in-flight from the
sender once congestion control on the sender is fully utilizing the window.

Note: this approach doesn't attempt to differentiate from a newly opened
connection which may not be fully utilizing the window due to congestion
control vs one that is. The receiver can't get at this information, so we
assume worst case; that full window is in use (we did advertise it after all)
and that data could be in-flight

The previous behavior of closing the connection, then opening a new
with a new HTTP range value results in a massive amounts of discarded
and re-sent data when large TCP windows are used.  This has been observed
on MacOS/iOS which starts with an initial window of 256KB and grows up to
1MB depending on the bandwidth-product delay.

When seeking within a window's worth of data and we close the connection,
then open a new one within the same window's worth of data, we discard
from the current offset till the end of the window.  Then on the new
connection the server ends up re-sending the previous data from new
offset till the end of old window.

Example (assumes full window utilization):

TCP window size: 64KB
Position: 32KB
Forward seek position: 40KB

      *                      (Next window)
32KB |--------------| 96KB |---------------| 160KB
        *
  40KB |---------------| 104KB

Re-sent amount: 96KB - 40KB = 56KB

For a real world test example, I have MP4 file of ~25MB, which ffplay
only reads ~16MB and performs 177 seeks. With current ffmpeg, this results
in 177 HTTP GETs and ~73MB worth of TCP data communication.  With this
patch, ffmpeg issues 4 HTTP GETs and 3 seeks for a total of ~22MB of TCP data
communication.

To support this feature, the short seek logic in avio_seek() has been
extended to call a function to get the short seek threshold value.  This
callback has been plumbed to the URLProtocol structure, which now has
infrastructure in HTTP and TCP to get the underlying receiver window size
via SO_RCVBUF.  If the underlying URL and protocol don't support returning
a short seek threshold, the default s->short_seek_threshold is used

This feature has been tested on Windows 7 and MacOS/iOS.  Windows support
is slightly complicated by the fact that when TCP window auto-tuning is
enabled, SO_RCVBUF doesn't report the real window size, but it does if
SO_RCVBUF was manually set (disabling auto-tuning). So we can only use
this optimization on Windows in the later case

Signed-off-by: Joel Cunningham <joel.cunningham@me.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/cuvid: add format mismatch debug logs
Timo Rothenpieler [Thu, 9 Feb 2017 21:19:59 +0000 (22:19 +0100)]
avcodec/cuvid: add format mismatch debug logs

3 years agoavcodec/cuvid: set width and height before calling get_format
Timo Rothenpieler [Tue, 14 Feb 2017 10:47:08 +0000 (11:47 +0100)]
avcodec/cuvid: set width and height before calling get_format

The external hw_frames_ctx is initialized in that callback, and needs
that information to be accurate.

3 years agoavcodec/cuvid: update hw_frames_ctx reference after get_format call
Timo Rothenpieler [Thu, 9 Feb 2017 21:29:47 +0000 (22:29 +0100)]
avcodec/cuvid: update hw_frames_ctx reference after get_format call

3 years agoavcodec/nvenc: push cuda context before encoding a frame
Timo Rothenpieler [Mon, 13 Feb 2017 21:59:46 +0000 (22:59 +0100)]
avcodec/nvenc: push cuda context before encoding a frame

Thanks to Miroslav Slugeň for figuring out what was going on here.

3 years agoMAINTAINERS: add myself as mdct/opus maintainer
Rostislav Pehlivanov [Sat, 11 Feb 2017 21:49:04 +0000 (21:49 +0000)]
MAINTAINERS: add myself as mdct/opus maintainer

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
3 years agodoc/encoders: add documentation for the Opus encoder
Rostislav Pehlivanov [Tue, 14 Feb 2017 06:14:15 +0000 (06:14 +0000)]
doc/encoders: add documentation for the Opus encoder

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
3 years agoopus: add a native Opus encoder
Rostislav Pehlivanov [Sat, 11 Feb 2017 00:25:08 +0000 (00:25 +0000)]
opus: add a native Opus encoder

This marks the first time anyone has written an Opus encoder without
using any libopus code. The aim of the encoder is to prove how far
the format can go by writing the craziest encoder for it.

Right now the encoder's basic, it only supports CBR encoding, however
internally every single feature the CELT layer has is implemented
(except the pitch pre-filter which needs to work well with the rest of
whatever gets implemented). Psychoacoustic and rate control systems are
under development.

The encoder takes in frames of 120 samples and depending on the value of
opus_delay the plan is to use the extra buffered frames as lookahead.
Right now the encoder will pick the nearest largest legal frame size and
won't use the lookahead, but that'll change once there's a
psychoacoustic system.

Even though its a pretty basic encoder its already outperforming
any other native encoder FFmpeg has by a huge amount.

The PVQ search algorithm is faster and more accurate than libopus's
algorithm so the encoder's performance is close to that of libopus
at zero complexity (libopus has more SIMD).
The algorithm might be ported to libopus or other codecs using PVQ in
the future.

The encoder still has a few minor bugs, like desyncs at ultra low
bitrates (below 9kbps with 20ms frames).

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
3 years agoopus_celt: rename structures to better names and reorganize them
Rostislav Pehlivanov [Sat, 11 Feb 2017 00:25:07 +0000 (00:25 +0000)]
opus_celt: rename structures to better names and reorganize them

This is meant to be applied on top of my previous patch which
split PVQ into celt_pvq.c and made opus_celt.h

Essentially nothing has been changed other than renaming CeltFrame
to CeltBlock (CeltFrame had absolutely nothing at all to do with
a frame) and CeltContext to CeltFrame.
3 variables have been put in CeltFrame as they make more sense
there rather than being passed around as arguments.
The coefficients have been moved to the CeltBlock structure
(why the hell were they in CeltContext and not in CeltFrame??).

Now the encoder would be able to use the exact context the decoder
uses (plus a couple of extra fields in there).

FATE passes, no slowdowns, etc.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
3 years agoopus_celt: move quantization and band decoding to opus_pvq.c
Rostislav Pehlivanov [Sat, 11 Feb 2017 00:25:06 +0000 (00:25 +0000)]
opus_celt: move quantization and band decoding to opus_pvq.c

A huge amount can be reused by the encoder, as the only thing
which needs to be done would be to add a 10 line celt_icwrsi,
a wrapper around it (celt_alg_quant) and templating the
ff_celt_decode_band to replace entropy decoding functions
with entropy encoding.

There is no performance loss but in fact a performance gain of
around 6% which is caused by the compiler being able to optimize
the decoding more efficiently.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
3 years agoimdct15: rename to mdct15 and add a forward transform
Rostislav Pehlivanov [Wed, 1 Feb 2017 03:13:06 +0000 (03:13 +0000)]
imdct15: rename to mdct15 and add a forward transform

Handles strides (needed for Opus transients), does pre-reindexing and folding
without needing a copy.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
3 years agoopus_rc: add entropy encoding functions
Rostislav Pehlivanov [Wed, 1 Feb 2017 03:13:05 +0000 (03:13 +0000)]
opus_rc: add entropy encoding functions

Mostly used the RFC document, the decoding functions and
the reference encoder's implmenentation as a reference.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
3 years agoavformat/http: Check for truncated buffers in http_connect()
Michael Niedermayer [Mon, 13 Feb 2017 11:47:49 +0000 (12:47 +0100)]
avformat/http: Check for truncated buffers in http_connect()

Reported-by: SleepProgger <security@gnutp.com>
Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agodoc/ffmpeg: document trailing "?" in map option
Lou Logan [Tue, 14 Feb 2017 00:26:43 +0000 (15:26 -0900)]
doc/ffmpeg: document trailing "?" in map option

This feature was added in 2375a85c36c4941042e6ee58a31d6560bde91d37.

Signed-off-by: Lou Logan <lou@lrcd.com>
3 years agolavc: Add device context field to AVCodecContext
Mark Thompson [Thu, 9 Feb 2017 00:23:36 +0000 (00:23 +0000)]
lavc: Add device context field to AVCodecContext

For use by codec implementations which can allocate frames internally.

3 years agoavfilter/vf_lut: make it possible to clip pixel values that are out of valid range
Paul B Mahol [Mon, 13 Feb 2017 21:49:41 +0000 (22:49 +0100)]
avfilter/vf_lut: make it possible to clip pixel values that are out of valid range

Previous behavior was not useful at all as such pixels where all mapped to 0.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agoavfilter/vf_lut: do not always explicitly clip pixels
Paul B Mahol [Mon, 13 Feb 2017 20:52:51 +0000 (21:52 +0100)]
avfilter/vf_lut: do not always explicitly clip pixels

Old behaviour was not useful at all. New behaviour only emulate
old behaviour with default options.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 years agodoc/protocols: add option usage description
Lou Logan [Mon, 13 Feb 2017 21:23:03 +0000 (12:23 -0900)]
doc/protocols: add option usage description

Fixes ticket #6148.

Signed-off-by: Lou Logan <lou@lrcd.com>
3 years agoaac_latm: Align inband PCE to the start of the payload
Alex Converse [Thu, 9 Feb 2017 16:58:47 +0000 (08:58 -0800)]
aac_latm: Align inband PCE to the start of the payload

A strict reading of the spec seems to imply that it should be aligned to
the start of the element instance tag, but that would break all of the
samples with PCEs.

It seems like a well formed LATM stream should have its PCE in the ASC
rather than inband.

Fixes ticket 4544

3 years agoaacsbr: Associate SBR data with AAC elements on init
Alex Converse [Thu, 9 Feb 2017 16:28:30 +0000 (08:28 -0800)]
aacsbr: Associate SBR data with AAC elements on init

Quiets some log spam on pure upsampling mode.

Fixes ticket 5163.