ffmpeg.git
2 months agoavutil/file: add more check befor destory the buffer
Jun Zhao [Fri, 30 Aug 2019 01:09:16 +0000 (09:09 +0800)]
avutil/file: add more check befor destory the buffer

add more check befor destory the buffer

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2 months agoavutil/file: always set *size to zero if *bufptr is NULL
Jun Zhao [Wed, 28 Aug 2019 16:15:52 +0000 (00:15 +0800)]
avutil/file: always set *size to zero if *bufptr is NULL

Always set *size to zero if *bufptr is NULL, it's more make sence.

fix #8095

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2 months agoavcodec: add IMM5 decoder
Paul B Mahol [Fri, 14 Sep 2018 09:14:15 +0000 (11:14 +0200)]
avcodec: add IMM5 decoder

2 months agoavcodec/msrle: add a flush() callback
Paul B Mahol [Thu, 29 Aug 2019 16:28:49 +0000 (18:28 +0200)]
avcodec/msrle: add a flush() callback

The reference frame isn't valid after seeking.

2 months agoconfigure: fix --enable-omx compile on raspberry pi
Aman Gupta [Thu, 29 Aug 2019 15:44:45 +0000 (08:44 -0700)]
configure: fix --enable-omx compile on raspberry pi

Many ffmpeg + rpi compilation guides on the internet recommend
using `./configure --enable-omx --enable-omx-rpi`. This fails
to find the IL OMX headers on device because the omx require_headers
check happens first before the add_cflags in omx_rpi.

A workaround is to use `./configure --enable-omx-rpi` only, since
omx_rpi already implies omx. But because many users expect to use
existing scripts and commands, we swap the order here so omx_rpi
special cases are applied first.

In the past this wasn't an issue because users noticed the OMX_Core.h
missing error and installed libomxil-bellagio-dev. But since
76c82843ccad1, the rpi specific headers from /opt/vc/include/IL
are required.

Signed-off-by: Aman Gupta <aman@tmm1.net>
2 months agoavcodec/ivi: Allocate bufs later
Michael Niedermayer [Tue, 13 Aug 2019 23:28:09 +0000 (01:28 +0200)]
avcodec/ivi: Allocate bufs later

Fixes: Timeout (24sec->2sec)
Fixes: 15951/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INDEO5_fuzzer-5095433266790400

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_dec_fuzzer: Adjust maxpixels for indeo4
Michael Niedermayer [Tue, 13 Aug 2019 21:42:09 +0000 (23:42 +0200)]
tools/target_dec_fuzzer: Adjust maxpixels for indeo4

Fixes: Timeout (131sec -> 4sec)
Fixes: 15581/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INDEO4_fuzzer-5651105515569152

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_dec_fuzzer: Adjust GDV pixel threshold down by a factor of 2
Michael Niedermayer [Tue, 13 Aug 2019 20:06:12 +0000 (22:06 +0200)]
tools/target_dec_fuzzer: Adjust GDV pixel threshold down by a factor of 2

Fixes: Timeout (7sec -> 1sec)
Fixes: 14709/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_GDV_fuzzer-5704215281795072

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_dec_fuzzer: adjust pixel threshold for SANM, as it allows coding giganti...
Michael Niedermayer [Mon, 12 Aug 2019 08:40:30 +0000 (10:40 +0200)]
tools/target_dec_fuzzer: adjust pixel threshold for SANM, as it allows coding gigantic images on tiny input

Fixes: Timeout (13sec ->1sec)
Fixes: 16122/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SANM_fuzzer-5724944247291904

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/tta: Fix integer overflow in prediction
Michael Niedermayer [Sun, 11 Aug 2019 18:56:44 +0000 (20:56 +0200)]
avcodec/tta: Fix integer overflow in prediction

Fixes: signed integer overflow: -395281576 + -1827578048 cannot be represented in type 'int'
Fixes: 16038/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TTA_fuzzer-5646109705240576

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/vb: Check input packet size to be large enough to contain flags
Michael Niedermayer [Sun, 11 Aug 2019 22:21:49 +0000 (00:21 +0200)]
avcodec/vb: Check input packet size to be large enough to contain flags

Fixes: Timeout (->9sec)
Fixes: 16292/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VB_fuzzer-5747063496638464

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/cavsdec: Limit the number of access units per packet to 2
Michael Niedermayer [Sat, 10 Aug 2019 15:34:37 +0000 (17:34 +0200)]
avcodec/cavsdec: Limit the number of access units per packet to 2

