diff options
author | Koen Vos <koen.vos@skype.net> | 2011-12-13 23:47:31 +0400 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2011-12-13 23:47:31 +0400 |
commit | bf75c8ec4d0dded188bc7793de6da56c7ff0be1c (patch) | |
tree | c21bb05faf0a203b73e8f8aae90fc63dac27625d /silk/resampler_rom.c | |
parent | 6619a736376221f2782cecff55d051c3ecfc2ff7 (diff) |
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
Diffstat (limited to 'silk/resampler_rom.c')
-rw-r--r-- | silk/resampler_rom.c | 214 |
1 files changed, 48 insertions, 166 deletions
diff --git a/silk/resampler_rom.c b/silk/resampler_rom.c index 15473e09..9c4750c3 100644 --- a/silk/resampler_rom.c +++ b/silk/resampler_rom.c @@ -30,7 +30,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endif /* Filter coefficients for IIR/FIR polyphase resampling * - * Total size: < 600 Words (1.2 kB) */ + * Total size: 179 Words (358 Bytes) */ #include "resampler_private.h" @@ -39,32 +39,46 @@ const opus_int16 silk_resampler_down2_0 = 9872; const opus_int16 silk_resampler_down2_1 = 39809 - 65536; /* Tables for 2x upsampler, high quality */ -const opus_int16 silk_resampler_up2_hq_0[ 2 ] = { 4280, 33727 - 65536 }; -const opus_int16 silk_resampler_up2_hq_1[ 2 ] = { 16295, 54015 - 65536 }; -const opus_int16 silk_resampler_up2_hq_notch[ 4 ] = { 6554, -3932, 6554, 30573 }; +const opus_int16 silk_resampler_up2_hq_0[ 3 ] = { 1746, 14986, 39083 - 65536 }; +const opus_int16 silk_resampler_up2_hq_1[ 3 ] = { 6854, 25769, 55542 - 65536 }; -/* Tables with IIR and FIR coefficients for fractional downsamplers (90 Words) */ -silk_DWORD_ALIGN const opus_int16 silk_Resampler_3_4_COEFS[ 2 + 3 * RESAMPLER_DOWN_ORDER_FIR / 2 ] = { - -20253, -13986, - 86, 7, -151, 368, -542, 232, 11041, 21904, - 39, 90, -181, 216, -17, -877, 6408, 19695, - 2, 113, -108, 2, 314, -977, 2665, 15787, +/* Matlab code for the notch filter coefficients: */ +/* B = [1, 0.147, 1]; A = [1, 0.107, 0.89]; G = 0.93; freqz(G * B, A, 2^14, 16e3); axis([0, 8000, -10, 1]) */ +/* fprintf('\t%6d, %6d, %6d, %6d\n', round(B(2)*2^16), round(-A(2)*2^16), round((1-A(3))*2^16), round(G*2^15)) */ +const opus_int16 silk_resampler_up2_hq_notch[ 4 ] = { 9634, -7012, 7209, 30474 }; + +/* Tables with IIR and FIR coefficients for fractional downsamplers (123 Words) */ +silk_DWORD_ALIGN const opus_int16 silk_Resampler_3_4_COEFS[ 2 + 3 * RESAMPLER_DOWN_ORDER_FIR0 / 2 ] = { + -20694, -13867, + -49, 64, 17, -157, 353, -496, 163, 11047, 22205, + -39, 6, 91, -170, 186, 23, -896, 6336, 19928, + -19, -36, 102, -89, -24, 328, -951, 2568, 15909, +}; + +silk_DWORD_ALIGN const opus_int16 silk_Resampler_2_3_COEFS[ 2 + 2 * RESAMPLER_DOWN_ORDER_FIR0 / 2 ] = { + -14457, -14019, + 64, 128, -122, 36, 310, -768, 584, 9267, 17733, + 12, 128, 18, -142, 288, -117, -865, 4123, 14459, +}; + +silk_DWORD_ALIGN const opus_int16 silk_Resampler_1_2_COEFS[ 2 + RESAMPLER_DOWN_ORDER_FIR1 / 2 ] = { + 616, -14323, + -10, 39, 58, -46, -84, 120, 184, -315, -541, 1284, 5380, 9024, }; -silk_DWORD_ALIGN const opus_int16 silk_Resampler_2_3_COEFS[ 2 + 2 * RESAMPLER_DOWN_ORDER_FIR / 2 ] = { - -13997, -14120, - 60, -174, 71, 298, -800, 659, 9238, 17461, - 48, -40, -150, 314, -155, -845, 4188, 14293, +silk_DWORD_ALIGN const opus_int16 silk_Resampler_1_3_COEFS[ 2 + RESAMPLER_DOWN_ORDER_FIR2 / 2 ] = { + 16102, -15162, + -13, 0, 20, 26, 5, -31, -43, -4, 65, 90, 7, -157, -248, -44, 593, 1583, 2612, 3271, }; -silk_DWORD_ALIGN const opus_int16 silk_Resampler_1_2_COEFS[ 2 + RESAMPLER_DOWN_ORDER_FIR / 2 ] = { - 1233, -14293, - -91, 162, 169, -342, -505, 1332, 5281, 8742, +silk_DWORD_ALIGN const opus_int16 silk_Resampler_1_4_COEFS[ 2 + RESAMPLER_DOWN_ORDER_FIR2 / 2 ] = { + 22500, -15099, + 3, -14, -20, -15, 2, 25, 37, 25, -16, -71, -107, -79, 50, 292, 623, 982, 1288, 1464, }; -silk_DWORD_ALIGN const opus_int16 silk_Resampler_1_3_COEFS[ 2 + RESAMPLER_DOWN_ORDER_FIR / 2 ] = { - 16306, -14409, - 99, -201, -220, -16, 572, 1483, 2433, 3043, +silk_DWORD_ALIGN const opus_int16 silk_Resampler_1_6_COEFS[ 2 + RESAMPLER_DOWN_ORDER_FIR2 / 2 ] = { + 27540, -15257, + 17, 12, 8, 1, -10, -22, -30, -32, -22, 3, 44, 100, 168, 243, 317, 381, 429, 455, }; silk_DWORD_ALIGN const opus_int16 silk_Resampler_2_3_COEFS_LQ[ 2 + 2 * 2 ] = { @@ -73,150 +87,18 @@ silk_DWORD_ALIGN const opus_int16 silk_Resampler_2_3_COEFS_LQ[ 2 + 2 * 2 ] = { 1567, 8276, }; -/* Table with interplation fractions of 1/288 : 2/288 : 287/288 (432 Words) */ -silk_DWORD_ALIGN const opus_int16 silk_resampler_frac_FIR_144[ 144 ][ RESAMPLER_ORDER_FIR_144 / 2 ] = { - { -25, 58, 32526}, - { -8, -69, 32461}, - { 8, -195, 32393}, - { 25, -318, 32321}, - { 41, -439, 32244}, - { 57, -557, 32163}, - { 72, -673, 32079}, - { 88, -787, 31990}, - { 103, -899, 31897}, - { 118, -1009, 31801}, - { 133, -1116, 31700}, - { 148, -1221, 31596}, - { 162, -1324, 31488}, - { 177, -1424, 31376}, - { 191, -1522, 31260}, - { 205, -1618, 31140}, - { 218, -1712, 31017}, - { 231, -1803, 30890}, - { 245, -1893, 30759}, - { 257, -1980, 30625}, - { 270, -2065, 30487}, - { 282, -2147, 30346}, - { 295, -2228, 30201}, - { 306, -2306, 30052}, - { 318, -2382, 29900}, - { 330, -2456, 29745}, - { 341, -2528, 29586}, - { 352, -2597, 29424}, - { 362, -2664, 29259}, - { 373, -2730, 29090}, - { 383, -2793, 28918}, - { 393, -2854, 28743}, - { 402, -2912, 28565}, - { 411, -2969, 28384}, - { 421, -3024, 28199}, - { 429, -3076, 28012}, - { 438, -3126, 27822}, - { 446, -3175, 27628}, - { 454, -3221, 27432}, - { 462, -3265, 27233}, - { 469, -3307, 27031}, - { 476, -3348, 26826}, - { 483, -3386, 26619}, - { 490, -3422, 26409}, - { 496, -3456, 26196}, - { 502, -3488, 25981}, - { 508, -3518, 25763}, - { 514, -3547, 25543}, - { 519, -3573, 25320}, - { 524, -3597, 25095}, - { 529, -3620, 24867}, - { 533, -3640, 24637}, - { 538, -3659, 24405}, - { 541, -3676, 24171}, - { 545, -3691, 23934}, - { 548, -3704, 23696}, - { 552, -3716, 23455}, - { 554, -3726, 23212}, - { 557, -3733, 22967}, - { 559, -3740, 22721}, - { 561, -3744, 22472}, - { 563, -3747, 22222}, - { 565, -3748, 21970}, - { 566, -3747, 21716}, - { 567, -3745, 21460}, - { 568, -3741, 21203}, - { 568, -3735, 20944}, - { 568, -3728, 20684}, - { 568, -3719, 20422}, - { 568, -3708, 20159}, - { 568, -3697, 19894}, - { 567, -3683, 19628}, - { 566, -3668, 19361}, - { 564, -3652, 19093}, - { 563, -3634, 18823}, - { 561, -3614, 18552}, - { 559, -3594, 18280}, - { 557, -3571, 18008}, - { 554, -3548, 17734}, - { 552, -3523, 17459}, - { 549, -3497, 17183}, - { 546, -3469, 16907}, - { 542, -3440, 16630}, - { 539, -3410, 16352}, - { 535, -3379, 16074}, - { 531, -3346, 15794}, - { 527, -3312, 15515}, - { 522, -3277, 15235}, - { 517, -3241, 14954}, - { 513, -3203, 14673}, - { 507, -3165, 14392}, - { 502, -3125, 14110}, - { 497, -3085, 13828}, - { 491, -3043, 13546}, - { 485, -3000, 13264}, - { 479, -2957, 12982}, - { 473, -2912, 12699}, - { 466, -2867, 12417}, - { 460, -2820, 12135}, - { 453, -2772, 11853}, - { 446, -2724, 11571}, - { 439, -2675, 11289}, - { 432, -2625, 11008}, - { 424, -2574, 10727}, - { 417, -2522, 10446}, - { 409, -2470, 10166}, - { 401, -2417, 9886}, - { 393, -2363, 9607}, - { 385, -2309, 9328}, - { 376, -2253, 9050}, - { 368, -2198, 8773}, - { 359, -2141, 8497}, - { 351, -2084, 8221}, - { 342, -2026, 7946}, - { 333, -1968, 7672}, - { 324, -1910, 7399}, - { 315, -1850, 7127}, - { 305, -1791, 6856}, - { 296, -1731, 6586}, - { 286, -1670, 6317}, - { 277, -1609, 6049}, - { 267, -1548, 5783}, - { 257, -1486, 5517}, - { 247, -1424, 5254}, - { 237, -1362, 4991}, - { 227, -1300, 4730}, - { 217, -1237, 4470}, - { 207, -1174, 4212}, - { 197, -1110, 3956}, - { 187, -1047, 3701}, - { 176, -984, 3448}, - { 166, -920, 3196}, - { 155, -856, 2946}, - { 145, -792, 2698}, - { 134, -728, 2452}, - { 124, -664, 2207}, - { 113, -600, 1965}, - { 102, -536, 1724}, - { 92, -472, 1486}, - { 81, -408, 1249}, - { 70, -345, 1015}, - { 60, -281, 783}, - { 49, -217, 553}, - { 38, -154, 325}, +/* Table with interplation fractions of 1/24, 3/24, 5/24, ... , 23/24 : 23/24 (46 Words) */ +silk_DWORD_ALIGN const opus_int16 silk_resampler_frac_FIR_12[ 12 ][ RESAMPLER_ORDER_FIR_12 / 2 ] = { + { 189, -600, 617, 30567 }, + { 117, -159, -1070, 29704 }, + { 52, 221, -2392, 28276 }, + { -4, 529, -3350, 26341 }, + { -48, 758, -3956, 23973 }, + { -80, 905, -4235, 21254 }, + { -99, 972, -4222, 18278 }, + { -107, 967, -3957, 15143 }, + { -103, 896, -3487, 11950 }, + { -91, 773, -2865, 8798 }, + { -71, 611, -2143, 5784 }, + { -46, 425, -1375, 2996 }, }; |