mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +04:00
Merge pull request #26590 from Kumataro:fix26589
Support C++20 standard #26590 Close https://github.com/opencv/opencv/issues/26589 Related https://github.com/opencv/opencv_contrib/pull/3842 Related: https://github.com/opencv/opencv/issues/20269 - do not arithmetic enums and ( different enums or floating numeric) - remove unused variable ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
@@ -1982,7 +1982,7 @@ struct RGB2Lab_f
|
||||
clipv(bvec0); clipv(bvec1);
|
||||
#undef clipv
|
||||
/* int iR = R*LAB_BASE, iG = G*LAB_BASE, iB = B*LAB_BASE, iL, ia, ib; */
|
||||
v_float32 basef = vx_setall_f32(LAB_BASE);
|
||||
v_float32 basef = vx_setall_f32(static_cast<float>(LAB_BASE));
|
||||
rvec0 = v_mul(rvec0, basef), gvec0 = v_mul(gvec0, basef), bvec0 = v_mul(bvec0, basef);
|
||||
rvec1 = v_mul(rvec1, basef), gvec1 = v_mul(gvec1, basef), bvec1 = v_mul(bvec1, basef);
|
||||
|
||||
@@ -2013,14 +2013,14 @@ struct RGB2Lab_f
|
||||
b_vec0 = v_cvt_f32(i_bvec0); b_vec1 = v_cvt_f32(i_bvec1);
|
||||
|
||||
/* dst[i] = L*100.0f */
|
||||
v_float32 v100dBase = vx_setall_f32(100.0f/LAB_BASE);
|
||||
v_float32 v100dBase = vx_setall_f32(100.0f / static_cast<float>(LAB_BASE));
|
||||
l_vec0 = v_mul(l_vec0, v100dBase);
|
||||
l_vec1 = v_mul(l_vec1, v100dBase);
|
||||
/*
|
||||
dst[i + 1] = a*256.0f - 128.0f;
|
||||
dst[i + 2] = b*256.0f - 128.0f;
|
||||
*/
|
||||
v_float32 v256dBase = vx_setall_f32(256.0f/LAB_BASE), vm128 = vx_setall_f32(-128.f);
|
||||
v_float32 v256dBase = vx_setall_f32(256.0f / static_cast<float>(LAB_BASE)), vm128 = vx_setall_f32(-128.f);
|
||||
a_vec0 = v_fma(a_vec0, v256dBase, vm128);
|
||||
a_vec1 = v_fma(a_vec1, v256dBase, vm128);
|
||||
b_vec0 = v_fma(b_vec0, v256dBase, vm128);
|
||||
@@ -2038,10 +2038,10 @@ struct RGB2Lab_f
|
||||
float G = clip(src[1]);
|
||||
float B = clip(src[bIdx^2]);
|
||||
|
||||
int iR = cvRound(R*LAB_BASE), iG = cvRound(G*LAB_BASE), iB = cvRound(B*LAB_BASE);
|
||||
int iR = cvRound(R*static_cast<float>(LAB_BASE)), iG = cvRound(G*static_cast<float>(LAB_BASE)), iB = cvRound(B*static_cast<float>(LAB_BASE));
|
||||
int iL, ia, ib;
|
||||
trilinearInterpolate(iR, iG, iB, LABLUVLUTs16.RGB2LabLUT_s16, iL, ia, ib);
|
||||
float L = iL*1.0f/LAB_BASE, a = ia*1.0f/LAB_BASE, b = ib*1.0f/LAB_BASE;
|
||||
float L = iL*1.0f/static_cast<float>(LAB_BASE), a = ia*1.0f/static_cast<float>(LAB_BASE), b = ib*1.0f/static_cast<float>(LAB_BASE);
|
||||
|
||||
dst[i] = L*100.0f;
|
||||
dst[i + 1] = a*256.0f - 128.0f;
|
||||
|
||||
@@ -43,7 +43,6 @@ using namespace cv;
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
||||
enum { XY_SHIFT = 16, XY_ONE = 1 << XY_SHIFT, DRAWING_STORAGE_BLOCK = (1<<12) - 256 };
|
||||
|
||||
static const int MAX_THICKNESS = 32767;
|
||||
@@ -1027,8 +1026,8 @@ EllipseEx( Mat& img, Point2l center, Size2l axes,
|
||||
for (unsigned int i = 0; i < _v.size(); ++i)
|
||||
{
|
||||
Point2l pt;
|
||||
pt.x = (int64)cvRound(_v[i].x / XY_ONE) << XY_SHIFT;
|
||||
pt.y = (int64)cvRound(_v[i].y / XY_ONE) << XY_SHIFT;
|
||||
pt.x = (int64)cvRound(_v[i].x / static_cast<double>(XY_ONE)) << XY_SHIFT;
|
||||
pt.y = (int64)cvRound(_v[i].y / static_cast<double>(XY_ONE)) << XY_SHIFT;
|
||||
pt.x += cvRound(_v[i].x - pt.x);
|
||||
pt.y += cvRound(_v[i].y - pt.y);
|
||||
if (pt != prevPt) {
|
||||
@@ -1645,7 +1644,7 @@ static void
|
||||
ThickLine( Mat& img, Point2l p0, Point2l p1, const void* color,
|
||||
int thickness, int line_type, int flags, int shift )
|
||||
{
|
||||
static const double INV_XY_ONE = 1./XY_ONE;
|
||||
static const double INV_XY_ONE = 1./static_cast<double>(XY_ONE);
|
||||
|
||||
p0.x <<= XY_SHIFT - shift;
|
||||
p0.y <<= XY_SHIFT - shift;
|
||||
@@ -1981,8 +1980,8 @@ void ellipse(InputOutputArray _img, const RotatedRect& box, const Scalar& color,
|
||||
int _angle = cvRound(box.angle);
|
||||
Point2l center(cvRound(box.center.x),
|
||||
cvRound(box.center.y));
|
||||
center.x = (center.x << XY_SHIFT) + cvRound((box.center.x - center.x)*XY_ONE);
|
||||
center.y = (center.y << XY_SHIFT) + cvRound((box.center.y - center.y)*XY_ONE);
|
||||
center.x = (center.x << XY_SHIFT) + cvRound((box.center.x - center.x)*static_cast<float>(XY_ONE));
|
||||
center.y = (center.y << XY_SHIFT) + cvRound((box.center.y - center.y)*static_cast<float>(XY_ONE));
|
||||
Size2l axes(cvRound(box.size.width),
|
||||
cvRound(box.size.height));
|
||||
axes.width = (axes.width << (XY_SHIFT - 1)) + cvRound((box.size.width - axes.width)*(XY_ONE>>1));
|
||||
@@ -2303,7 +2302,7 @@ void putText( InputOutputArray _img, const String& text, Point org,
|
||||
scalarToRawData(color, buf, img.type(), 0);
|
||||
|
||||
int base_line = -(ascii[0] & 15);
|
||||
int hscale = cvRound(fontScale*XY_ONE), vscale = hscale;
|
||||
int hscale = cvRound(fontScale * static_cast<double>(XY_ONE)), vscale = hscale;
|
||||
|
||||
if( line_type == cv::LINE_AA && img.depth() != CV_8U )
|
||||
line_type = 8;
|
||||
|
||||
@@ -692,7 +692,11 @@ namespace
|
||||
getContourPoints(edges, dx, dy, points);
|
||||
|
||||
features.resize(levels_ + 1);
|
||||
std::for_each(features.begin(), features.end(), [=](std::vector<Feature>& e) { e.clear(); e.reserve(maxBufferSize_); });
|
||||
const size_t maxBufferSize = maxBufferSize_;
|
||||
std::for_each(features.begin(), features.end(), [maxBufferSize](std::vector<Feature>& e) {
|
||||
e.clear();
|
||||
e.reserve(maxBufferSize);
|
||||
});
|
||||
|
||||
for (size_t i = 0; i < points.size(); ++i)
|
||||
{
|
||||
|
||||
@@ -1283,7 +1283,7 @@ void cv::calcHist( InputArrayOfArrays images, const std::vector<int>& channels,
|
||||
CV_OCL_RUN(images.total() == 1 && channels.size() == 1 && images.channels(0) == 1 &&
|
||||
channels[0] == 0 && images.isUMatVector() && mask.empty() && !accumulate &&
|
||||
histSize.size() == 1 && histSize[0] == BINS && ranges.size() == 2 &&
|
||||
ranges[0] == 0 && ranges[1] == BINS,
|
||||
ranges[0] == 0 && ranges[1] == static_cast<float>(BINS),
|
||||
ocl_calcHist(images, hist))
|
||||
|
||||
int i, dims = (int)histSize.size(), rsz = (int)ranges.size(), csz = (int)channels.size();
|
||||
|
||||
@@ -1274,8 +1274,8 @@ public:
|
||||
#endif
|
||||
for( ; x1 < bcols; x1++ )
|
||||
{
|
||||
int sx = cvRound(sX[x1]*INTER_TAB_SIZE);
|
||||
int sy = cvRound(sY[x1]*INTER_TAB_SIZE);
|
||||
int sx = cvRound(sX[x1]*static_cast<float>(INTER_TAB_SIZE));
|
||||
int sy = cvRound(sY[x1]*static_cast<float>(INTER_TAB_SIZE));
|
||||
int v = (sy & (INTER_TAB_SIZE-1))*INTER_TAB_SIZE + (sx & (INTER_TAB_SIZE-1));
|
||||
XY[x1*2] = saturate_cast<short>(sx >> INTER_BITS);
|
||||
XY[x1*2+1] = saturate_cast<short>(sy >> INTER_BITS);
|
||||
@@ -1314,8 +1314,8 @@ public:
|
||||
|
||||
for( ; x1 < bcols; x1++ )
|
||||
{
|
||||
int sx = cvRound(sXY[x1*2]*INTER_TAB_SIZE);
|
||||
int sy = cvRound(sXY[x1*2+1]*INTER_TAB_SIZE);
|
||||
int sx = cvRound(sXY[x1*2]*static_cast<float>(INTER_TAB_SIZE));
|
||||
int sy = cvRound(sXY[x1*2+1]*static_cast<float>(INTER_TAB_SIZE));
|
||||
int v = (sy & (INTER_TAB_SIZE-1))*INTER_TAB_SIZE + (sx & (INTER_TAB_SIZE-1));
|
||||
XY[x1*2] = saturate_cast<short>(sx >> INTER_BITS);
|
||||
XY[x1*2+1] = saturate_cast<short>(sy >> INTER_BITS);
|
||||
@@ -1991,7 +1991,7 @@ void cv::convertMaps( InputArray _map1, InputArray _map2,
|
||||
bool useSSE4_1 = CV_CPU_HAS_SUPPORT_SSE4_1;
|
||||
#endif
|
||||
|
||||
const float scale = 1.f/INTER_TAB_SIZE;
|
||||
const float scale = 1.f/static_cast<float>(INTER_TAB_SIZE);
|
||||
int x, y;
|
||||
for( y = 0; y < size.height; y++ )
|
||||
{
|
||||
@@ -2071,8 +2071,8 @@ void cv::convertMaps( InputArray _map1, InputArray _map2,
|
||||
#endif
|
||||
for( ; x < size.width; x++ )
|
||||
{
|
||||
int ix = saturate_cast<int>(src1f[x]*INTER_TAB_SIZE);
|
||||
int iy = saturate_cast<int>(src2f[x]*INTER_TAB_SIZE);
|
||||
int ix = saturate_cast<int>(src1f[x]*static_cast<float>(INTER_TAB_SIZE));
|
||||
int iy = saturate_cast<int>(src2f[x]*static_cast<float>(INTER_TAB_SIZE));
|
||||
dst1[x*2] = saturate_cast<short>(ix >> INTER_BITS);
|
||||
dst1[x*2+1] = saturate_cast<short>(iy >> INTER_BITS);
|
||||
dst2[x] = (ushort)((iy & (INTER_TAB_SIZE-1))*INTER_TAB_SIZE + (ix & (INTER_TAB_SIZE-1)));
|
||||
@@ -2117,8 +2117,8 @@ void cv::convertMaps( InputArray _map1, InputArray _map2,
|
||||
#endif
|
||||
for( ; x < size.width; x++ )
|
||||
{
|
||||
int ix = saturate_cast<int>(src1f[x*2]*INTER_TAB_SIZE);
|
||||
int iy = saturate_cast<int>(src1f[x*2+1]*INTER_TAB_SIZE);
|
||||
int ix = saturate_cast<int>(src1f[x*2]*static_cast<float>(INTER_TAB_SIZE));
|
||||
int iy = saturate_cast<int>(src1f[x*2+1]*static_cast<float>(INTER_TAB_SIZE));
|
||||
dst1[x*2] = saturate_cast<short>(ix >> INTER_BITS);
|
||||
dst1[x*2+1] = saturate_cast<short>(iy >> INTER_BITS);
|
||||
dst2[x] = (ushort)((iy & (INTER_TAB_SIZE-1))*INTER_TAB_SIZE + (ix & (INTER_TAB_SIZE-1)));
|
||||
@@ -3143,7 +3143,7 @@ void WarpPerspectiveLine_Process_CV_SIMD(const double *M, short* xy, short* alph
|
||||
for( ; x1 < bw; x1++ )
|
||||
{
|
||||
double W = W0 + M[6]*x1;
|
||||
W = W ? INTER_TAB_SIZE/W : 0;
|
||||
W = W ? static_cast<double>(INTER_TAB_SIZE)/W : 0;
|
||||
double fX = std::max((double)INT_MIN, std::min((double)INT_MAX, (X0 + M[0]*x1)*W));
|
||||
double fY = std::max((double)INT_MIN, std::min((double)INT_MAX, (Y0 + M[3]*x1)*W));
|
||||
int X = saturate_cast<int>(fX);
|
||||
|
||||
@@ -132,8 +132,8 @@ void convertMaps_32f1c16s_SSE41(const float* src1f, const float* src2f, short* d
|
||||
}
|
||||
for (; x < width; x++)
|
||||
{
|
||||
int ix = saturate_cast<int>(src1f[x] * INTER_TAB_SIZE);
|
||||
int iy = saturate_cast<int>(src2f[x] * INTER_TAB_SIZE);
|
||||
int ix = saturate_cast<int>(src1f[x] * static_cast<float>(INTER_TAB_SIZE));
|
||||
int iy = saturate_cast<int>(src2f[x] * static_cast<float>(INTER_TAB_SIZE));
|
||||
dst1[x * 2] = saturate_cast<short>(ix >> INTER_BITS);
|
||||
dst1[x * 2 + 1] = saturate_cast<short>(iy >> INTER_BITS);
|
||||
dst2[x] = (ushort)((iy & (INTER_TAB_SIZE - 1))*INTER_TAB_SIZE + (ix & (INTER_TAB_SIZE - 1)));
|
||||
@@ -165,8 +165,8 @@ void convertMaps_32f2c16s_SSE41(const float* src1f, short* dst1, ushort* dst2, i
|
||||
}
|
||||
for (; x < width; x++)
|
||||
{
|
||||
int ix = saturate_cast<int>(src1f[x * 2] * INTER_TAB_SIZE);
|
||||
int iy = saturate_cast<int>(src1f[x * 2 + 1] * INTER_TAB_SIZE);
|
||||
int ix = saturate_cast<int>(src1f[x * 2] * static_cast<float>(INTER_TAB_SIZE));
|
||||
int iy = saturate_cast<int>(src1f[x * 2 + 1] * static_cast<float>(INTER_TAB_SIZE));
|
||||
dst1[x * 2] = saturate_cast<short>(ix >> INTER_BITS);
|
||||
dst1[x * 2 + 1] = saturate_cast<short>(iy >> INTER_BITS);
|
||||
dst2[x] = (ushort)((iy & (INTER_TAB_SIZE - 1))*INTER_TAB_SIZE + (ix & (INTER_TAB_SIZE - 1)));
|
||||
@@ -444,7 +444,7 @@ public:
|
||||
for (; x1 < bw; x1++)
|
||||
{
|
||||
double W = W0 + M[6] * x1;
|
||||
W = W ? INTER_TAB_SIZE / W : 0;
|
||||
W = W ? static_cast<double>(INTER_TAB_SIZE) / W : 0;
|
||||
double fX = std::max((double)INT_MIN, std::min((double)INT_MAX, (X0 + M[0] * x1)*W));
|
||||
double fY = std::max((double)INT_MIN, std::min((double)INT_MAX, (Y0 + M[3] * x1)*W));
|
||||
int X = saturate_cast<int>(fX);
|
||||
|
||||
@@ -1056,7 +1056,7 @@ static bool ipp_crossCorr(const Mat& src, const Mat& tpl, Mat& dst, bool normed)
|
||||
if (ippiCrossCorrNorm==0)
|
||||
return false;
|
||||
|
||||
IppEnum funCfg = (IppEnum)(ippAlgAuto | ippiROIValid);
|
||||
IppEnum funCfg = (IppEnum)(+ippAlgAuto | ippiROIValid);
|
||||
if(normed)
|
||||
funCfg |= ippiNorm;
|
||||
else
|
||||
@@ -1093,7 +1093,7 @@ static bool ipp_sqrDistance(const Mat& src, const Mat& tpl, Mat& dst)
|
||||
if (ippiSqrDistanceNorm==0)
|
||||
return false;
|
||||
|
||||
IppEnum funCfg = (IppEnum)(ippAlgAuto | ippiROIValid | ippiNormNone);
|
||||
IppEnum funCfg = (IppEnum)(+ippAlgAuto | ippiROIValid | ippiNormNone);
|
||||
status = ippiSqrDistanceNormGetBufferSize(srcRoiSize, tplRoiSize, funCfg, &bufSize);
|
||||
if ( status < 0 )
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user