Fixes: Timeout (122sec -> 13ms)
Fixes: 15978/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CAVS_fuzzer-5148925004087296

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/mpsubdec: Remove floating point usage
Michael Niedermayer [Tue, 30 Jul 2019 17:11:27 +0000 (19:11 +0200)]
avformat/mpsubdec: Remove floating point usage

This makes the code bitexact between platforms.
Intermediate timestamps between frames are preserved.
The timebase is simplified.
Rounding differs from doubles in cases where timestamps/durations
are "funny"

Suggested-by: jb
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agolavc/cbs_h2645: Use av_realloc instead of av_malloc
Thierry Foucu [Mon, 26 Aug 2019 20:50:40 +0000 (13:50 -0700)]
lavc/cbs_h2645: Use av_realloc instead of av_malloc

Follow the description of av_realloc, the memory needs to be allocated
by av_realloc.

2 months agolavf/dump: dump the vbv_delay with N/A instead of 18446744073709551615
Limin Wang [Tue, 27 Aug 2019 14:34:54 +0000 (22:34 +0800)]
lavf/dump: dump the vbv_delay with N/A instead of 18446744073709551615

How to check it:
./ffmpeg -f lavfi -i testsrc  -c:v mpeg2video  -f null  -
master:
  Side data:
        cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay:
        18446744073709551615
patch applied:
Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/dsd: use uint8_t instead of unsigned char
Paul B Mahol [Wed, 28 Aug 2019 15:30:55 +0000 (17:30 +0200)]
avcodec/dsd: use uint8_t instead of unsigned char

2 months agoavcodec/dsddec: add slice threading support
Paul B Mahol [Wed, 28 Aug 2019 15:28:16 +0000 (17:28 +0200)]
avcodec/dsddec: add slice threading support

2 months agoavformat/dsfdec: set packet pts/duration/pos correctly
Paul B Mahol [Tue, 30 Jul 2019 11:16:33 +0000 (13:16 +0200)]
avformat/dsfdec: set packet pts/duration/pos correctly

2 months agoavcodec/h264_refs: do not use invalid mmco values in case of error
Paul B Mahol [Wed, 7 Aug 2019 16:49:08 +0000 (18:49 +0200)]
avcodec/h264_refs: do not use invalid mmco values in case of error

Change one relevant assert to av_assert0 while here.

2 months agoavformat/mov: improve timecode calculation
Paul B Mahol [Thu, 22 Aug 2019 16:14:15 +0000 (18:14 +0200)]
avformat/mov: improve timecode calculation

Fixes timecode calculation for NTSC frame rates.
Fixes ticket #5978.

2 months agoavcodec/tiff: add missing break in tiff_decode_tag()
Paul B Mahol [Wed, 28 Aug 2019 13:46:40 +0000 (15:46 +0200)]
avcodec/tiff: add missing break in tiff_decode_tag()

2 months agoavformat/dhav: always initializer ret
Paul B Mahol [Wed, 28 Aug 2019 13:44:36 +0000 (15:44 +0200)]
avformat/dhav: always initializer ret

2 months agoavfilter/af_compand: change error condition into warning
Paul B Mahol [Tue, 6 Aug 2019 11:37:58 +0000 (13:37 +0200)]
avfilter/af_compand: change error condition into warning

2 months agolibavcodec/amfenc: Vulkan initialization support for encoder.
OvchinnikovDmitrii [Thu, 8 Aug 2019 18:33:25 +0000 (21:33 +0300)]
libavcodec/amfenc: Vulkan initialization support for encoder.

Added linux support for amf encoder through vulkan.

To use h.264(AMD VCE) encoder on linux amdgru-pro version 19.20+ and
amf-amdgpu-pro package(amdgru-pro contains, but does not install
automatically) are required.

This driver can be installed using amdgpu-pro-install script in
official amd driver archive.

Initialization of amf encoder occurs in this order:
1) trying to initialize through dx11(only windows)
2) trying to initialize through dx9(only windows)
3) trying to initialize through vulkan

Only Vulkan initialization available on linux.

2 months agoavcodec/qtrle: don't clear the palette when flushing
James Almer [Tue, 27 Aug 2019 18:24:01 +0000 (15:24 -0300)]
avcodec/qtrle: don't clear the palette when flushing

It may be propagated only once for the entire stream.

Signed-off-by: James Almer <jamrial@gmail.com>
2 months agoavcodec/qtrle: call ff_reget_buffer() only when the picture data is going to change
James Almer [Mon, 26 Aug 2019 17:29:59 +0000 (14:29 -0300)]
avcodec/qtrle: call ff_reget_buffer() only when the picture data is going to change

