[xiph-cvs] cvs commit: ices/src cfgparse.c encode.c

Karl Heyes karl at xiph.org
Sun Dec 21 17:53:21 PST 2003



karl        03/12/21 20:53:21

  Modified:    src      cfgparse.c encode.c
  Log:
  update encoder setup, use managed mode only when settings require it

Revision  Changes    Path
1.8       +1 -4      ices/src/cfgparse.c

Index: cfgparse.c
===================================================================
RCS file: /usr/local/cvsroot/ices/src/cfgparse.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- cfgparse.c	21 Dec 2003 03:38:53 -0000	1.7
+++ cfgparse.c	22 Dec 2003 01:53:20 -0000	1.8
@@ -1,7 +1,7 @@
 /* cfgparse.c
  * - cfgparse file reading code, plus default settings.
  *
- * $Id: cfgparse.c,v 1.7 2003/12/21 03:38:53 karl Exp $
+ * $Id: cfgparse.c,v 1.8 2003/12/22 01:53:20 karl Exp $
  *
  * Copyright (c) 2001 Michael Smith <msmith at labyrinth.net.au>
  *
@@ -168,10 +168,7 @@
         if (xmlIsBlankNode(node)) continue;
 
         if (strcmp(node->name, "nominal-bitrate") == 0)
-        {
             SET_INT(instance->nom_br);
-            instance->managed = 1;
-        }
         else if (strcmp(node->name, "minimum-bitrate") == 0)
             SET_INT(instance->min_br);
         else if (strcmp(node->name, "maximum-bitrate") == 0)

<p><p>1.18      +16 -16    ices/src/encode.c

Index: encode.c
===================================================================
RCS file: /usr/local/cvsroot/ices/src/encode.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- encode.c	19 Dec 2003 03:27:31 -0000	1.17
+++ encode.c	22 Dec 2003 01:53:20 -0000	1.18
@@ -1,7 +1,7 @@
 /* encode.c
  * - runtime encoding of PCM data.
  *
- * $Id: encode.c,v 1.17 2003/12/19 03:27:31 karl Exp $
+ * $Id: encode.c,v 1.18 2003/12/22 01:53:20 karl Exp $
  *
  * Copyright (c) 2001 Michael Smith <msmith at labyrinth.net.au>
  *
@@ -65,25 +65,23 @@
                     "channels, %d Hz, minimum bitrate %d, nominal %d, "
                     "maximum %d", channels, rate, min_br, nom_br, max_br);
 
-            if (vorbis_encode_setup_managed (&s->vi, channels, rate, max_br, nom_br, min_br) ||
-                    vorbis_encode_setup_init(&s->vi))
+            if (vorbis_encode_setup_managed (&s->vi, channels,
+                        rate, max_br, nom_br, min_br))
                 break;
         }
         else
         {
             if (nom_br < 0)
             {
-                if (min_br > 0 || max_br > 0) {
-                    LOG_INFO5("Encoder initialising in constrained VBR mode: %d "
-                            "channels, %d Hz, quality %f, minimum bitrate %d, "
-                            "maximum %d", channels, rate, quality, min_br, max_br);
-                } else {
-                    LOG_INFO3("Encoder initialising in VBR mode: %d channel(s), %d Hz, "
-                            "quality %f", channels, rate, quality);
-                }
+                LOG_INFO3("Encoder initialising in VBR mode: %d channel(s), "
+                        "%d Hz, quality %f", channels, rate, quality);
+                if (min_br > 0 || max_br > 0)
+                    LOG_INFO0("ignoring min/max bitrate, not supported in VBR "
+                            "mode, use nominal-bitrate instead");
                 if (vorbis_encode_setup_vbr(&s->vi, channels, rate, quality*0.1))
                     break;
 
+#if 0
                 if (max_br > 0 || min_br > 0)
                 {
                     struct ovectl_ratemanage_arg ai;
@@ -95,19 +93,21 @@
                     if (vorbis_encode_ctl(&s->vi, OV_ECTL_RATEMANAGE_SET, &ai))
                         break;
                 }
-                if (vorbis_encode_setup_init(&s->vi))
-                    break;
+#endif
             }
             else
             {
                 LOG_INFO3("Encoder initialising in VBR mode: %d "
                         "channels, %d Hz, nominal %d", channels, rate, nom_br);
-                if (vorbis_encode_setup_managed (&s->vi, channels, rate, max_br, nom_br, max_br) ||
-                        vorbis_encode_ctl (&s->vi, OV_ECTL_RATEMANAGE_AVG, NULL) ||
-                        vorbis_encode_setup_init(&s->vi))
+                if (vorbis_encode_setup_managed (&s->vi, channels,
+                            rate, max_br, nom_br, max_br))
+                    break;
+                if (vorbis_encode_ctl (&s->vi, OV_ECTL_RATEMANAGE_SET, NULL))
                     break;
             }
         }
+        if (vorbis_encode_setup_init(&s->vi))
+            break;
 
         vorbis_analysis_init(&s->vd, &s->vi);
         vorbis_block_init(&s->vd, &s->vb);

<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