ffmpeg.git
2 months agolavdevice: Add AudioToolbox output device.
Thilo Borgmann [Mon, 15 Jun 2020 13:09:33 +0000 (15:09 +0200)]
lavdevice: Add AudioToolbox output device.

2 months agoavformat/dashenc: Add hls_master_name option
Przemysław Sobala [Wed, 10 Jun 2020 11:14:36 +0000 (13:14 +0200)]
avformat/dashenc: Add hls_master_name option

2 months agoavformat/hlsenc: Always treat numbers as decimal
Andreas Rheinhardt [Mon, 15 Jun 2020 03:09:07 +0000 (05:09 +0200)]
avformat/hlsenc: Always treat numbers as decimal

c801ab43c36e8c4f88121aa09af26c77bcbd671b caused a regression: The stream
number is now parsed with strtoll without a fixed basis; as a
consequence, the "010" in a variant stream mapping like "a:010" is now
treated as an octal number (i.e. as eight, not ten). This was not
intended and may break some scripts, so this commit restores the old
behaviour.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavcodec/iirfilter: Fix memleak
Andreas Rheinhardt [Mon, 15 Jun 2020 01:33:13 +0000 (03:33 +0200)]
avcodec/iirfilter: Fix memleak

Commit 17e88bf0df21906633a7d36d9f2aeeeb5b6d3267 created a memleak by
removing a call to ff_iir_filter_free_coeffsp on error; this has been
found by Coverity (ID 1464159). This commit fixes the memleak by
readding the call to ff_iir_filter_free_coeffsp.

Notice that this is not a simple revert, because several macros that
were used before 17e88bf0df21906633a7d36d9f2aeeeb5b6d3267 were replaced
in commit 44863b2c2d5a31d82aafa71cdbd180d6bfbed5b4 and completely removed
in 2658680df4fc606522e5f65899afb9a98b47d287.

Reviewed-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavcodec/hevc_mp4toannexb_bsf: Check NAL size against available input
Andreas Rheinhardt [Wed, 27 May 2020 17:09:14 +0000 (19:09 +0200)]
avcodec/hevc_mp4toannexb_bsf: Check NAL size against available input

The hevc_mp4toannexb bsf does not explicitly check whether a NAL unit
is so big that it extends beyond the end of the input packet; it does so
only implicitly by using the checked version of the bytestream2 API.
But this has downsides compared to real checks: It can lead to huge
allocations (up to 2GiB) even when the input packet is just a few bytes.
And furthermore it leads to uninitialized data being output.
So add a check to error out early if it happens.

Also check directly whether there is enough data for the length field.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavcodec/h264: create user data unregistered SEI side data for H.264
Limin Wang [Thu, 11 Jun 2020 04:50:46 +0000 (12:50 +0800)]
avcodec/h264: create user data unregistered SEI side data for H.264

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agoavfilter/vf_showinfo: display H.26[45] user data unregistered sei message
Limin Wang [Thu, 11 Jun 2020 23:32:29 +0000 (07:32 +0800)]
avfilter/vf_showinfo: display H.26[45] user data unregistered sei message

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agoavcodec/hevc_sei: add support for user data unregistered SEI message
Limin Wang [Thu, 11 Jun 2020 02:25:47 +0000 (10:25 +0800)]
avcodec/hevc_sei: add support for user data unregistered SEI message

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agoavcodec/cbs_av1: abort when written inferred values don't match
James Almer [Thu, 11 Jun 2020 16:06:17 +0000 (13:06 -0300)]
avcodec/cbs_av1: abort when written inferred values don't match

If this happens, it's a sign of parsing issues earlier in the process, or
misuse by the calling module.

Prevents writing invalid bitstreams.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2 months agoavcodec/cbs_h2645: abort when written inferred values don't match
James Almer [Thu, 11 Jun 2020 16:06:10 +0000 (13:06 -0300)]
avcodec/cbs_h2645: abort when written inferred values don't match

If this happens, it's a sign of parsing issues earlier in the process, or
misuse by the calling module.

Prevents writing invalid bitstreams.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2 months agoavformat/mxfdec: free duplicated utf16 strings
Michael Niedermayer [Sun, 14 Jun 2020 17:45:05 +0000 (19:45 +0200)]
avformat/mxfdec: free duplicated utf16 strings

Fixes: memleak
Fixes: 23415/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5124814510751744

