Idec1

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

Typedefs

typedef struct Idec1_Object * Idec1_Handle
 Handle through which to reference an Image Decode algorithm.

Functions

Idec1_Handle Idec1_create (Engine_Handle hEngine, Char *codecName, IMGDEC1_Params *params, IMGDEC1_DynamicParams *dynParams)
 Creates an Image Decode (XDM 1.0) algorithm instance.
Int Idec1_process (Idec1_Handle hId, Buffer_Handle hInBuf, Buffer_Handle hOutBuf)
 Decodes an image buffer.
Int Idec1_delete (Idec1_Handle hId)
 Deletes an Image Decode algorithm instance.
IMGDEC1_Handle Idec1_getVisaHandle (Idec1_Handle hId)
 Get the IMGDEC1 handle from the Idec1 module instance.
Int32 Idec1_getInBufSize (Idec1_Handle hId)
 Get the input buffer size required by the codec.
Int32 Idec1_getOutBufSize (Idec1_Handle hId)
 Get the output buffer size required by the codec.

Variables

const IMGDEC1_Params Idec1_Params_DEFAULT
 Default XDM parameters for an Image Decode algorithm.
const IMGDEC1_DynamicParams Idec1_DynamicParams_DEFAULT
 Default XDM dynamic parameters for an Image Decode algorithm.

Detailed Description

Provides a simple interface to IMGDEC1 (XDM 1.0) 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/Idec1.h>
     #include <ti/sdo/dmai/BufferGfx.h>
     
     IMGDEC1_Params          params       = Idec1_Params_DEFAULT;
     IMGDEC1_DynamicParams   dynParams    = Idec1_DynamicParams_DEFAULT;
     Buffer_Attrs            bAttrs       = Buffer_Attrs_DEFAULT;
     BufferGfx_Attrs         gfxAttrs     = BufferGfx_Attrs_DEFAULT;
     Idec1_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 = Idec1_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(Idec1_getOutBufSize(hId), 
                             BufferGfx_getBufferAttrs(&gfxAttrs));
     hInBuf = Buffer_create(Idec1_getInBufSize(hId), &bAttrs);
     numBytes = fread(Buffer_getUserPtr(hInBuf), 1, Idec1_getInBufSize(hId), 
                      inFile);
     Buffer_setNumBytesUsed(hInBuf, numBytes);       
     Idec1_process(hId, hInBuf, hOutBuf);
      
     Buffer_delete(hOutBuf);
     Buffer_delete(hInBuf); 
     Idec1_delete(hId);
     Engine_close(hEngine);
     fclose(inFile); 

Typedef Documentation

typedef struct Idec1_Object* Idec1_Handle

Handle through which to reference an Image Decode algorithm.


Function Documentation

Idec1_Handle Idec1_create ( Engine_Handle  hEngine,
Char *  codecName,
IMGDEC1_Params *  params,
IMGDEC1_DynamicParams *  dynParams 
)

Creates an Image Decode (XDM 1.0) 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 Idec1_Handle).
NULL for failure.

Int Idec1_process ( Idec1_Handle  hId,
Buffer_Handle  hInBuf,
Buffer_Handle  hOutBuf 
)

Decodes an image buffer.

Parameters:
[in] hId The Idec1_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:
Idec1_create must be called before this function.

Int Idec1_delete ( Idec1_Handle  hId  ) 

Deletes an Image Decode algorithm instance.

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

IMGDEC1_Handle Idec1_getVisaHandle ( Idec1_Handle  hId  ) 

Get the IMGDEC1 handle from the Idec1 module instance.

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

Int32 Idec1_getInBufSize ( Idec1_Handle  hId  ) 

Get the input buffer size required by the codec.

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

Int32 Idec1_getOutBufSize ( Idec1_Handle  hId  ) 

Get the output buffer size required by the codec.

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


Variable Documentation

const IMGDEC1_Params Idec1_Params_DEFAULT

Default XDM parameters for an Image Decode algorithm.

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

const IMGDEC1_DynamicParams Idec1_DynamicParams_DEFAULT

Default XDM dynamic parameters for an Image Decode algorithm.

     size                 = sizeof(IMGDEC1_DynamicParams),
     numAU                = XDM_DEFAULT, 
     decodeHeader         = XDM_DECODE_AU,
     displayWidth         = 0,


Copyright 2011, Texas Instruments Incorporated