Commit a1dd0fcf authored by Timothy B. Terriberry's avatar Timothy B. Terriberry Committed by Jean-Marc Valin
Browse files

Update Opus range coder due to CELT refactoring.

The byte buffer is now part of the range coder struct itself, and
 rangeenc.c and rangedec.c have gone away.
parent 50b20d78
celt @ 7d2200be
Subproject commit ef986e44211bc0fd3820700b61e552828a0d8c65
Subproject commit 7d2200be41538645b5e5765b4aa2ea5bab990030
......@@ -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
silk @ fc06bda8
Subproject commit 111b23f648a45d3a034050e579a531d0592dc720
Subproject commit fc06bda89e40f8adfa1af9cebf869e63ef693bb5
......@@ -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;
}
......
......@@ -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);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment