ffmpeg.git
6 months agoavformat/flac_picture: Switch to bytestream2 API
Andreas Rheinhardt [Fri, 29 Nov 2019 19:44:10 +0000 (20:44 +0100)]
avformat/flac_picture: Switch to bytestream2 API

ff_flac_parse_picture() parses a buffer containing a flac metadata
picture block by wrapping it in an AVIOContext and using the AVIOContext
API. Consequently, when not enough data could be read AVERROR(EIO) was
returned although reading didn't really fail: A block that contains a
subfield whose size field indicates that it is so big as to extend
beyond the buffer is just invalid.

This commit changes this by using the bytestream2 API instead;
furthermore, the checks for whether there is enough data left are
performed before allocating a buffer for said data.

Finally, if the length of the picture description is bigger than
INT_MAX, it will now raise an error.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavformat/flac_picture: Simplify checks
Andreas Rheinhardt [Fri, 29 Nov 2019 19:44:09 +0000 (20:44 +0100)]
avformat/flac_picture: Simplify checks

During parsing a flac picture metadata block, the mimetype is read as
follows: Its 32b size field is read and checked for being in the range
1..63; afterwards, the actual mimetype-string is read into a buffer of
size 64, where the length to read is the minimum of the length field and
the size of the destination buffer -1. Then an assert guards that length
is indeed < the size of the destination buffer before the string in the
buffer is zero-terminated.

The FFMIN as well as the assert are actually redundant, as it has
been checked that the string (even after terminating) fits into the
buffer. In order to make this clear, reword the check "len >= 64" to
"len >= sizeof(mimetype)" and drop the FFMIN as well as the assert.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavformat/smoothstreamingenc: removed unused check of avformat_free_context
Steven Liu [Fri, 29 Nov 2019 05:16:00 +0000 (13:16 +0800)]
avformat/smoothstreamingenc: removed unused check of avformat_free_context

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Reviewed-by: Jun Zhao <barryjzhao@tencent.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
6 months agoavformat/rtpenc_mpegts: removed unused check of avformat_free_context
Steven Liu [Fri, 29 Nov 2019 05:15:59 +0000 (13:15 +0800)]
avformat/rtpenc_mpegts: removed unused check of avformat_free_context

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Reviewed-by: Jun Zhao <barryjzhao@tencent.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
6 months agoavformat/hdsenc: removed unused check of avformat_free_context
Steven Liu [Fri, 29 Nov 2019 05:15:58 +0000 (13:15 +0800)]
avformat/hdsenc: removed unused check of avformat_free_context

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Reviewed-by: Jun Zhao <barryjzhao@tencent.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
6 months agoavformat/dashenc: remove unused check of avformat_free_context
Steven Liu [Fri, 29 Nov 2019 05:15:57 +0000 (13:15 +0800)]
avformat/dashenc: remove unused check of avformat_free_context

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Reviewed-by: Jun Zhao <barryjzhao@tencent.com>
Reviewed-by: Jeyapal, Karthick <kjeyapal@akamai.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
6 months agoavformat/avc: add missing return error value
James Almer [Sat, 30 Nov 2019 14:26:17 +0000 (11:26 -0300)]
avformat/avc: add missing return error value

Signed-off-by: James Almer <jamrial@gmail.com>
6 months agolavc/extract_extradata: Use bytestream api
Andriy Gelman [Sat, 30 Nov 2019 13:30:19 +0000 (08:30 -0500)]
lavc/extract_extradata: Use bytestream api

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
6 months agoavcodec/extract_extradata_bsf: Don't unref uninitialized buffers
Andreas Rheinhardt [Sat, 30 Nov 2019 06:38:10 +0000 (07:38 +0100)]
avcodec/extract_extradata_bsf: Don't unref uninitialized buffers

This happens if allocating extradata fails and s->remove is unset.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
6 months agoavformat/avc: fix sps buffer offset when calling ff_avc_decode_sps()
James Almer [Sat, 30 Nov 2019 02:13:36 +0000 (23:13 -0300)]
avformat/avc: fix sps buffer offset when calling ff_avc_decode_sps()

Skip the avcC specific size bytes and the NAL header bits.

Signed-off-by: James Almer <jamrial@gmail.com>
6 months agofate/demux: add an AV1 Annex B test
James Almer [Mon, 18 Nov 2019 13:44:32 +0000 (10:44 -0300)]
fate/demux: add an AV1 Annex B test

Signed-off-by: James Almer <jamrial@gmail.com>
6 months agoavcodec/av1_parser: export stream dimensions in avctx
James Almer [Mon, 18 Nov 2019 13:43:40 +0000 (10:43 -0300)]
avcodec/av1_parser: export stream dimensions in avctx

This is required to demux annexb samples when a decoder isn't available.

Signed-off-by: James Almer <jamrial@gmail.com>
6 months agofate/lavf-container: add an H264 mp4 remux test
James Almer [Fri, 29 Nov 2019 21:12:41 +0000 (18:12 -0300)]
fate/lavf-container: add an H264 mp4 remux test

This uses a raw h264 bitstream as source, in order to test the avcC
generation code.

Signed-off-by: James Almer <jamrial@gmail.com>
6 months agofate/lavf-container: add an AV1 mp4 remux test
James Almer [Fri, 29 Nov 2019 21:02:05 +0000 (18:02 -0300)]
fate/lavf-container: add an AV1 mp4 remux test

Signed-off-by: James Almer <jamrial@gmail.com>
6 months agolibavdevice/lavfi: check avfilter_graph_dump return value
Zhao Zhili [Thu, 21 Nov 2019 07:08:18 +0000 (15:08 +0800)]
libavdevice/lavfi: check avfilter_graph_dump return value

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavformat/avio: Use ffurl_closep
Andreas Rheinhardt [Fri, 29 Nov 2019 09:42:48 +0000 (10:42 +0100)]
avformat/avio: Use ffurl_closep

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavfilter/vf_hqdn3d: add support for commands
Paul B Mahol [Thu, 21 Nov 2019 14:50:35 +0000 (15:50 +0100)]
avfilter/vf_hqdn3d: add support for commands

6 months agoavfilter/vf_hqdn3d: add support for 12bit and 14bit yuv formats
Paul B Mahol [Thu, 21 Nov 2019 14:27:43 +0000 (15:27 +0100)]
avfilter/vf_hqdn3d: add support for 12bit and 14bit yuv formats

6 months agolavc/mvha: Check init_get_bits8() for failure
Jun Zhao [Thu, 28 Nov 2019 11:42:01 +0000 (19:42 +0800)]
lavc/mvha: Check init_get_bits8() for failure

fix potential null pointer dereference

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
6 months agolavf/vividas: check avformat_new_stream() return
Jun Zhao [Thu, 28 Nov 2019 11:07:48 +0000 (19:07 +0800)]
lavf/vividas: check avformat_new_stream() return

check avformat_new_stream() return.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
6 months agoavfilter/vf_yadif: rename config_props -> config_output, link -> outlink
Limin Wang [Thu, 28 Nov 2019 01:41:15 +0000 (09:41 +0800)]
avfilter/vf_yadif: rename config_props -> config_output, link -> outlink

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavformat/vividas: Avoid allocation of AVIOContext
Andreas Rheinhardt [Thu, 28 Nov 2019 14:31:33 +0000 (15:31 +0100)]
avformat/vividas: Avoid allocation of AVIOContext

Put an AVIOContext whose lifetime doesn't extend beyond the function where
it is allocated on the stack instead of allocating and freeing it. This
also avoids the need to free it, which in this case fixes possible
memleaks on error.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavformat/avc: write the missing bits in the AVC Decoder Configuration Box
James Almer [Tue, 26 Nov 2019 14:58:16 +0000 (11:58 -0300)]
avformat/avc: write the missing bits in the AVC Decoder Configuration Box

Signed-off-by: James Almer <jamrial@gmail.com>
6 months agoavformat/movenc: Avoid allocation for small dynamic buffers
Andreas Rheinhardt [Wed, 27 Nov 2019 12:22:11 +0000 (13:22 +0100)]
avformat/movenc: Avoid allocation for small dynamic buffers

By using avio_get_dyn_buf() + ffio_free_dyn_buf() instead of
avio_close_dyn_buf() + av_free() one can avoid an allocation + copy for
small dynamic buffers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 months agoavformat/matroskaenc: Avoid allocation for small dynamic buffers
Andreas Rheinhardt [Wed, 27 Nov 2019 12:22:10 +0000 (13:22 +0100)]
avformat/matroskaenc: Avoid allocation for small dynamic buffers

By using avio_get_dyn_buf() + ffio_free_dyn_buf() instead of
avio_close_dyn_buf() + av_free() one can avoid an allocation + copy for
small dynamic buffers (i.e. small master elements).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 months agoavformat/id3v2enc: Avoid allocation for small tags
Andreas Rheinhardt [Wed, 27 Nov 2019 12:22:09 +0000 (13:22 +0100)]
avformat/id3v2enc: Avoid allocation for small tags

By using avio_get_dyn_buf() + ffio_free_dyn_buf() instead of
avio_close_dyn_buf() + av_free() one can avoid an allocation + copy for
small tags. Furthermore, it simplifies freeing.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 months agoavformat/avc: Avoid allocation for small SPS/PPS arrays
Andreas Rheinhardt [Wed, 27 Nov 2019 12:22:08 +0000 (13:22 +0100)]
avformat/avc: Avoid allocation for small SPS/PPS arrays

By using avio_get_dyn_buf() + ffio_free_dyn_buf() instead of
avio_close_dyn_buf() + av_free() one can avoid an allocation + copy for
small extradata. Furthermore, it simplifies freeing.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 months agoavformat/av1: Avoid allocation for small headers
Andreas Rheinhardt [Wed, 27 Nov 2019 12:22:07 +0000 (13:22 +0100)]
avformat/av1: Avoid allocation for small headers

By using avio_get_dyn_buf() + ffio_free_dyn_buf() instead of
avio_close_dyn_buf() + av_free() one can avoid an allocation + copy for
small headers. Furthermore, it simplifies freeing.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 months agoavformat/apetag: Avoid allocation for small tags
Andreas Rheinhardt [Wed, 27 Nov 2019 12:22:06 +0000 (13:22 +0100)]
avformat/apetag: Avoid allocation for small tags

By using avio_get_dyn_buf() + ffio_free_dyn_buf() instead of
avio_close_dyn_buf() + av_free() one can avoid an allocation + copy for
small tags. Furthermore, it simplifies freeing.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 months agoavformat/aviobuf: Avoid allocating buffer when using dynamic buffer
Andreas Rheinhardt [Wed, 27 Nov 2019 12:22:05 +0000 (13:22 +0100)]
avformat/aviobuf: Avoid allocating buffer when using dynamic buffer

Up until now, using a dynamic buffer entailed at least three
allocations: One for the AVIOContext, one for the AVIOContext's opaque
(which, among other things, contains the small write buffer), and one
for the big buffer that is independently allocated that is returned when
calling avio_close_dyn_buf().

It is possible to avoid the third allocation if one doesn't use a
packetized dynamic buffer, if all the data written so far fit into the
write buffer and if one does not require the actual (big) buffer to have
an indefinite lifetime. This is done by making avio_get_dyn_buf() return
a pointer to the data in the write buffer if nothing has been written to
the main buffer yet. The dynamic buffer will then be freed using
ffio_free_dynamic_buffer (which needed to be modified not to call
avio_close_dyn_buf() internally).

So a typical use-case like:

size = avio_close_dyn_buf(dyn_pb, &buf);
do something with buf
av_free(buf);

can be converted to:

size = avio_get_dyn_buf(dyn_pb, &buf);
do something with buf
ffio_free_dynamic_buffer(&dyn_pb);

In more complex scenarios this can simplify freeing as well, because it
is now clear that freeing always has to be performed via
ffio_free_dynamic_buffer().

Of course, in case this saves an allocation it also saves a memcpy.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 months agoavfilter/vf_libvmaf: Check for av_frame_alloc failure
Limin Wang [Wed, 20 Nov 2019 15:24:22 +0000 (23:24 +0800)]
avfilter/vf_libvmaf: Check for av_frame_alloc failure

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavformat/flacenc: Add const to ff_flac_write_header() parameter
Andreas Rheinhardt [Wed, 27 Nov 2019 07:48:56 +0000 (08:48 +0100)]
avformat/flacenc: Add const to ff_flac_write_header() parameter

The extradata is not changed at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/vp8: fix multiple ff_thread_finish_setup() calls
Zhao Zhili [Thu, 14 Nov 2019 04:29:55 +0000 (12:29 +0800)]
avcodec/vp8: fix multiple ff_thread_finish_setup() calls

webp decoder doesn't set update_thread_context field

$ ffmpeg -i rgb_q80.webp -f null -
[webp @ 0x7ffbd5823200] Multiple ff_thread_finish_setup() calls

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavfilter/vf_colorconstancy: av_frame_free(&in) in case of error or direct flag is...
Limin Wang [Wed, 27 Nov 2019 10:46:51 +0000 (18:46 +0800)]
avfilter/vf_colorconstancy: av_frame_free(&in) in case of error or direct flag is false

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agolavc/qsvenc: Fix some code indentations
Linjie Fu [Tue, 26 Nov 2019 03:53:16 +0000 (11:53 +0800)]
lavc/qsvenc: Fix some code indentations

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
6 months agodoc/encoder: add the missing qsv encoders
Zhong Li [Wed, 27 Nov 2019 07:04:23 +0000 (07:04 +0000)]
doc/encoder: add the missing qsv encoders

