OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 // To regenerate SkPMetricUtil_generated.h, simply run ./generate_pmetric_tables
.py | 7 // To regenerate SkPMetricUtil_generated.h, simply run ./generate_pmetric_tables
.py |
8 namespace SkPMetricUtil { | 8 namespace SkPMetricUtil { |
9 static float gCubeRootTable[] = { | 9 static float gCubeRootTable[] = { |
10 0.0000000000f,0.0992125657f,0.1250000000f,0.1430892803f,0.1574901312f,0.1696
511010f, | 10 0.0000000000f,0.0992125657f,0.1250000000f,0.1430892803f,0.1574901312f,0.1696
511010f, |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 0.9827780228f,0.9831149368f,0.9834516200f,0.9837880729f,0.9841242958f,0.9844
602891f, | 172 0.9827780228f,0.9831149368f,0.9834516200f,0.9837880729f,0.9841242958f,0.9844
602891f, |
173 0.9847960532f,0.9851315885f,0.9854668954f,0.9858019743f,0.9861368255f,0.9864
714495f, | 173 0.9847960532f,0.9851315885f,0.9854668954f,0.9858019743f,0.9861368255f,0.9864
714495f, |
174 0.9868058466f,0.9871400173f,0.9874739618f,0.9878076807f,0.9881411742f,0.9884
744427f, | 174 0.9868058466f,0.9871400173f,0.9874739618f,0.9878076807f,0.9881411742f,0.9884
744427f, |
175 0.9888074867f,0.9891403065f,0.9894729024f,0.9898052749f,0.9901374244f,0.9904
693511f, | 175 0.9888074867f,0.9891403065f,0.9894729024f,0.9898052749f,0.9901374244f,0.9904
693511f, |
176 0.9908010556f,0.9911325380f,0.9914637989f,0.9917948386f,0.9921256575f,0.9924
562559f, | 176 0.9908010556f,0.9911325380f,0.9914637989f,0.9917948386f,0.9921256575f,0.9924
562559f, |
177 0.9927866341f,0.9931167927f,0.9934467318f,0.9937764520f,0.9941059535f,0.9944
352367f, | 177 0.9927866341f,0.9931167927f,0.9934467318f,0.9937764520f,0.9941059535f,0.9944
352367f, |
178 0.9947643020f,0.9950931497f,0.9954217802f,0.9957501939f,0.9960783911f,0.9964
063721f, | 178 0.9947643020f,0.9950931497f,0.9954217802f,0.9957501939f,0.9960783911f,0.9964
063721f, |
179 0.9967341374f,0.9970616873f,0.9973890221f,0.9977161421f,0.9980430478f,0.9983
697395f, | 179 0.9967341374f,0.9970616873f,0.9973890221f,0.9977161421f,0.9980430478f,0.9983
697395f, |
180 0.9986962176f,0.9990224823f,0.9993485340f,0.9996743731f, | 180 0.9986962176f,0.9990224823f,0.9993485340f,0.9996743731f, |
181 }; | 181 }; |
182 float get_cube_root(float value) { | 182 static float get_cube_root(float value) { |
183 SkASSERT(value >= 0.0f); | 183 SkASSERT(value >= 0.0f); |
184 SkASSERT(value * 1023.0f < 1024.0f); | 184 SkASSERT(value * 1023.0f < 1024.0f); |
185 return gCubeRootTable[(int)(value * 1023.0f)]; | 185 return gCubeRootTable[(int)(value * 1023.0f)]; |
186 } | 186 } |
187 | 187 |
188 static float gGammaTable[] = { | 188 static float gGammaTable[] = { |
189 0.0000000000f,0.0000050771f,0.0000233280f,0.0000569218f,0.0001071874f,0.0001
751240f, | 189 0.0000000000f,0.0000050771f,0.0000233280f,0.0000569218f,0.0001071874f,0.0001
751240f, |
190 0.0002615438f,0.0003671363f,0.0004925038f,0.0006381828f,0.0008046585f,0.0009
923743f, | 190 0.0002615438f,0.0003671363f,0.0004925038f,0.0006381828f,0.0008046585f,0.0009
923743f, |
191 0.0012017395f,0.0014331346f,0.0016869153f,0.0019634162f,0.0022629532f,0.0025
858256f, | 191 0.0012017395f,0.0014331346f,0.0016869153f,0.0019634162f,0.0022629532f,0.0025
858256f, |
192 0.0029323183f,0.0033027030f,0.0036972396f,0.0041161771f,0.0045597549f,0.0050
282035f, | 192 0.0029323183f,0.0033027030f,0.0036972396f,0.0041161771f,0.0045597549f,0.0050
282035f, |
(...skipping 30 matching lines...) Expand all Loading... |
223 0.6120655999f,0.6186857275f,0.6253447208f,0.6320426176f,0.6387794557f,0.6455
552724f, | 223 0.6120655999f,0.6186857275f,0.6253447208f,0.6320426176f,0.6387794557f,0.6455
552724f, |
224 0.6523701054f,0.6592239918f,0.6661169688f,0.6730490733f,0.6800203422f,0.6870
308122f, | 224 0.6523701054f,0.6592239918f,0.6661169688f,0.6730490733f,0.6800203422f,0.6870
308122f, |
225 0.6940805198f,0.7011695015f,0.7082977937f,0.7154654323f,0.7226724536f,0.7299
188934f, | 225 0.6940805198f,0.7011695015f,0.7082977937f,0.7154654323f,0.7226724536f,0.7299
188934f, |
226 0.7372047874f,0.7445301713f,0.7518950806f,0.7592995507f,0.7667436169f,0.7742
273142f, | 226 0.7372047874f,0.7445301713f,0.7518950806f,0.7592995507f,0.7667436169f,0.7742
273142f, |
227 0.7817506778f,0.7893137424f,0.7969165429f,0.8045591139f,0.8122414899f,0.8199
637053f, | 227 0.7817506778f,0.7893137424f,0.7969165429f,0.8045591139f,0.8122414899f,0.8199
637053f, |
228 0.8277257945f,0.8355277915f,0.8433697304f,0.8512516452f,0.8591735697f,0.8671
355375f, | 228 0.8277257945f,0.8355277915f,0.8433697304f,0.8512516452f,0.8591735697f,0.8671
355375f, |
229 0.8751375824f,0.8831797377f,0.8912620368f,0.8993845130f,0.9075471995f,0.9157
501293f, | 229 0.8751375824f,0.8831797377f,0.8912620368f,0.8993845130f,0.9075471995f,0.9157
501293f, |
230 0.9239933353f,0.9322768503f,0.9406007070f,0.9489649382f,0.9573695762f,0.9658
146535f, | 230 0.9239933353f,0.9322768503f,0.9406007070f,0.9489649382f,0.9573695762f,0.9658
146535f, |
231 0.9743002024f,0.9828262551f,0.9913928436f,1.0000000000f, | 231 0.9743002024f,0.9828262551f,0.9913928436f,1.0000000000f, |
232 }; | 232 }; |
233 float get_gamma(unsigned char value) { | 233 static float get_gamma(unsigned char value) { |
234 return gGammaTable[value]; | 234 return gGammaTable[value]; |
235 } | 235 } |
236 | 236 |
237 static float gTVITable[] = { | 237 static float gTVITable[] = { |
238 0.0013803843f,0.0054723435f,0.0090762146f,0.0127002285f,0.0161086814f,0.0201
358517f, | 238 0.0013803843f,0.0054723435f,0.0090762146f,0.0127002285f,0.0161086814f,0.0201
358517f, |
239 0.0241630221f,0.0281901924f,0.0322173627f,0.0362445331f,0.0402717034f,0.0442
988738f, | 239 0.0241630221f,0.0281901924f,0.0322173627f,0.0362445331f,0.0402717034f,0.0442
988738f, |
240 0.0483260441f,0.0523532145f,0.0563803848f,0.0604075551f,0.0644347255f,0.0684
618958f, | 240 0.0483260441f,0.0523532145f,0.0563803848f,0.0604075551f,0.0644347255f,0.0684
618958f, |
241 0.0724890662f,0.0765162365f,0.0805434069f,0.0845705772f,0.0885977476f,0.0926
249179f, | 241 0.0724890662f,0.0765162365f,0.0805434069f,0.0845705772f,0.0885977476f,0.0926
249179f, |
242 0.0966520882f,0.1006792586f,0.1047064289f,0.1087335993f,0.1127607696f,0.1167
879400f, | 242 0.0966520882f,0.1006792586f,0.1047064289f,0.1087335993f,0.1127607696f,0.1167
879400f, |
243 0.1208151103f,0.1248422806f,0.1288694510f,0.1328966213f,0.1369237917f,0.1409
509620f, | 243 0.1208151103f,0.1248422806f,0.1288694510f,0.1328966213f,0.1369237917f,0.1409
509620f, |
(...skipping 1652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1896 5.5301355513f,5.5306914556f,5.5312473598f,5.5318032641f,5.5323591684f,5.5329
150726f, | 1896 5.5301355513f,5.5306914556f,5.5312473598f,5.5318032641f,5.5323591684f,5.5329
150726f, |
1897 5.5334709769f,5.5340268811f,5.5345827854f,5.5351386896f,5.5356945939f,5.5362
504982f, | 1897 5.5334709769f,5.5340268811f,5.5345827854f,5.5351386896f,5.5356945939f,5.5362
504982f, |
1898 5.5368064024f,5.5373623067f,5.5379182109f,5.5384741152f,5.5390300194f,5.5395
859237f, | 1898 5.5368064024f,5.5373623067f,5.5379182109f,5.5384741152f,5.5390300194f,5.5395
859237f, |
1899 5.5401418280f,5.5406977322f,5.5412536365f,5.5418095407f,5.5423654450f,5.5429
213492f, | 1899 5.5401418280f,5.5406977322f,5.5412536365f,5.5418095407f,5.5423654450f,5.5429
213492f, |
1900 5.5434772535f,5.5440331578f,5.5445890620f,5.5451449663f,5.5457008705f,5.5462
567748f, | 1900 5.5434772535f,5.5440331578f,5.5445890620f,5.5451449663f,5.5457008705f,5.5462
567748f, |
1901 5.5468126790f,5.5473685833f,5.5479244876f,5.5484803918f,5.5490362961f,5.5495
922003f, | 1901 5.5468126790f,5.5473685833f,5.5479244876f,5.5484803918f,5.5490362961f,5.5495
922003f, |
1902 5.5501481046f,5.5507040088f,5.5512599131f,5.5518158174f,5.5523717216f,5.5529
276259f, | 1902 5.5501481046f,5.5507040088f,5.5512599131f,5.5518158174f,5.5523717216f,5.5529
276259f, |
1903 5.5534835301f,5.5540394344f,5.5545953386f,5.5551512429f,5.5557071472f,5.5562
630514f, | 1903 5.5534835301f,5.5540394344f,5.5545953386f,5.5551512429f,5.5557071472f,5.5562
630514f, |
1904 5.5568189557f,5.5573748599f,5.5579307642f,5.5584866684f, | 1904 5.5568189557f,5.5573748599f,5.5579307642f,5.5584866684f, |
1905 }; | 1905 }; |
1906 float get_threshold_vs_intensity(float value) { | 1906 static float get_threshold_vs_intensity(float value) { |
1907 SkASSERT(value >= 0.0f); | 1907 SkASSERT(value >= 0.0f); |
1908 SkASSERT(value < 100.0f); | 1908 SkASSERT(value < 100.0f); |
1909 return gTVITable[(int)(value * 100.0f)]; | 1909 return gTVITable[(int)(value * 100.0f)]; |
1910 } | 1910 } |
1911 | 1911 |
1912 static float gVisualMaskTable[] = { | 1912 static float gVisualMaskTable[] = { |
1913 1.0000000000f,1.1897247198f,1.6811970813f,2.1839523495f,2.6547752201f,3.0963
096336f, | 1913 1.0000000000f,1.1897247198f,1.6811970813f,2.1839523495f,2.6547752201f,3.0963
096336f, |
1914 3.5139692055f,3.9121076634f,4.2939844505f,4.6620559235f,5.0182118232f,5.3639
381283f, | 1914 3.5139692055f,3.9121076634f,4.2939844505f,4.6620559235f,5.0182118232f,5.3639
381283f, |
1915 5.7004270140f,6.0286520228f,6.3494205286f,6.6634111728f,6.9712011485f,7.2732
864768f, | 1915 5.7004270140f,6.0286520228f,6.3494205286f,6.6634111728f,6.9712011485f,7.2732
864768f, |
1916 7.5700973467f,7.8620099053f,8.1493554541f,8.4324277147f,8.7114886393f,8.9867
731060f, | 1916 7.5700973467f,7.8620099053f,8.1493554541f,8.4324277147f,8.7114886393f,8.9867
731060f, |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2571 329.4895500897f,329.5479680033f,329.6063814791f,329.6647905187f,329.72319512
34f,329.7815952948f, | 2571 329.4895500897f,329.5479680033f,329.6063814791f,329.6647905187f,329.72319512
34f,329.7815952948f, |
2572 329.8399910342f,329.8983823432f,329.9567692231f,330.0151516755f,330.07352970
18f,330.1319033035f, | 2572 329.8399910342f,329.8983823432f,329.9567692231f,330.0151516755f,330.07352970
18f,330.1319033035f, |
2573 330.1902724820f,330.2486372387f,330.3069975751f,330.3653534927f,330.42370499
29f,330.4820520772f, | 2573 330.1902724820f,330.2486372387f,330.3069975751f,330.3653534927f,330.42370499
29f,330.4820520772f, |
2574 330.5403947470f,330.5987330037f,330.6570668488f,330.7153962838f,330.77372131
01f,330.8320419291f, | 2574 330.5403947470f,330.5987330037f,330.6570668488f,330.7153962838f,330.77372131
01f,330.8320419291f, |
2575 330.8903581422f,330.9486699510f,331.0069773569f,331.0652803612f,331.12357896
55f,331.1818731712f, | 2575 330.8903581422f,330.9486699510f,331.0069773569f,331.0652803612f,331.12357896
55f,331.1818731712f, |
2576 331.2401629797f,331.2984483924f,331.3567294109f,331.4150060364f,331.47327827
05f,331.5315461146f, | 2576 331.2401629797f,331.2984483924f,331.3567294109f,331.4150060364f,331.47327827
05f,331.5315461146f, |
2577 331.5898095702f,331.6480686385f,331.7063233212f,331.7645736196f,331.82281953
51f,331.8810610693f, | 2577 331.5898095702f,331.6480686385f,331.7063233212f,331.7645736196f,331.82281953
51f,331.8810610693f, |
2578 331.9392982234f,331.9975309989f,332.0557593973f,332.1139834200f,332.17220306
84f,332.2304183439f, | 2578 331.9392982234f,331.9975309989f,332.0557593973f,332.1139834200f,332.17220306
84f,332.2304183439f, |
2579 332.2886292480f,332.3468357821f,332.4050379475f,332.4632357458f, | 2579 332.2886292480f,332.3468357821f,332.4050379475f,332.4632357458f, |
2580 }; | 2580 }; |
2581 float get_visual_mask(float value) { | 2581 static float get_visual_mask(float value) { |
2582 SkASSERT(value >= 0.0f); | 2582 SkASSERT(value >= 0.0f); |
2583 SkASSERT(value < 4000.0f); | 2583 SkASSERT(value < 4000.0f); |
2584 return gVisualMaskTable[(int)value]; | 2584 return gVisualMaskTable[(int)value]; |
2585 } | 2585 } |
2586 } | 2586 } |
OLD | NEW |