Suggested-by: Marton Balint <cus@passwd.hu>
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavformat/4xm: Check that a video stream was created before returning packets for it
Michael Niedermayer [Sun, 14 Jun 2020 17:51:23 +0000 (19:51 +0200)]
avformat/4xm: Check that a video stream was created before returning packets for it

Fixes: assertion failure
Fixes: 23434/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5227750851084288.fuzz

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/libzvbi-teletextdec: fix txt_default_region limits
Marton Balint [Mon, 8 Jun 2020 23:31:00 +0000 (01:31 +0200)]
avcodec/libzvbi-teletextdec: fix txt_default_region limits

Max region ID is 87. Also the region affects not only the G0 charset but G2 and
the national subset as well.

Signed-off-by: Marton Balint <cus@passwd.hu>
2 months agoavcodec/ffwavesynth: Avoid undefined operation on ts overflow
Michael Niedermayer [Sat, 13 Jun 2020 19:47:03 +0000 (21:47 +0200)]
avcodec/ffwavesynth: Avoid undefined operation on ts overflow

Alternatively these conditions could be treated as errors
Fixes: 23147/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5639254549200896
Fixes: signed integer overflow: 9223372036854775807 + 1 cannot be represented in type 'int64_t' (aka 'long')

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/mv30: check mode_size vs. input space
Michael Niedermayer [Sat, 13 Jun 2020 14:03:14 +0000 (16:03 +0200)]
avcodec/mv30: check mode_size vs. input space

Fixes: Timeout (longer than my patience vs 1sec)
Fixes: 22984/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MV30_fuzzer-5630021988515840

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/mpeg4videodec: Fix 2 integer overflows in get_amv()
Michael Niedermayer [Thu, 11 Jun 2020 20:22:57 +0000 (22:22 +0200)]
avcodec/mpeg4videodec: Fix 2 integer overflows in get_amv()

Fixes: signed integer overflow: -144876608 * 16 cannot be represented in type 'int'
Fixes: 22782/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-6039584977977344

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/jpeg2000dec: Fix/check for multiple integer overflows
Michael Niedermayer [Thu, 11 Jun 2020 20:45:27 +0000 (22:45 +0200)]
avcodec/jpeg2000dec: Fix/check for multiple integer overflows

Fixes: shift exponent 35 is too large for 32-bit type 'int'
Fixes: 22857/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-5202709358837760

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavformat/utils: Print analyze duration and probesize when printing a suggestion to...
Michael Niedermayer [Mon, 8 Jun 2020 09:07:27 +0000 (11:07 +0200)]
avformat/utils: Print analyze duration and probesize when printing a suggestion to increase them

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/lossless_audiodsp: Fix undefined overflows in scalarproduct_and_madd_int16_c()
Michael Niedermayer [Sun, 7 Jun 2020 17:24:10 +0000 (19:24 +0200)]
avcodec/lossless_audiodsp: Fix undefined overflows in scalarproduct_and_madd_int16_c()

Fixes: signed integer overflow: 2142077091 + 6881070 cannot be represented in type 'int'
Fixes: 22737/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMALOSSLESS_fuzzer-5958388889681920

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/sonic: Fix several integer state overflows
Michael Niedermayer [Sun, 10 May 2020 19:09:45 +0000 (21:09 +0200)]
avcodec/sonic: Fix several integer state overflows

Fixes: signed integer overflow: -234 * -14797801 cannot be represented in type 'int'
Fixes: 20492/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SONIC_fuzzer-5695924975435776
Fixes: 22275/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SONIC_fuzzer-5695924975435776

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/sonic: Fix several integer overflows
Michael Niedermayer [Thu, 20 Feb 2020 18:56:39 +0000 (19:56 +0100)]
avcodec/sonic: Fix several integer overflows

Fixes: signed integer overflow: 2129689466 + 2129689466 cannot be represented in type 'int'
Fixes: 20715/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SONIC_fuzzer-5155263109922816

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavformat/oggdec: Disable mid stream codec changes
Michael Niedermayer [Sat, 13 Jun 2020 10:36:49 +0000 (12:36 +0200)]
avformat/oggdec: Disable mid stream codec changes

Fixes: 22082/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5688619118624768
Fixes: crash from V-codecs/Theora/theora_testsuite_broken/multi2.ogg

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Suggested-by: Lynne on IRC
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/mpeg4videodec: avoid invalid values and reinitialize in format changes for...
Michael Niedermayer [Sat, 13 Jun 2020 09:56:01 +0000 (11:56 +0200)]
avcodec/mpeg4videodec: avoid invalid values and reinitialize in format changes for studio profile

