ffmpeg.git
11 hours agoavcodec/decode: copy the output parameters from the last bsf in the chain back to... master
James Almer [Thu, 26 Jul 2018 23:43:19 +0000 (20:43 -0300)]
avcodec/decode: copy the output parameters from the last bsf in the chain back to the AVCodecContext

Certain AVCodecParameters, like the contents of the extradata, may be changed
by the init() function of any of the bitstream filters in the chain.

Signed-off-by: James Almer <jamrial@gmail.com>
11 hours agoavcodec/decode: flush the internal bsfs instead of constantly reinitalizing them
James Almer [Thu, 26 Jul 2018 23:42:27 +0000 (20:42 -0300)]
avcodec/decode: flush the internal bsfs instead of constantly reinitalizing them

Initialize the bsfs once when opening the codec and uninitialize them once when
closing it, instead of at every codec flush/seek.

Signed-off-by: James Almer <jamrial@gmail.com>
11 hours agoavcodec/h264_redundant_pps_bsf: implement a AVBSFContext.flush() callback
James Almer [Fri, 27 Jul 2018 01:32:15 +0000 (22:32 -0300)]
avcodec/h264_redundant_pps_bsf: implement a AVBSFContext.flush() callback

Signed-off-by: James Almer <jamrial@gmail.com>
11 hours agoavcodec/mpeg4_unpack_bframes_bsf: implement a AVBSFContext.flush() callback
James Almer [Fri, 27 Jul 2018 01:26:01 +0000 (22:26 -0300)]
avcodec/mpeg4_unpack_bframes_bsf: implement a AVBSFContext.flush() callback

Signed-off-by: James Almer <jamrial@gmail.com>
11 hours agoavcodec/vp9_superframe_bsf: implement a AVBSFContext.flush() callback
James Almer [Fri, 27 Jul 2018 01:24:47 +0000 (22:24 -0300)]
avcodec/vp9_superframe_bsf: implement a AVBSFContext.flush() callback

Signed-off-by: James Almer <jamrial@gmail.com>
11 hours agoavcodec/vp9_superframe_split_bsf: implement a AVBSFContext.flush() callback
James Almer [Thu, 26 Jul 2018 23:35:16 +0000 (20:35 -0300)]
avcodec/vp9_superframe_split_bsf: implement a AVBSFContext.flush() callback

Signed-off-by: James Almer <jamrial@gmail.com>
11 hours agoavcodec/h264_mp4toannexb_bsf: implement a AVBSFContext.flush() callback
James Almer [Thu, 26 Jul 2018 23:34:52 +0000 (20:34 -0300)]
avcodec/h264_mp4toannexb_bsf: implement a AVBSFContext.flush() callback

Signed-off-by: James Almer <jamrial@gmail.com>
11 hours agoavcodec/bsf: add a flushing mechanism to AVBSFContext
James Almer [Thu, 26 Jul 2018 23:32:13 +0000 (20:32 -0300)]
avcodec/bsf: add a flushing mechanism to AVBSFContext

Meant to reset the internal bsf state without the need to reinitialize it.

Signed-off-by: James Almer <jamrial@gmail.com>
26 hours agolavfi: fix can't dispaly "slice" sub-option in "ffmpeg -h full"
Jun Zhao [Mon, 13 Aug 2018 01:30:27 +0000 (09:30 +0800)]
lavfi: fix can't dispaly "slice" sub-option in "ffmpeg -h full"

 fix can't dispaly "slice" sub-option in "ffmpeg -h full" for
 AVFilter options.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
37 hours agoavcodec/frame_thread_encoder: fix memory leak that occurs when close encoder without...
lee ju [Sat, 4 Aug 2018 10:19:45 +0000 (10:19 +0000)]
avcodec/frame_thread_encoder: fix memory leak that  occurs when close encoder without sending eof and receiving to end

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
39 hours agoavcodec/scpr: Check for min > max in decompress_p()
Michael Niedermayer [Sat, 4 Aug 2018 21:45:52 +0000 (23:45 +0200)]
avcodec/scpr: Check for min > max in decompress_p()

Fixes: Timeout
Fixes: 9342/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-4795990841229312

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
39 hours agoavcodec/shorten: Fix signed 32bit overflow in shift in shorten_decode_frame()
Michael Niedermayer [Sun, 12 Aug 2018 21:06:55 +0000 (23:06 +0200)]
avcodec/shorten: Fix signed 32bit overflow in shift in shorten_decode_frame()

Fixes: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
Fixes: 9480/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-6647324284551168 -rss_limit_mb=2000

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
39 hours agoavcodec/shorten: Fix integer overflow in residual/LPC combination
Michael Niedermayer [Sun, 12 Aug 2018 20:55:59 +0000 (22:55 +0200)]
avcodec/shorten: Fix integer overflow in residual/LPC combination

Fixes: signed integer overflow: -540538872 + -2012739576 cannot be represented in type 'int'
Fixes: 9255/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-5758630052757504

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
39 hours agoavcodec/shorten: Check verbatim length
Michael Niedermayer [Sun, 12 Aug 2018 20:43:33 +0000 (22:43 +0200)]
avcodec/shorten: Check verbatim length

