Commit Graph

95808 Commits

Author SHA1 Message Date
Derek Buitenhuis d8bf24459b avcodec: Add librav1e encoder
Port to the new send/receive API by: James Almer <jamrial@gmail.com>.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2019-11-10 13:55:39 +00:00
Michael Niedermayer 0f89a2293e avcodec/wmaprodec: get frame during frame decode
Fixes: memleak
Fixes: 17615/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XMA2_fuzzer-5681306024804352

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>
2019-11-09 18:17:25 +01:00
Michael Niedermayer 10eabb8e40 avcodec/interplayacm: Fix overflow of last unused value
Fixes: signed integer overflow: -2147450880 - 65535 cannot be represented in type 'int'
Fixes: 18393/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INTERPLAY_ACM_fuzzer-5667520110919680

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 18:03:38 +01:00
Michael Niedermayer 7786f6c30e avcodec/adpcm: Fix undefined behavior with negative predictions in IMA OKI
Fixes: left shift of negative value -30
Fixes: 18392/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_IMA_OKI_fuzzer-5631771831435264

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 18:03:37 +01:00
Michael Niedermayer 1c63edcdd2 avcodec/cook: Move up and extend block_align check
Fixes: signed integer overflow: 2046820356 * 8 cannot be represented in type 'int'
Fixes: 18391/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_COOK_fuzzer-5631674666188800

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 18:02:00 +01:00
Michael Niedermayer 00e469fb61 avcodec/sbcdec: Fix integer overflows in sbc_synthesize_four()
Fixes: signed integer overflow: 1494495519 + 1494495519 cannot be represented in type 'int'
Fixes: 18347/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SBC_fuzzer-5711714661695488

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 17:59:32 +01:00
Michael Niedermayer 97f778e9c5 avcodec/twinvq: Check block_align
Fixes: signed integer overflow: 538976288 * 8 cannot be represented in type 'int'
Fixes: 18348/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_METASOUND_fuzzer-6681325716635648

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 17:59:03 +01:00
Michael Niedermayer 50001cd440 avcodec/cook: Enlarge gain table
Fixes: index 25 out of bounds for type 'float [23]'
Fixes: 18355/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_COOK_fuzzer-5641398941908992

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 17:55:09 +01:00
Michael Niedermayer 57750bb629 avcodec/cook: Check samples_per_channel earlier
Fixes: division by zero
Fixes: 18362/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_COOK_fuzzer-5653727679086592

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 17:55:07 +01:00
Michael Niedermayer de5102fd92 avcodec/atrac3plus: Check split point in fill mode 3
Fixes: index 32 out of bounds for type 'int [32]'
Fixes: 18350/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ATRAC3P_fuzzer-5643794862571520

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 17:54:59 +01:00
Michael Niedermayer 55c97a7637 avcodec/wmavoice: Check sample_rate
Fixes: left shift of 538976288 by 8 places cannot be represented in type 'int'
Fixes: 18376/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAVOICE_fuzzer-5741645391200256

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 17:27:20 +01:00
Michael Niedermayer 9ea9973959 avcodec/xsubdec: fix overflow in alpha handling
Fixes: left shift of 255 by 24 places cannot be represented in type 'int'
Fixes: 18368/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XSUB_fuzzer-5702665442426880

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 17:27:19 +01:00
Michael Niedermayer 32b3c8ce7d avcodec/iff: Check available space before entering loop in decode_long_vertical_delta2() / decode_long_vertical_delta()
Fixes: Timeout (31sec -> 41ms)
Fixes: 18380/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5645210121404416

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 17:26:28 +01:00
Michael Niedermayer 1c038c5c63 avcodec/apedec: Fix integer overflow in filter_3800()
Fixes: signed integer overflow: 2117181180 + 60483298 cannot be represented in type 'int'
Fixes: 18344/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5685327791915008

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 17:26:09 +01:00
Michael Niedermayer be78999266 avcodec/atrac3plusdec: add FF_CODEC_CAP_INIT_CLEANUP
Fixes: memleaks
Fixes: 18332/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ATRAC3P_fuzzer-5655654374572032

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 17:21:36 +01:00
Michael Niedermayer d6fea2ef22 avutil/lfg: Document the AVLFG struct
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 16:10:02 +01:00
Michael Niedermayer 20fad71247 avcodec/decode: Also consider channels in max_samples check
Fixes: Timeout (109sec -> 0.6sec)
Fixes: 18309/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INTERPLAY_ACM_fuzzer-6226598168100864

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 16:06:32 +01:00
Michael Niedermayer 17603094d5 avcodec/rasc: Check input size in decode_fint()
Fixes: Timeout (11sec -> 42ms)
Fixes: 18287/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RASC_fuzzer-5637866331308032

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 16:02:43 +01:00
Michael Niedermayer df498cf544 avcodec/ffv1dec: Use a different error message for the slice level CRC
This way they can be told apart easily

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 16:02:43 +01:00
Michael Niedermayer 1d1719a44d avcodec/apedec: Fix undefined integer overflow in long_filter_ehigh_3830()
Fixes: signed integer overflow: -1094995529 * 2 cannot be represented in type 'int'
Fixes: 18281/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5692589180715008

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 16:01:47 +01:00
Michael Niedermayer 14d3384cf3 avformat/flvenc: Check pts for mpeg4/h264 (which need the value)
Fixes: Ticket8152

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 15:59:38 +01:00
Michael Niedermayer 0c3e1b395b avcodec/dstdec: Check that AC probabilities are within range
ISO/IEC 14496-3:2005(E): "Each entry of P_one[ ][ ] is in the range of 1 to
128, corresponding to a probability of 1/256 to 128/256 of the next error bit (bit E, See Figure 10.5)..."

