1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-03-03 14:32:16 +02:00

48628 Commits

Author SHA1 Message Date
Andreas Rheinhardt
eb9bfe30a2 avcodec/imc: Fix leak on init error
Since e6afa61be97674312e36c9b6f8bb5fba009232e7 an AVFloatDSPContext
would leak on av_tx_init() failure.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-11 20:27:06 +02:00
Paul B Mahol
86bd0f08d3 avcodec/vmixdec: fix inputs with more than 255 slices 2023-09-11 01:14:50 +02:00
Paul B Mahol
64f538c356 avcodec/shorten: use uint16_t for wave_format 2023-09-11 01:14:49 +02:00
Andreas Rheinhardt
e9bbb39e94 avcodec/truemotion2: Don't check before freeing VLC
ff_vlc_free() is of course compatible with freeing
a blank VLC.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-11 00:28:04 +02:00
Andreas Rheinhardt
9cdf82c2c2 avcodec/vlc: Use proper namespace
Therefore use a proper prefix for this API, e.g.
ff_init_vlc_sparse -> ff_vlc_init_sparse
ff_free_vlc        -> ff_vlc_free
INIT_VLC_LE        -> VLC_INIT_LE
INIT_VLC_USE_NEW_STATIC -> VLC_INIT_USE_STATIC
(The ancient INIT_VLC_USE_STATIC has been removed
in 595324e143b57a52e2329eb47b84395c70f93087, so that
the NEW has been dropped.)
Finally, reorder the flags and change their values
accordingly.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-11 00:27:45 +02:00
Andreas Rheinhardt
7b98a1875d avcodec/vlc: Add documentation for ff_init_vlc_sparse()
Mostly taken from the documentation for ff_init_vlc_from_lengths();
also remove the documentation in vlc.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-11 00:26:34 +02:00
Andreas Rheinhardt
a84fe06112 avcodec/idctdsp: Avoid inclusion of avcodec.h
Not every user of idctdsp.h wants to initialize an IDCTDSPContext;
e.g. the proresdsp only uses ff_init_scantable_permutation()
and the IDCT permutation enum; similarly for cavsdsp and wmv2dsp.
Using a forward declaration here avoids an avcodec.h dependency
in the relevant files.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-11 00:26:34 +02:00
Andreas Rheinhardt
7b0b9a25ed avcodec/proresdsp: Pass necessary parameter directly
Only avctx->bits_per_raw_sample is used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-11 00:26:34 +02:00
Andreas Rheinhardt
489d96ca02 avcodec/proresdec: Include required headers directly
Do not rely on an indirect inclusion of avcodec.h in proresdsp.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-11 00:26:34 +02:00
Andreas Rheinhardt
b0fb8e82dd avcodec/get_bits: Avoid reading multiple times in get_bits_long
Due to non-byte-alignment a read of 32 bits guarantees only
25 usable bits; therefore get_bits_long() (which is used to
potentially read more than 25 bits) performs two reads in case
it needs to read more than 25 bits and combines the result.

Yet this is not necessary: One can just read 64 bits at a time
to get 32 usable bits (57 would be possible). This commit does so.

This reduced the size of .text by 30144B for GCC 11.4 and 5648B
for Clang 14 (both with -O3).

(get_bits_long() is a building block of show_bits_long()
and get_ue_golomb_long(), so this patch affects these, too.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-10 23:21:05 +02:00
Paul B Mahol
e26506cb3b avcodec/exr: use uint16/uint8 where possible 2023-09-10 22:44:39 +02:00
Andreas Rheinhardt
cfa47fd331 all: Use av_frame_replace() where appropriate
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-10 21:22:30 +02:00
llyyr
ded4478b8b hevc_ps: fix fixed_rate check
Fixes: fc429d785e9e24c5520ce716d4bc3b5547e581eb

Since fc429d785e9e24c5520ce716d4bc3b5547e581eb splits the fixed_rate
flag into general and within_cvs, check for both.
2023-09-10 20:05:07 +01:00
llyyr
06241c3154 hevc_ps: fix cpb_cnt_minus1 initialization
Fixes: fc429d785e9e24c5520ce716d4bc3b5547e581eb

cpb_cnt used to be initialized to 1 before
fc429d785e9e24c5520ce716d4bc3b5547e581eb so cpb_cnt_minus1 should be
initialized to 0.

Also add +1 to the decode_sublayer_hrd call to account for the change to
the offset
2023-09-10 20:04:56 +01:00
Paul B Mahol
1a87a9d82a avcodec/magicyuvenc: add support for encoding raw slice
Switched to raw slice encoding only if huffman encoding size of slice
is bigger than raw one.
2023-09-10 17:56:04 +02:00
Michael Niedermayer
ab7d38f970
avcodec/cscd: Fix "CamStudio Lossless Codec 1.0" gzip files
Fixes: tickets/10241/cscd_1_0_306_306_gzip.avi

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-10 16:40:49 +02:00
Michael Niedermayer
d2a0464fc2
avcodec/cscd: Check for CamStudio Lossless Codec 1.0 behavior in end check of LZO files
Alternatively the check could be simply made more tolerant
Fixes: Ticket10227

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-10 16:40:49 +02:00
Paul B Mahol
c6f0fd2dcd avcodec/magicyuvenc: use last slice height when correlating 2023-09-10 13:53:04 +02:00
Paul B Mahol
3b9e6a7333 avcodec/magicyuvenc: fix correlation buffers size when slices are used 2023-09-10 13:53:04 +02:00
Paul B Mahol
fd1574d1ba avcodec/magicyuvenc: remove unnecessary indirection 2023-09-10 13:53:04 +02:00
Paul B Mahol
8c3169fafb avcodec/magicyuvenc: add Slice struct to simplify allocations 2023-09-10 13:53:04 +02:00
Paul B Mahol
a716624293 avcodec/magicyuvenc: stop hardcoding max possible align 2023-09-10 13:53:04 +02:00
Paul B Mahol
5c87933e76 avcodec/magicyuvenc: move bit writer to stack 2023-09-10 13:52:59 +02:00
Paul B Mahol
800fbc98a5 avcodec/magicyuvenc: use const for src pointer 2023-09-10 13:51:47 +02:00
Paul B Mahol
4d1b7ff733 avcodec/magicyuvenc: check for allocation return value 2023-09-10 13:51:46 +02:00
Paul B Mahol
f832a77231 avcodec/magicyuvenc: ensure no slice slot is left unset 2023-09-10 13:51:39 +02:00
Paul B Mahol
e6923e06c2 avcodec/hcadec: small refactoring 2023-09-09 12:09:30 +02:00
Paul B Mahol
dcd92aa01a avcodec/hcadec: do not hardcode max number of channels 2023-09-09 12:09:29 +02:00
James Almer
fb548fba04 avcodec/av1dec: export pixel format even if no hardware decoder is present
And remove the AVOID_PROBING flag, given it's the last av1 decoder to be tested
either way.
This fixes a regression introduced in 1652f2492f88434010053289d946dab6a57e4d58,
where even if forcing the native av1 decoder, if another decoder was present,
like libdav1d or libaom-av1, they'd be used for probing and some fate tests
would have different results.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-09-08 09:42:25 -03:00
Lynne
398467f519
vulkan_decode: convert max level from vulkan to av for comparisons 2023-09-08 06:56:43 +02:00
Michael Niedermayer
d5cc9d8dd9
avcodec/vmixdec: Check for end of input in decode_dcac()
Fixes: Timeout
Fixes: 59952/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VMIX_fuzzer-6718213736759296

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-08 01:32:30 +02:00
Michael Niedermayer
d48476183f
avcodec/mpeg4videodec: consider lowres in dest_pcm[]
Fixes: out of array access
Fixes: 59999/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-5767982157266944

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-08 01:32:30 +02:00
Michael Niedermayer
94bd1796ff
avcodec/hevcdec: Fix undefined memcpy()
There is likely a better way to fix this, this is mainly to show the problem

Fixes: MC within same frame resulting in overlapping memcpy()
Fixes: 60189/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-4992746590175232
Fixes: 61753/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5022150806077440
Fixes: 58062/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-4717458841010176

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-08 01:32:29 +02:00
Andreas Rheinhardt
e34d5d1e3b avcodec/tiff: Don't cast const away
lzma_stream.next_in is const for more than 15 years now
and has been so in every release of liblzma.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 20:58:00 +02:00
Andreas Rheinhardt
2f9a33995a avcodec/v210dec: Don't cast const away
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 20:58:00 +02:00
Paul B Mahol
03ed48aeca avcodec/rpzaenc: replace float-point calculations with integer ones 2023-09-07 20:58:08 +02:00
Paul B Mahol
b97ac6b3df avcodec/utvideodec: fix possible write past end of array 2023-09-07 12:27:34 +02:00
Paul B Mahol
9c9f48e7f2 avcodec/smcenc: remove useless cast 2023-09-07 11:21:23 +02:00
Andreas Rheinhardt
de73accd39 avcodec/vp8data: Use <> for inclusion of stdint.h
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:49:11 +02:00
Andreas Rheinhardt
e3b355c0be avutil/mem: Don't include avutil.h
It is not necessary at all. So remove it.
This also breaks an inclusion cycle mem.h->avutil.h->common.h->mem.h.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:42:10 +02:00
Andreas Rheinhardt
8238bc0b5e avcodec/defs: Add AV_PROFILE_* defines, deprecate FF_PROFILE_* defines
These defines are also used in other contexts than just AVCodecContext
ones, e.g. in libavformat. Furthermore, given that these defines are
public, the AV-prefix is the right one, so deprecate (and not just move)
the FF-macros.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:39:02 +02:00
Andreas Rheinhardt
8d3f721e0b avcodec/rv34_parser: Remove unused ParseContext
This parser does not do frame packetization at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:28:01 +02:00
Andreas Rheinhardt
a7443421f2 avcodec/rv34_parser: Merge RV30 and RV40 parsers
They do mostly the same.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:27:52 +02:00
Andreas Rheinhardt
947d51f32a avcodec/x86/hpeldsp_vp3: Merge into hpeldsp
Once upon a time, 413abbe16465a7b49472ac110e42939e853e24a1
added versions of some put_no_rnd_pixels functions for use
in VP3 and Theora (with an explicit check so that they are
only used for VP3 and Theora). When this was moved to hpeldsp
(from dsputil) in 3ced55d51c2e65b37e50d500dff88bcd80e01b9c,
the check was replaced by a check for the bitexact flag
(and a CONFIG_VP3_DECODER compile-time check), so that
these functions were now used for other codecs as well.

Later commit 1dfc3cf89d0eb026af28be46294b85d79499ffb5
split off the "VP3-specific bits into a separate file",
yet these bits were not really VP3-specific bits at all
any more. (The error was repeated in commit
0a39c9ac0bfd7345fe676b4e2707d9cec3cbb553.) This commit
has not been reverted, because this would make future
changes from Libav (from where it originated) harder,
yet Libav is no more, so this commit effectively reverts
1dfc3cf89d0eb026af28be46294b85d79499ffb5.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:24:39 +02:00
Christophe Gisquet
da888b790a avcodec/utvideodec: add vlc multi support
Faster decoding, by average 50% faster overall.
2023-09-07 00:23:30 +02:00
Paul B Mahol
8b7391cb5f avcodec/magicyuv: add vlc multi support
Gives nice speed boost, depending on encoded content it goes from
30% to 60% faster.
2023-09-07 00:23:30 +02:00
Paul B Mahol
29b9fca4b3 avcodec: add multi vlc reader
Heavily based and inspired by Christophe's cache branches.

Co-Authored-by: Christophe Gisquet
2023-09-07 00:23:30 +02:00
James Almer
3a5be28857 avcodec/qsvenc: add missing header include
Needed for ff_encode_add_cpb_side_data().
Fixes regression since 0231df505dc70ac435f2b437d1995ebabd70a66a.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-09-06 16:08:40 -03:00
James Almer
1652f2492f avcodec/av1dec: don't set aspect ratio when it's not yet known
Makes the output of the native decoder consistent with external decoders like
libdav1d with fate-enhanced-flv-av1.

Reviewed-by: Zhao Zhili <quinkblack@foxmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-09-06 14:37:15 -03:00
Paul B Mahol
6022e0b04f avcodec/rpzaenc: fix assertions with very small width/height 2023-09-06 16:25:41 +02:00