text: /* Copyright 2019 Google LLC
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     https://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  #include "dsp/fast_fun.h"
  
  /* These table values match the values computed by fast_fun_compute_tables.c.
   * Printed tables can be regenerated by running the unit test as
   *
   * fast_fun_test --print_tables
   */
  const float kFastFunLog2Table[256] = {
      0.0028122745, 0.00842590258, 0.0140177719, 0.0195880495, 0.0251369048,
      0.0306644998, 0.0361709967,  0.0416565537, 0.0471213348, 0.0525654927,
      0.0579891838, 0.0633925647,  0.068775773,  0.0741389766, 0.079482317,
      0.0848059431, 0.090109989,   0.0953946114, 0.100659944,  0.105906129,
      0.111133315,  0.116341621,   0.121531196,  0.12670216,   0.131854668,
      0.136988834,  0.142104805,   0.147202685,  0.152282611,  0.157344729,
      0.162389129,  0.167415962,   0.172425345,  0.177417383,  0.18239221,
      0.187349945,  0.192290708,   0.197214603,  0.20212175,   0.207012251,
      0.211886242,  0.216743827,   0.221585095,  0.22641018,   0.231219187,
      0.236012205,  0.240789369,   0.245550752,  0.250296474,  0.255026639,
      0.259741336,  0.264440686,   0.269124776,  0.273793727,  0.278447598,
      0.283086509,  0.287710547,   0.292319804,  0.296914369,  0.30149439,
      0.306059897,  0.31061098,    0.315147787,  0.319670349,  0.324178785,
      0.328673184,  0.333153605,   0.337620169,  0.342072964,  0.34651202,
      0.350937486,  0.355349422,   0.359747887,  0.364133,     0.368504822,
      0.372863412,  0.377208889,   0.381541342,  0.385860801,  0.390167356,
      0.394461095,  0.39874211,    0.403010458,  0.4072662,    0.411509424,
      0.415740222,  0.419958651,   0.424164772,  0.428358644,  0.432540387,
      0.43671003,   0.440867662,   0.445013374,  0.449147165,  0.453269154,
      0.457379431,  0.461477995,   0.465564966,  0.469640374,  0.473704308,
      0.477756858,  0.481798023,   0.485827893,  0.489846557,  0.493854076,
      0.497850448,  0.501835823,   0.505810201,  0.509773672,  0.513726234,
      0.517668068,  0.521599114,   0.52551949,   0.529429257,  0.533328414,
      0.537217081,  0.541095316,   0.544963121,  0.548820615,  0.552667797,
      0.556504786,  0.560331583,   0.564148247,  0.567954838,  0.571751416,
      0.57553798,   0.579314709,   0.583081543,  0.586838543,  0.590585828,
      0.594323397,  0.59805131,    0.601769567,  0.605478346,  0.60917753,
      0.612867296,  0.616547644,   0.620218635,  0.623880327,  0.627532721,
      0.631175935,  0.634809911,   0.638434768,  0.642050564,  0.645657301,
      0.649255037,  0.652843833,   0.656423748,  0.659994781,  0.663556993,
      0.667110443,  0.670655191,   0.674191177,  0.67771858,   0.68123734,
      0.684747577,  0.68824923,    0.69174248,   0.695227265,  0.698703647,
      0.702171624,  0.705631375,   0.709082782,  0.712525964,  0.715960979,
      0.719387829,  0.722806513,   0.726217151,  0.729619741,  0.733014345,
      0.736400962,  0.739779651,   0.743150413,  0.746513367,  0.749868453,
      0.75321579,   0.756555378,   0.759887218,  0.763211429,  0.766527951,
      0.769836903,  0.773138285,   0.776432097,  0.779718399,  0.782997251,
      0.786268711,  0.789532721,   0.7927894,    0.796038687,  0.799280703,
      0.802515447,  0.805742979,   0.808963299,  0.812176406,  0.815382421,
      0.818581283,  0.821773112,   0.824957848,  0.82813561,   0.831306398,
      0.834470212,  0.837627053,   0.84077704,   0.843920171,  0.847056508,
      0.85018599,   0.853308737,   0.856424689,  0.859533966,  0.862636507,
      0.865732431,  0.86882174,    0.871904433,  0.874980509,  0.878050089,
      0.881113172,  0.884169698,   0.887219787,  0.890263498,  0.893300712,
      0.896331608,  0.899356127,   0.902374327,  0.905386209,  0.908391833,
      0.911391199,  0.914384365,   0.917371333,  0.920352101,  0.923326731,
      0.926295221,  0.929257631,   0.932214022,  0.935164273,  0.938108563,
      0.941046834,  0.943979144,   0.946905553,  0.949826002,  0.95274049,
      0.955649197,  0.958552003,   0.961448967,  0.96434015,   0.967225552,
      0.970105171,  0.972979069,   0.975847244,  0.978709757,  0.981566548,
      0.984417737,  0.987263322,   0.990103245,  0.992937624,  0.995766461,
      0.998589754};
  
  const int32_t kFastFunExp2Table[256] = {
      0,       22744,   45549,   68417,   91346,   114337,  137391,  160508,
      183687,  206928,  230233,  253601,  277033,  300528,  324086,  347709,
      371395,  395146,  418961,  442841,  466786,  490795,  514870,  539009,
      563215,  587485,  611822,  636225,  660693,  685229,  709830,  734499,
      759234,  784036,  808906,  833843,  858847,  883920,  909060,  934269,
      959546,  984891,  1010305, 1035788, 1061340, 1086962, 1112653, 1138413,
      1164244, 1190144, 1216115, 1242156, 1268267, 1294450, 1320703, 1347028,
      1373424, 1399891, 1426431, 1453042, 1479725, 1506481, 1533309, 1560210,
      1587184, 1614231, 1641352, 1668546, 1695814, 1723155, 1750571, 1778061,
      1805626, 1833265, 1860979, 1888769, 1916634, 1944574, 1972590, 2000682,
      2028850, 2057095, 2085416, 2113814, 2142289, 2170841, 2199471, 2228178,
      2256963, 2285826, 2314768, 2343787, 2372886, 2402063, 2431320, 2460655,
      2490071, 2519566, 2549141, 2578796, 2608532, 2638348, 2668245, 2698223,
      2728283, 2758424, 2788646, 2818951, 2849338, 2879807, 2910359, 2940993,
      2971711, 3002512, 3033396, 3064365, 3095417, 3126553, 3157774, 3189079,
      3220470, 3251945, 3283506, 3315152, 3346884, 3378702, 3410607, 3442598,
      3474675, 3506840, 3539092, 3571431, 3603858, 3636373, 3668976, 3701667,
      3734447, 3767316, 3800274, 3833322, 3866459, 3899686, 3933003, 3966410,
      3999908, 4033496, 4067176, 4100947, 4134810, 4168764, 4202811, 4236950,
      4271181, 4305505, 4339922, 4374433, 4409037, 4443735, 4478527, 4513413,
      4548394, 4583470, 4618641, 4653907, 4689269, 4724727, 4760281, 4795931,
      4831678, 4867522, 4903463, 4939501, 4975637, 5011871, 5048204, 5084635,
      5121164, 5157793, 5194521, 5231349, 5268276, 5305304, 5342432, 5379660,
      5416990, 5454421, 5491953, 5529587, 5567323, 5605161, 5643102, 5681146,
      5719293, 5757543, 5795898, 5834356, 5872918, 5911585, 5950357, 5989234,
      6028216, 6067304, 6106498, 6145798, 6185205, 6224718, 6264339, 6304067,
      6343903, 6383847, 6423899, 6464060, 6504330, 6544709, 6585197, 6625795,
      6666503, 6707322, 6748251, 6789291, 6830443, 6871706, 6913081, 6954568,
      6996167, 7037880, 7079705, 7121644, 7163696, 7205863, 7248144, 7290539,
      7333050, 7375676, 7418417, 7461274, 7504247, 7547337, 7590544, 7633868,
      7677309, 7720868, 7764546, 7808341, 7852256, 7896289, 7940442, 7984715,
      8029107, 8073620, 8118254, 8163008, 8207884, 8252882, 8298002, 8343244};
  