ffmpeg.git
2 years agovaapi_encode: Use gop_size consistently in RC parameters
Mark Thompson [Sun, 2 Apr 2017 22:05:13 +0000 (23:05 +0100)]
vaapi_encode: Use gop_size consistently in RC parameters

The non-H.26[45] codecs already use this form.  Since we don't
currently generate I frames for codecs which support them separately
to IDR, the p_per_i variable is set to infinity by default so that it
doesn't interfere with any other calculation.  (All the code for I
frames still exists, and it works for H.264 if set manually.)

(cherry picked from commit 6af014f4028238b4c50f1731b3369a41d65fa9c4)

2 years agoqsvenc: Allow use of hw_device_ctx to make the internal session
Mark Thompson [Sat, 4 Mar 2017 23:57:37 +0000 (23:57 +0000)]
qsvenc: Allow use of hw_device_ctx to make the internal session

(cherry picked from commit 3d197514e613ccd9eab43180c0a7c8b09a307606)

2 years agoqsvdec: Allow use of hw_device_ctx to make the internal session
Mark Thompson [Sat, 4 Mar 2017 23:57:36 +0000 (23:57 +0000)]
qsvdec: Allow use of hw_device_ctx to make the internal session

(cherry picked from commit 8848ba0bd6b035af77d4f13aa0d8aaaad9806fe8)

2 years agoqsv: Add ability to create a session from a device
Mark Thompson [Sat, 4 Mar 2017 23:57:35 +0000 (23:57 +0000)]
qsv: Add ability to create a session from a device

(cherry picked from commit 4936a48b1e6fc2147599541f8b25f43a8a9d1f16)

2 years agovf_deinterlace_vaapi: Add support for field rate output
Mark Thompson [Mon, 27 Feb 2017 21:29:46 +0000 (21:29 +0000)]
vf_deinterlace_vaapi: Add support for field rate output

In order to work correctly with the i965 driver, this also fixes the
direction of forward/backward references - forward references are
intended to be those from the past to the current frame, not from the
current frame to the future.

(cherry picked from commit 9aa251c98ce60e5ee83156e5292547a7671ced3a)

2 years agoffmpeg: Document the -init_hw_device option
Mark Thompson [Sun, 19 Mar 2017 16:25:37 +0000 (16:25 +0000)]
ffmpeg: Document the -init_hw_device option

(cherry picked from commit 303fadf5963e01b8edf4ba2701e45f7e9e586aeb)

2 years agoffmpeg: Enable generic hwaccel support for VDPAU
Mark Thompson [Sat, 4 Mar 2017 23:57:34 +0000 (23:57 +0000)]
ffmpeg: Enable generic hwaccel support for VDPAU

(cherry picked from commit aa6b2e081c504cb99f5e2e0ceb45295ef24bdac2)

2 years agoffmpeg: Enable generic hwaccel support for VAAPI
Mark Thompson [Sat, 4 Mar 2017 23:57:31 +0000 (23:57 +0000)]
ffmpeg: Enable generic hwaccel support for VAAPI

(cherry picked from commit 62a1ef9f26c654a3e988aa465c4ac1d776c4c356)

2 years agoffmpeg: Generic device setup
Mark Thompson [Sat, 4 Mar 2017 23:57:30 +0000 (23:57 +0000)]
ffmpeg: Generic device setup

Not yet enabled for any hwaccels.

(cherry picked from commit d2e6dd32a445b5744a51d090c0822dbd7e434592)
(cherry picked from commit 9203aac22874c7259e155b7d00f1f33bb1355129)

2 years agohwcontext: Make it easier to work with device types
Mark Thompson [Sat, 4 Mar 2017 23:57:29 +0000 (23:57 +0000)]
hwcontext: Make it easier to work with device types

Adds functions to convert to/from strings and a function to iterate
over all supported device types.  Also adds a new invalid type
AV_HWDEVICE_TYPE_NONE, which acts as a sentinel value.

(cherry picked from commit b7487f4f3c39b4b202e1ea7bb2de13902f2dee45)

2 years agohwcontext: Add device derivation
Mark Thompson [Sat, 4 Mar 2017 23:57:28 +0000 (23:57 +0000)]
hwcontext: Add device derivation

Creates a new device context from another of a different type which
refers to the same underlying hardware.

(cherry picked from commit b266ad56fe0e4ce5bb70118ba2e2b1dabfaf76ce)

2 years agovaapi_encode: Discard output buffer if picture submission fails
Mark Thompson [Thu, 16 Feb 2017 00:02:29 +0000 (00:02 +0000)]
vaapi_encode: Discard output buffer if picture submission fails

Previously this was leaking, though it actually hit an assert making
sure that the buffer had already been cleared when freeing the picture.

(cherry picked from commit 17aeee5832b9188b570c3d3de4197e4cdc54c634)

2 years agohwcontext_vaapi: Try to support the VDPAU wrapper
Mark Thompson [Mon, 30 Jan 2017 19:11:28 +0000 (19:11 +0000)]
hwcontext_vaapi: Try to support the VDPAU wrapper

