diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2018-07-28 20:50:45 +0300 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2018-07-28 20:55:01 +0300 |
commit | dd6d6d523b4e7e51f2cfee725caf41cedeba1af2 (patch) | |
tree | 72fbe175ef6cd7494ccc68ce7a2d8139317a26b1 /src/opus_multistream_encoder.c | |
parent | 6adfa708a0ecf8fdd83fe8da3322dc80e6dfb74e (diff) |
Fixing arithmetic problems for 16-bit CPUs in ambisonics_rate_allocation()
Diffstat (limited to 'src/opus_multistream_encoder.c')
-rw-r--r-- | src/opus_multistream_encoder.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/opus_multistream_encoder.c b/src/opus_multistream_encoder.c index c47830ad..6cc1f432 100644 --- a/src/opus_multistream_encoder.c +++ b/src/opus_multistream_encoder.c @@ -741,10 +741,10 @@ static void ambisonics_rate_allocation( ) { int i; - int total_rate; - int directional_rate; - int nondirectional_rate; - int leftover_bits; + opus_int32 total_rate; + opus_int32 directional_rate; + opus_int32 nondirectional_rate; + opus_int32 leftover_bits; /* Each nondirectional channel gets (rate_ratio_num / rate_ratio_den) times * as many bits as all other ambisonics channels. @@ -760,7 +760,7 @@ static void ambisonics_rate_allocation( if (st->bitrate_bps==OPUS_AUTO) { total_rate = (st->layout.nb_coupled_streams + st->layout.nb_streams) * - (Fs+60*Fs/frame_size) + st->layout.nb_streams * 15000; + (Fs+60*Fs/frame_size) + st->layout.nb_streams * (opus_int32)15000; } else if (st->bitrate_bps==OPUS_BITRATE_MAX) { total_rate = nb_channels * 320000; |