[Speex-dev] SPEEX_GET_QUALITY

A. Maitland Bottoms bottoms at debian.org
Sun Feb 27 05:45:20 PST 2005


To close debian bug #271052, 
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=271052

I went ahead and did the following:

$ diff -u ../original/speex-1.1.6/libspeex/nb_celp.c libspeex/nb_celp.c
--- ../original/speex-1.1.6/libspeex/nb_celp.c	2004-07-15 01:16:52.000000000 -0400
+++ libspeex/nb_celp.c	2005-02-27 08:24:49.000000000 -0500
@@ -1746,6 +1746,21 @@
          st->submodeSelect = st->submodeID = ((SpeexNBMode*)(st->mode->mode))->quality_map[quality];
       }
       break;
+   case SPEEX_GET_QUALITY:
+      {
+         int quality;
+
+	 for(quality=0;quality <=10; quality++)
+	   if (st->submodeID == ((SpeexNBMode*)(st->mode->mode))->quality_map[quality]) break;
+
+	 if (quality>10) {
+	   (*(int*)ptr) = -1;
+	   speex_warning("quality not set");
+	   return -1;
+	 } else
+	   (*(int*)ptr) = quality;
+      }
+      break;
    case SPEEX_SET_COMPLEXITY:
       st->complexity = (*(int*)ptr);
       if (st->complexity<1)

$ diff -u ../original/speex-1.1.6/libspeex/sb_celp.c libspeex/sb_celp.c
--- ../original/speex-1.1.6/libspeex/sb_celp.c	2004-07-15 01:16:52.000000000 -0400
+++ libspeex/sb_celp.c	2005-02-27 08:33:38.000000000 -0500
@@ -1217,6 +1217,13 @@
          speex_encoder_ctl(st->st_low, SPEEX_SET_MODE, &nb_qual);
       }
       break;
+   case SPEEX_GET_QUALITY:
+      {
+         int quality;
+         speex_encoder_ctl(st->st_low, SPEEX_GET_QUALITY, &quality);
+	 (*(int*)ptr) = quality;
+      }
+      break;
    case SPEEX_SET_COMPLEXITY:
       speex_encoder_ctl(st->st_low, SPEEX_SET_COMPLEXITY, ptr);
       st->complexity = (*(int*)ptr);


Is that good enough to add to the speex subversion repo for inclusion in
future releases?

-Maitland


More information about the Speex-dev mailing list