Compare commits

...

2 Commits

Author SHA1 Message Date
Alexander Smorkalov
4288cda8af Merge pull request #30711 from Kumataro:trial/donot_convert_from_enum_to_double
core, videoio: fix C++20 compilation warnings for enum-to-double conversions
2026-11-07 21:22:46 +03:00
Kumataro
e027ae3f3b core, videoio: fix C++20 compilation warnings for enum-to-double conversions
- Replace anonymous enums with `constexpr` variables.
- Add `static_cast<double>()` to enum values in `EXPECT_EQ` assertions.
2026-11-07 20:13:55 +09:00
6 changed files with 19 additions and 25 deletions

View File

@@ -73,17 +73,14 @@ enum Kind
KIND_MERGE // 2..4 planes are written into one interleaved stream (e.g. NCHW -> NHWC)
};
enum
{
TRANSPOSE_TILE = 64, // in elements
SPLIT_CHUNK = 1024, // in elements
ROW_CHUNK_BYTES = 64*1024,
GATHER_BLOCK_BYTES = 8*1024,
// costs are bytes weighted by the kernel; the copies are memory-bound,
// so small stripes only add overhead
PARALLEL_MIN_COST = 1024*1024,
STRIPE_COST = 1024*1024
};
constexpr int TRANSPOSE_TILE = 64; // in elements
constexpr int SPLIT_CHUNK = 1024; // in elements
constexpr int ROW_CHUNK_BYTES = 64*1024;
constexpr double GATHER_BLOCK_BYTES = 8*1024;
// costs are bytes weighted by the kernel; the copies are memory-bound,
// so small stripes only add overhead
constexpr double PARALLEL_MIN_COST = 1024*1024;
constexpr double STRIPE_COST = 1024*1024;
struct Plan
{

View File

@@ -17,14 +17,11 @@ namespace cv {
namespace {
enum
{
RND_MAX_DIMS = CV_MAX_DIM + 1, // + the channel axis
RND_BLOCK = 1024, // elements converted per call when the source needs conversion
RND_VCHUNK = 1024, // innermost-axis chunk in the vertical kernel
RND_SERIAL_WORK = 64*1024, // below this (source elements) everything runs in one thread
RND_STRIPE_WORK = 64*1024
};
constexpr int RND_MAX_DIMS = CV_MAX_DIM + 1; // + the channel axis
constexpr int RND_BLOCK = 1024; // elements converted per call when the source needs conversion
constexpr int RND_VCHUNK = 1024; // innermost-axis chunk in the vertical kernel
constexpr double RND_SERIAL_WORK = 64*1024; // below this (source elements) everything runs in one thread
constexpr double RND_STRIPE_WORK = 64*1024;
//////////////////////////////// vector traits ////////////////////////////////

View File

@@ -26,7 +26,7 @@ TEST_P(videoio_gstreamer, read_check)
ASSERT_NO_THROW(cap.open(pipeline.str(), CAP_GSTREAMER));
ASSERT_TRUE(cap.isOpened());
EXPECT_EQ(CAP_PROP_UNKNOWN, cap.get(CV__CAP_PROP_LATEST));
EXPECT_EQ(static_cast<double>(CAP_PROP_UNKNOWN), cap.get(CV__CAP_PROP_LATEST));
Mat buffer, decode_frame, gray_frame, rgb_frame;
for (int i = 0; i < count_frames; ++i)

View File

@@ -143,7 +143,7 @@ TEST(videoio_images, write_returns_status)
col.generate(1);
VideoWriter wri(col.getFirstFilename(), CAP_IMAGES, 0, 0, col.getFrame(0).size());
ASSERT_TRUE(wri.isOpened());
EXPECT_EQ(CAP_PROP_UNKNOWN, wri.get(CV__CAP_PROP_LATEST));
EXPECT_EQ(static_cast<double>(CAP_PROP_UNKNOWN), wri.get(CV__CAP_PROP_LATEST));
const Mat frame = col.getFrame(0);
@@ -346,7 +346,7 @@ TEST_P(videoio_image_seq_start, open)
ASSERT_TRUE(cap.open(pattern, apiPref,
{ CAP_PROP_IMAGE_SEQ_START, start }));
ASSERT_TRUE(cap.isOpened());
EXPECT_EQ(CAP_PROP_UNKNOWN, cap.get(CV__CAP_PROP_LATEST));
EXPECT_EQ(static_cast<double>(CAP_PROP_UNKNOWN), cap.get(CV__CAP_PROP_LATEST));
for (size_t idx = 0; idx < count; ++idx)
{
Mat img;

View File

@@ -169,7 +169,7 @@ TEST(videoio_ffmpeg, camera_index)
ASSERT_TRUE(cap.open(0, CAP_FFMPEG));
Mat frame;
ASSERT_TRUE(cap.read(frame));
EXPECT_EQ(CAP_PROP_UNKNOWN, cap.get(CV__CAP_PROP_LATEST));
EXPECT_EQ(static_cast<double>(CAP_PROP_UNKNOWN), cap.get(CV__CAP_PROP_LATEST));
ASSERT_FALSE(frame.empty());
}

View File

@@ -65,7 +65,7 @@ public:
return;
}
EXPECT_EQ(CAP_PROP_UNKNOWN, cap.get(CV__CAP_PROP_LATEST));
EXPECT_EQ(static_cast<double>(CAP_PROP_UNKNOWN), cap.get(CV__CAP_PROP_LATEST));
int n_frames = -1;
EXPECT_NO_THROW(n_frames = (int)cap.get(CAP_PROP_FRAME_COUNT));
@@ -535,7 +535,7 @@ TEST_P(Videoio_Writer, write_nothing)
EXPECT_NO_THROW(writer.open(video_file, apiPref, fourcc, fps, frame_size, true));
ASSERT_TRUE(writer.isOpened());
EXPECT_EQ(cv::VIDEOWRITER_PROP_UNKNOWN, writer.get(CV__CAP_PROP_LATEST));
EXPECT_EQ(static_cast<double>(cv::VIDEOWRITER_PROP_UNKNOWN), writer.get(CV__CAP_PROP_LATEST));
#if 0 // no frames
cv::Mat m(frame_size, CV_8UC3, Scalar::all(127));