Commit graph

2404 commits

Author SHA1 Message Date
Jean-Marc Valin
dbf2ea841e draft: Describing SILK delay compensation 2011-10-19 13:56:34 -04:00
Jean-Marc Valin
cb897c56f2 draft: mode switching details (reset and redundancy cross-fade) 2011-10-19 12:38:53 -04:00
Jean-Marc Valin
d062c4a50e Only free state once in kiss-fft failed init path 2011-10-19 07:41:27 -04:00
Jean-Marc Valin
e6a4ece78f Simplfies the condition for resetting the CELT state 2011-10-19 01:56:38 -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
Jean-Marc Valin
9a05688696 Misc corrections to the draft 2011-10-18 14:42:24 -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
Jean-Marc Valin
f2d6480f90 Draft text for encoder mode selection 2011-10-17 17:55:59 -04:00
Timothy B. Terriberry
88e5cdc5ad Fix fixed-point build bustage from 53cc1a03. 2011-10-17 16:19:28 -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
7ef6c7c1b4 This should fix switching from SILK/hybrid to 60ms CELT 2011-10-17 14:20:43 -04:00
Gregory Maxwell
d9dd4992da Correct rare mismatch between the encoder and decoder introduced by e9b53212.
Only one of the two required checks in the encoder were updated. Thanks to
Tim for tracking down the actual cause of the mismatch.
2011-10-16 04:02:02 -04:00
Jean-Marc Valin
ebb1cd16d7 Addressing some comments about the draft and cleaning up COPYING 2011-10-14 16:11:30 -04:00
Jean-Marc Valin
e22cc277b1 Fixes CELT->Hybrid glitches
These were caused by not prefilling the hybrid CELT state
2011-10-14 13:48:17 -04:00
Timothy B. Terriberry
4bc8c0335b More draft updates.
A number of fixes and additions, including
* Ensure all usage of the word "mode" refer only to the choice of
   SILK/hybrid/CELT, not audio bandwidth, frame size, channel count,
   or anything else.
  There's still a bunch of usage of "mode" in CELT to refer to
   things in the CELTMode struct (e.g., band layout, etc.).
* Document the LSF reordering for silk_NLSF2A_find_poly().
* Document the DC response check during LSF stabilization.
* Fix the excitation scaling to give decoded SILK output in the
   range -1.0...1.0.
* Rewrite the mode-switching section.
  Ironically the title of the section still implies "mode" means
   than just SILK/hybrid/CELT, but I couldn't come up with a
   better one.
