Commit Graph

13 Commits

Author SHA1 Message Date
gg0907
65994f5530 upgrade to 4.4.1
Signed-off-by: gg0907 <guohui_1701@163.com>
2022-05-23 11:23:35 +08:00
Michael Niedermayer
cca0436efc avcodec/dirac_vlc: Fix integer overflow in ff_dirac_golomb_read_32/16bit()
Fixes: left shift of 1073741824 by 1 places cannot be represented in type 'int32_t' (aka 'int')
Fixes: 21245/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5683334274613248

Change to int16_t suggested by Lynne

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-25 22:32:16 +02:00
Lynne
675bb1f4f9 diracdec: rewrite golomb reader
This version is able to output multiple coefficients at a time and
is able to altogether remove actual golomb code parsing.
Its also able to partially recover the last coefficient in case
the packet is incomplete.

Total decoder performance gain for 8bit 420 1080p lossless: 40%.
Total decoder performance gain for 10bit 420 1080p lossless: 40%.

clang was able to vectorize the loop much better than
my handwritten assembly, but gcc was very naive and didn't.

Lookup table is a rewritten version of vc2hqdecode.
2020-03-12 20:26:48 +00:00
Michael Niedermayer
d98d29a775 avcodec/dirac_vlc: limit res_bits in APPEND_RESIDUE()
Fixes: runtime error: left shift of 1073741838 by 1 places cannot be represented in type 'int32_t' (aka 'int')
Fixes: 3279/clusterfuzz-testcase-minimized-4564805744590848

Suggested-by: <atomnuker>
Reviewed-by: <atomnuker>
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-09-09 18:55:47 +02:00
Michael Niedermayer
c595139f1f avcodec/dirac_vlc: Fix invalid shift in ff_dirac_golomb_read_32bit()
Fixes: runtime error: shift exponent 64 is too large for 64-bit type 'residual' (aka 'unsigned long')
Fixes: 2838/clusterfuzz-testcase-minimized-6260066086813696

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-09-02 23:50:28 +02:00
Michael Niedermayer
46e4075549 avcodec/dirac_vlc: Fix invalid shift
Fixes: runtime error: shift exponent 65 is too large for 64-bit type 'residual' (aka 'unsigned long')
Fixes: 2737/clusterfuzz-testcase-minimized-4968639147016192

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-08-01 13:54:43 +02:00
Michael Niedermayer
69e7daf6ce avcodec/dirac_vlc: Fix undefined shift
Fixes: runtime error: shift exponent 64 is too large for 64-bit type 'residual' (aka 'unsigned long')
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>
2017-07-24 02:42:33 +02:00
Rostislav Pehlivanov
f41e37b84f dirac_vlc: prevent shifting a 0 by 64 bits when zeroing residue
Adding a check for bits == 0 would still make Coverity misdetect this,
so just revert to the normal way of setting the residue to 0.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2016-07-14 01:29:34 +01:00
Rostislav Pehlivanov
c4adcff976 dirac_vlc: add a SET_RESIDUE macro and fix recent regression
Can also be used in future cleanups since 99% of the time the leftover
appending will just append to an already empty residue.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2016-07-14 01:00:59 +01:00
Rostislav Pehlivanov
9c0aba434e dirac_vlc: remove redundant macro declaration
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2016-07-13 23:38:10 +01:00
Rostislav Pehlivanov
e24c31b656 dirac_vlc: fix undefined shifts
Shifting by more than 63 bits is undefined behavior, athough any
compiler not returning 0 after shifting by any amount would be insane.

Found by Coverity, fixes CID1363959 and CID1363960

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2016-07-13 23:35:03 +01:00
Michael Niedermayer
9157ac2f9c avcodec/dirac_vlc: Fix mixed declaration and statements
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-12 13:30:52 +02:00
Rostislav Pehlivanov
0eb0f93109 diracdec: implement a LUT-based Golomb code parser
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>
2016-07-11 23:40:28 +01:00