This implements an API used in future encoders to avoid dynalloc doing silly things
on periodic LSB patterns and to reduce the bitrate on near-silence.
Signed-off-by: Gregory Maxwell <greg@xiph.org>
silk_get_TOC is unused, unreachable, and not useful without some
packet pre-processing, but until we remove it it should be correct.
This was also reported by Mozilla.
We now have rates for each possible threshold. This also adds some
histeresis but it's not that useful for now because the effective rate
doesn't changes from frame to frame (unless one changes the target rate).
This change also has the side effect of lowering the intensity stereo
point for 64 kb/s to band 15 (instead of 16).
This prevents rate reduction due to channel correlation from increasing
by more than 0.25 bit/sample between two frames. This issue was observed
on r.flac where the frame following a transient would lose nearly
1 bit/sample
This only increases the average rate by about 1.5 kb/s, but it
restores the high quality of transients from 1.0. Also it
ensures that dynalloc can never starve other bands when used
aggressively.
1) Stereo saving was being too aggressive because it only considered the LF
and because the savings were multiplied by coded_bins rather than by
just the number of "side bins" below the intensity threshold
2) In the case of bandlimited signals, dynalloc would allocate way too many
bits to the last non-zero band. We now explicitly check for the last
band with a meaningful signal.
These issues were really obvious when encoding the decoded test01.mp3
because of the strong inter-channel correlation and (especially) the 16 kHz
lowpass used by the mp3 encoder.
The usage of restrict in include/opus_custom.h was missed
by the prior commit replacing this keyword with a macro.
Also fixes some prototype/function agreement with respect to
restrict.
We had previously advised people to -Drestrict on
non-C99 compilers, but this creates problems for
some of the MSVC headers. Instead this just
uses a macro and defines it sanely.
When libopus is forced to sufficiently low rates it will start
outputting 'PLC' (one byte) frames. The code that did this
did not sanitize the mode well enough and would create corrupted
TOC values in some cases.
Plural works better with the previous sentence. The agreement problem
was there in my original commit. I was just confused by the half
that Tim promoted.
The (non-default) temporary & output dirs configured in the projects could
cause issues when doing compilation on a multiprocessor machine. Cleaned
this up a little to use the defaults, which makes that work again and
doesn't make the output structure any worse. Also removed debug output for
release binaries & a tiny whitespace fix.
* Bump the document date.
* Mandate that the ID header must complete on the first page (to
remove any ambiguities about this requirement in RFC 3533).
* Remove reundant wording that rillian forgot to remove in 360a4117.
* Split the "Granule Position" section into subsections.
* Move the first paragraph of the "Other Implementation Notes"
section into the "Granule Position" section, add general seeking
implementation guidance, and be specific about the interaction
between pre-roll and pre-skip.
* Retitle the remaining contents of the "Other Implementation Notes"
section to "Packet Size Limits"
* Specify that all the header fields are REQUIRED (and add a
description of the Channel Mapping Table as a whole, so we can
say when it is REQUIRED).
* Specify that implementations MUST NOT reject headers with extra
data if they have an unknown minor version number.
* Add a reference to RFC 3629 (UTF-8).
* Minor formatting adjustments to vorbis-trim and vorbis-mapping
cites.
* Eliminate semicolons and terrible "Else, if" constructs.
Remove a redundant phrase from the previous commit.
Thanks to Tim for pointing this out.
Clarify what 'skipped' means.
Give a reference for the vorbis granulepos-trimming.
Commas and semicolons in the resampling decision list.
Capital SHOULD on treating unknown channel mapping families
as discrete.
Clarify why goes in the vendor string. Maybe needs an example?
'gstoggmux 1.0.12; libopus 1.2.3'
Remove a redundant word. 'could' already covers 'potential' and
the line is stronger without it.
tf_estimate was being initialized to zero and then never set because
transient_analysis() wasn't being called. This could also have affected
other frame sizes at lower complexity.