summaryrefslogtreecommitdiff
path: root/libavcodec
Commit message (Collapse)AuthorAge
* avcodec/nvenc: use framerate if availableZachariah Brown2020-05-15
| | | | | | | | | | | | The h264_nvenc and hevc_nvenc encoders aren't respecting the framerate in the codec context. Instead it was using the timebase which in our use-case was 1/1000 so the encoder was behaving as if we wanted 1000fps. This resulted in poor encoding results due to an extremely low bitrate. Both the amf and qsv encoders already contain similar logic to first check the framerate before falling back to the timebase. Signed-off-by: Zachariah Brown <zachariah@renewedvision.com> Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
* avcodec/option_table: mark venc_params as a video decoder flag opt typeJames Almer2020-05-14
| | | | | | | It's not meant for audio or subtitles, or for encoders of any kind. Reviewed-by: mypopy@gmail.com <mypopy@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/mv30: fix warning: suggest braces around initialization of subobject ↵Limin Wang2020-05-14
| | | | | | [-Wmissing-braces] Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* pixblockdsp, avdct: Add get_pixels_unalignedMartin Storsjö2020-05-13
| | | | | | | | | | | | | Use this in vf_spp.c, where the get_pixels operation is done on unaligned source addresses. Hook up the x86 (mmx and sse) versions of get_pixels to this function pointer, as those implementations seem to support unaligned use. This fixes fate-filter-spp on armv7. Signed-off-by: Martin Storsjö <martin@martin.st>
* avcodec/adpcm: Fix integer overflow in ADPCM THPMichael Niedermayer2020-05-13
| | | | | | | | | | The reference (thp.txt) uses floats so wrap around would seem incorrect. Fixes: signed integer overflow: 1073741824 + 1073741824 cannot be represented in type 'int' Fixes: 20658/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_THP_fuzzer-5646302555930624 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavc/libopenh264enc: Add coder option to replace cabacLinjie Fu2020-05-13
| | | | | | | | | | | | | | | | | Set DEPRECATED flag to option cabac, replace with coder. The priority logic is: 1. s->coder; then 2. avctx->coder_type; then 3. s->cabac. Change the default option to -1 and allow the default cabac to be determined by profile. Add FF_API_OPENH264_CABAC macro for cabac to remove this option after LIBAVCODEC_VERSION_MAJOR = 59. Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Linjie Fu <linjie.fu@intel.com>
* lavc/libopenh264enc: Allow specifying the profile through AVCodecContextLinjie Fu2020-05-13
| | | | | | | | | | | | | | And determine the profile with following priority: 1. s->profile; then 2. avctx->profile; then 3. s->cabac; then 4. a default profile. This seems more natural in case user somehow sets both avctx->profile and s->profile. Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Linjie Fu <linjie.fu@intel.com>
* lavc/libopenh264enc: Rewrite profile handlingLinjie Fu2020-05-13
| | | | | | | | | | | | Support the profiles "constrained_baseline" and "high" for libopenh264 version >= 1.8, support "constrained_baseline" and "main" for earlier version. If option not supported with current version, convert to constrained baseline with a warning for users. Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Linjie Fu <linjie.fu@intel.com>
* avcodec/ralf: Check num_blocks before useMichael Niedermayer2020-05-12
| | | | | | | | Fixes: out of array access Fixes: 20659/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RALF_fuzzer-5739471895265280 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/iff: Test video_size being non zeroMichael Niedermayer2020-05-12
| | | | | | | | | Fixes: Out of array access Fixes: 20659/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5658548592967680 Fixes: 20659/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5723561177382912 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/cdtoons: Check sprite_offset is within the packetMichael Niedermayer2020-05-12
| | | | | | | | | Fixes: out of array read Fixes: 20659/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CDTOONS_fuzzer-5754518731227136 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>
* libavcodec/decode: Mark decode_simple_internal() as inlineMichael Niedermayer2020-05-12
| | | | | | | | This was suggested in https://github.com/google/oss-fuzz/issues/3787 to reduce the grouping errors by oss-fuzz Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* vp9dec: support exporting QP tables through the AVVideoEncParams APIAnton Khirnov2020-05-12
|
* vp9dec: factorise freeing per-tile allocated dataAnton Khirnov2020-05-12
|
* lavc: add a flag for exporting AVVideoEncParams from decodersAnton Khirnov2020-05-12
|
* avcodec/utvideodec: Fix integer overflow in decode_plane()Michael Niedermayer2020-05-12
| | | | | | | | Fixes: signed integer overflow: 2147483594 + 142 cannot be represented in type 'int' Fixes: 20492/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_UTVIDEO_fuzzer-5658568101724160 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ttadsp: Fix several integer overflows in tta_filter_process_c()Michael Niedermayer2020-05-12
| | | | | | | | Fixes: signed integer overflow: 1931744255 + 252497024 cannot be represented in type 'int' Fixes: 20492/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TTA_fuzzer-5763348114440192 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ralf: Fix integer overflow in decode_block()Michael Niedermayer2020-05-12
| | | | | | | | Fixes: signed integer overflow: 289082077 - -2003141111 cannot be represented in type 'int' Fixes: 20492/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RALF_fuzzer-5196077752123392 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/nuv: widen buf_size typeMichael Niedermayer2020-05-12
| | | | | | | | Fixes: signed integer overflow: 65312 * 65312 cannot be represented in type 'int' Fixes: 20492/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NUV_fuzzer-5740176118906880 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/iff: Fix several integer overflowsMichael Niedermayer2020-05-11
| | | | | | | | | Fixes: negation of -2147483648 cannot be represented in type 'int32_t' (aka 'int'); cast to an unsigned type to negate this value to itself Fixes: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int32_t' (aka 'int') Fixes: 20492/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5764066459254784 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/g729postfilter: Clip gain before scaling with AGC_FAC1Michael Niedermayer2020-05-11
| | | | | | | | | | | | The fixed point integer reference specifies the multiplication used to have 16bit input and clips so we need to clip the input The floating point implementation does not seem to do that. Fixes: signed integer overflow: 6317568 * 410 cannot be represented in type 'int' Fixes: 20492/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_G729_fuzzer-5700189272932352 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/alac: Fix integer overflow with 24/20bps samplesMichael Niedermayer2020-05-11
| | | | | | | | Fixes: signed integer overflow: 1020048 * 4096 cannot be represented in type 'int' Fixes: 20492/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-5753877751660544 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/adpcm: Clip predictor for IMA_APMMichael Niedermayer2020-05-11
| | | | | | | | Fixes: signed integer overflow: -2147483647 - 61436 cannot be represented in type 'int' Fixes: 20492/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_IMA_APM_fuzzer-5092176004644864 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/dstdec: Check sample rateMichael Niedermayer2020-05-10
| | | | | | | | | Fixes: out of array access Fixes: 20659/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DST_fuzzer-5735812071424000 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>
* avcodec/decode: remove unused AVCodecInternal compat_decode fieldJames Almer2020-05-09
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/v4l2_context: Finish draining if V4L2_BUF_FLAG_LAST is setAndriy Gelman2020-05-09
| | | | | | | | | | | | | | | | | | V4L2 api can indicate that flushing of the capture buffers is completed by setting the V4L2_BUF_FLAG_LAST flag. Use guards because the flag was only defined in Linux v4.2. Reference: linux/Documentation/media/uapi/v4l/dev-decoder.rst "The client must continue to handle both queues independently, similarly to normal decode operation. This includes: ... - queuing and dequeuing CAPTURE buffers, until a buffer marked with the V4L2_BUF_FLAG_LAST flag is dequeued" Reviewed-by: Ming Qian <ming.qian@nxp.com> Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
* avcodec/v4l2_context: Drop empty packet while drainingAndriy Gelman2020-05-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | v4l2_m2m devices may send an empty packet/frame while draining to indicate that all capture buffers have been flushed. Currently, the empty packet/frame is not handled correctly: When encoding, the empty packet is forwarded to the muxer, usually creating warnings. When decoding, a reference to the memory is created anyway. Since in the past this memory contained a decoded frame, it results in an extra frame being decoded. This commit discards the empty packet/frame. References: linux/Documentation/media/uapi/v4l/dev-decoder.rst: "The last buffer may be empty (with :c:type:`v4l2_buffer` bytesused = 0) and in that case it must be ignored by the client, as it does not contain a decoded frame." linux/Documentation/media/uapi/media/v4l/vidioc-encoder-cmd.rst: "...This buffer may be empty, indicated by the driver setting the ``bytesused`` field to 0." Reviewed-by: Ming Qian <ming.qian@nxp.com> Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
* avcodec/aacdec_template: Pass AVCodecContext seperatly to ↵Michael Niedermayer2020-05-10
| | | | | | | | | | | set_default_channel_config() Regression since 4d9b9c5e4637ac15205467f16fcac92a28e18f18 Fixes: Null pointer dereference Fixes: 21642/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_LATM_fuzzer-5670101358739456 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/pngdec: Check length in fdATMichael Niedermayer2020-05-10
| | | | | | | | Fixes: 21089/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APNG_fuzzer-5135981419429888 Fixes: out of array read Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/g2meet: Check tile_width in epic_jb_decode_tile()Michael Niedermayer2020-05-10
| | | | | | | | | | Fixes: out of array access Fixes: 21469/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_G2M_fuzzer-5199357982015488 Alternatively the arrays can be made bigger or the index can be clipped. In case a real file with such huge tiles exist we ask the user to upload it. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/hapdec: Check tex_size more strictly and before using itMichael Niedermayer2020-05-10
| | | | | | | | | Fixes: OOM Fixes: 20774/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HAP_fuzzer-5678608951803904 Fixes: 20956/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HAP_fuzzer-5713643025203200 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/mpegvideo: return more specific error codes for init_duplicate_context()Limin Wang2020-05-09
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/mpegvideo: return more specific error codes for ff_mpv_common_init()Limin Wang2020-05-09
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/mpeg12enc: return more specific error codes for encode_init()Limin Wang2020-05-09
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/mpegvideo_enc: return more specific error codes for ff_mpv_encode_init()Limin Wang2020-05-09
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/(null|opus_metadata)_bsf: Use ff_bsf_get_packet_ref() directlyAndreas Rheinhardt2020-05-08
| | | | | Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/bsf: Restrict ff_bsf_get_packet_ref() return values to <= 0Andreas Rheinhardt2020-05-08
| | | | | | | | | | | | | | | Up until now the documentation of ff_bsf_get_packet_ref() allowed return values >= 0 in case of success, whereas av_bsf_receive_packet() only allows 0 on success. Given that for some bitstream filters the return value of ff_bsf_get_packet_ref() is forwarded to the caller of av_bsf_receive_packet() without any filtering, there would be a problem if ff_bsf_get_packet_ref() actually returned values > 0. But it currently doesn't and there is no reason why it should ever do so. Therefore this commit aligns the return values of these functions by restricting ff_bsf_get_packet_ref() to always returns 0 on success. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpegvideo_enc: reindent codeLimin Wang2020-05-08
| | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/zmbv: remove the unnecessary type conversionLimin Wang2020-05-08
| | | | | Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/tiff: remove the unnecessary type conversionLimin Wang2020-05-08
| | | | | Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/pngdec: remove the unnecessary type conversionLimin Wang2020-05-08
| | | | | Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/lcldec: remove the unnecessary type conversionLimin Wang2020-05-08
| | | | | Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/libx264: return error if unknown picture type encounteredLimin Wang2020-05-08
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/libx264: return immediately if encode_nals return 0Limin Wang2020-05-08
| | | | | | | | x264_encoder_encode can return 0 with nnal 0. As a result, encode_nals will return 0. In this condition, it's better to return 0 immediately to avoid the following unneeded pict_type and flags setting. Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/libx265: Fix Uninitialized scalar variableLimin Wang2020-05-08
| | | | | | | return error if unknown picture type encountered Fixes CID 1457234 Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/pcm_rechunk_bsf: add bitstream filter to rechunk pcm audioMarton Balint2020-05-07
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avcodec/profiles: remove duplicate FF_PROFILE_RESERVED entryLimin Wang2020-05-07
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* lavc/bsf: add an Opus metadata bitstream filterLynne2020-05-05
| | | | | The only adjustable field is the gain. Some ripping/transcoding programs have started to use it.
* avcodec/wavpack: Check rate_x and sample rate for overflowMichael Niedermayer2020-05-05
| | | | | | | | | Fixes: shift exponent 32 is too large for 32-bit type 'int' Fixes: 21647/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVPACK_fuzzer-5686168323883008 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: David Bryant <david@wavpack.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/avpacket: add missing entry for prft to av_packet_side_data_name()James Almer2020-05-05
| | | | Signed-off-by: James Almer <jamrial@gmail.com>