This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

using g729 codec in omapl138

Other Parts Discussed in Thread: OMAPL138

Hi,

We are using OMAPL138 in our project i.e. VoIP based system.

We are trying to use different codecs g711a/g711u/g723/g729 etc while encoding-decoding payload using McBSP interface.

But the problem we are facing in here is while using g729 codec:

            codec_encParams = G729ENC_PARAMS;
            myPortInfo->chanEnc = (ISPHENC1_Handle)SPHENC1_create(ce,g729encodecName,&codec_encParams);

            codec_decParams = G729DEC_PARAMS;
            myPortInfo->chanDec = (ISPHDEC1_Handle)SPHDEC1_create(ce,g729decodecName,&codec_decParams);

Encoding raw linear samples receive from McBSP TDM side using

            inBufDesc.bufSize = 320;
            outBufDesc.bufSize = 20;

            inBufDesc.buf = myPortInfo->encodeIn;
            outBufDesc.buf = myPortInfo->encodeOut;

            /** Call the Extended IALG Method Encode to process the frame of codewords */
            retval = SPHENC1_process(myPortInfo->chanEnc,&inBufDesc,&outBufDesc,&encInArgs,&encOutArgs);

Decoding encoded samples receive from IP side using

            inBufDesc.bufSize = 20;
            outBufDesc.bufSize = 320;

            inBufDesc.buf = myPortInfo->decodeIn;
            outBufDesc.buf = myPortInfo->decodeOut;

            /* Call the Extended IALG Method Decode to process the frame of codewords */
            retval = SPHDEC1_process((ISPHDEC1_Handle)myPortInfo->chanDec,&inBufDesc,&outBufDesc,&decInArgs,&decOutArgs);


But while encoding sample I shuold get 20bytes total out of that we get only 10Bytes encoded and rest I got as :

Payload: 758acfea0ebb05cac44700000000000000000000

Can anyone tell at which step I am missing any configuration?

Regards

