libhevc-mirror/decoder
Narayan Kalaburgi df28e1e8ab
Some checks failed
CMake / build (cmake, aarch64-linux-gnu-gcc, -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/aarch64_toolchain.cmake, aarch64-linux-gnu-g++, ubuntu-latest-cross-aarch64-cmake, ubuntu-latest) (push) Has been cancelled
CMake / build (cmake, arm-linux-gnueabihf-gcc, -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/aarch32_toolchain.cmake, arm-linux-gnueabihf-g++, ubuntu-latest-cross-aarch32-cmake, ubuntu-latest) (push) Has been cancelled
CMake / build (cmake, clang, , clang++, macos-latest-clang-cmake, macos-latest) (push) Has been cancelled
CMake / build (cmake, clang, , clang++, ubuntu-24.04-arm-clang-cmake, ubuntu-24.04-arm) (push) Has been cancelled
CMake / build (cmake, clang, , clang++, ubuntu-latest-clang-cmake, ubuntu-latest) (push) Has been cancelled
CMake / build (cmake, clang, -DSANITIZE=fuzzer-no-link,address, clang++, ubuntu-latest-clang-cmake-asan-fuzzer, ubuntu-latest) (push) Has been cancelled
CMake / build (cmake, clang, -G Ninja, clang++, ubuntu-latest-clang-cmake-ninja, ubuntu-latest) (push) Has been cancelled
CMake / build (cmake, gcc, , g++, ubuntu-latest-gcc-cmake, ubuntu-latest) (push) Has been cancelled
libhevcdec: Implement 10-bit decoding support for Cross Component Prediction
This commit implements HBD inverse transform residual functions, which is a
prerequisite to enable 10-bit decoding with Cross Component Prediction (CCP).

When CCP is enabled, the inverse transform and prediction addition cannot be
performed in a single pass (`itrans_recon`). Instead, the decoder must first
compute the unclipped transform residuals (`itrans_res`), scale them for CCP,
and then add the prediction. For 10-bit bitstreams, the decoder was missing
HBD implementations for `itrans_res` and improperly falling back to 8-bit
implementations. This resulted in the use of an incorrect second-stage inverse
transform shift (hardcoded to 12 instead of `20 - bit_depth`), significantly
corrupting the residuals.

Key Changes:
1. Created `common/ihevc_hbd_itrans_res.c` providing mathematically compliant
   HBD implementations of `itrans_res` for all Transform Unit sizes (4x4, 8x8,
   16x16, 32x32, and DC) using intermediate `CLIP_S16` logic and dynamic
   bit-depth shifting (`20 - bit_depth`).

2. Implemented `ihevc_hbd_chroma_recon_nxn_ccp` to properly scale 10-bit residuals
   with the cross-component alpha and add the prediction.

3. Modified `ihevcd_iquant_itrans_resi_recon_tu_plane` to dynamically branch to
   `ps_codec->apf_hbd_itrans_res` and `ihevc_hbd_chroma_recon_nxn_ccp` when
   `pixel_size > 1`. This cleanly handles 10-bit CCP while keeping 8-bit paths
   untouched.
