Hello community, here is the log from the commit of package babl for openSUSE:Factory checked in at 2020-10-10 19:03:03 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/babl (Old) and /work/SRC/openSUSE:Factory/.babl.new.4249 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "babl" Sat Oct 10 19:03:03 2020 rev:53 rq:840285 version:0.1.82 Changes: -------- --- /work/SRC/openSUSE:Factory/babl/babl.changes 2020-08-23 09:20:29.970662518 +0200 +++ /work/SRC/openSUSE:Factory/.babl.new.4249/babl.changes 2020-10-10 19:03:08.720447198 +0200 @@ -1,0 +2,8 @@ +Thu Oct 8 13:50:24 UTC 2020 - Bjørn Lie <bjorn....@gmail.com> + +- Update to version 0.1.82: + + Handle the parametric ICCv4 types that are not strictly the + same type as core sRGB curve. + + Meson build cleanups, depend on meson 0.54. + +------------------------------------------------------------------- Old: ---- babl-0.1.80.tar.xz New: ---- babl-0.1.82.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ babl.spec ++++++ --- /var/tmp/diff_new_pack.wXSvfF/_old 2020-10-10 19:03:09.756447713 +0200 +++ /var/tmp/diff_new_pack.wXSvfF/_new 2020-10-10 19:03:09.760447715 +0200 @@ -19,7 +19,7 @@ %define debug_package_requires libbabl-0_1-0 = %{version}-%{release} Name: babl -Version: 0.1.80 +Version: 0.1.82 Release: 0 Summary: Dynamic Pixel Format Translation Library License: LGPL-3.0-or-later AND GPL-3.0-or-later @@ -29,7 +29,7 @@ Source0: https://download.gimp.org/pub/babl/0.1/%{name}-%{version}.tar.xz Source99: baselibs.conf -BuildRequires: meson >= 0.50.0 +BuildRequires: meson >= 0.54.0 BuildRequires: pkgconfig BuildRequires: vala BuildRequires: pkgconfig(gobject-introspection-1.0) ++++++ babl-0.1.80.tar.xz -> babl-0.1.82.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babl-0.1.80/NEWS new/babl-0.1.82/NEWS --- old/babl-0.1.80/NEWS 2020-08-02 22:15:38.939850600 +0200 +++ new/babl-0.1.82/NEWS 2020-10-04 18:37:23.492539400 +0200 @@ -3,6 +3,13 @@ the news section both in the README and the webpage. --> +2020-10-04 babl-0.1.82 </dt><dd> +Handle the parametric ICCv4 types that are not strictly the same type as core +sRGB curve. + </dd><dt> +2020-08-02 babl-0.1.80 </dt><dd> +meson build cleanups, depend on meson 0.54 + </dd><dt> 2020-06-07 babl-0.1.78 </dt><dd> Bugfix release - mutex and atomicity related issues. </dd><dt> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babl-0.1.80/babl/babl-icc.c new/babl-0.1.82/babl/babl-icc.c --- old/babl-0.1.80/babl/babl-icc.c 2020-08-02 22:15:38.947836000 +0200 +++ new/babl-0.1.82/babl/babl-icc.c 2020-10-04 18:37:23.496532200 +0200 @@ -384,18 +384,36 @@ g = icc_read (s15f16, offset + 12 + 4 * 0); return babl_trc_gamma (g); break; + case 1: + { + float a,b,c; + g = icc_read (s15f16, offset + 12 + 4 * 0); + a = icc_read (s15f16, offset + 12 + 4 * 1); + b = icc_read (s15f16, offset + 12 + 4 * 2); + c = 0; + return babl_trc_formula_cie (g, a, b, c); + } + case 2: + { + float a,b,c; + g = icc_read (s15f16, offset + 12 + 4 * 0); + a = icc_read (s15f16, offset + 12 + 4 * 1); + b = icc_read (s15f16, offset + 12 + 4 * 2); + c = icc_read (s15f16, offset + 12 + 4 * 3); + return babl_trc_formula_cie (g, a, b, c); + } case 3: { - float a,b,c,d; + float a,b,c,d,e,f; g = icc_read (s15f16, offset + 12 + 4 * 0); a = icc_read (s15f16, offset + 12 + 4 * 1); b = icc_read (s15f16, offset + 12 + 4 * 2); c = icc_read (s15f16, offset + 12 + 4 * 3); d = icc_read (s15f16, offset + 12 + 4 * 4); - //fprintf (stderr, "%f %f %f %f %f\n", g, a, b, c, d); - return babl_trc_formula_srgb (g, a, b, c, d); + e = 0.0f; + f = 0.0f; + return babl_trc_formula_srgb (g, a, b, c, d, e, f); } - break; case 4: { float a,b,c,d,e,f; @@ -406,15 +424,8 @@ d = icc_read (s15f16, offset + 12 + 4 * 4); e = icc_read (s15f16, offset + 12 + 4 * 5); f = icc_read (s15f16, offset + 12 + 4 * 6); - fprintf (stderr, "%f %f %f %f %f %f %f\n", - g, a, b, c, d, e, f); - { - fprintf (stderr, "unhandled parametric sRGB formula TRC type %i\n", function_type); - *error = "unhandled sRGB formula like TRC"; - return babl_trc_gamma (2.2); - } - } - break; + return babl_trc_formula_srgb (g, a, b, c, d, e, f); + } default: *error = "unhandled parametric TRC"; fprintf (stderr, "unhandled parametric TRC type %i\n", function_type); @@ -539,6 +550,7 @@ break; } case BABL_TRC_FORMULA_SRGB: + case BABL_TRC_FORMULA_CIE: { int lut_size = 512; if (flags == BABL_ICC_COMPACT_TRC_LUT) @@ -676,7 +688,6 @@ icc_write (u8, state->o + 12 + i, description[i]); } - icc_write (u32, 0, state->no + 0); length = state->no + 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babl-0.1.80/babl/babl-internal.h new/babl-0.1.82/babl/babl-internal.h --- old/babl-0.1.80/babl/babl-internal.h 2020-08-02 22:15:38.947836000 +0200 +++ new/babl-0.1.82/babl/babl-internal.h 2020-10-04 18:37:23.496532200 +0200 @@ -385,7 +385,9 @@ void _babl_space_add_universal_rgb (const Babl *space); const Babl * -babl_trc_formula_srgb (double gamma, double a, double b, double c, double d); +babl_trc_formula_srgb (double gamma, double a, double b, double c, double d, double e, double f); +const Babl * +babl_trc_formula_cie (double gamma, double a, double b, double c); const Babl *babl_space_match_trc_matrix (const Babl *trc_red, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babl-0.1.80/babl/babl-trc.c new/babl-0.1.82/babl/babl-trc.c --- old/babl-0.1.80/babl/babl-trc.c 2020-08-02 22:15:38.959813800 +0200 +++ new/babl-0.1.82/babl/babl-trc.c 2020-10-04 18:37:23.500525200 +0200 @@ -165,16 +165,19 @@ float b = trc->lut[2]; float c = trc->lut[3]; float d = trc->lut[4]; - if (x > c * d) // XXX: verify that this math is the correct inverse + float e = trc->lut[5]; + float f = trc->lut[6]; + + if (x - f > c * d) // XXX: verify that this math is the correct inverse { - float v = _babl_trc_gamma_from_linear ((Babl *) trc, x); + float v = _babl_trc_gamma_from_linear ((Babl *) trc, x - f); v = (v-b)/a; if (v < 0.0 || v >= 0.0) return v; return 0.0; } if (c > 0.0) - return x / c; + return (x - e) / c; return 0.0; } @@ -188,14 +191,54 @@ float b = trc->lut[2]; float c = trc->lut[3]; float d = trc->lut[4]; + float e = trc->lut[5]; + float f = trc->lut[6]; if (x >= d) { - return _babl_trc_gamma_to_linear ((Babl *) trc, a * x + b); + return _babl_trc_gamma_to_linear ((Babl *) trc, a * x + b) + e; + } + return c * x + f; +} +static inline float +_babl_trc_formula_cie_from_linear (const Babl *trc_, + float value) +{ + BablTRC *trc = (void*)trc_; + float x= value; + float a = trc->lut[1]; + float b = trc->lut[2]; + float c = trc->lut[3]; + + if (x > c) + { + float v = _babl_trc_gamma_from_linear ((Babl *) trc, x - c); + v = (v-b)/a; + if (v < 0.0 || v >= 0.0) + return v; + } + return 0.0; +} + +static inline float +_babl_trc_formula_cie_to_linear (const Babl *trc_, + float value) +{ + BablTRC *trc = (void*)trc_; + float x= value; + float a = trc->lut[1]; + float b = trc->lut[2]; + float c = trc->lut[3]; + + if (x >= -b / a) + { + return _babl_trc_gamma_to_linear ((Babl *) trc, a * x + b) + c; } - return c * x; + return c; } + + static inline float _babl_trc_srgb_to_linear (const Babl *trc_, float value) @@ -416,11 +459,38 @@ trc_db[i].poly_gamma_from_linear_x1, POLY_GAMMA_DEGREE, POLY_GAMMA_SCALE); break; + case BABL_TRC_FORMULA_CIE: + trc_db[i].lut = babl_calloc (sizeof (float), 4); + { + int j; + for (j = 0; j < 4; j++) + trc_db[i].lut[j] = lut[j]; + } + trc_db[i].fun_to_linear = _babl_trc_formula_cie_to_linear; + trc_db[i].fun_from_linear = _babl_trc_formula_cie_from_linear; + + trc_db[i].poly_gamma_to_linear_x0 = lut[4]; + trc_db[i].poly_gamma_to_linear_x1 = POLY_GAMMA_X1; + babl_polynomial_approximate_gamma (&trc_db[i].poly_gamma_to_linear, + trc_db[i].gamma, + trc_db[i].poly_gamma_to_linear_x0, + trc_db[i].poly_gamma_to_linear_x1, + POLY_GAMMA_DEGREE, POLY_GAMMA_SCALE); + + trc_db[i].poly_gamma_from_linear_x0 = lut[3] * lut[4]; + trc_db[i].poly_gamma_from_linear_x1 = POLY_GAMMA_X1; + babl_polynomial_approximate_gamma (&trc_db[i].poly_gamma_from_linear, + trc_db[i].rgamma, + trc_db[i].poly_gamma_from_linear_x0, + trc_db[i].poly_gamma_from_linear_x1, + POLY_GAMMA_DEGREE, POLY_GAMMA_SCALE); + break; + case BABL_TRC_FORMULA_SRGB: - trc_db[i].lut = babl_calloc (sizeof (float), 5); + trc_db[i].lut = babl_calloc (sizeof (float), 7); { int j; - for (j = 0; j < 5; j++) + for (j = 0; j < 7; j++) trc_db[i].lut[j] = lut[j]; } trc_db[i].fun_to_linear = _babl_trc_formula_srgb_to_linear; @@ -479,20 +549,25 @@ double a, double b, double c, - double d) + double d, + double e, + double f) { char name[128]; int i; - float params[5]={g, a, b, c, d}; + float params[7]={g, a, b, c, d, e, f}; if (fabs (g - 2.400) < 0.01 && fabs (a - 0.947) < 0.01 && fabs (b - 0.052) < 0.01 && fabs (c - 0.077) < 0.01 && - fabs (d - 0.040) < 0.01) + fabs (d - 0.040) < 0.01 && + fabs (e - 0.000) < 0.01 && + fabs (f - 0.000) < 0.01 + ) return babl_trc ("sRGB"); - snprintf (name, sizeof (name), "%.6f %.6f %.4f %.4f %.4f", g, a, b, c, d); + snprintf (name, sizeof (name), "%.6f %.6f %.4f %.4f %.4f %.4f %.4f", g, a, b, c, d, e, f); for (i = 0; name[i]; i++) if (name[i] == ',') name[i] = '.'; while (name[strlen(name)-1]=='0') @@ -501,6 +576,25 @@ } const Babl * +babl_trc_formula_cie (double g, + double a, + double b, + double c) +{ + char name[128]; + int i; + float params[4]={g, a, b, c}; + + snprintf (name, sizeof (name), "%.6f %.6f %.4f %.4f", g, a, b, c); + for (i = 0; name[i]; i++) + if (name[i] == ',') name[i] = '.'; + while (name[strlen(name)-1]=='0') + name[strlen(name)-1]='\0'; + return babl_trc_new (name, BABL_TRC_FORMULA_CIE, g, 0, params); +} + + +const Babl * babl_trc_gamma (double gamma) { char name[32]; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babl-0.1.80/babl/babl-trc.h new/babl-0.1.82/babl/babl-trc.h --- old/babl-0.1.80/babl/babl-trc.h 2020-08-02 22:15:38.959813800 +0200 +++ new/babl-0.1.82/babl/babl-trc.h 2020-10-04 18:37:23.500525200 +0200 @@ -30,7 +30,8 @@ BABL_TRC_FORMULA_GAMMA, BABL_TRC_SRGB, BABL_TRC_FORMULA_SRGB, - BABL_TRC_LUT} + BABL_TRC_LUT, + BABL_TRC_FORMULA_CIE} BablTRCType; typedef struct diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babl-0.1.80/babl/git-version.h new/babl-0.1.82/babl/git-version.h --- old/babl-0.1.80/babl/git-version.h 2020-08-02 22:15:39.470893400 +0200 +++ new/babl-0.1.82/babl/git-version.h 2020-10-04 18:37:23.851894100 +0200 @@ -1,6 +1,6 @@ #ifndef __GIT_VERSION_H__ #define __GIT_VERSION_H__ -#define BABL_GIT_VERSION "BABL_0_1_80" +#define BABL_GIT_VERSION "BABL_0_1_80-5-gaab3029" #endif /* __GIT_VERSION_H__ */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babl-0.1.80/meson.build new/babl-0.1.82/meson.build --- old/babl-0.1.80/meson.build 2020-08-02 22:15:38.987762000 +0200 +++ new/babl-0.1.82/meson.build 2020-10-04 18:37:23.512503600 +0200 @@ -1,6 +1,6 @@ project('babl', 'c', license: 'LGPL3+', - version: '0.1.80', + version: '0.1.82', meson_version: '>=0.54.0', default_options: [ 'buildtype=debugoptimized'