Idec
Provides a simple interface to IMGDEC (XDM 0.9) based algorithms. Typical usage (JPEG, no error checking):.
More...
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", ¶ms, &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
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. |
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. |
Deletes an Image Decode algorithm instance.
- Parameters:
-
- Return values:
-
| Dmai_EOK | for success. |
| Negative value | for failure, see Dmai.h. |
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. |
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. |
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. |
Variable Documentation
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,
Default XDM dynamic parameters for an Image Decode algorithm.
size = sizeof(VIDDEC_DynamicParams),
numAu = XDM_DEFAULT,
decodeHeader = XDM_DECODE_AU,
displayWidth = 0,