ffmpeg.git
2 months agolibavcodec/libx265: add user data unregistered SEI encoding
Brad Hards [Mon, 12 Jul 2021 08:24:37 +0000 (18:24 +1000)]
libavcodec/libx265: add user data unregistered SEI encoding

MISB ST 0604 and ST 2101 require user data unregistered SEI messages
(precision timestamps and sensor identifiers) to be included. That
currently isn't supported for libx265. This patch adds support
for user data unregistered SEI messages in accordance with
ISO/IEC 23008-2:2020 Section D.2.7

The design is based on nvenc, with support finished up at
57de80673cb

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2 months agoffmpeg_opt: restore documented stream selection behaviour
Gyan Doshi [Wed, 28 Jul 2021 07:23:42 +0000 (12:53 +0530)]
ffmpeg_opt: restore documented stream selection behaviour

11d3b03fcb added consideration of default stream disposition for audio
and video when choosing the 'best' stream among all the inputs. This can
lead to video streams with lower resolution or audio streams with fewer
channels being selected.

Stream disposition, however, only sets a priority for a stream
among all other streams in the *same input*. It cannot set a priority
for a stream across all inputs.

This patch sets a middle-way and selects the best stream from each file
with default disposition considered. Then it discards disposition weight
and selects best stream as per the original criteria of highest
resolution for video and most channels for audio.

2 months agoavformat/mxfdec: prefer footer and complete partitions for metadata
Marton Balint [Sun, 27 Jun 2021 20:59:49 +0000 (22:59 +0200)]
avformat/mxfdec: prefer footer and complete partitions for metadata

Also do not store inferior metadata with the same UID.

Signed-off-by: Marton Balint <cus@passwd.hu>
2 months agoavformat/wavdec: Use 64bit in new_pos computation
Michael Niedermayer [Tue, 27 Apr 2021 18:57:02 +0000 (20:57 +0200)]
avformat/wavdec: Use 64bit in new_pos computation

Fixes: signed integer overflow: 129 * 16711680 cannot be represented in type 'int'
Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_WAV_fuzzer-6742285317439488

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavformat/sbgdec: Check for overflow in timestamp preparation
Michael Niedermayer [Tue, 27 Apr 2021 18:53:32 +0000 (20:53 +0200)]
avformat/sbgdec: Check for overflow in timestamp preparation

Fixes: signed integer overflow: 9223372036854775807 + 86400000000 cannot be represented in type 'long'
Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_SBG_fuzzer-6731040263634944

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavformat/dsicin: Check packet size for overflow
Michael Niedermayer [Fri, 23 Apr 2021 17:44:08 +0000 (19:44 +0200)]
avformat/dsicin: Check packet size for overflow

Fixes: signed integer overflow: 24672 + 2147483424 cannot be represented in type 'int'
Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_DSICIN_fuzzer-6731325979623424

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavformat/dsfdec: Change order of operations in bitrate computation
Michael Niedermayer [Fri, 23 Apr 2021 17:39:16 +0000 (19:39 +0200)]
avformat/dsfdec: Change order of operations in bitrate computation

Fixes: signed integer overflow: 538976288 * 67372036 cannot be represented in type 'int'
Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_DSF_fuzzer-6751696819716096

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavformat/bfi: check nframes
Michael Niedermayer [Fri, 23 Apr 2021 17:33:58 +0000 (19:33 +0200)]
avformat/bfi: check nframes

Fixes: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int'
Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_BFI_fuzzer-6737028768202752

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavformat/avidec: fix position overflow in avi_load_index()
Michael Niedermayer [Fri, 23 Apr 2021 17:11:03 +0000 (19:11 +0200)]
avformat/avidec: fix position overflow in avi_load_index()

Fixes: signed integer overflow: 9223372033098784808 + 4294967072 cannot be represented in type 'long'
Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_AVI_fuzzer-6732488912273408

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavformat/asfdec_f: Check sizeX against padding
Michael Niedermayer [Fri, 23 Apr 2021 15:35:20 +0000 (17:35 +0200)]
avformat/asfdec_f: Check sizeX against padding

Fixes: signed integer overflow: 2147483607 + 64 cannot be represented in type 'int'
Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_ASF_fuzzer-6753897878257664

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavformat/aiffdec: Check for size overflow in header parsing
Michael Niedermayer [Fri, 23 Apr 2021 15:28:29 +0000 (17:28 +0200)]
avformat/aiffdec: Check for size overflow in header parsing

Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_AIFF_fuzzer-6723467048255488

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/aaccoder: Add minimal bias in search_for_ms()
Michael Niedermayer [Mon, 31 May 2021 19:00:32 +0000 (21:00 +0200)]
avcodec/aaccoder: Add minimal bias in search_for_ms()