Rishabh Jain

  • Hi Rishabh,

    G729 Encoder processes 10ms data (80 samples of speech) and encodes into 10bytes of output for each process call. So, whatever you have observed is correct.

    You may have to change your logic to process more data (320 bytes of input) in multiple process calls.

    -Venkat

  • Thanks Venkat for your quick response.

    Is this the limitation with G729 codec? as when I work with G711a/u, G723 codec I process whole bunch of input data as much I need to process like for :-

    G711a/u - RAW 320 samples for encoding for 20ms data

    G723 - RAW 480 samples for encoding for 30ms data

    There is no problem in changing my logic as I will definitely do that to work.

    Regards

    Rishabh Jain

  • Hi Venkatesh,

    Can you guide us for the implementation of G722 codec as I have noticed certain thing that:-

    1) Firstly what is the sampling rate of G722 codec in this i.e. 8Khz/16Khz but I study it works at 16Khz.

    As per standards we should have 160bytes data for 20ms but while encoding through G722 codec as on the input of 320bytes we get only 80bytes packet encoded.

    It is as per what standards?

    I share the same issue while decoding it so please guide me through this too.

    I am sharing few details for initializing of G722 handles are as :-

                ISPHENC1_Params g722ParamsEnc;

                g722ParamsEnc.size = sizeof(ISPHENC1_Params);
                g722ParamsEnc.codecSelection = 0;
                g722ParamsEnc.bitRate = 0;
                g722ParamsEnc.tablesPtr = NULL;
                g722ParamsEnc.frameSize = 320;
                myPortInfo->chanEnc = (ISPHENC1_Handle)SPHENC1_create(ce,g722encodecName,&codec_encParams);

    Regards

    Rishabh Jain

  • Hi Rishabh,

    This is not the limitation of the codec. Each codec standard defines its frame size for processing the data.

    G711 is sample based codec - it supports all multiples of 10ms frames

    G723 - it supports the frame sizes 20ms or 30ms

    Similarly, G729 has the framesize of 10ms.

    Hope it is clear.

    -Venkat

  • Hi Rishabh,

    The codecselection parameter is set to 0, means you are running the codec in non-ITU mode, where the output comes in packed format. For ITU mode, codecselection=1, the output is as defined by ITU (Each parameter is represented with 16-bits) and will be 160 bytes in your case.

    -Venkat

  • Hello Venkat,

    What is the difference between Non-ITU & ITU mode? If we are talking in terms of codec compress-decompress.

    For the output data of 160 bytes for 20ms how much input data samples I have to process as in our case 5ms = 80 raw samples.

    20 ms = 320 raw sample.

    When I encode this I 320bytes of data I get only 160 bytes data. And out of which 80bytes data are encoded & rest others 80 bytes are "00000000".

    -Rishabh Jain

  • Hi Rishabh,

    ITU-mode or non-ITU mode are different in how the bitstream is outputted from the codec.

    As per G722 standard, it is a 64kbps codec. It means for 10ms of input data, it should generate 80bytes of output.

    In non-ITU mode, you will see the codec generates 80bytes for 10ms of input. Whereas in ITU mode, you will see that the codec generates 160bytes of output as each byte in the output represented with 2 bytes. This ITU mode is only to check the compliance with the standard provided test cases. In real time applications, we should always use non-ITU mode.

    -Venkat

  • Hi Venkat,

    >> ITU-mode or non-ITU mode are different in how the bitstream is outputted from the codec.

    Yes I have checked that how ITU and NON-ITU mode works and there bit shifted output. So concluded point is that we will be continuing using NON-ITU mode for encoding paramters.

    >> As per G722 standard, it is a 64kbps codec. It means for 10ms of input data, it should generate 80bytes of output.

    It means for 10ms of input data means 160 bytes input and it should generate 80bytes of output is this what you mean as it returns only 40bytes of data while processing 10ms(160 bytes) input data.

    >> In non-ITU mode, you will see the codec generates 80bytes for 10ms of input?

    Please clear this point a bit more as it is not behaving the same manner.


    Rishabh Jain

  • Hi Rishabh,

    10ms input at 16KHz sampling rate is 160samples or 320bytes.

    -Venkat

  • Hi Venkat,

    I am making you our scenario more clear.

    We are receiving data samples from McBSP which is being configured at 8Khz so according to this

    5 ms = 40 samples(80 Bytes).

    10 ms = 80 samples(160 Bytes).

    In our case settings at McBSP side cannot be changed.

    So please now tell how can we get input samples for G722 codec, which requires samples at 16Khz(160 samples for 10 ms).

  • Hi Rishab,

    I am not familiar with McBSP.

    For G722, you need 16KHz sampled signal as input. In which case, you may need a resampler before the codec to upsample your 8KHz input from McBSP to 16KHz.

    -Venkat

  • Hi Venkat,

    I am just briefing you with our implementation using omapl138 device.

    We are making an VoIP gateway which uses omapl138 for conversion of TDM data[Analog side voice] to IP data [RTP payload] & vice-versa, which is made possible by using of McBSP interface provided in omapl138.

    For that we need to configure McBSP interface, while in its configuration there is a parameter in that we need to input sampling value of data, so there we have already configure data for McBSP interface at 8KHz means we will get sample o/p at 8KHz.

    Now problem is that we need to provide G722 codec with 16Khz sample data, so can you tell me that how we will be getting that o/p data at 16Khz as for now we get 8Khz data i.e.

    5 ms = 40 samples(80 Bytes).

    10 ms = 80 samples(160 Bytes).

    As mentioned in my last post McBSP settings cannot be changed, as other codecs works fine with that like (PCMA, PCMU, G729, G723).

    Please ask for more information if you need it.

    Regards

    Rishabh Jain

  • Hi Rishab,

    As I already mentioned I am not familiar with McBSP. May be we need to wait for McBSP or system experts.

    -Venkat

  • Hi Venkat,

    Thanks for the quick response.

    I think you get our problem where we are stucked now.

    Please suggest some quick answer for that as this codec is getting very critical to us for our project completion.

    -Rishabh

  • Hi Rishabh,

    You can use a resampler before the codec.

    1) Insert zeroes at alternate samples and pass it to the codec. (OR)

    2) Insert a sample between two, as an average of the two. (OR)

    3) Use a proper resampling algorithm

    Above may not solve your problem, but will enable you to integrate the codec and validate.

    -Venkat

  • Hi Venkat,

    Sorry for delayed response.

    I want to ask one thing regarding G722 codec standard i.e. G722 codec also supports 8khz sampling rate, so can you provide me library for G722 codec which supports 8Khz sampling. If so that will be very helpful for us.

    For rest I will try to use your method as mentioned above.

    - Rishabh Jain

  • Hi Venkat,

    Please answer my last post for regarding G722 codec which supports 8Khz sampling rate.

    Regards

    Rishabh Jain

  • Rishabh,

    Where did you heard that G722 also supports 8KHz? We didn't come across it in the standard.

    G722 is a wideband codec works on 16KHz input data.

    -Venkat

  • Hi Venkat,

    This question has been raised as per our configuration of McBSP, as in McBSP individual channel cannot be configured for different configuration, so it has been configured at 8Khz.

    And TI supports g722 codec along with others codecs which works at 8Khz, so how you people manage to do it simultaneously ?

    --- G722 is a wide-band codec works on 16KHz input data.

    This is why I ask, that do we have any 8Khz G722 codec library or any other way through which we can re-sample 8Khz data to 16Khz data and can process through G722 codec library.

    Have I made myself clear on it for asking you g722 codec lib. for 8Khz.

    Sorry for misunderstanding and do reply for any clarification needed.

    Regards

    Rishabh Jain

  • Hi Rishabh,

    I understand your problem. But from the codec perspective, g722 requires 16KHz input. I am familiar with integrating various codecs into one application.

    -Venkat