nn::jpeg::CTR::JpegMpDecoder::GetDstBufferSize Member Function

Syntax

#include <nn/jpeg.h>

static size_t GetDstBufferSize(
     u32 maxWidth,
     u32 maxHeight,
     PixelFormat dstPixelFormat
);

Arguments

Name Description
in maxWidth Specifies the maximum width (in pixels) of an image that can be decoded (equal to or less than 65536). Specify the maximum decoded width (after shrinking) when shrinking and decoding by using the StartJpegDecoderShrink function. If you specify the width of the output image buffer with the SetOutputBufferWidth function, specify a larger value in this function. You can also specify an even larger value.
in maxHeight Specifies the maximum height (in pixels) of an image that can be decoded (equal to or less than 65536). Specify the maximum decoded height (after shrinking) when shrinking and decoding. You can also specify an even larger value.
in dstPixelFormat Specifies the pixel format in which to store the image.
When specifying PIXEL_FORMAT_CTR_RGB565_BLOCK8, PIXEL_FORMAT_CTR_RGB8_BLOCK8, or PIXEL_FORMAT_CTR_RGBA8_BLOCK8, round up the values for maxWidth and maxHeight to the nearest multiple of 8 when calculating the buffer size in bytes. For PIXEL_FORMAT_YUYV8, round up maxWidth to the nearest multiple of 2 when calculating the buffer size.

Return Values

Returns the size (in bytes) of the buffer where the decoded results will be stored.
Returns 0 to indicate an error if the arguments are invalid or if the number of bytes exceeds the range defined by the size_t type.

Description

Calculates the number of bytes in the buffer where the decoded JPEG results (one image's worth) will be stored.

The application must handle the allocation and deallocation of the buffer.

Depending on the pixel format in which to store the data (dstPixelFormat), the buffer image size is sometimes rounded up to a value larger than the maximum allowed decodable image size (maxWidth and maxHeight).

Revision History

2010/04/14
Initial version.

CONFIDENTIAL