Sdec

Provides a simple interface to SPHDEC (XDM 0.9) based algorithms. Currently only works for TI:s G711 decoder due to assumptions made. Typical usage (G.711, no error checking):. More...

Typedefs

typedef struct Sdec_Object * Sdec_Handle
 Handle through which to reference a Speech Decode algorithm.

Functions

Sdec_Handle Sdec_create (Engine_Handle hEngine, Char *codecName, SPHDEC_Params *params, SPHDEC_DynamicParams *dynParams)
 Creates a Speech Decode (XDM 0.9) algorithm instance.
Int Sdec_process (Sdec_Handle hSd, Buffer_Handle hInBuf, Buffer_Handle hOutBuf)
 Decodes a Speech buffer.
Int Sdec_delete (Sdec_Handle hSd)
 Deletes a Speech Decode algorithm instance.
SPHDEC_Handle Sdec_getVisaHandle (Sdec_Handle hSd)
 Get the SPHDEC handle from the Sdec module instance.
Int32 Sdec_getInBufSize (Sdec_Handle hSd)
 Get the input buffer size required by the codec.
Int32 Sdec_getOutBufSize (Sdec_Handle hSd)
 Get the output buffer size required by the codec.

Variables

const SPHDEC_Params Sdec_Params_DEFAULT
 Default XDM parameters for a Speech Decode algorithm.
const SPHDEC_DynamicParams Sdec_DynamicParams_DEFAULT
 Default XDM dynamic parameters for a Speech Decode algorithm.

Detailed Description

Provides a simple interface to SPHDEC (XDM 0.9) based algorithms. Currently only works for TI:s G711 decoder due to assumptions made. Typical usage (G.711, no error checking):.

     #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/ce/Sdec.h>

     Sdec_Handle hSd;
     Loader_Handle hLoader;
     Buffer_Handle hOutBuf;
     Engine_Handle hEngine;
     SPHDEC_Params params = Sdec_Params_DEFAULT;
     SPHDEC_DynamicParams dynParams = Sdec_DynamicParams_DEFAULT;
     Loader_Attrs lAttrs = Loader_Attrs_DEFAULT;
     Buffer_Attrs bAttrs = Buffer_Attrs_DEFAULT;

     CERuntime_init();
     Dmai_init();
     hEngine = Engine_open("myengine", NULL, NULL);
     hSd = Sdec_create(hEngine, "g711dec", &params, &dynParams);
     hOutBuf = Buffer_create(Sdec_getOutBufSize(hSd), &bAttrs);
     lAttrs.readSize = Sdec_getInBufSize(hSd);
     lAttrs.readBufSize = lAttrs.readSize * 2;
     hLoader = Loader_create("myfile.g711", &lAttrs);
     Loader_prime(hLoader, &hInBuf);

     while (1) {
         Sdec_process(hSd, hInBuf, hOutBuf);
         // Raw decoded samples now available in hOutBuf.
         Loader_getFrame(hLoader, hInBuf);
         if (Buffer_getUserPtr(hInBuf) == NULL) break;
     }
     Loader_delete(hLoader);
     Buffer_delete(hOutBuf);
     Sdec_delete(hSd);
     Engine_close(hEngine);

Typedef Documentation

typedef struct Sdec_Object* Sdec_Handle

Handle through which to reference a Speech Decode algorithm.


Function Documentation

Sdec_Handle Sdec_create ( Engine_Handle  hEngine,
Char *  codecName,
SPHDEC_Params *  params,
SPHDEC_DynamicParams *  dynParams 
)

Creates a Speech 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 Sdec_Handle).
NULL for failure.

Int Sdec_process ( Sdec_Handle  hSd,
Buffer_Handle  hInBuf,
Buffer_Handle  hOutBuf 
)

Decodes a Speech buffer.

Parameters:
[in] hSd The Sdec_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:
Sdec_create must be called before this function.

Int Sdec_delete ( Sdec_Handle  hSd  ) 

Deletes a Speech Decode algorithm instance.

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

SPHDEC_Handle Sdec_getVisaHandle ( Sdec_Handle  hSd  ) 

Get the SPHDEC handle from the Sdec module instance.

Parameters:
[in] hSd The Sdec_Handle for which to get the SPHDEC handle.
Return values:
Handle to the speech decode algorithm, see the XDM documentation for SPHDEC.
Remarks:
Sdec_create must be called before this function.

Int32 Sdec_getInBufSize ( Sdec_Handle  hSd  ) 

Get the input buffer size required by the codec.

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

Int32 Sdec_getOutBufSize ( Sdec_Handle  hSd  ) 

Get the output buffer size required by the codec.

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


Variable Documentation

const SPHDEC_Params Sdec_Params_DEFAULT

Default XDM parameters for a Speech Decode algorithm.

     size                 = sizeof(SPHDEC_Params),
     dataEnable           = 0,
     compandingLaw        = ISPEECH_ALAW,
     packingType          = 0

const SPHDEC_DynamicParams Sdec_DynamicParams_DEFAULT

Default XDM dynamic parameters for a Speech Decode algorithm.

     size                 = sizeof(SPHDEC_DynamicParams),
     postFilter           = 0


Copyright 2011, Texas Instruments Incorporated