Fixes: out of array access
Fixes: 23327/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-5134822992510976

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/pixlet: Fix log(0) check
Michael Niedermayer [Sat, 13 Jun 2020 09:21:52 +0000 (11:21 +0200)]
avcodec/pixlet: Fix log(0) check

Fixes: passing zero to clz(), which is not a valid argument
Fixes: 23337/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PIXLET_fuzzer-5179131989065728

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavformat/ape: Cleanup after ape_read_header() failure
Michael Niedermayer [Sat, 13 Jun 2020 09:13:21 +0000 (11:13 +0200)]
avformat/ape: Cleanup after ape_read_header() failure

Fixes: memleaks
Fixes: 23306/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5635436931448832

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/iff: Fix off by x error
Michael Niedermayer [Sat, 13 Jun 2020 08:48:14 +0000 (10:48 +0200)]
avcodec/iff: Fix off by x error

Fixes: out of array access
Fixes: 23245/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5723121327013888.fuzz

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoswscale: cosmetic fixes
Nelson Gomez [Sun, 26 Apr 2020 02:37:03 +0000 (19:37 -0700)]
swscale: cosmetic fixes

Signed-off-by: Nelson Gomez <nelson.gomez@microsoft.com>
2 months agoswscale/x86/output: add AVX2 version of yuv2nv12cX
Nelson Gomez [Sun, 26 Apr 2020 02:37:02 +0000 (19:37 -0700)]
swscale/x86/output: add AVX2 version of yuv2nv12cX

256 bits is just wide enough to fit all the operands needed to vectorize
the software implementation, but AVX2 is needed to for a couple of
instructions like cross-lane permutation.

Output is bit-for-bit identical to C.

Signed-off-by: Nelson Gomez <nelson.gomez@microsoft.com>
2 months agoswscale: make yuv2interleavedX more asm-friendly
Nelson Gomez [Sun, 26 Apr 2020 02:37:01 +0000 (19:37 -0700)]
swscale: make yuv2interleavedX more asm-friendly

Extracting information from SwsContext in assembly is difficult, and
rearranging SwsContext just for asm access didn't look good. These
functions only need a couple of fields from it anyway, so just make
them parameters in their own right.

Signed-off-by: Nelson Gomez <nelson.gomez@microsoft.com>
2 months agoavcodec/smvjpegdec: remove uninitialized ret
Limin Wang [Fri, 12 Jun 2020 23:50:22 +0000 (07:50 +0800)]
avcodec/smvjpegdec: remove uninitialized ret

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agoavcodec/mpegvideo: remove extra space
Limin Wang [Fri, 12 Jun 2020 23:47:13 +0000 (07:47 +0800)]
avcodec/mpegvideo: remove extra space

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agoswscale/utils: return better error code from initFilter()
Limin Wang [Sat, 13 Jun 2020 05:52:20 +0000 (13:52 +0800)]
swscale/utils: return better error code from initFilter()

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agoswscale/utils: reindent
Limin Wang [Fri, 12 Jun 2020 23:29:43 +0000 (07:29 +0800)]
swscale/utils: reindent

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agolavf/prompeg: prompeg_write() must report data all was written
David Holroyd [Tue, 9 Jun 2020 13:37:10 +0000 (21:37 +0800)]
lavf/prompeg: prompeg_write() must report data all was written

Previously, prompeg_write() would only report to caller that bytes we
written when a FEC packet was actually created.  Not all RTP packets are
expected to generate a FEC packet however, so this behavior was causing
avio to retry writing the RTP packet, eventually forcing the FEC state
machine to send a FEC packet erroneously (and so breaking out of the
retry loop).

This was resulting in incorrect FEC data being generated, and far too
many FEC packets to be sent (~100% FEC overhead).

fix #7863

Signed-off-by: David Holroyd <david.holroyd@m2amedia.tv>
2 months agolavu/internal: Fix comment for avpriv_dict_set_timestamp
Jun Zhao [Sat, 6 Jun 2020 09:04:58 +0000 (17:04 +0800)]
lavu/internal: Fix comment for avpriv_dict_set_timestamp

Fix comment for avpriv_dict_set_timestamp from b72a7b96f84

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2 months agolavc/qsv: fix make checkheaders warning
Jun Zhao [Sun, 31 May 2020 08:12:36 +0000 (16:12 +0800)]
lavc/qsv: fix make checkheaders warning

make checkheaders will get warning as follow:

