diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2012-07-11 10:54:47 +0400 |
---|---|---|
committer | Gregory Maxwell <greg@xiph.org> | 2012-08-07 02:19:30 +0400 |
commit | 1cd5d95b3fe6ba959037e427324bea22563f67a3 (patch) | |
tree | c4614a02ab99d5a55d2ac35ca9e98371ff9bbb66 /celt/celt.c | |
parent | 02f19c26f17e43f3b8ac6cfe15a3d8a622f8ef07 (diff) |
Implements OPUS_{GET,SET}_LSB_DEPTH
This implements an API used in future encoders to avoid dynalloc doing silly things
on periodic LSB patterns and to reduce the bitrate on near-silence.
Diffstat (limited to 'celt/celt.c')
-rw-r--r-- | celt/celt.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/celt/celt.c b/celt/celt.c index 4f16887d..8164269e 100644 --- a/celt/celt.c +++ b/celt/celt.c @@ -156,6 +156,7 @@ struct OpusCustomEncoder { int signalling; int constrained_vbr; /* If zero, VBR can do whatever it likes with the rate */ int loss_rate; + int lsb_depth; /* Everything beyond this point gets cleared on a reset */ #define ENCODER_RESET_START rng @@ -266,6 +267,7 @@ OPUS_CUSTOM_NOSTATIC int opus_custom_encoder_init(CELTEncoder *st, const CELTMod st->vbr = 0; st->force_intra = 0; st->complexity = 5; + st->lsb_depth=24; opus_custom_encoder_ctl(st, OPUS_RESET_STATE); @@ -1823,6 +1825,20 @@ int opus_custom_encoder_ctl(CELTEncoder * OPUS_RESTRICT st, int request, ...) st->stream_channels = value; } break; + case OPUS_SET_LSB_DEPTH_REQUEST: + { + opus_int32 value = va_arg(ap, opus_int32); + if (value<8 || value>24) + goto bad_arg; + st->lsb_depth=value; + } + break; + case OPUS_GET_LSB_DEPTH_REQUEST: + { + opus_int32 *value = va_arg(ap, opus_int32*); + *value=st->lsb_depth; + } + break; case OPUS_RESET_STATE: { int i; |