Code cleanup: removes cdf_table.c and all code that depended on it.
authorJean-Marc Valin <jmvalin@jmvalin.ca>
Tue, 2 Apr 2013 20:42:27 +0000 (16:42 -0400)
committerJean-Marc Valin <jmvalin@jmvalin.ca>
Tue, 2 Apr 2013 20:42:27 +0000 (16:42 -0400)
src/cdf_table.c [deleted file]
src/pvq_decoder.c
src/pvq_encoder.c
src/tests/test_coef_coder.c
unix/Makefile

diff --git a/src/cdf_table.c b/src/cdf_table.c
deleted file mode 100644 (file)
index 4b3d234..0000000
+++ /dev/null
@@ -1,268 +0,0 @@
-/* This file is auto-generated using "gen_cdf 128 4" */
-
-#include "pvq_code.h"
-
-const ogg_uint16_t cdf_table[129][16] = {
-  {32753,32754,32755,32756,32757,32758,32759,32760,32761,32762,32763,32764,32765,32766,32767,32768},
-  {30715,32747,32755,32756,32757,32758,32759,32760,32761,32762,32763,32764,32765,32766,32767,32768},
-  {28722,32695,32755,32756,32757,32758,32759,32760,32761,32762,32763,32764,32765,32766,32767,32768},
-  {26814,32561,32750,32756,32757,32758,32759,32760,32761,32762,32763,32764,32765,32766,32767,32768},
-  {25022,32326,32733,32756,32757,32758,32759,32760,32761,32762,32763,32764,32765,32766,32767,32768},
-  {23360,31985,32694,32752,32757,32758,32759,32760,32761,32762,32763,32764,32765,32766,32767,32768},
-  {21836,31545,32624,32744,32757,32758,32759,32760,32761,32762,32763,32764,32765,32766,32767,32768},
-  {20446,31020,32513,32724,32754,32758,32759,32760,32761,32762,32763,32764,32765,32766,32767,32768},
-  {19186,30430,32359,32690,32747,32757,32759,32760,32761,32762,32763,32764,32765,32766,32767,32768},
-  {18045,29793,32162,32640,32736,32755,32759,32760,32761,32762,32763,32764,32765,32766,32767,32768},
-  {17012,29123,31921,32567,32716,32750,32758,32760,32761,32762,32763,32764,32765,32766,32767,32768},
-  {16075,28434,31639,32470,32686,32742,32756,32760,32761,32762,32763,32764,32765,32766,32767,32768},
-  {15225,27739,31323,32350,32644,32728,32752,32759,32761,32762,32763,32764,32765,32766,32767,32768},
-  {14452,27045,30977,32205,32588,32708,32745,32757,32761,32762,32763,32764,32765,32766,32767,32768},
-  {13748,26360,30607,32037,32519,32681,32736,32754,32760,32762,32763,32764,32765,32766,32767,32768},
-  {13103,25686,30216,31847,32434,32645,32721,32748,32758,32762,32763,32764,32765,32766,32767,32768},
-  {12512,25028,29809,31635,32333,32599,32701,32740,32755,32761,32763,32764,32765,32766,32767,32768},
-  {11973,24391,29393,31407,32218,32545,32677,32730,32751,32760,32763,32764,32765,32766,32767,32768},
-  {11473,23774,28969,31163,32090,32481,32646,32716,32745,32757,32762,32764,32765,32766,32767,32768},
-  {11011,23176,28539,30903,31945,32405,32608,32697,32736,32753,32761,32764,32765,32766,32767,32768},
-  {10583,22599,28107,30632,31789,32319,32562,32673,32724,32747,32758,32763,32765,32766,32767,32768},
-  {10186,22041,27672,30347,31617,32220,32507,32643,32708,32739,32754,32761,32764,32766,32767,32768},
-  { 9816,21509,27245,30059,31440,32117,32449,32612,32692,32731,32750,32759,32764,32766,32767,32768},
-  { 9472,20993,26816,29759,31247,31999,32379,32571,32668,32717,32742,32755,32761,32764,32766,32768},
-  { 9150,20501,26396,29459,31050,31877,32306,32529,32645,32705,32736,32752,32760,32764,32766,32768},
-  { 8849,20022,25976,29148,30838,31739,32219,32475,32611,32684,32723,32744,32755,32761,32764,32768},
-  { 8566,19567,25567,28840,30625,31599,32130,32420,32578,32664,32711,32737,32751,32759,32763,32768},
-  { 8301,19128,25164,28529,30405,31451,32034,32359,32540,32641,32697,32728,32746,32756,32761,32768},
-  { 8051,18704,24766,28215,30177,31294,31929,32290,32496,32613,32680,32718,32740,32752,32759,32768},
-  { 7815,18299,24378,27903,29947,31132,31819,32218,32449,32583,32661,32706,32732,32747,32756,32768},
-  { 7593,17909,23998,27592,29713,30965,31704,32140,32397,32549,32639,32692,32723,32741,32752,32768},
-  { 7383,17532,23624,27280,29474,30791,31581,32055,32340,32511,32614,32676,32713,32735,32748,32768},
-  { 7184,17171,23260,26972,29235,30614,31455,31968,32280,32471,32587,32658,32701,32727,32743,32768},
-  { 6995,16822,22903,26665,28992,30432,31323,31874,32215,32426,32556,32637,32687,32718,32737,32768},
-  { 6815,16488,22556,26362,28750,30248,31187,31776,32146,32378,32523,32614,32671,32707,32730,32768},
-  { 6645,16167,22218,26064,28508,30061,31048,31675,32074,32327,32488,32590,32655,32696,32722,32768},
-  { 6482,15856,21886,25766,28263,29870,30904,31569,31997,32272,32449,32563,32636,32683,32713,32768},
-  { 6328,15552,21559,25470,28016,29674,30753,31456,31914,32212,32406,32532,32614,32668,32703,32768},
-  { 6180,15265,21245,25182,27774,29480,30603,31343,31830,32151,32362,32501,32592,32652,32692,32768},
-  { 6039,14984,20935,24895,27530,29283,30449,31225,31741,32085,32314,32466,32567,32634,32679,32768},
-  { 5905,14714,20634,24613,27287,29084,30292,31104,31650,32017,32263,32429,32540,32615,32665,32768},
-  { 5776,14451,20339,24334,27045,28884,30132,30979,31554,31944,32209,32389,32511,32594,32650,32768},
-  { 5652,14201,20054,24062,26807,28686,29973,30854,31457,31870,32153,32347,32480,32571,32633,32768},
-  { 5534,13957,19775,23793,26569,28486,29810,30725,31357,31793,32095,32303,32447,32546,32615,32768},
-  { 5421,13721,19502,23528,26332,28285,29646,30594,31254,31714,32034,32257,32412,32520,32595,32768},
-  { 5312,13492,19235,23267,26098,28085,29480,30460,31148,31631,31970,32208,32375,32492,32574,32768},
-  { 5207,13269,18973,23008,25863,27883,29312,30323,31038,31544,31902,32155,32334,32461,32551,32768},
-  { 5106,13056,18721,22758,25635,27685,29146,30187,30929,31458,31835,32103,32294,32430,32527,32768},
-  { 5009,12846,18471,22508,25405,27484,28976,30047,30815,31366,31762,32046,32250,32396,32501,32768},
-  { 4916,12647,18232,22267,25182,27288,28809,29908,30702,31276,31690,31989,32205,32361,32474,32768},
-  { 4826,12451,17995,22026,24957,27088,28638,29765,30584,31180,31613,31928,32157,32324,32445,32768},
-  { 4739,12261,17764,21790,24736,26891,28468,29622,30466,31084,31536,31867,32109,32286,32415,32768},
-  { 4656,12077,17539,21559,24518,26696,28299,29479,30347,30986,31456,31802,32057,32245,32383,32768},
-  { 4575,11897,17318,21331,24302,26501,28129,29334,30226,30886,31375,31737,32005,32203,32350,32768},
-  { 4497,11724,17104,21108,24089,26308,27960,29189,30104,30785,31292,31669,31950,32159,32315,32768},
-  { 4421,11554,16892,20887,23877,26114,27788,29041,29979,30681,31206,31599,31893,32113,32278,32768},
-  { 4348,11389,16686,20671,23668,25923,27619,28895,29855,30577,31120,31528,31835,32066,32240,32768},
-  { 4278,11231,16487,20460,23464,25735,27451,28749,29730,30471,31032,31456,31776,32018,32201,32768},
-  { 4209,11076,16291,20252,23261,25547,27283,28602,29604,30365,30943,31382,31715,31968,32160,32768},
-  { 4143,10923,16098,20047,23060,25360,27115,28454,29476,30256,30851,31305,31652,31916,32118,32768},
-  { 4079,10776,15910,19846,22863,25175,26948,28307,29348,30146,30758,31227,31587,31863,32074,32768},
-  { 4017,10632,15726,19648,22667,24991,26780,28158,29219,30035,30664,31148,31521,31808,32029,32768},
-  { 3956,10495,15549,19456,22477,24812,26617,28013,29092,29926,30571,31070,31455,31753,31983,32768},
-  { 3898,10359,15373,19265,22286,24631,26452,27865,28962,29814,30475,30988,31386,31695,31935,32768},
-  { 3841,10227,15202,19079,22100,24455,26290,27720,28834,29702,30379,30906,31317,31637,31887,32768},
-  { 3786,10096,15032,18893,21914,24277,26126,27572,28703,29588,30280,30822,31246,31577,31836,32768},
-  { 3732, 9969,14866,18711,21730,24101,25962,27424,28572,29473,30181,30737,31173,31516,31785,32768},
-  { 3680, 9846,14705,18534,21551,23929,25803,27279,28442,29359,30081,30650,31099,31453,31732,32768},
-  { 3629, 9727,14548,18360,21375,23759,25644,27135,28314,29246,29983,30566,31027,31391,31679,32768},
-  { 3580, 9608,14392,18188,21200,23590,25486,26990,28184,29131,29882,30478,30951,31326,31624,32768},
-  { 3532, 9496,14242,18020,21028,23422,25328,26845,28053,29015,29781,30390,30875,31261,31568,32768},
-  { 3485, 9381,14091,17852,20856,23255,25171,26701,27923,28899,29678,30300,30797,31194,31511,32768},
-  { 3439, 9271,13944,17688,20687,23090,25015,26557,27792,28782,29575,30210,30719,31127,31453,32768},
-  { 3395, 9166,13803,17529,20523,22929,24862,26415,27663,28666,29472,30120,30640,31058,31394,32768},
-  { 3352, 9061,13662,17370,20359,22767,24708,26272,27533,28549,29368,30028,30560,30989,31334,32768},
-  { 3309, 8958,13524,17214,20197,22608,24556,26131,27404,28433,29264,29936,30479,30918,31273,32768},
-  { 3268, 8859,13390,17063,20040,22452,24407,25992,27276,28317,29161,29845,30399,30848,31212,32768},
-  { 3228, 8761,13258,16913,19883,22297,24259,25853,27148,28201,29057,29752,30317,30776,31149,32768},
-  { 3189, 8668,13131,16767,19730,22144,24111,25714,27020,28084,28951,29658,30234,30703,31085,32768},
-  { 3151, 8572,13001,16619,19575,21990,23963,25575,26892,27968,28847,29565,30151,30630,31021,32768},
-  { 3113, 8479,12875,16475,19424,21839,23817,25437,26764,27851,28741,29470,30067,30556,30956,32768},
-  { 3077, 8392,12755,16337,19278,21693,23675,25303,26639,27736,28637,29377,29984,30482,30891,32768},
-  { 3041, 8303,12634,16198,19131,21545,23532,25167,26513,27620,28531,29281,29898,30406,30824,32768},
-  { 3007, 8219,12517,16063,18988,21401,23391,25033,26387,27504,28426,29186,29813,30330,30757,32768},
-  { 2972, 8131,12398,15926,18843,21255,23249,24898,26261,27388,28320,29090,29727,30254,30689,32768},
-  { 2939, 8050,12285,15795,18703,21113,23110,24765,26136,27272,28214,28994,29641,30177,30621,32768},
-  { 2907, 7969,12173,15665,18565,20973,22973,24634,26013,27158,28109,28899,29555,30100,30552,32768},
-  { 2875, 7890,12064,15538,18429,20835,22837,24503,25890,27044,28004,28803,29468,30022,30483,32768},
-  { 2844, 7812,11956,15412,18294,20697,22701,24373,25767,26930,27899,28708,29382,29944,30413,32768},
-  { 2813, 7735,11849,15287,18160,20561,22567,24243,25644,26815,27793,28611,29294,29865,30342,32768},
-  { 2784, 7660,11744,15164,18028,20426,22434,24115,25523,26702,27689,28515,29207,29786,30271,32768},
-  { 2754, 7589,11644,15046,17900,20295,22304,23989,25403,26589,27584,28419,29119,29707,30200,32768},
-  { 2726, 7517,11543,14927,17772,20163,22173,23862,25282,26476,27479,28322,29031,29627,30128,32768},
-  { 2698, 7443,11441,14808,17643,20031,22042,23735,25161,26362,27373,28225,28942,29546,30055,32768},
-  { 2670, 7375,11345,14694,17520,19904,21915,23612,25043,26251,27270,28130,28855,29467,29983,32768},
-  { 2643, 7308,11250,14582,17398,19778,21789,23489,24926,26140,27166,28033,28766,29386,29910,32768},
-  { 2617, 7241,11156,14470,17276,19652,21663,23366,24808,26029,27062,27937,28678,29305,29836,32768},
-  { 2591, 7176,11064,14361,17157,19528,21539,23245,24692,25919,26960,27842,28590,29225,29763,32768},
-  { 2566, 7112,10973,14253,17039,19406,21417,23125,24576,25809,26856,27746,28502,29144,29689,32768},
-  { 2541, 7046,10881,14144,16920,19282,21292,23003,24459,25698,26752,27649,28412,29061,29614,32768},
-  { 2517, 6986,10794,14040,16806,19164,21174,22887,24347,25591,26651,27555,28325,28981,29540,32768},
-  { 2493, 6924,10707,13936,16692,19045,21054,22769,24233,25482,26549,27459,28236,28899,29465,32768},
-  { 2469, 6865,10622,13834,16580,18928,20935,22651,24118,25373,26446,27363,28147,28817,29390,32768},
-  { 2446, 6805,10537,13733,16469,18812,20818,22536,24007,25266,26344,27267,28058,28735,29315,32768},
-  { 2424, 6746,10453,13632,16358,18696,20701,22420,23894,25158,26242,27172,27969,28653,29239,32768},
-  { 2402, 6688,10371,13534,16250,18582,20585,22305,23782,25051,26141,27077,27881,28571,29164,32768},
-  { 2380, 6634,10292,13438,16144,18471,20472,22193,23673,24946,26041,26983,27793,28489,29088,32768},
-  { 2358, 6578,10212,13342,16038,18360,20359,22081,23564,24841,25941,26888,27704,28407,29012,32768},
-  { 2337, 6523,10134,13248,15933,18249,20246,21969,23455,24736,25841,26794,27616,28325,28936,32768},
-  { 2317, 6471,10058,13156,15831,18141,20136,21859,23347,24632,25742,26700,27528,28243,28860,32768},
-  { 2297, 6418, 9982,13064,15729,18034,20027,21750,23240,24529,25643,26607,27440,28161,28784,32768},
-  { 2277, 6366, 9907,12973,15628,17927,19918,21642,23134,24426,25545,26514,27353,28079,28708,32768},
-  { 2257, 6315, 9834,12885,15530,17823,19811,21535,23029,24325,25448,26422,27266,27998,28633,32768},
-  { 2238, 6266, 9762,12797,15432,17719,19704,21427,22923,24222,25349,26328,27178,27915,28555,32768},
-  { 2219, 6216, 9690,12710,15335,17616,19599,21322,22820,24122,25253,26236,27091,27834,28480,32768},
-  { 2200, 6167, 9619,12623,15237,17512,19492,21215,22714,24019,25154,26142,27002,27750,28401,32768},
-  { 2182, 6120, 9551,12540,15144,17413,19390,21112,22613,23920,25059,26051,26916,27669,28325,32768},
-  { 2164, 6073, 9483,12457,15051,17314,19288,21010,22512,23822,24965,25962,26831,27589,28251,32768},
-  { 2146, 6026, 9414,12373,14957,17214,19185,20906,22409,23722,24868,25869,26743,27506,28173,32768},
-  { 2129, 5981, 9349,12293,14867,17118,19086,20806,22310,23625,24775,25780,26659,27427,28099,32768},
-  { 2112, 5936, 9283,12213,14777,17021,18985,20704,22209,23526,24679,25688,26571,27344,28021,32768},
-  { 2095, 5892, 9219,12134,14688,16926,18887,20605,22111,23430,24586,25599,26486,27264,27945,32768},
-  { 2078, 5848, 9155,12055,14599,16831,18789,20506,22012,23333,24492,25509,26401,27183,27869,32768},
-  { 2062, 5805, 9092,11978,14512,16737,18691,20407,21914,23237,24399,25419,26315,27102,27793,32768},
-  { 2046, 5763, 9030,11902,14426,16645,18596,20311,21818,23143,24308,25332,26232,27023,27718,32768},
-  { 2030, 5721, 8969,11827,14342,16555,18502,20215,21722,23048,24215,25242,26146,26941,27641,32768},
-  { 2015, 5680, 8908,11752,14257,16463,18406,20118,21626,22954,24124,25154,26062,26861,27565,32768},
-  { 1999, 5639, 8848,11678,14173,16373,18313,20023,21531,22860,24032,25065,25976,26779,27487,32768},
-  { 1984, 5599, 8789,11605,14090,16283,18219,19927,21435,22766,23940,24977,25892,26699,27412,32768}
-};
-
-
-const unsigned char decayE[129] = {
-  1,
-  1,
-  4,
-  8,
-  14,
-  21,
-  28,
-  36,
-  44,
-  52,
-  59,
-  66,
-  73,
-  80,
-  86,
-  92,
-  98,
-  103,
-  108,
-  113,
-  117,
-  122,
-  126,
-  129,
-  133,
-  136,
-  140,
-  143,
-  146,
-  148,
-  151,
-  154,
-  156,
-  158,
-  161,
-  163,
-  165,
-  167,
-  169,
-  170,
-  172,
-  174,
-  175,
-  177,
-  178,
-  180,
-  181,
-  182,
-  184,
-  185,
-  186,
-  187,
-  188,
-  190,
-  191,
-  192,
-  193,
-  194,
-  194,
-  195,
-  196,
-  197,
-  198,
-  199,
-  200,
-  200,
-  201,
-  202,
-  202,
-  203,
-  204,
-  204,
-  205,
-  206,
-  206,
-  207,
-  207,
-  208,
-  209,
-  209,
-  210,
-  210,
-  211,
-  211,
-  212,
-  212,
-  213,
-  213,
-  213,
-  214,
-  214,
-  215,
-  215,
-  216,
-  216,
-  216,
-  217,
-  217,
-  217,
-  218,
-  218,
-  219,
-  219,
-  219,
-  220,
-  220,
-  220,
-  220,
-  221,
-  221,
-  221,
-  222,
-  222,
-  222,
-  223,
-  223,
-  223,
-  223,
-  224,
-  224,
-  224,
-  224,
-  225,
-  225,
-  225,
-  225,
-  225,
-  226,
-  226
-};
index 226a958..bcb4493 100644 (file)
@@ -42,7 +42,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/
 int laplace_decode_special(od_ec_dec *dec,unsigned decay,int max)
 {
   int pos;
-#if 1
   int shift;
   int xs;
   int ms;
@@ -83,52 +82,6 @@ int laplace_decode_special(od_ec_dec *dec,unsigned decay,int max)
   else
     pos = xs;
 
-#else
-  unsigned decay2, decay4, decay8, decay16;
-  unsigned decay_f;
-  decay = OD_MINI(255,decay);
-  /* powers of decay */
-  decay2=decay*decay;
-  decay4=decay2*decay2>>16;
-  decay8=decay4*decay4>>16;
-  decay16=decay8*decay8>>16;
-  decay_f=32768U-OD_MAXI(1,decay16>>1);
-  if(max<0)
-    max=0x7FFFFFFF;
-  pos=0;
-  /* Decoding jumps of 16 with probability decay^16 */
-  while(max>=16&&od_ec_decode_bool_q15(dec,decay_f)){
-    pos+=16;
-    max-=16;
-  }
-#if 0
-  pos += od_ec_dec_bits(dec, 4);
-#else
-  if (max>=8){
-    /* p(x%16>=8) = decay^8/(decay^8+1) */
-    decay_f=OD_MAXI(1,decay8>>2);
-    pos += 8*od_ec_decode_bool(dec,16384,16384+decay_f);
-    if(pos&0x8)max-=8;
-  }
-  if (max>=4){
-    /* p(x%8>=4) = decay^4/(decay^4+1) */
-    decay_f=OD_MAXI(1,decay4>>2);
-    pos += 4*od_ec_decode_bool(dec,16384,16384+decay_f);
-    if(pos&0x4)max-=4;
-  }
-  if (max>=2){
-    /* p(x%4>=2) = decay^2/(decay^2+1) */
-    decay_f=OD_MAXI(1,decay2>>2);
-    pos += 2*od_ec_decode_bool(dec,16384,16384+decay_f);
-    if(pos&0x2)max-=2;
-  }
-  if (max>=1){
-    /* p(x%2>=1) = decay/(decay+1) */
-    decay_f=OD_MAXI(1,decay<<6);
-    pos += od_ec_decode_bool(dec,16384,16384+decay_f);
-  }
-#endif
-#endif
   return pos;
 }
 