The driver is somewhat bitrotten (not updated for years) but is still
usable for decoding with this change.  To support it, this adds a new
driver quirk to indicate no support at all for surface attributes.

Based on a patch by wm4 <nfxjfg@googlemail.com>.

(cherry picked from commit e791b915c774408fbc0ec9e7270b021899e08ccc)

2 years agolavc/aarch64/simple_idct: fix build with Xcode 7.2
Matthieu Bouron [Wed, 14 Jun 2017 11:28:18 +0000 (13:28 +0200)]
lavc/aarch64/simple_idct: fix build with Xcode 7.2

2 years agovp9: fix overwrite in ff_vp9_ipred_dr_16x16_16_avx2.
Ronald S. Bultje [Wed, 14 Jun 2017 13:44:26 +0000 (09:44 -0400)]
vp9: fix overwrite in ff_vp9_ipred_dr_16x16_16_avx2.

Fixes trac issue 6459.

2 years agoavfilter/vf_signature: fix memory leaks in error cases
Timo Rothenpieler [Sun, 11 Jun 2017 13:29:35 +0000 (15:29 +0200)]
avfilter/vf_signature: fix memory leaks in error cases

Fixes CIDs 1403234 and 1403235

2 years agoavformat/pcmdec: fix memory leak
Timo Rothenpieler [Sun, 11 Jun 2017 13:19:17 +0000 (15:19 +0200)]
avformat/pcmdec: fix memory leak

Fixes CID 1396267

2 years agoavformat/librtmp: check return value of setsockopt
Timo Rothenpieler [Sun, 11 Jun 2017 13:08:43 +0000 (15:08 +0200)]
avformat/librtmp: check return value of setsockopt

Fixes CID 1396837

2 years agoavfilter/vf_scale_npp: fix out-of-bounds reads
Timo Rothenpieler [Sun, 11 Jun 2017 12:56:44 +0000 (14:56 +0200)]
avfilter/vf_scale_npp: fix out-of-bounds reads

Fixes CIDs 1396414 and 1396415

2 years agoavfilter/unsharp: fix uninitialized pointer read
Timo Rothenpieler [Sun, 11 Jun 2017 12:50:01 +0000 (14:50 +0200)]
avfilter/unsharp: fix uninitialized pointer read

Fixes CID 1396855

2 years agolavc/aarch64/simple_idct: fix idct_col4_top coefficient
Matthieu Bouron [Tue, 13 Jun 2017 15:19:51 +0000 (17:19 +0200)]
lavc/aarch64/simple_idct: fix idct_col4_top coefficient

Fixes regression introduced by 5d0b8b1ae307951310c7d9a8fa282fbca9b997cd.

2 years agoavcodec/aacsbr_fixed: Fix signed integer overflow in sbr_hf_inverse_filter()
Michael Niedermayer [Tue, 13 Jun 2017 15:10:30 +0000 (17:10 +0200)]
avcodec/aacsbr_fixed: Fix signed integer overflow in sbr_hf_inverse_filter()

Fixes: runtime error: signed integer overflow: 2147483584 + 128 cannot be represented in type 'int'
Fixes: 2164/clusterfuzz-testcase-minimized-4715936172998656

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/aacsbr_fixed: Check shift in sbr_hf_assemble()
Michael Niedermayer [Tue, 13 Jun 2017 14:25:59 +0000 (16:25 +0200)]
avcodec/aacsbr_fixed: Check shift in sbr_hf_assemble()

Fixes: runtime error: shift exponent -10 is negative

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/sbrdsp_fixed: Return an error from sbr_hf_apply_noise() if operations are...
Michael Niedermayer [Tue, 13 Jun 2017 11:28:23 +0000 (13:28 +0200)]
avcodec/sbrdsp_fixed: Return an error from sbr_hf_apply_noise() if operations are impossible

Fixes: 1775/clusterfuzz-testcase-minimized-5330288148217856

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavfilter: properly set SAR for A->V filters
Paul B Mahol [Tue, 13 Jun 2017 13:07:36 +0000 (15:07 +0200)]
avfilter: properly set SAR for A->V filters

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2 years agolavc/mediacodecdec: switch to the new generic filtering mechanism
Matthieu Bouron [Fri, 9 Jun 2017 22:41:07 +0000 (00:41 +0200)]
lavc/mediacodecdec: switch to the new generic filtering mechanism

2 years agoavcodec/put_bits: Implement put_bits32() in a single pass instead of 2 passes writing...
Michael Niedermayer [Tue, 13 Jun 2017 01:18:21 +0000 (03:18 +0200)]
avcodec/put_bits: Implement put_bits32() in a single pass instead of 2 passes writing 16bits each