Fixes: Timeout
Fixes: 9252/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-5780720709533696

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
40 hours agoavfilter/vf_hue: 10bit support
Michael Niedermayer [Wed, 1 Aug 2018 17:48:08 +0000 (19:48 +0200)]
avfilter/vf_hue: 10bit support

Tested-by: Tobias Rapp <t.rapp@noa-archive.com>
Tested-by: Reto Kromer <lists@reto.ch>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
45 hours agodoc/filters: Add entry for sr filter.
Sergey Lavrushkin [Wed, 15 Aug 2018 16:35:09 +0000 (19:35 +0300)]
doc/filters: Add entry for sr filter.

Signed-off-by: Gyan Doshi <ffmpeg@gyani.pro>
2 days agoavutil/encryption_info: Fix size calculation.
Jacob Trimble [Mon, 13 Aug 2018 22:17:11 +0000 (15:17 -0700)]
avutil/encryption_info: Fix size calculation.

Found by Chrome's ClusterFuzz: https://crbug.com/873693

Signed-off-by: Jacob Trimble <modmaker@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 days agolavfi/vf_colorconstancy: cosmetic update
Mina [Tue, 14 Aug 2018 18:56:51 +0000 (20:56 +0200)]
lavfi/vf_colorconstancy: cosmetic update

2 days agolavfi/vf_colorconstancy: change option ranges
Mina [Tue, 14 Aug 2018 18:55:08 +0000 (20:55 +0200)]
lavfi/vf_colorconstancy: change option ranges

2 days agolibavfilter: Adds proper file descriptions to dnn_srcnn.h and dnn_espcn.h.
Sergey Lavrushkin [Thu, 2 Aug 2018 16:56:23 +0000 (19:56 +0300)]
libavfilter: Adds proper file descriptions to dnn_srcnn.h and dnn_espcn.h.

Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
2 days agolibavfilter/vf_sr.c: Removes uint8 -> float and float -> uint8 conversions.
Sergey Lavrushkin [Tue, 31 Jul 2018 15:58:28 +0000 (18:58 +0300)]
libavfilter/vf_sr.c: Removes uint8 -> float and float -> uint8 conversions.

Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
2 days agolibavfilter/dnn_backend_tf.c: Fixes ff_dnn_free_model_tf.
Sergey Lavrushkin [Tue, 31 Jul 2018 15:40:24 +0000 (18:40 +0300)]
libavfilter/dnn_backend_tf.c: Fixes ff_dnn_free_model_tf.

Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
2 days agolavc/videotoolboxenc: Fix compilation on osx 10.10.5 Yosemite
Thilo Borgmann [Thu, 9 Aug 2018 10:47:35 +0000 (12:47 +0200)]
lavc/videotoolboxenc: Fix compilation on osx 10.10.5 Yosemite

Signed-off-by: Aman Gupta <aman@tmm1.net>
2 days agoavformat: correct fdebug loglevel
Gyan Doshi [Mon, 13 Aug 2018 07:02:41 +0000 (12:32 +0530)]
avformat: correct fdebug loglevel

fftools/cmdutils sets loglevel for fdebug to DEBUG but all fdebug output
except for two were emitted at TRACE.

2 days agolibswscale: Adds conversions from/to float gray format.
Sergey Lavrushkin [Fri, 3 Aug 2018 15:06:50 +0000 (18:06 +0300)]
libswscale: Adds conversions from/to float gray format.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 days agolibavformat/dashdec: Support negative value of the @r attrbute of S in SegmentTimelin...
sanil [Mon, 13 Aug 2018 08:53:59 +0000 (16:53 +0800)]
libavformat/dashdec: Support negative value of the @r attrbute of S in SegmentTimeline element.

The following patch supports parsing negative value of the @r attribute of S in SegmentTimeline element.

Example streams:
1. http://dash.edgesuite.net/dash264/TestCases/1c/qualcomm/1/MultiRate.mpd
2. http://dash.edgesuite.net/dash264/TestCases/1c/qualcomm/2/MultiRate.mpd

4 days agolavfi: add erosion_opencl, dilation_opencl filters
Danil Iashchenko [Sun, 12 Aug 2018 20:12:08 +0000 (23:12 +0300)]
lavfi: add erosion_opencl, dilation_opencl filters

Add erosion_opencl, dilation_opencl filters. Behave like existing erosion and dilation filters.

4 days agoavcodec/mpegaudio_parser: Initialize poutbuf*
Michael Niedermayer [Sun, 5 Aug 2018 12:51:36 +0000 (14:51 +0200)]
avcodec/mpegaudio_parser: Initialize poutbuf*

Possibly fixes: null pointer dereference
Possibly fixes: 9352/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MP3ADUFLOAT_fuzzer-5146068961460224
Fixes: Heap-use-after-free
Fixes: 9453/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MP3ADUFLOAT_fuzzer-5137954375729152

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 days agoavcodec/ivi: Factor width dereference out of the loops in ivi_output_plane()
Michael Niedermayer [Sat, 4 Aug 2018 00:34:11 +0000 (02:34 +0200)]
avcodec/ivi: Factor width dereference out of the loops in ivi_output_plane()

396078 -> 268468 dezicycles

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 days agoavcodec/ivi: Only clip samples when needed in ivi_output_plane()
Michael Niedermayer [Sat, 4 Aug 2018 00:31:58 +0000 (02:31 +0200)]
avcodec/ivi: Only clip samples when needed in ivi_output_plane()

