Hello community, here is the log from the commit of package babl for openSUSE:Factory checked in at 2020-06-14 18:16:01 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/babl (Old) and /work/SRC/openSUSE:Factory/.babl.new.3606 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "babl" Sun Jun 14 18:16:01 2020 rev:51 rq:814101 version:0.1.78 Changes: -------- --- /work/SRC/openSUSE:Factory/babl/babl.changes 2020-02-14 16:26:05.483213997 +0100 +++ /work/SRC/openSUSE:Factory/.babl.new.3606/babl.changes 2020-06-14 18:16:04.646977446 +0200 @@ -1,0 +2,10 @@ +Thu Jun 11 06:53:18 UTC 2020 - Paolo Stivanin <[email protected]> + +- Update to version 0.1.78: + * Bugfix release - mutex and atomicity related issues. + * Wrap hue in HSV, HSL, HCY. Fix black pullout in non ICC CMYK + conversion. Added AV2 gamme u8->linear float conversions. VAPI file generation + for vala integration. Adjusted strategy for conversion selection, trades back + warm-up time for missing some fast multi-step conversions. + +------------------------------------------------------------------- Old: ---- babl-0.1.74.tar.xz New: ---- babl-0.1.78.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ babl.spec ++++++ --- /var/tmp/diff_new_pack.QyxPXf/_old 2020-06-14 18:16:05.250978996 +0200 +++ /var/tmp/diff_new_pack.QyxPXf/_new 2020-06-14 18:16:05.254979006 +0200 @@ -19,7 +19,7 @@ %define debug_package_requires libbabl-0_1-0 = %{version}-%{release} Name: babl -Version: 0.1.74 +Version: 0.1.78 Release: 0 Summary: Dynamic Pixel Format Translation Library License: LGPL-3.0-or-later AND GPL-3.0-or-later @@ -31,6 +31,7 @@ BuildRequires: meson >= 0.50.0 BuildRequires: pkgconfig +BuildRequires: vala BuildRequires: pkgconfig(gobject-introspection-1.0) BuildRequires: pkgconfig(lcms2) # None of these is needed for standard build: @@ -102,5 +103,8 @@ %{_libdir}/*.so %{_libdir}/pkgconfig/*.pc %{_datadir}/gir-1.0/Babl-0.1.gir +%dir %{_datadir}/vala/vapi +%{_datadir}/vala/vapi/babl-0.1.deps +%{_datadir}/vala/vapi/babl-0.1.vapi %changelog ++++++ babl-0.1.74.tar.xz -> babl-0.1.78.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babl-0.1.74/NEWS new/babl-0.1.78/NEWS --- old/babl-0.1.74/NEWS 2020-01-13 00:26:51.000000000 +0100 +++ new/babl-0.1.78/NEWS 2020-06-07 19:38:51.880586000 +0200 @@ -3,6 +3,15 @@ the news section both in the README and the webpage. --> +2020-06-07 babl-0.1.78 </dt><dd> +Bugfix release - mutex and atomicity related issues. + </dd><dt> +2020-05-27 babl-0.1.76 </dt><dd> +Wrap hue in HSV, HSL, HCY. Fix black pullout in non ICC CMYK +conversion. Added AV2 gamme u8->linear float conversions. VAPI file generation +for vala integration. Adjusted strategy for conversion selection, trades back +warm-up time for missing some fast multi-step conversions. + </dd><dt> 2019-08-22 babl-0.1.74 </dt><dd> Build fixes, improved host cpu detection, OSX fixes, clang warning squelches. 2019-08-22 babl-0.1.72 </dt><dd> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babl-0.1.74/babl/babl-cache.c new/babl-0.1.78/babl/babl-cache.c --- old/babl-0.1.74/babl/babl-cache.c 2020-01-13 00:26:51.000000000 +0100 +++ new/babl-0.1.78/babl/babl-cache.c 2020-06-07 19:38:51.880586000 +0200 @@ -129,7 +129,7 @@ n -= strlen (d);d += strlen (d); } - snprintf (d, n, " error=%f", fish->fish.error); + snprintf (d, n, " error=%.10f", fish->fish.error); n -= strlen (d);d += strlen (d); if (fish->class_type == BABL_FISH) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babl-0.1.74/babl/babl-conversion.c new/babl-0.1.78/babl/babl-conversion.c --- old/babl-0.1.74/babl/babl-conversion.c 2020-01-13 00:26:51.000000000 +0100 +++ new/babl-0.1.78/babl/babl-conversion.c 2020-06-07 19:38:51.880586000 +0200 @@ -487,7 +487,9 @@ conversion->error = 0.0000042; } - source = babl_calloc (test_pixels, fmt_source->format.bytes_per_pixel); + source = babl_calloc (test_pixels+1, fmt_source->format.bytes_per_pixel); + /* +1 is masking valgrind Invalid read of 16 + * false positives */ destination = babl_calloc (test_pixels, fmt_destination->format.bytes_per_pixel); ref_destination = babl_calloc (test_pixels, fmt_destination->format.bytes_per_pixel); destination_rgba_double = babl_calloc (test_pixels, fmt_rgba_double->format.bytes_per_pixel); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babl-0.1.74/babl/babl-fish-path.c new/babl-0.1.78/babl/babl-fish-path.c --- old/babl-0.1.74/babl/babl-fish-path.c 2020-01-13 00:26:51.000000000 +0100 +++ new/babl-0.1.78/babl/babl-fish-path.c 2020-06-07 19:38:51.880586000 +0200 @@ -145,11 +145,12 @@ if (env) max_length = atoi (env); else - max_length = 3; /* reducing this number makes finding short fishes much + max_length = 2; /* reducing this number makes finding short fishes much faster - even if we lose out on some of the fast - bigger fish, the fishes we can get with a max_length of 3 - is actually 5, since we deepen the search twice if no - sufficient results are found. + bigger fish, the fishes we can get with a max_length of 2 + is actually 5, since we deepen the search to that + depth if none are found within two steps in the + initial search. */ if (max_length > BABL_HARD_MAX_PATH_LENGTH) max_length = BABL_HARD_MAX_PATH_LENGTH; @@ -351,85 +352,85 @@ { if ((conv->source->format.space == sRGB) && (conv->destination->format.space == sRGB)) - { - switch (conv->instance.class_type) { - case BABL_CONVERSION_LINEAR: - babl_conversion_new ( - babl_format_with_space ( - (void*)conv->source->instance.name, (void*)space), - babl_format_with_space ( - (void*)conv->destination->instance.name, (void*)space), - "linear", conv->function.linear, - "data", conv->data, - NULL); - break; - case BABL_CONVERSION_PLANAR: - babl_conversion_new ( - babl_format_with_space ( - (void*)conv->source->instance.name, (void*)space), - babl_format_with_space ( - (void*)conv->destination->instance.name, (void*)space), - "planar", conv->function.planar, - "data", conv->data, - NULL); - break; - case BABL_CONVERSION_PLANE: - babl_conversion_new ( - babl_format_with_space ( - (void*)conv->source->instance.name, (void*)space), - babl_format_with_space ( - (void*)conv->destination->instance.name, (void*)space), - "plane", conv->function.plane, - "data", conv->data, - NULL); - break; - default: - break; + switch (conv->instance.class_type) + { + case BABL_CONVERSION_LINEAR: + babl_conversion_new ( + babl_format_with_space ( + (void*)conv->source->instance.name, (void*)space), + babl_format_with_space ( + (void*)conv->destination->instance.name, (void*)space), + "linear", conv->function.linear, + "data", conv->data, + NULL); + break; + case BABL_CONVERSION_PLANAR: + babl_conversion_new ( + babl_format_with_space ( + (void*)conv->source->instance.name, (void*)space), + babl_format_with_space ( + (void*)conv->destination->instance.name, (void*)space), + "planar", conv->function.planar, + "data", conv->data, + NULL); + break; + case BABL_CONVERSION_PLANE: + babl_conversion_new ( + babl_format_with_space ( + (void*)conv->source->instance.name, (void*)space), + babl_format_with_space ( + (void*)conv->destination->instance.name, (void*)space), + "plane", conv->function.plane, + "data", conv->data, + NULL); + break; + default: + break; + } } } - } else if ((conv->source->class_type == BABL_MODEL) && (conv->destination->class_type == BABL_MODEL)) { if ((conv->source->model.space == sRGB) && (conv->destination->model.space == sRGB)) - { - switch (conv->instance.class_type) { - case BABL_CONVERSION_LINEAR: - babl_conversion_new ( - babl_remodel_with_space ( - (void*)conv->source, (void*)space), - babl_remodel_with_space ( - (void*)conv->destination, (void*)space), - "linear", conv->function, - NULL); - break; - case BABL_CONVERSION_PLANAR: - babl_conversion_new ( - babl_remodel_with_space ( - (void*)conv->source, (void*)space), - babl_remodel_with_space ( - (void*)conv->destination, (void*)space), - "planar", conv->function, - NULL); - break; - case BABL_CONVERSION_PLANE: - babl_conversion_new ( - babl_remodel_with_space ( - (void*)conv->source, (void*)space), - babl_remodel_with_space ( - (void*)conv->destination, (void*)space), - "plane", conv->function, - NULL); - break; - default: - break; + switch (conv->instance.class_type) + { + case BABL_CONVERSION_LINEAR: + babl_conversion_new ( + babl_remodel_with_space ( + (void*)conv->source, (void*)space), + babl_remodel_with_space ( + (void*)conv->destination, (void*)space), + "linear", conv->function.linear, + NULL); + break; + case BABL_CONVERSION_PLANAR: + babl_conversion_new ( + babl_remodel_with_space ( + (void*)conv->source, (void*)space), + babl_remodel_with_space ( + (void*)conv->destination, (void*)space), + "planar", conv->function.planar, + NULL); + break; + case BABL_CONVERSION_PLANE: + babl_conversion_new ( + babl_remodel_with_space ( + (void*)conv->source, (void*)space), + babl_remodel_with_space ( + (void*)conv->destination, (void*)space), + "plane", conv->function.plane, + NULL); + break; + default: + break; + } } } - } else if ((conv->source->class_type == BABL_TYPE) && (conv->destination->class_type == BABL_TYPE)) @@ -453,7 +454,8 @@ babl->fish_path.source_bpp = babl_source->type.bits / 8; break; default: - babl_log ("=eeek{%i}\n", babl_source->instance.class_type - BABL_MAGIC); + babl_log ("=eeek{%i}\n", + babl_source->instance.class_type - BABL_MAGIC); } switch (babl_dest->instance.class_type) @@ -507,6 +509,15 @@ const Babl *sRGB = babl_space ("sRGB"); char name[BABL_MAX_NAME_LEN]; int is_fast = 0; + static int debug_missing = -1; + if (debug_missing < 0) + { + const char *val = getenv ("BABL_DEBUG_MISSING"); + if (val && strcmp (val, "0")) + debug_missing = 1; + else + debug_missing = 0; + } _babl_fish_create_name (name, source, destination, 1); babl_mutex_lock (babl_format_mutex); @@ -586,8 +597,13 @@ babl->fish_path.cost = BABL_MAX_COST_VALUE; babl->fish_path.conversion_list = babl_list_init_with_size (BABL_HARD_MAX_PATH_LENGTH); + { PathContext pc; + int start_depth = max_path_length (); + int end_depth = start_depth + 2 + ((destination->format.space != sRGB)?1:0); + end_depth = MIN(end_depth, BABL_HARD_MAX_PATH_LENGTH); + pc.current_path = babl_list_init_with_size (BABL_HARD_MAX_PATH_LENGTH); pc.fish_path = babl; pc.to_format = (Babl *) destination; @@ -599,52 +615,25 @@ */ babl_in_fish_path++; - get_conversion_path (&pc, (Babl *) source, 0, max_path_length (), tolerance); - -#if 0 - /* second attempt,. at path length + 1*/ - if (babl->fish_path.conversion_list->count == 0 && - max_path_length () + 1 <= BABL_HARD_MAX_PATH_LENGTH) + for (int max_depth = start_depth; + babl->fish_path.conversion_list->count == 0 && max_depth <= end_depth; + max_depth++) { - get_conversion_path (&pc, (Babl *) source, 0, max_path_length () + 1, tolerance); - -#if 0 - if (babl->fish_path.conversion_list->count) - { - fprintf (stderr, "babl is using a rather long chain, room exists for optimization here\n"); - babl_list_each (babl->fish_path.conversion_list, show_item, NULL); - } -#endif + get_conversion_path (&pc, (Babl *) source, 0, max_depth, tolerance); } -#endif - /* third attempt,. at path length + 2 */ - if (babl->fish_path.conversion_list->count == 0 && - max_path_length () + 2 <= BABL_HARD_MAX_PATH_LENGTH) + if (debug_missing) { - get_conversion_path (&pc, (Babl *) source, 0, max_path_length () + 2, tolerance); -#if 1 - if (babl->fish_path.conversion_list->count) - { - //fprintf (stderr, "babl is a long chain, should be optimized\n"); - //babl_list_each (babl->fish_path.conversion_list, show_item, NULL); - } + if (babl->fish_path.conversion_list->count == 0) + fprintf (stderr, "babl: WARNING lacking conversion path for %s to %s\n", + babl_get_name (source), babl_get_name (destination)); + else if (babl->fish_path.conversion_list->count == end_depth) + fprintf (stderr, "babl: WARNING need %i step conversion for %s to %s\n", end_depth, + babl_get_name (source), babl_get_name (destination)); else - { - static int show_missing = -1; - if (show_missing < 0) - { - const char *val = getenv ("BABL_DEBUG_MISSING"); - if (val && strcmp (val, "0")) - show_missing = 1; - else - show_missing = 0; - } - if (show_missing) - fprintf (stderr, "babl is lacking conversion for %s to %s\n", - babl_get_name (source), babl_get_name (destination)); - } -#endif + fprintf (stderr, "babl: found %i step conversion for %s to %s\n", + babl->fish_path.conversion_list->count, + babl_get_name (source), babl_get_name (destination)); } babl_in_fish_path--; @@ -656,11 +645,6 @@ babl_free (babl); babl_mutex_unlock (babl_format_mutex); - /* it is legitimate for reference paths to be faster than long chains - of paths, thus it is time to retire this warning. XXX: remove it fully - - _babl_fish_missing_fast_path_warning (source, destination); */ - return NULL; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babl-0.1.74/babl/babl-fish-reference.c new/babl-0.1.78/babl/babl-fish-reference.c --- old/babl-0.1.74/babl/babl-fish-reference.c 2020-01-13 00:26:51.000000000 +0100 +++ new/babl-0.1.78/babl/babl-fish-reference.c 2020-06-07 19:38:51.880586000 +0200 @@ -918,7 +918,7 @@ for (i = 0; i < n; i++) { /* A very naive conversion - but it is usable */ - double key=0.0; + double key=1.0; cmyka[i * 5 + 0] = 1.0 - rgba[i * 4 + 0]; cmyka[i * 5 + 1] = 1.0 - rgba[i * 4 + 1]; cmyka[i * 5 + 2] = 1.0 - rgba[i * 4 + 2]; @@ -1259,7 +1259,8 @@ } else { - source_float_buf_alloc = babl_malloc (sizeof (float) * n * + /* the +1 is to mask a valgrind 'invalid read of size 16' false positive */ + source_float_buf_alloc = babl_malloc (sizeof (float) * (n+1) * (BABL (babl->fish.source)->format.model->components)); source_float_buf = source_float_buf_alloc; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babl-0.1.74/babl/babl-mutex.h new/babl-0.1.78/babl/babl-mutex.h --- old/babl-0.1.74/babl/babl-mutex.h 2020-01-13 00:26:51.000000000 +0100 +++ new/babl-0.1.78/babl/babl-mutex.h 2020-06-07 19:38:51.884585900 +0200 @@ -20,7 +20,7 @@ #define _BABL_MUTEX_H #ifndef _WIN32 -#define __GNU_SOURCE 1 +#define _GNU_SOURCE 1 #include <pthread.h> #else #include <windows.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babl-0.1.74/babl/babl-palette.c new/babl-0.1.78/babl/babl-palette.c --- old/babl-0.1.74/babl/babl-palette.c 2020-01-13 00:26:51.000000000 +0100 +++ new/babl-0.1.78/babl/babl-palette.c 2020-06-07 19:38:51.884585900 +0200 @@ -27,6 +27,13 @@ #include "babl.h" #include "babl-memory.h" +#ifdef HAVE_STDATOMIC_H +#include <stdatomic.h> +#define BABL_ATOMIC _Atomic +#else +#define BABL_ATOMIC +#endif + #define HASH_TABLE_SIZE 1111 @@ -45,7 +52,7 @@ */ double *data_double; unsigned char *data_u8; - BablPaletteRadius *radii; + BablPaletteRadius *BABL_ATOMIC radii; volatile unsigned int hash[HASH_TABLE_SIZE]; } BablPalette; @@ -110,7 +117,8 @@ } static void -babl_palette_init_radii (BablPalette *pal) +babl_palette_init_radii (BablPalette *pal, + BablPaletteRadius *radii) { int i, j; @@ -122,12 +130,12 @@ for (i = 0; i < pal->count; i++) { - BablPaletteRadius *radii1 = pal->radii + (pal->count - 1) * i; + BablPaletteRadius *radii1 = radii + (pal->count - 1) * i; const unsigned char *p1 = pal->data_u8 + 4 * i; for (j = i + 1; j < pal->count; j++) { - BablPaletteRadius *radii2 = pal->radii + (pal->count - 1) * j; + BablPaletteRadius *radii2 = radii + (pal->count - 1) * j; const unsigned char *p2 = pal->data_u8 + 4 * j; unsigned short diff; @@ -145,6 +153,53 @@ } } +static BablPaletteRadius * +babl_palette_create_radii (BablPalette *pal) +{ + BablPaletteRadius *radii; + + radii = babl_malloc (sizeof (BablPaletteRadius) * + (pal->count - 1) * + pal->count); + + babl_palette_init_radii (pal, radii); + + return radii; +} + +static const BablPaletteRadius * +babl_palette_get_radii (BablPalette *pal, + int entry) +{ + BablPaletteRadius *radii; + +#ifdef HAVE_STDATOMIC_H + radii = atomic_load_explicit (&pal->radii, memory_order_consume); + + if (! radii) + { + BablPaletteRadius *existing_radii; + + existing_radii = NULL; + radii = babl_palette_create_radii (pal); + + if (! atomic_compare_exchange_strong_explicit (&pal->radii, + &existing_radii, radii, + memory_order_acq_rel, + memory_order_consume)) + { + babl_free (radii); + + radii = existing_radii; + } + } +#else + radii = pal->radii; +#endif + + return radii + (pal->count - 1) * entry; +} + static void babl_palette_reset_hash (BablPalette *pal) { @@ -181,7 +236,7 @@ } else { - const BablPaletteRadius *radii = pal->radii + (pal->count - 1) * best_idx; + const BablPaletteRadius *radii = babl_palette_get_radii (pal, best_idx); const unsigned char *q; int best_diff2; int best_diff; @@ -240,9 +295,9 @@ } static BablPalette * -make_pal (const Babl *pal_space, - const Babl *format, - const void *data, +make_pal (const Babl *pal_space, + const Babl *format, + const void *data, int count) { BablPalette *pal = NULL; @@ -256,9 +311,7 @@ pal->data = babl_malloc (bpp * count); pal->data_double = babl_malloc (4 * sizeof(double) * count); pal->data_u8 = babl_malloc (4 * sizeof(char) * count); - pal->radii = babl_malloc (sizeof (BablPaletteRadius) * - (pal->count - 1) * - pal->count); + pal->radii = NULL; memcpy (pal->data, data, bpp * count); @@ -267,14 +320,16 @@ babl_process (babl_fish (format, babl_format_with_space ("R'G'B'A u8", pal_space)), data, pal->data_u8, count); - babl_palette_init_radii (pal); +#ifndef HAVE_STDATOMIC_H + pal->radii = babl_palette_create_radii (pal); +#endif babl_palette_reset_hash (pal); return pal; } -static void +static void babl_palette_free (BablPalette *pal) { babl_free (pal->data); @@ -315,7 +370,7 @@ babl_process (babl_fish (pal.format, babl_format ("RGBA double")), pal.data, pal.data_double, pal.count); - babl_palette_init_radii (&pal); + babl_palette_init_radii (&pal, pal.radii); babl_palette_reset_hash (&pal); @@ -680,8 +735,8 @@ static inline long conv_pal8_pala8 (Babl *conversion, - unsigned char *src, - unsigned char *dst, + unsigned char *src, + unsigned char *dst, long samples) { long n = samples; @@ -698,8 +753,8 @@ static inline long conv_pala8_pal8 (Babl *conversion, - unsigned char *src, - unsigned char *dst, + unsigned char *src, + unsigned char *dst, long samples) { long n = samples; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babl-0.1.74/babl/git-version.h new/babl-0.1.78/babl/git-version.h --- old/babl-0.1.74/babl/git-version.h 2020-01-13 00:26:51.000000000 +0100 +++ new/babl-0.1.78/babl/git-version.h 2020-06-07 19:38:52.256591800 +0200 @@ -1,6 +1,6 @@ #ifndef __GIT_VERSION_H__ #define __GIT_VERSION_H__ -#define BABL_GIT_VERSION "BABL_0_1_74" +#define BABL_GIT_VERSION "BABL_0_1_76-5-g24c3666" #endif /* __GIT_VERSION_H__ */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babl-0.1.74/babl/meson.build new/babl-0.1.78/babl/meson.build --- old/babl-0.1.74/babl/meson.build 2020-01-13 00:26:51.000000000 +0100 +++ new/babl-0.1.78/babl/meson.build 2020-06-07 19:38:51.892586000 +0200 @@ -161,4 +161,11 @@ header: 'babl.h', install: true, ) + + if get_option('enable-vapi') + gnome.generate_vapi(lib_name, + sources: babl_gir[0], + install: true, + ) + endif endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babl-0.1.74/extensions/HCY.c new/babl-0.1.78/extensions/HCY.c --- old/babl-0.1.74/extensions/HCY.c 2020-01-13 00:26:51.000000000 +0100 +++ new/babl-0.1.78/extensions/HCY.c 2020-06-07 19:38:51.900586100 +0200 @@ -232,8 +232,11 @@ if(chroma < EPSILON) { red = green = blue = luma; } else { - hue *= 6.; - H_sec = (int)hue; + hue = fmod (hue, 1.0); + hue += hue < 0.0; + hue *= 6.0; + + H_sec = (int) hue; switch (H_sec) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babl-0.1.74/extensions/HSL.c new/babl-0.1.78/extensions/HSL.c --- old/babl-0.1.74/extensions/HSL.c 2020-01-13 00:26:51.000000000 +0100 +++ new/babl-0.1.78/extensions/HSL.c 2020-06-07 19:38:51.900586100 +0200 @@ -251,6 +251,9 @@ double p = 2 * lightness - q; + hue = fmod (hue, 1.0); + hue += hue < 0.0; + red = hue2cpn (p, q, hue + 1.0/3.0); green = hue2cpn (p, q, hue); blue = hue2cpn (p, q, hue - 1.0/3.0); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babl-0.1.74/extensions/HSV.c new/babl-0.1.78/extensions/HSV.c --- old/babl-0.1.74/extensions/HSV.c 2020-01-13 00:26:51.000000000 +0100 +++ new/babl-0.1.78/extensions/HSV.c 2020-06-07 19:38:51.900586100 +0200 @@ -242,7 +242,11 @@ double chroma, h_tmp, x, min; chroma = saturation * value; - h_tmp = hue * 6.0; + + h_tmp = fmod (hue, 1.0); + h_tmp += h_tmp < 0.0; + h_tmp *= 6.0; + x = chroma * (1.0 - fabs (fmod (h_tmp, 2.0) - 1.0)); if (h_tmp < 1.0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babl-0.1.74/extensions/avx2-int8-tables.h new/babl-0.1.78/extensions/avx2-int8-tables.h --- old/babl-0.1.74/extensions/avx2-int8-tables.h 2020-01-13 00:26:51.000000000 +0100 +++ new/babl-0.1.78/extensions/avx2-int8-tables.h 2020-06-07 19:38:51.900586100 +0200 @@ -201,7 +201,7 @@ 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, - 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, + 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, @@ -517,7 +517,7 @@ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, 100, 100, 100, 100, 100, 100, 100, 100, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, @@ -1066,7 +1066,7 @@ 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, -139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 140, 140, 140, +139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, @@ -1187,7 +1187,7 @@ 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -146, 146, 146, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, +146, 146, 146, 146, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, @@ -4098,3 +4098,520 @@ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }; + +static const float gamma_to_linear[512] = +{ +0x0p+0, +0x1.3e45677c176f7p-12, +0x1.3e45677c176f7p-11, +0x1.dd681b3a23272p-11, +0x1.3e45677c176f7p-10, +0x1.8dd6c15b1d4b4p-10, +0x1.dd681b3a23272p-10, +0x1.167cba8c94818p-9, +0x1.3e45677c176f7p-9, +0x1.660e146b9a5d5p-9, +0x1.8dd6c15b1d4b4p-9, +0x1.b6a31b5259c99p-9, +0x1.e1e31d70c99ddp-9, +0x1.07c38bf8583a9p-8, +0x1.1fcc2beed6421p-8, +0x1.390ffaf95e279p-8, +0x1.53936cc7bc928p-8, +0x1.6f5addb50c915p-8, +0x1.8c6a94031b561p-8, +0x1.aac6c0fb97351p-8, +0x1.ca7381f9f602bp-8, +0x1.eb74e160978dp-8, +0x1.06e76bbda92b8p-7, +0x1.18c2a5a8a8044p-7, +0x1.2b4e09b3f0ae3p-7, +0x1.3e8b7b3bde965p-7, +0x1.527cd60af8b85p-7, +0x1.6723eea8d3709p-7, +0x1.7c8292a3db6b3p-7, +0x1.929a88d67b521p-7, +0x1.a96d91a8016bdp-7, +0x1.c0fd67499fab6p-7, +0x1.d94bbdefd740ep-7, +0x1.f25a44089883fp-7, +0x1.061551372c694p-6, +0x1.135f3e4c2cce2p-6, +0x1.210bb8642b172p-6, +0x1.2f1b8c1ae46bdp-6, +0x1.3d8f839b79c0bp-6, +0x1.4c6866b3e9fa4p-6, +0x1.5ba6fae794313p-6, +0x1.6b4c0380d2deep-6, +0x1.7b5841a1bf3acp-6, +0x1.8bcc74542addbp-6, +0x1.9ca95898dc8b5p-6, +0x1.adefa9761c02p-6, +0x1.bfa0200597bd9p-6, +0x1.d1bb7381aec1fp-6, +0x1.e442595227bcap-6, +0x1.f73585185e1b5p-6, +0x1.054ad45d76878p-5, +0x1.0f31ba386ff26p-5, +0x1.194fcb663747bp-5, +0x1.23a55e62a662ap-5, +0x1.2e32c8e148d11p-5, +0x1.38f85fd21eacfp-5, +0x1.43f67766310ffp-5, +0x1.4f2d6313fa8dp-5, +0x1.5a9d759ba5edp-5, +0x1.6647010b254eep-5, +0x1.722a56c2239eep-5, +0x1.7e47c775d2427p-5, +0x1.8a9fa33494b07p-5, +0x1.973239698b9ccp-5, +0x1.a3ffd8e001389p-5, +0x1.b108cfc6b7fbcp-5, +0x1.be4d6bb31d522p-5, +0x1.cbcdf9a4616f2p-5, +0x1.d98ac60675833p-5, +0x1.e7841cb4f16dfp-5, +0x1.f5ba48fde2048p-5, +0x1.0216cad240765p-4, +0x1.096f2671eb815p-4, +0x1.10e65c38a5192p-4, +0x1.187c90bf8bce2p-4, +0x1.2031e85f5d6dap-4, +0x1.28068731a1952p-4, +0x1.2ffa9111cb94bp-4, +0x1.380e299e53f92p-4, +0x1.40417439ca10fp-4, +0x1.4894940bddbfbp-4, +0x1.5107ac0261e59p-4, +0x1.599aded247aacp-4, +0x1.624e4ef892ed4p-4, +0x1.6b221ebb4817ep-4, +0x1.7416702a539d1p-4, +0x1.7d2b65206b527p-4, +0x1.86611f43e9e6ap-4, +0x1.8fb7c007a4a7p-4, +0x1.992f68abbbc89p-4, +0x1.a2c83a3e6566dp-4, +0x1.ac82559cb3644p-4, +0x1.b65ddb7354604p-4, +0x1.c05aec3f4fe5ep-4, +0x1.ca79a84ebe03p-4, +0x1.d4ba2fc17a6a5p-4, +0x1.df1ca289d34b8p-4, +0x1.e9a1206d34003p-4, +0x1.f447c904cbb4ep-4, +0x1.ff10bbbe302c2p-4, +0x1.04fe0bedfe5f1p-3, +0x1.0a84fe3b36d8fp-3, +0x1.101d443dfc06fp-3, +0x1.15c6ed58eefdfp-3, +0x1.1b8208da5fefp-3, +0x1.214ea5fc9514ap-3, +0x1.272cd3e610123p-3, +0x1.2d1ca1a9d1cfbp-3, +0x1.331e1e479cdf5p-3, +0x1.393158ac3674ep-3, +0x1.3f565fb1a5fd5p-3, +0x1.458d421f735dfp-3, +0x1.4bd60eaae3e73p-3, +0x1.5230d3f736034p-3, +0x1.589da095dbaa1p-3, +0x1.5f1c8306b3a3cp-3, +0x1.65ad89b841a2bp-3, +0x1.6c50c307e53bfp-3, +0x1.73063d420fc8p-3, +0x1.79ce06a279303p-3, +0x1.80a82d5453b5dp-3, +0x1.8794bf727eb3fp-3, +0x1.8e93cb07b8679p-3, +0x1.95a55e0ecec0bp-3, +0x1.9cc98672cf47ep-3, +0x1.a400520f3619cp-3, +0x1.ab49ceb01c003p-3, +0x1.b2a60a1263b0ap-3, +0x1.ba1511e3e632dp-3, +0x1.c196f3c39e76fp-3, +0x1.c92bbd41d41fep-3, +0x1.d0d37be045851p-3, +0x1.d88e3d1250f68p-3, +0x1.e05c0e3d1d3ep-3, +0x1.e83cfcb7c16fp-3, +0x1.f03115cb6bfd3p-3, +0x1.f83866b38924dp-3, +0x1.00297e4ef4553p-2, +0x1.044072557177ap-2, +0x1.086115f6beb3ap-2, +0x1.0c8b6fb5c735ep-2, +0x1.10bf860ef039ap-2, +0x1.14fd5f782a5a6p-2, +0x1.1945026102997p-2, +0x1.1d967532b31b1p-2, +0x1.21f1be50339e7p-2, +0x1.2656e41649ae3p-2, +0x1.2ac5ecdb988f8p-2, +0x1.2f3edef0b0ed8p-2, +0x1.33c1c0a020438p-2, +0x1.384e982e800b1p-2, +0x1.3ce56bda84a81p-2, +0x1.418641dd0c1bcp-2, +0x1.463120692c7afp-2, +0x1.4ae60dac4229dp-2, +0x1.4fa50fcdfde15p-2, +0x1.546e2cf0727a9p-2, +0x1.59416b3022858p-2, +0x1.5e1ed0a40daabp-2, +0x1.6306635dbdd7bp-2, +0x1.67f82969543a2p-2, +0x1.6cf428cd96079p-2, +0x1.71fa678bf915dp-2, +0x1.770aeba0b042ap-2, +0x1.7c25bb02b7ac5p-2, +0x1.814adba3e0bd9p-2, +0x1.867a5370de0b1p-2, +0x1.8bb428514f067p-2, +0x1.90f86027cb84ep-2, +0x1.964700d1ef1b1p-2, +0x1.9ba0102864521p-2, +0x1.a10393feefafdp-2, +0x1.a67192247a9bep-2, +0x1.abea10631e195p-2, +0x1.b16d14802d5cap-2, +0x1.b6faa43c403bbp-2, +0x1.bc92c5533d785p-2, +0x1.c2357d7c64e5dp-2, +0x1.c7e2d26a596dep-2, +0x1.cd9ac9cb2aef2p-2, +0x1.d35d69485ffc5p-2, +0x1.d92ab686ff782p-2, +0x1.df02b7279a10dp-2, +0x1.e4e570c6539c5p-2, +0x1.ead2e8faec526p-2, +0x1.f0cb2558c9ea4p-2, +0x1.f6ce2b6f00983p-2, +0x1.fcdc00c85bec2p-2, +0x1.017a5575b3cb2p-1, +0x1.048c17ad3c04bp-1, +0x1.07a349c9d9837p-1, +0x1.0abfee888c05p-1, +0x1.0de208a4444c8p-1, +0x1.11099ad5e83ebp-1, +0x1.1436a7d456eefp-1, +0x1.176932546ca12p-1, +0x1.1aa13d0906bdap-1, +0x1.1ddecaa307b85p-1, +0x1.2121ddd15aecep-1, +0x1.246a7940f86d1p-1, +0x1.27b89f9ce8c4bp-1, +0x1.2b0c538e48b07p-1, +0x1.2e6597bc4ccap-1, +0x1.31c46ecc4528dp-1, +0x1.3528db61a0f73p-1, +0x1.3892e01df1fccp-1, +0x1.3c027fa0f01ebp-1, +0x1.3f77bc887cd3bp-1, +0x1.42f29970a68f8p-1, +0x1.467318f3ac22dp-1, +0x1.49f93daa00113p-1, +0x1.4d850a2a4bde1p-1, +0x1.51168109734e5p-1, +0x1.54ada4da97a1bp-1, +0x1.584a782f1ac23p-1, +0x1.5becfd96a2698p-1, +0x1.5f95379f1b3edp-1, +0x1.634328d4bbe97p-1, +0x1.66f6d3c2081cfp-1, +0x1.6ab03aefd39aap-1, +0x1.6e6f60e5452b1p-1, +0x1.72344827d98f6p-1, +0x1.75fef33b6669bp-1, +0x1.79cf64a21d1e2p-1, +0x1.7da59edc8dabp-1, +0x1.8181a469a9787p-1, +0x1.856377c6c6224p-1, +0x1.894b1b6fa0377p-1, +0x1.8d3891de5df49p-1, +0x1.912bdd8b91f45p-1, +0x1.952500ee3dda5p-1, +0x1.9923fe7bd4f67p-1, +0x1.9d28d8a83edfcp-1, +0x1.a13391e5da09fp-1, +0x1.a5442ca57e52ep-1, +0x1.a95aab567f88fp-1, +0x1.ad771066afec2p-1, +0x1.b1995e4262a69p-1, +0x1.b5c197546e3f8p-1, +0x1.b9efbe062f086p-1, +0x1.be23d4bf8981bp-1, +0x1.c25ddde6ecbbbp-1, +0x1.c69ddbe154af1p-1, +0x1.cae3d1124c90bp-1, +0x1.cf2fbfdbf11f1p-1, +0x1.d381aa9ef2e82p-1, +0x1.d7d993ba988d4p-1, +0x1.dc377d8cc0fd5p-1, +0x1.e09b6a71e5aa6p-1, +0x1.e5055cc51cbb4p-1, +0x1.e97556e01b351p-1, +0x1.edeb5b1b37216p-1, +0x1.f2676bcd69adep-1, +0x1.f6e98b4c51466p-1, +0x1.fb71bbec33ab2p-1, +0x1p+0, + +0x0p+0, +0x1.010101010101p-8, +0x1.010101010101p-7, +0x1.8181818181818p-7, +0x1.010101010101p-6, +0x1.4141414141414p-6, +0x1.8181818181818p-6, +0x1.c1c1c1c1c1c1cp-6, +0x1.010101010101p-5, +0x1.2121212121212p-5, +0x1.4141414141414p-5, +0x1.6161616161616p-5, +0x1.8181818181818p-5, +0x1.a1a1a1a1a1a1ap-5, +0x1.c1c1c1c1c1c1cp-5, +0x1.e1e1e1e1e1e1ep-5, +0x1.010101010101p-4, +0x1.1111111111111p-4, +0x1.2121212121212p-4, +0x1.3131313131313p-4, +0x1.4141414141414p-4, +0x1.5151515151515p-4, +0x1.6161616161616p-4, +0x1.7171717171717p-4, +0x1.8181818181818p-4, +0x1.9191919191919p-4, +0x1.a1a1a1a1a1a1ap-4, +0x1.b1b1b1b1b1b1bp-4, +0x1.c1c1c1c1c1c1cp-4, +0x1.d1d1d1d1d1d1dp-4, +0x1.e1e1e1e1e1e1ep-4, +0x1.f1f1f1f1f1f1fp-4, +0x1.010101010101p-3, +0x1.0909090909091p-3, +0x1.1111111111111p-3, +0x1.1919191919192p-3, +0x1.2121212121212p-3, +0x1.2929292929293p-3, +0x1.3131313131313p-3, +0x1.3939393939394p-3, +0x1.4141414141414p-3, +0x1.4949494949495p-3, +0x1.5151515151515p-3, +0x1.5959595959596p-3, +0x1.6161616161616p-3, +0x1.6969696969697p-3, +0x1.7171717171717p-3, +0x1.7979797979798p-3, +0x1.8181818181818p-3, +0x1.8989898989899p-3, +0x1.9191919191919p-3, +0x1.999999999999ap-3, +0x1.a1a1a1a1a1a1ap-3, +0x1.a9a9a9a9a9a9bp-3, +0x1.b1b1b1b1b1b1bp-3, +0x1.b9b9b9b9b9b9cp-3, +0x1.c1c1c1c1c1c1cp-3, +0x1.c9c9c9c9c9c9dp-3, +0x1.d1d1d1d1d1d1dp-3, +0x1.d9d9d9d9d9d9ep-3, +0x1.e1e1e1e1e1e1ep-3, +0x1.e9e9e9e9e9e9fp-3, +0x1.f1f1f1f1f1f1fp-3, +0x1.f9f9f9f9f9fap-3, +0x1.010101010101p-2, +0x1.050505050505p-2, +0x1.0909090909091p-2, +0x1.0d0d0d0d0d0d1p-2, +0x1.1111111111111p-2, +0x1.1515151515151p-2, +0x1.1919191919192p-2, +0x1.1d1d1d1d1d1d2p-2, +0x1.2121212121212p-2, +0x1.2525252525252p-2, +0x1.2929292929293p-2, +0x1.2d2d2d2d2d2d3p-2, +0x1.3131313131313p-2, +0x1.3535353535353p-2, +0x1.3939393939394p-2, +0x1.3d3d3d3d3d3d4p-2, +0x1.4141414141414p-2, +0x1.4545454545454p-2, +0x1.4949494949495p-2, +0x1.4d4d4d4d4d4d5p-2, +0x1.5151515151515p-2, +0x1.5555555555555p-2, +0x1.5959595959596p-2, +0x1.5d5d5d5d5d5d6p-2, +0x1.6161616161616p-2, +0x1.6565656565656p-2, +0x1.6969696969697p-2, +0x1.6d6d6d6d6d6d7p-2, +0x1.7171717171717p-2, +0x1.7575757575757p-2, +0x1.7979797979798p-2, +0x1.7d7d7d7d7d7d8p-2, +0x1.8181818181818p-2, +0x1.8585858585858p-2, +0x1.8989898989899p-2, +0x1.8d8d8d8d8d8d9p-2, +0x1.9191919191919p-2, +0x1.9595959595959p-2, +0x1.999999999999ap-2, +0x1.9d9d9d9d9d9dap-2, +0x1.a1a1a1a1a1a1ap-2, +0x1.a5a5a5a5a5a5ap-2, +0x1.a9a9a9a9a9a9bp-2, +0x1.adadadadadadbp-2, +0x1.b1b1b1b1b1b1bp-2, +0x1.b5b5b5b5b5b5bp-2, +0x1.b9b9b9b9b9b9cp-2, +0x1.bdbdbdbdbdbdcp-2, +0x1.c1c1c1c1c1c1cp-2, +0x1.c5c5c5c5c5c5cp-2, +0x1.c9c9c9c9c9c9dp-2, +0x1.cdcdcdcdcdcddp-2, +0x1.d1d1d1d1d1d1dp-2, +0x1.d5d5d5d5d5d5dp-2, +0x1.d9d9d9d9d9d9ep-2, +0x1.ddddddddddddep-2, +0x1.e1e1e1e1e1e1ep-2, +0x1.e5e5e5e5e5e5ep-2, +0x1.e9e9e9e9e9e9fp-2, +0x1.ededededededfp-2, +0x1.f1f1f1f1f1f1fp-2, +0x1.f5f5f5f5f5f5fp-2, +0x1.f9f9f9f9f9fap-2, +0x1.fdfdfdfdfdfep-2, +0x1.010101010101p-1, +0x1.030303030303p-1, +0x1.050505050505p-1, +0x1.070707070707p-1, +0x1.0909090909091p-1, +0x1.0b0b0b0b0b0b1p-1, +0x1.0d0d0d0d0d0d1p-1, +0x1.0f0f0f0f0f0f1p-1, +0x1.1111111111111p-1, +0x1.1313131313131p-1, +0x1.1515151515151p-1, +0x1.1717171717171p-1, +0x1.1919191919192p-1, +0x1.1b1b1b1b1b1b2p-1, +0x1.1d1d1d1d1d1d2p-1, +0x1.1f1f1f1f1f1f2p-1, +0x1.2121212121212p-1, +0x1.2323232323232p-1, +0x1.2525252525252p-1, +0x1.2727272727272p-1, +0x1.2929292929293p-1, +0x1.2b2b2b2b2b2b3p-1, +0x1.2d2d2d2d2d2d3p-1, +0x1.2f2f2f2f2f2f3p-1, +0x1.3131313131313p-1, +0x1.3333333333333p-1, +0x1.3535353535353p-1, +0x1.3737373737373p-1, +0x1.3939393939394p-1, +0x1.3b3b3b3b3b3b4p-1, +0x1.3d3d3d3d3d3d4p-1, +0x1.3f3f3f3f3f3f4p-1, +0x1.4141414141414p-1, +0x1.4343434343434p-1, +0x1.4545454545454p-1, +0x1.4747474747474p-1, +0x1.4949494949495p-1, +0x1.4b4b4b4b4b4b5p-1, +0x1.4d4d4d4d4d4d5p-1, +0x1.4f4f4f4f4f4f5p-1, +0x1.5151515151515p-1, +0x1.5353535353535p-1, +0x1.5555555555555p-1, +0x1.5757575757575p-1, +0x1.5959595959596p-1, +0x1.5b5b5b5b5b5b6p-1, +0x1.5d5d5d5d5d5d6p-1, +0x1.5f5f5f5f5f5f6p-1, +0x1.6161616161616p-1, +0x1.6363636363636p-1, +0x1.6565656565656p-1, +0x1.6767676767676p-1, +0x1.6969696969697p-1, +0x1.6b6b6b6b6b6b7p-1, +0x1.6d6d6d6d6d6d7p-1, +0x1.6f6f6f6f6f6f7p-1, +0x1.7171717171717p-1, +0x1.7373737373737p-1, +0x1.7575757575757p-1, +0x1.7777777777777p-1, +0x1.7979797979798p-1, +0x1.7b7b7b7b7b7b8p-1, +0x1.7d7d7d7d7d7d8p-1, +0x1.7f7f7f7f7f7f8p-1, +0x1.8181818181818p-1, +0x1.8383838383838p-1, +0x1.8585858585858p-1, +0x1.8787878787878p-1, +0x1.8989898989899p-1, +0x1.8b8b8b8b8b8b9p-1, +0x1.8d8d8d8d8d8d9p-1, +0x1.8f8f8f8f8f8f9p-1, +0x1.9191919191919p-1, +0x1.9393939393939p-1, +0x1.9595959595959p-1, +0x1.9797979797979p-1, +0x1.999999999999ap-1, +0x1.9b9b9b9b9b9bap-1, +0x1.9d9d9d9d9d9dap-1, +0x1.9f9f9f9f9f9fap-1, +0x1.a1a1a1a1a1a1ap-1, +0x1.a3a3a3a3a3a3ap-1, +0x1.a5a5a5a5a5a5ap-1, +0x1.a7a7a7a7a7a7ap-1, +0x1.a9a9a9a9a9a9bp-1, +0x1.ababababababbp-1, +0x1.adadadadadadbp-1, +0x1.afafafafafafbp-1, +0x1.b1b1b1b1b1b1bp-1, +0x1.b3b3b3b3b3b3bp-1, +0x1.b5b5b5b5b5b5bp-1, +0x1.b7b7b7b7b7b7bp-1, +0x1.b9b9b9b9b9b9cp-1, +0x1.bbbbbbbbbbbbcp-1, +0x1.bdbdbdbdbdbdcp-1, +0x1.bfbfbfbfbfbfcp-1, +0x1.c1c1c1c1c1c1cp-1, +0x1.c3c3c3c3c3c3cp-1, +0x1.c5c5c5c5c5c5cp-1, +0x1.c7c7c7c7c7c7cp-1, +0x1.c9c9c9c9c9c9dp-1, +0x1.cbcbcbcbcbcbdp-1, +0x1.cdcdcdcdcdcddp-1, +0x1.cfcfcfcfcfcfdp-1, +0x1.d1d1d1d1d1d1dp-1, +0x1.d3d3d3d3d3d3dp-1, +0x1.d5d5d5d5d5d5dp-1, +0x1.d7d7d7d7d7d7dp-1, +0x1.d9d9d9d9d9d9ep-1, +0x1.dbdbdbdbdbdbep-1, +0x1.ddddddddddddep-1, +0x1.dfdfdfdfdfdfep-1, +0x1.e1e1e1e1e1e1ep-1, +0x1.e3e3e3e3e3e3ep-1, +0x1.e5e5e5e5e5e5ep-1, +0x1.e7e7e7e7e7e7ep-1, +0x1.e9e9e9e9e9e9fp-1, +0x1.ebebebebebebfp-1, +0x1.ededededededfp-1, +0x1.efefefefefeffp-1, +0x1.f1f1f1f1f1f1fp-1, +0x1.f3f3f3f3f3f3fp-1, +0x1.f5f5f5f5f5f5fp-1, +0x1.f7f7f7f7f7f7fp-1, +0x1.f9f9f9f9f9fap-1, +0x1.fbfbfbfbfbfcp-1, +0x1.fdfdfdfdfdfep-1, +0x1p+0 +}; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babl-0.1.74/extensions/avx2-int8.c new/babl-0.1.78/extensions/avx2-int8.c --- old/babl-0.1.74/extensions/avx2-int8.c 2020-01-13 00:26:51.000000000 +0100 +++ new/babl-0.1.78/extensions/avx2-int8.c 2020-06-07 19:38:51.900586100 +0200 @@ -338,6 +338,184 @@ #undef CVT1 #undef CVTA1 +#define CVT1(src, dst) \ + (*dst++ = gamma_to_linear[*src++]) + +#define CVTA1(src, dst) \ + (*dst++ = gamma_to_linear[*src++ + 256]) + +static inline void +conv_y8_gamma_yF_linear (const Babl *conversion, + const uint8_t *src, + float *dst, + long samples) +{ + const __m128i *src_vec; + __v8sf *dst_vec; + + while ((uintptr_t) dst % 32 && samples > 0) + { + CVT1 (src, dst); + + samples--; + } + + src_vec = (const __m128i *) src; + dst_vec = (__v8sf *) dst; + + while (samples >= 16) + { + __m128i i8_01; + __m256i i32_0; + + i8_01 = _mm_loadu_si128 (src_vec++); + + i32_0 = _mm256_cvtepu8_epi32 (i8_01); + *dst_vec++ = _mm256_i32gather_ps (gamma_to_linear, i32_0, 4); + + i8_01 = _mm_shuffle_epi32 (i8_01, _MM_SHUFFLE (1, 0, 3, 2)); + + i32_0 = _mm256_cvtepu8_epi32 (i8_01); + *dst_vec++ = _mm256_i32gather_ps (gamma_to_linear, i32_0, 4); + + samples -= 16; + } + + src = (const uint8_t *) src_vec; + dst = (float *) dst_vec; + + while (samples > 0) + { + CVT1 (src, dst); + + samples--; + } +} + +static inline void +conv_ya8_gamma_yaF_linear (const Babl *conversion, + const uint8_t *src, + float *dst, + long samples) +{ + const __m128i *src_vec; + __v8sf *dst_vec; + const __m256i offset = _mm256_setr_epi32 (0, 256, 0, 256, + 0, 256, 0, 256); + + while ((uintptr_t) dst % 32 && samples > 0) + { + CVT1 (src, dst); + CVTA1 (src, dst); + + samples--; + } + + src_vec = (const __m128i *) src; + dst_vec = (__v8sf *) dst; + + while (samples >= 8) + { + __m128i i8_01; + __m256i i32_0; + + i8_01 = _mm_loadu_si128 (src_vec++); + + i32_0 = _mm256_cvtepu8_epi32 (i8_01); + i32_0 += offset; + *dst_vec++ = _mm256_i32gather_ps (gamma_to_linear, i32_0, 4); + + i8_01 = _mm_shuffle_epi32 (i8_01, _MM_SHUFFLE (1, 0, 3, 2)); + + i32_0 = _mm256_cvtepu8_epi32 (i8_01); + i32_0 += offset; + *dst_vec++ = _mm256_i32gather_ps (gamma_to_linear, i32_0, 4); + + samples -= 8; + } + + src = (const uint8_t *) src_vec; + dst = (float *) dst_vec; + + while (samples > 0) + { + CVT1 (src, dst); + CVTA1 (src, dst); + + samples--; + } +} + +static inline void +conv_rgb8_gamma_rgbF_linear (const Babl *conversion, + const uint8_t *src, + float *dst, + long samples) +{ + conv_y8_gamma_yF_linear (conversion, src, dst, 3 * samples); +} + +static inline void +conv_rgba8_gamma_rgbaF_linear (const Babl *conversion, + const uint8_t *src, + float *dst, + long samples) +{ + const __m128i *src_vec; + __v8sf *dst_vec; + const __m256i offset = _mm256_setr_epi32 (0, 0, 0, 256, + 0, 0, 0, 256); + + while ((uintptr_t) dst % 32 && samples > 0) + { + CVT1 (src, dst); + CVT1 (src, dst); + CVT1 (src, dst); + CVTA1 (src, dst); + + samples--; + } + + src_vec = (const __m128i *) src; + dst_vec = (__v8sf *) dst; + + while (samples >= 4) + { + __m128i i8_01; + __m256i i32_0; + + i8_01 = _mm_loadu_si128 (src_vec++); + + i32_0 = _mm256_cvtepu8_epi32 (i8_01); + i32_0 += offset; + *dst_vec++ = _mm256_i32gather_ps (gamma_to_linear, i32_0, 4); + + i8_01 = _mm_shuffle_epi32 (i8_01, _MM_SHUFFLE (1, 0, 3, 2)); + + i32_0 = _mm256_cvtepu8_epi32 (i8_01); + i32_0 += offset; + *dst_vec++ = _mm256_i32gather_ps (gamma_to_linear, i32_0, 4); + + samples -= 4; + } + + src = (const uint8_t *) src_vec; + dst = (float *) dst_vec; + + while (samples > 0) + { + CVT1 (src, dst); + CVT1 (src, dst); + CVT1 (src, dst); + CVTA1 (src, dst); + + samples--; + } +} + +#undef CVT1 +#undef CVTA1 + #endif /* defined(USE_AVX2) */ int init (void); @@ -408,6 +586,12 @@ "linear", \ conv_ ## src ## _linear_ ## dst ## _gamma, \ NULL); \ + \ + babl_conversion_new (dst ## _gamma, \ + src ## _linear, \ + "linear", \ + conv_ ## dst ## _gamma_ ## src ## _linear, \ + NULL); \ } \ while (0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babl-0.1.74/meson.build new/babl-0.1.78/meson.build --- old/babl-0.1.74/meson.build 2020-01-13 00:26:51.000000000 +0100 +++ new/babl-0.1.78/meson.build 2020-06-07 19:38:51.908586300 +0200 @@ -1,6 +1,6 @@ project('babl', 'c', license: 'LGPL3+', - version: '0.1.74', + version: '0.1.78', meson_version: '>=0.50.0', default_options: [ 'sysconfdir=/etc', @@ -260,6 +260,7 @@ # Check headers check_headers = [ + ['HAVE_STDATOMIC_H', 'stdatomic.h'] ] # Don't check for dynamic load on windows if not platform_win32 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babl-0.1.74/meson_options.txt new/babl-0.1.78/meson_options.txt --- old/babl-0.1.74/meson_options.txt 2020-01-13 00:26:51.000000000 +0100 +++ new/babl-0.1.78/meson_options.txt 2020-06-07 19:38:51.908586300 +0200 @@ -6,5 +6,6 @@ option('enable-avx2', type: 'boolean', value: true, description: 'enable AVX2 support') option('enable-f16c', type: 'boolean', value: true, description: 'enable hardware half-float support') option('enable-gir', type: 'boolean', value: true, description: 'enable GObject-Introspection (GIR)') +option('enable-vapi', type: 'boolean', value: true, description: 'enable Vala .vapi generation (requires GIR)') option('with-docs', type: 'boolean', value: true, description: 'build website') option('with-lcms', type: 'boolean', value: true, description: 'build with lcms') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babl-0.1.74/tests/cmyk.c new/babl-0.1.78/tests/cmyk.c --- old/babl-0.1.74/tests/cmyk.c 1970-01-01 01:00:00.000000000 +0100 +++ new/babl-0.1.78/tests/cmyk.c 2020-06-07 19:38:51.908586300 +0200 @@ -0,0 +1,56 @@ +/* babl - dynamically extendable universal pixel conversion library. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see + * <https://www.gnu.org/licenses/>. + */ + +#include <stdio.h> + +#include <babl/babl.h> + +#include "common.inc" + + +int +main (int argc, + char **argv) +{ + int OK = 1; + + float rgba[][4] = {{1.0 , 1.0 , 1.0 , 1.0}, + {0.0 , 1.0 , 0.0 , 1.0}, + {0.5 , 0.5 , 0.5 , 1.0}, + {0.0 , 1.0 , 1.0 , 1.0}}; + + float cmyk[][4] = {{0.0, 0.0 , 0.0 , 0.0}, + {1.0, 0.0 , 1.0 , 0.0}, + {0.0, 0.0 , 0.0 , 0.5}, + {1.0, 0.0 , 0.0 , 0.0}}; + + babl_init (); + + CHECK_CONV_FLOAT ("rgba to cmyk ", float, 0.001, + babl_format ("RGBA float"), + babl_format ("CMYK float"), + rgba, cmyk); + + CHECK_CONV_FLOAT ("cmyk to rgba ", float, 0.001, + babl_format ("CMYK float"), + babl_format ("RGBA float"), + cmyk, rgba); + + babl_exit (); + + return !OK; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babl-0.1.74/tests/conversions.c new/babl-0.1.78/tests/conversions.c --- old/babl-0.1.74/tests/conversions.c 1970-01-01 01:00:00.000000000 +0100 +++ new/babl-0.1.78/tests/conversions.c 2020-06-07 19:38:51.908586300 +0200 @@ -0,0 +1,73 @@ +/* babl - dynamically extendable universal pixel conversion library. + * Copyright (C) 2005, Øyvind Kolås. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see + * <https://www.gnu.org/licenses/>. + */ + +#include "config.h" +#include "babl-internal.h" + + static const struct + { + const char *from_format; + const char *to_format; + } + fishes[] = + { + { "Y' u8", "RaGaBaA float" }, + { "Y u8", "RaGaBaA float" }, + { "R'G'B'A u8", "RaGaBaA float" }, + { "R'G'B'A float", "R'G'B'A u8" }, + { "R'G'B'A float", "R'G'B' u8" }, + { "R'G'B'A u8", "RGBA float" }, + { "RGBA float", "R'G'B'A u8" }, + { "RGBA float", "R'G'B'A u8" }, + { "RGBA float", "R'G'B'A float" }, + { "Y' u8", "R'G'B' u8" }, + { "Y u8", "Y float" }, + { "R'G'B' u8", "cairo-RGB24" }, + { "R'G'B' u8", "R'G'B'A float" }, + { "R'G'B' u8", "R'G'B'A u8" }, + { "R'G'B'A u8", "R'G'B'A float" }, + { "R'G'B'A u8", "cairo-ARGB32" }, + { "R'G'B'A double", "RGBA float" }, + { "R'G'B'A float", "RGBA double" }, + { "R'G'B' u8", "RGB float" }, + { "RGB float", "R'G'B'A float" }, + { "R'G'B' u8", "RGBA float" }, + { "RaGaBaA float", "R'G'B'A float" }, + { "RaGaBaA float", "RGBA float" }, + { "RGBA float", "RaGaBaA float" }, + { "R'G'B' u8", "RaGaBaA float" }, + { "cairo-ARGB32", "R'G'B'A u8" } + }; + +int +main (int argc, + char **argv) +{ + putenv ("BABL_DEBUG_CONVERSIONS" "=" "1"); + putenv ("BABL_DEBUG_MISSING" "=" "1"); + babl_init (); + + for (int i = 0; i < sizeof (fishes)/sizeof(fishes[0]);i ++) + { + babl_fish (babl_format (fishes[i].from_format), + babl_format (fishes[i].to_format)); + } + + babl_exit (); + return 0; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babl-0.1.74/tests/meson.build new/babl-0.1.78/tests/meson.build --- old/babl-0.1.74/tests/meson.build 2020-01-13 00:26:51.000000000 +0100 +++ new/babl-0.1.78/tests/meson.build 2020-06-07 19:38:51.908586300 +0200 @@ -3,7 +3,9 @@ 'babl_class_name', 'cairo_cmyk_hack', 'cairo-RGB24', + 'cmyk', 'chromaticities', + 'conversions', 'extract', 'floatclamp', 'float-to-8bit',
