shithub: opus

Download patch

ref: d9ad6e113c5ca3b01543d7bccf0a98f8fc40d8c0
parent: d354dd2f4e93730635dca4d080ef8307af84a44f
author: Jean-Marc Valin <[email protected]>
date: Tue Feb 1 13:08:41 EST 2011

Enabling real CELT VBR

--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -175,6 +175,8 @@
 	    celt_encoder_ctl(st->celt_enc, CELT_SET_END_BAND(endband));
 	    celt_encoder_ctl(st->celt_enc, CELT_SET_CHANNELS(st->stream_channels));
 
+        celt_encoder_ctl(st->celt_enc, CELT_SET_VBR(0));
+        celt_encoder_ctl(st->celt_enc, CELT_SET_BITRATE(510000));
         if (st->mode == MODE_HYBRID)
         {
             int len;
@@ -187,10 +189,16 @@
                 /* check if SILK used up too much */
                 nb_compr_bytes = len > bytes_target ? len : bytes_target;
             }
-
         } else {
             celt_encoder_ctl(st->celt_enc, CELT_SET_START_BAND(0));
-            nb_compr_bytes = bytes_target;
+            if (st->use_vbr)
+            {
+                celt_encoder_ctl(st->celt_enc, CELT_SET_VBR(1));
+                celt_encoder_ctl(st->celt_enc, CELT_SET_BITRATE(st->bitrate_bps));
+                nb_compr_bytes = max_data_bytes-1;
+            } else {
+                nb_compr_bytes = bytes_target;
+            }
         }
 
 	    for (i=0;i<ENCODER_DELAY_COMPENSATION*st->channels;i++)