Commit Graph

42875 Commits

Author SHA1 Message Date
Linjie Fu
433ece8c8b lavc/libopenh264enc: Add qmin/qmax support
Clip iMinQp/iMaxQp to (1, 51) for user specified qp range.

If not set, leave iMinQp/iMaxQp untouched and use the values (0, 51)
initialized in FillDefault(), and the QP range would be adjusted to the
defaults inside libopenh264 library according to the iUsageType, (12, 42)
for iUsageType == CAMERA_VIDEO_REAL_TIME which is default.

<https://github.com/cisco/openh264/blob/master/codec/encoder/core/src/encoder_ext.cpp#L375>

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2020-04-29 20:58:17 +03:00
Josh Brewster
79f001675a libavcodec/libx264: fix reference frame computation based on level
The current implementation allows passing levels to libavcodec as
integers (such as "31" instead of "3.1").

However, in this case, the maximum reference frame value per level was
ignored because libavcodec converted the string to 310 instead of 31.

Since libx264 has correctly parsed the level to int
(x4->params.i_level_idc), we should rely on this value instead of
attempting to parse the level string on our own.

Signed-off-by: Josh Brewster <josh.brewster@protonmail.com>
Signed-off-by: Josh de Kock <josh@itanimul.li>
2020-04-29 12:01:14 +01:00
Andriy Gelman
1cc3851b60 avcodec/v4l2_m2m_enc: Enable frame level rate control by default
Without this setting, bitrate and qmin/qmax options have no
effect on the s5p-mfc hardware encoder.

Reviewed-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2020-04-28 12:39:39 -04:00
Andriy Gelman
9b5001a494 avcodec/v4l2_m2m_enc: Reduce log verbosity for some params
Currently the user gets unhelpful warnings when some default parameters
are not supported by the device. The verbosity of these log messages has
been changed to AV_LOG_DEBUG.

Reviewed-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2020-04-28 12:39:19 -04:00
Mark Thompson
1dff97b7bc avcodec/nvenc: add hardware config metadata
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2020-04-27 23:06:06 +02:00
Mark Thompson
344e6c3ff1 lavc/vaapi_encode: Add hardware config metadata
These encoders all accept VAAPI surfaces in a hardware frames context.
2020-04-26 18:38:25 +01:00
Mark Thompson
5a1ff44907 lavc/qsvenc: Add hardware config metadata
All of these encoders can accept libmfx surfaces directly in a hardware
frames context, or they can accept software frames if a suitable device
is supplied to use.
2020-04-26 18:38:25 +01:00
Mark Thompson
858eba0ca4 lavc: Extend hardware config metadata to encoders 2020-04-26 18:38:25 +01:00
Mark Thompson
2594f6a362 lavc: Rename hwaccel.h to hwconfig.h
This already applied to decoders as well as hwaccels, and adding encoder
support was going to make the name even more inaccurate.
2020-04-26 18:38:25 +01:00
Michael Niedermayer
588114cea4 avcodec/cbs_h265_syntax_template: Check num_negative/positive_pics when inter_ref_pic_set_prediction_flag is set
Fixes: out of array access
Fixes: 20446/clusterfuzz-testcase-minimized-ffmpeg_BSF_HEVC_METADATA_fuzzer-5707770718584832

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-26 18:25:53 +02:00
Michael Niedermayer
0a9ccc2514 avcodec/intrax8: Check for end of bitstream in ff_intrax8_decode_picture()
Fixes: Timeout (105sec -> 1sec)
Fixes: 20479/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1_fuzzer-5769846937878528

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-26 18:23:16 +02:00
Michael Niedermayer
cca0436efc avcodec/dirac_vlc: Fix integer overflow in ff_dirac_golomb_read_32/16bit()
Fixes: left shift of 1073741824 by 1 places cannot be represented in type 'int32_t' (aka 'int')
Fixes: 21245/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5683334274613248

