Commit Graph

111702 Commits

Author SHA1 Message Date
Andreas Rheinhardt 50ea7389ec avfilter: Deduplicate default audio inputs/outputs
Lots of audio filters use very simple inputs or outputs:
An array with a single AVFilterPad whose name is "default"
and whose type is AVMEDIA_TYPE_AUDIO; everything else is unset.

Given that we never use pointer equality for inputs or outputs*,
we can simply use a single AVFilterPad instead of dozens; this
even saves .data.rel.ro (4784B here) as well as relocations.

*: In fact, several filters (like the filters in af_biquads.c)
already use the same inputs; furthermore, ff_filter_alloc()
duplicates the input and output pads so that we do not even
work with the pads directly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-07 09:21:13 +02:00
Zhao Zhili 6b82f35041 fate/mov: add remux PCM to mp4 test
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-08-06 16:14:41 +08:00
Zhao Zhili 0c02ad857c avformat/movenc: fix sample size being zero in pcmC
bits_per_raw_sample might not set when remux raw PCM.

Fix #10433.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-08-06 16:14:41 +08:00
Michael Niedermayer 9549712056
avcodec/jpeg2000htdec: Consolidate jpeg2000 spec bits in jpeg2000_bitbuf_refill_backwards()
Code should make more sense now

Fixes: out of array access
Fixes: 58299/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-6627570448465920

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Pierre-Anthony Lemieux <pal@sandflow.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-08-05 19:52:00 +02:00
Andreas Rheinhardt dcd0c79f7e avcodec/svq1enc: Remove unnecessary cast
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-05 09:40:06 +02:00
Andreas Rheinhardt b35ae266cc avcodec/utils: Move ff_int_from_list_or_default() to its only user
Namely proresenc_anatoliy.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-05 09:40:06 +02:00
Andreas Rheinhardt 2ece81b4c0 avcodec/utils: Move ff_color_frame() to its only user
Namely h264_slice.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-05 09:40:06 +02:00
Andreas Rheinhardt 866be3fa1e avcodec/internal: Move FF_MAX_EXTRADATA_SIZE to its only user
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-05 09:40:06 +02:00
Andreas Rheinhardt 92f0d69846 avcodec/h264_metadata_bsf: Improve included headers
h264_sei.h is no longer used since the SEIs were moved to sei.h;
this also avoids inclusions of avcodec.h and bytestream.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-05 09:40:06 +02:00
Andreas Rheinhardt dda471bd85 avformat/rawdec: Don't include avcodec.h
Possible since 2850584876.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-05 09:40:06 +02:00
Andreas Rheinhardt 61f6766d35 avcodec/dirac: Include used headers directly
Don't include them implicitly via avcodec.h. This avoids
indirect avcodec.h inclusions in lavc/dirac.c, lavf/oggparsedirac.c,
and lavf/rtp(dec|enc)_vc2hq.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-05 09:40:06 +02:00
Andreas Rheinhardt 76f244b84e avformat/internal: Use forward declaration for AVCodecDescriptor
This avoids including lavc/codec_desc.h everywhere and thereby
forces users to include it directly instead of lazily and potentially
unknowingly relying on indirect inclusions.

Also add the proper inclusion to libavformat/demux.c, one of the
two files that actually use the new field.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-05 09:40:06 +02:00
Andreas Rheinhardt abc6a4a6bc avformat/evcdec: Remove unused headers
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-05 09:40:06 +02:00
Andreas Rheinhardt 09e8ccb19e avformat/av1dec: Remove avcodec.h inclusion
Possible since 60ecf44b03.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-05 09:40:06 +02:00
Andreas Rheinhardt 5d63bd5b9c avcodec/h264dec: Move inline functions only used by CABAC/CAVLC code
Most of the inline functions in h264dec.h are only used
by h264_cavlc.c and h264_cabac.c. Therefore move them
to the common header for these two, namely h264_mvpred.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-05 09:40:06 +02:00
Andreas Rheinhardt befb7e7d79 avcodec/tak: Use void* instead of AVCodecContext* for logcontext
Avoids implicit inclusions of avcodec.h in lavf/takdec.c
and lavc/tak.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-05 09:40:06 +02:00
Andreas Rheinhardt 00597af58b avdevice/pulse_audio_common: Avoid inclusion of avcodec.h
It only needs codec_id.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-05 09:40:06 +02:00
Andreas Rheinhardt 7469f2ec0a avcodec/avcodec: Remove unnecessary forward declaration
This would only be necessary if this header declared a function
that takes a (pointer to) struct AVCodecContext as parameter.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-05 09:40:06 +02:00
Martin Storsjö 7aa9684db3 w32pthreads: Fix function signature mismatches for CreateThread
In WinRT mode, we use CreateThread instead of _beginthreadex.

