vendor: OpenCV 5.0.0 snapshot at 40738fb16ceddb5fb3fea747585f7ce6abb0605b
This commit is contained in:
@@ -0,0 +1,270 @@
|
||||
/*
|
||||
* Copyright (c) 2024-2025 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef OPENCV_FASTCV_HAL_CORE_HPP_INCLUDED
|
||||
#define OPENCV_FASTCV_HAL_CORE_HPP_INCLUDED
|
||||
|
||||
#include <opencv2/core/base.hpp>
|
||||
|
||||
#undef cv_hal_lut
|
||||
#define cv_hal_lut fastcv_hal_lut
|
||||
#undef cv_hal_normHammingDiff8u
|
||||
#define cv_hal_normHammingDiff8u fastcv_hal_normHammingDiff8u
|
||||
#undef cv_hal_mul8u16u
|
||||
#define cv_hal_mul8u16u fastcv_hal_mul8u16u
|
||||
#undef cv_hal_sub8u32f
|
||||
#define cv_hal_sub8u32f fastcv_hal_sub8u32f
|
||||
#undef cv_hal_transpose2d
|
||||
#define cv_hal_transpose2d fastcv_hal_transpose2d
|
||||
#undef cv_hal_meanStdDev
|
||||
#define cv_hal_meanStdDev fastcv_hal_meanStdDev
|
||||
#undef cv_hal_flip
|
||||
#define cv_hal_flip fastcv_hal_flip
|
||||
#undef cv_hal_rotate90
|
||||
#define cv_hal_rotate90 fastcv_hal_rotate
|
||||
#undef cv_hal_addWeighted8u
|
||||
#define cv_hal_addWeighted8u fastcv_hal_addWeighted8u
|
||||
#undef cv_hal_mul8u
|
||||
#define cv_hal_mul8u fastcv_hal_mul8u
|
||||
#undef cv_hal_mul16s
|
||||
#define cv_hal_mul16s fastcv_hal_mul16s
|
||||
#undef cv_hal_mul32f
|
||||
#define cv_hal_mul32f fastcv_hal_mul32f
|
||||
#undef cv_hal_SVD32f
|
||||
#define cv_hal_SVD32f fastcv_hal_SVD32f
|
||||
#undef cv_hal_gemm32f
|
||||
#define cv_hal_gemm32f fastcv_hal_gemm32f
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief look-up table transform of an array.
|
||||
/// @param src_data Source image data
|
||||
/// @param src_step Source image step
|
||||
/// @param src_type Source image type
|
||||
/// @param lut_data Pointer to lookup table
|
||||
/// @param lut_channel_size Size of each channel in bytes
|
||||
/// @param lut_channels Number of channels in lookup table
|
||||
/// @param dst_data Destination data
|
||||
/// @param dst_step Destination step
|
||||
/// @param width Width of images
|
||||
/// @param height Height of images
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int fastcv_hal_lut(
|
||||
const uchar* src_data,
|
||||
size_t src_step,
|
||||
size_t src_type,
|
||||
const uchar* lut_data,
|
||||
size_t lut_channel_size,
|
||||
size_t lut_channels,
|
||||
uchar* dst_data,
|
||||
size_t dst_step,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Hamming distance between two vectors
|
||||
/// @param a pointer to first vector data
|
||||
/// @param b pointer to second vector data
|
||||
/// @param n length of vectors
|
||||
/// @param cellSize how many bits of the vectors will be added and treated as a single bit, can be 1 (standard Hamming distance), 2 or 4
|
||||
/// @param result pointer to result output
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int fastcv_hal_normHammingDiff8u(const uchar* a, const uchar* b, int n, int cellSize, int* result);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int fastcv_hal_mul8u16u(
|
||||
const uchar * src1_data,
|
||||
size_t src1_step,
|
||||
const uchar * src2_data,
|
||||
size_t src2_step,
|
||||
ushort * dst_data,
|
||||
size_t dst_step,
|
||||
int width,
|
||||
int height,
|
||||
double scale);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int fastcv_hal_sub8u32f(
|
||||
const uchar *src1_data,
|
||||
size_t src1_step,
|
||||
const uchar *src2_data,
|
||||
size_t src2_step,
|
||||
float *dst_data,
|
||||
size_t dst_step,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int fastcv_hal_transpose2d(
|
||||
const uchar* src_data,
|
||||
size_t src_step,
|
||||
uchar* dst_data,
|
||||
size_t dst_step,
|
||||
int src_width,
|
||||
int src_height,
|
||||
int element_size);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int fastcv_hal_meanStdDev(
|
||||
const uchar * src_data,
|
||||
size_t src_step,
|
||||
int width,
|
||||
int height,
|
||||
int src_type,
|
||||
double * mean_val,
|
||||
double * stddev_val,
|
||||
uchar * mask,
|
||||
size_t mask_step);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Flips a 2D array around vertical, horizontal, or both axes
|
||||
/// @param src_type source and destination image type
|
||||
/// @param src_data source image data
|
||||
/// @param src_step source image step
|
||||
/// @param src_width source and destination image width
|
||||
/// @param src_height source and destination image height
|
||||
/// @param dst_data destination image data
|
||||
/// @param dst_step destination image step
|
||||
/// @param flip_mode 0 flips around x-axis, 1 around y-axis, -1 both
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int fastcv_hal_flip(
|
||||
int src_type,
|
||||
const uchar* src_data,
|
||||
size_t src_step,
|
||||
int src_width,
|
||||
int src_height,
|
||||
uchar* dst_data,
|
||||
size_t dst_step,
|
||||
int flip_mode);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Rotates a 2D array in multiples of 90 degrees.
|
||||
/// @param src_type source and destination image type
|
||||
/// @param src_data source image data
|
||||
/// @param src_step source image step
|
||||
/// @param src_width source image width
|
||||
/// @If angle has value [180] it is also destination image width
|
||||
/// If angle has values [90, 270] it is also destination image height
|
||||
/// @param src_height source and destination image height (destination image width for angles [90, 270])
|
||||
/// If angle has value [180] it is also destination image height
|
||||
/// If angle has values [90, 270] it is also destination image width
|
||||
/// @param dst_data destination image data
|
||||
/// @param dst_step destination image step
|
||||
/// @param angle clockwise angle for rotation in degrees from set [90, 180, 270]
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int fastcv_hal_rotate(
|
||||
int src_type,
|
||||
const uchar* src_data,
|
||||
size_t src_step,
|
||||
int src_width,
|
||||
int src_height,
|
||||
uchar* dst_data,
|
||||
size_t dst_step,
|
||||
int angle);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief weighted sum of two arrays using formula: dst[i] = a * src1[i] + b * src2[i]
|
||||
/// @param src1_data first source image data
|
||||
/// @param src1_step first source image step
|
||||
/// @param src2_data second source image data
|
||||
/// @param src2_step second source image step
|
||||
/// @param dst_data destination image data
|
||||
/// @param dst_step destination image step
|
||||
/// @param width width of the images
|
||||
/// @param height height of the images
|
||||
/// @param scalars numbers a, b, and c
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int fastcv_hal_addWeighted8u(
|
||||
const uchar* src1_data,
|
||||
size_t src1_step,
|
||||
const uchar* src2_data,
|
||||
size_t src2_step,
|
||||
uchar* dst_data,
|
||||
size_t dst_step,
|
||||
int width,
|
||||
int height,
|
||||
const double scalars[3]);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int fastcv_hal_mul8u(
|
||||
const uchar *src1_data,
|
||||
size_t src1_step,
|
||||
const uchar *src2_data,
|
||||
size_t src2_step,
|
||||
uchar *dst_data,
|
||||
size_t dst_step,
|
||||
int width,
|
||||
int height,
|
||||
double scale);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int fastcv_hal_mul16s(
|
||||
const short *src1_data,
|
||||
size_t src1_step,
|
||||
const short *src2_data,
|
||||
size_t src2_step,
|
||||
short *dst_data,
|
||||
size_t dst_step,
|
||||
int width,
|
||||
int height,
|
||||
double scale);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int fastcv_hal_mul32f(
|
||||
const float *src1_data,
|
||||
size_t src1_step,
|
||||
const float *src2_data,
|
||||
size_t src2_step,
|
||||
float *dst_data,
|
||||
size_t dst_step,
|
||||
int width,
|
||||
int height,
|
||||
double scale);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// Performs singular value decomposition of \f$M\times N\f$(\f$M>N\f$) matrix \f$A = U*\Sigma*V^T\f$.
|
||||
///
|
||||
/// @param src Pointer to input MxN matrix A stored in column major order.
|
||||
/// After finish of work src will be filled with rows of U or not modified (depends of flag CV_HAL_SVD_MODIFY_A).
|
||||
/// @param src_step Number of bytes between two consequent columns of matrix A.
|
||||
/// @param w Pointer to array for singular values of matrix A (i. e. first N diagonal elements of matrix \f$\Sigma\f$).
|
||||
/// @param u Pointer to output MxN or MxM matrix U (size depends of flags).
|
||||
/// Pointer must be valid if flag CV_HAL_SVD_MODIFY_A not used.
|
||||
/// @param u_step Number of bytes between two consequent rows of matrix U.
|
||||
/// @param vt Pointer to array for NxN matrix V^T.
|
||||
/// @param vt_step Number of bytes between two consequent rows of matrix V^T.
|
||||
/// @param m Number fo rows in matrix A.
|
||||
/// @param n Number of columns in matrix A.
|
||||
/// @param flags Algorithm options (combination of CV_HAL_SVD_FULL_UV, ...).
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int fastcv_hal_SVD32f(
|
||||
float* src,
|
||||
size_t src_step,
|
||||
float* w,
|
||||
float* u,
|
||||
size_t u_step,
|
||||
float* vt,
|
||||
size_t vt_step,
|
||||
int m,
|
||||
int n,
|
||||
int flags);
|
||||
|
||||
int fastcv_hal_gemm32f(
|
||||
const float* src1,
|
||||
size_t src1_step,
|
||||
const float* src2,
|
||||
size_t src2_step,
|
||||
float alpha,
|
||||
const float* src3,
|
||||
size_t src3_step,
|
||||
float beta,
|
||||
float* dst,
|
||||
size_t dst_step,
|
||||
int m,
|
||||
int n,
|
||||
int k,
|
||||
int flags);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,268 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef OPENCV_FASTCV_HAL_IMGPROC_HPP_INCLUDED
|
||||
#define OPENCV_FASTCV_HAL_IMGPROC_HPP_INCLUDED
|
||||
|
||||
#include <opencv2/core/base.hpp>
|
||||
|
||||
#undef cv_hal_medianBlur
|
||||
#define cv_hal_medianBlur fastcv_hal_medianBlur
|
||||
#undef cv_hal_sobel
|
||||
#define cv_hal_sobel fastcv_hal_sobel
|
||||
#undef cv_hal_boxFilter
|
||||
#define cv_hal_boxFilter fastcv_hal_boxFilter
|
||||
#undef cv_hal_adaptiveThreshold
|
||||
#define cv_hal_adaptiveThreshold fastcv_hal_adaptiveThreshold
|
||||
#undef cv_hal_gaussianBlurBinomial
|
||||
#define cv_hal_gaussianBlurBinomial fastcv_hal_gaussianBlurBinomial
|
||||
#undef cv_hal_warpPerspective
|
||||
#define cv_hal_warpPerspective fastcv_hal_warpPerspective
|
||||
#undef cv_hal_pyrdown
|
||||
#define cv_hal_pyrdown fastcv_hal_pyrdown
|
||||
#undef cv_hal_cvtBGRtoHSV
|
||||
#define cv_hal_cvtBGRtoHSV fastcv_hal_cvtBGRtoHSV
|
||||
#undef cv_hal_cvtBGRtoYUVApprox
|
||||
#define cv_hal_cvtBGRtoYUVApprox fastcv_hal_cvtBGRtoYUVApprox
|
||||
#undef cv_hal_canny
|
||||
#define cv_hal_canny fastcv_hal_canny
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Calculate medianBlur filter
|
||||
/// @param src_data Source image data
|
||||
/// @param src_step Source image step
|
||||
/// @param dst_data Destination image data
|
||||
/// @param dst_step Destination image step
|
||||
/// @param width Source image width
|
||||
/// @param height Source image height
|
||||
/// @param depth Depths of source and destination image
|
||||
/// @param cn Number of channels
|
||||
/// @param ksize Size of kernel
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int fastcv_hal_medianBlur(
|
||||
const uchar* src_data,
|
||||
size_t src_step,
|
||||
uchar* dst_data,
|
||||
size_t dst_step,
|
||||
int width,
|
||||
int height,
|
||||
int depth,
|
||||
int cn,
|
||||
int ksize);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Computes Sobel derivatives
|
||||
///
|
||||
/// @param src_data Source image data
|
||||
/// @param src_step Source image step
|
||||
/// @param dst_data Destination image data
|
||||
/// @param dst_step Destination image step
|
||||
/// @param width Source image width
|
||||
/// @param height Source image height
|
||||
/// @param src_depth Depth of source image
|
||||
/// @param dst_depth Depths of destination image
|
||||
/// @param cn Number of channels
|
||||
/// @param margin_left Left margins for source image
|
||||
/// @param margin_top Top margins for source image
|
||||
/// @param margin_right Right margins for source image
|
||||
/// @param margin_bottom Bottom margins for source image
|
||||
/// @param dx orders of the derivative x
|
||||
/// @param dy orders of the derivative y
|
||||
/// @param ksize Size of kernel
|
||||
/// @param scale Scale factor for the computed derivative values
|
||||
/// @param delta Delta value that is added to the results prior to storing them in dst
|
||||
/// @param border_type Border type
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int fastcv_hal_sobel(
|
||||
const uchar* src_data,
|
||||
size_t src_step,
|
||||
uchar* dst_data,
|
||||
size_t dst_step,
|
||||
int width,
|
||||
int height,
|
||||
int src_depth,
|
||||
int dst_depth,
|
||||
int cn,
|
||||
int margin_left,
|
||||
int margin_top,
|
||||
int margin_right,
|
||||
int margin_bottom,
|
||||
int dx,
|
||||
int dy,
|
||||
int ksize,
|
||||
double scale,
|
||||
double delta,
|
||||
int border_type);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int fastcv_hal_boxFilter(
|
||||
const uchar* src_data,
|
||||
size_t src_step,
|
||||
uchar* dst_data,
|
||||
size_t dst_step,
|
||||
int width,
|
||||
int height,
|
||||
int src_depth,
|
||||
int dst_depth,
|
||||
int cn,
|
||||
int margin_left,
|
||||
int margin_top,
|
||||
int margin_right,
|
||||
int margin_bottom,
|
||||
size_t ksize_width,
|
||||
size_t ksize_height,
|
||||
int anchor_x,
|
||||
int anchor_y,
|
||||
bool normalize,
|
||||
int border_type);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int fastcv_hal_adaptiveThreshold(
|
||||
const uchar* src_data,
|
||||
size_t src_step,
|
||||
uchar* dst_data,
|
||||
size_t dst_step,
|
||||
int width,
|
||||
int height,
|
||||
double maxValue,
|
||||
int adaptiveMethod,
|
||||
int thresholdType,
|
||||
int blockSize,
|
||||
double C);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Blurs an image using a Gaussian filter.
|
||||
/// @param src_data Source image data
|
||||
/// @param src_step Source image step
|
||||
/// @param dst_data Destination image data
|
||||
/// @param dst_step Destination image step
|
||||
/// @param width Source image width
|
||||
/// @param height Source image height
|
||||
/// @param depth Depth of source and destination image
|
||||
/// @param cn Number of channels
|
||||
/// @param margin_left Left margins for source image
|
||||
/// @param margin_top Top margins for source image
|
||||
/// @param margin_right Right margins for source image
|
||||
/// @param margin_bottom Bottom margins for source image
|
||||
/// @param ksize Kernel size
|
||||
/// @param border_type Border type
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int fastcv_hal_gaussianBlurBinomial(
|
||||
const uchar* src_data,
|
||||
size_t src_step,
|
||||
uchar* dst_data,
|
||||
size_t dst_step,
|
||||
int width,
|
||||
int height,
|
||||
int depth,
|
||||
int cn,
|
||||
size_t margin_left,
|
||||
size_t margin_top,
|
||||
size_t margin_right,
|
||||
size_t margin_bottom,
|
||||
size_t ksize,
|
||||
int border_type);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Applies a perspective transformation to an image.
|
||||
///
|
||||
/// @param src_type Source and destination image type
|
||||
/// @param src_data Source image data
|
||||
/// @param src_step Source image step
|
||||
/// @param src_width Source image width
|
||||
/// @param src_height Source image height
|
||||
/// @param dst_data Destination image data
|
||||
/// @param dst_step Destination image step
|
||||
/// @param dst_width Destination image width
|
||||
/// @param dst_height Destination image height
|
||||
/// @param M 3x3 matrix with transform coefficients
|
||||
/// @param interpolation Interpolation mode (CV_HAL_INTER_NEAREST, ...)
|
||||
/// @param border_type Border processing mode (CV_HAL_BORDER_REFLECT, ...)
|
||||
/// @param border_value Values to use for CV_HAL_BORDER_CONSTANT mode
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int fastcv_hal_warpPerspective(
|
||||
int src_type,
|
||||
const uchar* src_data,
|
||||
size_t src_step,
|
||||
int src_width,
|
||||
int src_height,
|
||||
uchar* dst_data,
|
||||
size_t dst_step,
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
const double M[9],
|
||||
int interpolation,
|
||||
int border_type,
|
||||
const double border_value[4]);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int fastcv_hal_pyrdown(
|
||||
const uchar* src_data,
|
||||
size_t src_step,
|
||||
int src_width,
|
||||
int src_height,
|
||||
uchar* dst_data,
|
||||
size_t dst_step,
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
int depth,
|
||||
int cn,
|
||||
int border_type);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int fastcv_hal_cvtBGRtoHSV(
|
||||
const uchar * src_data,
|
||||
size_t src_step,
|
||||
uchar * dst_data,
|
||||
size_t dst_step,
|
||||
int width,
|
||||
int height,
|
||||
int depth,
|
||||
int scn,
|
||||
bool swapBlue,
|
||||
bool isFullRange,
|
||||
bool isHSV);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int fastcv_hal_cvtBGRtoYUVApprox(
|
||||
const uchar * src_data,
|
||||
size_t src_step,
|
||||
uchar * dst_data,
|
||||
size_t dst_step,
|
||||
int width,
|
||||
int height,
|
||||
int depth,
|
||||
int scn,
|
||||
bool swapBlue,
|
||||
bool isCbCr);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Canny edge detector
|
||||
/// @param src_data Source image data
|
||||
/// @param src_step Source image step
|
||||
/// @param dst_data Destination image data
|
||||
/// @param dst_step Destination image step
|
||||
/// @param width Source image width
|
||||
/// @param height Source image height
|
||||
/// @param cn Number of channels
|
||||
/// @param lowThreshold low thresholds value
|
||||
/// @param highThreshold high thresholds value
|
||||
/// @param ksize Kernel size for Sobel operator.
|
||||
/// @param L2gradient Flag, indicating use of L2 or L1 norma.
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int fastcv_hal_canny(
|
||||
const uchar* src_data,
|
||||
size_t src_step,
|
||||
uchar* dst_data,
|
||||
size_t dst_step,
|
||||
int width,
|
||||
int height,
|
||||
int cn,
|
||||
double lowThreshold,
|
||||
double highThreshold,
|
||||
int ksize,
|
||||
bool L2gradient);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef OPENCV_FASTCV_HAL_UTILS_HPP_INCLUDED
|
||||
#define OPENCV_FASTCV_HAL_UTILS_HPP_INCLUDED
|
||||
|
||||
#include "fastcv.h"
|
||||
#include <opencv2/core/utils/logger.hpp>
|
||||
|
||||
#define INITIALIZATION_CHECK \
|
||||
{ \
|
||||
if (!FastCvContext::getContext().isInitialized) \
|
||||
{ \
|
||||
return CV_HAL_ERROR_UNKNOWN; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define CV_HAL_RETURN(status, func) \
|
||||
{ \
|
||||
if( status == FASTCV_SUCCESS ) \
|
||||
{ \
|
||||
CV_LOG_DEBUG(NULL, "FastCV HAL for "<<#func<<" run successfully!"); \
|
||||
return CV_HAL_ERROR_OK; \
|
||||
} \
|
||||
else if(status == FASTCV_EBADPARAM || status == FASTCV_EUNALIGNPARAM || \
|
||||
status == FASTCV_EUNSUPPORTED || status == FASTCV_EHWQDSP || \
|
||||
status == FASTCV_EHWGPU) \
|
||||
{ \
|
||||
CV_LOG_DEBUG(NULL, "FastCV status:"<<getFastCVErrorString(status) \
|
||||
<<", Switching to default OpenCV solution!"); \
|
||||
return CV_HAL_ERROR_NOT_IMPLEMENTED; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
CV_LOG_ERROR(NULL,"FastCV error:"<<getFastCVErrorString(status)); \
|
||||
return CV_HAL_ERROR_UNKNOWN; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define CV_HAL_RETURN_NOT_IMPLEMENTED(reason) \
|
||||
{ \
|
||||
CV_LOG_DEBUG(NULL,"Switching to default OpenCV\nInfo: "<<reason); \
|
||||
return CV_HAL_ERROR_NOT_IMPLEMENTED; \
|
||||
}
|
||||
|
||||
#define FCV_KernelSize_SHIFT 3
|
||||
#define FCV_MAKETYPE(ksize,depth) ((ksize<<FCV_KernelSize_SHIFT) + depth)
|
||||
#define FCV_CMP_EQ(val1,val2) (fabs(val1 - val2) < FLT_EPSILON)
|
||||
|
||||
const char* getFastCVErrorString(int status);
|
||||
const char* borderToString(int border);
|
||||
const char* interpolationToString(int interpolation);
|
||||
|
||||
struct FastCvContext
|
||||
{
|
||||
public:
|
||||
// initialize at first call
|
||||
// Defines a static local variable context. Variable is created only once.
|
||||
static FastCvContext& getContext()
|
||||
{
|
||||
static FastCvContext context;
|
||||
return context;
|
||||
}
|
||||
|
||||
FastCvContext()
|
||||
{
|
||||
if (fcvSetOperationMode(FASTCV_OP_CPU_PERFORMANCE) != 0)
|
||||
{
|
||||
CV_LOG_WARNING(NULL, "Failed to switch FastCV operation mode");
|
||||
isInitialized = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
CV_LOG_INFO(NULL, "FastCV Operation Mode Switched");
|
||||
isInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool isInitialized;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user