Commit Graph

112251 Commits

Author SHA1 Message Date
Andreas Rheinhardt fa4bf5793a avutil/audio_fifo: Constify some pointees
Also constify AVAudioFifo* in the peek functions
besides constifying intermediate pointers (void**->void * const *).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-12 09:20:13 +02:00
Andreas Rheinhardt 9bf31f6096 avutil/samplefmt: Constify some pointees
This is the samplefmt analog of the imgutils changes
from the preceding commit.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-12 09:17:28 +02:00
Andreas Rheinhardt 41285890e0 avutil/imgutils: Constify some pointees
This is done immediately without waiting for the next major bump
just as in 9546b3a1cb and
4eaaa38d3d.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-12 09:14:25 +02:00
Paul B Mahol 8cd2e0c075 avcodec/fraps: remove extra new lines and not needed cast 2023-09-11 22:04:28 +02:00
Paul B Mahol 8042f658f7 avformat/mpjpegdec: remove extra newlines 2023-09-11 22:04:27 +02:00
Paul B Mahol 1735ca3c41 avcodec/8bps: always decode to planar formats directly 2023-09-11 22:04:26 +02:00
Paul B Mahol 1ce1970417 avcodec/8bps: use uint8/uint16 where possible 2023-09-11 22:04:25 +02:00
Andreas Rheinhardt 0c4ac187dc avformat/aviobuf: Fix function pointer equality check
Broken in e8704a8f60
when ffurl_read() has been turned into a static inline function
different from the actually used function ffurl_read2().

Fixes ticket #10562.

Tested-by: Mitzsch01
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-11 20:27:49 +02:00
Andreas Rheinhardt 58aaa83fa2 avformat/mxfdec: Don't pretend array to be bigger than it is
mxf_match_uid() accepts two const UID and a len parameter.
UID is a typedef for an array of 16 uint8_t, so the const UID
parameter is actually a pointer to const uint8_t.

The point of mxf_match_uid() is to check whether the initial
part of two UIDs match; the length of said part is given
by the len parameter. Once an incomplete UID has been passed
to mxf_match_uid() (albeit with the correct len, so safe),
which makes GCC emit -Wstringop-overread warnings.

Fix this by using a const uint8_t[] as type; it is more
natural for incomplete UIDs.

Reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-11 20:27:32 +02:00
Andreas Rheinhardt 740ce93fae avcodec/flicvideo: Remove unnecessary cast
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-11 20:27:26 +02:00
Andreas Rheinhardt eb9bfe30a2 avcodec/imc: Fix leak on init error
Since e6afa61be9 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 595324e143, 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 95e876f069 tools/patcheck: Remove test for ancient INIT_VLC_USE_STATIC
The flag has been removed long ago.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-11 00:26:34 +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
Andreas Rheinhardt 2a68d945cd avformat/avio: Constify data pointees of write callbacks
They are currently non-const for reasons unknown, although
avio_write() accepts a const buffer.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-10 22:55:42 +02:00
Andreas Rheinhardt e8704a8f60 avformat/aviobuf: Don't use incompatible function pointer type for call
It is undefined behaviour even in cases where it works
(it works because both are pointers). Instead change
the functions involved to use the type expected by the AVIO-API
and add inline wrappers for our internal callers.

Reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-10 22:55:42 +02:00
Paul B Mahol e26506cb3b avcodec/exr: use uint16/uint8 where possible 2023-09-10 22:44:39 +02:00
Paul B Mahol f95cb3d134 avformat/adxdec: remove unneeded check for channels inside read_packet() 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
Andreas Rheinhardt 0487786ffe avformat/avio: Remove redundant checks
Checking the return value of av_opt_set() is equivalent
to the current checks.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-10 21:22:13 +02:00
Andreas Rheinhardt ca78dcfb19 avformat/avio: Remove duplicated freeing code
The target of the jump frees this stuff, too.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-10 21:21:30 +02:00
Andreas Rheinhardt 4f98bf9dbd avformat/avio_internal: Don't include url.h
It is only included because two very rarely used functions
use pointers to URLContexts; use struct URLContext instead.
Also move ffio_geturlcontext() so that one can avoid
a forward declaration of struct URLContext (which would be
necessary as soon as FF_API_AVIODIRCONTEXT is no more).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-10 21:19:29 +02:00
Andreas Rheinhardt 879178b40d avformat/teeproto: Remove always-false check
Incompatibility of the flags and the protocol's capabilities
are checked generically (see url_alloc_for_protocol()).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-10 21:19:11 +02:00
Andreas Rheinhardt ee77ee77a1 avformat: Remove avformat and avio headers from protocols
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-10 21:17:55 +02:00
Andreas Rheinhardt d6afd6c303 avdevice/lavfi: Remove unnecessary avio_internal.h inclusion
The stuff declared in said header is actually unusable in libavdevice.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-10 21:17:36 +02:00
Andreas Rheinhardt 7ed8c08821 avformat/teeproto: Remove useless AVClass without options
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-10 21:17:14 +02:00
Andreas Rheinhardt 90f444ef74 avformat/dashenc: Avoid relocations for short strings
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-10 21:16:54 +02:00
Andreas Rheinhardt c95cdf871c avformat/dashenc: Simplify getting format string
A switch is simpler than a lookup over a table with
three entries, only two of which can happen at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-10 21:16:26 +02:00
Andreas Rheinhardt e4ab1b8f70 avformat/dashenc: Add const where appropriate
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-10 21:16:09 +02:00
Andreas Rheinhardt b948aa958a avformat/dashenc: Use proper type for AVCodecIDs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-10 21:15:53 +02:00
Andreas Rheinhardt a23627ee59 avformat/dashenc: Avoid unnecessary casts
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-10 21:15:34 +02:00
llyyr ded4478b8b hevc_ps: fix fixed_rate check
Fixes: fc429d785e

Since fc429d785e 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: fc429d785e

cpb_cnt used to be initialized to 1 before
fc429d785e 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
Andreas Rheinhardt 7b6e1fbeb9 avformat/vapoursynth: Add missing inclusion of frame.h
Broken in 0c6e5f321b.
Also add it to decklink_enc.cpp in order not to rely
on an implicit inclusion via libavfilter/ccfifo.h.

Reviewed-by: あんこ <mailcrystaldiskinfo@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-10 17:32:11 +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