CreateThread takes a LPTHREAD_START_ROUTINE function pointer,
which has got the signature DWORD WINAPI ThreadProc(LPVOID).
_beginthreadex takes a function with the signature
unsigned __stdcall func(void *).

DWORD is defined as an unsigned long, which is different type
from unsigned int, even if they have the same size on Windows.

This fixes build failures with Clang 16 and newer, where function
pointer type mismatches are a fatal error by default.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-08-04 21:51:20 +03:00
Martin Storsjö 271c8229f8 tests: Correctly distinguish between SAMPLES and TARGET_SAMPLES for hls_fmp4_ac3.m3u8
This fixes the test when running in a cross test setup where the
samples are located at a different path between build host and
temote test target.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-08-04 21:51:17 +03:00
Martin Storsjö 62fac040c8 intreadwrite: Indicate potential aliasing in AV_RN/AV_WN for Clang/MSVC mode
Use the GCC specific codepath for Clang in MSVC mode too.
This matches the condition used in a number of other places.

MSVC doesn't have a way to signal potential aliasing, while GCC
(and Clang) can use __attribute__((may_alias)) for this purpose.

When building with Clang in MSVC mode, __GNUC__ isn't defined but
_MSC_VER is as Clang primarily impersonates MSVC - but even then it
does support the GCC style attributes.

The GCC specific codepath uses av_alias, which expands to
the may_alias attribute if supported. The MSVC specific codepath
doesn't use av_alias so far (as MSVC doesn't support any
corresponding attribute).

This fixes a couple HEVC decoder tests when built with Clang 14 or
newer in MSVC mode (with issues observed on all of x86_64, armv7
and aarch64).

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-08-04 21:50:57 +03:00
Andreas Rheinhardt 802d2d1f02 avcodec/error_resilience, mpeg12dec: Remove always-true checks
Having a decode_slice callback is mandatory for HWAccels;
the only exception to this (and the reason why these checks
were added) was XvMC, but it is no more since commit
be95df12bb.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-04 11:50:34 +02:00
Andreas Rheinhardt 1062a6d6c4 avfilter/avfilter: Make functions only used here static
Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-04 11:49:26 +02:00
Andreas Rheinhardt 9732684ba2 avfilter/avfilter: Also deprecate variable name
Otherwise the var_names and the corresponding enum will be off
and e.g. the array holding the variable values will be too small.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-04 11:47:32 +02:00
Haihao Xiang 84fb7b9459 lavfi/vf_vpp_qsv: perform conversion from HDR to SDR
option tonemap is added to disable / enable tonemapping. By default
tonemapping is not performed.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-08-04 10:27:55 +08:00
Haihao Xiang b66aecf1b4 lavfi/vf_vpp_qsv: set color properties for output
User may set color range / matrix coefficient set / primaries / transfer
characteristics for output.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-08-04 10:27:55 +08:00
Haihao Xiang b42ea03f8b lavfi/vf_vpp_qsv: take input color properties into account
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-08-04 10:27:55 +08:00
Haihao Xiang 96b0b3f67a lavfi/qsvvpp: add set_frame_ext_params callback
This allows we add mfxExtBuffer per frame later.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-08-04 10:27:55 +08:00
Michael Niedermayer 044ab532fc
avcodec/jpeg2000htdec: Avoid freeing uninitialized pointers in ff_jpeg2000_decode_htj2k()
Fixes: freeing of uninitialized pointers
Fixes: part of 58299

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-08-04 00:06:26 +02:00
Marton Balint 207e9f4e50 avformat/flvdec: handle exheader fourcc correctly in metadata
In metadata fourcc is carried in the AMF number, not as binary.

Partially based on a patch by Steven Liu.

