From 85dbab9f5110244ad741cc08d4a37dd0148a5371 Mon Sep 17 00:00:00 2001 From: Adriana Vasilache Date: Thu, 13 Mar 2025 11:51:05 +0200 Subject: [PATCH 1/2] fix 1305 --- lib_com/options.h | 1 + lib_com/rom_com.c | 335 ++++++++++++++++++++++++++++++++++- lib_com/rom_com.h | 15 +- lib_dec/lsf_msvq_ma_dec_fx.c | 14 ++ lib_enc/lsf_msvq_ma_enc_fx.c | 36 ++++ 5 files changed, 392 insertions(+), 9 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index d03261715..e6d2ab520 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -172,4 +172,5 @@ #define DOT_PROD_CHOLESKY_64BIT /* FhG: Issue 1323, optimized 64 bit implementation of dot_product_cholesky() */ #define OPT_BASOP_ADD_v1 /* optimizations to avoid usage of BASOP_Util_Add_MantExp */ #define FIX_ISSUE_1327 /* Ittiam: Fix for issue 1327: Glitch when stereo is switching from TD to FD*/ +#define FIX_1305_AUDIBLE_ARTIFACT_OSBA /* Nokia: Fix for issue 1305, LSF codebook correction */ #endif diff --git a/lib_com/rom_com.c b/lib_com/rom_com.c index 172dadf82..956b9298c 100644 --- a/lib_com/rom_com.c +++ b/lib_com/rom_com.c @@ -10468,7 +10468,300 @@ const Word16 dico_lsf_abs_8b[256 * M] = /*14Q1*1.28*/ 788, 1126, 1690, 3183, 3923, 4599, 6240, 6890, 7758, 9022, 9656, 10453, 11779, 12706, 13913, 15214 }; - +#ifdef FIX_1305_AUDIBLE_ARTIFACT_OSBA +const Word16 lsf_cdk_nb_gc_stg1[] = /* 14Q1*1.28 */ +{ + -2060, -834, -3519, -6892, -9000, -9354, -8591, -4740, -2875, 119, 2201, 8359, 13282, 11593, 7956, 2278, + -315, 2266, 1640, -107, -1271, -2047, -3666, -3276, -4108, -3451, -3679, -1821, 333, 5050, 4721, 721, + -1218, 981, -271, -1938, -3424, -4481, -4844, -2900, -2918, -2030, -2020, 33, 2901, 6871, 5414, 1098, + -1916, 900, 698, 68, -219, -63, -1013, -93, -1478, -1309, -2168, -747, -680, 2164, 4067, 380, + -2001, -363, -2016, -3813, -4752, -4883, -5353, -3688, -3517, -2044, -1265, 2369, 8506, 9773, 6642, 1726, + 248, 3959, 3675, 2652, 1932, 1611, 158, 496, -1059, -1258, -2253, -998, -2663, -3764, 1691, -383, + -3056, -1399, -1850, -1465, 825, 2532, 1882, 2511, 947, 697, -599, 473, 1666, 5516, 5219, 951, + -2205, -295, 2103, 6114, 5408, 4381, 1651, 1179, -819, -1319, -2842, -1832, -783, 3354, 4232, 483, + -3419, -2417, -4124, -4495, -3167, -2091, -2008, -460, -561, 480, 714, 4646, 11041, 11099, 7432, 2087, + 782, 4359, 3205, 909, -1158, -2933, -4010, -2356, -3002, -2418, -2897, -1261, -680, 2911, 4185, 437, + -1827, 393, -408, -1452, -1506, -1568, -2929, -2309, -3085, -2468, -2635, -616, 2093, 6394, 5248, 989, + -1099, 2077, 1964, 1397, 1359, 1663, 75, 284, -1415, -1539, -2596, -1322, -2072, -1045, 2852, -50, + 275, 2778, 1560, -972, -3239, -4906, -5988, -4293, -4383, -3545, -3113, -691, 3447, 7297, 5469, 1142, + 1912, 6439, 5555, 3536, 2078, 681, -1258, -945, -2396, -2387, -3439, -2108, -1654, 1626, 3649, 220, + -2736, -1056, -2026, -2283, -1942, -1935, -2292, -886, -1311, -671, -950, 1064, 4449, 7900, 5894, 1332, + -1207, 2097, 5153, 7292, 7881, 8220, 6157, 5694, 2890, 2009, 217, 441, -1324, -2301, 1586, -261, + -3719, -3558, -6766, -8479, -7263, -4535, -2476, 1188, 2432, 4577, 6099, 12169, 15681, 13069, 8913, 2744, + -364, 2097, 844, -1025, -266, 1171, -790, -1150, -2772, -2896, -3733, -2129, 193, 4996, 4691, 694, + -1212, 1562, 694, -540, -1793, -2396, -2740, -963, -1954, -1574, -2155, -499, -390, 2543, 4198, 431, + -2105, 414, 362, 294, 1109, 2369, 1647, 2286, 580, 349, -1036, -168, -1403, -787, 3071, 53, + -371, 1637, -172, -2802, -5143, -6902, -8206, -6095, -5376, -3415, -1778, 2901, 9463, 9891, 6759, 1754, + 945, 5895, 6793, 5781, 5198, 4660, 2407, 1992, 31, -610, -2095, -1308, -2595, -2809, 1729, -340, + -2652, -1244, -566, 2624, 5363, 6869, 5337, 4925, 2206, 1268, -544, -12, -517, 1354, 3679, 324, + -1123, 1908, 2991, 3717, 3991, 4507, 3107, 3163, 1235, 608, -922, -309, -2391, -4273, 1110, -473, + -1991, -348, -2945, -6143, -6120, -1816, 158, 1549, 486, 196, -975, 616, 4064, 7799, 5882, 1322, + 653, 3531, 3111, 1674, 568, -209, -2193, -2018, -3407, -3169, -3882, -2382, -1522, 2439, 3928, 321, + -2928, -738, -436, -449, -196, 290, -367, 699, -365, -184, -1094, 267, 1684, 5602, 5189, 928, + -545, 2778, 2071, 901, -8, -664, -1813, -624, -1745, -1548, -2217, -606, -1833, -1612, 2822, -81, + 2231, 5550, 4411, 1523, -646, -2384, -4820, -4570, -5160, -3905, -2915, 837, 7332, 9218, 6324, 1544, + 8157, 12351, 9926, 6396, 5298, 4611, 2495, 1013, -1482, -1834, -2032, 1469, 5424, 7407, 5978, 1259, + -3925, -3010, -3126, -1345, 1026, 2172, 1963, 2943, 2005, 1969, 1291, 3787, 8830, 10349, 7058, 1940, + -88, 5926, 10544, 12034, 12407, 12347, 9611, 8163, 4825, 3377, 1152, 1144, -856, -2192, 1966, -132 +}; +const Word16 lsf_cdk_nb_gc_stg2[] = /* 14Q1*1.28 */ +{ + -483, -1393, -3211, -2761, 478, 1110, + -1042, -694, 56, -593, -1675, -1180, + -719, -1019, -1723, -2353, -1976, -711, + -962, -738, -960, -977, 825, 938, + -1146, -2098, -1311, 2393, 2705, 1388, + -1181, -1014, 518, 1312, 594, 207, + 482, 522, -749, -2625, -3616, -1895, + 481, -166, -1181, -626, -699, -871, + 867, 191, -622, 790, 2005, 1015, + -1308, -1983, -1662, -96, -318, -384, + 2040, 1597, -394, -1781, -587, 275, + -733, 677, 736, -747, -202, 204, + 1397, 1169, 1529, 1064, -493, -586, + -1463, -482, 2909, 3604, 2192, 903, + -1191, 320, 2528, 1246, -287, -505, + 4959, 5111, 3537, 2152, 1055, 94 +}; +const Word16 lsf_cdk_nb_gc_stg3[] = /* 14Q1*1.28 */ +{ + -824, -2545, -3724, -3408, -1712, 179, 2660, 2262, 774, 346, + -511, -1223, -1897, -2419, -2373, -2276, -667, 1219, 264, 79, + -1738, -2346, -1726, -1028, -843, -940, -1175, -390, -117, -101, + 121, -132, -796, -1263, -1647, -2241, -2837, -1498, -601, -305, + 2333, 1759, 108, -1185, -1711, -1684, 297, 1547, 386, 159, + -549, -454, -323, -181, -149, -255, -2140, -4150, -1306, -532, + -2031, -2826, -1679, -198, 1055, 2028, 2144, 1724, 744, 302, + 324, 1229, 1610, 1632, 1386, 766, -1725, -4689, -1717, -588, + -422, -540, -355, -512, -328, 334, 2573, 2879, 947, 424, + 323, -400, -1121, -782, -127, 209, -366, -81, -2, -43, + -1053, -55, 571, -63, -881, -1495, -1121, 373, 23, -23, + 1066, 1601, 1036, 436, -313, -1135, -2373, -2007, -715, -337, + 1013, 1663, 1605, 1337, 821, 400, 731, 1323, 438, 168, + -1310, -967, 788, 1795, 1329, 606, -529, -583, -140, -90, + 716, 1218, 1663, 2295, 3167, 4491, 5202, 3687, 1691, 753, + 2542, 4019, 4242, 3544, 2327, 1013, -673, -1614, -670, -212 +}; +const Word16 lsf_cdk_nb_vc_stg1[] = /* 14Q1*1.28 */ +{ + -1961, -1365, -4577, -7664, -8921, -8652, -8077, -4612, -2229, 1051, 4235, 11219, 15748, 13188, 8802, 2652, + 234, 2543, 171, -3086, -5328, -6955, -5621, -336, 375, 516, -421, 990, 3231, 6966, 5595, 1168, + -2510, -1591, -3772, -4376, -3464, -3082, -3691, -2370, -2348, -946, -270, 3969, 10774, 10908, 7290, 2005, + -192, 2673, 1956, 1229, 1179, 1362, 42, 559, -823, -1005, -1818, -411, -2302, -3168, 2277, -257, + -1674, -608, -3769, -7198, -9059, -6599, -2164, 1539, 1689, 1865, 1083, 3539, 8982, 10379, 7062, 1900, + -1461, 721, -489, -1056, -363, 886, 7, 269, -1421, -1492, -2294, -863, -814, 2216, 4063, 388, + -585, 1122, -602, -2728, -4083, -5024, -6153, -4668, -4470, -3234, -2467, 1139, 7792, 9413, 6441, 1613, + 315, 2783, 1591, -865, -2448, -4069, -5780, -4517, -4699, -3763, -3185, -650, 3708, 7557, 5574, 1189, + -3328, -3219, -6201, -7084, -5269, -2999, -2230, -411, 34, 2041, 3501, 9746, 15401, 13121, 8709, 2624, + -309, 2334, 919, -507, -1048, -1901, -2771, -1048, -1971, -1625, -2175, -461, -952, 1460, 3883, 286, + -1443, 235, -1653, -3032, -3027, -3212, -2854, -965, -1591, -958, -1198, 605, 2488, 6528, 5410, 1072, + 2613, 6491, 4450, 2019, 511, -1404, -2786, -1565, -2510, -2243, -2999, -1530, -117, 4082, 4484, 603, + -1919, -733, -3014, -4503, -2445, 570, 710, 1541, 215, 106, -616, 968, 3533, 7301, 5758, 1243, + -2622, -1425, -1387, 1333, 1703, 1229, 119, 324, -967, -878, -1652, -218, 1902, 6139, 5305, 998, + 2180, 3617, 742, -2814, -6714, -10551, -11728, -5579, -2213, 715, 3956, 10548, 15336, 12977, 8665, 2588, + 7167, 9031, 4708, 1606, 642, -2355, -6199, -6202, -5019, -1622, 1776, 8389, 14216, 12321, 8284, 2390, + -1016, 228, -2094, -4435, -5876, -6889, -7498, -5070, -4311, -2181, -640, 5417, 12369, 11333, 7604, 2106, + 2584, 4010, 956, -1140, -315, 471, -375, -677, -2468, -2810, -3255, -408, 5862, 8692, 6080, 1429, + -2165, -700, -1575, -1822, -1981, -2021, -3265, -2705, -3192, -2330, -1972, 783, 5672, 8615, 6085, 1446, + 673, 4198, 4135, 2624, 2060, 1479, -885, -1097, -2664, -2573, -3404, -1907, -2103, 74, 3200, 45, + -3099, -2942, -5724, -4810, -921, 1619, 2177, 2673, 1516, 1556, 1037, 3802, 9335, 10664, 7241, 1975, + -764, 1388, 1171, 447, 208, 181, -1625, -1573, -3099, -2955, -3575, -1913, -275, 4410, 4542, 630, + 876, 3041, 794, -1929, -4064, -5674, -7920, -7025, -7246, -4589, -1795, 3237, 10315, 10308, 6996, 1825, + 2761, 6141, 4859, 1253, -1361, -2897, -4941, -4318, -4868, -3543, -2623, 2052, 9493, 10137, 6843, 1776, + -1679, -1610, -6716, -11541, -10954, -5669, -3639, 30, 2665, 6798, 11048, 17523, 19889, 15925, 10428, 3446, + 528, 3151, 2561, 560, -427, -1463, -3448, -3091, -4050, -3482, -3729, -1786, 253, 4919, 4684, 708, + -880, 1208, 45, -1536, -2260, -2737, -3803, -3038, -3702, -2962, -2852, -667, 2097, 6497, 5246, 1007, + 5754, 8749, 6871, 4178, 3513, 2439, 378, -31, -1461, -1474, -2403, -618, 963, 4158, 4568, 680, + -2573, -1935, -3986, -2498, 3386, 7946, 6310, 4845, 1789, 572, -928, 24, 1101, 4562, 4937, 823, + -1822, -427, 1318, 5379, 6468, 6385, 3695, 2898, 385, -166, -1737, -1066, -1603, 842, 3369, 203, + 3621, 5505, 2473, -556, -2957, -6572, -10701, -10145, -4975, -572, 1450, 8083, 13755, 12045, 8086, 2315, + 10952, 13782, 9203, 4300, 4281, 3883, -821, -3642, -5852, -2487, 1242, 7762, 13745, 12106, 8195, 2345 +}; +const Word16 lsf_cdk_nb_vc_stg2[] = /* 14Q1*1.28 */ +{ + -397, -736, -1813, -2201, 414, 1327, + -1212, -1449, -2061, -2011, -1949, -1527, + -422, -128, 120, -828, -3234, -3469, + 558, 358, -881, -852, -607, -1268, + -1151, -1973, -2647, -12, 4450, 3835, + -1566, 81, 579, -311, 1609, 1381, + -1578, -415, 2536, 1860, -308, -697, + 1074, 828, 1655, 1853, -98, -713, + -786, -430, 519, -813, -1663, 77, + -1341, -1682, -1072, 645, 52, -697, + 147, 91, -1107, -3325, -3643, -455, + 1998, 1747, 157, -867, 1130, 1511, + 280, -253, -804, 1186, 2088, 626, + -1367, -1562, 1011, 3899, 2631, 1368, + 2010, 2041, 1203, -483, -2349, -1822, + 3754, 3482, 2605, 2260, 1477, 524 +}; +const Word16 lsf_cdk_nb_vc_stg3[] = /* 14Q1*1.28 */ +{ + -678, -2780, -4643, -3808, -744, 889, 1302, 1030, 369, 143, + -321, -930, -1847, -2513, -2640, -2759, -1839, -256, -325, -162, + -2602, -2977, -1866, -1253, -1099, -1002, -620, 200, -23, -33, + -92, 551, 656, 43, -1018, -2515, -3743, -1616, -787, -374, + -656, -1340, -1853, -2435, -2465, -1297, 2886, 2632, 786, 382, + -336, 101, 305, 479, 575, 695, -2200, -4887, -1372, -631, + -2642, -2154, 1251, 2306, 1297, 383, 179, 545, 211, 83, + 914, 1807, 1997, 1650, 612, -302, -422, 261, 41, 11, + -1734, -2410, -1729, -329, 1409, 2446, 2079, 1586, 686, 297, + -4, -1170, -1243, -116, -54, -530, -870, -59, -107, -62, + -1688, 194, 548, -515, -915, -590, 450, 910, 257, 104, + 2619, 2096, 432, -955, -1966, -2422, -1227, 2, -200, -95, + 1520, 609, -802, -955, 95, 1348, 2178, 1782, 677, 308, + 1999, 3386, 3511, 3177, 2332, 987, -2619, -5676, -1876, -723, + -164, 746, 1661, 2372, 2848, 3271, 2912, 2104, 994, 449, + 3866, 4272, 3623, 2850, 1733, 1398, 1555, 1443, 668, 303 +}; +const Word16 lsf_cdk_wb_gc_stg1[] = /* 14Q1*1.28 */ +{ + -867, -286, -3227, -6502, -8418, -10620, -11781, -11141, -10847, -9463, -7984, -6052, -4798, -3515, -2612, -1289, + -2742, -1250, -1509, -2173, -1481, -1989, -2549, -2264, -2361, -2290, -2294, -1667, -1772, -1381, -1528, -1125, + -738, 1005, -129, -1670, -1609, -2259, -3583, -4008, -4632, -4598, -4526, -3770, -3313, -2347, -2149, -1611, + -594, 1698, 1264, 808, 1191, 304, -891, -980, -1569, -1691, -1672, -1057, -1219, -855, -1198, -1066, + -1627, -598, -2572, -4548, -5029, -6169, -6854, -6742, -6796, -6019, -5534, -4540, -4001, -2978, -2647, -1866, + -1743, 1086, 1289, 51, 67, 272, 682, 1448, 1376, 2174, 2703, 3223, 2642, 2068, 848, 310, + -101, 3633, 3829, 1953, 1934, 2125, 1125, 954, 346, 501, 512, 1063, 746, 718, -93, -282, + -1036, 1645, 5388, 7940, 9201, 8758, 7664, 6945, 5384, 4439, 3828, 3855, 2816, 2004, 621, 59, + -2599, -2616, -6234, -10128, -11516, -11801, -10338, -7441, -5794, -3699, -2315, -975, -488, -55, -309, -28, + -3172, -2492, -3548, -3539, -1194, 296, 1640, 2608, 2171, 2111, 2280, 2820, 2077, 1396, 318, -87, + 1268, 3586, 2849, 954, 570, -39, -1516, -2412, -4062, -4832, -5222, -4397, -3759, -2566, -2067, -1350, + -2634, -1539, -861, 1705, 4995, 6994, 8007, 9228, 9184, 9170, 9109, 9247, 7731, 5869, 3415, 1713, + 437, 2270, 738, -2181, -3636, -4693, -5007, -4534, -4947, -5095, -5581, -5548, -5446, -4274, -3384, -2369, + -2327, -91, 185, 201, 2601, 3866, 3797, 4023, 3218, 2663, 2492, 2870, 2188, 1405, 96, -561, + 2561, 6555, 6270, 4765, 3888, 2445, 1507, 1755, 1433, 1318, 1403, 1908, 1335, 937, -91, -370, + -733, 3342, 6303, 8329, 10686, 12626, 13833, 15136, 14549, 13949, 13630, 13065, 10700, 8031, 4779, 2618, + 846, 2351, 153, -3425, -5955, -8517, -9641, -8599, -8223, -7092, -6093, -4952, -4521, -3743, -3433, -2408, + -1635, 608, -155, -1736, -1925, -2215, -1533, -318, -96, 484, 941, 1553, 1274, 1071, 160, -194, + 543, 3271, 2102, -615, -1617, -3202, -3573, -2416, -2124, -1623, -1420, -913, -989, -764, -1039, -1001, + -1287, 451, 2606, 6175, 6827, 5438, 3549, 2938, 1503, 544, -109, 227, -540, -569, -1122, -917, + -997, 687, -885, -3191, -4415, -5938, -5718, -3907, -3259, -2229, -1650, -728, -529, -292, -875, -889, + -124, 3518, 2495, 679, 327, -672, -459, 717, 854, 1385, 1782, 2239, 1848, 1569, 455, 108, + 264, 5017, 5145, 3821, 4446, 4555, 4317, 4659, 4182, 4388, 4340, 4507, 3659, 2785, 1163, 434, + 217, 5440, 10101, 10630, 11468, 11067, 9926, 9265, 8136, 7175, 6288, 6065, 4787, 3393, 1606, 676, + -3165, -3320, -5850, -7198, -6336, -5517, -4406, -2921, -2205, -1064, -291, 599, 510, 517, -157, -173, + -3015, -2035, -1357, 446, 2462, 2533, 1858, 1867, 926, 462, 284, 778, -142, -536, -1008, -711, + 3824, 6994, 5543, 2306, 910, -827, -1695, -1606, -2055, -2250, -2468, -1950, -2215, -1804, -1932, -1516, + -1122, 2490, 3628, 3384, 4841, 5757, 6275, 7101, 6804, 6898, 6777, 6898, 5802, 4579, 2534, 1174, + 2500, 4904, 3440, -50, -2318, -4969, -7216, -8296, -9010, -7984, -6841, -5358, -4305, -3343, -3029, -2197, + -1130, 1883, 1778, 1452, 2123, 2385, 2704, 3588, 3462, 3942, 4267, 4752, 4034, 3209, 1569, 630, + 7128, 11572, 10637, 8373, 7758, 6474, 5079, 5046, 4848, 4534, 4140, 3954, 3202, 2161, 921, 97, + 2453, 10054, 15206, 16784, 18675, 18447, 17375, 16882, 14948, 13353, 11694, 10550, 8275, 6178, 3237, 1623 +}; +const Word16 lsf_cdk_wb_gc_stg2[] = /* 14Q1*1.28 */ +{ + -1242, -2325, -3447, -2957, -935, 136, + -1900, -2383, -1054, -300, -639, -453, + -1052, -912, -497, -1827, -2359, -1026, + 845, 162, -2325, -4527, -4055, -964, + -1355, -2692, -1791, 2442, 2470, 1204, + 502, 2645, 3546, 2325, 1360, 329, + -1116, -14, 2460, 1118, -549, -765, + 993, 483, 603, 1567, 72, -496, + 302, -576, -2408, -1796, 1837, 2025, + -1112, -824, 135, 481, 1018, 717, + 279, -605, -1756, -660, -565, -837, + 61, 1206, 538, -1100, -293, 284, + 494, 1057, 569, 1551, 3166, 1695, + -1282, -679, 2960, 4165, 2708, 1202, + 1352, 1776, 764, -1077, -3440, -2779, + 4230, 3681, 1704, 595, 203, -272 +}; +const Word16 lsf_cdk_wb_gc_stg3[] = /* 14Q1*1.28 */ +{ + -1692, -3602, -4793, -4647, -3130, -1455, -567, -310, -126, 97, + -781, -1342, -1595, -1825, -1968, -2228, -2423, -2173, -1728, -1014, + 1120, -141, -1734, -3425, -5169, -5705, -4960, -3464, -1921, -743, + -36, 321, 563, 433, -96, -1132, -2205, -2782, -2581, -1718, + 389, -452, -1005, -274, 832, 991, 389, -222, -692, -501, + -2190, -2798, -1607, -423, -125, -257, -431, -450, -339, -208, + 2132, 3853, 3443, 1997, 175, -1654, -2831, -2596, -1758, -1008, + 410, 564, 707, 1201, 1916, 2472, 2707, 2444, 1855, 1144, + 133, -625, -1950, -2715, -2567, -1367, 358, 942, 961, 615, + -967, 172, 864, 173, -532, -713, -114, 577, 906, 510, + 1834, 1292, -5, -1098, -1788, -1884, -1571, -1083, -729, -468, + -887, 372, 2319, 2786, 2399, 1540, 570, -42, -302, -314, + 1848, 2139, 1467, 986, 777, 696, 594, 346, -36, -161, + -1500, -2216, -2077, -724, 1004, 2503, 3162, 2791, 2094, 1256, + 1862, 3189, 3559, 3477, 3200, 2897, 2416, 1927, 1409, 787, + -1676, -724, 1843, 4078, 5072, 5294, 4906, 4095, 2988, 1725 +}; +const Word16 lsf_cdk_wb_vc_stg1[] = /* 14Q1*1.28 */ +{ + -1169, -1178, -5421, -10365, -12816, -14044, -12310, -10006, -8590, -6535, -4613, -2760, -2000, -1192, -912, -178, + -1909, -941, -2086, -2291, -1945, -2756, -3840, -4021, -4241, -4183, -4176, -3560, -3121, -2181, -2097, -1610, + 523, 1711, -538, -3944, -6115, -8627, -9588, -8822, -9035, -8633, -7845, -6415, -5644, -4498, -3779, -2302, + -1855, -559, -1281, 23, 1072, 572, 763, 1153, 835, 1105, 1350, 1741, 1200, 1028, 55, -241, + -2691, -2546, -5104, -6609, -6190, -6757, -6765, -6163, -5728, -4475, -3402, -2261, -1846, -1209, -1210, -865, + -3082, -3582, -6733, -7226, -3418, -1187, -284, 311, -112, 47, 169, 258, -28, -11, -739, -603, + 4473, 5429, 1536, -3846, -8175, -13252, -15190, -10613, -5904, -2168, -302, 357, 191, 746, 1447, 775, + 1431, 2219, -795, -3481, -2554, -907, -741, -2233, -4399, -6040, -8120, -8867, -8167, -6226, -3890, -1594, + -1792, -2685, -8570, -13886, -12914, -8973, -5293, -2814, -1816, -705, 242, 1222, 746, 533, -162, 169, + -856, 1231, 731, -1014, -1130, -1210, -1884, -1751, -2252, -2428, -2352, -1744, -1800, -1563, -1684, -1332, + -22, 1559, 590, -1712, -2772, -3958, -5012, -5069, -5691, -5673, -5605, -5118, -4872, -3945, -3319, -2382, + -796, 2508, 2924, 1050, 1472, 878, -71, 133, -502, -857, -797, -208, -372, -465, -1026, -790, + -1232, 312, -1192, -3705, -3987, -4177, -3268, -1700, -1237, -612, -55, 606, 235, -75, -563, -635, + -2460, -2548, -3890, -679, 5626, 7998, 7028, 5741, 4216, 3336, 2579, 2337, 1055, 234, -697, -746, + 7636, 9203, 4689, -70, -2224, -6648, -10688, -12527, -11302, -8061, -4352, -1565, -408, -1, -134, -45, + 5401, 7493, 5306, 1621, -57, -1869, -2037, -1404, -1893, -1859, -1714, -1338, -2161, -2093, -1986, -1999, + -297, 226, -3033, -6525, -8304, -10331, -11876, -11407, -10741, -9592, -7951, -6032, -4887, -3877, -2895, -1334, + -914, -247, -2925, -2358, 3578, 4562, 788, -2546, -5752, -7170, -6566, -4291, -3281, -2051, -965, 67, + 958, 3328, 1286, -2145, -3356, -5141, -5160, -3168, -2885, -2260, -1818, -1065, -1089, -951, -1305, -1299, + -1111, 1547, 1028, 620, 1910, 2978, 3729, 4853, 4716, 5424, 5530, 5970, 4963, 3844, 1922, 806, + -789, 430, -1825, -4684, -5341, -6421, -7098, -6773, -6841, -6028, -5296, -4291, -3910, -3178, -2851, -2009, + -152, 1451, -1176, -3532, -2507, -653, 1277, 2307, 2046, 3166, 3851, 3864, 3228, 2577, 1247, 402, + 2272, 4107, 1167, -2454, -4673, -6822, -9669, -11249, -10517, -2412, 286, 88, 1817, 1123, -2665, -2833, + 3913, 5708, 4811, 3337, 1431, -1822, -3706, -5212, -7184, -9025, -11824, -12428, -10673, -5173, -2384, -1195, + 125, 752, -2925, -7524, -9726, -11192, -8177, -2854, -1547, -930, -363, 660, 464, -131, -736, -845, + 1605, 3944, 3301, 757, -142, -1414, -2622, -3166, -4092, -4396, -4293, -3769, -3540, -3025, -2897, -2179, + 3324, 4999, 2179, -2199, -4356, -6696, -7413, -7170, -7510, -7517, -6940, -5624, -5053, -4160, -3856, -2534, + 1926, 5651, 4554, 2772, 2615, 2146, 1467, 1462, 809, 414, 250, 449, 206, -7, -689, -794, + 1748, 3789, 1287, -210, -249, -1717, -1233, 71, 634, 900, 1499, 1930, 1533, 1187, 374, 113, + -1051, 912, 4019, 6818, 7680, 6760, 5073, 4635, 3239, 1998, 1060, 1348, 422, 43, -631, -616, + 12481, 14518, 8906, 2685, 2678, 1065, -3826, -7701, -10446, -9199, -6504, -4763, -2970, -2352, -1187, -80, + 7355, 9912, 7924, 4619, 4452, 3295, 2333, 2403, 1487, 526, 194, 447, 494, 495, 68, -603 +}; +const Word16 lsf_cdk_wb_vc_stg2[] = /* 14Q1*1.28 */ +{ + -199, -1044, -2616, -2667, -186, 531, + -2115, -2918, -2904, -2029, -1702, -867, + -172, -882, -1792, -3078, -4165, -2114, + 1603, 650, -1423, -1268, 222, -909, + -1122, -1814, -2124, 698, 2594, 1367, + -1728, -1588, 1105, 2391, 914, 302, + -710, 1344, 673, -201, 1418, 156, + 860, 452, 872, 1786, 464, -166, + -1260, -1152, -315, -1067, -841, 839, + -240, -615, -495, 164, -1529, -2363, + 1274, 2119, 1920, -455, -3447, -3084, + 1301, 1367, -85, -2793, -2835, 680, + 1100, 480, -872, -662, 3185, 3071, + -489, -484, 1628, 4541, 3735, 2114, + -694, 1395, 3995, 2266, 249, -598, + 2592, 2691, 2433, 2373, 1923, 1041 +}; +const Word16 lsf_cdk_wb_vc_stg3[] = /* 14Q1*1.28 */ +{ + -1348, -3219, -4401, -3923, -3061, -2172, -875, -259, 183, 343, + -2283, -2097, -962, -1304, -1678, -1806, -1331, -796, -460, -279, + -56, -721, -1679, -2316, -2741, -3369, -4049, -3809, -2633, -1403, + -7, 1185, 1122, 277, -1077, -2267, -2277, -1051, 173, 276, + -4, -923, -765, 392, 856, 71, -1043, -2005, -2414, -1876, + -2432, -3790, -2774, -334, 928, 1265, 1235, 1001, 717, 387, + 2508, 4109, 3043, 1345, -870, -3281, -5688, -5934, -4210, -2107, + 859, 596, 522, 1732, 2563, 2431, 1771, 1518, 915, 574, + 265, -841, -2749, -3324, -752, 1580, 1290, 379, -226, -38, + -603, -361, -84, -151, -477, -125, 1559, 2067, 1923, 1176, + 1419, 485, -1310, -2957, -4194, -3673, -1361, 307, 766, 601, + -2545, -1816, 2196, 2955, 2377, 2344, 1771, 1381, 818, 284, + 3026, 2792, 1328, 232, -316, 162, 514, 507, -100, -238, + -873, -1018, -721, 120, 2420, 4278, 5225, 4665, 3656, 2135, + 174, 2325, 3613, 3322, 2019, 629, -345, -911, -1250, -988, + 1901, 3294, 3621, 3934, 4002, 3935, 3603, 2939, 2143, 1151 +}; +#else const Word16 lsf_cdk_nb_gc_stg1[] = /* 14Q1*1.28 */ { -2046, -827, -3490, -8984, -9331, -8562, -2854, 112, 2194, 13294, 11592, 7952, @@ -10761,7 +11054,7 @@ const Word16 lsf_cdk_wb_vc_stg3[] = /* 14Q1*1.28 */ 1, 9, 160, 3607, 3314, 2016, -333, -884, -1233, 13, 12, 1888, 3621, 3935, 4000, 3607, 2932, 2128 }; - +#endif const Word16 *const lsf_codebook[2][2][TCXLPC_NUMSTAGES] = /* 14Q1*1.28 */ { { @@ -10778,10 +11071,41 @@ const Word16 lsf_numbits[TCXLPC_NUMSTAGES] = { 5, 4, 4 }; // Q0 const Word16 lsf_dims_ivas[TCXLPC_NUMSTAGES] = { 16, 6, 10 }; // Q0 const Word16 lsf_offs_ivas[TCXLPC_NUMSTAGES] = { 0, 0, 6 }; // Q0 +#ifndef FIX_1305_AUDIBLE_ARTIFACT_OSBA const Word16 lsf_dims[TCXLPC_NUMSTAGES] = { 16, 8, 12 }; // Q0 const Word16 lsf_offs[TCXLPC_NUMSTAGES] = { 0, 0, 4 }; // Q0 +#endif - +#ifdef FIX_1305_AUDIBLE_ARTIFACT_OSBA +const Word16 lsf_ind_cdk_nb_gc_stg4[] = /* 14Q1*1.28 */ +{ + -1373, -706, + 80, 263, + -898, 1016, + 969, 2021 +}; +const Word16 lsf_ind_cdk_nb_vc_stg4[] = /* 14Q1*1.28 */ +{ + -1373, -958, + 640, 1409, + -379, 253, + 2488, 3229 +}; +const Word16 lsf_ind_cdk_wb_gc_stg4[] = /* 14Q1*1.28 */ +{ + -1288, -818, + 373, 283, + -711, 1152, + 1300, 2455 +}; +const Word16 lsf_ind_cdk_wb_vc_stg4[] = /* 14Q1*1.28 */ +{ + -1051, -848, + 703, 409, + -564, 1535, + 2271, 2716 +}; +#else const Word16 lsf_ind_cdk_nb_gc_stg4[] = /* 14Q1*1.28 */ { -1360, -704, 0, @@ -10810,7 +11134,7 @@ const Word16 lsf_ind_cdk_wb_vc_stg4[] = /* 14Q1*1.28 */ -560, 1520, 0, 2256, 2704, 0 }; - +#endif const Word16 *const lsf_ind_codebook[2][2][TCXLPC_IND_NUMSTAGES] = /* 14Q1*1.28 */ { { { lsf_ind_cdk_wb_gc_stg4 }, { lsf_ind_cdk_wb_vc_stg4 } }, @@ -10820,9 +11144,12 @@ const Word16 *const lsf_ind_codebook[2][2][TCXLPC_IND_NUMSTAGES] = /* 14Q1*1.28 const Word16 lsf_ind_numbits[TCXLPC_IND_NUMSTAGES] = { 2 }; // Q0 const Word16 lsf_ind_dims_ivas[TCXLPC_IND_NUMSTAGES] = { 2 }; // Q0 +#ifndef FIX_1305_AUDIBLE_ARTIFACT_OSBA const Word16 lsf_ind_dims[TCXLPC_IND_NUMSTAGES] = { 4 }; // Q0 +#endif const Word16 lsf_ind_offs[TCXLPC_IND_NUMSTAGES] = { 0 }; // Q0 + const Word16 min_distance_thr[2][2] = /* 14Q1*1.28 */ { /* GC, VC */ diff --git a/lib_com/rom_com.h b/lib_com/rom_com.h index 33661fb58..151f200d6 100644 --- a/lib_com/rom_com.h +++ b/lib_com/rom_com.h @@ -543,8 +543,10 @@ extern const Word16 *const lsf_codebook[2][2][TCXLPC_NUMSTAGES]; /* 14Q1*1.28 */ extern const Word16 lsf_numbits[TCXLPC_NUMSTAGES]; // Q0 extern const Word16 lsf_dims_ivas[TCXLPC_NUMSTAGES]; // Q0 extern const Word16 lsf_offs_ivas[TCXLPC_NUMSTAGES]; // Q0 -extern const Word16 lsf_dims[TCXLPC_NUMSTAGES]; // Q0 -extern const Word16 lsf_offs[TCXLPC_NUMSTAGES]; // Q0 +#ifndef FIX_1305_AUDIBLE_ARTIFACT_OSBA +extern const Word16 lsf_dims[TCXLPC_NUMSTAGES]; // Q0 +extern const Word16 lsf_offs[TCXLPC_NUMSTAGES]; // Q0 +#endif extern const Word16 dico_lsf_abs_8b[]; /* 14Q1*1.28 */ @@ -571,9 +573,12 @@ extern const Word16 lsf_ind_cdk_wb_vc_stg4[]; /* 14Q1*1.28 */ extern const Word16 *const lsf_ind_codebook[2][2][TCXLPC_IND_NUMSTAGES]; /* 14Q1*1.28 */ extern const Word16 lsf_ind_numbits[TCXLPC_IND_NUMSTAGES]; // Q0 extern const Word16 lsf_ind_dims_ivas[TCXLPC_IND_NUMSTAGES]; // Q0 -extern const Word16 lsf_ind_dims[TCXLPC_IND_NUMSTAGES]; // Q0 -extern const Word16 lsf_ind_offs[TCXLPC_IND_NUMSTAGES]; // Q0 -extern const Word16 min_distance_thr[2][2]; /* 14Q1*1.28 */ +#ifndef FIX_1305_AUDIBLE_ARTIFACT_OSBA +extern const Word16 lsf_ind_dims[TCXLPC_IND_NUMSTAGES]; // Q0 +#endif +extern const Word16 lsf_ind_offs[TCXLPC_IND_NUMSTAGES]; // Q0 + +extern const Word16 min_distance_thr[2][2]; /* 14Q1*1.28 */ typedef Word16 lsp_unw_triplet[3]; // Q14 extern const lsp_unw_triplet p16_gamma0_92to1[16]; diff --git a/lib_dec/lsf_msvq_ma_dec_fx.c b/lib_dec/lsf_msvq_ma_dec_fx.c index 61e338c9c..aa67f9fd5 100644 --- a/lib_dec/lsf_msvq_ma_dec_fx.c +++ b/lib_dec/lsf_msvq_ma_dec_fx.c @@ -179,8 +179,13 @@ Word16 D_lsf_tcxlpc( msvq_dec( lsf_codebook[narrowband][cdk], +#ifdef FIX_1305_AUDIBLE_ARTIFACT_OSBA + lsf_dims_ivas, + lsf_offs_ivas, +#else lsf_dims, lsf_offs, +#endif TCXLPC_NUMSTAGES, M, M, @@ -202,7 +207,11 @@ Word16 D_lsf_tcxlpc( { msvq_dec( lsf_ind_codebook[narrowband][cdk], +#ifdef FIX_1305_AUDIBLE_ARTIFACT_OSBA + lsf_ind_dims_ivas, +#else lsf_ind_dims, +#endif lsf_ind_offs, TCXLPC_IND_NUMSTAGES, M, @@ -281,8 +290,13 @@ Word16 dec_lsf_tcxlpc( /* Decode independent lsf */ msvq_dec( lsf_codebook[narrowband][cdk], +#ifdef FIX_1305_AUDIBLE_ARTIFACT_OSBA + lsf_dims_ivas, + lsf_offs_ivas, +#else lsf_dims, lsf_offs, +#endif TCXLPC_NUMSTAGES, M, M, diff --git a/lib_enc/lsf_msvq_ma_enc_fx.c b/lib_enc/lsf_msvq_ma_enc_fx.c index aa2255c68..982e63265 100644 --- a/lib_enc/lsf_msvq_ma_enc_fx.c +++ b/lib_enc/lsf_msvq_ma_enc_fx.c @@ -552,8 +552,13 @@ Word16 Q_lsf_tcxlpc_fx( msvq_enc_fx( lsf_codebook[narrowband][cdk], +#ifdef FIX_1305_AUDIBLE_ARTIFACT_OSBA + lsf_dims_ivas, + lsf_offs_ivas, +#else lsf_dims, lsf_offs, +#endif lsf, lsf_numlevels, kMaxC, @@ -564,8 +569,13 @@ Word16 Q_lsf_tcxlpc_fx( indices + NumIndices ); msvq_dec( lsf_codebook[narrowband][cdk], +#ifdef FIX_1305_AUDIBLE_ARTIFACT_OSBA + lsf_dims_ivas, + lsf_offs_ivas, +#else lsf_dims, lsf_offs, +#endif TCXLPC_NUMSTAGES, lpcorder, lpcorder, @@ -595,7 +605,11 @@ Word16 Q_lsf_tcxlpc_fx( /* Quantize using extra stage(s) */ msvq_enc_fx( lsf_ind_codebook[narrowband][cdk], +#ifdef FIX_1305_AUDIBLE_ARTIFACT_OSBA + lsf_ind_dims_ivas, +#else lsf_ind_dims, +#endif lsf_ind_offs, lsf_rem, lsf_ind_numlevels, @@ -611,7 +625,11 @@ Word16 Q_lsf_tcxlpc_fx( /* Decode */ msvq_dec( lsf_ind_codebook[narrowband][cdk], +#ifdef FIX_1305_AUDIBLE_ARTIFACT_OSBA + lsf_ind_dims_ivas, +#else lsf_ind_dims, +#endif lsf_ind_offs, TCXLPC_IND_NUMSTAGES, lpcorder, @@ -706,8 +724,13 @@ Word16 Q_lsf_tcxlpc_ivas_fx( msvq_enc_fx( lsf_codebook[narrowband][cdk], +#ifdef FIX_1305_AUDIBLE_ARTIFACT_OSBA + lsf_dims_ivas, + lsf_offs_ivas, +#else lsf_dims, lsf_offs, +#endif lsf, lsf_numlevels, kMaxC, @@ -718,8 +741,13 @@ Word16 Q_lsf_tcxlpc_ivas_fx( indices + NumIndices ); msvq_dec( lsf_codebook[narrowband][cdk], +#ifdef FIX_1305_AUDIBLE_ARTIFACT_OSBA + lsf_dims_ivas, + lsf_offs_ivas, +#else lsf_dims, lsf_offs, +#endif TCXLPC_NUMSTAGES, lpcorder, lpcorder, @@ -750,7 +778,11 @@ Word16 Q_lsf_tcxlpc_ivas_fx( /* Quantize using extra stage(s) */ msvq_enc_fx( lsf_ind_codebook[narrowband][cdk], +#ifdef FIX_1305_AUDIBLE_ARTIFACT_OSBA + lsf_ind_dims_ivas, +#else lsf_ind_dims, +#endif lsf_ind_offs, lsf_rem, lsf_ind_numlevels, @@ -766,7 +798,11 @@ Word16 Q_lsf_tcxlpc_ivas_fx( /* Decode */ msvq_dec( lsf_ind_codebook[narrowband][cdk], +#ifdef FIX_1305_AUDIBLE_ARTIFACT_OSBA + lsf_ind_dims_ivas, +#else lsf_ind_dims, +#endif lsf_ind_offs, TCXLPC_IND_NUMSTAGES, lpcorder, -- GitLab From 2a30780e840a71b39b0d64dab8c8b40902418b1b Mon Sep 17 00:00:00 2001 From: Adriana Vasilache Date: Wed, 19 Mar 2025 09:43:33 +0200 Subject: [PATCH 2/2] fix 1305 work --- lib_com/lsf_tools_fx.c | 4 ++++ lib_com/options.h | 2 +- lib_enc/lsf_msvq_ma_enc_fx.c | 7 +++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index 08e74b9b7..8f7250221 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -3406,8 +3406,12 @@ void msvq_dec( maxn = n; move16(); } +#ifndef FIX_1305_AUDIBLE_ARTIFACT_OSBA assert( ( maxn % 4 ) == 0 ); N34 = mult( maxn, 24576 /*0.75 Q15*/ ); +#else + N34 = maxn; +#endif start = 0; move16(); diff --git a/lib_com/options.h b/lib_com/options.h index e6d2ab520..b5ff3ece9 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -172,5 +172,5 @@ #define DOT_PROD_CHOLESKY_64BIT /* FhG: Issue 1323, optimized 64 bit implementation of dot_product_cholesky() */ #define OPT_BASOP_ADD_v1 /* optimizations to avoid usage of BASOP_Util_Add_MantExp */ #define FIX_ISSUE_1327 /* Ittiam: Fix for issue 1327: Glitch when stereo is switching from TD to FD*/ -#define FIX_1305_AUDIBLE_ARTIFACT_OSBA /* Nokia: Fix for issue 1305, LSF codebook correction */ +//#define FIX_1305_AUDIBLE_ARTIFACT_OSBA /* Nokia: Fix for issue 1305, LSF codebook correction */ #endif diff --git a/lib_enc/lsf_msvq_ma_enc_fx.c b/lib_enc/lsf_msvq_ma_enc_fx.c index 982e63265..9557ce53c 100644 --- a/lib_enc/lsf_msvq_ma_enc_fx.c +++ b/lib_enc/lsf_msvq_ma_enc_fx.c @@ -301,10 +301,13 @@ void msvq_enc_fx( maxn = n; move16(); } - +#ifndef FIX_1305_AUDIBLE_ARTIFACT_OSBA assert( ( maxn % 4 ) == 0 ); N34 = mult( maxn, 24576 /*0.75f Q15*/ ); - +#else + N34 = maxn; + move16(); /* but actually there is no need for this*/ +#endif start = 0; move16(); if ( offs ) -- GitLab