changeset 7834:b9a26c7e64ef libavcodec

Normalize triplets in gain_val_tab[][] so gain_exp_tab[] can be just an one-dimensional array.
author vitor
date Mon, 08 Sep 2008 18:51:33 +0000
parents 52d04dea9491
children bc904d7e5551
files ra144.c ra144.h
diffstat 2 files changed, 82 insertions(+), 130 deletions(-) [+]
line wrap: on
line diff
--- a/ra144.c	Mon Sep 08 18:31:48 2008 +0000
+++ b/ra144.c	Mon Sep 08 18:51:33 2008 +0000
@@ -136,7 +136,7 @@
 
     v[0] = 0;
     for (i=!skip_first; i<3; i++)
-        v[i] = (gain_val_tab[n][i] * m[i]) >> (gain_exp_tab[n][i] + 1);
+        v[i] = (gain_val_tab[n][i] * m[i]) >> gain_exp_tab[n];
 
     for (i=0; i < BLOCKSIZE; i++)
         dest[i] = (s1[i]*v[0] + s2[i]*v[1] + s3[i]*v[2]) >> 12;
--- a/ra144.h	Mon Sep 08 18:31:48 2008 +0000
+++ b/ra144.h	Mon Sep 08 18:51:33 2008 +0000
@@ -26,137 +26,89 @@
 
 /* 14.4 data tables */
 static const int16_t gain_val_tab[256][3] = {
-    {541,  956,  768}, {877,  581,  568}, {675,  787,  635}, {624,  732,  668},
-    {623,  839,  697}, {640,  693,  991}, {925,  687,  608}, {552,  797,  572},
-    {535,  832,  799}, {762,  605,  577}, {832,  561, 1003}, {590,  687,  588},
-    {646,  901,  732}, {828,  689,  896}, {875,  624,  848}, {571,  942, 1022},
-    {824,  736,  643}, {517,  765,  512}, {562,  908,  761}, {694,  913,  675},
-    {704,  524,  672}, {721,  757,  558}, {884,  551,  633}, {558, 1007,  846},
-    {932,  746,  777}, {566,  822,  926}, {613,  771,  611}, {737,  671, 1008},
-    {651,  594,  579}, {801,  636,  564}, {852,  910,  719}, {998,  614,  575},
-    {665,  935,  628}, {631,  596,  829}, {644,  926,  526}, {879,  988,  613},
-    {941,  692,  693}, {565,  672,  576}, {547,  628,  740}, {639,  532,  537},
-    {955,  604,  598}, {562,  580,  900}, {603,  899,  621}, {746,  533,  624},
-    {729,  514,  735}, {853,  551,  692}, {949, 1018, 1004}, {544,  988,  735},
-    {789,  782,  821}, {897,  516,  754}, {517,  702,  828}, {586,  818,  763},
-    {907,  652,  592}, {528,  652,  642}, {531,  708,  780}, {666,  625,  727},
-    {947,  727,  554}, {549,  657,  981}, {605,  920,  852}, {624,  619,  983},
-    {605,  909,  547}, {690,  935,  516}, {700,  612,  853}, {767,  832,  574},
-    {523,  898,  923}, {722,  958,  691}, {613,  771,  928}, {758,  757,  584},
-    {512,  567,  577}, {615,  638,  698}, {574,  642,  589}, {993,  682,  878},
-    {539,  890,  913}, {694,  928,  544}, {805,  600,  680}, {540,  951,  782},
-    {816,  950,  590}, {955,  847,  811}, {547,  883,  556}, {652,  888,  604},
-    {863,  585,  855}, {1023, 997,  516}, {932,  614,  640}, {627,  564,  573},
-    {876,  900,  724}, {515,  857,  896}, {647,  953,  879}, {806,  854,  857},
-    {545,  583,  631}, {657,  601,  751}, {740,  905,  795}, {841, 1016,  568},
-    {747,  589,  983}, {878,  613,  526}, {864,  723,  779}, {534,  674,  774},
-    {950,  649,  939}, {590,  703,  899}, {618,  527,  579}, {725,  647,  972},
-    {641,  647,  707}, {730,  663,  644}, {807,  572,  578}, {879,  611,  821},
-    {667,  729,  841}, {782,  585,  751}, {802,  733,  976}, {850,  871,  708},
-    {870,  743,  704}, {941,  899,  585}, {943,  632,  875}, {1023, 732,  638},
-    {778,  753,  655}, {843,  945,  945}, {942,  969,  572}, {1008, 559,  854},
-    {868,  729,  787}, {970,  686,  547}, {535,  635,  674}, {560,  636,  828},
-    {994,  592,  833}, {548,  621,  694}, {550,  801,  955}, {582,  522,  646},
-    {606,  625,  818}, {623,  591,  874}, {669,  535, 1001}, {701,  938,  592},
-    {925,  820,  738}, {735,  790,  544}, {575,  788,  674}, {655,  783,  528},
-    {527,  513,  677}, {782,  852,  940}, {578,  910,  513}, {692,  882,  734},
-    {586,  683,  715}, {739,  609,  717}, {778,  773,  697}, {922,  785,  813},
-    {766,  651,  984}, {978,  596,  515}, {535,  757,  540}, {662,  687,  589},
-    {554,  536,  979}, {723,  982,  690}, {936,  956,  527}, {590, 1002,  547},
-    {517,  653,  825}, {832,  592,  974}, {512,  957,  903}, {631,  545,  906},
-    {514,  720,  649}, {596,  679,  694}, {617,  740,  979}, {711,  685,  877},
-    {655,  835,  848}, {754,  839,  698}, {871,  515,  769}, {955,  852,  573},
-    {640,  859,  587}, {792,  863,  554}, {843,  708,  682}, {971,  768,  552},
-    {891,  536,  690}, {1016, 560,  663}, {543,  870,  674}, {601,  999,  585},
-    {945,  966,  889}, {529,  912,  777}, {574, 1020,  714}, {609,  922,  932},
-    {598,  778,  929}, {651,  772,  744}, {691,  957,  722}, {729,  766,  984},
-    {547,  519,  632}, {583,  532,  922}, {633,  995,  603}, {677,  571,  874},
-    {602,  545,  666}, {627,  542,  875}, {672,  983,  598}, {692,  979,  730},
-    {668,  634,  872}, {711,  706,  674}, {739,  977,  595}, {759,  905,  763},
-    {756,  582,  763}, {748, 1013,  908}, {804,  937,  950}, {785,  543,  998},
-    {999,  684,  942}, {626,  633,  996}, {626,  567,  835}, {739,  571,  973},
-    {655,  769,  707}, {702,  952,  571}, {727,  712,  514}, {744,  686,  741},
-    {731,  552,  714}, {824,  991,  726}, {795,  615,  544}, {870,  575,  824},
-    {803,  832,  923}, {819,  839,  531}, {887,  786,  852}, {933,  764,  570},
-    {716,  906,  654}, {784,  804,  563}, {774,  535,  876}, {807,  598,  649},
-    {817,  759,  718}, {831,  993,  846}, {858,  567,  605}, {876, 1012,  651},
-    {852,  548,  549}, {895, 1008,  871}, {892, 1000,  591}, {935,  516,  836},
-    {931,  612,  776}, {968,  614,  816}, {524,  777,  719}, {549,  694,  786},
-    {882,  754,  534}, {597,  837,  766}, {635,  954,  704}, {803,  550,  798},
-    {699,  654,  798}, {924,  767,  738}, {970,  675,  608}, {632,  706,  684},
-    {858,  767,  563}, {527,  765,  702}, {559,  924, 1003}, {618,  524,  611},
-    {999,  942,  963}, {547,  857,  935}, {734,  926,  569}, {967,  746,  551},
-    {834,  633,  881}, {941,  701,  727}, {945,  564,  636}, {512,  563,  793},
-    {984,  556,  570}, {984,  540,  740}, {527,  764,  874}, {530,  664, 1014},
-    {546,  515,  521}, {554,  934,  672}, {598,  945,  556}, {627,  531,  733},
-    {576, 1020, 1014}, {623,  924,  594}, {678,  909,  603}, {814,  744,  543}
+    { 541, 956,  768}, { 877, 581,  568}, { 675,1574,  635}, {1248,1464,  668},
+    {1246, 839, 1394}, {2560,1386,  991}, { 925, 687,  608}, {2208, 797, 1144},
+    { 535, 832,  799}, { 762, 605, 1154}, { 832,1122, 1003}, {1180, 687, 1176},
+    {1292, 901,  732}, {1656, 689,  896}, {1750,1248,  848}, {2284, 942, 1022},
+    { 824,1472,  643}, { 517, 765,  512}, { 562,1816, 1522}, { 694,1826, 2700},
+    { 704, 524,  672}, {1442, 757, 2232}, { 884, 551, 1266}, {2232,1007, 1692},
+    { 932, 746,  777}, {1132, 822,  926}, {1226, 771,  611}, {2948,1342, 1008},
+    {1302, 594, 1158}, {1602, 636, 1128}, {3408, 910, 1438}, {1996, 614,  575},
+    { 665, 935,  628}, { 631,1192,  829}, { 644, 926, 1052}, { 879, 988, 1226},
+    { 941,2768, 2772}, { 565,1344, 2304}, { 547, 628,  740}, { 639, 532, 1074},
+    { 955,1208,  598}, {1124,1160,  900}, {1206, 899, 1242}, { 746, 533,  624},
+    {1458,1028,  735}, {1706,1102,  692}, {1898,1018, 1004}, {2176, 988,  735},
+    {1578, 782, 1642}, { 897, 516,  754}, {2068, 702, 1656}, {2344, 818, 1526},
+    { 907, 652,  592}, {1056, 652,  642}, {2124,1416,  780}, {2664,1250,  727},
+    {1894, 727, 1108}, {2196, 657,  981}, {4840, 920, 1704}, {4992,1238,  983},
+    {2420, 909, 1094}, {2760, 935, 1032}, {2800, 612,  853}, {3068, 832,  574},
+    { 523,1796,  923}, { 722,1916, 1382}, {1226,1542,  928}, { 758, 757,  584},
+    { 512,1134,  577}, { 615,1276,  698}, { 574,2568, 2356}, { 993,2728, 3512},
+    { 539, 890,  913}, { 694, 928, 1088}, { 805, 600, 1360}, {2160, 951, 3128},
+    { 816, 950,  590}, { 955, 847,  811}, {1094, 883,  556}, {1304, 888,  604},
+    { 863,1170,  855}, {1023, 997, 1032}, { 932,1228, 1280}, { 627, 564,  573},
+    { 876, 900, 1448}, {1030, 857, 1792}, {1294, 953, 1758}, {1612, 854, 1714},
+    {1090,1166,  631}, {1314,1202,  751}, {1480, 905,  795}, {1682,1016,  568},
+    {1494,1178,  983}, { 878, 613,  526}, {1728,1446,  779}, {2136,1348,  774},
+    { 950, 649,  939}, {1180, 703,  899}, {1236, 527, 1158}, {1450, 647,  972},
+    {1282, 647,  707}, {1460, 663,  644}, {1614, 572,  578}, {3516,1222,  821},
+    {2668, 729, 1682}, {3128, 585, 1502}, {3208, 733,  976}, {6800, 871, 1416},
+    {3480, 743, 1408}, {3764, 899, 1170}, {3772, 632,  875}, {4092, 732,  638},
+    {3112, 753, 2620}, {3372, 945, 1890}, {3768, 969, 2288}, {2016, 559,  854},
+    {1736, 729,  787}, {1940, 686,  547}, {2140, 635,  674}, {4480,1272,  828},
+    {3976, 592, 1666}, {4384, 621, 1388}, {4400, 801,  955}, {4656, 522,  646},
+    {4848, 625, 1636}, {4984, 591,  874}, {5352, 535, 1001}, {11216,938, 1184},
+    { 925,3280, 1476}, { 735,1580, 1088}, {1150,1576,  674}, { 655, 783,  528},
+    { 527,2052, 1354}, { 782,1704, 1880}, { 578, 910, 1026}, { 692, 882, 1468},
+    { 586, 683,  715}, { 739, 609,  717}, { 778, 773,  697}, { 922, 785,  813},
+    { 766, 651,  984}, { 978, 596, 1030}, {1070, 757, 1080}, {1324, 687, 1178},
+    {1108,2144,  979}, { 723, 982,  690}, { 936, 956,  527}, {1180,1002,  547},
+    { 517,1306,  825}, { 832,1184,  974}, {1024, 957,  903}, {1262,1090,  906},
+    {1028, 720,  649}, {1192, 679,  694}, {2468,1480,  979}, {2844,1370,  877},
+    {1310, 835,  848}, {1508, 839,  698}, {1742,1030,  769}, {1910, 852,  573},
+    {1280, 859, 1174}, {1584, 863, 1108}, {1686, 708, 1364}, {1942, 768, 1104},
+    { 891, 536,  690}, {1016, 560,  663}, {2172, 870, 1348}, {2404, 999, 1170},
+    {1890, 966,  889}, {2116, 912,  777}, {2296,1020,  714}, {4872,1844,  932},
+    {2392, 778,  929}, {2604, 772,  744}, {2764, 957,  722}, {5832,1532,  984},
+    {2188, 519, 1264}, {2332, 532,  922}, {5064, 995, 2412}, {2708, 571,  874},
+    {2408, 545,  666}, {5016,1084,  875}, {5376, 983, 1196}, {5536, 979,  730},
+    {5344, 634, 1744}, {5688, 706, 1348}, {5912, 977, 1190}, {6072, 905,  763},
+    {6048, 582, 1526}, {11968,1013,1816}, {12864,937, 1900}, {12560,1086, 998},
+    {1998, 684, 1884}, {2504, 633, 1992}, {1252, 567,  835}, {1478, 571,  973},
+    {2620, 769, 1414}, {2808, 952, 1142}, {2908, 712, 1028}, {2976, 686,  741},
+    {1462, 552,  714}, {3296, 991, 1452}, {1590, 615,  544}, {3480,1150,  824},
+    {3212, 832,  923}, {3276, 839,  531}, {3548, 786,  852}, {3732, 764,  570},
+    {5728, 906, 2616}, {6272, 804, 2252}, {3096, 535,  876}, {3228, 598,  649},
+    {6536, 759, 1436}, {6648, 993,  846}, {6864, 567, 1210},{14016,1012, 1302},
+    {3408, 548, 1098}, {7160,1008, 1742}, {7136,1000, 1182}, {7480,1032,  836},
+    {7448, 612, 1552}, {7744, 614,  816}, {8384, 777, 1438}, {8784, 694,  786},
+    { 882,1508, 1068}, { 597, 837,  766}, {1270, 954, 1408}, { 803, 550,  798},
+    {1398,1308,  798}, {1848,1534,  738}, { 970, 675,  608}, {1264, 706,  684},
+    {1716, 767, 1126}, {2108, 765, 1404}, {2236, 924, 1003}, {2472,1048,  611},
+    { 999, 942,  963}, {1094, 857,  935}, {2936, 926, 1138}, {1934, 746,  551},
+    {3336, 633, 1762}, {3764, 701, 1454}, {1890, 564,  636}, {4096,1126,  793},
+    {3936, 556, 1140}, {3936, 540,  740}, {4216, 764,  874}, {8480,1328, 1014},
+    {2184, 515, 1042}, {4432, 934, 1344}, {4784, 945, 1112}, {5016,1062,  733},
+    {9216,1020, 2028}, {9968, 924, 1188}, {5424, 909, 1206}, {6512, 744, 1086}
 };
 
