[xiph-commits] r11306 - in trunk/speex/ti: . speex_C54_test speex_C55_test speex_C64_test

jm at svn.xiph.org jm at svn.xiph.org
Fri Apr 28 07:04:28 PDT 2006


Author: jm
Date: 2006-04-28 07:04:22 -0700 (Fri, 28 Apr 2006)
New Revision: 11306

Modified:
   trunk/speex/ti/speex_C54_test/speex_C54_test.pjt
   trunk/speex/ti/speex_C55_test/speex_C55_test.pjt
   trunk/speex/ti/speex_C64_test/speex_C64_test.pjt
   trunk/speex/ti/testenc-TI-C5x.c
   trunk/speex/ti/testenc-TI-C64x.c
Log:
TI C5x and C6x DSP project update from Jim Crichton


Modified: trunk/speex/ti/speex_C54_test/speex_C54_test.pjt
===================================================================
--- trunk/speex/ti/speex_C54_test/speex_C54_test.pjt	2006-04-28 12:04:32 UTC (rev 11305)
+++ trunk/speex/ti/speex_C54_test/speex_C54_test.pjt	2006-04-28 14:04:22 UTC (rev 11306)
@@ -1,10 +1,11 @@
 ; Code Composer Project File, Version 2.0 (do not modify or remove this line)
 
 [Project Settings]
-ProjectDir="C:\speextrunktest\ti\speex_C54_test\"
+ProjectDir="C:\speex_11234\ti\speex_C54_test\"
 ProjectType=Executable
 CPUFamily=TMS320C54XX
 Tool="Compiler"
+Tool="CustomBuilder"
 Tool="DspBiosBuilder"
 Tool="Linker"
 Config="Debug"
@@ -36,14 +37,15 @@
 Source="..\..\libspeex\speex_callbacks.c"
 Source="..\..\libspeex\vbr.c"
 Source="..\..\libspeex\vq.c"
+Source="..\..\libspeex\window.c"
 Source="..\..\ti\testenc-TI-C5x.c"
 Source="speex_C54_test.cmd"
 
 ["Compiler" Settings: "Debug"]
-Options=-g -q -o3 -fr"..\ti\speex_C54_test\Debug" -i"..\ti" -i"..\include" -d"_DEBUG" -d"CONFIG_TI_C55X" -d"CONFIG_TI_C54X" -d"HAVE_CONFIG_H" -d"NO_LONGLONG" -mf -ms
+Options=-g -q -o3 -fr"..\ti\speex_C54_test\Debug" -i"..\ti" -i"..\include" -d"_DEBUG" -d"CONFIG_TI_C54X" -d"HAVE_CONFIG_H" -d"NO_LONGLONG" -mf -ms
 
 ["Compiler" Settings: "Release"]
-Options=-q -o2 -fr"..\ti\speex_C54_test\Release" -i"..\ti" -i"..\include" -d"CONFIG_TI_C55X" -d"HAVE_CONFIG_H" -d"NO_LONGLONG" -mf -ms
+Options=-q -o2 -fr"..\ti\speex_C54_test\Release" -i"..\ti" -i"..\include" -d"CONFIG_TI_C54X" -d"HAVE_CONFIG_H" -d"NO_LONGLONG" -mf -ms
 
 ["DspBiosBuilder" Settings: "Debug"]
 Options=-v54

Modified: trunk/speex/ti/speex_C55_test/speex_C55_test.pjt
===================================================================
--- trunk/speex/ti/speex_C55_test/speex_C55_test.pjt	2006-04-28 12:04:32 UTC (rev 11305)
+++ trunk/speex/ti/speex_C55_test/speex_C55_test.pjt	2006-04-28 14:04:22 UTC (rev 11306)
@@ -1,10 +1,11 @@
 ; Code Composer Project File, Version 2.0 (do not modify or remove this line)
 
 [Project Settings]
