From 5f23d999185e8392eccf0f21b6434e4d4814c27f Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Fri, 10 Oct 2014 11:05:19 +0000 Subject: [PATCH] the rest modes of cv::Mat::convertTo --- modules/core/src/convert.cpp | 62 ++++++++++++++++++++++++++++++++++++++++ modules/imgproc/src/corner.cpp | 2 ++ modules/imgproc/src/pyramids.cpp | 2 ++ 3 files changed, 66 insertions(+) diff --git a/modules/core/src/convert.cpp b/modules/core/src/convert.cpp index 67adfde..9d758e7 100644 --- a/modules/core/src/convert.cpp +++ b/modules/core/src/convert.cpp @@ -2448,6 +2448,25 @@ struct Cvt_SIMD }; template <> +struct Cvt_SIMD +{ + int operator() (const schar * src, ushort * dst, int width) const + { + int x = 0; + + for ( ; x <= width - 8; x += 8) + { + int16x8_t v_src = vmovl_s8(vld1_s8(src + x)); + vst1q_u16(dst + x, vcombine_u16(vqmovun_s32(vmovl_s16(vget_low_s16(v_src))), + vqmovun_s32(vmovl_s16(vget_high_s16(v_src))))); + } + + return x; + } +}; + + +template <> struct Cvt_SIMD { int operator() (const schar * src, int * dst, int width) const @@ -2503,6 +2522,49 @@ struct Cvt_SIMD }; template <> +struct Cvt_SIMD +{ + int operator() (const ushort * src, schar * dst, int width) const + { + int x = 0; + + for ( ; x <= width - 16; x += 16) + { + uint16x8_t v_src1 = vld1q_u16(src + x), v_src2 = vld1q_u16(src + x + 8); + int32x4_t v_dst10 = vreinterpretq_s32_u32(vmovl_u16(vget_low_u16(v_src1))); + int32x4_t v_dst11 = vreinterpretq_s32_u32(vmovl_u16(vget_high_u16(v_src1))); + int32x4_t v_dst20 = vreinterpretq_s32_u32(vmovl_u16(vget_low_u16(v_src2))); + int32x4_t v_dst21 = vreinterpretq_s32_u32(vmovl_u16(vget_high_u16(v_src2))); + + vst1q_s8(dst + x, vcombine_s8(vqmovn_s16(vcombine_s16(vqmovn_s32(v_dst10), vqmovn_s32(v_dst11))), + vqmovn_s16(vcombine_s16(vqmovn_s32(v_dst20), vqmovn_s32(v_dst21))))); + } + + return x; + } +}; + +template <> +struct Cvt_SIMD +{ + int operator() (const ushort * src, short * dst, int width) const + { + int x = 0; + + for ( ; x <= width - 8; x += 8) + { + uint16x8_t v_src = vld1q_u16(src + x); + int32x4_t v_dst0 = vreinterpretq_s32_u32(vmovl_u16(vget_low_u16(v_src))); + int32x4_t v_dst1 = vreinterpretq_s32_u32(vmovl_u16(vget_high_u16(v_src))); + + vst1q_s16(dst + x, vcombine_s16(vqmovn_s32(v_dst0), vqmovn_s32(v_dst1))); + } + + return x; + } +}; + +template <> struct Cvt_SIMD { int operator() (const ushort * src, int * dst, int width) const diff --git a/modules/imgproc/src/corner.cpp b/modules/imgproc/src/corner.cpp index 4d55a4f..096997a 100644 --- a/modules/imgproc/src/corner.cpp +++ b/modules/imgproc/src/corner.cpp @@ -618,7 +618,9 @@ void cv::preCornerDetect( InputArray _src, OutputArray _dst, int ksize, int bord if( src.depth() == CV_8U ) factor *= 255; factor = 1./(factor * factor * factor); +#if CV_NEON || CV_SSE2 float factor_f = (float)factor; +#endif #if CV_SSE2 volatile bool haveSSE2 = cv::checkHardwareSupport(CV_CPU_SSE2); diff --git a/modules/imgproc/src/pyramids.cpp b/modules/imgproc/src/pyramids.cpp index ad10f29..8a8515e 100644 --- a/modules/imgproc/src/pyramids.cpp +++ b/modules/imgproc/src/pyramids.cpp @@ -181,6 +181,8 @@ struct PyrDownVec_32f typedef NoVec PyrDownVec_32s16u; typedef NoVec PyrDownVec_32s16s; +typedef NoVec PyrUpVec_32f; + #elif CV_NEON struct PyrDownVec_32s8u -- 2.7.4