• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# NPP.NPPImage_16sC1类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ManagedCuda.NPP.NPPImage_16sC1的典型用法代码示例。如果您正苦于以下问题:C# NPPImage_16sC1类的具体用法?C# NPPImage_16sC1怎么用?C# NPPImage_16sC1使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NPPImage_16sC1类属于ManagedCuda.NPP命名空间,在下文中一共展示了NPPImage_16sC1类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DCTQuantFwd8x8LS

 /// <summary>
 /// Forward DCT, quantization and level shift part of the JPEG encoding.
 /// Input is expected in 8x8 macro blocks and output is expected to be in 64x1
 /// macro blocks.
 /// </summary>
 /// <param name="src">Source image.</param>
 /// <param name="dst">Destination image</param>
 /// <param name="QuantFwdTable">Forward quantization tables for JPEG encoding created using QuantInvTableInit()</param>
 /// <param name="oSizeRoi">Roi size (in macro blocks?).</param>
 public static void DCTQuantFwd8x8LS(NPPImage_8uC1 src, NPPImage_16sC1 dst, CudaDeviceVariable<ushort> QuantFwdTable, NppiSize oSizeRoi)
 {
     NppStatus status;
     status = NPPNativeMethods.NPPi.ImageCompression.nppiDCTQuantFwd8x8LS_JPEG_8u16s_C1R(src.DevicePointer, src.Pitch, dst.DevicePointer, dst.Pitch, QuantFwdTable.DevicePointer, oSizeRoi);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiDCTQuantFwd8x8LS_JPEG_8u16s_C1R", status));
     NPPException.CheckNppStatus(status, null);
 }
开发者ID:furusdara,项目名称:cuda,代码行数:16,代码来源:JPEGCompression.cs


示例2: CopyWrapBorder

 /// <summary>
 /// image copy with the borders wrapped by replication of source image pixel colors.
 /// </summary>
 /// <param name="dst">Destination-Image</param>
 /// <param name="nTopBorderHeight">Height (in pixels) of the top border. The height of the border at the bottom of
 /// the destination ROI is implicitly defined by the size of the source ROI: nBottomBorderHeight =
 /// oDstSizeROI.height - nTopBorderHeight - oSrcSizeROI.height.</param>
 /// <param name="nLeftBorderWidth">Width (in pixels) of the left border. The width of the border at the right side of
 /// the destination ROI is implicitly defined by the size of the source ROI: nRightBorderWidth =
 /// oDstSizeROI.width - nLeftBorderWidth - oSrcSizeROI.width.</param>
 public void CopyWrapBorder(NPPImage_16sC1 dst, int nTopBorderHeight, int nLeftBorderWidth)
 {
     status = NPPNativeMethods.NPPi.CopyWrapBorder.nppiCopyWrapBorder_16s_C1R(_devPtrRoi, _pitch, _sizeRoi, dst.DevicePointerRoi, dst.Pitch, dst.SizeRoi, nTopBorderHeight, nLeftBorderWidth);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiCopyWrapBorder_16s_C1R", status));
     NPPException.CheckNppStatus(status, this);
 }
开发者ID:kunzmi,项目名称:managedCuda,代码行数:16,代码来源:NPPImage_16sC1.cs


示例3: Remap

		/// <summary>
		/// planar image remap.
		/// </summary>
		/// <param name="src0">Source image (Channel 0)</param>
		/// <param name="src1">Source image (Channel 1)</param>
		/// <param name="src2">Source image (Channel 2)</param>
		/// <param name="dest0">Destination image (Channel 0)</param>
		/// <param name="dest1">Destination image (Channel 1)</param>
		/// <param name="dest2">Destination image (Channel 2)</param>
		/// <param name="pXMap">Device memory pointer to 2D image array of X coordinate values to be used when sampling source image. </param>
		/// <param name="pYMap">Device memory pointer to 2D image array of Y coordinate values to be used when sampling source image. </param>
		/// <param name="eInterpolation">The type of eInterpolation to perform resampling.</param>
		public static void Remap(NPPImage_16sC1 src0, NPPImage_16sC1 src1, NPPImage_16sC1 src2, NPPImage_16sC1 dest0, NPPImage_16sC1 dest1, NPPImage_16sC1 dest2, NPPImage_32fC1 pXMap, NPPImage_32fC1 pYMap, InterpolationMode eInterpolation)
		{
			CUdeviceptr[] src = new CUdeviceptr[] { src0.DevicePointer, src1.DevicePointer, src2.DevicePointer };
			CUdeviceptr[] dst = new CUdeviceptr[] { dest0.DevicePointerRoi, dest1.DevicePointerRoi, dest2.DevicePointerRoi };
			NppiRect srcRect = new NppiRect(src0.PointRoi, src0.SizeRoi);
			NppStatus status = NPPNativeMethods.NPPi.Remap.nppiRemap_16s_P3R(src, src0.SizeRoi, src0.Pitch, srcRect, pXMap.DevicePointerRoi, pXMap.Pitch, pYMap.DevicePointerRoi, pYMap.Pitch, dst, dest0.Pitch, dest0.SizeRoi, eInterpolation);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiRemap_16s_P3R", status));
			NPPException.CheckNppStatus(status, null);
		}
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:21,代码来源:NPPImage_16sC3.cs


