HAL samples: renamed and added readme

This commit is contained in:
Maksim Shabunin 2015-12-17 13:25:47 +03:00
parent 84f37d352f
commit d214770d5b
9 changed files with 666 additions and 632 deletions

34
samples/hal/README.md Normal file
View File

@ -0,0 +1,34 @@
Custom HAL samples
==================
Samples in this folder are intended to demonstrate functionality replacement mechanism in the OpenCV library.
The __c_hal__ is the example of pure C replacement library with all functions returning error. It can be used to verify error handling in the function switching code.
The __slow_hal__ contains naive C++ implementations of the element-wise logical array operations (and, or, xor, not) making them twice slower than the default.
Build custom HAL replacement library
------------------------------------
1. Create folder for build (for example `<home-dir>/my-hal-build`)
2. Go to created folder and run cmake: `cmake <opencv-src>/samples/hal/slow_hal`
3. Run make
After build you will find static library in the build folder: `libslow_hal.a`
Build OpenCV with HAL replacement
---------------------------------
1. Create folder for build (for example `<home-dir>/my-opencv-build`)
2. Go to created folder and run cmake:
```
cmake \
-DOPENCV_HAL_HEADERS="<opencv-src>/samples/hal/slow_hal/impl.hpp" \
-DOPENCV_HAL_LIBS="<home-dir>/my-hal-build/libslow_hal.a" \
<opencv-src>
```
3. Run make (or `make opencv_perf_core` to build the demonstration test executable only)
4. After build you can run the tests and verify that some functions are slower now:
```
./bin/opencv_perf_core --gtest_filter=*bitwise_and*
```

View File

@ -1,371 +0,0 @@
#include "broken.h"
int broken_add8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_add8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_add16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_add16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_add32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_add32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_add64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_sub8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_sub8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_sub16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_sub16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_sub32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_sub32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_sub64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_max8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_max8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_max16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_max16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_max32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_max32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_max64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_min8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_min8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_min16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_min16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_min32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_min32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_min64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_absdiff8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_absdiff8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_absdiff16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_absdiff16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_absdiff32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_absdiff32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_absdiff64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_and8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_or8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_xor8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_not8u(const uchar* src1, size_t sz1, uchar* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_cmp8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_cmp8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_cmp16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_cmp16s(const short* src1, size_t sz1, const short* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_cmp32s(const int* src1, size_t sz1, const int* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_cmp32f(const float* src1, size_t sz1, const float* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_cmp64f(const double* src1, size_t sz1, const double* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_mul8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_mul8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_mul16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_mul16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_mul32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_mul32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_mul64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_div8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_div8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_div16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_div16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_div32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_div32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_div64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_recip8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_recip8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_recip16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_recip16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_recip32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_recip32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_recip64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_addWeighted8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, const double* scales)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_addWeighted8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h, const double* scales)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_addWeighted16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h, const double* scales)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_addWeighted16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h, const double* scales)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_addWeighted32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h, const double* scales)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_addWeighted32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h, const double* scales)
{
return CV_HAL_ERROR_UNKNOWN;
}
int broken_addWeighted64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h, const double* scales)
{
return CV_HAL_ERROR_UNKNOWN;
}

View File

@ -1,245 +0,0 @@
#ifndef _BROKEN_H_INCLUDED_
#define _BROKEN_H_INCLUDED_
#include "opencv2/core/hal/interface.h"
#if defined(__cplusplus)
extern "C"
{
#endif
int broken_add8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h);
int broken_add8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h);
int broken_add16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h);
int broken_add16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h);
int broken_add32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h);
int broken_add32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h);
int broken_add64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h);
int broken_sub8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h);
int broken_sub8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h);
int broken_sub16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h);
int broken_sub16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h);
int broken_sub32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h);
int broken_sub32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h);
int broken_sub64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h);
int broken_max8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h);
int broken_max8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h);
int broken_max16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h);
int broken_max16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h);
int broken_max32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h);
int broken_max32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h);
int broken_max64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h);
int broken_min8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h);
int broken_min8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h);
int broken_min16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h);
int broken_min16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h);
int broken_min32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h);
int broken_min32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h);
int broken_min64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h);
int broken_absdiff8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h);
int broken_absdiff8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h);
int broken_absdiff16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h);
int broken_absdiff16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h);
int broken_absdiff32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h);
int broken_absdiff32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h);
int broken_absdiff64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h);
int broken_and8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h);
int broken_or8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h);
int broken_xor8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h);
int broken_not8u(const uchar* src1, size_t sz1, uchar* dst, size_t sz, int w, int h);
#undef cv_hal_add8u
#define cv_hal_add8u broken_add8u
#undef cv_hal_add8s
#define cv_hal_add8s broken_add8s
#undef cv_hal_add16u
#define cv_hal_add16u broken_add16u
#undef cv_hal_add16s
#define cv_hal_add16s broken_add16s
#undef cv_hal_add32s
#define cv_hal_add32s broken_add32s
#undef cv_hal_add32f
#define cv_hal_add32f broken_add32f
#undef cv_hal_add64f
#define cv_hal_add64f broken_add64f
#undef cv_hal_sub8u
#define cv_hal_sub8u broken_sub8u
#undef cv_hal_sub8s
#define cv_hal_sub8s broken_sub8s
#undef cv_hal_sub16u
#define cv_hal_sub16u broken_sub16u
#undef cv_hal_sub16s
#define cv_hal_sub16s broken_sub16s
#undef cv_hal_sub32s
#define cv_hal_sub32s broken_sub32s
#undef cv_hal_sub32f
#define cv_hal_sub32f broken_sub32f
#undef cv_hal_sub64f
#define cv_hal_sub64f broken_sub64f
#undef cv_hal_max8u
#define cv_hal_max8u broken_max8u
#undef cv_hal_max8s
#define cv_hal_max8s broken_max8s
#undef cv_hal_max16u
#define cv_hal_max16u broken_max16u
#undef cv_hal_max16s
#define cv_hal_max16s broken_max16s
#undef cv_hal_max32s
#define cv_hal_max32s broken_max32s
#undef cv_hal_max32f
#define cv_hal_max32f broken_max32f
#undef cv_hal_max64f
#define cv_hal_max64f broken_max64f
#undef cv_hal_min8u
#define cv_hal_min8u broken_min8u
#undef cv_hal_min8s
#define cv_hal_min8s broken_min8s
#undef cv_hal_min16u
#define cv_hal_min16u broken_min16u
#undef cv_hal_min16s
#define cv_hal_min16s broken_min16s
#undef cv_hal_min32s
#define cv_hal_min32s broken_min32s
#undef cv_hal_min32f
#define cv_hal_min32f broken_min32f
#undef cv_hal_min64f
#define cv_hal_min64f broken_min64f
#undef cv_hal_absdiff8u
#define cv_hal_absdiff8u broken_absdiff8u
#undef cv_hal_absdiff8s
#define cv_hal_absdiff8s broken_absdiff8s
#undef cv_hal_absdiff16u
#define cv_hal_absdiff16u broken_absdiff16u
#undef cv_hal_absdiff16s
#define cv_hal_absdiff16s broken_absdiff16s
#undef cv_hal_absdiff32s
#define cv_hal_absdiff32s broken_absdiff32s
#undef cv_hal_absdiff32f
#define cv_hal_absdiff32f broken_absdiff32f
#undef cv_hal_absdiff64f
#define cv_hal_absdiff64f broken_absdiff64f
#undef cv_hal_and8u
#define cv_hal_and8u broken_and8u
#undef cv_hal_or8u
#define cv_hal_or8u broken_or8u
#undef cv_hal_xor8u
#define cv_hal_xor8u broken_xor8u
#undef cv_hal_not8u
#define cv_hal_not8u broken_not8u
int broken_cmp8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op);
int broken_cmp8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op);
int broken_cmp16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op);
int broken_cmp16s(const short* src1, size_t sz1, const short* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op);
int broken_cmp32s(const int* src1, size_t sz1, const int* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op);
int broken_cmp32f(const float* src1, size_t sz1, const float* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op);
int broken_cmp64f(const double* src1, size_t sz1, const double* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op);
#undef cv_hal_cmp8u
#define cv_hal_cmp8u broken_cmp8u
#undef cv_hal_cmp8s
#define cv_hal_cmp8s broken_cmp8s
#undef cv_hal_cmp16u
#define cv_hal_cmp16u broken_cmp16u
#undef cv_hal_cmp16s
#define cv_hal_cmp16s broken_cmp16s
#undef cv_hal_cmp32s
#define cv_hal_cmp32s broken_cmp32s
#undef cv_hal_cmp32f
#define cv_hal_cmp32f broken_cmp32f
#undef cv_hal_cmp64f
#define cv_hal_cmp64f broken_cmp64f
int broken_mul8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, double scale);
int broken_mul8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h, double scale);
int broken_mul16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h, double scale);
int broken_mul16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h, double scale);
int broken_mul32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h, double scale);
int broken_mul32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h, double scale);
int broken_mul64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h, double scale);
int broken_div8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, double scale);
int broken_div8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h, double scale);
int broken_div16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h, double scale);
int broken_div16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h, double scale);
int broken_div32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h, double scale);
int broken_div32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h, double scale);
int broken_div64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h, double scale);
int broken_recip8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, double scale);
int broken_recip8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h, double scale);
int broken_recip16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h, double scale);
int broken_recip16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h, double scale);
int broken_recip32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h, double scale);
int broken_recip32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h, double scale);
int broken_recip64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h, double scale);
#undef cv_hal_mul8u
#define cv_hal_mul8u broken_mul8u
#undef cv_hal_mul8s
#define cv_hal_mul8s broken_mul8s
#undef cv_hal_mul16u
#define cv_hal_mul16u broken_mul16u
#undef cv_hal_mul16s
#define cv_hal_mul16s broken_mul16s
#undef cv_hal_mul32s
#define cv_hal_mul32s broken_mul32s
#undef cv_hal_mul32f
#define cv_hal_mul32f broken_mul32f
#undef cv_hal_mul64f
#define cv_hal_mul64f broken_mul64f
#undef cv_hal_div8u
#define cv_hal_div8u broken_div8u
#undef cv_hal_div8s
#define cv_hal_div8s broken_div8s
#undef cv_hal_div16u
#define cv_hal_div16u broken_div16u
#undef cv_hal_div16s
#define cv_hal_div16s broken_div16s
#undef cv_hal_div32s
#define cv_hal_div32s broken_div32s
#undef cv_hal_div32f
#define cv_hal_div32f broken_div32f
#undef cv_hal_div64f
#define cv_hal_div64f broken_div64f
#undef cv_hal_recip8u
#define cv_hal_recip8u broken_recip8u
#undef cv_hal_recip8s
#define cv_hal_recip8s broken_recip8s
#undef cv_hal_recip16u
#define cv_hal_recip16u broken_recip16u
#undef cv_hal_recip16s
#define cv_hal_recip16s broken_recip16s
#undef cv_hal_recip32s
#define cv_hal_recip32s broken_recip32s
#undef cv_hal_recip32f
#define cv_hal_recip32f broken_recip32f
#undef cv_hal_recip64f
#define cv_hal_recip64f broken_recip64f
int broken_addWeighted8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, const double* scales);
int broken_addWeighted8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h, const double* scales);
int broken_addWeighted16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h, const double* scales);
int broken_addWeighted16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h, const double* scales);
int broken_addWeighted32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h, const double* scales);
int broken_addWeighted32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h, const double* scales);
int broken_addWeighted64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h, const double* scales);
#undef cv_hal_addWeighted8u
#define cv_hal_addWeighted8u broken_addWeighted8u
#undef cv_hal_addWeighted8s
#define cv_hal_addWeighted8s broken_addWeighted8s
#undef cv_hal_addWeighted16u
#define cv_hal_addWeighted16u broken_addWeighted16u
#undef cv_hal_addWeighted16s
#define cv_hal_addWeighted16s broken_addWeighted16s
#undef cv_hal_addWeighted32s
#define cv_hal_addWeighted32s broken_addWeighted32s
#undef cv_hal_addWeighted32f
#define cv_hal_addWeighted32f broken_addWeighted32f
#undef cv_hal_addWeighted64f
#define cv_hal_addWeighted64f broken_addWeighted64f
#if defined(__cplusplus)
}
#endif
#endif

View File

@ -6,6 +6,6 @@ if(UNIX)
endif()
endif()
add_library(broken_hal broken.c)
add_library(c_hal impl.c)
set(OPENCV_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../..")
target_include_directories(broken_hal PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${OPENCV_SRC_DIR}/modules/core/include)
target_include_directories(c_hal PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${OPENCV_SRC_DIR}/modules/core/include)

371
samples/hal/c_hal/impl.c Normal file
View File

@ -0,0 +1,371 @@
#include "impl.h"
int wrong_add8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_add8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_add16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_add16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_add32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_add32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_add64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_sub8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_sub8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_sub16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_sub16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_sub32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_sub32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_sub64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_max8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_max8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_max16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_max16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_max32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_max32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_max64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_min8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_min8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_min16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_min16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_min32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_min32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_min64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_absdiff8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_absdiff8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_absdiff16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_absdiff16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_absdiff32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_absdiff32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_absdiff64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_and8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_or8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_xor8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_not8u(const uchar* src1, size_t sz1, uchar* dst, size_t sz, int w, int h)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_cmp8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_cmp8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_cmp16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_cmp16s(const short* src1, size_t sz1, const short* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_cmp32s(const int* src1, size_t sz1, const int* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_cmp32f(const float* src1, size_t sz1, const float* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_cmp64f(const double* src1, size_t sz1, const double* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_mul8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_mul8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_mul16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_mul16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_mul32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_mul32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_mul64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_div8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_div8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_div16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_div16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_div32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_div32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_div64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_recip8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_recip8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_recip16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_recip16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_recip32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_recip32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_recip64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h, double scale)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_addWeighted8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, const double* scales)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_addWeighted8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h, const double* scales)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_addWeighted16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h, const double* scales)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_addWeighted16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h, const double* scales)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_addWeighted32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h, const double* scales)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_addWeighted32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h, const double* scales)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}
int wrong_addWeighted64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h, const double* scales)
{
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
}

245
samples/hal/c_hal/impl.h Normal file
View File

@ -0,0 +1,245 @@
#ifndef _wrong_H_INCLUDED_
#define _wrong_H_INCLUDED_
#include "opencv2/core/hal/interface.h"
#if defined(__cplusplus)
extern "C"
{
#endif
int wrong_add8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h);
int wrong_add8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h);
int wrong_add16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h);
int wrong_add16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h);
int wrong_add32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h);
int wrong_add32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h);
int wrong_add64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h);
int wrong_sub8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h);
int wrong_sub8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h);
int wrong_sub16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h);
int wrong_sub16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h);
int wrong_sub32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h);
int wrong_sub32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h);
int wrong_sub64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h);
int wrong_max8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h);
int wrong_max8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h);
int wrong_max16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h);
int wrong_max16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h);
int wrong_max32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h);
int wrong_max32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h);
int wrong_max64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h);
int wrong_min8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h);
int wrong_min8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h);
int wrong_min16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h);
int wrong_min16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h);
int wrong_min32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h);
int wrong_min32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h);
int wrong_min64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h);
int wrong_absdiff8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h);
int wrong_absdiff8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h);
int wrong_absdiff16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h);
int wrong_absdiff16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h);
int wrong_absdiff32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h);
int wrong_absdiff32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h);
int wrong_absdiff64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h);
int wrong_and8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h);
int wrong_or8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h);
int wrong_xor8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h);
int wrong_not8u(const uchar* src1, size_t sz1, uchar* dst, size_t sz, int w, int h);
#undef cv_hal_add8u
#define cv_hal_add8u wrong_add8u
#undef cv_hal_add8s
#define cv_hal_add8s wrong_add8s
#undef cv_hal_add16u
#define cv_hal_add16u wrong_add16u
#undef cv_hal_add16s
#define cv_hal_add16s wrong_add16s
#undef cv_hal_add32s
#define cv_hal_add32s wrong_add32s
#undef cv_hal_add32f
#define cv_hal_add32f wrong_add32f
#undef cv_hal_add64f
#define cv_hal_add64f wrong_add64f
#undef cv_hal_sub8u
#define cv_hal_sub8u wrong_sub8u
#undef cv_hal_sub8s
#define cv_hal_sub8s wrong_sub8s
#undef cv_hal_sub16u
#define cv_hal_sub16u wrong_sub16u
#undef cv_hal_sub16s
#define cv_hal_sub16s wrong_sub16s
#undef cv_hal_sub32s
#define cv_hal_sub32s wrong_sub32s
#undef cv_hal_sub32f
#define cv_hal_sub32f wrong_sub32f
#undef cv_hal_sub64f
#define cv_hal_sub64f wrong_sub64f
#undef cv_hal_max8u
#define cv_hal_max8u wrong_max8u
#undef cv_hal_max8s
#define cv_hal_max8s wrong_max8s
#undef cv_hal_max16u
#define cv_hal_max16u wrong_max16u
#undef cv_hal_max16s
#define cv_hal_max16s wrong_max16s
#undef cv_hal_max32s
#define cv_hal_max32s wrong_max32s
#undef cv_hal_max32f
#define cv_hal_max32f wrong_max32f
#undef cv_hal_max64f
#define cv_hal_max64f wrong_max64f
#undef cv_hal_min8u
#define cv_hal_min8u wrong_min8u
#undef cv_hal_min8s
#define cv_hal_min8s wrong_min8s
#undef cv_hal_min16u
#define cv_hal_min16u wrong_min16u
#undef cv_hal_min16s
#define cv_hal_min16s wrong_min16s
#undef cv_hal_min32s
#define cv_hal_min32s wrong_min32s
#undef cv_hal_min32f
#define cv_hal_min32f wrong_min32f
#undef cv_hal_min64f
#define cv_hal_min64f wrong_min64f
#undef cv_hal_absdiff8u
#define cv_hal_absdiff8u wrong_absdiff8u
#undef cv_hal_absdiff8s
#define cv_hal_absdiff8s wrong_absdiff8s
#undef cv_hal_absdiff16u
#define cv_hal_absdiff16u wrong_absdiff16u
#undef cv_hal_absdiff16s
#define cv_hal_absdiff16s wrong_absdiff16s
#undef cv_hal_absdiff32s
#define cv_hal_absdiff32s wrong_absdiff32s
#undef cv_hal_absdiff32f
#define cv_hal_absdiff32f wrong_absdiff32f
#undef cv_hal_absdiff64f
#define cv_hal_absdiff64f wrong_absdiff64f
#undef cv_hal_and8u
#define cv_hal_and8u wrong_and8u
#undef cv_hal_or8u
#define cv_hal_or8u wrong_or8u
#undef cv_hal_xor8u
#define cv_hal_xor8u wrong_xor8u
#undef cv_hal_not8u
#define cv_hal_not8u wrong_not8u
int wrong_cmp8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op);
int wrong_cmp8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op);
int wrong_cmp16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op);
int wrong_cmp16s(const short* src1, size_t sz1, const short* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op);
int wrong_cmp32s(const int* src1, size_t sz1, const int* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op);
int wrong_cmp32f(const float* src1, size_t sz1, const float* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op);
int wrong_cmp64f(const double* src1, size_t sz1, const double* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op);
#undef cv_hal_cmp8u
#define cv_hal_cmp8u wrong_cmp8u
#undef cv_hal_cmp8s
#define cv_hal_cmp8s wrong_cmp8s
#undef cv_hal_cmp16u
#define cv_hal_cmp16u wrong_cmp16u
#undef cv_hal_cmp16s
#define cv_hal_cmp16s wrong_cmp16s
#undef cv_hal_cmp32s
#define cv_hal_cmp32s wrong_cmp32s
#undef cv_hal_cmp32f
#define cv_hal_cmp32f wrong_cmp32f
#undef cv_hal_cmp64f
#define cv_hal_cmp64f wrong_cmp64f
int wrong_mul8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, double scale);
int wrong_mul8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h, double scale);
int wrong_mul16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h, double scale);
int wrong_mul16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h, double scale);
int wrong_mul32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h, double scale);
int wrong_mul32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h, double scale);
int wrong_mul64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h, double scale);
int wrong_div8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, double scale);
int wrong_div8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h, double scale);
int wrong_div16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h, double scale);
int wrong_div16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h, double scale);
int wrong_div32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h, double scale);
int wrong_div32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h, double scale);
int wrong_div64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h, double scale);
int wrong_recip8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, double scale);
int wrong_recip8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h, double scale);
int wrong_recip16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h, double scale);
int wrong_recip16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h, double scale);
int wrong_recip32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h, double scale);
int wrong_recip32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h, double scale);
int wrong_recip64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h, double scale);
#undef cv_hal_mul8u
#define cv_hal_mul8u wrong_mul8u
#undef cv_hal_mul8s
#define cv_hal_mul8s wrong_mul8s
#undef cv_hal_mul16u
#define cv_hal_mul16u wrong_mul16u
#undef cv_hal_mul16s
#define cv_hal_mul16s wrong_mul16s
#undef cv_hal_mul32s
#define cv_hal_mul32s wrong_mul32s
#undef cv_hal_mul32f
#define cv_hal_mul32f wrong_mul32f
#undef cv_hal_mul64f
#define cv_hal_mul64f wrong_mul64f
#undef cv_hal_div8u
#define cv_hal_div8u wrong_div8u
#undef cv_hal_div8s
#define cv_hal_div8s wrong_div8s
#undef cv_hal_div16u
#define cv_hal_div16u wrong_div16u
#undef cv_hal_div16s
#define cv_hal_div16s wrong_div16s
#undef cv_hal_div32s
#define cv_hal_div32s wrong_div32s
#undef cv_hal_div32f
#define cv_hal_div32f wrong_div32f
#undef cv_hal_div64f
#define cv_hal_div64f wrong_div64f
#undef cv_hal_recip8u
#define cv_hal_recip8u wrong_recip8u
#undef cv_hal_recip8s
#define cv_hal_recip8s wrong_recip8s
#undef cv_hal_recip16u
#define cv_hal_recip16u wrong_recip16u
#undef cv_hal_recip16s
#define cv_hal_recip16s wrong_recip16s
#undef cv_hal_recip32s
#define cv_hal_recip32s wrong_recip32s
#undef cv_hal_recip32f
#define cv_hal_recip32f wrong_recip32f
#undef cv_hal_recip64f
#define cv_hal_recip64f wrong_recip64f
int wrong_addWeighted8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, const double* scales);
int wrong_addWeighted8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h, const double* scales);
int wrong_addWeighted16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h, const double* scales);
int wrong_addWeighted16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h, const double* scales);
int wrong_addWeighted32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h, const double* scales);
int wrong_addWeighted32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h, const double* scales);
int wrong_addWeighted64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h, const double* scales);
#undef cv_hal_addWeighted8u
#define cv_hal_addWeighted8u wrong_addWeighted8u
#undef cv_hal_addWeighted8s
#define cv_hal_addWeighted8s wrong_addWeighted8s
#undef cv_hal_addWeighted16u
#define cv_hal_addWeighted16u wrong_addWeighted16u
#undef cv_hal_addWeighted16s
#define cv_hal_addWeighted16s wrong_addWeighted16s
#undef cv_hal_addWeighted32s
#define cv_hal_addWeighted32s wrong_addWeighted32s
#undef cv_hal_addWeighted32f
#define cv_hal_addWeighted32f wrong_addWeighted32f
#undef cv_hal_addWeighted64f
#define cv_hal_addWeighted64f wrong_addWeighted64f
#if defined(__cplusplus)
}
#endif
#endif

View File

@ -6,6 +6,6 @@ if(UNIX)
endif()
endif()
add_library(simple_hal simple.cpp)
add_library(slow_hal impl.cpp)
set(OPENCV_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../..")
target_include_directories(simple_hal PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${OPENCV_SRC_DIR}/modules/core/include)
target_include_directories(slow_hal PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${OPENCV_SRC_DIR}/modules/core/include)

View File

@ -1,4 +1,4 @@
#include "simple.hpp"
#include "impl.hpp"
int slow_and8u(const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height)
{
@ -24,9 +24,9 @@ int slow_xor8u(const uchar* src1, size_t step1, const uchar* src2, size_t step2,
return CV_HAL_ERROR_OK;
}
int slow_not8u(const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height)
int slow_not8u(const uchar* src1, size_t step1, uchar* dst, size_t step, int width, int height)
{
for(; height--; src1 = src1 + step1, src2 = src2 + step2, dst = dst + step)
for(; height--; src1 = src1 + step1, dst = dst + step)
for(int x = 0 ; x < width; x++ )
dst[x] = ~src1[x];
return CV_HAL_ERROR_OK;

View File

@ -6,15 +6,15 @@
int slow_and8u(const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height);
int slow_or8u(const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height);
int slow_xor8u(const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height);
int slow_not8u(const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height);
int slow_not8u(const uchar* src1, size_t step1, uchar* dst, size_t step, int width, int height);
#undef hal_and8u
#define hal_and8u slow_and8u
#undef hal_or8u
#define hal_or8u slow_or8u
#undef hal_xor8u
#define hal_xor8u slow_xor8u
#undef hal_not8u
#define hal_not8u slow_not8u
#undef cv_hal_and8u
#define cv_hal_and8u slow_and8u
#undef cv_hal_or8u
#define cv_hal_or8u slow_or8u
#undef cv_hal_xor8u
#define cv_hal_xor8u slow_xor8u
#undef cv_hal_not8u
#define cv_hal_not8u slow_not8u
#endif