[xiph-cvs] cvs commit: speex/libspeex nb_celp.c sb_celp.c

Jean-Marc Valin jm at xiph.org
Sat Aug 23 21:28:12 PDT 2003



jm          03/08/24 00:28:12

  Modified:    libspeex nb_celp.c sb_celp.c
  Log:
  Allow setting the decode submode in case it's not embedded in the stream
  (which you shouldn't think about unless you know what you're doing and
  want to be incompatible with everyone else)

Revision  Changes    Path
1.121     +4 -0      speex/libspeex/nb_celp.c

Index: nb_celp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/nb_celp.c,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -r1.120 -r1.121
--- nb_celp.c	22 Aug 2003 22:01:48 -0000	1.120
+++ nb_celp.c	24 Aug 2003 04:28:11 -0000	1.121
@@ -1817,6 +1817,10 @@
    st=(DecState*)state;
    switch(request)
    {
+   case SPEEX_SET_LOW_MODE:
+   case SPEEX_SET_MODE:
+      st->submodeID = (*(int*)ptr);
+      break;
    case SPEEX_GET_LOW_MODE:
    case SPEEX_GET_MODE:
       (*(int*)ptr) = st->submodeID;

<p><p>1.125     +20 -0     speex/libspeex/sb_celp.c

Index: sb_celp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/sb_celp.c,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -r1.124 -r1.125
--- sb_celp.c	22 Aug 2003 22:01:48 -0000	1.124
+++ sb_celp.c	24 Aug 2003 04:28:11 -0000	1.125
@@ -1268,6 +1268,12 @@
    st=(SBDecState*)state;
    switch(request)
    {
+   case SPEEX_SET_HIGH_MODE:
+      st->submodeID = (*(int*)ptr);
+      break;
+   case SPEEX_SET_LOW_MODE:
+      speex_encoder_ctl(st->st_low, SPEEX_SET_LOW_MODE, ptr);
+      break;
    case SPEEX_GET_LOW_MODE:
       speex_decoder_ctl(st->st_low, SPEEX_GET_LOW_MODE, ptr);
       break;
@@ -1278,6 +1284,20 @@
       speex_decoder_ctl(st->st_low, request, ptr);
       st->lpc_enh_enabled = *((int*)ptr);
       break;
+   case SPEEX_SET_MODE:
+   case SPEEX_SET_QUALITY:
+      {
+         int nb_qual;
+         int quality = (*(int*)ptr);
+         if (quality < 0)
+            quality = 0;
+         if (quality > 10)
+            quality = 10;
+         st->submodeID = ((SpeexSBMode*)(st->mode->mode))->quality_map[quality];
+         nb_qual = ((SpeexSBMode*)(st->mode->mode))->low_quality_map[quality];
+         speex_decoder_ctl(st->st_low, SPEEX_SET_MODE, &nb_qual);
+      }
+      break;
    case SPEEX_GET_BITRATE:
       speex_decoder_ctl(st->st_low, request, ptr);
       if (st->submodes[st->submodeID])

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list