From 54468eb2c5c89da9ad28596dd8165d4cf3388459 Mon Sep 17 00:00:00 2001 From: Yonas Yanfa Date: Wed, 7 Aug 2024 08:06:27 -0400 Subject: [PATCH] feature (freebsd): PR #643 off master. (#731) Co-authored-by: Yonas --- server/plugin/plg_image_c/image_heif_freebsd.go | 11 +++++++++++ server/plugin/plg_image_c/image_heif_linux.go | 10 ++++++++++ server/plugin/plg_image_c/image_jpeg_freebsd.go | 11 +++++++++++ server/plugin/plg_image_c/image_jpeg_linux.go | 10 ++++++++++ server/plugin/plg_image_c/image_png_freebsd.go | 11 +++++++++++ server/plugin/plg_image_c/image_png_linux.go | 10 ++++++++++ server/plugin/plg_image_c/image_raw_freebsd.go | 11 +++++++++++ server/plugin/plg_image_c/image_raw_linux.go | 10 ++++++++++ 8 files changed, 84 insertions(+) create mode 100644 server/plugin/plg_image_c/image_heif_freebsd.go create mode 100644 server/plugin/plg_image_c/image_heif_linux.go create mode 100644 server/plugin/plg_image_c/image_jpeg_freebsd.go create mode 100644 server/plugin/plg_image_c/image_jpeg_linux.go create mode 100644 server/plugin/plg_image_c/image_png_freebsd.go create mode 100644 server/plugin/plg_image_c/image_png_linux.go create mode 100644 server/plugin/plg_image_c/image_raw_freebsd.go create mode 100644 server/plugin/plg_image_c/image_raw_linux.go diff --git a/server/plugin/plg_image_c/image_heif_freebsd.go b/server/plugin/plg_image_c/image_heif_freebsd.go new file mode 100644 index 00000000..c7a3e586 --- /dev/null +++ b/server/plugin/plg_image_c/image_heif_freebsd.go @@ -0,0 +1,11 @@ +package plg_image_c + +// #include "image_heif.h" +// #cgo LDFLAGS: -L /usr/local/lib -L /usr/lib -L /lib -lheif +// #cgo CFLAGS: -I /usr/local/include +import "C" + +func heif(input uintptr, output uintptr, size int) { + C.heif_to_jpeg(C.int(input), C.int(output), C.int(size)) + return +} diff --git a/server/plugin/plg_image_c/image_heif_linux.go b/server/plugin/plg_image_c/image_heif_linux.go new file mode 100644 index 00000000..95b6bced --- /dev/null +++ b/server/plugin/plg_image_c/image_heif_linux.go @@ -0,0 +1,10 @@ +package plg_image_c + +// #include "image_heif.h" +// #cgo LDFLAGS: -lheif +import "C" + +func heif(input uintptr, output uintptr, size int) { + C.heif_to_jpeg(C.int(input), C.int(output), C.int(size)) + return +} diff --git a/server/plugin/plg_image_c/image_jpeg_freebsd.go b/server/plugin/plg_image_c/image_jpeg_freebsd.go new file mode 100644 index 00000000..14c6879b --- /dev/null +++ b/server/plugin/plg_image_c/image_jpeg_freebsd.go @@ -0,0 +1,11 @@ +package plg_image_c + +// #include "image_jpeg.h" +// #cgo LDFLAGS: -L /usr/local/lib -L /usr/lib -L /lib -l:libjpeg.a +// #cgo CFLAGS: -I /usr/local/include +import "C" + +func jpeg(input uintptr, output uintptr, size int) { + C.jpeg_to_jpeg(C.int(input), C.int(output), C.int(size)) + return +} diff --git a/server/plugin/plg_image_c/image_jpeg_linux.go b/server/plugin/plg_image_c/image_jpeg_linux.go new file mode 100644 index 00000000..235e4139 --- /dev/null +++ b/server/plugin/plg_image_c/image_jpeg_linux.go @@ -0,0 +1,10 @@ +package plg_image_c + +// #include "image_jpeg.h" +// #cgo LDFLAGS: -l:libjpeg.a +import "C" + +func jpeg(input uintptr, output uintptr, size int) { + C.jpeg_to_jpeg(C.int(input), C.int(output), C.int(size)) + return +} diff --git a/server/plugin/plg_image_c/image_png_freebsd.go b/server/plugin/plg_image_c/image_png_freebsd.go new file mode 100644 index 00000000..22384c87 --- /dev/null +++ b/server/plugin/plg_image_c/image_png_freebsd.go @@ -0,0 +1,11 @@ +package plg_image_c + +// #include "image_png.h" +// #cgo LDFLAGS: -L /usr/local/lib -L /usr/lib -L /lib -l:libsharpyuv.a -l:libpng.a -l:libz.a -l:libwebp.a -l:libpthread.a -fopenmp +// #cgo CFLAGS: -I /usr/local/include +import "C" + +func png(input uintptr, output uintptr, size int) { + C.png_to_webp(C.int(input), C.int(output), C.int(size)) + return +} diff --git a/server/plugin/plg_image_c/image_png_linux.go b/server/plugin/plg_image_c/image_png_linux.go new file mode 100644 index 00000000..e87acdaf --- /dev/null +++ b/server/plugin/plg_image_c/image_png_linux.go @@ -0,0 +1,10 @@ +package plg_image_c + +// #include "image_png.h" +// #cgo LDFLAGS: -l:libpng.a -l:libz.a -l:libwebp.a -fopenmp +import "C" + +func png(input uintptr, output uintptr, size int) { + C.png_to_webp(C.int(input), C.int(output), C.int(size)) + return +} diff --git a/server/plugin/plg_image_c/image_raw_freebsd.go b/server/plugin/plg_image_c/image_raw_freebsd.go new file mode 100644 index 00000000..d95a667d --- /dev/null +++ b/server/plugin/plg_image_c/image_raw_freebsd.go @@ -0,0 +1,11 @@ +package plg_image_c + +// #include "image_raw.h" +// #cgo LDFLAGS: -L /usr/local/lib -L /usr/lib -L /lib -l:libyuv.a -l:libjpeg.a -l:libraw.a -fopenmp -l:libc++.a -llcms2 -lm +// #cgo CFLAGS: -I /usr/local/include +import "C" + +func raw(input uintptr, output uintptr, size int) { + C.raw_to_jpeg(C.int(input), C.int(output), C.int(size)) + return +} diff --git a/server/plugin/plg_image_c/image_raw_linux.go b/server/plugin/plg_image_c/image_raw_linux.go new file mode 100644 index 00000000..e9a0774f --- /dev/null +++ b/server/plugin/plg_image_c/image_raw_linux.go @@ -0,0 +1,10 @@ +package plg_image_c + +// #include "image_raw.h" +// #cgo LDFLAGS: -l:libjpeg.a -l:libraw.a -fopenmp -l:libstdc++.a -llcms2 -lm +import "C" + +func raw(input uintptr, output uintptr, size int) { + C.raw_to_jpeg(C.int(input), C.int(output), C.int(size)) + return +}