shithub: libvpx

Download patch

ref: e728637b8be3f5d0704a501aed5ac6e44897a584
parent: 7d9288f5f86e1b0a03ae5a555dc034e7055845ca
author: Angie Chiang <angiebird@google.com>
date: Wed Jun 19 10:51:26 EDT 2019

Integerize log2_approximation()

Change-Id: If645bf6a90f4bfb5a51ca0a78b88d1eb5bedbec2

--- a/vp9/encoder/vp9_mcomp.c
+++ b/vp9/encoder/vp9_mcomp.c
@@ -1733,180 +1733,184 @@
 #if CONFIG_NON_GREEDY_MV
 
 #define LOG2_TABLE_SIZE 1024
-static const double log2_table[LOG2_TABLE_SIZE] = {
-  0.000000,  // This is a dummy value
-  0.000000, 1.000000, 1.584963, 2.000000, 2.321928, 2.584963, 2.807355,
-  3.000000, 3.169925, 3.321928, 3.459432, 3.584963, 3.700440, 3.807355,
-  3.906891, 4.000000, 4.087463, 4.169925, 4.247928, 4.321928, 4.392317,
-  4.459432, 4.523562, 4.584963, 4.643856, 4.700440, 4.754888, 4.807355,
-  4.857981, 4.906891, 4.954196, 5.000000, 5.044394, 5.087463, 5.129283,
-  5.169925, 5.209453, 5.247928, 5.285402, 5.321928, 5.357552, 5.392317,
-  5.426265, 5.459432, 5.491853, 5.523562, 5.554589, 5.584963, 5.614710,
-  5.643856, 5.672425, 5.700440, 5.727920, 5.754888, 5.781360, 5.807355,
-  5.832890, 5.857981, 5.882643, 5.906891, 5.930737, 5.954196, 5.977280,
-  6.000000, 6.022368, 6.044394, 6.066089, 6.087463, 6.108524, 6.129283,
-  6.149747, 6.169925, 6.189825, 6.209453, 6.228819, 6.247928, 6.266787,
-  6.285402, 6.303781, 6.321928, 6.339850, 6.357552, 6.375039, 6.392317,
-  6.409391, 6.426265, 6.442943, 6.459432, 6.475733, 6.491853, 6.507795,
-  6.523562, 6.539159, 6.554589, 6.569856, 6.584963, 6.599913, 6.614710,
-  6.629357, 6.643856, 6.658211, 6.672425, 6.686501, 6.700440, 6.714246,
-  6.727920, 6.741467, 6.754888, 6.768184, 6.781360, 6.794416, 6.807355,
-  6.820179, 6.832890, 6.845490, 6.857981, 6.870365, 6.882643, 6.894818,
-  6.906891, 6.918863, 6.930737, 6.942515, 6.954196, 6.965784, 6.977280,
-  6.988685, 7.000000, 7.011227, 7.022368, 7.033423, 7.044394, 7.055282,
-  7.066089, 7.076816, 7.087463, 7.098032, 7.108524, 7.118941, 7.129283,
-  7.139551, 7.149747, 7.159871, 7.169925, 7.179909, 7.189825, 7.199672,
-  7.209453, 7.219169, 7.228819, 7.238405, 7.247928, 7.257388, 7.266787,
-  7.276124, 7.285402, 7.294621, 7.303781, 7.312883, 7.321928, 7.330917,
-  7.339850, 7.348728, 7.357552, 7.366322, 7.375039, 7.383704, 7.392317,
-  7.400879, 7.409391, 7.417853, 7.426265, 7.434628, 7.442943, 7.451211,
-  7.459432, 7.467606, 7.475733, 7.483816, 7.491853, 7.499846, 7.507795,
-  7.515700, 7.523562, 7.531381, 7.539159, 7.546894, 7.554589, 7.562242,
-  7.569856, 7.577429, 7.584963, 7.592457, 7.599913, 7.607330, 7.614710,
-  7.622052, 7.629357, 7.636625, 7.643856, 7.651052, 7.658211, 7.665336,
-  7.672425, 7.679480, 7.686501, 7.693487, 7.700440, 7.707359, 7.714246,
-  7.721099, 7.727920, 7.734710, 7.741467, 7.748193, 7.754888, 7.761551,
-  7.768184, 7.774787, 7.781360, 7.787903, 7.794416, 7.800900, 7.807355,
-  7.813781, 7.820179, 7.826548, 7.832890, 7.839204, 7.845490, 7.851749,
-  7.857981, 7.864186, 7.870365, 7.876517, 7.882643, 7.888743, 7.894818,
-  7.900867, 7.906891, 7.912889, 7.918863, 7.924813, 7.930737, 7.936638,
-  7.942515, 7.948367, 7.954196, 7.960002, 7.965784, 7.971544, 7.977280,
-  7.982994, 7.988685, 7.994353, 8.000000, 8.005625, 8.011227, 8.016808,
-  8.022368, 8.027906, 8.033423, 8.038919, 8.044394, 8.049849, 8.055282,
-  8.060696, 8.066089, 8.071462, 8.076816, 8.082149, 8.087463, 8.092757,
-  8.098032, 8.103288, 8.108524, 8.113742, 8.118941, 8.124121, 8.129283,
-  8.134426, 8.139551, 8.144658, 8.149747, 8.154818, 8.159871, 8.164907,
-  8.169925, 8.174926, 8.179909, 8.184875, 8.189825, 8.194757, 8.199672,
-  8.204571, 8.209453, 8.214319, 8.219169, 8.224002, 8.228819, 8.233620,
-  8.238405, 8.243174, 8.247928, 8.252665, 8.257388, 8.262095, 8.266787,
-  8.271463, 8.276124, 8.280771, 8.285402, 8.290019, 8.294621, 8.299208,
-  8.303781, 8.308339, 8.312883, 8.317413, 8.321928, 8.326429, 8.330917,
-  8.335390, 8.339850, 8.344296, 8.348728, 8.353147, 8.357552, 8.361944,
-  8.366322, 8.370687, 8.375039, 8.379378, 8.383704, 8.388017, 8.392317,
-  8.396605, 8.400879, 8.405141, 8.409391, 8.413628, 8.417853, 8.422065,
-  8.426265, 8.430453, 8.434628, 8.438792, 8.442943, 8.447083, 8.451211,
-  8.455327, 8.459432, 8.463524, 8.467606, 8.471675, 8.475733, 8.479780,
-  8.483816, 8.487840, 8.491853, 8.495855, 8.499846, 8.503826, 8.507795,
-  8.511753, 8.515700, 8.519636, 8.523562, 8.527477, 8.531381, 8.535275,
-  8.539159, 8.543032, 8.546894, 8.550747, 8.554589, 8.558421, 8.562242,
-  8.566054, 8.569856, 8.573647, 8.577429, 8.581201, 8.584963, 8.588715,
-  8.592457, 8.596190, 8.599913, 8.603626, 8.607330, 8.611025, 8.614710,
-  8.618386, 8.622052, 8.625709, 8.629357, 8.632995, 8.636625, 8.640245,
-  8.643856, 8.647458, 8.651052, 8.654636, 8.658211, 8.661778, 8.665336,
-  8.668885, 8.672425, 8.675957, 8.679480, 8.682995, 8.686501, 8.689998,
-  8.693487, 8.696968, 8.700440, 8.703904, 8.707359, 8.710806, 8.714246,
-  8.717676, 8.721099, 8.724514, 8.727920, 8.731319, 8.734710, 8.738092,
-  8.741467, 8.744834, 8.748193, 8.751544, 8.754888, 8.758223, 8.761551,
-  8.764872, 8.768184, 8.771489, 8.774787, 8.778077, 8.781360, 8.784635,
-  8.787903, 8.791163, 8.794416, 8.797662, 8.800900, 8.804131, 8.807355,
-  8.810572, 8.813781, 8.816984, 8.820179, 8.823367, 8.826548, 8.829723,
-  8.832890, 8.836050, 8.839204, 8.842350, 8.845490, 8.848623, 8.851749,
-  8.854868, 8.857981, 8.861087, 8.864186, 8.867279, 8.870365, 8.873444,
-  8.876517, 8.879583, 8.882643, 8.885696, 8.888743, 8.891784, 8.894818,
-  8.897845, 8.900867, 8.903882, 8.906891, 8.909893, 8.912889, 8.915879,
-  8.918863, 8.921841, 8.924813, 8.927778, 8.930737, 8.933691, 8.936638,
-  8.939579, 8.942515, 8.945444, 8.948367, 8.951285, 8.954196, 8.957102,
-  8.960002, 8.962896, 8.965784, 8.968667, 8.971544, 8.974415, 8.977280,
-  8.980140, 8.982994, 8.985842, 8.988685, 8.991522, 8.994353, 8.997179,
-  9.000000, 9.002815, 9.005625, 9.008429, 9.011227, 9.014020, 9.016808,
-  9.019591, 9.022368, 9.025140, 9.027906, 9.030667, 9.033423, 9.036174,
-  9.038919, 9.041659, 9.044394, 9.047124, 9.049849, 9.052568, 9.055282,
-  9.057992, 9.060696, 9.063395, 9.066089, 9.068778, 9.071462, 9.074141,
-  9.076816, 9.079485, 9.082149, 9.084808, 9.087463, 9.090112, 9.092757,
-  9.095397, 9.098032, 9.100662, 9.103288, 9.105909, 9.108524, 9.111136,
-  9.113742, 9.116344, 9.118941, 9.121534, 9.124121, 9.126704, 9.129283,
-  9.131857, 9.134426, 9.136991, 9.139551, 9.142107, 9.144658, 9.147205,
-  9.149747, 9.152285, 9.154818, 9.157347, 9.159871, 9.162391, 9.164907,
-  9.167418, 9.169925, 9.172428, 9.174926, 9.177420, 9.179909, 9.182394,
-  9.184875, 9.187352, 9.189825, 9.192293, 9.194757, 9.197217, 9.199672,
-  9.202124, 9.204571, 9.207014, 9.209453, 9.211888, 9.214319, 9.216746,
-  9.219169, 9.221587, 9.224002, 9.226412, 9.228819, 9.231221, 9.233620,
-  9.236014, 9.238405, 9.240791, 9.243174, 9.245553, 9.247928, 9.250298,
-  9.252665, 9.255029, 9.257388, 9.259743, 9.262095, 9.264443, 9.266787,
-  9.269127, 9.271463, 9.273796, 9.276124, 9.278449, 9.280771, 9.283088,
-  9.285402, 9.287712, 9.290019, 9.292322, 9.294621, 9.296916, 9.299208,
-  9.301496, 9.303781, 9.306062, 9.308339, 9.310613, 9.312883, 9.315150,
-  9.317413, 9.319672, 9.321928, 9.324181, 9.326429, 9.328675, 9.330917,
-  9.333155, 9.335390, 9.337622, 9.339850, 9.342075, 9.344296, 9.346514,
-  9.348728, 9.350939, 9.353147, 9.355351, 9.357552, 9.359750, 9.361944,
-  9.364135, 9.366322, 9.368506, 9.370687, 9.372865, 9.375039, 9.377211,
-  9.379378, 9.381543, 9.383704, 9.385862, 9.388017, 9.390169, 9.392317,
-  9.394463, 9.396605, 9.398744, 9.400879, 9.403012, 9.405141, 9.407268,
-  9.409391, 9.411511, 9.413628, 9.415742, 9.417853, 9.419960, 9.422065,
-  9.424166, 9.426265, 9.428360, 9.430453, 9.432542, 9.434628, 9.436712,
-  9.438792, 9.440869, 9.442943, 9.445015, 9.447083, 9.449149, 9.451211,
-  9.453271, 9.455327, 9.457381, 9.459432, 9.461479, 9.463524, 9.465566,
-  9.467606, 9.469642, 9.471675, 9.473706, 9.475733, 9.477758, 9.479780,
-  9.481799, 9.483816, 9.485829, 9.487840, 9.489848, 9.491853, 9.493855,
-  9.495855, 9.497852, 9.499846, 9.501837, 9.503826, 9.505812, 9.507795,
-  9.509775, 9.511753, 9.513728, 9.515700, 9.517669, 9.519636, 9.521600,
-  9.523562, 9.525521, 9.527477, 9.529431, 9.531381, 9.533330, 9.535275,
-  9.537218, 9.539159, 9.541097, 9.543032, 9.544964, 9.546894, 9.548822,
-  9.550747, 9.552669, 9.554589, 9.556506, 9.558421, 9.560333, 9.562242,
-  9.564149, 9.566054, 9.567956, 9.569856, 9.571753, 9.573647, 9.575539,
-  9.577429, 9.579316, 9.581201, 9.583083, 9.584963, 9.586840, 9.588715,
-  9.590587, 9.592457, 9.594325, 9.596190, 9.598053, 9.599913, 9.601771,
-  9.603626, 9.605480, 9.607330, 9.609179, 9.611025, 9.612868, 9.614710,
-  9.616549, 9.618386, 9.620220, 9.622052, 9.623881, 9.625709, 9.627534,
-  9.629357, 9.631177, 9.632995, 9.634811, 9.636625, 9.638436, 9.640245,
-  9.642052, 9.643856, 9.645658, 9.647458, 9.649256, 9.651052, 9.652845,
-  9.654636, 9.656425, 9.658211, 9.659996, 9.661778, 9.663558, 9.665336,
-  9.667112, 9.668885, 9.670656, 9.672425, 9.674192, 9.675957, 9.677720,
-  9.679480, 9.681238, 9.682995, 9.684749, 9.686501, 9.688250, 9.689998,
-  9.691744, 9.693487, 9.695228, 9.696968, 9.698705, 9.700440, 9.702173,
-  9.703904, 9.705632, 9.707359, 9.709084, 9.710806, 9.712527, 9.714246,
-  9.715962, 9.717676, 9.719389, 9.721099, 9.722808, 9.724514, 9.726218,
-  9.727920, 9.729621, 9.731319, 9.733015, 9.734710, 9.736402, 9.738092,
-  9.739781, 9.741467, 9.743151, 9.744834, 9.746514, 9.748193, 9.749869,
-  9.751544, 9.753217, 9.754888, 9.756556, 9.758223, 9.759888, 9.761551,
-  9.763212, 9.764872, 9.766529, 9.768184, 9.769838, 9.771489, 9.773139,
-  9.774787, 9.776433, 9.778077, 9.779719, 9.781360, 9.782998, 9.784635,
-  9.786270, 9.787903, 9.789534, 9.791163, 9.792790, 9.794416, 9.796040,
-  9.797662, 9.799282, 9.800900, 9.802516, 9.804131, 9.805744, 9.807355,
-  9.808964, 9.810572, 9.812177, 9.813781, 9.815383, 9.816984, 9.818582,
-  9.820179, 9.821774, 9.823367, 9.824959, 9.826548, 9.828136, 9.829723,
-  9.831307, 9.832890, 9.834471, 9.836050, 9.837628, 9.839204, 9.840778,
-  9.842350, 9.843921, 9.845490, 9.847057, 9.848623, 9.850187, 9.851749,
-  9.853310, 9.854868, 9.856426, 9.857981, 9.859535, 9.861087, 9.862637,
-  9.864186, 9.865733, 9.867279, 9.868823, 9.870365, 9.871905, 9.873444,
-  9.874981, 9.876517, 9.878051, 9.879583, 9.881114, 9.882643, 9.884171,
-  9.885696, 9.887221, 9.888743, 9.890264, 9.891784, 9.893302, 9.894818,
-  9.896332, 9.897845, 9.899357, 9.900867, 9.902375, 9.903882, 9.905387,
-  9.906891, 9.908393, 9.909893, 9.911392, 9.912889, 9.914385, 9.915879,
-  9.917372, 9.918863, 9.920353, 9.921841, 9.923327, 9.924813, 9.926296,
-  9.927778, 9.929258, 9.930737, 9.932215, 9.933691, 9.935165, 9.936638,
-  9.938109, 9.939579, 9.941048, 9.942515, 9.943980, 9.945444, 9.946906,
-  9.948367, 9.949827, 9.951285, 9.952741, 9.954196, 9.955650, 9.957102,
-  9.958553, 9.960002, 9.961450, 9.962896, 9.964341, 9.965784, 9.967226,
-  9.968667, 9.970106, 9.971544, 9.972980, 9.974415, 9.975848, 9.977280,
-  9.978710, 9.980140, 9.981567, 9.982994, 9.984418, 9.985842, 9.987264,
-  9.988685, 9.990104, 9.991522, 9.992938, 9.994353, 9.995767, 9.997179,
-  9.998590,
+static const int log2_table[LOG2_TABLE_SIZE] = {
+  0,  // This is a dummy value
+  0,        1048576,  1661954,  2097152,  2434718,  2710530,  2943725,
+  3145728,  3323907,  3483294,  3627477,  3759106,  3880192,  3992301,
+  4096672,  4194304,  4286015,  4372483,  4454275,  4531870,  4605679,
+  4676053,  4743299,  4807682,  4869436,  4928768,  4985861,  5040877,
+  5093962,  5145248,  5194851,  5242880,  5289431,  5334591,  5378443,
+  5421059,  5462508,  5502851,  5542146,  5580446,  5617800,  5654255,
+  5689851,  5724629,  5758625,  5791875,  5824409,  5856258,  5887450,
+  5918012,  5947969,  5977344,  6006160,  6034437,  6062195,  6089453,
+  6116228,  6142538,  6168398,  6193824,  6218829,  6243427,  6267632,
+  6291456,  6314910,  6338007,  6360756,  6383167,  6405252,  6427019,
+  6448477,  6469635,  6490501,  6511084,  6531390,  6551427,  6571202,
+  6590722,  6609993,  6629022,  6647815,  6666376,  6684713,  6702831,
+  6720734,  6738427,  6755916,  6773205,  6790299,  6807201,  6823917,
+  6840451,  6856805,  6872985,  6888993,  6904834,  6920510,  6936026,
+  6951384,  6966588,  6981641,  6996545,  7011304,  7025920,  7040397,
+  7054736,  7068940,  7083013,  7096956,  7110771,  7124461,  7138029,
+  7151476,  7164804,  7178017,  7191114,  7204100,  7216974,  7229740,
+  7242400,  7254954,  7267405,  7279754,  7292003,  7304154,  7316208,
+  7328167,  7340032,  7351805,  7363486,  7375079,  7386583,  7398000,
+  7409332,  7420579,  7431743,  7442826,  7453828,  7464751,  7475595,
+  7486362,  7497053,  7507669,  7518211,  7528680,  7539077,  7549404,
+  7559660,  7569847,  7579966,  7590017,  7600003,  7609923,  7619778,
+  7629569,  7639298,  7648964,  7658569,  7668114,  7677598,  7687023,
+  7696391,  7705700,  7714952,  7724149,  7733289,  7742375,  7751407,
+  7760385,  7769310,  7778182,  7787003,  7795773,  7804492,  7813161,
+  7821781,  7830352,  7838875,  7847350,  7855777,  7864158,  7872493,
+  7880782,  7889027,  7897226,  7905381,  7913492,  7921561,  7929586,
+  7937569,  7945510,  7953410,  7961268,  7969086,  7976864,  7984602,
+  7992301,  7999960,  8007581,  8015164,  8022709,  8030217,  8037687,
+  8045121,  8052519,  8059880,  8067206,  8074496,  8081752,  8088973,
+  8096159,  8103312,  8110431,  8117516,  8124569,  8131589,  8138576,
+  8145532,  8152455,  8159347,  8166208,  8173037,  8179836,  8186605,
+  8193343,  8200052,  8206731,  8213380,  8220001,  8226593,  8233156,
+  8239690,  8246197,  8252676,  8259127,  8265550,  8271947,  8278316,
+  8284659,  8290976,  8297266,  8303530,  8309768,  8315981,  8322168,
+  8328330,  8334467,  8340579,  8346667,  8352730,  8358769,  8364784,
+  8370775,  8376743,  8382687,  8388608,  8394506,  8400381,  8406233,
+  8412062,  8417870,  8423655,  8429418,  8435159,  8440878,  8446576,
+  8452252,  8457908,  8463542,  8469155,  8474748,  8480319,  8485871,
+  8491402,  8496913,  8502404,  8507875,  8513327,  8518759,  8524171,
+  8529564,  8534938,  8540293,  8545629,  8550947,  8556245,  8561525,
+  8566787,  8572031,  8577256,  8582464,  8587653,  8592825,  8597980,
+  8603116,  8608236,  8613338,  8618423,  8623491,  8628542,  8633576,
+  8638593,  8643594,  8648579,  8653547,  8658499,  8663434,  8668354,
+  8673258,  8678145,  8683017,  8687874,  8692715,  8697540,  8702350,
+  8707145,  8711925,  8716690,  8721439,  8726174,  8730894,  8735599,
+  8740290,  8744967,  8749628,  8754276,  8758909,  8763528,  8768134,
+  8772725,  8777302,  8781865,  8786415,  8790951,  8795474,  8799983,
+  8804478,  8808961,  8813430,  8817886,  8822328,  8826758,  8831175,
+  8835579,  8839970,  8844349,  8848715,  8853068,  8857409,  8861737,
+  8866053,  8870357,  8874649,  8878928,  8883195,  8887451,  8891694,
+  8895926,  8900145,  8904353,  8908550,  8912734,  8916908,  8921069,
+  8925220,  8929358,  8933486,  8937603,  8941708,  8945802,  8949885,
+  8953957,  8958018,  8962068,  8966108,  8970137,  8974155,  8978162,
+  8982159,  8986145,  8990121,  8994086,  8998041,  9001986,  9005920,
+  9009844,  9013758,  9017662,  9021556,  9025440,  9029314,  9033178,
+  9037032,  9040877,  9044711,  9048536,  9052352,  9056157,  9059953,
+  9063740,  9067517,  9071285,  9075044,  9078793,  9082533,  9086263,
+  9089985,  9093697,  9097400,  9101095,  9104780,  9108456,  9112123,
+  9115782,  9119431,  9123072,  9126704,  9130328,  9133943,  9137549,
+  9141146,  9144735,  9148316,  9151888,  9155452,  9159007,  9162554,
+  9166092,  9169623,  9173145,  9176659,  9180165,  9183663,  9187152,
+  9190634,  9194108,  9197573,  9201031,  9204481,  9207923,  9211357,
+  9214784,  9218202,  9221613,  9225017,  9228412,  9231800,  9235181,
+  9238554,  9241919,  9245277,  9248628,  9251971,  9255307,  9258635,
+  9261956,  9265270,  9268577,  9271876,  9275169,  9278454,  9281732,
+  9285002,  9288266,  9291523,  9294773,  9298016,  9301252,  9304481,
+  9307703,  9310918,  9314126,  9317328,  9320523,  9323711,  9326892,
+  9330067,  9333235,  9336397,  9339552,  9342700,  9345842,  9348977,
+  9352106,  9355228,  9358344,  9361454,  9364557,  9367654,  9370744,
+  9373828,  9376906,  9379978,  9383043,  9386102,  9389155,  9392202,
+  9395243,  9398278,  9401306,  9404329,  9407345,  9410356,  9413360,
+  9416359,  9419351,  9422338,  9425319,  9428294,  9431263,  9434226,
+  9437184,  9440136,  9443082,  9446022,  9448957,  9451886,  9454809,
+  9457726,  9460638,  9463545,  9466446,  9469341,  9472231,  9475115,
+  9477994,  9480867,  9483735,  9486597,  9489454,  9492306,  9495152,
+  9497993,  9500828,  9503659,  9506484,  9509303,  9512118,  9514927,
+  9517731,  9520530,  9523324,  9526112,  9528895,  9531674,  9534447,
+  9537215,  9539978,  9542736,  9545489,  9548237,  9550980,  9553718,
+  9556451,  9559179,  9561903,  9564621,  9567335,  9570043,  9572747,
+  9575446,  9578140,  9580830,  9583514,  9586194,  9588869,  9591540,
+  9594205,  9596866,  9599523,  9602174,  9604821,  9607464,  9610101,
+  9612735,  9615363,  9617987,  9620607,  9623222,  9625832,  9628438,
+  9631040,  9633637,  9636229,  9638818,  9641401,  9643981,  9646556,
+  9649126,  9651692,  9654254,  9656812,  9659365,  9661914,  9664459,
+  9666999,  9669535,  9672067,  9674594,  9677118,  9679637,  9682152,
+  9684663,  9687169,  9689672,  9692170,  9694665,  9697155,  9699641,
+  9702123,  9704601,  9707075,  9709545,  9712010,  9714472,  9716930,
+  9719384,  9721834,  9724279,  9726721,  9729159,  9731593,  9734024,
+  9736450,  9738872,  9741291,  9743705,  9746116,  9748523,  9750926,
+  9753326,  9755721,  9758113,  9760501,  9762885,  9765266,  9767642,
+  9770015,  9772385,  9774750,  9777112,  9779470,  9781825,  9784175,
+  9786523,  9788866,  9791206,  9793543,  9795875,  9798204,  9800530,
+  9802852,  9805170,  9807485,  9809797,  9812104,  9814409,  9816710,
+  9819007,  9821301,  9823591,  9825878,  9828161,  9830441,  9832718,
+  9834991,  9837261,  9839527,  9841790,  9844050,  9846306,  9848559,
+  9850808,  9853054,  9855297,  9857537,  9859773,  9862006,  9864235,
+  9866462,  9868685,  9870904,  9873121,  9875334,  9877544,  9879751,
+  9881955,  9884155,  9886352,  9888546,  9890737,  9892925,  9895109,
+  9897291,  9899469,  9901644,  9903816,  9905985,  9908150,  9910313,
+  9912473,  9914629,  9916783,  9918933,  9921080,  9923225,  9925366,
+  9927504,  9929639,  9931771,  9933900,  9936027,  9938150,  9940270,
+  9942387,  9944502,  9946613,  9948721,  9950827,  9952929,  9955029,
+  9957126,  9959219,  9961310,  9963398,  9965484,  9967566,  9969645,
+  9971722,  9973796,  9975866,  9977934,  9980000,  9982062,  9984122,
+  9986179,  9988233,  9990284,  9992332,  9994378,  9996421,  9998461,
+  10000498, 10002533, 10004565, 10006594, 10008621, 10010644, 10012665,
+  10014684, 10016700, 10018713, 10020723, 10022731, 10024736, 10026738,
+  10028738, 10030735, 10032729, 10034721, 10036710, 10038697, 10040681,
+  10042662, 10044641, 10046617, 10048591, 10050562, 10052530, 10054496,
+  10056459, 10058420, 10060379, 10062334, 10064287, 10066238, 10068186,
+  10070132, 10072075, 10074016, 10075954, 10077890, 10079823, 10081754,
+  10083682, 10085608, 10087532, 10089453, 10091371, 10093287, 10095201,
+  10097112, 10099021, 10100928, 10102832, 10104733, 10106633, 10108529,
+  10110424, 10112316, 10114206, 10116093, 10117978, 10119861, 10121742,
+  10123620, 10125495, 10127369, 10129240, 10131109, 10132975, 10134839,
+  10136701, 10138561, 10140418, 10142273, 10144126, 10145976, 10147825,
+  10149671, 10151514, 10153356, 10155195, 10157032, 10158867, 10160699,
+  10162530, 10164358, 10166184, 10168007, 10169829, 10171648, 10173465,
+  10175280, 10177093, 10178904, 10180712, 10182519, 10184323, 10186125,
+  10187925, 10189722, 10191518, 10193311, 10195103, 10196892, 10198679,
+  10200464, 10202247, 10204028, 10205806, 10207583, 10209357, 10211130,
+  10212900, 10214668, 10216435, 10218199, 10219961, 10221721, 10223479,
+  10225235, 10226989, 10228741, 10230491, 10232239, 10233985, 10235728,
+  10237470, 10239210, 10240948, 10242684, 10244417, 10246149, 10247879,
+  10249607, 10251333, 10253057, 10254779, 10256499, 10258217, 10259933,
+  10261647, 10263360, 10265070, 10266778, 10268485, 10270189, 10271892,
+  10273593, 10275292, 10276988, 10278683, 10280376, 10282068, 10283757,
+  10285444, 10287130, 10288814, 10290495, 10292175, 10293853, 10295530,
+  10297204, 10298876, 10300547, 10302216, 10303883, 10305548, 10307211,
+  10308873, 10310532, 10312190, 10313846, 10315501, 10317153, 10318804,
+  10320452, 10322099, 10323745, 10325388, 10327030, 10328670, 10330308,
+  10331944, 10333578, 10335211, 10336842, 10338472, 10340099, 10341725,
+  10343349, 10344971, 10346592, 10348210, 10349828, 10351443, 10353057,
+  10354668, 10356279, 10357887, 10359494, 10361099, 10362702, 10364304,
+  10365904, 10367502, 10369099, 10370694, 10372287, 10373879, 10375468,
+  10377057, 10378643, 10380228, 10381811, 10383393, 10384973, 10386551,
+  10388128, 10389703, 10391276, 10392848, 10394418, 10395986, 10397553,
+  10399118, 10400682, 10402244, 10403804, 10405363, 10406920, 10408476,
+  10410030, 10411582, 10413133, 10414682, 10416230, 10417776, 10419320,
+  10420863, 10422404, 10423944, 10425482, 10427019, 10428554, 10430087,
+  10431619, 10433149, 10434678, 10436206, 10437731, 10439256, 10440778,
+  10442299, 10443819, 10445337, 10446854, 10448369, 10449882, 10451394,
+  10452905, 10454414, 10455921, 10457427, 10458932, 10460435, 10461936,
+  10463436, 10464935, 10466432, 10467927, 10469422, 10470914, 10472405,
+  10473895, 10475383, 10476870, 10478355, 10479839, 10481322, 10482802,
+  10484282,
 };
 
-static double log2_approximation(int v) {
+#define LOG2_PRECISION 20
+static int64_t log2_approximation(int64_t v) {
   assert(v > 0);
   if (v < LOG2_TABLE_SIZE) {
     return log2_table[v];
   } else {
     // use linear approximation when v >= 2^10
-    const double slope = 0.001409;  // slope = 1 / (log(2) * 1024)
+    const int slope =
+        1477;  // slope = 1 / (log(2) * 1024) * (1 << LOG2_PRECISION)
     assert(LOG2_TABLE_SIZE == 1 << 10);
-    return slope * (v - LOG2_TABLE_SIZE) + 10;
+
+    return slope * (v - LOG2_TABLE_SIZE) + (10 << LOG2_PRECISION);
   }
 }
+
 double vp9_nb_mvs_inconsistency(const MV *mv, const int_mv *nb_mvs,
                                 int mv_num) {
   int i;
   int update = 0;
-  double best_cost = 0;
+  int64_t best_cost = 0;
   vpx_clear_system_state();
   for (i = 0; i < mv_num; ++i) {
     if (nb_mvs[i].as_int != INVALID_MV) {
       MV nb_mv = nb_mvs[i].as_mv;
-      const int row_diff = abs(mv->row - nb_mv.row);
-      const int col_diff = abs(mv->col - nb_mv.col);
-      double cost =
+      const int64_t row_diff = abs(mv->row - nb_mv.row);
+      const int64_t col_diff = abs(mv->col - nb_mv.col);
+      const int64_t cost =
           log2_approximation(1 + row_diff * row_diff + col_diff * col_diff);
       if (update == 0) {
         best_cost = cost;
@@ -1916,7 +1920,7 @@
       }
     }
   }
-  return best_cost;
+  return best_cost * 1. / (1 << LOG2_PRECISION);
 }
 
 static double exhaustive_mesh_search_new(const MACROBLOCK *x, MV *best_mv,