Commit graph

59 commits

Author SHA1 Message Date
Sean DuBois 733188ab17 Implement bitdepth conversion and upsampling
bitdepth package takes F32LE -> S16LE and handles upsampling
from 16Khz -> 48Khz
2022-09-30 21:56:49 -06:00
Sean DuBois 7941dd8c63 Finish LTP Synthesis Implementation
Silk Decoder is fully implemented!
2022-09-30 16:08:38 -07:00
Sean DuBois 684adce144 Use LPC values from previous when current frame has no cached values 2022-09-25 22:42:19 -04:00
Sean DuBois 238ccbfc34 Properly implement Q15 handling
If w4 == 4 the normalized value (n1Q15) is only used for the first two subframes.
Before we incorrectly would use it for all subframes.
2022-09-25 22:29:01 -04:00
Sean DuBois 4c632df5ac Remove finalLPCValues from silk.Decoder
LPC values shouldn't be stored across frames
2022-09-25 20:22:17 -04:00
Sean DuBois 3a79dec65f Create cache for res and out values
LTP Synthesis needs values of out + res for previous frames
2022-09-22 23:32:16 -04:00
Sean DuBois 903249e356 Don't recompute res for each subframe 2022-09-21 23:02:46 -04:00
Sean DuBois 42288fd1e3 Fix LTP Scaling Parameter generation
Was incorrectly not subframe aware
2022-09-21 16:08:50 -04:00
Sean DuBois 7b32fb7f78 Properly pass decoded excitation into LTP Synthesis
Before would discard excitation and always use a zero'ed out list
2022-09-20 15:58:02 -04:00
Sean DuBois 9e56e15906 Use float32 instead of float64 internally 2022-09-20 14:17:13 -04:00
Sean DuBois c631824345 Add untested LTP Synthesis implementation
Implements the spec, but haven't compared to values from libopus yet
2022-09-18 23:16:42 -04:00
Sean DuBois cb995e5d2b Update PitchLag decoder to be subframe aware
Before would only compute s=0
2022-09-17 16:20:53 -04:00
Sean DuBois c9124c5c4e Move Silk Frame Reconstruction into dedicated method
More closely matches RFC
2022-09-16 22:45:37 -04:00
Sean DuBois 0112ac2b3e Make more state available to LTP Synthesis
Unimplemented but needed
2022-09-16 22:32:17 -04:00
Sean DuBois 56e47b2485 Update lpcSynthesis to take subframe only of out
Instead of doing arithmetic in the function make it the responsibility
of the caller.
2022-09-16 12:45:45 -04:00
Sean DuBois ce891b494b Fix rollover issue with logGain
Was incorrectly stored as unsigned integer before
2022-09-15 21:55:19 -04:00
Sean DuBois 782c09fe4c Fix LPC Synthesis Bug
Use gainQ16 for the current subframe. Before we always used gainQ16[0]
incorrectly.
2022-09-15 15:03:33 -04:00
Sean DuBois 2e21fbab86 Add full decode test
Test a full unvoiced frame through Silk decoder
2022-09-15 13:40:42 -04:00
Sean DuBois 5d12791c86 Add test cases for all subframes
LPC unit test was only checking first run
2022-09-13 15:59:05 -04:00
Sean DuBois b9266e005e Improve constant naming
add `codebook` prefix to vars that needed it
2022-09-13 11:49:59 -04:00
Sean DuBois e2d581a590 Finish decodeLTPScalingParamater
Defined in section-4.2.7.6.3
2022-09-12 22:08:56 -04:00
Sean DuBois 2067ca5ac0 Implement decoding LTP Filter Coefficients
section-4.2.7.6.2
2022-09-12 17:14:13 -04:00
Sean DuBois 1dcc971611 Delete unused function 2022-09-11 23:33:50 -04:00
Sean DuBois 87d5d99155 Implement Pitch Lags
Defined in section-4.2.7.6.1
2022-09-11 23:32:29 -04:00
Sean DuBois 85ca7b30c0 Fix frameType parsing
frameTypeSymbol values start from 0 again
when voiceActivityDetected == true
2022-09-08 00:41:09 -04:00
Sean DuBois e005fba189 Finish normalizeLSFInterpolation
Before we only handled when wQ2 == 4
2022-09-08 00:16:35 -04:00
Sean DuBois 496497d1f7 Add test for LPC Synthesis 2022-09-07 16:01:09 -04:00
Sean DuBois e06e1cdfef Add test for Silk limitLPCFilterPredictionGain 2022-09-07 11:48:02 -04:00
Sean DuBois b2df0354df Implement LPC Synthesis
Some data makes it all the way through. LTP Synthesis needs to be
implemented now
2022-09-06 23:49:51 -04:00
Sean DuBois f20a9eedf1 Add stubs for rest of Silk Decoder
Also include the implemented excitation functions now that we have
reached them.
2022-09-05 23:50:07 -04:00
Sean DuBois 5919d29d78 Add stub for Limiting the Prediction Gain of the LPC Filter
Comes from 4.2.7.5.8 we can implement this later
2022-09-05 15:41:26 -04:00
Sean DuBois 1e8a69eba3 Implement Limiting the Prediction Gain of the LPC Filter
Don't have a test to actually exercise this behavior yet. All the test
files I have currently don't enter this block.

