Michael Graczyk
2016-Sep-07 22:26 UTC
[opus] [PATCH] Fix ambisonics bitrate when bitrate_bps is OPUS_AUTO
Change-Id: I16bd4cd990d8ad5888c9e30016218ac25242ecb5 --- src/opus_multistream_encoder.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/opus_multistream_encoder.c b/src/opus_multistream_encoder.c index 30cafe1..c07132f 100644 --- a/src/opus_multistream_encoder.c +++ b/src/opus_multistream_encoder.c @@ -747,7 +747,8 @@ static void ambisonics_rate_allocation( if (st->bitrate_bps==OPUS_AUTO) { - total_rate = num_channels * (20000 + st->layout.nb_streams*(Fs+60*Fs/frame_size)); + total_rate = (st->layout.nb_coupled_streams + st->layout.nb_streams) * + (Fs+60*Fs/frame_size) + st->layout.nb_streams * 15000; } else if (st->bitrate_bps==OPUS_BITRATE_MAX) { total_rate = num_channels * 320000; -- 2.8.0.rc3.226.g39d4020
Michael Graczyk
2016-Sep-07 22:29 UTC
[opus] [PATCH] Fix ambisonics bitrate when bitrate_bps is OPUS_AUTO
15000 was chosen so that 4 channels at 48k and 60ms frames would be 256kbps. Everything else was chosen to match surround allocation as much as possible. On Wed, Sep 7, 2016 at 5:26 PM, Michael Graczyk <mgraczyk at google.com> wrote:> Change-Id: I16bd4cd990d8ad5888c9e30016218ac25242ecb5 > --- > src/opus_multistream_encoder.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/src/opus_multistream_encoder.c b/src/opus_multistream_ > encoder.c > index 30cafe1..c07132f 100644 > --- a/src/opus_multistream_encoder.c > +++ b/src/opus_multistream_encoder.c > @@ -747,7 +747,8 @@ static void ambisonics_rate_allocation( > > if (st->bitrate_bps==OPUS_AUTO) > { > - total_rate = num_channels * (20000 + st->layout.nb_streams*(Fs+60* > Fs/frame_size)); > + total_rate = (st->layout.nb_coupled_streams + > st->layout.nb_streams) * > + (Fs+60*Fs/frame_size) + st->layout.nb_streams * 15000; > } else if (st->bitrate_bps==OPUS_BITRATE_MAX) > { > total_rate = num_channels * 320000; > -- > 2.8.0.rc3.226.g39d4020 > >-- Thanks, Michael Graczyk -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.xiph.org/pipermail/opus/attachments/20160907/f4ac0ad4/attachment.html>
Jean-Marc Valin
2016-Sep-08 15:37 UTC
[opus] [PATCH] Fix ambisonics bitrate when bitrate_bps is OPUS_AUTO
Hi Michael, Thanks for the fix. It's now merged in master. Jean-Marc On 07/09/16 06:26 PM, Michael Graczyk wrote:> Change-Id: I16bd4cd990d8ad5888c9e30016218ac25242ecb5 > --- > src/opus_multistream_encoder.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/src/opus_multistream_encoder.c b/src/opus_multistream_encoder.c > index 30cafe1..c07132f 100644 > --- a/src/opus_multistream_encoder.c > +++ b/src/opus_multistream_encoder.c > @@ -747,7 +747,8 @@ static void ambisonics_rate_allocation( > > if (st->bitrate_bps==OPUS_AUTO) > { > - total_rate = num_channels * (20000 + st->layout.nb_streams*(Fs+60*Fs/frame_size)); > + total_rate = (st->layout.nb_coupled_streams + st->layout.nb_streams) * > + (Fs+60*Fs/frame_size) + st->layout.nb_streams * 15000; > } else if (st->bitrate_bps==OPUS_BITRATE_MAX) > { > total_rate = num_channels * 320000; >