Commit graph

45 commits

Author SHA1 Message Date
Jean-Marc Valin
cd78f3976e
Fixes a SILK bandwidth switching regression
The bug was triggered because f982b84d started using prefill for
SILK bandwidth changes, which reinitialized the encoder state and
prevented the variable lowpass from working properly. To fix the problem,
we preserve the sampling rate and variable low-pass when prefilling.
2018-05-24 02:29:11 -04:00
Gustaf Ullberg
42f43db7e4
Silk makes use of Opus VAD
Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
2018-05-14 13:55:39 -04:00
Jean-Marc Valin
7e3352ef51
Converting some silk_assert()s into hardening celt_assert()s
Only converted the ones that are really sure (not signal-dependent)
and that shouldn't add much run-time complexity
2018-03-27 15:13:27 -04:00
Mark Harris
d6d70371e8
Fix compiler warnings
- celt/modes.c:430:14: warning: cast from 'const unsigned char *' to
  'opus_int16 *' increases required alignment from 1 to 2 [-Wcast-align]
- 'C[0][1]' may be used uninitialized [-Wmaybe-uninitialized]
- Unused variable/parameter
- Value stored is never read
- MSVC warnings about "possible loss of data" due to type conversions
- MSVC warning C4146: unary minus operator applied to unsigned type
- silk/NLSF_del_dec_quant.c:137:20: warning: array subscript is above
  array bounds [-Warray-bounds] (gcc -O3 false positive)
- src/mlp_train.h:39:20: warning: function declaration isn't a prototype
  [-Wstrict-prototypes]
- Remove SMALL_FOOTPRINT code from SSE 4.1 FIR implementation, matching
  the C implementation.

The clang -Wcast-align warnings with SSE intrinsics are a known
clang issue: https://llvm.org/bugs/show_bug.cgi?id=20670
2017-02-26 19:10:45 -08:00
Jean-Marc Valin
2b011b64d8 Moving FEC decision to the Opus encoder level (from SILK level) 2016-07-19 16:11:50 -04:00
Koen Vos
6e40eb5d75 removed prefilter
The NSQ SSE optimizations are disabled for now because they need to be updated
2016-07-17 15:05:55 -04:00
Jean-Marc Valin
61714e9edb Quality: Increase CELT rate for voiced frames in hybrid mode 2016-07-17 15:05:54 -04:00
Koen Vos
3499e78bd5 Fix for flutter with FEC
The bug was caused by an improper feedback of the per-frame bitrate, causing
the bitrate to jump up and down from frame to frame, within a packet.
The patch avoids this, and also gives a slight improvement in general for
multi-frame packets, even without FEC.

Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
2015-08-10 12:22:25 -04:00
maks
e40105f4db Fixes internal check_control_input() error checking.
The code was wrong, but did not have any impact on user-visible behaviour
because all it did was change an internal-only error code.

Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
2014-02-06 17:32:47 -05:00
Timothy B. Terriberry
39386e0b85 Adds Neon assembly for correlation/convolution
Optimizing celt_pitch_xcorr()/xcorr_kernel() which also speeds up
FIRs, IIRs and auto-correlations

Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
2013-11-18 13:41:17 -05:00
Jean-Marc Valin
cbe93e23be Adds OPUS_SET_PREDICTION_DISABLED() ctl to force "independent" frames
Works by turning off pitch and energy prediction in CELT, while
setting first_frame_after_reset in SILK to disable pitch and LSF interpolation
and reduce LPC gain.
2013-11-15 13:50:38 -05:00
Ralph Giles
f2446c25c6 Remove trailing whitespace from the license headers. 2013-09-16 14:40:04 -07:00
Timothy B. Terriberry
80ad38370c Convert quotes in license headers to ASCII.
Since the last patch originally had them mangled (presumably by
 mailer, http server, or something else), let's just get rid of
 them.
2013-05-19 19:16:11 -07:00
Timothy B. Terriberry
c152d602aa Use dynamic stack allocation in the SILK encoder.
This makes all remaining large stack allocations use the vararray
 macros.
