Enabling real CELT VBR

This commit is contained in:
Jean-Marc Valin 2011-02-01 18:08:41 -05:00
parent d354dd2f4e
commit d9ad6e113c
2 changed files with 11 additions and 3 deletions

2
celt

@ -1 +1 @@
Subproject commit 263e27194898248d5ef9500df57075af35f5a86d Subproject commit 7e983194a3ac7c775c7d370a5bf6d71bf68c2645

View file

@ -175,6 +175,8 @@ int opus_encode(OpusEncoder *st, const short *pcm, int frame_size,
celt_encoder_ctl(st->celt_enc, CELT_SET_END_BAND(endband)); 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_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) if (st->mode == MODE_HYBRID)
{ {
int len; int len;
@ -187,11 +189,17 @@ int opus_encode(OpusEncoder *st, const short *pcm, int frame_size,
/* check if SILK used up too much */ /* check if SILK used up too much */
nb_compr_bytes = len > bytes_target ? len : bytes_target; nb_compr_bytes = len > bytes_target ? len : bytes_target;
} }
} else { } else {
celt_encoder_ctl(st->celt_enc, CELT_SET_START_BAND(0)); celt_encoder_ctl(st->celt_enc, CELT_SET_START_BAND(0));
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; nb_compr_bytes = bytes_target;
} }
}
for (i=0;i<ENCODER_DELAY_COMPENSATION*st->channels;i++) for (i=0;i<ENCODER_DELAY_COMPENSATION*st->channels;i++)
pcm_buf[i] = st->delay_buffer[i]; pcm_buf[i] = st->delay_buffer[i];