Andreas Rheinhardt
2d764069be
avcodec/vlc: Use structure instead of VLC_TYPE array as VLC element
...
In C, qualifiers for arrays are broken:
const VLC_TYPE (*foo)[2] is a pointer to an array of two const VLC_TYPE
elements and unfortunately this is not compatible with a pointer
to a const array of two VLC_TYPE, because the latter does not exist
as array types are never qualified (the qualifier applies to the base
type instead). This is the reason why get_vlc2() doesn't accept
a const VLC table despite not modifying the table at all, as
there is no automatic conversion from VLC_TYPE (*)[2] to
const VLC_TYPE (*)[2].
Fix this by using a structure VLCElem for the VLC table.
This also has the advantage of making it clear which
element is which.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2 years ago
Andreas Rheinhardt
ce7dbd0481
avcodec/codec_internal: Make FFCodec.decode use AVFrame*
...
This increases type-safety by avoiding conversions from/through void*.
It also avoids the boilerplate "AVFrame *frame = data;" line
for non-subtitle decoders.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years ago
Andreas Rheinhardt
1ea3650823
Replace all occurences of av_mallocz_array() by av_calloc()
...
They do the same.
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years ago
Andreas Rheinhardt
3dacb09f10
avcodec/ivi: Fix indentation
...
Also improve readability by keeping a pointer to the IVIBandDesc that is
currently freed.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
4 years ago
Andreas Rheinhardt
14be39e44a
avcodec/ivi: Make initializing VLCs thread-safe
...
This automatically makes indeo4/5 init-threadsafe.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years ago
Andreas Rheinhardt
d7a503ecf9
avcodec/ivi: Avoid reversing BE VLC codes for LE bitstream reader
...
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years ago
Andreas Rheinhardt
e411a3af11
avcodec/ivi: Fix segfault on allocation error
...
If allocating the tiles array for indeo 4/5 fails, the context is in an
inconsistent state, because the counter for the number of tiles is > 0.
This will lead to a segfault when freeing the tiles' substructures.
Fix this by setting the number of tiles to zero if the allocation was
unsuccessful.
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years ago
Michael Niedermayer
1d633e6a0a
avcodec/ivi: Clear got_p_frame before decoding a new frame using it
...
Fixes: assertion failure
Fixes: 21666/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INDEO4_fuzzer-5706468994318336
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 years ago
Andreas Rheinhardt
cc2a9509ce
libavcodec, libpostproc: Remove outcommented START/STOP_TIMER
...
as well as includes of libavutil/timer.h.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 years ago
Michael Niedermayer
a15d904ad7
avcodec: Replace get_bits_long() by get_bits() where possible
...
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 years ago
Michael Niedermayer
79d5d79f38
avcodec: Replace show_bits_long() by show_bits() where possible
...
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 years ago
Michael Niedermayer
15a65c13e1
avcodec/ivi: Allocate bufs later
...
Fixes: Timeout (24sec->2sec)
Fixes: 15951/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INDEO5_fuzzer-5095433266790400
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 years ago
Michael Niedermayer
a7e02cf3ad
avcodec/ivi: Ask for samples with odd tiles
...
Fixes: Assertion failure
Fixes: 15422/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INDEO5_fuzzer-5676625481433088
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 years ago
Michael Niedermayer
110dce9633
avcodec/ivi: Move buffer/block end check to caller of ivi_dc_transform()
...
Fixes: assertion failure
Fixes: 14078/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INDEO5_fuzzer-5760571284127744
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 years ago
Michael Niedermayer
4eec008259
avcodec/ivi: Reduce dereferencing structs in inner loop of ivi_process_empty_tile()
...
This speeds the code up by about 15%
Testcase: 13779/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INDEO4_fuzzer-5699589711069184
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 years ago
Michael Niedermayer
4bf9561d63
avcodec/ivi: Mark band parameter as const
...
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 years ago
Michael Niedermayer
111e9b0929
avcodec/ivi: fix indention for previous commit
6 years ago
Michael Niedermayer
c163e62db5
avcodec/ivi: Factor ref_mb check out
...
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 years ago
Michael Niedermayer
80cce5998c
avcodec/ivi: Avoid mbs memleak
...
Fixes: 11696/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INDEO5_fuzzer-5740319635668992
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 years ago
Michael Niedermayer
bf97d11b08
avcodec/ivi: Factor width dereference out of the loops in ivi_output_plane()
...
396078 -> 268468 dezicycles
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 years ago
Michael Niedermayer
82920bf494
avcodec/ivi: Only clip samples when needed in ivi_output_plane()
...
435740 -> 396078 dezicycles
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 years ago
Michael Niedermayer
a824685140
avcodec/ivi: Use av_image_check_size2()
...
Fixes OOM
Fixes: 1514/clusterfuzz-testcase-minimized-6437666243477504
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years ago
Michael Niedermayer
12dea8a5a1
avcodec/ivi: Free custom blk_vlc
...
Fixes memleak
Fixes: 1351/clusterfuzz-testcase-minimized-5861971645693952
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years ago
Diego Biurrun
a25dac976a
Use bitstream_init8() where appropriate
8 years ago
Paul B Mahol
c331be21c4
avcodec/ivi: use init_get_bits8()
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
8 years ago
Alexandra Hájková
c3defda0d8
indeo: Convert to the new bitstream reader
8 years ago
Diego Biurrun
746c56b773
indeo: Change type of array pitch parameters to ptrdiff_t
...
ptrdiff_t is the correct type for array pitches and similar.
8 years ago
Diego Biurrun
b668662939
get_bits: Move BITSTREAM_READER_LE definition before all relevant #includes
...
This avoids the danger that get_bits.h might get indirectly #included before
BITSTREAM_READER_LE is defined.
Also sort headers into canonical order where appropriate.
9 years ago
Vittorio Giovara
6202e2fede
indeo4: Rework stream analysis report
...
* Change log level from error to debug
* Print report after the first decoded frame, not at the end of decoding
* Drop macro guard and use a context variable instead
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
9 years ago
Diego Biurrun
69a68593ce
Remove stray line breaks from avpriv_{report_missing_feature|request_samples}
9 years ago
Michael Niedermayer
df91aa034b
avcodec/ivi: Check image dimensions
...
Fixes integer overflow
Fixes: 1e32c6c591d940337c20b197ec1c4d3d/asan_heap-oob_4a52e5_8946_0bb0d9e863def56005e49f1d89bdc94d.avi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
9 years ago
Vittorio Giovara
6a85dfc830
lavc: Replace av_dlog and tprintf with internal macros
10 years ago
Diego Biurrun
23944d29a2
indeo: Give Indeo4/5 shared code a more consistent name
10 years ago
Michael Niedermayer
114a2eb272
avcodec: Use av_clip_uintp2() where possible
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Dirk Ausserhaus
5ec6d152e2
indeo4: B-frames decoding
...
Signed-off-by: Kostya Shishkov <kostya.shishkov@gmail.com>
11 years ago
Dirk Ausserhaus
e121ac634b
indeo45: use is_indeo4 context flag instead of checking codec ID
...
Signed-off-by: Kostya Shishkov <kostya.shishkov@gmail.com>
11 years ago
Dirk Ausserhaus
f76e3669bb
Decode both parts of Indeo4 IP frames
...
Signed-off-by: Kostya Shishkov <kostya.shishkov@gmail.com>
11 years ago
Dirk Ausserhaus
3df0d20028
Move Indeo4 frametypes into common header.
...
Signed-off-by: Kostya Shishkov <kostya.shishkov@gmail.com>
11 years ago
Dirk Ausserhaus
8bfb4d72dd
avcodec/indeo4: Decode both parts of IP frames
...
Fixes part of Ticket845
av_frame_move_ref() idea by Anton Khirnov
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Dirk Ausserhaus
d24673a2c8
avcodec/indeo4: Move frametypes into common header.
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
f08ca91b05
avcodec/ivi_common: Use av_mallocz_array()
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Diego Biurrun
cc8163e1a3
avcodec: more correct printf specifiers
11 years ago
Janne Grunau
fb0c9d41d6
avutil: remove timer.h include from internal.h
...
Added libavutil/timer.h include to all files with {START,STOP}_TIMER.
11 years ago
Michael Niedermayer
d164ad3298
avcodec/ivi_common: use av_mallocz() to allocate mbs array
...
Fixes use of uninitialized memory
Fixes: msan_uninit-mem_7f1dffa1c016_8245_sasha.avi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Anton Khirnov
d184cd1dac
ivi_common: stop using deprecated avcodec_set_dimensions
11 years ago
Michael Niedermayer
489c575bd6
avcodec/ivi_common: make while get_bits loop more robust by checking bits left
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Martin Storsjö
a92538b7c0
ivi_common: Make sure color planes have been initialized
...
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
11 years ago
Diego Biurrun
060ce0c697
ivi_common: Make some tables only used within the file static
11 years ago
Luca Barbato
5b2a29552c
indeo: Reject impossible FRAMETYPE_NULL
...
A frame marked FRAMETYPE_NULL cannot be scalable and requires a
previous frame successfully decoded.
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
12 years ago
Luca Barbato
f9e5261cab
indeo: Do not reference mismatched tiles
...
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
12 years ago