1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-12 19:18:44 +02:00
Commit Graph

41 Commits

Author SHA1 Message Date
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>
2017-06-26 16:06:25 +02:00
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>
2017-06-26 16:06:25 +02:00
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>
2017-06-11 20:52:47 +02:00
Derek Buitenhuis
96d616052b Merge commit 'd12b5b2f135aade4099f4b26b0fe678656158c13'
* commit 'd12b5b2f135aade4099f4b26b0fe678656158c13':
  build: Split test programs off into separate files

Some conversions done by: James Almer <jamrial@gmail.com>
Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-05-11 19:13:03 +01:00
Michael Niedermayer
feb3f39614 avcodec/jpeg2000dwt: Check ndeclevels before calling dwt_encode*()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-27 21:02:13 +01:00
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>
2015-11-27 20:59:26 +01:00
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>
2015-11-15 22:11:05 +01:00
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>
2015-06-23 18:59:00 +02:00
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>
2015-06-22 23:18:47 +02:00
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>
2015-06-22 23:18:38 +02:00
Michael Niedermayer
19dc1ed4ad avcodec/jpeg2000dwt: Use a tighter check threshold for the 9/7f DWT test
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-22 23:06:55 +02:00
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>
2015-06-22 03:01:24 +02:00
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>
2015-06-22 02:27:50 +02:00
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>
2015-06-22 02:00:57 +02:00
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>
2015-06-22 01:54:51 +02:00
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>
2015-06-22 01:36:05 +02:00
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>
2015-06-21 19:25:35 +02:00
Michael Niedermayer
4299f085f4 avcodec/jpeg2000dwt: also test 9/7 float DWT
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-21 15:52:53 +02:00
Michael Niedermayer
6528b90dea avcodec/jpeg2000dwt: List differences for DWT test
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-21 13:43:02 +02:00
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>
2015-06-21 13:43:02 +02:00
Michael Niedermayer
d23b3f3940 avcodec/jpeg2000dwt: Also test 9/7 integer DWT
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-21 13:43:02 +02:00
Michael Niedermayer
3bd46914fb avcodec/jpeg2000dwt: Allow testing with a maximum allowed difference
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-21 13:43:02 +02:00
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>
2015-06-20 02:14:19 +02:00
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>
2015-06-20 02:10:39 +02:00
Michael Niedermayer
a75ca3ca6a avcodec/jpeg2000dwt: Fix special cases in sd_1d53()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-20 01:40:17 +02:00
Michael Niedermayer
de99ce4306 avcodec/jpeg2000dwt: add test for the 5/3 wavelet
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-20 01:37:43 +02:00
Michael Niedermayer
75651cd63f avcodec/jpeg2000dwt: Fix order of operations in integer decomposition wavelets
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-20 00:53:56 +02:00
Michael Niedermayer
7c3f7e6ed1 avcodec/jpeg2000dwt: Support 9/7 singularity cases on the encoder side
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-17 15:24:14 +02:00
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>
2015-06-17 15:07:50 +02:00
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>
2015-06-17 00:44:27 +02:00
Michael Niedermayer
34121ca187 avcodec/jpeg2000dwt: Fix 9/7 IDWT for small sizes
Fixes Ticket4631

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-16 20:33:54 +02:00
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>
2015-06-16 20:16:53 +02:00
Michael Niedermayer
1aa388d439 avcodec/jpeg2000dwt: use av_malloc_array()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-23 15:52:45 +02:00
Michael Niedermayer
c4604b8792 jpeg2000: Merge rescaling with interleaving in 9/7 IDWT
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-07-02 20:05:48 +02:00
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>
2013-06-03 13:24:20 +02:00
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>
2013-06-03 13:18:40 +02:00
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>
2013-05-28 09:42:19 +02:00
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>
2013-05-28 09:35:49 +02:00
Michael Niedermayer
d4a4661342 j2k/jpeg2000: merge j2k & jpeg2000 dwts, drop j2k dwt
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-27 21:54:07 +02:00
Michael Niedermayer
e2e9bee2da Merge remote-tracking branch 'qatar/master'
* qatar/master:
  avcodec: Bump minor for JPEG 2000 decoder
  JPEG 2000 decoder for DCinema

The mqc code is merged, the rest is added independent of
the existing jpeg2000 decoder and encoder.

Conflicts:
	Changelog
	doc/general.texi
	libavcodec/Makefile
	libavcodec/allcodecs.c
	libavcodec/mqc.c
	libavcodec/mqc.h
	libavcodec/mqcdec.c
	libavcodec/version.h
	tests/fate/video.mak

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-22 20:00:54 +02:00
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>
2013-04-22 15:38:29 +02:00