PERF_TEST_P(TestWarpAffine, WarpAffine_ovx, Combine( Values(szVGA, sz720p, sz1080p), InterType::all(), BorderMode::all() ) ) { Size sz, szSrc(512, 512); int borderMode, interType; sz = get<0>(GetParam()); interType = get<1>(GetParam()); borderMode = get<2>(GetParam()); Scalar borderColor = Scalar::all(150); Mat src(szSrc, CV_8UC1), dst(sz, CV_8UC1); cvtest::fillGradient(src); if (borderMode == BORDER_CONSTANT) cvtest::smoothBorder(src, borderColor, 1); Mat warpMat = getRotationMatrix2D(Point2f(src.cols / 2.f, src.rows / 2.f), 30., 2.2); declare.in(src).out(dst); TEST_CYCLE() warpAffine(src, dst, warpMat, sz, interType, borderMode, borderColor); #ifdef __ANDROID__ SANITY_CHECK(dst, interType == INTER_LINEAR ? 5 : 10); #else SANITY_CHECK(dst, 1); #endif }
void encodeFileName(QString & szPath) { QString szSrc(szPath); szPath = ""; for(int i = 0; i < szSrc.length(); i++) { QChar cur = szSrc[i]; if( ! (cur.isLetter() || cur.isDigit() || cur==' ' || cur=='_' || cur=='.' || cur=='#' || cur=='%') ) { if(cur.row()!=0) { szPath += '%'; szPath += cHexChars[cur.row() >> 4]; szPath += cHexChars[cur.row() & 15]; } szPath += '%'; szPath += cHexChars[cur.cell() >> 4]; szPath += cHexChars[cur.cell() & 15]; } else if (cur=='%')
PERF_TEST_P( TestWarpPerspective, WarpPerspective, Combine( Values( szVGA, sz720p, sz1080p ), InterType::all(), BorderMode::all() ) ) { Size sz, szSrc(512, 512); int borderMode, interType; sz = get<0>(GetParam()); interType = get<1>(GetParam()); borderMode = get<2>(GetParam()); Scalar borderColor = Scalar::all(150); Mat src(szSrc,CV_8UC4), dst(sz, CV_8UC4); cvtest::fillGradient(src); if(borderMode == BORDER_CONSTANT) cvtest::smoothBorder(src, borderColor, 1); Mat rotMat = getRotationMatrix2D(Point2f(src.cols/2.f, src.rows/2.f), 30., 2.2); Mat warpMat(3, 3, CV_64FC1); for(int r=0; r<2; r++) for(int c=0; c<3; c++) warpMat.at<double>(r, c) = rotMat.at<double>(r, c); warpMat.at<double>(2, 0) = .3/sz.width; warpMat.at<double>(2, 1) = .3/sz.height; warpMat.at<double>(2, 2) = 1; declare.in(src).out(dst); TEST_CYCLE() warpPerspective( src, dst, warpMat, sz, interType, borderMode, borderColor ); #ifdef __ANDROID__ SANITY_CHECK(dst, interType==INTER_LINEAR? 5 : 10); #else SANITY_CHECK(dst, 1); #endif }
LPCWSTR CRConFiles::GetFileFromConsole(LPCWSTR asSrc, CEStr& szFull) { CEStr szWinPath; LPCWSTR pszWinPath = MakeWinPath(asSrc, mp_RCon ? mp_RCon->GetMntPrefix() : NULL, szWinPath); if (!pszWinPath || !*pszWinPath) { _ASSERTE(pszWinPath && *pszWinPath); return NULL; } if (IsFilePath(pszWinPath, true)) { if (!FileExists(pszWinPath)) // otherwise it will cover directories too return NULL; szFull.Attach(szWinPath.Detach()); } else { CEStr szDir; LPCWSTR pszDir = mp_RCon->GetConsoleCurDir(szDir, true); // We may get empty dir here if we are in "~" subdir if (!pszDir || !*pszDir) { _ASSERTE(pszDir && *pszDir && wcschr(pszDir,L'/')==NULL); return NULL; } // Попытаться просканировать один-два уровеня подпапок bool bFound = FileExistSubDir(pszDir, pszWinPath, 1, szFull); if (!bFound) { // git diffs style, but with backslashes (they are converted already) // "a/src/ConEmu.cpp" and "b/src/ConEmu.cpp" if (pszWinPath[0] && (pszWinPath[1] == L'\\') && wcschr(L"abicwo", pszWinPath[0])) { LPCWSTR pszSlash = pszWinPath; while (!bFound && ((pszSlash = wcschr(pszSlash, L'\\')) != NULL)) { while (*pszSlash == L'\\') pszSlash++; if (!*pszSlash) break; bFound = FileExistSubDir(pszDir, pszSlash, 1, szFull); if (!bFound) { // Try to go to parent folder (useful while browsing git-diff-s) bFound = CheckParentFolders(pszDir, pszSlash, szFull); } } } else { // let's try to check some paths from #include // for example: #include "src/common/Common.h" LPCWSTR pszSlash = pszWinPath; while (*pszSlash == L'\\') pszSlash++; bFound = CheckParentFolders(pszDir, pszSlash, szFull); } } if (!bFound) { // If there is "src" subfolder in the current folder const wchar_t* predefined[] = {L"trunk", L"src", L"source", L"sources", NULL}; for (size_t i = 0; !bFound && predefined[i]; ++i) { CEStr szSrc(JoinPath(pszDir, predefined[i])); if (DirectoryExists(szSrc)) bFound = FileExistSubDir(szSrc, pszWinPath, 1, szFull); } } if (!bFound) { return NULL; } } if (!szFull.IsEmpty()) { // "src\conemu\realconsole.cpp" --> "src\ConEmu\RealConsole.cpp" MakePathProperCase(szFull); } return szFull; }