435740 -> 396078 dezicycles

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 days agoavcodec/indeo5: require initial valid intra/gop headers not just later
Michael Niedermayer [Sat, 4 Aug 2018 00:19:15 +0000 (02:19 +0200)]
avcodec/indeo5: require initial valid intra/gop headers not just later

Fixes: Timeout
Fixes: 9308/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INDEO5_fuzzer-5284853581873152

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 days agoavcodec/microdvddec: limit style characters in parsing
Michael Niedermayer [Sat, 4 Aug 2018 00:56:56 +0000 (02:56 +0200)]
avcodec/microdvddec: limit style characters in parsing

Fixes: Timeout
Fixes: 9293/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MICRODVD_fuzzer-5643972541153280

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 days agolibavutil: Adds gray floating-point pixel formats.
Sergey Lavrushkin [Fri, 3 Aug 2018 15:02:49 +0000 (18:02 +0300)]
libavutil: Adds gray floating-point pixel formats.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 days agolavf/mov.c: Set start_time for all streams (in case of edit lists).
Sasi Inguva [Mon, 6 Aug 2018 23:28:50 +0000 (16:28 -0700)]
lavf/mov.c: Set start_time for all streams (in case of edit lists).

Fixes vorbis mp4 audio files, with edit list specified. Since
st->skip_samples is not set in case of vorbis , ffmpeg computes the
start_time as negative.

Signed-off-by: Sasi Inguva <isasi@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 days agolavfi/vf_libvmaf: update to use libvmaf v1.3.9
Kyle Swanson [Tue, 7 Aug 2018 22:05:16 +0000 (15:05 -0700)]
lavfi/vf_libvmaf: update to use libvmaf v1.3.9

Signed-off-by: Kyle Swanson <kswanson@netflix.com>
7 days agolavc/hevcdec: add ONLY_IF_THREADS_ENABLED where it is missing.
Jun Zhao [Wed, 8 Aug 2018 06:31:27 +0000 (14:31 +0800)]
lavc/hevcdec: add ONLY_IF_THREADS_ENABLED where it is missing.

add ONLY_IF_THREADS_ENABLED where it is missing.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
Reviewed-by: James Almer <jamrial@gmail.com>
7 days agolavfi/selectivecolor: fix neutral color filtering
Clément Bœsch [Thu, 9 Aug 2018 17:22:02 +0000 (19:22 +0200)]
lavfi/selectivecolor: fix neutral color filtering

Neutrals are supposed to be anything not black (0,0,0) and not white
(N,N,N).

Previous neutral filtering code was too strict by excluding colors with
any of its RGB component maxed instead of just the white color.

Reported-by: Royi Avital <royiavital@yahoo.com>
8 days agolavfi/xbr: update filter url
Mina [Wed, 8 Aug 2018 19:49:02 +0000 (21:49 +0200)]
lavfi/xbr: update filter url

Existing link is broken.
This patch updates the existing url with a working one.

Signed-off-by: Mina <minasamy_@hotmail.com>
Signed-off-by: Gyan Doshi <ffmpeg@gyani.pro>
8 days agolavf/mov: Force HEVC codec_id for code-point dvh1 and an hvcC atom.
Carl Eugen Hoyos [Mon, 6 Aug 2018 22:33:40 +0000 (00:33 +0200)]
lavf/mov: Force HEVC codec_id for code-point dvh1 and an hvcC atom.

The mp4 registration authority accepted a code-point for Dolby Vision
HEVC that was already used as a fourcc for DVCPRO 100.

Fixes ticket #7347.

8 days agolibavformat/dashdec: Fix for un-free memory
Colin NG [Wed, 8 Aug 2018 17:27:07 +0000 (17:27 +0000)]
libavformat/dashdec: Fix for un-free memory

Fixes ticket #7338.

9 days agoMAINTAINERS: add myself to MIPS section
Shiyou Yin [Thu, 26 Jul 2018 03:46:23 +0000 (11:46 +0800)]
MAINTAINERS: add myself to MIPS section

Signed-off-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Reviewed-by: Manojkumar Bhosale <Manojkumar.Bhosale@imgtec.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
9 days agoffmpeg: simplify refcounting packets for the muxing queue
James Almer [Mon, 6 Aug 2018 00:34:14 +0000 (21:34 -0300)]
ffmpeg: simplify refcounting packets for the muxing queue

Signed-off-by: James Almer <jamrial@gmail.com>
9 days agoavs2: correct avs2 description
hwren [Tue, 7 Aug 2018 10:39:34 +0000 (18:39 +0800)]
avs2: correct avs2 description

Signed-off-by: hwren <hwrenx@126.com>
Signed-off-by: Gyan Doshi <ffmpeg@gyani.pro>
9 days agolavc/libx264: Support monochrome encoding.
Carl Eugen Hoyos [Tue, 7 Aug 2018 18:41:02 +0000 (20:41 +0200)]
lavc/libx264: Support monochrome encoding.