This continues the work of 6f2d9f50 to allow compiling with
 NONTHREADSAFE_PSEUDOSTACK to move the memory for large buffers
 off the stack for devices where it is very limited.

It also does this for some additional large buffers used by the
 PLC in the decoder.
2013-05-08 10:37:17 -07:00
Philip Jägenstedt
b7b5872c9d Fix minor issues reported by scan-build 2012-10-11 09:21:44 -04:00
Diego Elio Pettenò
d006b781ca Mark functions static if they are only used in their own translation unit.
This allows the compiler to perform more optimization on them as it
knows how the functions are being called.

Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu>
2012-09-12 15:54:17 -04:00
Jean-Marc Valin
ab5a049705 Merge commit '390c89225d' 2012-04-24 13:39:22 -04:00
Jean-Marc Valin
ae00e60d35 License update using the IETF Trust flavour of the BSD on the Silk code 2012-04-20 16:31:04 -04:00
Jean-Marc Valin
59354a7742 Fixes int vs opus_int32 compile errors on C5x 2012-03-08 12:19:35 -05: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
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
Koen Vos
acc7a6c78b Reformatting changes with an update to the MSVC project files 2011-10-28 19:44:26 -04:00
Koen Vos
43a0de4af1 Optimization of the CBR loop
Also some comment/warning fixes
2011-10-24 09:10:58 -04:00
Jean-Marc Valin
3b2aee062d Implements glitchless switching between SILK bandwidths
Only encoder changes were necessary because this uses the same
"redundant frames" mechanism as SILK<->CELT switching.
This also fixes a regression introduced in 78291b27 that was
causing the encoder to go back and forth between bandwidths when
SILK wasn't ready to change.
2011-10-21 23:21:34 -04:00
Jean-Marc Valin
294bfec27b Implements hard CBR for SILK
This is achieved by running the encoding process in a loop and
padding when we don't reach the exact rate. It also implements
VBR-with-cap, which means we no longer need to artificially decrease
the SILK bandwidth when it's close to the cap.
2011-10-20 00:39:41 -04:00
Gregory Maxwell
52de536fed Correct encoder/decoder state mismatch and spurious state resetting in the encoder when side is reset.
Patch from Tim which corrects a glitch during mode switching tests.
2011-10-19 00:20:46 -04:00
Timothy B. Terriberry
6559d36a46 Remove redundant mid-only flag when side VAD flag is set.
If there is activity in a regular, side SILK frame, then it must
 be coded, so we don't need to send a mid-only flag.
2011-10-17 23:31:20 -04:00
Timothy B. Terriberry
1e03a6eb04 Fix side-channel index for VAD/LBRR flags.
Neither the encoder nor decoder were incrementing the side-channel
 index for a mid-only frame.
Unfortunately, they used that index to index the VAD flags and LBRR
 flags.
This made the VAD flags for the side channel particularly useless,
 as you couldn't tell which frame a flag belonged to without
 decoding most of the packet.
It also desynched the LBRR information, as look at the wrong LBRR
 flags to decide when it had to code a mid-only flag.
If some frames were skipped in the side channel, then the last few
 VAD flags and LBRR flags would be garbage, but still get encoded.

This patch fixes this by continuing to increment nFramesDecoded or
 nFramesEncoded, even when skipping a frame in the side channel.
This makes the side-channel VAD and LBRR flags correspond to the
 correct time periods for frames greater than 20 ms.
It also fixes a bug where if DTX was not used on the packet where
 the side channel got turned off, it would never get used again
 until the encoder attempted to encode something in the side
 channel again.
2011-10-17 16:03:41 -04:00
Timothy B. Terriberry
53cc1a033a Fix the side frame conditional coding rules.
b24e5746 introduced changes to LastGainIndex which broke
 conditional coding for side frames after a mid-only frame (i.e.,
 in a 60 ms frame where the side is coded, not coded, then coded
 again).
These rules were a mess in general, however, because the side
 channel state kept a different nFramesDecoded count from the mid
 channel state, and had no way to tell if the prior side frame was
 coded.

This patch attempts to rationalize them by moving the conditional
 coding decision up to the top level, where all this information is
 available.
The first coded side frame after an uncoded side frame now always
 uses independent coding.