Change to int16_t suggested by Lynne

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-25 22:32:16 +02:00
Limin Wang
56b9130fff avcodec/bsf: simplify the code
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-04-25 20:39:25 +02:00
Peter Ross
1217b06a9b avcodec/vp9: prevent null pointer use on init_frames() failure
Signed-off-by: Peter Ross <pross@xvid.org>
Reviewed-by: James Almer <jamrial@gmail.com>
2020-04-25 12:11:11 +10:00
Zane van Iperen
3e22e738c0 avcodec: add support for Cunning Developments' ADPCM
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-24 19:43:04 +02:00
Andreas Rheinhardt
a501947a84 avcodec/mjpeg2jpeg_bsf: Remove unnecessary header
libavutil/mem.h is unneeded since 33d18982fa,
the commit that introduced the new packet-based bsf API, because with
this switch the allocations were no longer performed directly, but by
av_new_packet().

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-04-24 05:00:15 +02:00
Andreas Rheinhardt
88a37f0f5b avcodec/noise_bsf: Remove unnecessary headers
With 33d18982fa, the commit introducing
the new packet-based bsf API, a new buffer was no longer allocated
directly, but via av_new_packet(), so that libavutil/mem.h was no longer
needed.

Moreover since commit dc99ee6b08
av_packet_make_writable() is employed which copies the data in case it
is unavoidable so that string.h is no longer used (it was used for
memcpy()).

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-04-24 05:00:15 +02:00
Andreas Rheinhardt
60f9ecdccd avcodec/dump_extradata_bsf: Remove unnecessary header
Since 33d18982fa (the commit that
introduced the new bsf API) allocating an enlarged buffer in case
extradata needs to be added to a packet is done via av_new_packet(),
so that libavutil/mem.h is no longer needed.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-04-24 05:00:15 +02:00
Andreas Rheinhardt
6063b39e4d avcodec/dca_core_bsf: Remove unnecessary header
This bsf never needed libavutil/mem.h.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-04-24 05:00:15 +02:00
Andreas Rheinhardt
9f8dc586a0 avcodec/chomp_bsf: Remove unnecessary header
This bsf never needed internal.h.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-04-24 05:00:15 +02:00
Andreas Rheinhardt
cc489e43de avcodec/vp9_raw_reorder_bsf: Remove unnecessary header
This bsf doesn't have any options, so including libavutil/opt.h is
unnecessary.

Reviewed-by: Peter Ross <pross@xvid.org>
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-04-24 05:00:02 +02:00
Andreas Rheinhardt
6b0c94780d libavcodec/avpacket: Don't simply forward return value of av_dict_set()
The documentation of av_dict_set() states that values >= 0 indicate
success, whereas av_packet_unpack_dictionary() implies that return
values > 0 are impossible. So only forward the return value of
av_dict_set() in av_packet_unpack_dictionary() on error.

