freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] GSoC-2017-kushal d66639a 41/70: Updating Difference Metric s


From: Kushal K S V S
Subject: [freetype2] GSoC-2017-kushal d66639a 41/70: Updating Difference Metric score calculation
Date: Sun, 18 Mar 2018 11:21:16 -0400 (EDT)

branch: GSoC-2017-kushal
commit d66639a95c2a3c16235b74599265a7a84449dddb
Author: Kushal K S V S <address@hidden>
Commit: Kushal K S V S <address@hidden>

    Updating Difference Metric score calculation
---
 tests/make_png/Makefile      |  1 +
 tests/make_png/bitmap.c      | 16 ++++++++++++++++
 tests/make_png/bitmap.h      |  3 +++
 tests/make_png/images/README |  3 ++-
 tests/make_png/make_sprite.c |  4 +++-
 tests/make_png/murmur3.c     |  1 -
 tests/make_png/script.js     |  2 +-
 tests/make_png/style.css     |  1 +
 8 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/tests/make_png/Makefile b/tests/make_png/Makefile
index 0944cdf..70187bf 100644
--- a/tests/make_png/Makefile
+++ b/tests/make_png/Makefile
@@ -25,3 +25,4 @@ clean:
 
 
 
+
diff --git a/tests/make_png/bitmap.c b/tests/make_png/bitmap.c
index c5eef77..6e1ff6d 100644
--- a/tests/make_png/bitmap.c
+++ b/tests/make_png/bitmap.c
@@ -624,3 +624,19 @@ IMAGE* Append_Rows(IMAGE* small, IMAGE* big){
 
   return result; 
 }
+
+int Image_Diff( IMAGE* base, IMAGE* test){
+
+  int diff = 0;
+
+  int max_width = MAX(base->width, test->width);
+  int min_width = MIN(base->width, test->width);
+
+  int max_height = MAX(base->height, test->height);
+  int min_height = MIN(base->height, test->height);
+
+  diff = (max_width - min_width) * max_height;
+  diff += (max_height - min_height) * min_width;
+
+  return diff;
+}
diff --git a/tests/make_png/bitmap.h b/tests/make_png/bitmap.h
index 95b97ce..51e05cd 100644
--- a/tests/make_png/bitmap.h
+++ b/tests/make_png/bitmap.h
@@ -21,6 +21,7 @@
 
 #define BITS_PER_PIXEL_RGBA 32
 #define MAX(a, b) ((a) > (b) ? (a) : (b))
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
 
 typedef struct {                /* To store 32bit Hash */
   FT_UInt32 hash;
@@ -89,3 +90,5 @@ int First_Row(IMAGE* input);
 IMAGE* Append_Columns(IMAGE* small, IMAGE* big);
 /* Appening white columns with image alignment */
 IMAGE* Append_Rows(IMAGE* small, IMAGE* big);
+/* calculating the Pixel Differences */
+int Image_Diff( IMAGE* base, IMAGE* test);
diff --git a/tests/make_png/images/README b/tests/make_png/images/README
index c769f13..96f91f2 100644
--- a/tests/make_png/images/README
+++ b/tests/make_png/images/README
@@ -1 +1,2 @@
-This folder includes all the images generated
\ No newline at end of file
+This folder includes all the images generated
+
diff --git a/tests/make_png/make_sprite.c b/tests/make_png/make_sprite.c
index 5ae7bc8..ceb95b5 100644
--- a/tests/make_png/make_sprite.c
+++ b/tests/make_png/make_sprite.c
@@ -448,6 +448,8 @@ int main(int argc, char const *argv[])
         test_png = Append_Columns(test_png, base_png);
       }
 
+      pixel_diff += Image_Diff( base_png, test_png);
+
       Add_effect( base_png, test_png, after_effect_1, 1);
       pixel_diff = Add_effect( base_png, test_png, after_effect_2,2);
 
@@ -505,4 +507,4 @@ int main(int argc, char const *argv[])
   dlclose(test_handle);
 
   return 0;
-}
\ No newline at end of file
+}
diff --git a/tests/make_png/murmur3.c b/tests/make_png/murmur3.c
index 6698c09..be58a76 100644
--- a/tests/make_png/murmur3.c
+++ b/tests/make_png/murmur3.c
@@ -304,4 +304,3 @@ void MurmurHash3_x64_128 ( const void * key, const int len,
 }
 
 /*------------------------------------------------------------------*/
-
diff --git a/tests/make_png/script.js b/tests/make_png/script.js
index 0198cf9..274538f 100644
--- a/tests/make_png/script.js
+++ b/tests/make_png/script.js
@@ -19,4 +19,4 @@ function sort_t(tbody, col, asc){
         arr[i] = "<td>"+arr[i].join("</td><td>")+"</td>";
     }
     tbody.innerHTML = "<tr>"+arr.join("</tr><tr>")+"</tr>";
-}
\ No newline at end of file
+}
diff --git a/tests/make_png/style.css b/tests/make_png/style.css
index 9f6d831..281b580 100644
--- a/tests/make_png/style.css
+++ b/tests/make_png/style.css
@@ -35,3 +35,4 @@ th {
 #hash{
   font-size: 12px;
 }
+



reply via email to

[Prev in Thread] Current Thread [Next in Thread]