Added new data types to cv::Mat & UMat#23865
Conversation
| #endif | ||
| }; | ||
|
|
||
| class bfloat16_t |
There was a problem hiding this comment.
It can conflict with C++23 floating-point types: https://en.cppreference.com/w/cpp/types/floating-point , though the same issue can be seen with the float16_t.
There was a problem hiding this comment.
thanks for the link, I did not know about those new type definitions. Yes, it would be nice to resolve possible name conflicts.
opencv-alalek
left a comment
There was a problem hiding this comment.
Don't forget to mention related discussions #12584
|
|
||
| std::vector<cv::Mat> img_pts_cams(num_cameras); | ||
| std::vector<bool> visible(num_cameras, false); | ||
| std::vector<uchar> visible(num_cameras, (uchar)0); |
There was a problem hiding this comment.
why?
where is it used with OpenCV API?
There was a problem hiding this comment.
the change makes the test pass
| #define CV_64F 6 | ||
| #define CV_16F 7 | ||
| #define CV_16BF 8 | ||
| #define CV_Bool 9 |
There was a problem hiding this comment.
all uppercase.
P.S. Put #undef in GAPI header.
Finally we should drop defines and start using of C++ enums.
There was a problem hiding this comment.
postpone it till the next patch
| CV_16U - 2 bytes | ||
| ... | ||
| */ | ||
| #define CV_ELEM_SIZE1(type) ((int)(0x4881228442211ULL >> CV_MAT_DEPTH(type) * 4) & 15) |
There was a problem hiding this comment.
CV_MAT_DEPTH(type) * 4 => (CV_MAT_DEPTH(type) * 4)
There was a problem hiding this comment.
so far there is no warning
| #endif | ||
|
|
||
| #if (!defined CV_SIMD_64F) || (!CV_SIMD_64F) | ||
| typedef struct v_float64 { int dummy; } v_float64; |
There was a problem hiding this comment.
It is better to drop this hack,
If we don't have type support, then we don't declare type itself.
There was a problem hiding this comment.
disagree; v_float64 and the relevant ops should always be available. CV_SIMD_64F and code fragmentation was a bad idea
| inline v_int64x4 operator > (const v_int64x4& a, const v_int64x4& b) | ||
| { return v_int64x4(_mm256_cmpgt_epi64(a.val, b.val)); } | ||
| inline v_int64x4 operator < (const v_int64x4& a, const v_int64x4& b) | ||
| { return v_int64x4(_mm256_cmpgt_epi64(b.val, a.val)); } |
There was a problem hiding this comment.
Adding of new intrinsic functions requires modification of C++ reference code / documentation and adding new tests.
| data += sizeof(int); | ||
| break; | ||
| case CV_64U: | ||
| ptr = fs::itoa(*(uint64_t*) data, buf, 10, false); |
There was a problem hiding this comment.
What implementation supports uint64_t?
modules/core/src/persistence.cpp
Outdated
| const int radix = 10; | ||
| char* ptr=buffer + 23 /* enough even for 64-bit integers */; | ||
| int sign = _signed && _val < 0 ? -1 : 1; | ||
| uint64_t val = _signed ? *(uint64_t*)&_val : abs(_val); |
There was a problem hiding this comment.
does it really work? condition is wrong
It is better to have different overloads instead.
There was a problem hiding this comment.
right, that was a bug; fixed
|
|
||
| Mat m16bfc1, m16bfc3; | ||
| m16fc1.convertTo(m16bfc1, CV_16BF); | ||
| m16fc3.convertTo(m16bfc3, CV_16BF); |
There was a problem hiding this comment.
test_20279
It is better to write own test function instead of hijacking of existed one.
| if (depth > 7) { | ||
| // [TODO] temporary hack; remove after rebuilding plugins or add a new | ||
| // version of plugins. Convert type from the old one to the new one (5 bits) | ||
| type = CV_MAKETYPE((type & 7), (type >> 3) + 1); |
There was a problem hiding this comment.
It is time to drop hack on the line 148 of this file.
There was a problem hiding this comment.
I guess, it's a subject or a separate PR; feel free to submit it later
| img_pts2.copyTo(image_points_all[1][i]); | ||
| } | ||
| std::vector<Size> image_sizes (2, imageSize); | ||
| Mat visibility_mat = Mat_<bool>::ones(2, numImgs); |
There was a problem hiding this comment.
@asmorkalov Need to cleanup this buggy code from 4.x too.
And look on traits why they doesn't disable that.
There was a problem hiding this comment.
yes, it's a subject or separate PR
65fe53e to
9805a62
Compare
…g randf_64f to exact version used before
…quite strong) assumption that video capture would give us frames with depth == CV_8U (0) or CV_16U (2). If depth is > 7 then it means that the plugin is built with the old OpenCV. It needs to be recompiled, of course and then this hack can be removed.
9805a62 to
127fe75
Compare
2. restored ==, !=, > and < univ. intrinsics on ARM32/ARM64.
|
Will this patch be ported back to 4.x? |
|
Hi @vpisarev, which is our main development branch now? |
This is updated version of #23591.
The related opencv_contrib PR: opencv/opencv_contrib#3523
FP16<=>FP32).Let's see how many tests fail.
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.