Coverting Codec Data

Coverting Codec Data

I have the function from va_g729 using this funtionva_g729_encode(short *in, char *out)how can I replace this with the IPP can someone please send me a sample

24 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.


we have ippsConvert_8s16s(const Ipp8s* pSrc,Ipp16s* pDst,int len) function but we have no ippsConvert_16s8s(const Ipp16s* pSrc,Ipp8s* pDst,int len) function. If you find such functionality useful please submit your request to Intel Premier Support


Yes But can you please provide sample how to convert to a


What sample do you mean? How to convert 16s to 8s data?

how to load and use it

Did you look at IPP speech-coding sample?


yes i did... still not a clear simple sample

That's what we have.

If you have some particular questions about codec and how to use it you can ask here.


If you use IPP4.0, those OBJ files in ippscmerged.lib maybe help you.
But if you use IPP5.0, the names of OBJ files maybe differ.


you can extract them from ippscmerged.lib by
lib.exe ippscmerged.lib /EXTRACT:d:/ippsr_sc/ippobj/sclibsobjs/win32/w7/mrg/ippscsag729/ippscsag729_split0.obj

One.... Merge Libraries dont seem to be in eval version of IPP v5

Two.... What does the Libraries have to do with the Question I asked...

Three.... Based on the "sample-speech-coding" example can some one please show me how to convert data comming from voip g729 to PCM LINIAR and back to g729 for return

it would go along way in convincing company to buy IPP Licenses


that's true, evaluation version of IPP provides only DLLs. You should be able to build speech-coding sample with IPP DLL, aren't you?

I'll ask our expert to comment your third question.


no I get error when tring to build the EXE part... because it wants to build static...but again the sample deals with file based audio and we need live audio from voip server.... the idea is to tie it into softphone.and if we can get the g729 codec fixed forout teststhen we can get the funding for Licenses... this is the ugency... we were hopping to have this done this week using your eval but it seems not possible... if we can get this working this week you can look forward to a sale of IPP by next week

Well, lets us first solve your build issue. Could you please look at speech-coding folder and confirm that file support.txt contains sample id like this w_ipp-sample-speech-coding_p_5.0.019?

I've just tested sample, it link IPP DLL.

We will try to help you as quick as possible


I can read the code in basic.... I dont need to compile.....what I need to know is how to convert it to support g729 encoding and decoding..... that would at least point me to right direction...

g723 also would be handy...

According speech-coding sample's readme.htm,

The samples have been implemented using the Intel Integrated Performance Primitives (Intel IPP) Speech Coding functions.They are command line based applications which process data given by one or more input PCM files and store the result into output bitstreams or PCM files. Both narrow band (8000 Hz) and wide band (16000 KHz) are supported.

the sample provide you exactly functionality you are looking for, right? So, I hope, if you will solve build issue you probably get a better chance to understand how this sample works, how it connects encoder or decoder and so on.


Hi,Touse USC encoder:#include "usc.h"
/*Declare global variable and pointer to the USC function table*/extern USC_Fxns USC_G729A_Fxns; /* G729A is done inva_g729 */
USC_Fxns *USC_Gxxx_Fnxs = &USC_G729A_Fxns;
......./*Init encoder*/USC_CodecInfo pInfo;
int i, nbanksEnc;
USC_MemBank* pBanksEnc;
USC_Handle hUSCEncoder;

/* Get the Gxxx codec info */
if(USC_NoError != USC_Gxxx_Fnxs->std.GetInfo((USC_Handle)NULL, &pInfo)) exit(1);
/*We'll create encoder*/
pInfo.params.direction = 0; /* Direction: encode */
pInfo.params.modes.vad = 0; /*No VAD in va_g729*/
pInfo.params.modes.bitrate =8000;/* G729A codec has got this bitrate*/

/* Learn how many memory block needed for the encoder */
if(USC_NoError != USC_Gxxx_Fnxs->std.NumAlloc(&pInfo.params, &nbanksEnc)) exit(2);

/* allocate memory for memory bank table */
pBanksEnc = (USC_MemBank*)malloc(sizeof(USC_MemBank)*nbanksEnc);

/* Query how big has to be each block */
if(USC_NoError != USC_Gxxx_Fnxs->std.MemAlloc(&pInfo.params, pBanksEnc)) exit(3);

/* allocate memory for each block */
for(i=0; ipBanksEnc[i].pMem = (unsigned char*)malloc(pBanksEnc[i].nbytes);

/* Create encoder instance */
if(USC_NoError != USC_Gxxx_Fnxs->std.Init(&pInfo.params, pBanksEnc, &hUSCEncoder)) exit(4);

Now to encode one frame (this code is equal to call va_g729_encode(short *in, char *out) function.

USC_PCMStream in;
USC_Bitstream out;

/* Set input stream params */
in.bitrate = 8000;
in.nbytes = lenPCM;
in.pBuffer = pPCM;
in.pcmType.bitPerSample = 16;
in.pcmType.sample_frequency = 8000;

/* Set output buffer */
out.pBuffer = pBitstrea;

/* Encode a frame */
if(USC_NoError != USC_Gxxx_Fnxs->Encode (hUSCEncoder, &in, &out)) exit(6);

For G723 codec just change

USC_Fxns *USC_Gxxx_Fnxs = &USC_G729A_Fxns;


USC_Fxns *USC_Gxxx_Fnxs = &USC_G723_Fxns;


Great Example....

thanks.... but how does one clean up after finished


No clean up needed. Just

for(i=0; ifree(pBanksEnc[i].pMem);


But if you'd like to put a USC codecinstance to its initial state just call:

USC_Status Reinit(USC_Modes *modes, USC_Handle handle );

Igor S. Belyakov

I am still having alot of problems with this....

I am tring to tie it into a Freeware Opensource application

I put the USC lib into a Single Threaded DLL and I am calling it though Application....

Eveything works fine except the encode and decode...
it inits fine but decode and encode fails

Could you provide witchstatus you get when you call encode() and decode() functions?

My first assumption that you incorrectly prepare function params. As for encode() function try to do following. Pls be prepared that this function operates under single frame and after function call in->nbytes will hold used PCM size out->nbytes willreturn bitstream size.

USC_PCMStream inData;
USC_Bitstream outData;

in.bitrate = 8000; /*it's hard patch for G729A. For the correct values in.bitrate = pInfo->params.modes.bitrate*/

in.nbytes = *inlen;

in.pBuffer = (char*)in;

in.pcmType.bitPerSample = 16;

in.pcmType.sample_frequency = 8000;

out.pBuffer = out;

Igor S. Belyakov


In the decode function where you coded

USC_Bitstream inData;
inData.nbytes = *inlen;
inData.pBuffer = in;

try to initialize frametype and bitrate inData entries by copying from the USC encode output bitstream structure. In case of RTP decoding the frametype and bitrate parameters to decoder should be formed according to a payload.


I am using the USC and when I Encode it thows an Exception and I get "USC_NoOperation" as a status message

Message Edited by on 06-13-200602:44 PM

Hi,Please check the folowing required define "NO_SCRATCH_MEMORY_USED" in your project.Igor S. Belyakov

Leave a Comment

Please sign in to add a comment. Not a member? Join today