Reviewed-by: Gyan Doshi <ffmpeg@gyani.pro>
Signed-off-by: Zhong Li <zhongli_dev@126.com>
6 months agolavc/rav1e: log and doc updated for const quantizer mode
Zhong Li [Tue, 12 Nov 2019 09:09:20 +0000 (09:09 +0000)]
lavc/rav1e: log and doc updated for const quantizer mode

Signed-off-by: Zhong Li <zhongli_dev@126.com>
6 months agoAdd options for spatial layers.
Thierry Foucu [Thu, 28 Nov 2019 00:25:33 +0000 (16:25 -0800)]
Add options for spatial layers.

Disable by default to output all the layers, to match libaomdec wrapper.
Add option to select the operating point for the spatial layers.
Update the documentation with the new options.

Signed-off-by: James Almer <jamrial@gmail.com>
6 months agoavcodec: add mvha video decoder
Paul B Mahol [Mon, 25 Nov 2019 11:59:56 +0000 (12:59 +0100)]
avcodec: add mvha video decoder

6 months agoavcodec: add mvdv video decoder
Paul B Mahol [Sat, 23 Nov 2019 12:46:55 +0000 (13:46 +0100)]
avcodec: add mvdv video decoder

6 months agoavformat/hls: correct grammatical errors of m3u8_hold_counters option
Steven Liu [Wed, 27 Nov 2019 11:04:00 +0000 (19:04 +0800)]
avformat/hls: correct grammatical errors of m3u8_hold_counters option

Suggested-by: Gyan <ffmpeg@gyani.pro>
Suggested-by: Rodney Baker <rodney.baker@iinet.net.au>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
6 months agolavc/qsvenc: Fix compilation for some build environments.
Carl Eugen Hoyos [Tue, 26 Nov 2019 23:03:33 +0000 (00:03 +0100)]
lavc/qsvenc: Fix compilation for some build environments.

Reported and tested by Sean Darcy.

6 months agoavutil/hwcontext_cuda: allow using primary CUDA device context
Oleg Dobkin [Mon, 18 Nov 2019 13:35:49 +0000 (15:35 +0200)]
avutil/hwcontext_cuda: allow using primary CUDA device context

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
6 months agoavformat/hlsenc: set strict_std_compliance from the parent AVFormatContext
Steven Liu [Mon, 25 Nov 2019 03:15:13 +0000 (11:15 +0800)]
avformat/hlsenc: set strict_std_compliance from the parent AVFormatContext

fix ticket: 8388

Reviewed-by: Jan Ekström <jeebjp@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
6 months agoavcodec/v210dec: add support for frame and slice threading
Limin Wang [Mon, 25 Nov 2019 03:45:10 +0000 (11:45 +0800)]
avcodec/v210dec: add support for frame and slice threading

1, Test server configure:
[root@localhost ~]# cat /proc/cpuinfo  |grep "model name"
 model name      : Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60GHz
 model name      : Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60GHz
 ...

[root@localhost ~]# free -h
              total        used        free      shared  buff/cache   available
              Mem:           102G        1.1G        100G         16M        657M        100G
              Swap:          4.0G          0B        4.0G

2, Test result:
encode the v210 input data for testing:
./ffmpeg -y -i 4k_422.ts  -c:v v210 -vframes 10 test.avi

master:
./ffmpeg -y -threads 1 -stream_loop 1000 -i ./test.avi -benchmark -f null -
frame=10010 fps= 60 q=-0.0 Lsize=N/A time=00:38:26.30 bitrate=N/A speed=13.7x
video:5240kB audio:432432kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
bench: utime=101.869s stime=66.181s rtime=167.996s
bench: maxrss=186552kB

patch applied:
./ffmpeg -y -threads 2 -thread_type slice -stream_loop 1000 -i ./test.avi -benchmark -f null -
frame=10010 fps= 72 q=-0.0 Lsize=N/A time=00:38:26.30 bitrate=N/A speed=16.5x
video:5240kB audio:432432kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
bench: utime=103.562s stime=74.858s rtime=139.599s
bench: maxrss=188616kB

