Merge branch 4.x

This commit is contained in:
Alexander Smorkalov 2024-11-06 08:20:12 +03:00
commit 03983549fc
21 changed files with 100 additions and 122 deletions

View File

@ -1,3 +1,6 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
#ifndef OPENCV_HAL_RVV_MERGE_HPP_INCLUDED #ifndef OPENCV_HAL_RVV_MERGE_HPP_INCLUDED
#define OPENCV_HAL_RVV_MERGE_HPP_INCLUDED #define OPENCV_HAL_RVV_MERGE_HPP_INCLUDED

View File

@ -20,4 +20,5 @@ else()
set(THE_ROOT "${OpenCV_BINARY_DIR}/3rdparty/kleidicv/kleidicv-${KLEIDICV_SRC_COMMIT}") set(THE_ROOT "${OpenCV_BINARY_DIR}/3rdparty/kleidicv/kleidicv-${KLEIDICV_SRC_COMMIT}")
endif() endif()
option(KLEIDICV_ENABLE_SME2 "" OFF) # not compatible with some CLang versions in NDK
include("${THE_ROOT}/adapters/opencv/CMakeLists.txt") include("${THE_ROOT}/adapters/opencv/CMakeLists.txt")

View File

@ -915,16 +915,6 @@ macro(ocv_create_module)
POST_BUILD POST_BUILD
COMMAND link.exe /edit /APPCONTAINER:NO $(TargetPath)) COMMAND link.exe /edit /APPCONTAINER:NO $(TargetPath))
endif() endif()
if("${the_module}" STREQUAL "opencv_ts")
# copy required dll files; WinRT apps need these dlls that are usually substituted by Visual Studio
# however they are not on path and need to be placed with executables to run from console w/o APPCONTAINER
add_custom_command(TARGET ${the_module}
POST_BUILD
COMMAND copy /y "\"$(VCInstallDir)redist\\$(PlatformTarget)\\Microsoft.VC$(PlatformToolsetVersion).CRT\\msvcp$(PlatformToolsetVersion).dll\"" "\"${CMAKE_BINARY_DIR}\\bin\\$(Configuration)\\msvcp$(PlatformToolsetVersion)_app.dll\""
COMMAND copy /y "\"$(VCInstallDir)redist\\$(PlatformTarget)\\Microsoft.VC$(PlatformToolsetVersion).CRT\\msvcr$(PlatformToolsetVersion).dll\"" "\"${CMAKE_BINARY_DIR}\\bin\\$(Configuration)\\msvcr$(PlatformToolsetVersion)_app.dll\""
COMMAND copy /y "\"$(VCInstallDir)redist\\$(PlatformTarget)\\Microsoft.VC$(PlatformToolsetVersion).CRT\\vccorlib$(PlatformToolsetVersion).dll\"" "\"${CMAKE_BINARY_DIR}\\bin\\$(Configuration)\\vccorlib$(PlatformToolsetVersion)_app.dll\"")
endif()
endif() endif()
endmacro() endmacro()

View File

@ -9,6 +9,8 @@
#error "Build configuration error" #error "Build configuration error"
#endif #endif
#pragma warning(disable:4447) // Disable warning 'main' signature found without threading model
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>

View File

@ -11,7 +11,7 @@ Simple Thresholding
------------------- -------------------
Here, the matter is straight-forward. For every pixel, the same threshold value is applied. Here, the matter is straight-forward. For every pixel, the same threshold value is applied.
If the pixel value is smaller than the threshold, it is set to 0, otherwise it is set to a maximum value. If the pixel value is smaller than or equal to the threshold, it is set to 0, otherwise it is set to a maximum value.
The function **cv.threshold** is used to apply the thresholding. The function **cv.threshold** is used to apply the thresholding.
The first argument is the source image, which **should be a grayscale image**. The first argument is the source image, which **should be a grayscale image**.
The second argument is the threshold value which is used to classify the pixel values. The second argument is the threshold value which is used to classify the pixel values.

View File

@ -164,9 +164,9 @@ bool getBinLocation(std::string& dst)
#ifdef _WIN32 #ifdef _WIN32
bool getBinLocation(std::wstring& dst) bool getBinLocation(std::wstring& dst)
{ {
void* addr = (void*)getModuleLocation; // using code address, doesn't work with static linkage!
HMODULE m = 0; HMODULE m = 0;
#if _WIN32_WINNT >= 0x0501 && (!defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP)) #if _WIN32_WINNT >= 0x0501 && (!defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP))
void* addr = (void*)getModuleLocation; // using code address, doesn't work with static linkage!
::GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, ::GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
reinterpret_cast<LPCTSTR>(addr), reinterpret_cast<LPCTSTR>(addr),
&m); &m);

