extra/opencv to 4.9.0-8

This commit is contained in:
Kevin Mihelich 2024-05-24 12:57:20 +00:00
parent ed20b42400
commit 3506ddb1e4
3 changed files with 102 additions and 15 deletions

View file

@ -1,15 +1,18 @@
pkgbase = opencv
pkgdesc = Open Source Computer Vision Library
pkgver = 4.9.0
pkgrel = 6
pkgrel = 8
url = https://opencv.org/
arch = x86_64
license = Apache-2.0
makedepends = ant
makedepends = cmake
makedepends = cuda
makedepends = cudnn
makedepends = eigen
makedepends = fmt
makedepends = gcc13
makedepends = git
makedepends = glew
makedepends = hdf5
makedepends = java-environment
@ -53,16 +56,18 @@ pkgbase = opencv
optdepends = hdf5: for the HDF5 module
optdepends = opencl-icd-loader: For coding with OpenCL
optdepends = java-runtime: Java interface
source = https://github.com/opencv/opencv/archive/4.9.0/opencv-4.9.0.tar.gz
source = https://github.com/opencv/opencv_contrib/archive/4.9.0/opencv_contrib-4.9.0.tar.gz
source = git+https://github.com/opencv/opencv#tag=4.9.0
source = git+https://github.com/opencv/opencv_contrib#tag=4.9.0
source = opencv-cccl-2.2.0.zip::https://github.com/NVIDIA/cccl/archive/refs/tags/v2.2.0.zip
source = vtk9.patch
source = fix-nppi-bufsize-type.patch
sha256sums = ddf76f9dffd322c7c3cb1f721d0887f62d747b82059342213138dc190f28bc6c
sha256sums = 8952c45a73b75676c522dd574229f563e43c271ae1d5bbbd26f8e2b6bc1a4dae
source = opencv-cudnn9.patch::https://patch-diff.githubusercontent.com/raw/opencv/opencv/pull/25412.patch
sha256sums = b0d2012628b4224c7dd79aa98010586544e16858617c88c807014e11696b2ca3
sha256sums = 36ddaddd6f50cf13115ecf1a4777940739c4727e64135a52e768fa28ac163d4a
sha256sums = f0899311b537614f3bb79fcb20e5fa09e72b857ba3e5ef5d13ef64c6710483e7
sha256sums = f35a2d4ea0d6212c7798659e59eda2cb0b5bc858360f7ce9c696c77d3029668e
sha256sums = 993032a43a62faecc56f3f7aeaed29e471605dabdf28579fbeb36d52ecaa4060
sha256sums = db2a2dd99e52560e4c8b2ef7d578120f4bdc4232f71c871e732097232c83e2d4
pkgname = opencv

View file