Fixes: floating point division by 0
Fixes: Ticket8218

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months agoavcodec/noise_bsf: restore dropamount for backwards compatibility
Gyan Doshi [Fri, 30 Jul 2021 11:38:53 +0000 (17:08 +0530)]
avcodec/noise_bsf: restore dropamount for backwards compatibility

2 months agoavfilter/avf_showfreqs: switch to TX FFT from avutil
Paul B Mahol [Fri, 30 Jul 2021 07:24:49 +0000 (09:24 +0200)]
avfilter/avf_showfreqs: switch to TX FFT from avutil

2 months agoavformat/mxfdec: fix frame wrapping detection for J2K essence container
Pierre-Anthony Lemieux [Sun, 18 Jul 2021 18:07:43 +0000 (11:07 -0700)]
avformat/mxfdec: fix frame wrapping detection for J2K essence container

For JPEG 2000 essence, the MXF input format module currently uses the value of
byte 14 of the essence container UL to determine whether the J2K essence is
clip- (byte 14 is 0x02) or frame-wrapped (byte 14 is 0x01). Otherwise it
assumes an unknown wrapping.

Additional wrappings are documented in SMPTE ST422:2019:

0x03: Interlaced Frame, 1 field/KLV
0x04: Interlaced Frame, 2 fields/KLV
0x05: Field-wrapped Picture Element
0x06: Frame-wrapped Picture Element

And these should also be handled as frame wrapped content.

Signed-off-by: Pierre-Anthony Lemieux <pal@sandflow.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2 months agopostproc/postprocess: Remove legacy cruft
Andreas Rheinhardt [Fri, 23 Jul 2021 14:24:45 +0000 (16:24 +0200)]
postproc/postprocess: Remove legacy cruft

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2 months ago(postproc|swresample)/version: Don't include libavutil/avutil.h
Andreas Rheinhardt [Fri, 23 Jul 2021 14:21:56 +0000 (16:21 +0200)]
(postproc|swresample)/version: Don't include libavutil/avutil.h

Instead only include libavutil/version.h; including avutil.h is a
remnant from the time in which the version was in it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2 months agoavutil/error: Include macros.h for MKTAG
Andreas Rheinhardt [Fri, 23 Jul 2021 05:41:54 +0000 (07:41 +0200)]
avutil/error: Include macros.h for MKTAG

Up until now, including error.h alone does not make the AVERROR_* defines
usable, because they just expand to something involving MKTAG, but
without the header providing MKTAG. So include macros.h, the header
providing MKTAG.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2 months agoavutil/common, macros: Move several macros from common.h to macros.h
Andreas Rheinhardt [Fri, 23 Jul 2021 16:52:27 +0000 (18:52 +0200)]
avutil/common, macros: Move several macros from common.h to macros.h

common.h currently contains several things: Math macros, UTF-8 macros,
other fundamental macros; furthermore it also contains miscellaneous
math functions and it (directly and indirectly) includes lots of other
headers.

This commit moves the "other fundamental macros" to macros.h which is
a more fitting place.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2 months agoavformat/internal: Move ff_read_line_to_bprint_overwrite to avio_internal.h
Andreas Rheinhardt [Fri, 23 Jul 2021 02:01:44 +0000 (04:01 +0200)]
avformat/internal: Move ff_read_line_to_bprint_overwrite to avio_internal.h

It only uses an AVIOContext and an AVBPrint.

When doing so, it turned out that several non-users of
ff_read_line_to_bprint_overwrite() and ff_bprint_to_codecpar_extradata()
relied on libavformat/internal.h to include bprint.h or avstring.h
for them. In order to avoid a repeat of this and in order to reduce
unnecessary dependencies, a forward declaration of struct AVBPrint is
used instead of including bprint.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2 months agoavformat/aviobuf: Make ff_read_line_to_bprint() static
Andreas Rheinhardt [Fri, 23 Jul 2021 01:06:26 +0000 (03:06 +0200)]
avformat/aviobuf: Make ff_read_line_to_bprint() static

It is only used in ff_read_line_to_bprint_overwrite().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2 months agoavcodec/noise_bsf: add expr support
Gyan Doshi [Sun, 25 Jul 2021 10:01:54 +0000 (15:31 +0530)]
avcodec/noise_bsf: add expr support