ff_reget_buffer() will attempt to create a writable copy of the frame,
which is not needed when the decoder intends to return a reference to
the same buffer as the previous frame.

Should reduce data copy, hopefully achieving a similar speed up as
a9dacdeea6168787a142209bd19fdd74aefc9dd6 without dropping frames.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2 months agoRevert "avcodec/qtrle: Do not output duplicated frames on insufficient input"
James Almer [Mon, 26 Aug 2019 02:10:41 +0000 (23:10 -0300)]
Revert "avcodec/qtrle: Do not output duplicated frames on insufficient input"

This reverts commit a9dacdeea6168787a142209bd19fdd74aefc9dd6.

This patch effectively made the decoder output vfr content out of samples
where cfr is expected.

Addresses ticket #7880.

Signed-off-by: James Almer <jamrial@gmail.com>
2 months agoavcodec/atrac9dec: Check block_align
Michael Niedermayer [Sun, 18 Aug 2019 23:03:59 +0000 (01:03 +0200)]
avcodec/atrac9dec: Check block_align

Fixes: Infinite loop
Fixes: 16260/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ATRAC9_fuzzer-5676365617037312
Fixes: 16260/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ATRAC9_fuzzer-5768093879500800

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/qtrle: add a flush() callback
James Almer [Mon, 26 Aug 2019 18:27:55 +0000 (15:27 -0300)]
avcodec/qtrle: add a flush() callback

The reference frame isn't valid after seeking

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2 months agoavcodec/h2645_parse: zero initialize the rbsp buffer
James Almer [Mon, 26 Aug 2019 03:54:20 +0000 (00:54 -0300)]
avcodec/h2645_parse: zero initialize the rbsp buffer

Fixes ticket #8093

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2 months agoavcodec/vaapi_encode: respect -force_key_frames setting
Aman Gupta [Wed, 7 Aug 2019 17:20:51 +0000 (10:20 -0700)]
avcodec/vaapi_encode: respect -force_key_frames setting

This was a regression in 5fdcf85bbffe7451c227478fda62da5c0938f27d

Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Mark Thompson <sw@jkqxz.net>
2 months agotools/target_dec_fuzzer: Increase maxpixels threshold for dirac
Michael Niedermayer [Sat, 24 Aug 2019 23:00:30 +0000 (01:00 +0200)]
tools/target_dec_fuzzer: Increase maxpixels threshold for dirac

wavelets allow significant size expansion and they are also not
very fast.

Fixes: Timeout
Fixes: 16480/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5659892689403904 (108sec -> 17ms)
Fixes: 16480/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5749422717140992 (big ->15sec)

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agotools/target_dec_fuzzer: Do not corrupt the packet size return
Michael Niedermayer [Sun, 25 Aug 2019 18:41:57 +0000 (20:41 +0200)]
tools/target_dec_fuzzer: Do not corrupt the packet size return

Fixes: Timeout (infinite)
Fixes: 16732/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TAK_fuzzer-5642166377906176

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/alac: Check for bps of 0
Michael Niedermayer [Thu, 8 Aug 2019 23:23:49 +0000 (01:23 +0200)]
avcodec/alac: Check for bps of 0

Fixes: shift exponent 32 is too large for 32-bit type 'unsigned int'
Fixes: 15764/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-5102101203517440

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavfilter/vf_derain: reindent code after last commit
Xuewei Meng [Mon, 26 Aug 2019 07:09:46 +0000 (15:09 +0800)]
avfilter/vf_derain: reindent code after last commit

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2 months agodoc/examples/decode_video: add input file format information for usage
Steven Liu [Wed, 21 Aug 2019 11:34:49 +0000 (19:34 +0800)]
doc/examples/decode_video: add input file format information for usage

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2 months agodoc/examples/decode_audio: print message about how to play the output file
Steven Liu [Wed, 21 Aug 2019 11:34:28 +0000 (19:34 +0800)]
doc/examples/decode_audio: print message about how to play the output file

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2 months agoavformat/hlsenc: remove unused value
Steven Liu [Wed, 21 Aug 2019 02:24:36 +0000 (10:24 +0800)]
avformat/hlsenc: remove unused value

CID: 1452644
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2 months agoavformat/hlsenc: fix memleak of filename
Steven Liu [Wed, 21 Aug 2019 02:24:25 +0000 (10:24 +0800)]
avformat/hlsenc: fix memleak of filename

CID: 1452445
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2 months agoavformat/hlsenc: fix memleak in hls_write_trailer
Steven Liu [Wed, 21 Aug 2019 02:24:12 +0000 (10:24 +0800)]
avformat/hlsenc: fix memleak in hls_write_trailer

