CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
64 lines
2.2 KiB
ReStructuredText
64 lines
2.2 KiB
ReStructuredText
.. meta::
|
|
:description: retrieving image information with rocJPEG
|
|
:keywords: rocJPEG, ROCm, API, documentation, image information, jpeg
|
|
|
|
|
|
********************************************************************
|
|
Retrieving image information with rocJPEG
|
|
********************************************************************
|
|
|
|
Retrieving image information is done using ``rocJpegGetImageInfo()``.
|
|
|
|
.. code:: cpp
|
|
|
|
RocJpegStatus rocJpegGetImageInfo(
|
|
RocJpegHandle handle,
|
|
RocJpegStreamHandle jpeg_stream_handle,
|
|
uint8_t *num_components,
|
|
RocJpegChromaSubsampling *subsampling,
|
|
uint32_t *widths,
|
|
uint32_t *heights);
|
|
|
|
``rocJpegGetImageInfo()`` takes the ``RocJpegHandle`` and a ``RocJpegStreamHandle`` as inputs, and returns the subsampling, number of components, and widths and heights of the components. These are passed to the ``subsampling``, ``num_components``, and ``widths`` and ``heights`` output parameters.
|
|
|
|
The ``subsampling`` output parameter is a ``RocJpegChromaSubsampling`` enum.
|
|
|
|
.. code:: cpp
|
|
|
|
typedef enum {
|
|
ROCJPEG_CSS_444 = 0,
|
|
ROCJPEG_CSS_440 = 1,
|
|
ROCJPEG_CSS_422 = 2,
|
|
ROCJPEG_CSS_420 = 3,
|
|
ROCJPEG_CSS_411 = 4,
|
|
ROCJPEG_CSS_400 = 5,
|
|
ROCJPEG_CSS_UNKNOWN = -1
|
|
} RocJpegChromaSubsampling;
|
|
|
|
Its value is set to the chroma subsampling retrieved from the image.
|
|
|
|
For example:
|
|
|
|
.. code:: cpp
|
|
|
|
// Get the image info
|
|
uint8_t num_components;
|
|
RocJpegChromaSubsampling subsampling;
|
|
uint32_t widths[ROCJPEG_MAX_COMPONENT] = {};
|
|
uint32_t heights[ROCJPEG_MAX_COMPONENT] = {};
|
|
|
|
status = rocJpegGetImageInfo(handle, rocjpeg_stream_handle, &num_components, &subsampling, widths, heights);
|
|
if (status != ROCJPEG_STATUS_SUCCESS) {
|
|
std::cerr << "Failed to get image info with error code: " << rocJpegGetErrorName(status) << std::endl;
|
|
rocJpegStreamDestroy(rocjpeg_stream_handle);
|
|
rocJpegDestroy(handle);
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
|
|
``rocJpegGetImageInfo()`` is thread safe.
|
|
|
|
.. note::
|
|
|
|
The VCN hardware-accelerated JPEG decoder in AMD GPUs only supports decoding JPEG images with ``ROCJPEG_CSS_444``, ``ROCJPEG_CSS_440``, ``ROCJPEG_CSS_422``, ``ROCJPEG_CSS_420``, and ``ROCJPEG_CSS_400`` chroma subsampling.
|