From 921a05687c99d692ba2cd695a0b0cb8873f8d391 Mon Sep 17 00:00:00 2001 From: ZloyDyadka Date: Tue, 6 Jul 2021 14:59:12 +0300 Subject: [PATCH 1/2] Vips: add VipsVectorSetEnabled --- vips.go | 11 +++++++++++ vips.h | 1 + 2 files changed, 12 insertions(+) diff --git a/vips.go b/vips.go index 43990f3..95f5b96 100644 --- a/vips.go +++ b/vips.go @@ -147,6 +147,17 @@ func VipsCacheDropAll() { C.vips_cache_drop_all() } +// VipsVectorSetEnabled enables or disables SIMD vector instructions. This can give speed-up, +// but can also be unstable on some systems and versions. +func VipsVectorSetEnabled(enable bool) { + flag := 0 + if enable { + flag = 1 + } + + C.vips_vector_set_enabled(flag) +} + // VipsDebugInfo outputs to stdout libvips collected data. Useful for debugging. func VipsDebugInfo() { C.im__print_all() diff --git a/vips.h b/vips.h index 190317c..ab2c82e 100644 --- a/vips.h +++ b/vips.h @@ -3,6 +3,7 @@ #include #include #include +#include /** * Starting libvips 7.41, VIPS_ANGLE_x has been renamed to VIPS_ANGLE_Dx From f62a291281cc15c0537538d60c1f6536ffd6253a Mon Sep 17 00:00:00 2001 From: ZloyDyadka Date: Tue, 6 Jul 2021 16:35:38 +0300 Subject: [PATCH 2/2] Vips: cast go.int to c.INT in VipsVectorSetEnabled --- vips.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vips.go b/vips.go index 95f5b96..1d03c92 100644 --- a/vips.go +++ b/vips.go @@ -155,7 +155,7 @@ func VipsVectorSetEnabled(enable bool) { flag = 1 } - C.vips_vector_set_enabled(flag) + C.vips_vector_set_enabled(C.int(flag)) } // VipsDebugInfo outputs to stdout libvips collected data. Useful for debugging.