OMX_JpegEnc_Utils.h revision d8b67d87f24cb14a2550934992536d7840008276
1/*
2 * Copyright (C) Texas Instruments - http://www.ti.com/
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 * Lesser General Public License for more details.
14 *
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19 */
20/* =============================================================================
21* Done            Texas Instruments OMAP(TM) Platform Software
22*  (c) Copyright Texas Instruments, Incorporated.  All Rights Reserved.
23*
24*  Use of this software is controlled by the terms and conditions found
25*  in the license agreement under which this software has been supplied.
26* ============================================================================ */
27/**
28* @file OMX_JpegEnc_Utils.h
29*
30* This is a header file for a JPEG encoder that is fully
31* compliant with the OMX Image specification.
32* This the file that the application that uses OMX would include
33* in its code.
34*
35* @path  $(CSLPATH)\inc
36*
37* @rev  0.1
38*/
39/* -------------------------------------------------------------------------------- */
40/* ================================================================================
41*!
42*! Revision History
43*! ===================================
44*!
45*! 22-May-2006 mf: Revisions appear in reverse chronological order;
46*! that is, newest first.  The date format is dd-Mon-yyyy.
47* ================================================================================= */
48
49#ifndef OMX_JPEGENC_UTILS__H
50#define OMX_JPEGENC_UTILS__H
51#include <OMX_Component.h>
52#include <OMX_IVCommon.h>
53
54
55#ifndef UNDER_CE
56#include <dlfcn.h>
57#endif
58#include "LCML_DspCodec.h"
59#include "LCML_Types.h"
60#include "LCML_CodecInterface.h"
61#include <pthread.h>
62#include <stdarg.h>
63#include <OMX_Core.h>
64#include <OMX_Types.h>
65#include <OMX_Image.h>
66#include<OMX_TI_Common.h>
67#include <OMX_TI_Debug.h>
68#ifdef RESOURCE_MANAGER_ENABLED
69#include <ResourceManagerProxyAPI.h>
70#endif
71#include "OMX_JpegEnc_CustomCmd.h"
72
73
74#ifdef __PERF_INSTRUMENTATION__
75#include "perf.h"
76#endif
77
78#define OMX_JPEGENC_NonMIME 1
79#define OMX_NOPORT 0xFFFFFFFE
80#define JPEGE_TIMEOUT (100000)
81#define NUM_OF_PORTS  2
82#define NUM_OF_BUFFERSJPEG 4
83
84#define MAX_INPARAM_SIZE 1024
85
86#define COMP_MAX_NAMESIZE 127
87
88#define OMX_CustomCommandStopThread (OMX_CommandMax - 1)
89#define PADDING_128_BYTE 128
90#define PADDING_256_BYTE 256
91
92
93#ifdef UNDER_CE
94    #include <oaf_debug.h>
95#endif
96
97#define KHRONOS_1_1
98
99#ifndef FUNC
100#define FUNC 1
101#endif
102
103#ifdef RESOURCE_MANAGER_ENABLED
104#define JPEGENC1MPImage 1000000
105#define JPEGENC2MPImage 2000000
106#endif
107
108#define DSP_MMU_FAULT_HANDLING
109
110/*Linked List */
111
112typedef struct Node {
113    struct Node *pNextNode;
114    void *pValue;
115} Node;
116
117typedef struct LinkedList {
118    Node *pRoot;
119    pthread_mutex_t lock;
120}   LinkedList;
121
122LinkedList AllocList;
123
124void LinkedList_Create(LinkedList *LinkedList);
125void LinkedList_AddElement(LinkedList *LinkedList, void *pValue);
126void LinkedList_FreeElement(LinkedList *LinkedList, void *pValue);
127void LinkedList_FreeAll(LinkedList *LinkedList);
128void LinkedList_DisplayAll(LinkedList *LinkedList);
129void LinkedList_Destroy(LinkedList *LinkedList);
130
131/*
132 *     M A C R O S
133 */
134
135#define OMX_CONF_INIT_STRUCT(_s_, _name_)   \
136    memset((_s_), 0x0, sizeof(_name_)); \
137    (_s_)->nSize = sizeof(_name_);      \
138    (_s_)->nVersion.s.nVersionMajor = 0x1;  \
139    (_s_)->nVersion.s.nVersionMinor = 0x0;  \
140    (_s_)->nVersion.s.nRevision = 0x0;      \
141    (_s_)->nVersion.s.nStep = 0x0
142
143#define OMX_CHECK_PARAM(_ptr_)  \
144{   \
145    if(!_ptr_) {    \
146    eError = OMX_ErrorBadParameter; \
147    goto EXIT; \
148    }   \
149}
150
151#define OMX_CONF_SET_ERROR_BAIL(_eError, _eCode)\
152{                       \
153    _eError = _eCode;               \
154    goto OMX_CONF_CMD_BAIL;         \
155}
156
157#define OMX_MALLOC(_pStruct_, _size_)   \
158    _pStruct_ = malloc(_size_);  \
159    if(_pStruct_ == NULL){  \
160        eError = OMX_ErrorInsufficientResources;    \
161        goto EXIT;  \
162    } \
163    memset(_pStruct_, 0, _size_);\
164    LinkedList_AddElement(&AllocList, _pStruct_);
165
166#define OMX_FREE(_ptr)   \
167{                     \
168    if (_ptr != NULL) { \
169        LinkedList_FreeElement(&AllocList, _ptr);\
170        _ptr = NULL; \
171    }                \
172}
173
174#define OMX_FREEALL()   \
175{                     \
176        LinkedList_FreeAll(&AllocList);\
177}
178
179#define OMX_MEMCPY_CHECK(_p_)\
180{\
181    if (_p_ == NULL) { \
182    eError = OMX_ErrorInsufficientResources;  \
183    goto EXIT;   \
184    } \
185}
186
187
188#ifdef RESOURCE_MANAGER_ENABLED
189#define OMX_GET_RM_VALUE(_Res_, _RM_, _dbg_) \
190{   \
191    if ((_Res_) <= JPEGENC1MPImage){  \
192        (_RM_) = 30;  \
193        }   \
194    else {  \
195        (_RM_) = 60;  \
196        }   \
197    \
198        \
199    OMX_PRMGR2((_dbg_), "Value in MHz requested to RM = %d\n", (_RM_)); \
200}
201#endif
202
203typedef struct IDMJPGE_TIGEM_Comment {
204  OMX_U8 comment[256];
205  OMX_U16 commentLen;
206} IDMJPGE_TIGEM_Comment;
207
208
209typedef struct IIMGENC_DynamicParams {
210    OMX_U32 nSize;             /* nSize of this structure */
211    OMX_U32 nNumAU;            /* Number of Access unit to encode,
212                                  * set to XDM_DEFAULT in case of entire frame
213                                  */
214    OMX_U32 nInputChromaFormat;/* Input chroma format, Refer above comments regarding chroma                    */
215    OMX_U32 nInputHeight;       /* Input nHeight*/
216    OMX_U32 nInputWidth;        /* Input nWidth*/
217    OMX_U32 nCaptureWidth;      /* 0: use imagewidth as pitch, otherwise:
218                                   * use given display nWidth (if > imagewidth)
219                                   * for pitch.
220                                   */
221    OMX_U32 nGenerateHeader;    /* XDM_ENCODE_AU or XDM_GENERATE_HEADER */
222    OMX_U32 qValue;            /* Q value compression factor for encoder */
223} IIMGENC_DynamicParams;
224
225
226  typedef struct IDMJPGE_TIGEM_CustomQuantTables
227  {
228    /* The array "lum_quant_tab" defines the quantization table for the luma component. */
229    OMX_U16 lum_quant_tab[64];
230    /* The array "chm_quant_tab" defines the quantization table for the chroma component.  */
231    OMX_U16 chm_quant_tab[64];
232  } IDMJPGE_TIGEM_CustomQuantTables;
233
234
235typedef struct IDMJPGE_TIGEM_DynamicParams {
236    IIMGENC_DynamicParams  params;
237    OMX_U32 captureHeight;       /* if set to 0 use image height
238                                     else should set to actual Image height */
239    OMX_U32 DRI_Interval ;
240    JPEGENC_CUSTOM_HUFFMAN_TABLE *huffmanTable;
241    IDMJPGE_TIGEM_CustomQuantTables *quantTable;
242} IDMJPGE_TIGEM_DynamicParams;
243
244/* PPLIB not needed if the the input to jpeg encoder is yuv. Uncomment the next line if PPLIB is needed */
245/* #define __JPEG_OMX_PPLIB_ENABLED__ */
246
247#ifdef __JPEG_OMX_PPLIB_ENABLED__
248#define OMX_JPEGENC_NUM_DLLS (5)
249#else
250#define OMX_JPEGENC_NUM_DLLS (4)
251#endif
252
253
254#ifdef UNDER_CE
255#define JPEG_ENC_NODE_DLL "/windows/jpegenc_sn.dll64P"
256#define JPEG_COMMON_DLL "/windows/usn.dll64P"
257#define USN_DLL "/windows/usn.dll64P"
258#define CONVERSIONS_DLL "/windows/conversions.dll64P"
259	#ifdef __JPEG_OMX_PPLIB_ENABLED__
260		#define PPLIB_DLL "/windows/postprocessor_dualout.dll64P"
261	#endif
262#else
263#define JPEG_ENC_NODE_DLL "jpegenc_sn.dll64P"
264#define JPEG_COMMON_DLL "usn.dll64P"
265#define USN_DLL "usn.dll64P"
266#define CONVERSIONS_DLL "conversions.dll64P"
267	#ifdef __JPEG_OMX_PPLIB_ENABLED__
268		#define PPLIB_DLL "postprocessor_dualout.dll64P"
269	#endif
270#endif
271
272#define JPGENC_SNTEST_STRMCNT          2
273#define JPGENC_SNTEST_INSTRMID         0
274#define JPGENC_SNTEST_OUTSTRMID        1
275#define JPGENC_SNTEST_ARGLENGTH        20
276#define JPGENC_SNTEST_INBUFCNT         4
277#define JPGENC_SNTEST_OUTBUFCNT        4
278#define JPGENC_SNTEST_MAX_HEIGHT       4096
279#define JPGENC_SNTEST_MAX_WIDTH        4096
280#define JPGENC_SNTEST_PROG_FLAG        1
281#define M_COM   0xFE            /* COMment  */
282
283#define JPEGE_DSPSTOP       0x01
284#define JPEGE_BUFFERBACK    0x02
285#define JPEGE_IDLEREADY     ( JPEGE_DSPSTOP | JPEGE_BUFFERBACK )
286
287typedef enum Content_Type
288{
289    APP0_BUFFER = 0,
290    APP1_BUFFER,
291    APP13_BUFFER,
292    COMMENT_BUFFER,
293    APP0_NUMBUF,
294    APP1_NUMBUF,
295    APP13_NUMBUF,
296    COMMENT_NUMBUF,
297    APP0_THUMB_H,
298    APP0_THUMB_W,
299    APP1_THUMB_H,
300    APP1_THUMB_W,
301    APP13_THUMB_H,
302    APP13_THUMB_W,
303    APP0_THUMB_INDEX,
304    APP1_THUMB_INDEX,
305    APP13_THUMB_INDEX,
306    DYNPARAMS_HUFFMANTABLE,
307    DYNPARAMS_QUANTTABLE,
308    APP5_BUFFER,
309    APP5_NUMBUF,
310    APP5_THUMB_H,
311    APP5_THUMB_W,
312    APP5_THUMB_INDEX
313} Content_Type;
314
315/*This enum must not be changed.  */
316typedef enum JPEG_PORT_TYPE_INDEX
317    {
318    JPEGENC_INP_PORT,
319    JPEGENC_OUT_PORT
320}JPEG_PORT_TYPE_INDEX;
321
322typedef enum JPEGENC_BUFFER_OWNER {
323    JPEGENC_BUFFER_CLIENT = 0x0,
324    JPEGENC_BUFFER_COMPONENT_IN,
325    JPEGENC_BUFFER_COMPONENT_OUT,
326    JPEGENC_BUFFER_DSP,
327    JPEGENC_BUFFER_TUNNEL_COMPONENT
328} JPEGENC_BUFFER_OWNER;
329
330typedef struct _JPEGENC_BUFFERFLAG_TRACK {
331    OMX_U32 flag;
332    OMX_U32 buffer_id;
333    OMX_HANDLETYPE hMarkTargetComponent;
334    OMX_PTR pMarkData;
335} JPEGENC_BUFFERFLAG_TRACK;
336
337typedef struct _JPEGENC_BUFFERMARK_TRACK {
338    OMX_U32 buffer_id;
339    OMX_HANDLETYPE hMarkTargetComponent;
340    OMX_PTR pMarkData;
341} JPEGENC_BUFFERMARK_TRACK;
342
343typedef struct JPEGENC_BUFFER_PRIVATE {
344    OMX_BUFFERHEADERTYPE* pBufferHdr;
345    JPEGENC_BUFFER_OWNER eBufferOwner;
346    OMX_BOOL bAllocByComponent;
347    OMX_BOOL bReadFromPipe;
348} JPEGENC_BUFFER_PRIVATE;
349
350typedef struct JPEG_PORT_TYPE   {
351    OMX_HANDLETYPE hTunnelComponent;
352    OMX_U32 nTunnelPort;
353    JPEGENC_BUFFER_PRIVATE* pBufferPrivate[NUM_OF_BUFFERSJPEG];
354    JPEGENC_BUFFERFLAG_TRACK sBufferFlagTrack[NUM_OF_BUFFERSJPEG];
355    JPEGENC_BUFFERMARK_TRACK sBufferMarkTrack[NUM_OF_BUFFERSJPEG];
356    OMX_PARAM_PORTDEFINITIONTYPE* pPortDef;
357    OMX_BUFFERSUPPLIERTYPE pBufSupplier;
358    OMX_PARAM_BUFFERSUPPLIERTYPE* pParamBufSupplier;
359    OMX_IMAGE_PARAM_PORTFORMATTYPE* pPortFormat;
360    OMX_U8 nBuffCount;
361}JPEG_PORT_TYPE;
362
363typedef struct JPEGE_INPUT_PARAMS {
364    OMX_U32 *pInParams;
365    OMX_U32 size;
366} JPEGE_INPUT_PARAMS;
367
368typedef struct _JPEGENC_CUSTOM_PARAM_DEFINITION {
369    OMX_U8 cCustomParamName[128];
370    OMX_INDEXTYPE nCustomParamIndex;
371} JPEGENC_CUSTOM_PARAM_DEFINITION;
372
373typedef struct JPEGENC_COMPONENT_PRIVATE
374{
375    JPEG_PORT_TYPE* pCompPort[NUM_OF_PORTS];
376    OMX_PORT_PARAM_TYPE* pPortParamType;
377    OMX_PORT_PARAM_TYPE* pPortParamTypeAudio;
378    OMX_PORT_PARAM_TYPE* pPortParamTypeVideo;
379    OMX_PORT_PARAM_TYPE* pPortParamTypeOthers;
380    OMX_PRIORITYMGMTTYPE* pPriorityMgmt;
381    OMX_CALLBACKTYPE cbInfo;
382    OMX_IMAGE_PARAM_QFACTORTYPE* pQualityfactor;
383    OMX_CONFIG_RECTTYPE  *pCrop;
384    /** This is component handle */
385    OMX_COMPONENTTYPE* pHandle;
386    /*Comonent Name& Version*/
387    OMX_STRING cComponentName;
388    OMX_VERSIONTYPE ComponentVersion;
389    OMX_VERSIONTYPE SpecVersion;
390
391    /** Current state of this component */
392    OMX_STATETYPE   nCurState;
393    OMX_STATETYPE   nToState;
394    OMX_U8          ExeToIdleFlag;  /* StateCheck */
395
396    OMX_U32 nInPortIn;
397    OMX_U32 nInPortOut;
398    OMX_U32 nOutPortIn;
399    OMX_U32 nOutPortOut;
400    OMX_BOOL bInportDisableIncomplete;
401    OMX_BOOL bOutportDisableIncomplete;
402    OMX_BOOL bSetLumaQuantizationTable;
403    OMX_BOOL bSetChromaQuantizationTable;
404    OMX_BOOL bSetHuffmanTable;
405    OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE *pCustomLumaQuantTable;
406    OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE *pCustomChromaQuantTable;
407    JPEGENC_CUSTOM_HUFFMANTTABLETYPE *pHuffmanTable;
408
409
410    /** The component thread handle */
411    pthread_t ComponentThread;
412    /** The pipes to maintain free buffers */
413    int free_outBuf_Q[2];
414    /** The pipes to maintain input buffers sent from app*/
415    int filled_inpBuf_Q[2];
416    /** The pipes for sending buffers to the thread */
417    int nCmdPipe[2];
418    int nCmdDataPipe[2];
419    OMX_U32 nApp_nBuf;
420    short int nNum_dspBuf;
421    int nCommentFlag;
422    OMX_U8 *pString_Comment;
423    JPEG_APPTHUMB_MARKER sAPP0;
424    JPEG_APPTHUMB_MARKER sAPP1;
425    JPEG_APPTHUMB_MARKER sAPP5;
426    JPEG_APP13_MARKER sAPP13;
427    JPEGE_INPUT_PARAMS InParams;
428#ifdef __JPEG_OMX_PPLIB_ENABLED__
429    OMX_U32 *pOutParams;
430#endif
431#ifdef RESOURCE_MANAGER_ENABLED
432    RMPROXY_CALLBACKTYPE rmproxyCallback;
433#endif
434    OMX_BOOL bPreempted;
435    int nFlags;
436    int nMarkPort;
437    OMX_PTR pMarkData;
438    OMX_HANDLETYPE hMarkTargetComponent;
439    OMX_BOOL bDSPStopAck;
440   OMX_BOOL bFlushComplete;
441    OMX_BOOL bAckFromSetStatus;
442    void* pLcmlHandle;   /* Review Utils.c */
443    int isLCMLActive;
444    LCML_DSP_INTERFACE* pLCML;
445    void * pDllHandle;
446    OMX_U8 nDRI_Interval;
447#ifdef KHRONOS_1_1
448    OMX_PARAM_COMPONENTROLETYPE componentRole;
449#endif
450    IDMJPGE_TIGEM_DynamicParams *pDynParams;
451
452    pthread_mutex_t jpege_mutex;
453    pthread_cond_t  stop_cond;
454    pthread_cond_t  flush_cond;
455    /* pthread_cond_t  control_cond; */
456    pthread_mutex_t jpege_mutex_app;
457    pthread_cond_t  populate_cond;
458    pthread_cond_t  unpopulate_cond;
459
460
461#ifdef __PERF_INSTRUMENTATION__
462    PERF_OBJHANDLE pPERF, pPERFcomp;
463#endif
464    struct OMX_TI_Debug dbg;
465
466    /* Reference count for pending state change requests */
467    OMX_U32 nPendingStateChangeRequests;
468    pthread_mutex_t mutexStateChangeRequest;
469    pthread_cond_t StateChangeCondition;
470
471
472} JPEGENC_COMPONENT_PRIVATE;
473
474
475OMX_ERRORTYPE HandleJpegEncCommand (JPEGENC_COMPONENT_PRIVATE *pComponentPrivate, OMX_U32 nParam1);
476OMX_ERRORTYPE JpegEncDisablePort(JPEGENC_COMPONENT_PRIVATE *pComponentPrivate, OMX_U32 nParam1);
477OMX_ERRORTYPE JpegEncEnablePort(JPEGENC_COMPONENT_PRIVATE *pComponentPrivate, OMX_U32 nParam1);
478OMX_ERRORTYPE HandleJpegEncCommandFlush(JPEGENC_COMPONENT_PRIVATE *pComponentPrivate, OMX_U32 nParam1);
479OMX_ERRORTYPE JPEGEnc_Start_ComponentThread(OMX_HANDLETYPE pHandle);
480OMX_ERRORTYPE HandleJpegEncDataBuf_FromApp(JPEGENC_COMPONENT_PRIVATE *pComponentPrivate );
481OMX_ERRORTYPE HandleJpegEncDataBuf_FromDsp( JPEGENC_COMPONENT_PRIVATE *pComponentPrivate, OMX_BUFFERHEADERTYPE* pBuffHead );
482OMX_ERRORTYPE HandleJpegEncFreeDataBuf( JPEGENC_COMPONENT_PRIVATE *pComponentPrivate, OMX_BUFFERHEADERTYPE* pBuffHead );
483OMX_ERRORTYPE HandleJpegEncFreeOutputBufferFromApp( JPEGENC_COMPONENT_PRIVATE *pComponentPrivate );
484OMX_ERRORTYPE AllocJpegEncResources( JPEGENC_COMPONENT_PRIVATE *pComponentPrivate );
485OMX_ERRORTYPE JPEGEnc_Free_ComponentResources(JPEGENC_COMPONENT_PRIVATE *pComponentPrivate);
486OMX_ERRORTYPE Fill_JpegEncLCMLInitParams(LCML_DSP *lcml_dsp, OMX_U16 arr[], OMX_HANDLETYPE pComponent);
487OMX_ERRORTYPE GetJpegEncLCMLHandle(OMX_HANDLETYPE pComponent);
488OMX_ERRORTYPE SetJpegEncInParams(JPEGENC_COMPONENT_PRIVATE *pComponentPrivate);
489OMX_ERRORTYPE SendDynamicParam(JPEGENC_COMPONENT_PRIVATE *pComponentPrivate);
490OMX_BOOL IsTIOMXComponent(OMX_HANDLETYPE hComp);
491
492#ifdef __JPEG_OMX_PPLIB_ENABLED__
493#define JPEGENC_PPLIB_CREATEPARAM_SIZE 28
494#define JPEGENC_PPLIB_DYNPARM_SIZE 252
495OMX_ERRORTYPE SendDynamicPPLibParam(JPEGENC_COMPONENT_PRIVATE *pComponentPrivate,OMX_U32 *ptInputParam);
496
497
498
499typedef struct _PPLIB_UALGRunTimeParam_t
500{
501    OMX_U32 size;                            /**< Size of the structure in bytes. */
502    OMX_U32 ulInWidth;                       /**< Input picture buffer width.  This value should be the same as the original decoded output width of the WMV9/VC1 stream. */
503    OMX_U32 ulInHeight;                      /**< Input picture buffer height.  This value should be the same as the original decoded output height of the WMV9/VC1 stream. */
504    OMX_U32 ulFrameEnabled[2];               /**< It is possible to run the VGPOP twice with two separate sets of configuration parameters using PPLIB.  This parameter specifies whether each set of configuration parameters is to be used when running PPLIB for this particular frame. */
505    OMX_U32 ulEnableYUVOutput[2];            /**< Flag to enable YUV output */
506    OMX_U32 ulEnableRGBOutput[2];            /**< Flag to enable RGB output. */
507    OMX_U32 ulFrameInputStartYOffset[2];     /**< Offset from the start of the input buffer where the input Y data is located.  You can specify a different offset for each set of VGPOP parameters.  In most cases, this will be 0. */
508    OMX_U32 ulFrameInputStartCOffset[2];     /**< Offset from the start of the input buffer where the input CrCb data is located.  You can specify a different offset for each set of VGPOP parameters.  In most cases, this will be the same as (input width * input height) + Y offset. */
509    OMX_U32 ulFrameOutputStartYOffset[2];    /**< Offset from the start of the output buffer where the output Y data should be placed.  You can specify a different offset for each set of VGPOP parameters. */
510    OMX_U32 ulFrameOutputStartCOffset[2];    /**< Offset from the start of the output buffer where the output CrCb data should be placed.  You can specify a different offset for each set of VGPOP parameters.  In most cases, this will be the same as (output width * output height) + Y offset. */
511    OMX_U32 ulFrameOutputRGBOffset[2];       /**< Offset from the start of the output buffer where the output RGB data is located.  You can specify a different offset for each set of VGPOP parameters.  In most cases, this will be 0. */
512    OMX_U32 ulFrameOutputHeight[2];          /**< Output picture buffer height for each VGPOP parameter set.*/
513    OMX_U32 ulFrameOutputWidth[2];           /**< Output picture buffer width for each VGPOP parameter set. */
514    OMX_U32 ulFrameContrast[2];              /**< Contrast Method for each VGPOP parameter set */
515    OMX_U32 ulFrameInXStart[2];              /**< Horizontal cropping start position in the input buffer.  Set to 0 if no cropping is desired. */
516    OMX_U32 ulFrameInYStart[2];              /**< Vertical cropping start position in the input buffer.  Set to 0 if no cropping is desired.*/
517    OMX_U32 ulFrameInXSize[2];               /**< Horizontal cropping width.  Set to 0 if no cropping is desired */
518    OMX_U32 ulFrameInYSize[2];               /**< Vertical cropping height.  Set to 0 if no cropping is desired.*/
519    OMX_U32 ulFrameZoomFactor[2];            /**< Zooming ratio value, where ulZoomFactor = (Desired Zoom Ratio * 1024).  Set to 1024 if no zooming is desired.  Set above 1024 to enable zooming. */
520    OMX_U32 ulFrameZoomLimit[2];             /**< Zooming ratio limit, where ulZoomLimit=(Desired Zoom Limit * 1024).*/
521    OMX_U32 ulFrameZoomSpeed[2];             /**< Speed of ratio change.  Set to 0 to disable zoom variation.  The variation speed is proportional to the value while the direction (in/out) is given by the sign.*/
522    OMX_U32 ulFrameEnableLightChroma[2];     /**< Light chrominance process.  */
523    OMX_U32 ulFrameEnableAspectRatioLock[2]; /**< Locked H/V ratio */
524    OMX_U32 ulFrameEnableMirroring[2];       /**< To mirror the picture: */
525    OMX_U32 ulFrameRGBRotation[2];           /**< Rotation to apply to RGB Output. May be set to 0, 90, 180 or 270.*/
526    OMX_U32 ulFrameYUVRotation[2];           /**< Rotation to apply to YUV Output. May be set to 0, 90, 180, or 270*/
527    OMX_U32 ulFrameIORange[2];               /**< IO Video Range.   */
528    OMX_U32 ulFrameEnableDithering[2];       /**< Dithering Enable */
529    OMX_U32 ulFrameOutputPitch[2];           /**< Enable an output pitch */
530    OMX_U32 ulAlphaRGB[2];                   /**< This is the default alpha values for ARGB32 or RGBA32. */
531    OMX_U32 ulIsFrameGenerated[2];           /**< Flag to notify the user if a frame has been generated */
532    OMX_U32 ulYUVFrameSize[2];               /**< YUV output size in bytes */
533    OMX_U32 ulRGBFrameSize[2];               /**< RGB output size in bytes. */
534} PPLIB_UALGRunTimeParam_t;
535
536
537
538#endif
539
540typedef OMX_ERRORTYPE (*fpo)(OMX_HANDLETYPE);
541
542static const struct DSP_UUID JPEGESOCKET_TI_UUID = {
543    0xCB70C0C1, 0x4C85, 0x11D6, 0xB1, 0x05, {
544        0x00, 0xC0, 0x4F, 0x32, 0x90, 0x31
545    }
546};
547
548
549static const struct DSP_UUID USN_UUID = {
550    0x79A3C8B3, 0x95F2, 0x403F, 0x9A, 0x4B, {
551        0xCF, 0x80, 0x57, 0x73, 0x05, 0x41
552    }
553};
554
555static const struct DSP_UUID CONVERSIONS_UUID = {
556	0x722DD0DA, 0xF532, 0x4238, 0xB8, 0x46, {
557		0xAB, 0xFF, 0x5D, 0xA4, 0xBA, 0x02
558	}
559};
560
561#ifdef __JPEG_OMX_PPLIB_ENABLED__
562static const struct DSP_UUID PPLIB_UUID = {
563	0xFC8CF948, 0xD3E9, 0x4B65, 0xBC, 0xA7, {
564	0x08, 0x2E, 0xA0, 0xAD, 0x86, 0xF0
565    }
566};
567#endif
568void* OMX_JpegEnc_Thread (void* pThreadData);
569
570typedef enum ThrCmdType
571{
572    SetState,
573    Flush,
574    StopPort,
575    RestartPort,
576    MarkBuf,
577    Start,
578    Stop,
579    FillBuf,
580    EmptyBuf
581} ThrCmdType;
582
583typedef enum OMX_JPEGE_INDEXTYPE  {
584
585    OMX_IndexCustomCommentFlag = 0xFF000001,
586    OMX_IndexCustomCommentString = 0xFF000002,
587    OMX_IndexCustomInputFrameWidth,
588    OMX_IndexCustomInputFrameHeight,
589    OMX_IndexCustomAPP0,
590    OMX_IndexCustomAPP1,
591    OMX_IndexCustomAPP5,
592    OMX_IndexCustomAPP13,
593    OMX_IndexCustomQFactor,
594    OMX_IndexCustomDRI,
595    OMX_IndexCustomHuffmanTable,
596    OMX_IndexCustomDebug
597}OMX_INDEXIMAGETYPE;
598
599typedef struct IUALG_Buf {
600    OMX_PTR            pBufAddr;
601    unsigned long          ulBufSize;
602    OMX_PTR            pParamAddr;
603    unsigned long        ulParamSize;
604    unsigned long          ulBufSizeUsed;
605    //IUALG_BufState tBufState;
606    OMX_BOOL           bBufActive;
607    OMX_U32          unBufID;
608    unsigned long          ulReserved;
609} IUALG_Buf;
610
611typedef enum {
612    IUALG_CMD_STOP             = 0,
613    IUALG_CMD_PAUSE            = 1,
614    IUALG_CMD_GETSTATUS        = 2,
615    IUALG_CMD_SETSTATUS        = 3,
616    IUALG_CMD_USERSETCMDSTART  = 100,
617    IUALG_CMD_USERGETCMDSTART  = 150,
618    IUALG_CMD_FLUSH            = 0x100
619}IUALG_Cmd;
620
621OMX_ERRORTYPE AddStateTransition(JPEGENC_COMPONENT_PRIVATE* pComponentPrivate);
622OMX_ERRORTYPE RemoveStateTransition(JPEGENC_COMPONENT_PRIVATE* pComponentPrivate, OMX_BOOL bEnableSignal);
623
624#endif /*OMX_JPEGENC_UTILS__H*/
625