summaryrefslogtreecommitdiffstats
path: root/libavcodec/jpeg2000.c
Commit message (Collapse)AuthorAgeFilesLines
* avcodec/jpeg2000: Check that codsty->log2_prec_widths/heights has been ↵Michael Niedermayer2017-09-301-0/+3
| | | | | | | | | | initialized Fixes: OOM Fixes: 2225/clusterfuzz-testcase-minimized-5505632079708160 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 '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'Clément Bœsch2016-06-211-1/+1
|\ | | | | | | | | | | | | * commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb': cosmetics: Fix spelling mistakes Merged-by: Clément Bœsch <u@pkh.me>
| * cosmetics: Fix spelling mistakesVittorio Giovara2016-05-041-2/+2
| | | | | | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
* | lavc: move exp2fi to ff_exp2fi in internal.hGanesh Ajjanagadde2015-12-161-16/+2
| | | | | | | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
* | avcodec/jpeg2000: replace naive pow call with smarter exp2fiGanesh Ajjanagadde2015-12-081-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pow is a very wasteful function for this purpose. A low hanging fruit would be simply to replace with exp2f, and that does yield some speedup. However, there are 2 drawbacks of this: 1. It does not exploit the integer nature of the argument. 2. (minor) Some platforms lack a proper exp2f routine, making benefits available only to non broken libm. 3. exp2f does not solve the same issue that plagues pow, namely terrible worst case performance. This is a fundamental issue known as the "table-maker's dilemma" recognized by Prof. Kahan himself and subsequently elaborated and researched by many others. All this is clear from benchmarks below. This exploits the IEEE-754 format to get very good performance even in the worst case for integer powers of 2. This solves all the issues noted above. Function tested with clang usan over [-1000, 1000] (beyond range of relevance for this, which is [-255, 255]), patch itself with FATE. Benchmarks obtained on x86-64, Haswell, GNU-Linux via 10^5 iterations of the pow call, START/STOP, and command ffplay ~/samples/jpeg2000/chiens_dcinema2K.mxf. Low number of runs also given to prove the point about worst case: pow: 216270 decicycles in pow, 1 runs, 0 skips 110175 decicycles in pow, 2 runs, 0 skips 56085 decicycles in pow, 4 runs, 0 skips 29013 decicycles in pow, 8 runs, 0 skips 15472 decicycles in pow, 16 runs, 0 skips 8689 decicycles in pow, 32 runs, 0 skips 5295 decicycles in pow, 64 runs, 0 skips 3599 decicycles in pow, 128 runs, 0 skips 2748 decicycles in pow, 256 runs, 0 skips 2304 decicycles in pow, 511 runs, 1 skips 2072 decicycles in pow, 1022 runs, 2 skips 1963 decicycles in pow, 2044 runs, 4 skips 1894 decicycles in pow, 4091 runs, 5 skips 1860 decicycles in pow, 8184 runs, 8 skips exp2f: 134140 decicycles in pow, 1 runs, 0 skips 68110 decicycles in pow, 2 runs, 0 skips 34530 decicycles in pow, 4 runs, 0 skips 17677 decicycles in pow, 8 runs, 0 skips 9175 decicycles in pow, 16 runs, 0 skips 4931 decicycles in pow, 32 runs, 0 skips 2808 decicycles in pow, 64 runs, 0 skips 1747 decicycles in pow, 128 runs, 0 skips 1208 decicycles in pow, 256 runs, 0 skips 952 decicycles in pow, 512 runs, 0 skips 822 decicycles in pow, 1024 runs, 0 skips 765 decicycles in pow, 2047 runs, 1 skips 722 decicycles in pow, 4094 runs, 2 skips 693 decicycles in pow, 8190 runs, 2 skips exp2fi: 2740 decicycles in pow, 1 runs, 0 skips 1530 decicycles in pow, 2 runs, 0 skips 955 decicycles in pow, 4 runs, 0 skips 622 decicycles in pow, 8 runs, 0 skips 477 decicycles in pow, 16 runs, 0 skips 368 decicycles in pow, 32 runs, 0 skips 317 decicycles in pow, 64 runs, 0 skips 291 decicycles in pow, 128 runs, 0 skips 277 decicycles in pow, 256 runs, 0 skips 268 decicycles in pow, 512 runs, 0 skips 265 decicycles in pow, 1024 runs, 0 skips 263 decicycles in pow, 2048 runs, 0 skips 263 decicycles in pow, 4095 runs, 1 skips 260 decicycles in pow, 8191 runs, 1 skips Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
* | avcodec/jpeg2000: fix type of arguments of tag_tree_sizeMichael Niedermayer2015-12-031-3/+3
| | | | | | | | | | | | | | Fixes: out of array read Fixes: 36b8096fefab16c4c9326a508053e95c/signal_sigsegv_1d9ce18_3233_1a55196b018106dfabeace071a432d9e.r3d 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-3/+3
| | | | | | | | | | | | | | | | | | 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/jpeg2000: Check comp coords to be within the supported sizeMichael Niedermayer2015-11-151-0/+5
| | | | | | | | | | | | | | | | | | | | | | Fixes assertion failure Fixes: 03e0abe721b1174856d41a1eb5d6a896/signal_sigabrt_7ffff6ae7cc9_3813_e71bf3541abed3ccba031cd5ba0269a4.avi This fix is choosen to be simple to backport, better solution for master is planed Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/jpeg2000: Use av_image_check_size() in ff_jpeg2000_init_component()Michael Niedermayer2015-11-151-1/+5
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit '570fcaf3326aef9313b10863e2f6e6ae664d9dae'Hendrik Leppkes2015-09-161-103/+119
|\ \ | |/ | | | | | | | | | | * commit '570fcaf3326aef9313b10863e2f6e6ae664d9dae': jpeg2000: Factor out prec init Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * jpeg2000: Factor out prec initLuca Barbato2015-09-141-96/+112
| | | | | | | | Makes debugging a little simpler.
* | Merge commit '95a41311ac3a44773cc4dc407408aca35b1f8e26'Hendrik Leppkes2015-09-161-14/+24
|\ \ | |/ | | | | | | | | | | * commit '95a41311ac3a44773cc4dc407408aca35b1f8e26': jpeg2000: Factor out band stepsize initialization Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * jpeg2000: Factor out band stepsize initializationLuca Barbato2015-09-141-14/+25
| |
* | Merge commit '7fb93eae43cc89bd7c1c275344e1cdbadab7155b'Hendrik Leppkes2015-09-161-212/+232
|\ \ | |/ | | | | | | | | | | * commit '7fb93eae43cc89bd7c1c275344e1cdbadab7155b': jpeg2000: Factor out band initialization Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * jpeg2000: Factor out band initializationLuca Barbato2015-09-141-193/+213
| |
* | avcodec/jpeg2000: comment out unused variableGanesh Ajjanagadde2015-08-211-1/+1
| | | | | | | | | | | | | | | | Fixes -Wunused-const-variable from http://fate.ffmpeg.org/report.cgi?time=20150820031140&slot=arm64-darwin-clang-apple-5.1 Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit '059a934806d61f7af9ab3fd9f74994b838ea5eba'Michael Niedermayer2015-07-271-2/+2
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '059a934806d61f7af9ab3fd9f74994b838ea5eba': lavc: Consistently prefix input buffer defines Conflicts: doc/examples/decoding_encoding.c libavcodec/4xm.c libavcodec/aac_adtstoasc_bsf.c libavcodec/aacdec.c libavcodec/aacenc.c libavcodec/ac3dec.h libavcodec/asvenc.c libavcodec/avcodec.h libavcodec/avpacket.c libavcodec/dvdec.c libavcodec/ffv1enc.c libavcodec/g2meet.c libavcodec/gif.c libavcodec/h264.c libavcodec/h264_mp4toannexb_bsf.c libavcodec/huffyuvdec.c libavcodec/huffyuvenc.c libavcodec/jpeglsenc.c libavcodec/libxvid.c libavcodec/mdec.c libavcodec/motionpixels.c libavcodec/mpeg4videodec.c libavcodec/mpegvideo.c libavcodec/noise_bsf.c libavcodec/nuv.c libavcodec/nvenc.c libavcodec/options.c libavcodec/parser.c libavcodec/pngenc.c libavcodec/proresenc_kostya.c libavcodec/qsvdec.c libavcodec/svq1enc.c libavcodec/tiffenc.c libavcodec/truemotion2.c libavcodec/utils.c libavcodec/utvideoenc.c libavcodec/vc1dec.c libavcodec/wmalosslessdec.c libavformat/adxdec.c libavformat/aiffdec.c libavformat/apc.c libavformat/apetag.c libavformat/avidec.c libavformat/bink.c libavformat/cafdec.c libavformat/flvdec.c libavformat/id3v2.c libavformat/isom.c libavformat/matroskadec.c libavformat/mov.c libavformat/mpc.c libavformat/mpc8.c libavformat/mpegts.c libavformat/mvi.c libavformat/mxfdec.c libavformat/mxg.c libavformat/nutdec.c libavformat/oggdec.c libavformat/oggparsecelt.c libavformat/oggparseflac.c libavformat/oggparseopus.c libavformat/oggparsespeex.c libavformat/omadec.c libavformat/rawdec.c libavformat/riffdec.c libavformat/rl2.c libavformat/rmdec.c libavformat/rtpdec_latm.c libavformat/rtpdec_mpeg4.c libavformat/rtpdec_qdm2.c libavformat/rtpdec_svq3.c libavformat/sierravmd.c libavformat/smacker.c libavformat/smush.c libavformat/spdifenc.c libavformat/takdec.c libavformat/tta.c libavformat/utils.c libavformat/vqf.c libavformat/westwood_vqa.c libavformat/xmv.c libavformat/xwma.c libavformat/yop.c Merged-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/jpeg2000dec: Merge i_stepsize/2 decoder special case into dequantMichael Niedermayer2015-06-281-2/+3
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000: Support 32 decomposition levelsMichael Niedermayer2015-06-281-1/+1
| | | | | | | | | | | | Fixes Ticket4680 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000dec: Support progression order changesMichael Niedermayer2015-06-261-0/+2
| | | | | | | | | | | | Fixes Ticket4657 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000: Remove CBLK limitMichael Niedermayer2015-06-261-13/+13
| | | | | | | | | | | | | | | | | | This also reduces the amount of memory needed Fixes Ticket4672 The new code seems slightly faster as well, probably due to better cache usage Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000: Improve right bottom precinct positionsMichael Niedermayer2015-06-251-4/+4
| | | | | | | | | | | | Fixes Ticket4656 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-0/+5
| | | | | | | | | | | | | | | | | | | | 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/jpeg2000: Move H band scaling from wavelet into quantization codeMichael Niedermayer2015-06-221-2/+11
| | | | | | | | | | | | | | This reduces the number of operations done and is equivalent except for rounding Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000: Move gainb handling into the quantization codeMichael Niedermayer2015-06-221-3/+2
| | | | | | | | | | | | | | | | 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/jpeg2000: Fix regression with multiple tilesMichael Niedermayer2015-06-141-6/+7
| | | | | | | | | | | | Fixes Ticket 4624 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000: Change codeblock coords to same origin as bandsMichael Niedermayer2015-06-141-6/+6
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000: Change precinct coords to same origin as bandsMichael Niedermayer2015-06-141-12/+12
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000: Fix band coordsMichael Niedermayer2015-06-141-6/+6
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg200dsp: add ff_rct_int_{sse2,avx2}James Almer2015-06-131-0/+1
| | | | | | | | | | Reviewed-by: Michael Niedermayer <michaelni@gmx.at> Signed-off-by: James Almer <jamrial@gmail.com>
* | avcodec/jpeg200dsp: add ff_ict_float_{sse,avx}James Almer2015-06-131-0/+1
| | | | | | | | | | | | | | Original intrinsics version by Nicolas Bertrand. Reviewed-by: Michael Niedermayer <michaelni@gmx.at> Signed-off-by: James Almer <jamrial@gmail.com>
* | avcodec/jpeg2000dec: Fix Selective arithmetic coding bypass and Multiple ↵Michael Niedermayer2015-06-121-1/+1
| | | | | | | | | | | | | | | | | | | | codeword segments These 2 are highly related so they are in the same commit Fixes part of Ticket4605 Fixes p0_04.j2k Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000: remove unused variableMichael Niedermayer2015-06-091-1/+0
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000: Disable special case for JPEG2000_QSTY_SIMichael Niedermayer2015-06-091-5/+5
| | | | | | | | | | | | | | | | The code gave apparently completely wrong values Fixes Ticket2872 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000dec: Fix subsampled decodingMichael Niedermayer2015-06-091-5/+0
| | | | | | | | | | | | Fixes part of Ticket3619 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit 'a2448cfe167a4cd4eb631318550d4eef38fca24a'Michael Niedermayer2014-11-131-9/+14
|\ \ | |/ | | | | | | | | | | | | | | | | * commit 'a2448cfe167a4cd4eb631318550d4eef38fca24a': jpeg2000: do not compute the same value twice Conflicts: libavcodec/jpeg2000.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * jpeg2000: do not compute the same value twiceVittorio Giovara2014-11-131-9/+6
| | | | | | | | | | CC: libav-stable@libav.org Bug-Id: CID 1026771 / CID 1026772 / CID 1026773
* | Merge commit '10306e9c5fcc28bd9310a9b38f21540e9e1433e9'Michael Niedermayer2014-06-241-17/+24
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | * commit '10306e9c5fcc28bd9310a9b38f21540e9e1433e9': jpeg2000: fix dereferencing invalid pointers during cleanup Conflicts: libavcodec/jpeg2000.c See: 09927f3eaa93e31dd90ab8ee66dc1ad867b3365f See: 912ce9dd2080c5837285a471d750fa311e09b555 See: 9e477a37703318cb86d8ed1d426929235aa02b67 Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * jpeg2000: fix dereferencing invalid pointers during cleanupVittorio Giovara2014-06-231-8/+23
| | | | | | | | | | | | CC: libav-stable@libav.org Found-by: Laurent Butti <laurentb@gmail.com> Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | Merge commit 'fe4d5fe9361162f9033ff1bd84bfc1b2091ba785'Michael Niedermayer2014-06-171-1/+2
|\ \ | |/ | | | | | | | | | | | | | | | | | | * commit 'fe4d5fe9361162f9033ff1bd84bfc1b2091ba785': jpeg2000: Mark static data init functions as av_cold Conflicts: libavcodec/jpeg2000.c libavcodec/jpeg2000dec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * jpeg2000: Mark static data init functions as av_coldDiego Biurrun2014-06-171-1/+2
| |
* | fix various typosLou Logan2014-06-031-1/+1
| | | | | | | | | | Signed-off-by: Lou Logan <lou@lrcd.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/jpeg2000: zero i/f_dataMichael Niedermayer2013-10-131-2/+2
| | | | | | | | | | | | | | | | Fixes uninitialized use of variables Fixes part of Ticket2921 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | jpeg2000: fix null pointer dereference in case of malloc failureMichael Niedermayer2013-08-231-9/+11
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | jpeg2000: zero reslevel array on allocationMichael Niedermayer2013-08-231-1/+1
| | | | | | | | | | | | prevent use of uninitialized values Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | jpeg2000: fix dereferencing invalid pointersMichael Niedermayer2013-08-231-6/+8
| | | | | | | | | | Found-by: Laurent Butti <laurentb@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | jpeg2000: fix overflow in dequantizationMichael Niedermayer2013-07-131-1/+1
| | | | | | | | | | | | | | | | Fixes decoding of file generated with: ffmpeg -f lavfi -i smptehdbars=hd720 -pix_fmt rgb48 /tmp/o.jp2 Reviewed-by: Nicolas BERTRAND <nicoinattendu@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit 'daeb4e3042f2ecae2d41aaa4cae0bed932539788'Michael Niedermayer2013-07-031-1/+3
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | * commit 'daeb4e3042f2ecae2d41aaa4cae0bed932539788': jpeg2000: Proper cleanup on failure in decode_frame() Conflicts: libavcodec/jpeg2000.c See: 9d56ccf5 Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * jpeg2000: Proper cleanup on failure in decode_frame()Luca Barbato2013-07-021-1/+3
| | | | | | | | Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
| * jpeg2000: Compute corrections of sub-band coordinatesMichael Niedermayer2013-07-021-3/+7
| | | | | | | | Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
OpenPOWER on IntegriCloud