Paul B Mahol
5133f4c2c1
avcodec/lagarith: return early on error
...
Also return proper error values.
3 years ago
Andreas Rheinhardt
67b6f5fbb5
avcodec/lagarith: Mark decoder as init-threadsafe
...
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years ago
Andreas Rheinhardt
a247ac640d
avcodec: Constify AVCodecs
...
Given that the AVCodec.next pointer has now been removed, most of the
AVCodecs are not modified at all any more and can therefore be made
const (as this patch does); the only exceptions are the very few codecs
for external libraries that have a init_static_data callback.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
4 years ago
Anton Khirnov
1f4cf92cfb
pthread_frame: merge the functionality for normal decoder init and init_thread_copy
...
The current design, where
- proper init is called for the first per-thread context
- first thread's private data is copied into private data for all the
other threads
- a "fixup" function is called for all the other threads to e.g.
allocate dynamically allocated data
is very fragile and hard to follow, so it is abandoned. Instead, the
same init function is used to init each per-thread context. Where
necessary, AVCodecInternal.is_copy can be used to differentiate between
the first thread and the other ones (e.g. for decoding the extradata
just once).
5 years ago
Michael Niedermayer
fb3855342b
avcodec/lagarith: Sanity check scale
...
A value of 24 and above can collaps the range to 0 which would not work.
Fixes: Timeout (75sec -> 21sec)
Fixes: 18707/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LAGARITH_fuzzer-5708950892969984
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
7efe84aebd
avcodec/lagarith: Remove duplicate check
...
Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 years ago
Paul B Mahol
29a24e5f79
avcodec/lagarith: set pict_type too
6 years ago
Paul B Mahol
b2ffecbd0c
avcodec/lagarith: switch to planar rgb
...
Speed goes from 363 fps to 428 fps for 640x480 video.
6 years ago
Michael Niedermayer
dbac849c4d
avcodec/lagarith: Optimize FRAME_SOLID_RGBA
...
Changes 5466110 decicycles to 1798072 decicycles (tested with fate-suite/lagarith/lag-rgb32.avi)
Fixes: Timeout
Fixes: 9484/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LAGARITH_fuzzer-5707859156271104
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
706c9beaea
avcodec/lagarith: Remove redundant varianble init
...
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years ago
Michael Niedermayer
8d21ab4d12
avcodec/lagarith: Check that the range coded data stream is consistent when the probabilities indicate no data could have been coded.
...
Fixes: Timeout
Fixes: 8638/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LAGARITH_fuzzer-5132046098759680
Fixes: 8943/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LAGARITH_fuzzer-4883030219948032
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
5859b5b439
avcodec/lagarith: Detect end of input in lag_decode_line() loop
...
Fixes: timeout
Fixes: 2933/clusterfuzz-testcase-5124990208835584
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
948b54763b
avcodec/lagarith: Fix runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
...
Fixes: 1764/clusterfuzz-testcase-minimized-5394243164045312
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years ago
Michael Niedermayer
ed3c9b5b0d
avcodec/lagarith: Check scale_factor
...
Fixes: 1425/clusterfuzz-testcase-minimized-6295712339853312
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
Michael Niedermayer
ddb2dd7edb
avcodec/lagarith: Fix runtime error: left shift of negative value -1
...
Fixes: 1424/clusterfuzz-testcase-minimized-6088327159611392
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
Ronald S. Bultje
081c21ca55
lagarith: assign correct per-thread value to LagarithContext::avctx.
...
This fixes race conditions reported by tsan in fate-lagarith. The races
were because each thread's LagarithContext::avctx was set to the first
thread's AVCodecContext.
8 years ago
Diego Biurrun
a25dac976a
Use bitstream_init8() where appropriate
8 years ago
James Almer
47f212329e
huffyuvdsp: move functions only used by huffyuv from lossless_videodsp
...
Signed-off-by: James Almer <jamrial@gmail.com>
8 years ago
James Almer
5ac1dd8e23
lossless_videodsp: move shared functions from huffyuvdsp
...
Several codecs other than huffyuv use them.
Signed-off-by: James Almer <jamrial@gmail.com>
8 years ago
Alexandra Hájková
6fad5abcad
lagarith: Convert to the new bitstream reader
8 years ago
Vittorio Giovara
41ed7ab45f
cosmetics: Fix spelling mistakes
...
Signed-off-by: Diego Biurrun <diego@biurrun.de>
9 years ago
Vittorio Giovara
def97856de
lavc: AV-prefix all codec capabilities
...
Express bitfields more simply.
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
10 years ago
Michael Niedermayer
35dcc8a040
avcodec/lagarith: fix integer overflow
...
Fixes: asan_heap-oob_1bf48fa_2513_lag-yuy2.avi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
e981de81fe
avcodec/lagarith: fix chroma plane width & height
...
Fixes out of array read
Fixes: asan_heap-oob_1bf48fa_2513_lag-yuy2.avi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Diego Biurrun
0d439fbede
dsputil: Split off HuffYUV decoding bits into their own context
...
Also shorten HuffYUV context member names to avoid clutter.
11 years ago
Diego Biurrun
4f4840377f
lagarith: Fix typo in printf format string
...
libavcodec/lagarith.c:671:16: warning: '#' flag used with ‘%u’ gnu_printf format [-Wformat]
11 years ago
Diego Biurrun
cc8163e1a3
avcodec: more correct printf specifiers
11 years ago
Anton Khirnov
4c3e1956ee
lagarith: reallocate rgb_planes when needed
...
Fixes invalid writes on pixel format changes.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
11 years ago
Kostya Shishkov
2f97094608
lagarith: do not call simd functions on unaligned lines
...
They end up overwriting past the line end.
Partially based on a patch by Michael Niedermayer <michaelni@gmx.at>
Bug-Id: vlc/9700
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
11 years ago
Michael Niedermayer
61d43a2651
avcodec/lagarith: check and propagate return value from init_get_bits8()
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
afd1245433
avcodec/lagarith: use init_get_bits8()
...
Suggested-by: Reimar
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
6f1b296771
avcodec/lagarith: reenable buggy lag_decode_zero_run_line()
...
This is to prevent regressions in case the old code was able to partly
decode frames (no way to say without a testcase)
Add a memset to prevent use of uninitialized memory until we have a
testcase and can test/fix it
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
e80aa47abf
avcodec/lagarith: fix init_get_bits() size in lag_decode_arith_plane()
...
untested due to lack of sample
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
3410122c68
avcodec/lagarith: fix src/src_size for esc_count < 8
...
untested due to lack of sample
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
100a54da52
avcodec/lagarith: disable lag_decode_zero_run_line() and ask for a sample
...
The code seems to have never been tested
fixing it should be quite easy but needs a sample/testcase
Fixes use of uninitialized memory
Fixes: msan_uninit-mem_7f9a862dfabf_413_2889_assassin_OL.avi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Diego Biurrun
b2bed9325d
cosmetics: Group .name and .long_name together in codec/format declarations
11 years ago
Michael Niedermayer
45f0623ae3
avcodec/lagarith: check scaled probabilities
...
Prevents infinite loop
Fixes Ticket2988
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Carl Eugen Hoyos
f381dc1d61
Support decoding of Lagarith frame type FRAME_SOLID_COLOR.
...
Fixes bug 459.
12 years ago
Clément Bœsch
1ec94b0f06
lavc: factorize ff_{thread_,re,}get_buffer error messages.
...
Coccinelle profile used:
@@
expression r, ctx, f, loglevel, str, flags;
@@
-if ((r = ff_get_buffer(ctx, f, flags)) < 0) {
- av_log(ctx, loglevel, str);
- return r;
-}
+if ((r = ff_get_buffer(ctx, f, flags)) < 0)
+ return r;
@@
expression r, ctx, f, loglevel, str;
@@
-if ((r = ff_reget_buffer(ctx, f)) < 0) {
- av_log(ctx, loglevel, str);
- return r;
-}
+if ((r = ff_reget_buffer(ctx, f)) < 0)
+ return r;
@@
expression r, ctx, f, loglevel, str, flags;
@@
-if ((r = ff_thread_get_buffer(ctx, f, flags)) < 0) {
- av_log(ctx, loglevel, str);
- return r;
-}
+if ((r = ff_thread_get_buffer(ctx, f, flags)) < 0)
+ return r;
...along with some manual patches for the remaining ones.
12 years ago
Anton Khirnov
759001c534
lavc decoders: work with refcounted frames.
12 years ago
Paul B Mahol
c4274d118b
lagarith: return more meaningful error codes
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Carl Eugen Hoyos
40297a8bdb
Support solid gray frames when decoding Lagarith.
...
Fixes bug 431.
12 years ago
Diego Biurrun
511cf612ac
miscellaneous typo fixes
12 years ago
Anton Khirnov
df9b956751
lavc: fix decode_frame() third parameter semantics for video decoders
...
It's got_frame, not data size
12 years ago
Michael Niedermayer
9eef41b848
lagarith: always allocate for 4 planes. Fixes out of array accesses
...
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
2d71f31df2
lag_read_prob_header: fix out of array access
...
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Anton Khirnov
716d413c13
Replace PIX_FMT_* -> AV_PIX_FMT_*, PixelFormat -> AVPixelFormat
12 years ago
Michael Niedermayer
b631e4ed64
lagarith: check count before writing zeros.
...
Fixes CVE-2012-2793
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Anton Khirnov <anton@khirnov.net>
12 years ago
Michael Niedermayer
2b3b52d519
lagarith: fix alignment on buffers passed into prediction dsp code.
...
This should fix issues with direct rendering
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Hendrik Leppkes
f9150c8ac0
lagarith: frame multithreading
...
About 2x speedup going from 1 to 2 threads.
1.7s to 0.85s on foreman CIF.
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
13 years ago