Decode
Function Usage
Image decoding API of the ImageProcessor class. The Image memory allocated by this API does not need to be managed or destroyed by users. Only the memory allocated on the host can be used as the input of this API. Currently, the data type of the input image memory can be JPEG or PNG. For details, see Image Decoding.
- JPG/JPEG format:
- Maximum resolution of the JPG/JPEG input image: 8192 x 8192. (The RGB_888 and BGR_888 formats support only 4096 x 4096.)
- Minimum resolution of the JPG/JPEG input image: 32 x 32
- Supported formats by the output decoded images and outputImage: YUV_SP_420 and YVU_SP_420. The Atlas inference product and Atlas 800I A2 inference product also support RGB_888 and BGR_888.
- Width of the output image.
- For the
Atlas 200/300/500 inference product , the output width is a multiple of 128. - For the
Atlas 200I/500 A2 inference product , the output width is a multiple of 128. Before alignment, the API performs 2-pixel alignment downwards. Assume that the width of the source image is 1023. After the image is decoded by calling the decoding API, the value obtained by calling GetSize() is 1024, and the value obtained by calling GetOriginalSize() is 1022. - For the Atlas inference product and Atlas 800I A2 inference product, the output width is a multiple of 64. In format RGB_888 or BGR_888, the width is 16-pixel aligned, performed by the decoding API automatically.
- For the
- Output image height: a multiple of 16. The decoding API automatically aligns the height.For the
Atlas 200I/500 A2 inference product , the API performs 2-pixel alignment downwards before the alignment operation. Assume that the height of the source image is 683. After the call of the Decode API, the height get by calling GetSize() is 688, and the height get by calling GetOriginalSize() is 682.
Restrictions on the JPG and JPEG input image format:- Only Huffman coding is supported. The subsample of the stream is 444, 422, 420, 400, or 440.
- Arithmetic coding is not supported.
- The progressive JPEG format is not supported.
- The JPEG 2000 format is not supported.
- PNG format:
- Maximum resolution of the PNG input image: 4096 x 4096.
- Minimum resolution of the PNG input image: 32 x 32.
- Output image width: a multiple of 128. The decoding API automatically aligns the width.
- Output image height: a multiple of 16. The decoding API automatically aligns the height.
Prototype
1 | APP_ERROR ImageProcessor::Decode(const std::shared_ptr<uint8_t> dataPtr, const uint32_t dataSize, Image& outputImage, const ImageFormat decodeFormat = ImageFormat::YUV_SP_420); |
1 | APP_ERROR ImageProcessor::Decode(const std::string inputPath, Image& outputImage, const ImageFormat decodeFormat = ImageFormat::YUV_SP_420); |
Parameters
Response Parameters
Data Structure |
Description |
|---|---|
APP_ERROR |
For details about the returned error codes, see APP_ERROR Description. |
Parent topic: ImageProcessor