820 cpu cycles -> 660 cpu cycles for 100 put_bits32()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/golomb: Assert that the input is not too large in set_ue_golomb()
Michael Niedermayer [Tue, 13 Jun 2017 00:56:58 +0000 (02:56 +0200)]
avcodec/golomb: Assert that the input is not too large in set_ue_golomb()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agotools/sofa2wavs: add license header
Paul B Mahol [Mon, 12 Jun 2017 20:13:09 +0000 (22:13 +0200)]
tools/sofa2wavs: add license header

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2 years agoavcodec/vp9: ipred_dr_16x16_16 avx2 implementation
Ilia Valiakhmetov [Sat, 10 Jun 2017 10:01:12 +0000 (17:01 +0700)]
avcodec/vp9: ipred_dr_16x16_16 avx2 implementation

Signed-off-by: Ilia Valiakhmetov <zakne0ne@gmail.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2 years agotools: add sofa2wavs
Paul B Mahol [Fri, 9 Jun 2017 11:18:31 +0000 (13:18 +0200)]
tools: add sofa2wavs

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2 years agoavfilter: add native headphone spatialization filter
Paul B Mahol [Wed, 7 Jun 2017 19:23:14 +0000 (21:23 +0200)]
avfilter: add native headphone spatialization filter

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2 years agox86inc: Add some additional cpuflag relations
Henrik Gramner [Sat, 6 May 2017 10:26:56 +0000 (12:26 +0200)]
x86inc: Add some additional cpuflag relations

Simplifies writing assembly code that depends on available instructions.

LZCNT implies SSE2
BMI1 implies AVX+LZCNT
AVX2 implies BMI2

2 years agoavcodec/libvpxdec: Check that display dimensions fit in the storage dimensions
Michael Niedermayer [Wed, 7 Jun 2017 17:17:30 +0000 (19:17 +0200)]
avcodec/libvpxdec: Check that display dimensions fit in the storage dimensions

Fixes assertion failure
Fixes: 2112/clusterfuzz-testcase-minimized-4526878557732864

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/avpacket: Limit iterations in ff_packet_split_and_drop_side_data()
Michael Niedermayer [Sun, 11 Jun 2017 20:08:04 +0000 (22:08 +0200)]
avcodec/avpacket: Limit iterations in ff_packet_split_and_drop_side_data()

This avoids scaning beyond what a valid packet can contain
Fixes: Timeout
Fixes: 541/clusterfuzz-testcase-610189291657625

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/jpeg2000dwt: Fix runtime error: left shift of negative value -123
Michael Niedermayer [Sun, 11 Jun 2017 18:28:46 +0000 (20:28 +0200)]
avcodec/jpeg2000dwt: Fix runtime error: left shift of negative value -123

Fixes: 2208/clusterfuzz-testcase-minimized-5976593765761024

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/wavpack: Fix runtime error: signed integer overflow: 1886191616 + 277872640...
Michael Niedermayer [Sun, 11 Jun 2017 18:19:59 +0000 (20:19 +0200)]
avcodec/wavpack: Fix runtime error: signed integer overflow: 1886191616 + 277872640 cannot be represented in type 'int'

Fixes: 2181/clusterfuzz-testcase-minimized-6314784322486272

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavformat/mov: add support for reading VP Codec Configuration Box
James Almer [Sat, 27 May 2017 21:58:15 +0000 (18:58 -0300)]
avformat/mov: add support for reading VP Codec Configuration Box

As defined in "VP Codec ISO Media File Format Binding v1.0"
https://github.com/webmproject/vp9-dash/blob/master/VPCodecISOMediaFileFormatBinding.md

Signed-off-by: James Almer <jamrial@gmail.com>
2 years agoavcodec/snowdec: Fix runtime error: left shift of negative value -1
Michael Niedermayer [Sun, 11 Jun 2017 12:34:54 +0000 (14:34 +0200)]
avcodec/snowdec: Fix runtime error: left shift of negative value -1

Fixes: 2197/clusterfuzz-testcase-minimized-6010716676947968

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/aacdec_fixed: Fix runtime error: left shift of negative value -1297616
Michael Niedermayer [Sun, 11 Jun 2017 12:32:35 +0000 (14:32 +0200)]
avcodec/aacdec_fixed: Fix runtime error: left shift of negative value -1297616

Fixes: 2195/clusterfuzz-testcase-minimized-4736721533009920

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/gdv: fix compiler warnings
Paul B Mahol [Sun, 11 Jun 2017 08:26:18 +0000 (10:26 +0200)]
avcodec/gdv: fix compiler warnings

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2 years agoavformat: add Gremlin Digital Video demuxer
Paul B Mahol [Fri, 2 Jun 2017 09:28:35 +0000 (11:28 +0200)]
avformat: add Gremlin Digital Video demuxer

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2 years agoavcodec: add Gremlin Digital Video decoder
Paul B Mahol [Fri, 2 Jun 2017 10:52:07 +0000 (12:52 +0200)]
avcodec: add Gremlin Digital Video decoder

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2 years agoavcodec: add Gremlin DPCM decoder
Paul B Mahol [Fri, 2 Jun 2017 10:43:02 +0000 (12:43 +0200)]
avcodec: add Gremlin DPCM decoder

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2 years agoavcodec/tiff: Fix leak of geotags[].val
Michael Niedermayer [Sat, 10 Jun 2017 23:05:26 +0000 (01:05 +0200)]
avcodec/tiff: Fix leak of geotags[].val

