shithub: opus

Download patch

ref: 6adfa708a0ecf8fdd83fe8da3322dc80e6dfb74e
parent: bc4ecf1917bf70f289b969ec048a6e0d3eecb5bd
author: Felicia Lim <[email protected]>
date: Fri Jul 27 14:10:05 EDT 2018

Fix bitrate allocation for channel mapping 2

Signed-off-by: Jean-Marc Valin <[email protected]>

--- a/src/opus_multistream_encoder.c
+++ b/src/opus_multistream_encoder.c
@@ -752,8 +752,10 @@
    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)
    {