xref: /utopia/UTPA2-700.0.x/projects/tmplib/include/apiJPEG_v2.h (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
1 //<MStar Software>
2 //******************************************************************************
3 // MStar Software
4 // Copyright (c) 2010 - 2012 MStar Semiconductor, Inc. All rights reserved.
5 // All software, firmware and related documentation herein ("MStar Software") are
6 // intellectual property of MStar Semiconductor, Inc. ("MStar") and protected by
7 // law, including, but not limited to, copyright law and international treaties.
8 // Any use, modification, reproduction, retransmission, or republication of all
9 // or part of MStar Software is expressly prohibited, unless prior written
10 // permission has been granted by MStar.
11 //
12 // By accessing, browsing and/or using MStar Software, you acknowledge that you
13 // have read, understood, and agree, to be bound by below terms ("Terms") and to
14 // comply with all applicable laws and regulations:
15 //
16 // 1. MStar shall retain any and all right, ownership and interest to MStar
17 //    Software and any modification/derivatives thereof.
18 //    No right, ownership, or interest to MStar Software and any
19 //    modification/derivatives thereof is transferred to you under Terms.
20 //
21 // 2. You understand that MStar Software might include, incorporate or be
22 //    supplied together with third party`s software and the use of MStar
23 //    Software may require additional licenses from third parties.
24 //    Therefore, you hereby agree it is your sole responsibility to separately
25 //    obtain any and all third party right and license necessary for your use of
26 //    such third party`s software.
27 //
28 // 3. MStar Software and any modification/derivatives thereof shall be deemed as
29 //    MStar`s confidential information and you agree to keep MStar`s
30 //    confidential information in strictest confidence and not disclose to any
31 //    third party.
32 //
33 // 4. MStar Software is provided on an "AS IS" basis without warranties of any
34 //    kind. Any warranties are hereby expressly disclaimed by MStar, including
35 //    without limitation, any warranties of merchantability, non-infringement of
36 //    intellectual property rights, fitness for a particular purpose, error free
37 //    and in conformity with any international standard.  You agree to waive any
38 //    claim against MStar for any loss, damage, cost or expense that you may
39 //    incur related to your use of MStar Software.
40 //    In no event shall MStar be liable for any direct, indirect, incidental or
41 //    consequential damages, including without limitation, lost of profit or
42 //    revenues, lost or damage of data, and unauthorized system use.
43 //    You agree that this Section 4 shall still apply without being affected
44 //    even if MStar Software has been modified by MStar in accordance with your
45 //    request or instruction for your use, except otherwise agreed by both
46 //    parties in writing.
47 //
48 // 5. If requested, MStar may from time to time provide technical supports or
49 //    services in relation with MStar Software to you for your use of
50 //    MStar Software in conjunction with your or your customer`s product
51 //    ("Services").
52 //    You understand and agree that, except otherwise agreed by both parties in
53 //    writing, Services are provided on an "AS IS" basis and the warranty
54 //    disclaimer set forth in Section 4 above shall apply.
55 //
56 // 6. Nothing contained herein shall be construed as by implication, estoppels
57 //    or otherwise:
58 //    (a) conferring any license or right to use MStar name, trademark, service
59 //        mark, symbol or any other identification;
60 //    (b) obligating MStar or any of its affiliates to furnish any person,
61 //        including without limitation, you and your customers, any assistance
62 //        of any kind whatsoever, or any information; or
63 //    (c) conferring any license or right under any intellectual property right.
64 //
65 // 7. These terms shall be governed by and construed in accordance with the laws
66 //    of Taiwan, R.O.C., excluding its conflict of law rules.
67 //    Any and all dispute arising out hereof or related hereto shall be finally
68 //    settled by arbitration referred to the Chinese Arbitration Association,
69 //    Taipei in accordance with the ROC Arbitration Law and the Arbitration
70 //    Rules of the Association by three (3) arbitrators appointed in accordance
71 //    with the said Rules.
72 //    The place of arbitration shall be in Taipei, Taiwan and the language shall
73 //    be English.
74 //    The arbitration award shall be final and binding to both parties.
75 //
76 //******************************************************************************
77 //<MStar Software>
78 ////////////////////////////////////////////////////////////////////////////////
79 //
80 // Copyright (c) 2006-2007 MStar Semiconductor, Inc.
81 // All rights reserved.
82 //
83 // Unless otherwise stipulated in writing, any and all information contained
84 // herein regardless in any format shall remain the sole proprietary of
85 // MStar Semiconductor Inc. and be kept in strict confidence
86 // (��MStar Confidential Information��) by the recipient.
87 // Any unauthorized act including without limitation unauthorized disclosure,
88 // copying, use, reproduction, sale, distribution, modification, disassembling,
89 // reverse engineering and compiling of the contents of MStar Confidential
90 // Information is unlawful and strictly prohibited. MStar hereby reserves the
91 // rights to any and all damages, losses, costs and expenses resulting therefrom.
92 //
93 ////////////////////////////////////////////////////////////////////////////////
94 
95 //////////////////////////////////////////////////////////////////////////////////////////////////
96 ///
97 /// @file   apiJPEG_v2.h
98 /// @brief  JPEG Driver Interface
99 /// @author MStar Semiconductor Inc.
100 ///////////////////////////////////////////////////////////////////////////////////////////////////
101 
102 #ifndef _API_JPEG_V2_H_
103 #define _API_JPEG_V2_H_
104 
105 #ifdef __cplusplus
106 extern "C"
107 {
108 #endif
109 
110 #include "MsTypes.h"
111 //-------------------------------------------------------------------------------------------------
112 // Defines
113 //-------------------------------------------------------------------------------------------------
114 // below for utopia20 structure
115 
116 typedef enum {
117     MApi_CMD_JPEG_EnableOJPD,
118     MApi_CMD_JPEG_Init_UsingOJPD,
119     MApi_CMD_JPEG_get_APP0_info,
120     MApi_CMD_JPEG_Init,
121     MApi_CMD_JPEG_DecodeHdr,
122     MApi_CMD_JPEG_Decode,
123     MApi_CMD_JPEG_Exit,
124     MApi_CMD_JPEG_GetErrorCode,
125     MApi_CMD_JPEG_GetJPDEventFlag,
126     MApi_CMD_JPEG_SetJPDEventFlag,
127     MApi_CMD_JPEG_Rst,
128     MApi_CMD_JPEG_PowerOn,
129     MApi_CMD_JPEG_PowerOff,
130     MApi_CMD_JPEG_GetCurVidx,
131     MApi_CMD_JPEG_IsProgressive,
132     MApi_CMD_JPEG_ThumbnailFound,
133     MApi_CMD_JPEG_GetWidth,
134     MApi_CMD_JPEG_GetHeight,
135     MApi_CMD_JPEG_GetOriginalWidth,
136     MApi_CMD_JPEG_GetOriginalHeight,
137     MApi_CMD_JPEG_GetNonAlignmentWidth,
138     MApi_CMD_JPEG_GetNonAlignmentHeight,
139     MApi_CMD_JPEG_GetAlignedPitch,
140     MApi_CMD_JPEG_GetAlignedPitch_H,
141     MApi_CMD_JPEG_GetAlignedWidth,
142     MApi_CMD_JPEG_GetAlignedHeight,
143     MApi_CMD_JPEG_GetScaleDownFactor,
144     MApi_CMD_JPEG_SetMaxDecodeResolution,
145     MApi_CMD_JPEG_SetProMaxDecodeResolution,
146     MApi_CMD_JPEG_SetMRBufferValid,
147     MApi_CMD_JPEG_UpdateReadInfo,
148     MApi_CMD_JPEG_ProcessEOF,
149     MApi_CMD_JPEG_SetErrCode,
150     MApi_CMD_JPEG_SetDbgLevel,
151     MApi_CMD_JPEG_GetDbgLevel,
152     MApi_CMD_JPEG_GetInfo,
153     MApi_CMD_JPEG_GetStatus,
154     MApi_CMD_JPEG_GetLibVer,
155     MApi_CMD_JPEG_HdlVidxChk,
156     MApi_CMD_JPEG_GetBuffLoadType,
157     MApi_CMD_JPEG_EnableISR,
158     MApi_CMD_JPEG_DisableISR,
159     MApi_CMD_JPEG_WaitDone,
160     MApi_CMD_JPEG_GetEXIFDateTime,
161     MApi_CMD_JPEG_GetEXIFOrientation,
162     MApi_CMD_JPEG_GetEXIFManufacturer,
163     MApi_CMD_JPEG_GetEXIFModel,
164     MApi_CMD_JPEG_GetEXIFFlash,
165     MApi_CMD_JPEG_GetEXIFISOSpeedRatings,
166     MApi_CMD_JPEG_GetEXIFShutterSpeedValue,
167     MApi_CMD_JPEG_GetEXIFApertureValue,
168     MApi_CMD_JPEG_GetEXIFExposureBiasValue,
169     MApi_CMD_JPEG_GetEXIFFocalLength,
170     MApi_CMD_JPEG_GetEXIFImageWidth,
171     MApi_CMD_JPEG_GetEXIFImageHeight,
172     MApi_CMD_JPEG_GetEXIFExposureTime,
173     MApi_CMD_JPEG_GetEXIFFNumber,
174     MApi_CMD_JPEG_GetFreeMemory,
175     MApi_CMD_JPEG_GetDataOffset,
176     MApi_CMD_JPEG_GetSOFOffset,
177     MApi_CMD_JPEG_SetNJPDInstance,
178     MApi_CMD_JPEG_SupportCMYK,
179     MApi_CMD_JPEG_SupportRGB,
180     MApi_CMD_JPEG_SetMHEG5,
181     MApi_CMD_JPEG_IsMPOFormat,
182     MApi_CMD_JPEG_GetMPOIndex,
183     MApi_CMD_JPEG_GetMPOAttr,
184     MApi_CMD_JPEG_DumpMPO,
185     MApi_CMD_JPEG_SetMPOBuffer,
186     MApi_CMD_JPEG_SetMPOMaxDecodeResolution,
187     MApi_CMD_JPEG_SetMPOProMaxDecodeResolution,
188     MApi_CMD_JPEG_SetVerificationMode,
189     MApi_CMD_JPEG_GetVerificationMode,
190     MApi_CMD_JPEG_Debug,
191     MApi_CMD_JPEG_GetControl,
192     MApi_CMD_JPEG_GetCbEvent,
193     MApi_CMD_JPEG_SetCbEvent
194 } E_JPEG_V2_IOCTL_CMD;
195 
196 
197 // For MApi_JPEG_EnableOJPD(), MApi_JPEG_IsProgressive(), MApi_JPEG_ThumbnailFound(),
198 // For MApi_JPEG_SetMHEG5(), MApi_JPEG_IsMPOFormat()
199 typedef struct _JPEG_BOOL_PARAM
200 {
201     MS_BOOL bValue;
202 }JPEG_BOOL_PARAM, *PJPEG_BOOL_PARAM;
203 
204 typedef struct _JPEG_INIT_PARAM
205 {
206     JPEG_InitParam *pInitParam;
207     JPEG_Result retVal;
208 }JPEG_INIT_PARAM, *PJPEG_INIT_PARAM;
209 
210 typedef struct _JPEG_GETAPP0INFO_PARAM
211 {
212     MS_U8 *unit;
213     MS_U16 *x;
214     MS_U16 *y;
215 }JPEG_GETAPP0INFO_PARAM, *PJPEG_GETAPP0INFO_PARAM;
216 
217 // For MApi_JPEG_DecodeHdr(), MApi_JPEG_Decode()
218 // For MApi_JPEG_HdlVidxChk(), MApi_JPEG_DisableISR()
219 typedef struct _JPEG_RESULT_PARAM
220 {
221     JPEG_Result retVal;
222 }JPEG_RESULT_PARAM, *PJPEG_RESULT_PARAM;
223 
224 typedef struct _JPEG_GETERRORCODE_PARAM
225 {
226     JPEG_ErrCode ErrCode;
227 }JPEG_GETERRORCODE_PARAM, *PJPEG_GETERRORCODE_PARAM;
228 
229 // For MApi_JPEG_GetJPDEventFlag() and MApi_JPEG_SetJPDEventFlag()
230 typedef struct _JPEG_JPEGEVENT_PARAM
231 {
232     JPEG_Event eEvtVal;
233 }JPEG_JPEGEVENT_PARAM, *PJPEG_JPEGEVENT_PARAM;
234 
235 // For MApi_JPEG_GetCurVidx()
236 // For MApi_JPEG_GetWidth(), MApi_JPEG_GetHeight()
237 // For MApi_JPEG_GetOriginalWidth(), MApi_JPEG_GetOriginalHeight()
238 // For MApi_JPEG_GetNonAlignmentWidth(), MApi_JPEG_GetNonAlignmentHeight()
239 // For MApi_JPEG_GetAlignedPitch(), MApi_JPEG_GetAlignedPitch_H()
240 // For MApi_JPEG_GetAlignedWidth(), MApi_JPEG_GetAlignedHeight()
241 typedef struct _JPEG_U16_PARAM
242 {
243     MS_U16 u16Value;
244 }JPEG_U16_PARAM, *PJPEG_U16_PARAM;
245 
246 // For MApi_JPEG_GetScaleDownFactor(), MApi_JPEG_SetDbgLevel(), MApi_JPEG_GetDbgLevel()
247 // For MApi_JPEG_SetNJPDInstance()
248 typedef struct _JPEG_U8_PARAM
249 {
250     MS_U8 u8Value;
251 }JPEG_U8_PARAM, *PJPEG_U8_PARAM;
252 
253 
254 // For MApi_JPEG_SetMaxDecodeResolution(), MApi_JPEG_SetProMaxDecodeResolution()
255 // For MApi_JPEG_SetMPOMaxDecodeResolution(), MApi_JPEG_SetMPOProMaxDecodeResolution()
256 typedef struct _JPEG_RESOLUTION_PARAM
257 {
258     MS_U16 u16Width;
259     MS_U16 u16Height;
260 }JPEG_RESOLUTION_PARAM, *PJPEG_RESOLUTION_PARAM;
261 
262 typedef struct _JPEG_SETMBUFFERVALID_PARAM
263 {
264     JPEG_BuffLoadType u8MRBuffType;
265 }JPEG_SETMBUFFERVALID_PARAM, *PJPEG_SETMBUFFERVALID_PARAM;
266 
267 typedef struct _JPEG_UPDATEREADINFO_PARAM
268 {
269     MS_U32 u32DataRead;
270     MS_BOOL bEOFflag;
271 }JPEG_UPDATEREADINFO_PARAM, *PJPEG_UPDATEREADINFO_PARAM;
272 
273 typedef struct _JPEG_PROCESSEOF_PARAM
274 {
275     JPEG_BuffLoadType u8MRBuffType;
276 }JPEG_PROCESSEOF_PARAM, *PJPEG_PROCESSEOF_PARAM;
277 
278 typedef struct _JPEG_SETERRORCODE_PARAM
279 {
280     JPEG_ErrCode ErrStatus;
281 }JPEG_SETERRORCODE_PARAM, *PJPEG_SETERRORCODE_PARAM;
282 
283 typedef struct _JPEG_GETINFO_PARAM
284 {
285     JPEG_Info *pJPEG_Info;
286 }JPEG_GETINFO_PARAM, *PJPEG_GETINFO_PARAM;
287 
288 typedef struct _JPEG_GETSTATUS_PARAM
289 {
290     JPEG_Status *pJPEG_Status;
291 }JPEG_GETSTATUS_PARAM, *PJPEG_GETSTATUS_PARAM;
292 
293 typedef struct _JPEG_GETLIBVER_PARAM
294 {
295     const MSIF_Version **ppVersion;
296     JPEG_Result retVal;
297 }JPEG_GETLIBVER_PARAM, *PJPEG_GETLIBVER_PARAM;
298 
299 typedef struct _JPEG_GETBUFFLOADTYPE_PARAM
300 {
301     JPEG_BuffLoadType *pBuffLoadType;
302     JPEG_Result retVal;
303 }JPEG_GETBUFFLOADTYPE_PARAM, *PJPEG_GETBUFFLOADTYPE_PARAM;
304 
305 typedef struct _JPEG_ENABLEISR_PARAM
306 {
307     JPEG_IsrFuncCb IsrCb;
308     JPEG_Result retVal;
309 }JPEG_ENABLEISR_PARAM, *PJPEG_ENABLEISR_PARAM;
310 
311 typedef struct _JPEG_WAITDONE_PARAM
312 {
313     JPEG_DecodeStatus retVal;
314 }JPEG_WAITDONE_PARAM, *PJPEG_WAITDONE_PARAM;
315 
316 typedef struct _JPEG_GETEXIFDATETIME_PARAM
317 {
318     JPEG_EXIF_DateTime *DateTime;
319     JPEG_Result retVal;
320 }JPEG_GETEXIFDATETIME_PARAM, *PJPEG_GETEXIFDATETIME_PARAM;
321 
322 typedef struct _JPEG_GETEXIFORIENTATION_PARAM
323 {
324     JPEG_EXIF_Orientation *eOrientation;
325     JPEG_Result retVal;
326 }JPEG_GETEXIFORIENTATION_PARAM, *PJPEG_GETEXIFORIENTATION_PARAM;
327 
328 // For MApi_JPEG_GetEXIFManufacturer(), MApi_JPEG_GetEXIFManufacturer()
329 typedef struct _JPEG_GETEXIFSTRING_PARAM
330 {
331     MS_U8 *pu8String;
332     MS_U8 u8size;
333     JPEG_Result retVal;
334 }JPEG_GETEXIFSTRING_PARAM, *PJPEG_GETEXIFSTRING_PARAM;
335 
336 // For MApi_JPEG_GetEXIFFlash()
337 typedef struct _JPEG_GETEXIFU16_PARAM
338 {
339     MS_U16 *pu16Value;
340     JPEG_Result retVal;
341 }JPEG_GETEXIFU16_PARAM, *PJPEG_GETEXIFU16_PARAM;
342 
343 // For MApi_JPEG_GetEXIFISOSpeedRatings()
344 // For MApi_JPEG_GetEXIFImageWidth(), MApi_JPEG_GetEXIFImageHeight()
345 typedef struct _JPEG_GETEXIFU32_PARAM
346 {
347     MS_U32 *pu32Value;
348     JPEG_Result retVal;
349 }JPEG_GETEXIFU32_PARAM, *PJPEG_GETEXIFU32_PARAM;
350 
351 // For MApi_JPEG_GetEXIFShutterSpeedValue(), MApi_JPEG_GetEXIFApertureValue()
352 // For MApi_JPEG_GetEXIFExposureBiasValue(), MApi_JPEG_GetEXIFFocalLength()
353 // For MApi_JPEG_GetEXIFExposureTime(), MApi_JPEG_GetEXIFFNumber()
354 typedef struct _JPEG_GETEXIFRATIONAL_PARAM
355 {
356     JPEG_RATIONAL *pRational;
357     JPEG_Result retVal;
358 }JPEG_GETEXIFRATIONAL_PARAM, *PJPEG_GETEXIFRATIONAL_PARAM;
359 
360 typedef struct _JPEG_GETFREEMEMORY_PARAM
361 {
362     MS_U32 size;
363     MS_PHY addr;
364 }JPEG_GETFREEMEMORY_PARAM, *PJPEG_GETFREEMEMORY_PARAM;
365 
366 // For MApi_JPEG_GetDataOffset(), MApi_JPEG_GetSOFOffset()
367 typedef struct _JPEG_U32_PARAM
368 {
369     MS_U32 u32Value;
370 }JPEG_U32_PARAM, *PJPEG_U32_PARAM;
371 
372 // For MApi_JPEG_SupportCMYK(), MApi_JPEG_SupportRGB()
373 typedef struct _JPEG_SUPPORTCMYK_PARAM
374 {
375     MS_BOOL bEnable;
376     JPEG_Result retVal;
377 }JPEG_SUPPORTCMYK_PARAM, *PJPEG_SUPPORTCMYK_PARAM;
378 
379 typedef struct _JPEG_GETMPOINDEX_PARAM
380 {
381     JPEG_MPO_INDEX_INFO **ppMPOIndex;
382     MS_BOOL bretVal;
383 }JPEG_GETMPOINDEX_PARAM, *PJPEG_GETMPOINDEX_PARAM;
384 
385 typedef struct _JPEG_GETMPOATTR_PARAM
386 {
387     MS_U32 image_no;
388     JPEG_MPO_ATTRIBUTE_INFO **ppMPOAttr;
389     MS_BOOL bretVal;
390 }JPEG_GETMPOATTR_PARAM, *PJPEG_GETMPOATTR_PARAM;
391 
392 typedef struct _JPEG_SETMPOBUFFER_PARAM
393 {
394     MS_U32 read_offset;
395     MS_U32 output_start;
396     MS_BOOL bretVal;
397 }JPEG_SETMPOBUFFER_PARAM, *PJPEG_SETMPOBUFFER_PARAM;
398 
399 // For MApi_JPEG_SetVerificationMode(), MApi_JPEG_GetVerificationMode()
400 typedef struct _JPEG_VERIFICATION_PARAM
401 {
402     NJPEG_VerificationMode VerificationMode;
403 }JPEG_VERIFICATION_PARAM, *PJPEG_VERIFICATION_PARAM;
404 
405 typedef struct _JPEG_GET_CTRL_PARAM
406 {
407     EN_JPEG_GET_CTRL_ID eGetID;
408     MS_U32 *param;
409     MS_U32 u32size;
410     JPEG_Result retVal;
411 }JPEG_GET_CTRL_PARAM, *PJPEG_GET_CTRL_PARAM;
412 
413 void NJPEG_EXRegisterToUtopia(FUtopiaOpen ModuleType);
414 MS_U32 JPEG_Open(void** ppInstance, MS_U32 u32ModuleVersion, void* pAttribute);
415 MS_U32 JPEG_Close(void* pInstance);
416 MS_U32 JPEG_Ioctl(void* pInstance, MS_U32 u32Cmd, void* pArgs);
417 void JPEG_SetDbgLevel_V2(MS_U8 u8DbgLevel);
418 
419 
420 #ifdef __cplusplus
421 }
422 #endif
423 
424 #endif // _API_JPEG_V2_H_
425 
426 
427