[babl] stats: remove false negatives from HTML stats output
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl] stats: remove false negatives from HTML stats output
- Date: Sun, 17 Apr 2011 16:23:34 +0000 (UTC)
commit 6bbf401cbde5414c0e5fef53c3725df7c4aced73
Author: �yvind Kolås <pippin gimp org>
Date: Sun Apr 17 17:22:12 2011 +0100
stats: remove false negatives from HTML stats output
too many of the conversions are flagged as bad in the matrix change code so
that only conversions that contribute to more than 0.1% of the overall pixels
converted by babl are shown in the stats written when BABL_STATS environment
variable is set.
babl/babl-fish-stats.c | 46 ++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 42 insertions(+), 4 deletions(-)
---
diff --git a/babl/babl-fish-stats.c b/babl/babl-fish-stats.c
index 7b853b1..f5b3e2a 100644
--- a/babl/babl-fish-stats.c
+++ b/babl/babl-fish-stats.c
@@ -29,6 +29,41 @@ static char *utf8_bar[]={"·", "â??", "â??", "â??", "â??", "â??", "â??", "â??",
static char *utf8_bar[]={" ","1","2","3","4","5","6","7","8"};
*/
+static double sum_pixels = 0.0;
+
+static int
+table_destination_sum_each (Babl *babl,
+ void *userdata)
+{
+ Babl *source = userdata;
+ Babl *destination = babl;
+
+ if (source != destination)
+ {
+ Babl *fish = babl_fish (source, destination);
+ babl_assert (fish);
+ sum_pixels += fish->fish.pixels;
+ }
+ return 0;
+}
+
+static int
+table_source_sum_each (Babl *babl,
+ void *userdata)
+{
+ babl_format_class_for_each (table_destination_sum_each, babl);
+ return 0;
+}
+
+static void
+table_sum_processings_calc (void)
+{
+ sum_pixels = 0;
+ babl_format_class_for_each (table_source_sum_each, NULL);
+}
+
+#define LIMIT 0.001
+
static int
table_destination_each (Babl *babl,
void *userdata)
@@ -51,7 +86,7 @@ table_destination_each (Babl *babl,
case BABL_FISH_PATH:
fprintf (output_file, "<td class='cell'%s><a href='javascript:o()'>%s",
- fish->fish.processings > 0 ? " style='background-color: #69f'" : "",
+ fish->fish.pixels / sum_pixels > LIMIT ? " style='background-color: #69f'" : "",
utf8_bar[babl_list_size (fish->fish_path.conversion_list)]);
{
@@ -95,11 +130,11 @@ table_destination_each (Babl *babl,
case BABL_FISH_REFERENCE:
fprintf (output_file, "<td class='cell'%s><a href='javascript:o()'> ",
- fish->fish.processings > 0 ? " style='background-color: #f99'" : "");
+ fish->fish.pixels / sum_pixels > LIMIT ? " style='background-color: #f99'" : "");
fprintf (output_file, "<div class='tooltip'>");
fprintf (output_file, "<h3><span class='g'>Reference</span> %s <span class='g'>to</span> %s</h3>", source->instance.name, destination->instance.name);
- if (fish->fish.processings > 0)
+ if (fish->fish.processings > 1)
{
fprintf (output_file, "<span class='g'>Processings:</span>%i<br/>", fish->fish.processings);
fprintf (output_file, "<span class='g'>Pixels:</span>%li<br/>", fish->fish.pixels);
@@ -110,7 +145,7 @@ table_destination_each (Babl *babl,
case BABL_FISH_SIMPLE:
fprintf (output_file, "<td class='cell'%s><a href='javascript:o()'>·",
- fish->fish.processings > 1 ? " style='background-color: #69f'" : "");
+ fish->fish.pixels / sum_pixels > LIMIT ? " style='background-color: #69f'" : "");
fprintf (output_file, "<div class='tooltip'>");
fprintf (output_file, "<h3><span class='g'>Simple</span> %s <span class='g'>to</span> %s</h3>", source->instance.name, destination->instance.name);
@@ -138,6 +173,8 @@ table_destination_each (Babl *babl,
static int source_no = 0;
+
+
static int
table_source_each (Babl *babl,
void *userdata)
@@ -264,6 +301,7 @@ babl_fish_stats (FILE *file)
{
output_file = file;
+ table_sum_processings_calc ();
fprintf (output_file,
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]