fix CID: 1426931

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2 months agolibavfilter: Add dehaze-filter option in existing derain.
Xuewei Meng [Thu, 22 Aug 2019 10:28:44 +0000 (18:28 +0800)]
libavfilter: Add dehaze-filter option in existing derain.

Add the support of dehaze filter in existing derain filter source
code. As the processing procedure in FFmpeg is the same for current
derain and dehaze, we reuse the derain filter source code. The
model training and generation scripts are in repo
https://github.com/XueweiMeng/derain_filter.git

Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Xuewei Meng <xwmeng96@gmail.com>
2 months agolavc/x264: Also clean-up libx264rgb after init errors.
Carl Eugen Hoyos [Sun, 25 Aug 2019 14:09:40 +0000 (16:09 +0200)]
lavc/x264: Also clean-up libx264rgb after init errors.

Missed in c180f0f6

2 months agoavformat/movenc: add muxing support for Dolby TrueHD streams
James Almer [Thu, 1 Aug 2019 03:54:53 +0000 (00:54 -0300)]
avformat/movenc: add muxing support for Dolby TrueHD streams

Signed-off-by: James Almer <jamrial@gmail.com>
2 months agoavformat/mov: add demuxing support for Dolby TrueHD streams
James Almer [Thu, 1 Aug 2019 03:49:08 +0000 (00:49 -0300)]
avformat/mov: add demuxing support for Dolby TrueHD streams

Signed-off-by: James Almer <jamrial@gmail.com>
2 months agoavcodec/mlp_parser: export AVCodecContext frame_size
James Almer [Sun, 25 Aug 2019 01:41:52 +0000 (22:41 -0300)]
avcodec/mlp_parser: export AVCodecContext frame_size

Signed-off-by: James Almer <jamrial@gmail.com>
2 months agoavcodec/mlp_parse: move TrueHD channel layout and sample rate related code to the...
James Almer [Wed, 31 Jul 2019 20:54:28 +0000 (17:54 -0300)]
avcodec/mlp_parse: move TrueHD channel layout and sample rate related code to the header

It will be needed by the next commit.

Signed-off-by: James Almer <jamrial@gmail.com>
2 months agoavformat/dhav: handle files missing data at start
Paul B Mahol [Sat, 24 Aug 2019 16:03:46 +0000 (18:03 +0200)]
avformat/dhav: handle files missing data at start

Try to seek to end of file and if signature is found seek backwards until
last valid chunk is found.

2 months agoavformat/dhav: gracefully handle corrupted files
Paul B Mahol [Sat, 24 Aug 2019 08:59:49 +0000 (10:59 +0200)]
avformat/dhav: gracefully handle corrupted files

Try to find next valid chunk in offsets of 0x8000 from last good one.

2 months agofate/als: Add test for conformance file with 512 channels.
Thilo Borgmann [Thu, 22 Aug 2019 19:21:12 +0000 (21:21 +0200)]
fate/als: Add test for conformance file with 512 channels.

2 months agoavcodec/videotoolbox_hevc: avoid leaking cached_hw_frames_ctx
Pavel Koshevoy [Wed, 7 Aug 2019 02:42:15 +0000 (20:42 -0600)]
avcodec/videotoolbox_hevc: avoid leaking cached_hw_frames_ctx

vtctx->cached_hw_frames_ctx is unref'd in videotoolbox_uninit,
but videotoolbox_hevc used ff_videotoolbox_uninit which
doesn't unref cache_hw_frames_ctx.

Signed-off-by: Pavel Koshevoy <pkoshevoy@gmail.com>
2 months agoavcodec/omx: Fix handling of fragmented buffers
Dave Stevenson [Thu, 17 Jan 2019 17:39:34 +0000 (17:39 +0000)]
avcodec/omx: Fix handling of fragmented buffers

See https://trac.ffmpeg.org/ticket/7687

If an encoded frame is returned split over two or more
IL buffers due to the size, then there is a race between
whether get_buffer will fail, return NULL, and a truncated
frame is passed on, or IL will return the remaining part
of the encoded frame.
If get_buffer returns NULL, part of the frame is left behind
in the codec, and will be collected on the next call. That
then leaves a frame stuck in the codec. Repeat enough times
and the codec FIFO is full, and the pipeline stalls.

A performance improvement in the Raspberry Pi firmware means
that the timing has changed, and now frequently drops into the
case where get_buffer returns NULL.