@ -12,7 +12,7 @@ pkgname=(opencv
opencv-samples
python-opencv)
pkgver=4.9.0
pkgrel=6
pkgrel=8
pkgdesc='Open Source Computer Vision Library'
arch=(x86_64)
license=(Apache-2.0)
@ -45,6 +45,7 @@ makedepends=(ant
cmake
eigen
fmt
git
glew
hdf5
java-environment
@ -64,15 +65,27 @@ optdepends=('opencv-samples: samples'
'hdf5: for the HDF5 module'
'opencl-icd-loader: For coding with OpenCL'
'java-runtime: Java interface')
source=(https://github.com/opencv/opencv/archive/$pkgver/$pkgname-$pkgver.tar.gz
https://github.com/opencv/opencv_contrib/archive/$pkgver/opencv_contrib-$pkgver.tar.gz
vtk9.patch)
sha256sums=('ddf76f9dffd322c7c3cb1f721d0887f62d747b82059342213138dc190f28bc6c'
'8952c45a73b75676c522dd574229f563e43c271ae1d5bbbd26f8e2b6bc1a4dae'
'f35a2d4ea0d6212c7798659e59eda2cb0b5bc858360f7ce9c696c77d3029668e')
source=(git+https://github.com/opencv/opencv#tag=$pkgver
git+https://github.com/opencv/opencv_contrib#tag=$pkgver
$pkgname-cccl-2.2.0.zip::https://github.com/NVIDIA/cccl/archive/refs/tags/v2.2.0.zip
vtk9.patch
fix-nppi-bufsize-type.patch
opencv-cudnn9.patch::https://patch-diff.githubusercontent.com/raw/opencv/opencv/pull/25412.patch)
sha256sums=('b0d2012628b4224c7dd79aa98010586544e16858617c88c807014e11696b2ca3'
'36ddaddd6f50cf13115ecf1a4777940739c4727e64135a52e768fa28ac163d4a'
'f0899311b537614f3bb79fcb20e5fa09e72b857ba3e5ef5d13ef64c6710483e7'
'f35a2d4ea0d6212c7798659e59eda2cb0b5bc858360f7ce9c696c77d3029668e'
'993032a43a62faecc56f3f7aeaed29e471605dabdf28579fbeb36d52ecaa4060'
'db2a2dd99e52560e4c8b2ef7d578120f4bdc4232f71c871e732097232c83e2d4')
prepare() {
patch -d $pkgname-$pkgver -p1 < vtk9.patch # Don't require all vtk optdepends
patch -d $pkgname -p1 < vtk9.patch # Don't require all vtk optdepends
# fix type of several buffer size variables (NPP from CUDA 12.4 has breaking API change
# as several function parameters were changed from `int*` to `size_t*`)
patch -d opencv_contrib -Np1 < fix-nppi-bufsize-type.patch
patch -d opencv -p1 < opencv-cudnn9.patch # Fix build with CUDNN 9
}
build() {
@ -94,7 +107,7 @@ build() {
-DINSTALL_C_EXAMPLES=ON \
-DINSTALL_PYTHON_EXAMPLES=ON \
-DCMAKE_INSTALL_PREFIX=/usr \
-DOPENCV_EXTRA_MODULES_PATH=$srcdir/opencv_contrib-$pkgver/modules \
-DOPENCV_EXTRA_MODULES_PATH=$srcdir/opencv_contrib/modules \
-DOPENCV_SKIP_PYTHON_LOADER=ON \
-DLAPACK_LIBRARIES=/usr/lib/liblapack.so;/usr/lib/libblas.so;/usr/lib/libcblas.so \
-DLAPACK_CBLAS_H=/usr/include/cblas.h \
@ -107,7 +120,7 @@ build() {
-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON \
-Dprotobuf_MODULE_COMPATIBLE=ON"
cmake -B build -S $pkgname-$pkgver $_opts
cmake -B build -S $pkgname $_opts
cmake --build build
}

View file

@ -0,0 +1,69 @@
--- a/modules/cudaarithm/src/reductions.cpp 2023-12-26 22:24:58.000000000 +0100
+++ b/modules/cudaarithm/src/reductions.cpp 2024-03-18 16:51:32.108049155 +0100
@@ -151,7 +151,7 @@
sz.width = gsrc.cols;
sz.height = gsrc.rows;
- int bufSize;
+ size_t bufSize;
#if (CUDA_VERSION <= 4020)
nppSafeCall( nppiMeanStdDev8uC1RGetBufferHostSize(sz, &bufSize) );
#else
@@ -227,7 +227,7 @@
sz.width = gsrc.cols;
sz.height = gsrc.rows;
- int bufSize;
+ size_t bufSize;
#if (CUDA_VERSION <= 4020)
nppSafeCall( nppiMeanStdDev8uC1MRGetBufferHostSize(sz, &bufSize) );
#else
--- a/modules/cudaimgproc/src/histogram.cpp 2023-12-26 22:24:58.000000000 +0100
+++ b/modules/cudaimgproc/src/histogram.cpp 2024-03-18 17:51:37.005208948 +0100
@@ -281,8 +281,8 @@
namespace
{
- typedef NppStatus (*get_buf_size_c1_t)(NppiSize oSizeROI, int nLevels, int* hpBufferSize);
- typedef NppStatus (*get_buf_size_c4_t)(NppiSize oSizeROI, int nLevels[], int* hpBufferSize);
+ typedef NppStatus (*get_buf_size_c1_t)(NppiSize oSizeROI, int nLevels, size_t* hpBufferSize);
+ typedef NppStatus (*get_buf_size_c4_t)(NppiSize oSizeROI, int nLevels[], size_t* hpBufferSize);
template<int SDEPTH> struct NppHistogramEvenFuncC1
{
@@ -315,7 +315,7 @@
sz.width = src.cols;
sz.height = src.rows;
- int buf_size;
+ size_t buf_size;
get_buf_size(sz, levels, &buf_size);
BufferPool pool(stream);
@@ -349,7 +349,7 @@
Npp32s* pHist[] = {hist[0].ptr<Npp32s>(), hist[1].ptr<Npp32s>(), hist[2].ptr<Npp32s>(), hist[3].ptr<Npp32s>()};
- int buf_size;
+ size_t buf_size;
get_buf_size(sz, levels, &buf_size);
BufferPool pool(stream);
@@ -419,7 +419,7 @@
sz.width = src.cols;
sz.height = src.rows;
- int buf_size;
+ size_t buf_size;
get_buf_size(sz, levels.cols, &buf_size);
BufferPool pool(stream);
@@ -460,7 +460,7 @@
sz.width = src.cols;
sz.height = src.rows;
- int buf_size;
+ size_t buf_size;
get_buf_size(sz, nLevels, &buf_size);
BufferPool pool(stream);