1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

45320 Commits

Author SHA1 Message Date
Michael Niedermayer
adae546f24 avcodec/exr: Check uncompressed_size against max_pixels
Fixes: Timeout
Fixes: 35286/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-6557139802914816
Fixes: 31253/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-4901782326214656

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-07-17 10:48:27 +02:00
James Almer
1349de10b2 avcodec/libdav1d: parse sequence headers in extradata if available
This allows the decoder context to be initialized with all stream parameters
before a packet is parsed.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-07-14 13:11:51 -03:00
Jan Ekström
f32f56468c {configure,avcodec/libx264}: remove separate x264_csp_bgr check
We already require X264_BUILD >= 118, which includes an unconditional
definition of X264_CSP_BGR in itself, thus making this check
effectively always true.
2021-07-12 12:07:10 +03:00
Guangyu Sun
24b3178efd libavcodec/vorbisenc: Add missing initial_padding
Vorbis has priming samples at the beginning. If the initial_padding is not
set in the encoder, the total sample count will be one frame fewer than it
should be. The result is that we get a truncated version of encoding.

initial_padding should be set to the frame_size used in
vorbis_encode_frame().

Signed-off-by: Guangyu Sun <gsun@roblox.com>
2021-07-12 09:54:52 +02:00
Gyan Doshi
1aa9dcd091 avcodec/qsvenc: clip global_quality for ICQ modes.
Allowed range is 1 to 51.

Ref: https://software.intel.com/content/www/us/en/develop/articles/advanced-bitrate-control-methods-in-intel-media-sdk.html
2021-07-12 09:33:22 +05:30
James Almer
7ee17ec7e4 avcodec/libdav1d: don't repeatedly parse the same sequence header
Look at the event flag that signals a new sequence header was found
in the bitstream on supported libdav1d versions for this purpose.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-07-09 11:07:29 -03:00
James Almer
48eaf8ba1c avcodec/libdav1d: use ff_decode_frame_props() to fill frame properties
The main benefit comes from propagating container level metadata like hdr,
which is more commonly used than the relevant Metadata OBUs.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-07-09 11:07:29 -03:00
Michael Niedermayer
eaec4df63f avcodec/aacdec_template: Avoid some invalid values to be set by decode_audio_specific_config_gb()
Fixes: NULL pointer dereference
Fixes: decode_spectrum_and_dequant.mp4

Found-by: Rafael Dutra <rafael.dutra@cispa.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-07-09 14:57:49 +02:00
Andreas Rheinhardt
f067795c74 avcodec/textdec: Deduplicate AVClasses
The child_class_next API relied on different AVCodecs to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 20:10:17 +02:00
Andreas Rheinhardt
d46de6d4bc avcodec/proresenc_anatoliy: Deduplicate pix_fmts arrays
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 20:10:17 +02:00
Andreas Rheinhardt
a45058ddf9 avcodec/proresenc_anatoliy: Deduplicate AVClasses
The child_class_next API relied on different AVCodecs to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 20:10:17 +02:00
Andreas Rheinhardt
f41a9b331e avcodec/pngenc: Deduplicate AVClasses
The child_class_next API relied on different AVCodecs to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 20:10:17 +02:00
Andreas Rheinhardt
34ff543672 avcodec/mpegvideo_enc: Deduplicate ff_mpv_generic_options-based AVClasses
The child_class_next API relied on different AVCodecs to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 20:10:17 +02:00
Andreas Rheinhardt
19d8077e31 avcodec/libwebpenc: Deduplicate options, AVClass, pix_fmts
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 20:10:17 +02:00
Andreas Rheinhardt
425d272507 avcodec/libcodec2: Remove AVClass for decoder
The decoder has no options.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 20:10:17 +02:00
Andreas Rheinhardt
01f4f6c297 avcodec/g726: Deduplicate AVClasses
The child_class_next API relied on different AVCodecs to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 20:10:17 +02:00
Andreas Rheinhardt
bc368575a9 avcodec/ac3enc: Deduplicate AVClasses
The child_class_next API relied on different AVCodecs to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 20:10:01 +02:00
Andreas Rheinhardt
9a1a82d21c avcodec/ac3dec_float: Deduplicate AVClasses
The child_class_next API relied on different AVCodecs to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 19:30:36 +02:00
Andreas Rheinhardt
34a7e61768 avcodec/Makefile: Fix standalone build of adpcm_argo encoder
Said encoder uses a function in adpcm.c and while it does not use
anything from adpcm_data.c, other parts of both adpcm.c and adpcmenc.c
need it, so adpcm_data.c needs to be enabled anyway.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 16:03:18 +02:00
Andriy Gelman
78f21f4ec1 avcodec/mjpegdec: Try to continue decoding on zero quant matrix value
A zero value in the quantization matrix is invalid but in practice will
just set the transform coefficient to zero after inverse quantization.
Try to continue decoding if the AV_EF_EXPLODE flag is not set.

Fixes ticket #9287.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2021-07-05 13:00:50 -04:00
James Almer
041267b558 avcodec/setts_bsf: add a NOPTS constant
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-07-04 11:18:43 -03:00
James Almer
b0b3fce3c3 avcodec/setts_bsf: actually store the current packet's timestamps to be usable by the next
Before this change, the PREV_OUTPTS and PREV_OUTDTS constants always evaluated
to AV_NOPTS_VALUE.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-07-04 11:16:01 -03:00
Gyan Doshi
301d275301 avcodec/bsf: switch to av_get_token to parse bsf list string
The recently added setts bsf makes use of the eval API whose
expressions can contain commas. The existing parsing in
av_bsf_list_parse_str() uses av_strtok to naively split
the string at commas, thus preventing the use of setts filter
with expressions containing commas.

av_get_token can work with escaped commas, allowing full use of setts.
2021-07-04 09:54:33 +05:30
Michael Niedermayer
70874e024a avcodec/lpc: check for zero err in normalization in compute_lpc_coefs()
Fixes: floating point division by 0
Fixes: Ticket8213

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-07-03 18:03:35 +02:00
Michael Niedermayer
6a6a765fa4 avcodec/j2kenc: Check for av_strtok() failure
Fixes: CID1466601 Dereference null return value

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-07-03 18:03:35 +02:00
Haihao Xiang
9583e66ea0 qsvenc_hevc: allow user set more coding options
The SDK supports NalHrdConformance, RecoveryPointSEI and AUDelimiter for
hevc encoder, so we may allow user to set these coding options like as
what we did for h264_qsv encoder.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
Signed-off-by: Zhong Li <zhongli_dev@126.com>
2021-07-02 23:38:36 +08:00
Michael Niedermayer
cea05864e6 avcodec/cpia: Fix missing src_size update
Fixes: out of array read
Fixes: 35210/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CPIA_fuzzer-5669199688105984

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-06-29 19:36:36 +02:00
Michael Niedermayer
18b0dd0738 avcodec/exr: Better size checks
Fixes: signed integer overflow: 3530839700044513368 + 8386093932303352321 cannot be represented in type 'long long'
Fixes: 35182/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5398383270428672

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-06-29 19:36:36 +02:00
Michael Niedermayer
11fac9613e avcodec/clearvideo: Check tile_size to be not too large
Fixes: left shift of 1 by 31 places cannot be represented in type 'int'
Fixes: 35023/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CLEARVIDEO_fuzzer-6740166587842560

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-06-29 19:36:36 +02:00
Michael Niedermayer
00ae9b77ef avcodec/utils: Use 64bit for intermediate in AV_CODEC_ID_ADPCM_THP* duration calculation
Fixes: signed integer overflow: 486539264 * 14 cannot be represented in type 'int'
Fixes: 35281/clusterfuzz-testcase-minimized-ffmpeg_dem_RSD_fuzzer-6068262742917120

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-06-29 19:36:36 +02:00
Derek Buitenhuis
d70dde2712 avcodec/h264_metadata_bsf: Allow zeroing constraint_set4_flag and constraint_set5_flag
These bits are reserved in earlier versions of the H.264 spec, and
some poor hardware decoders require they are zero. Thus, it is useful
to be able to zero these on streams that may have them set. The result
is still a valid H.264 bitstream.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2021-06-29 15:31:06 +01:00
Anton Khirnov
296dc876ec lavc: fix and extend AVCodecContext.get_format doxy
Remove some incorrect (or at least misleading) statements, such as the
formats being ordered by quality, or the first format being the native
one. Neither of those are true for hardware acceleration, which is the
main use of this callback.
2021-06-26 19:33:42 +02:00
Limin Wang
81bad080cd avcodec/libx264: Separate headers not supported in AVC-Intra mode
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-06-25 09:27:52 +08:00
Limin Wang
93da0869e6 avcodec/libx264: Add support for Sony XAVC Class 300 and 480
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-06-25 09:27:52 +08:00
Mohammad Izadi
aca923b365 avcodec: Pass HDR10+ metadata to packet side data in VP9 encoder
HDR10+ metadata is stored in the bit stream for HEVC. The story is
different for VP9 and cannot store the metadata in the bit stream.
HDR10+ should be passed to packet side data an stored in the container
(mkv) for VP9.

This CL is taking HDR10+ from AVFrame side data in libvpxenc and is
passing it to the AVPacket side data.

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Zern <jzern@google.com>
2021-06-24 10:29:17 -07:00
James Almer
ec8e95296e avcodec/crystalhd: signal that the decoder sets all output frame properties
Signed-off-by: James Almer <jamrial@gmail.com>
2021-06-21 15:26:44 -03:00
James Almer
6b4805686c avcodec/cuviddec: signal that the decoder sets all output frame properties
Fixes memleaks described in ticket #9082.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-06-21 15:21:51 -03:00
James Almer
854a9d8c6e avcodec/cuviddec: remove unused AVCodec.decode() callback
The AVCodec.receive_frame() callback takes precedence.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-06-21 15:05:20 -03:00
James Almer
b4c2ff3e41 avcodec/decode: reindent after the previous commit
Signed-off-by: James Almer <jamrial@gmail.com>
2021-06-21 15:05:11 -03:00
James Almer
7b9610ebd8 avcodec/decode: add an internal codec flag to signal a decoder sets all output frame properties
Decoders like cuviddec ignore and overwrite all the properties set by the generic
code as derived from AVCodecInternal.last_pkt_props. This flag ensures libavcodec
will not store and potentially queue input packets that ultimately will not be used.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-06-21 15:03:52 -03:00
James Almer
a4fb03563a avcodec/decode: fetch packets from the pkt_props FIFO on every frame returned
Fixes memleaks on decoders that don't call ff_decode_frame_props(), like
libdav1d.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-06-21 14:59:54 -03:00
Michael Niedermayer
d866787dac avcodec/hevc_sei: Use get_bits_long() for time_offset_value
Fixes: assertion failure
Fixes: crash_1

Found-by: Thuan Pham <tpham.unimelb@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-06-20 17:43:47 +02:00
Haihao Xiang
971b4ac733 lavc/qsvdec: fix pts
The time base used for compressed bitstream and video frame in the SDK
is { 1, 90000 }. [1][2]

This can avoid the error message below from the muxer.

$> ffmpeg -hwaccel qsv -c:v hevc_qsv -i input.h265 -f null -
...
[null @ 0x561c24f6f2f0] Application provided invalid, non monotonically
increasing dts to muxer in stream 0: 2 >= 2

[1]https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md#mfxbitstream
[2]https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md#mfxframedata

Signed-off-by: Zhong Li <zhongli_dev@126.com>
2021-06-20 23:04:35 +08:00
Pavel Koshevoy
b51c2c48c1 avcodec/ccaption_dec: Make real-time latency configurable
Un-hardcode the 200ms minimum latency between emitting subtitle events
so that those that wish to receive a subtitle event for every screen
change could do so.

The problem with delaying realtime output by any amount is that it is
unknown when the next byte pair that would trigger output will happen.
It may be within 200ms, or it may be several seconds later -- that's
not realtime at all.
2021-06-18 19:20:03 -06:00
Michael Niedermayer
216eb60b85 avcodec/iff: Only write palette to plane 1 if its PAL8
Fixes: null pointer passed as argument 1, which is declared to never be null
Fixes: 33791/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5107575256383488.fuzz

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-06-18 18:58:25 +02:00
Matthieu Patou
fcb80aa289 lavc/libvpxenc: Show encoder config as a warning in case of failed initialization
Suggested-By: ffmpeg@fb.com
2021-06-14 20:25:56 +02:00
Matthieu Patou
268f134e51 lavc/libaomenc: Show encoder config as a warning in case of failed initialization
Suggested-By: ffmpeg@fb.com
2021-06-14 20:25:52 +02:00
Thilo Borgmann
115aa7cea3 lavc/videotoolboxenc.c: Fix preprocessor macro for OSX 10.10.5 and probably older versions 2021-06-14 16:20:47 +02:00
Michael Niedermayer
ff56c139e0 avcodec/faxcompr: Check available bits in decode_uncompressed()
Fixes: Timeout
Fixes: 34950/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5686764151898112
Fixes: 34966/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-4587409334468608

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-06-12 14:22:42 +02:00
Michael Niedermayer
7d8421e3d5 avcodec/faxcompr: Check if bits are available before reading in cmode == 9 || cmode == 10
Fixes: Timeout
Fixes: 34950/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5686764151898112

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-06-12 14:22:42 +02:00