diff --git a/libimagequant.spec b/libimagequant.spec index 2b7de9c..c074150 100644 --- a/libimagequant.spec +++ b/libimagequant.spec @@ -9,6 +9,8 @@ Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz # Fix shared library permissions Patch0: libimagequant_solibperm.patch +# Fix some "error: '' not specified in enclosing 'parallel'" errors +Patch1: libimagequant_omp.patch BuildRequires: gcc diff --git a/libimagequant_omp.patch b/libimagequant_omp.patch new file mode 100644 index 0000000..ad2dced --- /dev/null +++ b/libimagequant_omp.patch @@ -0,0 +1,36 @@ +diff -rupN libimagequant-2.12.2/kmeans.c libimagequant-2.12.2-new/kmeans.c +--- libimagequant-2.12.2/kmeans.c 2018-10-28 22:39:27.000000000 +0100 ++++ libimagequant-2.12.2-new/kmeans.c 2019-02-04 11:20:03.367754202 +0100 +@@ -74,7 +74,7 @@ LIQ_PRIVATE double kmeans_do_iteration(h + + double total_diff=0; + #pragma omp parallel for if (hist_size > 2000) \ +- schedule(static) default(none) shared(average_color,callback) reduction(+:total_diff) ++ schedule(static) default(none) shared(average_color,callback,hist_size,achv,n,map) reduction(+:total_diff) + for(int j=0; j < hist_size; j++) { + float diff; + unsigned int match = nearest_search(n, &achv[j].acolor, achv[j].tmp.likely_colormap_index, &diff); +diff -rupN libimagequant-2.12.2/libimagequant.c libimagequant-2.12.2-new/libimagequant.c +--- libimagequant-2.12.2/libimagequant.c 2018-10-28 22:39:27.000000000 +0100 ++++ libimagequant-2.12.2-new/libimagequant.c 2019-02-04 11:34:43.067012436 +0100 +@@ -1277,7 +1277,7 @@ LIQ_NONNULL static float remap_to_palett + kmeans_init(map, max_threads, average_color); + + #pragma omp parallel for if (rows*cols > 3000) \ +- schedule(static) default(none) shared(acolormap) shared(average_color) reduction(+:remapping_error) ++ schedule(static) default(none) shared(acolormap,input_image,transparent_index,n,output_pixels,map,cols,rows) shared(average_color) reduction(+:remapping_error) + for(int row = 0; row < rows; ++row) { + const f_pixel *const row_pixels = liq_image_get_row_f(input_image, row); + const f_pixel *const bg_pixels = input_image->background && acolormap[transparent_index].acolor.a < 1.f/256.f ? liq_image_get_row_f(input_image->background, row) : NULL; +diff -rupN libimagequant-2.12.2/mediancut.c libimagequant-2.12.2-new/mediancut.c +--- libimagequant-2.12.2/mediancut.c 2018-10-28 22:39:27.000000000 +0100 ++++ libimagequant-2.12.2-new/mediancut.c 2019-02-04 11:25:19.039487962 +0100 +@@ -196,7 +196,7 @@ static double prepare_sort(struct box *b + const unsigned int ind1 = b->ind; + const unsigned int colors = b->colors; + #pragma omp parallel for if (colors > 25000) \ +- schedule(static) default(none) shared(achv, channels) ++ schedule(static) default(none) shared(achv, channels, ind1, colors) + for(unsigned int i=0; i < colors; i++) { + const float *chans = (const float *)&achv[ind1 + i].acolor; + // Only the first channel really matters. When trying median cut many times