The NvMediaIJPE object takes uncompressed image data and turns it into a jpeg bitstream.
Data Structures | |
struct | NvMediaJPHuffmanTableSpecfication |
image JPEG encoder HuffmanTable. More... | |
struct | NvMediaJPEncAttributes |
image JPEG encoder attributes. More... | |
struct | NvMediaIJPE |
image JPEG encoder object created by NvMediaIJPECreate. More... | |
Macros | |
#define | NVMEDIA_IJPE_VERSION_MAJOR 1 |
Major Version number. More... | |
#define | NVMEDIA_IJPE_VERSION_MINOR 7 |
Minor Version number. More... | |
#define | NVMEDIA_JPEG_ENC_FLAG_NONE |
JPEG encoder flag empty. More... | |
#define | NVMEDIA_JPEG_ENC_FLAG_SKIP_SOI |
JPEG encoder flag to skip SOI marker. More... | |
#define | NVMEDIA_IMAGE_JPEG_ATTRIBUTE_QUALITY |
Quality. More... | |
#define | NVMEDIA_IMAGE_JPEG_ATTRIBUTE_RESTARTINTERVAL |
Restart interval. More... | |
#define | NVMEDIA_IMAGE_JPEG_ATTRIBUTE_TARGETSIZE |
encode frame target size More... | |
#define | NVMEDIA_IMAGE_JPEG_ATTRIBUTE_QUANTTABLE |
Luma/Chroma quant table. More... | |
#define | NVMEDIA_IMAGE_JPEG_ATTRIBUTE_HUFFTABLE |
Huffmann table. More... | |
Functions | |
NvMediaStatus | NvMediaIJPEGetVersion (NvMediaVersion *version) |
Gets the version compatibility for the NvMedia IJPE library. More... | |
NvMediaIJPE * | NvMediaIJPECreate (const NvMediaDevice *device, NvMediaSurfaceType inputFormat, uint8_t maxOutputBuffering, uint32_t maxBitstreamBytes) |
Creates a JPEG encoder object capable of turning a stream of surfaces of the inputFormat into a JPEG stream. More... | |
void | NvMediaIJPEDestroy (NvMediaIJPE *encoder) |
Destroys an NvMedia image JPEG encoder. More... | |
NvMediaStatus | NvMediaIJPEFeedFrame (const NvMediaIJPE *encoder, NvMediaImage *frame, uint8_t quality) |
Encodes the specified frame with input quality. More... | |
NvMediaStatus | NvMediaIJPEFeedFrameQuant (const NvMediaIJPE *encoder, NvMediaImage *frame, uint8_t *lumaQuant, uint8_t *chromaQuant) |
Encodes the specified frame with input Luma and Chroma quant tables. More... | |
NvMediaStatus | NvMediaIJPEFeedFrameRateControl (const NvMediaIJPE *encoder, NvMediaImage *frame, uint8_t *lumaQuant, uint8_t *chromaQuant, uint32_t targetImageSize) |
Encodes the specified frame with input Luma and Chroma quant tables and targetImageSize. More... | |
NvMediaStatus | NvMediaIJPESetAttributes (const NvMediaIJPE *encoder, uint32_t attributeMask, const void *attributes) |
Sets the JPEG encoder attributes. More... | |
NvMediaStatus | NvMediaIJPEGetBits (const NvMediaIJPE *encoder, uint32_t *numBytes, void *buffer, uint32_t flags) |
Returns a frame's worth of bitstream into the provided buffer. More... | |
NvMediaStatus | NvMediaIJPEGetBitsEx (const NvMediaIJPE *encoder, uint32_t *numBytes, uint32_t numBitstreamBuffers, const NvMediaBitstreamBuffer *bitstreams, uint32_t flags) |
Performs the same operation as NvMediaIJPEGetBits() except NvMediaIJPEGetBitsEx() consumes an array of buffers. More... | |
NvMediaStatus | NvMediaIJPEBitsAvailable (const NvMediaIJPE *encoder, uint32_t *numBytesAvailable, NvMediaBlockingType blockingType, uint32_t millisecondTimeout) |
Returns the encode status and number of bytes available for the next frame (if any). More... | |
#define NVMEDIA_IJPE_VERSION_MAJOR 1 |
Major Version number.
Definition at line 38 of file nvmedia_ijpe.h.
#define NVMEDIA_IJPE_VERSION_MINOR 7 |
Minor Version number.
Definition at line 40 of file nvmedia_ijpe.h.
#define NVMEDIA_IMAGE_JPEG_ATTRIBUTE_HUFFTABLE |
Huffmann table.
Definition at line 79 of file nvmedia_ijpe.h.
#define NVMEDIA_IMAGE_JPEG_ATTRIBUTE_QUALITY |
Quality.
Definition at line 59 of file nvmedia_ijpe.h.
#define NVMEDIA_IMAGE_JPEG_ATTRIBUTE_QUANTTABLE |
Luma/Chroma quant table.
Definition at line 74 of file nvmedia_ijpe.h.
#define NVMEDIA_IMAGE_JPEG_ATTRIBUTE_RESTARTINTERVAL |
Restart interval.
Definition at line 64 of file nvmedia_ijpe.h.
#define NVMEDIA_IMAGE_JPEG_ATTRIBUTE_TARGETSIZE |
encode frame target size
Definition at line 69 of file nvmedia_ijpe.h.
#define NVMEDIA_JPEG_ENC_FLAG_NONE |
JPEG encoder flag empty.
Definition at line 46 of file nvmedia_ijpe.h.
#define NVMEDIA_JPEG_ENC_FLAG_SKIP_SOI |
JPEG encoder flag to skip SOI marker.
Normally, app inserts EXIF data in jpeg image which occurs after SOI marker. This flag be used to skip SOI marker insertion.
Definition at line 53 of file nvmedia_ijpe.h.
NvMediaStatus NvMediaIJPEBitsAvailable | ( | const NvMediaIJPE * | encoder, |
uint32_t * | numBytesAvailable, | ||
NvMediaBlockingType | blockingType, | ||
uint32_t | millisecondTimeout | ||
) |
Returns the encode status and number of bytes available for the next frame (if any).
The specific behavior depends on the specified blockingType. It is safe to call this function from a separate thread.
[in] | encoder | The encoder to use. |
[in] | numBytesAvailable | The number of bytes available in the next encoded frame. This is valid only when the return value is NVMEDIA_STATUS_OK. |
[in] | blockingType | The following are the supported blocking types:
|
[in] | millisecondTimeout | Timeout in milliseconds or NVMEDIA_VIDEO_ENCODER_TIMEOUT_INFINITE if a timeout is not desired. |
NVMEDIA_STATUS_OK
NVMEDIA_STATUS_PENDING
if an encode is in progress but not yet completed. NVMEDIA_STATUS_NONE_PENDING
if no encode is in progress. NVMEDIA_STATUS_TIMED_OUT
if the operation timed out. NvMediaIJPE* NvMediaIJPECreate | ( | const NvMediaDevice * | device, |
NvMediaSurfaceType | inputFormat, | ||
uint8_t | maxOutputBuffering, | ||
uint32_t | maxBitstreamBytes | ||
) |
Creates a JPEG encoder object capable of turning a stream of surfaces of the inputFormat into a JPEG stream.
Surfaces are fed to the encoder with NvMediaIJPEFeedFrame() and bitstream buffers are retrieved with NvMediaIJPEGetBits().
[in] | device | The device this image JPEG encoder will use. |
[in] | inputFormat | Specifies the stream of surfaces to convert to JPEG. |
[in] | maxOutputBuffering | This determines how many frames of encoded bitstream can be held by the NvMediaIJPE object before it must be retrieved using NvMediaIJPEGetBits(). This number must be greater than or equal to maxInputBuffering and is clamped to between maxInputBuffering and 16. If maxOutputBuffering frames worth of encoded bitstream are yet unretrieved by NvMediaIJPEGetBits (), then NvMediaIJPEFeedFrame() returns NVMEDIA_STATUS_INSUFFICIENT_BUFFERING. One or more frames must be retrieved with NvMediaIJPEGetBits () before frame feeding can continue. |
[in] | maxBitstreamBytes | Determines the maximum bytes that JPEG encoder can produce for each feed frame. |
NvMediaIJPE | The new image JPEG encoder device's handle or NULL if unsuccessful. |
void NvMediaIJPEDestroy | ( | NvMediaIJPE * | encoder | ) |
Destroys an NvMedia image JPEG encoder.
[in] | encoder | The JPEG encoder to destroy. |
NvMediaStatus NvMediaIJPEFeedFrame | ( | const NvMediaIJPE * | encoder, |
NvMediaImage * | frame, | ||
uint8_t | quality | ||
) |
Encodes the specified frame with input quality.
[in] | encoder | The encoder to use. |
[in] | frame | This must be of the same sourceType as in the the NvMediaIJPE object. There is no limit on the size of this surface. |
[in] | quality | This specifies the encode quality. JPEG encode will generate quant tables for luma and chroma according to the quality value Supported quality value: 1..100 |
NvMediaStatus NvMediaIJPEFeedFrameQuant | ( | const NvMediaIJPE * | encoder, |
NvMediaImage * | frame, | ||
uint8_t * | lumaQuant, | ||
uint8_t * | chromaQuant | ||
) |
Encodes the specified frame with input Luma and Chroma quant tables.
[in] | encoder | The encoder to use. |
[in] | frame | This must be of the same sourceType as in the NvMediaIJPE object. There is no limit on the size of this surface. |
[in] | lumaQuant | This specifies Luma quant table used for encode |
[in] | chromaQuant | This specifies Chroma quant table used for encode |
NvMediaStatus NvMediaIJPEFeedFrameRateControl | ( | const NvMediaIJPE * | encoder, |
NvMediaImage * | frame, | ||
uint8_t * | lumaQuant, | ||
uint8_t * | chromaQuant, | ||
uint32_t | targetImageSize | ||
) |
Encodes the specified frame with input Luma and Chroma quant tables and targetImageSize.
[in] | encoder | The encoder to use. |
[in] | frame | This must be of the same sourceType as in the NvMediaIJPE object. There is no limit on the size of this surface. |
[in] | lumaQuant | This specifies Luma quant table used for encode |
[in] | chromaQuant | This specifies Chroma quant table used for encode |
[in] | targetImageSize | This specifies target image size in bytes |
NvMediaStatus NvMediaIJPEGetBits | ( | const NvMediaIJPE * | encoder, |
uint32_t * | numBytes, | ||
void * | buffer, | ||
uint32_t | flags | ||
) |
Returns a frame's worth of bitstream into the provided buffer.
numBytes returns the size of this bitstream. It is safe to call this function from a separate thread. The return value and behavior is the same as that of NvMediaIJPEBitsAvailable() when called with NVMEDIA_ENCODE_BLOCKING_TYPE_NEVER except that when NVMEDIA_STATUS_OK is returned, the buffer will be filled in addition to the numBytes.
Before calling this function:
[in] | encoder | The encoder to use. |
[out] | numBytes | Returns the size of the filled bitstream. |
[in,out] | buffer | The buffer to be filled with the encoded data. If buffer is NULL, this function returns without copying the encoded bitstream. |
[in] | flags | The flags for special handlings Current support flag NVMEDIA_JPEG_ENC_FLAG_NONE or NVMEDIA_JPEG_ENC_FLAG_SKIP_SOI |
NvMediaStatus NvMediaIJPEGetBitsEx | ( | const NvMediaIJPE * | encoder, |
uint32_t * | numBytes, | ||
uint32_t | numBitstreamBuffers, | ||
const NvMediaBitstreamBuffer * | bitstreams, | ||
uint32_t | flags | ||
) |
Performs the same operation as NvMediaIJPEGetBits() except NvMediaIJPEGetBitsEx() consumes an array of buffers.
Please see NvMediaIJPEGetBits() for usage.
[in] | encoder | The encoder to use. |
[out] | numBytes | Returns the size of the filled bitstream. |
[in] | numBitstreamBuffers | Number of buffers provided to encoder |
[in,out] | bitstreams | Pointer pointing to the array of buffers of type NvMediaBitstreamBuffer. These buffer to be filled with the encoded data. If it is NULL, this function returns without copying the encoded bitstreams. |
[in] | flags | The flags for special handlings Current support flag NVMEDIA_JPEG_ENC_FLAG_NONE or NVMEDIA_JPEG_ENC_FLAG_SKIP_SOI |
NvMediaStatus NvMediaIJPEGetVersion | ( | NvMediaVersion * | version | ) |
Gets the version compatibility for the NvMedia IJPE library.
[in] | version | A pointer to a NvMediaVersion structure of the client. |
NvMediaStatus NvMediaIJPESetAttributes | ( | const NvMediaIJPE * | encoder, |
uint32_t | attributeMask, | ||
const void * | attributes | ||
) |
Sets the JPEG encoder attributes.
These go into effect at the next encode frame.
[in] | encoder | The encoder to use. |
[in] | attributeMask | Attribute mask. |
[in] | attributes | Attributes data. Supported attribute structures: NvMediaJPEncAttributes |