If such a frame is also not the first side frame in an Opus frame,
 then it doesn't include an LTP scaling parameter (because the LTP
 state is well-defined).
2011-10-17 16:03:41 -04:00
Jean-Marc Valin
b24e574627 Misc bug fixes
- There was a bug where the decoder resampler was not properly initialized
when fs_kHz == API_fs_kHz. In that case the resampler would continue to
upsample, and the output was corrupt.

- The delay value in the decoder was taken from the state before it was
potentially updated. This caused the decoder to apply the new dalay value one
frame late

- The encoder and decoder states are now updated more consistently, when
the sampling rate changes (pesq liked these changes)

- Properly resetting the side channel encoder and decoder for the first
frame with side coding active again

- Faster updating the "ratio" value in the LR_to_MS() code for large
prediction values means that for certain extreme/artificial input
signals the output looks better
2011-10-11 21:09:14 -04:00
Koen Vos
a9b864b80a Cleaner way to take into account the prediction for stereo width 2011-10-09 20:27:13 -04:00
Koen Vos
42f1e3d6a7 Two minor SILK fixes
- increases the max pitch lag by 1 (the thing Tim pointed out).  this brings the decoder in sync with the old one
- avoids that the first stereo frame is collapsed to mono
2011-10-09 12:53:59 -04:00
Jean-Marc Valin
1f65994ef4 Avoids unnecessary collapse of the HF stereo image in hybrid mode.
SILK now reports an "effective width" that takes into account side prediction.
2011-10-09 01:05:25 -04:00
Jean-Marc Valin
d5c9263724 Fixes two encoder bugs causing glitches in stereo->mono switches
1) averaging the output of the left and right resampling states when
   switching to mono
2) averaging the the delay buffers from left and right when switching
2011-10-07 14:59:53 -04:00
Jean-Marc Valin
b5972388d7 Proper SILK delay compensation for resampling
Adds SILK delay compensation that depends on encode and decode sampling
rate, as well as SILK internal coding rate. This ensures that the SILK
part of Opus is always in sync with the CELT part no matter what the
sampling rates are. It also increases the resampling delay to 1.15 ms
(was previously 0.48 ms).
2011-10-07 11:46:01 -04:00
Koen Vos
8887566918 SILK update
Simplifies mono/stereo switching in SILK
Fixes a quantization mismatch between encoder and decoder
Constrains the pitch lags in the same way in the encoder and decoder
2011-10-06 13:38:26 -04:00
Jean-Marc Valin
32d5c2d6d4 Disabling LBRR for whever there's a change in bandwidth/channels/framesize 2011-10-04 20:20:13 -04:00
Jean-Marc Valin
1e0805d74f Delaying SILK stereo->mono transitions by two frames
Gets rid of some more glitches caused by the decoder resampler
2011-10-03 13:52:18 -04:00
Jean-Marc Valin
de3e16c858 Fixes stereo->mono switching bugs (encoder)
Delaying stereo->mono switching decisions so that SILK can do a smooth
downmix. Also, wrote proper float/fixed code for the hybrid variable
stereo collapse, including a smooth downmix for stereo<->mono switching
2011-10-03 00:39:29 -04:00
Jean-Marc Valin
c7ab61b3c6 Fixes a bug introduced while fixing the original 60-ms stereo bug 2011-09-28 16:24:01 -04:00
Jean-Marc Valin
e4de8a9c76 Fixes a bug that was falsely triggering DTX for 60 ms stereo
There's still a range coder mismatch on the first frame when using FEC.
2011-09-28 14:23:01 -04:00
Gregory Maxwell
7152a9aa9a Fix some GCC warings in the silk/ directory. 2011-09-27 21:33:14 -04:00
Jean-Marc Valin
9f90e57a9b Fixes a glitch in SILK mono->stereo switching
For these transitions, we now start the left and right resamplers
from the same state.
2011-09-27 14:10:23 -04:00
Jean-Marc Valin
1c2f5633d1 Removed all the silk_ prefixes in source file names (not symbols) 2011-09-16 01:16:53 -07:00
Renamed from silk/silk_enc_API.c (Browse further)