In file included from libavcodec/qsv_internal.h.c:1:
./libavcodec/qsv_internal.h:24:5: warning: "CONFIG_VAAPI" is not defined, evaluates to 0 [-Wundef]
   24 | #if CONFIG_VAAPI
      |     ^~~~~~~~~~~~

include "config.h" to fix the warning

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2 months agoavformat/sccdec: move pos variables outside of loop
Paul B Mahol [Sat, 13 Jun 2020 10:23:29 +0000 (12:23 +0200)]
avformat/sccdec: move pos variables outside of loop

Ensures that sub->pos is always correct.

2 months agoavcodec/ccaption_dec: switch active screen in end of caption early
Paul B Mahol [Sat, 13 Jun 2020 09:57:33 +0000 (11:57 +0200)]
avcodec/ccaption_dec: switch active screen in end of caption early

Fixes dropping of last caption.

2 months agoavcodec/ccaption_dec: remove unused arguments from function
Paul B Mahol [Sat, 13 Jun 2020 09:48:43 +0000 (11:48 +0200)]
avcodec/ccaption_dec: remove unused arguments from function

2 months agoavcodec/ccaption_dec: check for error codes
Paul B Mahol [Sat, 13 Jun 2020 09:41:53 +0000 (11:41 +0200)]
avcodec/ccaption_dec: check for error codes

2 months agoavutil/internal: remove FF_ALLOCx{_ARRAY}_OR_GOTO macros
Limin Wang [Tue, 2 Jun 2020 11:18:32 +0000 (19:18 +0800)]
avutil/internal: remove FF_ALLOCx{_ARRAY}_OR_GOTO macros

These functions have a terrible design, let us fix them before extending
them.
First design mistake: no error code. A helper function for testing
memory allocation failure where AVERROR(ENOMEM) does not appear is
absurd.

Second design mistake: printing a message. Return the error code, let
the caller print the error message.

Third design mistake: hard-coded use of goto.