-ProjectDir="C:\speextrunktest\ti\speex_C55_test\"
+ProjectDir="C:\speex_11234\ti\speex_C55_test\"
 ProjectType=Executable
 CPUFamily=TMS320C55XX
 Tool="Compiler"
+Tool="CustomBuilder"
 Tool="DspBiosBuilder"
 Tool="Linker"
 Config="Debug"
@@ -36,6 +37,7 @@
 Source="..\..\libspeex\speex_callbacks.c"
 Source="..\..\libspeex\vbr.c"
 Source="..\..\libspeex\vq.c"
+Source="..\..\libspeex\window.c"
 Source="..\..\ti\testenc-TI-C5x.c"
 Source="speex_C55_test.cmd"
 

Modified: trunk/speex/ti/speex_C64_test/speex_C64_test.pjt
===================================================================
--- trunk/speex/ti/speex_C64_test/speex_C64_test.pjt	2006-04-28 12:04:32 UTC (rev 11305)
+++ trunk/speex/ti/speex_C64_test/speex_C64_test.pjt	2006-04-28 14:04:22 UTC (rev 11306)
@@ -1,16 +1,18 @@
 ; Code Composer Project File, Version 2.0 (do not modify or remove this line)
 
 [Project Settings]
-ProjectDir="E:\speextrunktest\ti\speex_C64_test\"
+ProjectDir="C:\speex_11234\ti\speex_C64_test\"
 ProjectType=Executable
 CPUFamily=TMS320C64XX
 Tool="Compiler"
+Tool="CustomBuilder"
 Tool="DspBiosBuilder"
 Tool="Linker"
 Config="Debug"
 Config="Release"
 
 [Source Files]
+Source="..\..\..\CCStudio_v3.1\C6000\cgtools\lib\rts6400.lib"
 Source="..\..\libspeex\bits.c"
 Source="..\..\libspeex\cb_search.c"
 Source="..\..\libspeex\exc_10_16_table.c"
@@ -36,15 +38,15 @@
 Source="..\..\libspeex\speex_callbacks.c"
 Source="..\..\libspeex\vbr.c"
 Source="..\..\libspeex\vq.c"
+Source="..\..\libspeex\window.c"
 Source="..\testenc-TI-C64x.c"
-Source="C:\ti\c6000\cgtools\lib\rts6400.lib"
 Source="speex_C64_test.cmd"
 
 ["Compiler" Settings: "Debug"]
-Options=-g -o3 -fr"$(Proj_dir)\Debug" -i"..\ti" -i"..\include" -d"_DEBUG" -d"HAVE_CONFIG_H" -mv6400
+Options=-g -o3 -fr"$(Proj_dir)\Debug" -i"..\ti" -i"..\include" -d"_DEBUG" -d"CONFIG_TI_C6X" -d"HAVE_CONFIG_H" -mv6400
 
 ["Compiler" Settings: "Release"]
-Options=-o3 -fr"$(Proj_dir)\Release" -i"..\ti" -i"..\include"  -i"..\" -i"..\..\include" -d"HAVE_CONFIG_H" -mv6400
+Options=-o3 -fr"$(Proj_dir)\Release" -i"..\ti" -i"..\include" -d"HAVE_CONFIG_H" -mv6400
 
 ["DspBiosBuilder" Settings: "Debug"]
 Options=-v6x
@@ -57,3 +59,4 @@
 
 ["Linker" Settings: "Release"]
 Options=-c -m".\Release\speex_C64_test.map" -o".\Release\speex_C64_test.out" -w -x
+

Modified: trunk/speex/ti/testenc-TI-C5x.c
===================================================================
--- trunk/speex/ti/testenc-TI-C5x.c	2006-04-28 12:04:32 UTC (rev 11305)
+++ trunk/speex/ti/testenc-TI-C5x.c	2006-04-28 14:04:22 UTC (rev 11306)
@@ -46,13 +46,34 @@
 #include <..\libspeex\arch.h>
 
 #undef DECODE_ONLY
