]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ivimm/ipumm.git/blob - extrel/ti/ivahd_codecs/packages/ti/sdo/codecs/jpegvenc/ijpegenc.h
a63545303f5099f1c381e0866819189d94571bb3
[ivimm/ipumm.git] / extrel / ti / ivahd_codecs / packages / ti / sdo / codecs / jpegvenc / ijpegenc.h
1 /*
2 ********************************************************************************
3 * HDVICP2.0 Based JPEG Encoder
4 *
5 * "HDVICP2.0 Based JPEG Encoder" is software module developed for
6 * TI's HDVICP2 based SoCs. This module is capable of encoding a raw image
7 * by compressing it into a JPEG bitstream compliant with ISO/IEC IS 10918-1.
8 * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
9 * ALL RIGHTS RESERVED
10 ********************************************************************************
11 */
12 /**
13 ********************************************************************************
14 * @file      ijpegenc.h
15 *
16 * @brief     JPEG specific interface details
17 *
18 * @author    Pavan Kumar
19 *
20 * @version 0.0 (Dec 2009) : Created the initial version.
21 *
22 * @version 0.1 (Jan 2010):Modified for Functionality requirements[Pavan,Vasudev]
23 *
24 * @version 0.2 (Feb 2010) : Review & Cleanup [Vasudev]
25 *
26 * @version 0.3 (Aug 2010):Debug Trace & error Robustness support added[Vasudev]
27 *
28 * @version 0.4 (Dec 2010) : Added support for error recovery and error 
29 *                           robustness in case of data sync errors[Pavan]
30 *
31 * @version 0.5 (Nov 2011) : Added support for Minimum Quality factor 1 and  
32 *                           Maximum Quality factor 100        [Naidu]
33 *
34 * @version 0.6 (Nov 2011) : Create and Dynamic Default structure are exposed to 
35 *                           Application                       [Naidu]
36 *
37 * @version 0.7 (July 2012) : Added support to change marker position JPEG header
38 *                            [Naidu]
39 *
40 * @version 0.8 (Sep 2012) : Added support for Rate Control and Privacy Masking
41 *                           [Mahantesh]
42 *
43 * @version 2.2 (Dec 2012) : Added another value to IJPEGVENC_RateControlAlgo 
44 *                           enum to support run-time disabling of rate control
45 *                           [Mahantesh]
46 * @version 2.3 (May 2013) : Added error check for \93non-multiple of 16\94 
47 *                           inputBufDesc->imagePitch [Naidu]
48 *                          
49 ********************************************************************************
50 */
52 /* -------------------- compilation control switches -------------------------*/
53 #ifndef JPEGENC_TI_IJPEGVENC_H
54 #define JPEGENC_TI_IJPEGVENC_H
56 /**
57 * Macro for Minimum,maximum & Default Quality Factor
58 **/
59 #define IJPEGVENC_MIN_QUALITY_FACTOR      (1)
60 #define IJPEGVENC_MAX_QUALITY_FACTOR      (100)
61 #define IJPEGVENC_DEFAULT_QUALITY_FACTOR  (50)
63 /** 
64   Maximum number of PMs supported inside the frame.
65 */
66 #define IJPEGVENC_MAX_PM 36
67 /*******************************************************************************
68 *                             INCLUDE FILES
69 *******************************************************************************/
70 /* -------------------- system and platform files ----------------------------*/
71 #include <ti/xdais/ialg.h>
72 #include <ti/xdais/dm/ividenc2.h>
73 #include <ti/xdais/xdas.h>
74 /*--------------------- program files ----------------------------------------*/
76 /*******************************************************************************
77 *  PUBLIC DECLARATIONS Defined here, used elsewhere
78 *******************************************************************************/
79 /*---------------------- data declarations -----------------------------------*/
80 /**
81 ********************************************************************************
82 *  @struct IJPEGVENC_PrivacyMaskingInput  
83 *
84 *  @brief  This structure defines the PM input parameters required by Encoder.
85 *
86 *  @param  listPM : List of regions to be privacy masked with their x and y 
87 *                   co-ordinates
88 *                    
89 *  @param  noOfPrivacyMaskRegions: Number of PMs passed to codec
90 *
91 *  @param  lumaValueForPM : Y pixel value for privacy mask region
92 *
93 *  @param  cbValueForPM   : Cb pixel value for privacy mask region
94 *
95 *  @param  crValueForPM   : Cr pixel value for privacy mask region
96 ********************************************************************************
97 */
98 typedef struct IJPEGVENC_PrivacyMaskingInput{
99   XDM_Rect    listPM[IJPEGVENC_MAX_PM];   
100   XDAS_Int32  noOfPrivacyMaskRegions;
101   XDAS_UInt8  lumaValueForPM;
102   XDAS_UInt8  cbValueForPM;
103   XDAS_UInt8  crValueForPM;
104   XDAS_UInt8  dummy;         
105 }IJPEGVENC_PrivacyMaskingInput;
106 /**
107 ********************************************************************************
108 *  @struct     IJPEGVENC_Obj
110 *  @brief       This structure must be the first field of all JPEGVENC
111 *               instance objects
113 *  @param  fxns : Pointer to Functions which performs all the operations on
114 *                 IJPEGVENC objects.
115 ********************************************************************************
116 */
117 typedef struct IJPEGVENC_Obj {
118   struct IJPEGVENC_Fxns *fxns;
119 } IJPEGVENC_Obj;
120 /**
121 ******************************************************************************** 
122 *  @struct IJPEGVENC_RateControlParams
123 *  @brief  This structure contains all the parameters which controls Rate 
124           Control behavior
126 *  @param  rateControlParamsPreset : 
127           regarded @ IJPEGENC_DynamicParams::rateControlParams
128           This Preset controls the USER_DEFINED vs DEFAULT mode. if User is 
129           not aware about following fields, it should be set as 
130           IJPEGVENC_RATECONTROLPARAMS_DEFAULT
131 *  @param  scalingMatrixPreset  : 
132           ignored @ IJPEGENC_DynamicParams::rateControlParams
133           This Preset controls the USER_DEFINED vs DEFAULT mode. if User is 
134           not aware about following fields, it should be set as 
135           IJPEG_SCALINGMATRIX_DEFAULT
136           
137 *  @param  rcAlgo  : ignored @ IJPEGENC_DynamicParams::rateControlParams
138           This defines the rate control algorithm to be used. Only useful 
139           if IVIDENC2::rateControlPreset is set as IVIDEO_USER_DEFINED
141 *  @param  qpI  : regarded @ IJPEGENC_DynamicParams::rateControlParams
142           Initial Quantization Parameter for I/IDR frames. 
143           Valid Range is [-1, 51]
144           -1 : Auto Initialization else other wise Initial QP.
145           when rateControlPreset = IVIDEO_NONE, this quantization parameter is 
146           used by the whole video frame/field 
148 *  @param  qpMaxI  : regarded @ IJPEGENC_DynamicParams::rateControlParams
149           Maximum Quantization Parameter for I/IDR frame(s). Range [0 , 51]. 
150           Useful to control a minimum quality level
152 *  @param  qpMinI  : regarded @ IJPEGENC_DynamicParams::rateControlParams
153           Minimum Quantization Parameter for I/IDR frame(s). Range [0 , 51]. 
154           Useful to control a maximum bit-rate level
156 *  @param  qpP  : regarded @ IJPEGENC_DynamicParams::rateControlParams
157           Initial Quantization Parameter for P frames. Valid Range is [-1, 51]
158           -1 : Auto Initialization else other wise Initial QP.
159           when rateControlPreset = IVIDEO_NONE, this quantization parameter is 
160           used by the whole video frame/field 
162 *  @param  qpMaxP  : regarded @ IJPEGENC_DynamicParams::rateControlParams
163           Maximum Quantization Parameter for inter frame(s). Range [0 , 51]. 
164           Useful to control a minimum quality level
166 *  @param  qpMinP  : regarded @ IJPEGENC_DynamicParams::rateControlParams
167           Minimum Quantization Parameter for inter frame(s). Range [0 , 51]. 
168           Useful to control a maximum bit-rate level
170 *  @param  qpOffsetB  : regarded @ IJPEGENC_DynamicParams::rateControlParams
171           Offset of B frames Quantization Parameter from P frames. 
172           Valid Range is [-1, 51]
173           -1 : Auto Initialization else other wise user provided offset
174       if after adding the qpOffsetB into qp of P frame it exceeds 51 then
175       it is clipped to 51
176           when rateControlPreset = IVIDEO_NONE, this offset parameter is 
177           used by the whole video frame/field 
179 *  @param  qpMaxB  : regarded @ IJPEGENC_DynamicParams::rateControlParams
180           Maximum Quantization Parameter for B frame(s). Range [0 , 51]. 
181           Useful to control a minimum quality level
183 *  @param  qpMinB  : regarded @ IJPEGENC_DynamicParams::rateControlParams
184           Minimum Quantization Parameter for B frame(s). Range [0 , 51]. 
185           Useful to control a maximum bit-rate level
187 *  @param  allowFrameSkip: regarded @ IJPEGENC_DynamicParams::rateControlParams
188           Controls Frame Skip. 
189           non-zero means frames can be skipped to  achieve target bit-rate 
190           zero means frame can never be skipped
192 *  @param  removeExpensiveCoeff : 
193           regarded @ IJPEGENC_DynamicParams::rateControlParams
194           Flag to Remove high frequency expensive coeffecients 
196 *  @param  chromaQPIndexOffset  : 
197           ignored @ IJPEGENC_DynamicParams::rateControlParams
198           Specifies offset to be added to luma QP for addressing QPC values 
199           table for chroma components. 
200           Valid value is between -12 and 12, (inclusive)
202 *  @param  IPQualityFactor: ignored @ IJPEGENC_DynamicParams::rateControlParams
203           This provides configurality to control I frame Quality wrt to P frame. 
204           Higher Quality factor means I frame quality is given higher 
205           improtance compared to P frame. 
206           Refer IJPEGENC_FrameQualityFactor for possible values
208 *  @param  initialBufferLevel  : 
209           ignored @ IJPEGENC_DynamicParams::rateControlParams
210           Initial Buffer level for HRD compliance. It informs that Hypothtical 
211           decoder can start after how much time. The value taken is the 
212           obsolute value of the HRD buffer size  For example if user want 
213           Hypothtical decoder to start taking out data from HRD buffer after 
214           half second then it should set initialBufferLevel = half of the 
215           HRD buffer size that is programmed. 
216           
217 *  @param  HRDBufferSize : regarded @ IJPEGENC_DynamicParams::rateControlParams
218           Hypothetical Reference Decoder Buffer Size. This size controls the 
219           frame skip  logic of the encoder. for low delay applications this 
220           size should be small. Unit of this variable is bits
222 *  @param  minPicSizeRatio:regarded @ IJPEGENC_DynamicParams::rateControlParams
223                             This ratio is used to compute minimum picture size 
224                             in the following manner, 
225                             minPicSize = averagePicSize >> minPicSizeRatio
226                             allowed values 1 to 4, Setting this to 0 will enable 
227                             encoder chosen ratio.  
228                             Note that this is guided value to rate control to 
229                             determine min picture size and encoder may not 
230                             strictly follow this
231 *  @param  maxPicSizeRatio:regarded @ IJPEGENC_DynamicParams::rateControlParams
232                             To determines ratio for max picture size
233                             This ratio is used to compute maximum picture size 
234                             in the following manner, 
235                             maxPicSize = averagePicSize * maxPicSizeRatio
236                             allowed values 2 to 30.Setting this to 0 and 1 
237                             will enable encoder chosen ratio.  
238                             Note that this is guided value to rate control 
239                             to determine max picture size and encoder may not 
240                             strictly follow this.
242 *  @param  enablePRC     : regarded @ IJPEGENC_DynamicParams::rateControlParams
243                             This flag is used to control allowing PRC in the 
244                             frame
246 *  @param  enablePartialFrameSkip : regarded @ IJPEGENC_DynamicParams::
247                                  rateControlParams
248                             This flag is used to control allowing partial frame  
249                             skip in the frame
250 *  @param  reserved : 16 bit word, kept to not change the foot print
251 *  @param  VBRDuration : During over which statistics during interval are  
252                         collected to switch bit-rate states.Increasing this  
253                         value will make VBR wait for longer time before 
254                         switching bit-rate state
255 *  @param  VBRsensitivity : Specifies the target bitrate used by rate control in 
256                            high complexity state. 
257 *  @param  skipDistributionWindowLength : Number of frames over which the skip  
258                                          frames can be distributed  
259 *  @param  numSkipInDistributionWindow : Number of skips allowed within the 
260                                          distribution window 
261 *  @param  reservedRC
262           Some part is kept reserved to add parameters later without 
263           changing the foot print of  interface memory
265 *  @todo  More parameters to be added : delay (VBV), PRC related etc..
266 ********************************************************************************  
267 */
269 typedef struct IJPEGVENC_RateControlParams {
270   XDAS_Int8  rateControlParamsPreset ;
271   XDAS_Int8  scalingMatrixPreset     ;
272   XDAS_Int8  rcAlgo                  ;
273   XDAS_Int8  qpI                     ;
274   XDAS_Int8  qpMaxI                  ;
275   XDAS_Int8  qpMinI                  ;
276   XDAS_Int8  qpP                     ;
277   XDAS_Int8  qpMaxP                  ;
278   XDAS_Int8  qpMinP                  ;
279   XDAS_Int8  qpOffsetB               ;
280   XDAS_Int8  qpMaxB                  ;
281   XDAS_Int8  qpMinB                  ;
282   XDAS_Int8  allowFrameSkip          ;
283   XDAS_Int8  removeExpensiveCoeff    ;
284   XDAS_Int8  chromaQPIndexOffset     ;
285   XDAS_Int8  IPQualityFactor         ;
286   XDAS_Int32 initialBufferLevel      ;
287   XDAS_Int32 HRDBufferSize           ;
288   XDAS_Int16 minPicSizeRatioI        ; 
289   XDAS_Int16 maxPicSizeRatioI        ; 
290   XDAS_Int16 minPicSizeRatioP        ; 
291   XDAS_Int16 maxPicSizeRatioP        ; 
292   XDAS_Int16 minPicSizeRatioB        ; 
293   XDAS_Int16 maxPicSizeRatioB        ; 
294   XDAS_Int8  enablePRC               ;
295   XDAS_Int8  enablePartialFrameSkip  ;
296   XDAS_Int8  discardSavedBits        ;
297   XDAS_Int8  reserved                ;
298   XDAS_Int32 VBRDuration            ;
299   XDAS_Int8  VBRsensitivity          ;
300   XDAS_Int16 skipDistributionWindowLength;
301   XDAS_Int16 numSkipInDistributionWindow;
302   XDAS_Int8  enableHRDComplianceMode ;
303   XDAS_Int32 frameSkipThMulQ5        ;
304   XDAS_Int32 vbvUseLevelThQ5         ;
305   XDAS_Int32 reservedRC[3]           ; 
307 } IJPEGVENC_RateControlParams ;
309 /**
310 ********************************************************************************
311 *  @struct     IJPEGVENC_Status
313 *  @brief       Status structure defines the parameters that can be changed or
314 *               read during real-time operation of the alogrithm.
316 *  @param videnc2Status : This structure holds all the status parameters for
317 *                         IVIDENC2 Objects
318 ********************************************************************************
319 */
320 typedef struct IJPEGVENC_Status {
321   /*--------------------------------------------------------------------------*/
322   /* Base Class                                                               */
323   /*--------------------------------------------------------------------------*/
324   IVIDENC2_Status videnc2Status;
326   /*--------------------------------------------------------------------------*/
327   /*Debug trace Level : Possible values are 0,1,2,3,4                         */
328   /*--------------------------------------------------------------------------*/
329   XDAS_UInt32 debugTraceLevel;
331   /*--------------------------------------------------------------------------*/
332   /* Number of last frames to log the debug info                              */
333   /*--------------------------------------------------------------------------*/
334   XDAS_UInt32 lastNFramesToLog;
336   /*--------------------------------------------------------------------------*/
337   /* base address of the trace buffer in external memory                      */
338   /*--------------------------------------------------------------------------*/  
339   XDAS_UInt32 * extMemoryDebugTraceAddr;
340   
341   /*--------------------------------------------------------------------------*/
342   /* Size of the trace buffer                                                 */
343   /*--------------------------------------------------------------------------*/    
344   XDAS_UInt32 extMemoryDebugTraceSize;
346   /*--------------------------------------------------------------------------*/
347   /* Extended Error Code0 returned by encoder                                 */
348   /*--------------------------------------------------------------------------*/
349   XDAS_UInt32 extendedErrorCode0;
350   
351   /*--------------------------------------------------------------------------*/
352   /* Extended Error Code1 returned by encoder                                 */
353   /*--------------------------------------------------------------------------*/
354   XDAS_UInt32 extendedErrorCode1;
355   
356   /*--------------------------------------------------------------------------*/
357   /* Extended Error Code2 returned by encoder                                 */
358   /*--------------------------------------------------------------------------*/
359   XDAS_UInt32 extendedErrorCode2;
360   
361   /*--------------------------------------------------------------------------*/
362   /* Extended Error Code3 returned by encoder                                 */
363   /*--------------------------------------------------------------------------*/
364   XDAS_UInt32 extendedErrorCode3;  
365   /*--------------------------------------------------------------------------*/
366   /* Rate control param structure                                             */
367   /*--------------------------------------------------------------------------*/
368   IJPEGVENC_RateControlParams rateControlParams;
369   /*--------------------------------------------------------------------------*/
370   /* Flag to enable Privacy Masking                                           */
371   /*--------------------------------------------------------------------------*/  
372   XDAS_Int32  enablePrivacyMasking;
374 } IJPEGVENC_Status;
376 /**
377 ********************************************************************************
378 *  @struct     IJPEGVENC_Params
380 *  @brief       This structure defines the creation parameters for
381 *               all JPEGVENC objects
383 *  @param  videnc2Params :Create time Parameter structure
385 *  @param  maxThumbnailHSizeApp0:Max Horizontal resolution for APP0
386 *                                   thumbnail
387 *  @param  maxThumbnailVSizeApp0 :Max Vertical resolution for APP0
388 *                                    thumbnail
389 *  @param  maxThumbnailHSizeApp1:Max Horizontal resolution for APP1
390 *                                   thumbnail
391 *  @param  maxThumbnailVSizeApp1 :Max Vertical resolution for APP1
392 *                                    thumbnail
393 *  @param  chm_dc_vlc[12] :Chroma AC codes
394 ********************************************************************************
395 */
396 typedef struct IJPEGVENC_Params {
397   /*--------------------------------------------------------------------------*/
398   /* Base Class                                                               */
399   /*--------------------------------------------------------------------------*/
400   IVIDENC2_Params videnc2Params;
401   
402   /*--------------------------------------------------------------------------*/
403   /* Max Horizontal resolution for APP0 thumbnail                             */
404   /*--------------------------------------------------------------------------*/
405   XDAS_UInt16     maxThumbnailHSizeApp0;
407   /*--------------------------------------------------------------------------*/
408   /* Max Vertical resolution for APP0 thumbnail                               */
409   /*--------------------------------------------------------------------------*/
410   XDAS_UInt16     maxThumbnailVSizeApp0;
411   
412   /*--------------------------------------------------------------------------*/
413   /* Max Horizontal resolution for APP1 thumbnail                             */
414   /*--------------------------------------------------------------------------*/
415   XDAS_UInt16     maxThumbnailHSizeApp1;
417   /*--------------------------------------------------------------------------*/
418   /* Max Vertical resolution for APP0 thumbnail                               */
419   /*--------------------------------------------------------------------------*/
420   XDAS_UInt16     maxThumbnailVSizeApp1;
422   /*--------------------------------------------------------------------------*/
423   /*Debug trace Level                                                         */
424   /*--------------------------------------------------------------------------*/
425   XDAS_UInt32   debugTraceLevel;
427   /*--------------------------------------------------------------------------*/
428   /*History of last N frames                                                  */
429   /*--------------------------------------------------------------------------*/
430   XDAS_UInt32   lastNFramesToLog;  
431   /*--------------------------------------------------------------------------*/
432   /*Marker positions modification                                             */
433   /*--------------------------------------------------------------------------*/
434   XDAS_UInt32   Markerposition;
435   /*--------------------------------------------------------------------------*/
436   /* Rate control param structure                                             */
437   /*--------------------------------------------------------------------------*/
438   IJPEGVENC_RateControlParams rateControlParams;
439   
440 } IJPEGVENC_Params;
442 typedef IVIDENC2_Cmd IJPEGVENC_Cmd;
444 /**
445 ********************************************************************************
446 *  @struct     IJPEGVENC_CustomQuantTables
448 *  @brief      JPEG Encoder Custom Quantization Tables - This structure defines
449 *              the custom quantization tables for both Luma & Chroma that need
450 *              to be passed to the JPEG Encoder. This will be used in the
451 *              Quantization Module.The format is as specified in RFC 2035
452 *              (RTP Payload Format for JPEG-compressed Video) and also in
453 *              Table K.1 & K.2 of JPEG Spec.
455 *              NOTE: The "IJPEGVENC_DynamicParams" structure defined below
456 *              contains a pointer to this structure of type
457 *              "IJPEGVENC_CustomQuantTables" -
458 *              "IJPEGVENC_CustomQuantTables *quantTable".
459 *              This field is used to pass custom Quantization tables to the
460 *              JPEG Encoder.The application just needs to initialize this field
461 *              appropriately.However, if the application wishes to use the
462 *              Standard Quantization Tables,then there are 2 ways of informing
463 *              this to the JPEG Encoder -
464 *             (a) by using the base class only "IJPEGVENC_DynamicParams" and not
465 *                 the extended class "IJPEGVENC_DynamicParams", in which case
466 *                 the size field in the DynamicParams structure should be set to
467 *                 the size of "IJPEGVENC_DynamicParams".
468 *             (b) by using the extended class "IJPEGVENC_DynamicParams", but by
469 *                 setting the field "IJPEGVENC_CustomQuantTables *quantTable" to
470 *                 NULL.
472 *  @param  lumQuantTab :This defines the quantization table for the luma
473 *                       component.
474 *  @param  chmQuantTab :This defines the quantization table for the chroma
475 *                       component.
476 ********************************************************************************
477 */
478 typedef struct IJPEGVENC_CustomQuantTables
480   /*--------------------------------------------------------------------------*/
481   /* The array "lumQuantTab" defines the quantization table for the luma      */
482   /*  component.                                                              */
483   /*--------------------------------------------------------------------------*/
484   XDAS_UInt16 lumQuantTab[64];
486   /*--------------------------------------------------------------------------*/
487   /* The array "chmQuantTab" defines the quantization table for the chroma    */
488   /* component.                                                               */
489   /*--------------------------------------------------------------------------*/
490   XDAS_UInt16 chmQuantTab[64];
492 } IJPEGVENC_CustomQuantTables;
494 /**
495 ********************************************************************************
496 *  @struct     IJPEGVENC_DynamicParams
498 *  @brief       This structure defines the dynamic parameters for
499 *               all JPEGVENC objects
501 *  @param videnc2DynamicParams: IVIDENC2_Dynamic Params
502 *  @param restartInterval     : Restart Interval
503 *  @param qualityFactor       : Quality factor
504 *  @param quantTable          : User Defined Quant Table
505 *  @param rateControlParams   : Rate Control Params
506 *  @param enablePrivacyMasking: Flag to enable Privacy Masking
507 ********************************************************************************
508 */
509 typedef struct IJPEGVENC_DynamicParams {
510   /*--------------------------------------------------------------------------*/
511   /* Base Class                                                               */
512   /*--------------------------------------------------------------------------*/
513   IVIDENC2_DynamicParams videnc2DynamicParams;
514   
515   /*--------------------------------------------------------------------------*/
516   /* restartInterval : Specifies the number of MCUs between RST markers       */
517   /*--------------------------------------------------------------------------*/
518   XDAS_Int32             restartInterval;
520   /*--------------------------------------------------------------------------*/
521   /* qualityFactor : Specifies the quality setting to use for encoding        */
522   /*                 Supported values are from 0 (lowest quality)             */
523   /*                 to 97 (highest quality)                                  */
524   /*--------------------------------------------------------------------------*/
525   XDAS_Int32             qualityFactor;
527   /*--------------------------------------------------------------------------*/
528   /* quantTable : Application should populate the custom quant table in a     */
529   /*              structure of type IJPEGVENC_CustomQuantTables and pass the  */
530   /*              pointer to it here. Set it to NULL if custom quant tables   */
531   /*              are not to be used.                                         */
532   /*--------------------------------------------------------------------------*/
533   IJPEGVENC_CustomQuantTables *quantTable;
534   /*--------------------------------------------------------------------------*/
535   /* Rate control param structure                                             */
536   /*--------------------------------------------------------------------------*/
537   IJPEGVENC_RateControlParams rateControlParams;
538   /*--------------------------------------------------------------------------*/
539   /* Flag to enable Privacy Masking                                           */
540   /*--------------------------------------------------------------------------*/
541   XDAS_UInt32             enablePrivacyMasking;
542   
543 } IJPEGVENC_DynamicParams;
545 /**
546 ********************************************************************************
547 *  @struct     IJPEGVENC_InArgs
549 *  @brief       This structure defines the runtime input arguments
550 *               for IJPEGVENC::process
552 *  @param videnc2InArgs            : IVIDENC2_InArgs
553 *  @param APPN0                    : APP0 thumbnail Buffer
554 *  @param thumbnailIndexApp0       : JFIF Thumbnail Enable
555 *  @param APPN1                    : APP1 thumbnail Buffer
556 *  @param thumbnailIndexApp1       : EXIF Thumbnail Enable
557 *  @param Comment                  : Comment Data
558 *  @param pmInputParams            : Privacy Masking Params
559 ********************************************************************************
560 */
562 typedef struct IJPEGVENC_InArgs {
563   /*--------------------------------------------------------------------------*/
564   /* Base Class                                                               */
565   /*--------------------------------------------------------------------------*/
566   IVIDENC2_InArgs videnc2InArgs;
567   
568   /*--------------------------------------------------------------------------*/
569   /* APPN0 : buffer holding the data for APP-0 Marker                         */
570   /*--------------------------------------------------------------------------*/
571   XDM2_SingleBufDesc  APPN0;
573   /*--------------------------------------------------------------------------*/
574   /* thumbnailIndexApp0 :                                                     */
575   /*--------------------------------------------------------------------------*/
576   XDAS_UInt16    thumbnailIndexApp0;
578   /*--------------------------------------------------------------------------*/
579   /* APPN1 : buffer holding the data for APP-1 Marker                         */
580   /*--------------------------------------------------------------------------*/
581   XDM2_SingleBufDesc  APPN1;
583   /*--------------------------------------------------------------------------*/
584   /* Thumbnail_Index_App0 :                                                   */
585   /*--------------------------------------------------------------------------*/
586   XDAS_UInt16    thumbnailIndexApp1;
588   /*--------------------------------------------------------------------------*/
589   /* Comment : buffer holding the data for comment Marker                     */
590   /*--------------------------------------------------------------------------*/
591   XDM2_SingleBufDesc  Comment;
592   
593   /*--------------------------------------------------------------------------*/
594   /* Privacy Masking Params                                                   */
595   /*--------------------------------------------------------------------------*/
596   IJPEGVENC_PrivacyMaskingInput pmInputParams;
598 } IJPEGVENC_InArgs;
600 /**
601 ********************************************************************************
602 *  @struct     IJPEGVENC_OutArgs
604 *  @brief  This structure defines the runtime output arguments
605 *          for IJPEGVENC::process
607 *  @param  videnc2OutArgs : This structure contains run time output arguments 
608 *                           for all IVIDENC2 instance objects
609 *  @param  vbvBufferLevel : This varible tells the buffer level at the end
610 *                           of every picture from decoder perspective.
611 ********************************************************************************
612 */
614 typedef struct IJPEGVENC_OutArgs {
615   IVIDENC2_OutArgs videnc2OutArgs;
616   XDAS_Int32 vbvBufferLevel;
617 } IJPEGVENC_OutArgs;
619 /**
620 ********************************************************************************
621 *  @struct     IJPEGVENC_Fxns
623 *  @brief       This structure defines all of the operations on
624 *               JPEGVENC objects.
625 *  @param ividenc : Pointer to Functions which performs all the operations on
626 *                   IVIDENC2 objects.
627 ********************************************************************************
628 */
629 typedef struct IJPEGVENC_Fxns {
630   IVIDENC2_Fxns ividenc;
631 } IJPEGVENC_Fxns;
633 /**
634  * The error codes correspond to the 32-bit extended error parameter passed 
635  * through outargs and get sttus. The error have been categorised to the below 
636  * 32 groups and the respective bit is set on error occurrence.
637  */
638 typedef enum
640   IJPEGVENC_ERR_UNSUPPORTED_VIDENC2PARAMS = 0,
641   IJPEGVENC_ERR_UNSUPPORTED_VIDENC2DYNAMICPARAMS,            
642   IJPEGVENC_ERR_UNSUPPORTED_JPEGENCDYNAMICPARAMS,              
643   IJPEGVENC_ERR_IMPROPER_DATASYNC_SETTING,      
644   IJPEGVENC_ERR_NOSLICE,     
645   IJPEGVENC_ERR_SLICEHDR,            
646   IJPEGVENC_ERR_MBDATA,            
647   IJPEGVENC_ERR_UNSUPPFEATURE,     
648   IJPEGVENC_ERR_STREAM_END = 16,            
649   IJPEGVENC_ERR_INVALID_MBOX_MESSAGE,    
650   IJPEGVENC_ERR_HDVICP_RESET,
651   IJPEGVENC_ERR_HDVICP_WAIT_NOT_CLEAN_EXIT,
652   IJPEGVENC_ERR_IRES_RESHANDLE,
653   IJPEGVENC_ERR_STANDBY,
655   /* Error Codes for Data Sync */
656   IJPEGVENC_ERR_INPUT_DATASYNC,
657   IJPEGVENC_ERR_OUTPUT_DATASYNC,
658   
659   IJPEG_ERR_PRIVACY_MASKING_PARAMS,
660   IJPEG_ERR_RATECONTROLPARAMS
661 }IJPEGVENC_ExtendedErrorCodes;
663 /**
664  * The enum corresponds to the 4 32-bit words used to pass the error codes to 
665  * the application in the extended parameters of status stucture through the 
666  * getstatus command. Each bit is set for an error which falls under one of 
667  * the groups in the outargs 32 bvits.
668  */
669 typedef enum
671   JPEG_DYNAMIC_PARAMS_HANDLE_ERROR = 0,
672   JPEG_STATUS_HANDLE_ERROR,
673   JPEG_DYNAMIC_PARAMS_SIZE_ERROR,
674   JPEG_ENCODE_HEADER_ERROR,
675   JPEG_UNSUPPORTED_RESOLUTION,
676   JPEG_CAPTURE_WIDTH_ERROR,
677   JPEG_GET_DATA_FXN_NULL_POINTER,
678   JPEG_GET_BUFFER_FXN_NULL_POINTER,
679   JPEG_INVALID_RESTART_INTERVAL_ERROR,
680   JPEG_INVALID_QUALITY_FACTOR_ERROR,
681   JPEG_INVALID_INPUT_CHROMA_FORMAT_ERROR,
682   JPEG_NULL_QUANT_TABLE_POINTER_ERROR,
683   JPEG_NULL_INARGS_POINTER_ERROR,
684   JPEG_NULL_INARGS_APP_POINTER_ERROR,
685   JPEG_INARGS_SIZE_ERROR,
686   JPEG_INVALID_INPUT_BYTES_ERROR,
687   JPEG_INVALID_INPUT_ID_ERROR,
688   JPEG_NULL_INPUT_BUF_DESC_ERROR,
689   JPEG_NULL_INPUT_BUFFER_POINTER_ERROR,
690   JPEG_INVALID_INPUT_BUFFER_SIZE_ERROR,
691   JPEG_INVALID_NUM_OF_INPUT_BUFFERS_ERROR,
692   JPEG_INVALID_INPUT_BUFFER_MEMTYPE_ERROR,
693   JPEG_INVALID_OUTPUT_BUFFER_MEMTYPE_ERROR,
694   JPEG_NULL_OUTARGS_POINTER_ERROR,
695   JPEG_INVALID_OUTARGS_SIZE,
696   JPEG_NULL_OUTPUT_BUF_DESC_ERROR,
697   JPEG_NULL_OUTPUT_BUFFER_POINTER_ERROR,
698   JPEG_INVALID_OUTPUT_BUFFER_SIZE_ERROR,
699   JPEG_INVALID_NUM_OF_OUTPUT_BUFFERS_ERROR,
700   JPEG_INSUFFICIENT_OUTPUT_BUFFER_SIZE_ERROR,
701   JPEG_INVALID_JFIF_THUMBNAIL_ENABLE_ERROR,
702   JPEG_INVALID_EXIF_THUMBNAIL_ENABLE_ERROR,
703   JPEG_INPUT_BUFFER_POINTER_ALIGN_ERROR,
704   
705   /* Extended Error Codes related to Data Sync */
706   JPEG_DATASYNC_GET_ROW_DATA_ERROR, /* from 33rd bit*/
707   
708   JPEG_DATASYNC_INVALID_RESTART_INTERVAL_ERROR,
709   
710   JPEG_DATASYNC_BLOCK_POINTER_ERROR,
711   JPEG_DATASYNC_BLOCK_SIZE_ERROR,
712   JPEG_DATASYNC_INVALID_BLOCKS_ERROR,
713   JPEG_DATASYNC_NOT_VALID_COMBINATION_ERROR,
714   JPEG_INVALID_IMAGEPITCH
715 }IjpegVENC_ErrorStatus;
717 /**
718   @enum   IJPEGVENC_RateControlParamsPreset
719   @brief  These enumerations control the RateControl Params  
720 */
722 typedef enum
724   IJPEGVENC_RATECONTROLPARAMS_DEFAULT     = 0 , 
725       /**< Default Rate Control params */
726   IJPEGVENC_RATECONTROLPARAMS_USERDEFINED = 1 , 
727       /**< User defined Rate Control params */
728   IJPEGVENC_RATECONTROLPARAMS_EXISTING    = 2 , 
729       /**< Keep the Rate Control params as existing. This is 
730       * useful because during control call if user don't want 
731       * to change the Rate Control Params
732       */
733   IJPEGVENC_RATECONTROLPARAMS_MAX
735 } IJPEGVENC_RateControlParamsPreset;
737 /**
738   @enum   IJPEGVENC_PrivacyMaskingInputParams
739   @brief  These enumerations control the Privacy Masking Params  
740 */
741 typedef enum
743   IJPEGVENC_PRIVACYMASKING_DISABLE = 0,
744   /**< Disable Privacy Masking */
745   IJPEGVENC_PRIVACYMASKING_ENABLE
746   /**< Enable Privacy Masking  */
747 }IJPEGVENC_PrivacyMaskingInputParams;
749 /**
750   
751   @enum   IJPEGVENC_RateControlAlgo
752   @brief  These enumerations control the type of rateControl algo to be picked
753           up by encoder. Only useful if IVIDENC2::rateControlPreset is set as 
754           IVIDEO_USER_DEFINED
755   
756 */
757 typedef enum
759   IJPEGVENC_RATECONTROL_VBR_STORAGE       = 0 ,        
760   /** VBR - Storage Rate Control   */
761   IJPEGVENC_RATECONTROL_CBR_LOW_DELAY     = 1 ,        
762   /** CBR - Low Delay Rate Control */
763   IJPEGVENC_RATECONTROL_DISABLE           = 2
764   /** Disable Rate Control */  
765 } IJPEGVENC_RateControlAlgo;
766 /**
767 ******************************************************************************
768  *  ======== IJPEGVENC_DynamicParams ========
769  *  Default Create parameter values for JPEGVENC instance objects
770 ********************************************************************************
771 */
772 extern const IJPEGVENC_DynamicParams JPEGVENC_TI_DYNAMICPARAMS;
773 /**
774 ******************************************************************************
775  *  ======== IJPEGVENC_Params ========
776  *  Default DynamicParams values for JPEGVENC instance objects
777 ********************************************************************************
778 */
779 extern const IJPEGVENC_Params JPEGVENC_TI_PARAMS;
781 /*******************************************************************************
782 *  PRIVATE DECLARATIONS Defined here, used only here
783 *******************************************************************************/
784 /*---------------------- data declarations -----------------------------------*/
786 /*---------------------- function prototypes ---------------------------------*/
788 #endif /*#ifndef JPEGENC_TI_IJPEGVENC_H*/