From 08cc0afc797d2225cf23fbc785e6a28cc8667285 Mon Sep 17 00:00:00 2001 From: Justin Berger Date: Wed, 28 Mar 2018 21:52:00 -0600 Subject: Nuget packaged up dependencies --- redist/minimal_opencv.c | 172 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 169 insertions(+), 3 deletions(-) (limited to 'redist/minimal_opencv.c') diff --git a/redist/minimal_opencv.c b/redist/minimal_opencv.c index 50eb7df..e35e31d 100644 --- a/redist/minimal_opencv.c +++ b/redist/minimal_opencv.c @@ -1,5 +1,3 @@ -//#include "/home/justin/source/CLAPACK/INCLUDE/f2c.h" -//#include "/home/justin/source/CLAPACK/INCLUDE/clapack.h" #include #include @@ -10,8 +8,176 @@ #include "string.h" #include +#include + //#define DEBUG_PRINT +#ifdef _WIN3211 +#include "cblas.h" + +int CBLAS_CallFromC; +int RowMajorStrg; +void cblas_xerbla(int info, const char *rout, const char *form, ...) +{ + extern int RowMajorStrg; + char empty[1] = ""; + va_list argptr; + + va_start(argptr, form); + + if (RowMajorStrg) + { + if (strstr(rout, "gemm") != 0) + { + if (info == 5) info = 4; + else if (info == 4) info = 5; + else if (info == 11) info = 9; + else if (info == 9) info = 11; + } + else if (strstr(rout, "symm") != 0 || strstr(rout, "hemm") != 0) + { + if (info == 5) info = 4; + else if (info == 4) info = 5; + } + else if (strstr(rout, "trmm") != 0 || strstr(rout, "trsm") != 0) + { + if (info == 7) info = 6; + else if (info == 6) info = 7; + } + else if (strstr(rout, "gemv") != 0) + { + if (info == 4) info = 3; + else if (info == 3) info = 4; + } + else if (strstr(rout, "gbmv") != 0) + { + if (info == 4) info = 3; + else if (info == 3) info = 4; + else if (info == 6) info = 5; + else if (info == 5) info = 6; + } + else if (strstr(rout, "ger") != 0) + { + if (info == 3) info = 2; + else if (info == 2) info = 3; + else if (info == 8) info = 6; + else if (info == 6) info = 8; + } + else if ((strstr(rout, "her2") != 0 || strstr(rout, "hpr2") != 0) + && strstr(rout, "her2k") == 0) + { + if (info == 8) info = 6; + else if (info == 6) info = 8; + } + } + if (info) + fprintf(stderr, "Parameter %d to routine %s was incorrect\n", info, rout); + vfprintf(stderr, form, argptr); + va_end(argptr); + if (info && !info) + F77_xerbla(empty, &info); /* Force link of our F77 error handler */ + exit(-1); +} +void cblas_dgemm(const CBLAS_LAYOUT layout, const CBLAS_TRANSPOSE TransA, + const CBLAS_TRANSPOSE TransB, const int M, const int N, + const int K, const double alpha, const double *A, + const int lda, const double *B, const int ldb, + const double beta, double *C, const int ldc) +{ + char TA, TB; +#ifdef F77_CHAR + F77_CHAR F77_TA, F77_TB; +#else +#define F77_TA &TA +#define F77_TB &TB +#endif + +#ifdef F77_INT + F77_INT F77_M = M, F77_N = N, F77_K = K, F77_lda = lda, F77_ldb = ldb; + F77_INT F77_ldc = ldc; +#else +#define F77_M M +#define F77_N N +#define F77_K K +#define F77_lda lda +#define F77_ldb ldb +#define F77_ldc ldc +#endif + + RowMajorStrg = 0; + CBLAS_CallFromC = 1; + + if (layout == CblasColMajor) + { + if (TransA == CblasTrans) TA = 'T'; + else if (TransA == CblasConjTrans) TA = 'C'; + else if (TransA == CblasNoTrans) TA = 'N'; + else + { + cblas_xerbla(2, "cblas_dgemm", "Illegal TransA setting, %d\n", TransA); + CBLAS_CallFromC = 0; + RowMajorStrg = 0; + return; + } + + if (TransB == CblasTrans) TB = 'T'; + else if (TransB == CblasConjTrans) TB = 'C'; + else if (TransB == CblasNoTrans) TB = 'N'; + else + { + cblas_xerbla(3, "cblas_dgemm", "Illegal TransB setting, %d\n", TransB); + CBLAS_CallFromC = 0; + RowMajorStrg = 0; + return; + } + +#ifdef F77_CHAR + F77_TA = C2F_CHAR(&TA); + F77_TB = C2F_CHAR(&TB); +#endif + + F77_dgemm(F77_TA, F77_TB, &F77_M, &F77_N, &F77_K, &alpha, A, + &F77_lda, B, &F77_ldb, &beta, C, &F77_ldc); + } + else if (layout == CblasRowMajor) + { + RowMajorStrg = 1; + if (TransA == CblasTrans) TB = 'T'; + else if (TransA == CblasConjTrans) TB = 'C'; + else if (TransA == CblasNoTrans) TB = 'N'; + else + { + cblas_xerbla(2, "cblas_dgemm", "Illegal TransA setting, %d\n", TransA); + CBLAS_CallFromC = 0; + RowMajorStrg = 0; + return; + } + if (TransB == CblasTrans) TA = 'T'; + else if (TransB == CblasConjTrans) TA = 'C'; + else if (TransB == CblasNoTrans) TA = 'N'; + else + { + cblas_xerbla(2, "cblas_dgemm", "Illegal TransB setting, %d\n", TransB); + CBLAS_CallFromC = 0; + RowMajorStrg = 0; + return; + } +#ifdef F77_CHAR + F77_TA = C2F_CHAR(&TA); + F77_TB = C2F_CHAR(&TB); +#endif + + F77_dgemm(F77_TA, F77_TB, &F77_N, &F77_M, &F77_K, &alpha, B, + &F77_ldb, A, &F77_lda, &beta, C, &F77_ldc); + } + else cblas_xerbla(1, "cblas_dgemm", "Illegal layout setting, %d\n", layout); + CBLAS_CallFromC = 0; + RowMajorStrg = 0; + return; +} +#endif + + int cvRound(float f) { return roundf(f); } #define CV_Error(code, msg) assert(0 && msg); // cv::error( code, msg, CV_Func, __FILE__, __LINE__ ) @@ -27,7 +193,7 @@ void cvCopyTo(const CvMat *srcarr, CvMat *dstarr) { void cvGEMM(const CvMat *src1, const CvMat *src2, double alpha, const CvMat *src3, double beta, CvMat *dst, int tABC) { lapack_int rows1 = src1->rows; lapack_int cols1 = src1->cols; - + lapack_int rows2 = src2->rows; lapack_int cols2 = src2->cols; -- cgit v1.2.3