Helper class for decoding JPEG images using libjpeg APIs.
NvJPEGDecoder
uses the libjpeg
APIs for decoding JPEG images. It supports two methods for decoding:
DMABUF
and return its file descriptor (FD).malloc
).The JPEG decoder is capable of decoding YUV420, YUV422, and YUV444 JPEG images.
JCS_YCbCr
(YUV420) color space is currently supported. Definition at line 86 of file NvJpegDecoder.h.
Public Member Functions | |
~NvJPEGDecoder () | |
int | decodeToFd (int &fd, unsigned char *in_buf, unsigned long in_buf_size, uint32_t &pixfmt, uint32_t &width, uint32_t &height) |
Decodes a JPEG image to hardware buffer memory. More... | |
int | decodeToBuffer (NvBuffer **buffer, unsigned char *in_buf, unsigned long in_buf_size, uint32_t *pixfmt, uint32_t *width, uint32_t *height) |
Decodes a JPEG image to software buffer memory. More... | |
virtual int | isInError () |
Indicates whether the element encountered an error during its operation. More... | |
void | getProfilingData (NvElementProfiler::NvElementProfilerData &data) |
Gets profiling data for the element. More... | |
void | printProfilingStats (std::ostream &out_stream=std::cout) |
Prints profiling data for the element to an output stream. More... | |
virtual void | enableProfiling () |
Enables profiling for the element. More... | |
bool | isProfilingEnabled () |
Checks whether profiling is enabled for the element. More... | |
Static Public Member Functions | |
static NvJPEGDecoder * | createJPEGDecoder (const char *comp_name) |
Creates a new JPEG Decoder named comp_name. More... | |
Protected Attributes | |
int | is_in_error |
Indicates if an error was encountered during the operation of the element. More... | |
const char * | comp_name |
Specifies the name of the component, for debugging. More... | |
NvElementProfiler | profiler |
Profiler for the element. More... | |
NvJPEGDecoder::~NvJPEGDecoder | ( | ) |
|
static |
Creates a new JPEG Decoder named comp_name.
int NvJPEGDecoder::decodeToBuffer | ( | NvBuffer ** | buffer, |
unsigned char * | in_buf, | ||
unsigned long | in_buf_size, | ||
uint32_t * | pixfmt, | ||
uint32_t * | width, | ||
uint32_t * | height | ||
) |
Decodes a JPEG image to software buffer memory.
This method decodes JPEG images in software memory to a specified width and size.
decodeToBuffer
method is slower than the NvJPEGDecoder::decodeToFd method because it involves conversion from hardware buffer memory to software buffer memory.[out] | buffer | Indirect pointer to an NvBuffer object that contains the decoded image. The object is allocated by the method and the buffer memory is allocated using NvBuffer::allocateMemory. |
[in] | in_buf | A pointer to the memory containing the JPEG. |
[in] | in_buf_size | Size of the input buffer in bytes. |
[out] | pixfmt | A pointer to the V4L2 pixel format of the decoded image. |
[out] | width | A pointer to the width of the decoded image in pixels. |
[out] | height | A pointer to the height of the decoded image in pixels. |
int NvJPEGDecoder::decodeToFd | ( | int & | fd, |
unsigned char * | in_buf, | ||
unsigned long | in_buf_size, | ||
uint32_t & | pixfmt, | ||
uint32_t & | width, | ||
uint32_t & | height | ||
) |
Decodes a JPEG image to hardware buffer memory.
This method decodes JPEG images in hardware memory to a specified width and size.
[out] | fd | A reference to the file descriptor (FD) of the hardware buffer. |
[in] | in_buf | A pointer to the memory containing the JPEG image. |
[in] | in_buf_size | Size of the input buffer in bytes. |
[out] | pixfmt | A reference to the V4L2 pixel format of the decoded image. |
[out] | width | A reference to the width of the decoded image in pixels. |
[out] | height | A reference to the height of the decoded image in pixels. |
|
virtualinherited |
Enables profiling for the element.
Reimplemented in NvV4l2Element.
|
inherited |
Gets profiling data for the element.
|
inlinevirtualinherited |
Indicates whether the element encountered an error during its operation.
Reimplemented in NvV4l2Element.
Definition at line 72 of file NvElement.h.
References NvElement::is_in_error.
|
inherited |
Checks whether profiling is enabled for the element.
|
inherited |
Prints profiling data for the element to an output stream.
[in] | out_stream | Output stream of type std::ostream to print the data to. It takes the default value std::cout if not specified. |
|
protectedinherited |
Specifies the name of the component, for debugging.
Definition at line 122 of file NvElement.h.
|
protectedinherited |
Indicates if an error was encountered during the operation of the element.
Definition at line 120 of file NvElement.h.
Referenced by NvElement::isInError().
|
protectedinherited |
Profiler for the element.
Definition at line 124 of file NvElement.h.