Note that there are some explanatory texts on larger screens.

plurals
  1. POSpeex decoded frame is not as the original frame
    primarykey
    data
    text
    <p>i need your help in determining the problem in the following sample code (taken from speex manual) for fixed point encoding. i tested encoding a 160 sample frame and then decoding it back But The problem is that the decoded frame is totally different from the original frame(see output below in a comment).What is the possible reason for this?.thanks for any help</p> <pre><code>#include&lt;stdio.h&gt; #include"intel16.h" #include &lt;speex/speex.h&gt; #define FRAME_SIZE 160 #define MAX_NB_BYTES 25 SpeexBits bits; void *enc_state; int quality=4; int nbBytes; int byte_ptr; int frame_size; short frame[FRAME_SIZE]; char outBuffer[20]; SpeexBits decBits; void *dec_state; short decFrame[FRAME_SIZE]; int z=0; int frame_size; int main (int argc,char **argv) { for( z=0;z&lt;160;z++) { frame[z]=intel_theme[z]; //array of short from "intel16" header file } printf("\n =================================== \n"); for( z=0;z&lt;160;z++) { printf("%i",frame[z]); printf (" "); } speex_bits_init(&amp;bits); enc_state = speex_encoder_init(&amp;speex_nb_mode); speex_encoder_ctl(enc_state,SPEEX_GET_FRAME_SIZE,&amp;frame_size); speex_encoder_ctl(enc_state,SPEEX_SET_QUALITY,&amp;quality); speex_bits_reset(&amp;bits); speex_encode_int(enc_state, frame, &amp;bits); // encoding from frame to &amp;bits nbBytes = speex_bits_write(&amp;bits, outBuffer, MAX_NB_BYTES); //writing from &amp;bits to outBuffer //---------------------------------------------------- speex_bits_destroy(&amp;bits); speex_encoder_destroy(enc_state); printf("\n outBuffer: "); for(z=0;z&lt;20;z++) { printf("%c",outBuffer[z]); } printf("\n \n"); //-----------DECODING------------------- speex_bits_init(&amp;decBits); dec_state=speex_decoder_init(&amp;speex_nb_mode); speex_decoder_ctl(dec_state, SPEEX_GET_FRAME_SIZE, &amp;frame_size); speex_bits_read_from(&amp;decBits,outBuffer,nbBytes); speex_decode_int(dec_state,&amp;decBits,decFrame); //---------------------------------------------------- printf("\n BUFFER DECODED BACK \n"); for(z=0;z&lt;160;z++) { printf("%i",decFrame[z]); printf (" "); } speex_bits_destroy(&amp;decBits); speex_decoder_destroy(dec_state); /*==========END OF DECODING==============*/ printf("\n nbBytes: "); printf("%i",nbBytes); printf("\n frame_size= "); printf("%i",frame_size); printf ("\n"); //----------------- printf("end of run!"); return 0; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload