From: Øyvind Kolås Date: Thu, 27 Jan 2022 07:29:44 +0000 (+0100) Subject: tools: include CMYK encodings in babl-benchmark X-Git-Tag: archive/raspbian/1%0.1.106-3+rpi1^2~15^2~4^2~10 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=1ed0524d1ed122f138072cdc6a72d52341ffb7de;p=babl.git tools: include CMYK encodings in babl-benchmark --- diff --git a/tools/babl-benchmark.c b/tools/babl-benchmark.c index 239b599..d12dbb5 100644 --- a/tools/babl-benchmark.c +++ b/tools/babl-benchmark.c @@ -35,7 +35,7 @@ int unit_pixels = 1; // use megapixels per second instead of bytes int global_relative_scale = 1; -int exclude_identity = 0; +int exclude_identity = 1; #define N_BYTES N_PIXELS * (4 * 8) #define BAR_WIDTH 40 @@ -70,6 +70,42 @@ unicode_hbar (int width, int show_details = 0; int progress = 1; +#include +#include + +#if 0 + // more accurate, the 2100 constant is roughly + // what is needed on my system to convert to 1.5ghz + // constant clock performance + +inline uint64_t bench_ticks (void) { + uint32_t lo, hi; + __asm__ __volatile__ ( + "xorl %%eax, %%eax\n" + "cpuid\n" + "rdtsc\n" + : "=a" (lo), "=d" (hi) + : + : "%ebx", "%ecx"); + return ((uint64_t)hi << 32 | lo) / 2100; +} +#else +inline uint64_t bench_ticks (void) { return babl_ticks();} +#endif + +#if 0 +main() +{ + unsigned long long x; + unsigned long long y; + x = rdtsc(); + printf("%lld\n",x); + y = rdtsc(); + printf("%lld\n",y); + printf("it took this long to call printf: %lld\n",y-x); +} +#endif + static int test (int set_no) { @@ -86,7 +122,13 @@ test (int set_no) babl_format_with_space("RGBA float", babl_space(space)), \ babl_format_with_space("RaGaBaA float", babl_space(space)), \ babl_format_with_space("R'G'B'A float", babl_space(space)), \ - babl_format_with_space("R'G'B'A u16", babl_space(out_space)), \ + babl_format_with_space("RGBA u16", babl_space(out_space)), \ + babl_format_with_space("R'G'B'A u8", babl_space(out_space)) + +#define cmyk_set(space, out_space) \ + babl_format_with_space("cmykA float", babl_space(space)), \ + babl_format_with_space("camayakaA float", babl_space(space)), \ + babl_format_with_space("RGBA u16", babl_space(out_space)), \ babl_format_with_space("R'G'B'A u8", babl_space(out_space)) const Babl **formats=NULL; @@ -193,6 +235,14 @@ test (int set_no) { babl_format_with_space("YA u16", babl_space("sRGB")), default_set("sRGB", "Rec2020"), NULL }, { babl_format_with_space("YA half", babl_space("sRGB")), default_set("sRGB", "Rec2020"), NULL }, { babl_format_with_space("YA float", babl_space("sRGB")), default_set("sRGB", "Rec2020"), NULL }, + + + { babl_format_with_space("CMYKA float", babl_space("sRGB")), cmyk_set("sRGB", "sRGB"), NULL }, + { babl_format_with_space("CMYKA u16", babl_space("sRGB")), cmyk_set("sRGB", "sRGB"), NULL }, + { babl_format_with_space("CMYKA u8", babl_space("sRGB")), cmyk_set("sRGB", "sRGB"), NULL }, + { babl_format_with_space("cmykA float", babl_space("sRGB")), cmyk_set("sRGB", "sRGB"), NULL }, + { babl_format_with_space("cmykA u16", babl_space("sRGB")), cmyk_set("sRGB", "sRGB"), NULL }, + { babl_format_with_space("cmykA u8", babl_space("sRGB")), cmyk_set("sRGB", "sRGB"), NULL }, }; @@ -250,12 +300,12 @@ test (int set_no) /* a round of warmup */ babl_process (fish, src_data, dst_data, N_PIXELS/4); - start = babl_ticks (); + start = bench_ticks (); while (iters--) { babl_process (fish, src_data, dst_data, N_PIXELS); } - end = babl_ticks (); + end = bench_ticks (); fishes[n] = fish; mbps [n] = (N_PIXELS * ITERATIONS / 1000.0 / 1000.0) / ((end-start)/(1000.0*1000.0)); if (!unit_pixels) @@ -312,13 +362,13 @@ test (int set_no) else #endif - fprintf (stdout, "%d ", fishes[n]->fish_path.conversion_list->count); + fprintf (stdout, " %d ", fishes[n]->fish_path.conversion_list->count); } - fprintf (stdout, "%s to %s\t%.9f", + fprintf (stdout, "%.9f %s to %s ", + fishes[n]->fish.error, babl_get_name (formats[i]), - babl_get_name (formats[j]), - fishes[n]->fish.error); + babl_get_name (formats[j])); if (fishes[n]->class_type == BABL_FISH_PATH && show_details) {