@@ -145,7 +98,6 @@ static int laplace_decode(od_ec_dec *dec, int ExQ8, int K)
   int j;
   int shift;
   ogg_uint16_t cdf[16];
-  const ogg_uint16_t *cdf0, *cdf1;
   int sym;
   int lsb=0;
   int decay;
@@ -161,19 +113,11 @@ static int laplace_decode(od_ec_dec *dec, int ExQ8, int K)
   K=(K+(1<<shift>>1))>>shift;
 
   decay = OD_MINI(254,256*ExQ8/(ExQ8+256));
-#if 1
   offset = laplace_offset[(decay+1)>>1];
   for(j=0;j<16;j++)
   {
     cdf[j]=exp_cdf_table[(decay+1)>>1][j]-offset;
   }
-#else
-  /* Interpolate pre-computed icdfs based on Ex */
-  cdf0=cdf_table[ExQ8>>4];
-  cdf1=cdf_table[(ExQ8>>4)+1];
-  for(j=0;j<16;j++)
-    cdf[j]=((ExQ8&0xF)*cdf1[j]+(16-(ExQ8&0xF))*cdf0[j]+8)>>4;
-#endif
 
   /* Simple way of truncating the pdf when we have a bound */
   sym=od_ec_decode_cdf_unscaled(dec,cdf,OD_MINI(K+1,16));
index 8171fe2..865f366 100644 (file)
@@ -41,7 +41,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/
  */
 void laplace_encode_special(od_ec_enc *enc,int x,unsigned decay,int max)
 {
-#if 1
   int shift;
   int xs;
   int ms;
@@ -79,54 +78,6 @@ void laplace_encode_special(od_ec_enc *enc,int x,unsigned decay,int max)
   } while (sym>=15);
   if (shift)
     od_ec_enc_bits(enc, x&((1<<shift)-1), shift);
-#else
-  unsigned decay2, decay4, decay8, decay16;
-  unsigned decay_f;
-  decay = OD_MINI(255,decay);
-  /* powers of decay */
-  decay2=decay*decay;
-  decay4=decay2*decay2>>16;
-  decay8=decay4*decay4>>16;
-  decay16=decay8*decay8>>16;
-  decay_f=32768U-OD_MAXI(1,decay16>>1);
-  if(max<0)
-    max=0x7FFFFFFF;
-  /* Encoding jumps of 16 with probability decay^16 */
-  while(x>15 && max>=16){
-    od_ec_encode_bool_q15(enc,1,decay_f);
-    x-=16;
-    max-=16;
-  }
-  if(max>=16)
-    od_ec_encode_bool_q15(enc,0,decay_f);
-#if 0
-  od_ec_enc_bits(enc, x, 4);
-#else
-  if(max>=8){
-    /* p(x%16>8) = decay^8/(decay^8+1) */
-    decay_f=OD_MAXI(1,decay8>>2);
-    od_ec_encode_bool(enc, (x&0x8)!=0,16384,16384+decay_f);
-    if(x&0x8)max-=8;
-  }
-  if(max>=4){
-    /* p(x%8>4) = decay^4/(decay^4+1) */
-    decay_f=OD_MAXI(1,decay4>>2);
-    od_ec_encode_bool(enc, (x&0x4)!=0,16384,16384+decay_f);
-    if(x&0x4)max-=4;
-  }
-  if(max>=2){
-    /* p(x%4>2) = decay^2/(decay^2+1) */
-    decay_f=OD_MAXI(1,decay2>>2);
-    od_ec_encode_bool(enc, (x&0x2)!=0,16384,16384+decay_f);
-    if (x&0x2)max-=2;
-  }
-  if(max>=1){
-    /* p(x%2>1) = decay/(decay+1) */
-    decay_f=OD_MAXI(1,decay<<6);
-    od_ec_encode_bool(enc, (x&0x1)!=0,16384,16384+decay_f);
-  }
-#endif
-#endif
 }
 
 /** Encodes a Laplace-distributed variable for use in PVQ
@@ -142,7 +93,6 @@ static void laplace_encode(od_ec_enc *enc, int x, int ExQ8, int K)
   int shift;
   int xs;
   ogg_uint16_t cdf[16];
-  const ogg_uint16_t *cdf0, *cdf1;
   int sym;
   int decay;
   int offset;
@@ -158,19 +108,11 @@ static void laplace_encode(od_ec_enc *enc, int x, int ExQ8, int K)
   xs=(x+(1<<shift>>1))>>shift;
 
   decay = OD_MINI(254,256*ExQ8/(ExQ8+256));
-#if 1
     offset = laplace_offset[(decay+1)>>1];
     for(j=0;j<16;j++)
     {
       cdf[j]=exp_cdf_table[(decay+1)>>1][j]-offset;
     }
-#else
-  /* Interpolate pre-computed cdfs based on Ex */
-  cdf0=cdf_table[ExQ8>>4];
-  cdf1=cdf_table[(ExQ8>>4)+1];
-  for(j=0;j<16;j++)
-    cdf[j]=((ExQ8&0xF)*cdf1[j]+(16-(ExQ8&0xF))*cdf0[j]+8)>>4;
-#endif
 
   sym=xs;
   if (sym>15)
index 86feccf..fb6e376 100644 (file)
@@ -26,7 +26,6 @@
 #include "../entenc.c"
 #include "../entdec.c"
 #include "../entcode.c"
-#include "../cdf_table.c"
 #include "../laplace_tables.c"
 #include "../internal.c"
 #include <stdlib.h>
index 04147e0..463892d 100644 (file)
@@ -89,7 +89,6 @@ WORKDIR = objs
 LIBDAALABASE_CSOURCES = \
 adapt.c \
 block_size.c \
-cdf_table.c \
 entcode.c \
 entdec.c \
 entenc.c \