./ffmpeg -y -threads 2 -thread_type frame -stream_loop 1000 -i ./test.avi -benchmark -f null -
frame=10010 fps= 85 q=-0.0 Lsize=N/A time=00:38:26.30 bitrate=N/A speed=19.6x
video:5240kB audio:432432kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
bench: utime=114.310s stime=92.685s rtime=117.693s
bench: maxrss=231896kB

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/v410dec: add support for frame and slice threading
Limin Wang [Mon, 25 Nov 2019 03:40:04 +0000 (11:40 +0800)]
avcodec/v410dec: add support for frame and slice threading

1, Test server configure:
[root@localhost ~]# cat /proc/cpuinfo  |grep "model name"
model name : Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60GHz
model name : Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60GHz
...

[root@localhost ~]# free -h
              total        used        free      shared  buff/cache   available
              Mem:           102G        1.1G        100G         16M        657M        100G
              Swap:          4.0G          0B        4.0G

2, Test result:
encode the v410 input data for testing:
 ./ffmpeg -y -i 4k_422.ts  -c:v v410 -vframes 10 test.avi

master:
./ffmpeg -y -stream_loop 1000 -i ./test.avi -benchmark -f null -
frame=10010 fps= 37 q=-0.0 Lsize=N/A time=00:38:26.30 bitrate=N/A speed= 8.6x
video:5240kB audio:432432kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
bench: utime=166.016s stime=102.192s rtime=268.120s
bench: maxrss=273400kB

patch applied:
./ffmpeg -y -threads 2 -thread_type slice -stream_loop 1000 -i ./test.avi -benchmark -f null -
frame=10010 fps= 53 q=-0.0 Lsize=N/A time=00:38:26.30 bitrate=N/A speed=12.3x
video:5240kB audio:432432kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
bench: utime=165.135s stime=100.456s rtime=187.994s
bench: maxrss=275476kB

./ffmpeg -y -threads 2 -thread_type frame -stream_loop 1000 -i ./test.avi -benchmark -f null -
frame=10010 fps= 61 q=-0.0 Lsize=N/A time=00:38:26.30 bitrate=N/A speed=14.1x
video:5240kB audio:432432kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
bench: utime=171.386s stime=122.102s rtime=163.637s
bench: maxrss=340308kB

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavformat/hls: add option for the m3u8 list load max times
Steven Liu [Mon, 18 Nov 2019 09:37:00 +0000 (17:37 +0800)]
avformat/hls: add option for the m3u8 list load max times

set max times for load m3u8 when the m3u8 list refresh do not with new
segments any times.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
6 months agoavcodec/nuv: Use ff_set_dimensions()
Michael Niedermayer [Sat, 23 Nov 2019 08:29:58 +0000 (09:29 +0100)]
avcodec/nuv: Use ff_set_dimensions()

Fixes: OOM
Fixes: 18956/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NUV_fuzzer-5766505644163072

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavformat/vividas: Error out on audio packets in the absence of audio streams
Michael Niedermayer [Tue, 5 Nov 2019 21:03:19 +0000 (22:03 +0100)]
avformat/vividas: Error out on audio packets in the absence of audio streams

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavformat/vividas: Check and require 1 video stream
Michael Niedermayer [Tue, 5 Nov 2019 20:52:41 +0000 (21:52 +0100)]
avformat/vividas: Check and require 1 video stream

The decoder hardcodes that audio is stream_id = 1 so it does not
currently work with more or less than 1 video stream at st=0

Fixes: assertion failure
Fixes: 18602/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6259277199310848

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/ffwavesynth: Fix integer overflow with pink_ts_cur/next
Michael Niedermayer [Tue, 5 Nov 2019 21:11:52 +0000 (22:11 +0100)]
avcodec/ffwavesynth: Fix integer overflow with pink_ts_cur/next

Fixes: signed integer overflow: 6175076100092079360 - -5034989061050195840 cannot be represented in type 'long'
Fixes: 18614/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5704508847423488

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/ralf: Fix integer overflows with the filter coefficient in decode_channel()
Michael Niedermayer [Tue, 5 Nov 2019 21:27:04 +0000 (22:27 +0100)]
avcodec/ralf: Fix integer overflows with the filter coefficient in decode_channel()

Fixes: signed integer overflow: 1145975808 - -1146173210 cannot be represented in type 'int'
Fixes: 18616/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RALF_fuzzer-5121296757424128

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/g729dec: Use 64bit and clip in scalar product
Michael Niedermayer [Tue, 5 Nov 2019 22:28:35 +0000 (23:28 +0100)]
avcodec/g729dec: Use 64bit and clip in scalar product

The G729 reference decoder clips after each individual operation and keeps track if overflow
occurred (in the fixed point implementation), this here is
simpler and faster but not 1:1 the same what the reference does.