+#define CHECK_RESULT  /* Compares original file with encoded/decoder file */
+#define TESTENC_BYTES_PER_FRAME 20  /* 8kbps */
+#define TESTENC_QUALITY 4 /* 8kbps */
+//#define TESTENC_BYTES_PER_FRAME 28  /* 11kbps */
+//#define TESTENC_QUALITY 5	      /* 11 kbps */
 
+/* For narrowband, QUALITY maps to these bit rates (see modes.c, manual.pdf) 
+ *   {1, 8, 2, 3, 3, 4, 4, 5, 5, 6, 7}
+ * 0 -> 2150
+ * 1 -> 3950
+ * 2 -> 5950
+ * 3 -> 8000
+ * 4 -> 8000
+ * 5 -> 11000
+ * 6 -> 11000
+ * 7 -> 15000
+ * 8 -> 15000
+ * 9 -> 18200
+ *10 -> 26400  */
+
 #ifdef FIXED_DEBUG
 extern long long spx_mips;
 #endif
 #include <math.h>
 
 #ifdef MANUAL_ALLOC
+/* Take all Speex space from this private heap */ 
+/* This is useful for multichannel applications */
 #pragma DATA_SECTION(spxHeap, ".myheap"); 
 static char spxHeap[SPEEX_PERSIST_STACK_SIZE];
 
