Aryan Salmanpour 6ad4a76177 Initial commit of the rocJPEG library (#1)
* rocJPEG initial commit

* Add gitignore file

* clean up

* code clean up

* CMakeLists update

* Update README

* Update readme and setup script

* add docs folder

* update rocjepg headers

* update the rocjepg header

* update the copyright year

* Add nullptr check for all APIs

* update the hip kernels execution

* follow google c++ style guide

* code clean up

* use google c++ style guide for hip kernels

* add support for rocJpegGetErrorName API

* Add ParseCommandLine function

* update the rocjpeg sample

* Update the readme, LIBVA instructions

* udate the rocJPEG script

* Update CMAKE and libdrm

* Add support for ROCJPEG_OUTPUT_UNCHANGED and SaveImage function

* code  clean up

* update the drm dependencies

* remove the unused hipstream

* code clean up

* add -fmt option for selection the output format

* update the GetImageInfo API

* update the sample

* update the save image function based onn the surface and putput format

* add new sample images

* Put hip interop mem into separate functions and some code clean up

* Add support for CopyLuma and CopyChroma

* Add support for the yuv output format for NV12 surface

* Update HIP kernels

* add support for rgbi format conversion for NV12 and YUv444

* Update the status

* Add support for converting YUYV to RGB

* Add support for unpacking YUYV format

* Fix unpacking Y fron YUYV hip kernel

* Add suppoort for extractign packed YUYV to YUV planar

* hip code clean up

* code clean up

* Update the headers

* code clean up

* change hip kernel names

* hip kernel clean up

* hip clean up

* code clean up

* code clean up

* code clean up

* code clean up

* code clean up

* code clean up for jpege decoder class

* code clean up

* code clean up

* code clean up

* code clean up

* update the dockers

* code clean up

* code clean up

* hip kernels clean up

* remove unused hip kernels

* add additional test cases

* update the APIs

* add new hip yuv400torgbi kernel

* update yuv400torgbi kernel

* restructure files

* code clean up

* code clean up

* add jenkins

* code clean up

* code clean up

* update readme

* update docker's README

* make changes based on the reviewers comments

* make changes based on the reviewers comments

* return ROCJPEG_STATUS_JPEG_NOT_SUPPORTED if the resolution of the jpeg is not supported for HW decoding
2024-03-25 17:05:31 -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:2:2
  • YUV 4:2:0
  • YUV 4:0:0

Prerequisites

Important

gfx908 or higher GPU required

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

Important

sudo amdgpu-install --usecase=rocm

  • AMD Multimedia packages
    sudo apt install libva-amdgpu-dev libdrm-amdgpu1 mesa-amdgpu-va-drivers
    

Note

RPM Packages for RHEL/SLES - libva-amdgpu-devel libdrm-amdgpu mesa-amdgpu-dri-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

Note

  • All package installs are shown with the apt package manager. Use the appropriate package manager for your operating system.
  • To install rocDecode 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)]
                             --developer [ Setup Developer Options - optional (default:ON) [options:ON/OFF]]

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
./videodecode -i /opt/rocm/share/rocjpeg/image/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 rocDecode 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
    • SLES - 15-SP5
  • ROCm:
    • rocm-core - 6.1.0.60100-62
    • amdgpu-core - 1:6.1.60100-1741643
  • rocJPEG Setup Script - V1.0
S
Description
No description provided
Readme 282 MiB
Languages
C++ 67.5%
C 20.6%
Python 6.6%
CMake 3.4%
Shell 0.6%
Other 1.1%