Add code such that should a buffer be received without
OMX_BUFFERFLAG_ENDOFFRAME that get_buffer is called with wait
set, so we wait for the remainder of the frame.
This code has been made conditional on the Pi build in case
other IL implementations don't handle ENDOFFRAME correctly.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Martin Storsjö <martin@martin.st>
2 months agoavcodec/omx: ensure zerocopy mode can be disabled on rpi builds
Aman Gupta [Thu, 22 Aug 2019 18:02:45 +0000 (11:02 -0700)]
avcodec/omx: ensure zerocopy mode can be disabled on rpi builds

fixes https://trac.ffmpeg.org/ticket/6586

Signed-off-by: Aman Gupta <aman@tmm1.net>
2 months agoavcodec/omx: add support for -force_key_frames
Aman Gupta [Wed, 21 Aug 2019 17:39:07 +0000 (10:39 -0700)]
avcodec/omx: add support for -force_key_frames

Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Martin Storsjö <martin@martin.st>
2 months agoMAINTAINERS: add myself to OMX
Aman Gupta [Thu, 22 Aug 2019 21:10:26 +0000 (14:10 -0700)]
MAINTAINERS: add myself to OMX

Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavformat/mpegtsenc: get rid of packet counting for sdt/pat/pmt
Marton Balint [Thu, 8 Aug 2019 07:53:10 +0000 (09:53 +0200)]
avformat/mpegtsenc: get rid of packet counting for sdt/pat/pmt

The packet counting based approach caused excessive sdt/pat/pmt for VBR, so
let's use a timestamp based approach instead similar to how we emit PCRs.
SDT/PAT/PMT period should be consistent for both VBR and CBR from now on.

Also change the type of sdt_period and pat_period to AV_OPT_TYPE_DURATION so no
floating point math is necessary.

Fixes ticket #3714.

Signed-off-by: Marton Balint <cus@passwd.hu>
2 months agoavformat/mpegtsenc: move some code around and simplify a bit
Marton Balint [Wed, 14 Aug 2019 22:51:10 +0000 (00:51 +0200)]
avformat/mpegtsenc: move some code around and simplify a bit

PCR does not need to be recalcualted for CBR when inserting a NULL or PCR only
packet.

Signed-off-by: Marton Balint <cus@passwd.hu>
2 months agoavformat/mpegtsenc: add support for setting PCR interval for VBR streams
Marton Balint [Mon, 12 Aug 2019 21:32:11 +0000 (23:32 +0200)]
avformat/mpegtsenc: add support for setting PCR interval for VBR streams

Also document the algorithm for the default PCR interval.

Fixes ticket #8061.

Signed-off-by: Marton Balint <cus@passwd.hu>
2 months agoavformat/mpegtsenc: rename pcr_period variable to pcr_period_ms
Marton Balint [Thu, 8 Aug 2019 20:35:25 +0000 (22:35 +0200)]
avformat/mpegtsenc: rename pcr_period variable to pcr_period_ms

Signed-off-by: Marton Balint <cus@passwd.hu>
2 months agoavcodec/alac: Fix multiple integer overflows in lpc_prediction()
Michael Niedermayer [Thu, 8 Aug 2019 17:48:19 +0000 (19:48 +0200)]
avcodec/alac: Fix multiple integer overflows in lpc_prediction()

Fixes: signed integer overflow: 2088795537 + 2147254401 cannot be represented in type 'int'
Fixes: signed integer overflow: -1500363496 + -1295351808 cannot be represented in type 'int'
Fixes: signed integer overflow: -79560 * 32640 cannot be represented in type 'int'
Fixes: signed integer overflow: 2088910005 + 2088796058 cannot be represented in type 'int'
Fixes: signed integer overflow: -117258064 - 2088725225 cannot be represented in type 'int'
Fixes: signed integer overflow: 2088725225 - -117258064 cannot be represented in type 'int'
Fixes: 15739/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-5630664122040320

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/smacker: Check that not all tables are skiped
Michael Niedermayer [Thu, 8 Aug 2019 20:38:11 +0000 (22:38 +0200)]
avcodec/smacker: Check that not all tables are skiped

If all tables are skipped it would be impossible to encode any
"non black" video.

Fixes: Timeout (78sec -> 1ms)
Fixes: 15821/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMACKER_fuzzer-5652598838788096

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/pictordec: Optimize picmemset() for single plane full lines
Michael Niedermayer [Fri, 2 Aug 2019 21:10:35 +0000 (23:10 +0200)]
avcodec/pictordec: Optimize picmemset() for single plane full lines

Fixes: Timeout (72sec -> 1sec)
Fixes: 15512/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PICTOR_fuzzer-5663942342344704

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/pnm_parser: Use memmove() to handle "overread"
Michael Niedermayer [Thu, 1 Aug 2019 20:20:48 +0000 (22:20 +0200)]
avcodec/pnm_parser: Use memmove() to handle "overread"

This is significantly faster

Fixes: Timeout (1sec after this and the previous commit)
Fixes: 15558/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PPM_fuzzer-5705273643106304

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/parser: Optimize ff_combine_frame() with massivly negative next
Michael Niedermayer [Thu, 1 Aug 2019 20:18:43 +0000 (22:18 +0200)]
avcodec/parser: Optimize ff_combine_frame() with massivly negative next

Fixes: Timeout
Fixes: 15558/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PPM_fuzzer-5705273643106304

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/pnm: skip reading trailing bytes in get_pnm()
Michael Niedermayer [Thu, 1 Aug 2019 19:12:07 +0000 (21:12 +0200)]
avcodec/pnm: skip reading trailing bytes in get_pnm()

None of the keys we support is that long and other keys
lead to decoder failure. None of the values is expected
to be longer, they are all numbers or short keywords.

This simplifies the code

Fixes: Timeout (9sec->43ms)
Fixes: 15177/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PAM_fuzzer-5080556716425216

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/pnm: Check magic bytes directly without pnm_get()
Michael Niedermayer [Thu, 1 Aug 2019 18:04:15 +0000 (20:04 +0200)]
avcodec/pnm: Check magic bytes directly without pnm_get()

Fixes: Timeout (10sec -> 30ms) (case 15089)
Fixes: 15089/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PBM_fuzzer-5767535057698816
Fixes: 16001/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PGM_fuzzer-5199169645445120
Fixes: 16003/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PGMYUV_fuzzer-5076443270217728

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/mpsubdec: Check pts / duration before cast
Michael Niedermayer [Sun, 28 Jul 2019 21:05:45 +0000 (23:05 +0200)]
avformat/mpsubdec: Check pts / duration before cast

Fixes: 3e+47 is outside the range of representable values of type 'int'
Fixes: 16057/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5691111307214848

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/lcldec: Check mthread_inlen instead of cliping
Michael Niedermayer [Sat, 27 Jul 2019 21:24:25 +0000 (23:24 +0200)]
avcodec/lcldec: Check mthread_inlen instead of cliping

Clipping was added in 2009 to avoid crashes.
The clipped case would produce a 2nd slice with 0 input
thus also producing 0 output.
Subsequent checks will cause decoder failure unless both
slices have the same output length. thus the only way this
would not already fail is if the output from both slices
was 0 bytes.

Fixes: Timeout (134sec -> 241ms)
Fixes: 15599/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MSZH_fuzzer-5658127116009472

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/rl2: set dimensions
Michael Niedermayer [Mon, 22 Jul 2019 21:24:35 +0000 (23:24 +0200)]
avcodec/rl2: set dimensions

The dimensions are always 320x200 they are hardcoded in the demuxer.
Hardcode them instead in the decoder.

Fixes: Timeout (16sec -> 400ms)
Fixes: 15574/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RL2_fuzzer-5158614072819712

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/flvdec: delete unused code
leozhang [Wed, 14 Aug 2019 03:07:18 +0000 (11:07 +0800)]
avformat/flvdec: delete unused code

Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Signed-off-by: leozhang <leozhang@qiyi.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoChange libaom default to crf=32.
elliottk [Wed, 21 Aug 2019 19:18:20 +0000 (12:18 -0700)]
Change libaom default to crf=32.

Current default is 256kbps, which produces inconsistent
results (too high for low-res, too low for hi-res).
Use CRF instead, which will adapt.

Signed-off-by: James Zern <jzern@google.com>
2 months agoavcodec/h264_parse: retry decoding SPS with complete NAL
Jun Li [Thu, 22 Aug 2019 20:58:30 +0000 (13:58 -0700)]
avcodec/h264_parse: retry decoding SPS with complete NAL

Fix #6591
The content has no rbsp_stop_one_bit for ending the SPS, that
causes the decoding SPS failure, results decoding frame failure as well.

The patch is just adding a retry with complete NALU, copied from the retry in decode_nal_unit()

Signed-off-by: James Almer <jamrial@gmail.com>
2 months agotools/target_dec_fuzzer: use refcounted packets
James Almer [Tue, 20 Aug 2019 21:58:03 +0000 (18:58 -0300)]
tools/target_dec_fuzzer: use refcounted packets

Should reduce allocations and data copying.

Signed-off-by: James Almer <jamrial@gmail.com>
2 months agoavcodec/aacdec: Add FF_CODEC_CAP_INIT_CLEANUP
Michael Niedermayer [Thu, 22 Aug 2019 21:43:48 +0000 (23:43 +0200)]
avcodec/aacdec: Add FF_CODEC_CAP_INIT_CLEANUP