http://ffmpeg.org/pipermail/ffmpeg-devel/2020-May/262544.html

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agoswscale/utils: remove FF_ALLOC_ARRAY_OR_GOTO macros
Limin Wang [Tue, 2 Jun 2020 13:54:21 +0000 (21:54 +0800)]
swscale/utils: remove FF_ALLOC_ARRAY_OR_GOTO macros

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agoavcodec/alac: remove FF_ALLOC_OR_GOTO and gotos label
Limin Wang [Fri, 29 May 2020 14:38:31 +0000 (22:38 +0800)]
avcodec/alac: remove FF_ALLOC_OR_GOTO and gotos label

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agoavcodec/mpegvideo_enc: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos lable
Limin Wang [Tue, 2 Jun 2020 15:59:15 +0000 (23:59 +0800)]
avcodec/mpegvideo_enc: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos lable

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agoavcodec/mpegpicture: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label
Limin Wang [Tue, 2 Jun 2020 15:49:28 +0000 (23:49 +0800)]
avcodec/mpegpicture: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agoavcodec/mpegvideo: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label
Limin Wang [Tue, 2 Jun 2020 15:42:30 +0000 (23:42 +0800)]
avcodec/mpegvideo: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agoavcodec/mpegvideo: simplify check for av_frame_alloc
Limin Wang [Tue, 2 Jun 2020 15:36:54 +0000 (23:36 +0800)]
avcodec/mpegvideo: simplify check for av_frame_alloc

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agoavcodec/iirfilter: remove FF_ALLOCZ_OR_GOTO and gotos label
Limin Wang [Mon, 1 Jun 2020 15:13:32 +0000 (23:13 +0800)]
avcodec/iirfilter: remove FF_ALLOCZ_OR_GOTO and gotos label

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agoavcodec/aacenc: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label
Limin Wang [Mon, 1 Jun 2020 14:48:28 +0000 (22:48 +0800)]
avcodec/aacenc: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agoavcodec/ac3enc_template: remove FF_ALLOC_ARRAY_OR_GOTO and gotos label
Limin Wang [Fri, 29 May 2020 14:05:46 +0000 (22:05 +0800)]
avcodec/ac3enc_template: remove FF_ALLOC_ARRAY_OR_GOTO and gotos label

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agoavcodec/ac3enc: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label
Limin Wang [Mon, 1 Jun 2020 16:06:55 +0000 (00:06 +0800)]
avcodec/ac3enc: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agoavcodec/snow: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label
Limin Wang [Mon, 1 Jun 2020 13:49:44 +0000 (21:49 +0800)]
avcodec/snow: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agoavcodec/dnxhdenc: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label
Limin Wang [Mon, 1 Jun 2020 13:49:12 +0000 (21:49 +0800)]
avcodec/dnxhdenc: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agoavcodec/twinvq: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label
Limin Wang [Mon, 1 Jun 2020 14:23:57 +0000 (22:23 +0800)]
avcodec/twinvq: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agoavcodec/apedec: remove FF_ALLOC_OR_GOTO and gotos lable
Limin Wang [Mon, 1 Jun 2020 13:26:53 +0000 (21:26 +0800)]
avcodec/apedec: remove FF_ALLOC_OR_GOTO and gotos lable

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agoavcodec: add FF_CODEC_CAP_INIT_CLEANUP for all codecs which use ff_mpv_common_init()
Limin Wang [Wed, 3 Jun 2020 13:53:11 +0000 (21:53 +0800)]
avcodec: add FF_CODEC_CAP_INIT_CLEANUP for all codecs which use ff_mpv_common_init()

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agoavcodec/alac: Add FF_CODEC_CAP_INIT_CLEANUP
Limin Wang [Fri, 29 May 2020 13:08:58 +0000 (21:08 +0800)]
avcodec/alac: Add FF_CODEC_CAP_INIT_CLEANUP

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agoavcodec/aacenc: add FF_CODEC_CAP_INIT_CLEANUP
Limin Wang [Mon, 1 Jun 2020 14:29:13 +0000 (22:29 +0800)]
avcodec/aacenc: add FF_CODEC_CAP_INIT_CLEANUP

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agoavcodec/ac3enc: add FF_CODEC_CAP_INIT_CLEANUP
Limin Wang [Mon, 1 Jun 2020 14:06:46 +0000 (22:06 +0800)]
avcodec/ac3enc: add FF_CODEC_CAP_INIT_CLEANUP

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agoavcodec/apedec: add FF_CODEC_CAP_INIT_CLEANUP
Limin Wang [Thu, 28 May 2020 15:53:46 +0000 (23:53 +0800)]
avcodec/apedec: add FF_CODEC_CAP_INIT_CLEANUP

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agoavcodec/adpcmenc: remove FF_ALLOC_OR_GOTO macros and gotos lable
Limin Wang [Thu, 28 May 2020 15:43:41 +0000 (23:43 +0800)]
avcodec/adpcmenc: remove FF_ALLOC_OR_GOTO macros and gotos lable

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agoavcodec/h264dec: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos lable
Limin Wang [Thu, 28 May 2020 15:33:04 +0000 (23:33 +0800)]
avcodec/h264dec: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos lable

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agoavcodec/h264dec: store count of the tables into const variable for long lines
Limin Wang [Thu, 28 May 2020 15:13:45 +0000 (23:13 +0800)]
avcodec/h264dec: store count of the tables into const variable for long lines

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agoavcodec/h264dec: cosmetics
Limin Wang [Wed, 27 May 2020 15:04:29 +0000 (23:04 +0800)]
avcodec/h264dec: cosmetics

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agoavcodec/wmalosslessdec: Check block_align maximum
Michael Niedermayer [Tue, 9 Jun 2020 20:11:23 +0000 (22:11 +0200)]
avcodec/wmalosslessdec: Check block_align maximum

Fixes: Assertion failure
Fixes: 22737/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMALOSSLESS_fuzzer-5958388889681920

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/loco: Fix signed integer overflow in loco_get_rice()
Michael Niedermayer [Tue, 9 Jun 2020 20:14:59 +0000 (22:14 +0200)]
avcodec/loco: Fix signed integer overflow in loco_get_rice()

Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
Fixes: 22975/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LOCO_fuzzer-5658160970072064

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavformat/thp: Check fps
Michael Niedermayer [Mon, 8 Jun 2020 07:28:55 +0000 (09:28 +0200)]
avformat/thp: Check fps

Fixes: division by zero
Fixes: 23162/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4856420817436672

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavformat/mpl2dec: Fix integer overflow with duration
Michael Niedermayer [Mon, 8 Jun 2020 07:47:41 +0000 (09:47 +0200)]
avformat/mpl2dec: Fix integer overflow with duration

Fixes: signed integer overflow: 9223372036854775807 - -1 cannot be represented in type 'long'
Fixes: 23167/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6425051741290496

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/cbs: Allocate more CodedBitstreamUnit at once in cbs_insert_unit()
Michael Niedermayer [Fri, 10 Apr 2020 20:05:07 +0000 (22:05 +0200)]
avcodec/cbs: Allocate more CodedBitstreamUnit at once in cbs_insert_unit()