3 months agoavcodec/mips: cabac.h provide fallback for wsbh instruction
Jiaxun Yang [Fri, 23 Jul 2021 05:53:44 +0000 (13:53 +0800)]
avcodec/mips: cabac.h provide fallback for wsbh instruction

wsbh is only avilable for MIPS R2+.
Provide a fallback for older processors.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavutil/mips: Use $at as MMI macro temporary register
Jiaxun Yang [Fri, 23 Jul 2021 05:53:43 +0000 (13:53 +0800)]
avutil/mips: Use $at as MMI macro temporary register

Some function had exceed 30 inline assembly register oprands limiation
when using LOONGSON2 version of MMI macros. We can avoid that by take
$at, which is register reserved for assembler, as temporary register.

As none of instructions used in these macros is pseudo, it is safe to
utilize $at here.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavcodec/mips: Use MMI marcos to replace Loongson3 instructions
Jiaxun Yang [Fri, 23 Jul 2021 05:53:42 +0000 (13:53 +0800)]
avcodec/mips: Use MMI marcos to replace Loongson3 instructions

Loongson3's extention instructions (prefixed with gs) are widely used
in our MMI codebase. However, these instructions are not avilable on
Loongson-2E/F while MMI code should work on these processors.

Previously we introduced mmiutils marcos to provide backward compactbility
but newly commited code didn't follow that. In this patch I revised the
codebase and converted all these instructions into MMI marcos to get
Loongson2 supproted again.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavutil/mips: Use MMI_{L, S}QC1 macro in {SAVE, RECOVER}_REG
Jiaxun Yang [Fri, 23 Jul 2021 05:53:41 +0000 (13:53 +0800)]
avutil/mips: Use MMI_{L, S}QC1 macro in {SAVE, RECOVER}_REG

{SAVE,RECOVER}_REG will be available for Loongson2 again,
also comment about the magic.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavformat/mov: Remove pointless EOF checks
Andreas Rheinhardt [Sat, 24 Jul 2021 04:14:13 +0000 (06:14 +0200)]
avformat/mov: Remove pointless EOF checks

9888ffb1ce5e0a17f711b01933d504c72ea29d3b added checks for EOF
in loops in the mov demuxer as a precaution against timeouts;
yet there is no I/O in the loop when parsing the STSZ atom
as the values are read from an already read buffer. So remove said
checks.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 months agoavformat/mov: Fix crash with too big STSZ atoms
Andreas Rheinhardt [Sat, 24 Jul 2021 03:43:12 +0000 (05:43 +0200)]
avformat/mov: Fix crash with too big STSZ atoms

mov_read_stsz() did not ensure that every bit of a buffer is addressable
by an int as is required by the get_bits API, leading to a crash in
ticket #9344. Fix this by restricting the size more thoroughly.

The file from said ticket will then be considered invalid; in the
future, we might read and process the data in chunks to actually support
such files.

Fixes ticket #9344.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 months agotools/target_dec_fuzzer: Adjust threshold for VP6F
Michael Niedermayer [Sun, 25 Jul 2021 13:21:36 +0000 (15:21 +0200)]
tools/target_dec_fuzzer: Adjust threshold for VP6F

Fixes: Timeout
Fixes: 34791/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP6F_fuzzer-4571038838030336

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agotools/target_dec_fuzzer: Adjust the threshold for VP5
Michael Niedermayer [Tue, 20 Jul 2021 15:51:47 +0000 (17:51 +0200)]
tools/target_dec_fuzzer: Adjust the threshold for VP5

Fixes: Timeout
Fixes: 35793/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP5_fuzzer-6492854393372672

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agotools/target_dec_fuzzer: Adjust the threshold for VP3
Michael Niedermayer [Tue, 20 Jul 2021 15:46:09 +0000 (17:46 +0200)]
tools/target_dec_fuzzer: Adjust the threshold for VP3

Fixes: Timeout
Fixes: 35855/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP3_fuzzer-4851183540895744

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavformat/mov: Fix incorrect overflow detection in mov_read_sidx()
Michael Niedermayer [Wed, 28 Apr 2021 14:53:52 +0000 (16:53 +0200)]
avformat/mov: Fix incorrect overflow detection in mov_read_sidx()

Fixes: signed integer overflow: 9223372036854775807 + 1442840321 cannot be represented in type 'long'
Fixes: 33670/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6644379491106816

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agotools/target_dec_fuzzer: Fix extradata duplication
Michael Niedermayer [Sat, 24 Jul 2021 16:18:23 +0000 (18:18 +0200)]
tools/target_dec_fuzzer: Fix extradata duplication

Fixes: out of array access
Fixes: 36340/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-5872546875572224.fuzz

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agolibavcodec/mpeg12dec.c: Switch to init_get_bits8 and checks return value
Thierry Foucu [Tue, 27 Jul 2021 18:25:04 +0000 (11:25 -0700)]
libavcodec/mpeg12dec.c: Switch to init_get_bits8 and checks return value

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavfilter/avf_showcqt: switch to TX FFT from avutil
Paul B Mahol [Tue, 27 Jul 2021 19:16:28 +0000 (21:16 +0200)]
avfilter/avf_showcqt: switch to TX FFT from avutil

3 months agoavfilter/af_afftdn: switch to TX FFT from avutil
Paul B Mahol [Tue, 27 Jul 2021 18:48:40 +0000 (20:48 +0200)]
avfilter/af_afftdn: switch to TX FFT from avutil

3 months agoavfilter/avf_concat: fix EOF timestamp
Paul B Mahol [Sun, 25 Jul 2021 18:09:44 +0000 (20:09 +0200)]
avfilter/avf_concat: fix EOF timestamp

3 months agoqsvenc: Value '0' is not a valid value for parameter GopOptFlag
Haihao Xiang [Thu, 5 Nov 2020 07:08:23 +0000 (15:08 +0800)]
qsvenc: Value '0' is not a valid value for parameter GopOptFlag

The accepted values for GopOptFlag are MFX_GOP_CLOSED (1) and
MFX_GOP_STRICT (2).

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
Signed-off-by: Zhong Li <zhongli_dev@126.com>
3 months agoavformat/concat: check the terminating character returned by av_get_token()
James Almer [Tue, 27 Jul 2021 15:00:03 +0000 (12:00 -0300)]
avformat/concat: check the terminating character returned by av_get_token()

Don't attempt to increase the cursor pointer if it was \0.
Fixes invalid reads.

Reviewed-by: Marton Balint <cus@passwd.hu>
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: James Almer <jamrial@gmail.com>
3 months agoavfilter/vf_pseudocolor: add three more presets
Paul B Mahol [Mon, 26 Jul 2021 20:49:02 +0000 (22:49 +0200)]
avfilter/vf_pseudocolor: add three more presets

3 months agoavcodec/h264_sei: honor the Film Grain Characteristics cancel flag
James Almer [Mon, 26 Jul 2021 02:09:00 +0000 (23:09 -0300)]
avcodec/h264_sei: honor the Film Grain Characteristics cancel flag

Film Grain persistence is cancelled when it's true.

Signed-off-by: James Almer <jamrial@gmail.com>
3 months agoavfilter/af_silenceremove: make window also depends on input sample format
Paul B Mahol [Sun, 25 Jul 2021 19:50:31 +0000 (21:50 +0200)]
avfilter/af_silenceremove: make window also depends on input sample format

3 months agoffmpeg: fix order between field order autodetection and override
Jan Ekström [Mon, 19 Jul 2021 20:25:28 +0000 (23:25 +0300)]
ffmpeg: fix order between field order autodetection and override

Having the override before autodetection meant that the overridden
value got overwritten by the autodetected result each time,
effectively disabling the ability to utilize the `-top` option
for override purposes.

Somehow I missed this in fbb44bc51a647862eb05ae3f9d7d49a0be9bed57 ,
even though the lines were within the context. Probably the code
originally being after this logic had something to do with it,
but previously it only touched the avformat context's codecpar,
which did not affect the encoder codec context whatsoever.

Fixes #9320
Fixes #9339

3 months agoavformat/yuv4mpegenc: add support for yuva444p
Paul B Mahol [Sat, 24 Jul 2021 16:07:57 +0000 (18:07 +0200)]
avformat/yuv4mpegenc: add support for yuva444p

3 months agoavfilter/af_silenceremove: add support for more sample formats
Paul B Mahol [Sun, 25 Jul 2021 13:38:33 +0000 (15:38 +0200)]
avfilter/af_silenceremove: add support for more sample formats

3 months agoavfilter/f_ebur128: fix video output regression
Paul B Mahol [Sun, 25 Jul 2021 11:04:03 +0000 (13:04 +0200)]
avfilter/f_ebur128: fix video output regression

3 months agoavfilter/f_ebur128: add all sample rates support
Paul B Mahol [Thu, 4 Mar 2021 13:01:39 +0000 (14:01 +0100)]
avfilter/f_ebur128: add all sample rates support

The magic constants come from the unofficial "ITU-R BS.1770-1 filter
specifications"¹ by Raiden (libebur128) which relies on "Parameter
Quantization in Direct-Form Recursive Audio Filters"² by Brian
Neunaber.

The constants seem to include a quantization bias, for example:
- Vb is supposed to be exactly √Vh in a high shelf filter
- the Pre-filter Gain should likely be 4dB
- Pre Q and RLB Q are respectively very close to √½ and ½

Those are not adjusted to prevent the values from drifting away from
the official specifications.

An alternative to this approach would be to requantize on the fly as
proposed by pbelkner³, where the 48kHz code path would use the exact
specifications constants while derivating constants for other
frequencies.

[1]: https://www.scribd.com/document/49991813/ITU-R-BS-1770-1-filters
[2]: https://www.scribd.com/document/6531763/Direct-Form-Filter-Parameter-Quantization
[3]: https://hydrogenaud.io/index.php?topic=86116.msg740092#msg740092

3 months agoavfilter/af_afwtdn: add forgotten break statement
Paul B Mahol [Sun, 25 Jul 2021 09:47:47 +0000 (11:47 +0200)]
avfilter/af_afwtdn: add forgotten break statement

3 months agoavfilter/vf_threshold: add support for commands
Paul B Mahol [Sun, 25 Jul 2021 09:24:18 +0000 (11:24 +0200)]
avfilter/vf_threshold: add support for commands

3 months agoavfilter/af_anlmdn: add longer names of filter options
Paul B Mahol [Sun, 25 Jul 2021 08:22:42 +0000 (10:22 +0200)]
avfilter/af_anlmdn: add longer names of filter options

3 months agolavfi/signature: fix always true expression
Valerii Zapodovnikov [Mon, 24 May 2021 01:00:24 +0000 (04:00 +0300)]
lavfi/signature: fix always true expression

Otherwise since "==" has higher precedence, mode is never checked.

Reviewed-by: Jai Luthra <me@jailuthra.in>
3 months agoavfilter/vf_pseudocolor: add solar preset
Paul B Mahol [Sat, 24 Jul 2021 21:12:13 +0000 (23:12 +0200)]
avfilter/vf_pseudocolor: add solar preset

Useful to emphasize bandings in video.

3 months agoavfilter/vf_fillborders: add another mode
Paul B Mahol [Sat, 24 Jul 2021 18:20:52 +0000 (20:20 +0200)]
avfilter/vf_fillborders: add another mode

3 months agoavfilter/avf_showspectrum: fix not rendering all channels with fscale=log:mode=separate
Paul B Mahol [Sat, 24 Jul 2021 15:30:58 +0000 (17:30 +0200)]
avfilter/avf_showspectrum: fix not rendering all channels with fscale=log:mode=separate

3 months agoconfigure: remove sofalizer triggering of avcodec dependency
Paul B Mahol [Sat, 24 Jul 2021 15:01:20 +0000 (17:01 +0200)]
configure: remove sofalizer triggering of avcodec dependency

3 months agoavfilter/avf_showspectrum: fix hz scale with legend enabled
Paul B Mahol [Sat, 24 Jul 2021 14:56:51 +0000 (16:56 +0200)]
avfilter/avf_showspectrum: fix hz scale with legend enabled

3 months agoavfilter/avf_showspectrum: switch to TX FFT from avutil
Paul B Mahol [Sat, 24 Jul 2021 12:22:38 +0000 (14:22 +0200)]
avfilter/avf_showspectrum: switch to TX FFT from avutil

3 months agoavfilter/af_headphone: switch to TX FFT from avutil
Paul B Mahol [Sat, 24 Jul 2021 10:17:36 +0000 (12:17 +0200)]
avfilter/af_headphone: switch to TX FFT from avutil

3 months agoavfilter/af_sofalizer: switch to TX FFT from avutil
Paul B Mahol [Sat, 24 Jul 2021 09:26:08 +0000 (11:26 +0200)]
avfilter/af_sofalizer: switch to TX FFT from avutil

3 months agoavfilter: add afwtdn filter
Paul B Mahol [Sun, 31 May 2020 08:22:23 +0000 (10:22 +0200)]
avfilter: add afwtdn filter

3 months agotools/graph2dot: Don't use sizeof(AVFilterGraph), check allocation
Andreas Rheinhardt [Thu, 22 Jul 2021 07:01:27 +0000 (09:01 +0200)]
tools/graph2dot: Don't use sizeof(AVFilterGraph), check allocation

Use avfilter_graph_alloc() instead of av_mallocz(sizeof(AVFilterGraph))
to allocate an AVFilterGraph; this also properly allocates the graph's
internal. The current code just happened to work because it did not
make any use of said internal.

Also check the allocation; this fixes Coverity #1292528.

Reviewed-by: Jan Ekström <jeebjp@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 months agoavcodec/h264_sei: parse and export Film Grain Characteristics SEI messages
James Almer [Fri, 23 Jul 2021 14:06:45 +0000 (11:06 -0300)]
avcodec/h264_sei: parse and export Film Grain Characteristics SEI messages

Signed-off-by: James Almer <jamrial@gmail.com>
3 months agoavutil/film_grain_params: add support for H.274 Film Grain Characteristics
James Almer [Fri, 23 Jul 2021 14:06:31 +0000 (11:06 -0300)]
avutil/film_grain_params: add support for H.274 Film Grain Characteristics

Used by codecs like H.264, HEVC, and VVC.

Signed-off-by: James Almer <jamrial@gmail.com>
3 months agocbs_h264: add support for Film Grain Characteristics SEI messages
James Almer [Fri, 23 Jul 2021 14:05:04 +0000 (11:05 -0300)]
cbs_h264: add support for Film Grain Characteristics SEI messages

Signed-off-by: James Almer <jamrial@gmail.com>
3 months agoavfilter/vf_shufflepixels: Check ff_get_video_buffer()
Andreas Rheinhardt [Thu, 22 Jul 2021 07:24:20 +0000 (09:24 +0200)]
avfilter/vf_shufflepixels: Check ff_get_video_buffer()

There would be a segfault in case of (likely memory allocation) failure.
Fixes Coverity issue #1322338.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 months agoavformat/yuv4mpegdec: Use table instead of repeated "else if"
Andreas Rheinhardt [Wed, 21 Jul 2021 11:15:00 +0000 (13:15 +0200)]
avformat/yuv4mpegdec: Use table instead of repeated "else if"

The code savings more than offset the size of the table
(1936B vs 768B with GCC 10.3 at -O3).

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 months agoavcodec/tableprint_vlc: Fix building with hardcoded tables
Andreas Rheinhardt [Thu, 22 Jul 2021 23:00:13 +0000 (01:00 +0200)]
avcodec/tableprint_vlc: Fix building with hardcoded tables

This has been broken in 25c8507818d8559a6654a5b30a0f8aae11a48181,
because the hacks for headers that are incompatible with building
for the host in libavcodec/tableprint_vlc.h have not been adjusted.

Moving AV_INPUT_BUFFER_PADDING_SIZE to defs.h which is valid for
both the target as well as the host allowed to remove some of the hacks.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 months agotools/target_dec_fuzzer: Adjust threshold for libvorbis
Michael Niedermayer [Thu, 22 Apr 2021 16:13:38 +0000 (18:13 +0200)]
tools/target_dec_fuzzer: Adjust threshold for libvorbis

Fixes: Timeout
Fixes: 33513/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LIBVORBIS_fuzzer-6481006635909120

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavformat/mov: Avoid undefined overflow in time_offset calculation
Michael Niedermayer [Tue, 20 Apr 2021 15:40:56 +0000 (17:40 +0200)]
avformat/mov: Avoid undefined overflow in time_offset calculation

Fixes: signed integer overflow: 8511838621821575200 - -3954125146725285889 cannot be represented in type 'long'
Fixes: 33414/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6610119325515776

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoRemove/replace some unnecessary avcodec.h inclusions
Andreas Rheinhardt [Mon, 14 Jun 2021 16:03:55 +0000 (18:03 +0200)]
Remove/replace some unnecessary avcodec.h inclusions

Also remove other unnecessary headers and include headers directly while
at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 months agoavcodec/g729postfilter.h: Include acelp_pitch_delay.h
Andreas Rheinhardt [Sun, 13 Jun 2021 13:44:20 +0000 (15:44 +0200)]
avcodec/g729postfilter.h: Include acelp_pitch_delay.h

Needed for PITCH_DELAY_MAX.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 months agoavcodec: Remove some unnecessary mpegvideo.h inclusions
Andreas Rheinhardt [Sat, 12 Jun 2021 23:35:01 +0000 (01:35 +0200)]
avcodec: Remove some unnecessary mpegvideo.h inclusions

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 months agoRemove unnecessary avassert.h inclusions
Andreas Rheinhardt [Thu, 22 Jul 2021 13:02:30 +0000 (15:02 +0200)]
Remove unnecessary avassert.h inclusions

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 months agoRemove unnecessary mem.h inclusions
Andreas Rheinhardt [Thu, 22 Jul 2021 12:47:57 +0000 (14:47 +0200)]
Remove unnecessary mem.h inclusions

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 months agoRemove obsolete version.h inclusions
Andreas Rheinhardt [Fri, 11 Jun 2021 19:54:31 +0000 (21:54 +0200)]
Remove obsolete version.h inclusions

These have mostly been added because of FF_API_*; yet when these were
removed, removing the header has been forgotten.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 months agoavutil/internal, swresample/audioconvert: Remove cpu.h inclusions
Andreas Rheinhardt [Sat, 12 Jun 2021 21:00:12 +0000 (23:00 +0200)]
avutil/internal, swresample/audioconvert: Remove cpu.h inclusions

These inclusions are not necessary, as cpu.h is already included
wherever it is needed (via direct inclusion or via the arch-specific
headers).
Also remove other unnecessary cpu.h inclusions from ordinary
non-headers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 months agoavcodec/lossless_videodsp: Improve included headers
Andreas Rheinhardt [Sat, 12 Jun 2021 20:31:53 +0000 (22:31 +0200)]
avcodec/lossless_videodsp: Improve included headers

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 months agoavcodec/avcodec: Don't include cpu.h
Andreas Rheinhardt [Sat, 12 Jun 2021 20:10:11 +0000 (22:10 +0200)]
avcodec/avcodec: Don't include cpu.h

It is not used here at all; instead, add it where it is used without
including it or any of the arch-specific CPU headers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 months agoavcodec/avcodec: Don't include hwcontext.h
Andreas Rheinhardt [Sat, 12 Jun 2021 19:04:28 +0000 (21:04 +0200)]
avcodec/avcodec: Don't include hwcontext.h

It is no longer used directly; but it is still indirectly included via
codec.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 months agoavcodec/avcodec: Don't include errno.h
Andreas Rheinhardt [Fri, 11 Jun 2021 23:14:27 +0000 (01:14 +0200)]
avcodec/avcodec: Don't include errno.h

This inclusion has been added before libavutil/error.h was split off
from avcodec.h (in 60c144f700e2e362047b00704abcb694d49e549c).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 months agoavcodec/avcodec: Stop including channel_layout.h in avcodec.h
Andreas Rheinhardt [Fri, 11 Jun 2021 23:10:58 +0000 (01:10 +0200)]
avcodec/avcodec: Stop including channel_layout.h in avcodec.h

Also include channel_layout.h directly wherever used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 months agoavcodec/avcodec: Stop including bsf.h in avcodec.h
Andreas Rheinhardt [Fri, 11 Jun 2021 21:35:33 +0000 (23:35 +0200)]
avcodec/avcodec: Stop including bsf.h in avcodec.h

Also include bsf.h directly wherever it is used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 months agoavcodec/adpcm_data: Move tables only used by adpcm.c to it
Andreas Rheinhardt [Thu, 17 Jun 2021 01:41:36 +0000 (03:41 +0200)]
avcodec/adpcm_data: Move tables only used by adpcm.c to it

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 months agoavcodec/adpcm_data: Fix type mismatch for ff_adpcm_afc_coeffs
Andreas Rheinhardt [Thu, 17 Jun 2021 01:34:57 +0000 (03:34 +0200)]
avcodec/adpcm_data: Fix type mismatch for ff_adpcm_afc_coeffs

According to the header it is an array of int16_t, yet it is declared as
uint16_t. Fix this by using int16_t troughout and convert the definition
to use values in the range of int16_t.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 months agoavcodec/adpcm: Don't include disabled AVCodecs
Andreas Rheinhardt [Tue, 8 Jun 2021 01:25:43 +0000 (03:25 +0200)]
avcodec/adpcm: Don't include disabled AVCodecs

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 months agoavcodec/adpcm: Disable dead code
Andreas Rheinhardt [Tue, 8 Jun 2021 16:26:52 +0000 (18:26 +0200)]
avcodec/adpcm: Disable dead code

This change ensures that the linker can drop adpcm_data.o if no decoder
that actually uses anything from there is enabled.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 months agoavcodec/adpcm: Fix indentation
Andreas Rheinhardt [Tue, 8 Jun 2021 14:52:15 +0000 (16:52 +0200)]
avcodec/adpcm: Fix indentation

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 months agoavcodec/adpcm: Use smaller scope for some variables
Andreas Rheinhardt [Mon, 7 Jun 2021 23:03:45 +0000 (01:03 +0200)]
avcodec/adpcm: Use smaller scope for some variables