Fixes: memleaks
Fixes: 16289/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_LATM_fuzzer-5200695692623872

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>
2 months agoavcodec/idcinvideo: Add 320x240 default maximum resolution
Michael Niedermayer [Thu, 22 Aug 2019 17:13:56 +0000 (19:13 +0200)]
avcodec/idcinvideo: Add 320x240 default maximum resolution

Fixes: Timeout (128sec -> 2ms)
Fixes: 16568/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IDCIN_fuzzer-5675004095627264

See: [FFmpeg-devel] [PATCH 4/4] tools/target_dec_fuzzer: Adjust max_pixels for IDCIN

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agotools/target_dec_fuzzer: Do not increase max_pixels
Michael Niedermayer [Thu, 22 Aug 2019 17:29:19 +0000 (19:29 +0200)]
tools/target_dec_fuzzer: Do not increase max_pixels

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agolavfi: add deshake_opencl filter
Jarek Samic [Thu, 8 Aug 2019 13:24:32 +0000 (09:24 -0400)]
lavfi: add deshake_opencl filter

3 months agolavfi: modify avfilter_get_matrix to support separate scale factors
Jarek Samic [Thu, 8 Aug 2019 13:24:31 +0000 (09:24 -0400)]
lavfi: modify avfilter_get_matrix to support separate scale factors

3 months agolavfi: add utilities to reduce OpenCL boilerplate code
Jarek Samic [Thu, 8 Aug 2019 13:24:30 +0000 (09:24 -0400)]
lavfi: add utilities to reduce OpenCL boilerplate code

3 months agoavcodec: remove some dead assignments
Marton Balint [Sat, 17 Aug 2019 17:12:01 +0000 (19:12 +0200)]
avcodec: remove some dead assignments

Signed-off-by: Marton Balint <cus@passwd.hu>
3 months agoavutil/imgutils: remove dead assignment
Marton Balint [Sat, 17 Aug 2019 13:34:20 +0000 (15:34 +0200)]
avutil/imgutils: remove dead assignment

Signed-off-by: Marton Balint <cus@passwd.hu>
3 months agoavformat/mxfdec: do not ignore bad size errors
Marton Balint [Sat, 17 Aug 2019 09:40:11 +0000 (11:40 +0200)]
avformat/mxfdec: do not ignore bad size errors

The return value was unintentionally lost after
00a2652df3bf25a27d174cc67ed508b5317cb115.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 months agoavformat/realtextdec: free queue on error
Michael Niedermayer [Wed, 21 Aug 2019 18:37:17 +0000 (20:37 +0200)]
avformat/realtextdec: free queue on error

Fixes: memleak
Fixes: 16277/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5696629440512000

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavcodec/vp5/6/8: use vpX_rac_is_end()
Michael Niedermayer [Tue, 20 Aug 2019 09:51:48 +0000 (11:51 +0200)]
avcodec/vp5/6/8: use vpX_rac_is_end()

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavformat/vividas: Check av_xiphlacing() return value before use
Michael Niedermayer [Wed, 21 Aug 2019 21:05:21 +0000 (23:05 +0200)]
avformat/vividas: Check av_xiphlacing() return value before use

Fixes: out of array access
Fixes: 16277/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5696629440512000

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>
3 months agoAdd assembly support for -fsanitize=hwaddress tagged globals.
Peter Collingbourne [Wed, 21 Aug 2019 18:55:25 +0000 (11:55 -0700)]
Add assembly support for -fsanitize=hwaddress tagged globals.

As of LLVM r368102, Clang will set a pointer tag in bits 56-63 of the
address of a global when compiling with -fsanitize=hwaddress. This requires
an adjustment to assembly code that takes the address of such globals: the
code cannot use the regular R_AARCH64_ADR_PREL_PG_HI21 relocation to refer
to the global, since the tag would take the address out of range. Instead,
the code must use the non-checking (_NC) variant of the relocation (the
link-time check is substituted by a runtime check).

This change makes the necessary adjustment in the movrel macro, where it is
needed when compiling with -fsanitize=hwaddress.

Signed-off-by: Peter Collingbourne <pcc@google.com>
Reviewed-by: Martin Storsjö
Reviewed-by: Janne Grunau
3 months agolibavfilter: Update derain filter doc.
Xuewei Meng [Sat, 27 Jul 2019 02:59:26 +0000 (10:59 +0800)]
libavfilter: Update derain filter doc.