Fixes: Timeout (42sec ->1sec)
Fixes: 18181/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DST_fuzzer-5736646250594304

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 15:57:34 +01:00
Michael Niedermayer 03ea8d8cd4 avcodec/dstdec: Check read_table() for failure
Fixes: Timeout (too long -> 42sec)
Fixes: 18181/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DST_fuzzer-5736646250594304

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 15:57:33 +01:00
Michael Niedermayer 2a8785966c avcodec/vc1_block: Check input in the block decode loops
Fixes: Timeout (196sec -> 2sec)
Fixes: 18026/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1_fuzzer-5640941108461568

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 15:31:06 +01:00
Michael Niedermayer 947732c56d avcodec/vc1_block: Check for end of bitstream at the top of vc1_decode_i_blocks_adv()
Fixes: Timeout (147sec -> 2sec)
Fixes: 17704/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-5723851098423296

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 15:25:32 +01:00
Michael Niedermayer de1d3b0925 tools/target_dec_fuzzer: Adjust threshold for smacker
Fixes: Timeout (65sec -> 0.5sec)
Fixes: 18072/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMACKER_fuzzer-5722709366931456

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 15:23:06 +01:00
Michael Niedermayer 07519f363b avcodec/hqx: Check the input data against the image size
Fixes: Timeout (22 -> 100 ms)
Fixes: 15173/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HQX_fuzzer-5662556846292992
Fixes: 17896/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HQX_fuzzer-5679312077848576

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 15:20:30 +01:00
Michael Niedermayer 859362a6f0 avcodec/pafvideo: Only clear frame when it was written to
This avoids unneeded operations and makes the code faster.

Fixes: Timeout
Fixes: 15724/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PAF_VIDEO_fuzzer-5750842205929472 (12sec -> 9sec)
Fixes: 17625/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PAF_VIDEO_fuzzer-5640515311108096 (16sec -> 4sec)

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 14:13:34 +01:00
Michael Niedermayer 114ddf6430 avformat/vividas: Fix n_sb_blocks Check
Fixes: signed integer overflow: 1540265776 * 2 cannot be represented in type 'int'
Fixes: 18160/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5758808818712576

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 13:46:21 +01:00
Michael Niedermayer 55279d699f avcodec/snowenc: Set mb_num to avoid ratecontrol floating point divisions by 0.0
Fixes: Ticket7990

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 13:46:20 +01:00
Michael Niedermayer 8802e329c8 avcodec/snowenc: Fix 2 undefined shifts
Fixes: Ticket7990

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 13:46:19 +01:00
Steven Liu bb190ded67 avformat/mlvdec:drop unnecessary check before ff_format_io_close
Reviewed-by: Linjie Fu <linjie.fu@intel.com>
Reviewed-by: Jun Zhao <barryjzhao@tencent.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-11-09 11:27:14 +09:00
James Zern a605e9ad1e avcodec/libvpxenc,cosmetics: fix a typo
predicition -> prediction
2019-11-08 17:48:29 -08:00
James Zern a6be42a733 avcodec/libvpxdec.c,cosmetics: bpp -> bpc
Signed-off-by: James Zern <jzern@google.com>
2019-11-08 17:42:42 -08:00
Lou Logan 007e03348d avfilter/Makefile: add missing framesync dependency to bm3d & mix filters
Signed-off-by: Lou Logan <lou@lrcd.com>
2019-11-08 09:37:31 -09:00
Lou Logan 5896411437 configure: select missing rdft for several filters
afir, sinc, superequalizer, surround

For afir fft is replaced with rdft as:
rdft_select="fft"