Non fuzzed samples which trigger any such overflow are welcome, so
the need and impact of different clipping solutions can be evaluated.

Fixes: signed integer overflow: 1271483721 + 1073676289 cannot be represented in type 'int'
Fixes: 18617/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ACELP_KELVIN_fuzzer-5137705679978496

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/mxpegdec: Check for multiple SOF
Michael Niedermayer [Sun, 3 Nov 2019 11:20:14 +0000 (12:20 +0100)]
avcodec/mxpegdec: Check for multiple SOF

Fixes: Timeout (14sec -> 9ms)
Fixes: 18598/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MXPEG_fuzzer-5726095261564928

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/nuv: Move comptype check up
Michael Niedermayer [Sat, 2 Nov 2019 13:14:44 +0000 (14:14 +0100)]
avcodec/nuv: Move comptype check up

Fixes: Timeout (23sec -> 5ms)
Fixes: 18517/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NUV_fuzzer-5753135536013312

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/wmavoice: Fix integer overflow in synth_frame()
Michael Niedermayer [Sat, 2 Nov 2019 14:15:46 +0000 (15:15 +0100)]
avcodec/wmavoice: Fix integer overflow in synth_frame()

Fixes: left shift of negative value -3
Fixes: 18518/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAVOICE_fuzzer-6560514359951360

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/rawdec: Check bits_per_coded_sample more pedantically for 16bit cases
Michael Niedermayer [Sun, 20 Oct 2019 21:02:27 +0000 (23:02 +0200)]
avcodec/rawdec: Check bits_per_coded_sample more pedantically for 16bit cases

Fixes: shift exponent -14 is negative
Fixes: 18335/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RAWVIDEO_fuzzer-5723267192586240

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavutil/lfg: Correct index increment type to avoid undefined behavior
Michael Niedermayer [Sat, 19 Oct 2019 19:27:41 +0000 (21:27 +0200)]
avutil/lfg: Correct index increment type to avoid undefined behavior

Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
Fixes: 18333/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_COMFORTNOISE_fuzzer-5668481831272448

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/cngdec: Remove AV_CODEC_CAP_DELAY
Michael Niedermayer [Sat, 19 Oct 2019 19:58:26 +0000 (21:58 +0200)]
avcodec/cngdec: Remove AV_CODEC_CAP_DELAY

As is the decoder will never stop, it will cause an infinite loop. The RFC seems only
to speak of non empty packets so endlessly generating noise from the last empty flush
packets seems wrong.

Fixes: infinite loop
Fixes: 18333/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_COMFORTNOISE_fuzzer-5668481831272448

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agotools/target_dec_fuzzer: Adjust threshold for VP9
Michael Niedermayer [Fri, 18 Oct 2019 21:40:22 +0000 (23:40 +0200)]
tools/target_dec_fuzzer: Adjust threshold for VP9

The threshold is chosen so that the worse frames would together not take
excessive time.
A better solution is welcome!

Fixes: Timeout (308sec ->102ms)
Fixes: 18314/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP9_fuzzer-5701689176227840

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavformat/matroskaenc: Remove outdated comment
Andreas Rheinhardt [Wed, 6 Nov 2019 02:49:13 +0000 (03:49 +0100)]
avformat/matroskaenc: Remove outdated comment

This comment does not account for the fact that the limits on cluster
size and duration are configurable by the user since 98308bd4.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavformat/matroskaenc: Fix potential leak of cached packet
Andreas Rheinhardt [Wed, 6 Nov 2019 02:49:01 +0000 (03:49 +0100)]
avformat/matroskaenc: Fix potential leak of cached packet

If mkv_write_trailer() is not called, the cached audio packet might
leak; so unref it in mkv_deinit().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavformat/mxfenc: simplify d-10 ul handling
Baptiste Coudurier [Thu, 20 Jun 2019 23:11:28 +0000 (16:11 -0700)]
avformat/mxfenc: simplify d-10 ul handling

6 months agoavformat/mxfenc: simplify dv ul handling
Baptiste Coudurier [Thu, 20 Jun 2019 22:40:31 +0000 (15:40 -0700)]
avformat/mxfenc: simplify dv ul handling

6 months agoavformat/dvenc: support muxing dvcprohd
Baptiste Coudurier [Sat, 9 Nov 2019 23:56:32 +0000 (15:56 -0800)]
avformat/dvenc: support muxing dvcprohd

6 months agoavfilter: add axcorrelate filter
Paul B Mahol [Thu, 14 Nov 2019 20:16:18 +0000 (21:16 +0100)]
avfilter: add axcorrelate filter