Signed-off-by: Marton Balint <cus@passwd.hu>
2023-08-03 21:56:00 +02:00
Andreas Rheinhardt c7ff0c3e4b avcodec/sga: Don't use GetBit-API for byte-aligned reads
Use the bytestream2-API instead.
Should also fix Coverity issue #1473536 (which is about an unchecked
init_get_bits8()).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-02 18:31:59 +02:00
Andreas Rheinhardt 27a9e1ce22 avcodec/mpegvideo_dec: Use av_fast_padded_malloc where appropriate
Will probably also fix Coverity issue #1473529.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-02 18:31:59 +02:00
Andreas Rheinhardt 2d7c1479c2 avcodec/nvenc: Remove always-true check
nvenc_store_frame_data() is always called with frame != NULL
(checked at the beginning of nvenc_send_frame());
in fact, frame is dereferenced unconditionally after the block
guarded by the check for frame. Therefore Coverity complains
about this in issue #1538295.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-02 18:31:59 +02:00
Andreas Rheinhardt 28817b90fc avformat/hls_sample_encryption: Always free AC3HeaderInfo on error
The code currently presumes that a return value of AVERROR(ENOMEM)
implies that ac3hdr could not be allocated, so it need not be freed.
Yet any avpriv_ac3_parse_header() might allocate more than the
AC3HeaderInfo internally (it doesn't currently), so simply free
it unconditionally.

Fixes Coverity issues #1492870 and #1492868.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-02 18:31:59 +02:00
Andreas Rheinhardt 80cc9b81de avcodec/nvdec_(mjpeg|vp8): Constify AVHWAccels
The discrepancy between the actual definition and the declarations
in hwaccels.h is actually UB.

Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-02 18:16:00 +02:00
Andreas Rheinhardt 739f24d833 fftools/opt_common: Don't add unnecessary " "
Before:
D.AIL. smackaudio           Smacker audio (decoders: smackaud )
After:
D.AIL. smackaudio           Smacker audio (decoders: smackaud)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-02 18:15:34 +02:00
Andreas Rheinhardt 41409405d4 fftools/opt_common: Use %c instead of %s to write single char
Also combine multiple printfs.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-02 18:15:34 +02:00
Michael Niedermayer 32556fa62b
avformat/avr: Check sample rate
Fixes: 54979/clusterfuzz-testcase-minimized-ffmpeg_dem_AVR_fuzzer-6681035461230592
Fixes: Timeout

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-08-02 17:31:13 +02:00
Eli Kobrin 3e97d96e6f
libswresample: Prevent out of bounds.
We've been fuzzing torchvision with [sydr-fuzz](https://github.com/ispras/oss-sydr-fuzz)
and found out of bounds error in ffmpeg project at audioconvert.c:151.
To prevent error we need to fix checks for in and out fmt in swr_init.

Signed-off-by: Eli Kobrin <kobrineli@ispras.ru>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-08-02 17:31:13 +02:00
Andreas Rheinhardt 0e9956a06e fftools/ffprobe: Fix memleak
Fixes Coverity issue #1524491.
Regression since e6126abc69.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-01 16:31:13 +02:00
Haihao Xiang 567e78b283 lavfi/vf_vpp_qsv: fix duration in pass-through mode
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-07-31 09:09:20 +08:00
Haihao Xiang e63d9ba007 lavu/hwcontext_qsv: silence the warning
libavutil/hwcontext_qsv.c: In function ‘qsv_map_to’:
libavutil/hwcontext_qsv.c:1905:47: warning: cast from pointer to integer
of different size [-Wpointer-to-int-cast]

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-07-31 09:09:20 +08:00
Andreas Rheinhardt a105b11a9d avcodec/cbs: Add specialization for ff_cbs_(read|write)_unsigned()
These functions allow not only to read and write unsigned values,
but also to check ranges and to emit trace output which can be
beautified when processing arrays (indices like "[i]" are replaced
by their actual numbers).

Yet lots of callers actually only need something simpler:
Their range is only implicitly restricted by the amount
of bits used and they are not part of arrays, hence don't
need this beautification.

This commit adds specializations for these callers;
this is very beneficial size-wise (it reduced the size
of .text by 23312 bytes here), as a call is now cheaper.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-07-30 21:36:31 +02:00
Andreas Rheinhardt b85557b231 avcodec/h264_slice: Remove always-false check
The H.264 decoder, the only codec with which this code
is ever called, does not set AVCodec.pix_fmts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-07-30 21:36:31 +02:00
Paul B Mahol 8bbaecb5de avfilter/avf_showcwt: improve range detection for morlet scales 2023-07-30 19:57:50 +02:00
Paul B Mahol 48cd5561e1 avfilter/avf_showcwt: rename option value 2023-07-30 18:14:16 +02:00
Paul B Mahol bd23b1d0ac avfilter/avf_showcwt: add iscale option 2023-07-30 18:14:16 +02:00
Paul B Mahol 6f552b9c5e avfilter/avf_showcwt: improve caching of some arrays 2023-07-30 18:14:15 +02:00
Paul B Mahol 4f8b0beeba avfilter/avf_showcwt: reduce excessive operations 2023-07-30 18:14:15 +02:00
Andreas Rheinhardt bf9f6a5e55 avformat/lrcdec: Fix declaration-after-statement warning
Happens since c0f867bf50.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-07-29 17:58:58 +02:00