Fixes: 2176/clusterfuzz-testcase-minimized-5908197216878592

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/fft_template: Fix multiple runtime error: signed integer overflow: -194391871...
Michael Niedermayer [Sat, 27 May 2017 10:21:25 +0000 (12:21 +0200)]
avcodec/fft_template: Fix multiple runtime error: signed integer overflow: -1943918714 - 1935113003 cannot be represented in type 'int'

Fixes: 1735/clusterfuzz-testcase-minimized-5350472347025408

This uses unsigned instead of SUINT because the later was rejected by multiple developers
See: [FFmpeg-devel] [PATCH] avcodec/fft_template: Fix multiple runtime error: signed integer overflow: -1943918714 - 1935113003 cannot be represented in type 'int'

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/ra144: Fix runtime error: signed integer overflow: -2200 * 1033073 cannot...
Michael Niedermayer [Sat, 10 Jun 2017 22:45:20 +0000 (00:45 +0200)]
avcodec/ra144: Fix runtime error: signed integer overflow: -2200 * 1033073 cannot be represented in type 'int'

Fixes: 2175/clusterfuzz-testcase-minimized-5809657849315328

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/flicvideo: Fix runtime error: signed integer overflow: 4864 * 459296 cannot...
Michael Niedermayer [Sat, 10 Jun 2017 17:43:25 +0000 (19:43 +0200)]
avcodec/flicvideo: Fix runtime error: signed integer overflow: 4864 * 459296 cannot be represented in type 'int'

Fixes: 2174/clusterfuzz-testcase-minimized-5739234533048320

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/cfhd: Check band parameters before storing them
Michael Niedermayer [Sat, 10 Jun 2017 16:45:08 +0000 (18:45 +0200)]
avcodec/cfhd: Check band parameters before storing them

Fixes out of array read
Fixes: 2169/clusterfuzz-testcase-minimized-5688641642823680

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agofate: add test for -time_base option
Michael Bradshaw [Fri, 9 Jun 2017 22:02:27 +0000 (15:02 -0700)]
fate: add test for -time_base option

Signed-off-by: Michael Bradshaw <mjbshaw@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/h264_parse: Check picture structure when initializing weight table
Michael Niedermayer [Fri, 9 Jun 2017 22:13:07 +0000 (00:13 +0200)]
avcodec/h264_parse: Check picture structure when initializing weight table

Fixes: runtime error: index 49 out of bounds for type 'int [48][2][2]'
Fixes: 2159/clusterfuzz-testcase-minimized-5267945972301824

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/dvbsubdec: Check pixel buffer size constraint from ETSI EN 300 743 V1.3.1
Michael Niedermayer [Fri, 9 Jun 2017 21:16:55 +0000 (23:16 +0200)]
avcodec/dvbsubdec: Check pixel buffer size constraint from ETSI EN 300 743 V1.3.1

Fixes: OOM
Fixes: 2143/clusterfuzz-testcase-minimized-5482288060039168

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/dvbsubdec: Use av_image_check_size2()
Michael Niedermayer [Fri, 9 Jun 2017 21:04:30 +0000 (23:04 +0200)]
avcodec/dvbsubdec: Use av_image_check_size2()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agolavf/mov.c: offset index timestamps by the minimum pts to make first pts zero
Sasi Inguva [Tue, 6 Jun 2017 18:16:01 +0000 (11:16 -0700)]
lavf/mov.c: offset index timestamps by the minimum pts to make first pts zero

If the videos starts with B frame, then the minimum composition time
as computed by stts + ctts will be non-zero. Hence we need to shift
the DTS, so that the first pts is zero. This was the intention of that
code-block. However it was subtracting by the wrong amount.

For example, for one of the videos in the bug nonFormatted.mp4 we have

stts:
sample_count  duration
960           1001

ctts:
sample_count  duration
1             3003
2             0
1             3003
....

The resulting composition times are :  3003, 1001, 2002, 6006, ...

The minimum composition time or PTS is 1001, which should be used to
offset DTS. However the code block was wrongly using ctts[0] which is
3003. Hence the PTS was negative. This change computes the minimum pts
encountered while fixing the index, and then subtracts it from all the
timestamps after the edit list fixes are applied.

Samples files available from:

https://bugs.chromium.org/p/chromium/issues/detail?id=721451
https://bugs.chromium.org/p/chromium/issues/detail?id=723537

fate-suite/h264/twofields_packet.mp4 is a similar file starting with 2
B frames. Before this change the PTS of first two B-frames was -6006
and -3003, and I am guessing one of them got dropped when being decoded
and remuxed  to the framecrc before, and now it is not being dropped.

