1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00
Commit Graph

43069 Commits

Author SHA1 Message Date
Anton Khirnov
fb30c9107a hevc_parser: drop the use of SliceHeader
It is only used to store a few local variables within one function,
which is better accomplished by just declaring them on stack explicitly.
2020-06-08 10:51:56 +02:00
Anton Khirnov
2a9bed8fc1 hevc_refs: reduce code duplication in find_ref_idx() 2020-06-08 10:51:56 +02:00
Andreas Rheinhardt
d29aaf12f4 avcodec/v4l2_m2m_enc: Avoid ;;
Inside a function, the second ; in a double ;; is a null statement, but
outside of functions a double ;; is simply invalid C that compilers
happen to accept. v4l2_m2m_enc.c contained several ;; as a result of
macro-expansion. So change the underlying macro so that it doesn't
happen any longer.

This fixes warnings when compiling with -pedantic: "ISO C does not allow
extra ‘;’ outside of a function".

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-06-08 01:22:34 +02:00
Michael Niedermayer
27c42d33bc avcodec/ac3dec_fixed: Remove some temporary variables from scale_coefs()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-06-08 00:21:15 +02:00
Michael Niedermayer
292b9b93a5 avcodec/lzf: Consider the needed size in reallocation
Fixes: NULL pointer dereference
Fixes: 22381/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NOTCHLC_fuzzer-5659879921680384.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-06-08 00:21:15 +02:00
Michael Niedermayer
6d96bae9c4 avcodec/adpcm: XA: Check shift similar to filter
Fixes: negative shift
Fixes: 22499/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_XA_fuzzer-5765452130418688

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-06-07 22:01:12 +02:00
Gautam Ramakrishnan
d09c35677d libavcodec/jpeg2000_parser: Add jpeg2000 parser
I have attempted to write a JPEG2000 Parser. Have tested
by generating a file containing 14 frames, as mentioned
by Micheal. Have also tried testing with various packet
sizes by setting -frame_size option. Additionally,
fixed a few formatting issues as pointed out by Micheal.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-06-07 01:23:40 +02:00
James Almer
49d37b4b61 avcodec/libaomenc: remove the experimental flag when using libaom 2.0.0 or newer
Reviewed-by: James Zern <jzern@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-06-06 01:04:39 -03:00
Michael Niedermayer
a1223ddc56 avcodec/huffyuvdec: Test vertical coordinate more often
Fixes: out of array access
Fixes: 22892/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HYMT_fuzzer-5135996772679680.fuzz

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>
2020-06-06 00:38:53 +02:00
Thierry Foucu
a1a85579e3 libavcodec/bmp_parser.c: fix a use_of_uninitialized_value in target_dec_fuzzer.
the target_dec_fuzzer is checking for the avpkt.data pointer but if the
bmp parser cannot combine the frame, the poutbuf is not set.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-06-06 00:25:00 +02:00
Thierry Foucu
3dc24b3379 libavcodec/mlp_parser.c: fix a use_of_uninitialized_value in target_dec_fuzzer.
the target_dec_fuzzer is checking for the avpkt.data pointer but if the
mlp parser cannot combine the frame, the poutbuf is not set.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-06-06 00:25:00 +02:00
Thierry Foucu
d5422a14e2 libavcodec/png_parser.c: fix a use_of_uninitialized_value in target_dec_fuzzer.
the target_dec_fuzzer is checking for the avpkt.data pointer but if the
png parser cannot combine the frame, the poutbuf is not set.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-06-06 00:25:00 +02:00
Michael Niedermayer
cf28521fee avcodec/hq_hqa: Check info size
Fixes: assertion failure
Fixes: 21079/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HQ_HQA_fuzzer-5737046523248640

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-06-05 18:14:17 +02:00
Michael Niedermayer
7f817853cd avcodec/mv30: Fix multiple integer overflows in idct_1d()
Fixes: signed integer overflow: -4869937 * 473 cannot be represented in type 'int'
Fixes: 21934/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MV30_fuzzer-5667289925156864

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-06-04 23:58:49 +02:00
Michael Niedermayer
e73a251680 avcodec/mv30: Do not allow MVs outside the allocated image
Fixes: out of array read
Fixes: 21804/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MV30_fuzzer-5673678898724864

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-06-04 23:58:49 +02:00
Michael Niedermayer
c42ed06695 avcodec/wmalosslessdec: Fix integer overflow in mclms_predict()
Fixes: signed integer overflow: 2147483636 + 2048 cannot be represented in type 'int'
Fixes: 22016/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMALOSSLESS_fuzzer-5109395618004992

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-06-04 23:58:49 +02:00
Michael Niedermayer
071e293723 avcodec/vp9dsp_template: Fix integer overflow(s) in iadst16_1d()
Fixes: signed integer overflow: 1080285923 - -1130879337 cannot be represented in type 'int'
Fixes: 22002/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP9_fuzzer-6260237310099456

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-06-04 23:58:49 +02:00
Michael Niedermayer
bafaf95116 avcodec/wavpack: Do not allow the sample format to change between channels
Fixes: out of array access
Fixes: 22692/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVPACK_fuzzer-5678686190960640

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: David Bryant <david@wavpack.com>
Tested-by: David Bryant <david@wavpack.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-06-04 23:09:07 +02:00
Michael Niedermayer
e34686d7ac avcodec/bitpacked: add missing comma to codec tags
Fixes: array end overread
Fixes: 22395/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BITPACKED_fuzzer-5760940300828672

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Darnley <james.darnley@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-06-04 19:22:29 +02:00
Roman Arzumanyan
470bbf60d4 avcodec/nvenc: honor max bitrate in CQ mode
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2020-06-04 15:33:19 +02:00
James Almer
8e7b5ba80e avcodec/decode: actually propagate AVHWAccel.alloc_frame() return value
Finishes fixing the regression introduced in a1133db30e
after the partial fix in b6d6597bef.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-06-04 09:58:27 -03:00
Limin Wang
801c8a961a avcodec/ratecontrol: fix the integer overflow after long time run
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-06-03 06:57:50 +08:00
James Almer
6e1903938b avcodec/internal: move packet related functions to their own header
Signed-off-by: James Almer <jamrial@gmail.com>
2020-06-02 19:02:12 -03:00
Michael Niedermayer
782865bf30 avcodec/h264dec: Disable forced small_padding on flag2 fast
Fixes: 20978/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-5746381832847360

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-06-02 00:02:04 +02:00
Michael Niedermayer
4b2248594c avcodec/jpeg2000dec: clear pointer which become stale in get_ppt()
Fixes: use after free
Fixes: 22484/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-5671488765296640

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Gautam Ramakrishnan <gautamramk@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-06-01 23:32:28 +02:00
Roman Arzumanyan
0842fd2c25 avcodec/nvenc: zero avg and max bitrate in CQ mode
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2020-06-01 19:23:47 +02:00
Andreas Rheinhardt
f02b1b1222 avcodec/encode: Remove ff_alloc_packet
It is no longer used anymore.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-06-01 14:52:26 +02:00
Limin Wang
dd76226842 avcodec/mpeg12enc: support mpeg2 encoder const profile
Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-06-01 07:05:32 +08:00
Brad Hards
bbc0eb7fcb avcodec: add constants for KLV pseudo-profile.
There are two different ways KLV is used in MISB specs - sync and async.
The corresponding text (in ST1401) says:

