v4sf DisplayFunctionGGBA::inv_display( v4sf L ) { const v4sf voffset = _mm_set1_ps(L_offset); const v4sf vmax = _mm_set1_ps(L_max); L = _mm_max_ps(L, voffset); L = _mm_min_ps(L, voffset+vmax); return _mm_pow_ps((L - voffset)/(vmax-_mm_set1_ps(L_black)), _mm_set1_ps(1.0f/gamma)); }
void pow_fmath(const Mat& src, const float a, Mat & dest) { if (dest.empty())dest.create(src.size(), CV_32F); int width = src.cols; int height = src.rows; int size = src.size().area(); int i = 0; const float* s = src.ptr<float>(0); float* d = dest.ptr<float>(0); const __m128 ma = _mm_set1_ps(a); for (i = 0; i <= size - 4; i += 4) { _mm_store_ps(d + i, _mm_pow_ps(_mm_load_ps(s + i), ma)); } for (; i < size; i++) { d[i] = cv::pow(s[i], a); } }
void pow_fmath(const Mat& src1, const Mat& src2, Mat & dest) { if (dest.empty())dest.create(src1.size(), CV_32F); int width = src1.cols; int height = src1.rows; int size = src1.size().area(); int i = 0; const float* s1 = src1.ptr<float>(0); const float* s2 = src2.ptr<float>(0); float* d = dest.ptr<float>(0); for (i = 0; i <= size - 4; i += 4) { _mm_store_ps(d + i, _mm_pow_ps(_mm_load_ps(s1 + i), _mm_load_ps(s2 + i))); } for (; i < size; i++) { d[i] = cv::pow(s1[i], s2[i]); } }
v4sf DisplayFunctionGGBA::display( v4sf pix ) { return _mm_pow_ps(pix, _mm_set1_ps(gamma)) * (_mm_set1_ps(L_max)-_mm_set1_ps(L_black)) + _mm_set1_ps(L_offset); }