6 months agoavfilter/vf_normalize: add support for commands
Paul B Mahol [Sat, 23 Nov 2019 10:07:02 +0000 (11:07 +0100)]
avfilter/vf_normalize: add support for commands

6 months agoavfilter/af_aiir: normalize biquads only if divisor is big enough
Paul B Mahol [Fri, 22 Nov 2019 20:06:35 +0000 (21:06 +0100)]
avfilter/af_aiir: normalize biquads only if divisor is big enough

6 months agoavfilter/af_biquads: add new normalize/n option
Paul B Mahol [Fri, 22 Nov 2019 19:54:12 +0000 (20:54 +0100)]
avfilter/af_biquads: add new normalize/n option

6 months agoavcodec/v4l2_context: Fix indentation
Andriy Gelman [Tue, 12 Nov 2019 05:37:03 +0000 (00:37 -0500)]
avcodec/v4l2_context: Fix indentation

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
Signed-off-by: Aman Gupta <aman@tmm1.net>
6 months agoavcodec/v4l2_m2m_dec: Fix decoding on Odroid XU4
Andriy Gelman [Tue, 12 Nov 2019 05:37:02 +0000 (00:37 -0500)]
avcodec/v4l2_m2m_dec: Fix decoding on Odroid XU4

c0c79461967 unintentianally changed the initialization flow of the
decoder: It caused the capture buffers to be initialized on
v4l2_m2m.c:180 in v4l2_configure_contexts(). This breaks h264 decoding
on the Odroid XU4 (RPI4 was not affected).

This commit postpones capture buffer initialization
as before c0c79461967 to fix the issue.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
Signed-off-by: Aman Gupta <aman@tmm1.net>
6 months agoavfilter/af_aiir: fix biquads normalization
Paul B Mahol [Fri, 22 Nov 2019 19:24:29 +0000 (20:24 +0100)]
avfilter/af_aiir: fix biquads normalization

6 months agoavfilter/af_aiir: add missing normalization of biquads gains
Paul B Mahol [Fri, 22 Nov 2019 16:42:04 +0000 (17:42 +0100)]
avfilter/af_aiir: add missing normalization of biquads gains

6 months agoavfilter/af_aiir: make a/b coefficients array
Paul B Mahol [Fri, 22 Nov 2019 15:13:06 +0000 (16:13 +0100)]
avfilter/af_aiir: make a/b coefficients array

6 months agoavfilter/af_aiir: factor out response calculation
Paul B Mahol [Fri, 22 Nov 2019 15:04:13 +0000 (16:04 +0100)]
avfilter/af_aiir: factor out response calculation

6 months agoavfilter/af_aiir: check for stability
Paul B Mahol [Fri, 22 Nov 2019 11:51:48 +0000 (12:51 +0100)]
avfilter/af_aiir: check for stability

6 months agodoc/filters: complete and correct vmafmotion section
Gyan Doshi [Fri, 22 Nov 2019 14:25:35 +0000 (19:55 +0530)]
doc/filters: complete and correct vmafmotion section

6 months agoavformat/av1: Fix leak of dynamic buffer in case of parsing failure
Andreas Rheinhardt [Thu, 21 Nov 2019 06:17:19 +0000 (07:17 +0100)]
avformat/av1: Fix leak of dynamic buffer in case of parsing failure

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
6 months agoavfilter/af_aiir: fix array length when selecting conjugate poles
Paul B Mahol [Thu, 21 Nov 2019 22:23:55 +0000 (23:23 +0100)]
avfilter/af_aiir: fix array length when selecting conjugate poles

6 months agoavfilter/graphdump: fix use of uninitialized variables
Zhao Zhili [Thu, 21 Nov 2019 06:58:26 +0000 (14:58 +0800)]
avfilter/graphdump: fix use of uninitialized variables

In case of av_bprint_finalize failed.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavfilter/avfilter: fix indentation
leozhang [Wed, 20 Nov 2019 12:10:57 +0000 (20:10 +0800)]
avfilter/avfilter: fix indentation

Signed-off-by: leozhang <leozhang@qiyi.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavfilter/vf_amplify: add timeline support
Paul B Mahol [Thu, 21 Nov 2019 17:34:07 +0000 (18:34 +0100)]
avfilter/vf_amplify: add timeline support

6 months agoavfilter/vf_datascope: add support for commands in oscilloscope
Paul B Mahol [Thu, 21 Nov 2019 17:08:48 +0000 (18:08 +0100)]
avfilter/vf_datascope: add support for commands in oscilloscope

