summaryrefslogtreecommitdiff
path: root/libavcodec/hevc_cabac.c
Commit message (Collapse)AuthorAge
* avcodec/hevcdec: fix stat_coeff save/load for ↵Xu Guangxin2021-01-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | persistent_rice_adaptation_enabled_flag It's required by the 9.3.1 TableStatCoeff* section. Following clips have this feature: WPP_HIGH_TP_444_8BIT_RExt_Apple_2.bit Bitdepth_A_RExt_Sony_1.bin Bitdepth_B_RExt_Sony_1.bin EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_10BIT_RExt_Sony_1.bit EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_12BIT_RExt_Sony_1.bit EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_8BIT_RExt_Sony_1.bit EXTPREC_MAIN_444_16_INTRA_10BIT_RExt_Sony_1.bit EXTPREC_MAIN_444_16_INTRA_12BIT_RExt_Sony_1.bit EXTPREC_MAIN_444_16_INTRA_8BIT_RExt_Sony_1.bit WPP_AND_TILE_10Bit422Test_HIGH_TP_444_10BIT_RExt_Apple_2.bit WPP_AND_TILE_AND_CABAC_BYPASS_ALIGN_0_HIGH_TP_444_14BIT_RExt_Apple_2.bit WPP_AND_TILE_AND_CABAC_BYPASS_ALIGN_1_HIGH_TP_444_14BIT_RExt_Apple_2.bit WPP_AND_TILE_HIGH_TP_444_8BIT_RExt_Apple_2.bit you can download them from: https://www.itu.int/wftp3/av-arch/jctvc-site/bitstream_exchange/draft_conformance/RExt/ Signed-off-by: Xu Guangxin <oddstone@gmail.com> Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
* avcodec/hevc_cabac: Limit value in coeff_abs_level_remaining_decode() tighterMichael Niedermayer2020-11-29
| | | | | | | | | The max depth is 16bps, the max allowed coefficient depth is depth+6 Fixes: signed integer overflow: 1074266112 + 1073725439 cannot be represented in type 'int' Fixes: 26493/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5657763331702784 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavc/hevc_cabac: fix cbf_cb and cbf_cr for transform depth 4Linjie Fu2019-12-17
| | | | | | | | | | | The max transform depth is 5(from 0 to 4), so we need 5 cabac states for cbf_cb and cbf_cr. See Table 9-4 for details. Signed-off-by: Xu Guangxin <guangxin.xu@intel.com> Signed-off-by: Linjie Fu <linjie.fu@intel.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/hevc_cabac: Tighten the limit on k in ff_hevc_cu_qp_delta_abs()Michael Niedermayer2019-09-28
| | | | | | | | | | Values larger would fail subsequent tests. Fixes: signed integer overflow: 5 + 2147483646 cannot be represented in type 'int' Fixes: 16966/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5695709549953024 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/hevc_cabac: Check prefix so as to avoid invalid shifts in ↵Michael Niedermayer2018-01-27
| | | | | | | | | | | | | coeff_abs_level_remaining_decode() I suspect that this can be limited tighter, but i failed to find anything in the spec that would confirm that. Fixes: 4833/clusterfuzz-testcase-minimized-5302840101699584 Fixes: runtime error: left shift of 134217730 by 4 places cannot be represented in type 'int' Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/hevc_cabac: Move prefix check in coeff_abs_level_remaining_decode() downMichael Niedermayer2018-01-23
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/hevc_cabac: Fix integer overflow in ff_hevc_cu_qp_delta_abs()Michael Niedermayer2017-12-17
| | | | | | | | Fixes: signed integer overflow: 2147483647 + 1073741824 cannot be represented in type 'int' Fixes: 4555/clusterfuzz-testcase-minimized-4505532481142784 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/hevc_cabac: Check for ff_init_cabac_decoder() failure in cabac_reinit()Michael Niedermayer2017-08-03
| | | | | | | | Fixes: runtime error: left shift of negative value -967831544 Fixes: 2815/clusterfuzz-testcase-minimized-6062914471460864 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/hevcdec: check ff_init_cabac_decoder() for failureMichael Niedermayer2017-06-24
| | | | | | | | | Fixes: runtime error: left shift of 1965559808 by 4 places cannot be represented in type 'int' Fixes: 2333/clusterfuzz-testcase-minimized-5223935677300736 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Merge commit '5c89022542ce8521d89ef58858342a7bc1c3cd0d'Clément Bœsch2017-04-08
|\ | | | | | | | | | | | | * commit '5c89022542ce8521d89ef58858342a7bc1c3cd0d': hevc: Drop pointless av_unused attribute Merged-by: Clément Bœsch <u@pkh.me>
| * hevc: Drop pointless av_unused attributeDiego Biurrun2016-11-30
| |
* | Merge commit '0bfdcce4d42a6e654c00ea5f9237dc987626457f'James Almer2017-03-23
|\| | | | | | | | | | | | | * commit '0bfdcce4d42a6e654c00ea5f9237dc987626457f': hevc: move the SliceType enum to hevc.h Merged-by: James Almer <jamrial@gmail.com>
| * hevc: move the SliceType enum to hevc.hAnton Khirnov2016-10-21
| | | | | | | | | | Those values are decoder-independent and are also use by the VA-API encoder.
* | Merge commit '150c896a9e46b23b97debb0a5f66fbaeaa32f153'James Almer2017-03-23
|\| | | | | | | | | | | | | * commit '150c896a9e46b23b97debb0a5f66fbaeaa32f153': hevcdec: split ff_hevc_diag_scan* declarations into a separate header Merged-by: James Almer <jamrial@gmail.com>
* | Merge commit '4abe3b049d987420eb891f74a35af2cebbf52144'Clément Bœsch2017-03-23
|\| | | | | | | | | | | | | * commit '4abe3b049d987420eb891f74a35af2cebbf52144': hevc: rename hevc.[ch] to hevcdec.[ch] Merged-by: Clément Bœsch <u@pkh.me>
| * hevc: rename hevc.[ch] to hevcdec.[ch]Anton Khirnov2016-10-16
| | | | | | | | | | This is more consistent with the rest of libav and frees up the hevc.h name for decoder-independent shared declarations.
* | Merge commit 'cc16da75c2f99d92f7a6461100f041352deb6d88'Clément Bœsch2017-01-31
|\| | | | | | | | | | | | | | | | | | | * commit 'cc16da75c2f99d92f7a6461100f041352deb6d88': hevc: Add coefficient limiting to speed up IDCT Noop again as we have these changes already, only random spacing changes. Merged-by: Clément Bœsch <cboesch@gopro.com>
* | Merge commit '1bd890ad173d79e7906c5e1d06bf0a06cca4519d'Clément Bœsch2017-01-31
|\| | | | | | | | | | | | | | | | | | | | | | | | | * commit '1bd890ad173d79e7906c5e1d06bf0a06cca4519d': hevc: Separate adding residual to prediction from IDCT This commit should be a noop but isn't because of the following renames: - transform_add → add_residual - transform_skip → dequant - idct_4x4_luma → transform_4x4_luma Merged-by: Clément Bœsch <cboesch@gopro.com>
* | Merge commit '5afb94c817abffad030c6b94d7003dca8aace3d5'Clément Bœsch2016-06-21
|\| | | | | | | | | | | | | * commit '5afb94c817abffad030c6b94d7003dca8aace3d5': Mark read-only tables as static Merged-by: Clément Bœsch <u@pkh.me>
* | avcodec/hevc_cabac: Fix multiple integer overflowsMichael Niedermayer2015-11-27
| | | | | | | | | | | | | | Fixes: 04ec80eefa77aecd7a49a442cc02baea/asan_heap-oob_19544fa_3303_1905796cd9d8e15f86d664332caabc00.bit Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit 'a062a55d37720abc8c704aa0e8682efd3cdc9c9b'Michael Niedermayer2015-07-13
|\| | | | | | | | | | | | | | | | | | | | | * commit 'a062a55d37720abc8c704aa0e8682efd3cdc9c9b': hevc_parser: fix standalone build with the hevc decoder disabled Conflicts: libavcodec/Makefile libavcodec/hevc.c Merged-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit 'b11acd57326db6c2cc1475dd0bea2a06fbc85aa2'Michael Niedermayer2015-07-12
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'b11acd57326db6c2cc1475dd0bea2a06fbc85aa2': hevc: remove HEVCContext usage from hevc_ps Conflicts: libavcodec/hevc.c libavcodec/hevc_cabac.c libavcodec/hevc_filter.c libavcodec/hevc_mvs.c libavcodec/hevc_ps.c libavcodec/hevc_refs.c libavcodec/hevcpred_template.c Merged-by: Michael Niedermayer <michael@niedermayer.cc>
| * hevc: remove HEVCContext usage from hevc_psAnton Khirnov2015-07-12
| | | | | | | | | | | | Factor out the parameter sets into a separate struct and use it instead. This will allow us to reuse this code in the parser.
| * hevc: Use generic av_clip function, not C implementationPeter Meerwald2015-02-13
| | | | | | | | | | | | | | | | | | hevc seems to be the only place where the C implementation of the av_clip function is explicitly selected, precluding platform-specific optimizations Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Anton Khirnov <anton@khirnov.net>
| * hevc_cabac: decrease CABAC_MAX_BINMichael Niedermayer2014-11-11
| | | | | | | | | | | | | | Prevents shifts with undefined behavior, as no syntax element has a valid value greater than 1 << 31. Bug-Id: CID 1206635
* | avcodec/hevc_cabac: Rename ff_hevc_transform_skip_flag_decode() to ↵Michael Niedermayer2015-05-18
| | | | | | | | | | | | | | | | hevc_transform_skip_flag_decode() The function is static and used once in the file its defined in Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec: use av_mod_uintp2() where usefulJames Almer2015-04-21
| | | | | | | | | | Reviewed-by: Michael Niedermayer <michaelni@gmx.at> Signed-off-by: James Almer <jamrial@gmail.com>
* | hevc: reuse edge emu buffer for coefficientsChristophe Gisquet2014-10-01
| | | | | | | | | | | | | | Kind of hackish but... Reviewed-by: Mickael Raulet <Mickael.Raulet@insa-rennes.fr> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | hevc: remove CodingTreeChristophe Gisquet2014-09-27
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | hevc/rext: fixing rdpcm and scaling list for Range ExtensionMickaël Raulet2014-07-22
| | | | | | | | | | | | | | | | | | | | | | -new rext bitstreams: PERSIST_RPARAM_A_RExt_Sony_1.bit ok = QMATRIX_A_RExt_Sony_1.bit ok = SAO_A_RExt_MediaTek_1.bit ok = (cherry picked from commit cdea029d452c521f8e5bcbe589f44b13a4011604) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | hevc/rext: add support for Range extension toolsMickaël Raulet2014-07-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SPS features/flags: - transform_skip_rotation_enabled_flag - transform_skip_context_enabled_flag - implicit_rdpcm_enabled_flag - explicit_rdpcm_enabled_flag - intra_smoothing_disabled_flag - persistent_rice_adaptation_enabled_flag PPS features/flags: - log2_max_transform_skip_block_size - cross_component_prediction_enabled_flag - chroma_qp_offset_list_enabled_flag - diff_cu_chroma_qp_offset_depth - chroma_qp_offset_list_len_minus1 - cb_qp_offset_list - cr_qp_offset_list - log2_sao_offset_scale_luma - log2_sao_offset_scale_chroma (cherry picked from commit 005294c5b939a23099871c6130c8a7cc331f73ee) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | hevc/rext: basic infrastructure for supporting range extensionMickaël Raulet2014-07-15
| | | | | | | | | | | | | | | | - support for 4:2:2 and 4:4:4 up to 12 bits - add a new profile for range extension (cherry picked from commit d3c067fa65bbc871758d28aa07f54123430ca346) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | hevc: separate residu and prediction (needed for Range Extension)Mickaël Raulet2014-07-15
| | | | | | | | | | | | (cherry picked from commit 6b3856ef57d66f2e59ee61fd2eb5f83b6d0d7d4a) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | hevc/cabac: add new context for new syntax elements related to Rext(cherry ↵Mickaël Raulet2014-07-15
| | | | | | | | | | | | picked from commit 6d71e2394f52679cfc8b86fb5880f89e6bd311d4) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | hevc: cleaning up, remove unused constants(cherry picked from commit ↵Mickaël Raulet2014-07-14
| | | | | | | | | | | | 7eed32d076c57aa03011d65a64903e8bdb633978) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit '869fc416f7c78ed4e397e0208acd1545771c0502'Michael Niedermayer2014-06-18
|\| | | | | | | | | | | | | * commit '869fc416f7c78ed4e397e0208acd1545771c0502': hevc: Mark num_bins_in_se as unused Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * hevc: Mark num_bins_in_se as unusedLuca Barbato2014-06-18
| | | | | | | | Only its size is actually used. Silence a clang warning.
* | avcodec/hevc: new idct + asmplepere2014-06-17
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | hevc: C code update for new motion compensationMickaël Raulet2014-05-06
| | | | | | | | | | | | | | pretty print C Reviewed-by: "Ronald S. Bultje" <rsbultje@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/hevc_cabac: decrease CABAC_MAX_BINMichael Niedermayer2014-04-28
| | | | | | | | | | | | | | | | | | | | | | Prevents shifts with undefined behavior Fixes CID1206634 Fixes CID1206635 Fixed CID1206636 Reviewed-by: smarter Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | libavcodec/hevc: reduce bracket differences to ↵Michael Niedermayer2013-11-02
| | | | | | | | | | | | 064698d381e1e7790f21b0199a8930ea04e2e942 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/hevc: more whitespaces to reduce difference to ↵Michael Niedermayer2013-11-02
| | | | | | | | | | | | 064698d381e1e7790f21b0199a8930ea04e2e942 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/hevc: Adjust white-spaces to reduce difference to ↵Michael Niedermayer2013-11-02
| | | | | | | | | | | | 064698d381e1e7790f21b0199a8930ea04e2e942 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit '064698d381e1e7790f21b0199a8930ea04e2e942'Michael Niedermayer2013-11-01
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '064698d381e1e7790f21b0199a8930ea04e2e942': Add HEVC decoder Conflicts: Changelog libavcodec/Makefile libavcodec/allcodecs.c libavcodec/hevc.c libavcodec/hevc.h libavcodec/hevc_cabac.c libavcodec/hevc_filter.c libavcodec/hevc_mvs.c libavcodec/hevc_parser.c libavcodec/hevc_ps.c libavcodec/hevc_refs.c libavcodec/hevc_sei.c libavcodec/hevcdsp.c libavcodec/hevcdsp_template.c libavcodec/hevcpred.c libavcodec/hevcpred_template.c libavcodec/version.h cosmetics from hevc.h & hevc_ps.c mostly merged, other files left as they where in ffmpeg. Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * Add HEVC decoderGuillaume Martres2013-10-31
| | | | | | | | | | | | | | | | | | | | | | Initially written by Guillaume Martres <smarter@ubuntu.com> as a GSoC project. Further contributions by the OpenHEVC project and other developers, namely: Mickaël Raulet <mraulet@insa-rennes.fr> Seppo Tomperi <seppo.tomperi@vtt.fi> Gildas Cocherel <gildas.cocherel@laposte.net> Khaled Jerbi <khaled_jerbi@yahoo.fr> Wassim Hamidouche <wassim.hamidouche@insa-rennes.fr> Vittorio Giovara <vittorio.giovara@gmail.com> Jan Ekström <jeebjp@gmail.com> Anton Khirnov <anton@khirnov.net> Martin Storsjö <martin@martin.st> Luca Barbato <lu_zero@gentoo.org> Yusuke Nakamura <muken.the.vfrmaniac@gmail.com> Reimar Döffinger <Reimar.Doeffinger@gmx.de> Diego Biurrun <diego@biurrun.de> Signed-off-by: Anton Khirnov <anton@khirnov.net>
* hevc: more cosmetic(cherry picked from commit ↵Mickaël Raulet2013-10-27
| | | | | | | | 9697abe41daa234602915f85bf6b1c0ca0252cff) Decreases the difference to Anton Khirnovs patch v5 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* hevc : cosmetic changes(cherry picked from commit ↵Mickaël Raulet2013-10-27
| | | | | | | | 7308c0ccf13f18cebe4851e6dcd6b5c0b09be1dd) Decreases the difference to Anton Khirnovs patch v5 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* hevc: add wavefront parallel processingMickaël Raulet2013-10-22
| | | | | | | cherry picked from commit b971f2c8fdc60f8bab605a6e8060492eb548a53a cherry picked from commit e57b0a2c915ce6b8a9d57b8292f6581f0680842e Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* hevc: pretty print(cherry picked from commit ↵Mickaël Raulet2013-10-20
| | | | | | 64a4b623b7d66dfc0f3883e5f1d9125c00c3b18c) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avcodec/hevc_cabac: trivial simplificationsMichael Niedermayer2013-10-20
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>