Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(513)

Side by Side Diff: tools/skpdiff/SkPMetric.cpp

Issue 296103003: Fix windows compiler failures by using SkIsFinite. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include <cmath> 1 #include <cmath>
2 #include <math.h> 2 #include <math.h>
3 3
4 #include "SkBitmap.h" 4 #include "SkBitmap.h"
5 #include "skpdiff_util.h" 5 #include "skpdiff_util.h"
6 #include "SkPMetric.h" 6 #include "SkPMetric.h"
7 #include "SkPMetricUtil_generated.h" 7 #include "SkPMetricUtil_generated.h"
8 8
9 struct RGB { 9 struct RGB {
10 float r, g, b; 10 float r, g, b;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 bitmap->unlockPixels(); 155 bitmap->unlockPixels();
156 return true; 156 return true;
157 } 157 }
158 158
159 // From Barten SPIE 1989 159 // From Barten SPIE 1989
160 static float contrast_sensitivity(float cyclesPerDegree, float luminance) { 160 static float contrast_sensitivity(float cyclesPerDegree, float luminance) {
161 float a = 440.0f * powf(1.0f + 0.7f / luminance, -0.2f); 161 float a = 440.0f * powf(1.0f + 0.7f / luminance, -0.2f);
162 float b = 0.3f * powf(1.0f + 100.0f / luminance, 0.15f); 162 float b = 0.3f * powf(1.0f + 100.0f / luminance, 0.15f);
163 float exp = expf(-b * cyclesPerDegree); 163 float exp = expf(-b * cyclesPerDegree);
164 float root = sqrtf(1.0f + 0.06f * expf(b * cyclesPerDegree)); 164 float root = sqrtf(1.0f + 0.06f * expf(b * cyclesPerDegree));
165 if (!std::isfinite(exp) || !std::isfinite(root)) { 165 if (!SkScalarIsFinite(exp) || !SkScalarIsFinite(root)) {
166 return 0; 166 return 0;
167 } 167 }
168 return a * cyclesPerDegree * exp * root; 168 return a * cyclesPerDegree * exp * root;
169 } 169 }
170 170
171 #if 0 171 #if 0
172 // We're keeping these around for reference and in case the lookup tables are no longer desired. 172 // We're keeping these around for reference and in case the lookup tables are no longer desired.
173 // They are no longer called by any code in this file. 173 // They are no longer called by any code in this file.
174 174
175 // From Daly 1993 175 // From Daly 1993
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 if (!bitmap_to_cielab(baseline, &baselineLAB) || !bitmap_to_cielab(test, &te stLAB)) { 457 if (!bitmap_to_cielab(baseline, &baselineLAB) || !bitmap_to_cielab(test, &te stLAB)) {
458 return true; 458 return true;
459 } 459 }
460 460
461 result->poiCount = 0; 461 result->poiCount = 0;
462 result->result = pmetric(&baselineLAB, &testLAB, &result->poiCount); 462 result->result = pmetric(&baselineLAB, &testLAB, &result->poiCount);
463 result->timeElapsed = get_seconds() - startTime; 463 result->timeElapsed = get_seconds() - startTime;
464 464
465 return true; 465 return true;
466 } 466 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698