1 /*M/////////////////////////////////////////////////////////////////////////////////////// 2 // 3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 // 5 // By downloading, copying, installing or using the software you agree to this license. 6 // If you do not agree to this license, do not download, install, 7 // copy or use the software. 8 // 9 // 10 // License Agreement 11 // For Open Source Computer Vision Library 12 // 13 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 // Third party copyrights are property of their respective owners. 16 // 17 // Redistribution and use in source and binary forms, with or without modification, 18 // are permitted provided that the following conditions are met: 19 // 20 // * Redistribution's of source code must retain the above copyright notice, 21 // this list of conditions and the following disclaimer. 22 // 23 // * Redistribution's in binary form must reproduce the above copyright notice, 24 // this list of conditions and the following disclaimer in the documentation 25 // and/or other materials provided with the distribution. 26 // 27 // * The name of the copyright holders may not be used to endorse or promote products 28 // derived from this software without specific prior written permission. 29 // 30 // This software is provided by the copyright holders and contributors "as is" and 31 // any express or implied warranties, including, but not limited to, the implied 32 // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 // In no event shall the Intel Corporation or contributors be liable for any direct, 34 // indirect, incidental, special, exemplary, or consequential damages 35 // (including, but not limited to, procurement of substitute goods or services; 36 // loss of use, data, or profits; or business interruption) however caused 37 // and on any theory of liability, whether in contract, strict liability, 38 // or tort (including negligence or otherwise) arising in any way out of 39 // the use of this software, even if advised of the possibility of such damage. 40 // 41 //M*/ 42 43 /* //////////////////////////////////////////////////////////////////// 44 // 45 // CvMat helper tables 46 // 47 // */ 48 49 #include "precomp.hpp" 50 51 namespace cv 52 { 53 54 const float g_8x32fTab[] = 55 { 56 -128.f, -127.f, -126.f, -125.f, -124.f, -123.f, -122.f, -121.f, 57 -120.f, -119.f, -118.f, -117.f, -116.f, -115.f, -114.f, -113.f, 58 -112.f, -111.f, -110.f, -109.f, -108.f, -107.f, -106.f, -105.f, 59 -104.f, -103.f, -102.f, -101.f, -100.f, -99.f, -98.f, -97.f, 60 -96.f, -95.f, -94.f, -93.f, -92.f, -91.f, -90.f, -89.f, 61 -88.f, -87.f, -86.f, -85.f, -84.f, -83.f, -82.f, -81.f, 62 -80.f, -79.f, -78.f, -77.f, -76.f, -75.f, -74.f, -73.f, 63 -72.f, -71.f, -70.f, -69.f, -68.f, -67.f, -66.f, -65.f, 64 -64.f, -63.f, -62.f, -61.f, -60.f, -59.f, -58.f, -57.f, 65 -56.f, -55.f, -54.f, -53.f, -52.f, -51.f, -50.f, -49.f, 66 -48.f, -47.f, -46.f, -45.f, -44.f, -43.f, -42.f, -41.f, 67 -40.f, -39.f, -38.f, -37.f, -36.f, -35.f, -34.f, -33.f, 68 -32.f, -31.f, -30.f, -29.f, -28.f, -27.f, -26.f, -25.f, 69 -24.f, -23.f, -22.f, -21.f, -20.f, -19.f, -18.f, -17.f, 70 -16.f, -15.f, -14.f, -13.f, -12.f, -11.f, -10.f, -9.f, 71 -8.f, -7.f, -6.f, -5.f, -4.f, -3.f, -2.f, -1.f, 72 0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 73 8.f, 9.f, 10.f, 11.f, 12.f, 13.f, 14.f, 15.f, 74 16.f, 17.f, 18.f, 19.f, 20.f, 21.f, 22.f, 23.f, 75 24.f, 25.f, 26.f, 27.f, 28.f, 29.f, 30.f, 31.f, 76 32.f, 33.f, 34.f, 35.f, 36.f, 37.f, 38.f, 39.f, 77 40.f, 41.f, 42.f, 43.f, 44.f, 45.f, 46.f, 47.f, 78 48.f, 49.f, 50.f, 51.f, 52.f, 53.f, 54.f, 55.f, 79 56.f, 57.f, 58.f, 59.f, 60.f, 61.f, 62.f, 63.f, 80 64.f, 65.f, 66.f, 67.f, 68.f, 69.f, 70.f, 71.f, 81 72.f, 73.f, 74.f, 75.f, 76.f, 77.f, 78.f, 79.f, 82 80.f, 81.f, 82.f, 83.f, 84.f, 85.f, 86.f, 87.f, 83 88.f, 89.f, 90.f, 91.f, 92.f, 93.f, 94.f, 95.f, 84 96.f, 97.f, 98.f, 99.f, 100.f, 101.f, 102.f, 103.f, 85 104.f, 105.f, 106.f, 107.f, 108.f, 109.f, 110.f, 111.f, 86 112.f, 113.f, 114.f, 115.f, 116.f, 117.f, 118.f, 119.f, 87 120.f, 121.f, 122.f, 123.f, 124.f, 125.f, 126.f, 127.f, 88 128.f, 129.f, 130.f, 131.f, 132.f, 133.f, 134.f, 135.f, 89 136.f, 137.f, 138.f, 139.f, 140.f, 141.f, 142.f, 143.f, 90 144.f, 145.f, 146.f, 147.f, 148.f, 149.f, 150.f, 151.f, 91 152.f, 153.f, 154.f, 155.f, 156.f, 157.f, 158.f, 159.f, 92 160.f, 161.f, 162.f, 163.f, 164.f, 165.f, 166.f, 167.f, 93 168.f, 169.f, 170.f, 171.f, 172.f, 173.f, 174.f, 175.f, 94 176.f, 177.f, 178.f, 179.f, 180.f, 181.f, 182.f, 183.f, 95 184.f, 185.f, 186.f, 187.f, 188.f, 189.f, 190.f, 191.f, 96 192.f, 193.f, 194.f, 195.f, 196.f, 197.f, 198.f, 199.f, 97 200.f, 201.f, 202.f, 203.f, 204.f, 205.f, 206.f, 207.f, 98 208.f, 209.f, 210.f, 211.f, 212.f, 213.f, 214.f, 215.f, 99 216.f, 217.f, 218.f, 219.f, 220.f, 221.f, 222.f, 223.f, 100 224.f, 225.f, 226.f, 227.f, 228.f, 229.f, 230.f, 231.f, 101 232.f, 233.f, 234.f, 235.f, 236.f, 237.f, 238.f, 239.f, 102 240.f, 241.f, 242.f, 243.f, 244.f, 245.f, 246.f, 247.f, 103 248.f, 249.f, 250.f, 251.f, 252.f, 253.f, 254.f, 255.f 104 }; 105 106 /* [-255..255].^2 */ 107 const ushort g_8x16uSqrTab[] = 108 { 109 65025, 64516, 64009, 63504, 63001, 62500, 62001, 61504, 61009, 60516, 60025, 59536, 110 59049, 58564, 58081, 57600, 57121, 56644, 56169, 55696, 55225, 54756, 54289, 53824, 111 53361, 52900, 52441, 51984, 51529, 51076, 50625, 50176, 49729, 49284, 48841, 48400, 112 47961, 47524, 47089, 46656, 46225, 45796, 45369, 44944, 44521, 44100, 43681, 43264, 113 42849, 42436, 42025, 41616, 41209, 40804, 40401, 40000, 39601, 39204, 38809, 38416, 114 38025, 37636, 37249, 36864, 36481, 36100, 35721, 35344, 34969, 34596, 34225, 33856, 115 33489, 33124, 32761, 32400, 32041, 31684, 31329, 30976, 30625, 30276, 29929, 29584, 116 29241, 28900, 28561, 28224, 27889, 27556, 27225, 26896, 26569, 26244, 25921, 25600, 117 25281, 24964, 24649, 24336, 24025, 23716, 23409, 23104, 22801, 22500, 22201, 21904, 118 21609, 21316, 21025, 20736, 20449, 20164, 19881, 19600, 19321, 19044, 18769, 18496, 119 18225, 17956, 17689, 17424, 17161, 16900, 16641, 16384, 16129, 15876, 15625, 15376, 120 15129, 14884, 14641, 14400, 14161, 13924, 13689, 13456, 13225, 12996, 12769, 12544, 121 12321, 12100, 11881, 11664, 11449, 11236, 11025, 10816, 10609, 10404, 10201, 10000, 122 9801, 9604, 9409, 9216, 9025, 8836, 8649, 8464, 8281, 8100, 7921, 7744, 123 7569, 7396, 7225, 7056, 6889, 6724, 6561, 6400, 6241, 6084, 5929, 5776, 124 5625, 5476, 5329, 5184, 5041, 4900, 4761, 4624, 4489, 4356, 4225, 4096, 125 3969, 3844, 3721, 3600, 3481, 3364, 3249, 3136, 3025, 2916, 2809, 2704, 126 2601, 2500, 2401, 2304, 2209, 2116, 2025, 1936, 1849, 1764, 1681, 1600, 127 1521, 1444, 1369, 1296, 1225, 1156, 1089, 1024, 961, 900, 841, 784, 128 729, 676, 625, 576, 529, 484, 441, 400, 361, 324, 289, 256, 129 225, 196, 169, 144, 121, 100, 81, 64, 49, 36, 25, 16, 130 9, 4, 1, 0, 1, 4, 9, 16, 25, 36, 49, 64, 131 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400, 132 441, 484, 529, 576, 625, 676, 729, 784, 841, 900, 961, 1024, 133 1089, 1156, 1225, 1296, 1369, 1444, 1521, 1600, 1681, 1764, 1849, 1936, 134 2025, 2116, 2209, 2304, 2401, 2500, 2601, 2704, 2809, 2916, 3025, 3136, 135 3249, 3364, 3481, 3600, 3721, 3844, 3969, 4096, 4225, 4356, 4489, 4624, 136 4761, 4900, 5041, 5184, 5329, 5476, 5625, 5776, 5929, 6084, 6241, 6400, 137 6561, 6724, 6889, 7056, 7225, 7396, 7569, 7744, 7921, 8100, 8281, 8464, 138 8649, 8836, 9025, 9216, 9409, 9604, 9801, 10000, 10201, 10404, 10609, 10816, 139 11025, 11236, 11449, 11664, 11881, 12100, 12321, 12544, 12769, 12996, 13225, 13456, 140 13689, 13924, 14161, 14400, 14641, 14884, 15129, 15376, 15625, 15876, 16129, 16384, 141 16641, 16900, 17161, 17424, 17689, 17956, 18225, 18496, 18769, 19044, 19321, 19600, 142 19881, 20164, 20449, 20736, 21025, 21316, 21609, 21904, 22201, 22500, 22801, 23104, 143 23409, 23716, 24025, 24336, 24649, 24964, 25281, 25600, 25921, 26244, 26569, 26896, 144 27225, 27556, 27889, 28224, 28561, 28900, 29241, 29584, 29929, 30276, 30625, 30976, 145 31329, 31684, 32041, 32400, 32761, 33124, 33489, 33856, 34225, 34596, 34969, 35344, 146 35721, 36100, 36481, 36864, 37249, 37636, 38025, 38416, 38809, 39204, 39601, 40000, 147 40401, 40804, 41209, 41616, 42025, 42436, 42849, 43264, 43681, 44100, 44521, 44944, 148 45369, 45796, 46225, 46656, 47089, 47524, 47961, 48400, 48841, 49284, 49729, 50176, 149 50625, 51076, 51529, 51984, 52441, 52900, 53361, 53824, 54289, 54756, 55225, 55696, 150 56169, 56644, 57121, 57600, 58081, 58564, 59049, 59536, 60025, 60516, 61009, 61504, 151 62001, 62500, 63001, 63504, 64009, 64516, 65025 152 }; 153 154 const uchar g_Saturate8u[] = 155 { 156 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 157 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 158 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 159 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 160 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 161 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 162 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 163 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 164 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 165 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 166 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 167 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 168 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 169 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 170 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 171 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 172 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 173 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 174 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 175 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 176 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 177 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 178 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 179 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 180 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 181 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 182 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 183 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 184 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 185 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 186 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 187 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 188 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 189 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 190 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 191 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 192 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 193 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 194 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 195 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 196 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 197 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 198 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 199 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 200 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 201 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 202 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 203 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 204 255 205 }; 206 207 } 208 209 /* End of file. */ 210