Idec

Provides a simple interface to IMGDEC (XDM 0.9) based algorithms. Typical usage (JPEG, no error checking):. More...

Typedefs

typedef struct Idec_Object * Idec_Handle
 Handle through which to reference an Image Decode algorithm.

Functions

Idec_Handle Idec_create (Engine_Handle hEngine, Char *codecName, IMGDEC_Params *params, IMGDEC_DynamicParams *dynParams)
 Creates an Image Decode (XDM 0.9) algorithm instance.
Int Idec_process (Idec_Handle hId, Buffer_Handle hInBuf, Buffer_Handle hOutBuf)
 Decodes an image buffer.
Int Idec_delete (Idec_Handle hId)
 Deletes an Image Decode algorithm instance.
IMGDEC_Handle Idec_getVisaHandle (Idec_Handle hId)
 Get the IMGDEC handle from the Idec module instance.
Int32 Idec_getInBufSize (Idec_Handle hId)
 Get the input buffer size required by the codec.
Int32 Idec_getOutBufSize (Idec_Handle hId)
 Get the output buffer size required by the codec.

Variables

const IMGDEC_Params Idec_Params_DEFAULT
 Default XDM parameters for an Image Decode algorithm.
const IMGDEC_DynamicParams Idec_DynamicParams_DEFAULT
 Default XDM dynamic parameters for an Image Decode algorithm.

Detailed Description

Provides a simple interface to IMGDEC (XDM 0.9) based algorithms. Typical usage (JPEG, no error checking):.

     #include <stdio.h>
     #include <xdc/std.h>
     #include <ti/sdo/ce/Engine.h>
     #include <ti/sdo/ce/CERuntime.h>
     #include <ti/sdo/dmai/Dmai.h>
     #include <ti/sdo/dmai/Buffer.h>
     #include <ti/sdo/dmai/Loader.h>
     #include <ti/sdo/dmai/ColorSpace.h>
     #include <ti/sdo/dmai/ce/Idec.h>
     #include <ti/sdo/dmai/BufferGfx.h>
     
     IMGDEC_Params           params       = Idec_Params_DEFAULT;
     IMGDEC_DynamicParams    dynParams    = Idec_DynamicParams_DEFAULT;
     Buffer_Attrs            bAttrs       = Buffer_Attrs_DEFAULT;
     BufferGfx_Attrs         gfxAttrs     = BufferGfx_Attrs_DEFAULT;
     Idec_Handle             hId          = NULL;
     Engine_Handle           hEngine      = NULL;
     Buffer_Handle           hInBuf       = NULL;
     Buffer_Handle           hOutBuf      = NULL;
     Int                     numBytes     = 0;
     FILE                    *inFile; 
        
     CERuntime_init();
     Dmai_init();
     hEngine = Engine_open("myengine", NULL, NULL);
     hId = Idec_create(hEngine, "jpegdec", &params, &dynParams);
     gfxAttrs.colorSpace     = ColorSpace_UYVY;
     gfxAttrs.dim.width      = params.maxWidth;
     gfxAttrs.dim.height     = params.maxHeight;
     gfxAttrs.dim.lineLength = BufferGfx_calcLineLength(params.maxWidth, 
                                                        gfxAttrs.colorSpace);
     hOutBuf = Buffer_create(Idec_getOutBufSize(hId), 
                             BufferGfx_getBufferAttrs(&gfxAttrs));
     hInBuf = Buffer_create(Idec_getInBufSize(hId), &bAttrs);
     numBytes = fread(Buffer_getUserPtr(hInBuf), 1, Idec_getInBufSize(hId), 
                      inFile);
     Buffer_setNumBytesUsed(hInBuf, numBytes);       
     Idec_process(hId, hInBuf, hOutBuf);
      
     Buffer_delete(hOutBuf);
     Buffer_delete(hInBuf); 
     Idec_delete(hId);
     Engine_close(hEngine);
     fclose(inFile); 

Typedef Documentation

typedef struct Idec_Object* Idec_Handle

Handle through which to reference an Image Decode algorithm.


Function Documentation

Idec_Handle Idec_create ( Engine_Handle  hEngine,
Char *  codecName,
IMGDEC_Params *  params,
IMGDEC_DynamicParams *  dynParams 
)

Creates an Image Decode (XDM 0.9) algorithm instance.

Parameters:
[in] hEngine An opened engine containing the algorithm to create.
[in] codecName The name of the algorithm to open. Corresponds to the string name given in the .cfg file.
[in] params XDM parameters to use while creating the codec.
[in] dynParams XDM dynamic parameters to use while creating the codec.
Return values:
Handle for use in subsequent operations (see Idec_Handle).
NULL for failure.

Int Idec_process ( Idec_Handle  hId,
Buffer_Handle  hInBuf,
Buffer_Handle  hOutBuf 
)

Decodes an image buffer.

Parameters:
[in] hId The Idec_Handle to use for decoding.
[in] hInBuf The Buffer_Handle for the buffer containing the encoded data.
[in] hOutBuf The Buffer_Handle for the buffer to fill with decoded data.
Return values:
Dmai_EOK for success.
Negative value for failure, see Dmai.h.
Remarks:
Idec_create must be called before this function.

Int Idec_delete ( Idec_Handle  hId  ) 

Deletes an Image Decode algorithm instance.

Parameters:
[in] hId The Idec_Handle to delete.
Return values:
Dmai_EOK for success.
Negative value for failure, see Dmai.h.
Remarks:
Idec_create must be called before this function.

IMGDEC_Handle Idec_getVisaHandle ( Idec_Handle  hId  ) 

Get the IMGDEC handle from the Idec module instance.

Parameters:
[in] hId The Idec_Handle for which to get the IMGDEC handle.
Return values:
Handle to the image decode algorithm, see the XDM documentation for IMGDEC.
Remarks:
Idec_create must be called before this function.

Int32 Idec_getInBufSize ( Idec_Handle  hId  ) 

Get the input buffer size required by the codec.

Parameters:
[in] hId The Idec_Handle for which to get the buffer size.
Return values:
Size in bytes of the input buffer required.
Remarks:
Idec_create must be called before this function.

Int32 Idec_getOutBufSize ( Idec_Handle  hId  ) 

Get the output buffer size required by the codec.

Parameters:
[in] hId The Idec_Handle for which to get the buffer size.
Return values:
Size in bytes of the output buffer required.
Remarks:
Idec_create must be called before this function.


Variable Documentation

const IMGDEC_Params Idec_Params_DEFAULT

Default XDM parameters for an Image Decode algorithm.

     size                 = sizeof(IMGDEC_Params),
     maxHeight            = 576,
     maxWidth             = 720,
     maxScans             = 15,
     dataEndianness       = XDM_BYTE,
     forceChromaFormat    = XDM_YUV_422ILE,

const IMGDEC_DynamicParams Idec_DynamicParams_DEFAULT

Default XDM dynamic parameters for an Image Decode algorithm.

     size                 = sizeof(VIDDEC_DynamicParams),
     numAu                = XDM_DEFAULT, 
     decodeHeader         = XDM_DECODE_AU,
     displayWidth         = 0,


Copyright 2011, Texas Instruments Incorporated