ISO/IEC 13818-1 Table-34 defines a stream_type = 0x15 for “Metadata carried in PES packets,”
and Table 2-22 defines a stream_id = 0xFC for “metadata stream.”

and

In ISO/IEC 13818-1, Table-34 defines a stream_type = 0x06 for “PES packets containing private
data,” and Table 2-22 defines a stream_id = 0xBD for “private_stream_1.”

These constants allow us to distinguish the two cases, as codec profiles.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-05-31 18:31:54 +02:00
Andreas Rheinhardt
a886785018 avcodec/anm: Don't unnecessarily use context variables
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-05-31 13:13:52 +02:00
Andreas Rheinhardt
45c3502266 avcodec/anm: Check extradata length before allocating frame
Then one doesn't need to free the frame in case the length turns out to
be insufficient.

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-05-31 12:17:06 +02:00
Paul B Mahol
d49db99ce2 avcodec: add PFM image decoder 2020-05-30 18:02:55 +02:00
Michael Niedermayer
9d24f293e7 avcodec/adpcm_data: extend ff_adpcm_ima_cunning_index_table
Fixes: overread by 1
Fixes: 21880/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_IMA_CUNNING_fuzzer-5717917221257216.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-05-29 19:40:36 +02:00
Jun Zhao
b63f502911 lavc/libx264: misc style fixes
commit 4ed3a01d71 missed coding style fix.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-05-28 15:56:06 +08:00
James Almer
b6d6597bef avcodec/decode: fix decoding when frames are allocated using AVHWAccel.alloc_frame()
Regression since a1133db30e

Found-by: comex <comexk@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-05-27 23:10:04 -03:00
Zane van Iperen
09e6e45588 avcodec/adpcmenc: fix formatting
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-05-27 22:13:39 +02:00
Zane van Iperen
b1189c1571 avcodec: add adpcm_ima_ssi encoder
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-05-27 22:13:39 +02:00
Zane van Iperen
908199802a avcodec/adpcmenc: add capabilities argument to ADPCM_ENCODER()
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-05-27 22:13:20 +02:00
Limin Wang
b01d12bcc0 avcodec/h264dec: Add FF_CODEC_CAP_INIT_CLEANUP
then ff_h264_free_tables() and h264_decode_end() can be removed
in h264_decode_init() if it's failed.

