Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

G279 Crashing.

damiancoventry
Beginner
956 Views

Hi, I downloaded the speech proessing example code from the IPP page on intel.com. The example program in the zip "w_ipp-G729_p_4.0.005.zip" throws an access violation when giving any 8khz 16bit pcm audio data. However, on the assumption that it's the fault of the example program and not the IPP libray itself, I simply call the following 3 or 4 IPP functions and it crashes with an access violation:

int required_size;
apiG729Decoder_Alloc((G729Codec_Type)G729A_CODEC, &required_size);

G729Decoder_Obj* decoder_ = (G729Decoder_Obj*)ippsMalloc_8u(required_size);
apiG729Decoder_Init(decoder_, (G729Codec_Type)G729A_CODEC);

unsigned char* compressed_buffer;
// compressed_buffer is filled with data from a Cisco7960 IP phone...

short* decompressed_buffer;
// decompressed_buffer is setup...

apiG729Decode(
decoder_,
compressed_buffer,
G729A_CODEC,
decompressed_buffer);

The call to apiG729Decode() throws an access violation on line 1442 of file decg729.c, does anybody have any idea why?

0 Kudos
6 Replies
Vladimir_Dudnik
Employee
956 Views
Hi,
Could you look to expert's answer below:

I may suggest two reasons for exception/violation:

1) First one, let consider the user code snippet: (cleaned out of &amr; etc)

int required_size;

apiG729Decoder_Alloc((G729Codec_Type)G729A_CODEC, required_size);

G729Decoder_Obj* decoder_ = (G729Decoder_Obj*)ippsMalloc_8u(required_size);

apiG729Decoder_Init(decoder_, (G729Codec_Type)G729A_CODEC);

unsigned char* compressed_buffer;// compressed_buffer is filled with data from a Cisco7960 IP phone...

short* decompressed_buffer;// decompressed_buffer is setup...

apiG729Decode(decoder_,compressed_buffer,G729A_CODEC,decompressed_buffer);

I see the bug in

apiG729Decoder_Alloc(..., &required_size);

2) and second one, just to clarify for user proper use of input data, g729 sample supports a raw pcm input for encoder and the ITU G.729 bitstream test format input for decoder. RTP storage format not supported so far.

Regards,
Vladimir

0 Kudos
damiancoventry
Beginner
956 Views
Hi Vladimir,
I think if you changed the code as you specify it wouldn't even compile, and if it did it, running it would crash. The "g729api.h" file defines the two Alloc functions as follows:
Code:
G729_CODECAPI(APIG729_Status, apiG729Encoder_Alloc, (G729Codec_Type codecType, int *pCodecSize))
G729_CODECAPI(APIG729_Status, apiG729Decoder_Alloc, (G729Codec_Type codecType, int *pCodecSize))
Clearly you pass the address of an integer to this function, not an integer. It's my understanding that this function calculates how many bytes you need to allocate and returns it to you via this pointer.
Raw PCM data is being read and fed into the encoder routines, not the decoder - sorry, i should have been more clear here. The raw PCM data is 16 bit mono data, and it's being read at the standard rate of 8khz.
The code is as follows
Code:
int required_size;
apiG729Encoder_Alloc((G729Codec_Type)G729A_CODEC, &required_size);
encoder_ = (G729Encoder_Obj*)ippsMalloc_8u(required_size);
apiG729Encoder_Init(encoder_, (G729Codec_Type)G729A_CODEC, G729Encode_VAD_Disabled);
int frametype;
apiG729Encode(
    encoder_,
    souce_data,
    dest_data,
    G729A_CODEC,
    &frametype);
souce_data is filled with raw PCM data (16 bit mono), and dest_data is bitstream that gets the compressed data. The function apiG729Encode crashes as noted previously when it executes the line:
Code:
/* Clause 3.2.1 Windowing and autocorrelation computation */
ippsAutoCorr_G729B(LPC_WINDOW, &norm,r_auto);
which can be found in the Intel supplied code in the file "encg729.c"
0 Kudos
Vladimir_Dudnik
Employee
956 Views
Hi,
I think it would be better, if you submit this issue through technical support, so itcan be tracked, analized and so on.
Thanks,
Vladimir
0 Kudos
Anonymous87
Beginner
956 Views
Hi,

How do I convert the bitstream format to the format expected by RTP?

Is it better to convert the frame or to modify the G.729 encoder so that is natively generates frames in the format I want?

Where can I find documentation for the 'bitstream' format currently in use?

Regards,

Daniel
0 Kudos
Ulrich_H_1
Beginner
956 Views

I took Damian's source code as template and it also crashed. The reason is missing calls to apiG729Encoder_InitBuffer and apiG729Decoder_InitBuffer. Useful template code can be found at https://github.com/vir/yate-g72X-ipp/blob/master/g729codec.cpp 

Kind regards,
Ulrich
 

0 Kudos
Ying_H_Intel
Employee
956 Views

Dear Ulrich and All,

thanks for the update and sharing.

Just notes, the speech codec functionality including G729 were deprecated from IPP 8.0 version (2 years before).  So no further investigate on all of the related questions. Sorry for the bad news.

Best Regards,
Ying

0 Kudos
Reply