Michael Niedermayer
793347a545
avcodec/jpeg2000dwt: Fix integer overflows in sr_1d53()
...
Fixes: 5918/clusterfuzz-testcase-minimized-5120505435652096
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
3c70251780
avcodec/jpeg2000dwt: Fix integer overflows in sr_1d97_int()
...
Fixes: runtime error: signed integer overflow: 1157259380 + 1157259380 cannot be represented in type 'int'
Fixes: 2365/clusterfuzz-testcase-minimized-6020421927305216
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
ea5366670e
avcodec/jpeg2000dwt: Fix integer overflow in dwt_decode97_int()
...
Fixes: runtime error: signed integer overflow: -163654656 * 256 cannot be represented in type 'int'
Fixes: 2367/clusterfuzz-testcase-minimized-4648678897745920
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
d24043e1a2
avcodec/jpeg2000dwt: Fix runtime error: left shift of negative value -123
...
Fixes: 2208/clusterfuzz-testcase-minimized-5976593765761024
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
feb3f39614
avcodec/jpeg2000dwt: Check ndeclevels before calling dwt_encode*()
...
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
9 years ago
Michael Niedermayer
75422280fb
avcodec/jpeg2000dwt: Check ndeclevels before calling dwt_decode*()
...
Fixes out of array access
Fixes: 01859c9a9ac6cd60a008274123275574/asan_heap-oob_1dff571_8250_50d3d1611e294c3519fd1fa82198b69b.avi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
9 years ago
Michael Niedermayer
0eb7de1973
avcodec/jpeg2000: Change coord to 32bit to support larger than 32k width or height
...
Fixes: 03e0abe721b1174856d41a1eb5d6a896/signal_sigabrt_7ffff6ae7cc9_3813_e71bf3541abed3ccba031cd5ba0269a4.avi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
9 years ago
Michael Niedermayer
0416b5e033
avcodec/jpeg2000dwt: Replace /2 by >>1
...
Divisions can be slow if the compiler fails to replace them by shifts
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
f067ee57c9
avcodec/jpeg2000dwt: Move large arrays used in the test code away from the stack
...
This should avoid problems on systems with little stack space and fix some crashes
in fate
crash found-by: jamrial
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
8428e2c5f3
avcodec/jpeg2000dwt: Print 1 digit less in the 9/7f DWT test
...
This avoids test failure due to differing rounding between 32 and 64bit x86
Found-by: jamrial
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
19dc1ed4ad
avcodec/jpeg2000dwt: Use a tighter check threshold for the 9/7f DWT test
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
4e926fb969
avcodec/jpeg2000: Move L band scaling from the 9/7f wavelet to quantization stage
...
This reduces the number of operations
Its not done for 9/7i as that would overflow thanks to JPEG2000 allowing
32 decomposition levels
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
b1fdf81c6e
avcodec/jpeg2000dwt: use 32x32->64 multiplies in the 9/7i DWT
...
This significantly improves the quality when the integer 9/7 transform
is used
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
6c7b1597c7
avcodec/jpeg2000: Move H band scaling from wavelet into quantization code
...
This reduces the number of operations done and is equivalent except for
rounding
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
69f7ccef8e
avcodec/jpeg2000dwt: Move K/X constants to header
...
this makes them accessible by the rest of the jpeg2000 code
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
1c495b0bf6
avcodec/jpeg2000: Move gainb handling into the quantization code
...
thats how the specification defines it, this also improves numerical
accuracy of the integer wavelet implementation. It otherwise should
be equivalent, in case of overflows this can be reverted.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
3bcf61f495
avcodec/jpeg2000dwt: Fix value of F_LFTG_X and I_LFTG_X
...
Even if the jpeg2000 spec uses a wrong value this does not
make mathematics work this way, also this has been corrected in the 2004
version AFAIK
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
4299f085f4
avcodec/jpeg2000dwt: also test 9/7 float DWT
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
6528b90dea
avcodec/jpeg2000dwt: List differences for DWT test
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
aa594415a0
avcodec/jpeg2000dwt: increase the number of test iterations
...
the code had too little coverage
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
d23b3f3940
avcodec/jpeg2000dwt: Also test 9/7 integer DWT
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
3bd46914fb
avcodec/jpeg2000dwt: Allow testing with a maximum allowed difference
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
5358953cdf
avcodec/jpeg2000dwt: Fill array using 2d instead of 1d accesses
...
Avoids gcc warning
Found-by: jamrial
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
116e7d5418
avcodec/jpeg2000dwt: Factor dwt test code out so it can be easily used with the other dwts too
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
a75ca3ca6a
avcodec/jpeg2000dwt: Fix special cases in sd_1d53()
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
de99ce4306
avcodec/jpeg2000dwt: add test for the 5/3 wavelet
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
75651cd63f
avcodec/jpeg2000dwt: Fix order of operations in integer decomposition wavelets
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
7c3f7e6ed1
avcodec/jpeg2000dwt: Support 9/7 singularity cases on the encoder side
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
9841024402
avcodec/jpeg2000dwt: More special cases to handle singularities in 9/7 decode
...
Fixes Ticket4634
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
1125c71fd7
avcodec/jpeg2000dwt: assert that mod == 0 for encoding
...
We are missing the handling of some special cases for this.
These cases should be unused and there should be no reason
to ever use them unless some spec dictates their use
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
34121ca187
avcodec/jpeg2000dwt: Fix 9/7 IDWT for small sizes
...
Fixes Ticket4631
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
8294ec67b5
avcodec/jpeg2000dwt: add special cases for handling length 1 in 5/3 decode
...
Fixes Ticket4630
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
1aa388d439
avcodec/jpeg2000dwt: use av_malloc_array()
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
c4604b8792
jpeg2000: Merge rescaling with interleaving in 9/7 IDWT
...
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
12 years ago
Michael Niedermayer
8a266aaaac
avcodec/jpeg2000dwt: merge rescaling with interleave in 9/7 int IDWT
...
Tha fate tests change because the edge mirroring was wrong before this commit
Reviewed-by: Nicolas BERTRAND <nicoinattendu@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
96b71a6ec5
avcodec/jpeg2000dwt: merge rescaling with interleave in 9/7 float IDWT
...
10% faster
Reviewed-by: Nicolas BERTRAND <nicoinattendu@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
197e219c92
jpeg2000dwt: add float based 9/7 dwt
...
Untested as theres no code yet using it in the encoder.
Code based on mixed float/int dwt
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
cf05fe8a7e
jpeg2000dwt: remove floats from mixed float/int 9/7 dwt
...
This should fix some fate failures
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
d4a4661342
j2k/jpeg2000: merge j2k & jpeg2000 dwts, drop j2k dwt
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Nicolas Bertrand
c81a706381
JPEG 2000 decoder for DCinema
...
Based on the 2007 GSoC project from Kamil Nowosad <k.nowosad@students.mimuw.edu.pl>
Updated to current programming standards, style and many more small
fixes by Diego Biurrun <diego@biurrun.de>.
Signed-off-by: Diego Biurrun <diego@biurrun.de>
12 years ago