OMX_JpegEnc_Utils.h revision b44cdb1b44b144d09e8ec950d1e8e4c280064056
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
90
91#ifdef UNDER_CE
92    #include <oaf_debug.h>
93#endif
94
95#define KHRONOS_1_1
96
97#ifndef FUNC
98#define FUNC 1
99#endif
100
101#ifdef RESOURCE_MANAGER_ENABLED
102#define JPEGENC1MPImage 1000000
103#define JPEGENC2MPImage 2000000
104#endif
105
106#define DSP_MMU_FAULT_HANDLING
107
108/*Linked List */
109
110typedef struct Node {
111    struct Node *pNextNode;
112    void *pValue;
113} Node;
114
115typedef struct LinkedList {
116    Node *pRoot;
117}   LinkedList;
118
119LinkedList AllocList;
120
121void LinkedList_Create(LinkedList *LinkedList);
122void LinkedList_AddElement(LinkedList *LinkedList, void *pValue);
123void LinkedList_FreeElement(LinkedList *LinkedList, void *pValue);
124void LinkedList_FreeAll(LinkedList *LinkedList);
125void LinkedList_DisplayAll(LinkedList *LinkedList);
126void LinkedList_Destroy(LinkedList *LinkedList);
127
128/*
129 *     M A C R O S
130 */
131
132#define OMX_CONF_INIT_STRUCT(_s_, _name_)   \
133    memset((_s_), 0x0, sizeof(_name_)); \
134    (_s_)->nSize = sizeof(_name_);      \
135    (_s_)->nVersion.s.nVersionMajor = 0x1;  \
136    (_s_)->nVersion.s.nVersionMinor = 0x0;  \
137    (_s_)->nVersion.s.nRevision = 0x0;      \
138    (_s_)->nVersion.s.nStep = 0x0
139
140#define OMX_CHECK_PARAM(_ptr_)  \
141{   \
142    if(!_ptr_) {    \
143    eError = OMX_ErrorBadParameter; \
144    goto EXIT; \
145    }   \
146}
147
148#define OMX_CONF_SET_ERROR_BAIL(_eError, _eCode)\
149{                       \
150    _eError = _eCode;               \
151    goto OMX_CONF_CMD_BAIL;         \
152}
153
154#define OMX_MALLOC(_pStruct_, _size_)   \
155    _pStruct_ = malloc(_size_);  \
156    if(_pStruct_ == NULL){  \
157        eError = OMX_ErrorInsufficientResources;    \
158        goto EXIT;  \
159    } \
160    memset(_pStruct_, 0, _size_);\
161    LinkedList_AddElement(&AllocList, _pStruct_);
162
163#define OMX_FREE(_ptr)   \
164{                     \
165    if (_ptr != NULL) { \
166        LinkedList_FreeElement(&AllocList, _ptr);\
167        _ptr = NULL; \
168    }                \
169}
170
171#define OMX_FREEALL()   \
172{                     \
173        LinkedList_FreeAll(&AllocList);\
174}
175
176#define OMX_MEMCPY_CHECK(_p_)\
177{\
178    if (_p_ == NULL) { \
179    eError = OMX_ErrorInsufficientResources;  \
180    goto EXIT;   \
181    } \
182}
183
184
185#ifdef RESOURCE_MANAGER_ENABLED
186#define OMX_GET_RM_VALUE(_Res_, _RM_, _dbg_) \
187{   \
188    if ((_Res_) <= JPEGENC1MPImage){  \
189        (_RM_) = 30;  \
190        }   \
191    else {  \
192        (_RM_) = 60;  \
193        }   \
194    \
195        \
196    OMX_PRMGR2((_dbg_), "Value in MHz requested to RM = %d\n", (_RM_)); \
197}
198#endif
199
200typedef struct IDMJPGE_TIGEM_Comment {
201  OMX_U8 comment[256];
202  OMX_U16 commentLen;
203} IDMJPGE_TIGEM_Comment;
204
205
206typedef struct IIMGENC_DynamicParams {
207    OMX_U32 nSize;             /* nSize of this structure */
208    OMX_U32 nNumAU;            /* Number of Access unit to encode,
209                                  * set to XDM_DEFAULT in case of entire frame
210                                  */
211    OMX_U32 nInputChromaFormat;/* Input chroma format, Refer above comments regarding chroma                    */
212    OMX_U32 nInputHeight;       /* Input nHeight*/
213    OMX_U32 nInputWidth;        /* Input nWidth*/
214    OMX_U32 nCaptureWidth;      /* 0: use imagewidth as pitch, otherwise:
215                                   * use given display nWidth (if > imagewidth)
216                                   * for pitch.
217                                   */
218    OMX_U32 nGenerateHeader;    /* XDM_ENCODE_AU or XDM_GENERATE_HEADER */
219    OMX_U32 qValue;            /* Q value compression factor for encoder */
220} IIMGENC_DynamicParams;
221
222
223  typedef struct IDMJPGE_TIGEM_CustomQuantTables
224  {
225    /* The array "lum_quant_tab" defines the quantization table for the luma component. */
226    OMX_U16 lum_quant_tab[64];
227    /* The array "chm_quant_tab" defines the quantization table for the chroma component.  */
228    OMX_U16 chm_quant_tab[64];
229  } IDMJPGE_TIGEM_CustomQuantTables;
230
231
232typedef struct IDMJPGE_TIGEM_DynamicParams {
233    IIMGENC_DynamicParams  params;
234    OMX_U32 captureHeight;       /* if set to 0 use image height
235                                     else should set to actual Image height */
236    OMX_U32 DRI_Interval ;
237    JPEGENC_CUSTOM_HUFFMAN_TABLE *huffmanTable;
238    IDMJPGE_TIGEM_CustomQuantTables *quantTable;
239} IDMJPGE_TIGEM_DynamicParams;
240
241
242#define __JPEG_OMX_PPLIB_ENABLED__
243
244#ifdef __JPEG_OMX_PPLIB_ENABLED__
245#define OMX_JPEGENC_NUM_DLLS (5)
246#else
247#define OMX_JPEGENC_NUM_DLLS (4)
248#endif
249
250
251#ifdef UNDER_CE
252#define JPEG_ENC_NODE_DLL "/windows/jpegenc_sn.dll64P"
253#define JPEG_COMMON_DLL "/windows/usn.dll64P"
254#define USN_DLL "/windows/usn.dll64P"
255#define CONVERSIONS_DLL "/windows/conversions.dll64P"
256	#ifdef __JPEG_OMX_PPLIB_ENABLED__
257		#define PPLIB_DLL "/windows/postprocessor_dualout.dll64P"
258	#endif
259#else
260#define JPEG_ENC_NODE_DLL "jpegenc_sn.dll64P"
261#define JPEG_COMMON_DLL "usn.dll64P"
262#define USN_DLL "usn.dll64P"
263#define CONVERSIONS_DLL "conversions.dll64P"
264	#ifdef __JPEG_OMX_PPLIB_ENABLED__
265		#define PPLIB_DLL "postprocessor_dualout.dll64P"
266	#endif
267#endif
268
269#define JPGENC_SNTEST_STRMCNT          2
270#define JPGENC_SNTEST_INSTRMID         0
271#define JPGENC_SNTEST_OUTSTRMID        1
272#define JPGENC_SNTEST_ARGLENGTH        20
273#define JPGENC_SNTEST_INBUFCNT         4
274#define JPGENC_SNTEST_OUTBUFCNT        4
275#define JPGENC_SNTEST_MAX_HEIGHT       4096
276#define JPGENC_SNTEST_MAX_WIDTH        4096
277#define JPGENC_SNTEST_PROG_FLAG        1
278#define M_COM   0xFE            /* COMment  */
279
280#define JPEGE_DSPSTOP       0x01
281#define JPEGE_BUFFERBACK    0x02
282#define JPEGE_IDLEREADY     ( JPEGE_DSPSTOP | JPEGE_BUFFERBACK )
283
284typedef enum Content_Type
285{
286    APP0_BUFFER = 0,
287    APP1_BUFFER,
288    APP13_BUFFER,
289    COMMENT_BUFFER,
290    APP0_NUMBUF,
291    APP1_NUMBUF,
292    APP13_NUMBUF,
293    COMMENT_NUMBUF,
294    APP0_THUMB_H,
295    APP0_THUMB_W,
296    APP1_THUMB_H,
297    APP1_THUMB_W,
298    APP13_THUMB_H,
299    APP13_THUMB_W,
300    APP0_THUMB_INDEX,
301    APP1_THUMB_INDEX,
302    APP13_THUMB_INDEX,
303    DYNPARAMS_HUFFMANTABLE,
304    DYNPARAMS_QUANTTABLE,
305    APP5_BUFFER,
306    APP5_NUMBUF,
307    APP5_THUMB_H,
308    APP5_THUMB_W,
309    APP5_THUMB_INDEX
310} Content_Type;
311
312/*This enum must not be changed.  */
313typedef enum JPEG_PORT_TYPE_INDEX
314    {
315    JPEGENC_INP_PORT,
316    JPEGENC_OUT_PORT
317}JPEG_PORT_TYPE_INDEX;
318
319typedef enum JPEGENC_BUFFER_OWNER {
320    JPEGENC_BUFFER_CLIENT = 0x0,
321    JPEGENC_BUFFER_COMPONENT_IN,
322    JPEGENC_BUFFER_COMPONENT_OUT,
323    JPEGENC_BUFFER_DSP,
324    JPEGENC_BUFFER_TUNNEL_COMPONENT
325} JPEGENC_BUFFER_OWNER;
326
327typedef struct _JPEGENC_BUFFERFLAG_TRACK {
328    OMX_U32 flag;
329    OMX_U32 buffer_id;
330    OMX_HANDLETYPE hMarkTargetComponent;
331    OMX_PTR pMarkData;
332} JPEGENC_BUFFERFLAG_TRACK;
333
334typedef struct _JPEGENC_BUFFERMARK_TRACK {
335    OMX_U32 buffer_id;
336    OMX_HANDLETYPE hMarkTargetComponent;
337    OMX_PTR pMarkData;
338} JPEGENC_BUFFERMARK_TRACK;
339
340typedef struct JPEGENC_BUFFER_PRIVATE {
341    OMX_BUFFERHEADERTYPE* pBufferHdr;
342    JPEGENC_BUFFER_OWNER eBufferOwner;
343    OMX_BOOL bAllocByComponent;
344    OMX_BOOL bReadFromPipe;
345} JPEGENC_BUFFER_PRIVATE;
346
347typedef struct JPEG_PORT_TYPE   {
348    OMX_HANDLETYPE hTunnelComponent;
349    OMX_U32 nTunnelPort;
350    JPEGENC_BUFFER_PRIVATE* pBufferPrivate[NUM_OF_BUFFERSJPEG];
351    JPEGENC_BUFFERFLAG_TRACK sBufferFlagTrack[NUM_OF_BUFFERSJPEG];
352    JPEGENC_BUFFERMARK_TRACK sBufferMarkTrack[NUM_OF_BUFFERSJPEG];
353    OMX_PARAM_PORTDEFINITIONTYPE* pPortDef;
354    OMX_BUFFERSUPPLIERTYPE pBufSupplier;
355    OMX_PARAM_BUFFERSUPPLIERTYPE* pParamBufSupplier;
356    OMX_IMAGE_PARAM_PORTFORMATTYPE* pPortFormat;
357    OMX_U8 nBuffCount;
358}JPEG_PORT_TYPE;
359
360typedef struct JPEGE_INPUT_PARAMS {
361    OMX_U32 *pInParams;
362    OMX_U32 size;
363} JPEGE_INPUT_PARAMS;
364
365typedef struct _JPEGENC_CUSTOM_PARAM_DEFINITION {
366    OMX_U8 cCustomParamName[128];
367    OMX_INDEXTYPE nCustomParamIndex;
368} JPEGENC_CUSTOM_PARAM_DEFINITION;
369
370typedef struct JPEGENC_COMPONENT_PRIVATE
371{
372    JPEG_PORT_TYPE* pCompPort[NUM_OF_PORTS];
373    OMX_PORT_PARAM_TYPE* pPortParamType;
374    OMX_PORT_PARAM_TYPE* pPortParamTypeAudio;
375    OMX_PORT_PARAM_TYPE* pPortParamTypeVideo;
376    OMX_PORT_PARAM_TYPE* pPortParamTypeOthers;
377    OMX_PRIORITYMGMTTYPE* pPriorityMgmt;
378    OMX_CALLBACKTYPE cbInfo;
379    OMX_IMAGE_PARAM_QFACTORTYPE* pQualityfactor;
380    OMX_CONFIG_RECTTYPE  *pCrop;
381    /** This is component handle */
382    OMX_COMPONENTTYPE* pHandle;
383    /*Comonent Name& Version*/
384    OMX_STRING cComponentName;
385    OMX_VERSIONTYPE ComponentVersion;
386    OMX_VERSIONTYPE SpecVersion;
387
388    /** Current state of this component */
389    OMX_STATETYPE   nCurState;
390    OMX_STATETYPE   nToState;
391    OMX_U8          ExeToIdleFlag;  /* StateCheck */
392
393    OMX_U32 nInPortIn;
394    OMX_U32 nInPortOut;
395    OMX_U32 nOutPortIn;
396    OMX_U32 nOutPortOut;
397    OMX_BOOL bInportDisableIncomplete;
398    OMX_BOOL bOutportDisableIncomplete;
399    OMX_BOOL bSetLumaQuantizationTable;
400    OMX_BOOL bSetChromaQuantizationTable;
401    OMX_BOOL bSetHuffmanTable;
402    OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE *pCustomLumaQuantTable;
403    OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE *pCustomChromaQuantTable;
404    JPEGENC_CUSTOM_HUFFMANTTABLETYPE *pHuffmanTable;
405
406
407    /** The component thread handle */
408    pthread_t ComponentThread;
409    /** The pipes to maintain free buffers */
410    int free_outBuf_Q[2];
411    /** The pipes to maintain input buffers sent from app*/
412    int filled_inpBuf_Q[2];
413    /** The pipes for sending buffers to the thread */
414    int nCmdPipe[2];
415    int nCmdDataPipe[2];
416    OMX_U32 nApp_nBuf;
417    short int nNum_dspBuf;
418    int nCommentFlag;
419    OMX_U8 *pString_Comment;
420    JPEG_APPTHUMB_MARKER sAPP0;
421    JPEG_APPTHUMB_MARKER sAPP1;
422    JPEG_APPTHUMB_MARKER sAPP5;
423    JPEG_APP13_MARKER sAPP13;
424    JPEGE_INPUT_PARAMS InParams;
425#ifdef __JPEG_OMX_PPLIB_ENABLED__
426    OMX_U32 *pOutParams;
427#endif
428#ifdef RESOURCE_MANAGER_ENABLED
429    RMPROXY_CALLBACKTYPE rmproxyCallback;
430#endif
431    OMX_BOOL bPreempted;
432    int nFlags;
433    int nMarkPort;
434    OMX_PTR pMarkData;
435    OMX_HANDLETYPE hMarkTargetComponent;
436    OMX_BOOL bDSPStopAck;
437   OMX_BOOL bFlushComplete;
438    OMX_BOOL bAckFromSetStatus;
439    void* pLcmlHandle;   /* Review Utils.c */
440    int isLCMLActive;
441    LCML_DSP_INTERFACE* pLCML;
442    void * pDllHandle;
443    OMX_U8 nDRI_Interval;
444#ifdef KHRONOS_1_1
445    OMX_PARAM_COMPONENTROLETYPE componentRole;
446#endif
447    IDMJPGE_TIGEM_DynamicParams *pDynParams;
448
449    pthread_mutex_t jpege_mutex;
450    pthread_cond_t  stop_cond;
451    pthread_cond_t  flush_cond;
452    /* pthread_cond_t  control_cond; */
453    pthread_mutex_t jpege_mutex_app;
454    pthread_cond_t  populate_cond;
455    pthread_cond_t  unpopulate_cond;
456
457
458#ifdef __PERF_INSTRUMENTATION__
459    PERF_OBJHANDLE pPERF, pPERFcomp;
460#endif
461    struct OMX_TI_Debug dbg;
462
463} JPEGENC_COMPONENT_PRIVATE;
464
465
466OMX_ERRORTYPE HandleJpegEncCommand (JPEGENC_COMPONENT_PRIVATE *pComponentPrivate, OMX_U32 nParam1);
467OMX_ERRORTYPE JpegEncDisablePort(JPEGENC_COMPONENT_PRIVATE *pComponentPrivate, OMX_U32 nParam1);
468OMX_ERRORTYPE JpegEncEnablePort(JPEGENC_COMPONENT_PRIVATE *pComponentPrivate, OMX_U32 nParam1);
469OMX_ERRORTYPE HandleJpegEncCommandFlush(JPEGENC_COMPONENT_PRIVATE *pComponentPrivate, OMX_U32 nParam1);
470OMX_ERRORTYPE JPEGEnc_Start_ComponentThread(OMX_HANDLETYPE pHandle);
471OMX_ERRORTYPE HandleJpegEncDataBuf_FromApp(JPEGENC_COMPONENT_PRIVATE *pComponentPrivate );
472OMX_ERRORTYPE HandleJpegEncDataBuf_FromDsp( JPEGENC_COMPONENT_PRIVATE *pComponentPrivate, OMX_BUFFERHEADERTYPE* pBuffHead );
473OMX_ERRORTYPE HandleJpegEncFreeDataBuf( JPEGENC_COMPONENT_PRIVATE *pComponentPrivate, OMX_BUFFERHEADERTYPE* pBuffHead );
474OMX_ERRORTYPE HandleJpegEncFreeOutputBufferFromApp( JPEGENC_COMPONENT_PRIVATE *pComponentPrivate );
475OMX_ERRORTYPE AllocJpegEncResources( JPEGENC_COMPONENT_PRIVATE *pComponentPrivate );
476OMX_ERRORTYPE JPEGEnc_Free_ComponentResources(JPEGENC_COMPONENT_PRIVATE *pComponentPrivate);
477OMX_ERRORTYPE Fill_JpegEncLCMLInitParams(LCML_DSP *lcml_dsp, OMX_U16 arr[], OMX_HANDLETYPE pComponent);
478OMX_ERRORTYPE GetJpegEncLCMLHandle(OMX_HANDLETYPE pComponent);
479OMX_ERRORTYPE SetJpegEncInParams(JPEGENC_COMPONENT_PRIVATE *pComponentPrivate);
480OMX_ERRORTYPE SendDynamicParam(JPEGENC_COMPONENT_PRIVATE *pComponentPrivate);
481OMX_BOOL IsTIOMXComponent(OMX_HANDLETYPE hComp);
482
483#ifdef __JPEG_OMX_PPLIB_ENABLED__
484#define JPEGENC_PPLIB_CREATEPARAM_SIZE 28
485#define JPEGENC_PPLIB_DYNPARM_SIZE 252
486OMX_ERRORTYPE SendDynamicPPLibParam(JPEGENC_COMPONENT_PRIVATE *pComponentPrivate,OMX_U32 *ptInputParam);
487
488
489
490typedef struct _PPLIB_UALGRunTimeParam_t
491{
492    OMX_U32 size;                            /**< Size of the structure in bytes. */
493    OMX_U32 ulInWidth;                       /**< Input picture buffer width.  This value should be the same as the original decoded output width of the WMV9/VC1 stream. */
494    OMX_U32 ulInHeight;                      /**< Input picture buffer height.  This value should be the same as the original decoded output height of the WMV9/VC1 stream. */
495    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. */
496    OMX_U32 ulEnableYUVOutput[2];            /**< Flag to enable YUV output */
497    OMX_U32 ulEnableRGBOutput[2];            /**< Flag to enable RGB output. */
498    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. */
499    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. */
500    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. */
501    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. */
502    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. */
503    OMX_U32 ulFrameOutputHeight[2];          /**< Output picture buffer height for each VGPOP parameter set.*/
504    OMX_U32 ulFrameOutputWidth[2];           /**< Output picture buffer width for each VGPOP parameter set. */
505    OMX_U32 ulFrameContrast[2];              /**< Contrast Method for each VGPOP parameter set */
506    OMX_U32 ulFrameInXStart[2];              /**< Horizontal cropping start position in the input buffer.  Set to 0 if no cropping is desired. */
507    OMX_U32 ulFrameInYStart[2];              /**< Vertical cropping start position in the input buffer.  Set to 0 if no cropping is desired.*/
508    OMX_U32 ulFrameInXSize[2];               /**< Horizontal cropping width.  Set to 0 if no cropping is desired */
509    OMX_U32 ulFrameInYSize[2];               /**< Vertical cropping height.  Set to 0 if no cropping is desired.*/
510    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. */
511    OMX_U32 ulFrameZoomLimit[2];             /**< Zooming ratio limit, where ulZoomLimit=(Desired Zoom Limit * 1024).*/
512    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.*/
513    OMX_U32 ulFrameEnableLightChroma[2];     /**< Light chrominance process.  */
514    OMX_U32 ulFrameEnableAspectRatioLock[2]; /**< Locked H/V ratio */
515    OMX_U32 ulFrameEnableMirroring[2];       /**< To mirror the picture: */
516    OMX_U32 ulFrameRGBRotation[2];           /**< Rotation to apply to RGB Output. May be set to 0, 90, 180 or 270.*/
517    OMX_U32 ulFrameYUVRotation[2];           /**< Rotation to apply to YUV Output. May be set to 0, 90, 180, or 270*/
518    OMX_U32 ulFrameIORange[2];               /**< IO Video Range.   */
519    OMX_U32 ulFrameEnableDithering[2];       /**< Dithering Enable */
520    OMX_U32 ulFrameOutputPitch[2];           /**< Enable an output pitch */
521    OMX_U32 ulAlphaRGB[2];                   /**< This is the default alpha values for ARGB32 or RGBA32. */
522    OMX_U32 ulIsFrameGenerated[2];           /**< Flag to notify the user if a frame has been generated */
523    OMX_U32 ulYUVFrameSize[2];               /**< YUV output size in bytes */
524    OMX_U32 ulRGBFrameSize[2];               /**< RGB output size in bytes. */
525} PPLIB_UALGRunTimeParam_t;
526
527
528
529#endif
530
531typedef OMX_ERRORTYPE (*fpo)(OMX_HANDLETYPE);
532
533static const struct DSP_UUID JPEGESOCKET_TI_UUID = {
534    0xCB70C0C1, 0x4C85, 0x11D6, 0xB1, 0x05, {
535        0x00, 0xC0, 0x4F, 0x32, 0x90, 0x31
536    }
537};
538
539
540static const struct DSP_UUID USN_UUID = {
541    0x79A3C8B3, 0x95F2, 0x403F, 0x9A, 0x4B, {
542        0xCF, 0x80, 0x57, 0x73, 0x05, 0x41
543    }
544};
545
546static const struct DSP_UUID CONVERSIONS_UUID = {
547	0x722DD0DA, 0xF532, 0x4238, 0xB8, 0x46, {
548		0xAB, 0xFF, 0x5D, 0xA4, 0xBA, 0x02
549	}
550};
551
552#ifdef __JPEG_OMX_PPLIB_ENABLED__
553static const struct DSP_UUID PPLIB_UUID = {
554	0xFC8CF948, 0xD3E9, 0x4B65, 0xBC, 0xA7, {
555	0x08, 0x2E, 0xA0, 0xAD, 0x86, 0xF0
556    }
557};
558#endif
559void* OMX_JpegEnc_Thread (void* pThreadData);
560
561typedef enum ThrCmdType
562{
563    SetState,
564    Flush,
565    StopPort,
566    RestartPort,
567    MarkBuf,
568    Start,
569    Stop,
570    FillBuf,
571    EmptyBuf
572} ThrCmdType;
573
574typedef enum OMX_JPEGE_INDEXTYPE  {
575
576    OMX_IndexCustomCommentFlag = 0xFF000001,
577    OMX_IndexCustomCommentString = 0xFF000002,
578    OMX_IndexCustomInputFrameWidth,
579    OMX_IndexCustomInputFrameHeight,
580    OMX_IndexCustomAPP0,
581    OMX_IndexCustomAPP1,
582    OMX_IndexCustomAPP5,
583    OMX_IndexCustomAPP13,
584    OMX_IndexCustomQFactor,
585    OMX_IndexCustomDRI,
586    OMX_IndexCustomHuffmanTable,
587    OMX_IndexCustomDebug
588}OMX_INDEXIMAGETYPE;
589
590typedef struct IUALG_Buf {
591    OMX_PTR            pBufAddr;
592    unsigned long          ulBufSize;
593    OMX_PTR            pParamAddr;
594    unsigned long        ulParamSize;
595    unsigned long          ulBufSizeUsed;
596    //IUALG_BufState tBufState;
597    OMX_BOOL           bBufActive;
598    OMX_U32          unBufID;
599    unsigned long          ulReserved;
600} IUALG_Buf;
601
602typedef enum {
603    IUALG_CMD_STOP             = 0,
604    IUALG_CMD_PAUSE            = 1,
605    IUALG_CMD_GETSTATUS        = 2,
606    IUALG_CMD_SETSTATUS        = 3,
607    IUALG_CMD_USERSETCMDSTART  = 100,
608    IUALG_CMD_USERGETCMDSTART  = 150,
609    IUALG_CMD_FLUSH            = 0x100
610}IUALG_Cmd;
611#endif /*OMX_JPEGENC_UTILS__H*/
612