9 days agolibavfilter: Fixes warnings for unused variables in dnn_srcnn.h, dnn_espcn.h, dnn_bac...
Sergey Lavrushkin [Sat, 28 Jul 2018 09:55:02 +0000 (12:55 +0300)]
libavfilter: Fixes warnings for unused variables in dnn_srcnn.h, dnn_espcn.h, dnn_backend_tf.c.

Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
9 days agolibavfilter: Code style fixes for pointers in DNN module and sr filter.
Sergey Lavrushkin [Fri, 27 Jul 2018 16:34:02 +0000 (19:34 +0300)]
libavfilter: Code style fixes for pointers in DNN module and sr filter.

Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
9 days agolibavfilter: Adds on the fly generation of default DNN models for tensorflow backend...
Sergey Lavrushkin [Fri, 27 Jul 2018 16:31:55 +0000 (19:31 +0300)]
libavfilter: Adds on the fly generation of default DNN models for tensorflow backend instead of storing binary model.

Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
10 days agoavformat/flvdec: add flv_full_metadata option into flvdec
Steven Liu [Tue, 7 Aug 2018 07:51:36 +0000 (15:51 +0800)]
avformat/flvdec: add flv_full_metadata option into flvdec

output all the metadata context when use this option.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
10 days agoavformat/flvdec: reindent code for previous commit
Steven Liu [Tue, 7 Aug 2018 07:50:47 +0000 (15:50 +0800)]
avformat/flvdec: reindent code for previous commit

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
10 days agoavformat/flvdec: add flv_ignore_prevtag option into flvdec
Steven Liu [Tue, 7 Aug 2018 07:48:23 +0000 (15:48 +0800)]
avformat/flvdec: add flv_ignore_prevtag option into flvdec

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
10 days agoavformat/dashdec: remove unused functions and process code
Steven Liu [Tue, 7 Aug 2018 04:37:02 +0000 (12:37 +0800)]
avformat/dashdec: remove unused functions and process code

Based on a patch for hls by Richard Shaffer

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
10 days agoavformat/dashdec: Fix memleak when resolve_content_path
Jacek Jendrzej [Tue, 7 Aug 2018 03:32:05 +0000 (11:32 +0800)]
avformat/dashdec: Fix memleak when resolve_content_path

Can be reproduced with:  valgrind  --leak-check=full  -v ffmpeg -i
http://yt-dash-mse-test.commondatastorage.googleapis.com/media/motion-20120802-manifest.mpd

Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
10 days agoavformat/dashdec: fix for ticket #7336
Jacek Jendrzej [Tue, 7 Aug 2018 03:30:04 +0000 (11:30 +0800)]
avformat/dashdec: fix for ticket #7336

fix for ticket #7336

Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
10 days agofftools/qsv: add extra_hw_frames support
Zhong Li [Wed, 25 Jul 2018 08:05:38 +0000 (16:05 +0800)]
fftools/qsv: add extra_hw_frames support

Currently extra_hw_frames can't be applied to qsv since it
doesn't call function avcodec_get_hw_frames_parameters().

Give an option to fix ticket #7261 though it is not a perfect soultion
(allocate the minimum pool size internally and automatically).

Signed-off-by: Zhong Li <zhong.li@intel.com>
10 days agolavc/qsvenc: expose qp of encoded frames
Zhong Li [Fri, 1 Jun 2018 10:21:28 +0000 (18:21 +0800)]
lavc/qsvenc: expose qp of encoded frames

Requirement from ticket #7254.
Currently only H264 supported by MSDK.

Signed-off-by: Zhong Li <zhong.li@intel.com>
10 days agovf_tonemap: Update hdr metadata with the new peak value
Vittorio Giovara [Wed, 25 Jul 2018 15:45:46 +0000 (17:45 +0200)]
vf_tonemap: Update hdr metadata with the new peak value

Less effective than the approach in vf_tonemap_opencl because there
is no peak detection, but it's still a good idea to implement this.

10 days agovf_tonemap_opencl: Move update_metadata() to a shared file
Vittorio Giovara [Wed, 25 Jul 2018 15:02:45 +0000 (17:02 +0200)]
vf_tonemap_opencl: Move update_metadata() to a shared file

10 days agovf_tonemap[_opencl]: Move determine_signal_peak() to a shared file
Vittorio Giovara [Wed, 25 Jul 2018 14:44:50 +0000 (16:44 +0200)]
vf_tonemap[_opencl]: Move determine_signal_peak() to a shared file

The two functions are identical. Use the shared LumaCoeffients type too.

10 days agovf_tonemap: Fix logic for detecting the maximum peak of untagged sources
Vittorio Giovara [Wed, 25 Jul 2018 15:21:04 +0000 (17:21 +0200)]
vf_tonemap: Fix logic for detecting the maximum peak of untagged sources

When there is no metadata attached to a frame, take into account both
the PQ and HLG transfers, and change the HLG default value to 10:
the value of 12 is the maximum range in scene referred light, but
the reference OOTF maps this from 0 to 1000 cd/m² on the ideal HLG
monitor.

This matches what vf_tonemap_opencl does.

11 days agoavcodec/libaomenc: correct range for cpu-used
Gyan Doshi [Sun, 5 Aug 2018 06:03:45 +0000 (11:33 +0530)]
avcodec/libaomenc: correct range for cpu-used

Valid range is [0,8] as stated in aom.git:aom/aomcx.h

Fixes #7343

11 days agoavcodec/mediacodecdec: fix spurious newline in trace logging
Aman Gupta [Sun, 5 Aug 2018 19:31:07 +0000 (12:31 -0700)]
avcodec/mediacodecdec: fix spurious newline in trace logging

