summaryrefslogtreecommitdiff
path: root/thirdparty/opus/celt/rate.c
diff options
context:
space:
mode:
authorunknown <sneakyfish5.sneaky@gmail.com>2019-11-02 11:59:07 -0500
committerJonathan Mannancheril <sneakyfish5.sneaky@gmail.com>2019-11-09 13:06:56 -0600
commite00426c512a7905f5f925d382c443bab7a0ca693 (patch)
tree662c34929dc2b46b8eba05cd992e57f3aa7b6943 /thirdparty/opus/celt/rate.c
parent8570b9b0c2972b7aa191475342d0dd8030fd4188 (diff)
Update opus to 1.3.1 and opusfile to 0.11
Diffstat (limited to 'thirdparty/opus/celt/rate.c')
-rw-r--r--thirdparty/opus/celt/rate.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/thirdparty/opus/celt/rate.c b/thirdparty/opus/celt/rate.c
index 7dfa5be8a6..465e1ba26c 100644
--- a/thirdparty/opus/celt/rate.c
+++ b/thirdparty/opus/celt/rate.c
@@ -348,12 +348,17 @@ static OPUS_INLINE int interp_bits2pulses(const CELTMode *m, int start, int end,
/*This if() block is the only part of the allocation function that
is not a mandatory part of the bitstream: any bands we choose to
skip here must be explicitly signaled.*/
- /*Choose a threshold with some hysteresis to keep bands from
- fluctuating in and out.*/
+ int depth_threshold;
+ /*We choose a threshold with some hysteresis to keep bands from
+ fluctuating in and out, but we try not to fold below a certain point. */
+ if (codedBands > 17)
+ depth_threshold = j<prev ? 7 : 9;
+ else
+ depth_threshold = 0;
#ifdef FUZZING
if ((rand()&0x1) == 0)
#else
- if (codedBands<=start+2 || (band_bits > ((j<prev?7:9)*band_width<<LM<<BITRES)>>4 && j<=signalBandwidth))
+ if (codedBands<=start+2 || (band_bits > (depth_threshold*band_width<<LM<<BITRES)>>4 && j<=signalBandwidth))
#endif
{
ec_enc_bit_logp(ec, 1, 1);
@@ -524,7 +529,7 @@ static OPUS_INLINE int interp_bits2pulses(const CELTMode *m, int start, int end,
return codedBands;
}
-int compute_allocation(const CELTMode *m, int start, int end, const int *offsets, const int *cap, int alloc_trim, int *intensity, int *dual_stereo,
+int clt_compute_allocation(const CELTMode *m, int start, int end, const int *offsets, const int *cap, int alloc_trim, int *intensity, int *dual_stereo,
opus_int32 total, opus_int32 *balance, int *pulses, int *ebits, int *fine_priority, int C, int LM, ec_ctx *ec, int encode, int prev, int signalBandwidth)
{
int lo, hi, len, j;