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.

g722 can‘t encoder 16k pcm data to 48k/56k bps bitstream currectly.

Other Parts Discussed in Thread: TEST2

Hi,

I'm trying to integrate with the g722 library from TI on my dm8168.I find the g722 lib(Version 2.00.00.000) can encode the 16k pcm data to 64kbps data currectly,but it can’t encode 16k pcm data to 48k/56k bps data currectly. there are the test config as follows:

test1:

  1. g722_64k config:           

            tablesPtr      = NULL;

           codecSelection = ISPEECH1_G722_CODECSELECT_NONITUMODE;

           bitRate = ISPEECH1_G722_BITRATE_RATE0;

           inBuf.bufSize  = 320 * 2;

           outBuf. bufSize = 160;

    2. g722_56k config:

           tablesPtr      = NULL;

           codecSelection = ISPEECH1_G722_CODECSELECT_NONITUMODE;

           bitRate = ISPEECH1_G722_BITRATE_RATE1;

           inBuf.bufSize  = 160 * 2;

           outBuf. bufSize = 140;

    3.  g722_48k config:  

           tablesPtr      = NULL;

           codecSelection = ISPEECH1_G722_CODECSELECT_NONITUMODE;

           bitRate = ISPEECH1_G722_BITRATE_RATE2;

           inBuf.bufSize  = 160 * 2;

           outBuf. bufSize =120;

       I find the g722_64k config can encode one frame audio data( 320 samples) to 160 Byte,and The 160 Byte bitstream can be expanded to PCM (320 samples)currectly.But the g722_56k config and g722_48k config can’t .

test2:

        I set g722_56k ,g722_48k all of the config to be the same to the g722_64k config,except the bitrate.

  1. g722_64k config:           

             tablesPtr      = NULL;

             codecSelection = ISPEECH1_G722_CODECSELECT_NONITUMODE;

             bitRate = ISPEECH1_G722_BITRATE_RATE0;

             inBuf.bufSize  = 320 * 2;

             outBuf. bufSize = 160;

       2.   g722_56k config:

            tablesPtr      = NULL;

            codecSelection = ISPEECH1_G722_CODECSELECT_NONITUMODE;

            bitRate = ISPEECH1_G722_BITRATE_RATE1;

            inBuf.bufSize  = 320 * 2;

            outBuf. bufSize = 160

      3.  g722_48k config:  

            tablesPtr      = NULL;

            codecSelection = ISPEECH1_G722_CODECSELECT_NONITUMODE;

            bitRate = ISPEECH1_G722_BITRATE_RATE2;

            inBuf.bufSize  = 320 * 2;

            outBuf. bufSize =160;

         I find the g722_64k config, g722_56k config, g722_48k config can all encode 16k pcm data ( 320 samples one frame) to 64kbps data currectly, and The bitstream can be expanded to PCM (320 samples)currectly.

So my question is whether the g722 lib (Version 2.00.00.000) support Compressing linear 16k PCM into 56/64Kbps?

Thanks,

sunfarmer

  • Hi sunfarmer,

    Output size is same for all the modes. If you do a control call with XDM_GETBUFINFO, you can find that the output size is same for 64,56or 48kbps

    56kbps is same as 64 kbps with the least significant bit of every byte set to 0.

    48kbps is same as 64 kbps with the 2 least significant bits of every byte set to 0.

  • Hi Adithya Banninthaya

    Thank you for your reply. you are right ,the output size is same for 64,56or 48kbps,but the output data is not same as you said.here are some data of stream bit that

    encoded by g722_48.

    If the 48kbps is same as 64 kbps with the 2 least significant bits of every byte set to 0,the first two bits of ervery bitstream byte should be 0 ,and the higher 4 bit should Less than than 3 (0011),but it’s not.

     

    I did another test and find the data encoded by g722_56k/ g722_48k can be decoded by g722_64k currectly.there is the test config as follows:

    encoder:

           tablesPtr      = NULL;

           codecSelection = ISPEECH1_G722_CODECSELECT_NONITUMODE;

           bitRate = ISPEECH1_G722_BITRATE_RATE1;// g722_56k

           inBuf.bufSize  = 320 * 2;

           outBuf. bufSize = 160;

    • or

           tablesPtr      = NULL;

           codecSelection = ISPEECH1_G722_CODECSELECT_NONITUMODE;

           bitRate = ISPEECH1_G722_BITRATE_RATE2;// g722_48k

           inBuf.bufSize  = 320 * 2;

           outBuf. bufSize = 160;

    decoder:

           tablesPtr      = NULL;

           codecSelection = ISPEECH1_G722_CODECSELECT_NONITUMODE;

           bitRate = ISPEECH1_G722_BITRATE_RATE0;// g722_64k

           inBuf.bufSize  =160;

           outBuf. bufSize = 320 * 2;

     

    so I doubt  whether the g722_56k ,g722_48k in the g722 lib(Version 2.00.00.000) is same as g722_64k?  could you help me to explain why this Phenomenon happened?

    thanks

    Sunfarmer

  • Hi Sunfarmer,

    In the line highlighted by you, the least significant two bits are always zero since every byte is ending with 0(0x00), 4 (0x0100), 8 (0x1000) or c (0x1100)