Signed-off-by: Aman Gupta <aman@tmm1.net>
13 days agoavcodec/pnm_parser: Avoid reparsing failed data.
Michael Niedermayer [Sat, 28 Jul 2018 12:09:32 +0000 (14:09 +0200)]
avcodec/pnm_parser: Avoid reparsing failed data.

Alternatively the parser could be re implemented / redesigned so as to better
and more efficiently find frame boundaries

Fixes: Timeout
Fixes: 9210/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PBM_fuzzer-4770771833454592
Fixes: 9214/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PPM_fuzzer-5741633353023488
Fixes: 9219/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PGM_fuzzer-6249230237696000
Fixes: 9550/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PAM_fuzzer-5312669836902400

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 days agoavcodec/simple_idct_template: Fix several integer overflows
Michael Niedermayer [Sat, 28 Jul 2018 10:18:05 +0000 (12:18 +0200)]
avcodec/simple_idct_template: Fix several integer overflows

Fixes: simple_idct_template.c:184:30: runtime error: signed integer overflow: -1065517056 - 1392182838 cannot be represented in type 'int'
Fixes: simple_idct_template.c:269:21: runtime error: signed integer overflow: 16384 * 259254 cannot be represented in type 'int'
Fixes: simple_idct_template.c:164:17: runtime error: signed integer overflow: 21407 * 210162 cannot be represented in type 'int'
Fixes: simple_idct_template.c:167:17: runtime error: signed integer overflow: 21407 * 210162 cannot be represented in type 'int'
Fixes: simple_idct_template.c:169:19: runtime error: signed integer overflow: 22725 * 259190 cannot be represented in type 'int'
Fixes: simple_idct_template.c:171:19: runtime error: signed integer overflow: 19265 * 259190 cannot be represented in type 'int'
Fixes: simple_idct_template.c:173:19: runtime error: signed integer overflow: 12873 * 259190 cannot be represented in type 'int'
Fixes: simple_idct_template.c:183:28: runtime error: signed integer overflow: 1860878336 + 585177665 cannot be represented in type 'int'
Fixes: simple_idct_template.c:159:17: runtime error: signed integer overflow: 16384 * 189520 cannot be represented in type 'int'
Fixes: simple_idct_template.c:170:22: runtime error: signed integer overflow: 19265 * 130147 cannot be represented in type 'int'
Fixes: simple_idct_template.c:174:23: runtime error: signed integer overflow: -22725 * 130147 cannot be represented in type 'int'
Fixes: simple_idct_template.c:183:20: runtime error: signed integer overflow: 16384 * -175206 cannot be represented in type 'int'
Fixes: simple_idct_template.c:184:22: runtime error: signed integer overflow: -16384 * -175206 cannot be represented in type 'int'
Fixes: simple_idct_template.c:185:22: runtime error: signed integer overflow: -16384 * -175206 cannot be represented in type 'int'
Fixes: simple_idct_template.c:186:20: runtime error: signed integer overflow: 16384 * -175206 cannot be represented in type 'int'
Fixes: simple_idct_template.c:195:26: runtime error: signed integer overflow: 19265 * 150747 cannot be represented in type 'int'
Fixes: simple_idct_template.c:198:27: runtime error: signed integer overflow: -22725 * 150747 cannot be represented in type 'int'
Fixes: simple_idct_template.c:184:37: runtime error: signed integer overflow: 21407 * -171941 cannot be represented in type 'int'
Fixes: simple_idct_template.c:185:37: runtime error: signed integer overflow: 21407 * -171941 cannot be represented in type 'int'
Fixes: simple_idct_template.c:192:27: runtime error: signed integer overflow: -12873 * 206341 cannot be represented in type 'int'
Fixes: simple_idct_template.c:185:30: runtime error: signed integer overflow: 1196441600 + 1703756981 cannot be represented in type 'int'
Fixes: simple_idct_template.c:176:23: runtime error: signed integer overflow: -12873 * 168461 cannot be represented in type 'int'
Fixes: simple_idct_template.c:191:27: runtime error: signed integer overflow: -22725 * -140062 cannot be represented in type 'int'
Fixes: simple_idct_template.c:197:26: runtime error: signed integer overflow: 19265 * -140062 cannot be represented in type 'int'
Fixes: simple_idct_template.c:183:34: runtime error: signed integer overflow: 8867 * -243046 cannot be represented in type 'int'
Fixes: simple_idct_template.c:186:34: runtime error: signed integer overflow: 8867 * -243046 cannot be represented in type 'int'
Fixes: simple_idct_template.c:186:28: runtime error: signed integer overflow: -816234496 - 2139878414 cannot be represented in type 'int'
Fixes: simple_idct_template.c:188:26: runtime error: signed integer overflow: 12873 * -239872 cannot be represented in type 'int'
Fixes: simple_idct_template.c:165:16: runtime error: signed integer overflow: 8867 * -260084 cannot be represented in type 'int'
Fixes: simple_idct_template.c:166:16: runtime error: signed integer overflow: 8867 * -260084 cannot be represented in type 'int'
Fixes: 9135/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-6324422955761664

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 days agoavcodec/aacdec_template: Check for duplicate elements
Michael Niedermayer [Sat, 28 Jul 2018 09:42:37 +0000 (11:42 +0200)]
avcodec/aacdec_template: Check for duplicate elements

