This changes the saturation test to ensure that it relies on the
unsigned overflow behaviour (which is allowed) rather than the signed
overflow behaviour (which is undefined).
The overflows reported were:
- Syy in find_best_pitch() in pitch.c
- xy, xx and yy in remove_doubling() in pitch.c
The fixes are:
- Adaptive scaling in pitch_downsample() which also improves quality
- Adding a missing downshift in find_best_pitch()
- More conservative yshift when calling find_best_pitch()
The opus_headers.txt, etc. files are makefile
fragments defining variables with a list of
required header files for the build. As such
they should use the .mk filename extension,
just like opus_sources.mk, etc.
The multiply would overflow with 16 bit ints. Thanks
to Riccardo Micci for pointing out the issue. Thanks
to Tim Terriberry for the valid range of the decay
argument.
Note that ft is unsigned, but always less than 32736,
so we could use a 16 bit signed type here if it allows
the compiler to produce faster code (with signed 16*16
and 16*32 multiplies). In the absense of actual cycle
counts from a real platform, I've left it as an unsigned
for the sake of readability.
For similar reasons we cast (16384-decay) to a signed
integer even though it is also always positive.
The parameter descriptions look like they were copied
from encoder_create. Update them for the decode side
and repeat the clarifications about what sample rates
are allowed and what they mean.
Doxygen is smart enough to insert a period if the paragraph
before the @see directive, which starts a new section, doesn't
have one. Unfortunately it's not smart enough to convert a
comma to a period. So while the "description, @see foo" idiom
used for the CTL documentation scans well in the header file,
the Doxygen output end up with "description,.\n".
Minimal change to remove the offending commas.
This isn't entirely accurate, since it's also used on integer
math. However, the idea is similar: to add bounds checking.
This code asserts rather than warning, so one must pass
--enable-assertions to configure as well to get any output,
and in that case the first instance is fatal.
Quick testing shows both test_opus_decode and test_opus_encode
trigger the assertions, but running the draft-10 test vectors
does not.
The silk math debug macros include a bounds check on silk_abs.
Because INT_MIN = (-INT_MAX - 1), abs(INT_MIN) can't be
represented as an int. The macro was checking for this value
as 0x8000... without a cast to signed, warning on gcc.
silk/typedef.h already defines minimum values for the int
types, so we correct the warning by using those.
The versions of UADD32 and USUB32 in fixed_debug.h take
unsigned long long (ideally 64 bit) inputs, and range
check the arguments. However, the printed warnings cast
them to (unsigned), which is confusing. Instead, print
the full value passed in.
NB this will make negative values print has huge,
rather than negative, values.
On my system this speeds up 'make -j8 check' by about
50%. The drawback is that we don't get to see Greg's
nice output from the test programmes. It's hidden in
a log file, even on failure or 'make V=1'. Probably
this is better for most people; developers can run
the tests manually.
Use the celt_mips defined in fixed_debug.h from the unit tests
by defining CELT_C earlier. We must export celt_mips so it can
be used by clients calling the library, like opus_custom_demo.
Fixes the encoder bitrate CTLs to correctly apply to all streams,
prevents the MS encoder from starving the latter streams by not
reserving a reasonable minimum amount of space for them.
Also using the same int->float conversion functions for SILK as for CELT
and changed encoder implementation default to constrained VBR just to
be safe when VBR gets more aggressive.
- Safer gain clamping for PLC
- Makes opus_decoder_get_nb_samples() report an error on invalid ToC
- Giving a free license to the text ofthe draft (not just the code)
decoder:
- fixed incorrect scaling of filter states for the smallest quantization
step sizes
- NLSF2A now limits the prediction gain of LPC filters
encoder:
- increased damping of LTP coefficients in LTP analysis
- increased white noise fraction in noise shaping LPC analysis
- introduced maximum total prediction gain. Used by Burg's method to
exit early if prediction gain is exceeded. This improves packet
loss robustness and numerical robustness in Burg's method
- Prefiltered signal is now in int32 Q10 domain, from int16 Q0
- Increased max number of iterations in CBR gain control loop from 5 to 6
- Removed useless code from LTP scaling control
- Optimization: smarter LPC loop unrolling
- Switched default win32 compile mode to be floating-point
resampler:
- made resampler have constant delay of 0.75 ms; removed delay
compensation from silk code.
- removed obsolete table entries (~850 Bytes)
- increased downsampling filter order from 16 to 18/24/36 (depending on
frequency ratio)
- reoptimized filter coefficients
The range decoder used to initialize nbits_total after the
renormalization loop, even though the renormalization loop
modifies it.
This was presumably safe, because nothing actually used the value
before it was initialized, but I'm tired of it triggering the
integer overflow checking.
C reserves identifiers of the from _[A-Z]+ and we have a number of
those in the code. This patch renames the various function arguments,
MACROS and preprocessor symbols to avoid the reserved form.
It also removes the CHANNELS() macro altogether. This was a
minor optimization for TI DSP to force a mono-only build,
as were the associated local 'const' versions. Since stereo
support is manditory, it wasn't worth keeping.
Thanks to John Ridges for raising the issue, and Jean-Marc Valin
and Greg Maxwell for reviewing the changes.