Fixes: Timeout (85sec -> 0.5sec)
Fixes: 20791/clusterfuzz-testcase-minimized-ffmpeg_BSF_AV1_FRAME_SPLIT_fuzzer-5659537719951360
Fixes: 21214/clusterfuzz-testcase-minimized-ffmpeg_BSF_MPEG2_METADATA_fuzzer-5165560875974656
Fixes: 21247/clusterfuzz-testcase-minimized-ffmpeg_BSF_H264_METADATA_fuzzer-5715175257931776

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavformat/mov: Check if DTS is AV_NOPTS_VALUE in mov_find_next_sample().
Dale Curtis [Thu, 14 May 2020 21:38:07 +0000 (14:38 -0700)]
avformat/mov: Check if DTS is AV_NOPTS_VALUE in mov_find_next_sample().

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavfilter/vf_vaguedenoiser: fix small typo in option explanation
Paul B Mahol [Fri, 12 Jun 2020 22:41:16 +0000 (00:41 +0200)]
avfilter/vf_vaguedenoiser: fix small typo in option explanation

2 months agoavfilter/af_rubberband: adjust nb_samples after every command
Paul B Mahol [Fri, 12 Jun 2020 10:57:43 +0000 (12:57 +0200)]
avfilter/af_rubberband: adjust nb_samples after every command

2 months agoavformat/sccdec: split line with multiple subs
Paul B Mahol [Fri, 12 Jun 2020 18:03:42 +0000 (20:03 +0200)]
avformat/sccdec: split line with multiple subs

2 months agodoc/APIchanges: add new AV_PIX_FMT_X2RGB10
Lynne [Fri, 12 Jun 2020 16:48:28 +0000 (17:48 +0100)]
doc/APIchanges: add new AV_PIX_FMT_X2RGB10

2 months agolavu/hwcontext_vaapi: add vaapi_format_map support for x2rgb10
Fei Wang [Wed, 22 Apr 2020 05:23:03 +0000 (13:23 +0800)]
lavu/hwcontext_vaapi: add vaapi_format_map support for x2rgb10

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2 months agoswscale: Add swscale input/output support for X2RGB10LE
Fei Wang [Wed, 22 Apr 2020 05:23:02 +0000 (13:23 +0800)]
swscale: Add swscale input/output support for X2RGB10LE

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2 months agolavu/pix_fmt: add new pixel format x2rgb10
Fei Wang [Wed, 22 Apr 2020 05:23:01 +0000 (13:23 +0800)]
lavu/pix_fmt: add new pixel format x2rgb10

The format is packed RGB with each channel 10 bits available and
include 2 bits unused.

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2 months agomailmap: add entry for myself
Steven Liu [Fri, 12 Jun 2020 06:30:02 +0000 (14:30 +0800)]
mailmap: add entry for myself

2 months agotools/target_dec_fuzzer: Adjust threshold for lagarith
Michael Niedermayer [Sun, 7 Jun 2020 17:08:01 +0000 (19:08 +0200)]
tools/target_dec_fuzzer: Adjust threshold for lagarith

Fixes: Timeout (3minute 49 sec -> 3sec)
Fixes: 22020/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LAGARITH_fuzzer-5708544679870464

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/mpeg12dec: remove outdated comments
Michael Niedermayer [Sat, 6 Jun 2020 17:42:07 +0000 (19:42 +0200)]
avcodec/mpeg12dec: remove outdated comments

Found-by: Kieran
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/snowdec: Avoid integer overflow with huge qlog
Michael Niedermayer [Sat, 6 Jun 2020 15:45:39 +0000 (17:45 +0200)]
avcodec/snowdec: Avoid integer overflow with huge qlog

Fixes: integer overflow
Fixes: 22285/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SNOW_fuzzer-5682428762128384

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/movtextdec: Fix shift overflows in mov_text_init()
Michael Niedermayer [Fri, 5 Jun 2020 16:22:51 +0000 (18:22 +0200)]
avcodec/movtextdec: Fix shift overflows in mov_text_init()

Fixes: left shift of 243 by 24 places cannot be represented in type 'int'
Fixes: 22716/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOVTEXT_fuzzer-5704263425851392

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agotools/target_dem_fuzzer: Use file extensions listed in input formats
Michael Niedermayer [Mon, 8 Jun 2020 09:26:45 +0000 (11:26 +0200)]
tools/target_dem_fuzzer: Use file extensions listed in input formats

