Pavel Tcherniaev b68b9ba8ea Roi decode feature (#48)
* implemented ROI for NATIVE, YUV_PLANAR, Y, RGB and RGB_PLANAR

* added the changes requested by Aryan in the PR

* prelim check in of ROI

* finished RGB and RGB_PLANAR ROI implementation and testing in rocjpeg_decoder.cpp, updated the versions to 0.6.0, updated jpegdecode.cpp and jpegdecodedbatched.cpp. Still need to modify jpegmultithreads.cpp. Need to run tests on JPEG 444 and 440. And need to add test to ctests and make test. Will update this PR when I've added everything mentioned here.

* changed new_offset and new_uv_offset to roi_offset and roi_uv_offset in rocjpeg_decoder.cpp. Added ROI handling in jpegdecodemultithreads sample. Still need to run tests on jpegdecodemultithreads and jpegdecodebatched.

* addressed all changes Aryan mentioned for PR 48 on August 12

* added tests to ctests and make tests and fixed conflict in jpegdecodemultithreads.cpp

* addressed latest change requests

* removed spaces after case VA_FOURCC_444P

* updated ctests and make tests

* fixed copy/paste error for ctests

* fixed typo with extra $

* added print statement for cropped image dimensions

* addressed latest change requests from Aryan. Ran make tests and ctests, all passed

* added workaround for YUV440 to RGB conversion
2024-08-13 21:30:26 -04:00
2024-03-27 14:13:32 -06:00
2024-08-13 21:30:26 -04:00
2024-04-17 09:25:16 -04:00
2024-08-13 21:30:26 -04:00
2024-08-13 21:30:26 -04:00
2024-08-13 21:30:26 -04:00
2024-03-27 14:13:32 -06:00
2024-08-07 10:21:13 -04:00
2024-08-13 21:30:26 -04:00
2024-08-07 10:21:13 -04:00
2024-08-07 10:21:13 -04:00

MIT licensed

rocJPEG is a high performance JPEG decode SDK for AMD GPUs. Using the rocJPEG API, you can access the JPEG decoding features available on your GPU.

Supported JPEG chroma subsampling

  • YUV 4:4:4
  • YUV 4:4:0
  • YUV 4:2:2
  • YUV 4:2:0
  • YUV 4:0:0

Prerequisites

Important

gfx908 or higher GPU required

  • Install ROCm 6.3.0 or later with amdgpu-install: Required usecase - rocm

Important

sudo amdgpu-install --usecase=rocm

  • Video Acceleration API (VA-API) Version 1.5.0+ - Libva is an implementation for VA-API
    sudo apt install libva-dev
    

Note

RPM Packages for RHEL/SLES - libva-devel

  • AMD VA Drivers

    sudo apt install mesa-amdgpu-va-drivers
    
  • CMake 3.5 or later

    sudo apt install cmake
    
  • pkg-config

    sudo apt install pkg-config
    

Important

  • If using Ubuntu 22.04, you must install libstdc++-12-dev
sudo apt install libstdc++-12-dev
  • Additional RPM Packages required for RHEL/SLES - libdrm-amdgpu mesa-amdgpu-dri-drivers

Note

  • All package installs are shown with the apt package manager. Use the appropriate package manager for your operating system.
  • To install rocJPEG with minimum requirements, follow the quick-start instructions

Prerequisites setup script for Linux

For your convenience, we provide the setup script, rocJPEG-setup.py which installs all required dependencies. Run this script only once.

Usage:

  python rocJPEG-setup.py  --rocm_path [ ROCm Installation Path - optional (default:/opt/rocm)]

NOTE: This script only needs to be executed once.

Installation instructions

The installation process uses the following steps:

Package install

Install rocJPEG runtime, development, and test packages.

  • Runtime package - rocjpeg only provides the rocjpeg library librocjpeg.so
  • Development package - rocjpeg-dev/rocjpeg-devel provides the library, header files, and samples
  • Test package - rocjpeg-test provides CTest to verify installation

Ubuntu

sudo apt install rocjpeg rocjpeg-dev rocjpeg-test

RHEL

sudo yum install rocjpeg rocjpeg-devel rocjpeg-test

SLES

sudo zypper install rocjpeg rocjpeg-devel rocjpeg-test

Note

Package install auto installs all dependencies.

Source install

git clone https://github.com/ROCm/rocJPEG.git
cd rocJPEG
mkdir build && cd build
cmake ../
make -j8
sudo make install

Run tests

make test

NOTE: run tests with verbose option make test ARGS="-VV"

Make package

sudo make package

Verify installation

The installer will copy

  • Libraries into /opt/rocm/lib
  • Header files into /opt/rocm/include/rocjpeg
  • Samples folder into /opt/rocm/share/rocjpeg
  • Documents folder into /opt/rocm/share/doc/rocjpeg

Using sample application

To verify your installation using a sample application, run:

mkdir rocjpeg-sample && cd rocjpeg-sample
cmake /opt/rocm/share/rocjpeg/samples/jpegDecode/
make -j8
./jpegdecode -i /opt/rocm/share/rocjpeg/images/mug_420.jpg

Using test package

To verify your installation using the rocjpeg-test package, run:

mkdir rocjpeg-test && cd rocjpeg-test
cmake /opt/rocm/share/rocjpeg/test/
ctest -VV

Samples

The tool provides a few samples to decode JPEG images here. Please refer to the individual folders to build and run the samples. You can access samples to decode your images in our GitHub repository. Refer to the individual folders to build and run the samples.

Docker

You can find rocJPEG Docker containers in our GitHub repository.

Documentation

Run the following code to build our documentation locally.

cd docs
pip3 install -r sphinx/requirements.txt
python3 -m sphinx -T -E -b html -d _build/doctrees -D language=en . _build/html

For more information on documentation builds, refer to the Building documentation page.

Tested configurations

  • Linux
    • Ubuntu - 20.04 / 22.04
    • RHEL - 8 / 9
  • ROCm:
    • rocm-core - 6.3.0.60300-14317
    • amdgpu-core - 6.3.60300-1798298
  • libva-dev - 2.7.0-2 / 2.14.0-1
  • mesa-amdgpu-va-drivers - 24.2.0.60300-1798298
  • mesa-amdgpu-dri-drivers - 24.2.0.60300-1798298
  • rocJPEG Setup Script - V2.1.0
S
Описание
No description provided
Readme 282 MiB
Languages
C++ 67.5%
C 20.6%
Python 6.6%
CMake 3.4%
Shell 0.6%
Разное 1.1%