1 /*---------------------------------------------------------------------------*
2 Project: TwlSDK - SSP - include
3 File: jpegdec.h
4
5 Copyright 2007-2008 Nintendo. All rights reserved.
6
7 These coded instructions, statements, and computer programs contain
8 proprietary information of Nintendo of America Inc. and/or Nintendo
9 Company Ltd., and are protected by Federal copyright law. They may
10 not be disclosed to third parties or copied or duplicated in any form,
11 in whole or in part, without the prior written consent of Nintendo.
12
13 $Date:: 2009-01-09#$
14 $Rev: 9810 $
15 $Author: kitase_hirotake $
16 *---------------------------------------------------------------------------*/
17
18 #ifndef TWL_SSP_JPEGDEC_H_
19 #define TWL_SSP_JPEGDEC_H_
20
21 #include <twl/ssp/common/ssp_jpeg_type.h>
22 #include <twl/ssp/ARM9/exifdec.h>
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 #include <twl/types.h>
29
30 /*---------------------------------------------------------------------------*
31 Name: SSP_CheckJpegDecoderSign
32
33 Description: Only checks a JPEG file's signature.
34
35 Arguments: data: JPEG file
36 size: JPEG file size
37
38 Returns: Returns TRUE on success.
39 *---------------------------------------------------------------------------*/
40 BOOL SSP_CheckJpegDecoderSign(u8* data, u32 size);
41
42 /*---------------------------------------------------------------------------*
43 Name: SSP_StartJpegDecoder
44
45 Description: Decodes a JPEG file.
46
47 Arguments: data: JPEG file
48 size: JPEG file size
49 dst: Destination buffer for decoding (now only RGB555)
50 width: Gives the maximum image width as an argument.
51 When the image is decoded successfully, its width will be returned.
52 height: Gives the maximum image height as an argument.
53 When the image is decoded successfully, its height will be returned.
54 option: Options (bitwise logical OR)
55 SSP_JPEG_RGB555: Decode in the RGB555 format.
56 Currently, even if this is not specified, data will be decoded in the RGB555 format.
57 SSP_JPEG_THUMBNAIL: Decode thumbnails. When this is unspecified, the main image will be decoded.
58 SSP_JPEG_EXIF: Get only EXIF information
59
60 Returns: Returns TRUE on success.
61 *---------------------------------------------------------------------------*/
62 BOOL SSP_StartJpegDecoder(u8* data, u32 size, void* dst, s16* width, s16* height, u32 option);
63
64 /*---------------------------------------------------------------------------*
65 Name: SSP_StartJpegDecoderEx
66
67 Description: Specifies whether to use a signature and decode a JPEG file.
68
69 Arguments: data: JPEG file
70 size: JPEG file size
71 dst: Destination buffer for decoding (now only RGB555)
72 width: Gives the maximum image width as an argument.
73 When the image is decoded successfully, its width will be returned.
74 height: Gives the maximum image height as an argument.
75 When the image is decoded successfully, its height will be returned.
76 option: Options (bitwise logical OR)
77 SSP_JPEG_RGB555: Decode in the RGB555 format.
78 Currently, even if this is not specified, data will be decoded in the RGB555 format.
79 SSP_JPEG_THUMBNAIL: Decode thumbnails. When this is unspecified, the main image will be decoded.
80 SSP_JPEG_EXIF: Get only EXIF information
81 sign: Specify TRUE to check the signature.
82
83 Returns: Returns TRUE on success.
84 *---------------------------------------------------------------------------*/
SSP_StartJpegDecoderEx(u8 * data,u32 size,void * dst,s16 * width,s16 * height,u32 option,BOOL sign)85 static inline BOOL SSP_StartJpegDecoderEx(u8* data, u32 size, void* dst, s16* width, s16* height, u32 option, BOOL sign)
86 {
87 BOOL result;
88
89 (void)SSP_SetJpegDecoderSignMode(sign);
90 result = SSP_StartJpegDecoder(data, size, dst, width, height, option);
91 (void)SSP_SetJpegDecoderSignMode(FALSE);
92
93 return result;
94 }
95
96 /*---------------------------------------------------------------------------*
97 Name: SSP_ExtractJpegDecoderExif
98
99 Description: Extracts only EXIF information from a JPEG file.
100 Use the various get functions to get the actual extracted values.
101
102 Arguments: data: JPEG file
103 size: JPEG file size
104
105 Returns: Returns TRUE on success.
106 *---------------------------------------------------------------------------*/
SSP_ExtractJpegDecoderExif(u8 * data,u32 size)107 static inline BOOL SSP_ExtractJpegDecoderExif(u8* data, u32 size)
108 {
109 return SSP_StartJpegDecoder(data, size, 0, 0, 0, SSP_JPEG_EXIF);
110 }
111
112 #ifdef __cplusplus
113 } /* extern "C" */
114 #endif
115
116 /* TWL_SSP_JPEGDEC_H_ */
117 #endif
118