This should make it easier for the fuzzer to fuzz formats being detected only by
file extension and thus increase coverage

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavutil: add AV_FRAME_DATA_SEI_UNREGISTERED side data type
Limin Wang [Wed, 10 Jun 2020 15:34:30 +0000 (23:34 +0800)]
avutil: add AV_FRAME_DATA_SEI_UNREGISTERED side data type

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2 months agodnn-layer-mathunary-test: add unit test for tan
Ting Fu [Sat, 6 Jun 2020 12:12:51 +0000 (20:12 +0800)]
dnn-layer-mathunary-test: add unit test for tan

Signed-off-by: Ting Fu <ting.fu@intel.com>
Signed-off-by: Guo Yejun <yejun.guo@intel.com>
2 months agodnn_backend_native_layer_mathunary: add tan support
Ting Fu [Sat, 6 Jun 2020 12:12:50 +0000 (20:12 +0800)]
dnn_backend_native_layer_mathunary: add tan support

It can be tested with the model generated with below python scripy

import tensorflow as tf
import numpy as np
import imageio

in_img = imageio.imread('input.jpeg')
in_img = in_img.astype(np.float32)/255.0
in_data = in_img[np.newaxis, :]

x = tf.placeholder(tf.float32, shape=[1, None, None, 3], name='dnn_in')
x1 = tf.multiply(x, 0.78)
x2 = tf.tan(x1)
y = tf.identity(x2, name='dnn_out')

sess=tf.Session()
sess.run(tf.global_variables_initializer())

graph_def = tf.graph_util.convert_variables_to_constants(sess, sess.graph_def, ['dnn_out'])
tf.train.write_graph(graph_def, '.', 'image_process.pb', as_text=False)

print("image_process.pb generated, please use \
path_to_ffmpeg/tools/python/convert.py to generate image_process.model\n")

output = sess.run(y, feed_dict={x: in_data})
imageio.imsave("out.jpg", np.squeeze(output))

Signed-off-by: Ting Fu <ting.fu@intel.com>
Signed-off-by: Guo Yejun <yejun.guo@intel.com>
2 months agodnn-layer-mathunary-test: add unit test for cos
Ting Fu [Sat, 6 Jun 2020 12:12:49 +0000 (20:12 +0800)]
dnn-layer-mathunary-test: add unit test for cos

Signed-off-by: Ting Fu <ting.fu@intel.com>
Signed-off-by: Guo Yejun <yejun.guo@intel.com>
2 months agodnn_backend_native_layer_mathunary: add cos support
Ting Fu [Sat, 6 Jun 2020 12:12:48 +0000 (20:12 +0800)]
dnn_backend_native_layer_mathunary: add cos support

It can be tested with the model generated with below python scripy

import tensorflow as tf
import numpy as np
import imageio

in_img = imageio.imread('input.jpeg')
in_img = in_img.astype(np.float32)/255.0
in_data = in_img[np.newaxis, :]

x = tf.placeholder(tf.float32, shape=[1, None, None, 3], name='dnn_in')
x1 = tf.multiply(x, 1.5)
x2 = tf.cos(x1)
y = tf.identity(x2, name='dnn_out')

sess=tf.Session()
sess.run(tf.global_variables_initializer())

graph_def = tf.graph_util.convert_variables_to_constants(sess, sess.graph_def, ['dnn_out'])
tf.train.write_graph(graph_def, '.', 'image_process.pb', as_text=False)

print("image_process.pb generated, please use \
path_to_ffmpeg/tools/python/convert.py to generate image_process.model\n")

output = sess.run(y, feed_dict={x: in_data})
imageio.imsave("out.jpg", np.squeeze(output))

Signed-off-by: Ting Fu <ting.fu@intel.com>
Signed-off-by: Guo Yejun <yejun.guo@intel.com>
2 months agodnn-layer-mathunary-test: add unit test for sin
Ting Fu [Sat, 6 Jun 2020 12:12:47 +0000 (20:12 +0800)]
dnn-layer-mathunary-test: add unit test for sin

Signed-off-by: Ting Fu <ting.fu@intel.com>
Signed-off-by: Guo Yejun <yejun.guo@intel.com>
2 months agodnn_backend_native_layer_mathunary: add sin support
Ting Fu [Sat, 6 Jun 2020 12:12:46 +0000 (20:12 +0800)]
dnn_backend_native_layer_mathunary: add sin support