Fixes: Timeout
Fixes: 9552/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-6027842339995648

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 days agoavcodec/aacpsdsp_template: Fix integer overflow in ps_stereo_interpolate_c()
Michael Niedermayer [Sat, 28 Jul 2018 08:59:09 +0000 (10:59 +0200)]
avcodec/aacpsdsp_template: Fix integer overflow in ps_stereo_interpolate_c()

Fixes: signed integer overflow: -1813244069 + -1407981383 cannot be represented in type 'int'
Fixes: 8823/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5643295618236416

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 days agoavformat/flvenc: Check audio packet size
Michael Niedermayer [Sat, 28 Jul 2018 13:03:50 +0000 (15:03 +0200)]
avformat/flvenc: Check audio packet size

Fixes: Assertion failure
Fixes: assert_flvenc.c:941_1.swf

Found-by: #CHEN HONGXU# <HCHEN017@e.ntu.edu.sg>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 days agoavcodec/mediacodecdec: fix SEGV on modern nvidia decoders
Aman Gupta [Tue, 31 Jul 2018 21:33:08 +0000 (14:33 -0700)]
avcodec/mediacodecdec: fix SEGV on modern nvidia decoders

This code came originally from gstreamer, where it was added in [1]
as a work-around for the Tegra 3. (The alignment was changed in [2]
as a response to [3], from 32-bit to 16-bit).

gstreamer only used this workaround in the case where the decoder
didn't return a slice-height property, but when the code was copied
into avcodec the conditional got lost. This commit restores the guard
and prefers the slice-height from the decoder when it is available.

This fixes segfaults decoding 1920x1080 h264 and mpeg2 videos on the
NVidia SHIELD after upgrading to Android Oreo.

[1] https://github.com/GStreamer/gst-plugins-bad/commit/a870e6a5c30dd85240fe75c7409cc1cf1b86541d
[2] https://github.com/GStreamer/gst-plugins-bad/commit/21ff3ae0b0127bd82951d278ca24f2d54133b7cd
[3] https://bugzilla.gnome.org/show_bug.cgi?id=748867

Signed-off-by: Aman Gupta <aman@tmm1.net>
2 weeks agolavc/svq3: Fix regression decoding some files.
Nikolas Bowe [Tue, 31 Jul 2018 00:22:02 +0000 (17:22 -0700)]
lavc/svq3: Fix regression decoding some files.

Fixes some SVQ3 encoded files which fail to decode correctly after 6d6faa2a2d.
These files exhibit lots of artifacts and logs show "Media key encryption is not implemented".
However they decode without artifacts before 6d6faa2a2d.
The attatched patch allows these files to successfully decode, but also reject media key files.

Tested on the files in #6094 and http://samples.mplayerhq.hu/V-codecs/SVQ3/Vertical400kbit.sorenson3.mov

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 weeks agoavcodec/mlp_parser: Check if synccode is within buffer
Michael Niedermayer [Sun, 29 Jul 2018 11:16:37 +0000 (13:16 +0200)]
avcodec/mlp_parser: Check if synccode is within buffer

Fixes: undefined shift
Fixes: 9216/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEHD_fuzzer-6281404575907840

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 weeks agoavcodec/qtrle: Check remaining bytestream in qtrle_decode_XYbpp()
Michael Niedermayer [Sun, 29 Jul 2018 10:40:48 +0000 (12:40 +0200)]
avcodec/qtrle: Check remaining bytestream in qtrle_decode_XYbpp()

Fixes: Timeout
Fixes: 9213/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QTRLE_fuzzer-5649753332252672

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 weeks agoavformat/matroskaenc: filter and reorder AV1 OBUs
James Almer [Mon, 23 Jul 2018 15:33:55 +0000 (12:33 -0300)]
avformat/matroskaenc: filter and reorder AV1 OBUs

Make sure to not write forbidden OBUs to CodecPrivate, and do the same with
unnecessary OBUs for packets.

Signed-off-by: James Almer <jamrial@gmail.com>
2 weeks agoavformat/av1: reorder OBUs before writting them in ff_isom_write_av1c()
James Almer [Mon, 30 Jul 2018 18:15:43 +0000 (15:15 -0300)]
avformat/av1: reorder OBUs before writting them in ff_isom_write_av1c()

Make sure Sequence Header is first, and only allow one of its kind.

Signed-off-by: James Almer <jamrial@gmail.com>
2 weeks agoavcodec/av1_parse: return size of the parsed OBU in parse_obu_header()
James Almer [Mon, 30 Jul 2018 18:14:24 +0000 (15:14 -0300)]
avcodec/av1_parse: return size of the parsed OBU in parse_obu_header()

Signed-off-by: James Almer <jamrial@gmail.com>
2 weeks agoavformat/av1: return an error when no data is provided to ff_isom_write_av1c()
James Almer [Mon, 23 Jul 2018 16:15:06 +0000 (13:15 -0300)]
avformat/av1: return an error when no data is provided to ff_isom_write_av1c()

Signed-off-by: James Almer <jamrial@gmail.com>
2 weeks agoavcodec/av1_parse: check for OBU header overread
James Almer [Mon, 23 Jul 2018 16:12:43 +0000 (13:12 -0300)]
avcodec/av1_parse: check for OBU header overread

