Update Opus range coder due to CELT refactoring.
authorTimothy B. Terriberry <tterribe@xiph.org>
Thu, 3 Feb 2011 22:52:50 +0000 (14:52 -0800)
committerJean-Marc Valin <jean-marc.valin@usherbrooke.ca>
Fri, 4 Feb 2011 03:32:27 +0000 (22:32 -0500)
The byte buffer is now part of the range coder struct itself, and
 rangeenc.c and rangedec.c have gone away.

celt
celt_sources.mk
silk
src/opus_decoder.c
src/opus_encoder.c

diff --git a/celt b/celt
index ef986e4..7d2200b 160000 (submodule)
--- a/celt
+++ b/celt
@@ -1 +1 @@
-Subproject commit ef986e44211bc0fd3820700b61e552828a0d8c65
+Subproject commit 7d2200be41538645b5e5765b4aa2ea5bab990030
index a9ad5d0..76e4710 100644 (file)
@@ -12,7 +12,5 @@ celt/libcelt/modes.c \
 celt/libcelt/pitch.c \
 celt/libcelt/plc.c \
 celt/libcelt/quant_bands.c \
-celt/libcelt/rangedec.c \
-celt/libcelt/rangeenc.c \
 celt/libcelt/rate.c \
 celt/libcelt/vq.c
diff --git a/silk b/silk
index 111b23f..fc06bda 160000 (submodule)
--- a/silk
+++ b/silk
@@ -1 +1 @@
-Subproject commit 111b23f648a45d3a034050e579a531d0592dc720
+Subproject commit fc06bda89e40f8adfa1af9cebf869e63ef693bb5
index cb6fef2..a57e1a2 100644 (file)
@@ -79,7 +79,6 @@ int opus_decode(OpusDecoder *st, const unsigned char *data,
 {
        int i, silk_ret=0, celt_ret=0;
        ec_dec dec;
-       ec_byte_buffer buf;
     SKP_SILK_SDK_DecControlStruct DecControl;
     SKP_int32 silk_frame_size;
     short pcm_celt[960*2];
@@ -116,8 +115,7 @@ int opus_decode(OpusDecoder *st, const unsigned char *data,
 
         len -= 1;
         data += 1;
-        ec_byte_readinit(&buf,(unsigned char*)data,len);
-        ec_dec_init(&dec,&buf);
+        ec_dec_init(&dec,(unsigned char*)data,len);
     } else {
         audiosize = frame_size;
     }
index 17164b6..2fe0f5d 100644 (file)
@@ -95,7 +95,6 @@ int opus_encode(OpusEncoder *st, const short *pcm, int frame_size,
        int ret=0;
        SKP_int32 nBytes;
        ec_enc enc;
-       ec_byte_buffer buf;
        int framerate, period;
     int silk_internal_bandwidth;
     int bytes_target;
@@ -103,8 +102,7 @@ int opus_encode(OpusEncoder *st, const short *pcm, int frame_size,
        bytes_target = st->bitrate_bps * frame_size / (st->Fs * 8) - 1;
 
        data += 1;
-       ec_byte_writeinit_buffer(&buf, data, max_data_bytes-1);
-       ec_enc_init(&enc,&buf);
+       ec_enc_init(&enc, data, max_data_bytes-1);
 
        /* SILK processing */
     if (st->mode != MODE_CELT_ONLY) {
@@ -194,7 +192,7 @@ int opus_encode(OpusEncoder *st, const short *pcm, int frame_size,
             int len;
             celt_encoder_ctl(st->celt_enc, CELT_SET_START_BAND(17));
 
-            len = (ec_enc_tell(&enc, 0)+7)>>3;
+            len = (ec_tell(&enc)+7)>>3;
             if( st->use_vbr ) {
                 nb_compr_bytes = len + (st->bitrate_bps - 12000) * frame_size / (2 * 8 * st->Fs);
             } else {
@@ -218,14 +216,14 @@ int opus_encode(OpusEncoder *st, const short *pcm, int frame_size,
         for (;i<frame_size*st->channels;i++)
             pcm_buf[i] = pcm[i-ENCODER_DELAY_COMPENSATION*st->channels];
 
-        ec_byte_shrink(&buf, nb_compr_bytes);
+        ec_enc_shrink(&enc, nb_compr_bytes);
 
            /* Encode high band with CELT */
            ret = celt_encode_with_ec(st->celt_enc, pcm_buf, frame_size, NULL, nb_compr_bytes, &enc);
            for (i=0;i<ENCODER_DELAY_COMPENSATION*st->channels;i++)
                st->delay_buffer[i] = pcm[frame_size*st->channels-ENCODER_DELAY_COMPENSATION*st->channels+i];
        } else {
-           ret = (ec_enc_tell(&enc, 0)+7)>>3;
+           ret = (ec_tell(&enc)+7)>>3;
            ec_enc_done(&enc);
        }