alternative to assert in quantise.c, still need a way to get info on errors
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Fri, 1 Oct 2010 08:09:21 +0000 (08:09 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Fri, 1 Oct 2010 08:09:21 +0000 (08:09 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@198 01035d8c-6547-0410-b346-abe4f91aad63

codec2/src/c2sim.c
codec2/src/quantise.c

index 1230425d350731bab8a56c2604e7eb9f9208aff8..772196483f303a2d83cddd37704be03d30dcaab1 100644 (file)
@@ -144,7 +144,7 @@ int main(int argc, char *argv[])
     fprintf(stderr, "\nCodec2 - 2400 bit/s speech codec - Simulation Program\n"
      "\thttp://rowetel.com/codec2.html\n\n"
      "usage: %s InputFile [-o OutputFile]\n"
-     "\t[-lpc Order]\n"
+     "\t[--lpc Order]\n"
      "\t[--lsp]\n"
      "\t[--phase0]\n"
      "\t[--postfilter]\n"
index e386bf8905c8ac9d856db729c106d3cdc51ec817..3d1d9bf82f4c05ab60501fb49a8d6e640c205256 100644 (file)
@@ -475,7 +475,17 @@ float speech_to_uq_lsps(float lsp[],
        E += ak[i]*R[i];
  
     roots = lpc_to_lsp(ak, order, lsp, 5, LSP_DELTA1);
-    assert(roots == order);
+    if (roots != order) {
+       /* for some reason LSP roots could not be found   */
+       /* some alpha testers are reporting this condition */
+       fprintf(stderr, "LSP roots not found!\nroots = %d\n", roots);
+       for(i=0; i<=order; i++)
+           fprintf(stderr, "a[%d] = %f\n", i, ak[i]);  
+       
+       /* some benign LSP values we can use instead */
+       for(i=0; i<order; i++)
+           lsp[i] = (PI/order)*(float)i;
+    }
 
     return E;
 }