Commit Graph

111672 Commits

Author SHA1 Message Date
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
Paul B Mahol
37d3000e3e avfilter/avf_showcwt: fix truncation of low Hz kernels 2023-07-29 17:16:42 +02:00
Reimar Döffinger
c0f867bf50 libavformat: fix incorrect handling of incomplete AVBPrint.
Change some internal APIs a bit to make it harder to make
such mistakes.
In particular, have the read chunk functions return an error
when the result is incomplete.
This might be less flexible, but since there has been no
use-case for that so far, avoiding coding mistakes seems better.
Add a function to queue a AVBPrint directly (ff_subtitles_queue_insert_bprint).
Also fixes a leak in lrcdec when ff_subtitles_queue_insert fails.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2023-07-29 16:05:29 +02:00
Reimar Döffinger
dcff15692d hevcdsp_idct_neon.S: Avoid unnecessary mov.
ret can be given an argument instead.
This is also consistent with how other assembler code
in FFmpeg does it.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2023-07-29 16:05:23 +02:00
James Almer
075dfc271b avfilter/qsvvpp: remove usage of deprecated fields
Added by mistake in 88b3841149.

Reviewed-by: Xiang, Haihao <haihao.xiang@intel.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-07-29 09:25:58 -03:00
Paul B Mahol
44813d66e2 avfilter/avf_showcwt: make kernels symmetrical 2023-07-29 11:30:16 +02:00
Paul B Mahol
6f6907fd20 avfilter/avf_showcwt: fix very low freqs leakage 2023-07-29 11:30:16 +02:00
Andreas Rheinhardt
27b4364339 avcodec/fdctdsp: Mark functions as hidden
Pointers to these functions are used in comparisons.
Currently the compiler has to presume the worst for these,
namely that the functions are from another DSO and therefore
loads their addresses from the GOT (which also entails a
relocation entry that is processed at runtime, regardless
of whether the code using them is run or not). This changes
after these functions are declared as hidden.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-07-29 04:22:01 +02:00
Andreas Rheinhardt
8387241975 avcodec/dct: Move fdct function declarations to fdctdsp.h
It is the more proper place for them given that this is
the only API using them.
Also use a forward-declaration of AVCodecContext in fdctdsp.h
to avoid including avcodec.h in jfdct(fst|int).c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-07-29 04:16:59 +02:00
Andreas Rheinhardt
096563c108 avcodec/Makefile: Unconditionally skip vulkan_video_codec_av1std.h
libavcodec/vulkan_video_codec_av1std.h currently does not pass
checkheaders: It is missing stdint.h and vulkan/vulkan_core.h.
The comment "This header is NOT YET generated from the Khronos Vulkan
XML API Registry." as well as the fact that it does not use our standard
inclusion guards makes the file appear as if it is to be treated
like a third-party header and not one of our own. This commit
therefore "fixes" the issue by unconditionally skipping said header.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-07-29 04:06:58 +02:00
Paul B Mahol
8c67e13473 avfilter/avf_showcwt: remove not needed fabsf() 2023-07-28 22:32:31 +02:00
Paul B Mahol
7d6dd90f3a avfilter/avf_showcwt: unbreak highest frequencies
The kernel was truncated too much.
2023-07-28 22:32:31 +02:00
Paul B Mahol
dca54600f0 avfilter/avf_showcwt: keep kernels precision as high as possible 2023-07-28 22:32:31 +02:00
Jan Ekström
b300552dfb avformat/mov: enable identifying TTML subtitle streams as such
The contents are full TTML XML documents. TTML writing tests'
results are updated as the streams are now properly identified
as TTML ones.

Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
2023-07-28 15:31:56 +03:00
Sebastian Ramacher
7de3fcb059 examples: fix build of mux and resample_audio
The commits eac4324bfb and
cd8211527e renamed the examples, but the
targets were not updated. Hence, the builds are missing -lm.

Signed-off-by: Sebastian Ramacher <sramacher@debian.org>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-07-28 09:20:39 -03:00
Anton Khirnov
e8777221f2 fftools/ffprobe: fix handling parse_options() return value
Reviewed-by: James Almer <jamrial@gmail.com>
Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-07-28 09:11:26 -03:00
Paul B Mahol
a7a46aff46 avfilter/avf_showcwt: remove excessive operations 2023-07-28 14:02:35 +02:00
Paul B Mahol
32a2268b6e avfilter/avf_showcwt: switch to overlap-save
And do both left and right zero-padding for forward FFT.
2023-07-28 14:02:34 +02:00
Paul B Mahol
830e522cde avfilter/avf_showcwt: reduce memory usage even more 2023-07-28 14:02:33 +02:00
Benjamin Cheng
27804200ef vulkan_hevc: use diagonal scan order for scaling lists
The hevc parser parses the diagonal scan order in bitstream into raster
scan order. However, the Vulkan spec wants it as specified in H265 spec,
which is diagonal scan order.