The FF_CODEC_CAP_INIT_CLEANUP flag is need for single thread, For multithread,
it'll be cleanup still by AV_CODEC_CAP_FRAME_THREADS flag if have.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-05-27 21:59:51 +08:00
Limin Wang
467d9e27e0 avcodec: Add FF_CODEC_CAP_INIT_CLEANUP
then ff_mpv_encode_end() will be unnecessary in ff_mpv_encode_init()
if it's failed.

The FF_CODEC_CAP_INIT_CLEANUP flag is need for single thread, For multithread,
it'll be cleanup still by AV_CODEC_CAP_FRAME_THREADS flag if have.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-05-27 21:59:51 +08:00
Limin Wang
6124cbdcfa avcodec/adpcmenc: Add FF_CODEC_CAP_INIT_CLEANUP
then we can remove adpcm_encode_close() in adpcm_encode_init() if have failed.
so the goto error lable will be unnecessary and can be removed later.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-05-27 21:59:51 +08:00
Anton Khirnov
b5aee6086b avcodec.h: move avcodec_get_{type,name} to codec_id.h 2020-05-27 10:22:17 +02:00
Anton Khirnov
ba6cada92e avcodec.h: split AVCodec API into its own header 2020-05-27 10:22:17 +02:00
Linjie Fu
7ae340111e lavc/vaapi_hevc: add missing max_8bit_constraint_flag
This is accidentally missed while rebasing.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
2020-05-27 15:34:16 +08:00
Xu Guangxin
8b5ffaea64 lavc/hevc_refs: Fix the logic of find_ref_idx()
Currently find_ref_idx() would trigger 2 scans in DPB to find the
requested POC:
1. Firstly, ignore MSB of ref->poc and search for the requested POC;
2. Secondly, compare the entire ref->poc with requested POC;

For long term reference, we are able to only check LSB if MSB is not
presented(e.g. delta_poc_msb_present_flag == 0). However, for short
term reference, we should never ignore poc's MSB and it should be
kind of bit-exact. (Details in 8.3.2)

Otherwise this leads to decoding failures like:
[hevc @ 0x5638f4328600] Error constructing the frame RPS.
[hevc @ 0x5638f4328600] Error parsing NAL unit #2.
[hevc @ 0x5638f4338a80] Could not find ref with POC 21
Error while decoding stream #0:0: Invalid data found when processing input

Search the requested POC based on whether MSB is used, and avoid
the 2-times scan for DPB buffer. This benefits both native HEVC
decoder and integrated HW decoders.

Signed-off-by: Xu Guangxin <guangxin.xu@intel.com>
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
2020-05-27 14:47:55 +08:00
Xu Guangxin
939a4db227 lavc/hevc: Add poc_msb_present filed in LongTermRPS
delta_poc_msb_present_flag is needed in find_ref_idx() to
indicate whether MSB of POC should be taken into account.

Details in 8.3.2.

Signed-off-by: Xu Guangxin <guangxin.xu@intel.com>
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
2020-05-27 14:39:36 +08:00
Martin Storsjö
6c33a230e4 mfenc: Avoid including codecapi.h, fix building in UWP mode with clang
Including codecapi.h and uuids.h in UWP mode doesn't define all defines
properly, ending up with constructs that MSVC silently tolerates, but
that clang errors out on, like this:
    DEFINE_GUIDEX(CODECAPI_AVEncCommonFormatConstraint);

Just avoid including codecapi.h completely and hardcode the last few
enum values we use from there. We already use local versions of most
enums from there, due to older mingw-w64 headers being incomplete.

Signed-off-by: Martin Storsjö <martin@martin.st>
2020-05-27 00:19:32 +03:00
Martin Storsjö
869f655e2e mfenc: Remove an unused include
This might have been used originally for the decoder parts of
the MediaFoundation wrapper, which aren't merged yet.

Signed-off-by: Martin Storsjö <martin@martin.st>
2020-05-27 00:19:32 +03:00
Lynne
2502e13b07
opusenc: add apply_phase_inv option
By popular request.
Does the same as in libopusenc.
2020-05-26 10:52:12 +01:00
Lynne
b8d9bc2e87
pngdec: add ability to check chunk CRC
By default now, if AV_EF_CRCCHECK or AV_EF_IGNORE_ERR are enabled the decoder
will skip the chunk and carry on with the next one. This should make the
decoder able to decode more corrupt files because the functions which decode
individual chunks will very likely error out if fed invalid data and stop the
decoding of the entire image.
2020-05-26 10:23:13 +01:00