View File

@ -221,7 +221,9 @@ void InfEngineNgraphNet::createNet(Target targetId) {
CV_LOG_DEBUG(NULL, "DNN/NGRAPH: Add 'Result' output: " << output_node_it->first); CV_LOG_DEBUG(NULL, "DNN/NGRAPH: Add 'Result' output: " << output_node_it->first);
CV_Assert(output_node_it->second); CV_Assert(output_node_it->second);
auto out = std::make_shared<ov::op::v0::Result>(output_node_it->second->node); auto out = std::make_shared<ov::op::v0::Result>(output_node_it->second->node);
out->set_friendly_name(output_node_it->first + (output_node_it->second->node.get_node()->get_output_size() == 1 ? "" : ".0")); std::string name = output_node_it->first + (output_node_it->second->node.get_node()->get_output_size() == 1 ? "" : ".0");
CV_LOG_DEBUG(NULL, "DNN-IE: Change friendly name from " << out->get_friendly_name() << " to " << name);
out->set_friendly_name(name);
outs.push_back(out); outs.push_back(out);
} }
CV_Assert_N(!inputs_vec.empty(), !outs.empty()); CV_Assert_N(!inputs_vec.empty(), !outs.empty());
@ -597,16 +599,22 @@ void InfEngineNgraphNet::forward(const std::vector<Ptr<BackendWrapper> >& outBlo
{ {
const std::string& name = it.get_node()->get_friendly_name(); const std::string& name = it.get_node()->get_friendly_name();
auto blobIt = allBlobs.find(name); auto blobIt = allBlobs.find(name);
CV_Assert(blobIt != allBlobs.end()); if (blobIt == allBlobs.end())
{
CV_Error(Error::StsAssert, format("Input blob with name %s not found", name.c_str()));
}
reqWrapper->req.set_input_tensor(i++, isAsync ? copyBlob(blobIt->second) : blobIt->second); reqWrapper->req.set_input_tensor(i++, isAsync ? copyBlob(blobIt->second) : blobIt->second);
} }
i = 0; i = 0;
for (const auto& it : netExec.outputs()) for (const auto& it : cnn->outputs()) // Starts from OpenVINO 2024 CompiledModel changes output frindly names
{ {
const std::string& name = it.get_node()->get_friendly_name(); const std::string& name = it.get_node()->get_friendly_name();
auto blobIt = allBlobs.find(name); auto blobIt = allBlobs.find(name);
CV_Assert(blobIt != allBlobs.end()); if (blobIt == allBlobs.end())
{
CV_Error(Error::StsAssert, format("Output blob with name %s not found", name.c_str()));
}
reqWrapper->req.set_output_tensor(i++, isAsync ? copyBlob(blobIt->second) : blobIt->second); reqWrapper->req.set_output_tensor(i++, isAsync ? copyBlob(blobIt->second) : blobIt->second);
} }

View File

@ -34,7 +34,20 @@
#include <opencv2\highgui\highgui_winrt.hpp> #include <opencv2\highgui\highgui_winrt.hpp>
#include "window_winrt_bridge.hpp" #include "window_winrt_bridge.hpp"
#define CV_WINRT_NO_GUI_ERROR( funcname ) CV_Error(cv::Error::StsNotImplemented, "The function is not implemented") #define CV_WINRT_NO_GUI_ERROR( funcname ) \
{ \
cvError( cv::Error::StsNotImplemented, funcname, \
"The function is not implemented. ", \
__FILE__, __LINE__ ); \
}
#ifdef CV_ERROR
#undef CV_ERROR
#define CV_ERROR( Code, Msg ) \
{ \
cvError( (Code), cvFuncName, Msg, __FILE__, __LINE__ ); \
};
#endif
/********************************** WinRT Specific API Implementation ******************************************/ /********************************** WinRT Specific API Implementation ******************************************/
@ -70,6 +83,8 @@ void showImageImpl(const char* name, InputArray arr)
int namedWindowImpl(const char* name, int flags) int namedWindowImpl(const char* name, int flags)
{ {
CV_UNUSED(flags);
if (!name) if (!name)
CV_Error(cv::Error::StsNullPtr, "NULL name"); CV_Error(cv::Error::StsNullPtr, "NULL name");
@ -94,8 +109,6 @@ void destroyAllWindowsImpl()
int createTrackbar2Impl(const char* trackbar_name, const char* window_name, int createTrackbar2Impl(const char* trackbar_name, const char* window_name,
int* val, int count, CvTrackbarCallback2 on_notify, void* userdata) int* val, int count, CvTrackbarCallback2 on_notify, void* userdata)
{ {
int pos = 0;
if (!window_name || !trackbar_name) if (!window_name || !trackbar_name)
CV_Error(cv::Error::StsNullPtr, "NULL window or trackbar name"); CV_Error(cv::Error::StsNullPtr, "NULL window or trackbar name");
@ -167,7 +180,7 @@ int getTrackbarPosImpl(const char* trackbar_name, const char* window_name)
CvTrackbar* trackbar = HighguiBridge::getInstance().findTrackbarByName(trackbar_name, window_name); CvTrackbar* trackbar = HighguiBridge::getInstance().findTrackbarByName(trackbar_name, window_name);
if (trackbar) if (trackbar)
pos = trackbar->getPosition(); pos = (int)trackbar->getPosition();
return pos; return pos;
} }
@ -179,11 +192,11 @@ int waitKeyImpl(int delay)
CV_WINRT_NO_GUI_ERROR("waitKeyImpl"); CV_WINRT_NO_GUI_ERROR("waitKeyImpl");
// see https://msdn.microsoft.com/en-us/library/windows/desktop/ms724411(v=vs.85).aspx // see https://msdn.microsoft.com/en-us/library/windows/desktop/ms724411(v=vs.85).aspx
int time0 = GetTickCount64(); //int time0 = GetTickCount64();
for (;;) for (;;)
{ {
CvWindow* window; // CvWindow* window;
if (delay <= 0) if (delay <= 0)
{ {
@ -194,6 +207,7 @@ int waitKeyImpl(int delay)
void setMouseCallbackImpl(const char* window_name, CvMouseCallback on_mouse, void* param) void setMouseCallbackImpl(const char* window_name, CvMouseCallback on_mouse, void* param)
{ {
CV_UNUSED(on_mouse); CV_UNUSED(param);
CV_WINRT_NO_GUI_ERROR("setMouseCallbackImpl"); CV_WINRT_NO_GUI_ERROR("setMouseCallbackImpl");
if (!window_name) if (!window_name)
@ -210,19 +224,23 @@ void setMouseCallbackImpl(const char* window_name, CvMouseCallback on_mouse, voi
void moveWindowImpl(const char* name, int x, int y) void moveWindowImpl(const char* name, int x, int y)
{ {
CV_UNUSED(name); CV_UNUSED(x); CV_UNUSED(y);
CV_WINRT_NO_GUI_ERROR("moveWindowImpl"); CV_WINRT_NO_GUI_ERROR("moveWindowImpl");
} }
void resizeWindowImpl(const char* name, int width, int height) void resizeWindowImpl(const char* name, int width, int height)
{ {
CV_UNUSED(name); CV_UNUSED(width); CV_UNUSED(height);
CV_WINRT_NO_GUI_ERROR("resizeWindowImpl"); CV_WINRT_NO_GUI_ERROR("resizeWindowImpl");
} }
void cvSetModeWindow_WinRT(const char* name, double prop_value) { void cvSetModeWindow_WinRT(const char* name, double prop_value) {
CV_UNUSED(name); CV_UNUSED(prop_value);
CV_WINRT_NO_GUI_ERROR("cvSetModeWindow"); CV_WINRT_NO_GUI_ERROR("cvSetModeWindow");
} }
double cvGetModeWindow_WinRT(const char* name) { double cvGetModeWindow_WinRT(const char* name) {
CV_UNUSED(name);
CV_WINRT_NO_GUI_ERROR("cvGetModeWindow"); CV_WINRT_NO_GUI_ERROR("cvGetModeWindow");
return cv::Error::StsNotImplemented; return cv::Error::StsNotImplemented;
} }

View File

@ -64,9 +64,9 @@ HighguiBridge& HighguiBridge::getInstance()
return instance; return instance;
} }
void HighguiBridge::setContainer(Windows::UI::Xaml::Controls::Panel^ container) void HighguiBridge::setContainer(Windows::UI::Xaml::Controls::Panel^ container_)
{ {
this->container = container; this->container = container_;
} }
CvWindow* HighguiBridge::findWindowByName(cv::String name) CvWindow* HighguiBridge::findWindowByName(cv::String name)
@ -190,9 +190,9 @@ void CvTrackbar::setMinPosition(double pos)
slider->Minimum = pos; slider->Minimum = pos;
} }
void CvTrackbar::setSlider(Slider^ slider) { void CvTrackbar::setSlider(Slider^ slider_) {
if (slider) if (slider_)
this->slider = slider; this->slider = slider_;
} }
double CvTrackbar::getPosition() double CvTrackbar::getPosition()
@ -219,6 +219,7 @@ Slider^ CvTrackbar::getSlider()
CvWindow::CvWindow(cv::String name, int flags) : name(name) CvWindow::CvWindow(cv::String name, int flags) : name(name)
{ {
CV_UNUSED(flags);
this->page = (Page^)Windows::UI::Xaml::Markup::XamlReader::Load(const_cast<Platform::String^>(markupContent)); this->page = (Page^)Windows::UI::Xaml::Markup::XamlReader::Load(const_cast<Platform::String^>(markupContent));
this->sliderMap = new std::map<cv::String, CvTrackbar*>(); this->sliderMap = new std::map<cv::String, CvTrackbar*>();
@ -246,14 +247,15 @@ CvWindow::CvWindow(cv::String name, int flags) : name(name)
CvWindow::~CvWindow() {} CvWindow::~CvWindow() {}
void CvWindow::createSlider(cv::String name, int* val, int count, CvTrackbarCallback2 on_notify, void* userdata) void CvWindow::createSlider(cv::String name_, int* val, int count, CvTrackbarCallback2 on_notify, void* userdata)
{ {
CvTrackbar* trackbar = findTrackbarByName(name); CV_UNUSED(userdata);
CvTrackbar* trackbar = findTrackbarByName(name_);
// Creating slider if name is new or reusing the existing one // Creating slider if name is new or reusing the existing one
Slider^ slider = !trackbar ? ref new Slider() : trackbar->getSlider(); Slider^ slider = !trackbar ? ref new Slider() : trackbar->getSlider();
slider->Header = HighguiBridge::getInstance().convertString(name); slider->Header = HighguiBridge::getInstance().convertString(name_);
// Making slider the same size as the image control or setting minimal size. // Making slider the same size as the image control or setting minimal size.
// This is added to cover potential edge cases because: // This is added to cover potential edge cases because:
@ -282,26 +284,26 @@ void CvWindow::createSlider(cv::String name, int* val, int count, CvTrackbarCall
if (!sliderPanel) return; if (!sliderPanel) return;
// Adding slider to the list for current window // Adding slider to the list for current window
CvTrackbar* trackbar = new CvTrackbar(name, slider, this); CvTrackbar* trackbar_ = new CvTrackbar(name_, slider, this);
trackbar->callback = on_notify; trackbar_->callback = on_notify;
slider->ValueChanged += slider->ValueChanged +=
ref new Controls::Primitives::RangeBaseValueChangedEventHandler( ref new Controls::Primitives::RangeBaseValueChangedEventHandler(
[=](Platform::Object^ sender, [=](Platform::Object^ sender,
Windows::UI::Xaml::Controls::Primitives::RangeBaseValueChangedEventArgs^ e) Windows::UI::Xaml::Controls::Primitives::RangeBaseValueChangedEventArgs^ e)
{ {
Slider^ slider = (Slider^)sender; Slider^ slider = (Slider^)sender;
trackbar->callback(slider->Value, nullptr); trackbar_->callback((int)slider->Value, nullptr);
}); });
this->sliderMap->insert(std::pair<cv::String, CvTrackbar*>(name, trackbar)); this->sliderMap->insert(std::pair<cv::String, CvTrackbar*>(name_, trackbar_));
// Adding slider to the window // Adding slider to the window
sliderPanel->Children->Append(slider); sliderPanel->Children->Append(slider);
} }
} }
CvTrackbar* CvWindow::findTrackbarByName(cv::String name) CvTrackbar* CvWindow::findTrackbarByName(cv::String name_)
{ {
auto search = sliderMap->find(name); auto search = sliderMap->find(name_);
if (search != sliderMap->end()) { if (search != sliderMap->end()) {
return search->second; return search->second;
} }
@ -343,12 +345,12 @@ Page^ CvWindow::getPage()
} }
//TODO: prototype, not in use yet //TODO: prototype, not in use yet
void CvWindow::createButton(cv::String name) void CvWindow::createButton(cv::String name_)
{ {
if (!buttonPanel) return; if (!buttonPanel) return;
Button^ b = ref new Button(); Button^ b = ref new Button();
b->Content = HighguiBridge::getInstance().convertString(name); b->Content = HighguiBridge::getInstance().convertString(name_);
b->Width = 260; b->Width = 260;
b->Height = 80; b->Height = 80;
b->Click += ref new Windows::UI::Xaml::RoutedEventHandler( b->Click += ref new Windows::UI::Xaml::RoutedEventHandler(

View File

@ -113,7 +113,6 @@ private:
// Meyers singleton // Meyers singleton
HighguiBridge(const HighguiBridge &); HighguiBridge(const HighguiBridge &);
void operator=(HighguiBridge &);
HighguiBridge() { HighguiBridge() {
windowsMap = new std::map<cv::String, CvWindow*>(); windowsMap = new std::map<cv::String, CvWindow*>();
}; };

View File

@ -2666,39 +2666,30 @@ void warpAffineBlocklineNN(int *adelta, int *bdelta, short* xy, int X0, int Y0,
{ {
CALL_HAL(warpAffineBlocklineNN, cv_hal_warpAffineBlocklineNN, adelta, bdelta, xy, X0, Y0, bw); CALL_HAL(warpAffineBlocklineNN, cv_hal_warpAffineBlocklineNN, adelta, bdelta, xy, X0, Y0, bw);
const int AB_BITS = MAX(10, (int)INTER_BITS); constexpr int AB_BITS = MAX(10, static_cast<int>(INTER_BITS));
int x1 = 0; int x1 = 0;
#if CV_TRY_SSE4_1 #if (CV_SIMD || CV_SIMD_SCALABLE)
bool useSSE4_1 = CV_CPU_HAS_SUPPORT_SSE4_1;
if( useSSE4_1 )
opt_SSE4_1::WarpAffineInvoker_Blockline_SSE41(adelta, bdelta, xy, X0, Y0, bw);
else
#endif
{ {
#if CV_SIMD128 const v_int32 v_X0 = vx_setall_s32(X0);
const v_int32 v_Y0 = vx_setall_s32(Y0);
const int step = VTraits<v_int16>::vlanes();
for (; x1 <= bw - step; x1 += step)
{ {
v_int32x4 v_X0 = v_setall_s32(X0), v_Y0 = v_setall_s32(Y0); v_int16 v_X = v_pack(v_shr<AB_BITS>(v_add(v_X0, vx_load(adelta + x1))),
int span = VTraits<v_uint16x8>::vlanes(); v_shr<AB_BITS>(v_add(v_X0, vx_load(adelta + x1 + step / 2))));
for( ; x1 <= bw - span; x1 += span ) v_int16 v_Y = v_pack(v_shr<AB_BITS>(v_add(v_Y0, vx_load(bdelta + x1))),
{ v_shr<AB_BITS>(v_add(v_Y0, vx_load(bdelta + x1 + step / 2))));
v_int16x8 v_dst[2]; v_store_interleave(xy + 2 * x1, v_X, v_Y);
#define CV_CONVERT_MAP(ptr,offset,shift) v_pack(v_shr<AB_BITS>(v_add(shift,v_load(ptr + offset))),\
v_shr<AB_BITS>(v_add(shift,v_load(ptr + offset + 4))))
v_dst[0] = CV_CONVERT_MAP(adelta, x1, v_X0);
v_dst[1] = CV_CONVERT_MAP(bdelta, x1, v_Y0);
#undef CV_CONVERT_MAP
v_store_interleave(xy + (x1 << 1), v_dst[0], v_dst[1]);
}
}
#endif
for( ; x1 < bw; x1++ )
{
int X = (X0 + adelta[x1]) >> AB_BITS;
int Y = (Y0 + bdelta[x1]) >> AB_BITS;
xy[x1*2] = saturate_cast<short>(X);
xy[x1*2+1] = saturate_cast<short>(Y);
} }
} }
#endif
for (; x1 < bw; x1++)
{
const int X = (X0 + adelta[x1]) >> AB_BITS;
const int Y = (Y0 + bdelta[x1]) >> AB_BITS;
xy[x1 * 2] = saturate_cast<short>(X);
xy[x1 * 2 + 1] = saturate_cast<short>(Y);
}
} }
void warpAffineBlockline(int *adelta, int *bdelta, short* xy, short* alpha, int X0, int Y0, int bw) void warpAffineBlockline(int *adelta, int *bdelta, short* xy, short* alpha, int X0, int Y0, int bw)

View File

@ -74,7 +74,6 @@ namespace opt_SSE4_1
void convertMaps_nninterpolate32f1c16s_SSE41(const float* src1f, const float* src2f, short* dst1, int width); void convertMaps_nninterpolate32f1c16s_SSE41(const float* src1f, const float* src2f, short* dst1, int width);
void convertMaps_32f1c16s_SSE41(const float* src1f, const float* src2f, short* dst1, ushort* dst2, int width); void convertMaps_32f1c16s_SSE41(const float* src1f, const float* src2f, short* dst1, ushort* dst2, int width);
void convertMaps_32f2c16s_SSE41(const float* src1f, short* dst1, ushort* dst2, int width); void convertMaps_32f2c16s_SSE41(const float* src1f, short* dst1, ushort* dst2, int width);
void WarpAffineInvoker_Blockline_SSE41(int *adelta, int *bdelta, short* xy, int X0, int Y0, int bw);
class WarpPerspectiveLine_SSE4 class WarpPerspectiveLine_SSE4
{ {

View File

@ -173,42 +173,6 @@ void convertMaps_32f2c16s_SSE41(const float* src1f, short* dst1, ushort* dst2, i
} }
} }
void WarpAffineInvoker_Blockline_SSE41(int *adelta, int *bdelta, short* xy, int X0, int Y0, int bw)
{
const int AB_BITS = MAX(10, (int)INTER_BITS);
int x1 = 0;
__m128i v_X0 = _mm_set1_epi32(X0);
__m128i v_Y0 = _mm_set1_epi32(Y0);
for (; x1 <= bw - 16; x1 += 16)
{
__m128i v_x0 = _mm_packs_epi32(_mm_srai_epi32(_mm_add_epi32(v_X0, _mm_loadu_si128((__m128i const *)(adelta + x1))), AB_BITS),
_mm_srai_epi32(_mm_add_epi32(v_X0, _mm_loadu_si128((__m128i const *)(adelta + x1 + 4))), AB_BITS));
__m128i v_x1 = _mm_packs_epi32(_mm_srai_epi32(_mm_add_epi32(v_X0, _mm_loadu_si128((__m128i const *)(adelta + x1 + 8))), AB_BITS),
_mm_srai_epi32(_mm_add_epi32(v_X0, _mm_loadu_si128((__m128i const *)(adelta + x1 + 12))), AB_BITS));
__m128i v_y0 = _mm_packs_epi32(_mm_srai_epi32(_mm_add_epi32(v_Y0, _mm_loadu_si128((__m128i const *)(bdelta + x1))), AB_BITS),
_mm_srai_epi32(_mm_add_epi32(v_Y0, _mm_loadu_si128((__m128i const *)(bdelta + x1 + 4))), AB_BITS));
__m128i v_y1 = _mm_packs_epi32(_mm_srai_epi32(_mm_add_epi32(v_Y0, _mm_loadu_si128((__m128i const *)(bdelta + x1 + 8))), AB_BITS),
_mm_srai_epi32(_mm_add_epi32(v_Y0, _mm_loadu_si128((__m128i const *)(bdelta + x1 + 12))), AB_BITS));
_mm_interleave_epi16(v_x0, v_x1, v_y0, v_y1);
_mm_storeu_si128((__m128i *)(xy + x1 * 2), v_x0);
_mm_storeu_si128((__m128i *)(xy + x1 * 2 + 8), v_x1);
_mm_storeu_si128((__m128i *)(xy + x1 * 2 + 16), v_y0);
_mm_storeu_si128((__m128i *)(xy + x1 * 2 + 24), v_y1);
}
for (; x1 < bw; x1++)
{
int X = (X0 + adelta[x1]) >> AB_BITS;
int Y = (Y0 + bdelta[x1]) >> AB_BITS;
xy[x1 * 2] = saturate_cast<short>(X);
xy[x1 * 2 + 1] = saturate_cast<short>(Y);
}
}
class WarpPerspectiveLine_SSE4_Impl CV_FINAL : public WarpPerspectiveLine_SSE4 class WarpPerspectiveLine_SSE4_Impl CV_FINAL : public WarpPerspectiveLine_SSE4
{ {
public: public:

View File

@ -265,7 +265,7 @@ int CV_DrawingTest_CPP::checkLineVirtualIterator( )
int x3 = randomGenerator.uniform(-512, 1024+1); int x3 = randomGenerator.uniform(-512, 1024+1);
int y3 = randomGenerator.uniform(-512, 1024+1); int y3 = randomGenerator.uniform(-512, 1024+1);
int channels = randomGenerator.uniform(1, 3+1); int channels = randomGenerator.uniform(1, 3+1);
Mat m(cv::Size(width, height), CV_MAKETYPE(8U, channels)); Mat m(cv::Size(width, height), CV_MAKETYPE(CV_8U, channels));
Point p1(x1, y1); Point p1(x1, y1);
Point p2(x2, y2); Point p2(x2, y2);
Point offset(x3, y3); Point offset(x3, y3);

View File

@ -309,7 +309,7 @@ Ptr<FaceDetectorYN> FaceDetectorYN::create(const String& framework,
#ifdef HAVE_OPENCV_DNN #ifdef HAVE_OPENCV_DNN
return makePtr<FaceDetectorYNImpl>(framework, bufferModel, bufferConfig, input_size, score_threshold, nms_threshold, top_k, backend_id, target_id); return makePtr<FaceDetectorYNImpl>(framework, bufferModel, bufferConfig, input_size, score_threshold, nms_threshold, top_k, backend_id, target_id);
#else #else
CV_UNUSED(bufferModel); CV_UNUSED(bufferConfig); CV_UNUSED(input_size); CV_UNUSED(score_threshold); CV_UNUSED(nms_threshold); CV_UNUSED(top_k); CV_UNUSED(backend_id); CV_UNUSED(target_id); CV_UNUSED(framework); CV_UNUSED(bufferModel); CV_UNUSED(bufferConfig); CV_UNUSED(input_size); CV_UNUSED(score_threshold); CV_UNUSED(nms_threshold); CV_UNUSED(top_k); CV_UNUSED(backend_id); CV_UNUSED(target_id);
CV_Error(cv::Error::StsNotImplemented, "cv::FaceDetectorYN requires enabled 'dnn' module."); CV_Error(cv::Error::StsNotImplemented, "cv::FaceDetectorYN requires enabled 'dnn' module.");
#endif #endif
} }

View File

@ -210,7 +210,7 @@ Ptr<FaceRecognizerSF> FaceRecognizerSF::create(const String& framework,
#ifdef HAVE_OPENCV_DNN #ifdef HAVE_OPENCV_DNN
return makePtr<FaceRecognizerSFImpl>(framework, bufferModel, bufferConfig, backend_id, target_id); return makePtr<FaceRecognizerSFImpl>(framework, bufferModel, bufferConfig, backend_id, target_id);
#else #else
CV_UNUSED(bufferModel); CV_UNUSED(bufferConfig); CV_UNUSED(backend_id); CV_UNUSED(target_id); CV_UNUSED(framework); CV_UNUSED(bufferModel); CV_UNUSED(bufferConfig); CV_UNUSED(backend_id); CV_UNUSED(target_id);
CV_Error(cv::Error::StsNotImplemented, "cv::FaceRecognizerSF requires enabled 'dnn' module"); CV_Error(cv::Error::StsNotImplemented, "cv::FaceRecognizerSF requires enabled 'dnn' module");
#endif #endif
} }

View File

@ -35,7 +35,7 @@ MediaStreamSink::MediaStreamSink(
__in MediaSampleHandler^ sampleHandler __in MediaSampleHandler^ sampleHandler
) )
: _shutdown(false) : _shutdown(false)
, _id(-1) , _id((DWORD)-1)
, _width(0) , _width(0)
, _height(0) , _height(0)
{ {
@ -207,16 +207,16 @@ HRESULT MediaStreamSink::QueueEvent(
__in MediaEventType met, __in MediaEventType met,
__in REFGUID extendedType, __in REFGUID extendedType,
__in HRESULT status, __in HRESULT status,
__in_opt const PROPVARIANT *value __in_opt const PROPVARIANT *value_
) )
{ {
return ExceptionBoundary([this, met, extendedType, status, value]() return ExceptionBoundary([this, met, extendedType, status, value_]()
{ {
auto lock = _lock.LockExclusive(); auto lock = _lock.LockExclusive();
_VerifyNotShutdown(); _VerifyNotShutdown();
CHK(_eventQueue->QueueEventParamVar(met, extendedType, status, value)); CHK(_eventQueue->QueueEventParamVar(met, extendedType, status, value_));
}); });
} }
@ -381,4 +381,4 @@ void MediaStreamSink::_UpdateMediaType(__in const ComPtr<IMFMediaType>& mt)
} }
CHK(mt->CopyAllItems(_curMT.Get())); CHK(mt->CopyAllItems(_curMT.Get()));
} }

View File

@ -81,11 +81,11 @@ void VideoioBridge::allocateOutputBuffers()
} }
// performed on UI thread // performed on UI thread
void VideoioBridge::allocateBuffers(int width, int height) void VideoioBridge::allocateBuffers(int width_, int height_)
{ {
// allocate input Mats (bgra8 = CV_8UC4, RGB24 = CV_8UC3) // allocate input Mats (bgra8 = CV_8UC4, RGB24 = CV_8UC3)
frontInputMat.create(height, width, CV_8UC3); frontInputMat.create(height_, width_, CV_8UC3);
backInputMat.create(height, width, CV_8UC3); backInputMat.create(height_, width_, CV_8UC3);
frontInputPtr = frontInputMat.ptr(0); frontInputPtr = frontInputMat.ptr(0);
backInputPtr = backInputMat.ptr(0); backInputPtr = backInputMat.ptr(0);
@ -155,4 +155,4 @@ void VideoioBridge::setHeight(int _height)
height = _height; height = _height;
} }
// end // end

View File

@ -154,6 +154,7 @@ namespace cv {
// see VideoCapture::read // see VideoCapture::read
bool VideoCapture_WinRT::retrieveFrame(int channel, cv::OutputArray outArray) bool VideoCapture_WinRT::retrieveFrame(int channel, cv::OutputArray outArray)
{ {
CV_UNUSED(channel);
if (!started) { if (!started) {
int width, height; int width, height;

View File

@ -238,9 +238,9 @@ void Video::CopyOutput() {
auto inAr = VideoioBridge::getInstance().frontInputPtr; auto inAr = VideoioBridge::getInstance().frontInputPtr;
auto outAr = GetData(VideoioBridge::getInstance().frontOutputBuffer->PixelBuffer); auto outAr = GetData(VideoioBridge::getInstance().frontOutputBuffer->PixelBuffer);
const unsigned int bytesPerPixel = 3; const unsigned int bytesPerPixel_ = 3;
auto pbScanline = inAr; auto pbScanline = inAr;
auto plPitch = width * bytesPerPixel; auto plPitch = width * bytesPerPixel_;
auto buf = outAr; auto buf = outAr;
unsigned int colBytes = width * 4; unsigned int colBytes = width * 4;
@ -254,7 +254,7 @@ void Video::CopyOutput() {
// used for RGB24: // used for RGB24:
// nb. alpha is set to full opaque // nb. alpha is set to full opaque
for (unsigned int i = 0, j = 0; i < plPitch; i += bytesPerPixel, j += 4) for (unsigned int i = 0, j = 0; i < plPitch; i += bytesPerPixel_, j += 4)
{ {
// swizzle the R and B values (RGB24 to Bgr8) // swizzle the R and B values (RGB24 to Bgr8)
buf[j] = pbScanline[i + 2]; buf[j] = pbScanline[i + 2];
@ -317,4 +317,4 @@ bool Video::listDevices() {
return result.get(); return result.get();
} }
// end // end

View File

@ -252,12 +252,12 @@ if __name__ == "__main__":
parser.add_argument('--cmake_option', action='append', help="Append CMake options") parser.add_argument('--cmake_option', action='append', help="Append CMake options")
# Use flag --build_flags="-s USE_PTHREADS=0 -Os" for one and more arguments as in the example # Use flag --build_flags="-s USE_PTHREADS=0 -Os" for one and more arguments as in the example
parser.add_argument('--build_flags', help="Append Emscripten build options") parser.add_argument('--build_flags', help="Append Emscripten build options")
parser.add_argument('--build_wasm_intrin_test', default=False, action="store_true", help="Build WASM intrin tests") parser.add_argument('--build_wasm_intrin_test', action="store_true", help="Build WASM intrin tests")
# Write a path to modify file like argument of this flag # Write a path to modify file like argument of this flag
parser.add_argument('--config', help="Specify configuration file with own list of exported into JS functions") parser.add_argument('--config', help="Specify configuration file with own list of exported into JS functions")
parser.add_argument('--webnn', action="store_true", help="Enable WebNN Backend") parser.add_argument('--webnn', action="store_true", help="Enable WebNN Backend")
transformed_args = ["--cmake_option=%s".format(arg) if arg[:2] == "-D" else arg for arg in sys.argv[1:]] transformed_args = ["--cmake_option={}".format(arg) if arg[:2] == "-D" else arg for arg in sys.argv[1:]]
args = parser.parse_args(transformed_args) args = parser.parse_args(transformed_args)
log.debug("Args: %s", args) log.debug("Args: %s", args)