Class NPPNativeMethods.NPPi.ImageCompression
Image compression primitives.
The JPEG standard defines a flow of level shift, DCT and quantization for forward JPEG transform and inverse level shift, IDCT and de-quantization for inverse JPEG transform. This group has the functions for both forward and inverse functions.
Inheritance
Inherited Members
Namespace: ManagedCuda.NPP
Assembly: NPP.dll
Syntax
public static class ImageCompression
Methods
nppiDCTQuantFwd8x8LS_JPEG_8u16s_C1R(CUdeviceptr, Int32, CUdeviceptr, Int32, CUdeviceptr, NppiSize)
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.
Declaration
public static NppStatus nppiDCTQuantFwd8x8LS_JPEG_8u16s_C1R(CUdeviceptr pSrc, int nSrcStep, CUdeviceptr pDst, int nDstStep, CUdeviceptr pQuantFwdTable, NppiSize oSizeROI)
Parameters
Type | Name | Description |
---|---|---|
CUdeviceptr | pSrc | Source-Image Pointer. |
System.Int32 | nSrcStep | Source-Image Line Step. |
CUdeviceptr | pDst | Destination-Image Pointer. |
System.Int32 | nDstStep | Destination-Image Line Step. |
CUdeviceptr | pQuantFwdTable | Forward quantization tables for JPEG encoding created |
NppiSize | oSizeROI | Region-of-Interest (ROI). |
Returns
Type | Description |
---|---|
NppStatus | Error codes: - #NPP_SIZE_ERROR For negative input height/width or not a multiple of 8 width/height. - #NPP_STEP_ERROR If input image width is not multiple of 8 or does not match ROI. - #NPP_NULL_POINTER_ERROR If the destination pointer is 0. |
nppiDCTQuantInv8x8LS_JPEG_16s8u_C1R(CUdeviceptr, Int32, CUdeviceptr, Int32, CUdeviceptr, NppiSize)
Inverse DCT, de-quantization and level shift part of the JPEG decoding. Input is expected in 64x1 macro blocks and output is expected to be in 8x8 macro blocks.
Declaration
public static NppStatus nppiDCTQuantInv8x8LS_JPEG_16s8u_C1R(CUdeviceptr pSrc, int nSrcStep, CUdeviceptr pDst, int nDstStep, CUdeviceptr pQuantInvTable, NppiSize oSizeROI)
Parameters
Type | Name | Description |
---|---|---|
CUdeviceptr | pSrc | Source-Image Pointer. |
System.Int32 | nSrcStep | Source-Image Line Step. |
CUdeviceptr | pDst | Destination-Image Pointer. |
System.Int32 | nDstStep | Destination-Image Line Step. |
CUdeviceptr | pQuantInvTable | Inverse quantization tables for JPEG decoding created |
NppiSize | oSizeROI | Region-of-Interest (ROI). |
Returns
Type | Description |
---|---|
NppStatus | Error codes: - #NPP_SIZE_ERROR For negative input height/width or not a multiple of 8 width/height. - #NPP_STEP_ERROR If input image width is not multiple of 8 or does not match ROI. - #NPP_NULL_POINTER_ERROR If the destination pointer is 0. |
nppiQuantFwdRawTableInit_JPEG_8u(Byte[], Int32)
Apply quality factor to raw 8-bit quantization table. This is effectively and in-place method that modifies a given raw quantization table based on a quality factor. Note that this method is a host method and that the pointer to the raw quantization table is a host pointer.
Declaration
public static NppStatus nppiQuantFwdRawTableInit_JPEG_8u(byte[] hpQuantRawTable, int nQualityFactor)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | hpQuantRawTable | Raw quantization table. |
System.Int32 | nQualityFactor | Quality factor for the table. Range is [1:100]. |
Returns
Type | Description |
---|---|
NppStatus | Error code: #NPP_NULL_POINTER_ERROR is returned if hpQuantRawTable is 0. |
nppiQuantFwdTableInit_JPEG_8u16u(Byte[], UInt16[])
Initializes a quantization table for nppiDCTQuantFwd8x8LS_JPEG_8u16s_C1R(). The method creates a 16-bit version of the raw table and converts the data order from zigzag layout to original row-order layout since raw quantization tables are typically stored in zigzag format. This method is a host method. It consumes and produces host data. I.e. the pointers passed to this function must be host pointers. The resulting table needs to be transferred to device memory in order to be used with nppiDCTQuantFwd8x8LS_JPEG_8u16s_C1R() function.
Declaration
public static NppStatus nppiQuantFwdTableInit_JPEG_8u16u(byte[] hpQuantRawTable, ushort[] hpQuantFwdRawTable)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | hpQuantRawTable | Host pointer to raw quantization table as returned by |
System.UInt16[] | hpQuantFwdRawTable | Forward quantization table for use with nppiDCTQuantFwd8x8LS_JPEG_8u16s_C1R(). |
Returns
Type | Description |
---|---|
NppStatus | Error code: #NPP_NULL_POINTER_ERROR pQuantRawTable is 0. |
nppiQuantInvTableInit_JPEG_8u16u(Byte[], UInt16[])
Initializes a quantization table for nppiDCTQuantInv8x8LS_JPEG_16s8u_C1R(). The nppiDCTQuantFwd8x8LS_JPEG_8u16s_C1R() method uses a quantization table in a 16-bit format allowing for faster processing. In addition it converts the data order from zigzag layout to original row-order layout. Typically raw quantization tables are stored in zigzag format. This method is a host method and consumes and produces host data. I.e. the pointers passed to this function must be host pointers. The resulting table needs to be transferred to device memory in order to be used with nppiDCTQuantFwd8x8LS_JPEG_8u16s_C1R() function.
Declaration
public static NppStatus nppiQuantInvTableInit_JPEG_8u16u(byte[] hpQuantRawTable, ushort[] hpQuantFwdRawTable)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | hpQuantRawTable | Raw quantization table. |
System.UInt16[] | hpQuantFwdRawTable | Inverse quantization table. |
Returns
Type | Description |
---|---|
NppStatus | #NPP_NULL_POINTER_ERROR pQuantRawTable or pQuantFwdRawTable is0. |