This is to avoid unused variables warnings after the code for
the disabled encoders has been #if'ed away which will happen in
a subsequent commit.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 months agoavcodec/adpcmenc: Don't include disabled AVCodecs
Andreas Rheinhardt [Tue, 8 Jun 2021 01:25:43 +0000 (03:25 +0200)]
avcodec/adpcmenc: Don't include disabled AVCodecs

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 months agoavcodec/adpcmenc: Deduplicate AVClasses
Andreas Rheinhardt [Mon, 7 Jun 2021 14:13:33 +0000 (16:13 +0200)]
avcodec/adpcmenc: Deduplicate AVClasses

The child_class_next API relied on different (de)muxers to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 months agoavcodec/adpcmenc: #if disabled code away, fix build without ADPCM_ARGO
Andreas Rheinhardt [Tue, 8 Jun 2021 00:36:00 +0000 (02:36 +0200)]
avcodec/adpcmenc: #if disabled code away, fix build without ADPCM_ARGO

The adpcm_argo encoder does not use the data from adpcm_data.c directly;
instead it shares a function with the adpcm_argo decoder that is in
adpcm.c. When all the ADPCM decoders and the adpcm_argo encoder are
disabled, adpcm.c is not compiled; yet the code in adpcmenc.c calling
said function from adpcm.c is still present, leading to link errors.

Fix this by disabling the code belonging to disabled codecs in
adpcmenc.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 months agoavcodec/adpcmenc: Use smaller scope for some variables
Andreas Rheinhardt [Mon, 7 Jun 2021 23:03:45 +0000 (01:03 +0200)]
avcodec/adpcmenc: Use smaller scope for some variables

This is to avoid unused variables warnings if the code for disabled
encoders is #if'ed away which will happen in a subsequent commit.
In case of buf it also avoids shadowing.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 months agolavfi/dnn_backend_ov: Rename RequestItem to OVRequestItem
Shubhanshu Saxena [Sun, 11 Jul 2021 16:15:02 +0000 (21:45 +0530)]
lavfi/dnn_backend_ov: Rename RequestItem to OVRequestItem

Rename RequestItem to OVRequestItem in the OpenVINO backend
to avoid confusion.

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
3 months agolavfi/dnn_backend_openvino.c: Fix Memory Leak in execute_model_ov
Shubhanshu Saxena [Sun, 11 Jul 2021 16:15:01 +0000 (21:45 +0530)]
lavfi/dnn_backend_openvino.c: Fix Memory Leak in execute_model_ov

In cases where the execution inside the function execute_model_ov fails,
the OVRequestItem must be pushed back to the request_queue before returning
the error. In case pushing back fails, release the allocated memory.

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
3 months agolavu/kperf: use ff_thread_once()
J. Dekker [Wed, 21 Jul 2021 14:21:34 +0000 (16:21 +0200)]
lavu/kperf: use ff_thread_once()

Signed-off-by: J. Dekker <jdek@itanimul.li>
3 months agodoc/filters: note expr and eval mode support in overlay_cuda
Gyan Doshi [Wed, 21 Jul 2021 07:38:13 +0000 (13:08 +0530)]
doc/filters: note expr and eval mode support in overlay_cuda

Commit 58c908cf94 added support for expressions for x and y parameters.
Also added was option to set eval frequency.

3 months agoavutil/macos_kperf: add missing header guards
James Almer [Tue, 20 Jul 2021 22:01:02 +0000 (19:01 -0300)]
avutil/macos_kperf: add missing header guards

Fixes fate-source

Signed-off-by: James Almer <jamrial@gmail.com>
3 months agolavu/checkasm: add (private) kperf timing for macOS
J. Dekker [Tue, 20 Jul 2021 17:09:22 +0000 (19:09 +0200)]
lavu/checkasm: add (private) kperf timing for macOS

Signed-off-by: J. Dekker <jdek@itanimul.li>
3 months agoavfilter/af_drmeter: Check that there is data
Michael Niedermayer [Sat, 5 Jun 2021 18:28:24 +0000 (20:28 +0200)]
avfilter/af_drmeter: Check that there is data

Fixes: floating point division by 0
Fixes: -nan is outside the range of representable values of type 'int'
Fixes: Ticket8307

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavfilter/vf_fftdnoiz: Use lrintf() in export_row8()
Michael Niedermayer [Sat, 5 Jun 2021 18:12:08 +0000 (20:12 +0200)]
avfilter/vf_fftdnoiz: Use lrintf() in export_row8()

Fixes: 1.04064e+10 is outside the range of representable values of type 'int'
Fixes: Ticket 8279

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>