6 months agoavfilter/vsrc_sierpinski: change seed option type
Paul B Mahol [Thu, 21 Nov 2019 16:38:48 +0000 (17:38 +0100)]
avfilter/vsrc_sierpinski: change seed option type

6 months agoavfilter/vsrc_sierpinski: fix another typos
Paul B Mahol [Thu, 21 Nov 2019 16:35:35 +0000 (17:35 +0100)]
avfilter/vsrc_sierpinski: fix another typos

6 months agoavfilter/vsrc_testsrc: simplify color filter commands parsing
Paul B Mahol [Thu, 21 Nov 2019 16:30:21 +0000 (17:30 +0100)]
avfilter/vsrc_testsrc: simplify color filter commands parsing

6 months agoavfilter/vf_chromakey: add support for commands
Paul B Mahol [Thu, 21 Nov 2019 16:19:40 +0000 (17:19 +0100)]
avfilter/vf_chromakey: add support for commands

6 months agoavfilter/vf_lumakey: add support for commands
Paul B Mahol [Thu, 21 Nov 2019 15:59:39 +0000 (16:59 +0100)]
avfilter/vf_lumakey: add support for commands

6 months agoavfilter/vf_lumakey: change options to doubles, so that values are automatically...
Paul B Mahol [Thu, 21 Nov 2019 15:52:48 +0000 (16:52 +0100)]
avfilter/vf_lumakey: change options to doubles, so that values are automatically scaled

6 months agoavfilter/vf_lumakey: add support for 12bit yuva formats
Paul B Mahol [Thu, 21 Nov 2019 15:40:17 +0000 (16:40 +0100)]
avfilter/vf_lumakey: add support for 12bit yuva formats

6 months agoavfilter/vf_scroll: add support for slice threading
Paul B Mahol [Thu, 21 Nov 2019 11:55:17 +0000 (12:55 +0100)]
avfilter/vf_scroll: add support for slice threading

6 months agoavfilter/vf_chromashift: add support for commands
Paul B Mahol [Thu, 21 Nov 2019 11:24:02 +0000 (12:24 +0100)]
avfilter/vf_chromashift: add support for commands

6 months agoavfilter/vf_fillborders: add support for commands
Paul B Mahol [Thu, 21 Nov 2019 11:07:58 +0000 (12:07 +0100)]
avfilter/vf_fillborders: add support for commands

6 months agoavfilter/af_afftdn: simplify changing commands
Paul B Mahol [Thu, 21 Nov 2019 10:49:23 +0000 (11:49 +0100)]
avfilter/af_afftdn: simplify changing commands

6 months agoavfilter/vf_median: clip radius instead of erroring out
Paul B Mahol [Thu, 21 Nov 2019 10:21:31 +0000 (11:21 +0100)]
avfilter/vf_median: clip radius instead of erroring out

6 months agoavfilter/vf_median: add support for commands
Paul B Mahol [Wed, 20 Nov 2019 21:27:43 +0000 (22:27 +0100)]
avfilter/vf_median: add support for commands

6 months agoavcodec/mjpegbdec: Fix yuv444 pix_fmt detection
Alex Mogurenko [Wed, 20 Nov 2019 11:22:46 +0000 (13:22 +0200)]
avcodec/mjpegbdec: Fix yuv444 pix_fmt detection

by default adobe_transform set to 0 and because of that mjpegb decoder detects yuv444 pix fmt as bgrp

6 months agoavfilter/f_graphmonitor: output frames in pts gaps
Paul B Mahol [Wed, 20 Nov 2019 16:44:18 +0000 (17:44 +0100)]
avfilter/f_graphmonitor: output frames in pts gaps

6 months agoavcodec/iff: Move index use after check in decodeplane8()
Michael Niedermayer [Tue, 29 Oct 2019 18:12:23 +0000 (19:12 +0100)]
avcodec/iff: Move index use after check in decodeplane8()

Fixes: index 9 out of bounds for type 'const uint64_t [8][256]'
Fixes: 18409/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5767030560522240
Fixes: 18720/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5651995784642560

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/atrac3: Check for huge block aligns
Michael Niedermayer [Sun, 20 Oct 2019 21:51:58 +0000 (23:51 +0200)]
avcodec/atrac3: Check for huge block aligns

The largest documented frame size = block align is 1024 bytes
(https://wiki.multimedia.cx/index.php/ATRAC3)

Without a limit this can allocate arbitrary memory and trigger OOM
Fixes: OOM
Fixes: 18337/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ATRAC3_fuzzer-5763861478637568
Fixes: 18556/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ATRAC3AL_fuzzer-5646183334936576

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