Signed-off-by: Sasi Inguva <isasi@google.com>
2 years agovf_colorspace: Add a pixdesc API alias name for bt2020nc color space
Vittorio Giovara [Fri, 9 Jun 2017 00:00:19 +0000 (20:00 -0400)]
vf_colorspace: Add a pixdesc API alias name for bt2020nc color space

2 years agox86inc: Remove argument from WIN64_RESTORE_XMM
Anton Mitrofanov [Sat, 20 May 2017 18:17:59 +0000 (21:17 +0300)]
x86inc: Remove argument from WIN64_RESTORE_XMM

The use of rsp was pretty much hardcoded there and probably didn't work
otherwise with stack_size > 0.

2 years agox86inc: Prefer r14/r15 over r12/r13 on x86-64
Henrik Gramner [Sat, 22 Apr 2017 18:30:35 +0000 (20:30 +0200)]
x86inc: Prefer r14/r15 over r12/r13 on x86-64

Due to a peculiarity in the ModR/M addressing encoding, the r12 and r13
registers sometimes requires an additional byte when used as a base register.

r14 and r15 doesn't have that issue, so prefer using them.

2 years agox86inc: Make REP_RET identical to RET in SSSE3+ functions
Henrik Gramner [Thu, 20 Apr 2017 17:16:51 +0000 (19:16 +0200)]
x86inc: Make REP_RET identical to RET in SSSE3+ functions

There's no point in emitting a rep prefix before ret on modern CPUs.

2 years agox86inc: Fix call with memory operands
Henrik Gramner [Wed, 29 Mar 2017 14:43:57 +0000 (16:43 +0200)]
x86inc: Fix call with memory operands

We overload the `call` instruction with a macro, but it would misbehave when
the macro argument wasn't a valid identifier. Fix it by explicitly checking
if the argument is an identifier.

2 years agolibavformat/http: return EIO when ffurl_read return 0, but s->off < target_end
raymondzheng [Thu, 18 May 2017 06:35:31 +0000 (14:35 +0800)]
libavformat/http: return EIO when ffurl_read return 0, but s->off < target_end

Approved-by: "Ronald S. Bultje" <rsbultje@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavfilter/af_sofalizer: switch to libmysofa
Paul B Mahol [Fri, 2 Jun 2017 23:39:04 +0000 (01:39 +0200)]
avfilter/af_sofalizer: switch to libmysofa

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2 years agolavc: add mpeg2 mediacodec decoder
Aman Gupta [Mon, 5 Jun 2017 20:22:58 +0000 (16:22 -0400)]
lavc: add mpeg2 mediacodec decoder

Android TV and FireOS hardware supports mpeg2 hardware decoding via
MediaCodec.

Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
2 years agoavcodec/indeo4: Check remaining data in Pic hdr extension parsing code
Michael Niedermayer [Thu, 8 Jun 2017 11:58:47 +0000 (13:58 +0200)]
avcodec/indeo4: Check remaining data in Pic hdr extension parsing code

Fixes: Timeout
Fixes: 2115/clusterfuzz-testcase-minimized-6594111748440064

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/ac3dec_fixed: Fix multiple runtime error: signed integer overflow: -39271008...
Michael Niedermayer [Thu, 8 Jun 2017 11:44:32 +0000 (13:44 +0200)]
avcodec/ac3dec_fixed: Fix multiple runtime error: signed integer overflow: -39271008 * 59 cannot be represented in type 'int'

Fixes: 2113/clusterfuzz-testcase-minimized-6510704959946752

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agovf_colorspace: Add support for jedec p22 primaries
Vittorio Giovara [Wed, 30 Nov 2016 18:16:25 +0000 (13:16 -0500)]
vf_colorspace: Add support for jedec p22 primaries

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2 years agovf_colorspace: Add support for smpte248 color primaries
Vittorio Giovara [Wed, 7 Jun 2017 19:03:14 +0000 (15:03 -0400)]
vf_colorspace: Add support for smpte248 color primaries

2 years agoMAINTAINERS: Add Manojkumar Bhosale for MIPS, remove myself.
Nedeljko Babic [Wed, 7 Jun 2017 13:25:51 +0000 (15:25 +0200)]
MAINTAINERS: Add Manojkumar Bhosale for MIPS, remove myself.

Manojkumar is taking over MIPS maintenance.

Signed-off-by: Nedeljko Babic <nedeljko.babic@imgtec.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agox86/aacpsdsp: fix output of ff_ps_stereo_interpolate_ipdopd_sse3
James Almer [Wed, 7 Jun 2017 16:53:31 +0000 (13:53 -0300)]
x86/aacpsdsp: fix output of ff_ps_stereo_interpolate_ipdopd_sse3

The fate-aac-al_sbr_ps_04_ur test did not detect this mistake.

2 years agolavf: consider codec framerate for framerate detection
wm4 [Tue, 23 May 2017 11:36:38 +0000 (13:36 +0200)]
lavf: consider codec framerate for framerate detection

Fixes detection of some TV sample as 24.5 FPS. With the patch applied,
it's detected as 25 FPS.

