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