summaryrefslogtreecommitdiffstats
path: root/libavcodec/diracdec.c
Commit message (Collapse)AuthorAgeFilesLines
* avcodec/diracdec: Fix integer overflow with quantMichael Niedermayer2018-01-081-5/+5
| | | | | | | | | Fixes: signed integer overflow: 2 + 2147483646 cannot be represented in type 'int' Fixes: 4792/clusterfuzz-testcase-minimized-6322450775146496 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* diracdec: fix deprecated API usageNicolas Frattaroli2017-11-031-2/+10
| | | | | | | | avcodec_get_chroma_sub_sample is deprecated and generates a warning during build, so av_pix_fmt_get_chroma_sub_sample is used Signed-off-by: Nicolas Frattaroli <ffmpeg@fratti.ch> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/diracdec: Fix overflow in DC computationMichael Niedermayer2017-09-111-1/+1
| | | | | | | | Fixes: runtime error: signed integer overflow: 11896 + 2147483646 cannot be represented in type 'int' Fixes: 3053/clusterfuzz-testcase-minimized-6355082062856192 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/diracdec: Fix integer overflow in INTRA_DC_PRED()Michael Niedermayer2017-09-021-1/+1
| | | | | | | | | Fixes: runtime error: signed integer overflow: 1168175789 + 1168178473 cannot be represented in type 'int' Fixes: 3081/clusterfuzz-testcase-minimized-4807564879462400 Fixes: 2844/clusterfuzz-testcase-minimized-5561715838156800 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/diracdec: Fixes integer overflowMichael Niedermayer2017-08-171-1/+1
| | | | | | | | Fixes: runtime error: signed integer overflow: 340018243 * 27 cannot be represented in type 'int' Fixes: 2861/clusterfuzz-testcase-minimized-5361070510178304 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/diracdec: Check perspective_exp and zrs_exp.Michael Niedermayer2017-08-171-0/+4
| | | | | | | | | Fixes: undefined shift Fixes: runtime error: shift exponent 264 is too large for 32-bit type 'int' Fixes: 2860/clusterfuzz-testcase-minimized-4672811689836544 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/diracdec: Check weight_log2denomMichael Niedermayer2017-08-011-0/+5
| | | | | | | | | | Fixes: runtime error: shift exponent -1 is negative Fixes: 2742/clusterfuzz-testcase-minimized-5724322402402304 Fixes: 2744/clusterfuzz-testcase-minimized-4672435653705728 Fixes: 2749/clusterfuzz-testcase-minimized-5298741273690112 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/diracdec: Fix integer overflow in divide3()Michael Niedermayer2017-07-291-1/+1
| | | | | | | | Fixes: runtime error: signed integer overflow: -1073746548 * 21845 cannot be represented in type 'int' Fixes: 2729/clusterfuzz-testcase-minimized-5902915464069120 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/diracdec: Fix integer overflow in signed multiplication in ↵Michael Niedermayer2017-07-281-1/+2
| | | | | | | | | | UNPACK_ARITH() Fixes: runtime error: signed integer overflow: 1073741823 * 4 cannot be represented in type 'int' Fixes: 2729/clusterfuzz-testcase-minimized-5902915464069120 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/diracdec: Check dimensions which are closer to what is allocated in ↵Michael Niedermayer2017-07-211-1/+4
| | | | | | | | | | alloc_sequence_buffers() Fixes OOM Fixes: 2674/clusterfuzz-testcase-minimized-4999700518273024 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/diracdec: Fix off by 1 error in quant checkMichael Niedermayer2017-05-251-1/+1
| | | | | | | | Fixes: out of array read Fixes: 1781/clusterfuzz-testcase-minimized-4617176877105152 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/diracdec: Factor quant matrix readsMichael Niedermayer2017-05-251-4/+3
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/diracdec: Fix Assertion frame->buf[0] failed at libavcodec/decode.c:610Michael Niedermayer2017-05-111-1/+1
| | | | | | | Fixes: 1487/clusterfuzz-testcase-minimized-6288036495097856 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* dirac: make initialization of arithmetic coder tables threadsafe.Ronald S. Bultje2017-03-281-1/+8
|
* diracdec: check return code of get_buffer_with_edgeAndreas Cadhalpun2016-11-041-1/+3
| | | | | | | If it fails, buffers aren't allocated, causing NULL pointer dereferencing. Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
* diracdec: clear slice_params_num_buf on allocation failureAndreas Cadhalpun2016-11-041-0/+1
| | | | | | | | | | | Otherwise it can be non-zero next time decode_lowdelay is called, causing slice_params_buf not to be allocated, leading to a NULL pointer dereference. The problem was introduced in commit dcad4677d637cd2f701917e38361fa96b8c9a418. Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
* diracdec: use correct buffer for slice_params_buf reallocAndreas Cadhalpun2016-11-041-1/+1
| | | | | | | | | | This fixes a double-free detected by AddressSanitizer. The problem was introduced in commit dcad4677d637cd2f701917e38361fa96b8c9a418. Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
* avcodec/diracdec: Check numx/yMichael Niedermayer2016-08-201-0/+5
| | | | | | | | Fixes division by 0 Fixes: 60261c4469ba3e11059890fb2832a515/asan_generic_135e694_2790_beb94eaa0aeb7d11c0437375a8964a99.drc Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* diracdec: fix unchecked byte lengthRostislav Pehlivanov2016-07-131-3/+2
| | | | | | | Also drops the start variable since it's redundant. Found by Coverity, fixes CID1363964 Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* diracdec: fix maximum quantization index checksRostislav Pehlivanov2016-07-131-2/+2
| | | | | | Found by Coverity, fixes CID1363961 and CID1363962 Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* diracdec: fix #coeffs -> byte conversionRostislav Pehlivanov2016-07-121-2/+2
| | | | Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* diracdec: do not memset the entire coefficient buffer for HQ picturesRostislav Pehlivanov2016-07-111-3/+5
| | | | | | This is now handled by the slice decoding function. Signed-off-by: Rostislav Pehlivanov <rpehlivanov@obe.tv>
* diracdec: do not allocate and free slice parameters every frameRostislav Pehlivanov2016-07-111-14/+22
| | | | Signed-off-by: Rostislav Pehlivanov <rpehlivanov@obe.tv>
* diracdec: implement a LUT-based Golomb code parserRostislav Pehlivanov2016-07-111-12/+13
| | | | | | | | Still much left to optimize, but it provides a significant performance improvement - 10% for 300Mbps (1080p30), 25% for 1.5Gbps (4k 60fps) in comparison with the default implementation. Signed-off-by: Rostislav Pehlivanov <rpehlivanov@obe.tv>
* diracdec: rewrite HQ slice decodingRostislav Pehlivanov2016-07-111-15/+111
| | | | | | | | | | | | Now coefficients are written to a buffer and are then dequantized by the new SIMD dequantization functions. For the lower bands without enough coefficients to fill a register (and hence they overwrite) the C version of the dequantization function is used. The buffer is per-thread and will be realloc'd if anything changes. This prevents regressions and having to limit slice size. Signed-off-by: Rostislav Pehlivanov <rpehlivanov@obe.tv>
* diractab: expose the maximum quantization index as a macroRostislav Pehlivanov2016-07-111-4/+4
| | | | | | | Prevents having to have random magic values in the decoder and a separate macro in the encoder. Signed-off-by: Rostislav Pehlivanov <rpehlivanov@obe.tv>
* diracdec: decode HQ profile slices in rowsRostislav Pehlivanov2016-07-111-2/+11
| | | | | | Siginificantly improves the performance. Signed-off-by: Rostislav Pehlivanov <rpehlivanov@obe.tv>
* diracdec: simplify golomb parsing and dequantizationRostislav Pehlivanov2016-07-111-47/+6
| | | | | | | | In preparation for the following commits, this commit simplifies the coefficient parsing and dequantization function. It was needlessly inlined without much performance gain. Signed-off-by: Rostislav Pehlivanov <rpehlivanov@obe.tv>
* Merge commit '4024b566d664a4b161d677554be52f32e7ad4236'Hendrik Leppkes2016-06-261-28/+28
| | | | | | | * commit '4024b566d664a4b161d677554be52f32e7ad4236': golomb: Give svq3_get_se_golomb()/svq3_get_ue_golomb() better names Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
* avcodec/diracdec: Fix potential integer overflowMichael Niedermayer2016-05-191-2/+2
| | | | | | Fixes CID1361948 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/diracdec: check bitstream size related fields for overflowsMichael Niedermayer2016-03-281-5/+21
| | | | | | | | Fixes segfault Fixes Ticket5333 Regression since bfc8a4dabe5a0154b31128b59dca575010176441 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* diracdec: Pass DWTPlane to dwt initTimothy Gu2016-02-071-2/+2
|
* diracdec: Split DWTPlane struct from PlaneTimothy Gu2016-02-071-26/+21
|
* dirac_dwt: Rename init2 to initTimothy Gu2016-02-071-2/+2
| | | | The functions are all private.
* diradec: split tables away to a separate diractab fileRostislav Pehlivanov2016-02-031-73/+6
| | | | Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* diracdec: move the MAX_DWT_LEVELS macro to dirac.hRostislav Pehlivanov2016-02-031-11/+1
| | | | | | Used by the VC-2 encoder. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* diracdec: fix original Dirac Low Delay profileRostislav Pehlivanov2016-01-211-0/+3
| | | | | | | | | The version structure in the main decoder context was not (and apparently has never been) populated since it was added. Still, having VC-2 break the existing Dirac Low Delay mode was odd and easily avoidable had the specifications authors noticed/cared. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* diracdec: add support for 12 bit videosRostislav Pehlivanov2016-01-211-2/+5
| | | | | | | | | The DSP lacked a function needed to convert signed to unsigned. This was ignored when originally adding support and templating for bit depths greater than 8. The 10 bit function was used for 12 bit pictures and resulted in an improper conversion. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* avcodec/diracdec: Fix qfactor/offset tablesMichael Niedermayer2016-01-171-45/+63
| | | | | | | | | | | | | It seems the previous tables where calculated with 32bit integers ignoring overflows. Also check for the max qindex, the value is choosen so that the qfactor/offset fit in int32. Fixes: 070b7914fd5dfe8f93248bea71363410/asan_static-oob_c8d034_2764_258e20f4a3c79158aecddb61a833d756.drc Fixes out of array reads Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/diracdec: Handle the 0 vlc case at the top of coeff_unpack_golomb()Michael Niedermayer2016-01-131-6/+12
| | | | | | | decoding changes from 17 to 20 fps Reviewed-by; Rostislav Pehlivanov <atomnuker@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/diracdec: Factor +2 out of the inner loopMichael Niedermayer2016-01-131-5/+5
| | | | | Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/diracdec: Inline svq3_get_ue_golomb() and merge the sign bit ↵Michael Niedermayer2016-01-131-3/+34
| | | | | | | | | decoding into it This avoids closing and opening the bit reader Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* diracdec: Add slice threading to HQ profileKieran Kunhya2016-01-131-8/+30
|
* diracdec: fix idwt_stride calculation in bytesAndreas Cadhalpun2016-01-121-1/+1
| | | | | | | | | | | | The transformation to bytes must happen after alignment to get the same resulting pointers as before. This fixes segmentation faults in the assembler code. The regression was introduced in commit 9553689. Reviewed-by: Kieran Kunhya <kierank@obe.tv> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
* avcodec/diracdec: Check ff_set_dimensions() for failureMichael Niedermayer2015-12-171-1/+6
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/diracdec: fix aspect ratio (it was lost after ↵Michael Niedermayer2015-12-171-0/+1
| | | | | | | efcc8fddd6b7d1f931ff349e195d78c3c943d7fd) Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Merge commit 'e02de9df4b218bd6e1e927b67fd4075741545688'Hendrik Leppkes2015-12-171-14/+29
| | | | | | | * commit 'e02de9df4b218bd6e1e927b67fd4075741545688': lavc: export Dirac parsing API used by the ogg demuxer as public Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
* diracdec: Fix codeblock parameters readingKieran Kunhya2015-12-161-1/+16
|
* diracdec: Add support for HQ profileKieran Kunhya2015-12-161-39/+80
|
* diracdec: remove duplicate codeblock decodingRostislav Pehlivanov2015-12-101-13/+0
| | | | | | Broken by commit 7424a6d0a589d31100d6067ebcb47236c00f4b36 Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
OpenPOWER on IntegriCloud