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