RSL10 LPDSP32 AudioCodecs Example Test

Hello,

I am working on AudioCodecs example code of LPDSP32. From the given known codecs, I have chosen G722_DSP. Since this codec does not require sample_rate parameter, I give a sinusoidal wave as input with frame rate = 80 and block size = 4, mode&achannel = 1, for encoding operation. Total input sine wave is 80x16 samples. When I try to convert the decoded output (40x16 size), the expected output has to be similar to initial sine wave. However, I obtain too noisy sine wave.

What might be the reason for wrong encoding or decoding? Is the timing of the input matters, or how should the parameters be adjusted?

Can you provide the source code of the LPDSP32 Program Segment’s source code so that I can understand what frame_size and block_size is?

Thanks in advance.

Hello @nevinsehbal,

Although the G722 Codec does not have an explicit Sample Rate parameter the Codec requires an input audio rate of 16KHz to operate properly.

It is also important to ensure that the transmission rate that is expected over the radio matches the Codec Mode that is set (0 - 48kbps; 1 - 56kbps; 2 - 64kbps), as the Codec Encode/Decode operations will require matching Modes.

Given you are passing a Frame Size of 80 16-bit samples to the Codec (1 Frame per 5ms) and the Codec is set to Mode 1 (56kbps), you can expect to see a Codec Encode output of 35 8-bit encoded samples every 5ms.

Therefore, when you go to Decode these samples, you must pass them in at a rate of 35 bytes every 5ms, or some other derivative of 56kbps (7bytes per millisecond).

Finally, when trying to convert the Decoded output back into the sine wave, please ensure you are treating them as 16kHz samples as this in the only rate the G722 Codec is able to operate within.

The LPDSP source code used to implement the Codecs should be available within the same RSL10 LPDSP32 package used to obtain the “AudioCodecs” sample, specifically found within the "AudioCodecsDSP\src\codecs" directory of the package.

Thank you for reaching out on our Community Forums, and please let us know if you have any follow-up questions!

2 Likes

Hello @brandon.shannon,

Thanks for your reply. Please let me clarify what I understood from your explanation and from AudioCodecsDSP source code.

  • There are 3 modes in G722 codec: 1, 2 and 3. These are:
    1-64kbps 2-56kbps 3-48kbps, because “bitsPerSample = 9 - mode” in the source code.

  • In encoding, when I pass a frame of 80x16-bits, I should obtain 40x8-bits (assuming 64kbps). Therefore, the data is 4 times compressed.
    Operation parameters should be:
    action = ENCODE | ENCODE_RESET
    frameSize = 80
    blockSize = 4 // Does this have an effect on codec?
    modeAndChannel = 1
    sampleRate = 0

  • In decoding, when I pass a frame of 40x8-bits, I obtain 80x16-bits.
    Operation parameters should be:
    action = DECODE | DECODE_RESET
    frameSize = 40
    blockSize = 4 or 2?
    modeAndChannel = 1
    sampleRate = 0

  • blockSize parameter is a question mark, does it affect codec?

  • Should I set ENCODE_RESET or DECODE_RESET action for every frame?

  • As far as I understand, a timer is not needed for loading the data in both encoding and decoding. i.e. G722 codec does not require real-time data feeding (e.g. every 5ms), and the mode option (64kbps) is only used to understand the input&output size. Am I right?

I’d be glad if you answer these questions. Thanks in advance.

@nevinsehbal

  • In encoding, when I pass a frame of 80x16-bits, I should obtain 40x8-bits (assuming 64kbps). Therefore, the data is 4 times compressed.
    Operation parameters should be:
    action = ENCODE | ENCODE_RESET
    frameSize = 80
    blockSize = 4 // Does this have an effect on codec?
    modeAndChannel = 1
    sampleRate = 0
  • In decoding, when I pass a frame of 40x8-bits, I obtain 80x16-bits.
    Operation parameters should be:
    action = DECODE | DECODE_RESET
    frameSize = 40
    blockSize = 4 or 2?
    modeAndChannel = 1
    sampleRate = 0
  • blockSize parameter is a question mark, does it affect codec?
  • Should I set ENCODE_RESET or DECODE_RESET action for every frame?

Each 5ms period, might need NCODE_RESET or DECODE_RESET action for 5ms.

Please see the picture below:

image

In the 5ms period, we do have 4 blocks and 4 frames.
1. frameSize = The frame size to be used (samples)
2. blockSize = The block size or subframe size (samples)
A1: blockSize effect codec since it need do codec 4 times (if blobksize=4)
A2: After decoding, the framesize =40 and blockSize= 4 (no changing)

As far as I understand, a timer is not needed for loading the data in both encoding and decoding. i.e. G722 codec does not require real-time data feeding (e.g. every 5ms), and the mode option (64kbps) is only used to understand the input&output size. Am I right?

Every 5ms timer is for our custom audio protocol processing definition.(see picture). Therefore, there is no requirement for a real-time data feeding. Codec/Decode just do frame to frame processing.
For sure, it will cause delay for codec/decode processing.

1 Like