From: Øyvind Kolås Date: Thu, 30 Aug 2018 00:50:38 +0000 (+0200) Subject: tools: fix utf8 mode of diagram, change gradient unit in html X-Git-Tag: archive/raspbian/1%0.1.106-3+rpi1^2~15^2~14^2~15 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=7203a2ac1e0ce02e395fbd2496496484a75ddabf;p=babl.git tools: fix utf8 mode of diagram, change gradient unit in html The gradient in the html mode is now pixels per time, not bytes read+written per time, which seem to be more fair in assessing the reference conversions of different pixel sizes. --- diff --git a/tools/babl_fish_path_fitness.c b/tools/babl_fish_path_fitness.c index 019a280..ffd81ab 100644 --- a/tools/babl_fish_path_fitness.c +++ b/tools/babl_fish_path_fitness.c @@ -25,7 +25,7 @@ static int qux = 0; static char *utf8_bar[] = { " %s%s", "·%s%s", "▁%s%s", "▂%s%s", "▃%s%s", "▄%s%s", "▅%s%s", "▆%s%s", "▇%s%s", "█%s%s" }; #define DIRECT " " #define SELF " " -#define EMPTY " " +#define EMPTY " %s%s" #define SL "" #define NL "\n" @@ -155,9 +155,7 @@ static int destination_each (Babl *babl, #ifdef UTF8 #else { - long bytes_in = 0; - long bytes_out = 0; - float bytes_per_second; + float pixels_per_second; long ticks_start, ticks_end; ticks_start = babl_ticks (); @@ -165,15 +163,14 @@ static int destination_each (Babl *babl, &test_pixels_out[0], NUM_TEST_PIXELS); ticks_end = babl_ticks (); - bytes_in = NUM_TEST_PIXELS * babl_format_get_bytes_per_pixel (source); - bytes_out = NUM_TEST_PIXELS * babl_format_get_bytes_per_pixel (destination); - bytes_per_second = (bytes_in + bytes_out) / ((ticks_end - ticks_start)/1000.0); + pixels_per_second = (NUM_TEST_PIXELS) / ((ticks_end - ticks_start)/1000.0); { - float colval = bytes_per_second/1024/1024.0/7.0; - if (colval > 1) colval = 1; - + float colval = pixels_per_second/1000/1000.0/0.7; + if (colval > 1) + colval = 1; + if (colval < 0.2) { sprintf (style, "color:rgb(%i, 0, 0);", (int)(colval * 5 * 255)); @@ -182,19 +179,17 @@ static int destination_each (Babl *babl, { sprintf (style, "color:rgb(255, %i, 0);", (int)((colval-0.2) * 5 * 255)); } - else + else { sprintf (style, "color:rgb(255, 255, %i);", (int)((colval-0.4) * 1.666 * 255)); } - - } { int steps = 0; if (temp) steps = babl_list_size (temp->fish_path.conversion_list); - sprintf (title, "%s to %s %i steps %.3fgb/s ", babl_get_name (source), babl_get_name (destination), steps, bytes_per_second/1024.0/1024.0); + sprintf (title, "%s to %s %i steps %.3f mpix/s ", babl_get_name (source), babl_get_name (destination), steps, pixels_per_second/1000.0); } } #endif