int main(int argc, char *argv[]) #endif { sInputParams Params; // input parameters from command line CDecodingPipeline Pipeline; // pipeline for decoding, includes input file reader, decoder and output file writer mfxStatus sts = MFX_ERR_NONE; // return value check sts = ParseInputString(argv, (mfxU8)argc, &Params); MSDK_CHECK_PARSE_RESULT(sts, MFX_ERR_NONE, 1); if (Params.bIsMVC) Pipeline.SetMultiView(); sts = Pipeline.Init(&Params); MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, 1); // print stream info Pipeline.PrintInfo(); msdk_printf(MSDK_STRING("Decoding started\n")); for (;;) { sts = Pipeline.RunDecoding(); if (MFX_ERR_INCOMPATIBLE_VIDEO_PARAM == sts || MFX_ERR_DEVICE_LOST == sts || MFX_ERR_DEVICE_FAILED == sts) { if (MFX_ERR_INCOMPATIBLE_VIDEO_PARAM == sts) { msdk_printf(MSDK_STRING("\nERROR: Incompatible video parameters detected. Recovering...\n")); } else { msdk_printf(MSDK_STRING("\nERROR: Hardware device was lost or returned unexpected error. Recovering...\n")); sts = Pipeline.ResetDevice(); MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, 1); } sts = Pipeline.ResetDecoder(&Params); MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, 1); continue; } else { MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, 1); break; } } msdk_printf(MSDK_STRING("\nDecoding finished\n")); return 0; }
int main(int argc, char *argv[]) #endif { sInputParams Params = {}; // input parameters from command line std::auto_ptr<CEncodingPipeline> pPipeline; mfxStatus sts = MFX_ERR_NONE; // return value check sts = ParseInputString(argv, (mfxU8)argc, &Params); MSDK_CHECK_PARSE_RESULT(sts, MFX_ERR_NONE, 1); // Choosing which pipeline to use pPipeline.reset(CreatePipeline(Params)); MSDK_CHECK_POINTER(pPipeline.get(), MFX_ERR_MEMORY_ALLOC); if (MVC_ENABLED & Params.MVC_flags) { pPipeline->SetMultiView(); pPipeline->SetNumView(Params.numViews); } sts = pPipeline->Init(&Params); MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts); pPipeline->PrintInfo(); msdk_printf(MSDK_STRING("Processing started\n")); if (pPipeline->CaptureStartV4L2Pipeline() != MFX_ERR_NONE) { msdk_printf(MSDK_STRING("V4l2 failure terminating the program\n")); return 0; } for (;;) { sts = pPipeline->Run(); if (MFX_ERR_DEVICE_LOST == sts || MFX_ERR_DEVICE_FAILED == sts) { msdk_printf(MSDK_STRING("\nERROR: Hardware device was lost or returned an unexpected error. Recovering...\n")); sts = pPipeline->ResetDevice(); MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, 1); sts = pPipeline->ResetMFXComponents(&Params); MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, 1); continue; } else { MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, 1); break; } } pPipeline->CaptureStopV4L2Pipeline(); pPipeline->Close(); msdk_printf(MSDK_STRING("\nProcessing finished\n")); return 0; }
bool MSVC7Loader::DoImport(TiXmlElement* conf) { ProjectBuildTarget* bt = m_pProject->GetBuildTarget(m_ConfigurationName); if (!bt) bt = m_pProject->AddBuildTarget(m_ConfigurationName); bt->SetCompilerID(m_pProject->GetCompilerID()); // See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcext/html/vxlrfvcprojectenginelibraryruntimelibraryoption.asp m_OutDir = ReplaceMSVCMacros(cbC2U(conf->Attribute("OutputDirectory"))); m_IntDir = ReplaceMSVCMacros(cbC2U(conf->Attribute("IntermediateDirectory"))); if (m_IntDir.StartsWith(_T(".\\"))) m_IntDir.Remove(0,2); bt->SetObjectOutput(m_IntDir); // see MSDN: ConfigurationTypes Enumeration wxString conftype = cbC2U(conf->Attribute("ConfigurationType")); if (conftype.IsSameAs(_T("1"))) // typeApplication 1, no difference between console or gui here, we must check the subsystem property of the linker bt->SetTargetType(ttExecutable); else if (conftype.IsSameAs(_T("2"))) // typeDynamicLibrary 2 bt->SetTargetType(ttDynamicLib); else if (conftype.IsSameAs(_T("4"))) // typeStaticLibrary 4 bt->SetTargetType(ttStaticLib); else if (conftype.IsSameAs(_T("-1"))) // typeNative -1, check subsystem property of the linker to make sure bt->SetTargetType(ttNative); else if (conftype.IsSameAs(_T("10"))) // typeGeneric 10 bt->SetTargetType(ttCommandsOnly); else // typeUnknown 0 { bt->SetTargetType(ttCommandsOnly); Manager::Get()->GetLogManager()->DebugLog(_T("unrecognized project type")); } TiXmlElement* tool = conf->FirstChildElement("Tool"); if (!tool) { Manager::Get()->GetLogManager()->DebugLog(_T("No 'Tool' node...")); return false; } for (; tool; tool=tool->NextSiblingElement("Tool")) { if (strcmp(tool->Attribute("Name"), "VCLinkerTool") == 0 || strcmp(tool->Attribute("Name"), "VCLibrarianTool") == 0) { // linker wxString tmp; if ((bt->GetTargetType()==ttExecutable) || (bt->GetTargetType()==ttNative)) { tmp = cbC2U(tool->Attribute("SubSystem")); //subSystemNotSet 0 //subSystemConsole 1 //subSystemWindows 2 if (tmp.IsSameAs(_T("1"))) { bt->SetTargetType(ttConsoleOnly); //bt->AddLinkerOption("/SUBSYSTEM:CONSOLE"); // don't know if it is necessary } else if (tmp.IsSameAs(_T("3"))) bt->SetTargetType(ttNative); } // else we keep executable tmp = ReplaceMSVCMacros(cbC2U(tool->Attribute("OutputFile"))); tmp = UnixFilename(tmp); if (tmp.Last() == _T('.')) tmp.RemoveLast(); if (bt->GetTargetType() == ttStaticLib) { // convert the lib name Compiler* compiler = CompilerFactory::GetCompiler(m_pProject->GetCompilerID()); if (compiler) { wxString prefix = compiler->GetSwitches().libPrefix; wxString suffix = compiler->GetSwitches().libExtension; wxFileName fname = tmp; if (!fname.GetName().StartsWith(prefix)) fname.SetName(prefix + fname.GetName()); fname.SetExt(suffix); tmp = fname.GetFullPath(); } } bt->SetOutputFilename(tmp); m_TargetPath = wxFileName(tmp).GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR); m_TargetFilename = wxFileName(tmp).GetFullName(); tmp = cbC2U(tool->Attribute("AdditionalLibraryDirectories")); wxArrayString arr; ParseInputString(tmp, arr); for (unsigned int i = 0; i < arr.GetCount(); ++i) { bt->AddLibDir(ReplaceMSVCMacros(arr[i])); } if (!m_ConvertSwitches) // no point importing this option, if converting to GCC { tmp = cbC2U(tool->Attribute("IgnoreDefaultLibraryNames")); arr = GetArrayFromString(tmp, _T(";")); if (arr.GetCount()==1) arr = GetArrayFromString(tmp, _T(",")); for (unsigned int i = 0; i < arr.GetCount(); ++i) { bt->AddLinkerOption(wxString(_T("/NODEFAULTLIB:")) + arr[i]); } } #if 0 // no need since "/nologo" appear on the invocation commands of compilers/linkers if (!m_ConvertSwitches) { tmp = tool->Attribute("SuppressStartupBanner"); if (tmp.IsSameAs("TRUE")) bt->AddLinkerOption("/nologo"); } #endif tmp = cbC2U(tool->Attribute("GenerateDebugInformation")); if (tmp.IsSameAs(_T("TRUE"))) { //bt->AddCompilerOption(m_ConvertSwitches ? "-g" : "/Zi"); // no ! if (!m_ConvertSwitches) bt->AddLinkerOption(_T("/debug")); } // other options: /MACHINE:I386, /INCREMENTAL:YES, /STACK:10000000 if (!m_ConvertSwitches) { arr = GetArrayFromString(ReplaceMSVCMacros(cbC2U(tool->Attribute("AdditionalOptions"))), _T(" ")); for (unsigned int i = 0; i < arr.GetCount(); ++i) bt->AddLinkerOption(arr[i]); } // else ignore all options tmp = ReplaceMSVCMacros(cbC2U(tool->Attribute("AdditionalDependencies"))); arr = GetArrayFromString(tmp, _T(" ")); for (unsigned int i = 0; i < arr.GetCount(); ++i) { tmp = arr[i]; if (tmp.Right(4).CmpNoCase(_T(".lib")) == 0) tmp.Remove(tmp.Length() - 4); if ((tmp == _T("/dll")) || (tmp == _T("/DLL"))) bt->AddLinkerOption(_T("--dll")); else bt->AddLinkLib(tmp); } if (!m_ConvertSwitches) { tmp = cbC2U(tool->Attribute("LinkIncremental")); if (tmp.IsSameAs(_T("1"))) // 1 -> no, default is yes bt->AddLinkerOption(_T("/INCREMENTAL:NO")); } if (!m_ConvertSwitches) { tmp = ReplaceMSVCMacros(cbC2U(tool->Attribute("ProgramDatabaseFile"))); if (!tmp.IsEmpty()) bt->AddLinkerOption(wxString(_T("/pdb:")) + UnixFilename(tmp)); } if (!m_ConvertSwitches) { tmp = ReplaceMSVCMacros(cbC2U(tool->Attribute("ModuleDefinitionFile"))); if (!tmp.IsEmpty()) bt->AddLinkerOption(_T("/DEF:\"") + tmp + _T("\"")); } } else if (strcmp(tool->Attribute("Name"), "VCCLCompilerTool") == 0) { unsigned int i; wxString tmp; wxArrayString arr; // compiler tmp = cbC2U(tool->Attribute("AdditionalIncludeDirectories")); // vc70 uses ";" while vc71 uses "," separators // NOTE (mandrav#1#): No, that is *not* the case (what were they thinking at MS?) // try with comma (,) which is the newest I believe ParseInputString(tmp, arr); // This will parse recursively for (i = 0; i < arr.GetCount(); ++i) { bt->AddIncludeDir(ReplaceMSVCMacros(arr[i])); bt->AddResourceIncludeDir(ReplaceMSVCMacros(arr[i])); } tmp = cbC2U(tool->Attribute("PreprocessorDefinitions")); arr = GetArrayFromString(tmp, _T(",")); if (arr.GetCount() == 1) // if it fails, try with semicolon arr = GetArrayFromString(tmp, _T(";")); for (unsigned int j = 0; j < arr.GetCount(); ++j) { if (m_ConvertSwitches) bt->AddCompilerOption(wxString(_T("-D")) + arr[j]); else bt->AddCompilerOption(wxString(_T("/D")) + arr[j]); } tmp = cbC2U(tool->Attribute("WarningLevel")); if (m_ConvertSwitches) { if (tmp.IsSameAs(_T("0"))) bt->AddCompilerOption(_T("-w")); else if (tmp.IsSameAs(_T("1")) || tmp.IsSameAs(_T("2")) || tmp.IsSameAs(_T("3"))) bt->AddCompilerOption(_T("-W")); else if (tmp.IsSameAs(_T("4"))) bt->AddCompilerOption(_T("-Wall")); } else { bt->AddCompilerOption(wxString(_T("/W")) + tmp); } /* For more details on "DebugInformationFormat", please visit http://msdn2.microsoft.com/en-us/library/aa652260(VS.71).aspx http://msdn2.microsoft.com/en-us/library/microsoft.visualstudio.vcprojectengine.debugoption(VS.80).aspx */ tmp = cbC2U(tool->Attribute("DebugInformationFormat")); if (tmp.IsSameAs(_T("3"))) bt->AddCompilerOption(m_ConvertSwitches ? _T("") : _T("/Zi")); else if (tmp.IsSameAs(_T("4"))) bt->AddCompilerOption(m_ConvertSwitches ? _T("-g") : _T("/ZI")); tmp = cbC2U(tool->Attribute("InlineFunctionExpansion")); if (!m_ConvertSwitches && tmp.IsSameAs(_T("1"))) bt->AddCompilerOption(_T("/Ob1")); /* Optimization : optimizeDisabled 0 optimizeMinSpace 1 optimizeMaxSpeed 2 optimizeFull 3 optimizeCustom 4 */ tmp = cbC2U(tool->Attribute("Optimization")); if (m_ConvertSwitches) { if (tmp.IsSameAs(_T("0"))) bt->AddCompilerOption(_T("-O0")); else if (tmp.IsSameAs(_T("1"))) bt->AddCompilerOption(_T("-O1")); else if (tmp.IsSameAs(_T("2"))) bt->AddCompilerOption(_T("-O2")); else if (tmp.IsSameAs(_T("3"))) bt->AddCompilerOption(_T("-O3")); //else if (tmp.IsSameAs("4")) bt->AddCompilerOption("-O1"); // nothing to do ? } else { if (tmp.IsSameAs(_T("0"))) bt->AddCompilerOption(_T("/Od")); else if (tmp.IsSameAs(_T("1"))) bt->AddCompilerOption(_T("/O1")); else if (tmp.IsSameAs(_T("2"))) bt->AddCompilerOption(_T("/O2")); else if (tmp.IsSameAs(_T("3"))) bt->AddCompilerOption(_T("/Ox")); //else if (tmp.IsSameAs("4")) bt->AddCompilerOption("/O1"); // nothing to do ? } if (!m_ConvertSwitches) { tmp = cbC2U(tool->Attribute("Detect64BitPortabilityProblems")); if (tmp.IsSameAs(_T("TRUE"))) bt->AddCompilerOption(_T("/Wp64")); tmp = cbC2U(tool->Attribute("MinimalRebuild")); if (tmp.IsSameAs(_T("TRUE"))) bt->AddCompilerOption(_T("/Gm")); /* RuntimeLibrary : rtMultiThreaded 0 --> /MT rtMultiThreadedDebug 1 --> /MTd rtMultiThreadedDLL 2 --> /MD rtMultiThreadedDebugDLL 3 --> /MDd rtSingleThreaded 4 --> /ML rtSingleThreadedDebug 5 --> /MLd */ tmp = cbC2U(tool->Attribute("RuntimeLibrary")); if (tmp.IsSameAs(_T("0"))) bt->AddCompilerOption(_T("/MT")); else if (tmp.IsSameAs(_T("1"))) bt->AddCompilerOption(_T("/MTd")); else if (tmp.IsSameAs(_T("2"))) bt->AddCompilerOption(_T("/MD")); else if (tmp.IsSameAs(_T("3"))) bt->AddCompilerOption(_T("/MDd")); else if (tmp.IsSameAs(_T("4"))) bt->AddCompilerOption(_T("/ML")); else if (tmp.IsSameAs(_T("5"))) bt->AddCompilerOption(_T("/MLd")); #if 0 tmp = cbC2U(tool->Attribute("SuppressStartupBanner")); if (tmp.IsSameAs(_T("TRUE"))) bt->AddCompilerOption("/nologo"); #endif /* runtimeBasicCheckNone 0 runtimeCheckStackFrame 1 --> /RTCs or /GZ runtimeCheckUninitVariables 2 runtimeBasicCheckAll 3 */ tmp = cbC2U(tool->Attribute("BasicRuntimeChecks")); if (tmp.IsSameAs(_T("1"))) bt->AddCompilerOption(_T("/GZ")); tmp = cbC2U(tool->Attribute("ExceptionHandling")); if (tmp.IsSameAs(_T("TRUE"))) bt->AddCompilerOption(_T("EHsc")); // add C++ exception handling } tmp = cbC2U(tool->Attribute("RuntimeTypeInfo")); if (tmp.IsSameAs(_T("TRUE"))) bt->AddCompilerOption(m_ConvertSwitches ? _T("-frtti") : _T("/GR")); /* AdditionalOptions=" /Zm1000 /GR -DCMAKE_INTDIR=\"Debug\"" ObjectFile="Debug\" /Zm<n> max memory alloc (% of default) */ tmp = cbC2U(tool->Attribute("AdditionalOptions")); //tmp = ReplaceMSVCMacros(tmp); arr = GetArrayFromString(tmp, _T(" ")); for (i=0; i<arr.GetCount(); ++i) { if (arr[i].IsSameAs(_T("/D")) || arr[i].IsSameAs(_T("-D"))) { bt->AddCompilerOption((m_ConvertSwitches? _T("-D"):_T("/D")) + arr[i+1]); ++i; } else if (arr[i].StartsWith(_T("/D")) || arr[i].StartsWith(_T("-D"))) bt->AddCompilerOption((m_ConvertSwitches? _T("-D"):_T("/D")) + arr[i].Mid(2)); else if (arr[i].IsSameAs(_T("/Zi"))) bt->AddCompilerOption(m_ConvertSwitches? _T("-g"):_T("/Zi")); else if (!m_ConvertSwitches) bt->AddCompilerOption(arr[i]); } tmp = cbC2U(tool->Attribute("ForcedIncludeFiles")); if (!tmp.IsEmpty()) { wxArrayString FIfiles; ParseInputString(tmp, FIfiles); for (size_t j = 0; j < FIfiles.GetCount(); ++j) bt->AddCompilerOption(m_ConvertSwitches? _T("-include ") + ReplaceMSVCMacros(FIfiles[j]) : _T("/FI ") + ReplaceMSVCMacros(FIfiles[j])); } } else if (strcmp(tool->Attribute("Name"), "VCPreBuildEventTool") == 0) { // pre-build step wxString cmd = ReplaceMSVCMacros(cbC2U(tool->Attribute("CommandLine"))); if (!cmd.IsEmpty()) bt->AddCommandsBeforeBuild(cmd); } else if (strcmp(tool->Attribute("Name"), "VCPostBuildEventTool") == 0) { // post-build step wxString cmd = ReplaceMSVCMacros(cbC2U(tool->Attribute("CommandLine"))); if (!cmd.IsEmpty()) bt->AddCommandsAfterBuild(cmd); } } return true; }
int main(int argc, char *argv[]) #endif { sInputParams Params; // input parameters from command line CCameraPipeline Pipeline; // pipeline for decoding, includes input file reader, decoder and output file writer mfxStatus sts = MFX_ERR_NONE; // return value check sts = ParseInputString(argv, (mfxU8)argc, &Params); MSDK_CHECK_PARSE_RESULT(sts, MFX_ERR_NONE, 1); sts = Pipeline.Init(&Params); MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, 1); // print stream info Pipeline.PrintInfo(); msdk_printf(MSDK_STRING("Camera pipe started\n")); #if defined(_WIN32) || defined(_WIN64) LARGE_INTEGER timeBegin, timeEnd, m_Freq; QueryPerformanceFrequency(&m_Freq); QueryPerformanceCounter(&timeBegin); #endif int resetNum = 0; for (;;) { sts = Pipeline.Run(); if (MFX_WRN_VIDEO_PARAM_CHANGED == sts) { sInputParams *pParams = &Params; if (resetNum >= (int)Params.resetParams.size()) break; msdk_strcopy(Params.strSrcFile, Params.resetParams[resetNum].strSrcFile); msdk_strcopy(pParams->strDstFile, Params.resetParams[resetNum].strDstFile); pParams->frameInfo[VPP_IN].nWidth = (mfxU16)Params.resetParams[resetNum].width; pParams->frameInfo[VPP_IN].nHeight = (mfxU16)Params.resetParams[resetNum].height; pParams->frameInfo[VPP_IN].CropW = pParams->frameInfo[VPP_IN].nWidth; if ( Params.resetParams[resetNum].cropW ) pParams->frameInfo[VPP_IN].CropW = Params.resetParams[resetNum].cropW; pParams->frameInfo[VPP_IN].CropH = pParams->frameInfo[VPP_IN].nHeight; if ( Params.resetParams[resetNum].cropH ) pParams->frameInfo[VPP_IN].CropH = Params.resetParams[resetNum].cropH; pParams->frameInfo[VPP_IN].CropX = align(Params.resetParams[resetNum].cropX); pParams->frameInfo[VPP_IN].CropY = Params.resetParams[resetNum].cropY; if ( ! pParams->frameInfo[VPP_IN].CropW ) { pParams->frameInfo[VPP_IN].CropW = pParams->frameInfo[VPP_IN].nWidth; } if ( ! pParams->frameInfo[VPP_IN].CropH ) { pParams->frameInfo[VPP_IN].CropH = pParams->frameInfo[VPP_IN].nHeight; } pParams->frameInfo[VPP_OUT].nWidth = pParams->frameInfo[VPP_IN].CropW; pParams->frameInfo[VPP_OUT].nHeight = pParams->frameInfo[VPP_IN].CropH; pParams->frameInfo[VPP_OUT].CropW = pParams->frameInfo[VPP_IN].CropW; pParams->frameInfo[VPP_OUT].CropH = pParams->frameInfo[VPP_IN].CropH; pParams->bayerType = Params.resetParams[resetNum].bayerType; pParams->bHP = Params.resetParams[resetNum].bHP; pParams->hp_diff = Params.resetParams[resetNum].hp_diff; pParams->hp_num = Params.resetParams[resetNum].hp_num; pParams->bBayerDenoise = Params.resetParams[resetNum].bDenoise; pParams->denoiseThreshold = Params.resetParams[resetNum].denoiseThreshold; pParams->bBlackLevel = Params.resetParams[resetNum].bBlackLevel; pParams->black_level_B = Params.resetParams[resetNum].black_level_B; pParams->black_level_G0= Params.resetParams[resetNum].black_level_G0; pParams->black_level_G1= Params.resetParams[resetNum].black_level_G1; pParams->black_level_R = Params.resetParams[resetNum].black_level_R; pParams->bWhiteBalance = Params.resetParams[resetNum].bWhiteBalance; pParams->white_balance_B = Params.resetParams[resetNum].white_balance_B; pParams->white_balance_G0= Params.resetParams[resetNum].white_balance_G0; pParams->white_balance_G1= Params.resetParams[resetNum].white_balance_G1; pParams->white_balance_R = Params.resetParams[resetNum].white_balance_R; pParams->bCCM = Params.resetParams[resetNum].bCCM; for (int k = 0; k < 3; k++) for (int z = 0; z < 3; z++) pParams->CCM[k][z] = Params.resetParams[resetNum].CCM[k][z]; //pParams->frameInfo[VPP_OUT].FourCC = MFX_FOURCC_ARGB16; //pParams->memTypeIn = pParams->memTypeOut = SYSTEM_MEMORY; sts = Pipeline.Reset(&Params); if (sts == MFX_ERR_INCOMPATIBLE_VIDEO_PARAM) { Pipeline.Close(); sts = Pipeline.Init(&Params); } if (sts != MFX_ERR_NONE) break; resetNum++; } else break; } #if defined(_WIN32) || defined(_WIN64) QueryPerformanceCounter(&timeEnd); double time = ((double)timeEnd.QuadPart - (double)timeBegin.QuadPart)/ (double)m_Freq.QuadPart; int frames = Pipeline.GetNumberProcessedFrames(); _tprintf(_T("Total frames %d \n"), frames); _tprintf(_T("Total time %.2lf sec\n"), time); _tprintf(_T("Total FPS %.2lf fps\n"), frames/time); #endif //Pipeline.Close(); if(MFX_ERR_ABORTED != sts) MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, 1); msdk_printf(MSDK_STRING("\nCamera pipe finished\n")); return 0; }