/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-rocjpeg/checkouts/latest/api/rocjpeg.h Source File

/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-rocjpeg/checkouts/latest/api/rocjpeg.h Source File#

rocJPEG: /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-rocjpeg/checkouts/latest/api/rocjpeg.h Source File
rocjpeg.h
Go to the documentation of this file.
1 /* Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved.
2 
3 Permission is hereby granted, free of charge, to any person obtaining a copy
4 of this software and associated documentation files (the "Software"), to deal
5 in the Software without restriction, including without limitation the rights
6 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 copies of the Software, and to permit persons to whom the Software is
8 furnished to do so, subject to the following conditions:
9 
10 The above copyright notice and this permission notice shall be included in
11 all copies or substantial portions of the Software.
12 
13 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 THE SOFTWARE.
20 */
21 
22 #ifndef ROC_JPEG_H
23 #define ROC_JPEG_H
24 
25 #define ROCJPEGAPI
26 
27 #pragma once
28 #include "hip/hip_runtime.h"
29 #include "rocjpeg_version.h"
30 
38 #if defined(__cplusplus)
39 extern "C" {
40 #endif // __cplusplus
46 #define ROCJPEG_MAX_COMPONENT 4
47 
53 typedef enum {
68 
86 typedef enum {
87  ROCJPEG_CSS_444 = 0,
88  ROCJPEG_CSS_440 = 1,
89  ROCJPEG_CSS_422 = 2,
90  ROCJPEG_CSS_420 = 3,
91  ROCJPEG_CSS_411 = 4,
92  ROCJPEG_CSS_400 = 5,
93  ROCJPEG_CSS_UNKNOWN = -1
95 
104 typedef struct {
105  uint8_t* channel[ROCJPEG_MAX_COMPONENT];
106  uint32_t pitch[ROCJPEG_MAX_COMPONENT];
107 } RocJpegImage;
108 
124 typedef enum {
135  ROCJPEG_OUTPUT_Y = 2,
137  ROCJPEG_OUTPUT_RGB = 3,
139  ROCJPEG_OUTPUT_RGB_PLANAR = 4,
142 
153 typedef struct {
155  struct {
156  int16_t left;
157  int16_t top;
158  int16_t right;
159  int16_t bottom;
160  } crop_rectangle;
161  struct {
162  uint32_t width;
163  uint32_t height;
164  } target_dimension;
167 
176 typedef enum {
180 
187 typedef void* RocJpegStreamHandle;
188 
204 RocJpegStatus ROCJPEGAPI rocJpegStreamCreate(RocJpegStreamHandle *jpeg_stream_handle);
205 
219 RocJpegStatus ROCJPEGAPI rocJpegStreamParse(const unsigned char *data, size_t length, RocJpegStreamHandle jpeg_stream_handle);
220 
235 
242 typedef void *RocJpegHandle;
243 
258 RocJpegStatus ROCJPEGAPI rocJpegCreate(RocJpegBackend backend, int device_id, RocJpegHandle *handle);
259 
274 
296 RocJpegStatus ROCJPEGAPI rocJpegGetImageInfo(RocJpegHandle handle, RocJpegStreamHandle jpeg_stream_handle, uint8_t *num_components, RocJpegChromaSubsampling *subsampling, uint32_t *widths, uint32_t *heights);
297 
314 RocJpegStatus ROCJPEGAPI rocJpegDecode(RocJpegHandle handle, RocJpegStreamHandle jpeg_stream_handle, const RocJpegDecodeParams *decode_params, RocJpegImage *destination);
315 
316 
331 RocJpegStatus ROCJPEGAPI rocJpegDecodeBatched(RocJpegHandle handle, RocJpegStreamHandle *jpeg_stream_handles, int batch_size, const RocJpegDecodeParams *decode_params, RocJpegImage *destinations);
332 
343 extern const char* ROCJPEGAPI rocJpegGetErrorName(RocJpegStatus rocjpeg_status);
344 
345 #if defined(__cplusplus)
346  }
347 #endif
348 
349 #endif // ROC_JPEG_H
RocJpegStatus ROCJPEGAPI rocJpegDecodeBatched(RocJpegHandle handle, RocJpegStreamHandle *jpeg_stream_handles, int batch_size, const RocJpegDecodeParams *decode_params, RocJpegImage *destinations)
Decodes a batch of JPEG images using the rocJPEG library.
RocJpegStatus ROCJPEGAPI rocJpegCreate(RocJpegBackend backend, int device_id, RocJpegHandle *handle)
Creates a RocJpegHandle for JPEG decoding.
void * RocJpegHandle
A handle representing a RocJpeg instance.
Definition: rocjpeg.h:242
RocJpegStatus ROCJPEGAPI rocJpegStreamParse(const unsigned char *data, size_t length, RocJpegStreamHandle jpeg_stream_handle)
Parses a JPEG stream.
RocJpegStatus ROCJPEGAPI rocJpegStreamCreate(RocJpegStreamHandle *jpeg_stream_handle)
Creates a RocJpegStreamHandle for JPEG stream processing.
RocJpegOutputFormat
Enum representing the output format options for the RocJpegImage.
Definition: rocjpeg.h:124
@ ROCJPEG_OUTPUT_Y
Definition: rocjpeg.h:135
@ ROCJPEG_OUTPUT_FORMAT_MAX
Definition: rocjpeg.h:140
@ ROCJPEG_OUTPUT_NATIVE
Definition: rocjpeg.h:130
@ ROCJPEG_OUTPUT_YUV_PLANAR
Definition: rocjpeg.h:133
@ ROCJPEG_OUTPUT_RGB
Definition: rocjpeg.h:137
RocJpegBackend
The backend options for the rocJpeg library.
Definition: rocjpeg.h:176
@ ROCJPEG_BACKEND_HYBRID
Definition: rocjpeg.h:178
@ ROCJPEG_BACKEND_HARDWARE
Definition: rocjpeg.h:177
RocJpegChromaSubsampling
Enum representing the chroma subsampling options for JPEG encoding/decoding.
Definition: rocjpeg.h:86
void * RocJpegStreamHandle
A handle representing a RocJpegStream instance.
Definition: rocjpeg.h:187
RocJpegStatus ROCJPEGAPI rocJpegDecode(RocJpegHandle handle, RocJpegStreamHandle jpeg_stream_handle, const RocJpegDecodeParams *decode_params, RocJpegImage *destination)
Decodes a JPEG image using the rocJPEG library.
RocJpegStatus ROCJPEGAPI rocJpegStreamDestroy(RocJpegStreamHandle jpeg_stream_handle)
Destroys a RocJpegStreamHandle object and releases associated resources.
RocJpegStatus
Enumeration representing the status codes for the rocJPEG library.
Definition: rocjpeg.h:53
@ ROCJPEG_STATUS_IMPLEMENTATION_NOT_SUPPORTED
Definition: rocjpeg.h:63
@ ROCJPEG_STATUS_HW_JPEG_DECODER_NOT_SUPPORTED
Definition: rocjpeg.h:64
@ ROCJPEG_STATUS_NOT_IMPLEMENTED
Definition: rocjpeg.h:66
@ ROCJPEG_STATUS_OUTOF_MEMORY
Definition: rocjpeg.h:59
@ ROCJPEG_STATUS_BAD_JPEG
Definition: rocjpeg.h:57
@ ROCJPEG_STATUS_SUCCESS
Definition: rocjpeg.h:54
@ ROCJPEG_STATUS_JPEG_NOT_SUPPORTED
Definition: rocjpeg.h:58
@ ROCJPEG_STATUS_ARCH_MISMATCH
Definition: rocjpeg.h:61
@ ROCJPEG_STATUS_INVALID_PARAMETER
Definition: rocjpeg.h:56
@ ROCJPEG_STATUS_EXECUTION_FAILED
Definition: rocjpeg.h:60
@ ROCJPEG_STATUS_RUNTIME_ERROR
Definition: rocjpeg.h:65
@ ROCJPEG_STATUS_NOT_INITIALIZED
Definition: rocjpeg.h:55
@ ROCJPEG_STATUS_INTERNAL_ERROR
Definition: rocjpeg.h:62
const char *ROCJPEGAPI rocJpegGetErrorName(RocJpegStatus rocjpeg_status)
Retrieves the name of the error associated with the given RocJpegStatus.
RocJpegStatus ROCJPEGAPI rocJpegDestroy(RocJpegHandle handle)
Destroys a RocJpegHandle object.
RocJpegStatus ROCJPEGAPI rocJpegGetImageInfo(RocJpegHandle handle, RocJpegStreamHandle jpeg_stream_handle, uint8_t *num_components, RocJpegChromaSubsampling *subsampling, uint32_t *widths, uint32_t *heights)
Retrieves information about the JPEG image.
Structure containing parameters for JPEG decoding.
Definition: rocjpeg.h:153
int16_t left
Definition: rocjpeg.h:156
RocJpegOutputFormat output_format
Definition: rocjpeg.h:154
uint32_t width
Definition: rocjpeg.h:162
int16_t top
Definition: rocjpeg.h:157
int16_t bottom
Definition: rocjpeg.h:159
uint32_t height
Definition: rocjpeg.h:163
int16_t right
Definition: rocjpeg.h:158
Structure representing a JPEG image.
Definition: rocjpeg.h:104