libjpeg
APIs for encoding JPEG images.
More...
#include <NvJpegEncoder.h>
Public Member Functions | |
~NvJPEGEncoder () | |
int | encodeFromFd (int fd, J_COLOR_SPACE color_space, unsigned char **out_buf, unsigned long &out_buf_size) |
Encodes a JPEG image from a file descriptor (FD) of hardware buffer memory. | |
int | encodeFromBuffer (NvBuffer &buffer, J_COLOR_SPACE color_space, unsigned char **out_buf, unsigned long &out_buf_size) |
Encodes a JPEG image from software buffer memory. | |
void | setCropRect (uint32_t left, uint32_t top, uint32_t width, uint32_t height) |
Set the cropping rectangle to be used by the jpeg encoder. | |
Static Public Member Functions | |
static NvJPEGEncoder * | createJPEGEncoder (const char *comp_name) |
Create a new JPEG Encoder named comp_name. | |
Private Member Functions | |
NvJPEGEncoder (const char *comp_name) | |
Private Attributes | |
struct jpeg_compress_struct | cinfo |
struct jpeg_error_mgr | jerr |
Static Private Attributes | |
static const NvElementProfiler::ProfilerField | valid_fields |
libjpeg
APIs for encoding JPEG images.
It supports two methods for encoding:
malloc
). (Supports YUV420 color format)
Definition at line 85 of file NvJpegEncoder.h.
NvJPEGEncoder::~NvJPEGEncoder | ( | ) |
Definition at line 62 of file NvJpegEncoder.cpp.
NvJPEGEncoder::NvJPEGEncoder | ( | const char * | comp_name | ) | [private] |
Definition at line 39 of file NvJpegEncoder.cpp.
NvJPEGEncoder * NvJPEGEncoder::createJPEGEncoder | ( | const char * | comp_name | ) | [static] |
Create a new JPEG Encoder named comp_name.
Definition at line 51 of file NvJpegEncoder.cpp.
int NvJPEGEncoder::encodeFromBuffer | ( | NvBuffer & | buffer, | |
J_COLOR_SPACE | color_space, | |||
unsigned char ** | out_buf, | |||
unsigned long & | out_buf_size | |||
) |
Encodes a JPEG image from software buffer memory.
The application may allocate the memory for storing the JPEG image. If the allocation is less than what is required, libjpeg
allocates more memory. The out_buf pointer and out_buf_size are updated accordingly.
The encodeFromBuffer
method is slower than NvJPEGEncoder::encodeFromFd
because encodeFromBuffer
involves conversion from software buffer memory to hardware buffer memory.
Supports YUV420 format only.
[out] | buffer | Indicates the NvBuffer object to contain the encoded image. |
[out] | color_space | Indicates the color_space to use for encoding. |
[in] | out_buf | Specifies a pointer to the memory for the JPEG image. |
[in] | out_buf_size | Specifies the size of the output buffer in bytes. |
Definition at line 122 of file NvJpegEncoder.cpp.
int NvJPEGEncoder::encodeFromFd | ( | int | fd, | |
J_COLOR_SPACE | color_space, | |||
unsigned char ** | out_buf, | |||
unsigned long & | out_buf_size | |||
) |
Encodes a JPEG image from a file descriptor (FD) of hardware buffer memory.
The application may allocate the memory for storing the JPEG image. If the allocation is less than what is required, libjpeg
allocates more memory. The out_buf pointer and out_buf_size are updated accordingly.
Supports YUV420 and NV12 formats.
[out] | fd | Indicates the file descriptor (FD) of the hardware buffer. |
[out] | color_space | Indicates the color_space to use for encoding. |
[in] | out_buf | Specifies a pointer to the memory for the JPEG image. |
[in] | out_buf_size | Specifies the size of the output buffer in bytes. |
Definition at line 69 of file NvJpegEncoder.cpp.
void NvJPEGEncoder::setCropRect | ( | uint32_t | left, | |
uint32_t | top, | |||
uint32_t | width, | |||
uint32_t | height | |||
) |
Set the cropping rectangle to be used by the jpeg encoder.
This method should be called before encodeFromFd or encodeFromBuffer for the cropping to take effect.
[in] | left | Horizontal offset of the cropping rectangle, in pixels |
[in] | top | Vertical offset of the cropping rectangle, in pixels |
[in] | width | Width of the cropping rectangle, in pixels |
[in] | height | Height of the cropping rectangle, in pixels |
Definition at line 277 of file NvJpegEncoder.cpp.
struct jpeg_compress_struct NvJPEGEncoder::cinfo [read, private] |
Definition at line 167 of file NvJpegEncoder.h.
struct jpeg_error_mgr NvJPEGEncoder::jerr [read, private] |
Definition at line 168 of file NvJpegEncoder.h.
const NvElementProfiler::ProfilerField NvJPEGEncoder::valid_fields [static, private] |
Initial value:
Definition at line 170 of file NvJpegEncoder.h.