(Btw: av_dict_set() does currently not return values > 0.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-04-23 19:42:03 +02:00
Michael Niedermayer
ae2537f53e avcodec/hevc_mp4toannexb_bsf: Check nalu_size
Fixes: Timeout (29sec -> 5ms)
Fixes: 20237/clusterfuzz-testcase-minimized-ffmpeg_BSF_HEVC_MP4TOANNEXB_fuzzer-5165615044362240

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-23 19:30:07 +02:00
Gautam Ramakrishnan
e58766ba12 libavcodec/jpeg2000dec.c: ROI marker support
This patch adds support for decoding images
with a Region of Interest. Allows decoding
samples such as p0_03.j2k. This patch should
fix ticket #4681.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-23 19:30:07 +02:00
Jun Zhao
7fd70ad9e9 lavc/version: bump minor version for DOVI sidedata
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-04-23 08:06:30 +08:00
Jun Zhao
0e1db79e37 lavc: add a new sidedata type for DOVI
add a new sidedata type for DOVI.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-04-23 08:05:06 +08:00
Vitaly Buka
f163d30de2 mpeg4videoenc: Don't crash with -fsanitize=bounds
Also the patch makes this code consistent with mpeg4videodec.c

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-22 23:21:10 +02:00
Gautam Ramakrishnan
6bd4a26168 libavcodec/jpeg2000dec.c: Support for CRG marker
This patch adds support to skip the CRG marker.
The CRG marker, is an informational marker.
Allows samples such as p0_03.j2k to be decoded.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-22 22:57:38 +02:00
Michael Niedermayer
b4a33387cb avcodec/iff: Check length before memcpy() in decode_deep_rle32()
Fixes: out of array read
Fixes: 20796/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5111364702175232.fuzz

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-22 22:57:38 +02:00
Michael Niedermayer
bc41a29a5a avcodec/iff: Fix invalid pointer intermediates in decode_deep_rle32()
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-22 22:57:38 +02:00
Michael Niedermayer
4c7bcaa385 avcodec/pngdec: Pass ret from decode_iccp_chunk()
Found while reviewing a patch fixing a similar issue

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-20 20:38:41 +02:00
Zane van Iperen
0bce55ac89 avcodec/adpcm: update get_nb_samples() doc
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-20 20:03:00 +02:00
Zane van Iperen
7150123aab avcodec/adpcm_ima_{apc, ssi, oki}: replace while() with for()
Per discussion at https://ffmpeg.org/pipermail/ffmpeg-devel/2020-April/260854.html

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-20 20:03:00 +02:00
James Almer
795ff53f18 avcodec/qpeg: mark the init function as thread-safe and init cleanup capable
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-04-20 13:46:37 -03:00
James Almer
18bb1d40c1 avcodec/qpeg: export missing frame properties
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-04-20 13:46:37 -03:00
James Almer
1b13023860 avcodec/qpeg: remove an unnecessary intermediary AVFrame
Decoding can be handled directly in the output frame.

Also ensure flushing cleans the reference frame in all cases.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-04-20 13:46:37 -03:00
Andreas Rheinhardt
ee593bff98 avcodec/bsf: Use macro for "packet is empty"
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-04-20 18:25:02 +02:00
Josh de Kock
bd2e7b74e1 lavc: stop using deprecated av_codec_next()
Signed-off-by: Josh de Kock <josh@itanimul.li>
2020-04-20 15:08:20 +00:00
qoroliang
cacdac819f lavc/hevcdec: fix the HEVC decoder crash when memory over-read
Fix an occasional crash for hevc decoder in ARM 32 platform, the
root cause is the memory over read(read cross the memory boundary)
in SAO NENO functions ff_hevc_sao_band_filter_neon_8 and
ff_hevc_sao_edge_filter_neon_8.

After this fix, the crash disapper in the massive Android phone
test.

Signed-off-by: qoroliang <qoroliang@tencent.com>
2020-04-20 10:28:04 +08:00
Andreas Rheinhardt
4bbf2a240f avcodec/truehd_core_bsf: Remove unused AVClass pointer
The context structure of the truehd_core bsf had a pointer to a const
AVClass as its first member; yet this bsf does not have any AVClass
associated with it, so that this pointer is always NULL. So remove it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-04-19 19:20:03 +02:00
Michael Niedermayer
13171ad2e3 avcodec/rv40dsp: Fix integer overflows in rv40_weight_func_*()
Fixes: signed integer overflow: 40550400 * 128 cannot be represented in type 'int'
Fixes: 20331/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RV40_fuzzer-5676685725007872

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-19 17:08:08 +02:00
Peter Ross
55d830f69a avcodec/pngdec: set return value on av_stereo3d_create_side_data() failure
Signed-off-by: Peter Ross <pross@xvid.org>
Reviewed-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2020-04-18 10:16:55 +10:00
Marton Balint
7d89445473 avcodec/bsf: use simplified algorithm for bsf_list chained filtering
Based on the one in ffmpeg.c and it is not using an extra flush_idx variable.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-04-17 21:26:55 +02:00
Peter Ross
1b59f3f844 avcodec/mv30: use aandcttables 2020-04-17 19:34:02 +10:00
Peter Ross
06dab51e68 avcodec/mv30: remove unused table elements 2020-04-17 19:34:02 +10:00
Peter Ross
3e5f0cf271 avcodec/vp3: fix indentation 2020-04-17 19:33:43 +10:00
James Almer
fccd6c2be0 avcodec: add a WebP parser
Based on code from the BMP parser.

Addresses ticket #8574

Reviewed-by: James Zern <jzern@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-04-16 15:05:07 -03:00
Michael Niedermayer
8e30502abe avcodec/ac3dec_fixed: Fix several invalid left shifts in scale_coefs()
Fixes: left shift of negative value -14336
Fixes: 20298/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AC3_FIXED_fuzzer-5675484201615360

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-16 00:56:49 +02:00
Michael Niedermayer
55f9683cf6 avcodec/flac_parser: Do not lose header count in find_headers_search()
Fixes: Timeout
Fixes: out of array access
Fixes: 20274/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLAC_fuzzer-5649631988154368
Fixes: 19275/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLAC_fuzzer-5757535722405888

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-16 00:56:49 +02:00
Michael Niedermayer
abb5762e98 avcodec/audiodsp: Fix integer overflow in scalarproduct_int16_c()
Fixes: signed integer overflow: 2145417478 + 76702564 cannot be represented in type 'int'
Fixes: 20313/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RA_144_fuzzer-5734487724130304

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-16 00:56:49 +02:00