Compare commits

...

382 Commits

Author SHA1 Message Date
MrBesen a1b65bf80a
Merge branch 'master' of https://git.ffmpeg.org/ffmpeg 2020-01-16 13:11:09 +01:00
James Almer e7c04eaf50 avformat/dashenc: document the new options
Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-15 23:34:37 -03:00
James Almer 05b3460991 avformat/dashenc: add an option to write a Latency element
Allows to set an intended target latency while streaming that clients can use
to measure when using low latency mode.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-15 23:34:22 -03:00
Anton Khirnov bc4f0e713b dashenc: support setting arbitrary HTTP protocol options
Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-15 23:34:22 -03:00
James Almer c96a9636c8 avformat/dashenc: allow setting custom movflags using format_options
Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-15 23:34:21 -03:00
James Almer cc929cee76 avformat/movenc: add a flag to enable CMAF compatability
Sets some required constrains and reports compatability with the relevant
compatible brand.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-15 23:34:21 -03:00
James Almer f63407a986 avformat/dashenc: implement DVB-DASH profile
Add new required elements and constrain presence and values for existing
ones based on the spec.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-15 23:34:21 -03:00
James Almer 21847e2a52 avformat/dashenc: add an option to enable low latency Dash manifest
In combination with the streaming option it constrains the value of a few elements,
to prevet clients from buffering too much data before starting presentation.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-15 23:34:20 -03:00
James Almer 7e5d143bb5 avformat/dashenc: Write a Producer Reference Time element
Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-15 23:34:20 -03:00
James Almer 7abc0979e6 avformat/movenc: use AVProducerReferenceTime side data to write the prft atom
If not available, set flags to 24 (bits 4 and 5), to signal the wallclock value
is read at the time of writing the atom.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-15 23:34:20 -03:00
James Almer 4e4ac20340 avformat/utils: make ff_ntp_time() accept a timestamp as input argument
Will be needed by the next patch.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-15 23:34:20 -03:00
James Almer 56c8856966 avcodec/libx264: export Producer Reference Time as packet side data
Taken from Wallclock at the time the frame is submitted to the encoder.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-15 23:34:20 -03:00
James Almer 717b2074ec avcodec: add a Producer Reference Time AVPacketSideData type
Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-15 23:33:41 -03:00
James Almer ea5a910628 avformat/dashenc: allow splitting fragments following P-Frame reordering
Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-15 12:22:29 -03:00
James Almer ceb236c1c5 avformat/dashenc: allow setting fragment durations
Implemented as as a frag_duration muxer option and key=value entry in the
adaptation_sets muxer option. It has the same syntax as the seg_duration option.
A new frag_type option is also introduced to select the kind of fragmentation.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-15 12:22:28 -03:00
James Almer 0c19dd2df4 avformat/dashenc: allow setting segment durations per AdaptationSet
Implemented as as a seg_duration key=value entry in the adaptation_sets muxer
option.
It has the same syntax as the global seg_duration option, and has precedence
over it if set.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-15 12:22:28 -03:00
Michael Niedermayer d26589c27a avcodec/wmalosslessdec: Use AV_STRINGIFY()
Suggested-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-15 13:49:13 +01:00
Michael Niedermayer 9d6be83085 avcodec/wmalosslessdec: Replace negative channel check by assert
It is already checked by common code in git/master

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-15 13:49:13 +01:00
Michael Niedermayer 891bcc4acc avcodec/wmalosslessdec: move channel check up
Fixes: out of array access
Fixes: 2nd part of 18429/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMALOSSLESS_fuzzer-6210814364614656

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-15 13:49:13 +01:00
Gyan Doshi 0777b197c5 avfilter/swaprect: correct assignment of VAR_POS
Revert regression introduced in 6af050d7d0
2020-01-15 14:27:51 +05:30
Gyan Doshi 0dc0837960 avfilter/scale: add animation support
Width and height expressions in scale and scale2ref filters can now
reference frame index, timestamp and packet position.
2020-01-15 12:03:47 +05:30
Gyan Doshi ce2cfa67aa avfilter/scale: add function to check expressions
Allows finer identification and logging of invalid expressions and use
of a single list for symbols and their index for both scale and
scale2ref.
2020-01-15 11:26:49 +05:30
Gyan Doshi 6310fbd543 avfilter/scale: separate exprs parse and eval
Retains parsed expressions which allows for better
error-checking and adding animation support.
2020-01-15 11:26:46 +05:30
Gyan Doshi cc9a7cae76 avfilter/scale2ref: update links and re-eval expr upon ref frame change
Needed when filtergraph reinit is disabled for the ref input.
2020-01-15 11:26:38 +05:30
Gyan Doshi c21462d42e avfilter/scale: store frame change eval
Better readability and allows reuse
2020-01-15 11:26:32 +05:30
Andreas Rheinhardt b55c6b8c40 avformat/avformat: Update AVInputFormat.read_packet documentation
Since bae8844e35, the packet is automatically unreferenced in
ff_read_packet() when an error is returned; but the documentation of
this of AVInputFormat.read_packet has not been updated accordingly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-14 23:00:35 +01:00
Andreas Rheinhardt 56a04b7c38 avformat/segafilmenc: Check early whether video is allowed
The current code only checks when writing the trailer whether the video
format and Codec ID are actually compatible with the container. At this
point, a lot of data will already have been written (in vain, of
course), so check during the init function instead.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-14 23:00:35 +01:00
Andreas Rheinhardt 30859c270f avformat/segafilmenc: Postpone check for existence of video stream
Up until now, the Sega FILM muxer complained if the first stream wasn't a
video stream that there is no video stream at all which is of course
nonsense. So postpone this check.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-14 23:00:35 +01:00
Andreas Rheinhardt 8ae026d74f avformat/segafilmenc: Fix undefined left shift of 1 by 31 places
by changing the type to unsigned.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-14 23:00:35 +01:00
Limin Wang 44a80897e8 avutil/avstring: Fix warning: ISO C90 forbids mixed declarations and code
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-14 19:19:30 +01:00
Limin Wang 72a08af8ba avfilter/vf_eq: cosmetics
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-14 19:19:30 +01:00
Andriy Gelman 8a8966295f avcodec/v4l2_context: Use AVERROR macro
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-14 19:19:30 +01:00
Paul B Mahol 7e4b0d377f avfilter/avf_showspectrum: check if frame clone is set 2020-01-14 16:52:08 +01:00
Paul B Mahol cc752233fb avfilter/f_ebur128: check if frame clone is set 2020-01-14 16:52:08 +01:00
Paul B Mahol c43f8baa41 avfilter/avf_aphasemeter: check if clone frame is set 2020-01-14 16:52:07 +01:00
Paul B Mahol d580c7a797 avfilter/avf_ahistogram: check if frame clone is set 2020-01-14 16:52:07 +01:00
Paul B Mahol 928020b9d0 avfilter/asr_anullsrc: remove pointless frame cloning 2020-01-14 16:52:07 +01:00
Paul B Mahol f6f6857c2a avfilter/af_anequalizer: check if frame clone is set 2020-01-14 16:52:07 +01:00
Paul B Mahol 80c4c336f9 avfilter/af_aiir: check if frame clone is set 2020-01-14 16:52:07 +01:00
Paul B Mahol 2a9a52b913 avfilter/af_afir: check if frame clone is set 2020-01-14 16:52:07 +01:00
Paul B Mahol f9897eda43 avfilter/avf_avectorscope: check if clone frame is set 2020-01-14 16:52:07 +01:00
Guo, Yejun 4e1ae43b17 lavfi/dnn_processing: refine code to use function av_image_copy_plane for data copy
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
2020-01-14 11:29:43 -03:00
Guo, Yejun 95ade711eb fate/filter-video: add two tests for dnn_processing with frame format rgb24 and grayf32
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
2020-01-14 11:00:04 -03:00
Paul B Mahol d9a52b0bbf avfilter/f_drawgraph: add rate/r option 2020-01-14 09:54:53 +01:00
Lynne 9e01f171f3
tiffdec: support embedded ICC profiles 2020-01-13 23:26:25 +00:00
Jun Zhao 722547996c lavfi/volume: enable runtime change flag
enable runtime change flag.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-01-13 09:25:18 +08:00
Jun Zhao b5cea39190 lavfi/zscale: enable runtime change flag
enable runtime change flag

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-01-13 09:25:18 +08:00
Jun Zhao a2619a473e lavfi/firequalizer: enable runtime change flag
enable runtime change flag

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-01-13 09:25:18 +08:00
Jun Zhao b7bf55550c lavfi/eq: enable runtime change flag
enable runtime change flag

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-01-13 09:25:18 +08:00
Jun Zhao 419e47788a lavfi/rotate: enable runtime change flag
enable runtime change flag

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-01-13 09:25:18 +08:00
Jun Zhao f2a095ac2a lavfi/streamselect: enable runtime change flag
enable runtime change flag.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-01-13 09:25:18 +08:00
Jun Zhao d9e78a723a lavfi/scale: enable runtime change flag
enable runtime change flag.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-01-13 09:25:18 +08:00
Jun Zhao 8cebc8e479 lavfi/hue: enable runtime change flag
enable runtime change flag.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-01-13 09:25:18 +08:00
Jun Zhao 31b24588c5 lavfi/crop: enable runtime change flag
enable runtime change flag.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-01-13 09:25:18 +08:00
Jun Zhao 94004a8b65 lavfi/spp: enable runtime change flag
enable runtime change flag.

Reviewe-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-01-13 09:25:18 +08:00
Jun Zhao 692f0519bb lavfi/spp: add "quality" option in runtime change path
it's stranage to use option "level" in runtime change path but used
"quality" in option, add "quality" in runtime change path, it's more
intuitive and keep the "level" for compatibility.

Reviewe-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-01-13 09:25:18 +08:00
Michael Niedermayer 029cc9883f tools/target_dec_fuzzer: Adjust threshold for RASC
Fixes: Timeout(35sec -> 4sec)
Fixes: 19289/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RASC_fuzzer-5676526398078976

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-11 23:31:18 +01:00
Michael Niedermayer 285138ef14 avcodec/cbs_h2645: Skip all 0 NAL units
Fixes: assertion failure
Fixes: 19286/clusterfuzz-testcase-minimized-ffmpeg_BSF_H264_REDUNDANT_PPS_fuzzer-5707990724509696

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-11 23:31:18 +01:00
Michael Niedermayer 794352ae9d avcodec/adpcm: Fix overflow in FFABS() IMA_EA_EACS
Fixes: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
Fixes: 19235/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_IMA_EA_EACS_fuzzer-5680878952382464

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-11 23:31:18 +01:00
Michael Niedermayer 6a865cec5e avcodec/alac: Fix integer overflow in LPC coefficient adaption
Fixes: signed integer overflow: 267693597 * 10 cannot be represented in type 'int'
Fixes: 19237/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-5755407700328448

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-11 23:31:18 +01:00
Michael Niedermayer c0bd5fa43d avcodec/g729postfilter: Optimize out overflowing multiplication from apply_tilt_comp()
Fixes: signed integer overflow: -1114392282 * 2 cannot be represented in type 'int'
Fixes: 19236/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_G729_fuzzer-5741678938030080

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-11 23:31:18 +01:00
Michael Niedermayer fea90e9438 libavcodec/vc1: Remove bits variable
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-11 23:31:18 +01:00
Michael Niedermayer 32fb919836 avcodec/vc1dec: Check field_mode for sprites
Fixes: Out of array read
Fixes: 19263/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-5389219325542400

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-11 23:31:18 +01:00
Michael Niedermayer c56a52a82c avcodec/vc1dec: Limit bits by the actual bitstream size
Fixes: Timeout (350 ->19sec)
Fixes: 19249/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-6566896438870016

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-11 23:31:18 +01:00
Limin Wang 8250bb49b1 avcodec/wavpack: simplify the code
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-11 23:25:21 +01:00
Paul B Mahol 1a7f4a122e avfilter: add freezeframes video filter 2020-01-11 19:05:17 +01:00
Andreas Rheinhardt 6a1bf8634a avformat/matroskaenc: Fix ReferenceBlock timestamp
In order to indicate that the frames in a BlockGroup are not keyframes,
one has to add a ReferenceBlock element containing the timestamp of a
referenced Block that has already been written. The timestamp ought to be
relative to the timestamp of the Block it is attached to. Yet the
Matroska muxer used the relative timestamp of the preceding Block of the
track, i.e. the timestamp of the preceding block relative to the
timestamp of the Cluster containing said block (that need not be the
Cluster containing the current Block). This has been fixed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-11 11:18:58 -03:00
Paul B Mahol b650046860 avfilter/af_dynaudnorm: use better limits for maximal amplification
Fixes regression in smoothness of amplification.
2020-01-11 14:08:52 +01:00
Limin Wang dd39dbf983 avfilter/af_amix: change the max range of the number of inputs
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-01-11 11:35:51 +01:00
Limin Wang a144cd6a51 avfilter/vf_mix: change the max range of the number of inputs
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-01-11 11:35:39 +01:00
Gyan Doshi c11b3253a4 doc/general: update table AV1 entry for librav1e 2020-01-11 11:01:17 +05:30
Jun Zhao 883e6af710 doc/general: Add avs2 decoder/encoder entry
Add avs2 decoder/encoder entry

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-01-11 10:51:52 +05:30
Alexandre Heitor Schmidt ae436cc5e4 avformat/img2dec: add option to provide metadata fields related to input path
libavformat/img2.h: New field export_path_metadata to
VideoDemuxData to only allow the use of the extra metadata
upon explicit user request, for security reasons.

libavformat/img2dec.c: Modify image2 demuxer to make available
two special metadata entries called lavf.image2dec.source_path
and lavf.image2dec.source_basename, which represents, respectively,
the complete path to the source image for the current frame and
the basename i.e. the file name related to the current frame.
These can then be used by filters like drawtext and others. The
metadata fields will only be available when explicitly enabled
with image2 option -export_path_metadata 1.

doc/demuxers.texi: Documented the new metadata fields available
for image2 and how to use them.

doc/filters.texi: Added an example on how to use the new metadata
fields with drawtext filter, in order to plot the input file path
to each output frame.

Usage example:

ffmpeg -f image2 -export_path_metadata 1 -pattern_type glob
 -framerate 18 -i '/path/to/input/files/*.jpg'
 -filter_complex drawtext="fontsize=40:fontcolor=white:
 fontfile=FreeSans.ttf:borderw=2:bordercolor=black:
 text='%{metadata\:lavf.image2dec.source_basename\:NA}':x=5:y=50"
 output.avi

Fixes #2874.

Signed-off-by: Alexandre Heitor Schmidt <alexandre.schmidt@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-10 23:08:18 +01:00
Andreas Rheinhardt ad1b0a12f3 avformat/mov: Use AV_DICT_DONT_STRDUP_VAL to avoid av_strdup
This will likely also fix CID 1452574 and 1452565, false positives
resulting from Coverity thinking that av_dict_set() automatically
frees its key and value parameters (even without the
AV_DICT_DONT_STRDUP_* flags).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-10 17:52:14 +01:00
Limin Wang 9519c8dbb7 avfilter/vf_showinfo: fix the integer handling issues
Fixes CID 1457606 and 1457607

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-10 17:52:14 +01:00
Limin Wang 8a62d88b0e avcodec/utils: replace avctx->internal with avci for better readability
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-10 17:52:14 +01:00
Gyan Doshi 22a06a539d avfilter/f_metadata: allow direct flushing when printing to file
Useful for monitoring sparse data in realtime
2020-01-10 21:44:26 +05:30
Andreas Rheinhardt c4c96d5942 fate: Don't use depreceated keepside option
The tests for concat use this option which is scheduled for removal and
does nothing any more. So remove it; otherwise, these tests would fail
at the next major version bump.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-10 12:28:18 -03:00
Paul B Mahol 52bf43eb49 avfilter/af_afir: add support for switching impulse response streams at runtime
Currently, switching is not free of artifacts, to be resolved later.
2020-01-10 13:14:54 +01:00
Paul B Mahol 03a7240a73 avfilter/af_afir: add support for even smaller partition sizes 2020-01-10 13:05:21 +01:00
Paul B Mahol e364fe4cca avfilter/af_afir: split input frames from impulse response frames 2020-01-10 12:43:18 +01:00
Gilles Bouthenot 929e5159bc avformat/id3v2enc: fix bad ID3v2 tag length 2020-01-10 12:02:13 +01:00
Martin Storsjö 3d894db700 movenc: Write durations based on pts into mvhd/mdhd/tkhd/elst
Keep all the existing data fields as they are (there's lots and
lots of nontrivial calculation and heuristics based on them in
their current form), but derive the duration as the difference
between the pts of the first packet to the maximum pts+duration
(not necessarily the last packet); use this duration in any box
where the actual presentation duration is supposed to be.

Fixes: 8420

Signed-off-by: Martin Storsjö <martin@martin.st>
2020-01-10 09:14:00 +02:00
Philip Langdale 3ea7057677 nvenc: implement flush to help allow an encoder to be re-used
It can be useful to re-use an encoder instance when doing segmented
encodings, and this requires flushing the encoder at the start of
each segment.
2020-01-08 19:20:36 -08:00
Andreas Rheinhardt 94cdf82d53 avformat/utils: Remove redundant save+restore
If the size of the input packet is zero, av_grow_packet() used to call
av_new_packet() which would initialize the packet and (in particular)
reset the pos field. This behaviour (which was never documented and
arguably always contradicted the documented behaviour) was changed in
2fe04630. This means that it is unnecessary to save and restore the
packet's position in append_packet_chunked().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-08 20:32:14 +01:00
Andreas Rheinhardt 198081efb7 avcodec/proresenc_anatoliy: Fix invalid left shift of negative number
This fixes ticket #7997 as well as the vsynth*-prores_# FATE-tests
(where * ranges over { 1, 2, 3, _lena } and # over { , _int, _444,
_444_int }).

(Given that prev_dc is in the range -0xC000..0x3FFF, no overflow can
happen upon multiplication with 2.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-08 20:32:14 +01:00
Martin Storsjö 2dc2b11fba cmdutils: Fix compilation on cygwin wrt SetDllDirectory and GetModuleHandle
After 06ec9c4746 we check for these
functions in configure (which will succeed in cygwin), but cmdutils.c
only includes windows.h if _WIN32 is defined (which it isn't in cygwin).

Retain the old intent from before 06ec9c4746,
that these functions only would be used when _WIN32 is defined, while
only using them if configure has agreed that they do exist.

Signed-off-by: Martin Storsjö <martin@martin.st>
2020-01-08 13:53:31 +02:00
Gyan Doshi 5bd001043d avfilter/aformat: add shorthand names for options 2020-01-08 11:15:13 +05:30
Andreas Rheinhardt 653ef8828a avformat/wtvdec: Cosmetics
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-07 22:35:52 -03:00
Andreas Rheinhardt 373c1c9b69 avformat/wtvdec: Fix memleak when reading header fails
Fixes #8314.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-07 22:35:27 -03:00
Limin Wang dce2e0657e avcodec/h264_metadata_bsf: Fix for the incorrect user data with hyphens
How to reproduce:
./ffmpeg -f lavfi -i testsrc -c:v libx264 -g 25 -bsf:v h264_metadata=sei_user_data=186f3693-b7b3-4f2c-9653-21492feee5b8+hello -frames:v 1 h264.mp4

master:
[Parsed_showinfo_0 @ 0x7fc8a0703180] UUID=186f3693-7030-4f2c-6030-21492feee5b8
[Parsed_showinfo_0 @ 0x7fc8a0703180] User Data=hello

Applied the patch:
[Parsed_showinfo_0 @ 0x7f969d408e00] UUID=186f3693-b7b3-4f2c-9653-21492feee5b8
[Parsed_showinfo_0 @ 0x7f969d408e00] User Data=hello

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-08 01:35:13 +01:00
Anthony Delannoy 3def315c5c lavf/libsrt: Fix typo
Reviewed-by: "mypopy@gmail.com" <mypopy@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-08 01:35:13 +01:00
Andreas Rheinhardt 8aeab0dbc1 avformat/dashenc: Fix leak of AVFormatContext on error
The Dash muxer uses submuxers and when one such submuxer has been allocated,
it is initially only stored in a temporary variable. Therefore it leaks
if an error happens between the allocation and storing it permanently.
This commit changes this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: "Jeyapal, Karthick" <kjeyapal@akamai.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-08 01:32:26 +01:00
Andreas Rheinhardt ad18f69bcb avformat/mpjpeg: Remove mpjpeg_write_trailer
It does nothing.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-08 01:32:26 +01:00
Andreas Rheinhardt 45e7c67aff avformat: Improve returned error codes
This commit improves returned error codes by forwarding error codes. In
some instances, the hardcoded returned error codes made no sense at all:
The normal error code for failure of av_new_packet() is AVERROR(ENOMEM),
yet there were instances where AVERROR(EIO) was returned.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-08 01:32:26 +01:00
Andreas Rheinhardt bb20f3dd73 avformat/fitsdec: Fix potential leak of string in AVBPrint
by freeing it a bit earlier.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-08 01:32:26 +01:00
Andreas Rheinhardt 3fd68fd955 avformat/avs: Remove avs_read_close()
It did nothing.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-08 01:32:26 +01:00
Marton Balint 3414115cd4 avformat: convert some avio_flush() calls to avio_write_marker(AVIO_DATA_MARKER_FLUSH_POINT)
Converting explicit avio_flush() calls helps us to buffer more data and avoid
flushing the IO context too often which causes reduced IO throughput for
non-streamed file output.

The user can control FLUSH_POINT flushing behaviour using the -flush_packets
option, the default typically means to flush unless a non-streamed file output
is used, so this change should have no adverse effect on streaming even if it
is assumed that after an avio_flush() the output buffer is clean so small
seekbacks within the output buffer will work even when the IO context is not
seekable.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-07 21:51:45 +01:00
Marton Balint f4a8ea7ff6 avformat: remove more unneeded avio_flush() calls
These instances are simply redundant or present because avio_flush() used to be
required before doing a seekback. That is no longer the case, aviobuf code does
the flush automatically on seek.

This only affects code which is either disabled for streaming IO contexts or
does no seekbacks after the flush, so this change should have no adverse effect
on streaming.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-07 21:51:45 +01:00
Marton Balint c371463915 avformat: remove avio_flush() calls from the end of write_packet functions
Removing explicit avio_flush() calls helps us to buffer more data and avoid
flushing the IO context too often which causes reduced IO throughput for
non-streamed file output.

The user can control flushing behaviour at the end of every packet using the
-flush_packets option, the default typically means to flush unless a
non-streamed file output is used.

Therefore this change should have no adverse effect on streaming, even if it is
assumed that a new packet has a clean buffer so small seekbacks within the
output buffer work even when the IO context is not seekable.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-07 21:51:45 +01:00
Marton Balint c05d82fa92 avformat: remove unneeded avio_flush() calls from the end of write_trailer functions
The IO context is always flushed by libavformat/mux.c after write_trailer is
called, so this change should have no effect at all.
2020-01-07 21:51:45 +01:00
Marton Balint 4bf90e095b avformat: remove avio_flush() calls from the end of write_header functions
To make it consistent with other muxers.

The user can still control the generic flushing behaviour after write_header
(same way as after packets) using the -flush_packets option, the default
typically means to flush unless a non-streamed file output is used.

Therefore this change should have no adverse effect on streaming, even if it is
assumed that the first packet has a clean buffer, so small seekbacks within the
output buffer work even when the IO context is not seekable.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-07 21:51:45 +01:00
Marton Balint 4d7f8254ac avformat: remove unneeded avio_flush() calls before calling avio_close_dyn_buf()
avio_close_dyn_buf() also does avio_flush().

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-07 21:51:45 +01:00
Guo, Yejun 37d24a6c8f vf_dnn_processing: add support for more formats gray8 and grayf32
The following is a python script to halve the value of the gray
image. 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
from skimage import color
from skimage import io
in_img = io.imread('input.jpg')
in_img = color.rgb2gray(in_img)
io.imsave('ori_gray.jpg', np.squeeze(in_img))
in_data = np.expand_dims(in_img, axis=0)
in_data = np.expand_dims(in_data, axis=3)
filter_data = np.array([0.5]).reshape(1,1,1,1).astype(np.float32)
filter = tf.Variable(filter_data)
x = tf.placeholder(tf.float32, shape=[1, None, None, 1], 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())
graph_def = tf.graph_util.convert_variables_to_constants(sess, sess.graph_def, ['dnn_out'])
tf.train.write_graph(graph_def, '.', 'halve_gray_float.pb', as_text=False)
print("halve_gray_float.pb generated, please use \
path_to_ffmpeg/tools/python/convert.py to generate halve_gray_float.model\n")
output = sess.run(y, feed_dict={x: in_data})
output = output * 255.0
output = output.astype(np.uint8)
io.imsave("out.jpg", np.squeeze(output))

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

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
2020-01-07 10:51:38 -03:00
Guo, Yejun 04e6f8a143 vf_dnn_processing: remove parameter 'fmt'
do not request AVFrame's format in vf_ddn_processing with 'fmt',
but to add another filter for the format.

command examples:
./ffmpeg -i input.jpg -vf format=bgr24,dnn_processing=model=halve_first_channel.model:input=dnn_in:output=dnn_out:dnn_backend=native -y out.native.png
./ffmpeg -i input.jpg -vf format=rgb24,dnn_processing=model=halve_first_channel.model:input=dnn_in:output=dnn_out:dnn_backend=native -y out.native.png

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
2020-01-07 10:35:59 -03:00
James Zern 742221d339 avcodec/libvpxenc,cosmetics: prefer sizeof(var)
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: James Zern <jzern@google.com>
2020-01-06 22:35:38 -08:00
Michael Niedermayer 06f6857b54 avcodec/vmdaudio: Check block_align more
Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
Fixes: 19788/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VMDAUDIO_fuzzer-5743379690553344

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-01-07 02:49:54 +01:00
Limin Wang d31a1266a7 avfilter/vf_showinfo: Fix erroneous results for mean and stdev with pixel bits >8
Have tested with be and le pixel format on be and le system for >8bit.
System:
lmwang@ubuntu:~/ffmpeg.git.mips$ grep HAVE_BIGENDIAN config.h
ffmpeg.git git:(showinfo) ✗ grep HAVE_BIGENDIAN config.h

Test result:
1, yuv420p
./ffmpeg -f lavfi  -i color=black:duration=1:r=1:size=1280x720,format=yuv420p,showinfo
Master:
mean:[16 128 128] stdev:[0.0 0.0 0.0]
After applied the patch:
 mean:[16 128 128] stdev:[0.0 0.0 0.0]

2, yuv420p10le
./ffmpeg -f lavfi  -i color=black:duration=1:r=1:size=1280x720,format=yuv420p10le,showinfo
Master:
mean:[32 1 1] stdev:[32.0 1.0 1.0]
After applied the patch:
mean:[64 512 512] stdev:[0.0 0.0 0.0]

3, yuv420p10be
./ffmpeg -f lavfi  -i color=black:duration=1:r=1:size=1280x720,format=yuv420p10be,showinfo
Master:
mean:[32 1 1] stdev:[32.0 1.0 1.0]
After applied the patch:
mean:[64 512 512] stdev:[0.0 0.0 0.0]

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-07 02:49:44 +01:00
Andreas Rheinhardt 220846f74f avformat/aviobuf: Honor avio_open[2] documentation
The documentation of both avio_open() as well as avio_open2() states
that on failure, the pointer to an AVIOContext given to this function
(via a pointer to a pointer to an AVIOContext) will be set to NULL. Yet
it didn't happen upon failure of ffurl_open_whitelist() or when allocating
the internal buffer failed. This commit changes this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-07 02:44:05 +01:00
Limin Wang 10f0332fd5 avcodec/decode: replace avctx->internal with avci for better readability
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-07 02:44:05 +01:00
Mark Thompson f907eea863 vf_tonemap_vaapi: Fix memory leak in error case
Fixes CID 1457236.
2020-01-07 00:04:50 +00:00
Xinpeng Sun f0e7ac5986 configure: Change the configure check for tonemap_vaapi
"VAProcFilterParameterBufferHDRToneMapping" was defined in libva 2.4.1, which will lead to
build failure for the filter tonemap_vaapi for libva 2.3.0 with current check. This patch
is to fix this build error.

Signed-off-by: Xinpeng Sun <xinpeng.sun@intel.com>
2020-01-07 00:04:50 +00:00
Carl Eugen Hoyos a665a2ecda lavc/vdpau_vp9: Do not mix declarations and code.
Fixes the following gcc warning:
libavcodec/vdpau_vp9.c:45:5: warning: ISO C90 forbids mixed declarations and code
2020-01-06 22:57:54 +01:00
Carl Eugen Hoyos 96fab29e96 Silence "string-plus-int" warning shown by clang.
libswscale/utils.c:89:42: warning: adding 'unsigned long' to a string does not append to the string [-Wstring-plus-int]
2020-01-06 22:38:56 +01:00
Paul B Mahol e21ba176c9 avfilter/af_sidechaincompress: add support for commands 2020-01-06 19:40:07 +01:00
Paul B Mahol 51927d33b7 doc/filters: mention commands for crystalizer filter 2020-01-06 19:08:56 +01:00
Gyan Doshi d0b0e8ecc8 doc/filters: indicate commands for scale2ref 2020-01-06 21:10:09 +05:30
Gyan Doshi 71ac3b6edc doc/filters: indicate commands for zscale 2020-01-06 21:09:00 +05:30
Paul B Mahol 27ec72db06 avfilter/af_dynaudnorm: add support for commands 2020-01-06 14:23:53 +01:00
Limin Wang 1e3f4b5f19 doc/filters: add entry for mean and stdev in showinfo
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Gyan Doshi <ffmpeg@gyani.pro>
2020-01-06 11:38:16 +05:30
Derek Buitenhuis a2d3511154 lavc/ffv1: Properly check that the 4th and 5th quant tables are zeroes
Currently, the decoder checks the 128th value of the 4th quant table during
while deriving the context on each sample, in order to speed itself up. This
is due to relying on the behavior of FFmpeg's FFV1 encoder, in which if that
value is zero, the entire 4th and 5th quant tables are assumed to be entirely
zero.

This does not match the FFV1 spec, which has no such restriction, and after
some discussion, it was decided to fix FFmpeg to abide by the spec, rather
than change the spec.

We will now check whether the 4th and 5th quant tables are zero properly,
by checking the 128th valye of both tables (which means they are zero due
to the way they're coded in the bitstream).

For further context, the FFV1 issue in question is located at:

    https://github.com/FFmpeg/FFV1/issues/169

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2020-01-06 00:06:03 +00:00
Ulrich Spörlein 60d599e217 libavformat: fix spelling in ID3v1 genres and extend the list of Winamp extensions.
Sources include various lists on the Internet, as well as the current
Wikipedia page at
https://en.wikipedia.org/w/index.php?title=List_of_ID3v1_Genres&oldid=896774343
but most importantly the list as used by taglib at
3e60e339a4 (diff-f86455366624350770f41b4940925dde)

Further patches to harmonize the spelling have been sent to taglib and
libid3tag. See also https://github.com/taglib/taglib/pull/942/

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-05 20:31:42 +01:00
Michael Niedermayer b0a718923b avcodec/pgssubdec: Free subtitle on error
Fixes: Assertion failure
Fixes: 19753/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PGSSUB_fuzzer-5688461843759104

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-01-05 20:31:42 +01:00
Gyan Doshi 8aa3c09c1b doc/volume: correct placement of replaygain_noclip
In the merge commit 878f8b0d26, entry for replaygain_noclip
was placed in commands, which it is not, instead of among
the options.
2020-01-05 21:46:08 +05:30
Paul B Mahol e26d66daaa avfilter/af_dynaudnorm: use already available pointer
Instead of dereferencing same thing again.
2020-01-05 10:22:57 +01:00
Paul B Mahol 1187dbb7e9 avfilter/af_dynaudnorm: move channels variable setup first 2020-01-05 10:20:27 +01:00
Gyan Doshi 5d82c078ea ffmpeg: don't force source-tracked keyframes for duplicates
Prevents a run of consecutive duplicate frames from all being encoded
as keyframes, when force_key_frames is set to source.
2020-01-05 12:01:46 +05:30
Gyan Doshi fa3ad7bbc6 ffmpeg: remove premature rescaling of forced_keyframe times
The user-set forced KF times are parsed *after* this deleted
loop and rescaled right after parsing.
2020-01-05 10:55:36 +05:30
Gyan Doshi fa677750de doc/ffmpeg: document value source for -force_key_frames
Also clarify behaviour in case of specified timestamps
2020-01-05 10:53:46 +05:30
Sebastian Pop c3a17ffff6 swscale/aarch64: use multiply accumulate and shift-right narrow
This patch rewrites the innermost loop of ff_yuv2planeX_8_neon to avoid zips and
horizontal adds by using fused multiply adds. The patch also uses ld1r to load
one element and replicate it across all lanes of the vector. The patch also
improves the clipping code by removing the shift right instructions and
performing the shift with the shift-right narrow instructions.

I see 8% difference on an m6g instance with neoverse-n1 CPUs:
$ ffmpeg -nostats -f lavfi -i testsrc2=4k:d=2 -vf bench=start,scale=1024x1024,bench=stop -f null -
before: t:0.014015 avg:0.014096 max:0.015018 min:0.013971
after:  t:0.012985 avg:0.013013 max:0.013996 min:0.012818

Tested with `make check` on aarch64-linux.

Signed-off-by: Sebastian Pop <spop@amazon.com>
Reviewed-by: Clément Bœsch <u@pkh.me>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-04 20:59:31 +01:00
Limin Wang ebbc976ae6 avcodec/bsf: replace ctx->internal-> with bsfi-> for better readability
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-04 20:59:31 +01:00
Carl Eugen Hoyos f7c945abc0 doc: Fix a typo. 2020-01-04 20:58:10 +01:00
Jun Zhao 304eaa63a9 lavfi/buffersrc: Remove redundant free after ff_filter_frame() failure
ff_filter_frame() always frees the frame in case of error, so we don't
need to free the frame after ff_filter_frame() fails.

Fix CID 1457230.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-01-04 19:37:39 +01:00
Paul B Mahol 389865352d avfilter/af_dynaudnorm: fix another clipping with custom peak value
This always happened at start with alternative boundary mode disabled.
The clipping only occurred if starting samples where high enough.
2020-01-04 19:34:50 +01:00
Paul B Mahol c8253cb332 avfilter/af_dynaudnorm: implement threshold option 2020-01-04 18:17:32 +01:00
Paul B Mahol 6a1305e8b7 avfilter/af_dynaudnorm: do not clip audio
Clipping can happen when smoothed gain is higher than maximum
allowed gain factor for current frame and peak value option is
set to enough low value.
2020-01-04 10:27:46 +01:00
Jun Zhao 3c8da7b982 libavutil/opt: fix memory leak after av_dict_parse_string fail
In case of failure, all the successfully set entries are stored in
*pm. We need to manually free the created dictionary to avoid
memory leak.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-01-04 09:05:23 +08:00
Jun Zhao c8e72a6494 lavfi/coreimage: fix memory leak after av_dict_parse_string fail
In case of failure, all the successfully set entries are stored in
*pm. We need to manually free the created dictionary to avoid
memory leak.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-01-04 09:05:09 +08:00
Jun Zhao cf9c9a9db9 lavc/libkvazaar: fix memory leak after av_dict_parse_string fail
In case of failure, all the successfully set entries are stored in
*pm. We need to manually free the created dictionary to avoid
memory leak.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-01-04 09:04:58 +08:00
Jun Zhao 0099f71502 lavc/bsf: fix memory leak after av_dict_parse_string fail
In case of failure, all the successfully set entries are stored in
*pm. We need to manually free the created dictionary to avoid
memory leak.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-01-04 09:03:30 +08:00
Marton Balint 944203270d avdevice/decklink: deprecate the -list_devices option
The user should use ffmpeg -sources decklink or ffmpeg -sinks decklink instead.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-03 18:13:22 +01:00
Marton Balint 2b7097ef27 avdevice/decklink_dec: remove -bm_v210 option
Deprecated since Sep 28, 2017.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-03 18:13:22 +01:00
Marton Balint 78a233e6e9 avdevice/decklink_dec: remove the @mode syntax
Deprecated since March 28, 2017.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-03 18:13:22 +01:00
Marton Balint d111a41f9d avformat/img2enc: fix writing multiple streams in write_muxed_file
Maybe we should just reject multiple streams for the image2 muxer instead?

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-03 11:23:55 +01:00
Marton Balint beb7f93b23 avformat/img2enc: minor simplification
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-03 11:23:55 +01:00
Marton Balint 57df8839e1 avformat/img2enc: cleanup IO contexts on error
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-03 11:23:55 +01:00
Marton Balint 43d5ddb4b5 avformat/img2enc: reindent after last commit
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-03 11:23:55 +01:00
Marton Balint 04e36fc4e1 avformat/img2enc: factorize piped write_packet
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-03 11:23:55 +01:00
Marton Balint b693b06b22 avformat/img2enc: factorize writing fully muxed file
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-03 11:23:55 +01:00
Marton Balint bc17b831dd doc/muxers: fix order of options and examples for image2 muxer
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-03 11:23:55 +01:00
Paul B Mahol 81172b5e3a avfilter/af_dynaudnorm: fix previous commit
We still need to analyze frame for amplification at EOF.
2020-01-02 17:24:01 +01:00
Paul B Mahol ed02563ce0 avfilter/af_dynaudnorm: do not enqueue flush buffers 2020-01-02 16:28:38 +01:00
Zhong Li 12c4d00c10 avcodec/mpeg12dec: always submit the first field to hwaccel
Though this patch to fix ticket #6668, I belive it
is unnecessary to set SLICE_FLAG_ALLOW_FIELD flag to other
hwaccels(dxva, vdpau, etc). Please also refer the orginal comment
of 9cb150c9ab

Should also fix ticket #8442.

Signed-off-by: Zhong Li <zhong.li@intel.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2020-01-02 13:29:46 +01:00
Timo Rothenpieler d4996a600c avcodec/nvdec_mpeg12: set field flags 2020-01-02 13:15:27 +01:00
Marton Balint e47a954631 avcodec/librav1e: use AV_OPT_TYPE_DICT for rav1e-params
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-01 21:22:11 +01:00
Marton Balint a613d042e7 avcodec/libxavs2: use AV_OPT_TYPE_DICT for xavs2-params
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-01 21:22:11 +01:00
Marton Balint 91f64ea4c5 avcodec/libx265: use AV_OPT_TYPE_DICT for x265-params
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-01 21:22:09 +01:00
Marton Balint dfea6d2e50 avcodec/libx264: use AV_OPT_TYPE_DICT for x264-params
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-01 20:41:34 +01:00
Marton Balint 9ac1066dc6 avcodec/libvpxenc: use AV_OPT_TYPE_DICT for ts-parameters
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-01 20:41:34 +01:00
Marton Balint 710e9f3f18 avformat/tee: use AV_OPT_TYPE_DICT for fifo_options
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-01 20:41:34 +01:00
Marton Balint 7c3125133f avformat/segment: use AV_OPT_TYPE_DICT for segment_format_options
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-01 20:41:34 +01:00
Marton Balint 5d35a6e8e2 avformat/hlsenc: use AV_OPT_TYPE_DICT for hls_ts_options
Simplifies code and avoids memory leaks.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-01 20:41:34 +01:00
Marton Balint f20bdbff6d avformat/fifo: use AV_OPT_TYPE_DICT for format_opts
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-01 20:41:34 +01:00
Marton Balint 59172164f3 avformat/dashenc: use AV_OPT_TYPE_DICT for format_options
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-01 20:41:34 +01:00
James Almer 3670a10c2d avcodec/libx265: export encoded frame stats
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 66b6005301894823052b437a950003ffbe3ba6de)
2020-01-01 13:50:39 -03:00
James Almer 278a91f8fe avcodec/libx265: add a qp option and apply the relevant global AVCodecContext settings to the encoder context
Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-01 13:48:02 -03:00
James Almer 3c22436ddf avcodec/libx265: apply some global AVCodecContext settings to the encoder context
There's no reason to ignore them if set.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-01 13:25:18 -03:00
Andreas Rheinhardt 40d9cbdc22 avformat/matroskadec: Use AV_DICT_DONT_STRDUP_VAL to save av_strdup
This will likely also fix CID 1452562, a false positive resulting from
Coverity thinking that av_dict_set() automatically frees its key and
value parameters (even without the AV_DICT_DONT_STRDUP_* flags).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-01 16:38:28 +01:00
Andreas Rheinhardt 34e3810b04 avformat/matroskaenc: Check return value of ff_isom_write_hvcc()
The Matroska muxer currently does not check the return value of
ff_isom_write_hvcc(), the function used to write mp4-style
HEVC-extradata as Matroska also uses it. This was intentionally done in
7a5356c72 to allow remuxing from mpeg-ts.

But if ff_isom_write_hvcc() fails, it has not output anything and the
file ends up without CodecPrivate and, if the input was Annex B, with
Annex B data, which is against the spec. So check the return value
again.

The underlying issue of not having extradata seems to have been fixed by
the introduction of the extract_extradata bitstream filter.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: "mypopy@gmail.com" <mypopy@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-01 16:38:28 +01:00
Andreas Rheinhardt 2968da7d9e avformat/matroskaenc: Adapt documentation of put_ebml_num
to its actual behaviour: That it uses the least amount of bytes unless
overridden.

The current documentation leaves it undefined how many bytes will be used
when no number to use has been given explicitly. But several estimates
(used to write EBML Master elements with a small length field) require
this number to be the least amount of bytes to work. Therefore change
the documentation; and remove a comment about writing length fields
indicating "unkown length". It has been outdated since 0580a122.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-01 16:38:28 +01:00
Andreas Rheinhardt 6d354aeb29 avformat/mpeg: Remove secondary packet for reading VobSub
When vobsub_read_packet() reads a packet, it uses a dedicated AVPacket
to get the subtitle timing and position from an FFDemuxSubtitlesQueue
(which has been filled with this data during reading the idx file in
vobsub_read_header); afterwards the actual subtitle data is read into
the packet destined for output and the timing and position are copied
to this packet. Afterwards, the local packet is unreferenced.

This can be simplified: Simply use the output packet to get the timing
and position from the FFDemuxSubtitlesQueue. The packet's size will be
zero afterwards, so that it can be directly used to read the actual
subtitle data. This makes copying the packet fields as well as
unreferencing the local packet unecessary and also removes an instance
of usage of sizeof(AVPacket) in libavformat.

The only difference is that the returned packet will already be flagged
as a keyframe. This currently only happens in compute_pkt_fields().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-01 16:38:28 +01:00
Matt Oliver 1fd8929450 compat/avisynth: Fix unicode compilation.
Reviewed-by: Stephen Hutchinson <qyot27@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-01 16:38:28 +01:00
Paul B Mahol d4d6280ab2 avfilter/af_dynaudnorm: do not hang forever if only EOF is received 2020-01-01 13:44:22 +01:00
Paul B Mahol 7bb09e57e0 avfilter/af_dynaudnorm: do not error out if even filter size was given
Instead issue a warning and make filter size odd number.
2020-01-01 13:44:22 +01:00
Jun Zhao d7e2a2bb35 lavf/libsrt: add version guard for srt encryption control
add version guard for srt encryption control. and use
SRTO_STRICTENC(53) for compatibility.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-01-01 19:35:53 +08:00
Gyan Doshi 7b58702cbd configure: bump year 2020-01-01 12:14:30 +05:30
Michael Niedermayer a15d904ad7 avcodec: Replace get_bits_long() by get_bits() where possible
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-31 18:43:50 +01:00
Michael Niedermayer 9a8471e3f0 avformat/oggparsetheora: Replace get_bits_long() by get_bits() where possible
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-31 18:43:50 +01:00
Michael Niedermayer e900621074 avformat/oggparseflac: Replace skip_bits_long() by skip_bits() where possible
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-31 18:43:50 +01:00
Michael Niedermayer f72fa1ad67 avcodec: Replace skip_bits_long() by skip_bits() where possible
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-31 18:43:50 +01:00
Michael Niedermayer 79d5d79f38 avcodec: Replace show_bits_long() by show_bits() where possible
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-31 18:43:50 +01:00
Michael Niedermayer fa47f6412d avcodec/ffwavesynth: Fix undefined overflow in wavesynth_synth_sample()
Fixes: signed integer overflow: 2147464192 + 21176 cannot be represented in type 'int'
Fixes: 19042/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5719828090585088

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-31 18:43:50 +01:00
Michael Niedermayer 89fd76db71 avcodec/cook: Use 3 stage VLC decoding for channel_coupling
Fixes: shift exponent -1 is negative
Fixes: out of array read
Fixes: 19028/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_COOK_fuzzer-5759766471376896
Fixes: 19037/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_COOK_fuzzer-5734106625474560

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-31 18:43:50 +01:00
Michael Niedermayer 4cfc563c57 avcodec/options_table: err_detect compliant and aggressive should also enable the weaker checks
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-31 18:43:50 +01:00
Michael Niedermayer 7d475c53c8 avformat/options_table: err_detect compliant and aggressive should also enable the weaker checks
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-31 18:43:50 +01:00
Michael Niedermayer 53efab44a9 avcodec/wmalosslessdec: Fixes undefined overflow in dequantization in decode_subframe()
Fixes: signed integer overflow: 47875596 * 45 cannot be represented in type 'int'
Fixes: 19082/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMALOSSLESS_fuzzer-5687766512041984

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-31 18:43:50 +01:00
Michael Niedermayer aea6755611 avcodec/sonic: Check e in get_symbol()
Fixes: signed integer overflow: 1721520852 + 1721520852 cannot be represented in type 'int'
Fixes: 18346/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SONIC_fuzzer-5709623893426176
Fixes: 18753/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SONIC_fuzzer-5663299131932672

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-31 18:43:50 +01:00
Michael Niedermayer 4dc93ae3d7 avcodec/twinvqdec: Correct overflow in block align check
Fixes: signed integer overflow: 538976288 * 8 cannot be represented in type 'int'
Fixes: 19126/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TWINVQ_fuzzer-5687464110325760

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-31 18:43:50 +01:00
Michael Niedermayer 77ba9e3252 avcodec/h264_ps: Provide more details with "Truncated VUI" Message
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-31 18:43:50 +01:00
Zhao Zhili 609285af51 fftools/ffmpeg_filter: remove sws_param option from buffersrc
The option is deprecated and ignored by buffersrc.
2019-12-31 14:24:34 +01:00
Michael Niedermayer c1411a1132 tools/target_dec_fuzzer: Stop negative block_align and sampling rate
These are checked for early in avcodec_open2() and do not really test the decoder
but instead waste resources which could be better spend fuzzing the actual decoder

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-31 12:37:47 +01:00
Zhao Zhili f78dc66089 avcodec/utils: remove access of AV_SAMPLE_FMT_NB
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-31 12:37:47 +01:00
Zhao Zhili 1e3e547a5b swscale/utils: remove access of AV_PIX_FMT_NB
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-31 12:37:47 +01:00
Marton Balint f1353ce222 avdevice/xcbgrab: capture the full desktop if video_size is not specified
Signed-off-by: Marton Balint <cus@passwd.hu>
2019-12-30 23:32:27 +01:00
Marton Balint f6845269c6 avdevice/xcbgrab: fix packet timestamps
Since 648b8cca6c and
c991e9cd91 timestamps were not set properly.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-12-30 21:09:24 +01:00
Paul B Mahol f651b18c19 avfilter/vf_histogram: add envelope to thistogram filter 2019-12-30 17:21:35 +01:00
Zhao Zhili b2491566a6 avfilter/buffersrc: deprecate sws_param option 2019-12-30 10:41:07 +01:00
Paul B Mahol e20c6d95b2 avfilter/af_crystalizer: add support for commands 2019-12-29 15:33:55 +01:00
Paul B Mahol 22d3552f44 avfilter/af_crystalizer: add timeline support 2019-12-29 15:33:55 +01:00
Paul B Mahol 26eba8ca61 avfilter/vf_waveform: add support for 12bit yuva formats 2019-12-29 15:33:55 +01:00
Paul B Mahol 11f6657e92 avfilter/vf_vectorscope: add support for 12bit yuva formats 2019-12-29 15:33:55 +01:00
Paul B Mahol 612b5791b8 avfilter/vf_histogram: add support for 12bit yuva formats 2019-12-29 15:33:55 +01:00
Paul B Mahol d3d6f5a76e avfilter/vf_histogram: reindent after previous commit 2019-12-29 15:33:55 +01:00
Paul B Mahol cc43c2f29a avfilter: add thistogram video filter 2019-12-29 15:33:55 +01:00
Zhong Li 755ad01dd1 lavc/qsv: remove the unused funtion ff_qsv_profile_to_mfx()
Signed-off-by: Zhong Li <zhongli_dev@126.com>
2019-12-29 20:23:07 +08:00
Zhong Li 779951f7b2 lavc/qsvdec: disable gpu copy when not supported
Signed-off-by: Zhong Li <zhongli_dev@126.com>
2019-12-29 20:23:07 +08:00
Zhong Li 9fff5c40a7 lavc/qsvdec: fix the error retrun code in ff_qsv_get_continuous_buffer()
Signed-off-by: Zhong Li <zhongli_dev@126.com>
2019-12-29 20:23:07 +08:00
Andreas Rheinhardt 2ff687c17f avformat/matroskadec: Fix lzo decompression
When a Matroska Block is only stored in compressed form, the size of
the uncompressed block is not explicitly coded and therefore not known
before decompressing it. Therefore the demuxer uses a guess for the
uncompressed size: The first guess is three times the compressed size
and if this is not enough, it is repeatedly incremented by a factor of
three. But when this happens with lzo, the decompression is neither
resumed nor started again. Instead when av_lzo1x_decode indicates that x
bytes of input data could not be decoded, because the output buffer is
already full, the first (not the last) x bytes of the input buffer are
resent for decoding in the next try; they overwrite already decoded
data.

This commit fixes this by instead restarting the decompression anew,
just with a bigger buffer.

This seems to be a regression since 935ec5a1.

A FATE-test for this has been added.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-28 22:40:13 -03:00
Andreas Rheinhardt 6c735b96ee fate/matroska: Add test for ProRes and bz2 compression
This test tests that demuxing ProRes that is muxed like it should be in
Matroska (i.e. with the first header ("icpf") atom stripped away) works;
it also tests bz2 decompression as well as the handling of
unknown-length clusters.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-28 22:40:13 -03:00
James Almer eb17a7906b avfilter/vf_vectorscope: use av_clip_uint8()
Fixes fate-source

Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-28 22:38:58 -03:00
Paul B Mahol 6399eed48a avfilter/vf_waveform: implement tint options 2019-12-28 21:51:40 +01:00
Paul B Mahol b3216f13ce avfilter/vf_vectorscope: improve tint output for gbrp formats 2019-12-28 21:51:40 +01:00
Carl Eugen Hoyos 2e700ec3a7 fftools/ffmpeg_opt: Add a missing closing brackets.
Fixes ticket #8447.
2019-12-28 20:11:01 +01:00
Paul B Mahol 2736dc0564 avfilter/vf_vectorscope: rename gray mode to tint mode 2019-12-28 14:01:15 +01:00
Paul B Mahol 29b765d657 avfilter/vf_vectorscope: add invert graticule 2019-12-28 12:32:43 +01:00
Paul B Mahol 1669c970b1 avfilter/vf_vectorscope: use enum for graticule items 2019-12-28 12:32:43 +01:00
Michael Niedermayer 5c0d1f7896 avfilter/vf_geq: Add support for reading sample sums and means of rectangles
This allows integrating box blur style filters in geq.

Without this computing the mean of an area in geq would have been excessivly slow

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-28 11:20:48 +01:00
Michael Niedermayer 47fd73ace2 avfilter/vf_geq: Add NB_PLANES
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-28 11:20:48 +01:00
Michael Niedermayer 45259a0ee4 avutil/eval: Add av_expr_count_func() similar to av_expr_count_vars()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-28 11:20:48 +01:00
Michael Niedermayer 26f040bcb4 avcodec/vc1dec: Fix "return -1" cases
Reviewed-by: "mypopy@gmail.com" <mypopy@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-28 11:20:48 +01:00
Michael Niedermayer 3ee9240be3 avcodec/vc1dec: Free sprite_output_frame on error
Fixes: memleaks
Fixes: 19471/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-5688035714269184

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-28 11:20:48 +01:00
Michael Niedermayer d5e7f01090 avfilter/vf_geq: Relicense to LGPL
All authors who have code in this under GPL agreed.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-28 11:20:48 +01:00
Michael Niedermayer 18ff210efb avcodec/atrac9dec: Clamp band_ext_data to max that can be read if skipped.
Fixes: out of array read
Fixes: 19327/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ATRAC9_fuzzer-5679823087468544

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>
2019-12-28 11:20:48 +01:00
Michael Niedermayer 1f20969457 avcodec/agm: Include block size in the MV check for flags == 3
Fixes: out of array read
Fixes: 19331/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AGM_fuzzer-5644115983466496

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-28 11:20:48 +01:00
Michael Niedermayer bf5c850b79 avcodec/wmadec: Keep track of exponent initialization per channel
Fixes: division by 0
Fixes: 19123/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAV2_fuzzer-5655493121146880

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-28 11:20:48 +01:00
Michael Niedermayer f1b97f62f8 avcodec/iff: Check that video_size is large enough for the read parameters
video is allocated before parameters like bpp are read.

Fixes: out of array access
Fixes: 19084/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5718556033679360
Fixes: 19465/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5759908398235648

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-28 11:20:48 +01:00
Andriy Gelman fc3760a66d avcodec/v4l2_m2m_enc: Check encoder pix_fmt matches pix_fmt on device
Fixes #8079

During initialization of a v4l2m2m device, the configured pix_fmt can be
different to the pix_fmt of the encoder (i.e. avctx->pix_fmt).

For example on the Odroid XU4:
./ffmpeg -f lavfi -i yuvtestsrc -codec:v h264_v4l2m2m out.h264

will configure the v4l2 encoder to pix_fmt nv21, whereas the input
frames will be yuv444p.

This commit checks that the configured v4l2 pix_fmt on device is the
same as avctx->pix_fmt. If they are different the initialization fails
and an error is returned. Tested on RPI4 and Odroid XU4.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2019-12-27 23:42:57 +00:00
Marton Balint a619787a9c avutil/tests/opt: add av_opt_get/av_opt_set tests
Signed-off-by: Marton Balint <cus@passwd.hu>
2019-12-27 21:52:21 +01:00
Marton Balint 672b925e8a avutil/tests/opt: add tests for AV_OPT_TYPE_DICT
Signed-off-by: Marton Balint <cus@passwd.hu>
2019-12-27 21:52:21 +01:00
Marton Balint 5edacc4609 avutil/opt: add full support for AV_OPT_TYPE_DICT
Now it is possible to set them from a string, to serialize them and to use a
default value.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-12-27 21:52:21 +01:00
Paul B Mahol 6c883e214a avfilter/vf_vibrance: add support for commands 2019-12-27 21:31:04 +01:00
Paul B Mahol 50cfe9662d avfilter/vf_il: add support for commands 2019-12-27 21:17:00 +01:00
Paul B Mahol 5fb37598ad avfilter/af_stereowiden: add support for commands 2019-12-27 21:03:29 +01:00
Paul B Mahol 954637805d avfilter/af_extrastereo: add support for commands 2019-12-27 20:57:06 +01:00
Paul B Mahol fad62eebee avfilter/vf_neighbor: add support for commands 2019-12-27 20:21:20 +01:00
Marvin Scholz f37bfd3f62 avformat/dashdec: propagate icy to child AVIOContexts
When the user decides they do not want to to send the Icy-MetaData
header, this should be respected for all requests, not just the first
one.

Fix #5578

Reviewed-by: Liu Steven <lq@chinaffmpeg.org>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-27 14:58:51 -03:00
Marvin Scholz c3bb6efef2 avformat/hls: propagate icy to child AVIOContexts
When the user decides they do not want to to send the Icy-MetaData
header, this should be respected for all requests, not just the first
one.

Fix #5578

Reviewed-by: Liu Steven <lq@chinaffmpeg.org>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-27 14:57:25 -03:00
Limin Wang 93671d6755 avcodec/mvha: fix warning: variable 'size' set but not used
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-27 13:13:39 -03:00
Andreas Rheinhardt 39561bbe77 avformat/microdvdenc: Use avio_w8 to write a char
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-27 12:38:08 +01:00
Andreas Rheinhardt 9bde6c6be0 avformat/microdvd: Use \n instead of \0 to end file header
Up until now, the microdvd demuxer uses av_strdup() to allocate the
extradata from a string; its length is set to strlen() + 1, i.e.
including the \0 at the end. Upon remuxing, the muxer would simply copy
the extradata at the beginning, including the \0.

This commit changes this by not adding the \0 to the size of the
extradata; the muxer now delimits extradata by inserting a \n. This
required to change the subtitles-microdvd-remux FATE-test.

Furthermore, the extradata is now allocated with zeroed padding.

The microdvd decoder is not affected by this, as it didn't use the size
of the extradata at all, but treated it as a C-string.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-27 12:38:08 +01:00
Andreas Rheinhardt b0d0d7e4d0 avformat/flvenc: Fix leak of oversized packets
Might happen for annex B H.264.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-26 22:48:44 +01:00
Andreas Rheinhardt 28d02524a0 avformat/flvenc: Forward errors from allocating keyframe index
While the function adding a new element to the keyframe index checked
the allocation, the caller didn't check the return value. This has been
changed. To do so, the return value has been changed to an ordinary ret
instead of pb->error. This doesn't pose a problem, as write_packet() in
mux.c already checks for write errors (since 9ad1e0c1).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-26 22:48:44 +01:00
Andreas Rheinhardt a94e6b50c6 avformat/wavenc: Add deinit function
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-26 22:48:44 +01:00
Andreas Rheinhardt 827bdc8418 avformat/spdifenc: Replace write_trailer by deinit
The write_trailer function doesn't write anything anyway. It only frees
memory.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-26 22:22:33 +01:00
Limin Wang ef91e3955a avcodec/vc1dec: remove the unneeded ()
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-26 22:22:33 +01:00
Limin Wang f8f86f8356 avcodec/ass: remove the unneeded ()
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-26 22:22:33 +01:00
Paul B Mahol b5f0cea16c avfilter/vf_histogram: use the name 's' for the pointer to the private context
This is consistent across filters.
2019-12-26 20:45:20 +01:00
Michael Niedermayer 4fa2d5a692 avcodec/cbs_vp9: Check data_size
Fixes: out of array access
Fixes: 19542/clusterfuzz-testcase-minimized-ffmpeg_BSF_TRACE_HEADERS_fuzzer-5659498341728256

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-26 16:06:25 +01:00
Andreas Rheinhardt 398a5f5d8f avfilter/buffersrc: Remove unused variables
Unused since f09ae730.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-26 16:06:25 +01:00
Marton Balint c991e9cd91 avdevice/xcbgrab: use a buffer pool for shared memory segments
Also by wrapping the SHM buffer in an AVBufferRef we eliminate yet another
possible memcpy improving performance.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-12-26 00:47:24 +01:00
Marton Balint 16685114d5 avutil/buffer: add av_buffer_pool_buffer_get_opaque
In order to access the original opaque parameter of a buffer in the buffer
pool. (The buffer pool implementation overrides the normal opaque parameter but
also saves it so it is accessible).

v2: add assertion check before dereferencing the BufferPoolEntry.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-12-26 00:47:24 +01:00
Paul B Mahol e3dca0744d avformat/dhav: improve seeking 2019-12-25 22:10:47 +01:00
Michael Niedermayer d6553e2e60 avcodec/cbs_vp9: Check index_size
Fixes: out of array read
Fixes: 19300/clusterfuzz-testcase-minimized-ffmpeg_BSF_VP9_METADATA_fuzzer-5653911730126848

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-25 18:00:40 +01:00
Limin Wang 3dd6c4478b avfilter/vf_yadif: cosmetics in the pix_fmts[] array
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-25 18:00:40 +01:00
Gyan Doshi 287620f59c avfilter/drawtext: log why input pad failed to be configured 2019-12-24 11:04:52 +05:30
Paul B Mahol a13af9aee1 avformat/sccdec: only change duration for last subtitle 2019-12-23 22:47:27 +01:00
Paul B Mahol 13bffa7969 avformat/sccdec: fix sub->pos values 2019-12-23 22:39:46 +01:00
Paul B Mahol 9da7536ce2 avformat/sccdec: fix timestamp of last subtitle
Fixes -c:s copy case.
2019-12-23 22:16:25 +01:00
Paul B Mahol 547b0c61af avfilter/vf_fade: reindent after previous commit 2019-12-23 20:24:36 +01:00
Paul B Mahol 6c9a9dd25a avfilter/vf_fade: add support for gbrp/gbrap formats 2019-12-23 20:16:27 +01:00
Zhong Li 5dc527f9ca lavc/midivid: check return value of init_get_bits8()
Fix CID 1456088

Signed-off-by: Zhong Li <zhongli_dev@126.com>
2019-12-23 20:14:42 +01:00
Paul B Mahol 94ad5d0128 avfilter/vf_readeia608: factor some constants out 2019-12-23 20:09:20 +01:00
Paul B Mahol 94682555c6 avfilter/vf_readeia608: check if gaps between clock bits are big enough
Should help finding less false positives.
2019-12-23 19:56:05 +01:00
Paul B Mahol 16968b619d avfilter/vf_readeia608: use special struct to hold line items 2019-12-23 18:02:38 +01:00
Zhao Zhili 0115dbd043 avfilter/avfilter: update documentation of avfilter_graph_create_filter 2019-12-23 17:02:55 +01:00
Zhao Zhili 61097535cd avfilter/buffersink: deprecate AVBufferSinkParams and AVABufferSinkParams 2019-12-23 17:02:55 +01:00
Zhao Zhili 07ffdedf78 avfilter/buffersink: replace init_opaque by init
The argument 'opaque' is always NULL since 0acf7e2 (2013),
and avfilter_init_filter() was removed in 52067b3c0e (2016).
2019-12-23 17:02:55 +01:00
Zhao Zhili 807e90d232 avfilter/buffersink: remove unused macros 2019-12-23 17:02:55 +01:00
Zhao Zhili bf08264daa avfilter/buffersrc: remove redundant flag
!(c->pix_fmt != AV_PIX_FMT_NONE || c->got_format_from_params)

equals

(c->pix_fmt == AV_PIX_FMT_NONE) && !c->got_format_from_params

1. When (c->pix_fmt == AV_PIX_FMT_NONE) is true, got_format_from_params is
always false, the flag doesn't contribute to the result.

2. When the first part is false, the second part doesn't matter, the flag
doesn't contribute to the result.

The result only depends on c->pix_fmt.
2019-12-23 17:02:55 +01:00
Gyan Doshi f0b3b55002 avformat/mpegtsenc: warn users if codec isn't supported
The MPEG-TS muxer will mux streams with unsupported codec id
as a private data stream; this usually makes the stream
not recognizable by ffmpeg and likely other tools.
2019-12-23 21:06:37 +05:30
James Almer c75f246a3c avcodec/noise_bsf: remove superfluous fail label
Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-23 11:49:44 -03:00
Steven Liu ec2a8e3390 Changelog: Fix typo of comments
Signed-off-by: Steven Liu <lq@onvideo.cn>
Reviewed-by: Lou Logan <lou@lrcd.com>
2019-12-23 22:13:48 +08:00
Nicolas George f09ae7309d lavfi/buffersrc: push frame directly.
This allows to remove the queued frame entirely.
2019-12-23 13:03:38 +01:00
Nicolas George 02daafb45c lavfi: remove AVFilterPad.poll_frame().
This design is no longer used and was replaced a long time ago.
2019-12-23 13:03:38 +01:00
Nicolas George f3a6ef69bf lavfi/buffersrc: remove poll_frame. 2019-12-23 13:03:38 +01:00
Nicolas George 65e6850c56 lavfi: remove ff_poll_frame().
It is never used.
2019-12-23 13:03:38 +01:00
Nicolas George 9ea7e68907 lavfi/buffersrc: remove fifo.
The frame is immediately pushed, the fifo has never more than one.
2019-12-23 13:03:38 +01:00
Limin Wang 03eb96f9b7 avfilter/vf_readeia608: fix check for failed av_calloc
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2019-12-23 10:26:36 +01:00
Andreas Rheinhardt 5b42d33571 avformat/hls: Use av_packet_move_ref() for packet ownership transfer
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-12-23 15:39:49 +08:00
Andreas Rheinhardt 74a8be3546 avformat/hlsenc: Fix check for presence of webvtt muxer
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Steven Liu <lq@onvideo.cn>
2019-12-23 14:05:54 +08:00
Andreas Rheinhardt 5ba3a8958c avformat/hlsenc: Fix memleaks with repeating parameters
When a parameter like e.g. language is contained more than once in the
part of var_stream_map pertaining to a single VariantStream, the later
one just overwrites the pointer to the earlier one, leading to a
memleak. This commit changes this by handling the situation gracefully:
The earlier string is silently freed first, so that the last one wins.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Steven Liu <lq@onvideo.cn>
2019-12-23 14:05:51 +08:00
Andreas Rheinhardt 53c1458bf2 avformat/hlsenc: Fix return value from localtime_r failure
"If an error is detected, localtime_r() shall return a null pointer
and set errno to indicate the error." Yet in case this happened in
hls_init(), AVERROR(ENOMEM) has been returned.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Steven Liu <lq@onvideo.cn>
2019-12-23 14:05:47 +08:00
Andreas Rheinhardt 149ee954a3 avformat/hlsenc: Fix potential segfault upon allocation failure
The hls muxer allocates an array of VariantStreams, a structure that
contains pointers to objects that need to be freed on their own. This
means that the number of allocated VariantStreams needs to be correct
when they are freed; yet the number of VariantStreams is set in
update_variant_stream_info() resp. parse_variant_stream_mapstring()
before the allocation has been checked for success, so that upon error
an attempt would be made to free the objects whose pointers are
positioned at position NULL (the location of VariantStreams) +
offsetof(VariantStream, the corresponding pointer).

Furthermore d1fe1344 added another possibility for the first function
to leave an inconsistent state behind: If an allocation of one of the
objects referenced by the VariantStream fails, the VariantStream will be
freed, but the number of allocated VariantStreams isn't reset, leading
to the same problem as above. (This was done in the mistaken belief that
the VariantStreams array would leak otherwise.)

Essentially the same also happens for the number of cc-streams. It has
been fixed, too.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Steven Liu <lq@onvideo.cn>
2019-12-23 14:05:43 +08:00
Andreas Rheinhardt bd131b64bc avformat/hlsenc: Fix leak of options when writing packets
Under certain circumstances hls_write_packet() would add options to an
AVDictionary. Said dictionary was never explicitly freed, instead it was
presumed that these options would be consumed when opening a new
IO-context. This left several possibilities for memleaks:

a) When no new IO-context would be opened at all. This is possible when
using both the flags temp_file and single_file together with a file
output.
b) When an error happens before one actually tries to open the new
IO-context.
c) When the new IO-context does not consume all options.

All three have been fixed; furthermore, the AVDictionary has been put
into a smaller scope (namely the only part of hls_write_packet() where
it is actually used).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Steven Liu <lq@onvideo.cn>
2019-12-23 14:05:40 +08:00
Andreas Rheinhardt 9e4b3ccbb6 avformat/hlsenc: Fix leak of options when initializing muxing fails
hls_mux_init() currently leaks an AVDictionary if opening a dynamic
buffer fails or if avformat_init_output fails. This has been fixed by
moving the initialization resp. the freeing of the dictionary around:
In the former case to a place after opening the dynamic buffer, in the
latter to a place before the check for initialization failure so that it
is done unconditionally.

Furthermore, the dictionary is now only copied and freed if the options
in it are actually used (namely when in SEGMENT_TYPE_FMP4 mode).

Finally, a similar situation in hls_start() has been fixed, too.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Steven Liu <lq@onvideo.cn>
2019-12-23 14:05:37 +08:00
Andreas Rheinhardt ae84305036 avformat/hlsenc: Only allocate when data is known to be needed
hls_init() would allocate a buffer, although it is only needed in one of
two branches that follow. This commit moves the allocation to the branch
that actually needs the buffer.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Steven Liu <lq@onvideo.cn>
2019-12-23 14:05:33 +08:00
Andreas Rheinhardt 728c44b861 avformat/hlsenc: Fix typo in error message
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Steven Liu <lq@onvideo.cn>
2019-12-23 14:05:30 +08:00
Andreas Rheinhardt 7d6637bcc4 avformat/hlsenc: Fix leak of child AVFormatContext
Before ed897633, the hls muxer would free its child AVFormatContexts
and reset the pointer to these contexts to NULL immediately afterwards;
ed897633 moved the former to later (into a separate function), but kept
the resetting, ensuring that the child context leaks.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Steven Liu <lq@onvideo.cn>
2019-12-23 14:05:26 +08:00
Jun Zhao c1e215041b fftools/cmdutils: Fix break command dump for -map option
Before this fix, ffmpeg -h full | grep map get the command dump
like:

-map [-]input_file_id[:stream_specifier][,sync_file_id[:stream_s  set input stream mapping
                                                               ^
                                                               |
							    truncated
after this fix, we can get full option dump.

Found-by: vacingfang <vacingfang@tencent.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-12-23 09:46:51 +08:00
James Almer 231ffd7e63 avcodec/hevcdec: keep closed captions in sync between multiple thread contexts
Based on h264 code.

Reviewed-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-21 16:10:21 -03:00
Paul B Mahol e890ce62ef avfilter/af_adeclick: implement timeline support 2019-12-21 20:02:04 +01:00
James Almer 191df4f2d1 avformat/movenc: use iso6 major brand when signed CTS offsets are used in trun boxes
Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-21 11:57:28 -03:00
James Almer 245ace4e2d avformat/movenc: ensure we don't write the major brand as a compatible brand more than once
Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-21 11:57:28 -03:00
James Almer 58ac760816 avformat/movenc: write the major brand also as the first compatible brand
Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-21 11:57:28 -03:00
Nicolas Gaullier 1fcbaa37e6 fftools/ffmpeg: Reindent after last commit
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-21 15:02:06 +01:00
Andreas Rheinhardt 15345881e7 avformat/icecast: Use AV_DICT_DONT_STRDUP_VAL to save an av_strdup
This will probably also fix CID 1452559, a false positive where Coverity
claims a double-free occurs, because it thinks that av_dict_set() frees
its key and value arguments even when the AV_DICT_DONT_STRDUP_* flags
aren't used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Marvin Scholz <epirat07@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-21 15:01:57 +01:00
Nicolas Gaullier f40fb7963e fftools/ffmpeg: Fix forward CPB props in to out
CPB side_data is copied when stream-copying (see init_output_stream_streamcopy()),
but it shall not be copied when the stream is decoded.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-21 14:46:12 +01:00
Paul B Mahol 26f4ee37f7 avfilter/vf_readeia608: if parity bit check fails, set correct value
As described in U.S. Federal Register, Volume 56, Number 114, June 13, 1991, pages 27204-27205.
2019-12-21 12:11:38 +01:00
Limin Wang 5e5bbd21e6 avcodec/h264_sei: fix the size of user data unregistered
According to the specifications, the payloadSize includes the 16-byte size of UUID.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-20 22:46:04 -03:00
Wonkap Jang a86bb2f606 doc/encoders: correct the description for ts_target_bitrate
ts_target_bitrate is in kbps, not bps. This commit clarifies the unit
and modifies the example to match the description.

Signed-off-by: James Zern <jzern@google.com>
2019-12-20 14:37:35 -05:00
Paul B Mahol 786a2daa3d avfilter/vf_readeia608: rewrite processing, make extracting more robust
Lots of options are now obsolete.
2019-12-20 18:08:46 +01:00
Limin Wang dbb051767f avcodec/hevc_sei: switch to AVBufferRef buffer for a53 caption
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-20 13:55:22 -03:00
Andreas Rheinhardt 99f505d2df avformat/icecast: Free the right buffer on error
In case an AVBPrint was not complete, icecast_open() would free some
buffers that have not been allocated yet instead of freeing the data of
the AVBPrint (if they have been allocated). Because this error does not
trigger a jump to the general cleanup section any more, one can moreover
remove a (now unnecessary) initialization of a pointer.

Furthermore, finalizing an AVBPrint can fail (namely when the string
inside the AVBPrint has not been allocated yet) and so this needs to be
checked.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-19 23:35:09 +01:00
James Almer abf5e7bc21 avformat/tls_openssl: don't use libcrypto locking functions with newer OpenSSL versions
They have been removed altogether without a compat implementation, and are
either no-ops or return NULL.
This fixes compiler warnings about checks always evaluating to false, and leaks
of allocated mutexes.

Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-19 19:30:37 -03:00
James Almer 8887991a31 avcodec/cbs_av1: add missing valid range of values for num_cb_points and num_cr_points
It is a requirement of bitstream conformance that num_cr_points is less than or equal to 10.
It is a requirement of bitstream conformance that num_cb_points is less than or equal to 10.

Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-19 01:04:10 -03:00
Martin Storsjö aad0e26f93 checkasm: aacpsdsp: Tolerate extra intermediate precision in stereo_interpolate
The stereo_interpolate functions add h_step to the values h
BUF_SIZE times. Within the stereo_interpolate C functions, the
values h (h0-h3, h00-h13) are declared as local float variables,
but the compiler is free to keep them in a register with extra
precision.

If the accumulation is rounded to 32 bit float precision after
each step, the less significant bits of h_step end up ignored
and the sum can deviate, affecting the end result more than
the currently set EPS.

By clearing the log2(BUF_SIZE) lower bits of h_step, we make sure
that the accumulation shouldn't differ significantly, regardless
of any extra precision in the accmulating register/variable.

This fixes the aacpsdsp checkasm test when built with clang for
mingw/x86_32.

Signed-off-by: Martin Storsjö <martin@martin.st>
2019-12-18 15:15:29 +02:00
Martin Storsjö e10654de2b ffprobe: Fix fate tests for ffprobe in cases where TARGET_PATH differs from the current path
In these cases, we must pass the full path of the file to ffprobe
(as the current working dir on the remote system, e.g. when invoked
with "ssh remote ffprobe ..." isn't the wanted one).

The input filename passed to ffprobe is also included in the output,
which is part of the reference test data. Add a new option to
ffprobe to allow overriding what path is printed, to keep the
original relative path in the tests.

An alternative approach could be an option to allow requesting omitting
the file name from the dumped data, and updating the test references
accordingly.

Signed-off-by: Martin Storsjö <martin@martin.st>
2019-12-18 15:15:12 +02:00
Sebastian Pop bd83191271 swscale/aarch64: use multiply accumulate and increase vector factor to 4
This patch implements ff_hscale_8_to_15_neon with NEON fused multiply accumulate
and bumps the vectorization factor from 2 to 4.
The speedup is of 25% on Graviton1 A1 instances based on A-72 cpus:

$ ffmpeg -nostats -f lavfi -i testsrc2=4k:d=2 -vf bench=start,scale=1024x1024,bench=stop -f null -
before: t:0.040303 avg:0.040287 max:0.040371 min:0.039214
after:  t:0.032168 avg:0.032215 max:0.033081 min:0.032146

The speedup is of 39% on Graviton2 m6g instances based on Neoverse-N1 cpus:
$ ffmpeg -nostats -f lavfi -i testsrc2=4k:d=2 -vf bench=start,scale=1024x1024,bench=stop -f null -
before: t:0.019446 avg:0.019423 max:0.019493 min:0.019181
after:  t:0.014015 avg:0.014096 max:0.015018 min:0.013971

Tested with `make check` on aarch64-linux.

Signed-off-by: Sebastian Pop <spop@amazon.com>
Reviewed-by: Jean-Baptiste Kempf <jb@videolan.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-17 23:41:47 +01:00
Linjie Fu e43d66dc67 lavc/h264dec.h: remove unused ff_h264_decode_slice_header
Once removed in 4a9bab3db0.

Introduced again in b25cd7540e.

Signed-off-by: Linjie Fu <fulinjie@zju.edu.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-17 23:41:47 +01:00
Linjie Fu fb705e4073 FATE/hevc.mak: cosmetic for fate-hevc-paired-fields
Adjust the order of fate-hevc-paired-fields.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-17 14:20:48 -03:00
Linjie Fu ed2bd94fc0 FATE: add test for hevc files with 4 TUDepth(0..4) of cbf_cb/cbf_cr
5 cabac states for cbf_cb and cbf_cr are supported according to
Table 9-4.

Add a test for 64x64 4:4:4 8bit HEVC clips with TUDepth = 4, cbf_cr > 0.

Signed-off-by: Xu Guangxin <guangxin.xu@intel.com>
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-17 14:12:40 -03:00
Linjie Fu d31a290226 lavc/hevc_cabac: fix cbf_cb and cbf_cr for transform depth 4
The max transform depth is 5(from 0 to 4), so we need 5 cabac states for
cbf_cb and cbf_cr.

See Table 9-4 for details.

Signed-off-by: Xu Guangxin <guangxin.xu@intel.com>
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-17 14:12:16 -03:00
Lynne 377a095dc3
vc2enc: zero padding of the coefficient buffer
Wavelet types with large amounts of overreading/writing like 9_7 would
write into the padding at high wavelet depths, which would remain and be
read by the next frame's transform and quickly cause artifacts to appear
for subsequent frames.
This fix affects all frames encoded with a non-power-of-two width, with
the artifacts varying between non-observable to very noticeable,
depending on encoder settings, so reencoding is advisable.
2019-12-17 14:56:33 +00:00
Paul B Mahol 3530fdc78e avfilter/vf_stack: set framerate to VFR when inputs frame rates differs 2019-12-17 13:30:16 +01:00
Martin Storsjö 0f50be625f fate: Add an option for disabling the 2k/4k tests
When testing on a memory limited system, these tests consume a
significant amount of memory and can often fail if testing by running
multiple processes in parallel.

Signed-off-by: Martin Storsjö <martin@martin.st>
2019-12-17 10:22:29 +02:00
Linjie Fu efefba61f8 lavc/vaapi_encode: grow packet if vaMapBuffer returns multiple buffers
Currently, assigning new buffer for pkt when multiple buffers were returned
from vaMapBuffer will overwrite the previous encoded pkt data and lead
to encode issues.

Iterate through the buf_list first to find out the total buffer size
needed for the pkt, allocate the whole pkt to avoid repeated reallocation
and memcpy, then copy data from each buf to pkt.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
2019-12-17 07:57:03 +08:00
Xinpeng Sun 2e2dfe6673 avfilter: Add tonemap vaapi filter for H2S
It performs HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion
with tone-mapping. It only supports HDR10 as input temporarily.

An example command to use this filter with vaapi codecs:
FFMPEG -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -hwaccel_output_format vaapi \
-i INPUT -vf 'tonemap_vaapi=format=p010' -c:v hevc_vaapi -profile 2 OUTPUT

Signed-off-by: Xinpeng Sun <xinpeng.sun@intel.com>
Signed-off-by: Zachary Zhou <zachary.zhou@intel.com>
Signed-off-by: Ruiling Song <ruiling.song@intel.com>
2019-12-17 07:49:49 +08:00
Carl Eugen Hoyos 9f6a06d927 lavc/allcodecs: Add mpeg4 omx encoder, missed in 0e387232 2019-12-16 22:45:34 +01:00
Carl Eugen Hoyos 84db67894f lavu/log: Also print the log level for level trace. 2019-12-16 20:53:27 +01:00
Andriy Gelman c07a772473 lavc/cbs_h2645_syntax_template: Fix memleak
payload_count is used to track the number of SEI payloads. It is also
used to free the SEIs in cbs_h264_free_sei()/cbs_h265_free_sei().

Currently, payload_count is set after for loop is completed. Hence if
there is an error and the function exits, the payload remains zero
causing a memleak.

This commit keeps track of payload_count inside the for loop to fix the
issue. Note that that the contents of current are initialized with
av_mallocz() so there is no need to zero initialize payload_count.

Found-by: libFuzzer
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2019-12-16 12:04:45 -03:00
Andreas Rheinhardt ed9279afbd h264_mp4toannexb: Remove unnecessary check
There can be at most 31 SPS and 255 PPS in the mp4/Matroska extradata.
Given that each has a size of at most 2^16-1, the length of the output
derived from these parameter sets can never overflow an ordinary 32 bit
integer. So use a simple uint32_t instead of uint64_t and replace the
unnecessary check with an av_assert1.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-15 23:43:49 +01:00
Michael Niedermayer 9fe07908c3 avcodec/adpcm: Clip predictor for APC
Fixes: signed integer overflow: -2147483648 - 13 cannot be represented in type 'int'
Fixes: 18893/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_IMA_APC_fuzzer-5630760442920960

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-15 01:01:22 +01:00
Michael Niedermayer 01593278ce avcodec/targa: Check colors vs. available space
Fixes: Timeout (37sec -> 52ms)
Fixes: 18892/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TARGA_fuzzer-5739537854889984

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-15 01:01:22 +01:00
Michael Niedermayer 5a8877da35 tools/target_dec_fuzzer: Adjust threshold for dst
Fixes: Timeout (400sec -> 14sec)
Fixes: 18989/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DST_fuzzer-5175008116867072

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-15 01:01:22 +01:00
Michael Niedermayer a76690c02b avcodec/dstdec: Use get_ur_golomb_jpegls()
Fixes: shift exponent -4 is negative
Fixes: 17793/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DST_fuzzer-5766088435957760
Fixes: 18989/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DST_fuzzer-5175008116867072

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-15 01:01:22 +01:00
Michael Niedermayer 19c41969b2 avcodec/wmavoice: Check remaining input in parse_packet_header()
Fixes: Infinite loop
Fixes: 18914/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAVOICE_fuzzer-5731902946541568

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-15 01:01:22 +01:00
Michael Niedermayer 92455c8c65 avcodec/wmalosslessdec: Fix 2 overflows in mclms
Fixes: signed integer overflow: 2038337026 + 109343477 cannot be represented in type 'int'
Fixes: 18886/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMALOSSLESS_fuzzer-5673660505653248

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-15 01:01:22 +01:00
Michael Niedermayer 6b7bcd437e avcodec/decode: Fix integer overflow in max_samples check
Fixes: signed integer overflow: 1677721600 * 32 cannot be represented in type 'int'
Fixes: 18885/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5741242185154560

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-15 01:01:22 +01:00
Michael Niedermayer a9cc69c0d5 avcodec/wmaprodec: Fixes integer overflow with 32bit samples
Fixes: left shift of 1 by 31 places cannot be represented in type 'int'
Fixes: 18860/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAPRO_fuzzer-5755223125786624

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-15 01:01:22 +01:00
Michael Niedermayer 50db30b47d avcodec/adpcm: Fix invalid shift in xa_decode()
Fixes: left shift of negative value -1
Fixes: 18859/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_XA_fuzzer-5748474213040128

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-15 01:01:22 +01:00
Michael Niedermayer 5d0b3e282a avcodec/wmavoice: Add FF_CODEC_CAP_INIT_CLEANUP
Fixes: memleaks
Fixes: 18855/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAVOICE_fuzzer-5687647317524480

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-15 01:01:22 +01:00
Michael Niedermayer ec3fe67074 avcodec/wmalosslessdec: Fix several integer issues
Fixes: shift exponent -1 is negative (and others)
Fixes: 18852/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMALOSSLESS_fuzzer-5660855295541248

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-15 01:01:22 +01:00
Michael Niedermayer 9d42826580 avcodec/wmalosslessdec: Check that padding bits is not more than sample bits
Fixes: left shift of 1 by 31 places cannot be represented in type 'int'
Fixes: 18817/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMALOSSLESS_fuzzer-5713317180211200

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-15 01:01:22 +01:00
Michael Niedermayer 185f441ba2 avcodec/iff: Skip overflowing runs in decode_delta_d()
Fixes: Timeout (107sec - 75ms>
Fixes: 18812/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-6295585225441280

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-15 01:01:22 +01:00
Michael Niedermayer 2c2ee67fd3 avcodec/apedec: Set error on error in ape_decode_value_3860()
Fixes: Timeout (unknown -> 15sec)
Fixes: 18808/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5677586072207360

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-15 01:01:22 +01:00
Michael Niedermayer c94cb8d9b2 avcodec/pnm: Check that the header is not truncated
Fixes: Ticket8430

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-15 01:01:22 +01:00
Michael Niedermayer f064c7c449 avcodec/mp3_header_decompress_bsf: Check sample_rate_index
Fixes: out of array read
Fixes: 19309/clusterfuzz-testcase-minimized-ffmpeg_BSF_MP3_HEADER_DECOMPRESS_fuzzer-5651002950942720

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-12-15 01:00:34 +01:00
Marton Balint 1f8e43938b avfilter/x86/vf_interlace: always use unaligned movs
Fixes crashes in command lines such as:

ffmpeg -f lavfi -i testsrc2=704x576:r=50,interlace,pad=720:576:8 -f null none

Related to ticket #6491.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-12-15 00:23:03 +01:00
Marton Balint 4cd2cee7ed avfilter/vf_interlace: do not interlace already interlaced frames
The filter used to work this way before it was merged into tinterlace.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-12-15 00:23:03 +01:00
Marton Balint 6498522bef avfilter/vf_tinterlace: add support for bypassing already interlaced frames
The old interlace filter worked this way before it was merged with tinterlace.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-12-15 00:23:01 +01:00
Marton Balint 28b5dc6199 avfilter/vf_interlace: restore lowpass mode constants
The documentation still mentions numerical constants in addition to textual
ones. It is also wrong to use distinct modes as flags and it disallows us to
actually use the flags field for real flags in the future.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-12-14 22:53:56 +01:00
Carl Eugen Hoyos 8b5ef2dcff lavu/pixfmt: Cosmetics, remove wrong end-of-comment markers. 2019-12-14 16:09:41 +01:00
Carl Eugen Hoyos 193143486e lavc/pnmdec: Fix 16bit decoding.
Regression since cdb5479c
Reported by irc user tTh from Mixart-Myrys
2019-12-14 09:49:58 +01:00
Paul B Mahol 24424a6516 avcodec/simple_idct_template: fix integer overflow 2019-12-14 00:20:52 +01:00
Michael Niedermayer bbe27890ff avcodec/cbs_av1_syntax_template: Check num_y_points
"It is a requirement of bitstream conformance that num_y_points is less than or equal to 14."

Fixes: index 24 out of bounds for type 'uint8_t [24]'
Fixes: 19282/clusterfuzz-testcase-minimized-ffmpeg_BSF_AV1_FRAME_MERGE_fuzzer-5747424845103104

Note, also needs a23dd33606

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: jamrial
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-13 23:52:19 +01:00
Guo, Yejun e52070e89c convert_from_tensorflow.py: add support when kernel size is 1*1 with one input/output channel (gray image)
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
2019-12-13 11:41:10 -03:00
Guo, Yejun ed9fc2e3c5 avfilter/vf_dnn_processing: refine code for better naming
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
2019-12-13 11:41:10 -03:00
James Almer 54d09eb8d0 fate/cbs: use the rawvideo muxer for AV1 tests
The IVF muxer autoinserts the av1_metadata filter unconditionally, which is
not desirable for these tests.

Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-13 10:58:10 -03:00
Paul B Mahol 824324db41 avfilter/vf_datascope: add decimal output 2019-12-13 12:51:47 +01:00
Martin Storsjö 06ec9c4746 configure: Check for the SetDllDirectory and GetModuleHandle functions
These functions aren't available when building for the restricted
UWP/WinRT/WinStore API subsets.

Normally when building in this mode, one is probably only building
the libraries, but being able to build ffmpeg.exe still is useful
(and a ffmpeg.exe targeting these API subsets still can be run
e.g. in wine, for testing).

Signed-off-by: Martin Storsjö <martin@martin.st>
2019-12-13 10:53:05 +02:00
Martin Storsjö f58bda642d checkasm: af_afir: Use a dynamic tolerance depending on values
As the values generated by av_bmg_get can be arbitrarily large
(only the stddev is specified), we can't use a fixed tolerance.
Calculate a dynamic tolerance (like in float_dsp from 38f966b222),
based on the individual steps of the calculation.

This fixes running this test with certain seeds, when built with
clang for mingw/x86_32.

Signed-off-by: Martin Storsjö <martin@martin.st>
2019-12-12 23:57:08 +02:00
Michael Niedermayer 9d1f7870a9 avfilter: Fix type in av_log for random_seed in cellauto and life
Fixes CID 1456556 / 1456555

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-12 21:40:53 +01:00
Michael Niedermayer ab3044368f avcodec/v210dec: move the stride read after its fully initialized
Fixes: out of array read
Fixes: 19129/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_V210_fuzzer-5068171023482880
Maybe fixes: 19130/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_V210_fuzzer-5637264407527424

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-12 19:25:33 +01:00
Linjie Fu 7aef2f59b5 lavc/utils.c: fix code indentations
Introduced since 4b4a02b8.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-12 19:25:33 +01:00
Linjie Fu bffb9326b6 lavc/mips: simplify the switch code
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-12 19:25:33 +01:00
Andreas Rheinhardt 82d61a9ce3 avformat: Don't free old extradata before ff_alloc/get_extradata
These functions already free it themselves before they allocate the new
extradata.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-12 19:25:33 +01:00
Andreas Rheinhardt c1e439d7e9 avformat: Forward errors where possible
It is not uncommon to find code where the caller thinks to know better
what the return value should be than the callee. E.g. something like
"if (av_new_packet(pkt, size) < 0) return AVERROR(ENOMEM);". This commit
changes several instances of this to instead forward the actual error.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-12 19:25:33 +01:00
Andreas Rheinhardt cb88cdf773 avformat/rtpdec_hevc: Don't reimplement ff_alloc_extradata
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-12 19:25:33 +01:00
Andreas Rheinhardt c1d300f83a avformat/apngdec: Don't free extradata manually
The extradata will be freed automatically when the corresponding stream
gets freed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-12 19:25:33 +01:00
Andreas Rheinhardt 2e328a8a38 avformat/apngdec: Make sure that extradata is zero-padded
Zeroing the padding has been forgotten.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-12 19:25:33 +01:00
Andreas Rheinhardt 56ce2ad2cc avformat/mov: Use ff_alloc_extradata for dvdsub extradata
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: "mypopy@gmail.com" <mypopy@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-12 19:25:33 +01:00
Zhong Li a87b5d5e8c lavc/x265: set preferred_transfer_characteristics for HLG
"HEVC HDR UHDTV Bitstreams using HLG10 shall also contain the
alternative_transfer_characteristics SEI message. The
alternative_transfer_characteristics SEI message shall be inserted on
the HEVC DVB_RAP, and preferred_transfer_characteristics shall be set
equal to "18", indicating Recommendation ITU-R BT. 2100 [45] HLG
system."

Signed-off-by: Zhong Li <zhongli_dev@126.com>
2019-12-12 23:44:02 +08:00
Linjie Fu 8446318502 lavc/qsvenc: add Tiles encode support for HEVC
Add -tile_rows and -tile_cols option to specify the number of tile rows
and columns for ICL+ (gen 11) platform.

A tile must wholly contain all the slices within it. Slices cannot cross
tile boundaries. So the slice number would be implicitly resized to the
max(nSlice, nTile).

Example:
    ffmpeg -v verbose -hwaccel qsv -init_hw_device qsv=hw
    -filter_hw_device hw -f rawvideo -s:v 1920x1080 -i ./input.nv12 -vf
    format=nv12,hwupload=extra_hw_frames=64 -c:v hevc_qsv -tile_rows 2
    -tile_cols 2 -slices 4 -y output.h265

Also dump the actual quantity of encoded tiled rows and columns in run
time.

Fix the enhancement #8400.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
2019-12-12 23:43:06 +08:00
Yuki Tsuchiya 0ceed513d5 lavf/movenc: cosmetics
Signed-off-by: Yuki Tsuchiya <Yuki.Tsuchiya@sony.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-12 12:36:13 -03:00
James Almer 6467a15997 Changelog: add entry about MPEG-H 3D Audio support in mp4
Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-12 12:03:31 -03:00
Yuki Tsuchiya 632b8298b7 lavf/isom: support for demuxing and remuxing of MPEG-H 3D Audio in MP4
Implemented according to the specification at https://www.iso.org/standard/69561.html
The 'mhm1' sample entry is registered with MP4RA, which is defined as MHAS encapsulated single stream MPEG-H 3D Audio.
'MHAS' stands for MPEG-H audio stream, which contains encoded audio data and corresponds metadata for decoding.
This patch enables extracting the MHAS bitstream from MP4 and remuxing into MP4.

Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-12 11:44:57 -03:00
Yuki Tsuchiya 30047b6a57 lavc: add MPEG-H 3D Audio codec id
Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-12 11:44:29 -03:00
Yuki Tsuchiya 610473b967 lavc/codec_desc: introduce AV_CODEC_PROP_INTRA_ONLY flag to audio codec
Introduce AV_CODEC_PROP_INTRA_ONLY flag to audio codec as well as video codec to support non intra-only audio codec.

Signed-off-by: Yuki Tsuchiya <Yuki.Tsuchiya@sony.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-12 11:38:47 -03:00
James Almer aedffc0b22 avcodec/mlp_parser: mark sync frames as key frames
Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-12 11:38:34 -03:00
Martin Storsjö 29f8d4e947 rtsp: Use AVERROR() with errno.h error codes for error returns
This particular function is only required to return nonzero on
errors, but use the common AVERROR() pattern for consistency.

Signed-off-by: Martin Storsjö <martin@martin.st>
2019-12-12 11:28:31 +02:00
Martin Storsjö e9bb1410e4 fate: Fix use of target_path/target_samples
Signed-off-by: Martin Storsjö <martin@martin.st>
2019-12-12 11:28:21 +02:00
Martin Storsjö b85dcd8586 fate: Fix dependencies to sample files to use local paths
These dependencies are evaluted by make and must be expressed with
the paths as in the local filesystem.

Signed-off-by: Martin Storsjö <martin@martin.st>
2019-12-12 11:27:55 +02:00
James Almer 13f2b6dc72 fate/cbs: update the two film grain cbs_av1 tests
They were missed in the previous commit.

Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-11 21:59:24 -03:00
James Almer a23dd33606 avcodec/cbs_av1: fix array size for ar_coeffs_cb_plus_128 and ar_coeffs_cr_plus_128
Taking into account the code

fb(2, ar_coeff_lag);
num_pos_luma = 2 * current->ar_coeff_lag * (current->ar_coeff_lag + 1);
if (current->num_y_points)
    num_pos_chroma = num_pos_luma + 1;
else
    num_pos_chroma = num_pos_luma;

Max value for ar_coeff_lag is 3 (two bits), for num_pos_luma 24, and for
num_pos_chroma 25.

Both ar_coeffs_cb_plus_128 and ar_coeffs_cr_plus_128 may have up to
num_pos_chroma values.

Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-11 19:29:43 -03:00
Martin Storsjö c27a85b983 fate: Use a oneoff test for the tremolo filter
The tremolo filter uses floating point internally, and uses
multiplication factors derived from sin(fmod()), neither of
which is bitexact for use with framecrc.

This fixes running this test when built with for mingw/x86_32
with clang.

In this case, a 1 ulp difference in the output from fmod() would
end up in an output from the filter that differs by 1 ulp, but
which makes the lrint() in swresample/audioconvert.c round in a
different direction.

Signed-off-by: Martin Storsjö <martin@martin.st>
2019-12-11 22:20:00 +02:00
Martin Storsjö 8f70e261fa checkasm: float_dsp: Scale FLT/DBL_EPSILON sufficiently when comparing
As the values generated by av_bmg_get can be arbitrarily large
(only the stddev is specified), we can't use a fixed tolerance.

This matches what was done for test_vector_dmul_scalar in
38f966b222.

This fixes the float_dsp checkasm test for some seeds, when built
with clang for mingw/x86_32.

Signed-off-by: Martin Storsjö <martin@martin.st>
2019-12-11 22:19:45 +02:00
Martin Storsjö 6569e9505c network: Define ENOTCONN as WSAENOTCONN if not defined
This fixes compilation with old mingw.org toolchains, which has got
much fewer errno.h entries.

Signed-off-by: Martin Storsjö <martin@martin.st>
2019-12-11 22:18:09 +02:00
Fei Wang 5fc3099caf avcodec/cbs_av1: rename enable_intraintra_compound flag
rename enable_intraintra_compound to enable_interintra_compound,
which keep same as AV1 sepc(v1.0.0-errata1).

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-11 16:23:38 -03:00
Andreas Rheinhardt 86e9747c63 avformat/iff: Use ff_alloc_extradata
Besides improved readability it also zeroes the padding which has been
forgotten here.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-11 16:24:16 +01:00
Andreas Rheinhardt a6d292b954 avformat/flvenc: Don't reimplement ff_alloc_extradata
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-11 16:24:16 +01:00
Andreas Rheinhardt 91f775e0c5 avformat/apc: Remove unnecessary resetting of flags
The packet a demuxer receives is freshly initialized, hence it is
unnecessary to reset any flags on them (as none are set), yet apc did
this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-11 16:24:16 +01:00
Gyan Doshi 78676ee8f8 avfilter/scale_eval: remove redundant mathematical constants
Even though removed from vf_scale in 3b316f9f22, they were reintroduced
when scale.c, now scale_eval.c, was split off in 037bb4021c
2019-12-11 16:08:53 +05:30
424 changed files with 6590 additions and 3215 deletions

View File

@ -5,8 +5,8 @@ version <next>:
- v360 filter
- Intel QSV-accelerated MJPEG decoding
- Intel QSV-accelerated VP9 decoding
- support for TrueHD in mp4
- Supoort AMD AMF encoder on Linux (via Vulkan)
- Support for TrueHD in mp4
- Support AMD AMF encoder on Linux (via Vulkan)
- IMM5 video decoder
- ZeroMQ protocol
- support Sipro ACELP.KELVIN decoding
@ -27,6 +27,9 @@ version <next>:
- axcorrelate filter
- mvdv decoder
- mvha decoder
- MPEG-H 3D Audio support in mp4
- thistogram filter
- freezeframes filter
version 4.2:

View File

@ -35,7 +35,6 @@ Specifically, the GPL parts of FFmpeg are:
- `vf_eq.c`
- `vf_find_rect.c`
- `vf_fspp.c`
- `vf_geq.c`
- `vf_histeq.c`
- `vf_hqdn3d.c`
- `vf_kerndeint.c`

View File

@ -1096,7 +1096,7 @@ AVSC_INLINE AVS_Library * avs_load_library() {
AVS_Library *library = (AVS_Library *)malloc(sizeof(AVS_Library));
if (library == NULL)
return NULL;
library->handle = LoadLibrary("avisynth");
library->handle = LoadLibraryA("avisynth");
if (library->handle == NULL)
goto fail;

12
configure vendored
View File

@ -482,6 +482,7 @@ Developer options (useful when working on FFmpeg itself):
--ignore-tests=TESTS comma-separated list (without "fate-" prefix
in the name) of tests whose result is ignored
--enable-linux-perf enable Linux Performance Monitor API
--disable-large-tests disable tests that use a large amount of memory
NOTE: Object files are built at the place where configure is launched.
EOF
@ -1931,6 +1932,7 @@ CONFIG_LIST="
$SUBSYSTEM_LIST
autodetect
fontconfig
large_tests
linux_perf
memory_poisoning
neon_clobber_test
@ -2194,6 +2196,7 @@ SYSTEM_FUNCS="
getaddrinfo
gethrtime
getopt
GetModuleHandle
GetProcessAffinityMask
GetProcessMemoryInfo
GetProcessTimes
@ -2223,6 +2226,7 @@ SYSTEM_FUNCS="
SecItemImport
SetConsoleTextAttribute
SetConsoleCtrlHandler
SetDllDirectory
setmode
setrlimit
Sleep
@ -3499,7 +3503,6 @@ freezedetect_filter_select="scene_sad"
frei0r_filter_deps="frei0r libdl"
frei0r_src_filter_deps="frei0r libdl"
fspp_filter_deps="gpl"
geq_filter_deps="gpl"
headphone_filter_select="fft"
histeq_filter_deps="gpl"
hqdn3d_filter_deps="gpl"
@ -3576,6 +3579,7 @@ tinterlace_filter_deps="gpl"
tinterlace_merge_test_deps="tinterlace_filter"
tinterlace_pad_test_deps="tinterlace_filter"
tonemap_filter_deps="const_nan"
tonemap_vaapi_filter_deps="vaapi VAProcFilterParameterBufferHDRToneMapping"
tonemap_opencl_filter_deps="opencl const_nan"
transpose_opencl_filter_deps="opencl"
transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags"
@ -3724,6 +3728,7 @@ enable asm
enable debug
enable doc
enable faan faandct faanidct
enable large_tests
enable optimizations
enable runtime_cpudetect
enable safe_bitstream_reader
@ -6032,6 +6037,7 @@ check_func_headers mach/mach_time.h mach_absolute_time
check_func_headers stdlib.h getenv
check_func_headers sys/stat.h lstat
check_func_headers windows.h GetModuleHandle
check_func_headers windows.h GetProcessAffinityMask
check_func_headers windows.h GetProcessTimes
check_func_headers windows.h GetSystemTimeAsFileTime
@ -6040,6 +6046,7 @@ check_func_headers windows.h MapViewOfFile
check_func_headers windows.h PeekNamedPipe
check_func_headers windows.h SetConsoleTextAttribute
check_func_headers windows.h SetConsoleCtrlHandler
check_func_headers windows.h SetDllDirectory
check_func_headers windows.h Sleep
check_func_headers windows.h VirtualAlloc
check_func_headers glob.h glob
@ -6577,6 +6584,7 @@ if enabled vaapi; then
check_type "va/va.h va/va_dec_hevc.h" "VAPictureParameterBufferHEVC"
check_struct "va/va.h" "VADecPictureParameterBufferVP9" bit_depth
check_type "va/va.h va/va_vpp.h" "VAProcFilterParameterBufferHDRToneMapping"
check_struct "va/va.h va/va_vpp.h" "VAProcPipelineCaps" rotation_flags
check_type "va/va.h va/va_enc_hevc.h" "VAEncPictureParameterBufferHEVC"
check_type "va/va.h va/va_enc_jpeg.h" "VAEncPictureParameterBufferJPEG"
@ -7448,7 +7456,7 @@ cat > $TMPH <<EOF
#define FFMPEG_CONFIG_H
#define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
#define FFMPEG_LICENSE "$(c_escape $license)"
#define CONFIG_THIS_YEAR 2019
#define CONFIG_THIS_YEAR 2020
#define FFMPEG_DATADIR "$(eval c_escape $datadir)"
#define AVCONV_DATADIR "$(eval c_escape $datadir)"
#define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"

View File

@ -15,6 +15,15 @@ libavutil: 2017-10-21
API changes, most recent first:
2020-01-15 - xxxxxxxxxx - lavc 58.66.100 - avcodec.h
Add AV_PKT_DATA_PRFT and AVProducerReferenceTime.
2019-12-27 - xxxxxxxxxx - lavu 56.38.100 - eval.h
Add av_expr_count_func().
2019-12-xx - xxxxxxxxxx - lavu 56.37.100 - buffer.h
Add av_buffer_pool_buffer_get_opaque().
2019-11-17 - 1c23abc88f - lavu 56.36.100 - eval API
Add av_expr_count_vars().

View File

@ -456,6 +456,17 @@ nanosecond precision.
@item video_size
Set the video size of the images to read. If not specified the video
size is guessed from the first image file in the sequence.
@item export_path_metadata
If set to 1, will add two extra fields to the metadata found in input, making them
also available for other filters (see @var{drawtext} filter for examples). Default
value is 0. The extra fields are described below:
@table @option
@item lavf.image2dec.source_path
Corresponds to the full path to the input file being read.
@item lavf.image2dec.source_basename
Corresponds to the name of the file being read.
@end table
@end table
@subsection Examples

View File

@ -1893,7 +1893,7 @@ key=value pairs. For example, to specify temporal scalability parameters
with @code{ffmpeg}:
@example
ffmpeg -i INPUT -c:v libvpx -ts-parameters ts_number_layers=3:\
ts_target_bitrate=250000,500000,1000000:ts_rate_decimator=4,2,1:\
ts_target_bitrate=250,500,1000:ts_rate_decimator=4,2,1:\
ts_periodicity=4:ts_layer_id=0,2,1,2 OUTPUT
@end example
Below is a brief explanation of each of the parameters, please
@ -1903,7 +1903,8 @@ details.
@item ts_number_layers
Number of temporal coding layers.
@item ts_target_bitrate
Target bitrate for each temporal layer.
Target bitrate for each temporal layer (in kbps).
(bitrate should be inclusive of the lower temporal layer).
@item ts_rate_decimator
Frame rate decimation factor for each temporal layer.
@item ts_periodicity
@ -2414,6 +2415,20 @@ during configuration. You need to explicitly configure the build with
@subsection Options
@table @option
@item b
Sets target video bitrate.
@item bf
@item g
Set the GOP size.
@item keyint_min
Minimum GOP size.
@item refs
Number of reference frames each P-frame can use. The range is from @var{1-16}.
@item preset
Set the x265 preset.
@ -2426,6 +2441,28 @@ Set profile restrictions.
@item crf
Set the quality for constant quality mode.
@item qp
Set constant quantization rate control method parameter.
@item qmin
Minimum quantizer scale.
@item qmax
Maximum quantizer scale.
@item qdiff
Maximum difference between quantizer scales.
@item qblur
Quantizer curve blur
@item qcomp
Quantizer curve compression factor
@item i_qfactor
@item b_qfactor
@item forced-idr
Normally, when forcing a I-frame type, the encoder can select any type
of I-frame. This option forces it to choose an IDR-frame.

View File

@ -879,12 +879,19 @@ Deprecated see -bsf
@item -force_key_frames[:@var{stream_specifier}] @var{time}[,@var{time}...] (@emph{output,per-stream})
@item -force_key_frames[:@var{stream_specifier}] expr:@var{expr} (@emph{output,per-stream})
Force key frames at the specified timestamps, more precisely at the first
frames after each specified time.
@item -force_key_frames[:@var{stream_specifier}] source (@emph{output,per-stream})
If the argument is prefixed with @code{expr:}, the string @var{expr}
is interpreted like an expression and is evaluated for each frame. A
key frame is forced in case the evaluation is non-zero.
@var{force_key_frames} can take arguments of the following form:
@table @option
@item @var{time}[,@var{time}...]
If the argument consists of timestamps, ffmpeg will round the specified times to the nearest
output timestamp as per the encoder time base and force a keyframe at the first frame having
timestamp equal or greater than the computed timestamp. Note that if the encoder time base is too
coarse, then the keyframes may be forced on frames with timestamps lower than the specified time.
The default encoder time base is the inverse of the output framerate but may be set otherwise
via @code{-enc_time_base}.
If one of the times is "@code{chapters}[@var{delta}]", it is expanded into
the time of the beginning of all chapters in the file, shifted by
@ -898,6 +905,11 @@ before the beginning of every chapter:
-force_key_frames 0:05:00,chapters-0.1
@end example
@item expr:@var{expr}
If the argument is prefixed with @code{expr:}, the string @var{expr}
is interpreted like an expression and is evaluated for each frame. A
key frame is forced in case the evaluation is non-zero.
The expression in @var{expr} can contain the following constants:
@table @option
@item n
@ -925,6 +937,12 @@ starting from second 13:
-force_key_frames expr:if(isnan(prev_forced_t),gte(t,13),gte(t,prev_forced_t+5))
@end example
@item source
If the argument is @code{source}, ffmpeg will force a key frame if
the current frame being encoded is marked as a key frame in its source.
@end table
Note that forcing too many keyframes is very harmful for the lookahead
algorithms of certain encoders: using fixed-GOP options or similar
would be more efficient.

View File

@ -443,6 +443,10 @@ How much to use compressed signal in output. Default is 1.
Range is between 0 and 1.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@section acontrast
Simple audio dynamic range compression/expansion filter.
@ -1179,7 +1183,7 @@ afftfilt="real='hypot(re,im)*cos((random(0)*2-1)*2*3.14)':imag='hypot(re,im)*sin
@anchor{afir}
@section afir
Apply an arbitrary Frequency Impulse Response filter.
Apply an arbitrary Finite Impulse Response filter.
This filter is designed for applying long FIR filters,
up to 60 seconds long.
@ -1188,10 +1192,10 @@ It can be used as component for digital crossover filters,
room equalization, cross talk cancellation, wavefield synthesis,
auralization, ambiophonics, ambisonics and spatialization.
This filter uses the second stream as FIR coefficients.
If the second stream holds a single channel, it will be used
This filter uses the streams higher than first one as FIR coefficients.
If the non-first stream holds a single channel, it will be used
for all input channels in the first stream, otherwise
the number of channels in the second stream must be same as
the number of channels in the non-first stream must be same as
the number of channels in the first stream.
It accepts the following parameters:
@ -1253,13 +1257,22 @@ Set video stream frame rate. This option is used only when @var{response} is ena
@item minp
Set minimal partition size used for convolution. Default is @var{8192}.
Allowed range is from @var{8} to @var{32768}.
Allowed range is from @var{1} to @var{32768}.
Lower values decreases latency at cost of higher CPU usage.
@item maxp
Set maximal partition size used for convolution. Default is @var{8192}.
Allowed range is from @var{8} to @var{32768}.
Lower values may increase CPU usage.
@item nbirs
Set number of input impulse responses streams which will be switchable at runtime.
Allowed range is from @var{1} to @var{32}. Default is @var{1}.
@item ir
Set IR stream which will be used for convolution, starting from @var{0}, should always be
lower than supplied value by @code{nbirs} option. Default is @var{0}.
This option can be changed at runtime via @ref{commands}.
@end table
@subsection Examples
@ -1281,13 +1294,13 @@ negotiate the most appropriate format to minimize conversions.
It accepts the following parameters:
@table @option
@item sample_fmts
@item sample_fmts, f
A '|'-separated list of requested sample formats.
@item sample_rates
@item sample_rates, r
A '|'-separated list of requested sample rates.
@item channel_layouts
@item channel_layouts, cl
A '|'-separated list of requested channel layouts.
See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
@ -3213,6 +3226,10 @@ Sets the intensity of effect (default: 2.0). Must be in range between 0.0
Enable clipping. By default is enabled.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@section dcshift
Apply a DC shift to the audio.
@ -3438,8 +3455,20 @@ value. Instead, the threshold value will be adjusted for each individual
frame.
In general, smaller parameters result in stronger compression, and vice versa.
Values below 3.0 are not recommended, because audible distortion may appear.
@item threshold, t
Set the target threshold value. This specifies the lowest permissible
magnitude level for the audio input which will be normalized.
If input frame volume is above this value frame will be normalized.
Otherwise frame may not be normalized at all. The default value is set
to 0, which means all input frames will be normalized.
This option is mostly useful if digital noise is not wanted to be amplified.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@section earwax
Make audio easier to listen to on headphones.
@ -3558,6 +3587,10 @@ Sets the difference coefficient (default: 2.5). 0.0 means mono sound
Enable clipping. By default is enabled.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@section firequalizer
Apply FIR Equalization using arbitrary frequency response.
@ -4660,6 +4693,10 @@ How much to use compressed signal in output. Default is 1.
Range is between 0 and 1.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@subsection Examples
@itemize
@ -5167,6 +5204,10 @@ channels. Default is 0.3.
Set level of input signal of original channel. Default is 0.8.
@end table
@subsection Commands
This filter supports the all above options except @code{delay} as @ref{commands}.
@section superequalizer
Apply 18 band equalizer.
@ -5522,6 +5563,11 @@ Pre-amplification gain in dB to apply to the selected replaygain gain.
Default value for @var{replaygain_preamp} is 0.0.
@item replaygain_noclip
Prevent clipping by limiting the gain applied.
Default value for @var{replaygain_noclip} is 1.
@item eval
Set when the volume expression is evaluated.
@ -5581,11 +5627,6 @@ The command accepts the same syntax of the corresponding option.
If the specified expression is not valid, it is kept at its current
value.
@item replaygain_noclip
Prevent clipping by limiting the gain applied.
Default value for @var{replaygain_noclip} is 1.
@end table
@subsection Examples
@ -8354,6 +8395,9 @@ Draw rows and columns numbers on left and top of video.
@item opacity
Set background opacity.
@item format
Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
@end table
@section dctdnoiz
@ -8629,6 +8673,10 @@ Limit the maximum change for each plane, default is 65535.
If 0, plane will remain unchanged.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@section deflicker
Remove temporal frame luminance variations.
@ -8970,6 +9018,10 @@ Flags to local 3x3 coordinates maps like this:
6 7 8
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@section displace
Displace pixels as indicated by second and third input stream.
@ -9027,8 +9079,8 @@ ffmpeg -i INPUT -f lavfi -i nullsrc=hd720,geq='r=128+80*(sin(sqrt((X-W/2)*(X-W/2
@section dnn_processing
Do image processing with deep neural networks. Currently only AVFrame with RGB24
and BGR24 are supported, more formats will be added later.
Do image processing with deep neural networks. It works together with another filter
which converts the pixel format of the Frame to what the dnn network requires.
The filter accepts the following options:
@ -9063,12 +9115,23 @@ Set the input name of the dnn network.
@item output
Set the output name of the dnn network.
@item fmt
Set the pixel format for the Frame. Allowed values are @code{AV_PIX_FMT_RGB24}, and @code{AV_PIX_FMT_BGR24}.
Default value is @code{AV_PIX_FMT_RGB24}.
@end table
@itemize
@item
Halve the red channle of the frame with format rgb24:
@example
ffmpeg -i input.jpg -vf format=rgb24,dnn_processing=model=halve_first_channel.model:input=dnn_in:output=dnn_out:dnn_backend=native out.native.png
@end example
@item
Halve the pixel value of the frame with format gray32f:
@example
ffmpeg -i input.jpg -vf format=grayf32,dnn_processing=model=halve_gray_float.model:input=dnn_in:output=dnn_out:dnn_backend=native -y out.native.png
@end example
@end itemize
@section drawbox
Draw a colored box on the input image.
@ -9258,6 +9321,9 @@ Set size of graph video. For the syntax of this option, check the
@ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
The default value is @code{900x256}.
@item rate, r
Set the output frame rate. Default value is @code{25}.
The foreground color expressions can use the following variables:
@table @option
@item MIN
@ -9869,6 +9935,15 @@ drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
@end example
@item
Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
must have option @option{-export_path_metadata 1} for the special metadata fields
to be available for filters.
@example
drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
@end example
@end itemize
For more information about libfreetype, check:
@ -10118,6 +10193,10 @@ Flags to local 3x3 coordinates maps like this:
6 7 8
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@section extractplanes
Extract color channel components from input video stream into
@ -11143,6 +11222,25 @@ specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
Set freeze duration until notification (default is 2 seconds).
@end table
@section freezeframes
Freeze video frames.
This filter freezes video frames using frame from 2nd input.
The filter accepts the following options:
@table @option
@item first
Set number of first frame from which to start freeze.
@item last
Set number of last frame from which to end freeze.
@item replace
Set number of frame from 2nd input which will be used instead of replaced frames.
@end table
@anchor{frei0r}
@section frei0r
@ -11671,6 +11769,7 @@ the histogram. Possible values are @code{none}, @code{weak} or
@code{strong}. It defaults to @code{none}.
@end table
@anchor{histogram}
@section histogram
Compute and draw a color distribution histogram for the input video.
@ -12165,6 +12264,10 @@ Default value is @code{none}.
Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@section inflate
Apply inflate effect to the video.
@ -12183,6 +12286,10 @@ Limit the maximum change for each plane, default is 65535.
If 0, plane will remain unchanged.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@section interlace
Simple interlacing filter from progressive contents. This interleaves upper (or
@ -15345,42 +15452,16 @@ Set the line to start scanning for EIA-608 data. Default is @code{0}.
@item scan_max
Set the line to end scanning for EIA-608 data. Default is @code{29}.
@item mac
Set minimal acceptable amplitude change for sync codes detection.
Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
@item spw
Set the ratio of width reserved for sync code detection.
Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
@item mhd
Set the max peaks height difference for sync code detection.
Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
@item mpd
Set max peaks period difference for sync code detection.
Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
@item msd
Set the first two max start code bits differences.
Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
@item bhd
Set the minimum ratio of bits height compared to 3rd start code bit.
Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
@item th_w
Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
@item th_b
Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
@item chp
Enable checking the parity bit. In the event of a parity error, the filter will output
@code{0x00} for that character. Default is false.
@item lp
Lowpass lines prior to further processing. Default is disabled.
Lowpass lines prior to further processing. Default is enabled.
@end table
@subsection Examples
@ -16058,6 +16139,19 @@ pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
@item ovsub
horizontal and vertical output chroma subsample values. For example for the
pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
@item n
The (sequential) number of the input frame, starting from 0.
Only available with @code{eval=frame}.
@item t
The presentation timestamp of the input frame, expressed as a number of
seconds. Only available with @code{eval=frame}.
@item pos
The position (byte offset) of the frame in the input stream, or NaN if
this information is unavailable and/or meaningless (for example in case of synthetic video).
Only available with @code{eval=frame}.
@end table
@subsection Examples
@ -16281,6 +16375,19 @@ The main input video's display aspect ratio. Calculated from
The main input video's horizontal and vertical chroma subsample values.
For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
is 1.
@item main_n
The (sequential) number of the main input frame, starting from 0.
Only available with @code{eval=frame}.
@item main_t
The presentation timestamp of the main input frame, expressed as a number of
seconds. Only available with @code{eval=frame}.
@item main_pos
The position (byte offset) of the frame in the main input stream, or NaN if
this information is unavailable and/or meaningless (for example in case of synthetic video).
Only available with @code{eval=frame}.
@end table
@subsection Examples
@ -16299,6 +16406,19 @@ Scale a logo to 1/10th the height of a video, while preserving its display aspec
@end example
@end itemize
@subsection Commands
This filter supports the following commands:
@table @option
@item width, w
@item height, h
Set the output video dimension expression.
The command accepts the same syntax of the corresponding option.
If the specified expression is not valid, it is kept at its current
value.
@end table
@section scroll
Scroll input video horizontally and/or vertically by constant speed.
@ -16723,6 +16843,15 @@ The Adler-32 checksum (printed in hexadecimal) of all the planes of the input fr
@item plane_checksum
The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
@item mean
The mean value of pixels in each plane of the input frame, expressed in the form
"[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
@item stdev
The standard deviation of pixel values in each plane of the input frame, expressed
in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
@end table
@section showpalette
@ -17190,6 +17319,15 @@ option may cause flicker since the B-Frames have often larger QP. Default is
@code{0} (not enabled).
@end table
@subsection Commands
This filter supports the following commands:
@table @option
@item level
@item quality
Same as quality option. And the command accepts the @code{max} same as the @code{6}.
@end table
@section sr
Scale the input by applying one of the super-resolution methods based on
@ -17740,6 +17878,61 @@ PAL output (25i):
16p: 33333334
@end example
@section thistogram
Compute and draw a color distribution histogram for the input video across time.
Unlike @ref{histogram} video filter which only shows histogram of single input frame
at certain time, this filter shows also past histograms of number of frames defined
by @code{width} option.
The computed histogram is a representation of the color component
distribution in an image.
The filter accepts the following options:
@table @option
@item width, w
Set width of single color component output. Default value is @code{0}.
Value of @code{0} means width will be picked from input video.
This also set number of passed histograms to keep.
Allowed range is [0, 8192].
@item display_mode, d
Set display mode.
It accepts the following values:
@table @samp
@item stack
Per color component graphs are placed below each other.
@item parade
Per color component graphs are placed side by side.
@item overlay
Presents information identical to that in the @code{parade}, except
that the graphs representing color components are superimposed directly
over one another.
@end table
Default is @code{stack}.
@item levels_mode, m
Set mode. Can be either @code{linear}, or @code{logarithmic}.
Default is @code{linear}.
@item components, c
Set what color components to display.
Default is @code{7}.
@item bgopacity, b
Set background opacity. Default is @code{0.9}.
@item envelope, e
Show envelope. Default is disabled.
@item ecolor, ec
Set envelope color. Default is @code{gold}.
@end table
@section threshold
Apply threshold effect to video stream.
@ -18119,10 +18312,12 @@ Enable complex vertical low-pass filtering.
This will slightly less reduce interlace 'twitter' and Moire
patterning but better retain detail and subjective sharpness impression.
@item bypass_il
Bypass already interlaced frames, only adjust the frame rate.
@end table
Vertical low-pass filtering can only be enabled for @option{mode}
@var{interleave_top} and @var{interleave_bottom}.
Vertical low-pass filtering and bypassing already interlaced frames can only be
enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
@end table
@ -18938,6 +19133,7 @@ Set vectorscope mode.
It accepts the following values:
@table @samp
@item gray
@item tint
Gray values are displayed on graph, higher brightness means more pixels have
same component color value on location in graph. This is the default mode.
@ -18996,6 +19192,7 @@ Set what kind of graticule to draw.
@item none
@item green
@item color
@item invert
@end table
@item opacity, o
@ -19040,6 +19237,11 @@ Set what kind of colorspace to use when drawing graticule.
@item 709
@end table
Default is auto.
@item tint0, t0
@item tint1, t1
Set color tint for gray/tint vectorscope mode. By default both options are zero.
This means no tint, and output will remain gray.
@end table
@anchor{vidstabdetect}
@ -19328,6 +19530,10 @@ If @code{intensity} is negative and this is set to 1, colors will change,
otherwise colors will be less saturated, more towards gray.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@anchor{vignette}
@section vignette
@ -19671,6 +19877,12 @@ Default is digital.
@item bgopacity, b
Set background opacity.
@item tint0, t0
@item tint1, t1
Set tint for output.
Only used with lowpass filter and when display is not overlay and input
pixel formats are not RGB.
@end table
@section weave, doubleweave
@ -20344,7 +20556,17 @@ horizontal and vertical output chroma subsample values. For example for the
pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
@end table
@subsection Commands
This filter supports the following commands:
@table @option
@item width, w
@item height, h
Set the output video dimension expression.
The command accepts the same syntax of the corresponding option.
If the specified expression is not valid, it is kept at its current
value.
@end table
@c man end VIDEO FILTERS
@ -21034,6 +21256,65 @@ Apply a strong blur of both luma and chroma parameters:
@c man end OPENCL VIDEO FILTERS
@chapter VAAPI Video Filters
@c man begin VAAPI VIDEO FILTERS
VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
To enable compilation of these filters you need to configure FFmpeg with
@code{--enable-vaapi}.
To use vaapi filters, you need to setup the vaapi device correctly. For more information, please read @url{https://trac.ffmpeg.org/wiki/Hardware/VAAPI}
@section tonemap_vappi
Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
It maps the dynamic range of HDR10 content to the SDR content.
It currently only accepts HDR10 as input.
It accepts the following parameters:
@table @option
@item format
Specify the output pixel format.
Currently supported formats are:
@table @var
@item p010
@item nv12
@end table
Default is nv12.
@item primaries, p
Set the output color primaries.
Default is same as input.
@item transfer, t
Set the output transfer characteristics.
Default is bt709.
@item matrix, m
Set the output colorspace matrix.
Default is same as input.
@end table
@subsection Example
@itemize
@item
Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
@example
tonemap_vaapi=format=p010:t=bt2020-10
@end example
@end itemize
@c man end VAAPI VIDEO FILTERS
@chapter Video Sources
@c man begin VIDEO SOURCES
@ -21076,9 +21357,9 @@ Specify the frame rate expected for the video stream.
The sample (pixel) aspect ratio of the input video.
@item sws_param
Specify the optional parameters to be used for the scale filter which
is automatically inserted when an input change is detected in the
input size or format.
This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
to the filtergraph description to specify swscale flags for automatically
inserted scalers. See @ref{Filtergraph syntax}.
@item hw_frames_ctx
When using a hardware pixel format, this should be a reference to an
@ -21103,7 +21384,7 @@ buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
Alternatively, the options can be specified as a flat string, but this
syntax is deprecated:
@var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}[:@var{sws_param}]
@var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
@section cellauto
@ -22516,6 +22797,9 @@ plain filename any writable url can be specified. Filename ``-'' is a shorthand
for standard output. If @code{file} option is not set, output is written to the log
with AV_LOG_INFO loglevel.
@item direct
Reduces buffering in print mode when output is written to a URL set using @var{file}.
@end table
@subsection Examples

View File

@ -814,11 +814,13 @@ following image formats are supported:
@item Autodesk RLE @tab @tab X
@tab fourcc: AASC
@item AV1 @tab E @tab E
@tab Supported through external libraries libaom and libdav1d
@tab Supported through external libraries libaom, libdav1d and librav1e
@item Avid 1:1 10-bit RGB Packer @tab X @tab X
@tab fourcc: AVrp
@item AVS (Audio Video Standard) video @tab @tab X
@tab Video encoding used by the Creature Shock game.
@item AVS2-P2/IEEE1857.4 @tab E @tab E
@tab Supported through external libraries libxavs2 and libdavs2
@item AYUV @tab X @tab X
@tab Microsoft uncompressed packed 4:4:4:4
@item Beam Software VB @tab @tab X

View File

@ -277,8 +277,8 @@ audio track.
@item list_devices
If set to @option{true}, print a list of devices and exit.
Defaults to @option{false}. Alternatively you can use the @code{-sources}
option of ffmpeg to list the available input devices.
Defaults to @option{false}. This option is deprecated, please use the
@code{-sources} option of ffmpeg to list the available input devices.
@item list_formats
If set to @option{true}, print a list of supported formats and exit.
@ -292,11 +292,6 @@ as @option{pal} (3 letters).
Default behavior is autodetection of the input video format, if the hardware
supports it.
@item bm_v210
This is a deprecated option, you can use @option{raw_format} instead.
If set to @samp{1}, video is captured in 10 bit v210 instead
of uyvy422. Not all Blackmagic devices support this option.
@item raw_format
Set the pixel format of the captured video.
Available values are:
@ -412,7 +407,7 @@ Defaults to @option{false}.
@item
List input devices:
@example
ffmpeg -f decklink -list_devices 1 -i dummy
ffmpeg -sources decklink
@end example
@item
@ -430,7 +425,7 @@ ffmpeg -format_code Hi50 -f decklink -i 'Intensity Pro' -c:a copy -c:v copy outp
@item
Capture video clip at 1080i50 10 bit:
@example
ffmpeg -bm_v210 1 -format_code Hi50 -f decklink -i 'UltraStudio Mini Recorder' -c:a copy -c:v copy output.avi
ffmpeg -raw_format yuv422p10 -format_code Hi50 -f decklink -i 'UltraStudio Mini Recorder' -c:a copy -c:v copy output.avi
@end example
@item
@ -1532,7 +1527,7 @@ ffmpeg -f x11grab -follow_mouse centered -show_region 1 -framerate 25 -video_siz
@end example
@item video_size
Set the video frame size. Default value is @code{vga}.
Set the video frame size. Default is the full desktop.
@item grab_x
@item grab_y

View File

@ -236,8 +236,10 @@ This is a deprecated option to set the segment length in microseconds, use @var{
@item seg_duration @var{duration}
Set the segment length in seconds (fractional value can be set). The value is
treated as average segment duration when @var{use_template} is enabled and
@var{use_timeline} is disabled and as minimum segment duration for all the other
use cases.
@item frag_duration @var{duration}
Set the length in seconds of fragments within segments (fractional value can be set).
@item frag_type @var{type}
Set the type of interval for fragmentation.
@item window_size @var{size}
Set the maximum number of segments kept in the manifest.
@item extra_window_size @var{size}
@ -278,9 +280,12 @@ To map all video (or audio) streams to an AdaptationSet, "v" (or "a") can be use
When no assignment is defined, this defaults to an AdaptationSet for each stream.
Optional syntax is "id=x,descriptor=descriptor_string,streams=a,b,c id=y,streams=d,e" and so on, descriptor is useful to the scheme defined by ISO/IEC 23009-1:2014/Amd.2:2015.
Optional syntax is "id=x,seg_duration=x,frag_duration=x,frag_type=type,descriptor=descriptor_string,streams=a,b,c id=y,seg_duration=y,frag_type=type,streams=d,e" and so on,
descriptor is useful to the scheme defined by ISO/IEC 23009-1:2014/Amd.2:2015.
For example, -adaptation_sets "id=0,descriptor=<SupplementalProperty schemeIdUri=\"urn:mpeg:dash:srd:2014\" value=\"0,0,0,1,1,2,2\"/>,streams=v".
Please note that descriptor string should be a self-closing xml tag.
seg_duration, frag_duration and frag_type override the global option values for each adaptation set.
For example, -adaptation_sets "id=0,seg_duration=2,frag_duration=1,frag_type=duration,streams=v id=1,seg_duration=2,frag_type=none,streams=a"
@item timeout @var{timeout}
Set timeout for socket I/O operations. Applicable only for HTTP output.
@item index_correction @var{index_correction}
@ -326,9 +331,26 @@ This option will also try to comply with the above open spec, till Apple's spec
Applicable only when @var{streaming} and @var{hls_playlist} options are enabled.
This is an experimental feature.
@item ldash @var{ldash}
Enable Low-latency Dash by constraining the presence and values of some elements.
@item master_m3u8_publish_rate @var{master_m3u8_publish_rate}
Publish master playlist repeatedly every after specified number of segment intervals.
@item -write_prft @var{write_prft}
Write Producer Reference Time elements on supported streams. This also enables writing
prft boxes in the underlying muxer. Applicable only when the @var{utc_url} option is enabled.
@item -mpd_profile @var{mpd_profile}
Set one or more manifest profiles.
@item -http_opts @var{http_opts}
List of options to pass to the underlying HTTP protocol. Applicable only for HTTP output.
@item -target_latency @var{target_latency}
Set an intended target latency in seconds (fractional value can be set) for serving. Applicable only when @var{streaming} and @var{write_prft} options are enabled.
This is an informative fields clients can use to measure the latency of the service.
@end table
@anchor{framecrc}
@ -1169,6 +1191,32 @@ The pattern "img%%-%d.jpg" will specify a sequence of filenames of the
form @file{img%-1.jpg}, @file{img%-2.jpg}, ..., @file{img%-10.jpg},
etc.
The image muxer supports the .Y.U.V image file format. This format is
special in that that each image frame consists of three files, for
each of the YUV420P components. To read or write this image file format,
specify the name of the '.Y' file. The muxer will automatically open the
'.U' and '.V' files as required.
@subsection Options
@table @option
@item frame_pts
If set to 1, expand the filename with pts from pkt->pts.
Default value is 0.
@item start_number
Start the sequence from the specified number. Default value is 1.
@item update
If set to 1, the filename will always be interpreted as just a
filename, not a pattern, and the corresponding file will be continuously
overwritten with new images. Default value is 0.
@item strftime
If set to 1, expand the filename with date and time information from
@code{strftime()}. Default value is 0.
@end table
@subsection Examples
The following example shows how to use @command{ffmpeg} for creating a
@ -1209,32 +1257,6 @@ You can set the file name with current frame's PTS:
ffmpeg -f v4l2 -r 1 -i /dev/video0 -copyts -f image2 -frame_pts true %d.jpg"
@end example
@subsection Options
@table @option
@item frame_pts
If set to 1, expand the filename with pts from pkt->pts.
Default value is 0.
@item start_number
Start the sequence from the specified number. Default value is 1.
@item update
If set to 1, the filename will always be interpreted as just a
filename, not a pattern, and the corresponding file will be continuously
overwritten with new images. Default value is 0.
@item strftime
If set to 1, expand the filename with date and time information from
@code{strftime()}. Default value is 0.
@end table
The image muxer supports the .Y.U.V image file format. This format is
special in that that each image frame consists of three files, for
each of the YUV420P components. To read or write this image file format,
specify the name of the '.Y' file. The muxer will automatically open the
'.U' and '.V' files as required.
@section matroska
Matroska container muxer.

View File

@ -140,8 +140,8 @@ device with @command{-list_formats 1}. Audio sample rate is always 48 kHz.
@item list_devices
If set to @option{true}, print a list of devices and exit.
Defaults to @option{false}. Alternatively you can use the @code{-sinks}
option of ffmpeg to list the available output devices.
Defaults to @option{false}. This option is deprecated, please use the
@code{-sinks} option of ffmpeg to list the available output devices.
@item list_formats
If set to @option{true}, print a list of supported formats and exit.
@ -168,7 +168,7 @@ Defaults to @samp{unset}.
@item
List output devices:
@example
ffmpeg -i test.avi -f decklink -list_devices 1 dummy
ffmpeg -sinks decklink
@end example
@item

View File

@ -119,7 +119,7 @@ static void log_callback_report(void *ptr, int level, const char *fmt, va_list v
void init_dynload(void)
{
#ifdef _WIN32
#if HAVE_SETDLLDIRECTORY && defined(_WIN32)
/* Calling SetDllDirectory with the empty string (but not NULL) removes the
* current working directory from the DLL search path as a security pre-caution. */
SetDllDirectory("");
@ -182,7 +182,7 @@ void show_help_options(const OptionDef *options, const char *msg, int req_flags,
first = 1;
for (po = options; po->name; po++) {
char buf[64];
char buf[128];
if (((po->flags & req_flags) != req_flags) ||
(alt_flags && !(po->flags & alt_flags)) ||
@ -2039,7 +2039,7 @@ FILE *get_preset_file(char *filename, size_t filename_size,
av_strlcpy(filename, preset_name, filename_size);
f = fopen(filename, "r");
} else {
#ifdef _WIN32
#if HAVE_GETMODULEHANDLE && defined(_WIN32)
char datadir[MAX_PATH], *ls;
base[2] = NULL;

View File

@ -1268,7 +1268,8 @@ static void do_video_out(OutputFile *of,
ost->forced_keyframes_expr_const_values[FKF_N] += 1;
} else if ( ost->forced_keyframes
&& !strncmp(ost->forced_keyframes, "source", 6)
&& in_picture->key_frame==1) {
&& in_picture->key_frame==1
&& !i) {
forced_keyframe = 1;
}
@ -3404,10 +3405,6 @@ static int init_output_stream_encode(OutputStream *ost)
av_log(oc, AV_LOG_WARNING, "Frame rate very high for a muxer not efficiently supporting it.\n"
"Please consider specifying a lower framerate, a different muxer or -vsync 2\n");
}
for (j = 0; j < ost->forced_kf_count; j++)
ost->forced_kf_pts[j] = av_rescale_q(ost->forced_kf_pts[j],
AV_TIME_BASE_Q,
enc_ctx->time_base);
enc_ctx->width = av_buffersink_get_w(ost->filter->filter);
enc_ctx->height = av_buffersink_get_h(ost->filter->filter);
@ -3599,12 +3596,14 @@ static int init_output_stream(OutputStream *ost, char *error, int error_len)
int i;
for (i = 0; i < ist->st->nb_side_data; i++) {
AVPacketSideData *sd = &ist->st->side_data[i];
uint8_t *dst = av_stream_new_side_data(ost->st, sd->type, sd->size);
if (!dst)
return AVERROR(ENOMEM);
memcpy(dst, sd->data, sd->size);
if (ist->autorotate && sd->type == AV_PKT_DATA_DISPLAYMATRIX)
av_display_rotation_set((uint32_t *)dst, 0);
if (sd->type != AV_PKT_DATA_CPB_PROPERTIES) {
uint8_t *dst = av_stream_new_side_data(ost->st, sd->type, sd->size);
if (!dst)
return AVERROR(ENOMEM);
memcpy(dst, sd->data, sd->size);
if (ist->autorotate && sd->type == AV_PKT_DATA_DISPLAYMATRIX)
av_display_rotation_set((uint32_t *)dst, 0);
}
}
}

View File

@ -786,10 +786,9 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
av_bprint_init(&args, 0, AV_BPRINT_SIZE_AUTOMATIC);
av_bprintf(&args,
"video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:"
"pixel_aspect=%d/%d:sws_param=flags=%d",
"pixel_aspect=%d/%d",
ifilter->width, ifilter->height, ifilter->format,
tb.num, tb.den, sar.num, sar.den,
SWS_BILINEAR + ((ist->dec_ctx->flags&AV_CODEC_FLAG_BITEXACT) ? SWS_BITEXACT:0));
tb.num, tb.den, sar.num, sar.den);
if (fr.num && fr.den)
av_bprintf(&args, ":frame_rate=%d/%d", fr.num, fr.den);
snprintf(name, sizeof(name), "graph %d input from stream %d:%d", fg->index,

View File

@ -3202,7 +3202,7 @@ void show_help_default(const char *opt, const char *arg)
OPT_EXIT, 0, 0);
show_help_options(options, "Global options (affect whole program "
"instead of just one file:",
"instead of just one file):",
0, per_file | OPT_EXIT | OPT_EXPERT, 0);
if (show_advanced)
show_help_options(options, "Advanced global options:", OPT_EXPERT,

View File

@ -254,6 +254,7 @@ static const OptionDef *options;
/* FFprobe context */
static const char *input_filename;
static const char *print_input_filename;
static AVInputFormat *iformat = NULL;
static struct AVHashContext *hash;
@ -2836,7 +2837,8 @@ static void show_error(WriterContext *w, int err)
writer_print_section_footer(w);
}
static int open_input_file(InputFile *ifile, const char *filename)
static int open_input_file(InputFile *ifile, const char *filename,
const char *print_filename)
{
int err, i;
AVFormatContext *fmt_ctx = NULL;
@ -2858,6 +2860,10 @@ static int open_input_file(InputFile *ifile, const char *filename)
print_error(filename, err);
return err;
}
if (print_filename) {
av_freep(&fmt_ctx->url);
fmt_ctx->url = av_strdup(print_filename);
}
ifile->fmt_ctx = fmt_ctx;
if (scan_all_pmts_set)
av_dict_set(&format_opts, "scan_all_pmts", NULL, AV_DICT_MATCH_CASE);
@ -2971,7 +2977,8 @@ static void close_input_file(InputFile *ifile)
avformat_close_input(&ifile->fmt_ctx);
}
static int probe_file(WriterContext *wctx, const char *filename)
static int probe_file(WriterContext *wctx, const char *filename,
const char *print_filename)
{
InputFile ifile = { 0 };
int ret, i;
@ -2980,7 +2987,7 @@ static int probe_file(WriterContext *wctx, const char *filename)
do_read_frames = do_show_frames || do_count_frames;
do_read_packets = do_show_packets || do_count_packets;
ret = open_input_file(&ifile, filename);
ret = open_input_file(&ifile, filename, print_filename);
if (ret < 0)
goto end;
@ -3286,6 +3293,12 @@ static int opt_input_file_i(void *optctx, const char *opt, const char *arg)
return 0;
}
static int opt_print_filename(void *optctx, const char *opt, const char *arg)
{
print_input_filename = arg;
return 0;
}
void show_help_default(const char *opt, const char *arg)
{
av_log_set_callback(log_callback_help);
@ -3544,6 +3557,7 @@ static const OptionDef real_options[] = {
{ "read_intervals", HAS_ARG, {.func_arg = opt_read_intervals}, "set read intervals", "read_intervals" },
{ "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {.func_arg = opt_default}, "generic catch all option", "" },
{ "i", HAS_ARG, {.func_arg = opt_input_file_i}, "read specified file", "input_file"},
{ "print_filename", HAS_ARG, {.func_arg = opt_print_filename}, "override the printed input filename", "print_file"},
{ "find_stream_info", OPT_BOOL | OPT_INPUT | OPT_EXPERT, { &find_stream_info },
"read and decode the streams to fill missing information with heuristics" },
{ NULL, },
@ -3692,7 +3706,7 @@ int main(int argc, char **argv)
av_log(NULL, AV_LOG_ERROR, "Use -h to get full help or, even better, run 'man %s'.\n", program_name);
ret = AVERROR(EINVAL);
} else if (input_filename) {
ret = probe_file(wctx, input_filename);
ret = probe_file(wctx, input_filename, print_input_filename);
if (ret < 0 && do_show_error)
show_error(wctx, ret);
}

View File

@ -140,8 +140,8 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
break;
case AV_CODEC_ID_ADPCM_IMA_APC:
if (avctx->extradata && avctx->extradata_size >= 8) {
c->status[0].predictor = AV_RL32(avctx->extradata);
c->status[1].predictor = AV_RL32(avctx->extradata + 4);
c->status[0].predictor = av_clip_intp2(AV_RL32(avctx->extradata ), 18);
c->status[1].predictor = av_clip_intp2(AV_RL32(avctx->extradata + 4), 18);
}
break;
case AV_CODEC_ID_ADPCM_IMA_WS:
@ -441,7 +441,7 @@ static int xa_decode(AVCodecContext *avctx, int16_t *out0, int16_t *out1,
d = in[16+i+j*4];
t = sign_extend(d, 4);
s = ( t<<shift ) + ((s_1*f0 + s_2*f1+32)>>6);
s = t*(1<<shift) + ((s_1*f0 + s_2*f1+32)>>6);
s_2 = s_1;
s_1 = av_clip_int16(s);
out0[j] = s_1;
@ -468,7 +468,7 @@ static int xa_decode(AVCodecContext *avctx, int16_t *out0, int16_t *out1,
d = in[16+i+j*4];
t = sign_extend(d >> 4, 4);
s = ( t<<shift ) + ((s_1*f0 + s_2*f1+32)>>6);
s = t*(1<<shift) + ((s_1*f0 + s_2*f1+32)>>6);
s_2 = s_1;
s_1 = av_clip_int16(s);
out1[j] = s_1;
@ -1233,7 +1233,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
}
for (i=0; i<=st; i++) {
c->status[i].predictor = bytestream2_get_le32u(&gb);
if (FFABS(c->status[i].predictor) > (1<<16))
if (FFABS((int64_t)c->status[i].predictor) > (1<<16))
return AVERROR_INVALIDDATA;
}

View File

@ -423,8 +423,8 @@ static int decode_inter_plane(AGMContext *s, GetBitContext *gb, int size,
int map = s->map[x];
if (orig_mv_x >= -32) {
if (y * 8 + mv_y < 0 || y * 8 + mv_y >= h ||
x * 8 + mv_x < 0 || x * 8 + mv_x >= w)
if (y * 8 + mv_y < 0 || y * 8 + mv_y + 8 >= h ||
x * 8 + mv_x < 0 || x * 8 + mv_x + 8 >= w)
return AVERROR_INVALIDDATA;
copy_block8(frame->data[plane] + (s->blocks_h - 1 - y) * 8 * frame->linesize[plane] + x * 8,

View File

@ -228,7 +228,7 @@ static void lpc_prediction(int32_t *error_buffer, uint32_t *buffer_out,
sign = sign_only(val) * error_sign;
lpc_coefs[j] -= sign;
val *= (unsigned)sign;
error_val -= (val >> lpc_quant) * (j + 1);
error_val -= (val >> lpc_quant) * (j + 1U);
}
}
}

View File

@ -776,6 +776,7 @@ extern AVCodec ff_mpeg2_qsv_encoder;
extern AVCodec ff_mpeg2_vaapi_encoder;
extern AVCodec ff_mpeg4_cuvid_decoder;
extern AVCodec ff_mpeg4_mediacodec_decoder;
extern AVCodec ff_mpeg4_omx_encoder;
extern AVCodec ff_mpeg4_v4l2m2m_encoder;
extern AVCodec ff_vc1_cuvid_decoder;
extern AVCodec ff_vp8_cuvid_decoder;

View File

@ -496,6 +496,7 @@ static inline int ape_decode_value_3860(APEContext *ctx, GetBitContext *gb,
x = (overflow << rice->k) + get_bits(gb, rice->k);
} else {
av_log(ctx->avctx, AV_LOG_ERROR, "Too many bits: %"PRIu32"\n", rice->k);
ctx->error = 1;
return AVERROR_INVALIDDATA;
}
rice->ksum += x - (rice->ksum + 8 >> 4);

View File

@ -105,7 +105,7 @@ int ff_ass_add_rect(AVSubtitle *sub, const char *dialog,
char *ass_str;
AVSubtitleRect **rects;
rects = av_realloc_array(sub->rects, (sub->num_rects+1), sizeof(*sub->rects));
rects = av_realloc_array(sub->rects, sub->num_rects+1, sizeof(*sub->rects));
if (!rects)
return AVERROR(ENOMEM);
sub->rects = rects;

View File

@ -223,8 +223,18 @@ static inline int parse_band_ext(ATRAC9Context *s, ATRAC9BlockData *b,
b->channel[0].band_ext = get_bits(gb, 2);
b->channel[0].band_ext = ext_band > 2 ? b->channel[0].band_ext : 4;
if (!get_bits(gb, 5))
if (!get_bits(gb, 5)) {
for (int i = 0; i <= stereo; i++) {
ATRAC9ChannelData *c = &b->channel[i];
const int count = at9_tab_band_ext_cnt[c->band_ext][ext_band];
for (int j = 0; j < count; j++) {
int len = at9_tab_band_ext_lengths[c->band_ext][ext_band][j];
c->band_ext_data[j] = av_clip_uintp2_c(c->band_ext_data[j], len);
}
}
return 0;
}
for (int i = 0; i <= stereo; i++) {
ATRAC9ChannelData *c = &b->channel[i];

View File

@ -656,6 +656,7 @@ enum AVCodecID {
AV_CODEC_ID_ATRAC9,
AV_CODEC_ID_HCOM,
AV_CODEC_ID_ACELP_KELVIN,
AV_CODEC_ID_MPEGH_3D_AUDIO,
/* subtitle codecs */
AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.
@ -1175,6 +1176,11 @@ typedef struct AVCPBProperties {
uint64_t vbv_delay;
} AVCPBProperties;
typedef struct AVProducerReferenceTime {
int64_t wallclock;
int flags;
} AVProducerReferenceTime;
/**
* The decoder will keep a reference to the frame and may reuse it later.
*/
@ -1409,6 +1415,11 @@ enum AVPacketSideDataType {
*/
AV_PKT_DATA_AFD,
/**
* Producer Reference Time data corresponding to the AVProducerReferenceTime struct.
*/
AV_PKT_DATA_PRFT,
/**
* The number of side data types.
* This is not part of the public API/ABI in the sense that it may

View File

@ -741,3 +741,25 @@ int ff_side_data_set_encoder_stats(AVPacket *pkt, int quality, int64_t *error, i
return 0;
}
int ff_side_data_set_prft(AVPacket *pkt, int64_t timestamp)
{
AVProducerReferenceTime *prft;
uint8_t *side_data;
int side_data_size;
side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_PRFT, &side_data_size);
if (!side_data) {
side_data_size = sizeof(AVProducerReferenceTime);
side_data = av_packet_new_side_data(pkt, AV_PKT_DATA_PRFT, side_data_size);
}
if (!side_data || side_data_size < sizeof(AVProducerReferenceTime))
return AVERROR(ENOMEM);
prft = (AVProducerReferenceTime *)side_data;
prft->wallclock = timestamp;
prft->flags = 0;
return 0;
}

View File

@ -493,7 +493,7 @@ int ff_bgmc_decode_init(GetBitContext *gb, unsigned int *h,
*h = TOP_VALUE;
*l = 0;
*v = get_bits_long(gb, VALUE_BITS);
*v = get_bits(gb, VALUE_BITS);
return 0;
}

View File

@ -153,7 +153,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
static float get_float(GetBitContext *gb)
{
int power = get_bits(gb, 5);
float f = ldexpf(get_bits_long(gb, 23), power - 23);
float f = ldexpf(get_bits(gb, 23), power - 23);
if (get_bits1(gb))
f = -f;
return f;

View File

@ -82,6 +82,7 @@ const AVClass *av_bsf_get_class(void)
int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **pctx)
{
AVBSFContext *ctx;
AVBSFInternal *bsfi;
int ret;
ctx = av_mallocz(sizeof(*ctx));
@ -98,14 +99,15 @@ int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **pctx)
goto fail;
}
ctx->internal = av_mallocz(sizeof(*ctx->internal));
if (!ctx->internal) {
bsfi = av_mallocz(sizeof(*bsfi));
if (!bsfi) {
ret = AVERROR(ENOMEM);
goto fail;
}
ctx->internal = bsfi;
ctx->internal->buffer_pkt = av_packet_alloc();
if (!ctx->internal->buffer_pkt) {
bsfi->buffer_pkt = av_packet_alloc();
if (!bsfi->buffer_pkt) {
ret = AVERROR(ENOMEM);
goto fail;
}
@ -175,9 +177,11 @@ int av_bsf_init(AVBSFContext *ctx)
void av_bsf_flush(AVBSFContext *ctx)
{
ctx->internal->eof = 0;
AVBSFInternal *bsfi = ctx->internal;
av_packet_unref(ctx->internal->buffer_pkt);
bsfi->eof = 0;
av_packet_unref(bsfi->buffer_pkt);
if (ctx->filter->flush)
ctx->filter->flush(ctx);
@ -185,26 +189,27 @@ void av_bsf_flush(AVBSFContext *ctx)
int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
{
AVBSFInternal *bsfi = ctx->internal;
int ret;
if (!pkt || (!pkt->data && !pkt->side_data_elems)) {
ctx->internal->eof = 1;
bsfi->eof = 1;
return 0;
}
if (ctx->internal->eof) {
if (bsfi->eof) {
av_log(ctx, AV_LOG_ERROR, "A non-NULL packet sent after an EOF.\n");
return AVERROR(EINVAL);
}
if (ctx->internal->buffer_pkt->data ||
ctx->internal->buffer_pkt->side_data_elems)
if (bsfi->buffer_pkt->data ||
bsfi->buffer_pkt->side_data_elems)
return AVERROR(EAGAIN);
ret = av_packet_make_refcounted(pkt);
if (ret < 0)
return ret;
av_packet_move_ref(ctx->internal->buffer_pkt, pkt);
av_packet_move_ref(bsfi->buffer_pkt, pkt);
return 0;
}
@ -216,38 +221,38 @@ int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt)
int ff_bsf_get_packet(AVBSFContext *ctx, AVPacket **pkt)
{
AVBSFInternal *in = ctx->internal;
AVBSFInternal *bsfi = ctx->internal;
AVPacket *tmp_pkt;
if (in->eof)
if (bsfi->eof)
return AVERROR_EOF;
if (!ctx->internal->buffer_pkt->data &&
!ctx->internal->buffer_pkt->side_data_elems)
if (!bsfi->buffer_pkt->data &&
!bsfi->buffer_pkt->side_data_elems)
return AVERROR(EAGAIN);
tmp_pkt = av_packet_alloc();
if (!tmp_pkt)
return AVERROR(ENOMEM);
*pkt = ctx->internal->buffer_pkt;
ctx->internal->buffer_pkt = tmp_pkt;
*pkt = bsfi->buffer_pkt;
bsfi->buffer_pkt = tmp_pkt;
return 0;
}
int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt)
{
AVBSFInternal *in = ctx->internal;
AVBSFInternal *bsfi = ctx->internal;
if (in->eof)
if (bsfi->eof)
return AVERROR_EOF;
if (!ctx->internal->buffer_pkt->data &&
!ctx->internal->buffer_pkt->side_data_elems)
if (!bsfi->buffer_pkt->data &&
!bsfi->buffer_pkt->side_data_elems)
return AVERROR(EAGAIN);
av_packet_move_ref(pkt, ctx->internal->buffer_pkt);
av_packet_move_ref(pkt, bsfi->buffer_pkt);
return 0;
}
@ -517,8 +522,8 @@ static int bsf_parse_single(const char *str, AVBSFList *bsf_lst)
ret = av_bsf_list_append2(bsf_lst, bsf_name, &bsf_options);
av_dict_free(&bsf_options);
end:
av_dict_free(&bsf_options);
av_free(buf);
return ret;
}

View File

@ -105,7 +105,7 @@ typedef struct AV1RawSequenceHeader {
uint8_t use_128x128_superblock;
uint8_t enable_filter_intra;
uint8_t enable_intra_edge_filter;
uint8_t enable_intraintra_compound;
uint8_t enable_interintra_compound;
uint8_t enable_masked_compound;
uint8_t enable_warped_motion;
uint8_t enable_dual_filter;
@ -256,20 +256,20 @@ typedef struct AV1RawFrameHeader {
uint8_t update_grain;
uint8_t film_grain_params_ref_idx;
uint8_t num_y_points;
uint8_t point_y_value[16];
uint8_t point_y_scaling[16];
uint8_t point_y_value[14];
uint8_t point_y_scaling[14];
uint8_t chroma_scaling_from_luma;
uint8_t num_cb_points;
uint8_t point_cb_value[16];
uint8_t point_cb_scaling[16];
uint8_t point_cb_value[10];
uint8_t point_cb_scaling[10];
uint8_t num_cr_points;
uint8_t point_cr_value[16];
uint8_t point_cr_scaling[16];
uint8_t point_cr_value[10];
uint8_t point_cr_scaling[10];
uint8_t grain_scaling_minus_8;
uint8_t ar_coeff_lag;
uint8_t ar_coeffs_y_plus_128[24];
uint8_t ar_coeffs_cb_plus_128[24];
uint8_t ar_coeffs_cr_plus_128[24];
uint8_t ar_coeffs_cb_plus_128[25];
uint8_t ar_coeffs_cr_plus_128[25];
uint8_t ar_coeff_shift_minus_6;
uint8_t grain_scale_shift;
uint8_t cb_mult;

View File

@ -268,7 +268,7 @@ static int FUNC(sequence_header_obu)(CodedBitstreamContext *ctx, RWContext *rw,
flag(enable_intra_edge_filter);
if (current->reduced_still_picture_header) {
infer(enable_intraintra_compound, 0);
infer(enable_interintra_compound, 0);
infer(enable_masked_compound, 0);
infer(enable_warped_motion, 0);
infer(enable_dual_filter, 0);
@ -281,7 +281,7 @@ static int FUNC(sequence_header_obu)(CodedBitstreamContext *ctx, RWContext *rw,
infer(seq_force_integer_mv,
AV1_SELECT_INTEGER_MV);
} else {
flag(enable_intraintra_compound);
flag(enable_interintra_compound);
flag(enable_masked_compound);
flag(enable_warped_motion);
flag(enable_dual_filter);
@ -1155,7 +1155,7 @@ static int FUNC(film_grain_params)(CodedBitstreamContext *ctx, RWContext *rw,
return 0;
}
fb(4, num_y_points);
fc(4, num_y_points, 0, 14);
for (i = 0; i < current->num_y_points; i++) {
fbs(8, point_y_value[i], 1, i);
fbs(8, point_y_scaling[i], 1, i);
@ -1174,12 +1174,12 @@ static int FUNC(film_grain_params)(CodedBitstreamContext *ctx, RWContext *rw,
infer(num_cb_points, 0);
infer(num_cr_points, 0);
} else {
fb(4, num_cb_points);
fc(4, num_cb_points, 0, 10);
for (i = 0; i < current->num_cb_points; i++) {
fbs(8, point_cb_value[i], 1, i);
fbs(8, point_cb_scaling[i], 1, i);
}
fb(4, num_cr_points);
fc(4, num_cr_points, 0, 10);
for (i = 0; i < current->num_cr_points; i++) {
fbs(8, point_cr_value[i], 1, i);
fbs(8, point_cr_scaling[i], 1, i);

View File

@ -568,7 +568,10 @@ static int cbs_h2645_fragment_add_nals(CodedBitstreamContext *ctx,
// Remove trailing zeroes.
while (size > 0 && nal->data[size - 1] == 0)
--size;
av_assert0(size > 0);
if (size == 0) {
av_log(ctx->log_ctx, AV_LOG_VERBOSE, "Discarding empty 0 NAL unit\n");
continue;
}
ref = (nal->data == nal->raw_data) ? frag->data_ref
: packet->rbsp.rbsp_buffer_ref;

View File

@ -954,6 +954,7 @@ static int FUNC(sei)(CodedBitstreamContext *ctx, RWContext *rw,
current->payload[k].payload_type = payload_type;
current->payload[k].payload_size = payload_size;
current->payload_count++;
CHECK(FUNC(sei_payload)(ctx, rw, &current->payload[k]));
if (!cbs_h2645_read_more_rbsp_data(rw))
@ -964,7 +965,6 @@ static int FUNC(sei)(CodedBitstreamContext *ctx, RWContext *rw,
"SEI message: found %d.\n", k);
return AVERROR_INVALIDDATA;
}
current->payload_count = k + 1;
#else
for (k = 0; k < current->payload_count; k++) {
PutBitContext start_state;

View File

@ -2184,6 +2184,7 @@ static int FUNC(sei)(CodedBitstreamContext *ctx, RWContext *rw,
current->payload[k].payload_type = payload_type;
current->payload[k].payload_size = payload_size;
current->payload_count++;
CHECK(FUNC(sei_payload)(ctx, rw, &current->payload[k], prefix));
if (!cbs_h2645_read_more_rbsp_data(rw))
@ -2194,7 +2195,6 @@ static int FUNC(sei)(CodedBitstreamContext *ctx, RWContext *rw,
"SEI message: found %d.\n", k);
return AVERROR_INVALIDDATA;
}
current->payload_count = k + 1;
#else
for (k = 0; k < current->payload_count; k++) {
PutBitContext start_state;

View File

@ -416,6 +416,9 @@ static int cbs_vp9_split_fragment(CodedBitstreamContext *ctx,
uint8_t superframe_header;
int err;
if (frag->data_size == 0)
return AVERROR_INVALIDDATA;
// Last byte in the packet.
superframe_header = frag->data[frag->data_size - 1];
@ -428,6 +431,9 @@ static int cbs_vp9_split_fragment(CodedBitstreamContext *ctx,
index_size = 2 + (((superframe_header & 0x18) >> 3) + 1) *
((superframe_header & 0x07) + 1);
if (index_size > frag->data_size)
return AVERROR_INVALIDDATA;
err = init_get_bits(&gbc, frag->data + frag->data_size - index_size,
8 * index_size);
if (err < 0)

File diff suppressed because it is too large Load Diff

View File

@ -759,7 +759,7 @@ static int decouple_info(COOKContext *q, COOKSubpacket *p, int *decouple_tab)
for (i = 0; i < length; i++)
decouple_tab[start + i] = get_vlc2(&q->gb,
p->channel_coupling.table,
p->channel_coupling.bits, 2);
p->channel_coupling.bits, 3);
else
for (i = 0; i < length; i++) {
int v = get_bits(&q->gb, p->js_vlc_bits);

View File

@ -479,32 +479,32 @@ static int decode_simple_internal(AVCodecContext *avctx, AVFrame *frame)
side= av_packet_get_side_data(avci->last_pkt_props, AV_PKT_DATA_SKIP_SAMPLES, &side_size);
if(side && side_size>=10) {
avctx->internal->skip_samples = AV_RL32(side) * avctx->internal->skip_samples_multiplier;
avci->skip_samples = AV_RL32(side) * avci->skip_samples_multiplier;
discard_padding = AV_RL32(side + 4);
av_log(avctx, AV_LOG_DEBUG, "skip %d / discard %d samples due to side data\n",
avctx->internal->skip_samples, (int)discard_padding);
avci->skip_samples, (int)discard_padding);
skip_reason = AV_RL8(side + 8);
discard_reason = AV_RL8(side + 9);
}
if ((frame->flags & AV_FRAME_FLAG_DISCARD) && got_frame &&
!(avctx->flags2 & AV_CODEC_FLAG2_SKIP_MANUAL)) {
avctx->internal->skip_samples = FFMAX(0, avctx->internal->skip_samples - frame->nb_samples);
avci->skip_samples = FFMAX(0, avci->skip_samples - frame->nb_samples);
got_frame = 0;
}
if (avctx->internal->skip_samples > 0 && got_frame &&
if (avci->skip_samples > 0 && got_frame &&
!(avctx->flags2 & AV_CODEC_FLAG2_SKIP_MANUAL)) {
if(frame->nb_samples <= avctx->internal->skip_samples){
if(frame->nb_samples <= avci->skip_samples){
got_frame = 0;
avctx->internal->skip_samples -= frame->nb_samples;
avci->skip_samples -= frame->nb_samples;
av_log(avctx, AV_LOG_DEBUG, "skip whole frame, skip left: %d\n",
avctx->internal->skip_samples);
avci->skip_samples);
} else {
av_samples_copy(frame->extended_data, frame->extended_data, 0, avctx->internal->skip_samples,
frame->nb_samples - avctx->internal->skip_samples, avctx->channels, frame->format);
av_samples_copy(frame->extended_data, frame->extended_data, 0, avci->skip_samples,
frame->nb_samples - avci->skip_samples, avctx->channels, frame->format);
if(avctx->pkt_timebase.num && avctx->sample_rate) {
int64_t diff_ts = av_rescale_q(avctx->internal->skip_samples,
int64_t diff_ts = av_rescale_q(avci->skip_samples,
(AVRational){1, avctx->sample_rate},
avctx->pkt_timebase);
if(frame->pts!=AV_NOPTS_VALUE)
@ -523,9 +523,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
av_log(avctx, AV_LOG_WARNING, "Could not update timestamps for skipped samples.\n");
}
av_log(avctx, AV_LOG_DEBUG, "skip %d/%d samples\n",
avctx->internal->skip_samples, frame->nb_samples);
frame->nb_samples -= avctx->internal->skip_samples;
avctx->internal->skip_samples = 0;
avci->skip_samples, frame->nb_samples);
frame->nb_samples -= avci->skip_samples;
avci->skip_samples = 0;
}
}
@ -551,11 +551,11 @@ FF_ENABLE_DEPRECATION_WARNINGS
if ((avctx->flags2 & AV_CODEC_FLAG2_SKIP_MANUAL) && got_frame) {
AVFrameSideData *fside = av_frame_new_side_data(frame, AV_FRAME_DATA_SKIP_SAMPLES, 10);
if (fside) {
AV_WL32(fside->data, avctx->internal->skip_samples);
AV_WL32(fside->data, avci->skip_samples);
AV_WL32(fside->data + 4, discard_padding);
AV_WL8(fside->data + 8, skip_reason);
AV_WL8(fside->data + 9, discard_reason);
avctx->internal->skip_samples = 0;
avci->skip_samples = 0;
}
}
}
@ -580,7 +580,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
/* do not stop draining when actual_got_frame != 0 or ret < 0 */
/* got_frame == 0 but actual_got_frame != 0 when frame is discarded */
if (avctx->internal->draining && !actual_got_frame) {
if (avci->draining && !actual_got_frame) {
if (ret < 0) {
/* prevent infinite loop if a decoder wrongly always return error on draining */
/* reasonable nb_errors_max = maximum b frames + thread count */
@ -1925,7 +1925,7 @@ static int get_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flags)
return AVERROR(EINVAL);
}
} else if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
if (frame->nb_samples * avctx->channels > avctx->max_samples) {
if (frame->nb_samples * (int64_t)avctx->channels > avctx->max_samples) {
av_log(avctx, AV_LOG_ERROR, "samples per frame %d, exceeds max_samples %"PRId64"\n", frame->nb_samples, avctx->max_samples);
return AVERROR(EINVAL);
}
@ -2030,15 +2030,17 @@ static void bsfs_flush(AVCodecContext *avctx)
void avcodec_flush_buffers(AVCodecContext *avctx)
{
avctx->internal->draining = 0;
avctx->internal->draining_done = 0;
avctx->internal->nb_draining_errors = 0;
av_frame_unref(avctx->internal->buffer_frame);
av_frame_unref(avctx->internal->compat_decode_frame);
av_packet_unref(avctx->internal->buffer_pkt);
avctx->internal->buffer_pkt_valid = 0;
AVCodecInternal *avci = avctx->internal;
av_packet_unref(avctx->internal->ds.in_pkt);
avci->draining = 0;
avci->draining_done = 0;
avci->nb_draining_errors = 0;
av_frame_unref(avci->buffer_frame);
av_frame_unref(avci->compat_decode_frame);
av_packet_unref(avci->buffer_pkt);
avci->buffer_pkt_valid = 0;
av_packet_unref(avci->ds.in_pkt);
if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME)
ff_thread_flush(avctx);
@ -2051,7 +2053,7 @@ void avcodec_flush_buffers(AVCodecContext *avctx)
bsfs_flush(avctx);
if (!avctx->refcounted_frames)
av_frame_unref(avctx->internal->to_free);
av_frame_unref(avci->to_free);
}
void ff_decode_bsfs_uninit(AVCodecContext *avctx)

View File

@ -121,7 +121,7 @@ static int read_map(GetBitContext *gb, Table *t, unsigned int map[DST_MAX_CHANNE
static av_always_inline int get_sr_golomb_dst(GetBitContext *gb, unsigned int k)
{
int v = get_ur_golomb(gb, k, get_bits_left(gb), 0);
int v = get_ur_golomb_jpegls(gb, k, get_bits_left(gb), 0);
if (v && get_bits1(gb))
v = -v;
return v;

View File

@ -252,7 +252,7 @@ static int escape124_decode_frame(AVCodecContext *avctx,
if (i == 2) {
// This codebook can be cut off at places other than
// powers of 2, leaving some of the entries undefined.
cb_size = get_bits_long(&gb, 20);
cb_size = get_bits(&gb, 20);
if (!cb_size) {
av_log(avctx, AV_LOG_ERROR, "Invalid codebook size 0.\n");
return AVERROR_INVALIDDATA;

View File

@ -37,7 +37,7 @@ static inline int RENAME(get_context)(PlaneContext *p, TYPE *src,
const int RT = last[1];
const int L = src[-1];
if (p->quant_table[3][127]) {
if (p->quant_table[3][127] || p->quant_table[4][127]) {
const int TT = last2[0];
const int LL = src[-2];
return p->quant_table[0][(L - LT) & 0xFF] +

View File

@ -350,7 +350,8 @@ fail:
static void wavesynth_synth_sample(struct wavesynth_context *ws, int64_t ts,
int32_t *channels)
{
int32_t amp, val, *cv;
int32_t amp, *cv;
unsigned val;
struct ws_interval *in;
int i, *last, pink;
uint32_t c, all_ch = 0;

View File

@ -217,9 +217,9 @@ int ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
}
skip_bits(&gb, 24); /* skip min frame size */
s->max_framesize = get_bits_long(&gb, 24);
s->max_framesize = get_bits(&gb, 24);
s->samplerate = get_bits_long(&gb, 20);
s->samplerate = get_bits(&gb, 20);
s->channels = get_bits(&gb, 3) + 1;
s->bps = get_bits(&gb, 5) + 1;

View File

@ -30,7 +30,7 @@ int ff_flv_decode_picture_header(MpegEncContext *s)
int format, width, height;
/* picture header */
if (get_bits_long(&s->gb, 17) != 1) {
if (get_bits(&s->gb, 17) != 1) {
av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n");
return AVERROR_INVALIDDATA;
}

View File

@ -486,14 +486,14 @@ static int16_t apply_tilt_comp(int16_t* out, int16_t* res_pst, int refl_coeff,
if (refl_coeff > 0) {
gt = (refl_coeff * G729_TILT_FACTOR_PLUS + 0x4000) >> 15;
fact = 0x4000; // 0.5 in (0.15)
sh_fact = 15;
fact = 0x2000; // 0.5 in (0.15)
sh_fact = 14;
} else {
gt = (refl_coeff * G729_TILT_FACTOR_MINUS + 0x4000) >> 15;
fact = 0x800; // 0.5 in (3.12)
sh_fact = 12;
fact = 0x400; // 0.5 in (3.12)
sh_fact = 11;
}
ga = (fact << 15) / av_clip_int16(32768 - FFABS(gt));
ga = (fact << 16) / av_clip_int16(32768 - FFABS(gt));
gt >>= 1;
/* Apply tilt compensation filter to signal. */
@ -503,12 +503,12 @@ static int16_t apply_tilt_comp(int16_t* out, int16_t* res_pst, int refl_coeff,
tmp2 = (gt * res_pst[i-1]) * 2 + 0x4000;
tmp2 = res_pst[i] + (tmp2 >> 15);
tmp2 = (tmp2 * ga * 2 + fact) >> sh_fact;
tmp2 = (tmp2 * ga + fact) >> sh_fact;
out[i] = tmp2;
}
tmp2 = (gt * ht_prev_data) * 2 + 0x4000;
tmp2 = res_pst[0] + (tmp2 >> 15);
tmp2 = (tmp2 * ga * 2 + fact) >> sh_fact;
tmp2 = (tmp2 * ga + fact) >> sh_fact;
out[0] = tmp2;
return tmp;

View File

@ -313,7 +313,7 @@ static inline int get_interleaved_se_golomb(GetBitContext *gb)
} else {
int log;
skip_bits(gb, 8);
buf |= 1 | show_bits_long(gb, 24);
buf |= 1 | show_bits(gb, 24);
if ((buf & 0xAAAAAAAA) == 0)
return INVALID_VLC;

View File

@ -381,7 +381,7 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket *pkt)
} else {
goto invalid_user_data;
}
if (i & 1)
if (j & 1)
udu->uuid_iso_iec_11578[j / 2] |= v;
else
udu->uuid_iso_iec_11578[j / 2] = v << 4;

View File

@ -21,6 +21,7 @@
#include <string.h>
#include "libavutil/avassert.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
@ -68,7 +69,7 @@ static int h264_extradata_to_annexb(AVBSFContext *ctx, const int padding)
{
H264BSFContext *s = ctx->priv_data;
uint16_t unit_size;
uint64_t total_size = 0;
uint32_t total_size = 0;
uint8_t *out = NULL, unit_nb, sps_done = 0,
sps_seen = 0, pps_seen = 0;
const uint8_t *extradata = ctx->par_in->extradata + 4;
@ -91,12 +92,7 @@ static int h264_extradata_to_annexb(AVBSFContext *ctx, const int padding)
unit_size = AV_RB16(extradata);
total_size += unit_size + 4;
if (total_size > INT_MAX - padding) {
av_log(ctx, AV_LOG_ERROR,
"Too big extradata size, corrupted stream or invalid MP4/AVCC bitstream\n");
av_free(out);
return AVERROR(EINVAL);
}
av_assert1(total_size <= INT_MAX - padding);
if (extradata + 2 + unit_size > ctx->par_in->extradata + ctx->par_in->extradata_size) {
av_log(ctx, AV_LOG_ERROR, "Packet header is not contained in global extradata, "
"corrupted stream or invalid MP4/AVCC bitstream\n");

View File

@ -186,7 +186,7 @@ static inline int decode_vui_parameters(GetBitContext *gb, AVCodecContext *avctx
}
if (show_bits1(gb) && get_bits_left(gb) < 10) {
av_log(avctx, AV_LOG_WARNING, "Truncated VUI\n");
av_log(avctx, AV_LOG_WARNING, "Truncated VUI (%d)\n", get_bits_left(gb));
return 0;
}

View File

@ -247,14 +247,14 @@ static int decode_unregistered_user_data(H264SEIUnregistered *h, GetBitContext *
uint8_t *user_data;
int e, build, i;
if (size < 16 || size >= INT_MAX - 16)
if (size < 16 || size >= INT_MAX - 1)
return AVERROR_INVALIDDATA;
user_data = av_malloc(16 + size + 1);
user_data = av_malloc(size + 1);
if (!user_data)
return AVERROR(ENOMEM);
for (i = 0; i < size + 16; i++)
for (i = 0; i < size; i++)
user_data[i] = get_bits(gb, 8);
user_data[i] = 0;

View File

@ -832,8 +832,6 @@ int ff_h264_slice_context_init(H264Context *h, H264SliceContext *sl);
void ff_h264_draw_horiz_band(const H264Context *h, H264SliceContext *sl, int y, int height);
int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl,
const H2645NAL *nal);
/**
* Submit a slice for decoding.
*

View File

@ -66,7 +66,7 @@ static const int8_t num_bins_in_se[] = {
1, // no_residual_data_flag
3, // split_transform_flag
2, // cbf_luma
4, // cbf_cb, cbf_cr
5, // cbf_cb, cbf_cr
2, // transform_skip_flag[][]
2, // explicit_rdpcm_flag[][]
2, // explicit_rdpcm_dir_flag[][]
@ -122,23 +122,23 @@ static const int elem_offset[sizeof(num_bins_in_se)] = {
37, // split_transform_flag
40, // cbf_luma
42, // cbf_cb, cbf_cr
46, // transform_skip_flag[][]
48, // explicit_rdpcm_flag[][]
50, // explicit_rdpcm_dir_flag[][]
52, // last_significant_coeff_x_prefix
70, // last_significant_coeff_y_prefix
88, // last_significant_coeff_x_suffix
88, // last_significant_coeff_y_suffix
88, // significant_coeff_group_flag
92, // significant_coeff_flag
136, // coeff_abs_level_greater1_flag
160, // coeff_abs_level_greater2_flag
166, // coeff_abs_level_remaining
166, // coeff_sign_flag
166, // log2_res_scale_abs
174, // res_scale_sign_flag
176, // cu_chroma_qp_offset_flag
177, // cu_chroma_qp_offset_idx
47, // transform_skip_flag[][]
49, // explicit_rdpcm_flag[][]
51, // explicit_rdpcm_dir_flag[][]
53, // last_significant_coeff_x_prefix
71, // last_significant_coeff_y_prefix
89, // last_significant_coeff_x_suffix
89, // last_significant_coeff_y_suffix
89, // significant_coeff_group_flag
93, // significant_coeff_flag
137, // coeff_abs_level_greater1_flag
161, // coeff_abs_level_greater2_flag
167, // coeff_abs_level_remaining
167, // coeff_sign_flag
167, // log2_res_scale_abs
175, // res_scale_sign_flag
177, // cu_chroma_qp_offset_flag
178, // cu_chroma_qp_offset_idx
};
#define CNU 154
@ -189,7 +189,7 @@ static const uint8_t init_values[3][HEVC_CONTEXTS] = {
// cbf_luma
111, 141,
// cbf_cb, cbf_cr
94, 138, 182, 154,
94, 138, 182, 154, 154,
// transform_skip_flag
139, 139,
// explicit_rdpcm_flag
@ -266,7 +266,7 @@ static const uint8_t init_values[3][HEVC_CONTEXTS] = {
// cbf_luma
153, 111,
// cbf_cb, cbf_cr
149, 107, 167, 154,
149, 107, 167, 154, 154,
// transform_skip_flag
139, 139,
// explicit_rdpcm_flag
@ -343,7 +343,7 @@ static const uint8_t init_values[3][HEVC_CONTEXTS] = {
// cbf_luma
153, 111,
// cbf_cb, cbf_cr
149, 92, 167, 154,
149, 92, 167, 154, 154,
// transform_skip_flag
139, 139,
// explicit_rdpcm_flag

View File

@ -76,8 +76,8 @@ static int decode_nal_sei_mastering_display_info(HEVCSEIMasteringDisplay *s, Get
static int decode_nal_sei_content_light_info(HEVCSEIContentLight *s, GetBitContext *gb)
{
// Max and average light levels
s->max_content_light_level = get_bits_long(gb, 16);
s->max_pic_average_light_level = get_bits_long(gb, 16);
s->max_content_light_level = get_bits(gb, 16);
s->max_pic_average_light_level = get_bits(gb, 16);
// As this SEI message comes before the first frame that references it,
// initialize the flag to 2 and decrement on IRAP access unit so it
// persists for the coded video sequence (e.g., between two IRAPs)
@ -177,7 +177,8 @@ static int decode_registered_user_data_closed_caption(HEVCSEIA53Caption *s, GetB
size -= 2;
if (cc_count && size >= cc_count * 3) {
const uint64_t new_size = (s->a53_caption_size + cc_count
int old_size = s->buf_ref ? s->buf_ref->size : 0;
const uint64_t new_size = (old_size + cc_count
* UINT64_C(3));
int i, ret;
@ -185,14 +186,14 @@ static int decode_registered_user_data_closed_caption(HEVCSEIA53Caption *s, GetB
return AVERROR(EINVAL);
/* Allow merging of the cc data from two fields. */
ret = av_reallocp(&s->a53_caption, new_size);
ret = av_buffer_realloc(&s->buf_ref, new_size);
if (ret < 0)
return ret;
for (i = 0; i < cc_count; i++) {
s->a53_caption[s->a53_caption_size++] = get_bits(gb, 8);
s->a53_caption[s->a53_caption_size++] = get_bits(gb, 8);
s->a53_caption[s->a53_caption_size++] = get_bits(gb, 8);
s->buf_ref->data[old_size++] = get_bits(gb, 8);
s->buf_ref->data[old_size++] = get_bits(gb, 8);
s->buf_ref->data[old_size++] = get_bits(gb, 8);
}
skip_bits(gb, 8); // marker_bits
}
@ -363,6 +364,5 @@ int ff_hevc_decode_nal_sei(GetBitContext *gb, void *logctx, HEVCSEI *s,
void ff_hevc_reset_sei(HEVCSEI *s)
{
s->a53_caption.a53_caption_size = 0;
av_freep(&s->a53_caption.a53_caption);
av_buffer_unref(&s->a53_caption.buf_ref);
}

View File

@ -83,8 +83,7 @@ typedef struct HEVCSEIPictureTiming {
} HEVCSEIPictureTiming;
typedef struct HEVCSEIA53Caption {
int a53_caption_size;
uint8_t *a53_caption;
AVBufferRef *buf_ref;
} HEVCSEIA53Caption;
typedef struct HEVCSEIMasteringDisplay {

View File

@ -2778,14 +2778,14 @@ static int set_side_data(HEVCContext *s)
metadata->MaxCLL, metadata->MaxFALL);
}
if (s->sei.a53_caption.a53_caption) {
AVFrameSideData* sd = av_frame_new_side_data(out,
AV_FRAME_DATA_A53_CC,
s->sei.a53_caption.a53_caption_size);
if (sd)
memcpy(sd->data, s->sei.a53_caption.a53_caption, s->sei.a53_caption.a53_caption_size);
av_freep(&s->sei.a53_caption.a53_caption);
s->sei.a53_caption.a53_caption_size = 0;
if (s->sei.a53_caption.buf_ref) {
HEVCSEIA53Caption *a53 = &s->sei.a53_caption;
AVFrameSideData *sd = av_frame_new_side_data_from_buf(out, AV_FRAME_DATA_A53_CC, a53->buf_ref);
if (!sd)
av_buffer_unref(&a53->buf_ref);
a53->buf_ref = NULL;
s->avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
}
@ -3463,6 +3463,13 @@ static int hevc_update_thread_context(AVCodecContext *dst,
s->max_ra = INT_MAX;
}
av_buffer_unref(&s->sei.a53_caption.buf_ref);
if (s0->sei.a53_caption.buf_ref) {
s->sei.a53_caption.buf_ref = av_buffer_ref(s0->sei.a53_caption.buf_ref);
if (!s->sei.a53_caption.buf_ref)
return AVERROR(ENOMEM);
}
s->sei.frame_packing = s0->sei.frame_packing;
s->sei.display_orientation = s0->sei.display_orientation;
s->sei.mastering_display = s0->sei.mastering_display;

View File

@ -322,6 +322,8 @@ static int extract_header(AVCodecContext *const avctx,
av_log(avctx, AV_LOG_ERROR, "Invalid number of bitplanes: %u\n", s->bpp);
return AVERROR_INVALIDDATA;
}
if (s->video_size && s->planesize * s->bpp * avctx->height > s->video_size)
return AVERROR_INVALIDDATA;
av_freep(&s->ham_buf);
av_freep(&s->ham_palbuf);
@ -1359,6 +1361,8 @@ static void decode_delta_d(uint8_t *dst,
bytestream2_seek_p(&pb, (offset / planepitch_byte) * pitch + (offset % planepitch_byte) + k * planepitch, SEEK_SET);
if (opcode >= 0) {
uint32_t x = bytestream2_get_be32(&gb);
if (opcode && 4 + (opcode - 1LL) * pitch > bytestream2_get_bytes_left_p(&pb))
continue;
while (opcode && bytestream2_get_bytes_left_p(&pb) > 0) {
bytestream2_put_be32(&pb, x);
bytestream2_skip_p(&pb, pitch - 4);

View File

@ -264,7 +264,7 @@ static int decode_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx)
}
if (get_bits1(&ctx->gb))
skip_bits_long(&ctx->gb, 24); /* skip transparency fill color */
skip_bits(&ctx->gb, 24); /* skip transparency fill color */
}
align_get_bits(&ctx->gb);
@ -348,7 +348,7 @@ static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx)
if (ctx->frame_type != FRAMETYPE_NULL) {
ctx->frame_flags = get_bits(&ctx->gb, 8);
ctx->pic_hdr_size = (ctx->frame_flags & 1) ? get_bits_long(&ctx->gb, 24) : 0;
ctx->pic_hdr_size = (ctx->frame_flags & 1) ? get_bits(&ctx->gb, 24) : 0;
ctx->checksum = (ctx->frame_flags & 0x10) ? get_bits(&ctx->gb, 16) : 0;
@ -392,7 +392,7 @@ static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *band,
return 0;
}
band->data_size = (ctx->frame_flags & 0x80) ? get_bits_long(&ctx->gb, 24) : 0;
band->data_size = (ctx->frame_flags & 0x80) ? get_bits(&ctx->gb, 24) : 0;
band->inherit_mv = band_flags & 2;
band->inherit_qdelta = band_flags & 8;

View File

@ -33,7 +33,7 @@ int ff_intel_h263_decode_picture_header(MpegEncContext *s)
}
/* picture header */
if (get_bits_long(&s->gb, 22) != 0x20) {
if (get_bits(&s->gb, 22) != 0x20) {
av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n");
return -1;
}

View File

@ -392,6 +392,8 @@ AVCPBProperties *ff_add_cpb_side_data(AVCodecContext *avctx);
int ff_side_data_set_encoder_stats(AVPacket *pkt, int quality, int64_t *error, int error_count, int pict_type);
int ff_side_data_set_prft(AVPacket *pkt, int64_t timestamp);
/**
* Check AVFrame for A53 side data and allocate and fill SEI message with A53 info
*

View File

@ -476,7 +476,7 @@ static int ivi_dec_tile_data_size(GetBitContext *gb)
if (get_bits1(gb)) {
len = get_bits(gb, 8);
if (len == 255)
len = get_bits_long(gb, 24);
len = get_bits(gb, 24);
}
/* align the bitstream reader on the byte boundary */
@ -1193,7 +1193,7 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
left = get_bits_count(&ctx->gb) & 0x18;
skip_bits_long(&ctx->gb, 64 - left);
if (get_bits_left(&ctx->gb) > 18 &&
show_bits_long(&ctx->gb, 21) == 0xBFFF8) { // syncheader + inter type
show_bits(&ctx->gb, 21) == 0xBFFF8) { // syncheader + inter type
AVPacket pkt;
pkt.data = avpkt->data + (get_bits_count(&ctx->gb) >> 3);
pkt.size = get_bits_left(&ctx->gb) >> 3;

View File

@ -110,8 +110,8 @@ static av_cold int libkvazaar_init(AVCodecContext *avctx)
entry->key, entry->value);
}
}
av_dict_free(&dict);
}
av_dict_free(&dict);
}
ctx->encoder = enc = api->encoder_open(cfg);

View File

@ -42,7 +42,7 @@ typedef struct librav1eContext {
size_t pass_pos;
int pass_size;
char *rav1e_opts;
AVDictionary *rav1e_opts;
int quantizer;
int speed;
int tiles;
@ -244,17 +244,12 @@ static av_cold int librav1e_encode_init(AVCodecContext *avctx)
}
}
if (ctx->rav1e_opts) {
AVDictionary *dict = NULL;
{
AVDictionaryEntry *en = NULL;
if (!av_dict_parse_string(&dict, ctx->rav1e_opts, "=", ":", 0)) {
while (en = av_dict_get(dict, "", en, AV_DICT_IGNORE_SUFFIX)) {
int parse_ret = rav1e_config_parse(cfg, en->key, en->value);
if (parse_ret < 0)
av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s.\n", en->key, en->value);
}
av_dict_free(&dict);
while ((en = av_dict_get(ctx->rav1e_opts, "", en, AV_DICT_IGNORE_SUFFIX))) {
int parse_ret = rav1e_config_parse(cfg, en->key, en->value);
if (parse_ret < 0)
av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s.\n", en->key, en->value);
}
}
@ -538,7 +533,7 @@ static const AVOption options[] = {
{ "tiles", "number of tiles encode with", OFFSET(tiles), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT64_MAX, VE },
{ "tile-rows", "number of tiles rows to encode with", OFFSET(tile_rows), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT64_MAX, VE },
{ "tile-columns", "number of tiles columns to encode with", OFFSET(tile_cols), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT64_MAX, VE },
{ "rav1e-params", "set the rav1e configuration using a :-separated list of key=value parameters", OFFSET(rav1e_opts), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
{ "rav1e-params", "set the rav1e configuration using a :-separated list of key=value parameters", OFFSET(rav1e_opts), AV_OPT_TYPE_DICT, { 0 }, 0, 0, VE },
{ NULL }
};

View File

@ -100,7 +100,7 @@ typedef struct VPxEncoderContext {
int rc_undershoot_pct;
int rc_overshoot_pct;
char *vp8_ts_parameters;
AVDictionary *vp8_ts_parameters;
// VP9-only
int lossless;
@ -757,19 +757,13 @@ FF_ENABLE_DEPRECATION_WARNINGS
enccfg.g_error_resilient = ctx->error_resilient || ctx->flags & VP8F_ERROR_RESILIENT;
if (CONFIG_LIBVPX_VP8_ENCODER && avctx->codec_id == AV_CODEC_ID_VP8 && ctx->vp8_ts_parameters) {
AVDictionary *dict = NULL;
if (CONFIG_LIBVPX_VP8_ENCODER && avctx->codec_id == AV_CODEC_ID_VP8) {
AVDictionaryEntry* en = NULL;
if (!av_dict_parse_string(&dict, ctx->vp8_ts_parameters, "=", ":", 0)) {
while ((en = av_dict_get(dict, "", en, AV_DICT_IGNORE_SUFFIX))) {
if (vp8_ts_param_parse(&enccfg, en->key, en->value) < 0)
av_log(avctx, AV_LOG_WARNING,
"Error parsing option '%s = %s'.\n",
en->key, en->value);
}
av_dict_free(&dict);
while ((en = av_dict_get(ctx->vp8_ts_parameters, "", en, AV_DICT_IGNORE_SUFFIX))) {
if (vp8_ts_param_parse(&enccfg, en->key, en->value) < 0)
av_log(avctx, AV_LOG_WARNING,
"Error parsing option '%s = %s'.\n",
en->key, en->value);
}
}
@ -1047,8 +1041,7 @@ static int queue_frames(AVCodecContext *avctx, AVPacket *pkt_out)
if (size < 0)
return size;
} else {
struct FrameListData *cx_frame =
av_malloc(sizeof(struct FrameListData));
struct FrameListData *cx_frame = av_malloc(sizeof(*cx_frame));
if (!cx_frame) {
av_log(avctx, AV_LOG_ERROR,
@ -1462,7 +1455,7 @@ static const AVOption vp8_options[] = {
"frames (2-pass only)", OFFSET(auto_alt_ref), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 2, VE},
{ "cpu-used", "Quality/Speed ratio modifier", OFFSET(cpu_used), AV_OPT_TYPE_INT, {.i64 = 1}, -16, 16, VE},
{ "ts-parameters", "Temporal scaling configuration using a "
":-separated list of key=value parameters", OFFSET(vp8_ts_parameters), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
":-separated list of key=value parameters", OFFSET(vp8_ts_parameters), AV_OPT_TYPE_DICT, {.str=NULL}, 0, 0, VE},
LEGACY_OPTIONS
{ NULL }
};

View File

@ -25,6 +25,7 @@
#include "libavutil/mem.h"
#include "libavutil/pixdesc.h"
#include "libavutil/stereo3d.h"
#include "libavutil/time.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "internal.h"
@ -44,6 +45,11 @@
// blocks of pixels (with respect to the luma plane)
#define MB_SIZE 16
typedef struct X264Opaque {
int64_t reordered_opaque;
int64_t wallclock;
} X264Opaque;
typedef struct X264Context {
AVClass *class;
x264_param_t params;
@ -95,10 +101,10 @@ typedef struct X264Context {
int scenechange_threshold;
int noise_reduction;
char *x264_params;
AVDictionary *x264_params;
int nb_reordered_opaque, next_reordered_opaque;
int64_t *reordered_opaque;
X264Opaque *reordered_opaque;
/**
* If the encoder does not support ROI then warn the first time we
@ -292,7 +298,8 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
x264_picture_t pic_out = {0};
int pict_type;
int bit_depth;
int64_t *out_opaque;
int64_t wallclock = 0;
X264Opaque *out_opaque;
AVFrameSideData *sd;
x264_picture_init( &x4->pic );
@ -314,7 +321,8 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
x4->pic.i_pts = frame->pts;
x4->reordered_opaque[x4->next_reordered_opaque] = frame->reordered_opaque;
x4->reordered_opaque[x4->next_reordered_opaque].reordered_opaque = frame->reordered_opaque;
x4->reordered_opaque[x4->next_reordered_opaque].wallclock = av_gettime();
x4->pic.opaque = &x4->reordered_opaque[x4->next_reordered_opaque];
x4->next_reordered_opaque++;
x4->next_reordered_opaque %= x4->nb_reordered_opaque;
@ -443,7 +451,8 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
out_opaque = pic_out.opaque;
if (out_opaque >= x4->reordered_opaque &&
out_opaque < &x4->reordered_opaque[x4->nb_reordered_opaque]) {
ctx->reordered_opaque = *out_opaque;
ctx->reordered_opaque = out_opaque->reordered_opaque;
wallclock = out_opaque->wallclock;
} else {
// Unexpected opaque pointer on picture output
ctx->reordered_opaque = 0;
@ -473,6 +482,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
pkt->flags |= AV_PKT_FLAG_KEY*pic_out.b_keyframe;
if (ret) {
ff_side_data_set_encoder_stats(pkt, (pic_out.i_qpplus1 - 1) * FF_QP2LAMBDA, NULL, 0, pict_type);
if (wallclock)
ff_side_data_set_prft(pkt, wallclock);
#if FF_API_CODED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
@ -892,19 +903,14 @@ FF_ENABLE_DEPRECATION_WARNINGS
}
}
if (x4->x264_params) {
AVDictionary *dict = NULL;
{
AVDictionaryEntry *en = NULL;
if (!av_dict_parse_string(&dict, x4->x264_params, "=", ":", 0)) {
while ((en = av_dict_get(dict, "", en, AV_DICT_IGNORE_SUFFIX))) {
if (x264_param_parse(&x4->params, en->key, en->value) < 0)
av_log(avctx, AV_LOG_WARNING,
"Error parsing option '%s = %s'.\n",
en->key, en->value);
}
av_dict_free(&dict);
while (en = av_dict_get(x4->x264_params, "", en, AV_DICT_IGNORE_SUFFIX)) {
if (x264_param_parse(&x4->params, en->key, en->value) < 0)
av_log(avctx, AV_LOG_WARNING,
"Error parsing option '%s = %s'.\n",
en->key, en->value);
}
}
@ -1116,7 +1122,7 @@ static const AVOption options[] = {
{ "sc_threshold", "Scene change threshold", OFFSET(scenechange_threshold), AV_OPT_TYPE_INT, { .i64 = -1 }, INT_MIN, INT_MAX, VE },
{ "noise_reduction", "Noise reduction", OFFSET(noise_reduction), AV_OPT_TYPE_INT, { .i64 = -1 }, INT_MIN, INT_MAX, VE },
{ "x264-params", "Override the x264 configuration using a :-separated list of key=value parameters", OFFSET(x264_params), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
{ "x264-params", "Override the x264 configuration using a :-separated list of key=value parameters", OFFSET(x264_params), AV_OPT_TYPE_DICT, { 0 }, 0, 0, VE },
{ NULL },
};

View File

@ -42,11 +42,12 @@ typedef struct libx265Context {
const x265_api *api;
float crf;
int cqp;
int forced_idr;
char *preset;
char *tune;
char *profile;
char *x265_opts;
AVDictionary *x265_opts;
/**
* If the encoder does not support ROI then warn the first time we
@ -82,10 +83,41 @@ static av_cold int libx265_encode_close(AVCodecContext *avctx)
return 0;
}
static av_cold int libx265_param_parse_float(AVCodecContext *avctx,
const char *key, float value)
{
libx265Context *ctx = avctx->priv_data;
char buf[256];
snprintf(buf, sizeof(buf), "%2.2f", value);
if (ctx->api->param_parse(ctx->params, key, buf) == X265_PARAM_BAD_VALUE) {
av_log(avctx, AV_LOG_ERROR, "Invalid value %2.2f for param \"%s\".\n", value, key);
return AVERROR(EINVAL);
}
return 0;
}
static av_cold int libx265_param_parse_int(AVCodecContext *avctx,
const char *key, int value)
{
libx265Context *ctx = avctx->priv_data;
char buf[256];
snprintf(buf, sizeof(buf), "%d", value);
if (ctx->api->param_parse(ctx->params, key, buf) == X265_PARAM_BAD_VALUE) {
av_log(avctx, AV_LOG_ERROR, "Invalid value %d for param \"%s\".\n", value, key);
return AVERROR(EINVAL);
}
return 0;
}
static av_cold int libx265_encode_init(AVCodecContext *avctx)
{
libx265Context *ctx = avctx->priv_data;
AVCPBProperties *cpb_props = NULL;
int ret;
ctx->api = x265_api_get(av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].depth);
if (!ctx->api)
@ -159,6 +191,10 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
// x265 validates the parameters internally
ctx->params->vui.colorPrimaries = avctx->color_primaries;
ctx->params->vui.transferCharacteristics = avctx->color_trc;
#if X265_BUILD >= 159
if (avctx->color_trc == AVCOL_TRC_ARIB_STD_B67)
ctx->params->preferredTransferCharacteristics = ctx->params->vui.transferCharacteristics;
#endif
ctx->params->vui.matrixCoeffs = avctx->colorspace;
}
@ -222,6 +258,48 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
} else if (avctx->bit_rate > 0) {
ctx->params->rc.bitrate = avctx->bit_rate / 1000;
ctx->params->rc.rateControlMode = X265_RC_ABR;
} else if (ctx->cqp >= 0) {
ret = libx265_param_parse_int(avctx, "qp", ctx->cqp);
if (ret < 0)
return ret;
}
#if X265_BUILD >= 89
if (avctx->qmin >= 0) {
ret = libx265_param_parse_int(avctx, "qpmin", avctx->qmin);
if (ret < 0)
return ret;
}
if (avctx->qmax >= 0) {
ret = libx265_param_parse_int(avctx, "qpmax", avctx->qmax);
if (ret < 0)
return ret;
}
#endif
if (avctx->max_qdiff >= 0) {
ret = libx265_param_parse_int(avctx, "qpstep", avctx->max_qdiff);
if (ret < 0)
return ret;
}
if (avctx->qblur >= 0) {
ret = libx265_param_parse_float(avctx, "qblur", avctx->qblur);
if (ret < 0)
return ret;
}
if (avctx->qcompress >= 0) {
ret = libx265_param_parse_float(avctx, "qcomp", avctx->qcompress);
if (ret < 0)
return ret;
}
if (avctx->i_quant_factor >= 0) {
ret = libx265_param_parse_float(avctx, "ipratio", avctx->i_quant_factor);
if (ret < 0)
return ret;
}
if (avctx->b_quant_factor >= 0) {
ret = libx265_param_parse_float(avctx, "pbratio", avctx->b_quant_factor);
if (ret < 0)
return ret;
}
ctx->params->rc.vbvBufferSize = avctx->rc_buffer_size / 1000;
@ -237,28 +315,44 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
if (!(avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER))
ctx->params->bRepeatHeaders = 1;
if (ctx->x265_opts) {
AVDictionary *dict = NULL;
if (avctx->gop_size >= 0) {
ret = libx265_param_parse_int(avctx, "keyint", avctx->gop_size);
if (ret < 0)
return ret;
}
if (avctx->keyint_min > 0) {
ret = libx265_param_parse_int(avctx, "min-keyint", avctx->keyint_min);
if (ret < 0)
return ret;
}
if (avctx->max_b_frames >= 0) {
ret = libx265_param_parse_int(avctx, "bframes", avctx->max_b_frames);
if (ret < 0)
return ret;
}
if (avctx->refs >= 0) {
ret = libx265_param_parse_int(avctx, "ref", avctx->refs);
if (ret < 0)
return ret;
}
{
AVDictionaryEntry *en = NULL;
while ((en = av_dict_get(ctx->x265_opts, "", en, AV_DICT_IGNORE_SUFFIX))) {
int parse_ret = ctx->api->param_parse(ctx->params, en->key, en->value);
if (!av_dict_parse_string(&dict, ctx->x265_opts, "=", ":", 0)) {
while ((en = av_dict_get(dict, "", en, AV_DICT_IGNORE_SUFFIX))) {
int parse_ret = ctx->api->param_parse(ctx->params, en->key, en->value);
switch (parse_ret) {
case X265_PARAM_BAD_NAME:
av_log(avctx, AV_LOG_WARNING,
"Unknown option: %s.\n", en->key);
break;
case X265_PARAM_BAD_VALUE:
av_log(avctx, AV_LOG_WARNING,
"Invalid value for %s: %s.\n", en->key, en->value);
break;
default:
break;
}
switch (parse_ret) {
case X265_PARAM_BAD_NAME:
av_log(avctx, AV_LOG_WARNING,
"Unknown option: %s.\n", en->key);
break;
case X265_PARAM_BAD_VALUE:
av_log(avctx, AV_LOG_WARNING,
"Invalid value for %s: %s.\n", en->key, en->value);
break;
default:
break;
}
av_dict_free(&dict);
}
}
@ -383,6 +477,7 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
x265_picture x265pic_out = { 0 };
x265_nal *nal;
uint8_t *dst;
int pict_type;
int payload = 0;
int nnal;
int ret;
@ -442,20 +537,23 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
pkt->pts = x265pic_out.pts;
pkt->dts = x265pic_out.dts;
#if FF_API_CODED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
switch (x265pic_out.sliceType) {
case X265_TYPE_IDR:
case X265_TYPE_I:
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
pict_type = AV_PICTURE_TYPE_I;
break;
case X265_TYPE_P:
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_P;
pict_type = AV_PICTURE_TYPE_P;
break;
case X265_TYPE_B:
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_B;
case X265_TYPE_BREF:
pict_type = AV_PICTURE_TYPE_B;
break;
}
#if FF_API_CODED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
avctx->coded_frame->pict_type = pict_type;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
@ -466,6 +564,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
#endif
pkt->flags |= AV_PKT_FLAG_DISPOSABLE;
ff_side_data_set_encoder_stats(pkt, x265pic_out.frameData.qp * FF_QP2LAMBDA, NULL, 0, pict_type);
*got_packet = 1;
return 0;
}
@ -535,11 +635,12 @@ static av_cold void libx265_encode_init_csp(AVCodec *codec)
#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
static const AVOption options[] = {
{ "crf", "set the x265 crf", OFFSET(crf), AV_OPT_TYPE_FLOAT, { .dbl = -1 }, -1, FLT_MAX, VE },
{ "qp", "set the x265 qp", OFFSET(cqp), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, VE },
{ "forced-idr", "if forcing keyframes, force them as IDR frames", OFFSET(forced_idr),AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
{ "preset", "set the x265 preset", OFFSET(preset), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
{ "tune", "set the x265 tune parameter", OFFSET(tune), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
{ "profile", "set the x265 profile", OFFSET(profile), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
{ "x265-params", "set the x265 configuration using a :-separated list of key=value parameters", OFFSET(x265_opts), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
{ "x265-params", "set the x265 configuration using a :-separated list of key=value parameters", OFFSET(x265_opts), AV_OPT_TYPE_DICT, { 0 }, 0, 0, VE },
{ NULL }
};
@ -552,6 +653,17 @@ static const AVClass class = {
static const AVCodecDefault x265_defaults[] = {
{ "b", "0" },
{ "bf", "-1" },
{ "g", "-1" },
{ "keyint_min", "-1" },
{ "refs", "-1" },
{ "qmin", "-1" },
{ "qmax", "-1" },
{ "qdiff", "-1" },
{ "qblur", "-1" },
{ "qcomp", "-1" },
{ "i_qfactor", "-1" },
{ "b_qfactor", "-1" },
{ NULL },
};

View File

@ -48,7 +48,7 @@ typedef struct XAVS2EContext {
int log_level;
void *encoder;
char *xavs2_opts;
AVDictionary *xavs2_opts;
xavs2_outpacket_t packet;
xavs2_param_t *param;
@ -92,16 +92,10 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
xavs2_opt_set2("OpenGOP", "%d", !(avctx->flags & AV_CODEC_FLAG_CLOSED_GOP));
if (cae->xavs2_opts) {
AVDictionary *dict = NULL;
{
AVDictionaryEntry *en = NULL;
if (!av_dict_parse_string(&dict, cae->xavs2_opts, "=", ":", 0)) {
while ((en = av_dict_get(dict, "", en, AV_DICT_IGNORE_SUFFIX))) {
xavs2_opt_set2(en->key, "%s", en->value);
}
av_dict_free(&dict);
}
while ((en = av_dict_get(cae->xavs2_opts, "", en, AV_DICT_IGNORE_SUFFIX)))
xavs2_opt_set2(en->key, "%s", en->value);
}
/* Rate control */
@ -267,7 +261,7 @@ static const AVOption options[] = {
{ "min_qp" , "min qp for rate control" , OFFSET(min_qp) , AV_OPT_TYPE_INT, {.i64 = 20 }, 0, 63, VE },
{ "speed_level" , "Speed level, higher is better but slower", OFFSET(preset_level) , AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 9, VE },
{ "log_level" , "log level: -1: none, 0: error, 1: warning, 2: info, 3: debug", OFFSET(log_level) , AV_OPT_TYPE_INT, {.i64 = 0 }, -1, 3, VE },
{ "xavs2-params" , "set the xavs2 configuration using a :-separated list of key=value parameters", OFFSET(xavs2_opts), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
{ "xavs2-params" , "set the xavs2 configuration using a :-separated list of key=value parameters", OFFSET(xavs2_opts), AV_OPT_TYPE_DICT, { 0 }, 0, 0, VE },
{ NULL },
};

View File

@ -63,7 +63,7 @@ static int decode_mvdv(MidiVidContext *s, AVCodecContext *avctx, AVFrame *frame)
if (intra_flag) {
nb_blocks = (avctx->width / 2) * (avctx->height / 2);
} else {
int skip_linesize;
int ret, skip_linesize;
nb_blocks = bytestream2_get_le32(gb);
skip_linesize = avctx->width >> 1;
@ -73,7 +73,9 @@ static int decode_mvdv(MidiVidContext *s, AVCodecContext *avctx, AVFrame *frame)
if (bytestream2_get_bytes_left(gb) < mask_size)
return AVERROR_INVALIDDATA;
init_get_bits8(&mask, mask_start, mask_size);
ret = init_get_bits8(&mask, mask_start, mask_size);
if (ret < 0)
return ret;
bytestream2_skip(gb, mask_size);
skip = s->skip;

View File

@ -73,10 +73,7 @@ static av_cold void h264_pred_init_msa(H264PredContext *h, int codec_id,
switch (codec_id) {
case AV_CODEC_ID_SVQ3:
;
break;
case AV_CODEC_ID_RV40:
;
break;
case AV_CODEC_ID_VP7:
case AV_CODEC_ID_VP8:

View File

@ -2049,7 +2049,7 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
unsigned nummarkers;
id = get_bits_long(&s->gb, 32);
id2 = get_bits_long(&s->gb, 24);
id2 = get_bits(&s->gb, 24);
len -= 7;
if (id != AV_RB32("PROF") || id2 != AV_RB24("ILE")) {
av_log(s->avctx, AV_LOG_WARNING, "Invalid ICC_PROFILE header in APP2\n");

View File

@ -102,7 +102,7 @@ int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb)
return AVERROR_INVALIDDATA;
}
if (get_bits_long(gb, 24) != 0xf8726f) /* Sync words */
if (get_bits(gb, 24) != 0xf8726f) /* Sync words */
return AVERROR_INVALIDDATA;
mh->stream_type = get_bits(gb, 8);

View File

@ -61,6 +61,8 @@ static int mlp_parse(AVCodecParserContext *s,
int ret;
int i, p = 0;
s->key_frame = 0;
*poutbuf_size = 0;
if (buf_size == 0)
return 0;
@ -136,6 +138,8 @@ static int mlp_parse(AVCodecParserContext *s,
* access unit header and all the 2- or 4-byte substream headers. */
// Only check when this isn't a sync frame - syncs have a checksum.
s->key_frame = 0;
parity_bits = 0;
for (i = -1; i < mp->num_substreams; i++) {
parity_bits ^= buf[p++];
@ -159,6 +163,8 @@ static int mlp_parse(AVCodecParserContext *s,
if (ff_mlp_read_major_sync(avctx, &mh, &gb) < 0)
goto lost_sync;
s->key_frame = 1;
avctx->bits_per_raw_sample = mh.group1_bits;
if (avctx->bits_per_raw_sample > 16)
avctx->sample_fmt = AV_SAMPLE_FMT_S32;

View File

@ -62,6 +62,11 @@ static int mp3_header_decompress(AVBSFContext *ctx, AVPacket *out)
lsf = sample_rate < (24000+32000)/2;
mpeg25 = sample_rate < (12000+16000)/2;
sample_rate_index= (header>>10)&3;
if (sample_rate_index == 3) {
ret = AVERROR_INVALIDDATA;
goto fail;
}
sample_rate= avpriv_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25); //in case sample rate is a little off
for(bitrate_index=2; bitrate_index<30; bitrate_index++){

View File

@ -1669,8 +1669,7 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
return AVERROR_INVALIDDATA;
}
if (s->avctx->hwaccel &&
(s->avctx->slice_flags & SLICE_FLAG_ALLOW_FIELD)) {
if (s->avctx->hwaccel) {
if ((ret = s->avctx->hwaccel->end_frame(s->avctx)) < 0) {
av_log(avctx, AV_LOG_ERROR,
"hardware accelerator failed to decode first field\n");

View File

@ -118,8 +118,8 @@ int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, GetBitContext *gb,
if (c->object_type == AOT_ALS) {
skip_bits(gb, 5);
if (show_bits_long(gb, 24) != MKBETAG('\0','A','L','S'))
skip_bits_long(gb, 24);
if (show_bits(gb, 24) != MKBETAG('\0','A','L','S'))
skip_bits(gb, 24);
specific_config_bitindex = get_bits_count(gb);

View File

@ -711,7 +711,7 @@ static int mpeg4_decode_partition_a(Mpeg4DecContext *ctx)
int i;
do {
if (show_bits_long(&s->gb, 19) == DC_MARKER)
if (show_bits(&s->gb, 19) == DC_MARKER)
return mb_num - 1;
cbpc = get_vlc2(&s->gb, ff_h263_intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 2);
@ -1001,7 +1001,7 @@ int ff_mpeg4_decode_partitions(Mpeg4DecContext *ctx)
if (s->pict_type == AV_PICTURE_TYPE_I) {
while (show_bits(&s->gb, 9) == 1)
skip_bits(&s->gb, 9);
if (get_bits_long(&s->gb, 19) != DC_MARKER) {
if (get_bits(&s->gb, 19) != DC_MARKER) {
av_log(s->avctx, AV_LOG_ERROR,
"marker missing after first I partition at %d %d\n",
s->mb_x, s->mb_y);
@ -1782,7 +1782,7 @@ static void next_start_code_studio(GetBitContext *gb)
{
align_get_bits(gb);
while (get_bits_left(gb) >= 24 && show_bits_long(gb, 24) != 0x1) {
while (get_bits_left(gb) >= 24 && show_bits(gb, 24) != 0x1) {
get_bits(gb, 8);
}
}

View File

@ -412,8 +412,6 @@ static int decode_wmv9(AVCodecContext *avctx, const uint8_t *buf, int buf_size,
ff_mpeg_er_frame_start(s);
v->bits = buf_size * 8;
v->end_mb_x = (w + 15) >> 4;
s->end_mb_y = (h + 15) >> 4;
if (v->respic & 1)

View File

@ -161,6 +161,9 @@ static int decode_frame(AVCodecContext *avctx,
type = AV_RB32(avpkt->data);
size = AV_RL32(avpkt->data + 4);
if (size < 1 || size >= avpkt->size)
return AVERROR_INVALIDDATA;
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;

View File

@ -39,7 +39,7 @@ static int noise(AVBSFContext *ctx, AVPacket *pkt)
{
NoiseContext *s = ctx->priv_data;
int amount = s->amount > 0 ? s->amount : (s->state % 10001 + 1);
int i, ret = 0;
int i, ret;
if (amount <= 0)
return AVERROR(EINVAL);
@ -55,19 +55,18 @@ static int noise(AVBSFContext *ctx, AVPacket *pkt)
}
ret = av_packet_make_writable(pkt);
if (ret < 0)
goto fail;
if (ret < 0) {
av_packet_unref(pkt);
return ret;
}
for (i = 0; i < pkt->size; i++) {
s->state += pkt->data[i] + 1;
if (s->state % amount == 0)
pkt->data[i] = s->state;
}
fail:
if (ret < 0)
av_packet_unref(pkt);
return ret;
return 0;
}
#define OFFSET(x) offsetof(NoiseContext, x)

View File

@ -50,6 +50,10 @@ static int nvdec_mpeg12_start_frame(AVCodecContext *avctx, const uint8_t *buffer
.FrameHeightInMbs = (cur_frame->height + 15) / 16,
.CurrPicIdx = cf->idx,
.field_pic_flag = s->picture_structure != PICT_FRAME,
.bottom_field_flag = s->picture_structure == PICT_BOTTOM_FIELD,
.second_field = s->picture_structure != PICT_FRAME && !s->first_field,
.intra_pic_flag = s->pict_type == AV_PICTURE_TYPE_I,
.ref_pic_flag = s->pict_type == AV_PICTURE_TYPE_I ||
s->pict_type == AV_PICTURE_TYPE_P,

View File

@ -2262,3 +2262,8 @@ int ff_nvenc_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
return 0;
}
av_cold void ff_nvenc_encode_flush(AVCodecContext *avctx)
{
ff_nvenc_send_frame(avctx, NULL);
}

View File

@ -214,6 +214,8 @@ int ff_nvenc_receive_packet(AVCodecContext *avctx, AVPacket *pkt);
int ff_nvenc_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
const AVFrame *frame, int *got_packet);
void ff_nvenc_encode_flush(AVCodecContext *avctx);
extern const enum AVPixelFormat ff_nvenc_pix_fmts[];
#endif /* AVCODEC_NVENC_H */

View File

@ -240,6 +240,7 @@ AVCodec ff_h264_nvenc_encoder = {
.receive_packet = ff_nvenc_receive_packet,
.encode2 = ff_nvenc_encode_frame,
.close = ff_nvenc_encode_close,
.flush = ff_nvenc_encode_flush,
.priv_data_size = sizeof(NvencContext),
.priv_class = &h264_nvenc_class,
.defaults = defaults,

View File

@ -198,6 +198,7 @@ AVCodec ff_hevc_nvenc_encoder = {
.receive_packet = ff_nvenc_receive_packet,
.encode2 = ff_nvenc_encode_frame,
.close = ff_nvenc_encode_close,
.flush = ff_nvenc_encode_flush,
.priv_data_size = sizeof(NvencContext),
.priv_class = &hevc_nvenc_class,
.defaults = defaults,

View File

@ -141,8 +141,8 @@ static const AVOption avcodec_options[] = {
{"explode", "abort decoding on minor error detection", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_EXPLODE }, INT_MIN, INT_MAX, A|V|D, "err_detect"},
{"ignore_err", "ignore errors", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_IGNORE_ERR }, INT_MIN, INT_MAX, A|V|D, "err_detect"},
{"careful", "consider things that violate the spec, are fast to check and have not been seen in the wild as errors", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_CAREFUL }, INT_MIN, INT_MAX, A|V|D, "err_detect"},
{"compliant", "consider all spec non compliancies as errors", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_COMPLIANT }, INT_MIN, INT_MAX, A|V|D, "err_detect"},
{"aggressive", "consider things that a sane encoder should not do as an error", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_AGGRESSIVE }, INT_MIN, INT_MAX, A|V|D, "err_detect"},
{"compliant", "consider all spec non compliancies as errors", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_COMPLIANT | AV_EF_CAREFUL }, INT_MIN, INT_MAX, A|V|D, "err_detect"},
{"aggressive", "consider things that a sane encoder should not do as an error", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_AGGRESSIVE | AV_EF_COMPLIANT | AV_EF_CAREFUL}, INT_MIN, INT_MAX, A|V|D, "err_detect"},
{"has_b_frames", NULL, OFFSET(has_b_frames), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX},
{"block_align", NULL, OFFSET(block_align), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX},
#if FF_API_PRIVATE_OPT

View File

@ -691,8 +691,11 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size,
ret = AVERROR_INVALIDDATA;
break;
}
if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE))
if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE)) {
avsubtitle_free(data);
*data_size = 0;
return ret;
}
buf += segment_length;
}

View File

@ -117,6 +117,9 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
return AVERROR_INVALIDDATA;
}
}
if (!pnm_space(s->bytestream[-1]))
return AVERROR_INVALIDDATA;
/* check that all tags are present */
if (w <= 0 || h <= 0 || maxval <= 0 || maxval > UINT16_MAX || depth <= 0 || tuple_type[0] == '\0' ||
av_image_check_size(w, h, 0, avctx) || s->bytestream >= s->bytestream_end)
@ -197,6 +200,10 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
}
}else
s->maxval=1;
if (!pnm_space(s->bytestream[-1]))
return AVERROR_INVALIDDATA;
/* more check if YUV420 */
if (av_pix_fmt_desc_get(avctx->pix_fmt)->flags & AV_PIX_FMT_FLAG_PLANAR) {
if ((avctx->width & 1) != 0)

View File

@ -143,7 +143,7 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
v = (*s->bytestream++)&1;
} else {
/* read a sequence of digits */
for (k = 0; k < 5 && c <= 9; k += 1) {
for (k = 0; k < 6 && c <= 9; k += 1) {
v = 10*v + c;
c = (*s->bytestream++) - '0';
}

View File

@ -224,7 +224,7 @@ static void encode_codeword(PutBitContext *pb, int val, int codebook)
}
#define QSCALE(qmat,ind,val) ((val) / ((qmat)[ind]))
#define TO_GOLOMB(val) (((val) << 1) ^ ((val) >> 31))
#define TO_GOLOMB(val) (((val) * 2) ^ ((val) >> 31))
#define DIFF_SIGN(val, sign) (((val) >> 31) ^ (sign))
#define IS_NEGATIVE(val) ((((val) >> 31) ^ -1) + 1)
#define TO_GOLOMB2(val,sign) ((val)==0 ? 0 : ((val) << 1) + (sign))

View File

@ -72,58 +72,6 @@ int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id)
return AVERROR(ENOSYS);
}
static const struct {
enum AVCodecID codec_id;
int codec_profile;
int mfx_profile;
} qsv_profile_map[] = {
#define MAP(c, p, v) { AV_CODEC_ID_ ## c, FF_PROFILE_ ## p, MFX_PROFILE_ ## v }
MAP(MPEG2VIDEO, MPEG2_SIMPLE, MPEG2_SIMPLE ),
MAP(MPEG2VIDEO, MPEG2_MAIN, MPEG2_MAIN ),
MAP(MPEG2VIDEO, MPEG2_HIGH, MPEG2_HIGH ),
MAP(H264, H264_BASELINE, AVC_BASELINE ),
MAP(H264, H264_CONSTRAINED_BASELINE, AVC_BASELINE),
#if QSV_VERSION_ATLEAST(1, 3)
MAP(H264, H264_EXTENDED, AVC_EXTENDED ),
#endif
MAP(H264, H264_MAIN, AVC_MAIN ),
MAP(H264, H264_HIGH, AVC_HIGH ),
MAP(H264, H264_HIGH_422, AVC_HIGH_422 ),
#if QSV_VERSION_ATLEAST(1, 8)
MAP(HEVC, HEVC_MAIN, HEVC_MAIN ),
MAP(HEVC, HEVC_MAIN_10, HEVC_MAIN10 ),
MAP(HEVC, HEVC_MAIN_STILL_PICTURE, HEVC_MAINSP ),
#endif
#if QSV_VERSION_ATLEAST(1, 16)
MAP(HEVC, HEVC_REXT, HEVC_REXT ),
#endif
MAP(VC1, VC1_SIMPLE, VC1_SIMPLE ),
MAP(VC1, VC1_MAIN, VC1_MAIN ),
MAP(VC1, VC1_COMPLEX, VC1_ADVANCED ),
MAP(VC1, VC1_ADVANCED, VC1_ADVANCED ),
#undef MAP
};
int ff_qsv_profile_to_mfx(enum AVCodecID codec_id, int profile)
{
int i;
if (profile == FF_PROFILE_UNKNOWN)
return MFX_PROFILE_UNKNOWN;
for (i = 0; i < FF_ARRAY_ELEMS(qsv_profile_map); i++) {
if (qsv_profile_map[i].codec_id != codec_id)
continue;
if (qsv_profile_map[i].codec_profile == profile)
return qsv_profile_map[i].mfx_profile;
}
return MFX_PROFILE_UNKNOWN;
}
int ff_qsv_level_to_mfx(enum AVCodecID codec_id, int level)
{
if (level == FF_LEVEL_UNKNOWN)

View File

@ -116,7 +116,6 @@ int ff_qsv_print_warning(void *log_ctx, mfxStatus err,
const char *warning_string);
int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id);
int ff_qsv_profile_to_mfx(enum AVCodecID codec_id, int profile);
int ff_qsv_level_to_mfx(enum AVCodecID codec_id, int level);
enum AVPixelFormat ff_qsv_map_fourcc(uint32_t fourcc);

View File

@ -74,7 +74,7 @@ static int ff_qsv_get_continuous_buffer(AVCodecContext *avctx, AVFrame *frame, A
break;
default:
av_log(avctx, AV_LOG_ERROR, "Unsupported pixel format.\n");
return AVERROR(ENOMEM);
return AVERROR(EINVAL);
}
frame->linesize[1] = frame->linesize[0];
@ -99,9 +99,11 @@ static int qsv_init_session(AVCodecContext *avctx, QSVContext *q, mfxSession ses
int ret;
if (q->gpu_copy == MFX_GPUCOPY_ON &&
!(q->iopattern & MFX_IOPATTERN_OUT_SYSTEM_MEMORY))
!(q->iopattern & MFX_IOPATTERN_OUT_SYSTEM_MEMORY)) {
av_log(avctx, AV_LOG_WARNING, "GPU-accelerated memory copy "
"only works in MFX_IOPATTERN_OUT_SYSTEM_MEMORY.\n");
"only works in system memory mode.\n");
q->gpu_copy = MFX_GPUCOPY_OFF;
}
if (session) {
q->session = session;
} else if (hw_frames_ref) {

View File

@ -139,6 +139,9 @@ static void dump_video_param(AVCodecContext *avctx, QSVEncContext *q,
#if QSV_HAVE_CO3
mfxExtCodingOption3 *co3 = (mfxExtCodingOption3*)coding_opts[2];
#endif
#if QSV_HAVE_EXT_HEVC_TILES
mfxExtHEVCTiles *exthevctiles = (mfxExtHEVCTiles *)coding_opts[3 + QSV_HAVE_CO_VPS];
#endif
av_log(avctx, AV_LOG_VERBOSE, "profile: %s; level: %"PRIu16"\n",
print_profile(info->CodecProfile), info->CodecLevel);
@ -204,6 +207,12 @@ static void dump_video_param(AVCodecContext *avctx, QSVEncContext *q,
av_log(avctx, AV_LOG_VERBOSE, "RateDistortionOpt: %s\n",
print_threestate(co->RateDistortionOpt));
#if QSV_HAVE_EXT_HEVC_TILES
if (avctx->codec_id == AV_CODEC_ID_HEVC)
av_log(avctx, AV_LOG_VERBOSE, "NumTileColumns: %"PRIu16"; NumTileRows: %"PRIu16"\n",
exthevctiles->NumTileColumns, exthevctiles->NumTileRows);
#endif
#if QSV_HAVE_CO2
av_log(avctx, AV_LOG_VERBOSE,
"RecoveryPointSEI: %s IntRefType: %"PRIu16"; IntRefCycleSize: %"PRIu16"; IntRefQPDelta: %"PRId16"\n",
@ -771,6 +780,16 @@ FF_ENABLE_DEPRECATION_WARNINGS
}
#endif
#if QSV_HAVE_EXT_HEVC_TILES
if (avctx->codec_id == AV_CODEC_ID_HEVC) {
q->exthevctiles.Header.BufferId = MFX_EXTBUFF_HEVC_TILES;
q->exthevctiles.Header.BufferSz = sizeof(q->exthevctiles);
q->exthevctiles.NumTileColumns = q->tile_cols;
q->exthevctiles.NumTileRows = q->tile_rows;
q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer *)&q->exthevctiles;
}
#endif
if (!check_enc_param(avctx,q)) {
av_log(avctx, AV_LOG_ERROR,
"some encoding parameters are not supported by the QSV "
@ -889,7 +908,14 @@ static int qsv_retrieve_enc_params(AVCodecContext *avctx, QSVEncContext *q)
};
#endif
mfxExtBuffer *ext_buffers[2 + QSV_HAVE_CO2 + QSV_HAVE_CO3 + QSV_HAVE_CO_VPS];
#if QSV_HAVE_EXT_HEVC_TILES
mfxExtHEVCTiles hevc_tile_buf = {
.Header.BufferId = MFX_EXTBUFF_HEVC_TILES,
.Header.BufferSz = sizeof(hevc_tile_buf),
};
#endif
mfxExtBuffer *ext_buffers[2 + QSV_HAVE_CO2 + QSV_HAVE_CO3 + QSV_HAVE_CO_VPS + QSV_HAVE_EXT_HEVC_TILES];
int need_pps = avctx->codec_id != AV_CODEC_ID_MPEG2VIDEO;
int ret, ext_buf_num = 0, extradata_offset = 0;
@ -907,6 +933,10 @@ static int qsv_retrieve_enc_params(AVCodecContext *avctx, QSVEncContext *q)
if (q->hevc_vps)
ext_buffers[ext_buf_num++] = (mfxExtBuffer*)&extradata_vps;
#endif
#if QSV_HAVE_EXT_HEVC_TILES
if (avctx->codec_id == AV_CODEC_ID_HEVC)
ext_buffers[ext_buf_num++] = (mfxExtBuffer*)&hevc_tile_buf;
#endif
q->param.ExtParam = ext_buffers;
q->param.NumExtParam = ext_buf_num;

View File

@ -38,6 +38,7 @@
#define QSV_HAVE_CO3 QSV_VERSION_ATLEAST(1, 11)
#define QSV_HAVE_CO_VPS QSV_VERSION_ATLEAST(1, 17)
#define QSV_HAVE_EXT_HEVC_TILES QSV_VERSION_ATLEAST(1, 13)
#define QSV_HAVE_EXT_VP9_PARAM QSV_VERSION_ATLEAST(1, 26)
#define QSV_HAVE_TRELLIS QSV_VERSION_ATLEAST(1, 8)
@ -124,6 +125,9 @@ typedef struct QSVEncContext {
mfxExtMultiFrameParam extmfp;
mfxExtMultiFrameControl extmfc;
#endif
#if QSV_HAVE_EXT_HEVC_TILES
mfxExtHEVCTiles exthevctiles;
#endif
#if QSV_HAVE_EXT_VP9_PARAM
mfxExtVP9Param extvp9param;
#endif
@ -161,6 +165,9 @@ typedef struct QSVEncContext {
int max_frame_size;
int max_slice_size;
int tile_cols;
int tile_rows;
int aud;
int single_sei_nal_unit;

View File

@ -243,6 +243,9 @@ static const AVOption options[] = {
{ "gpb", "1: GPB (generalized P/B frame); 0: regular P frame", OFFSET(qsv.gpb), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE},
{ "tile_cols", "Number of columns for tiled encoding", OFFSET(qsv.tile_cols), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, UINT16_MAX, VE },
{ "tile_rows", "Number of rows for tiled encoding", OFFSET(qsv.tile_rows), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, UINT16_MAX, VE },
{ NULL },
};

View File

@ -121,7 +121,7 @@ static inline void FUNC6(idctRowCondDC)(idctin *row, int extra_shift)
// TODO: Add DC-only support for int32_t input
#if IN_IDCT_DEPTH == 16
#if HAVE_FAST_64BIT
#define ROW0_MASK (0xffffLL << 48 * HAVE_BIGENDIAN)
#define ROW0_MASK (0xffffULL << 48 * HAVE_BIGENDIAN)
if (((AV_RN64A(row) & ~ROW0_MASK) | AV_RN64A(row+4)) == 0) {
uint64_t temp;
if (DC_SHIFT - extra_shift >= 0) {

View File

@ -144,6 +144,8 @@ static inline av_flatten int get_symbol(RangeCoder *c, uint8_t *state, int is_si
e= 0;
while(get_rac(c, state+1 + FFMIN(e,9))){ //1..10
e++;
if (e > 31)
return AVERROR_INVALIDDATA;
}
a= 1;

View File

@ -132,12 +132,6 @@ static int decode_frame(AVCodecContext *avctx,
h = bytestream2_get_le16(&s->gb);
bpp = bytestream2_get_byte(&s->gb);
if (bytestream2_get_bytes_left(&s->gb) <= idlen) {
av_log(avctx, AV_LOG_ERROR,
"Not enough data to read header\n");
return AVERROR_INVALIDDATA;
}
flags = bytestream2_get_byte(&s->gb);
if (!pal && (first_clr || colors || csize)) {
@ -146,6 +140,12 @@ static int decode_frame(AVCodecContext *avctx,
first_clr = colors = csize = 0;
}
if (bytestream2_get_bytes_left(&s->gb) < idlen + 2*colors) {
av_log(avctx, AV_LOG_ERROR,
"Not enough data to read header\n");
return AVERROR_INVALIDDATA;
}
// skip identifier if any
bytestream2_skip(&s->gb, idlen);

View File

@ -1218,6 +1218,8 @@ static void set_sar(TiffContext *s, unsigned tag, unsigned num, unsigned den)
static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
{
AVFrameSideData *sd;
GetByteContext gb_temp;
unsigned tag, type, count, off, value = 0, value2 = 1; // value2 is a denominator so init. to 1
int i, start;
int pos;
@ -1643,6 +1645,22 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
}
}
break;
case TIFF_ICC_PROFILE:
if (type != TIFF_UNDEFINED)
return AVERROR_INVALIDDATA;
gb_temp = s->gb;
bytestream2_seek(&gb_temp, SEEK_SET, off);
if (bytestream2_get_bytes_left(&gb_temp) < count)
return AVERROR_INVALIDDATA;
sd = av_frame_new_side_data(frame, AV_FRAME_DATA_ICC_PROFILE, count);
if (!sd)
return AVERROR(ENOMEM);
bytestream2_get_bufferu(&gb_temp, sd->data, count);
break;
case TIFF_ARTIST:
ADD_METADATA(count, "artist", NULL);
break;

View File

@ -92,6 +92,7 @@ enum TiffTags {
TIFF_MODEL_TIEPOINT = 0x8482,
TIFF_MODEL_PIXEL_SCALE = 0x830E,
TIFF_MODEL_TRANSFORMATION= 0x8480,
TIFF_ICC_PROFILE = 0x8773,
TIFF_GEO_KEY_DIRECTORY = 0x87AF,
TIFF_GEO_DOUBLE_PARAMS = 0x87B0,
TIFF_GEO_ASCII_PARAMS = 0x87B1,

Some files were not shown because too many files have changed in this diff Show More