Tested on RADV.

v2: fix copy-paste typo with PPS.
2023-07-28 04:07:33 +02:00
Michael Niedermayer
cf9cd35aa9
avcodec/evc_ps: Check num_ref_pic_list_in_sps
Fixes: out of array write
Fixes: 60798/clusterfuzz-testcase-minimized-ffmpeg_BSF_EVC_FRAME_MERGE_fuzzer-4633529766772736

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>
2023-07-28 02:12:12 +02:00
Marton Balint
f983303af4 avcodec: fix misleading indentation warnings after ticks_per_frame deprecation
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-07-27 21:24:23 +02:00
Richard Acayan
4fa1d3e791 avcodec/v4l2_context: suppress POLLERR and fix crash when buffers are uninitialized
A POLLERR occurs when libavcodec attempts to dequeue output buffers
before enqueuing capture buffers. This could happen to an application
deciding to send the first coded packet. Suppress these POLLERRs when
the buffers are uninitialized and avoid crashing because of enumerating
uninitialized buffers.

See https://trac.ffmpeg.org/ticket/9957 for the original bug report.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-07-27 21:23:39 +02:00
Jan Ekström
91e1d11d14 avcodec/hevcdec: simplify decrementing of MDCV/CLL flags
Mostly done to be able to update the comment so that it no longer
mentions the same flag twice.
2023-07-27 21:45:43 +03:00
Jan Ekström
43e63ff20a avcodec: move content light level SEI handling to h2645_sei
This allows this common H.274 SEI to be parsed from both H.264
as well as HEVC, as well as probably from VVC in the future.

Generally attempts to keep the original code as similar as possible.

FATE test refererence changes only change the order of side data
export within a single frame. Nothing else seems to have changed.
2023-07-27 21:45:43 +03:00
Jan Ekström
33358b862c avcodec: move mastering display colour volume SEI handling to h2645_sei
This allows this common H.274 SEI to be parsed from both H.264
as well as HEVC, as well as probably from VVC in the future.

Generally attempts to keep the original code as similar as possible.

FATE test refererence changes only change the order of side data
export within a single frame. Nothing else seems to have changed.
2023-07-27 21:45:43 +03:00
Michael Niedermayer
0ba719f726
avcodec/cbs_h2645: Avoid an unchecked bytesteram read
The unchecked read caused the 2nd subsequent tell call to move backward resulting
in a negative length

Fixes: assertion failure
Fixes: 60276/clusterfuzz-testcase-minimized-ffmpeg_BSF_TRACE_HEADERS_fuzzer-5434126636023808

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>
2023-07-25 23:17:29 +02:00
Michael Niedermayer
ac3e6b74bd
avformat/imf_cpl: Replace NULL content_title_utf8 by ""
Suggested-by: Pierre-Anthony Lemieux <pal@sandflow.com>
Reviewed-by: Pierre-Anthony Lemieux <pal@sandflow.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-07-25 23:17:29 +02:00
Michael Niedermayer
509ce40f18
avformat/imf_cpl: xmlNodeListGetString() can return NULL
Fixes: NULL pointer dereference
Fixes: 60166/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5998301577871360

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-07-25 23:17:29 +02:00
Michael Niedermayer
c5c719f030
avcodec/h266_metadata_bsf: Check if there are CodedBitstreamFragment units
Fixes: NULL pointer dereference
Fixes: 60269/clusterfuzz-testcase-minimized-ffmpeg_BSF_VVC_METADATA_fuzzer-5215449416335360

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>
2023-07-25 23:17:28 +02:00
Michael Niedermayer
574f3aaeff
avcodec/vmixdec: Fix several integer anomalies
Fixes: vmixdec.c:132:34: runtime error: signed integer overflow: -2147483648 * 1856 cannot be represented in type 'int'
Fixes: vmixdec.c:119:20: runtime error: signed integer overflow: -1256 + -2147483648 cannot be represented in type 'int'
Fixes: vmixdec.c:137:36: runtime error: signed integer overflow: 2147483416 * 16 cannot be represented in type 'int'
Fixes: 59843/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VMIX_fuzzer-4857434624360448

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-07-25 23:17:28 +02:00