diff --git a/avcodec.cpp b/avcodec.cpp index 75e60300..259f5e7a 100644 --- a/avcodec.cpp +++ b/avcodec.cpp @@ -413,7 +413,7 @@ static int avcodec_decoder_copy_frame(const avcodec_decoder d, opencv_mat mat, A NULL, NULL, NULL); // Configure colorspace - int colorspace = SWS_CS_ITU709; + int colorspace; switch (frame->colorspace) { case AVCOL_SPC_BT2020_NCL: case AVCOL_SPC_BT2020_CL: @@ -428,6 +428,9 @@ static int avcodec_decoder_copy_frame(const avcodec_decoder d, opencv_mat mat, A case AVCOL_SPC_SMPTE240M: colorspace = SWS_CS_SMPTE240M; break; + default: + colorspace = SWS_CS_ITU709; + break; } const int* inv_table = sws_getCoefficients(colorspace); diff --git a/avcodec.go b/avcodec.go index f5bc9e9e..7070059f 100644 --- a/avcodec.go +++ b/avcodec.go @@ -1,14 +1,5 @@ package lilliput -// #cgo CFLAGS: -msse -msse2 -msse3 -msse4.1 -msse4.2 -mavx -// #cgo darwin CFLAGS: -I${SRCDIR}/deps/osx/include -// #cgo linux CFLAGS: -I${SRCDIR}/deps/linux/include -// #cgo CXXFLAGS: -std=c++11 -// #cgo darwin CXXFLAGS: -I${SRCDIR}/deps/osx/include -// #cgo linux CXXFLAGS: -I${SRCDIR}/deps/linux/include -// #cgo LDFLAGS: -lswscale -lavformat -lavcodec -lavfilter -lavutil -lbz2 -lz -// #cgo darwin LDFLAGS: -L${SRCDIR}/deps/osx/lib -// #cgo linux LDFLAGS: -L${SRCDIR}/deps/linux/lib // #include "avcodec.hpp" import "C" diff --git a/cgo.go b/cgo.go new file mode 100644 index 00000000..070102b8 --- /dev/null +++ b/cgo.go @@ -0,0 +1,17 @@ +package lilliput + +/* +#cgo darwin CFLAGS: -I${SRCDIR}/deps/osx/include +#cgo linux CFLAGS: -msse -msse2 -msse3 -msse4.1 -msse4.2 -mavx -I${SRCDIR}/deps/linux/include +#cgo CXXFLAGS: -std=c++11 +#cgo darwin CXXFLAGS: -I${SRCDIR}/deps/osx/include +#cgo linux CXXFLAGS: -I${SRCDIR}/deps/linux/include +#cgo darwin LDFLAGS: -L${SRCDIR}/deps/osx/lib -lavcodec -lavfilter -lavformat -lavutil -lbz2 -lgif -ljpeg -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -lpng -lsharpyuv -lswscale -lwebp -lwebpmux -lz -framework CoreFoundation -framework CoreMedia -framework CoreVideo -framework VideoToolbox +#cgo linux LDFLAGS: -L${SRCDIR}/deps/linux/lib -L${SRCDIR}/deps/linux/share/OpenCV/3rdparty/lib -lswscale -lavformat -lavcodec -lavfilter -lavutil -lbz2 -lz -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -ljpeg -lpng -lwebp -lz -lgif -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -ljpeg -lpng -lwebp -lsharpyuv -lz -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -ljpeg -lpng -lwebp -lz -lopencv_core -lopencv_imgproc -lwebp -lwebpmux -lippicv +void dummy() {} +*/ +import "C" + +func init() { + C.dummy() +} diff --git a/deps/build-deps-osx.sh b/deps/build-deps-osx.sh index 1fcfac90..7443ef9d 100755 --- a/deps/build-deps-osx.sh +++ b/deps/build-deps-osx.sh @@ -60,7 +60,15 @@ tar -xzf $SRCDIR/libjpeg-turbo-2.1.4.tar.gz -C $BASEDIR/libjpeg-turbo --strip-co cd $BASEDIR/libjpeg-turbo mkdir -p $BUILDDIR/libjpeg-turbo cd $BUILDDIR/libjpeg-turbo -cmake $BASEDIR/libjpeg-turbo -DENABLE_STATIC=1 -DENABLE_SHARED=0 -DWITH_JPEG8=1 -DCMAKE_INSTALL_PREFIX=$PREFIX -DCMAKE_OSX_ARCHITECTURES=arm64 +cmake $BASEDIR/libjpeg-turbo \ + -DENABLE_STATIC=1 \ + -DENABLE_SHARED=0 \ + -DWITH_JPEG8=1 \ + -DCMAKE_INSTALL_PREFIX=$PREFIX \ + -DCMAKE_OSX_ARCHITECTURES=arm64 \ + -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \ + -DCMAKE_C_FLAGS="-mmacosx-version-min=14.0" \ + -DCMAKE_CXX_FLAGS="-mmacosx-version-min=14.0" make make install diff --git a/deps/osx/lib/libavcodec.a b/deps/osx/lib/libavcodec.a index 87e8d6f0..887c4d4e 100644 Binary files a/deps/osx/lib/libavcodec.a and b/deps/osx/lib/libavcodec.a differ diff --git a/deps/osx/lib/libavdevice.a b/deps/osx/lib/libavdevice.a index 97abfd0d..57993df1 100644 Binary files a/deps/osx/lib/libavdevice.a and b/deps/osx/lib/libavdevice.a differ diff --git a/deps/osx/lib/libavfilter.a b/deps/osx/lib/libavfilter.a index 229856dd..2c1d7b44 100644 Binary files a/deps/osx/lib/libavfilter.a and b/deps/osx/lib/libavfilter.a differ diff --git a/deps/osx/lib/libavformat.a b/deps/osx/lib/libavformat.a index 1983c937..c0dd881c 100644 Binary files a/deps/osx/lib/libavformat.a and b/deps/osx/lib/libavformat.a differ diff --git a/deps/osx/lib/libavutil.a b/deps/osx/lib/libavutil.a index 7e2e1138..e08927d8 100644 Binary files a/deps/osx/lib/libavutil.a and b/deps/osx/lib/libavutil.a differ diff --git a/deps/osx/lib/libbz2.a b/deps/osx/lib/libbz2.a index 7f7d7fb8..2eeee3a0 100644 Binary files a/deps/osx/lib/libbz2.a and b/deps/osx/lib/libbz2.a differ diff --git a/deps/osx/lib/libgif.a b/deps/osx/lib/libgif.a index 70d6980d..90ef32a4 100644 Binary files a/deps/osx/lib/libgif.a and b/deps/osx/lib/libgif.a differ diff --git a/deps/osx/lib/libjpeg.a b/deps/osx/lib/libjpeg.a index 9db6523f..58e2d4c0 100644 Binary files a/deps/osx/lib/libjpeg.a and b/deps/osx/lib/libjpeg.a differ diff --git a/deps/osx/lib/libopencv_core.a b/deps/osx/lib/libopencv_core.a index 712c5b00..5deb2340 100644 Binary files a/deps/osx/lib/libopencv_core.a and b/deps/osx/lib/libopencv_core.a differ diff --git a/deps/osx/lib/libopencv_imgcodecs.a b/deps/osx/lib/libopencv_imgcodecs.a index 3bd0bb75..b641a417 100644 Binary files a/deps/osx/lib/libopencv_imgcodecs.a and b/deps/osx/lib/libopencv_imgcodecs.a differ diff --git a/deps/osx/lib/libopencv_imgproc.a b/deps/osx/lib/libopencv_imgproc.a index a757abb5..75369eb0 100644 Binary files a/deps/osx/lib/libopencv_imgproc.a and b/deps/osx/lib/libopencv_imgproc.a differ diff --git a/deps/osx/lib/libpng.a b/deps/osx/lib/libpng.a index e8c52333..26e5b8ad 100644 Binary files a/deps/osx/lib/libpng.a and b/deps/osx/lib/libpng.a differ diff --git a/deps/osx/lib/libpng16.a b/deps/osx/lib/libpng16.a index e8c52333..26e5b8ad 100644 Binary files a/deps/osx/lib/libpng16.a and b/deps/osx/lib/libpng16.a differ diff --git a/deps/osx/lib/libsharpyuv.a b/deps/osx/lib/libsharpyuv.a index 16186546..7c717c71 100644 Binary files a/deps/osx/lib/libsharpyuv.a and b/deps/osx/lib/libsharpyuv.a differ diff --git a/deps/osx/lib/libswresample.a b/deps/osx/lib/libswresample.a index 8fbe46ef..25f0c4e0 100644 Binary files a/deps/osx/lib/libswresample.a and b/deps/osx/lib/libswresample.a differ diff --git a/deps/osx/lib/libswscale.a b/deps/osx/lib/libswscale.a index 83d828b1..e0c38521 100644 Binary files a/deps/osx/lib/libswscale.a and b/deps/osx/lib/libswscale.a differ diff --git a/deps/osx/lib/libturbojpeg.a b/deps/osx/lib/libturbojpeg.a index d1e49da9..987e4ccd 100644 Binary files a/deps/osx/lib/libturbojpeg.a and b/deps/osx/lib/libturbojpeg.a differ diff --git a/deps/osx/lib/libwebp.a b/deps/osx/lib/libwebp.a index e3c06933..a518d736 100644 Binary files a/deps/osx/lib/libwebp.a and b/deps/osx/lib/libwebp.a differ diff --git a/deps/osx/lib/libwebpdemux.a b/deps/osx/lib/libwebpdemux.a index 1fced660..7b8b3a9d 100644 Binary files a/deps/osx/lib/libwebpdemux.a and b/deps/osx/lib/libwebpdemux.a differ diff --git a/deps/osx/lib/libwebpmux.a b/deps/osx/lib/libwebpmux.a index ad23f5ae..89035e34 100644 Binary files a/deps/osx/lib/libwebpmux.a and b/deps/osx/lib/libwebpmux.a differ diff --git a/deps/osx/lib/libz.a b/deps/osx/lib/libz.a index 7147e101..d7040fd9 100644 Binary files a/deps/osx/lib/libz.a and b/deps/osx/lib/libz.a differ diff --git a/giflib.go b/giflib.go index 697596eb..d0043e6e 100644 --- a/giflib.go +++ b/giflib.go @@ -1,14 +1,5 @@ package lilliput -// #cgo CFLAGS: -msse -msse2 -msse3 -msse4.1 -msse4.2 -mavx -// #cgo darwin CFLAGS: -I${SRCDIR}/deps/osx/include -// #cgo linux CFLAGS: -I${SRCDIR}/deps/linux/include -// #cgo CXXFLAGS: -std=c++11 -// #cgo darwin CXXFLAGS: -I${SRCDIR}/deps/osx/include -// #cgo linux CXXFLAGS: -I${SRCDIR}/deps/linux/include -// #cgo LDFLAGS: -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -ljpeg -lpng -lwebp -lz -lgif -// #cgo darwin LDFLAGS: -L${SRCDIR}/deps/osx/lib -L${SRCDIR}/deps/osx/share/OpenCV/3rdparty/lib -// #cgo linux LDFLAGS: -lippicv -L${SRCDIR}/deps/linux/lib // #include "giflib.hpp" import "C" diff --git a/opencv.go b/opencv.go index 3d979bab..db8c9f41 100644 --- a/opencv.go +++ b/opencv.go @@ -1,14 +1,5 @@ package lilliput -// #cgo CFLAGS: -msse -msse2 -msse3 -msse4.1 -msse4.2 -mavx -// #cgo darwin CFLAGS: -I${SRCDIR}/deps/osx/include -// #cgo linux CFLAGS: -I${SRCDIR}/deps/linux/include -// #cgo CXXFLAGS: -std=c++11 -// #cgo darwin CXXFLAGS: -I${SRCDIR}/deps/osx/include -// #cgo linux CXXFLAGS: -I${SRCDIR}/deps/linux/include -// #cgo LDFLAGS: -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -ljpeg -lpng -lwebp -lsharpyuv -lz -// #cgo darwin LDFLAGS: -L${SRCDIR}/deps/osx/lib -L${SRCDIR}/deps/osx/share/OpenCV/3rdparty/lib -framework VideoToolbox -framework CoreVideo -framework CoreMedia -framework CoreFoundation -// #cgo linux LDFLAGS: -lippicv -L${SRCDIR}/deps/linux/lib // #include "opencv.hpp" import "C" diff --git a/thumbhash.go b/thumbhash.go index abdfccf6..410cd451 100644 --- a/thumbhash.go +++ b/thumbhash.go @@ -1,14 +1,5 @@ package lilliput -// #cgo CFLAGS: -msse -msse2 -msse3 -msse4.1 -msse4.2 -mavx -// #cgo darwin CFLAGS: -I${SRCDIR}/deps/osx/include -// #cgo linux CFLAGS: -I${SRCDIR}/deps/linux/include -// #cgo CXXFLAGS: -std=c++11 -// #cgo darwin CXXFLAGS: -I${SRCDIR}/deps/osx/include -// #cgo linux CXXFLAGS: -I${SRCDIR}/deps/linux/include -// #cgo LDFLAGS: -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -ljpeg -lpng -lwebp -lz -// #cgo darwin LDFLAGS: -L${SRCDIR}/deps/osx/lib -L${SRCDIR}/deps/osx/share/OpenCV/3rdparty/lib -// #cgo linux LDFLAGS: -lippicv -L${SRCDIR}/deps/linux/lib // #include "thumbhash.hpp" import "C" diff --git a/webp.go b/webp.go index 54d1ec44..ee84a799 100644 --- a/webp.go +++ b/webp.go @@ -1,14 +1,5 @@ package lilliput -// #cgo CFLAGS: -msse -msse2 -msse3 -msse4.1 -msse4.2 -mavx -// #cgo darwin CFLAGS: -I${SRCDIR}/deps/osx/include -// #cgo linux CFLAGS: -I${SRCDIR}/deps/linux/include -// #cgo CXXFLAGS: -std=c++11 -// #cgo darwin CXXFLAGS: -I${SRCDIR}/deps/osx/include -// #cgo linux CXXFLAGS: -I${SRCDIR}/deps/linux/include -// #cgo LDFLAGS: -lopencv_core -lopencv_imgproc -lwebp -lwebpmux -// #cgo darwin LDFLAGS: -L${SRCDIR}/deps/osx/lib -L${SRCDIR}/deps/osx/share/OpenCV/3rdparty/lib -// #cgo linux LDFLAGS: -L${SRCDIR}/deps/linux/lib // #include "webp.hpp" import "C"