nn::jpeg::CTR::JpegMpDecoder::StartJpegDecoderShrink Member Function#include <nn/jpeg.h>
size_t StartJpegDecoderShrink(
void * dst,
size_t dstSize,
const u8 * src,
size_t srcSize,
u32 maxWidth,
u32 maxHeight,
PixelFormat dstPixelFormat,
bool decodeThumbnail,
u32 shrinkLevel
);
| Name | Description | |
|---|---|---|
| out | dst | Specifies the buffer that stores the decoded result. The alignment of this buffer must match the output pixel format specified by the dstPixelFormat argument. |
| in | dstSize | Specifies the size of dst in bytes. Specify the return value of GetDstBufferSize. The maxWidth and maxHeight arguments of GetDstBufferSize specify the maximum image dimensions of the decoded result (after shrinking).Use the maxWidth, maxHeight, dstPixelFormat, and shrinkLevel arguments to this function as shown in this example: GetDstBufferSize ( maxWidth >> shrinkLevel, maxHeight >> shrinkLevel, dstPixelFormat )However, when using the SetOutputBufferWidth function, specify the larger of that specified width and (maxWidth >> shrinkLevel). |
| in | src | Specifies the JPEG data to decode. |
| in | srcSize | Specifies the size of src in bytes. |
| in | maxWidth | Specifies the maximum width (in pixels) of an image that can be decoded (equal to or less than 65536). This value must be a multiple of the bitwise result of (1 << shrinkLevel). After decoding successfully completes, use the GetLastWidth function to get the original image width and the GetLastOutputBufferWidth function to get the decoded result width. |
| in | maxHeight | Specifies the maximum height (in pixels) of an image that can be decoded (equal to or less than 65536). This value must be a multiple of the bitwise result of (1 << shrinkLevel). After decoding successfully completes, use the GetLastHeight function to get the original image height and the GetLastOutputBufferHeight function to get the decoded result height. |
| in | dstPixelFormat | Specifies the output pixel format. |
| in | decodeThumbnail | Specify true to decode the thumbnail.Specify false to decode the primary image. |
| in | shrinkLevel | Specifies the shrink level. You can specify values of 1 to 4.Specify 1 to shrink both the height and width of the image to 1/2 the dimension of the original image.Specify 2 to shrink both dimensions to 1/4, specify 3 for 1/8, and specify 4 for 1/16. |
0 on failure.GetLastError function to get the reason for failure. Decodes a JPEG image and outputs it after shrinking.
The height and width of the output image are 1/2, 1/4, 1/8, or 1/16 of the original dimensions depending on the value of the shrinkLevel argument (values are rounded up).
The alignment specified by the dst argument is the same as for StartJpegDecoder.
The values of maxWidth and maxHeight specify the largest decodable image size. They must be a multiple of the bitwise result of (1 << shrinkLevel).
In specific, the following conditions must be met.
The actual image size does not need to be a multiple of the bitwise result of (1 << shrinkLevel). If JPEG_DECODER_OPTION_MATCH_WIDTH_HEIGHT is specified using SetOption, the values of arguments maxWidth and maxHeight must match, otherwise decoding will fail.
After this function completes successfully, call the GetLastWidth and GetLastHeight functions to get the original image dimensions (before shrinking). Call the GetLastOutputBufferWidth and GetLastOutputBufferHeight functions to get the dimensions of the decoded result (output to a buffer after shrinking).
Processing time is not related to whether the original image size is a multiple of 8 or 16 pixels. Larger original and decoded image sizes take longer to process.
SetOption.CONFIDENTIAL