NVIDIA Performance Primitives (NPP)
Version 9.2
|
Image compression primitives. More...
Modules | |
Quantization Functions | |
Data Structures | |
struct | NppiJpegFrameDescr |
JPEG frame descriptor. More... |
|
struct | NppiJpegScanDescr |
JPEG scan descriptor. More... |
|
struct | NppiJpegDecodeJob |
JPEG decode job used by nppiJpegDecodeJob (see that for more documentation) More... |
|
struct | NppiJpegDecodeJobMemory |
Memory buffers used by one decode job. More... |
|
Typedefs | |
typedef struct NppiDecodeHuffmanSpec |
NppiDecodeHuffmanSpec |
typedef struct NppiEncodeHuffmanSpec |
NppiEncodeHuffmanSpec |
Functions | |
NppStatus | nppiDecodeHuffmanSpecGetBufSize_JPEG (int *pSize) |
Returns the length of the NppiDecodeHuffmanSpec structure. More... |
|
NppStatus | nppiDecodeHuffmanSpecInitHost_JPEG (const Npp8u *pRawHuffmanTable, NppiHuffmanTableType eTableType, NppiDecodeHuffmanSpec *pHuffmanSpec) |
Creates a Huffman table in a format that is suitable for the decoder on the host. More... |
|
NppStatus | nppiDecodeHuffmanSpecInitAllocHost_JPEG (const Npp8u *pRawHuffmanTable, NppiHuffmanTableType eTableType, NppiDecodeHuffmanSpec **ppHuffmanSpec) |
Allocates memory and creates a Huffman table in a format that is suitable for the decoder on the host. More... |
|
NppStatus | nppiDecodeHuffmanSpecFreeHost_JPEG (NppiDecodeHuffmanSpec *pHuffmanSpec) |
Frees the host memory allocated by nppiDecodeHuffmanSpecInitAllocHost_JPEG. More... |
|
NppStatus | nppiDecodeHuffmanScanHost_JPEG_8u16s_P1R (const Npp8u *pSrc, Npp32s nLength, Npp32s restartInterval, Npp32s Ss, Npp32s Se, Npp32s Ah, Npp32s Al, Npp16s *pDst, Npp32s nDstStep, NppiDecodeHuffmanSpec *pHuffmanTableDC, NppiDecodeHuffmanSpec *pHuffmanTableAC, NppiSize oSizeROI) |
Huffman Decoding of the JPEG decoding on the host. More... |
|
NppStatus | nppiDecodeHuffmanScanHost_JPEG_8u16s_P3R (const Npp8u *pSrc, Npp32s nLength, Npp32s nRestartInterval, Npp32s nSs, Npp32s nSe, Npp32s nAh, Npp32s nAl, Npp16s *apDst[3], Npp32s aDstStep[3], NppiDecodeHuffmanSpec *apHuffmanDCTable[3], NppiDecodeHuffmanSpec *apHuffmanACTable[3], NppiSize aSizeROI[3]) |
Huffman Decoding of the JPEG decoding on the host. More... |
|
NppStatus | nppiEncodeHuffmanSpecGetBufSize_JPEG (int *pSize) |
Returns the length of the NppiEncodeHuffmanSpec structure. More... |
|
NppStatus | nppiEncodeHuffmanSpecInit_JPEG (const Npp8u *pRawHuffmanTable, NppiHuffmanTableType eTableType, NppiEncodeHuffmanSpec *pHuffmanSpec) |
Creates a Huffman table in a format that is suitable for the encoder. More... |
|
NppStatus | nppiEncodeHuffmanSpecInitAlloc_JPEG (const Npp8u *pRawHuffmanTable, NppiHuffmanTableType eTableType, NppiEncodeHuffmanSpec **ppHuffmanSpec) |
Allocates memory and creates a Huffman table in a format that is suitable for the encoder. More... |
|
NppStatus | nppiEncodeHuffmanSpecFree_JPEG (NppiEncodeHuffmanSpec *pHuffmanSpec) |
Frees the memory allocated by nppiEncodeHuffmanSpecInitAlloc_JPEG. More... |
|
NppStatus | nppiEncodeHuffmanScan_JPEG_8u16s_P1R (const Npp16s *pSrc, Npp32s nSrcStep, Npp32s nRestartInterval, Npp32s nSs, Npp32s nSe, Npp32s nAh, Npp32s nAl, Npp8u *pDst, Npp32s *nLength, NppiEncodeHuffmanSpec *pHuffmanTableDC, NppiEncodeHuffmanSpec *pHuffmanTableAC, NppiSize oSizeROI, Npp8u *pTempStorage) |
Huffman Encoding of the JPEG Encoding. More... |
|
NppStatus | nppiEncodeHuffmanScan_JPEG_8u16s_P3R (Npp16s *apSrc[3], Npp32s aSrcStep[3], Npp32s nRestartInterval, Npp32s nSs, Npp32s nSe, Npp32s nAh, Npp32s nAl, Npp8u *pDst, Npp32s *nLength, NppiEncodeHuffmanSpec *apHuffmanDCTable[3], NppiEncodeHuffmanSpec *apHuffmanACTable[3], NppiSize aSizeROI[3], Npp8u *pTempStorage) |
Huffman Encoding of the JPEG Encoding. More... |
|
NppStatus | nppiEncodeOptimizeHuffmanScan_JPEG_8u16s_P1R (const Npp16s *pSrc, Npp32s nSrcStep, Npp32s nRestartInterval, Npp32s nSs, Npp32s nSe, Npp32s nAh, Npp32s nAl, Npp8u *pDst, Npp32s *pLength, Npp8u *hpCodesDC, Npp8u *hpTableDC, Npp8u *hpCodesAC, Npp8u *hpTableAC, NppiEncodeHuffmanSpec *pHuffmanDCTable, NppiEncodeHuffmanSpec *pHuffmanACTable, NppiSize oSizeROI, Npp8u *pTempStorage) |
Optimize Huffman Encoding of the JPEG Encoding. More... |
|
NppStatus | nppiEncodeOptimizeHuffmanScan_JPEG_8u16s_P3R (Npp16s *apSrc[3], Npp32s aSrcStep[3], Npp32s nRestartInterval, Npp32s nSs, Npp32s nSe, Npp32s nAh, Npp32s nAl, Npp8u *pDst, Npp32s *pLength, Npp8u *hpCodesDC[3], Npp8u *hpTableDC[3], Npp8u *hpCodesAC[3], Npp8u *hpTableAC[3], NppiEncodeHuffmanSpec *apHuffmanDCTable[3], NppiEncodeHuffmanSpec *apHuffmanACTable[3], NppiSize oSizeROI[3], Npp8u *pTempStorage) |
Optimize Huffman Encoding of the JPEG Encoding. More... |
|
NppStatus | nppiEncodeHuffmanGetSize (NppiSize oSize, int nChannels, size_t *pBufSize) |
Calculates the size of the temporary buffer for baseline Huffman encoding. More... |
|
NppStatus | nppiEncodeOptimizeHuffmanGetSize (NppiSize oSize, int nChannels, int *pBufSize) |
Calculates the size of the temporary buffer for optimize Huffman coding. More... |
|
NppStatus | nppiDCTInv4x4_WebP_16s_C1R (const Npp16s *pSrc, int nSrcStep, Npp16s *pDst, int nDstStep, NppiSize oSizeROI) |
Inverse DCT in WebP decoding. More... |
|
Hybrid CPU+GPU JPEG Huffman decoding | |
These functions and structs are used for Huffman decoding part of JPEG decode pipeline. It uses hybrid CPU + GPU approach. See nppiJpegDecodeJob for more documentation and example | |
enum |
NppiJpegDecodeJobKind { NPPI_JPEG_DECODE_SIMPLE, NPPI_JPEG_DECODE_PRE, NPPI_JPEG_DECODE_CPU, NPPI_JPEG_DECODE_GPU, NPPI_JPEG_DECODE_MEMZERO, NPPI_JPEG_DECODE_FINALIZE } |
Type of job to execute. More... |
|
NppStatus | nppiJpegDecodeJobMemorySize (const NppiJpegDecodeJob *pJob, size_t *aSize) |
Calculates sizes of additional buffers used by the job. More... |
|
NppStatus | nppiJpegDecodeJob (const NppiJpegDecodeJob *pJob, const NppiJpegDecodeJobMemory *pMemory) |
Executes a job – part of decoding. More... |
|
NppStatus | nppiJpegDecodeJobCreateMemzero (NppiJpegDecodeJob *pJob) |
Initializes a job that has to be called at the beginning of decoding. More... |
|
NppStatus | nppiJpegDecodeJobCreateFinalize (NppiJpegDecodeJob *pJob) |
Initializes a job that has to be called at the end of decoding, in order to convert temporary representation of DCT coefficients to the final one. More... |
|
size_t | nppiJpegDecodeGetScanDeadzoneSize (void) |
This function returns how much additional memory has to be available after the end of compressed scan data. More... |
|
size_t | nppiJpegDecodeGetDCTBufferSize (NppiSize oBlocks) |
Returns how much memory has to be allocated for DCT coefficient buffers declared in NppiJpegDecodeJobMemory. More... |
|
#define | NPPI_JPEG_DECODE_N_BUFFERS 3 |
Number of additional buffers that may be used by JPEG decode jobs. More... |
|
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.
These functions can be found in the nppicom library. Linking to only the sub-libraries that you use can significantly save link time, application load time, and CUDA runtime startup time when using dynamic libraries.
#define NPPI_JPEG_DECODE_N_BUFFERS 3 |
Number of additional buffers that may be used by JPEG decode jobs.
This number may change in the future, but it remain small.
typedef struct NppiDecodeHuffmanSpec NppiDecodeHuffmanSpec |
typedef struct NppiEncodeHuffmanSpec NppiEncodeHuffmanSpec |
Type of job to execute.
Usually you will need just SIMPLE for each scan, one MEMZERO at the beginning and FINALIZE at the end. See the example in nppiJpegDecodeJob
SIMPLE can be split into multiple jobs: PRE, CPU & GPU. Please note that if you don't use SIMPLE, you man need to add some memcopies and synchronizes as described in nppiJpegDecodeJob.
NppStatus nppiDCTInv4x4_WebP_16s_C1R | ( | const Npp16s * | pSrc, |
int | nSrcStep, | ||
Npp16s * | pDst, | ||
int | nDstStep, | ||
NppiSize | oSizeROI | ||
) |
Inverse DCT in WebP decoding.
Input is the bitstream that contains the coefficients of 16x16 blocks. These coefficients are based on a 4x4 sub-block unit, e.g., Coeffs in 0th 4x4 block, 1st 4x4 block 2nd 4x4 block, etc. Output is the coefficients after inverse DCT transform. The output is put in an image format (i.e. raster scan order), different from the input order.
pSrc | Source-Image Pointer. |
nSrcStep | Source-Image Line Step. |
pDst | Destination-Image Pointer. |
nDstStep | Destination-Image Line Step. |
oSizeROI | Region-of-Interest (ROI). |
NppStatus nppiDecodeHuffmanScanHost_JPEG_8u16s_P1R | ( | const Npp8u * | pSrc, |
Npp32s | nLength, | ||
Npp32s | restartInterval, | ||
Npp32s | Ss, | ||
Npp32s | Se, | ||
Npp32s | Ah, | ||
Npp32s | Al, | ||
Npp16s * | pDst, | ||
Npp32s | nDstStep, | ||
NppiDecodeHuffmanSpec * | pHuffmanTableDC, | ||
NppiDecodeHuffmanSpec * | pHuffmanTableAC, | ||
NppiSize | oSizeROI | ||
) |
Huffman Decoding of the JPEG decoding on the host.
Input is expected in byte stuffed huffman encoded JPEG scan and output is expected to be 64x1 macro blocks.
pSrc | Byte-stuffed huffman encoded JPEG scan. |
nLength | Byte length of the input. |
restartInterval | Restart Interval, see JPEG standard. |
Ss | Start Coefficient, see JPEG standard. |
Se | End Coefficient, see JPEG standard. |
Ah | Bit Approximation High, see JPEG standard. |
Al | Bit Approximation Low, see JPEG standard. |
pDst | Destination-Image Pointer. |
nDstStep | Destination-Image Line Step. |
pHuffmanTableDC | DC Huffman table. |
pHuffmanTableAC | AC Huffman table. |
oSizeROI | Region-of-Interest (ROI). |
NppStatus nppiDecodeHuffmanScanHost_JPEG_8u16s_P3R | ( | const Npp8u * | pSrc, |
Npp32s | nLength, | ||
Npp32s | nRestartInterval, | ||
Npp32s | nSs, | ||
Npp32s | nSe, | ||
Npp32s | nAh, | ||
Npp32s | nAl, | ||
Npp16s * | apDst[3], | ||
Npp32s | aDstStep[3], | ||
NppiDecodeHuffmanSpec * | apHuffmanDCTable[3], | ||
NppiDecodeHuffmanSpec * | apHuffmanACTable[3], | ||
NppiSize | aSizeROI[3] | ||
) |
Huffman Decoding of the JPEG decoding on the host.
Input is expected in byte stuffed huffman encoded JPEG scan and output is expected to be 64x1 macro blocks.
pSrc | Byte-stuffed huffman encoded JPEG scan. |
nLength | Byte length of the input. |
nRestartInterval | Restart Interval, see JPEG standard. |
nSs | Start Coefficient, see JPEG standard. |
nSe | End Coefficient, see JPEG standard. |
nAh | Bit Approximation High, see JPEG standard. |
nAl | Bit Approximation Low, see JPEG standard. |
apDst | Destination-Image Pointer. |
aDstStep | Destination-Image Line Step. |
apHuffmanDCTable | DC Huffman tables. |
apHuffmanACTable | AC Huffman tables. |
aSizeROI | Region-of-Interest (ROI). |
NppStatus nppiDecodeHuffmanSpecFreeHost_JPEG | ( | NppiDecodeHuffmanSpec * | pHuffmanSpec | ) |
Frees the host memory allocated by nppiDecodeHuffmanSpecInitAllocHost_JPEG.
pHuffmanSpec | Pointer to the Huffman table for the decoder |
NppStatus nppiDecodeHuffmanSpecGetBufSize_JPEG | ( | int * | pSize | ) |
Returns the length of the NppiDecodeHuffmanSpec structure.
pSize | Pointer to a variable that will receive the length of the NppiDecodeHuffmanSpec structure. |
NppStatus nppiDecodeHuffmanSpecInitAllocHost_JPEG | ( | const Npp8u * | pRawHuffmanTable, |
NppiHuffmanTableType | eTableType, | ||
NppiDecodeHuffmanSpec ** | ppHuffmanSpec | ||
) |
Allocates memory and creates a Huffman table in a format that is suitable for the decoder on the host.
pRawHuffmanTable | Huffman table formated as specified in the JPEG standard. |
eTableType | Enum specifying type of table (nppiDCTable or nppiACTable). |
ppHuffmanSpec | Pointer to returned pointer to the Huffman table for the decoder |
NppStatus nppiDecodeHuffmanSpecInitHost_JPEG | ( | const Npp8u * | pRawHuffmanTable, |
NppiHuffmanTableType | eTableType, | ||
NppiDecodeHuffmanSpec * | pHuffmanSpec | ||
) |
Creates a Huffman table in a format that is suitable for the decoder on the host.
pRawHuffmanTable | Huffman table formated as specified in the JPEG standard. |
eTableType | Enum specifying type of table (nppiDCTable or nppiACTable). |
pHuffmanSpec | Pointer to the Huffman table for the decoder |
Calculates the size of the temporary buffer for baseline Huffman encoding.
oSize | Image Dimension. |
nChannels | Number of channels in the image. |
pBufSize | Pointer to variable that returns the size of the temporary buffer. |
NppStatus nppiEncodeHuffmanScan_JPEG_8u16s_P1R | ( | const Npp16s * | pSrc, |
Npp32s | nSrcStep, | ||
Npp32s | nRestartInterval, | ||
Npp32s | nSs, | ||
Npp32s | nSe, | ||
Npp32s | nAh, | ||
Npp32s | nAl, | ||
Npp8u * | pDst, | ||
Npp32s * | nLength, | ||
NppiEncodeHuffmanSpec * | pHuffmanTableDC, | ||
NppiEncodeHuffmanSpec * | pHuffmanTableAC, | ||
NppiSize | oSizeROI, | ||
Npp8u * | pTempStorage | ||
) |
Huffman Encoding of the JPEG Encoding.
Input is expected to be 64x1 macro blocks and output is expected as byte stuffed huffman encoded JPEG scan.
pSrc | Destination-Image Pointer. |
nSrcStep | Destination-Image Line Step. |
nRestartInterval | Restart Interval, see JPEG standard. Currently only values <=0 are supported. |
nSs | Start Coefficient, see JPEG standard. |
nSe | End Coefficient, see JPEG standard. |
nAh | Bit Approximation High, see JPEG standard. |
nAl | Bit Approximation Low, see JPEG standard. |
pDst | Byte-stuffed huffman encoded JPEG scan. |
nLength | Byte length of the huffman encoded JPEG scan. |
pHuffmanTableDC | DC Huffman table. |
pHuffmanTableAC | AC Huffman table. |
oSizeROI | Region-of-Interest (ROI). |
pTempStorage | Temporary storage. |
NppStatus nppiEncodeHuffmanScan_JPEG_8u16s_P3R | ( | Npp16s * | apSrc[3], |
Npp32s | aSrcStep[3], | ||
Npp32s | nRestartInterval, | ||
Npp32s | nSs, | ||
Npp32s | nSe, | ||
Npp32s | nAh, | ||
Npp32s | nAl, | ||
Npp8u * | pDst, | ||
Npp32s * | nLength, | ||
NppiEncodeHuffmanSpec * | apHuffmanDCTable[3], | ||
NppiEncodeHuffmanSpec * | apHuffmanACTable[3], | ||
NppiSize | aSizeROI[3], | ||
Npp8u * | pTempStorage | ||
) |
Huffman Encoding of the JPEG Encoding.
Input is expected to be 64x1 macro blocks and output is expected as byte stuffed huffman encoded JPEG scan.
apSrc | Destination-Image Pointer. |
aSrcStep | Destination-Image Line Step. |
nRestartInterval | Restart Interval, see JPEG standard. Currently only values <=0 are supported. |
nSs | Start Coefficient, see JPEG standard. |
nSe | End Coefficient, see JPEG standard. |
nAh | Bit Approximation High, see JPEG standard. |
nAl | Bit Approximation Low, see JPEG standard. |
pDst | Byte-stuffed huffman encoded JPEG scan. |
nLength | Byte length of the huffman encoded JPEG scan. |
apHuffmanDCTable | DC Huffman tables. |
apHuffmanACTable | AC Huffman tables. |
aSizeROI | Region-of-Interest (ROI). |
pTempStorage | Temporary storage. |
NppStatus nppiEncodeHuffmanSpecFree_JPEG | ( | NppiEncodeHuffmanSpec * | pHuffmanSpec | ) |
Frees the memory allocated by nppiEncodeHuffmanSpecInitAlloc_JPEG.
pHuffmanSpec | Pointer to the Huffman table for the encoder |
NppStatus nppiEncodeHuffmanSpecGetBufSize_JPEG | ( | int * | pSize | ) |
Returns the length of the NppiEncodeHuffmanSpec structure.
pSize | Pointer to a variable that will receive the length of the NppiEncodeHuffmanSpec structure. |
NppStatus nppiEncodeHuffmanSpecInit_JPEG | ( | const Npp8u * | pRawHuffmanTable, |
NppiHuffmanTableType | eTableType, | ||
NppiEncodeHuffmanSpec * | pHuffmanSpec | ||
) |
Creates a Huffman table in a format that is suitable for the encoder.
pRawHuffmanTable | Huffman table formated as specified in the JPEG standard. |
eTableType | Enum specifying type of table (nppiDCTable or nppiACTable). |
pHuffmanSpec | Pointer to the Huffman table for the decoder |
NppStatus nppiEncodeHuffmanSpecInitAlloc_JPEG | ( | const Npp8u * | pRawHuffmanTable, |
NppiHuffmanTableType | eTableType, | ||
NppiEncodeHuffmanSpec ** | ppHuffmanSpec | ||
) |
Allocates memory and creates a Huffman table in a format that is suitable for the encoder.
pRawHuffmanTable | Huffman table formated as specified in the JPEG standard. |
eTableType | Enum specifying type of table (nppiDCTable or nppiACTable). |
ppHuffmanSpec | Pointer to returned pointer to the Huffman table for the encoder |
Calculates the size of the temporary buffer for optimize Huffman coding.
oSize | Image Dimension. |
nChannels | Number of channels in the image. |
pBufSize | Pointer to variable that returns the size of the temporary buffer. |
NppStatus nppiEncodeOptimizeHuffmanScan_JPEG_8u16s_P1R | ( | const Npp16s * | pSrc, |
Npp32s | nSrcStep, | ||
Npp32s | nRestartInterval, | ||
Npp32s | nSs, | ||
Npp32s | nSe, | ||
Npp32s | nAh, | ||
Npp32s | nAl, | ||
Npp8u * | pDst, | ||
Npp32s * | pLength, | ||
Npp8u * | hpCodesDC, | ||
Npp8u * | hpTableDC, | ||
Npp8u * | hpCodesAC, | ||
Npp8u * | hpTableAC, | ||
NppiEncodeHuffmanSpec * | pHuffmanDCTable, | ||
NppiEncodeHuffmanSpec * | pHuffmanACTable, | ||
NppiSize | oSizeROI, | ||
Npp8u * | pTempStorage | ||
) |
Optimize Huffman Encoding of the JPEG Encoding.
Input is expected to be 64x1 macro blocks and output is expected as byte stuffed huffman encoded JPEG scan.
pSrc | Destination-Image Pointer. |
nSrcStep | Destination-Image Line Step. |
nRestartInterval | Restart Interval, see JPEG standard. Currently only values <=0 are supported. |
nSs | Start Coefficient, see JPEG standard. |
nSe | End Coefficient, see JPEG standard. |
nAh | Bit Approximation High, see JPEG standard. |
nAl | Bit Approximation Low, see JPEG standard. |
pDst | Byte-stuffed huffman encoded JPEG scan. |
pLength | Pointer to the byte length of the huffman encoded JPEG scan. |
hpCodesDC | Host pointer to the code of the huffman tree for DC component. |
hpTableDC | Host pointer to the table of the huffman tree for DC component. |
hpCodesAC | Host pointer to the code of the huffman tree for AC component. |
hpTableAC | Host pointer to the table of the huffman tree for AC component. |
pHuffmanDCTable | DC Huffman table. |
pHuffmanACTable | AC Huffman table. |
oSizeROI | Region-of-Interest (ROI). |
pTempStorage | Temporary storage. |
NppStatus nppiEncodeOptimizeHuffmanScan_JPEG_8u16s_P3R | ( | Npp16s * | apSrc[3], |
Npp32s | aSrcStep[3], | ||
Npp32s | nRestartInterval, | ||
Npp32s | nSs, | ||
Npp32s | nSe, | ||
Npp32s | nAh, | ||
Npp32s | nAl, | ||
Npp8u * | pDst, | ||
Npp32s * | pLength, | ||
Npp8u * | hpCodesDC[3], | ||
Npp8u * | hpTableDC[3], | ||
Npp8u * | hpCodesAC[3], | ||
Npp8u * | hpTableAC[3], | ||
NppiEncodeHuffmanSpec * | apHuffmanDCTable[3], | ||
NppiEncodeHuffmanSpec * | apHuffmanACTable[3], | ||
NppiSize | oSizeROI[3], | ||
Npp8u * | pTempStorage | ||
) |
Optimize Huffman Encoding of the JPEG Encoding.
Input is expected to be 64x1 macro blocks and output is expected as byte stuffed huffman encoded JPEG scan.
apSrc | Destination-Image Pointer. |
aSrcStep | Destination-Image Line Step. |
nRestartInterval | Restart Interval, see JPEG standard. Currently only values <=0 are supported. |
nSs | Start Coefficient, see JPEG standard. |
nSe | End Coefficient, see JPEG standard. |
nAh | Bit Approximation High, see JPEG standard. |
nAl | Bit Approximation Low, see JPEG standard. |
pDst | Byte-stuffed huffman encoded JPEG scan. |
pLength | Pointer to the byte length of the huffman encoded JPEG scan. |
hpCodesDC | Host pointer to the code of the huffman tree for DC component. |
hpTableDC | Host pointer to the table of the huffman tree for DC component. |
hpCodesAC | Host pointer to the code of the huffman tree for AC component. |
hpTableAC | Host pointer to the table of the huffman tree for AC component. |
apHuffmanDCTable | DC Huffman tables. |
apHuffmanACTable | AC Huffman tables. |
oSizeROI | Region-of-Interest (ROI). |
pTempStorage | Temporary storage. |
size_t nppiJpegDecodeGetDCTBufferSize | ( | NppiSize | oBlocks | ) |
Returns how much memory has to be allocated for DCT coefficient buffers declared in NppiJpegDecodeJobMemory.
The returned value may be bigger than simply number of blocks * 64 * sizeof (short)
, because decoder may use slightly bigger temporary representation of data.
oBlocks | Size of the interleaved component in blocks. (That means that the size of component in blocks has to be aligned according to subsampling of this component and frame). |
This function assumes no ununsed space between rows, so at the end stride = oBlocks.width * 64 * sizeof (short)
.
size_t nppiJpegDecodeGetScanDeadzoneSize | ( | void | ) |
This function returns how much additional memory has to be available after the end of compressed scan data.
The following buffers: pCpuScan
and pGpuScan
in NppiJpegDecodeJobMemory should have size at least pScan->length + nppiJpegDecodeGetScanDeadzoneSize()
.
The additional memory is needed because the decoder may perform some speculative reads after the end of compressed scan data.
NppStatus nppiJpegDecodeJob | ( | const NppiJpegDecodeJob * | pJob, |
const NppiJpegDecodeJobMemory * | pMemory | ||
) |
Executes a job – part of decoding.
pJob | has to be initialized by nppiJpegDecodeJobCreateMemzero or nppiJpegDecodeJobCreateFinalize or manually. |
pMemory | has to point to valid structure, except for MEMZERO and FINALIZE scans, for which it can be NULL. |
This function can be used in two ways, depending on how much control do you need:
Example (pseudo)code for decoding JPEG: (Error handling code omitted for brevity. Each function which may return an error should be checked)
NppStatus nppiJpegDecodeJobCreateFinalize | ( | NppiJpegDecodeJob * | pJob | ) |
Initializes a job that has to be called at the end of decoding, in order to convert temporary representation of DCT coefficients to the final one.
pJob,: | pJob.pFrame should point to valid frame description *pJob.pScan will be overwritten. |
NppStatus nppiJpegDecodeJobCreateMemzero | ( | NppiJpegDecodeJob * | pJob | ) |
Initializes a job that has to be called at the beginning of decoding.
pJob,: |
pJob.pFrame should point to valid frame description. *pJob.pScan will be overwritten. |
If the caller had manually zeroed the memory for DCT buffers, (note: whole nppiJpegDecodeGetDCTBufferSize has to be zeroed). this job doesn't have to be executed.
NppStatus nppiJpegDecodeJobMemorySize | ( | const NppiJpegDecodeJob * | pJob, |
size_t * | aSize | ||
) |
Calculates sizes of additional buffers used by the job.
pJob | has to point to properly initialized job | |
[out] | aSize | will be filled with NPPI_JPEG_DECODE_N_BUFFERS sizes, aSize[i] telling how much memory has to be allocated for apCpuBuffer[i] and apGpuBuffer[i] . |