From 34a6af3c55cf8bba292cec8dc42fdc1917759a08 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 13 Dec 2006 18:10:21 -0800 Subject: [PATCH] pdiff: Delete all trailing whitespace. --- test/pdiff/CompareArgs.cpp | 4 +-- test/pdiff/CompareArgs.h | 4 +-- test/pdiff/LPyramid.cpp | 4 +-- test/pdiff/LPyramid.h | 4 +-- test/pdiff/Metric.cpp | 52 +++++++++++++++++------------------ test/pdiff/PerceptualDiff.cpp | 2 +- test/pdiff/RGBAImage.cpp | 8 +++--- test/pdiff/RGBAImage.h | 2 +- 8 files changed, 40 insertions(+), 40 deletions(-) diff --git a/test/pdiff/CompareArgs.cpp b/test/pdiff/CompareArgs.cpp index 2c5e5d41e..6b8fe8a81 100644 --- a/test/pdiff/CompareArgs.cpp +++ b/test/pdiff/CompareArgs.cpp @@ -18,7 +18,7 @@ #include "RGBAImage.h" #include -static const char* copyright = +static const char* copyright = "PerceptualDiff version 1.0, Copyright (C) 2006 Yangli Hector Yee\n\ PerceptualDiff comes with ABSOLUTELY NO WARRANTY;\n\ This is free software, and you are welcome\n\ @@ -79,7 +79,7 @@ bool CompareArgs::Parse_Args(int argc, char **argv) return false; } ImgA = new RGBACairoImage (surface); - } else if (i == 2) { + } else if (i == 2) { surface = cairo_image_surface_create_from_png (argv[2]); if (cairo_surface_status (surface)) { diff --git a/test/pdiff/CompareArgs.h b/test/pdiff/CompareArgs.h index fb5fc9d10..ab2a25129 100644 --- a/test/pdiff/CompareArgs.h +++ b/test/pdiff/CompareArgs.h @@ -28,9 +28,9 @@ class CompareArgs public: CompareArgs(); ~CompareArgs(); - bool Parse_Args(int argc, char **argv); + bool Parse_Args(int argc, char **argv); void Print_Args(); - + RGBAImage *ImgA; // Image A RGBAImage *ImgB; // Image B RGBAImage *ImgDiff; // Diff image diff --git a/test/pdiff/LPyramid.cpp b/test/pdiff/LPyramid.cpp index cefd24b4b..104179d98 100644 --- a/test/pdiff/LPyramid.cpp +++ b/test/pdiff/LPyramid.cpp @@ -49,7 +49,7 @@ float *LPyramid::Copy(float *img) int max = Width * Height; float *out = new float[max]; for (int i = 0; i < max; i++) out[i] = img[i]; - + return out; } @@ -72,7 +72,7 @@ void LPyramid::Convolve(float *a, float *b) if (nx>=Width) nx=2*(Width-1)-nx; if (ny>=Height) ny=2*(Height-1)-ny; a[index] += Kernel[i+2] * Kernel[j+2] * b[ny * Width + nx]; - } + } } } } diff --git a/test/pdiff/LPyramid.h b/test/pdiff/LPyramid.h index bb9777afc..27e041bfd 100644 --- a/test/pdiff/LPyramid.h +++ b/test/pdiff/LPyramid.h @@ -20,14 +20,14 @@ class LPyramid { -public: +public: LPyramid(float *image, int width, int height); virtual ~LPyramid(); float Get_Value(int x, int y, int level); protected: float *Copy(float *img); void Convolve(float *a, float *b); - + // Succesively blurred versions of the original image float *Levels[MAX_PYR_LEVELS]; diff --git a/test/pdiff/Metric.cpp b/test/pdiff/Metric.cpp index b92dd5c92..dde17c044 100644 --- a/test/pdiff/Metric.cpp +++ b/test/pdiff/Metric.cpp @@ -30,14 +30,14 @@ * threshold of visibility in cd per m^2 * TVI means Threshold vs Intensity function * This version comes from Ward Larson Siggraph 1997 - */ + */ float tvi(float adaptation_luminance) { // returns the threshold luminance given the adaptation luminance // units are candelas per meter squared - float log_a, r, result; + float log_a, r, result; log_a = log10f(adaptation_luminance); if (log_a < -3.94f) { @@ -52,24 +52,24 @@ float tvi(float adaptation_luminance) r = log_a - 1.255f; } - result = powf(10.0f , r); + result = powf(10.0f , r); return result; -} +} // computes the contrast sensitivity function (Barten SPIE 1989) // given the cycles per degree (cpd) and luminance (lum) float csf(float cpd, float lum) { - float a, b, result; - + float a, b, result; + a = 440.0f * powf((1.0f + 0.7f / lum), -0.2f); b = 0.3f * powf((1.0f + 100.0f / lum), 0.15f); - - result = a * cpd * expf(-b * cpd) * sqrtf(1.0f + 0.06f * expf(b * cpd)); - - return result; + + result = a * cpd * expf(-b * cpd) * sqrtf(1.0f + 0.06f * expf(b * cpd)); + + return result; } /* @@ -81,10 +81,10 @@ float mask(float contrast) float a, b, result; a = powf(392.498f * contrast, 0.7f); b = powf(0.0153f * a, 4.0f); - result = powf(1.0f + b, 0.25f); + result = powf(1.0f + b, 0.25f); return result; -} +} // convert Adobe RGB (1998) with reference white D65 to XYZ void AdobeRGBToXYZ(float r, float g, float b, float &x, float &y, float &z) @@ -137,7 +137,7 @@ bool Yee_Compare(CompareArgs &args) args.ErrorStr = "Image dimensions do not match\n"; return false; } - + unsigned int i, dim, pixels_failed; dim = args.ImgA->Get_Width() * args.ImgA->Get_Height(); bool identical = true; @@ -160,7 +160,7 @@ bool Yee_Compare(CompareArgs &args) args.ErrorStr = "Images are perceptually indistinguishable\n"; return true; } - + char different[100]; sprintf(different, "%d pixels are different\n", pixels_failed); @@ -220,14 +220,14 @@ int Yee_Compare_Images(RGBAImage *image_a, float *bZ = new float[dim]; float *aLum = new float[dim]; float *bLum = new float[dim]; - + float *aA = new float[dim]; float *bA = new float[dim]; float *aB = new float[dim]; float *bB = new float[dim]; if (verbose) printf("Converting RGB to XYZ\n"); - + unsigned int x, y, w, h; w = image_a->Get_Width(); h = image_a->Get_Height(); @@ -251,17 +251,17 @@ int Yee_Compare_Images(RGBAImage *image_a, bLum[i] = bY[i] * luminance; } } - + if (verbose) printf("Constructing Laplacian Pyramids\n"); - + LPyramid *la = new LPyramid(aLum, w, h); LPyramid *lb = new LPyramid(bLum, w, h); - + float num_one_degree_pixels = (float) (2 * tan(field_of_view * 0.5 * M_PI / 180) * 180 / M_PI); float pixels_per_degree = w / num_one_degree_pixels; - + if (verbose) printf("Performing test\n"); - + float num_pixels = 1; unsigned int adaptation_level = 0; for (i = 0; i < MAX_PYR_LEVELS; i++) { @@ -269,15 +269,15 @@ int Yee_Compare_Images(RGBAImage *image_a, if (num_pixels > num_one_degree_pixels) break; num_pixels *= 2; } - + float cpd[MAX_PYR_LEVELS]; cpd[0] = 0.5f * pixels_per_degree; for (i = 1; i < MAX_PYR_LEVELS; i++) cpd[i] = 0.5f * cpd[i - 1]; float csf_max = csf(3.248f, 100.0f); - + float F_freq[MAX_PYR_LEVELS - 2]; for (i = 0; i < MAX_PYR_LEVELS - 2; i++) F_freq[i] = csf_max / csf( cpd[i], 100.0f); - + unsigned int pixels_failed = 0; for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { @@ -301,7 +301,7 @@ int Yee_Compare_Images(RGBAImage *image_a, adapt *= 0.5f; if (adapt < 1e-5) adapt = 1e-5f; for (i = 0; i < MAX_PYR_LEVELS - 2; i++) { - F_mask[i] = mask(contrast[i] * csf(cpd[i], adapt)); + F_mask[i] = mask(contrast[i] * csf(cpd[i], adapt)); } float factor = 0; for (i = 0; i < MAX_PYR_LEVELS - 2; i++) { @@ -346,7 +346,7 @@ int Yee_Compare_Images(RGBAImage *image_a, #endif } } - + if (aX) delete[] aX; if (aY) delete[] aY; if (aZ) delete[] aZ; diff --git a/test/pdiff/PerceptualDiff.cpp b/test/pdiff/PerceptualDiff.cpp index 70c6e12b8..1fd66b922 100644 --- a/test/pdiff/PerceptualDiff.cpp +++ b/test/pdiff/PerceptualDiff.cpp @@ -28,7 +28,7 @@ int main(int argc, char **argv) { CompareArgs args; - + if (!args.Parse_Args(argc, argv)) { printf("%s", args.ErrorStr.c_str()); return -1; diff --git a/test/pdiff/RGBAImage.cpp b/test/pdiff/RGBAImage.cpp index 0b540d211..08e5cd9a7 100644 --- a/test/pdiff/RGBAImage.cpp +++ b/test/pdiff/RGBAImage.cpp @@ -25,13 +25,13 @@ RGBAImage* RGBAImage::ReadTiff(char *filename) { RGBAImage *fimg = 0; - + TIFF* tif = TIFFOpen(filename, "r"); char emsg[1024]; emsg[0] = 0; if (tif) { TIFFRGBAImage img; - + if (TIFFRGBAImageBegin(&img, tif, 0, emsg)) { size_t npixels; uint32* raster; @@ -120,9 +120,9 @@ RGBAImage* RGBAImage::ReadPNG(char *filename) png_read_destroy(png_ptr, info_ptr, end_info); return fimg; } - + bool RGBAImage::WritePPM() -{ +{ if (Width <= 0) return false; if (Height <=0 ) return false; FILE *out = fopen(Name.c_str(), "wb"); diff --git a/test/pdiff/RGBAImage.h b/test/pdiff/RGBAImage.h index 31727fa35..5f662bb62 100644 --- a/test/pdiff/RGBAImage.h +++ b/test/pdiff/RGBAImage.h @@ -45,7 +45,7 @@ public: virtual unsigned int Get(int x, int y) const { return Data[x + y * Width]; } virtual unsigned int Get(int i) const { return Data[i]; } const std::string &Get_Name(void) const { return Name; } - + bool WritePPM(); static RGBAImage* ReadTiff(char *filename); static RGBAImage* ReadPNG(char *filename);