Classes | Functions

CxUtils::JPEG Namespace Reference

Classes

class  Compressor
 If compressing multiple JPEG images, use a compressor because it will re-use memory for a slight speed up. More...
struct  InputSource
 Input source for JPEG decompression manager. More...
struct  OutputSource
 Output source for JPEG compression manager. More...

Functions

CX_UTILS_DLL int ConvertMJPEG2JPEG (const unsigned char *mjpeg, const unsigned int mjpegSize, unsigned char **jpeg, unsigned int *jpegSize)
 Takes an MJPEG frame data, and converts to JPEG data.
CX_UTILS_DLL int DecompressImage (const unsigned char *jpeg, const unsigned int jpegSize, unsigned char **image, unsigned short *width, unsigned short *height, unsigned char *channels)
 Takes JPEG data inside of a buffer and decompresses it to another buffer which will store the raw image.
CX_UTILS_DLL int CompressImage (const unsigned short width, const unsigned short height, const unsigned char channels, const unsigned char *image, unsigned char **jpeg, unsigned int *jpegBufferSize, unsigned int *jpegSize, const int quality=-1)
 Compresses RAW image data to JPEG format.
void InitSource (j_decompress_ptr cinfo)
boolean FillInputBuffer (j_decompress_ptr cinfo)
void SkipInputData (j_decompress_ptr cinfo, long num_bytes)
void TerminateSource (j_decompress_ptr cinfo)
void ErrorExit (j_common_ptr cinfo)
void InitDestination (j_compress_ptr cinfo)
boolean EmptyOutputBuffer (j_compress_ptr cinfo)
void TerminateDestination (j_compress_ptr cinfo)

Function Documentation

int CxUtils::JPEG::CompressImage ( const unsigned short  width,
const unsigned short  height,
const unsigned char  channels,
const unsigned char *  image,
unsigned char **  jpeg,
unsigned int *  jpegBufferSize,
unsigned int *  jpegSize,
const int  quality = -1 
)

Compresses RAW image data to JPEG format.

Parameters:
[in]imagePointer to raw image data that needs to be compressed. Data must be in BGR channel format.
[in]widthThe width of the image.
[in]heightThe height of the image.
[in]channelsThe number of channels in the image.
[out]jpegPointer to buffer which will store resulting JPEG data. If NULL or too small this buffer will grow dynamically.
[out]jpegBufferSizeThe size of the buffer in bytes holding the compressed JPEG.
[out]jpegSizeThe size of the JPEG data inside the buffer in bytes.
[in]qualityThe compression quality. Set to -1 for default, 0 worst and 100 best (but larger size).
Returns:
1 on success, 0 on failure.

JSAMPLE row to store a single compressed row.

Physical row width in image buffer (width*channels).

Definition at line 523 of file jpeg.cpp.

int CxUtils::JPEG::ConvertMJPEG2JPEG ( const unsigned char *  mjpeg,
const unsigned int  mjpegSize,
unsigned char **  jpeg,
unsigned int *  jpegSize 
)

Takes an MJPEG frame data, and converts to JPEG data.

Parameters:
[in]mjpegPointer to MJPEG data.
[in]mjpegSizeThe size in bytes of the MJPEG data.
[out]jpegPointer to buffer which will store the result. If NULL or too small new memory will be allocated dynamically. Decompressed data will be in BGR format.
[out]jpegSizePointer to output size of the new JPEG.
Returns:
1 on success, 0 on failure.

Definition at line 124 of file jpeg.cpp.

int CxUtils::JPEG::DecompressImage ( const unsigned char *  jpeg,
const unsigned int  jpegSize,
unsigned char **  image,
unsigned short *  width,
unsigned short *  height,
unsigned char *  channels 
)

Takes JPEG data inside of a buffer and decompresses it to another buffer which will store the raw image.

Parameters:
[in]jpegPointer to JPEG data.
[in]jpegSizeThe size in bytes of the JPEG data.
[out]imagePointer to buffer which will store the result. If NULL or too small new memory will be allocated dynamically. Decompressed data will be in BGR format.
[out]widthThe width of the image decompressed.
[out]heightThe height of the image decompressed.
[out]channelsThe number of channels in the decompressed image.
Returns:
1 on success, 0 on failure.

Definition at line 274 of file jpeg.cpp.

boolean CxUtils::JPEG::EmptyOutputBuffer ( j_compress_ptr  cinfo )

Definition at line 448 of file jpeg.cpp.

void CxUtils::JPEG::ErrorExit ( j_common_ptr  cinfo )

Definition at line 249 of file jpeg.cpp.

boolean CxUtils::JPEG::FillInputBuffer ( j_decompress_ptr  cinfo )

Definition at line 201 of file jpeg.cpp.

void CxUtils::JPEG::InitDestination ( j_compress_ptr  cinfo )

Definition at line 439 of file jpeg.cpp.

void CxUtils::JPEG::InitSource ( j_decompress_ptr  cinfo )

Definition at line 191 of file jpeg.cpp.

void CxUtils::JPEG::SkipInputData ( j_decompress_ptr  cinfo,
long  num_bytes 
)

Definition at line 228 of file jpeg.cpp.

void CxUtils::JPEG::TerminateDestination ( j_compress_ptr  cinfo )

Definition at line 474 of file jpeg.cpp.

void CxUtils::JPEG::TerminateSource ( j_decompress_ptr  cinfo )

Definition at line 243 of file jpeg.cpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines