#endif
namespace cv {
+namespace hal {
+CV_CPU_OPTIMIZATION_NAMESPACE_BEGIN
+
+void cvt16f32f(const float16_t* src, float* dst, int len);
+void cvt32f16f(const float* src, float16_t* dst, int len);
+void addRNGBias32f(float* arr, const float* scaleBiasPairs, int len);
+void addRNGBias64f(double* arr, const double* scaleBiasPairs, int len);
+
+CV_CPU_OPTIMIZATION_NAMESPACE_END
+} // namespace cv::hal
+
CV_CPU_OPTIMIZATION_NAMESPACE_BEGIN
BinaryFunc getConvertFunc(int sdepth, int ddepth);
-BinaryFunc get_cvt32f16f();
-BinaryFunc get_cvt16f32f();
+
+CV_CPU_OPTIMIZATION_NAMESPACE_END
#ifndef CV_CPU_OPTIMIZATION_DECLARATIONS_ONLY
-/*namespace hal {
+namespace hal {
+CV_CPU_OPTIMIZATION_NAMESPACE_BEGIN
+
+BinaryFunc getConvertFunc(int sdepth, int ddepth);
void cvt16f32f( const float16_t* src, float* dst, int len )
{
+ CV_INSTRUMENT_REGION();
int j = 0;
#if CV_SIMD
const int VECSZ = v_float32::nlanes;
void cvt32f16f( const float* src, float16_t* dst, int len )
{
+ CV_INSTRUMENT_REGION();
int j = 0;
#if CV_SIMD
const int VECSZ = v_float32::nlanes;
dst[j] = float16_t(src[j]);
}
-/*void addRNGBias32f( float* arr, const float* scaleBiasPairs, int len )
+void addRNGBias32f( float* arr, const float* scaleBiasPairs, int len )
{
+ CV_INSTRUMENT_REGION();
// the loop is simple enough, so we let the compiler to vectorize it
for( int i = 0; i < len; i++ )
- arr[i] = scaleBiasPairs[i*2 + 1];
+ arr[i] += scaleBiasPairs[i*2 + 1];
}
void addRNGBias64f( double* arr, const double* scaleBiasPairs, int len )
{
+ CV_INSTRUMENT_REGION();
// the loop is simple enough, so we let the compiler to vectorize it
for( int i = 0; i < len; i++ )
- arr[i] = scaleBiasPairs[i*2 + 1];
+ arr[i] += scaleBiasPairs[i*2 + 1];
}
-}*/
+CV_CPU_OPTIMIZATION_NAMESPACE_END
+} // namespace cv::hal
+
+// cv::
+CV_CPU_OPTIMIZATION_NAMESPACE_BEGIN
template<typename _Ts, typename _Td, typename _Twvec> static inline void
cvt_( const _Ts* src, size_t sstep, _Td* dst, size_t dstep, Size size )
DEF_CVT_FUNC(8u32s, cvt_, uchar, int, v_int32)
DEF_CVT_FUNC(8u32f, cvt_, uchar, float, v_float32)
DEF_CVT_FUNC(8u64f, cvt_, uchar, double, v_int32)
-//DEF_CVT_FUNC(8u16f, cvt1_, uchar, float16_t, v_float32)
+DEF_CVT_FUNC(8u16f, cvt1_, uchar, float16_t, v_float32)
////////////////////// 8s -> ... ////////////////////////
DEF_CVT_FUNC(8s32s, cvt_, schar, int, v_int32)
DEF_CVT_FUNC(8s32f, cvt_, schar, float, v_float32)
DEF_CVT_FUNC(8s64f, cvt_, schar, double, v_int32)
-//DEF_CVT_FUNC(8s16f, cvt1_, schar, float16_t, v_float32)
+DEF_CVT_FUNC(8s16f, cvt1_, schar, float16_t, v_float32)
////////////////////// 16u -> ... ////////////////////////
DEF_CVT_FUNC(16u32s, cvt_, ushort, int, v_int32)
DEF_CVT_FUNC(16u32f, cvt_, ushort, float, v_float32)
DEF_CVT_FUNC(16u64f, cvt_, ushort, double, v_int32)
-//DEF_CVT_FUNC(16u16f, cvt1_,ushort, float16_t, v_float32)
+DEF_CVT_FUNC(16u16f, cvt1_,ushort, float16_t, v_float32)
////////////////////// 16s -> ... ////////////////////////
DEF_CVT_FUNC(16s32s, cvt_, short, int, v_int32)
DEF_CVT_FUNC(16s32f, cvt_, short, float, v_float32)
DEF_CVT_FUNC(16s64f, cvt_, short, double, v_int32)
-//DEF_CVT_FUNC(16s16f, cvt1_,short, float16_t, v_float32)
+DEF_CVT_FUNC(16s16f, cvt1_,short, float16_t, v_float32)
////////////////////// 32s -> ... ////////////////////////
DEF_CVT_FUNC(32s16s, cvt_, int, short, v_int32)
DEF_CVT_FUNC(32s32f, cvt_, int, float, v_float32)
DEF_CVT_FUNC(32s64f, cvt_, int, double, v_int32)
-//DEF_CVT_FUNC(32s16f, cvt1_,int, float16_t, v_float32)
+DEF_CVT_FUNC(32s16f, cvt1_,int, float16_t, v_float32)
////////////////////// 32f -> ... ////////////////////////
DEF_CVT_FUNC(64f16s, cvt_, double, short, v_int32)
DEF_CVT_FUNC(64f32s, cvt_, double, int, v_int32)
DEF_CVT_FUNC(64f32f, cvt_, double, float, v_float32)
-//DEF_CVT_FUNC(64f16f, cvt1_,double, float16_t, v_float32)
+DEF_CVT_FUNC(64f16f, cvt1_,double, float16_t, v_float32)
////////////////////// 16f -> ... ////////////////////////
-//DEF_CVT_FUNC(16f8u, cvt_, float16_t, uchar, v_float32)
-//DEF_CVT_FUNC(16f8s, cvt_, float16_t, schar, v_float32)
-//DEF_CVT_FUNC(16f16u, cvt1_, float16_t, ushort, v_float32)
-//DEF_CVT_FUNC(16f16s, cvt1_, float16_t, short, v_float32)
-//DEF_CVT_FUNC(16f32s, cvt1_, float16_t, int, v_float32)
+DEF_CVT_FUNC(16f8u, cvt_, float16_t, uchar, v_float32)
+DEF_CVT_FUNC(16f8s, cvt_, float16_t, schar, v_float32)
+DEF_CVT_FUNC(16f16u, cvt1_, float16_t, ushort, v_float32)
+DEF_CVT_FUNC(16f16s, cvt1_, float16_t, short, v_float32)
+DEF_CVT_FUNC(16f32s, cvt1_, float16_t, int, v_float32)
DEF_CVT_FUNC(16f32f, cvt1_, float16_t, float, v_float32)
-//DEF_CVT_FUNC(16f64f, cvt1_, float16_t, double, v_float32)
+DEF_CVT_FUNC(16f64f, cvt1_, float16_t, double, v_float32)
///////////// "conversion" w/o conversion ///////////////
{
(cvt8u), (cvt8s8u), (cvt16u8u),
(cvt16s8u), (cvt32s8u), (cvt32f8u),
- (cvt64f8u), 0 //(cvt16f8u)
+ (cvt64f8u), (cvt16f8u)
},
{
(cvt8u8s), cvt8u, (cvt16u8s),
(cvt16s8s), (cvt32s8s), (cvt32f8s),
- (cvt64f8s), 0 //(cvt16f8s)
+ (cvt64f8s), (cvt16f8s)
},
{
(cvt8u16u), (cvt8s16u), cvt16u,
(cvt16s16u), (cvt32s16u), (cvt32f16u),
- (cvt64f16u), 0 //(cvt16f16u)
+ (cvt64f16u), (cvt16f16u)
},
{
(cvt8u16s), (cvt8s16s), (cvt16u16s),
cvt16u, (cvt32s16s), (cvt32f16s),
- (cvt64f16s), 0 //(cvt16f16s)
+ (cvt64f16s), (cvt16f16s)
},
{
(cvt8u32s), (cvt8s32s), (cvt16u32s),
(cvt16s32s), cvt32s, (cvt32f32s),
- (cvt64f32s), 0 //(cvt16f32s)
+ (cvt64f32s), (cvt16f32s)
},
{
(cvt8u32f), (cvt8s32f), (cvt16u32f),
(cvt16s32f), (cvt32s32f), cvt32s,
- (cvt64f32f), 0 //(cvt16f32f)
+ (cvt64f32f), (cvt16f32f)
},
{
(cvt8u64f), (cvt8s64f), (cvt16u64f),
(cvt16s64f), (cvt32s64f), (cvt32f64f),
- (cvt64s), 0 //(cvt16f64f)
+ (cvt64s), (cvt16f64f)
},
{
- 0, 0, 0, 0, 0, 0, 0, 0
- //(cvt8u16f), (cvt8s16f), (cvt16u16f), (cvt16s16f),
- //(cvt32s16f), (cvt32f16f), (cvt64f16f), (cvt16u)
+ (cvt8u16f), (cvt8s16f), (cvt16u16f), (cvt16s16f),
+ (cvt32s16f), (cvt32f16f), (cvt64f16f), (cvt16u)
}
};
return cvtTab[CV_MAT_DEPTH(ddepth)][CV_MAT_DEPTH(sdepth)];
}
-BinaryFunc get_cvt32f16f()
-{
- return cvt32f16f;
-}
-
-BinaryFunc get_cvt16f32f()
-{
- return cvt16f32f;
-}
-
-#endif
-
CV_CPU_OPTIMIZATION_NAMESPACE_END
+#endif
} // namespace