示例4: Copy

		/// <summary>
		/// Three-channel 8-bit unsigned planar to packed image copy.
		/// </summary>
		/// <param name="src0">Source image channel 0</param>
		/// <param name="src1">Source image channel 1</param>
		/// <param name="src2">Source image channel 2</param>
		/// <param name="dest">Destination image</param>
		public static void Copy(NPPImage_16sC1 src0, NPPImage_16sC1 src1, NPPImage_16sC1 src2, NPPImage_16sC3 dest)
		{
			CUdeviceptr[] array = new CUdeviceptr[] { src0.DevicePointerRoi, src1.DevicePointerRoi, src2.DevicePointerRoi };
			NppStatus status = NPPNativeMethods.NPPi.MemCopy.nppiCopy_16s_P3C3R(array, src0.Pitch, dest.DevicePointerRoi, dest.Pitch, dest.SizeRoi);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiCopy_16s_P3C3R", status));
			NPPException.CheckNppStatus(status, null);
		}
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:14,代码来源:NPPImage_16sC3.cs


示例5: Convert

		/// <summary>
		/// 32-bit unsigned to 16-bit signed conversion.
		/// </summary>
		/// <param name="dst">Destination image</param>
		/// <param name="roundMode">Round mode</param>
		/// <param name="scaleFactor">scaling factor</param>
		public void Convert(NPPImage_16sC1 dst, NppRoundMode roundMode, int scaleFactor)
		{
			status = NPPNativeMethods.NPPi.BitDepthConversion.nppiConvert_32u16s_C1RSfs(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi, roundMode, scaleFactor);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiConvert_32u16s_C1RSfs", status));
			NPPException.CheckNppStatus(status, this);
		}
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:12,代码来源:NPPImage_32uC1.cs