@@ -95,25 +116,27 @@
 {
    char *outFile, *bitsFile;
    FILE *fout, *fbits=NULL;
-#ifndef DECODE_ONLY
+#if !defined(DECODE_ONLY) || defined(CHECK_RESULT)
    char *inFile;
    FILE *fin;
+   short in_short[FRAME_SIZE];
 #endif
    short out_short[FRAME_SIZE];
    short inout_byte[2*FRAME_SIZE];
 #ifndef DECODE_ONLY
-   short in_short[FRAME_SIZE];
+   int nbChars;
+#endif
+#ifdef CHECK_RESULT
    float sigpow,errpow,snr, seg_snr=0;
    int snr_frames = 0;
-   int nbChars;
    int i;
 #endif
-   char cbits[22];
+   char cbits[TESTENC_BYTES_PER_FRAME/2 + 2];  /* temp store for encoded data */
    void *st;
    void *dec;
    SpeexBits bits;
    int tmp;
-   unsigned int bitCount=0;
+   unsigned long bitCount=0;
    int skip_group_delay;
    SpeexCallback callback;
 
@@ -124,7 +147,7 @@
    asm("	STM	#0,SWWSR");
 #endif
 
-#ifndef DECODE_ONLY
+#ifdef CHECK_RESULT
    sigpow = 0;
    errpow = 0;
 #endif
@@ -156,24 +179,26 @@
    speex_decoder_ctl(dec, SPEEX_SET_ENH, &tmp);
    tmp=0;
    speex_encoder_ctl(st, SPEEX_SET_VBR, &tmp);
-   tmp=4;
+   tmp=TESTENC_QUALITY;
    speex_encoder_ctl(st, SPEEX_SET_QUALITY, &tmp);
-   tmp=1;
+   tmp=1;  /* Lowest */
    speex_encoder_ctl(st, SPEEX_SET_COMPLEXITY, &tmp);
 
    speex_mode_query(&speex_nb_mode, SPEEX_MODE_FRAME_SIZE, &tmp);
    fprintf (stderr, "frame size: %d\n", tmp);
-   skip_group_delay = tmp / 2;
+   skip_group_delay = tmp / 4;  /* algorithmic delay */
 
 #ifdef DECODE_ONLY
-   bitsFile = "c:\\speextrunktest\\samples\\malebitsin5x.dat";
+   bitsFile = "c:\\speextrunktest\\samples\\malebitsin.dat";
    fbits = fopen(bitsFile, "rb");
 #else
    bitsFile = "c:\\speextrunktest\\samples\\malebits.dat";
    fbits = fopen(bitsFile, "wb");
 #endif
+#if !defined(DECODE_ONLY) || defined(CHECK_RESULT)
    inFile = "c:\\speextrunktest\\samples\\male.snd";
    fin = fopen(inFile, "rb");
+#endif
    outFile = "c:\\speextrunktest\\samples\\maleout.snd";
    fout = fopen(outFile, "wb+");
  
@@ -189,7 +214,8 @@
       speex_bits_reset(&bits);
 
       speex_encode_int(st, in_short, &bits);
-      nbChars = speex_bits_write(&bits, cbits, sizeof(cbits))/BYTES_PER_CHAR;
+      nbChars = speex_bits_write(&bits, cbits, 
+                         sizeof(cbits)*BYTES_PER_CHAR) /BYTES_PER_CHAR;
       bitCount+=bits.nbBits;
 
       word2byte((short *) cbits, inout_byte, nbChars);
@@ -199,13 +225,13 @@
 #else /* DECODE_ONLY */
    while (!feof(fbits))
    {
-      fread(inout_byte, 1, 20, fbits);
+      fread(inout_byte, 1, TESTENC_BYTES_PER_FRAME, fbits);
 
       if (feof(fbits))
          break;
 
-      byte2word(inout_byte, (short *)cbits, 10);
-      speex_bits_read_from(&bits, cbits, 20);
+      byte2word(inout_byte, (short *)cbits, TESTENC_BYTES_PER_FRAME/2);
+      speex_bits_read_from(&bits, cbits, TESTENC_BYTES_PER_FRAME);
       bitCount+=160;
 #endif
       speex_decode_int(dec, &bits, out_short);
@@ -215,30 +241,25 @@
       fwrite(inout_byte, 2, FRAME_SIZE-skip_group_delay, fout);
       skip_group_delay = 0;
 #if 1
-   fprintf (stderr, "Bits so far: %u \n", bitCount);
+   fprintf (stderr, "Bits so far: %lu \n", bitCount);
 #endif
    }
-   fprintf (stderr, "Total encoded size: %u bits\n", bitCount);
+   fprintf (stderr, "Total encoded size: %lu bits\n", bitCount);
    speex_encoder_destroy(st);
    speex_decoder_destroy(dec);
 
-#ifndef DECODE_ONLY
+#ifdef CHECK_RESULT
    rewind(fin);
    rewind(fout);
 
-//   while ( FRAME_SIZE == fread(in_short, sizeof(short), FRAME_SIZE, fin) 
-//           &&
-//           FRAME_SIZE ==  fread(out_short, sizeof(short), FRAME_SIZE,fout) )
-   while ( bitCount > 0 )
+   while ( FRAME_SIZE == fread(inout_byte, 2, FRAME_SIZE, fin)) 
    {
 	float s=0, e=0;
 
-    fread(inout_byte, 2, FRAME_SIZE, fin);
     byte2word(inout_byte, in_short, FRAME_SIZE);
     fread(inout_byte, 2, FRAME_SIZE, fout);
     byte2word(inout_byte, out_short, FRAME_SIZE);
 
-    bitCount -= FRAME_SIZE;
         for (i=0;i<FRAME_SIZE;++i) {
             s += (float)in_short[i] * in_short[i];
             e += ((float)in_short[i]-out_short[i]) * ((float)in_short[i]-out_short[i]);
@@ -248,12 +269,7 @@
 	errpow += e;
 	snr_frames++;
    }
-   fclose(fin);
-#endif
-   fclose(fout);
-   fclose(fbits);
 
-#ifndef DECODE_ONLY
    snr = 10 * log10( sigpow / errpow );
    seg_snr /= snr_frames;
    fprintf(stderr,"SNR = %f\nsegmental SNR = %f\n",snr, seg_snr);
@@ -261,5 +277,10 @@
 #ifdef FIXED_DEBUG
    printf ("Total: %f MIPS\n", (float)(1e-6*50*spx_mips/snr_frames));
 #endif
-#endif   
+#endif /* CHECK_RESULT */
+#if !defined(DECODE_ONLY) || defined(CHECK_RESULT)
+   fclose(fin);
+#endif
+   fclose(fout);
+   fclose(fbits);
 }

Modified: trunk/speex/ti/testenc-TI-C64x.c
===================================================================
--- trunk/speex/ti/testenc-TI-C64x.c	2006-04-28 12:04:32 UTC (rev 11305)
+++ trunk/speex/ti/testenc-TI-C64x.c	2006-04-28 14:04:22 UTC (rev 11306)
@@ -43,11 +43,34 @@
 #include <stdlib.h>
 #include <speex/speex_callbacks.h>
 
+#undef DECODE_ONLY
+#define CHECK_RESULT  /* Compares original file with encoded/decoder file */
+#define TESTENC_BYTES_PER_FRAME 20  /* 8kbps */
+#define TESTENC_QUALITY 4 /* 8kbps */
+//#define TESTENC_BYTES_PER_FRAME 28  /* 11kbps */
+//#define TESTENC_QUALITY 5	      /* 11 kbps */
+
+/* For narrowband, QUALITY maps to these bit rates (see modes.c, manual.pdf) 
+ *   {1, 8, 2, 3, 3, 4, 4, 5, 5, 6, 7}
+ * 0 -> 2150
+ * 1 -> 3950
+ * 2 -> 5950
+ * 3 -> 8000
+ * 4 -> 8000
+ * 5 -> 11000
+ * 6 -> 11000
+ * 7 -> 15000
+ * 8 -> 15000
+ * 9 -> 18200
+ *10 -> 26400  */
+
 #ifdef FIXED_DEBUG
 extern long long spx_mips;
 #endif
 
 #ifdef MANUAL_ALLOC
+/* Take all Speex space from this private heap */ 
+/* This is useful for multichannel applications */
 #pragma DATA_SECTION(spxHeap, ".myheap"); 
 static char spxHeap[SPEEX_PERSIST_STACK_SIZE];
 
@@ -63,20 +86,18 @@
 {
    char *outFile, *bitsFile;
    FILE *fout, *fbits=NULL;
-#ifndef DECODE_ONLY
+#if !defined(DECODE_ONLY) || defined(CHECK_RESULT)
    char *inFile;
    FILE *fin;
+   short in_short[FRAME_SIZE];
 #endif
-#if 0
-   char *dbgoutFile;
-   FILE *fdbgout;
-#endif
    short out_short[FRAME_SIZE];
 #ifndef DECODE_ONLY
-   short in_short[FRAME_SIZE];
+   int nbBits;
+#endif
+#ifdef CHECK_RESULT
    float sigpow,errpow,snr, seg_snr=0;
    int snr_frames = 0;
-   int nbBits;
    int i;
 #endif
    char cbits[200];
@@ -84,11 +105,11 @@
    void *dec;
    SpeexBits bits;
    int tmp;
-   int bitCount=0;
+   unsigned long bitCount=0;
    int skip_group_delay;
    SpeexCallback callback;
 
-#ifndef DECODE_ONLY
+#ifdef CHECK_RESULT
    sigpow = 0;
    errpow = 0;
 #endif
@@ -120,39 +141,34 @@
    speex_decoder_ctl(dec, SPEEX_SET_ENH, &tmp);
    tmp=0;
    speex_encoder_ctl(st, SPEEX_SET_VBR, &tmp);
-   tmp=4;
+   tmp=TESTENC_QUALITY;
    speex_encoder_ctl(st, SPEEX_SET_QUALITY, &tmp);
-   tmp=1;
+   tmp=1;  /* Lowest */
    speex_encoder_ctl(st, SPEEX_SET_COMPLEXITY, &tmp);
 
    speex_mode_query(&speex_nb_mode, SPEEX_MODE_FRAME_SIZE, &tmp);
    fprintf (stderr, "frame size: %d\n", tmp);
-   skip_group_delay = tmp / 2;
+   skip_group_delay = tmp / 4;		/* 5ms algorithmic delay */
 
 #ifdef DECODE_ONLY
-   bitsFile = "e:\\speextrunktest\\samples\\malebitsin54.dat";
+   bitsFile = "c:\\speextrunktest\\samples\\malebitsin.dat";
    fbits = fopen(bitsFile, "rb");
 #else
-   bitsFile = "e:\\speextrunktest\\samples\\malebits.dat";
+   bitsFile = "c:\\speextrunktest\\samples\\malebits.dat";
    fbits = fopen(bitsFile, "wb");
 #endif
-   inFile = "e:\\speextrunktest\\samples\\male.snd";
+#if !defined(DECODE_ONLY) || defined(CHECK_RESULT)
+   inFile = "c:\\speextrunktest\\samples\\male.snd";
    fin = fopen(inFile, "rb");
-   outFile = "e:\\speextrunktest\\samples\\maleout.snd";
+#endif
+   outFile = "c:\\speextrunktest\\samples\\maleout.snd";
    fout = fopen(outFile, "wb+");
-#if 0
-   dbgoutFile = "e:\\speextrunktest\\samples\\maledbgout.snd";
-   fdbgout = fopen(dbgoutFile, "wb+");
-#endif
  
    speex_bits_init(&bits);
 #ifndef DECODE_ONLY
    while (!feof(fin))
    {
       fread(in_short, sizeof(short), FRAME_SIZE, fin);
-#if 0
-      fwrite(in_short, sizeof(short), FRAME_SIZE, fdbgout);
-#endif
       if (feof(fin))
          break;
       speex_bits_reset(&bits);
@@ -167,13 +183,14 @@
 #else /* DECODE_ONLY */
    while (!feof(fbits))
    {
-      fread(cbits, 1, 20, fbits);
+      fread(cbits, 1, TESTENC_BYTES_PER_FRAME, fbits);
 
       if (feof(fbits))
          break;
 
-      speex_bits_read_from(&bits, cbits, 20);
-      bitCount+=160;
+      speex_bits_read_from(&bits, cbits, TESTENC_BYTES_PER_FRAME);
+//      bitCount+=160;  /* only correct for 8kbps, but just for the printf */
+      bitCount+=bits.nbBits;
 #endif
       
       speex_decode_int(dec, &bits, out_short);
@@ -182,14 +199,14 @@
       fwrite(&out_short[skip_group_delay], sizeof(short), FRAME_SIZE-skip_group_delay, fout);
       skip_group_delay = 0;
 #if 1
-   fprintf (stderr, "Bits so far: %d \n", bitCount);
+   fprintf (stderr, "Bits so far: %lu \n", bitCount);
 #endif
    }
-   fprintf (stderr, "Total encoded size: %d bits\n", bitCount);
+   fprintf (stderr, "Total encoded size: %lu bits\n", bitCount);
    speex_encoder_destroy(st);
    speex_decoder_destroy(dec);
 
-#ifndef DECODE_ONLY
+#ifdef CHECK_RESULT 
    rewind(fin);
    rewind(fout);
 
@@ -207,12 +224,7 @@
 	errpow += e;
 	snr_frames++;
    }
-   fclose(fin);
-#endif
-   fclose(fout);
-   fclose(fbits);
 
-#ifndef DECODE_ONLY
    snr = 10 * log10( sigpow / errpow );
    seg_snr /= snr_frames;
    fprintf(stderr,"SNR = %f\nsegmental SNR = %f\n",snr, seg_snr);
@@ -220,5 +232,10 @@
 #ifdef FIXED_DEBUG
    printf ("Total: %f MIPS\n", (float)(1e-6*50*spx_mips/snr_frames));
 #endif
-#endif   
+#endif /* CHECK_RESULT */
+#if !defined(DECODE_ONLY) || defined(CHECK_RESULT)
+   fclose(fin);
+#endif
+   fclose(fout);
+   fclose(fbits);
 }



More information about the commits mailing list