Defined in section-4.2.7.5.7
2022-09-03 23:54:52 -04:00
Sean DuBois 733dc27100 Implement Converting Normalized LSFs to LPC Coefficients
From 4.2.7.5.6
2022-08-29 22:16:56 -04:00
Sean DuBois b5ea7c4523 Finish decoder Excitation
Implements final part
https://datatracker.ietf.org/doc/html/rfc6716#section-4.2.7.8.6
2022-08-10 01:15:26 -04:00
Sean DuBois 8412cf5190 Split SILK excitation implementation into functions
Easier to follow and matches established pattern
2022-08-10 00:18:46 -04:00
Sean DuBois cfae85659a Implement Excitation Sign Decoding
Specified in https://datatracker.ietf.org/doc/html/rfc6716#section-4.2.7.8.5
2022-08-08 23:50:53 -04:00
Sean DuBois dd17102d36 Implement Pulse Location Decoding
Defined at https://datatracker.ietf.org/doc/html/rfc6716#section-4.2.7.8.3
2022-08-08 00:56:59 -04:00
Sean DuBois 65e49e6622 Add all Pulse Count ICDFs
From https://datatracker.ietf.org/doc/html/rfc6716#section-4.2.7.8.3
2022-08-07 14:46:21 -04:00
Sean DuBois a7a80f67e8 Fix incorrect value in test
Used wrong value from libopus RangeDecoder when comparing values
2022-08-07 00:19:07 -04:00
Sean DuBois 4678a6e2d2 Add WIP Excitation implementation 2022-08-06 15:50:45 -04:00
Sean DuBois 15b20878e0 Add unit tests for SILK Decoder
* TestDecodeStereoTODO
* TestDecodeFrameType
* TestDecodeSubframeQuantizations
* TestNormalizeLineSpectralFrequencyStageOne
* TestNormalizeLineSpectralFrequencyStageTwo
* TestNormalizeLineSpectralFrequencyCoefficients
2022-08-05 14:53:38 -04:00
Sean DuBois e1fb3069de Add doc from section-4.2.7.5.6
Next step in Silk decoder
2022-08-03 23:34:55 -04:00
Sean DuBois 716ea9afbe Simplify normalizeLineSpectralFrequencyCoefficients
Use default value to handle out of bounds access of cb1_Q8
2022-07-28 12:09:03 -04:00
Sean DuBois 95c6273a44 Begin to implement LSF to LPC
Add stub for LSF Stabilization
2022-07-27 23:25:26 -04:00
Sean DuBois b1281d6e3a Implement section-4.2.7.5.3
Reconstructing the Normalized LSF Coefficients.
2022-07-27 10:35:49 -04:00
Sean DuBois a42c71c335 Add ilog implementation
Described at 1.1.10
2022-07-27 09:59:17 -04:00
Sean DuBois 5f753386e1 Split SILK Stage one and Stage two LSF
Use a distinict function for each of these for now
2022-07-24 15:38:13 -04:00
Sean DuBois 06dcdff47a Implement Normalized LSF Stage 2 Decoding 2022-07-24 15:26:37 -04:00
Sean DuBois f61a090ac5 Improve SILK documentation
Instead of a large block of IETF RFC move it right above the relevant
code
2022-07-23 15:30:15 -04:00
Sean DuBois 5feaac5c42 Start to implement Silk LSF Decoding
Stage-1 and Stage-2 are decoded, but nothing happens after that
2022-07-23 15:26:52 -04:00