Commit graph

2401 commits

Author SHA1 Message Date
Jean-Marc Valin
94a4989cdb Makes silk_ADD_SAT32() conform to the C standard
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).
2012-04-12 16:35:19 -04:00
Jean-Marc Valin
367c394866 Fixes several overflows in the CELT fixed-point
These were all mostly benign and would at worst result in (rare)
suboptimal encoder decisions rather than signal corruption.
2012-04-12 11:09:09 -04:00
Jean-Marc Valin
7aecadda2f Fixes a bug introduced by the previous commit
celt_ilog2() could be called with 0 which is undefined.
2012-04-07 23:03:24 -04:00
Jean-Marc Valin
178758b81a Fixes some overflows in the fixed-point pitch code
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()
2012-04-06 23:32:11 -04:00
Ralph Giles
cd539dfdcd Rename to header makefile fragements to .mk
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.
2012-04-05 09:23:47 -07:00
Ralph Giles
8779266cf1 Add opus_custom.h to celt_headers.txt.
This file is included unconditionally by celt.h.
As such it's a required part of the build and
should be in the header index files.
2012-04-05 09:19:25 -07:00
Ralph Giles
d9474d9085 Cast a factor to maintain precision on 16 bit systems.
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.
2012-04-02 11:21:44 -04:00
Ralph Giles
f40285212c Improve decoder_create documentation.
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.
2012-04-02 11:21:41 -04:00
Ralph Giles
5f6e472c91 Remove trailing whitespace.
Also fixes a minor typo.
2012-04-02 11:21:36 -04:00
Jean-Marc Valin
905197d750 Fixes a bunch of 16-bit issues that the C5X compiler warns about 2012-03-08 14:09:09 -05:00
Jean-Marc Valin
59354a7742 Fixes int vs opus_int32 compile errors on C5x 2012-03-08 12:19:35 -05:00
Gregory Maxwell
8770b0709b CLANG IOC no longer likes the 'deterministic random' bitstreams, so move the test_opus_decode bailout up. 2012-03-06 12:01:36 -05:00
Ralph Giles
873fc5b04b Fix documenation typos.
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.
2012-03-05 17:09:54 -08:00
Ralph Giles
1e0ba0f40a Fix typos in the API documentation.
opus_decode() takes a sixth 'enable_fec' option. Naive invocations
shoudl set this to zero.
2012-03-05 17:09:54 -08:00
Ralph Giles
b46991c34f Restore the windows-side #ifdef check in silk/MacroDebug.h.
We still override the '#if 0' with FIXED_DEBUG, but this
leaves whatever Koen intended here more intact. Suggestion
from Greg Maxwell.
2012-03-05 17:09:54 -08:00
Ralph Giles
a855a1f0ff Check for underflow in the debug USUB32. 2012-03-05 17:09:54 -08:00
Ralph Giles
9357ae976e Enable the silk debug macros with FIXED_DEBUG.
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.
2012-03-05 17:09:54 -08:00
Ralph Giles
2fa9e6e538 Fix a signed-compare warning.
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.
2012-03-05 17:09:54 -08:00
Ralph Giles
9620cf7718 Print the actual arguments to the debug UADD/SUB32 routines.
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.
2012-03-05 17:09:54 -08:00
Ralph Giles
9f7d17bd11 Uncomment the reporting for UADD32 and USUB32 in fixed_debug.h. 2012-03-05 17:09:54 -08:00
Ralph Giles
5c06f8c585 Used unsigned intermediates with unsigned arguments in fixed_debug.h.
Corrects a signed-compare warning.
2012-03-05 17:09:53 -08:00
Ralph Giles
a69368e1c0 Use automake's support for parallel test execution.
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.
2012-03-05 17:09:53 -08:00
Ralph Giles
cb3cc53014 Fix --enable-fixed-point-debug.
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.
2012-03-05 17:09:53 -08:00
Vincent Penquerc'h
037918a8fe Guard against pathologically small buffer 2012-03-05 19:59:17 -05:00
Vincent Penquerc'h
ab0b5f5ff3 Make input mapping parameter const in multistream API 2012-03-05 19:58:19 -05:00
Jean-Marc Valin
c792108829 Adds missing RESTORE_STACK statements on error paths
Thanks to Vincent Penquerc'h
2012-03-05 19:56:13 -05:00
Jean-Marc Valin
c0387ff237 More consistent types for 16-bit architectures 2012-03-05 19:19:59 -05:00
Gregory Maxwell
3e4afc6fd2 Removes a number of macro definitions which are used nowhere in the codebase. 2012-03-05 18:00:01 -05:00
Gregory Maxwell
9cca20aaaf Various multistream fixes.
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.
2012-03-05 17:59:55 -05:00
Gregory Maxwell
e7028175af 40/60ms MDCT/Hybrid were not able to reach maximum bitrate. Now they can.
Also change the packet length in the API from int to opus_int32
because repacketized frames are able to go beyond 32767 bytes
in size.
2012-03-05 17:59:50 -05:00
Gregory Maxwell
8365b5d00d Add config.h (and copyright notice) to repacketizer_demo.c.
This fixes some problems with cross-compiles.
2012-03-05 17:33:58 -05:00
Jean-Marc Valin
fdb039badc Eliminates an unused parameter warning in anti_collapse() 2012-03-05 17:13:59 -05:00
Jean-Marc Valin
17c5966045 Last updates for draft -11
- Draft updates
- Updated code to produce and check test vectors
- Making sure that the test vectors pass at all rates as well as for mono and stereo
2012-02-17 16:18:08 -05:00
Jean-Marc Valin
c4ff3a0423 Modifies the comparison tool to make it much more permissive. 2012-02-09 11:24:44 -05:00
Koen Vos
75f04e5eb1 Fixes MSVC warnings 2012-01-31 14:49:40 -05:00
Jean-Marc Valin
66820f350d Tweaks the CELT fractional resampling delay to get perfect alignment
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.
2012-01-31 02:18:05 -05:00
Koen Vos
54518c879a Last part of the LPC work stabilization work discussed at the last meeting
Also adds the encoder part of commit ee8adbe701 as well as a few
minor cleanups.
2012-01-31 01:51:22 -05:00
Gregory Maxwell
a26b2be2f9 Improvements to the tests, add a TEST_OPUS_NOFUZZ to disable testing corrupted input.
No changes to the codec itself.
2012-01-25 12:04:17 +13:00
Jean-Marc Valin
286f11efea Making the PLC robust to overflows caused by extreme bit-streams
This is not strictly necessary because the only streams that cause these
already sound horrible, but it helps the testing process.
2012-01-25 11:32:09 +13:00
Jean-Marc Valin
f898ae1021 Fixes a non-bitstream-related PLC integer overflow. 2012-01-24 21:08:15 +13:00
Jean-Marc Valin
ee8adbe701 Fixes a few minor issues (no bit-stream change)
- 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)
2012-01-24 14:47:54 +13:00
Koen Vos
a51ebd6831 Accuracy improvements to help float implementations
Also clamps the gain to avoid forcing a float decoder to emulate the
state rescaling.
2011-12-14 11:41:18 -05:00
Jean-Marc Valin
5609cec9a5 Fixes two minor issues found in random testing at ridiculously low rate.
- When it cannot produce the rate it's being asked, the encoder now
  returns a "PLC packet"
