diff --git a/configure.ac b/configure.ac index 174b61e9..948d1e1a 100644 --- a/configure.ac +++ b/configure.ac @@ -259,6 +259,7 @@ AC_PROG_CC_STDC AC_PROG_CXX AC_C_CONST AC_C_RESTRICT +AX_GCC_VAR_ATTRIBUTE(vector_size) AC_PROG_RANLIB AC_PROG_INSTALL AC_PROG_LN_S diff --git a/doc/binding.xml b/doc/binding.xml index 3c27a515..6ed37b94 100644 --- a/doc/binding.xml +++ b/doc/binding.xml @@ -172,7 +172,7 @@ from gi.repository import Vips You can now use all of the libvips introspection machinery, as noted above. - Unfortunately g-o-i has some strong disadvantages. It is not very portable, since you will need a g-o-i layer for whatever platform you are targetting, it does not cross-compile well since typelibs include a lot of very-low level data (such as exact structure layouts), and installation for your users is likely to be tricky. + Unfortunately g-o-i has some strong disadvantages. It is not very portable, since you will need a g-o-i layer for whatever platform you are targetting; it does not cross-compile well, since typelibs include a lot of very-low level data (such as exact structure layouts); and installation for your users is likely to be tricky. If you have a choice, I would recommend simply using FFI. diff --git a/libvips/conversion/composite.cpp b/libvips/conversion/composite.cpp index 31b279a1..58196298 100644 --- a/libvips/conversion/composite.cpp +++ b/libvips/conversion/composite.cpp @@ -487,6 +487,9 @@ vips_composite_blend_mul( VipsBlendMode mode, B[bands] = aR; } +/* We have a vector path with gcc's vector attr. + */ +#ifdef HAVE_VAR_ATTRIBUTE_VECTOR_SIZE /* A vector of four floats. */ typedef float v4f __attribute__((vector_size(4 * sizeof(float)))); @@ -674,6 +677,7 @@ vips_composite_blend_mul_3float( VipsBlendMode mode, v4f &B, float *A_memory ) B[3] = aR; } +#endif /*HAVE_VAR_ATTRIBUTE_VECTOR_SIZE*/ /* A is the new pixel coming in, B is the double pixel we are accumulating. */ @@ -716,6 +720,7 @@ static void vips_combine_pixels( VipsComposite *composite, tq[bands] = B[bands]; } +#ifdef HAVE_VAR_ATTRIBUTE_VECTOR_SIZE static void vips_combine_pixels_3float( VipsComposite *composite, VipsPel *q, VipsPel **p ) @@ -738,6 +743,7 @@ vips_combine_pixels_3float( VipsComposite *composite, *((v4f *) tq) = R; tq[3] = B[3]; } +#endif /*HAVE_VAR_ATTRIBUTE_VECTOR_SIZE*/ static int vips_composite_gen( VipsRegion *output_region, @@ -767,10 +773,12 @@ vips_composite_gen( VipsRegion *output_region, for( x = 0; x < r->width; x++ ) { switch( input_regions[0]->im->BandFmt ) { case VIPS_FORMAT_FLOAT: +#ifdef HAVE_VAR_ATTRIBUTE_VECTOR_SIZE if( composite->bands == 3 ) vips_combine_pixels_3float( composite, q, p ); else +#endif /*HAVE_VAR_ATTRIBUTE_VECTOR_SIZE*/ vips_combine_pixels( composite, q, p ); break;