/// <summary> /// image maximum error. User buffer is internally allocated and freed. /// </summary> /// <param name="src2">2nd source image</param> /// <param name="pError">Pointer to the computed error.</param> /// <param name="nppStreamCtx">NPP stream context.</param> public void MaxError(NPPImage_32scC4 src2, CudaDeviceVariable <double> pError, NppStreamContext nppStreamCtx) { int bufferSize = MaxErrorGetBufferHostSize(nppStreamCtx); CudaDeviceVariable <byte> buffer = new CudaDeviceVariable <byte>(bufferSize); status = NPPNativeMethods_Ctx.NPPi.MaximumError.nppiMaximumError_32sc_C4R_Ctx(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, _sizeRoi, pError.DevicePointer, buffer.DevicePointer, nppStreamCtx); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiMaximumError_32sc_C4R_Ctx", status)); buffer.Dispose(); NPPException.CheckNppStatus(status, this); }
/// <summary> /// image average relative error. User buffer is internally allocated and freed. /// </summary> /// <param name="src2">2nd source image</param> /// <param name="pError">Pointer to the computed error.</param> public void AverageRelativeError(NPPImage_32scC4 src2, CudaDeviceVariable <double> pError) { int bufferSize = AverageRelativeErrorGetBufferHostSize(); CudaDeviceVariable <byte> buffer = new CudaDeviceVariable <byte>(bufferSize); status = NPPNativeMethods.NPPi.AverageRelativeError.nppiAverageRelativeError_32sc_C4R(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, _sizeRoi, pError.DevicePointer, buffer.DevicePointer); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiAverageRelativeError_32sc_C4R", status)); buffer.Dispose(); NPPException.CheckNppStatus(status, this); }
/// <summary> /// image maximum relative error. /// </summary> /// <param name="src2">2nd source image</param> /// <param name="pError">Pointer to the computed error.</param> /// <param name="buffer">Pointer to the user-allocated scratch buffer required for the MaximumRelativeError operation.</param> public void MaximumRelativeError(NPPImage_32scC4 src2, CudaDeviceVariable <double> pError, CudaDeviceVariable <byte> buffer) { int bufferSize = MaximumRelativeErrorGetBufferHostSize(); if (bufferSize > buffer.Size) { throw new NPPException("Provided buffer is too small."); } status = NPPNativeMethods.NPPi.MaximumRelativeError.nppiMaximumRelativeError_32sc_C4R(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, _sizeRoi, pError.DevicePointer, buffer.DevicePointer); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiMaximumRelativeError_32sc_C4R", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// Divide constant to image, scale by 2^(-nScaleFactor), then clamp to saturated value. Unchanged Alpha. /// </summary> /// <param name="nConstant">Value</param> /// <param name="dest">Destination image</param> /// <param name="nScaleFactor">scaling factor</param> public void DivA(Npp32sc[] nConstant, NPPImage_32scC4 dest, int nScaleFactor) { status = NPPNativeMethods.NPPi.DivConst.nppiDivC_32sc_AC4RSfs(_devPtrRoi, _pitch, nConstant, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, nScaleFactor); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiDivC_32sc_AC4RSfs", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// In place image division, scale by 2^(-nScaleFactor), then clamp to saturated value. Unchanged Alpha. /// </summary> /// <param name="src2">2nd source image</param> /// <param name="nScaleFactor">scaling factor</param> public void DivA(NPPImage_32scC4 src2, int nScaleFactor) { status = NPPNativeMethods.NPPi.Div.nppiDiv_32sc_AC4IRSfs(src2.DevicePointerRoi, src2.Pitch, _devPtrRoi, _pitch, _sizeRoi, nScaleFactor); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiDiv_32sc_AC4IRSfs", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// Image multiplication, scale by 2^(-nScaleFactor), then clamp to saturated value. /// </summary> /// <param name="src2">2nd source image</param> /// <param name="dest">Destination image</param> /// <param name="nScaleFactor">scaling factor</param> public void Mul(NPPImage_32scC4 src2, NPPImage_32scC4 dest, int nScaleFactor) { status = NPPNativeMethods.NPPi.Mul.nppiMul_32sc_C4RSfs(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, nScaleFactor); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiMul_32sc_C4RSfs", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// image copy. Not affecting Alpha channel. /// </summary> /// <param name="dst">Destination image</param> public void CopyA(NPPImage_32scC4 dst) { status = NPPNativeMethods.NPPi.MemCopy.nppiCopy_32sc_AC4R(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiCopy_32sc_AC4R", status)); NPPException.CheckNppStatus(status, this); }
///// <summary> ///// Image division, scale by 2^(-nScaleFactor), then clamp to saturated value. ///// </summary> ///// <param name="src2">2nd source image</param> ///// <param name="dest">Destination image</param> ///// <param name="nScaleFactor">scaling factor</param> //public void Div(NPPImage_32scC4 src2, NPPImage_32scC4 dest, int nScaleFactor) //{ // status = NPPNativeMethods_Ctx.NPPi.Div.nppiDiv_32sc_C4RSfs_Ctx(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, nScaleFactor, nppStreamCtx); // Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiDiv_32sc_C4RSfs_Ctx", status)); // NPPException.CheckNppStatus(status, this); //} ///// <summary> ///// In place image division, scale by 2^(-nScaleFactor), then clamp to saturated value. ///// </summary> ///// <param name="src2">2nd source image</param> ///// <param name="nScaleFactor">scaling factor</param> //public void Div(NPPImage_32scC4 src2, int nScaleFactor) //{ // status = NPPNativeMethods_Ctx.NPPi.Div.nppiDiv_32sc_C4IRSfs_Ctx(src2.DevicePointerRoi, src2.Pitch, _devPtrRoi, _pitch, _sizeRoi, nScaleFactor, nppStreamCtx); // Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiDiv_32sc_C4IRSfs_Ctx", status)); // NPPException.CheckNppStatus(status, this); //} ///// <summary> ///// Divide constant to image, scale by 2^(-nScaleFactor), then clamp to saturated value. ///// </summary> ///// <param name="nConstant">Value</param> ///// <param name="dest">Destination image</param> ///// <param name="nScaleFactor">scaling factor</param> //public void Div(Npp32sc[] nConstant, NPPImage_32scC4 dest, int nScaleFactor) //{ // status = NPPNativeMethods_Ctx.NPPi.DivConst.nppiDivC_32sc_C4RSfs_Ctx(_devPtrRoi, _pitch, nConstant, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, nScaleFactor, nppStreamCtx); // Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiDivC_32sc_C4RSfs_Ctx", status)); // NPPException.CheckNppStatus(status, this); //} ///// <summary> ///// Divide constant to image, scale by 2^(-nScaleFactor), then clamp to saturated value. Inplace. ///// </summary> ///// <param name="nConstant">Value</param> ///// <param name="nScaleFactor">scaling factor</param> //public void Div(Npp32sc[] nConstant, int nScaleFactor) //{ // status = NPPNativeMethods_Ctx.NPPi.DivConst.nppiDivC_32sc_C4IRSfs_Ctx(nConstant, _devPtrRoi, _pitch, _sizeRoi, nScaleFactor, nppStreamCtx); // Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiDivC_32sc_C4IRSfs_Ctx", status)); // NPPException.CheckNppStatus(status, this); //} /// <summary> /// Image division, scale by 2^(-nScaleFactor), then clamp to saturated value. Unchanged Alpha. /// </summary> /// <param name="src2">2nd source image</param> /// <param name="dest">Destination image</param> /// <param name="nScaleFactor">scaling factor</param> /// <param name="nppStreamCtx">NPP stream context.</param> public void DivA(NPPImage_32scC4 src2, NPPImage_32scC4 dest, int nScaleFactor, NppStreamContext nppStreamCtx) { status = NPPNativeMethods_Ctx.NPPi.Div.nppiDiv_32sc_AC4RSfs_Ctx(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, nScaleFactor, nppStreamCtx); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiDiv_32sc_AC4RSfs_Ctx", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// image average relative error. /// </summary> /// <param name="src2">2nd source image</param> /// <param name="pError">Pointer to the computed error.</param> /// <param name="buffer">Pointer to the user-allocated scratch buffer required for the AverageRelativeError operation.</param> public void AverageRelativeError(NPPImage_32scC4 src2, CudaDeviceVariable<double> pError, CudaDeviceVariable<byte> buffer) { int bufferSize = AverageRelativeErrorGetBufferHostSize(); if (bufferSize > buffer.Size) throw new NPPException("Provided buffer is too small."); status = NPPNativeMethods.NPPi.AverageRelativeError.nppiAverageRelativeError_32sc_C4R(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, _sizeRoi, pError.DevicePointer, buffer.DevicePointer); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiAverageRelativeError_32sc_C4R", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// Multiply constant to image, scale by 2^(-nScaleFactor), then clamp to saturated value. /// </summary> /// <param name="nConstant">Value</param> /// <param name="dest">Destination image</param> /// <param name="nScaleFactor">scaling factor</param> /// <param name="nppStreamCtx">NPP stream context.</param> public void Mul(Npp32sc[] nConstant, NPPImage_32scC4 dest, int nScaleFactor, NppStreamContext nppStreamCtx) { status = NPPNativeMethods_Ctx.NPPi.MulConst.nppiMulC_32sc_C4RSfs_Ctx(_devPtrRoi, _pitch, nConstant, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, nScaleFactor, nppStreamCtx); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiMulC_32sc_C4RSfs_Ctx", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// image maximum relative error. User buffer is internally allocated and freed. /// </summary> /// <param name="src2">2nd source image</param> /// <param name="pError">Pointer to the computed error.</param> public void MaximumRelativeError(NPPImage_32scC4 src2, CudaDeviceVariable<double> pError) { int bufferSize = MaximumRelativeErrorGetBufferHostSize(); CudaDeviceVariable<byte> buffer = new CudaDeviceVariable<byte>(bufferSize); status = NPPNativeMethods.NPPi.MaximumRelativeError.nppiMaximumRelativeError_32sc_C4R(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, _sizeRoi, pError.DevicePointer, buffer.DevicePointer); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiMaximumRelativeError_32sc_C4R", status)); buffer.Dispose(); NPPException.CheckNppStatus(status, this); }