Fix bitrate allocation for channel mapping 2
authorFelicia Lim <flim@google.com>
Sat, 28 Jul 2018 01:10:05 +0000 (18:10 -0700)
committerJean-Marc Valin <jmvalin@jmvalin.ca>
Sat, 28 Jul 2018 17:55:01 +0000 (13:55 -0400)
Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
src/opus_multistream_encoder.c

index 52fd27e..c47830a 100644 (file)
@@ -752,8 +752,10 @@ static void ambisonics_rate_allocation(
    const int rate_ratio_num = 4;
    const int rate_ratio_den = 3;
    const int nb_channels = st->layout.nb_streams + st->layout.nb_coupled_streams;
+   /* The omnidirectional ambisonics and non-diegetic stereo channels */
    const int nb_nondirectional_channels = st->layout.nb_coupled_streams * 2 + 1;
-   const int nb_directional_channels = st->layout.nb_streams - 1;
+   /* The remaining ambisonics channels */
+   const int nb_directional_channels = nb_channels - nb_nondirectional_channels;
 
    if (st->bitrate_bps==OPUS_AUTO)
    {