[host] added multithreaded memcopy implementation

This commit is contained in:
Geoffrey McRae
2017-11-01 02:15:47 +11:00
parent de8403dcd6
commit 9ac3cadc7d
6 changed files with 141 additions and 2 deletions

View File

@@ -123,12 +123,21 @@ namespace Capture
m_grabFrameParams.eGMode = NVFBC_TOSYS_SOURCEMODE_SCALE;
m_grabFrameParams.pNvFBCFrameGrabInfo = &m_grabInfo;
if (!m_memcpy.Initialize())
{
DEBUG_ERROR("Failed to initialize MTMemcpy");
DeInitialize();
return false;
}
m_initialized = true;
return true;
}
void NvFBC::DeInitialize()
{
m_memcpy.DeInitialize();
m_frameBuffer = NULL;
if (m_nvFBC)
@@ -197,7 +206,11 @@ namespace Capture
frame.height = m_grabInfo.dwHeight;
frame.stride = m_grabInfo.dwBufferWidth;
frame.outSize = m_grabInfo.dwBufferWidth * m_grabInfo.dwHeight * 3;
memcpy(frame.buffer, m_frameBuffer, frame.outSize);
if (!m_memcpy.Copy(frame.buffer, m_frameBuffer, frame.outSize))
{
DEBUG_ERROR("Memory copy failed");
return false;
}
return true;
}

View File

@@ -1,5 +1,6 @@
#pragma once
#include "ICapture.h"
#include "MTMemcpy.h"
#define W32_LEAN_AND_MEAN
#include <Windows.h>
@@ -24,7 +25,8 @@ namespace Capture
private:
bool m_initialized;
HMODULE m_hDLL;
HMODULE m_hDLL;
MTMemcpy m_memcpy;
NvFBC_CreateFunctionExType m_fnCreateEx;
NvFBC_SetGlobalFlagsType m_fnSetGlobalFlags;