Signed-off-by: Lou Logan <lou@lrcd.com>
2019-11-08 09:37:31 -09:00
leozhang c79307b7de avfilter/vf_dnn_processing: correct duplicate statement
Signed-off-by: leozhang <leozhang@qiyi.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-08 14:57:01 +01:00
Guo, Yejun f6e942251c avfilter/vf_dnn_processing: fix fate-source
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-08 14:56:38 +01:00
Michael Niedermayer 9802599ad0 avformat/mxfdec: cleanup on "essence prior to first PartitionPack"
Fixes: memleak
Fixes: 18473/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5738557074833408

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-08 14:48:01 +01:00
Limin Wang 81271b3cce avfilter/f_metadata: remove unneeded code
Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2019-11-08 22:25:10 +09:00
Jun Zhao e700038990 lavf/dashdec: drop unnecessary check before ff_format_io_close
ff_format_io_close will check the AVIOContext pointer pb, so drop
the unnecessary check before ff_format_io_close.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-11-08 11:39:02 +08:00
Jun Zhao a23c8d75ec lavf/dashenc: enable probesize/max_analyze_duration setting in sub-demuxer
Enable probesize/max_analyze_duration setting when open the sub-demuxer,
it's will be used to minimizing the initial delay.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-11-08 11:39:02 +08:00
Jun Zhao 5307c12acb lavf/hls: support probesize/max_analyze_duration when open sub-demuxer
Add probesize/max_analyze_duration support when open the sub-demuxer,
it's will be used to minimizing the initial delay.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-11-08 11:39:02 +08:00
Jun Zhao d44c7235a8 lavf/flvenc: Cosmetics: fix indentation
fix indentation

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-11-08 11:39:02 +08:00
Jun Zhao 3dce89e55e lavf/mov: add log context dump in log message
add log context dump in log message.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-11-08 11:39:02 +08:00
Jun Zhao bbf061c7ca lavf/hls: fix the log context setting in log message
Fix the log context setting in log message

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-11-08 11:39:02 +08:00
Guo, Yejun 4d980a8ceb avfilter/vf_dnn_processing: add a generic filter for image proccessing with dnn networks
This filter accepts all the dnn networks which do image processing.
Currently, frame with formats rgb24 and bgr24 are supported. Other
formats such as gray and YUV will be supported next. The dnn network
can accept data in float32 or uint8 format. And the dnn network can
change frame size.

The following is a python script to halve the value of the first
channel of the pixel. It demos how to setup and execute dnn model
with python+tensorflow. It also generates .pb file which will be
used by ffmpeg.

import tensorflow as tf
import numpy as np
import imageio
in_img = imageio.imread('in.bmp')
in_img = in_img.astype(np.float32)/255.0
in_data = in_img[np.newaxis, :]
filter_data = np.array([0.5, 0, 0, 0, 1., 0, 0, 0, 1.]).reshape(1,1,3,3).astype(np.float32)
filter = tf.Variable(filter_data)
x = tf.placeholder(tf.float32, shape=[1, None, None, 3], name='dnn_in')
y = tf.nn.conv2d(x, filter, strides=[1, 1, 1, 1], padding='VALID', name='dnn_out')
sess=tf.Session()
sess.run(tf.global_variables_initializer())
output = sess.run(y, feed_dict={x: in_data})
graph_def = tf.graph_util.convert_variables_to_constants(sess, sess.graph_def, ['dnn_out'])
tf.train.write_graph(graph_def, '.', 'halve_first_channel.pb', as_text=False)
output = output * 255.0
output = output.astype(np.uint8)
imageio.imsave("out.bmp", np.squeeze(output))

To do the same thing with ffmpeg:
- generate halve_first_channel.pb with the above script
- generate halve_first_channel.model with tools/python/convert.py
- try with following commands
  ./ffmpeg -i input.jpg -vf dnn_processing=model=halve_first_channel.model:input=dnn_in:output=dnn_out:fmt=rgb24:dnn_backend=native -y out.native.png
  ./ffmpeg -i input.jpg -vf dnn_processing=model=halve_first_channel.pb:input=dnn_in:output=dnn_out:fmt=rgb24:dnn_backend=tensorflow -y out.tf.png

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
2019-11-07 15:46:00 -03:00
Andreas Rheinhardt fc7b6d5574 fftools/ffmpeg_opt: Fix mixed declarations and code
Introduced in ed3c317d.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-06 20:38:03 +01:00
leozhang 84c27c8c08 avcodec/extract_extradata_bsf: fix typo in comments
Signed-off-by: leozhang <leozhang@qiyi.com>
Reviewed-by: Gyan <ffmpeg@gyani.pro>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-06 20:38:03 +01:00
Andriy Gelman 7b2ce27e56 avdevice/v4l2: Remove av_assert0 when format not supported
Before this commit an av_assert0 would fail if a v4l2 device did not
support a target format.
For example,
./ffmpeg -f v4l2 -codec:v h264 -i /dev/video0 -f mpegts -
would signal an abort if /dev/video0 did not support h264.

The new behaviour is to return an AVERROR(EINVAL) error code. An
av_assert0 has been added to verify this return.

Fixes #6629

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-06 20:38:03 +01:00