Signed-off-by: James Almer <jamrial@gmail.com>
2 weeks agoavcodec/libaomdec: auto insert dump_extra bitstream filter
James Almer [Mon, 23 Jul 2018 15:32:47 +0000 (12:32 -0300)]
avcodec/libaomdec: auto insert dump_extra bitstream filter

Some containers, like Matroska, may propagate key frames with no Sequence
Header OBU since it's provided in extradata instead.
With this change, the Sequence Header will be appended to the packet data
before calling aom_codec_decode().

Signed-off-by: James Almer <jamrial@gmail.com>
2 weeks agoavcodec/dump_extradata_bsf: don't allocate a new AVPacket per filtered packet
James Almer [Mon, 23 Jul 2018 22:16:30 +0000 (19:16 -0300)]
avcodec/dump_extradata_bsf: don't allocate a new AVPacket per filtered packet

~4x speedup in dump_extradata()

Signed-off-by: James Almer <jamrial@gmail.com>
2 weeks agoavformat/avs: add descriptive name and url
Gyan Doshi [Thu, 2 Aug 2018 05:17:10 +0000 (10:47 +0530)]
avformat/avs: add descriptive name and url

AVS now more commonly refers to the Chinese AVS format. This demuxer
processes video files for Creature Shock game

2 weeks agox86/pixelutils: don't use the AVX2 functions on CPUs known to be slow with them
James Almer [Wed, 1 Aug 2018 01:14:53 +0000 (22:14 -0300)]
x86/pixelutils: don't use the AVX2 functions on CPUs known to be slow with them

Signed-off-by: James Almer <jamrial@gmail.com>
2 weeks agox86/pixelutils: add missing preprocessor wrapper to the AVX2 functions
James Almer [Wed, 1 Aug 2018 01:03:22 +0000 (22:03 -0300)]
x86/pixelutils: add missing preprocessor wrapper to the AVX2 functions

Should fix compilation with old yasm/nasm

Signed-off-by: James Almer <jamrial@gmail.com>
2 weeks agotools/qt-faststart: Allow free atoms after moov atom.
Carl Eugen Hoyos [Wed, 11 Jul 2018 23:24:39 +0000 (01:24 +0200)]
tools/qt-faststart: Allow free atoms after moov atom.

2 weeks agoavutil/pixelutils: sad_32x32 sse2/avx2 optimizations.
Jun Zhao [Mon, 9 Jul 2018 16:41:00 +0000 (00:41 +0800)]
avutil/pixelutils: sad_32x32 sse2/avx2 optimizations.

add ff_pixelutils_sad_32x32_sse2, ff_pixelutils_sad_{a,u}_32x32_sse2,
ff_pixelutils_sad_32x32_avx22, ff_pixelutils_sad_{a,u}_32x32_avx2

use perf record/report profiling, get instructions:u for avx2 sad_32x32:

  72.05%  pixelutils  pixelutils     [.] block_sad_32x32_c
  18.50%  pixelutils  pixelutils     [.] block_sad_16x16_c
   4.78%  pixelutils  pixelutils     [.] block_sad_8x8_c
   2.69%  pixelutils  pixelutils     [.] block_sad_4x4_c
   0.89%  pixelutils  pixelutils     [.] block_sad_2x2_c
   0.16%  pixelutils  pixelutils     [.] ff_pixelutils_sad_32x32_avx2
   0.16%  pixelutils  pixelutils     [.] ff_pixelutils_sad_u_32x32_avx2
   0.12%  pixelutils  pixelutils     [.] ff_pixelutils_sad_a_32x32_avx2

sse2 sad_32x32 instructions:u like:

  71.86%  pixelutils  pixelutils     [.] block_sad_32x32_c
  18.42%  pixelutils  pixelutils     [.] block_sad_16x16_c
   4.81%  pixelutils  pixelutils     [.] block_sad_8x8_c
   2.68%  pixelutils  pixelutils     [.] block_sad_4x4_c
   0.88%  pixelutils  pixelutils     [.] block_sad_2x2_c
   0.29%  pixelutils  pixelutils     [.] ff_pixelutils_sad_32x32_sse2
   0.26%  pixelutils  pixelutils     [.] ff_pixelutils_sad_u_32x32_sse2
   0.23%  pixelutils  pixelutils     [.] ff_pixelutils_sad_a_32x32_sse2

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2 weeks agolavutil/pixelutils: add sad_32x32 in pixelutils API.
Jun Zhao [Mon, 9 Jul 2018 16:34:26 +0000 (00:34 +0800)]
lavutil/pixelutils: add sad_32x32 in pixelutils API.

add sad_32x32 in pixelutils API, and update the fate.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2 weeks agoavcodec/h264_mp4toannexb_bsf: use enum constants for the NAL unit type values
James Almer [Sun, 29 Jul 2018 21:22:25 +0000 (18:22 -0300)]
avcodec/h264_mp4toannexb_bsf: use enum constants for the NAL unit type values

Signed-off-by: James Almer <jamrial@gmail.com>
2 weeks agofate: add tests for audio channel up-/downmixing with pan filter
Tobias Rapp [Thu, 19 Jul 2018 11:59:37 +0000 (13:59 +0200)]
fate: add tests for audio channel up-/downmixing with pan filter

Add tests for upmixing and downmixing with audio channel counts that
have a corresponding default layout and also tests where there is no
default layout.

