1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-18 03:19:31 +02:00
Commit Graph

112042 Commits

Author SHA1 Message Date
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
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