-static const uint8_t gain_exp_tab[256][3] = {
-    {14, 14, 14}, {14, 14, 14}, {14, 13, 14}, {13, 13, 14},
-    {13, 14, 13}, {13, 14, 15}, {13, 13, 13}, {12, 14, 13},
-    {13, 13, 13}, {13, 13, 12}, {13, 12, 13}, {12, 13, 12},
-    {12, 13, 13}, {12, 13, 13}, {12, 12, 13}, {11, 13, 13},
-    {13, 12, 13}, {12, 12, 12}, {13, 12, 12}, {13, 12, 11},
-    {12, 12, 12}, {12, 13, 11}, {12, 12, 11}, {11, 13, 12},
-    {12, 12, 12}, {11, 12, 12}, {11, 12, 12}, {11, 12, 13},
-    {11, 12, 11}, {11, 12, 11}, {11, 13, 12}, {11, 12, 12},
-    {12, 12, 12}, {12, 11, 12}, {12, 12, 11}, {12, 12, 11},
-    {13, 11, 11}, {12, 11, 10}, {11, 11, 11}, {11, 11, 10},
-    {12, 11, 12}, {11, 11, 12}, {11, 12, 11}, {11, 11, 11},
-    {11, 11, 12}, {11, 11, 12}, {11, 12, 12}, {10, 12, 12},
-    {11, 12, 11}, {11, 11, 11}, {10, 12, 11}, {10, 12, 11},
-    {11, 11, 11}, {10, 11, 11}, {10, 11, 12}, {10, 11, 12},
-    {11, 12, 11}, {10, 12, 12}, {10, 13, 12}, {10, 12, 13},
-    {10, 12, 11}, {10, 12, 11}, {10, 12, 12}, {10, 12, 12},
-    {12, 11, 12}, {12, 11, 11}, {11, 11, 12}, {11, 11, 11},
-    {11, 10, 11}, {11, 10, 11}, {12, 10, 10}, {12, 10, 10},
-    {11, 11, 11}, {11, 11, 10}, {11, 11, 10}, {10, 12, 10},
-    {11, 11, 11}, {11, 11, 11}, {10, 11, 11}, {10, 11, 11},
-    {11, 10, 11}, {11, 11, 10}, {11, 10, 10}, {10, 10, 10},
-    {11, 11, 10}, {10, 11, 10}, {10, 11, 10}, {10, 11, 10},
-    {10, 10, 11}, {10, 10, 11}, {10, 11, 11}, {10, 11, 11},
-    {10, 10, 11}, {10, 10, 10}, {10, 10, 11}, { 9, 10, 11},
-    {11, 11, 11}, {10, 11, 11}, {10, 11, 10}, {10, 11, 11},
-    {10, 11, 11}, {10, 11, 11}, {10, 11, 11}, {10, 11, 12},
-    {10, 12, 11}, {10, 12, 11}, {10, 12, 12}, {10, 13, 12},
-    {10, 12, 11}, {10, 12, 11}, {10, 12, 12}, {10, 12, 12},
-    {10, 12, 10}, {10, 12, 11}, {10, 12, 10}, {10, 11, 11},
-    {10, 11, 11}, {10, 11, 11}, { 9, 11, 11}, { 9, 11, 12},
-    {10, 12, 11}, { 9, 12, 11}, { 9, 12, 12}, { 9, 12, 12},
-    { 9, 12, 11}, { 9, 12, 12}, { 9, 12, 12}, { 9, 13, 12},
-    {12, 10, 11}, {11, 10, 10}, {10, 10, 11}, {10, 10, 10},
-    {11,  9, 10}, {11, 10, 10}, {10, 10,  9}, {10, 10,  9},
-    {10, 10, 10}, {10, 10, 10}, {10, 10, 10}, {10, 10, 10},
-    {10, 10, 10}, {10, 10,  9}, { 9, 10,  9}, { 9, 10,  9},
-    {10,  9, 11}, {10, 10, 10}, {10, 10, 10}, { 9, 10, 10},
-    {10,  9, 10}, {10,  9, 10}, { 9, 10, 10}, { 9,  9, 10},
-    { 9, 10, 10}, { 9, 10, 10}, { 9, 10, 11}, { 9, 10, 11},
-    { 9, 10, 10}, { 9, 10, 10}, { 9,  9, 10}, { 9, 10, 10},
-    {10, 11, 10}, {10, 11, 10}, {10, 11, 10}, {10, 11, 10},
-    {10, 10, 10}, {10, 10, 10}, { 9, 11, 10}, { 9, 11, 10},
-    {10, 11, 11}, { 9, 11, 11}, { 9, 11, 11}, { 9, 11, 12},
-    { 9, 11, 11}, { 9, 11, 11}, { 9, 11, 11}, { 9, 11, 12},
-    { 9, 11, 10}, { 9, 11, 11}, { 9, 12, 10}, { 9, 11, 11},
-    { 9, 11, 11}, { 9, 11, 12}, { 9, 12, 11}, { 9, 12, 12},
-    { 9, 12, 11}, { 9, 12, 11}, { 9, 12, 11}, { 9, 12, 12},
-    { 9, 12, 11}, { 9, 13, 12}, { 9, 13, 12}, { 9, 12, 13},
-    {10, 11, 10}, { 9, 11, 10}, { 9, 10, 10}, { 9, 10, 10},
-    { 9, 11, 10}, { 9, 11, 10}, { 9, 11, 10}, { 9, 11, 11},
-    { 9, 10, 10}, { 9, 11, 10}, { 9, 10, 10}, { 9, 10, 11},
-    { 9, 11, 11}, { 9, 11, 11}, { 9, 11, 11}, { 9, 11, 11},
-    { 9, 12, 10}, { 9, 12, 10}, { 9, 11, 11}, { 9, 11, 11},
-    { 9, 12, 11}, { 9, 12, 12}, { 9, 12, 11}, { 9, 13, 12},
-    { 9, 11, 10}, { 9, 12, 11}, { 9, 12, 11}, { 9, 11, 12},
-    { 9, 12, 11}, { 9, 12, 12}, { 8, 12, 11}, { 8, 12, 12},
-    {10,  9,  9}, { 9,  9,  9}, { 9, 10,  9}, { 9,  9,  9},
-    { 9,  9, 10}, { 9,  9, 10}, { 9,  9,  9}, { 8,  9,  9},
-    { 9, 10,  9}, { 8, 10,  9}, { 8, 10, 10}, { 8,  9, 10},
-    { 9,  9,  9}, { 7,  8,  8}, { 8, 10,  9}, { 8,  9,  9},
-    { 9, 11, 10}, { 9, 11, 10}, { 9, 10, 10}, { 8, 10, 11},
-    { 9, 11, 10}, { 9, 11, 11}, { 8, 11, 11}, { 8, 11, 12},
-    { 8, 10,  9}, { 8, 11, 10}, { 8, 11, 10}, { 8, 10, 11},
-    { 8, 12, 11}, { 8, 12, 11}, { 8, 11, 10}, { 8, 11, 10}
+static const uint8_t gain_exp_tab[256] = {
+   15, 15, 15, 15, 15, 16, 14, 15, 14, 14, 14, 14, 14, 14, 14, 14,
+   14, 13, 14, 14, 13, 14, 13, 14, 13, 13, 13, 14, 13, 13, 14, 13,
+   13, 13, 13, 13, 14, 13, 12, 12, 13, 13, 13, 12, 13, 13, 13, 13,
+   13, 12, 13, 13, 12, 12, 13, 13, 13, 13, 14, 14, 13, 13, 13, 13,
+   13, 13, 13, 12, 12, 12, 13, 13, 12, 12, 12, 13, 12, 12, 12, 12,
+   12, 12, 12, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 11, 12, 12,
+   12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 14, 13, 13, 13, 13,
+   13, 13, 13, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 14,
+   13, 12, 12, 11, 12, 12, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+   12, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 11, 11, 11, 11,
+   12, 12, 12, 12, 11, 11, 12, 12, 12, 12, 12, 13, 12, 12, 12, 13,
+   12, 12, 13, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14,
+   12, 12, 11, 11, 12, 12, 12, 12, 11, 12, 11, 12, 12, 12, 12, 12,
+   13, 13, 12, 12, 13, 13, 13, 14, 12, 13, 13, 13, 13, 13, 13, 13,
+   11, 10, 11, 10, 11, 11, 10, 10, 11, 11, 11, 11, 10,  9, 11, 10,
+   12, 12, 11, 12, 12, 12, 12, 13, 11, 12, 12, 12, 13, 13, 12, 12
 };
 
 static const int8_t cb1_vects[128][40]={