Update the existing "stereo4" test so it actually outputs stereo like
the other stereo tests. Rename the previous "stereo4" test into
"upmix1".

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
2 weeks agotests/audiogen: raise channel count limit to 12
Tobias Rapp [Thu, 19 Jul 2018 09:49:33 +0000 (11:49 +0200)]
tests/audiogen: raise channel count limit to 12

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
2 weeks agolibavformat/dashenc: Fix relative URI of HLS master playlist
Antonio Morell [Thu, 26 Jul 2018 13:22:21 +0000 (14:22 +0100)]
libavformat/dashenc: Fix relative URI of HLS master playlist

2 weeks agodoc/formats: Add documentation for skip_estimate_duration_from_pts
Michael Niedermayer [Tue, 24 Jul 2018 22:49:39 +0000 (00:49 +0200)]
doc/formats: Add documentation for skip_estimate_duration_from_pts

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Gyan Doshi <ffmpeg@gyani.pro>
2 weeks agoconfigure: add missing aandcttables dependency to asv1 and asv2 encoders
James Almer [Mon, 30 Jul 2018 00:30:00 +0000 (21:30 -0300)]
configure: add missing aandcttables dependency to asv1 and asv2 encoders

Signed-off-by: James Almer <jamrial@gmail.com>
2 weeks agoconfigure: add missing aandcttables dependency to mpegvideoenc
James Almer [Mon, 30 Jul 2018 00:22:28 +0000 (21:22 -0300)]
configure: add missing aandcttables dependency to mpegvideoenc

Also remove the superfluous aandcttables dependency from all the modules
that only need it because of mpegvideoenc

Fixes ticket #7333

Signed-off-by: James Almer <jamrial@gmail.com>
2 weeks agolavfi/nlmeans: fix aarch64 assembly with clang
Jan Ekström [Thu, 26 Jul 2018 20:45:01 +0000 (23:45 +0300)]
lavfi/nlmeans: fix aarch64 assembly with clang

Clang is more strict about some things.

2 weeks agocmdutils: print a more descriptive error message in show_help_bsf() when no bsf is...
James Almer [Sat, 28 Jul 2018 03:58:29 +0000 (00:58 -0300)]
cmdutils: print a more descriptive error message in show_help_bsf() when no bsf is specified

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2 weeks agoavcodec/bitstream_filters: check the input argument of av_bsf_get_by_name() for NULL
James Almer [Sat, 28 Jul 2018 03:51:57 +0000 (00:51 -0300)]
avcodec/bitstream_filters: check the input argument of av_bsf_get_by_name() for NULL

Fixes crashes like "ffmpeg -h bsf" caused by passing NULL to strcmp()

Signed-off-by: James Almer <jamrial@gmail.com>
2 weeks agoavcodec/diracdec: Check bytes count in else branch in decode_lowdelay() too
Michael Niedermayer [Sun, 22 Jul 2018 19:42:16 +0000 (21:42 +0200)]
avcodec/diracdec: Check bytes count in else branch in decode_lowdelay() too

Fixes: signed integer overflow: 8 * 340018243 cannot be represented in type 'int'
Fixes: 9441/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5194665207791616

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 weeks agoavcodec/diracdec: Check slice numbers for overflows in relation to picture dimensions
Michael Niedermayer [Sun, 22 Jul 2018 19:26:24 +0000 (21:26 +0200)]
avcodec/diracdec: Check slice numbers for overflows in relation to picture dimensions

Fixes: signed integer overflow: 88 * 33685506 cannot be represented in type 'int'
Fixes: 9433/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5725943535501312

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 weeks agoavcodec/diracdec: Change frame_number to 64bit as its a 32bit from the bitstream...
Michael Niedermayer [Sun, 22 Jul 2018 18:45:39 +0000 (20:45 +0200)]
avcodec/diracdec: Change frame_number to 64bit as its a 32bit from the bitstream and we also have a -1 special case

Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
Fixes: 9291/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-6324345860259840

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 weeks agoavcodec/dirac_dwt_template: Fix several integer overflows in horizontal_compose_daub97i()
Michael Niedermayer [Sun, 22 Jul 2018 17:11:04 +0000 (19:11 +0200)]
avcodec/dirac_dwt_template: Fix several integer overflows in horizontal_compose_daub97i()

Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
Fixes: 8926/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-6047609228623872

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 weeks agoavcodec/diracdec: Prevent integer overflow in intermediate in global_mv()
Michael Niedermayer [Sun, 22 Jul 2018 16:58:34 +0000 (18:58 +0200)]
avcodec/diracdec: Prevent integer overflow in intermediate in global_mv()

Fixes: signed integer overflow: -393471 * 5460 cannot be represented in type 'int'
Fixes: 8890/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-6299775379963904

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 weeks agoavformat/librtmp: fix returning EOF from Read/Write
Timo Rothenpieler [Wed, 25 Jul 2018 22:37:35 +0000 (00:37 +0200)]
avformat/librtmp: fix returning EOF from Read/Write

Ticket #7052

2 weeks agofate: remove unnecessary reference file for fate-encryption-info
James Almer [Thu, 26 Jul 2018 03:38:01 +0000 (00:38 -0300)]
fate: remove unnecessary reference file for fate-encryption-info

Signed-off-by: James Almer <jamrial@gmail.com>