/*---------------------------------------------------------------------------* Project: JPEG Library for Wii U File: jpeg.h Copyright (C) Nintendo. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. *---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------* This file is a front-end implementation for 'IJG libjpeg' developed by the Independent JPEG Group (IJG). We are requested to state that: "this software is based in part on the work of the Independent JPEG Group". *---------------------------------------------------------------------------*/ #ifndef _CAFE_JPEG_H #define _CAFE_JPEG_H #ifdef __cplusplus extern "C" { #endif /*---------------------------------------------------------------------------* Structure and constants *---------------------------------------------------------------------------*/ typedef enum { JPEG_STATUS_OK = 0, JPEG_STATUS_ARGS = -1, JPEG_STATUS_UNSUPPORTED = -2, JPEG_STATUS_INVALID = -3, JPEG_STATUS_OUT_OF_MEMORY = -6, JPEG_STATUS_SHORT_OUTPUT = -7, JPEG_STATUS_HEAP_ERROR = -18, JPEG_STATUS_FATAL = -19 } JPEGStatus; typedef struct { s32 width; s32 height; s32 numCh; // Number of color channel of input } JPEGImageDim; /*---------------------------------------------------------------------------* Functions for encoding *---------------------------------------------------------------------------*/ JPEGStatus JPEGEncEncodeSurface ( void *pDestBuf, // Buffer for encoded JPEG. u32 destBufSize, // Its size in byte. u32 *pActualDestSize, // Byte-size of buffer filled with JPEG data. const u32 *pTexBuf, // Texture buffer to be encoded. const JPEGImageDim *pTexDim, // Its dimension. s32 quality, // Encoding quality (1..100). void *pWorkArea, // Temporal workspace. u32 workAreaSize // Its size in byte. ); JPEGStatus JPEGEncGetSurfaceInfo ( u32 *pDestHeapSize, // Heep size required to encode JPEG const JPEGImageDim *pImageDim // Dimension of source surface. ); /*---------------------------------------------------------------------------* Functions for decoding *---------------------------------------------------------------------------*/ JPEGStatus JPEGDecDecodeImage( u32 *pDestBuf, // Buffer for decoded surface. u32 destBufSize, // Its size in byte. const void *pJpegBuf, // JPEG buffer to be decoded. u32 jpegBufSize, // Its size in byte. s32 resolution, // JPEG scaling parameter (1, 2, 4, or 8). // Resulted surface will be scaled '1 / resolution'. void *pWorkArea, // Temporal workspace. u32 workAreaSize // Its size in byte. ); JPEGStatus JPEGDecGetImageInfo( JPEGImageDim *pDestDim, // Decoded JPEG dimension (width, height and channels) u32 *pDestHeapSize, // Heep size required to decode JPEG const void *pJpegBuf, // JPEG buffer to be decoded. u32 jpegBufSize, // Its size in bytes s32 resolution // JPEG scaling parameter (1, 2, 4, 8). ); /*---------------------------------------------------------- * !!! Please do not use following deprecated functions !!! *----------------------------------------------------------*/ JPEGStatus JPEGEncEncode( void *pWorkArea, u32 workAreaSize, u32 *pTexBuf, JPEGImageDim *pTexDim, s32 quality, void *pDestBuf, u32 destBufSize, u32 *pActualDestSize); JPEGStatus JPEGEncGetInfo ( JPEGImageDim *pImageDim, u32 *pDestHeapSize); JPEGStatus JPEGDecDecode( void *pWorkArea, u32 workAreaSize, void *const pJpegBuf, u32 jpegBufSize, s32 resolution, u32 *pDestBuf, u32 destBufSize); JPEGStatus JPEGDecGetInfo( void *const pJpegBuf, u32 jpegBufSize, s32 resolution, JPEGImageDim *pDestDim, u32 *pDestHeapSize); #ifdef __cplusplus } #endif #endif // _CAFE_JPEG_H