Senc

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

Typedefs

typedef struct Senc_Object * Senc_Handle
 Handle through which to reference a Speech Encode algorithm.

Functions

Senc_Handle Senc_create (Engine_Handle hEngine, Char *codecName, SPHENC_Params *params, SPHENC_DynamicParams *dynParams)
 Creates a Speech Encode (XDM 0.9) algorithm instance.
Int Senc_process (Senc_Handle hSe, Buffer_Handle hInBuf, Buffer_Handle hOutBuf)
 Encodes a speech buffer.
Int Senc_delete (Senc_Handle hSe)
 Deletes a Speech Encode algorithm instance.
SPHENC_Handle Senc_getVisaHandle (Senc_Handle hSe)
 Get the SPHENC handle from the Senc module instance.
Int32 Senc_getInBufSize (Senc_Handle hSe)
 Get the input buffer size required by the codec.
Int32 Senc_getOutBufSize (Senc_Handle hSe)
 Get the output buffer size required by the codec.

Variables

const SPHENC_Params Senc_Params_DEFAULT
 Default XDM parameters for a Speech Encode algorithm.
const SPHENC_DynamicParams Senc_DynamicParams_DEFAULT
 Default XDM dynamic parameters for a Speech Encode algorithm.

Detailed Description

Provides a simple interface to SPHENC (XDM 0.9) based algorithms. Currently only works for TI:s G711 encoder due to assumptions made. Typical example below (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/ce/Senc.h>

     Senc_Handle hSe;
     Buffer_Handle hOutBuf;
     Engine_Handle hEngine;
     SPHENC_Params params = Senc_Params_DEFAULT;
     SPHENC_DynamicParams dynParams = Senc_DynamicParams_DEFAULT;
     Buffer_Attrs bAttrs = Buffer_Attrs_DEFAULT;

     CERuntime_init();
     Dmai_init();
     hEngine = Engine_open("myengine", NULL, NULL);
     hSe = Senc_create(hEngine, "aacenc", &params, &dynParams);
     hOutBuf = Buffer_create(Senc_getOutBufSize(hSe), &bAttrs);
     hInBuf = Buffer_create(Senc_getInBufSize(hSe), &bAttrs);

     // Fill hInBuf with raw samples
     Senc_process(hSe, hInBuf, hOutBuf);
     // encoded data now available in hOutBuf.

     Buffer_delete(hOutBuf);
     Buffer_delete(hInBuf);
     Senc_delete(hSe);
     Engine_close(hEngine);

Typedef Documentation

typedef struct Senc_Object* Senc_Handle

Handle through which to reference a Speech Encode algorithm.


Function Documentation

Senc_Handle Senc_create ( Engine_Handle  hEngine,
Char *  codecName,
SPHENC_Params *  params,
SPHENC_DynamicParams *  dynParams 
)

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

Int Senc_process ( Senc_Handle  hSe,
Buffer_Handle  hInBuf,
Buffer_Handle  hOutBuf 
)

Encodes a speech buffer.

Parameters:
[in] hSe The Senc_Handle to use for encoding.
[in] hInBuf The Buffer_Handle for the buffer containing the raw data.
[in] hOutBuf The Buffer_Handle for the buffer to fill with encoded data.
Return values:
Dmai_EOK for success.
Negative value for failure, see Dmai.h.
Remarks:
Senc_create must be called before this function.

Int Senc_delete ( Senc_Handle  hSe  ) 

Deletes a Speech Encode algorithm instance.

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

SPHENC_Handle Senc_getVisaHandle ( Senc_Handle  hSe  ) 

Get the SPHENC handle from the Senc module instance.

Parameters:
[in] hSe The Senc_Handle for which to get the SPHENC handle.
Return values:
Handle to the speech encode algorithm, see the XDM documentation for SPHENC.
Remarks:
Senc_create must be called before this function.

Int32 Senc_getInBufSize ( Senc_Handle  hSe  ) 

Get the input buffer size required by the codec.

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

Int32 Senc_getOutBufSize ( Senc_Handle  hSe  ) 

Get the output buffer size required by the codec.

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


Variable Documentation

const SPHENC_Params Senc_Params_DEFAULT

Default XDM parameters for a Speech Encode algorithm.

     size                     = sizeof(SPHENC_Params),
     frameSize                = 80,
     compandingLaw            = ISPEECH_ALAW,
     packingType              = 0,
     vadSelection             = 0

const SPHENC_DynamicParams Senc_DynamicParams_DEFAULT

Default XDM dynamic parameters for a Speech Encode algorithm.

     size                     = sizeof(ISPHENC_DynamicParams),
     frameSize                = 80,
     bitRate                  = 0,
     mode                     = 0,
     vadFlag                  = 0,
     noiseSuppressionMode     = 0,
     ttyTddMode               = 0,
     dtmfMode                 = 0,
     dataTransmit             = 1,
     homingMode               = 0


Copyright 2011, Texas Instruments Incorporated