2026-08-24 05:35:06 +00:00
..
arm Cleanup few more unnecessary changes from HBD path 2026-08-09 05:13:29 +00:00
arm64 Cleanup few more unnecessary changes from HBD path 2026-08-09 05:13:29 +00:00
riscv64 Include ihevcd_defs.h and ihevcd_structs.h in risc function selector 2026-06-22 20:01:44 -07:00
x86 Cleanup few more unnecessary changes from HBD path 2026-08-09 05:13:29 +00:00
ihevcd_api.c libhevcdec: Implement 10-bit decoding support for Cross Component Prediction 2026-08-24 05:35:06 +00:00
ihevcd_bitstream.c use unsigned word type in ihevcd_bits_seek to avoid signed shift ub 2026-07-06 21:28:17 -07:00
ihevcd_bitstream.h Initial Version of HEVC decoder 2014-05-21 18:14:55 -07:00
ihevcd_boundary_strength.c libhevcdec: Cast pu1_pic_qp to WORD8 * in boundary strength calculation 2026-08-14 01:13:07 +00:00
ihevcd_boundary_strength.h Initial Version of HEVC decoder 2014-05-21 18:14:55 -07:00
ihevcd_cabac.c hevcdec: add support for persistent rice adaptation flag 2026-03-16 10:03:26 -07:00
ihevcd_cabac.h hevcdec: add support for persistent rice adaptation flag 2026-03-16 10:03:26 -07:00
ihevcd_common_tables.c hevcdec: update lib for chroma format idc 422 2026-03-04 15:39:55 -08:00
ihevcd_common_tables.h hevcdec: update lib for chroma format idc 422 2026-03-04 15:39:55 -08:00
ihevcd_cxa.h Move HEVC_DEC_PROFILE_T to ihevcd_structs.h 2026-08-09 23:47:45 +00:00
ihevcd_deblk.c decoder: Clean up HBD function pointers and rename to match convention 2026-08-09 23:47:45 +00:00
ihevcd_deblk.h Initial Version of HEVC decoder 2014-05-21 18:14:55 -07:00
ihevcd_debug.h Initial Version of HEVC decoder 2014-05-21 18:14:55 -07:00
ihevcd_decode.c Add support to return bit depth after decode header call 2026-08-22 02:22:06 +00:00
ihevcd_decode.h Initial Version of HEVC decoder 2014-05-21 18:14:55 -07:00
ihevcd_defs.h Remove few more unnecessary changes from HBD path 2026-08-09 23:47:45 +00:00
ihevcd_error.h Remove few more unnecessary changes from HBD path 2026-08-09 23:47:45 +00:00
ihevcd_fmt_conv.c libhevc: Implement 10-bit 444 sp to p Output format conversion 2026-08-14 21:34:32 +00:00
ihevcd_fmt_conv.h Few minor cleanups in headers to minimize the differences with main branch 2026-08-12 05:24:06 +00:00
ihevcd_func_types.h Initial Version of HEVC decoder 2014-05-21 18:14:55 -07:00
ihevcd_function_selector.h libhevcdec: Implement 10-bit decoding support for Cross Component Prediction 2026-08-24 05:35:06 +00:00
ihevcd_function_selector_generic.c libhevcdec: Implement 10-bit decoding support for Cross Component Prediction 2026-08-24 05:35:06 +00:00
ihevcd_get_mv.c fix oob top-left pu-map read in ihevcd_get_mv_ctb 2026-07-14 07:25:34 -07:00
ihevcd_get_mv.h Initial Version of HEVC decoder 2014-05-21 18:14:55 -07:00
ihevcd_ilf_padding.h Initial Version of HEVC decoder 2014-05-21 18:14:55 -07:00
ihevcd_inter_pred.c decoder: Clean up HBD function pointers and rename to match convention 2026-08-09 23:47:45 +00:00
ihevcd_inter_pred.h Initial Version of HEVC decoder 2014-05-21 18:14:55 -07:00
ihevcd_intra_pred_mode_prediction.c libhevc: Direct memcpy and memset calls to enable _FORTIFY_SOURCE 2026-06-18 06:44:56 -07:00
ihevcd_intra_pred_mode_prediction.h Initial Version of HEVC decoder 2014-05-21 18:14:55 -07:00
ihevcd_iquant_itrans_recon_ctb.c libhevcdec: Implement 10-bit decoding support for Cross Component Prediction 2026-08-24 05:35:06 +00:00
ihevcd_iquant_itrans_recon_ctb.h Remove few more unnecessary changes from HBD path 2026-08-09 23:47:45 +00:00
ihevcd_itrans_recon_dc.c Remove few more unnecessary changes from HBD path 2026-08-09 23:47:45 +00:00
ihevcd_itrans_recon_dc.h Few minor cleanups in headers to minimize the differences with main branch 2026-08-12 05:24:06 +00:00
ihevcd_ittiam_logo.h Clean up HBD support before split 2026-08-07 17:25:44 +00:00
ihevcd_job_queue.c Source files clean up 2014-07-12 15:09:24 -07:00
ihevcd_job_queue.h Source files clean up 2014-07-12 15:09:24 -07:00
ihevcd_mv_merge.c Reduced memory requirements 2015-10-09 11:44:26 -07:00
ihevcd_mv_merge.h Initial Version of HEVC decoder 2014-05-21 18:14:55 -07:00
ihevcd_mv_pred.c Source files clean up 2014-07-12 15:09:24 -07:00
ihevcd_mv_pred.h Initial Version of HEVC decoder 2014-05-21 18:14:55 -07:00
ihevcd_nal.c libhevc: move SEI related code under a macro 2024-05-07 10:07:49 -07:00
ihevcd_nal.h Initial Version of HEVC decoder 2014-05-21 18:14:55 -07:00
ihevcd_parse_headers.c hevcdec: Remove rext generic function pointer override for 422/444 2026-08-19 22:18:26 +00:00
ihevcd_parse_headers.h libhevc: move SEI related code under a macro 2024-05-07 10:07:49 -07:00
ihevcd_parse_residual.c Cleanup few more unnecessary changes from HBD path 2026-08-09 05:13:29 +00:00
ihevcd_parse_residual.h Remove few more unnecessary changes from HBD path 2026-08-09 23:47:45 +00:00
ihevcd_parse_slice.c libhevcdec: Fix compiler warnings in ihevcd_parse_slice 2026-08-22 02:33:24 +00:00
ihevcd_parse_slice.h Initial Version of HEVC decoder 2014-05-21 18:14:55 -07:00
ihevcd_parse_slice_header.c libhevcdec: Fix slice QP delta lower bound validation for HBD 2026-08-19 14:32:49 +00:00
ihevcd_parse_slice_header.h Initial Version of HEVC decoder 2014-05-21 18:14:55 -07:00
ihevcd_process_slice.c Remove SAO wrapper 2026-08-09 23:47:45 +00:00
ihevcd_process_slice.h Initial Version of HEVC decoder 2014-05-21 18:14:55 -07:00
ihevcd_profile.h Source files clean up 2014-07-12 15:09:24 -07:00
ihevcd_ref_list.c Decoder: Fix integer-overflow sanitizer issues 2019-01-09 13:16:37 -08:00
ihevcd_ref_list.h Initial Version of HEVC decoder 2014-05-21 18:14:55 -07:00
ihevcd_sao.c Fix hbd sao for 422 2026-08-23 05:26:29 +00:00
ihevcd_sao.h Remove SAO wrapper 2026-08-09 23:47:45 +00:00
ihevcd_statistics.h Initial Version of HEVC decoder 2014-05-21 18:14:55 -07:00
ihevcd_structs.h libhevcdec: Implement 10-bit decoding support for Cross Component Prediction 2026-08-24 05:35:06 +00:00
ihevcd_trace.h Initial Version of HEVC decoder 2014-05-21 18:14:55 -07:00
ihevcd_utils.c Remove SAO wrapper 2026-08-09 23:47:45 +00:00
ihevcd_utils.h libhevcdec: disable simd optimizations during 422/444 decoding. 2026-05-07 07:00:35 -07:00
ihevcd_version.c Clean up HBD support before split 2026-08-07 17:25:44 +00:00
libhevcdec.cmake decoder: Clean up HBD function pointers and rename to match convention 2026-08-09 23:47:45 +00:00