* Minor clean-ups to the acknowledgements.
2011-10-13 20:13:09 -04:00
Jean-Marc Valin
26451fef9a Improved test for fishy redundancy length 2011-10-13 20:12:05 -04:00
Jean-Marc Valin
e9b53212f2 Tim says it's safe 2011-10-13 16:24:11 -04:00
Jean-Marc Valin
ab96457554 JM puts on a brown paper bag 2011-10-13 16:18:24 -04:00
Jean-Marc Valin
eb17b5e00e Doing a best for "unprotected" switches to 2.5 ms frames 2011-10-13 12:39:15 -04:00
Koen Vos
e2f1aac572 Fixes a corner case that was causing silk_A2NLSF() to fail
Input that caused the problem was:
a_Q16[] = [129763 -49346 -42032 5488 28014 -1549 -2384 -8568
3154 -5104 -1605 6291 11861 -1843 -17715 7361]
2011-10-12 21:30:58 -04:00
Jean-Marc Valin
4f1b7dac7e Fixes a case where PLC was called on the side when no side was ever coded 2011-10-12 15:09:13 -04:00
Timothy B. Terriberry
e2a6aaa731 Improves accuracy of NLSF2A by reordering the polynomial roots 2011-10-12 14:24:19 -04:00
Jean-Marc Valin
d5158a42d1 Fixes a numerical accuracy issue in the pitch search
The energy "sliding window" was using double accumulation with
float multiplications. This forces the multiplications to be
double as well.
2011-10-12 12:58:52 -04:00
Jean-Marc Valin
d84c8d1fd8 Fixes a panned stereo regression
The previous commit introduced some cross-talk for the case of SILK
with one channel muted.
2011-10-11 21:46:55 -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
Jean-Marc Valin
a4885a5fd5 Gets rid of a "safe" signed overflow in silk_noise_shape_quantizer_del_dec() 2011-10-11 18:00:23 -04:00
Jean-Marc Valin
4541bbcc22 Gets rid of a "safe" signed overflow in silk_DIV32_varQ() 2011-10-11 16:47:00 -04:00
Jean-Marc Valin
3737862620 Using a noise-based PLC for the CELT layer in hybrid mode 2011-10-11 15:03:38 -04:00
Jean-Marc Valin
16f15924f8 Fixes a corruption when decoding FEC frames 2011-10-10 21:29:20 -04:00
Gregory Maxwell
a355d74efb Move a number of files and functions which are only used by fixed point builds from silk/ to silk/fixed/.
I attempted to not break the msvc projects, but I can't test them.
2011-10-10 20:53:48 -04:00
Koen Vos
3195f6cdb9 Misc SILK fixes:
- compile warning in opus_decoder.c
- decoder state reduced by ~3 kB (by merging buffers, as Tim suggested)
- some minor decoder optimizations (only the PLC is non-bit exact, so should be ok)
2011-10-10 20:46:32 -04:00
Jean-Marc Valin
53ea87fb96 Cheap early detection of unstable filters
We check the DC gain before doing the full RC calculations
2011-10-10 01:57:22 -04:00
Gregory Maxwell
3346d88390 Make repacketizer API use opus_int32 for lengths and add some additional error handling. 2011-10-10 01:02:14 -04:00
Koen Vos
854fe70352 Minor fixes
- fixes the test_opus "skip" for stereo
- fixes 6 visual studio compile warnings
- adds several header files to visual studio's include folder
2011-10-09 20:34:41 -04:00
Gregory Maxwell
756c7595dc Make opus_repacketizer_create handle malloc failure gracefully. 2011-10-09 20:28:51 -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
ebece63373 Fixes a stereo SILK->CELT switching bug
Making sure not to abruptly "de-collapse" the stereo for such transitions
2011-10-09 00:29:26 -04:00
Jean-Marc Valin
6d5af483be Increase the floor on nb_compr_bytes when we enable redundancy. 2011-10-08 22:45:19 -04:00
Jean-Marc Valin
78291b270a Fixes a redundancy mismatch bug
When SILK decided not to use the desired bandwidth, the redundancy
could be encoded at the desired bandwidth rather than at the actual
bandwidth used.
2011-10-08 22:12:31 -04:00
Jean-Marc Valin
207a2e8627 Fixes a rare integer overflow in the SILK "50% of max rate" rule 2011-10-08 15:08:38 -04:00
Jean-Marc Valin
591b74945d Redundancy fixes
No longer encoding the redundancy flag for SILK since we can infer
redundancy from the length of the frame. Also, we skip encoding the
flag for hybrid mode when we know the decoder will not read it.
2011-10-08 10:22:10 -04:00
Jean-Marc Valin
9fd13d6065 Not delaying stereo->mono transitions to/from CELT
Also not fuzzing the mode when it's forced
2011-10-07 22:50:49 -04:00
Jean-Marc Valin
1e22a4b7e9 Fixes a problem with the SILK toMono when we're encoding 40/60 ms frames 2011-10-07 22:29:38 -04:00
Jean-Marc Valin
6e5f6d048a Prevents a SILK stereo encoding-side desync
We now make sure that side is given >0 bits when it isn't disabled.
2011-10-07 18:08:41 -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
Timothy B. Terriberry
a5e96b8430 More draft updates and additions.
This patch
 * expands sections on LPC and LTP synthesis into something that can
    actually be implemented
 * fixes an error in the excitation reconstruction
 * reverts an erroneous simplification of the subframe gain
    decoding, and
 * updates the LPC gain limiting description to reflect the new,
    more accurate approach for computing the reflection
    coefficients.
It also includes a number of general clean-ups, such as
 * correcting the description of the sample rates various pieces
    run at (e.g., we can decode directly to rates other than 48 kHz)
 * the usage of "sampling rate" vs. "sample rate"
 * capitalization consistency in TOC titles, and
 * better selection of which sections appear in the TOC.
2011-10-06 15:08:44 -04:00