Library/ManagedCuda/NPP/NPPImageBase.cs
/// <summary>
/// Copy from device to device memory
/// </summary>
/// <param name="deviceSrc">Source</param>
/// <param name="roi">ROI of source image</param>
Copy from device to device memory
Copy from device to device memory
public void CopyToDeviceRoi<T>(CudaPitchedDeviceVariable<T> deviceSrc, NppiRect roi) where T : struct
		{
			if (disposed) throw new ObjectDisposedException(this.ToString());
			CUDAMemCpy2D copyParams = new CUDAMemCpy2D();
			copyParams.srcDevice = deviceSrc.DevicePointer;
			copyParams.srcMemoryType = CUMemoryType.Device;
			copyParams.srcPitch = deviceSrc.Pitch;
			copyParams.srcXInBytes = roi.x * _typeSize * _channels;
			copyParams.srcY = roi.y;
			copyParams.dstDevice = _devPtr;
			copyParams.dstMemoryType = CUMemoryType.Device;
			copyParams.dstPitch = _pitch;
			copyParams.dstXInBytes = _pointRoi.x * _typeSize * _channels;
			copyParams.dstY = _pointRoi.y;
			copyParams.Height = _sizeRoi.height;
			copyParams.WidthInBytes = _sizeRoi.width * _typeSize * _channels;
			res = DriverAPINativeMethods.SynchronousMemcpy_v2.cuMemcpy2D_v2(ref copyParams);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuMemcpy2D", res));
			if (res != CUResult.Success)
				throw new CudaException(res);
		}
public void CopyToDeviceRoi < T > ( CudaPitchedDeviceVariable < T > deviceSrc , NppiRect roi ) where T : struct { if ( disposed ) throw new ObjectDisposedException ( this . ToString ( ) ) ; CUDAMemCpy2D copyParams = new CUDAMemCpy2D ( ) ; copyParams . srcDevice = deviceSrc . DevicePointer ; copyParams . srcMemoryType = CUMemoryType . Device ; copyParams . srcPitch = deviceSrc . Pitch ; copyParams . srcXInBytes = roi . x * _typeSize * _channels ; copyParams . srcY = roi . y ; copyParams . dstDevice = _devPtr ; copyParams . dstMemoryType = CUMemoryType . Device ; copyParams . dstPitch = _pitch ; copyParams . dstXInBytes = _pointRoi . x * _typeSize * _channels ; copyParams . dstY = _pointRoi . y ; copyParams . Height = _sizeRoi . height ; copyParams . WidthInBytes = _sizeRoi . width * _typeSize * _channels ; res = DriverAPINativeMethods . SynchronousMemcpy_v2 . cuMemcpy2D_v2 ( ref copyParams ) ; Debug . WriteLine ( String . Format ( " " , DateTime . Now , " " , res ) ) ; if ( res != CUResult . Success ) throw new CudaException ( res ) ; }
Copy from device to device memory
Copy from device to device memory
deviceSrc
CudaPitchedDeviceVariable<T>
None
roi
NppiRect
ROI of source image
ROI of source image