Add the usage of tensorflow model in derain filter. Training scripts
as well as scripts for tf/native model generation are provided in the
repository at https://github.com/XueweiMeng/derain_filter.git.

Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Xuewei Meng <xwmeng96@gmail.com>
3 months agoavfilter/vf_v360: remove unused header
Paul B Mahol [Tue, 20 Aug 2019 09:52:54 +0000 (11:52 +0200)]
avfilter/vf_v360: remove unused header

3 months agoavfilter/vf_v360: improve comments above headers
Paul B Mahol [Tue, 20 Aug 2019 09:48:15 +0000 (11:48 +0200)]
avfilter/vf_v360: improve comments above headers

3 months agodoc/filters: fix typos
Paul B Mahol [Tue, 20 Aug 2019 09:43:49 +0000 (11:43 +0200)]
doc/filters: fix typos

3 months agoadd v360 to Changelog
Paul B Mahol [Tue, 20 Aug 2019 09:41:13 +0000 (11:41 +0200)]
add v360 to Changelog

3 months agodoc/filters: fix v360 options names
Paul B Mahol [Tue, 20 Aug 2019 09:40:04 +0000 (11:40 +0200)]
doc/filters: fix v360 options names

3 months agoavformat/hlsenc: avformat/hlsenc: simplified code
Steven Liu [Tue, 20 Aug 2019 03:46:10 +0000 (11:46 +0800)]
avformat/hlsenc: avformat/hlsenc: simplified code

simplified code for get dirname string in hls_delete_old_segments

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
3 months agoavformat/hlsenc: simplified code of use_localtime in hls_init
Steven Liu [Tue, 20 Aug 2019 02:31:01 +0000 (10:31 +0800)]
avformat/hlsenc: simplified code of use_localtime in hls_init

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
3 months agoavformat/hlsenc: fix memleak in update_variant_stream_info
Steven Liu [Tue, 20 Aug 2019 02:29:04 +0000 (10:29 +0800)]
avformat/hlsenc: fix memleak in update_variant_stream_info

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
3 months agoavcodec/alsdec: Fix integer overflow in decode_var_block_data()
Michael Niedermayer [Sun, 18 Aug 2019 23:30:53 +0000 (01:30 +0200)]
avcodec/alsdec: Fix integer overflow in decode_var_block_data()

Fixes: signed integer overflow: 1927975249 - -514719744 cannot be represented in type 'int'
Fixes: 16413/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5651206856245248

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Thilo Borgmann <thilo.borgmann@mail.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavcodec/internal: Bump sane_nb_chanels
Michael Niedermayer [Tue, 20 Aug 2019 14:52:08 +0000 (16:52 +0200)]
avcodec/internal: Bump sane_nb_chanels

This allows decoding more als reference samples

Suggested-by: Thilo Borgmann <thilo.borgmann@mail.de>
Reviewed-by: Thilo Borgmann <thilo.borgmann@mail.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavcodec/alsdec: Limit maximum channels to 512
Michael Niedermayer [Tue, 20 Aug 2019 14:52:07 +0000 (16:52 +0200)]
avcodec/alsdec: Limit maximum channels to 512

There seems to be no limit in the specification and upto 64k could be stored
512 is choosen as limit as thats the maximum in a conformance sample

An alternative to this patch would be a max_channels variable

Fixes: OOM
Fixes: 16200/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5764788793114624

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Suggested-by: Thilo Borgmann <thilo.borgmann@mail.de>
Reviewed-by: Thilo Borgmann <thilo.borgmann@mail.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agolavfi/qsvvpp: disable pass through mode if format changed
Zhong Li [Thu, 15 Aug 2019 02:33:57 +0000 (10:33 +0800)]
lavfi/qsvvpp: disable pass through mode if format changed

Partly fix tiket#8065

Signed-off-by: Zhong Li <zhong.li@intel.com>
3 months agolavfi/scale_qsv: change alignment to be 16 bytes
Zhong Li [Tue, 30 Jul 2019 14:54:08 +0000 (22:54 +0800)]
lavfi/scale_qsv: change alignment to be 16 bytes

32 bytes alignment is not needed and increases the failure possibilty of
SFC (low power scaling mode)

Signed-off-by: Zhong Li <zhong.li@intel.com>
3 months agolavc/qsvdec: Add VP9 decoder support
Zhong Li [Tue, 13 Aug 2019 06:11:12 +0000 (14:11 +0800)]
lavc/qsvdec: Add VP9 decoder support

VP9 decoder is support on Intel kabyLake+ platforms with MSDK Version 1.19+

Signed-off-by: Zhong Li <zhong.li@intel.com>