shithub: opus

Download patch

ref: 1736ae3f5e3a2772190f72f8ad29778b20235304
parent: aa8b99cbc3f52d7e0916fb503993d44f7c0c7553
author: Jean-Marc Valin <jmvalin@amazon.com>
date: Mon Jul 10 13:43:33 EDT 2023

Properly account for SILK bits in CELT CBR code

CELT encoding would just fail when setting CELT to CBR in hybrid mode.
It was never a problem because hybrid CBR was always used with
OPUS_BITRATE_MAX.

--- a/celt/celt_encoder.c
+++ b/celt/celt_encoder.c
@@ -1565,7 +1565,7 @@
       vbr_rate = 0;
       tmp = st->bitrate*frame_size;
       if (tell>1)
-         tmp += tell;
+         tmp += tell*mode->Fs;
       if (st->bitrate!=OPUS_BITRATE_MAX)
          nbCompressedBytes = IMAX(2, IMIN(nbCompressedBytes,
                (tmp+4*mode->Fs)/(8*mode->Fs)-!!st->signalling));
--