- Makes it possible to use the CELT PLC for more than 20 ms
2011-12-13 14:52:43 -05:00
Koen Vos
bbfc9c9ee5 Improves the accuracy such that it matches a float decoder much better 2011-12-13 14:50:12 -05:00
Koen Vos
bf75c8ec4d SILK fixes following last codec WG meeting
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
2011-12-13 14:47:31 -05:00
Timothy B. Terriberry
6619a73637 Move nbits_total initialize before renormalization.
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.
2011-12-02 15:37:29 -05:00
Gregory Maxwell
92c896e880 Fixes the code for optional self-delimited packing to make it fit the draft
This has no impact on opus_demo, test vectors, or "normal" codec operation
2011-12-02 12:41:31 -05:00
Jean-Marc Valin
1c80f64960 All variables named "bank" renamed to "bandE" to avoid problems on SHARC
SHARK compiler treaks "bank" as a reserved keyword -- go figure.
2011-12-02 12:38:32 -05:00
Ralph Giles
120800f8fa Rename '_FOO' to avoid potentional collisions with reserved identifiers.
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.
2011-12-02 12:31:36 -05:00
Jean-Marc Valin
e1be1920ba Some minor (non-bitstream-affecting) changes to help us have better test vectors
These fix corner cases discovered during the latest fuzzing tests.
2011-11-28 22:48:01 -05:00