Defines the API for the JPEG wrapper library.
More...
Data Structures |
struct | jh_jpegwrap_params_ts |
| Defines the parameter block passed to the JPEG library to decompress the JPEG image, which includes image size and scaling factors. More...
|
Functions |
int | jh_jpeg_compress (const jh_image_t *sbi, unsigned qual, jh_stream_t *stream, jh_error_t *error, int debug) |
| Compresses a residual image, also known as the subband image (SBI), in JPEG JFIF file format and stores the compressed image in memory.
|
int | jh_jpeg_compress_and_attach (const jh_image_t *sdri, unsigned qual, unsigned char *m11, unsigned *m11_sizes, unsigned char *icc, unsigned icc_size, jh_stream_t *stream, jh_error_t *error, int debug) |
| Compresses a standard dynamic range image (SDRI) in JPEG JFIF file format, attaches APP11 segments and an ICC profile, and stores the resulting image in memory.
|
void | jh_jpeg_release (unsigned char **jpg_buffer) |
| Releases the memory buffer created by jh_jpeg_compress() for the compressed SBI.
|
int | jh_jpeg_decompress_jpeghdr (unsigned char *jpg, size_t jpg_size, int *width, int *height, unsigned char **icc, int *icc_size, unsigned char **tmi, unsigned char **sbi, char *header, int probe_header, jh_jpegwrap_params_t *opts, jh_error_t *error, jh_monitor_t *monitorv) |
| Decompresses the JPEG-HDR file.
|
jh_result_t | jh_jpeg_read_header_mem (void *inbuffer, int size, int *width, int *height, int *channels, char *message) |
| Reads the JPEG-HDR file to get basic information about the image.
|
Detailed Description
Defines the API for the JPEG wrapper library.
Function Documentation
Compresses a residual image, also known as the subband image (SBI), in JPEG JFIF file format and stores the compressed image in memory.
- Note
- Later on, while creating the JPEG-HDR file, this compressed image is encoded in APP11 segments and put in the JPEG JFIF header.
- Parameters
-
[in] | sbi | Input residual image (SBI). |
[in] | qual | Encoding quality to compress the input SBI. Valid values 0 to 100. |
[in,out] | stream | User-implemented stream to hold encoded data |
[in,out] | error | User-allocated error-reporting structure that contains information about the error. Before calling this function, the value of error should be set to 0. |
| debug | RESERVED FOR INTERNAL USE. Must be set to 0. |
int jh_jpeg_compress_and_attach |
( |
const jh_image_t * |
sdri, |
|
|
unsigned |
qual, |
|
|
unsigned char * |
m11, |
|
|
unsigned * |
m11_sizes, |
|
|
unsigned char * |
icc, |
|
|
unsigned |
icc_size, |
|
|
jh_stream_t * |
stream, |
|
|
jh_error_t * |
error, |
|
|
int |
debug |
|
) |
| |
Compresses a standard dynamic range image (SDRI) in JPEG JFIF file format, attaches APP11 segments and an ICC profile, and stores the resulting image in memory.
- Parameters
-
[in] | sdri | Input standard dynamic range image (SDRI), also known as the tone-mapped image, or base image. |
[in] | qual | Encoding quality to compress the input SDRI. Valid values 0 to 100. |
[in] | m11 | Data to be stored in the APP11 marker. |
[in] | m11_sizes | Null-terminated character string containing the sizes of the APP11 markers stored in the m11 buffer. |
[in] | icc | Memory with the binary form of the ICC profile. NULL is allowed. |
[in] | icc_size | Size of the icc buffer. |
[in,out] | stream | User-implemented stream to hold encoded data |
[in,out] | error | User-allocated error-reporting structure that contains information about the error. Before calling this function, the value of error should be set to 0. |
| debug | RESERVED FOR INTERNAL USE. Must be set to 0. |
int jh_jpeg_decompress_jpeghdr |
( |
unsigned char * |
jpg, |
|
|
size_t |
jpg_size, |
|
|
int * |
width, |
|
|
int * |
height, |
|
|
unsigned char ** |
icc, |
|
|
int * |
icc_size, |
|
|
unsigned char ** |
tmi, |
|
|
unsigned char ** |
sbi, |
|
|
char * |
header, |
|
|
int |
probe_header, |
|
|
jh_jpegwrap_params_t * |
opts, |
|
|
jh_error_t * |
error, |
|
|
jh_monitor_t * |
monitorv |
|
) |
| |
Decompresses the JPEG-HDR file.
- Returns
- 0 if the function does not succeed.
- Parameters
-
[in] | jpg | Input JPEG-HDR file in memory. |
[in] | jpg_size | Size of the JPEG-HDR file. |
[out] | width | HDR image width, in pixels. |
[out] | height | HDR image height, in pixels. |
[out] | icc | ICC data to be returned, if applicable. |
[out] | icc_size | Size of the icc buffer. |
[out] | tmi | Resulting SDRI, which is the 8-bit gamma-corrected base image extracted from the JPEG-HDR file. |
[out] | sbi | Resulting SBI, which is the 8-bit residual image extracted from the JPEG-HDR file. |
[out] | header | JPEG-HDR header extracted from the JPEG-HDR file. |
[in] | probe_header | If the value is TRUE, only this header check will be conducted to identify the JPEG-HDR file. |
[in] | opts | Parameter block for JPEG decompression. If scaling factor is set to 1/2, 1/4, or 1/8, a smaller resulting image is generated. |
[in,out] | error | User-allocated error-reporting structure that contains information about the error, if any |
[in] | monitorv | Progress status of the function. Initial value of the jh_monitor_ts cancel field must be 0. |
jh_result_t jh_jpeg_read_header_mem |
( |
void * |
inbuffer, |
|
|
int |
size, |
|
|
int * |
width, |
|
|
int * |
height, |
|
|
int * |
channels, |
|
|
char * |
message |
|
) |
| |
Reads the JPEG-HDR file to get basic information about the image.
- Parameters
-
[in] | inbuffer | Input JPEG-HDR memory-mapped file. |
[in] | size | Size of the inbuffer buffer, in bytes. |
[out] | width | Number of columns in the image. |
[out] | height | Number of rows in the image. |
[out] | channels | Number of channels in the image. |
[in,out] | message | User-allocated character string that contains the description of the error, if any. |
void jh_jpeg_release |
( |
unsigned char ** |
jpg_buffer | ) |
|
Releases the memory buffer created by jh_jpeg_compress() for the compressed SBI.
- Note
- This function must be called after jh_jpeg_compress() and jh_jpeg_compress_and_attach() are called and as many times as these two functions are successfully executed, one after another.
- Returns
- 0 if the function does not succeed.
- Parameters
-
[out] | jpg_buffer | sbi_jpg buffer allocated in jh_jpeg_compress() for the JPEG-compressed SBI. |