xref: /utopia/UTPA2-700.0.x/mxlib/include/apiJPEG.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) 2008-2009 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.h
98 /// @brief  JPEG API
99 /// @author MStar Semiconductor Inc.
100 ///////////////////////////////////////////////////////////////////////////////////////////////////
101 
102 
103 /*! \defgroup JPEG JPEG interface (apiJPEG.h)
104     \ingroup JPEG
105     The supporting features of Mstar JPD HW IP are listed in the following:
106 -# Support JPEG sequential mode, single scan.
107 -# Mstar JPD IP supports sequential mode only. If the file is of JPD progressive mode, DDI will pre-do software variable length decoding (SVLD) and then call Mstar JPD IP to do the rest of the decoding procedure.
108 -# Support both color picture and grayscale format.
109 -# Operate in scan unit, the decoder will handle the part after scan header.
110 -# Support JPEG decoder based on programmable region of interest (ROI).
111 -# Support color format: YUV444/YUV422/YUV420/YUV411. The decoded result will be stored in YUV422 format.
112 -# One ECS read-from-memory channel MRC.
113 	   -It means that Mstar JPD only support interleaved baseline decoding.
114 -# JPD read data form read buffer which is defined by software. Its minimum size is 16 double words and multiple of 8.
115 -# Read Buffer is divided into low and high portion, and valid bit for each portion is set by software and clear by decoder.
116 -# Decode picture data output to write buffer which is for the picture of original size, 1/2 downscaled, 1/4 downscaled or 1/8 downscaled.
117 
118     <b> Operation Code Flow: </b> \n
119     check flow chart directly.
120     \image html JPD_decode_flow.png
121 
122 *! \defgroup JPEG_Basic JPEG Basic APIs
123 *  \ingroup JPEG
124 *! \defgroup JPEG_MPO MPO related APIs
125 *  \ingroup JPEG
126 *! \defgroup JPEG_MJPEG MJPEG related APIs
127 *  \ingroup JPEG
128 *! \defgroup JPEG_HW_BUG Previous HW bug related APIs (to be removed)
129 *  \ingroup JPEG
130 *! \defgroup JPEG_oJPD oJPD use related APIs (to be removed)
131 *  \ingroup JPEG
132 *! \defgroup JPEG_MHEG5 MHEG5 use related APIs (to be removed)
133 *  \ingroup JPEG
134 *! \defgroup JPEG_Debug JPEG Debug APIs
135 *  \ingroup JPEG
136 *! \defgroup JPEG_to_be_integrated JPEG_to_be_integrated (to be removed)
137 *  \ingroup JPEG
138 *! \defgroup JPEG_to_be_removed JPEG_to_be_removed (to be removed)
139 *  \ingroup JPEG
140 *! \defgroup JPEG_to_be_added JPEG_to_be_added
141 *  \ingroup JPEG
142 */
143 
144 #ifndef _API_JPEG_H_
145 #define _API_JPEG_H_
146 
147 #ifdef __cplusplus
148 extern "C" {
149 #endif
150 //-------------------------------------------------------------------------------------------------
151 //  Macro and Define
152 //-------------------------------------------------------------------------------------------------
153 #define MSIF_JPEG_LIB_CODE                     {'J','P','E','G'}                    ///<Lib code
154 #define MSIF_JPEG_LIBVER                       {'0','1'}                            ///<LIB version
155 #define MSIF_JPEG_BUILDNUM                     {'0','H'}                            ///<Build Number
156 #define MSIF_JPEG_CHANGELIST                   {'0','0','7','1','8','4','1','5'}    ///<P4 ChangeList Number
157 
158 //------------------------------------------------------------------------------
159 /// @brief \b JPEG_API_VERSION : JPEG Version
160 //------------------------------------------------------------------------------
161 #define JPEG_API_VERSION                /* Character String for DRV/API version             */  \
162     MSIF_TAG,                           /* 'MSIF'                                           */  \
163     MSIF_CLASS,                         /* '00'                                             */  \
164     MSIF_CUS,                           /* 0x0000                                           */  \
165     MSIF_MOD,                           /* 0x0000                                           */  \
166     MSIF_CHIP,                                                                                  \
167     MSIF_CPU,                                                                                   \
168     MSIF_JPEG_LIB_CODE,                 /* IP__                                             */  \
169     MSIF_JPEG_LIBVER,                   /* 0.0 ~ Z.Z                                        */  \
170     MSIF_JPEG_BUILDNUM,                 /* 00 ~ 99                                          */  \
171     MSIF_JPEG_CHANGELIST,               /* CL#                                              */  \
172     MSIF_OS
173 
174 //------------------------------------------------------------------------------
175 /// @brief \b JPEG_DEFAULT_EXIF_SIZE : The buffer size for thumbnail
176 //------------------------------------------------------------------------------
177 #define JPEG_DEFAULT_EXIF_SIZE  (64*1024UL + 128)
178 
179 #define SUPPORT_MPO_FORMAT          1
180 
181 #define SUPPORT_EXIF_EXTRA_INFO       TRUE // FALSE
182 
183 #define SUPPORT_GET_FULL_IMAGE_INFO          1
184 
185 #if SUPPORT_MPO_FORMAT
186 #define JPEG_MPO_MAX_SUPPORT_IMAGE  4
187 #endif
188 
189 
190 
191 #define JPEG_UTOPIA20       (1)
192 
193 //-------------------------------------------------------------------------------------------------
194 //  Type and Structure
195 //-------------------------------------------------------------------------------------------------
196 //-----------------------------------------------------------------------------
197 /// @brief \b Enum \b Name: JPEG_Result
198 /// @brief \b Enum \b Description: JPEG decode result
199 //-----------------------------------------------------------------------------
200 typedef enum
201 {
202     E_JPEG_FAILED   = 0
203   , E_JPEG_OKAY     = 1
204   , E_JPEG_DONE     = 2
205   , E_JPEG_RETRY    = 3
206 } JPEG_Result;
207 //-----------------------------------------------------------------------------
208 /// @brief \b Enum \b Name: JPEG_ErrCode
209 /// @brief \b Enum \b Description: JPEG error code
210 //-----------------------------------------------------------------------------
211 typedef enum
212 {
213     E_JPEG_NO_ERROR                     = 0
214   , E_JPEG_BAD_DHT_COUNTS               = -200
215   , E_JPEG_BAD_DHT_INDEX                = -201
216   , E_JPEG_BAD_DHT_MARKER               = -202
217   , E_JPEG_BAD_DQT_MARKER               = -203
218   , E_JPEG_BAD_DQT_TABLE                = -204
219   , E_JPEG_BAD_PRECISION                = -205
220   , E_JPEG_BAD_HEIGHT                   = -206
221   , E_JPEG_BAD_WIDTH                    = -207
222   , E_JPEG_TOO_MANY_COMPONENTS          = -208
223   , E_JPEG_BAD_SOF_LENGTH               = -209
224   , E_JPEG_BAD_VARIABLE_MARKER          = -210
225   , E_JPEG_BAD_DRI_LENGTH               = -211
226   , E_JPEG_BAD_SOS_LENGTH               = -212
227   , E_JPEG_BAD_SOS_COMP_ID              = -213
228   , E_JPEG_W_EXTRA_BYTES_BEFORE_MARKER  = -214
229   , E_JPEG_NO_ARITHMETIC_SUPPORT        = -215
230   , E_JPEG_UNEXPECTED_MARKER            = -216
231   , E_JPEG_NOT_JPEG                     = -217
232   , E_JPEG_UNSUPPORTED_MARKER           = -218
233   , E_JPEG_BAD_DQT_LENGTH               = -219
234   , E_JPEG_TOO_MANY_BLOCKS              = -221
235   , E_JPEG_UNDEFINED_QUANT_TABLE        = -222
236   , E_JPEG_UNDEFINED_HUFF_TABLE         = -223
237   , E_JPEG_NOT_SINGLE_SCAN              = -224
238   , E_JPEG_UNSUPPORTED_COLORSPACE       = -225
239   , E_JPEG_UNSUPPORTED_SAMP_FACTORS     = -226
240   , E_JPEG_DECODE_ERROR                 = -227
241   , E_JPEG_BAD_RESTART_MARKER           = -228
242   , E_JPEG_ASSERTION_ERROR              = -229
243   , E_JPEG_BAD_SOS_SPECTRAL             = -230
244   , E_JPEG_BAD_SOS_SUCCESSIVE           = -231
245   , E_JPEG_STREAM_READ                  = -232
246   , E_JPEG_NOTENOUGHMEM                 = -233
247   , E_JPEG_STOP_DECODE                  = -234 //kevinhuang, add
248   , E_JPEG_BAD_APP1_MARKER              = -235
249   , E_JPEG_NO_THUMBNAIL                 = -236
250   , E_JPEG_UNSUPPORTED_HUFF_DECODE      = -237
251   , E_JPEG_READBUFFER_TOOSMALL          = -238
252   , E_JPEG_NOT_ENOUGH_HEADER_INFO       = -240
253   , E_JPEG_RE_INIT                      = -241
254   , E_JPEG_NOT_INIT                     = -242
255   , E_JPEG_BAD_APP0_MARKER              = -243
256 #if SUPPORT_MPO_FORMAT
257   , E_JPEG_BAD_APP2_MARKER              = -250
258 #endif
259   , E_JPEG_JPD_DECODE_ERROR             = 0x5566
260 } JPEG_ErrCode;
261 //-----------------------------------------------------------------------------
262 /// @brief \b Enum \b Name: JPEG_DecType
263 /// @brief \b Enum \b Description: JPEG decode type
264 //-----------------------------------------------------------------------------
265 typedef enum
266 {
267     E_JPEG_TYPE_MAIN        = 0
268   , E_JPEG_TYPE_THUMBNAIL   = 1
269   , E_JPEG_TYPE_MJPEG       = 2
270 }JPEG_DecType;
271 //-----------------------------------------------------------------------------
272 /// @brief \b Enum \b Name: JPEG_BuffLoadType
273 /// @brief \b Enum \b Description: JPEG buffer loading mode
274 //-----------------------------------------------------------------------------
275 typedef enum
276 {
277     E_JPEG_BUFFER_NONE  = 0
278   , E_JPEG_BUFFER_HIGH  = 1
279   , E_JPEG_BUFFER_LOW   = 2
280 } JPEG_BuffLoadType;
281 //-----------------------------------------------------------------------------
282 /// @brief \b Enum \b Name: JPEG_DbgLevel
283 /// @brief \b Enum \b Description: JPEG debug mode
284 //-----------------------------------------------------------------------------
285 typedef enum
286 {
287     E_JPEG_DEBUG_NONE   = 0x0
288   , E_JPEG_DEBUG_API    = 0x01
289   , E_JPEG_DEBUG_DRV    = 0x02
290   , E_JPEG_DEBUG_HAL    = 0x04
291   , E_JPEG_DEBUG_MSG    = 0x07
292   , E_JPEG_DEBUG_ERR    = 0x08
293   , E_JPEG_DEBUG_ALL    = 0x0F
294   , E_JPEG_DEBUG_MJPEG    = 0x10
295 } JPEG_DbgLevel;
296 //-----------------------------------------------------------------------------
297 /// @brief \b Enum \b Name: JPEG_Event
298 /// @brief \b Enum \b Description: JPEG decode event flag
299 //-----------------------------------------------------------------------------
300 typedef enum
301 {
302     E_JPEG_EVENT_DEC_NONE       = 0x00
303   , E_JPEG_EVENT_DEC_DONE       = 0x01
304   , E_JPEG_EVENT_DEC_ECS_ERROR  = 0x02
305   , E_JPEG_EVENT_DEC_IS_ERROR   = 0x04
306   , E_JPEG_EVENT_DEC_RST_ERROR  = 0x08
307   , E_JPEG_EVENT_DEC_MRBL_DONE  = 0x10
308   , E_JPEG_EVENT_DEC_MRBH_DONE  = 0x20
309   , E_JPEG_EVENT_DEC_MRB_DONE   = 0x30
310   , E_JPEG_EVENT_DEC_MWB_FULL   = 0x40
311   , E_JPEG_EVENT_DEC_ERROR_MASK = 0x0E
312 } JPEG_Event;
313 //-----------------------------------------------------------------------------
314 /// @brief \b Enum \b Name: JPEG_DecodeStatus
315 /// @brief \b Enum \b Description: JPEG decoder status
316 //-----------------------------------------------------------------------------
317 typedef enum
318 {
319     E_JPEG_DEC_DONE             = 0
320   , E_JPEG_DEC_FAILED           = 1
321   , E_JPEG_DEC_RST_ERROR        = 2
322   , E_JPEG_DEC_BITSTREAM_ERROR  = 3
323   , E_JPEG_DEC_MRBL_DONE        = 4
324   , E_JPEG_DEC_MRBH_DONE        = 5
325   , E_JPEG_DEC_DECODING         = 6
326 } JPEG_DecodeStatus;
327 //-----------------------------------------------------------------------------
328 /// @brief \b Enum \b Name: JPEG_EXIF_IFD0_Orientation
329 /// @brief \b Enum \b Description: The orientation of JPEG EXIF
330 //-----------------------------------------------------------------------------
331 typedef enum
332 {
333     E_JPEG_EXIF_ORIENT_NOT_FOUND              = 0
334   , E_JPEG_EXIF_ORIENT_ROTATE_0               = 1
335   , E_JPEG_EXIF_ORIENT_MIRROR_LR              = 2
336   , E_JPEG_EXIF_ORIENT_ROTATE_180             = 3
337   , E_JPEG_EXIF_ORIENT_MIRROR_TB              = 4
338   , E_JPEG_EXIF_ORIENT_ROTATE_90_MIRROR_LR    = 5
339   , E_JPEG_EXIF_ORIENT_ROTATE_90              = 6
340   , E_JPEG_EXIF_ORIENT_ROTATE_90_MIRROR_TB    = 7
341   , E_JPEG_EXIF_ORIENT_ROTATE_270             = 8
342   , E_JPEG_EXIF_ORIENT_RESERVED               = 9
343 } JPEG_EXIF_Orientation;
344 
345 typedef enum
346 {
347     E_JPEG_GET_EXIF_MANUFACTURER            = 0
348   , E_JPEG_GET_EXIF_MODEL                   = 1
349   , E_JPEG_GET_EXIF_FLASH                   = 2
350   , E_JPEG_GET_EXIF_ISO_SPEED_RATINGS       = 3
351   , E_JPEG_GET_EXIF_SHUTTER_SPEED_VALUE     = 4
352   , E_JPEG_GET_EXIF_APERTURE_VALUE          = 5
353   , E_JPEG_GET_EXIF_EXPOSURE_BIAS_VALUE     = 6
354   , E_JPEG_GET_EXIF_FOCAL_LENGTH            = 7
355   , E_JPEG_GET_EXIF_IMAGE_WIDTH             = 8
356   , E_JPEG_GET_EXIF_IMAGE_HEIGHT            = 9
357   , E_JPEG_GET_EXIF_EXPOSURE_TIME           = 10
358   , E_JPEG_GET_EXIF_F_NUMBER                = 11
359   , E_JPEG_GET_EXIF_EXPOSURE_PROGRAM        = 12
360   , E_JPEG_GET_Y_SAMPLING_FACTOR_HORIZONTAL = 13
361   , E_JPEG_GET_Y_SAMPLING_FACTOR_VERTICAL   = 14
362   , E_JPEG_GET_COMPONENTS_NUM               = 15
363   , E_JPEG_GET_IS_PROGRESSIVE               = 16
364   , E_JPEG_GET_COLOR_FORMAT                 = 17
365 #if SUPPORT_GET_FULL_IMAGE_INFO
366   , E_JPEG_GET_FULL_IMAGE_WIDTH             = 18
367   , E_JPEG_GET_FULL_IMAGE_HEIGHT            = 19
368   , E_JPEG_IS_FULL_IMAGE_PROGRESSIVE        = 20
369 #endif
370 } EN_JPEG_GET_CTRL_ID;
371 
372 typedef enum
373 {
374      E_JPEG_INPUT_FORMAT_GRAY_SCALE     = 0
375 ,    E_JPEG_INPUT_FORMAT_YUV444         = 1
376 ,    E_JPEG_INPUT_FORMAT_YUV422         = 2
377 ,    E_JPEG_INPUT_FORMAT_YUV420         = 3
378 ,    E_JPEG_INPUT_FORMAT_YUV411         = 4
379 ,    E_JPEG_INPUT_FORMAT_CMYK           = 5
380 ,    E_JPEG_INPUT_FORMAT_RGB            = 6
381 }EN_JPEG_INPUT_COLOR_FORMAT;
382 
383 
384 
385 // the structure of NJPEG_VerificationMode should be the same as NJPD_VerificationMode
386 typedef enum
387 {
388     E_NJPEG00_NONE,
389     E_NJPEG01_TABLE_READ_WRITE,
390     E_NJPEG13_ROI,
391     E_NJPEG17_OBUF_OUTPUT_FORMAT_YC_SWAP,
392     E_NJPEG17_OBUF_OUTPUT_FORMAT_UV_SWAP,
393     E_NJPEG17_OBUF_OUTPUT_FORMAT_UV_7BIT,
394     E_NJPEG17_OBUF_OUTPUT_FORMAT_UV_MSB,
395     E_NJPEG18_IBUF_BURST_LENGTH,
396     E_NJPEG21_NO_RESET_TABLE,
397     E_NJPEG23_WRITE_PROTECT,
398     E_NJPEG25_DOWNSCALE_1_2,
399     E_NJPEG25_DOWNSCALE_1_4,
400     E_NJPEG25_DOWNSCALE_1_8
401 }NJPEG_VerificationMode;
402 
403 //-----------------------------------------------------------------------------
404 ///@brief \b Typedef \b Name: *JPEG_FillHdrFunc
405 ///@brief \b Typedef \b Description: the function for fill header information
406 ///@param <IN> \b BufAddr : fill buffer address
407 ///@param <IN> \b BufLength : fill buffer size
408 ///@return The amount of byte read
409 //-----------------------------------------------------------------------------
410 typedef MS_S32 (*JPEG_FillHdrFunc)(MS_PHY BufAddr, MS_U32 BufLength);
411 
412 //-----------------------------------------------------------------------------
413 ///@brief \b Typedef \b Name: *JPEG_IsrFuncCb
414 ///@brief \b Typedef \b Description: the function handling JPD interrupt
415 ///@param None
416 ///@return None
417 //-----------------------------------------------------------------------------
418 typedef void (*JPEG_IsrFuncCb)(void);
419 
420 //-----------------------------------------------------------------------------
421 /// @brief \b Struct \b Name: JPEG_InitParam
422 /// @brief \b Struct \b Description: JPEG decode parameter setting
423 //-----------------------------------------------------------------------------
424 typedef struct DLL_PACKED
425 {
426     MS_PHY u32MRCBufAddr;       ///< MRC buffer address
427     MS_U32 u32MRCBufSize;           ///< MRC buffer size
428     MS_PHY u32MWCBufAddr;       ///< MWC buffer address
429     MS_U32 u32MWCBufSize;           ///< MWC buffer size
430     MS_PHY u32InternalBufAddr;  ///< internal buffer address
431     MS_U32 u32InternalBufSize;      ///< internal buffer size
432     MS_U32 u32DecByteRead;          ///< how many byte read for JPEG decoder initialization
433     MS_BOOL bEOF;                   ///< has read to the end of file
434     MS_U8 u8DecodeType;             ///< JPEG decode type : JPEG main, thumbnail, or MJPEG
435     MS_BOOL bInitMem;               ///< initialize memory pool or not
436     JPEG_FillHdrFunc pFillHdrFunc;  ///< the function for fill header information
437 } JPEG_InitParam;
438 //-----------------------------------------------------------------------------
439 /// @brief \b Struct \b Name: JPEG_DrvCap
440 /// @brief \b Struct \b Description: JPEG decode driver capability
441 //-----------------------------------------------------------------------------
442 typedef struct DLL_PACKED
443 {
444     MS_U16 u16MaxWidth;     ///< max decoded width for baseline
445     MS_U16 u16MaxHeight;    ///< max decoded height for baseline
446     MS_U16 u16MaxProWidth;  ///< max decoded width for progressive
447     MS_U16 u16MaxProHeight; ///< max decoded height for progressive
448     MS_BOOL bBaseline;      ///< support baseline decode
449     MS_BOOL bProgressive;   ///< support progressive decode
450     MS_BOOL bMJPEG;         ///< support motion JPEG
451 } JPEG_DrvCap;
452 //-----------------------------------------------------------------------------
453 /// @brief \b Struct \b Name: JPEG_Info
454 /// @brief \b Struct \b Description: JPEG decode information
455 //-----------------------------------------------------------------------------
456 typedef struct DLL_PACKED
457 {
458     const MSIF_Version* pu8DrvVer;  ///< JPEG DRV version
459     MS_U8* pu8HalVer;               ///< JPEG HAL version
460     MS_U8* pu8FwVer;                ///< JPEG FW version
461     JPEG_DrvCap stDrvCap;           ///< JPEG driver capability
462 } JPEG_Info;
463 //-----------------------------------------------------------------------------
464 /// @brief \b Struct \b Name: JPEG_Status
465 /// @brief \b Struct \b Description: JPD driver Status
466 //-----------------------------------------------------------------------------
467 typedef struct DLL_PACKED
468 {
469     MS_U32  u32CurMRCAddr;  ///< JPD current decoded address
470     MS_U16  u16CurVidx;     ///< JPD current decoded vertical index
471     MS_U16  u16CurRow;      ///< JPD current decoded row
472     MS_U16  u16CurCol;      ///< JPD current decoded column
473     MS_BOOL bDrvBusy;       ///< JPD status
474     MS_BOOL bIsrEnable;     ///< JPD ISR status
475 } JPEG_Status;
476 //-----------------------------------------------------------------------------
477 /// @brief \b Struct \b Name: JPEG_EXIF_DateTime
478 /// @brief \b Struct \b Description: The DateTime info of JPEG EXIF.
479 //-----------------------------------------------------------------------------
480 typedef struct DLL_PACKED
481 {
482     MS_U32 u32Year;         ///< The year info of JPEG EXIF DataTime
483     MS_U32 u32Month;        ///< The month info of JPEG EXIF DataTime
484     MS_U32 u32Day;          ///< The day info of JPEG EXIF DataTime
485     MS_U32 u32Hour;         ///< The hour info of JPEG EXIF DataTime
486     MS_U32 u32Minute;       ///< The minute info of JPEG EXIF DataTime
487     MS_U32 u32Second;       ///< The second info of JPEG EXIF DataTime
488     MS_BOOL bHasDataTime;   ///< JPEG EXIF DataTime info exist or not
489 }JPEG_EXIF_DateTime;
490 
491 typedef enum
492 {
493     E_DECODE_NONE = 0,
494     E_DECODE_DONE,
495     E_DECODING,
496     E_DECODE_ERR,
497     E_STREAM_READ_ERR
498 } EN_JPEG_DECODE_STATUS;
499 
500 typedef struct DLL_PACKED
501 {
502     MS_U16 u16Xdensity;      //inch or cm
503     MS_U16 u16Ydensity;      //inch or cm
504     MS_U8 u8Unit;                  //APP0 Mark units : 0-> no units, X and Y specify the pixel aspect ratio
505                                       //                       1 -> X and Y are dots per inch
506                                       //                       2 -> X and Y are dots per cm
507 }APP0_Unit;
508 
509 
510 typedef struct DLL_PACKED
511 {
512     union
513     {
514         struct
515         {
516             MS_U32 numerator;
517             MS_U32 denominator;
518         };
519 
520         struct
521         {
522             MS_S32 s_numerator;
523             MS_S32 s_denominator;
524         };
525     };
526 } JPEG_RATIONAL;
527 
528 typedef struct DLL_PACKED _JPEG_CB_EVENT_PARAM
529 {
530     MS_U32 type;
531     MS_PHY BufAddr;
532     MS_U32 BufLength;
533     MS_S32 param;
534 }JPEG_CB_EVENT_PARAM, *PJPEG_CB_EVENT_PARAM;
535 
536 typedef enum
537 {
538     JPEG_CB_EVENT_NONE,
539     JPEG_CB_EVENT_FILL_HDR,
540     JPEG_CB_EVENT_ISR
541 }JPEG_CB_EVENT;
542 
543 #if SUPPORT_MPO_FORMAT
544 
545 typedef struct DLL_PACKED
546 {
547     MS_U32 attribute;
548     MS_U32 size;
549     MS_U32 offset;
550     MS_U16 image1_no;
551     MS_U16 image2_no;
552 } JPEG_MPO_MP_ENTRY_INFO;
553 
554 
555 typedef struct DLL_PACKED
556 {
557     MS_U32 start_of_offset;
558     MS_U32 num_of_image;
559     JPEG_MPO_MP_ENTRY_INFO mp_entry[JPEG_MPO_MAX_SUPPORT_IMAGE];
560 } JPEG_MPO_INDEX_INFO;
561 
562 
563 typedef struct DLL_PACKED
564 {
565     MS_U32 MPIndividualNum;
566     MS_U32 PanOrientation;
567     JPEG_RATIONAL PanOverlap_H;
568     JPEG_RATIONAL PanOverlap_V;
569     MS_U32 BaseViewpointNum;
570     JPEG_RATIONAL ConvergenceAngle;
571     JPEG_RATIONAL BaselineLength;
572     JPEG_RATIONAL VerticalDivergence;
573     JPEG_RATIONAL AxisDistance_X;
574     JPEG_RATIONAL AxisDistance_Y;
575     JPEG_RATIONAL AxisDistance_Z;
576     JPEG_RATIONAL YawAngle;
577     JPEG_RATIONAL PitchAngle;
578     JPEG_RATIONAL RollAngle;
579     MS_BOOL used;
580 } JPEG_MPO_ATTRIBUTE_INFO;
581 
582 #endif
583 
584 //-------------------------------------------------------------------------------------------------
585 /// Enable oJPD for Edison, only Camera use(to be removed).
586 /// @ingroup JPEG_oJPD
587 /// @param bOnOff \b IN : enable/disable
588 /// @return void.
589 //-------------------------------------------------------------------------------------------------
590 void MApi_JPEG_EnableOJPD(MS_BOOL bOnOff);
591 
592 //-------------------------------------------------------------------------------------------------
593 /// JPEG init oJPD for Edison, only Camera use(to be removed).
594 /// @ingroup JPEG_oJPD
595 /// @param pInitParam \b IN : pointer to initial parameter
596 /// @return JPEG_Result
597 ///     - E_JPEG_FAILED: The result of API execution is failed
598 ///     - E_JPEG_OKAY: The result of API execution is successful
599 ///     - E_JPEG_DONE: For CMYK/progressive decoding, it means one line decode done
600 ///     - E_JPEG_RETRY: Cannot get any information, need to re-call API
601 //-------------------------------------------------------------------------------------------------
602 JPEG_Result MApi_JPEG_Init_UsingOJPD(JPEG_InitParam *pInitParam);
603 
604 
605 //-------------------------------------------------------------------------------------------------
606 /// This function will get APP0 info.(to be removed).
607 /// @ingroup JPEG_to_be_removed
608 /// @param unit \b OUT : pointer to get the unit info
609 /// @param x \b OUT : pointer to get the x info
610 /// @param y \b OUT : pointer to get the y info
611 /// @return void.
612 //-------------------------------------------------------------------------------------------------
613 void msAPI_JPEG_get_APP0_info( MS_U8 *unit,MS_U16 *x, MS_U16 *y );
614 
615 
616 //-------------------------------------------------------------------------------------------------
617 /// This function will initialize the parameters of Mstar JPD
618 /// @ingroup JPEG_Basic
619 /// @param pInitParam \b IN : pointer to initial parameter
620 /// @return JPEG_Result
621 ///     - E_JPEG_FAILED: The result of API execution is failed
622 ///     - E_JPEG_OKAY: The result of API execution is successful
623 ///     - E_JPEG_DONE: For CMYK/progressive decoding, it means one line decode done
624 ///     - E_JPEG_RETRY: Cannot get any information, need to re-call API
625 //-------------------------------------------------------------------------------------------------
626 JPEG_Result MApi_JPEG_Init(JPEG_InitParam *pInitParam);
627 
628 //-------------------------------------------------------------------------------------------------
629 /// This function will parse JPEG header
630 /// @ingroup JPEG_Basic
631 /// @param void.
632 /// @return JPEG_Result
633 ///     - E_JPEG_FAILED: The result of API execution is failed
634 ///     - E_JPEG_OKAY: The result of API execution is successful
635 ///     - E_JPEG_DONE: For CMYK/progressive decoding, it means one line decode done
636 ///     - E_JPEG_RETRY: Cannot get any information, need to re-call API
637 //-------------------------------------------------------------------------------------------------
638 JPEG_Result MApi_JPEG_DecodeHdr(void);
639 
640 //-------------------------------------------------------------------------------------------------
641 /// This function will start JPEG decode
642 /// @ingroup JPEG_Basic
643 /// @param void.
644 /// @return JPEG_Result
645 ///     - E_JPEG_FAILED: The result of API execution is failed
646 ///     - E_JPEG_OKAY: The result of API execution is successful
647 ///     - E_JPEG_DONE: For CMYK/progressive decoding, it means one line decode done
648 ///     - E_JPEG_RETRY: Cannot get any information, need to re-call API
649 //-------------------------------------------------------------------------------------------------
650 JPEG_Result MApi_JPEG_Decode(void);
651 
652 //-------------------------------------------------------------------------------------------------
653 /// This function will free all block of JPD and power off JPD IP
654 /// @ingroup JPEG_Basic
655 /// @param void.
656 /// @return void.
657 //-------------------------------------------------------------------------------------------------
658 void MApi_JPEG_Exit(void);
659 
660 //-------------------------------------------------------------------------------------------------
661 /// This function will get JPD error code
662 /// @ingroup JPEG_Basic
663 /// @param void.
664 /// @return JPEG_ErrCode.
665 //-------------------------------------------------------------------------------------------------
666 JPEG_ErrCode MApi_JPEG_GetErrorCode(void);
667 
668 //-------------------------------------------------------------------------------------------------
669 /// This function will get JPD IP decode event
670 /// @ingroup JPEG_Basic
671 /// @param void.
672 /// @return JPEG_Event.
673 //-------------------------------------------------------------------------------------------------
674 JPEG_Event MApi_JPEG_GetJPDEventFlag(void);
675 
676 //-------------------------------------------------------------------------------------------------
677 /// This function will set JPD event.(to be removed).
678 /// @ingroup JPEG_HW_BUG
679 /// @param eEvtVal
680 /// @return void.
681 //-------------------------------------------------------------------------------------------------
682 void MApi_JPEG_SetJPDEventFlag(JPEG_Event eEvtVal);
683 
684 //-------------------------------------------------------------------------------------------------
685 /// This function will reset JPD IP decoding
686 /// @ingroup JPEG_Basic
687 /// @param void.
688 /// @return void.
689 //-------------------------------------------------------------------------------------------------
690 void MApi_JPEG_Rst(void);
691 
692 //-------------------------------------------------------------------------------------------------
693 /// This function will turn on JPD IP.(to be removed).
694 /// @ingroup JPEG_to_be_removed
695 /// @param void
696 /// @return void.
697 //-------------------------------------------------------------------------------------------------
698 void MApi_JPEG_PowerOn(void);
699 
700 //-------------------------------------------------------------------------------------------------
701 /// This function will turn off JPD IP.(to be removed).
702 /// @ingroup JPEG_to_be_removed
703 /// @param void
704 /// @return void.
705 //-------------------------------------------------------------------------------------------------
706 void MApi_JPEG_PowerOff(void);
707 
708 //-------------------------------------------------------------------------------------------------
709 /// Get current Memory write veritcal index(to be removed).
710 /// @ingroup JPEG_HW_BUG
711 /// @param void.
712 /// @return MS_U16: current Memory write veritcal index
713 //-------------------------------------------------------------------------------------------------
714 MS_U16 MApi_JPEG_GetCurVidx(void);
715 
716 //-------------------------------------------------------------------------------------------------
717 /// This function will check JPEG image is progressive mode or not(to be JPEG_to_be_integrated by get ctrl function).
718 /// @ingroup JPEG_to_be_integrated
719 /// @param void
720 /// @return MS_BOOL: is progressive mode or not
721 //-------------------------------------------------------------------------------------------------
722 MS_BOOL MApi_JPEG_IsProgressive(void);
723 
724 //-------------------------------------------------------------------------------------------------
725 /// This function will check JPEG image has thumbnail or not(to be JPEG_to_be_integrated by get ctrl function).
726 /// @ingroup JPEG_to_be_integrated
727 /// @param void
728 /// @return MS_BOOL:  has thumbnail or not
729 //-------------------------------------------------------------------------------------------------
730 MS_BOOL MApi_JPEG_ThumbnailFound(void);
731 
732 //-------------------------------------------------------------------------------------------------
733 /// This function will get the alignment width of the image(to be JPEG_to_be_integrated by get ctrl function).
734 /// @ingroup JPEG_to_be_integrated
735 /// @param void
736 /// @return MS_U16:  the alignment width of the image
737 //-------------------------------------------------------------------------------------------------
738 MS_U16 MApi_JPEG_GetWidth(void);
739 
740 //-------------------------------------------------------------------------------------------------
741 /// This function will get the alignment Height of the image(to be JPEG_to_be_integrated by get ctrl function).
742 /// @ingroup JPEG_to_be_integrated
743 /// @param void
744 /// @return MS_U16:  the alignment Height of the image
745 //-------------------------------------------------------------------------------------------------
746 MS_U16 MApi_JPEG_GetHeight(void);
747 
748 //-------------------------------------------------------------------------------------------------
749 /// This function will get the original width of the image(to be JPEG_to_be_integrated by get ctrl function).
750 /// @ingroup JPEG_to_be_integrated
751 /// @param void
752 /// @return MS_U16:  the original width of the image
753 //-------------------------------------------------------------------------------------------------
754 MS_U16 MApi_JPEG_GetOriginalWidth(void);
755 
756 //-------------------------------------------------------------------------------------------------
757 /// This function will get the original Height of the image(to be JPEG_to_be_integrated by get ctrl function).
758 /// @ingroup JPEG_to_be_integrated
759 /// @param void
760 /// @return MS_U16:  the original Height of the image
761 //-------------------------------------------------------------------------------------------------
762 MS_U16 MApi_JPEG_GetOriginalHeight(void);
763 
764 //-------------------------------------------------------------------------------------------------
765 /// This function will get the width before alignment(to be JPEG_to_be_integrated by get ctrl function).
766 /// @ingroup JPEG_to_be_integrated
767 /// @param void
768 /// @return MS_U16:  the width before alignment
769 //-------------------------------------------------------------------------------------------------
770 MS_U16 MApi_JPEG_GetNonAlignmentWidth(void);
771 
772 //-------------------------------------------------------------------------------------------------
773 /// This function will get the Height before alignment(to be JPEG_to_be_integrated by get ctrl function).
774 /// @ingroup JPEG_to_be_integrated
775 /// @param void
776 /// @return MS_U16:  the Height before alignment
777 //-------------------------------------------------------------------------------------------------
778 MS_U16 MApi_JPEG_GetNonAlignmentHeight(void);
779 
780 //-------------------------------------------------------------------------------------------------
781 /// This function will get displayed pitch of the image(to be JPEG_to_be_integrated by get ctrl function).
782 /// @ingroup JPEG_to_be_integrated
783 /// @param void
784 /// @return MS_U16: displayed pitch of the image
785 //-------------------------------------------------------------------------------------------------
786 MS_U16 MApi_JPEG_GetAlignedPitch(void);
787 
788 //-------------------------------------------------------------------------------------------------
789 /// Get information for MHEG5 use(to be removed).
790 /// @ingroup JPEG_MHEG5
791 /// @param void.
792 /// @return: MS_U16: information
793 //-------------------------------------------------------------------------------------------------
794 MS_U16 MApi_JPEG_GetAlignedPitch_H(void);
795 
796 //-------------------------------------------------------------------------------------------------
797 /// This function will get the displayed width of the image(to be JPEG_to_be_integrated by get ctrl function).
798 /// @ingroup JPEG_to_be_integrated
799 /// @param void
800 /// @return MS_U16:  the displayed width of the image
801 //-------------------------------------------------------------------------------------------------
802 MS_U16 MApi_JPEG_GetAlignedWidth(void);
803 
804 //-------------------------------------------------------------------------------------------------
805 /// This function will get the displayed Height of the image(to be JPEG_to_be_integrated by get ctrl function).
806 /// @ingroup JPEG_to_be_integrated
807 /// @param void
808 /// @return MS_U16:  the displayed Height of the image
809 //-------------------------------------------------------------------------------------------------
810 MS_U16 MApi_JPEG_GetAlignedHeight(void);
811 
812 //-------------------------------------------------------------------------------------------------
813 /// This function will get scale down factor of JPEG image(to be JPEG_to_be_integrated by get ctrl function).
814 /// @ingroup JPEG_to_be_integrated
815 /// @param void
816 /// @return MS_U8:  scale down factor of JPEG image
817 //-------------------------------------------------------------------------------------------------
818 MS_U8 MApi_JPEG_GetScaleDownFactor(void);
819 
820 //-------------------------------------------------------------------------------------------------
821 /// This function will set maximum output resolution of JPD baseline mode
822 /// @ingroup JPEG_Basic
823 /// @param u16Width \b IN : width
824 /// @param u16Height \b IN : height
825 /// @return void.
826 //-------------------------------------------------------------------------------------------------
827 void MApi_JPEG_SetMaxDecodeResolution(MS_U16 u16Width, MS_U16 u16Height);
828 
829 //-------------------------------------------------------------------------------------------------
830 /// This function will set maximum output resolution of JPD progressive mode
831 /// @ingroup JPEG_Basic
832 /// @param u16ProWidth \b IN : width
833 /// @param u16ProHeight \b IN : height
834 /// @return void.
835 //-------------------------------------------------------------------------------------------------
836 void MApi_JPEG_SetProMaxDecodeResolution(MS_U16 u16ProWidth, MS_U16 u16ProHeight);
837 
838 //-------------------------------------------------------------------------------------------------
839 /// This function will notify JPD IP that the data loaded to low/high portion of read buffer is ready
840 /// @ingroup JPEG_Basic
841 /// @param u8MRBuffType \b IN : JPEG_BuffLoadType
842 /// @return void.
843 //-------------------------------------------------------------------------------------------------
844 void MApi_JPEG_SetMRBufferValid(JPEG_BuffLoadType u8MRBuffType);
845 
846 //-------------------------------------------------------------------------------------------------
847 /// This function will set JPEG EOF flag and the total byte-read of JPEG file. It is called after loading data to read buffer when JPD IP is decoding
848 /// @ingroup JPEG_Basic
849 /// @param u32DataRead \b IN : data be read
850 /// @param bEOFflag \b IN : if eof
851 /// @return void.
852 //-------------------------------------------------------------------------------------------------
853 void MApi_JPEG_UpdateReadInfo(MS_U32 u32DataRead, MS_BOOL bEOFflag);
854 
855 //-------------------------------------------------------------------------------------------------
856 /// This function will set JPD IP of low/high portion done event. It is called when EOF.(to be removed).
857 /// @ingroup JPEG_to_be_removed
858 /// @param u8MRBuffType: IN : JPEG_BuffLoadType
859 /// @return void.
860 //-------------------------------------------------------------------------------------------------
861 void MApi_JPEG_ProcessEOF(JPEG_BuffLoadType u8MRBuffType);
862 
863 //-------------------------------------------------------------------------------------------------
864 /// This function will set JPD error code when the upper layer encounter some error.(to be removed).
865 /// @ingroup JPEG_to_be_removed
866 /// @param ErrStatus: IN : JPEG_ErrCode
867 /// @return void.
868 //-------------------------------------------------------------------------------------------------
869 void MApi_JPEG_SetErrCode(JPEG_ErrCode ErrStatus);
870 
871 //-------------------------------------------------------------------------------------------------
872 /// This function will enable/disable JPD API debug message
873 /// @ingroup JPEG_to_be_removed
874 /// @param u8DbgLevel: IN : debug level
875 /// @return void.
876 //-------------------------------------------------------------------------------------------------
877 void MApi_JPEG_SetDbgLevel(MS_U8 u8DbgLevel);
878 
879 //-------------------------------------------------------------------------------------------------
880 /// This function will get current dbg level.(to be removed).
881 /// @ingroup JPEG_to_be_removed
882 /// @param void.
883 /// @return MS_U8: dbg level
884 //-------------------------------------------------------------------------------------------------
885 MS_U8 MApi_JPEG_GetDbgLevel(void);
886 
887 //-------------------------------------------------------------------------------------------------
888 /// This function will get jpeg info.(to be removed).
889 /// @ingroup JPEG_to_be_removed
890 /// @param pJPEG_Info: OUT : pointer to jpeg info
891 /// @return void.
892 //-------------------------------------------------------------------------------------------------
893 void MApi_JPEG_GetInfo(JPEG_Info *pJPEG_Info);
894 
895 //-------------------------------------------------------------------------------------------------
896 /// This function will get jpeg status.(to be removed).
897 /// @ingroup JPEG_to_be_removed
898 /// @param pJPEG_Status: OUT : pointer to jpeg status
899 /// @return void.
900 //-------------------------------------------------------------------------------------------------
901 void MApi_JPEG_GetStatus(JPEG_Status *pJPEG_Status);
902 
903 //-------------------------------------------------------------------------------------------------
904 /// This function will get lib info.(to be removed).
905 /// @ingroup JPEG_to_be_removed
906 /// @param ppVersion OUT : pointer to lib version's pointer
907 /// @return JPEG_Result
908 ///     - E_JPEG_FAILED: The result of API execution is failed
909 ///     - E_JPEG_OKAY: The result of API execution is successful
910 ///     - E_JPEG_DONE: For CMYK/progressive decoding, it means one line decode done
911 ///     - E_JPEG_RETRY: Cannot get any information, need to re-call API
912 //-------------------------------------------------------------------------------------------------
913 JPEG_Result MApi_JPEG_GetLibVer(const MSIF_Version **ppVersion);
914 
915 //-------------------------------------------------------------------------------------------------
916 /// This function will check current vertical index of JPD and handle a timeout of JPD IP decoding.(to be removed).
917 /// @ingroup JPEG_HW_BUG
918 /// @param void.
919 /// @return JPEG_Result
920 ///     - E_JPEG_FAILED: The result of API execution is failed
921 ///     - E_JPEG_OKAY: The result of API execution is successful
922 ///     - E_JPEG_DONE: For CMYK/progressive decoding, it means one line decode done
923 ///     - E_JPEG_RETRY: Cannot get any information, need to re-call API
924 //-------------------------------------------------------------------------------------------------
925 JPEG_Result MApi_JPEG_HdlVidxChk(void);
926 
927 //-------------------------------------------------------------------------------------------------
928 /// This function will get buffer load type for preloading data when JPD IP is decoding
929 /// @ingroup JPEG_Basic
930 /// @pBuffLoadType u32DataRead \b IN : JPEG_BuffLoadType
931 /// @return JPEG_Result
932 ///     - E_JPEG_FAILED: The result of API execution is failed
933 ///     - E_JPEG_OKAY: The result of API execution is successful
934 ///     - E_JPEG_DONE: For CMYK/progressive decoding, it means one line decode done
935 ///     - E_JPEG_RETRY: Cannot get any information, need to re-call API
936 //-------------------------------------------------------------------------------------------------
937 JPEG_Result MApi_JPEG_GetBuffLoadType(JPEG_BuffLoadType *pBuffLoadType);
938 
939 //-------------------------------------------------------------------------------------------------
940 /// This function will enable ISR.(to be removed).
941 /// @ingroup JPEG_to_be_removed
942 /// @param IsrCb: callback function
943 /// @return JPEG_Result
944 ///     - E_JPEG_FAILED: The result of API execution is failed
945 ///     - E_JPEG_OKAY: The result of API execution is successful
946 ///     - E_JPEG_DONE: For CMYK/progressive decoding, it means one line decode done
947 ///     - E_JPEG_RETRY: Cannot get any information, need to re-call API
948 //-------------------------------------------------------------------------------------------------
949 JPEG_Result MApi_JPEG_EnableISR(JPEG_IsrFuncCb IsrCb);
950 
951 //-------------------------------------------------------------------------------------------------
952 /// This function will disable ISR.(to be removed).
953 /// @ingroup JPEG_to_be_removed
954 /// @param void.
955 /// @return JPEG_Result
956 ///     - E_JPEG_FAILED: The result of API execution is failed
957 ///     - E_JPEG_OKAY: The result of API execution is successful
958 ///     - E_JPEG_DONE: For CMYK/progressive decoding, it means one line decode done
959 ///     - E_JPEG_RETRY: Cannot get any information, need to re-call API
960 //-------------------------------------------------------------------------------------------------
961 JPEG_Result MApi_JPEG_DisableISR(void);
962 
963 //-------------------------------------------------------------------------------------------------
964 /// wait decode done and get decode status, this API is only for bringup/FPGA use
965 /// @ingroup JPEG_Debug
966 /// @param void.
967 /// @return: JPEG_DecodeStatus
968 //-------------------------------------------------------------------------------------------------
969 JPEG_DecodeStatus MApi_JPEG_WaitDone(void);
970 
971 //-------------------------------------------------------------------------------------------------
972 /// This function will get date time of JPEG EXIF(to be JPEG_to_be_integrated by get ctrl function).
973 /// @ingroup JPEG_to_be_integrated
974 /// @param DateTime: This function will get date time of JPEG EXIF
975 /// @return JPEG_Result
976 ///     - E_JPEG_FAILED: The result of API execution is failed
977 ///     - E_JPEG_OKAY: The result of API execution is successful
978 ///     - E_JPEG_DONE: For CMYK/progressive decoding, it means one line decode done
979 ///     - E_JPEG_RETRY: Cannot get any information, need to re-call API
980 //-------------------------------------------------------------------------------------------------
981 JPEG_Result MApi_JPEG_GetEXIFDateTime(JPEG_EXIF_DateTime *DateTime);
982 
983 //-------------------------------------------------------------------------------------------------
984 /// This function will get Orientation of JPEG EXIF(to be JPEG_to_be_integrated by get ctrl function).
985 /// @ingroup JPEG_to_be_integrated
986 /// @param eOrientation: This function will get Orientation of JPEG EXIF
987 /// @return JPEG_Result
988 ///     - E_JPEG_FAILED: The result of API execution is failed
989 ///     - E_JPEG_OKAY: The result of API execution is successful
990 ///     - E_JPEG_DONE: For CMYK/progressive decoding, it means one line decode done
991 ///     - E_JPEG_RETRY: Cannot get any information, need to re-call API
992 //-------------------------------------------------------------------------------------------------
993 JPEG_Result MApi_JPEG_GetEXIFOrientation(JPEG_EXIF_Orientation *eOrientation);
994 #if SUPPORT_EXIF_EXTRA_INFO
995 
996 //-------------------------------------------------------------------------------------------------
997 /// This function will get Manufacturer of JPEG EXIF(to be JPEG_to_be_integrated by get ctrl function).
998 /// @ingroup JPEG_to_be_integrated
999 /// @param pu8Manufacturer: This function will get Manufacturer of JPEG EXIF
1000 /// @param u8size: size of Manufacturer
1001 /// @return JPEG_Result
1002 ///     - E_JPEG_FAILED: The result of API execution is failed
1003 ///     - E_JPEG_OKAY: The result of API execution is successful
1004 ///     - E_JPEG_DONE: For CMYK/progressive decoding, it means one line decode done
1005 ///     - E_JPEG_RETRY: Cannot get any information, need to re-call API
1006 //-------------------------------------------------------------------------------------------------
1007 JPEG_Result MApi_JPEG_GetEXIFManufacturer(MS_U8 *pu8Manufacturer, MS_U8 u8size);
1008 
1009 //-------------------------------------------------------------------------------------------------
1010 /// This function will get Model of JPEG EXIF(to be JPEG_to_be_integrated by get ctrl function).
1011 /// @ingroup JPEG_to_be_integrated
1012 /// @param pu8Model: This function will get Model of JPEG EXIF
1013 /// @param u8size: size of Model
1014 /// @return JPEG_Result
1015 ///     - E_JPEG_FAILED: The result of API execution is failed
1016 ///     - E_JPEG_OKAY: The result of API execution is successful
1017 ///     - E_JPEG_DONE: For CMYK/progressive decoding, it means one line decode done
1018 ///     - E_JPEG_RETRY: Cannot get any information, need to re-call API
1019 //-------------------------------------------------------------------------------------------------
1020 JPEG_Result MApi_JPEG_GetEXIFModel(MS_U8 *pu8Model, MS_U8 u8size);
1021 
1022 //-------------------------------------------------------------------------------------------------
1023 /// This function will get Flash of JPEG EXIF(to be JPEG_to_be_integrated by get ctrl function).
1024 /// @ingroup JPEG_to_be_integrated
1025 /// @param pu16Flash: This function will get Flash of JPEG EXIF
1026 /// @return JPEG_Result
1027 ///     - E_JPEG_FAILED: The result of API execution is failed
1028 ///     - E_JPEG_OKAY: The result of API execution is successful
1029 ///     - E_JPEG_DONE: For CMYK/progressive decoding, it means one line decode done
1030 ///     - E_JPEG_RETRY: Cannot get any information, need to re-call API
1031 //-------------------------------------------------------------------------------------------------
1032 JPEG_Result MApi_JPEG_GetEXIFFlash(MS_U16 *pu16Flash);
1033 
1034 //-------------------------------------------------------------------------------------------------
1035 /// This function will get ISOSpeedRatings of JPEG EXIF(to be JPEG_to_be_integrated by get ctrl function).
1036 /// @ingroup JPEG_to_be_integrated
1037 /// @param pu32ISOSpeedRatings: This function will get ISOSpeedRatings of JPEG EXIF
1038 /// @return JPEG_Result
1039 ///     - E_JPEG_FAILED: The result of API execution is failed
1040 ///     - E_JPEG_OKAY: The result of API execution is successful
1041 ///     - E_JPEG_DONE: For CMYK/progressive decoding, it means one line decode done
1042 ///     - E_JPEG_RETRY: Cannot get any information, need to re-call API
1043 //-------------------------------------------------------------------------------------------------
1044 JPEG_Result MApi_JPEG_GetEXIFISOSpeedRatings(MS_U32 *pu32ISOSpeedRatings);
1045 
1046 //-------------------------------------------------------------------------------------------------
1047 /// This function will get ShutterSpeedValue of JPEG EXIF(to be JPEG_to_be_integrated by get ctrl function).
1048 /// @ingroup JPEG_to_be_integrated
1049 /// @param pShutterSpeedValue: This function will get ShutterSpeedValue of JPEG EXIF
1050 /// @return JPEG_Result
1051 ///     - E_JPEG_FAILED: The result of API execution is failed
1052 ///     - E_JPEG_OKAY: The result of API execution is successful
1053 ///     - E_JPEG_DONE: For CMYK/progressive decoding, it means one line decode done
1054 ///     - E_JPEG_RETRY: Cannot get any information, need to re-call API
1055 //-------------------------------------------------------------------------------------------------
1056 JPEG_Result MApi_JPEG_GetEXIFShutterSpeedValue(JPEG_RATIONAL *pShutterSpeedValue);
1057 
1058 //-------------------------------------------------------------------------------------------------
1059 /// This function will get pApertureValue of JPEG EXIF(to be JPEG_to_be_integrated by get ctrl function).
1060 /// @ingroup JPEG_to_be_integrated
1061 /// @param pApertureValue: This function will get ApertureValue of JPEG EXIF
1062 /// @return JPEG_Result
1063 ///     - E_JPEG_FAILED: The result of API execution is failed
1064 ///     - E_JPEG_OKAY: The result of API execution is successful
1065 ///     - E_JPEG_DONE: For CMYK/progressive decoding, it means one line decode done
1066 ///     - E_JPEG_RETRY: Cannot get any information, need to re-call API
1067 //-------------------------------------------------------------------------------------------------
1068 JPEG_Result MApi_JPEG_GetEXIFApertureValue(JPEG_RATIONAL *pApertureValue);
1069 
1070 //-------------------------------------------------------------------------------------------------
1071 /// This function will get ExposureBiasValue of JPEG EXIF(to be JPEG_to_be_integrated by get ctrl function).
1072 /// @ingroup JPEG_to_be_integrated
1073 /// @param pExposureBiasValue: This function will get ExposureBiasValue of JPEG EXIF
1074 /// @return JPEG_Result
1075 ///     - E_JPEG_FAILED: The result of API execution is failed
1076 ///     - E_JPEG_OKAY: The result of API execution is successful
1077 ///     - E_JPEG_DONE: For CMYK/progressive decoding, it means one line decode done
1078 ///     - E_JPEG_RETRY: Cannot get any information, need to re-call API
1079 //-------------------------------------------------------------------------------------------------
1080 JPEG_Result MApi_JPEG_GetEXIFExposureBiasValue(JPEG_RATIONAL *pExposureBiasValue);
1081 
1082 //-------------------------------------------------------------------------------------------------
1083 /// This function will get FocalLength of JPEG EXIF(to be JPEG_to_be_integrated by get ctrl function).
1084 /// @ingroup JPEG_to_be_integrated
1085 /// @param pFocalLength: This function will get FocalLength of JPEG EXIF
1086 /// @return JPEG_Result
1087 ///     - E_JPEG_FAILED: The result of API execution is failed
1088 ///     - E_JPEG_OKAY: The result of API execution is successful
1089 ///     - E_JPEG_DONE: For CMYK/progressive decoding, it means one line decode done
1090 ///     - E_JPEG_RETRY: Cannot get any information, need to re-call API
1091 //-------------------------------------------------------------------------------------------------
1092 JPEG_Result MApi_JPEG_GetEXIFFocalLength(JPEG_RATIONAL *pFocalLength);
1093 
1094 //-------------------------------------------------------------------------------------------------
1095 /// This function will get ImageWidth of JPEG EXIF(to be JPEG_to_be_integrated by get ctrl function).
1096 /// @ingroup JPEG_to_be_integrated
1097 /// @param pu32ImageWidth: This function will get ImageWidth of JPEG EXIF
1098 /// @return JPEG_Result
1099 ///     - E_JPEG_FAILED: The result of API execution is failed
1100 ///     - E_JPEG_OKAY: The result of API execution is successful
1101 ///     - E_JPEG_DONE: For CMYK/progressive decoding, it means one line decode done
1102 ///     - E_JPEG_RETRY: Cannot get any information, need to re-call API
1103 //-------------------------------------------------------------------------------------------------
1104 JPEG_Result MApi_JPEG_GetEXIFImageWidth(MS_U32 *pu32ImageWidth);
1105 
1106 //-------------------------------------------------------------------------------------------------
1107 /// This function will get ImageHeight of JPEG EXIF(to be JPEG_to_be_integrated by get ctrl function).
1108 /// @ingroup JPEG_to_be_integrated
1109 /// @param pu32ImageHeight: This function will get ImageHeight of JPEG EXIF
1110 /// @return JPEG_Result
1111 ///     - E_JPEG_FAILED: The result of API execution is failed
1112 ///     - E_JPEG_OKAY: The result of API execution is successful
1113 ///     - E_JPEG_DONE: For CMYK/progressive decoding, it means one line decode done
1114 ///     - E_JPEG_RETRY: Cannot get any information, need to re-call API
1115 //-------------------------------------------------------------------------------------------------
1116 JPEG_Result MApi_JPEG_GetEXIFImageHeight(MS_U32 *pu32ImageHeight);
1117 
1118 //-------------------------------------------------------------------------------------------------
1119 /// This function will get ExposureTime of JPEG EXIF(to be JPEG_to_be_integrated by get ctrl function).
1120 /// @ingroup JPEG_to_be_integrated
1121 /// @param pExposureTime: This function will get ExposureTime of JPEG EXIF
1122 /// @return JPEG_Result
1123 ///     - E_JPEG_FAILED: The result of API execution is failed
1124 ///     - E_JPEG_OKAY: The result of API execution is successful
1125 ///     - E_JPEG_DONE: For CMYK/progressive decoding, it means one line decode done
1126 ///     - E_JPEG_RETRY: Cannot get any information, need to re-call API
1127 //-------------------------------------------------------------------------------------------------
1128 JPEG_Result MApi_JPEG_GetEXIFExposureTime(JPEG_RATIONAL *pExposureTime);
1129 
1130 //-------------------------------------------------------------------------------------------------
1131 /// This function will get FNumber of JPEG EXIF(to be JPEG_to_be_integrated by get ctrl function).
1132 /// @ingroup JPEG_to_be_integrated
1133 /// @param pFNumber: This function will get FNumber of JPEG EXIF
1134 /// @return JPEG_Result
1135 ///     - E_JPEG_FAILED: The result of API execution is failed
1136 ///     - E_JPEG_OKAY: The result of API execution is successful
1137 ///     - E_JPEG_DONE: For CMYK/progressive decoding, it means one line decode done
1138 ///     - E_JPEG_RETRY: Cannot get any information, need to re-call API
1139 //-------------------------------------------------------------------------------------------------
1140 JPEG_Result MApi_JPEG_GetEXIFFNumber(JPEG_RATIONAL *pFNumber);
1141 #endif
1142 
1143 //-------------------------------------------------------------------------------------------------
1144 /// This function will get the jpeg information
1145 /// @ingroup JPEG_Basic
1146 /// @EN_JPEG_GET_CTRL_ID eGetID \b IN : control ID
1147 /// @param param \b IN : control info
1148 /// @param u32Size\b IN : control info size
1149 /// @return JPEG_Result
1150 ///     - E_JPEG_FAILED: The result of API execution is failed
1151 ///     - E_JPEG_OKAY: The result of API execution is successful
1152 ///     - E_JPEG_DONE: For CMYK/progressive decoding, it means one line decode done
1153 ///     - E_JPEG_RETRY: Cannot get any information, need to re-call API
1154 //-------------------------------------------------------------------------------------------------
1155 JPEG_Result MApi_JPEG_GetControl(EN_JPEG_GET_CTRL_ID eGetID, MS_U32 *param, MS_U32 u32Size);
1156 
1157 //-------------------------------------------------------------------------------------------------
1158 /// This function would disable address convert for MJPEG use(to be removed).
1159 /// @ingroup JPEG_MJPEG
1160 /// @param void
1161 /// @return void.
1162 //-------------------------------------------------------------------------------------------------
1163 void MApi_JPEG_DisableAddressConvert(void);
1164 //-------------------------------------------------------------------------------------------------
1165 /// This function will get free memory to use.(to be removed).
1166 /// @ingroup JPEG_HW_BUG
1167 /// @param size
1168 /// @return MS_PHYADDR
1169 //-------------------------------------------------------------------------------------------------
1170 MS_PHY MApi_JPEG_GetFreeMemory(MS_U32 size);
1171 //-------------------------------------------------------------------------------------------------
1172 /// Get current data offset(to be removed).
1173 /// @ingroup JPEG_HW_BUG
1174 /// @param void.
1175 /// @return MS_U32: current data offset
1176 //-------------------------------------------------------------------------------------------------
1177 MS_U32 MApi_JPEG_GetDataOffset(void);
1178 
1179 //-------------------------------------------------------------------------------------------------
1180 /// This function will sof offset.(to be removed).
1181 /// @ingroup JPEG_to_be_removed
1182 /// @param void
1183 /// @return MS_U32: offset
1184 //-------------------------------------------------------------------------------------------------
1185 MS_U32 MApi_JPEG_GetSOFOffset(void);
1186 
1187 //-------------------------------------------------------------------------------------------------
1188 /// This function would set NJPD number for MJPEG use
1189 /// @ingroup JPEG_MJPEG
1190 /// @param JPDNum: JPD number
1191 /// @return void.
1192 //-------------------------------------------------------------------------------------------------
1193 void MApi_JPEG_SetNJPDInstance(MS_U8 JPDNum);
1194 JPEG_Result MApi_JPEG_SupportCMYK(MS_BOOL bEnable);
1195 JPEG_Result MApi_JPEG_SupportRGB(MS_BOOL bEnable);
1196 
1197 //-------------------------------------------------------------------------------------------------
1198 /// Enable MHEG5 function(to be removed).
1199 /// @ingroup JPEG_MHEG5
1200 /// @param bEnable \b IN : enable/disable
1201 /// @return void.
1202 //-------------------------------------------------------------------------------------------------
1203 void MApi_JPEG_SetMHEG5(MS_BOOL bEnable);
1204 
1205 #if SUPPORT_MPO_FORMAT
1206 //For MPO
1207 
1208 //-------------------------------------------------------------------------------------------------
1209 /// This function would check if it is MPO format
1210 /// @ingroup JPEG_MPO
1211 /// @param void
1212 /// @return BOOL: MPO:1, not MPO: 0
1213 //-------------------------------------------------------------------------------------------------
1214 MS_BOOL MApi_JPEG_IsMPOFormat(void);
1215 
1216 //-------------------------------------------------------------------------------------------------
1217 /// This function would get MPO index information
1218 /// @ingroup JPEG_MPO
1219 /// @param ppMPOIndex: pointer to MPO index info pointer
1220 /// @return BOOL: ok:1, fail: 0
1221 //-------------------------------------------------------------------------------------------------
1222 MS_BOOL MApi_JPEG_GetMPOIndex(JPEG_MPO_INDEX_INFO **ppMPOIndex);
1223 
1224 //-------------------------------------------------------------------------------------------------
1225 /// This function would get MPO attribute information
1226 /// @ingroup JPEG_MPO
1227 /// @param ppMPOIndex: pointer to MPO attribute info pointer
1228 /// @return BOOL: ok:1, fail: 0
1229 //-------------------------------------------------------------------------------------------------
1230 MS_BOOL MApi_JPEG_GetMPOAttr(MS_U32 image_no, JPEG_MPO_ATTRIBUTE_INFO **ppMPOAttr);
1231 
1232 //-------------------------------------------------------------------------------------------------
1233 /// This function would print MPO information
1234 /// @ingroup JPEG_MPO
1235 /// @param void
1236 /// @return void
1237 //-------------------------------------------------------------------------------------------------
1238 void MApi_JPEG_DumpMPO(void);
1239 
1240 //-------------------------------------------------------------------------------------------------
1241 /// This function would set MPO Buffer information (to be removed)
1242 /// @ingroup JPEG_MPO
1243 /// @param read_offset \b IN : read_offset
1244 /// @param output_start \b IN : output_start
1245 /// @return BOOL: ok:1, fail: 0
1246 //-------------------------------------------------------------------------------------------------
1247 MS_BOOL MApi_JPEG_SetMPOBuffer(MS_U32 read_offset, MS_U32 output_start);
1248 
1249 //-------------------------------------------------------------------------------------------------
1250 /// This function would set MPO max decode resolution(baseline)
1251 /// @ingroup JPEG_MPO
1252 /// @param u16Width \b IN : width
1253 /// @param u16Height \b IN : height
1254 /// @return void
1255 //-------------------------------------------------------------------------------------------------
1256 void MApi_JPEG_SetMPOMaxDecodeResolution(MS_U16 u16Width, MS_U16 u16Height);
1257 
1258 //-------------------------------------------------------------------------------------------------
1259 /// This function would set MPO max decode resolution(progressive)
1260 /// @ingroup JPEG_MPO
1261 /// @param u16ProWidth \b IN : width
1262 /// @param u16ProHeight \b IN : height
1263 /// @return void
1264 //-------------------------------------------------------------------------------------------------
1265 void MApi_JPEG_SetMPOProMaxDecodeResolution(MS_U16 u16ProWidth, MS_U16 u16ProHeight);
1266 #endif
1267 
1268 //-------------------------------------------------------------------------------------------------
1269 /// set verification mode, this API is only for bringup/FPGA use
1270 /// @ingroup JPEG_Debug
1271 /// @param IN : NJPEG_VerificationMode.
1272 /// @return void.
1273 //-------------------------------------------------------------------------------------------------
1274 void MApi_JPEG_SetVerificationMode(NJPEG_VerificationMode VerificationMode);
1275 
1276 //-------------------------------------------------------------------------------------------------
1277 /// get current verification mode, this API is only for bringup/FPGA use
1278 /// @ingroup JPEG_Debug
1279 /// @param void.
1280 /// @return: NJPEG_VerificationMode.
1281 //-------------------------------------------------------------------------------------------------
1282 NJPEG_VerificationMode MApi_JPEG_GetVerificationMode(void);
1283 
1284 //-------------------------------------------------------------------------------------------------
1285 /// print the debug message
1286 /// @ingroup JPEG_Debug
1287 /// @param void.
1288 /// @return void.
1289 //-------------------------------------------------------------------------------------------------
1290 void MApi_NJPD_Debug(void);
1291 
1292 //-------------------------------------------------------------------------------------------------
1293 /// This function would check if it is nJPD or oJPD for MJPEG use
1294 /// @ingroup JPEG_MJPEG
1295 /// @param void
1296 /// @return BOOL: nJPD:1, oJPD: 0
1297 //-------------------------------------------------------------------------------------------------
1298 MS_BOOL MApi_JPEG_IsNJPD(void);
1299 
1300 #ifdef __cplusplus
1301 }
1302 #endif
1303 
1304 //------------------------------------------------------------------------------
1305 #endif // _API_JPEG_H_
1306 //------------------------------------------------------------------------------
1307