It can be tested with the model file generated with below python scripy:

import tensorflow as tf
import numpy as np
import imageio

in_img = imageio.imread('input.jpeg')
in_img = in_img.astype(np.float32)/255.0
in_data = in_img[np.newaxis, :]

x = tf.placeholder(tf.float32, shape=[1, None, None, 3], name='dnn_in')
x1 = tf.multiply(x, 3.14)
x2 = tf.sin(x1)
y = tf.identity(x2, name='dnn_out')

sess=tf.Session()
sess.run(tf.global_variables_initializer())

graph_def = tf.graph_util.convert_variables_to_constants(sess, sess.graph_def, ['dnn_out'])
tf.train.write_graph(graph_def, '.', 'image_process.pb', as_text=False)

print("image_process.pb generated, please use \
path_to_ffmpeg/tools/python/convert.py to generate image_process.model\n")

output = sess.run(y, feed_dict={x: in_data})
imageio.imsave("out.jpg", np.squeeze(output))

Signed-off-by: Ting Fu <ting.fu@intel.com>
Signed-off-by: Guo Yejun <yejun.guo@intel.com>
2 months agoavformat/aviobuf: Also return truncated buffer in avio_get_dyn_buf()
Andreas Rheinhardt [Mon, 25 May 2020 08:14:00 +0000 (10:14 +0200)]
avformat/aviobuf: Also return truncated buffer in avio_get_dyn_buf()

Two kinds of errors can happen when working with dynamic buffers:
(Re)allocation errors or truncation errors (one has to truncate the
buffer to a size of INT_MAX because avio_close_dyn_buf() and
avio_get_dyn_buf() both return an int). Right now, avio_get_dyn_buf()
returns an empty buffer in either case. But given that
avio_get_dyn_buf() does not destroy the dynamic buffer, one can return
the buffer in case of truncation and let the user check the error flags
and decide for himself instead of hardcoding a single way to proceed
in case of truncation.

(This actually restores the behaviour from before commit
163bb9ac0af495a5cb95441bdb5c02170440d28c.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavformat/aviobuf: Return better error codes
Andreas Rheinhardt [Sun, 24 May 2020 02:36:05 +0000 (04:36 +0200)]
avformat/aviobuf: Return better error codes

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavformat/aviobuf: Stop restricting dynamic buffer sizes to INT_MAX/2
Andreas Rheinhardt [Sun, 24 May 2020 02:04:29 +0000 (04:04 +0200)]
avformat/aviobuf: Stop restricting dynamic buffer sizes to INT_MAX/2

This has originally been done in 568e18b15e2ddf494fd8926707d34ca08c8edce5
as a precaution against integer overflows, but it is actually easy to
support the full range of int without overflows.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavformat/aviobuf: Simplify dyn_buf_write() a bit
Andreas Rheinhardt [Sun, 24 May 2020 02:02:27 +0000 (04:02 +0200)]
avformat/aviobuf: Simplify dyn_buf_write() a bit

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoavformat/aviobuf: Don't check for overflow after it happened
Andreas Rheinhardt [Sun, 24 May 2020 01:14:00 +0000 (03:14 +0200)]
avformat/aviobuf: Don't check for overflow after it happened

If adding two ints overflows, it doesn't matter whether the result will
be stored in an unsigned or not; and checking afterwards does not make it
retroactively defined.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2 months agoAVFormatContext: switch to child_class_iterate()
Anton Khirnov [Wed, 27 May 2020 13:34:07 +0000 (15:34 +0200)]
AVFormatContext: switch to child_class_iterate()

2 months agoAVIOContext: switch to child_class_iterate()
Anton Khirnov [Wed, 27 May 2020 13:34:07 +0000 (15:34 +0200)]
AVIOContext: switch to child_class_iterate()

2 months agoURLContext: switch to child_class_iterate()
Anton Khirnov [Wed, 27 May 2020 13:34:07 +0000 (15:34 +0200)]
URLContext: switch to child_class_iterate()

2 months agovf_spp: switch to child_class_iterate()
Anton Khirnov [Wed, 27 May 2020 13:34:07 +0000 (15:34 +0200)]
vf_spp: switch to child_class_iterate()

2 months agovf_scale: switch to child_class_iterate()
Anton Khirnov [Wed, 27 May 2020 13:34:07 +0000 (15:34 +0200)]
vf_scale: switch to child_class_iterate()