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...
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", ¶ms, &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);
Loader_getFrame(hLoader, hInBuf);
if (Buffer_getUserPtr(hInBuf) == NULL) break;
}
Loader_delete(hLoader);
Buffer_delete(hOutBuf);
Sdec_delete(hSd);
Engine_close(hEngine);
Typedef Documentation
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. |
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. |
Deletes a Speech Decode algorithm instance.
- Parameters:
-
- Return values:
-
| Dmai_EOK | for success. |
| Negative value | for failure, see Dmai.h. |
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. |
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. |
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. |
Variable Documentation
Default XDM parameters for a Speech Decode algorithm.
size = sizeof(SPHDEC_Params),
dataEnable = 0,
compandingLaw = ISPEECH_ALAW,
packingType = 0
Default XDM dynamic parameters for a Speech Decode algorithm.
size = sizeof(SPHDEC_DynamicParams),
postFilter = 0