1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - SSP - include
3   File:     bmp_conv.h
4 
5   Copyright 2009 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_BMP_H_
19 #define TWL_SSP_BMP_H_
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 #include <twl/types.h>
26 
27 typedef enum
28 {
29     SSP_BMP_YUV422 = 1,
30     SSP_BMP_RGB555
31 }
32 SSPConvertBmpType;
33 
34 /*---------------------------------------------------------------------------*
35   Name:         SSP_YUV422ToRGB888b
36 
37   Description:  Converts data from the YUV422 format to the RGB888 (bottom-up) format.
38 
39   Arguments:    src: Input (YUV422) data
40                 dst: Output (RGB888) data
41                 width: Image width
42                 height: Image height
43 
44   Returns:      Returns the size.
45  *---------------------------------------------------------------------------*/
46 u32 SSP_YUV422ToRGB888b( const void* src, void* dst, u16 width, u16 height );
47 
48 /*---------------------------------------------------------------------------*
49   Name:         SSP_RGB555ToRGB888b
50 
51   Description:  Converts data from the RGB555 format to the RGB888 (bottom-up) format.
52 
53   Arguments:    src: Input (YUV422) data
54                 dst: Output (RGB888) data
55                 width: Image width
56                 height: Image height
57 
58   Returns:      Returns the size.
59  *---------------------------------------------------------------------------*/
60 u32 SSP_RGB555ToRGB888b( const void* src, void* dst, u16 width, u16 height );
61 
62 /*---------------------------------------------------------------------------*
63   Name:         SSP_GetRGB888Size
64 
65   Description:  Gets the size of data in the RGB88 format.
66 
67   Arguments:    width: Image width
68                 height: Image height
69 
70   Returns:      Returns the size.
71  *---------------------------------------------------------------------------*/
72 u32 SSP_GetRGB888Size( u16 width, u16 height );
73 
74 /*---------------------------------------------------------------------------*
75   Name:         SSP_CreateBmpHeader
76 
77   Description:  Creates a BMP file header.
78 
79   Arguments:    dst: Output data
80                 width: Image width
81                 height: Image height
82 
83   Returns:      None.
84  *---------------------------------------------------------------------------*/
85 void SSP_CreateBmpHeader( u8 *dst, u16 width, u16 height );
86 
87 /*---------------------------------------------------------------------------*
88   Name:         SSP_GetBmpHeaderSize
89 
90   Description:  Gets the header size for a BMP file.
91 
92   Arguments:    None.
93 
94   Returns:      Returns the size.
95  *---------------------------------------------------------------------------*/
96 u32 SSP_GetBmpHeaderSize();
97 
98 /*---------------------------------------------------------------------------*
99   Name:         SSP_GetBmpFileSize
100 
101   Description:  Gets the size of a BMP file.
102 
103   Arguments:    width: Image width
104                 height: Image height
105 
106   Returns:      Returns the size.
107  *---------------------------------------------------------------------------*/
108 u32 SSP_GetBmpFileSize(u16 width, u16 height);
109 
110 /*---------------------------------------------------------------------------*
111   Name:         SSP_CreateBmpFile
112 
113   Description:  Creates a BMP file.
114 
115   Arguments:    src: Input (YUV422 or RGB555) data
116                 dst: Buffer to store the BMP file
117                 width: Image width
118                 height: Image height
119                 type: Input data type
120 
121   Returns:      Returns the size of the created BMP file.
122  *---------------------------------------------------------------------------*/
123 u32 SSP_CreateBmpFile(const void* src, void* dst, u16 width, u16 height, SSPConvertBmpType type);
124 
125 #ifdef __cplusplus
126 } /* extern "C" */
127 #endif
128 
129 /* TWL_SSP_BMP_H_ */
130 #endif
131