Sdec1

Provides a simple interface to SPHDEC1 (XDM 1.0) based algorithms. More...

Typedefs

typedef struct Sdec1_Object * Sdec1_Handle
 Handle through which to reference a Speech Decode algorithm.

Functions

Sdec1_Handle Sdec1_create (Engine_Handle hEngine, Char *codecName, SPHDEC1_Params *params, SPHDEC1_DynamicParams *dynParams)
 Creates a Speech Decode (XDM 1.0) algorithm instance.
Int Sdec1_process (Sdec1_Handle hSd, Buffer_Handle hInBuf, Buffer_Handle hOutBuf)
 Decodes a Speech buffer.
Int Sdec1_delete (Sdec1_Handle hSd)
 Deletes a Speech Decode algorithm instance.
SPHDEC1_Handle Sdec1_getVisaHandle (Sdec1_Handle hSd)
 Get the SPHDEC1 handle from the Sdec1 module instance.
Int32 Sdec1_getInBufSize (Sdec1_Handle hSd)
 Get the input buffer size required by the codec.
Int32 Sdec1_getOutBufSize (Sdec1_Handle hSd)
 Get the output buffer size required by the codec.

Variables

const SPHDEC1_Params Sdec1_Params_DEFAULT
 Default XDM parameters for a Speech Decode algorithm.
const SPHDEC1_DynamicParams Sdec1_DynamicParams_DEFAULT
 Default XDM dynamic parameters for a Speech Decode algorithm.

Detailed Description

Provides a simple interface to SPHDEC1 (XDM 1.0) based algorithms.

Release Support: G711, G726, G729 and ILBC. Due to defect in ILBC Decoder v 1.10.002, this release will not work with this version.

Typical usage:

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

     Sdec1_Handle hSd;
     Loader_Handle hLoader;
     Buffer_Handle hOutBuf, hInBuf;
     Engine_Handle hEngine;
     SPHDEC1_Params params = Sdec1_Params_DEFAULT;
     SPHDEC1_DynamicParams dynParams = Sdec1_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 = Sdec1_create(hEngine, "mydec", &params, &dynParams);
     hOutBuf = Buffer_create(Sdec1_getOutBufSize(hSd), &bAttrs);
     lAttrs.readSize = Sdec1_getInBufSize(hSd);
     lAttrs.readBufSize = lAttrs.readSize * 2;
     hLoader = Loader_create("myfile", &lAttrs);
     Loader_prime(hLoader, &hInBuf);

     while (1) {
         Sdec1_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);
     Sdec1_delete(hSd);
     Engine_close(hEngine);

Typedef Documentation

typedef struct Sdec1_Object* Sdec1_Handle

Handle through which to reference a Speech Decode algorithm.


Function Documentation

Sdec1_Handle Sdec1_create ( Engine_Handle  hEngine,
Char *  codecName,
SPHDEC1_Params *  params,
SPHDEC1_DynamicParams *  dynParams 
)

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

Int Sdec1_process ( Sdec1_Handle  hSd,
Buffer_Handle  hInBuf,
Buffer_Handle  hOutBuf 
)

Decodes a Speech buffer.

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

Int Sdec1_delete ( Sdec1_Handle  hSd  ) 

Deletes a Speech Decode algorithm instance.

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

SPHDEC1_Handle Sdec1_getVisaHandle ( Sdec1_Handle  hSd  ) 

Get the SPHDEC1 handle from the Sdec1 module instance.

Parameters:
[in] hSd The Sdec1_Handle for which to get the SPHDEC1 handle.
Return values:
Handle to the speech1 decode algorithm, see the XDM documentation for SPHDEC1.
Remarks:
Sdec1_create must be called before this function.

Int32 Sdec1_getInBufSize ( Sdec1_Handle  hSd  ) 

Get the input buffer size required by the codec.

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

Int32 Sdec1_getOutBufSize ( Sdec1_Handle  hSd  ) 

Get the output buffer size required by the codec.

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


Variable Documentation

const SPHDEC1_Params Sdec1_Params_DEFAULT

Default XDM parameters for a Speech Decode algorithm.

     size                 = sizeof(SPHDEC1_Params),
     compandingLaw        = ISPEECH1_PCM_COMPAND_ALAW,
     packingType          = 0,
     codecSelection       = 0,
     bitRate              = 0,
     reserved             = 0,
     **tablesPtr          = NULL,

const SPHDEC1_DynamicParams Sdec1_DynamicParams_DEFAULT

Default XDM dynamic parameters for a Speech Decode algorithm.

     size                 = sizeof(SPHDEC1_DynamicParams),
     postFilter           = 0


Copyright 2011, Texas Instruments Incorporated