This is enabled for mpegts only.

2 years agovorbisenc: Fix memory leak on errors
Tyler Jones [Tue, 6 Jun 2017 14:06:38 +0000 (08:06 -0600)]
vorbisenc: Fix memory leak on errors

Switches temporary samples for processing to be stored in the encoder's
context, avoids memory leaks if any errors occur while encoding a frame.

Fixes CID1412026

Signed-off-by: Tyler Jones <tdjones879@gmail.com>
Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2 years agolibavutil/eval: Add round function to expression parser
Kevin Mark [Tue, 6 Jun 2017 04:43:13 +0000 (00:43 -0400)]
libavutil/eval: Add round function to expression parser

We have floor, ceil, and trunc. Let's add round.

Signed-off-by: Kevin Mark <kmark937@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavformat/utils: Slightly un-clutter code in determinable_frame_size() by using a...
Michael Niedermayer [Sun, 4 Jun 2017 00:25:46 +0000 (02:25 +0200)]
avformat/utils: Slightly un-clutter code in determinable_frame_size() by using a switch

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agovf_colorspace: Add support for gbr color space
Vittorio Giovara [Mon, 5 Jun 2017 20:05:11 +0000 (16:05 -0400)]
vf_colorspace: Add support for gbr color space

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2 years agoavcodec/mpeg4videodec: Fix runtime error: signed integer overflow: 53098 * 40448...
Michael Niedermayer [Tue, 6 Jun 2017 14:28:57 +0000 (16:28 +0200)]
avcodec/mpeg4videodec: Fix runtime error: signed integer overflow: 53098 * 40448 cannot be represented in type 'int'

Fixes: 2106/clusterfuzz-testcase-minimized-6136503639998464

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/pafvideo: Fix assertion failure
Michael Niedermayer [Tue, 6 Jun 2017 14:21:37 +0000 (16:21 +0200)]
avcodec/pafvideo: Fix assertion failure

Fixes: 2100/clusterfuzz-testcase-minimized-4522961547558912

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/takdec: Fix multiple runtime error: signed integer overflow: 637072 * 4096...
Michael Niedermayer [Tue, 6 Jun 2017 14:01:16 +0000 (16:01 +0200)]
avcodec/takdec: Fix multiple runtime error: signed integer overflow: 637072 * 4096 cannot be represented in type 'int'

Fixes: 2079/clusterfuzz-testcase-minimized-5345861779324928

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agolibavcodec/vp9: ipred_dl_32x32_16 avx2 implementation
Ilia Valiakhmetov [Sun, 4 Jun 2017 17:52:27 +0000 (00:52 +0700)]
libavcodec/vp9: ipred_dl_32x32_16 avx2 implementation

vp9_diag_downleft_32x32_8bpp_c: 580.2
vp9_diag_downleft_32x32_8bpp_sse2: 75.6
vp9_diag_downleft_32x32_8bpp_ssse3: 73.7
vp9_diag_downleft_32x32_8bpp_avx: 72.7
vp9_diag_downleft_32x32_10bpp_c: 1101.2
vp9_diag_downleft_32x32_10bpp_sse2: 145.4
vp9_diag_downleft_32x32_10bpp_ssse3: 137.5
vp9_diag_downleft_32x32_10bpp_avx: 134.8
vp9_diag_downleft_32x32_10bpp_avx2: 94.0
vp9_diag_downleft_32x32_12bpp_c: 1108.5
vp9_diag_downleft_32x32_12bpp_sse2: 145.5
vp9_diag_downleft_32x32_12bpp_ssse3: 137.3
vp9_diag_downleft_32x32_12bpp_avx: 135.2
vp9_diag_downleft_32x32_12bpp_avx2: 94.0

~30% faster than avx implementation

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2 years agolavc/mpegvideo_enc: allow low_delay for non MPEG2 codecs depending on strict_std_comp...
Stefano Sabatini [Tue, 23 May 2017 10:22:41 +0000 (12:22 +0200)]
lavc/mpegvideo_enc: allow low_delay for non MPEG2 codecs depending on strict_std_compliance

Forcing low_delay can be useful, even if not officially supported.

2 years agofate: add fate-adts-id3v1-demux
James Almer [Mon, 5 Jun 2017 23:21:24 +0000 (20:21 -0300)]
fate: add fate-adts-id3v1-demux

This test the demuxer discarding non ADTS frames at the beginning and
end of the input.

As a side effect, this commit also enables fate-adts-demux, which was
accidentally disabled in 324f0fbff1245f9e9e1dda29ecb03138a2de287d.

Tested-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2 years agoavcodec/mjpegdec: Check that reference frame matches the current frame
Michael Niedermayer [Mon, 5 Jun 2017 20:23:15 +0000 (22:23 +0200)]
avcodec/mjpegdec: Check that reference frame matches the current frame

Fixes: out of array read
Fixes: 2097/clusterfuzz-testcase-minimized-5036861833609216

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/tiff: Avoid loosing allocated geotag values
Michael Niedermayer [Mon, 5 Jun 2017 18:39:21 +0000 (20:39 +0200)]
avcodec/tiff: Avoid loosing allocated geotag values

Fixes memleak
Fixes: 2076/clusterfuzz-testcase-minimized-6542640243802112

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/cavs: Fix runtime error: signed integer overflow: -12648062 * 256 cannot...
Michael Niedermayer [Mon, 5 Jun 2017 17:33:56 +0000 (19:33 +0200)]
avcodec/cavs: Fix runtime error: signed integer overflow: -12648062 * 256 cannot be represented in type 'int'

Fixes: 2067/clusterfuzz-testcase-minimized-5578430902960128

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoffprobe: Use pixdesc API to provide color space names
Vittorio Giovara [Thu, 1 Jun 2017 19:18:37 +0000 (15:18 -0400)]
ffprobe: Use pixdesc API to provide color space names

This API is more up-to-date, provides names compatible with filters
and external encoders, and is consistent with the other color
property variables.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2 years agovorbisenc: signal samples to skip
Rostislav Pehlivanov [Mon, 5 Jun 2017 15:51:08 +0000 (16:51 +0100)]
vorbisenc: signal samples to skip

The encoder never actually signalled how many samples to skip.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2 years agoavcodec/vorbisenc: Use a bufqueue in encoding with smaller lengths
Tyler Jones [Tue, 30 May 2017 17:28:16 +0000 (11:28 -0600)]
avcodec/vorbisenc: Use a bufqueue in encoding with smaller lengths

Switching the vorbis encoder to use a buffer queue for input frames allows
saving lookahead samples more easily and safely for psychoacoustic systems,
requiring less pointer arithmetic in the case of transient windows.

2 years agoavcodec/vorbisenc: Include bufqueue and afqueue
Tyler Jones [Tue, 30 May 2017 17:28:04 +0000 (11:28 -0600)]
avcodec/vorbisenc: Include bufqueue and afqueue

2 years agoavcodec/vorbisenc: Use fdsp for applying windows
Tyler Jones [Tue, 30 May 2017 15:14:36 +0000 (09:14 -0600)]
avcodec/vorbisenc: Use fdsp for applying windows

Using fdsp improves readability and allows using architecture-specific
optimizations.

Signed-off-by: Tyler Jones <tdjones879@gmail.com>
2 years agoavcodec/vorbisenc: Include fdsp
Tyler Jones [Tue, 30 May 2017 15:14:17 +0000 (09:14 -0600)]
avcodec/vorbisenc: Include fdsp

Signed-off-by: Tyler Jones <tdjones879@gmail.com>
2 years agoavformat/hls: Check local file extensions
Michael Niedermayer [Sat, 3 Jun 2017 19:20:04 +0000 (21:20 +0200)]
avformat/hls: Check local file extensions

This reduces the attack surface of local file-system
information leaking.

It prevents the existing exploit leading to an information leak. As
well as similar hypothetical attacks.

Leaks of information from files and symlinks ending in common multimedia extensions
are still possible. But files with sensitive information like private keys and passwords
generally do not use common multimedia filename extensions.
It does not stop leaks via remote addresses in the LAN.

The existing exploit depends on a specific decoder as well.
It does appear though that the exploit should be possible with any decoder.
The problem is that as long as sensitive information gets into the decoder,
the output of the decoder becomes sensitive as well.
The only obvious solution is to prevent access to sensitive information. Or to
disable hls or possibly some of its feature. More complex solutions like
checking the path to limit access to only subdirectories of the hls path may
work as an alternative. But such solutions are fragile and tricky to implement
portably and would not stop every possible attack nor would they work with all
valid hls files.

Developers have expressed their dislike / objected to disabling hls by default as well
as disabling hls with local files. There also where objections against restricting
remote url file extensions. This here is a less robust but also lower
inconvenience solution.
It can be applied stand alone or together with other solutions.
limiting the check to local files was suggested by nevcairiel

This recommits the security fix without the author name joke which was
originally requested by Nicolas.

Found-by: Emil Lerner and Pavel Cheremushkin
Reported-by: Thierry Foucu <tfoucu@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoRevert "avformat/hls: Check local file extensions"
Michael Niedermayer [Mon, 5 Jun 2017 11:24:36 +0000 (13:24 +0200)]
Revert "avformat/hls: Check local file extensions"

Requested-by: Paul B Mahol <onemda@gmail.com>
This reverts commit caf7d6178a4d5f24c915da48410a9790b21703aa.

2 years agofate: add test for the Dirac low delay profile
Rostislav Pehlivanov [Sun, 4 Jun 2017 17:03:05 +0000 (18:03 +0100)]
fate: add test for the Dirac low delay profile

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2 years agox86/aacpsdsp: optimize ff_ps_mul_pair_single_sse
James Almer [Mon, 5 Jun 2017 02:29:56 +0000 (23:29 -0300)]
x86/aacpsdsp: optimize ff_ps_mul_pair_single_sse

~2% faster.

2 years agoavformat/hls: Check local file extensions
Sysiphus [Sat, 3 Jun 2017 19:20:04 +0000 (21:20 +0200)]
avformat/hls: Check local file extensions

This reduces the attack surface of local file-system
information leaking.

It prevents the existing exploit leading to an information leak. As
well as similar hypothetical attacks.

Leaks of information from files and symlinks ending in common multimedia extensions
are still possible. But files with sensitive information like private keys and passwords
generally do not use common multimedia filename extensions.
It does not stop leaks via remote addresses in the LAN.

The existing exploit depends on a specific decoder as well.
It does appear though that the exploit should be possible with any decoder.
The problem is that as long as sensitive information gets into the decoder,
the output of the decoder becomes sensitive as well.
The only obvious solution is to prevent access to sensitive information. Or to
disable hls or possibly some of its feature. More complex solutions like
checking the path to limit access to only subdirectories of the hls path may
work as an alternative. But such solutions are fragile and tricky to implement
portably and would not stop every possible attack nor would they work with all
valid hls files.

Developers have expressed their dislike / objected to disabling hls by default as well
as disabling hls with local files. There also where objections against restricting
remote url file extensions. This here is a less robust but also lower
inconvenience solution.
It can be applied stand alone or together with other solutions.
limiting the check to local files was suggested by nevcairiel

Found-by: Emil Lerner and Pavel Cheremushkin
Reported-by: Thierry Foucu <tfoucu@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoFATE: Add test for libavfilter/scale2ref
Kevin Mark [Sun, 4 Jun 2017 07:53:31 +0000 (03:53 -0400)]
FATE: Add test for libavfilter/scale2ref

This new FATE test for the scale2ref filter makes use of the recently
added scale2ref-specific variables to maintain the aspect ratio of a
test input.

Filtergraph explanation:
[main] has an AR of 4:3. [ref] has an AR of 16:9.
640 / 4 = 160. So the new width for [main] is 160.
160 / ((320 / 240) * (1 / 1)) = 160 / (4 / 3) = 120. So the new
height for [main] is 120.
160 / 120 = 4 / 3 so [main]'s aspect ratio has been maintained while
using [ref]'s width as a reference point.

[ref] is nullsink'd since it is left unchanged by scale2ref (and so
shouldn't need to be tested).

If we were to use "iw/4:-1" in place of "iw/4:ow/mdar":
640 / 4 = 160. So the new width for [main] would be 160.
360 / 4 = 90. So the new height for [main] would be 90.
160 / 90 = 16 / 9 so [main] now has the same aspect ratio as [ref]
which is probably what you do not want.

This is currently the only test for scale2ref.

Signed-off-by: Kevin Mark <kmark937@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/qdrw: Fix null pointer dereference
Michael Niedermayer [Sun, 4 Jun 2017 19:37:47 +0000 (21:37 +0200)]
avcodec/qdrw: Fix null pointer dereference

The RGB555 PACKBITSRGN case tries to read a palette, if such
palette is actually stored then it accesses a null pointer.
All 16bit samples i could find use DIRECTBITSRGN.

Fixes: 2065/clusterfuzz-testcase-minimized-6298930457346048

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/sbrdsp_fixed: Fix assertion failure in sbr_sum_square_c()
Michael Niedermayer [Sun, 4 Jun 2017 18:54:44 +0000 (20:54 +0200)]
avcodec/sbrdsp_fixed: Fix assertion failure in sbr_sum_square_c()

This also increases the range of input values supported as well as
decreasing the operation dependencies in the main loop, improving
speed on modern CPUs.

Fixes part of: 2045/clusterfuzz-testcase-minimized-6751255865065472

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavutil/softfloat: Fix sign error in and improve documentation of av_int2sf()
Michael Niedermayer [Sun, 4 Jun 2017 18:45:09 +0000 (20:45 +0200)]
avutil/softfloat: Fix sign error in and improve documentation of av_int2sf()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavfilter/af_afftfilt: fix memory leaks
Paul B Mahol [Sun, 4 Jun 2017 20:51:57 +0000 (22:51 +0200)]
avfilter/af_afftfilt: fix memory leaks

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2 years agoavcodec/wavpack: Fix runtime error: signed integer overflow: 2081021665 - -130689706...
Michael Niedermayer [Sun, 4 Jun 2017 15:14:13 +0000 (17:14 +0200)]
avcodec/wavpack: Fix runtime error: signed integer overflow: 2081021665 - -130689706 cannot be represented in type 'int'

Fixes: 2038/clusterfuzz-testcase-minimized-4521466148159488

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 years agoavcodec/hevc_ps: Fix runtime error: index 32 out of bounds for type 'uint8_t [32]'
Michael Niedermayer [Sun, 4 Jun 2017 15:06:27 +0000 (17:06 +0200)]
avcodec/hevc_ps: Fix runtime error: index 32 out of bounds for type 'uint8_t [32]'

Fixes: 2010/clusterfuzz-testcase-minimized-6209288450080768

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>