summaryrefslogtreecommitdiff
path: root/libavcodec/jpeg2000dwt.c
Commit message (Collapse)AuthorAgeFilesLines
* avcodec/jpeg2000dwt: Fix left shift of negative numberAndreas Rheinhardt2022-09-291-1/+1
| | | | | | | | Fixes the j2k-dwt FATE-test; also fixes #9945. (I don't know whether the multiplication can overflow.) Reviewed-by: Tomas Härdin <git@haerdin.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Remove unnecessary libavutil/(avutil|common|internal).h inclusionsAndreas Rheinhardt2022-02-241-1/+2
| | | | | | | | | | Some of these were made possible by moving several common macros to libavutil/macros.h. While just at it, also improve the other headers a bit. Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* all: Remove unnecessary libavcodec/internal.h inclusionsAndreas Rheinhardt2022-02-081-1/+0
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Remove unnecessary avassert.h inclusionsAndreas Rheinhardt2021-07-221-1/+0
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/jpeg2000dwt: Fix undefined shifts of negative numbersAndreas Rheinhardt2019-09-281-1/+1
| | | | | | | | Affected the vsynth*-jpeg2000 and the vsynth*-jpeg2000-97 FATE tests (where * ranges over { 1, 2, 3, _lena }) as well as ticket #7983. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/jpeg2000dwt: Fix integer overflow in dwt_decode97_int()Michael Niedermayer2019-03-011-1/+1
| | | | | | | | Fixes: runtime error: signed integer overflow: 2147483598 + 128 cannot be represented in type 'int' Fixes: 12926/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-5705100733972480 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/jpeg2000dwt: Fix integer overflows in sr_1d53()Michael Niedermayer2018-02-201-4/+4
| | | | | | | 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>
* avcodec/jpeg2000dwt: Fix integer overflows in sr_1d97_int()Michael Niedermayer2017-06-261-4/+4
| | | | | | | | 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>
* avcodec/jpeg2000dwt: Fix integer overflow in dwt_decode97_int()Michael Niedermayer2017-06-261-1/+1
| | | | | | | | 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>
* avcodec/jpeg2000dwt: Fix runtime error: left shift of negative value -123Michael Niedermayer2017-06-111-1/+1
| | | | | | | 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>
* Merge commit 'd12b5b2f135aade4099f4b26b0fe678656158c13'Derek Buitenhuis2016-05-111-122/+0
|\ | | | | | | | | | | | | | | * 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>
| * jpeg2000: Merge rescaling with interleaving in 9/7 IDWTMichael Niedermayer2013-07-021-24/+10
| | | | | | | | Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* | avcodec/jpeg2000dwt: Check ndeclevels before calling dwt_encode*()Michael Niedermayer2015-11-271-0/+3
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/jpeg2000dwt: Check ndeclevels before calling dwt_decode*()Michael Niedermayer2015-11-271-0/+3
| | | | | | | | | | | | | | | | 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>
* | avcodec/jpeg2000: Change coord to 32bit to support larger than 32k width or ↵Michael Niedermayer2015-11-151-4/+4
| | | | | | | | | | | | | | | | | | 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>
* | avcodec/jpeg2000dwt: Replace /2 by >>1Michael Niedermayer2015-06-231-20/+20
| | | | | | | | | | | | Divisions can be slow if the compiler fails to replace them by shifts Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000dwt: Move large arrays used in the test code away from the stackMichael Niedermayer2015-06-221-4/+5
| | | | | | | | | | | | | | | | 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>
* | avcodec/jpeg2000dwt: Print 1 digit less in the 9/7f DWT testMichael Niedermayer2015-06-221-1/+1
| | | | | | | | | | | | | | This avoids test failure due to differing rounding between 32 and 64bit x86 Found-by: jamrial Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000dwt: Use a tighter check threshold for the 9/7f DWT testMichael Niedermayer2015-06-221-1/+1
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000: Move L band scaling from the 9/7f wavelet to quantization ↵Michael Niedermayer2015-06-221-4/+4
| | | | | | | | | | | | | | | | | | | | 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>
* | avcodec/jpeg2000dwt: use 32x32->64 multiplies in the 9/7i DWTMichael Niedermayer2015-06-221-8/+25
| | | | | | | | | | | | | | This significantly improves the quality when the integer 9/7 transform is used Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000: Move H band scaling from wavelet into quantization codeMichael Niedermayer2015-06-221-8/+8
| | | | | | | | | | | | | | This reduces the number of operations done and is equivalent except for rounding Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000dwt: Move K/X constants to headerMichael Niedermayer2015-06-221-2/+0
| | | | | | | | | | | | this makes them accessible by the rest of the jpeg2000 code Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000: Move gainb handling into the quantization codeMichael Niedermayer2015-06-221-14/+14
| | | | | | | | | | | | | | | | 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>
* | avcodec/jpeg2000dwt: Fix value of F_LFTG_X and I_LFTG_XMichael Niedermayer2015-06-211-5/+2
| | | | | | | | | | | | | | | | 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>
* | avcodec/jpeg2000dwt: also test 9/7 float DWTMichael Niedermayer2015-06-211-2/+44
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000dwt: List differences for DWT testMichael Niedermayer2015-06-211-0/+7
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000dwt: increase the number of test iterationsMichael Niedermayer2015-06-211-1/+1
| | | | | | | | | | | | the code had too little coverage Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000dwt: Also test 9/7 integer DWTMichael Niedermayer2015-06-211-2/+3
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000dwt: Allow testing with a maximum allowed differenceMichael Niedermayer2015-06-211-4/+6
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000dwt: Fill array using 2d instead of 1d accessesMichael Niedermayer2015-06-201-1/+1
| | | | | | | | | | | | | | Avoids gcc warning Found-by: jamrial Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000dwt: Factor dwt test code out so it can be easily used with ↵Michael Niedermayer2015-06-201-23/+34
| | | | | | | | | | | | the other dwts too Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000dwt: Fix special cases in sd_1d53()Michael Niedermayer2015-06-201-4/+4
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000dwt: add test for the 5/3 waveletMichael Niedermayer2015-06-201-0/+56
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000dwt: Fix order of operations in integer decomposition waveletsMichael Niedermayer2015-06-201-32/+34
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000dwt: Support 9/7 singularity cases on the encoder sideMichael Niedermayer2015-06-171-2/+12
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000dwt: More special cases to handle singularities in 9/7 decodeMichael Niedermayer2015-06-171-0/+4
| | | | | | | | | | | | Fixes Ticket4634 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000dwt: assert that mod == 0 for encodingMichael Niedermayer2015-06-171-0/+5
| | | | | | | | | | | | | | | | 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>
* | avcodec/jpeg2000dwt: Fix 9/7 IDWT for small sizesMichael Niedermayer2015-06-161-2/+8
| | | | | | | | | | | | Fixes Ticket4631 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000dwt: add special cases for handling length 1 in 5/3 decodeMichael Niedermayer2015-06-161-1/+4
| | | | | | | | | | | | Fixes Ticket4630 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000dwt: use av_malloc_array()Michael Niedermayer2014-04-231-3/+3
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000dwt: merge rescaling with interleave in 9/7 int IDWTMichael Niedermayer2013-06-031-13/+6
| | | | | | | | | | | | | | 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>
* | avcodec/jpeg2000dwt: merge rescaling with interleave in 9/7 float IDWTMichael Niedermayer2013-06-031-11/+4
| | | | | | | | | | | | | | 10% faster Reviewed-by: Nicolas BERTRAND <nicoinattendu@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | jpeg2000dwt: add float based 9/7 dwtMichael Niedermayer2013-05-281-1/+73
| | | | | | | | | | | | | | 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>
* | jpeg2000dwt: remove floats from mixed float/int 9/7 dwtMichael Niedermayer2013-05-281-14/+14
| | | | | | | | | | | | This should fix some fate failures Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | j2k/jpeg2000: merge j2k & jpeg2000 dwts, drop j2k dwtMichael Niedermayer2013-05-271-1/+150
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge remote-tracking branch 'qatar/master'Michael Niedermayer2013-04-221-4/+4
|/ | | | | | | | | | | | | | | | | | | | | | * 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>
* JPEG 2000 decoder for DCinemaNicolas Bertrand2013-04-221-0/+371
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>