示例6: SaveJpeg

        public static void SaveJpeg(string aFilename, int aQuality, Bitmap aImage)
        {
            if (aImage.PixelFormat != System.Drawing.Imaging.PixelFormat.Format24bppRgb)
            {
                throw new ArgumentException("Only three channel color images are supported.");
            }

            if (aImage.Width % 16 != 0 || aImage.Height % 16 != 0)
            {
                throw new ArgumentException("The provided bitmap must have a height and width of a multiple of 16.");
            }

            JPEGCompression compression = new JPEGCompression();

            NPPImage_8uC3 src = new NPPImage_8uC3(aImage.Width, aImage.Height);
            NPPImage_8uC1 srcY = new NPPImage_8uC1(aImage.Width, aImage.Height);
            NPPImage_8uC1 srcCb = new NPPImage_8uC1(aImage.Width / 2, aImage.Height / 2);
            NPPImage_8uC1 srcCr = new NPPImage_8uC1(aImage.Width / 2, aImage.Height / 2);
            src.CopyToDevice(aImage);

            //System.Drawing.Bitmap is ordered BGR not RGB
            //The NPP routine BGR to YCbCR outputs the values in clamped range, following the YCbCr standard.
            //But JPEG uses unclamped values ranging all from [0..255], thus use our own color matrix:
            float[,] BgrToYCbCr = new float[3, 4]
            {{0.114f,     0.587f,    0.299f,   0},
             {0.5f,      -0.33126f, -0.16874f, 128},
             {-0.08131f, -0.41869f,  0.5f,     128}};

            src.ColorTwist(BgrToYCbCr);

            //Reduce size of of Cb and Cr channel
            src.Copy(srcY, 2);
            srcY.Resize(srcCr, 0.5, 0.5, InterpolationMode.SuperSampling);
            src.Copy(srcY, 1);
            srcY.Resize(srcCb, 0.5, 0.5, InterpolationMode.SuperSampling);
            src.Copy(srcY, 0);

            FrameHeader oFrameHeader = new FrameHeader();
            oFrameHeader.nComponents = 3;
            oFrameHeader.nHeight = (ushort)aImage.Height;
            oFrameHeader.nSamplePrecision = 8;
            oFrameHeader.nWidth = (ushort)aImage.Width;
            oFrameHeader.aComponentIdentifier = new byte[] { 1, 2, 3 };
            oFrameHeader.aSamplingFactors = new byte[] { 34, 17, 17 }; //Y channel is twice the sice of Cb/Cr channel
            oFrameHeader.aQuantizationTableSelector = new byte[] { 0, 1, 1 };

            //Get quantization tables from JPEG standard with quality scaling
            QuantizationTable[] aQuantizationTables = new QuantizationTable[2];
            aQuantizationTables[0] = new QuantizationTable(QuantizationTable.QuantizationType.Luminance, aQuality);
            aQuantizationTables[1] = new QuantizationTable(QuantizationTable.QuantizationType.Chroma, aQuality);

            CudaDeviceVariable<byte>[] pdQuantizationTables = new CudaDeviceVariable<byte>[2];
            pdQuantizationTables[0] = aQuantizationTables[0].aTable;
            pdQuantizationTables[1] = aQuantizationTables[1].aTable;

            //Get Huffman tables from JPEG standard
            HuffmanTable[] aHuffmanTables = new HuffmanTable[4];
            aHuffmanTables[0] = new HuffmanTable(HuffmanTable.HuffmanType.LuminanceDC);
            aHuffmanTables[1] = new HuffmanTable(HuffmanTable.HuffmanType.ChromaDC);
            aHuffmanTables[2] = new HuffmanTable(HuffmanTable.HuffmanType.LuminanceAC);
            aHuffmanTables[3] = new HuffmanTable(HuffmanTable.HuffmanType.ChromaAC);

            //Set header
            ScanHeader oScanHeader = new ScanHeader();
            oScanHeader.nA = 0;
            oScanHeader.nComponents = 3;
            oScanHeader.nSe = 63;
            oScanHeader.nSs = 0;
            oScanHeader.aComponentSelector = new byte[] { 1, 2, 3 };
            oScanHeader.aHuffmanTablesSelector = new byte[] { 0, 17, 17 };

            NPPImage_16sC1[] apdDCT = new NPPImage_16sC1[3];

            NPPImage_8uC1[] apDstImage = new NPPImage_8uC1[3];
            NppiSize[] aDstSize = new NppiSize[3];
            aDstSize[0] = new NppiSize(srcY.Width, srcY.Height);
            aDstSize[1] = new NppiSize(srcCb.Width, srcCb.Height);
            aDstSize[2] = new NppiSize(srcCr.Width, srcCr.Height);

            // Compute channel sizes as stored in the output JPEG (8x8 blocks & MCU block layout)
            NppiSize oDstImageSize = new NppiSize();
            float frameWidth = (float)Math.Floor((float)oFrameHeader.nWidth);
            float frameHeight = (float)Math.Floor((float)oFrameHeader.nHeight);

            oDstImageSize.width = (int)Math.Max(1.0f, frameWidth);
            oDstImageSize.height = (int)Math.Max(1.0f, frameHeight);

            //Console.WriteLine("Output Size: " + oDstImageSize.width + "x" + oDstImageSize.height + "x" + (int)(oFrameHeader.nComponents));

            apDstImage[0] = srcY;
            apDstImage[1] = srcCb;
            apDstImage[2] = srcCr;

            int nMCUBlocksH = 0;
            int nMCUBlocksV = 0;

            // Compute channel sizes as stored in the JPEG (8x8 blocks & MCU block layout)
            for (int i = 0; i < oFrameHeader.nComponents; ++i)
            {
                nMCUBlocksV = Math.Max(nMCUBlocksV, oFrameHeader.aSamplingFactors[i] >> 4);
//.........这里部分代码省略.........
开发者ID:kunzmi,项目名称:managedCuda,代码行数:101,代码来源:JpegNPP.cs


示例7: FilterSobelCrossBorder

		/// <summary>
		/// Filters the image using a second cross derivative Sobel filter kernel with border control.
		/// </summary>
		/// <param name="dest">Destination image</param>
		/// <param name="eMaskSize">Enumeration value specifying the mask size</param>
		/// <param name="eBorderType">The border type operation to be applied at source image border boundaries.</param>
		public void FilterSobelCrossBorder(NPPImage_16sC1 dest, MaskSize eMaskSize, NppiBorderType eBorderType)
		{
			status = NPPNativeMethods.NPPi.FilterSobelCrossBorder.nppiFilterSobelCrossBorder_8u16s_C1R(_devPtr, _pitch, _sizeOriginal, _pointRoi, dest.DevicePointerRoi, dest.Pitch, dest.SizeRoi, eMaskSize, eBorderType);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiFilterSobelCrossBorder_8u16s_C1R", status));
			NPPException.CheckNppStatus(status, this);
		}
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:12,代码来源:NPPImage_8uC1.cs


示例8: FilterGauss

 /// <summary>
 /// Filters the image using a separable Gaussian filter kernel with user supplied floating point coefficients
 /// </summary>
 /// <param name="dst">Destination-Image</param>
 /// <param name="Kernel">Pointer to an array of nFilterTaps kernel coefficients which sum to 1.0F, where nFilterTaps =  2 * ((int)((float)ceil(radius) + 0.5F) ) + 1.</param>
 public void FilterGauss(NPPImage_16sC1 dst, CudaDeviceVariable<float> Kernel)
 {
     status = NPPNativeMethods.NPPi.FixedFilters.nppiFilterGaussAdvanced_16s_C1R(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi, Kernel.Size, Kernel.DevicePointer);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiFilterGaussAdvanced_16s_C1R", status));
     NPPException.CheckNppStatus(status, this);
 }
开发者ID:kunzmi,项目名称:managedCuda,代码行数:11,代码来源:NPPImage_16sC1.cs


示例9: FilterColumnBorder

 /// <summary>
 /// General purpose 1D convolution column filter with border control.<para/>
 /// Pixels under the mask are multiplied by the respective weights in the mask
 /// and the results are summed. Before writing the result pixel the sum is scaled
 /// back via division by nDivisor. If any portion of the mask overlaps the source
 /// image boundary the requested border type operation is applied to all mask pixels
 /// which fall outside of the source image.
 /// </summary>
 /// <param name="dest">Destination image</param>
 /// <param name="Kernel">Pointer to the start address of the kernel coefficient array. Coeffcients are expected to be stored in reverse order.</param>
 /// <param name="nAnchor">X offset of the kernel origin frame of reference w.r.t the source pixel.</param>
 /// <param name="nDivisor">The factor by which the convolved summation from the Filter operation should be divided. If equal to the sum of coefficients, this will keep the maximum result value within full scale.</param>
 /// <param name="eBorderType">The border type operation to be applied at source image border boundaries.</param>
 public void FilterColumnBorder(NPPImage_16sC1 dest, CudaDeviceVariable<int> Kernel, int nAnchor, int nDivisor, NppiBorderType eBorderType)
 {
     status = NPPNativeMethods.NPPi.LinearFilter1D.nppiFilterColumnBorder_16s_C1R(_devPtr, _pitch, _sizeOriginal, _pointRoi, dest.DevicePointerRoi, dest.Pitch, dest.SizeRoi, Kernel.DevicePointer, Kernel.Size, nAnchor, nDivisor, eBorderType);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiFilterColumnBorder_16s_C1R", status));
     NPPException.CheckNppStatus(status, this);
 }
开发者ID:kunzmi,项目名称:managedCuda,代码行数:19,代码来源:NPPImage_16sC1.cs


示例10: FilterColumn

 /// <summary>
 /// 1D column convolution.
 /// </summary>
 /// <param name="dst">Destination-Image</param>
 /// <param name="pKernel">Pointer to the start address of the kernel coefficient array. pKernel.Sizes gives kernel size<para/>
 /// Coefficients are expected to be stored in reverse order.</param>
 /// <param name="nAnchor">Y offset of the kernel origin frame of reference relative to the source pixel.</param>
 public void FilterColumn(NPPImage_16sC1 dst, CudaDeviceVariable<float> pKernel, int nAnchor)
 {
     status = NPPNativeMethods.NPPi.LinearFilter1D.nppiFilterColumn32f_16s_C1R(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi, pKernel.DevicePointer, pKernel.Size, nAnchor);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiFilterColumn32f_16s_C1R", status));
     NPPException.CheckNppStatus(status, this);
 }
开发者ID:kunzmi,项目名称:managedCuda,代码行数:13,代码来源:NPPImage_16sC1.cs


示例11: FilterBoxBorder

 /// <summary>
 /// Computes the average pixel values of the pixels under a rectangular mask.
 /// </summary>
 /// <param name="dest">Destination image</param>
 /// <param name="oMaskSize">Width and Height of the neighborhood region for the local Avg operation.</param>
 /// <param name="oAnchor">X and Y offsets of the kernel origin frame of reference w.r.t the source pixel.</param>
 /// <param name="eBorderType">The border type operation to be applied at source image border boundaries.</param>
 public void FilterBoxBorder(NPPImage_16sC1 dest, NppiSize oMaskSize, NppiPoint oAnchor, NppiBorderType eBorderType)
 {
     status = NPPNativeMethods.NPPi.LinearFixedFilters2D.nppiFilterBoxBorder_16s_C1R(_devPtr, _pitch, _sizeOriginal, _pointRoi, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, oMaskSize, oAnchor, eBorderType);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiFilterBoxBorder_16s_C1R", status));
     NPPException.CheckNppStatus(status, this);
 }
开发者ID:kunzmi,项目名称:managedCuda,代码行数:13,代码来源:NPPImage_16sC1.cs


示例12: Exp

 /// <summary>
 /// Exponential, scale by 2^(-nScaleFactor), then clamp to saturated value.
 /// </summary>
 /// <param name="dest">Destination image</param>
 /// <param name="nScaleFactor">scaling factor</param>
 public void Exp(NPPImage_16sC1 dest, int nScaleFactor)
 {
     status = NPPNativeMethods.NPPi.Exp.nppiExp_16s_C1RSfs(_devPtrRoi, _pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, nScaleFactor);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiExp_16s_C1RSfs", status));
     NPPException.CheckNppStatus(status, this);
 }
开发者ID:kunzmi,项目名称:managedCuda,代码行数:11,代码来源:NPPImage_16sC1.cs


示例13: DotProduct

        /// <summary>
        /// One-channel 16-bit signed image DotProd. Buffer is internally allocated and freed.
        /// </summary>
        /// <param name="src2">2nd source image</param>
        /// <param name="pDp">Pointer to the computed dot product of the two images. (1 * sizeof(double))</param>
        public void DotProduct(NPPImage_16sC1 src2, CudaDeviceVariable<double> pDp)
        {
            int bufferSize = DotProdGetBufferHostSize();
            CudaDeviceVariable<byte> buffer = new CudaDeviceVariable<byte>(bufferSize);

            status = NPPNativeMethods.NPPi.DotProd.nppiDotProd_16s64f_C1R(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, _sizeRoi, pDp.DevicePointer, buffer.DevicePointer);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiDotProd_16s64f_C1R", status));
            buffer.Dispose();
            NPPException.CheckNppStatus(status, this);
        }
开发者ID:kunzmi,项目名称:managedCuda,代码行数:15,代码来源:NPPImage_16sC1.cs


示例14: Div

 /// <summary>
 /// In place image division, scale by 2^(-nScaleFactor), then clamp to saturated value.
 /// </summary>
 /// <param name="src2">2nd source image</param>
 /// <param name="rndMode">Result Rounding mode to be used</param>
 /// <param name="nScaleFactor">scaling factor</param>
 public void Div(NPPImage_16sC1 src2, NppRoundMode rndMode, int nScaleFactor)
 {
     status = NPPNativeMethods.NPPi.DivRound.nppiDiv_Round_16s_C1IRSfs(src2.DevicePointerRoi, src2.Pitch, _devPtrRoi, _pitch, _sizeRoi, rndMode, nScaleFactor);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiDiv_Round_16s_C1IRSfs", status));
     NPPException.CheckNppStatus(status, this);
 }
开发者ID:kunzmi,项目名称:managedCuda,代码行数:12,代码来源:NPPImage_16sC1.cs


示例15: Scale

		/// <summary>
		/// image conversion.
		/// </summary>
		/// <param name="dst">Destination-Image</param>
		public void Scale(NPPImage_16sC1 dst)
		{
			NppiRect srcRect = new NppiRect(_pointRoi, _sizeRoi);
			status = NPPNativeMethods.NPPi.Scale.nppiScale_8u16s_C1R(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiScale_8u16s_C1R", status));
			NPPException.CheckNppStatus(status, this);
		}
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:11,代码来源:NPPImage_8uC1.cs


示例16: FilterBorder

		/// <summary>
		/// Single channel 8-bit unsigned to 16-bit signed convolution filter with border control.<para/>
		/// General purpose 2D convolution filter using floating-point weights with border control.<para/>
		/// Pixels under the mask are multiplied by the respective weights in the mask
		/// and the results are summed. Before writing the result pixel the sum is scaled
		/// back via division by nDivisor. If any portion of the mask overlaps the source
		/// image boundary the requested border type operation is applied to all mask pixels
		/// which fall outside of the source image. <para/>
		/// </summary>
		/// <param name="dest">Destination image</param>
		/// <param name="pKernel">Pointer to the start address of the kernel coefficient array. Coeffcients are expected to be stored in reverse order</param>
		/// <param name="nKernelSize">Width and Height of the rectangular kernel.</param>
		/// <param name="oAnchor">X and Y offsets of the kernel origin frame of reference relative to the source pixel.</param>
		/// <param name="eBorderType">The border type operation to be applied at source image border boundaries.</param>
		public void FilterBorder(NPPImage_16sC1 dest, CudaDeviceVariable<float> pKernel, NppiSize nKernelSize, NppiPoint oAnchor, NppiBorderType eBorderType)
		{
			status = NPPNativeMethods.NPPi.FilterBorder32f.nppiFilterBorder32f_8u16s_C1R(_devPtr, _pitch, _sizeOriginal, _pointRoi, dest.DevicePointerRoi, dest.Pitch, dest.SizeRoi, pKernel.DevicePointer, nKernelSize, oAnchor, eBorderType);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiFilterBorder32f_8u16s_C1R", status));
			NPPException.CheckNppStatus(status, this);
		}
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:20,代码来源:NPPImage_8uC1.cs


示例17: EncodeHuffmanScan

        /// <summary>
        /// Huffman Encoding of the JPEG Encoding.<para/>
        /// Input is expected to be 64x1 macro blocks and output is expected as byte stuffed huffman encoded JPEG scan.
        /// </summary>
        /// <param name="pSrc">Source image.</param>
        /// <param name="restartInterval">Restart Interval, see JPEG standard.</param>
        /// <param name="Ss">Start Coefficient, see JPEG standard.</param>
        /// <param name="Se">End Coefficient, see JPEG standard.</param>
        /// <param name="Ah">Bit Approximation High, see JPEG standard.</param>
        /// <param name="Al">Bit Approximation Low, see JPEG standard.</param>
        /// <param name="pDst">Byte-stuffed huffman encoded JPEG scan.</param>
        /// <param name="nLength">Byte length of the huffman encoded JPEG scan.</param>
        /// <param name="pHuffmanTableDC">DC Huffman table.</param>
        /// <param name="pHuffmanTableAC">AC Huffman table.</param>
        /// <param name="oSizeROI">ROI</param>
        /// <param name="buffer">Scratch buffer</param>
        public static void EncodeHuffmanScan(NPPImage_16sC1[] pSrc, int restartInterval, int Ss, int Se, int Ah, int Al,
					CudaDeviceVariable<byte> pDst, ref int nLength, NppiEncodeHuffmanSpec[] pHuffmanTableDC, NppiEncodeHuffmanSpec[] pHuffmanTableAC, NppiSize[] oSizeROI, CudaDeviceVariable<byte> buffer)
        {
            NppStatus status;

            CUdeviceptr[] srcs = new CUdeviceptr[] { pSrc[0].DevicePointer, pSrc[1].DevicePointer, pSrc[2].DevicePointer };
            int[] steps = new int[] { pSrc[0].Pitch, pSrc[1].Pitch, pSrc[2].Pitch };

            status = NPPNativeMethods.NPPi.CompressionDCT.nppiEncodeHuffmanScan_JPEG_8u16s_P3R(srcs, steps, restartInterval, Ss, Se, Ah, Al, pDst.DevicePointer, ref nLength, pHuffmanTableDC, pHuffmanTableAC, oSizeROI, buffer.DevicePointer);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiEncodeHuffmanScan_JPEG_8u16s_P3R", status));
            NPPException.CheckNppStatus(status, null);
        }
开发者ID:furusdara,项目名称:cuda,代码行数:28,代码来源:JPEGCompression.cs


示例18: LoadJpeg

        const int BUFFER_SIZE = 4 << 23; //32 MegaBytes

        #endregion Fields

        #region Methods

        public static Bitmap LoadJpeg(string aFilename)
        {
            JPEGCompression compression = new JPEGCompression();
            byte[] pJpegData = File.ReadAllBytes(aFilename);
            int nInputLength = pJpegData.Length;

            // Check if this is a valid JPEG file
            int nPos = 0;
            int nMarker = nextMarker(pJpegData, ref nPos, nInputLength);

            if (nMarker != 0x0D8)
            {
                throw new ArgumentException(aFilename + " is not a JPEG file.");
            }

            nMarker = nextMarker(pJpegData, ref nPos, nInputLength);

            // Parsing and Huffman Decoding (on host)
            FrameHeader oFrameHeader = new FrameHeader();

            oFrameHeader.aComponentIdentifier = new byte[3];
            oFrameHeader.aSamplingFactors = new byte[3];
            oFrameHeader.aQuantizationTableSelector = new byte[3];

            QuantizationTable[] aQuantizationTables = new QuantizationTable[4];
            aQuantizationTables[0] = new QuantizationTable();
            aQuantizationTables[1] = new QuantizationTable();
            aQuantizationTables[2] = new QuantizationTable();
            aQuantizationTables[3] = new QuantizationTable();

            CudaDeviceVariable<byte>[] pdQuantizationTables = new CudaDeviceVariable<byte>[4];
            pdQuantizationTables[0] = new CudaDeviceVariable<byte>(64);
            pdQuantizationTables[1] = new CudaDeviceVariable<byte>(64);
            pdQuantizationTables[2] = new CudaDeviceVariable<byte>(64);
            pdQuantizationTables[3] = new CudaDeviceVariable<byte>(64);

            HuffmanTable[] aHuffmanTables = new HuffmanTable[4];
            aHuffmanTables[0] = new HuffmanTable();
            aHuffmanTables[1] = new HuffmanTable();
            aHuffmanTables[2] = new HuffmanTable();
            aHuffmanTables[3] = new HuffmanTable();

            ScanHeader oScanHeader = new ScanHeader();
            oScanHeader.aComponentSelector = new byte[3];
            oScanHeader.aHuffmanTablesSelector = new byte[3];

            int nMCUBlocksH = 0;
            int nMCUBlocksV = 0;

            int nRestartInterval = -1;

            NppiSize[] aSrcSize = new NppiSize[3];

            short[][] aphDCT = new short[3][];
            NPPImage_16sC1[] apdDCT = new NPPImage_16sC1[3];
            int[] aDCTStep = new int[3];

            NPPImage_8uC1[] apSrcImage = new NPPImage_8uC1[3];
            int[] aSrcImageStep = new int[3];

            NPPImage_8uC1[] apDstImage = new NPPImage_8uC1[3];
            int[] aDstImageStep = new int[3];
            NppiSize[] aDstSize = new NppiSize[3];

            //Same read routine as in NPP JPEG sample from Nvidia
            while (nMarker != -1)
            {
                if (nMarker == 0x0D8)
                {
                    // Embeded Thumbnail, skip it
                    int nNextMarker = nextMarker(pJpegData, ref nPos, nInputLength);

                    while (nNextMarker != -1 && nNextMarker != 0x0D9)
                    {
                        nNextMarker = nextMarker(pJpegData, ref nPos, nInputLength);
                    }
                }

                if (nMarker == 0x0DD)
                {
                    readRestartInterval(pJpegData, ref nPos, ref nRestartInterval);
                }

                if ((nMarker == 0x0C0) | (nMarker == 0x0C2))
                {
                    //Assert Baseline for this Sample
                    //Note: NPP does support progressive jpegs for both encode and decode
                    if (nMarker != 0x0C0)
                    {
                        pdQuantizationTables[0].Dispose();
                        pdQuantizationTables[1].Dispose();
                        pdQuantizationTables[2].Dispose();
                        pdQuantizationTables[3].Dispose();

//.........这里部分代码省略.........
开发者ID:kunzmi,项目名称:managedCuda,代码行数:101,代码来源:JpegNPP.cs


示例19: EnodeHuffmanScan

        /// <summary>
        /// Huffman Encoding of the JPEG Encoding.<para/>
        /// Input is expected to be 64x1 macro blocks and output is expected as byte stuffed huffman encoded JPEG scan.
        /// </summary>
        /// <param name="pSrc">Source image.</param>
        /// <param name="restartInterval">Restart Interval, see JPEG standard.</param>
        /// <param name="Ss">Start Coefficient, see JPEG standard.</param>
        /// <param name="Se">End Coefficient, see JPEG standard.</param>
        /// <param name="Ah">Bit Approximation High, see JPEG standard.</param>
        /// <param name="Al">Bit Approximation Low, see JPEG standard.</param>
        /// <param name="pDst">Byte-stuffed huffman encoded JPEG scan.</param>
        /// <param name="nLength">Byte length of the huffman encoded JPEG scan.</param>
        /// <param name="pHuffmanTableDC">DC Huffman table.</param>
        /// <param name="pHuffmanTableAC">AC Huffman table.</param>
        /// <param name="oSizeROI">ROI</param>
        /// <param name="buffer">Scratch buffer</param>
        public static void EnodeHuffmanScan(NPPImage_16sC1 pSrc, int restartInterval, int Ss, int Se, int Ah, int Al,
					CudaDeviceVariable<byte> pDst, ref int nLength, NppiEncodeHuffmanSpec pHuffmanTableDC, NppiEncodeHuffmanSpec pHuffmanTableAC, NppiSize oSizeROI, CudaDeviceVariable<byte> buffer)
        {
            NppStatus status;
            status = NPPNativeMethods.NPPi.CompressionDCT.nppiEncodeHuffmanScan_JPEG_8u16s_P1R(pSrc.DevicePointer, pSrc.Pitch, restartInterval, Ss, Se, Ah, Al, pDst.DevicePointer, ref nLength, pHuffmanTableDC, pHuffmanTableAC, oSizeROI, buffer.DevicePointer);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiEncodeHuffmanScan_JPEG_8u16s_P1R", status));
            NPPException.CheckNppStatus(status, null);
        }
开发者ID:furusdara,项目名称:cuda,代码行数:24,代码来源:JPEGCompression.cs


示例20: GradientVectorSobelBorder

 /// <summary>
 /// 3 channel 8-bit unsigned packed RGB to optional 1 channel 16-bit signed X (vertical), Y (horizontal), magnitude, 
 /// and/or 32-bit floating point angle gradient vectors with user selectable fixed mask size and distance method with border control.
 /// </summary>
 /// <param name="destX">X vector destination_image_pointer</param>
 /// <param name="destY">Y vector destination_image_pointer.</param>
 /// <param name="destMag">magnitude destination_image_pointer.</param>
 /// <param name="destAngle">angle destination_image_pointer.</param>
 /// <param name="eMaskSize">fixed filter mask size to use.</param>
 /// <param name="eNorm">gradient distance method to use.</param>
 /// <param name="eBorderType">The border type operation to be applied at source image border boundaries.</param>
 public void GradientVectorSobelBorder(NPPImage_16sC1 destX, NPPImage_16sC1 destY, NPPImage_16sC1 destMag, NPPImage_32fC1 destAngle, MaskSize eMaskSize, NppiNorm eNorm, NppiBorderType eBorderType)
 {
     status = NPPNativeMethods.NPPi.GradientVectorSobelBorder.nppiGradientVectorSobelBorder_8u16s_C3C1R(_devPtr, _pitch, _sizeOriginal, _pointRoi, destX.DevicePointerRoi, destX.Pitch, destY.DevicePointerRoi, destY.Pitch, destMag.DevicePointerRoi, destMag.Pitch, destAngle.DevicePointerRoi, destAngle.Pitch, _sizeRoi, eMaskSize, eNorm, eBorderType);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiGradientVectorSobelBorder_8u16s_C3C1R", status));
     NPPException.CheckNppStatus(status, this);
 }
开发者ID:kunzmi,项目名称:managedCuda,代码行数:17,代码来源:NPPImage_8uC3.cs



注:本文中的ManagedCuda.NPP.NPPImage_16sC1类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# NPP.NPPImage_16sC3类代码示例发布时间:2022-05-26
下一篇:
C# CudaSparse.cusparseMatDescr类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap