16-bit clean shift in lsp_to_lpc()
[speexdsp.git] / libspeex / testenc_wb.c
index a1df051..7a19189 100644 (file)
@@ -1,9 +1,13 @@
-#include "speex.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <speex/speex.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include "speex_callbacks.h"
+#include <speex/speex_callbacks.h>
 
-#ifdef COUNT_MIPS
+#ifdef FIXED_DEBUG
 extern long long spx_mips;
 #endif
 
@@ -45,23 +49,24 @@ int main(int argc, char **argv)
    callback.data = st;
    speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback);
 
-   tmp=0;
+   tmp=1;
    speex_decoder_ctl(dec, SPEEX_SET_ENH, &tmp);
    tmp=0;
    speex_encoder_ctl(st, SPEEX_SET_VBR, &tmp);
    tmp=8;
    speex_encoder_ctl(st, SPEEX_SET_QUALITY, &tmp);
-   tmp=2;
-   speex_encoder_ctl(st, SPEEX_SET_COMPLEXITY, &tmp);
    tmp=3;
+   speex_encoder_ctl(st, SPEEX_SET_COMPLEXITY, &tmp);
+   /*tmp=3;
    speex_encoder_ctl(st, SPEEX_SET_HIGH_MODE, &tmp);
    tmp=6;
    speex_encoder_ctl(st, SPEEX_SET_LOW_MODE, &tmp);
+*/
 
+   speex_encoder_ctl(st, SPEEX_GET_LOOKAHEAD, &skip_group_delay);
+   speex_decoder_ctl(dec, SPEEX_GET_LOOKAHEAD, &tmp);
+   skip_group_delay += tmp;
 
-   speex_mode_query(&speex_wb_mode, SPEEX_MODE_FRAME_SIZE, &tmp);
-   fprintf (stderr, "frame size: %d\n", tmp);
-   skip_group_delay = 223;
 
    if (argc != 4 && argc != 3)
    {
@@ -87,7 +92,7 @@ int main(int argc, char **argv)
          in_float[i]=in_short[i];
       speex_bits_reset(&bits);
 
-      speex_encode(st, in_short, &bits);
+      speex_encode_int(st, in_short, &bits);
       nbBits = speex_bits_write(&bits, cbits, 200);
       bitCount+=bits.nbBits;
 
@@ -95,7 +100,7 @@ int main(int argc, char **argv)
          fwrite(cbits, 1, nbBits, fbits);
       speex_bits_rewind(&bits);
 
-      speex_decode(dec, &bits, out_short);
+      speex_decode_int(dec, &bits, out_short);
       speex_bits_reset(&bits);
 
       fwrite(&out_short[skip_group_delay], sizeof(short), FRAME_SIZE-skip_group_delay, fout);
@@ -104,6 +109,7 @@ int main(int argc, char **argv)
    fprintf (stderr, "Total encoded size: %d bits\n", bitCount);
    speex_encoder_destroy(st);
    speex_decoder_destroy(dec);
+   speex_bits_destroy(&bits);
 
    rewind(fin);
    rewind(fout);
@@ -129,7 +135,7 @@ int main(int argc, char **argv)
    seg_snr /= snr_frames;
    fprintf(stderr,"SNR = %f\nsegmental SNR = %f\n",snr, seg_snr);
 
-#ifdef COUNT_MIPS
+#ifdef FIXED_DEBUG
    printf ("Total: %f MIPS\n", (float)(1e-6*50*spx_mips/snr_frames));
 #endif