Forked from
Xiph.Org / Opus
3861 commits behind the upstream repository.
-
The previous "dumb cap" of (64<<LM)*(C<<BITRES) was not actually achievable by many (most) bands, and did not take the cost of coding theta for splits into account, and so was too small for some bands. This patch adds code to compute a fairly accurate estimate of the real maximum per-band rate (an estimate only because of rounding effects and the fact that the bit usage for theta is variable), which is then truncated and stored in an 8-bit table in the mode. This gives improved quality at all rates over 160 kbps/channel, prevents bits from being wasted all the way up to 255 kbps/channel (the maximum rate allowed, and approximately the maximum number of bits that can usefully be used regardless of the allocation), and prevents dynalloc and trim from producing enormous waste (eliminating the need for encoder logic to prevent this).
The previous "dumb cap" of (64<<LM)*(C<<BITRES) was not actually achievable by many (most) bands, and did not take the cost of coding theta for splits into account, and so was too small for some bands. This patch adds code to compute a fairly accurate estimate of the real maximum per-band rate (an estimate only because of rounding effects and the fact that the bit usage for theta is variable), which is then truncated and stored in an 8-bit table in the mode. This gives improved quality at all rates over 160 kbps/channel, prevents bits from being wasted all the way up to 255 kbps/channel (the maximum rate allowed, and approximately the maximum number of bits that can usefully be used regardless of the allocation), and prevents dynalloc and trim from producing enormous waste (eliminating the need for encoder logic to prevent this).
modes.h 3.69 KiB