No description
Find a file
Narayan Kalaburgi 9886db71d3 libhevcdec: Unify itrans_res family and remove redundant HBD implementation
Currently, libhevc maintains two separate implementations for inverse
transform residual functions: ihevc_itrans_res_* and ihevc_hbd_itrans_res_*.

Since both 8-bit and HBD inverse transform residual routines output signed
16-bit residuals (WORD16 *pi2_dst), the only algorithmic difference between
8-bit and HBD variants is the 2nd stage shift:

    Stage 1 shift: IT_SHIFT_STAGE_1 = 7 (fixed across all bit depths)
    Stage 2 shift: shift = 20 - bit_depth
        - 8-bit:  20 - 8  = 12 (IT_SHIFT_STAGE_2)
        - 10-bit: 20 - 10 = 10

This commit cleans up the entire itrans_res family (4x4_ttype1, 4x4, dc, 8x8,
16x16, 32x32) as follows:

1. common/ihevc_itrans_res.h & common/ihevc_itrans_res.c:
   - Add 'UWORD8 bit_depth' parameter to ihevc_itrans_res_* function
     signatures and typedefs.
   - Replace hardcoded 'shift = IT_SHIFT_STAGE_2;' with 'shift = 20 - bit_depth;'.
   - Remove obsolete ihevc_hbd_itrans_res_* prototypes and typedefs.

2. common/ihevc_hbd_itrans_res.c:
   - Delete file (~2,335 redundant lines removed).

3. Update tests/common/ihevc_itrans_res_test.cc to test bit depths 8 and 10
2026-09-10 11:21:07 -07:00
.github/workflows cmake.yml: Add runners to build arm and aarch63 builds 2026-02-22 20:55:28 -08:00
.vscode Rename test folder as examples 2026-04-13 12:02:22 +05:30
cmake Add initial tests for decoder and encoder 2026-07-27 13:15:45 -07:00
common libhevcdec: Unify itrans_res family and remove redundant HBD implementation 2026-09-10 11:21:07 -07:00
decoder libhevcdec: Unify itrans_res family and remove redundant HBD implementation 2026-09-10 11:21:07 -07:00
encoder Pass remaining bytes when reinitializing bitstream structure after tile or slice 2026-06-22 10:53:19 +05:30
examples Rename few local variables for consistency 2026-09-04 15:28:11 -07:00
fuzzer Do not allow change in bit-depth or chroma format once decoder is initialized 2026-09-04 13:39:54 -07:00
tests libhevcdec: Unify itrans_res family and remove redundant HBD implementation 2026-09-10 11:21:07 -07:00
Android.bp libhevcdec: Unify itrans_res family and remove redundant HBD implementation 2026-09-10 11:21:07 -07:00
CMakeLists.txt Add initial tests for decoder and encoder 2026-07-27 13:15:45 -07:00
FrameInfo.md Decoder: add support for QP and block_type map export in library 2022-08-04 11:40:43 +05:30
libhevc_blocklist.txt Remove assembly functions from CFI blocklist 2021-01-21 16:26:15 -08:00
LICENSE Add LICENSE to fix lint warning 2023-01-25 17:14:53 -08:00
METADATA Add METADATA to libhevc: Apache2=NOTICE 2020-04-28 08:53:23 -07:00
MODULE_LICENSE_APACHE2 Initial Version of HEVC decoder 2014-05-21 18:14:55 -07:00
NOTICE Initial Version of HEVC decoder 2014-05-21 18:14:55 -07:00
OWNERS OWNERS: Include avic_OWNERS 2023-08-11 15:54:49 -07:00
PREUPLOAD.cfg point to new repo hooks for mainline uploads 2020-05-26 15:17:47 -07:00
README.md libhevc: Enable support for MacOS 2024-10-01 06:37:42 -07:00

LIBHEVC

Getting Started Document

LibHEVC build steps

Supports:

  • aarch32/aarch64 on Linux.
  • aarch32/aarch64 on Android.
  • x86_32/x86_64 on Linux.
  • aarch64 on Mac.
  • x86_64 on Mac.

Native Builds

Use the following commands for building on the target machine

$ cd external/libhevc
$ mkdir build
$ cd build
$ cmake ..
$ make

Cross-compiler based builds

Building for x86_32 on a x86_64 Linux machine

$ cd external/libhevc
$ mkdir build
$ cd build
$ CFLAGS="-m32" CXXFLAGS="-m32" LDFLAGS="-m32" cmake ..
$ make

Building for aarch32/aarch64

Update 'CMAKE_C_COMPILER', 'CMAKE_CXX_COMPILER', 'CMAKE_C_COMPILER_AR', and 'CMAKE_CXX_COMPILER_AR' in CMAKE_TOOLCHAIN_FILE passed below

$ cd external/libhevc
$ mkdir build
$ cd build

For aarch64

$ cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/aarch64_toolchain.cmake
$ make

For aarch32

$ cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/aarch32_toolchain.cmake
$ make

Building for android

NOTE: This assumes that you are building on a machine that has Android NDK.

$ cd external/libhevc
$ mkdir build
$ cd build

Armv7 (32-bit)

cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/android_toolchain.cmake\
    -DHEVC_ANDROID_NDK_PATH=/opt/android-ndk-r26d/\
    -DANDROID_ABI=armeabi-v7a\
    -DANDROID_PLATFORM=android-23 ../
make

Armv8 (64-bit)

cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/android_toolchain.cmake\
    -DHEVC_ANDROID_NDK_PATH=/opt/android-ndk-r26d/\
    -DANDROID_ABI=arm64-v8a\
    -DANDROID_PLATFORM=android-23 ../
make