Grok  7.6.2
Classes | Functions | Variables
grok.cpp File Reference
#include <errno.h>
#include <stdarg.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/mman.h>
#include <fcntl.h>
#include "ojph_block_encoder.h"
#include "ojph_block_decoder.h"
#include "grk_includes.h"

Classes

struct  grk_codec_private
 Main codec handler used for compression or decompression. More...
 

Functions

bool GRK_CALLCONV grk_initialize (const char *plugin_path, uint32_t numthreads)
 Initialize library. More...
 
GRK_API void GRK_CALLCONV grk_deinitialize ()
 De-initialize library. More...
 
bool GRK_CALLCONV grk_set_info_handler (grk_msg_callback p_callback, void *p_user_data)
 Set info handler. More...
 
bool GRK_CALLCONV grk_set_warning_handler (grk_msg_callback p_callback, void *p_user_data)
 Set warning handler. More...
 
bool GRK_CALLCONV grk_set_error_handler (grk_msg_callback p_callback, void *p_user_data)
 Set error handler. More...
 
static size_t grk_read_from_file (void *p_buffer, size_t nb_bytes, FILE *p_file)
 
static uint64_t grk_get_data_length_from_file (FILE *p_file)
 
static size_t grk_write_to_file (void *p_buffer, size_t nb_bytes, FILE *p_file)
 
static bool grk_seek_in_file (int64_t nb_bytes, FILE *p_user_data)
 
const char *GRK_CALLCONV grk_version (void)
 library version More...
 
grk_image *GRK_CALLCONV grk_image_create (uint16_t numcmpts, grk_image_cmptparm *cmptparms, GRK_COLOR_SPACE clrspc, bool allocData)
 Create image. More...
 
void GRK_CALLCONV grk_image_destroy (grk_image *image)
 Deallocate all resources associated with an image. More...
 
grk_codec GRK_CALLCONV grk_create_decompress (GRK_CODEC_FORMAT p_format, grk_stream *stream)
 Create J2K/JP2 decompression structure. More...
 
void GRK_CALLCONV grk_set_default_decompress_params (grk_dparameters *parameters)
 Initialize decompress parameters with default values. More...
 
bool GRK_CALLCONV grk_init_decompress (grk_codec p_codec, grk_dparameters *parameters)
 Set up the decompressor with decompress parameters. More...
 
bool GRK_CALLCONV grk_read_header (grk_codec p_codec, grk_header_info *header_info, grk_image **p_image)
 Decompress JPEG 2000 header. More...
 
bool GRK_CALLCONV grk_decompress (grk_codec p_codec, grk_plugin_tile *tile, grk_image *p_image)
 Decompress image from a JPEG 2000 code stream. More...
 
bool GRK_CALLCONV grk_set_decompress_window (grk_codec p_codec, grk_image *p_image, uint32_t start_x, uint32_t start_y, uint32_t end_x, uint32_t end_y)
 Set the given area to be decompressed. More...
 
bool GRK_CALLCONV grk_decompress_tile (grk_codec p_codec, grk_image *p_image, uint16_t tile_index)
 Decompress a specific tile. More...
 
grk_codec GRK_CALLCONV grk_create_compress (GRK_CODEC_FORMAT p_format, grk_stream *stream)
 Creates a J2K/JP2 compression structure. More...
 
void GRK_CALLCONV grk_set_default_compress_params (grk_cparameters *parameters)
 Set compressing parameters to default values, that means : More...
 
bool GRK_CALLCONV grk_init_compress (grk_codec p_codec, grk_cparameters *parameters, grk_image *p_image)
 Set up the compressor parameters using the current image and user parameters. More...
 
bool GRK_CALLCONV grk_start_compress (grk_codec p_codec)
 Start compressing current image. More...
 
bool GRK_CALLCONV grk_compress (grk_codec p_codec)
 Encode an image into a JPEG 2000 code stream. More...
 
bool GRK_CALLCONV grk_compress_with_plugin (grk_codec p_info, grk_plugin_tile *tile)
 Encode an image into a JPEG 2000 code stream using plugin. More...
 
bool GRK_CALLCONV grk_end_compress (grk_codec p_codec)
 End to compress the current image. More...
 
bool GRK_CALLCONV grk_end_decompress (grk_codec p_codec)
 End decompression. More...
 
bool GRK_CALLCONV grk_set_MCT (grk_cparameters *parameters, float *pEncodingMatrix, int32_t *p_dc_shift, uint32_t pNbComp)
 Set the MCT matrix to use. More...
 
bool GRK_CALLCONV grk_compress_tile (grk_codec p_codec, uint16_t tile_index, uint8_t *p_data, uint64_t data_size)
 Compress uncompressed data stored in a buffer. More...
 
void GRK_CALLCONV grk_destroy_codec (grk_codec p_codec)
 Destroy codec. More...
 
void GRK_CALLCONV grk_dump_codec (grk_codec p_codec, uint32_t info_flag, FILE *output_stream)
 Dump codec information to file. More...
 
grk_codestream_info_v2 *GRK_CALLCONV grk_get_cstr_info (grk_codec p_codec)
 Get code stream information from codec. More...
 
void GRK_CALLCONV grk_destroy_cstr_info (grk_codestream_info_v2 **cstr_info)
 Destroy Codestream information after compression or decompression. More...
 
grk_codestream_index *GRK_CALLCONV grk_get_cstr_index (grk_codec p_codec)
 Get the code stream index from the codec. More...
 
void GRK_CALLCONV grk_destroy_cstr_index (grk_codestream_index **p_cstr_index)
 Destroy code stream index. More...
 
static void grk_free_file (void *p_user_data)
 
grk_stream *GRK_CALLCONV grk_stream_create_file_stream (const char *fname, size_t p_size, bool is_read_stream)
 Create stream from a file identified with its filename with a specific buffer size. More...
 
GRK_API size_t GRK_CALLCONV grk_stream_get_write_mem_stream_length (grk_stream *stream)
 Get length of memory stream. More...
 
grk_stream *GRK_CALLCONV grk_stream_create_mem_stream (uint8_t *buf, size_t len, bool ownsBuffer, bool is_read_stream)
 Create stream from buffer. More...
 
grk_stream *GRK_CALLCONV grk_stream_create_mapped_file_stream (const char *fname, bool read_stream)
 Create mapped file stream. More...
 
void GRK_CALLCONV grk_image_all_components_data_free (grk_image *image)
 Deallocate all component data for an image. More...
 
void GRK_CALLCONV grk_image_single_component_data_free (grk_image_comp *comp)
 Deallocate data for single image component. More...
 
static const char * get_path_separator ()
 
bool GRK_CALLCONV grk_plugin_load (grk_plugin_load_info info)
 Load plugin. More...
 
uint32_t GRK_CALLCONV grk_plugin_get_debug_state ()
 Get debug state of plugin. More...
 
void GRK_CALLCONV grk_plugin_cleanup (void)
 Release plugin resources. More...
 
GRK_API bool GRK_CALLCONV grk_plugin_init (grk_plugin_init_info initInfo)
 Initialize plugin. More...
 
void grk_plugin_internal_encode_callback (plugin_encode_user_callback_info *info)
 
int32_t GRK_CALLCONV grk_plugin_compress (grk_cparameters *compress_parameters, GRK_PLUGIN_COMPRESS_USER_CALLBACK callback)
 Compress with plugin. More...
 
int32_t GRK_CALLCONV grk_plugin_batch_compress (const char *input_dir, const char *output_dir, grk_cparameters *compress_parameters, GRK_PLUGIN_COMPRESS_USER_CALLBACK callback)
 Batch compress with plugin. More...
 
GRK_API bool GRK_CALLCONV grk_plugin_is_batch_complete (void)
 Check if batch job is complete. More...
 
void GRK_CALLCONV grk_plugin_stop_batch_compress (void)
 Stop batch compress. More...
 
int32_t grk_plugin_internal_decode_callback (PluginDecodeCallbackInfo *info)
 
int32_t GRK_CALLCONV grk_plugin_decompress (grk_decompress_parameters *decompress_parameters, grk_plugin_decompress_callback callback)
 Decompress with plugin. More...
 
int32_t GRK_CALLCONV grk_plugin_init_batch_decompress (const char *input_dir, const char *output_dir, grk_decompress_parameters *decompress_parameters, grk_plugin_decompress_callback callback)
 Initialize batch decompress. More...
 
int32_t GRK_CALLCONV grk_plugin_batch_decompress (void)
 Batch decompress. More...
 
void GRK_CALLCONV grk_plugin_stop_batch_decompress (void)
 Stop batch decompress. More...
 

Variables

static bool is_plugin_initialized = false
 
static const char * plugin_get_debug_state_method_name = "plugin_get_debug_state"
 
static const char * plugin_init_method_name = "plugin_init"
 
static const char * plugin_encode_method_name = "plugin_encode"
 
static const char * plugin_batch_encode_method_name = "plugin_batch_encode"
 
static const char * plugin_stop_batch_encode_method_name
 
static const char * plugin_is_batch_complete_method_name
 
static const char * plugin_decode_method_name = "plugin_decompress"
 
static const char * plugin_init_batch_decode_method_name
 
static const char * plugin_batch_decode_method_name = "plugin_batch_decompress"
 
static const char * plugin_stop_batch_decode_method_name
 
bool pluginLoaded = false
 
GRK_PLUGIN_COMPRESS_USER_CALLBACK userEncodeCallback = 0
 
PLUGIN_IS_BATCH_COMPLETE funcPluginIsBatchComplete = nullptr
 
grk_plugin_decompress_callback decodeCallback = 0
 

Function Documentation

◆ get_path_separator()

static const char* get_path_separator ( )
static

Referenced by grk_plugin_load().

◆ grk_compress()

bool GRK_CALLCONV grk_compress ( grk_codec  codec)

Encode an image into a JPEG 2000 code stream.

Parameters
codeccompressor handle
Returns
Returns true if successful, returns false otherwise

References grk_compress_with_plugin().

◆ grk_compress_tile()

bool GRK_CALLCONV grk_compress_tile ( grk_codec  codec,
uint16_t  tile_index,
uint8_t *  data,
uint64_t  data_size 
)

Compress uncompressed data stored in a buffer.

This method should be called right after grk_start_compress, and before grk_end_compress.

Parameters
codecJPEG 2000 code stream
tile_indexthe index of the tile to write. At the moment, the tiles must be written from 0 to n-1 in sequence.
datapointer to the data to write. Data is arranged in planar sequence, data_comp0, data_comp1 etc, The data should NOT BE INTERLEAVED.
data_sizethis value is used to ensure the data being written is correct. The size must be equal to the sum for each component of tile_width * tile_height * component_size. component_size can be 1 or 2 bytes, depending on the precision of the given component.
Returns
true if the data could be written.

◆ grk_compress_with_plugin()

bool GRK_CALLCONV grk_compress_with_plugin ( grk_codec  codec,
grk_plugin_tile tile 
)

Encode an image into a JPEG 2000 code stream using plugin.

Parameters
codeccompressor handle
tileplugin tile
Returns
Returns true if successful, returns false otherwise

Referenced by grk_compress().

◆ grk_create_compress()

grk_codec GRK_CALLCONV grk_create_compress ( GRK_CODEC_FORMAT  format,
grk_stream stream 
)

Creates a J2K/JP2 compression structure.

Parameters
formatCoder to select
streamthe JPEG 2000 stream.
Returns
Returns a handle to a compressor if successful, returns nullptr otherwise

References grk::grk_calloc(), GRK_CODEC_J2K, GRK_CODEC_JP2, GRK_CODEC_UNKNOWN, and grk::grk_free().

◆ grk_create_decompress()

grk_codec GRK_CALLCONV grk_create_decompress ( GRK_CODEC_FORMAT  format,
grk_stream stream 
)

Create J2K/JP2 decompression structure.

Parameters
formatJPEG 2000 format
streamJPEG 2000 stream.
Returns
a handle to a decompressor if successful, otherwise nullptr

References grk::grk_calloc(), GRK_CODEC_J2K, GRK_CODEC_JP2, GRK_CODEC_UNKNOWN, and grk::grk_free().

◆ grk_decompress()

bool GRK_CALLCONV grk_decompress ( grk_codec  p_decompressor,
grk_plugin_tile tile,
grk_image image 
)

Decompress image from a JPEG 2000 code stream.

Parameters
p_decompressordecompressor handle
tiletile struct from plugin
imagethe decompressed image
Returns
true if success, otherwise false

◆ grk_decompress_tile()

bool GRK_CALLCONV grk_decompress_tile ( grk_codec  codec,
grk_image image,
uint16_t  tile_index 
)

Decompress a specific tile.

Parameters
codecJPEG 2000 code stream
imageoutput image
tile_indexindex of the tile to be decompressed
Returns
true if success, otherwise false

◆ grk_deinitialize()

GRK_API void GRK_CALLCONV grk_deinitialize ( )

De-initialize library.

References grk_plugin_cleanup(), and ThreadPool::release().

Referenced by main().

◆ grk_destroy_codec()

void GRK_CALLCONV grk_destroy_codec ( grk_codec  codec)

Destroy codec.

Parameters
codecJPEG 2000 code stream

References grk::grk_free().

◆ grk_destroy_cstr_index()

void GRK_CALLCONV grk_destroy_cstr_index ( grk_codestream_index **  p_cstr_index)

Destroy code stream index.

Parameters
p_cstr_indexcode stream index

References grk::j2k_destroy_cstr_index().

◆ grk_destroy_cstr_info()

void GRK_CALLCONV grk_destroy_cstr_info ( grk_codestream_info_v2 **  cstr_info)

Destroy Codestream information after compression or decompression.

Parameters
cstr_infoCodestream information structure

References grk::grk_free().

Referenced by grk::j2k_get_cstr_info().

◆ grk_dump_codec()

void GRK_CALLCONV grk_dump_codec ( grk_codec  codec,
uint32_t  info_flag,
FILE *  output_stream 
)

Dump codec information to file.

Parameters
codecJPEG 2000 code stream.
info_flagtype of information dump.
output_streamoutput stream where dump the information get from the codec.

◆ grk_end_compress()

bool GRK_CALLCONV grk_end_compress ( grk_codec  codec)

End to compress the current image.

Parameters
codecCompressor handle

◆ grk_end_decompress()

bool GRK_CALLCONV grk_end_decompress ( grk_codec  codec)

End decompression.

Parameters
codecJPEG 2000 code stream

◆ grk_free_file()

static void grk_free_file ( void *  p_user_data)
static

◆ grk_get_cstr_index()

grk_codestream_index* GRK_CALLCONV grk_get_cstr_index ( grk_codec  codec)

Get the code stream index from the codec.

Parameters
codecJPEG 2000 code stream.
Returns
pointer to a code stream index structure.

◆ grk_get_cstr_info()

grk_codestream_info_v2* GRK_CALLCONV grk_get_cstr_info ( grk_codec  codec)

Get code stream information from codec.

Parameters
codecJPEG 2000 code stream
Returns
pointer to a code stream information structure.

◆ grk_get_data_length_from_file()

static uint64_t grk_get_data_length_from_file ( FILE *  p_file)
static

References GROK_FSEEK, and GROK_FTELL.

Referenced by grk_stream_create_file_stream().

◆ grk_image_all_components_data_free()

void GRK_CALLCONV grk_image_all_components_data_free ( grk_image image)

Deallocate all component data for an image.

Parameters
imageimage

References _grk_image::comps, grk_image_single_component_data_free(), and _grk_image::numcomps.

Referenced by grk::grk_copy_image_header(), and grk_image_destroy().

◆ grk_image_create()

grk_image* GRK_CALLCONV grk_image_create ( uint16_t  numcmpts,
grk_image_cmptparm cmptparms,
GRK_COLOR_SPACE  clrspc,
bool  allocData 
)

◆ grk_image_destroy()

void GRK_CALLCONV grk_image_destroy ( grk_image image)

◆ grk_image_single_component_data_free()

void GRK_CALLCONV grk_image_single_component_data_free ( grk_image_comp image)

◆ grk_init_compress()

bool GRK_CALLCONV grk_init_compress ( grk_codec  codec,
grk_cparameters parameters,
grk_image image 
)

Set up the compressor parameters using the current image and user parameters.

Parameters
codecJPEG 2000 code stream
parameterscompression parameters
imageinput image

◆ grk_init_decompress()

bool GRK_CALLCONV grk_init_decompress ( grk_codec  codec,
grk_dparameters parameters 
)

Set up the decompressor with decompress parameters.

Parameters
codecdecompressor handler
parametersdecompression parameters
Returns
true if the decompressor is correctly set

◆ grk_initialize()

bool GRK_CALLCONV grk_initialize ( const char *  plugin_path,
uint32_t  numthreads 
)

Initialize library.

Parameters
plugin_pathpath to plugin
numthreadsnumber of threads to use for compress/decompress

References ojph::local::decode_vlc_init_tables(), ojph::local::encode_uvlc_init_tables(), ojph::local::encode_vlc_init_tables(), grk_plugin_load(), ojph::info, ThreadPool::instance(), and is_plugin_initialized.

Referenced by main().

◆ grk_plugin_batch_compress()

int32_t GRK_CALLCONV grk_plugin_batch_compress ( const char *  input_dir,
const char *  output_dir,
grk_cparameters compress_parameters,
GRK_PLUGIN_COMPRESS_USER_CALLBACK  callback 
)

Batch compress with plugin.

Parameters
input_dirdirectory holding input images
output_dirdirectory holding compressed output images
compress_parameterscompress parameters
callbackcallback
Returns
0 if successful

References grk_plugin_internal_encode_callback(), grk::minpf_get_plugin_manager(), grk::minpf_get_symbol(), plugin_batch_encode_method_name, pluginLoaded, and userEncodeCallback.

◆ grk_plugin_batch_decompress()

int32_t GRK_CALLCONV grk_plugin_batch_decompress ( void  )

◆ grk_plugin_cleanup()

void GRK_CALLCONV grk_plugin_cleanup ( void  )

Release plugin resources.

References grk::minpf_cleanup_plugin_manager(), and pluginLoaded.

Referenced by grk_deinitialize().

◆ grk_plugin_compress()

int32_t GRK_CALLCONV grk_plugin_compress ( grk_cparameters compress_parameters,
GRK_PLUGIN_COMPRESS_USER_CALLBACK  callback 
)

Compress with plugin.

Parameters
compress_parameterscompress parameters
callbackcallback

References grk_plugin_internal_encode_callback(), grk::minpf_get_plugin_manager(), grk::minpf_get_symbol(), plugin_encode_method_name, pluginLoaded, and userEncodeCallback.

◆ grk_plugin_decompress()

int32_t GRK_CALLCONV grk_plugin_decompress ( grk_decompress_parameters decompress_parameters,
grk_plugin_decompress_callback  callback 
)

Decompress with plugin.

Parameters
decompress_parametersdecompress parameters
callbackcallback

References decodeCallback, grk_plugin_internal_decode_callback(), grk::minpf_get_plugin_manager(), grk::minpf_get_symbol(), plugin_decode_method_name, and pluginLoaded.

◆ grk_plugin_get_debug_state()

uint32_t GRK_CALLCONV grk_plugin_get_debug_state ( )

◆ grk_plugin_init()

GRK_API bool GRK_CALLCONV grk_plugin_init ( grk_plugin_init_info  initInfo)

◆ grk_plugin_init_batch_decompress()

int32_t GRK_CALLCONV grk_plugin_init_batch_decompress ( const char *  input_dir,
const char *  output_dir,
grk_decompress_parameters decompress_parameters,
grk_plugin_decompress_callback  callback 
)

Initialize batch decompress.

Parameters
input_dirinput directory holding compressed images
output_diroutput directory holding decompressed images
decompress_parametersdecompress parameters
callbackcallback
Returns
0 if successful

References decodeCallback, grk_plugin_internal_decode_callback(), grk::minpf_get_plugin_manager(), grk::minpf_get_symbol(), plugin_init_batch_decode_method_name, and pluginLoaded.

◆ grk_plugin_internal_decode_callback()

int32_t grk_plugin_internal_decode_callback ( PluginDecodeCallbackInfo info)

◆ grk_plugin_internal_encode_callback()

void grk_plugin_internal_encode_callback ( plugin_encode_user_callback_info info)

◆ grk_plugin_is_batch_complete()

GRK_API bool GRK_CALLCONV grk_plugin_is_batch_complete ( void  )

◆ grk_plugin_load()

bool GRK_CALLCONV grk_plugin_load ( grk_plugin_load_info  info)

◆ grk_plugin_stop_batch_compress()

void GRK_CALLCONV grk_plugin_stop_batch_compress ( void  )

◆ grk_plugin_stop_batch_decompress()

void GRK_CALLCONV grk_plugin_stop_batch_decompress ( void  )

◆ grk_read_from_file()

static size_t grk_read_from_file ( void *  p_buffer,
size_t  nb_bytes,
FILE *  p_file 
)
static

◆ grk_read_header()

bool GRK_CALLCONV grk_read_header ( grk_codec  codec,
grk_header_info header_info,
grk_image **  image 
)

Decompress JPEG 2000 header.

Parameters
codecJPEG 2000 code stream to read.
header_infoinformation read from JPEG 2000 header.
imagethe image structure initialized with the characteristics of encoded image.
Returns
true if the main header of the code stream and the JP2 header is correctly read.

◆ grk_seek_in_file()

static bool grk_seek_in_file ( int64_t  nb_bytes,
FILE *  p_user_data 
)
static

References GROK_FSEEK.

Referenced by grk_stream_create_file_stream().

◆ grk_set_decompress_window()

bool GRK_CALLCONV grk_set_decompress_window ( grk_codec  codec,
grk_image image,
uint32_t  start_x,
uint32_t  start_y,
uint32_t  end_x,
uint32_t  end_y 
)

Set the given area to be decompressed.

This function should be called right after grk_read_header is called, and before any tile header is read.

Parameters
codecJPEG 2000 code stream.
imageimage created by grk_read_header
start_xleft position of the rectangle to decompress (in image coordinates).
end_xthe right position of the rectangle to decompress (in image coordinates).
start_yup position of the rectangle to decompress (in image coordinates).
end_ybottom position of the rectangle to decompress (in image coordinates).
Returns
true if the area could be set.

◆ grk_set_default_compress_params()

void GRK_CALLCONV grk_set_default_compress_params ( grk_cparameters parameters)

Set compressing parameters to default values, that means :

Lossless Single tile Size of precinct : 2^15 x 2^15 (i.e. single precinct) Size of code block : 64 x 64 Number of resolutions: 6 No SOP marker in the code stream No EPH marker in the code stream No sub-sampling in x or y direction No mode switch activated Progression order: LRCP No index file No ROI upshifted Image origin lies at (0,0) Tile origin lies at (0,0) Reversible DWT 5-3 transform

Parameters
parametersCompression parameters

References _grk_cparameters::cblockh_init, _grk_cparameters::cblockw_init, _grk_cparameters::cod_format, _grk_cparameters::cp_disto_alloc, _grk_cparameters::cp_fixed_quality, _grk_cparameters::decod_format, _grk_cparameters::deviceId, grk::GRK_COMP_PARAM_DEFAULT_CBLOCKH, grk::GRK_COMP_PARAM_DEFAULT_CBLOCKW, grk::GRK_COMP_PARAM_DEFAULT_NUMRESOLUTION, grk::GRK_COMP_PARAM_DEFAULT_PROG_ORDER, GRK_PROFILE_NONE, GRK_UNK_FMT, ThreadPool::hardware_concurrency(), _grk_cparameters::max_comp_size, _grk_cparameters::numresolution, _grk_cparameters::numThreads, _grk_cparameters::prog_order, _grk_cparameters::repeats, _grk_cparameters::roi_compno, _grk_cparameters::rsiz, _grk_cparameters::subsampling_dx, _grk_cparameters::subsampling_dy, _grk_cparameters::tcp_numlayers, _grk_cparameters::tcp_rates, _grk_cparameters::tp_on, _grk_cparameters::writePLT, and _grk_cparameters::writeTLM.

◆ grk_set_default_decompress_params()

void GRK_CALLCONV grk_set_default_decompress_params ( grk_dparameters parameters)

Initialize decompress parameters with default values.

Parameters
parametersdecompression parameters

◆ grk_set_error_handler()

bool GRK_CALLCONV grk_set_error_handler ( grk_msg_callback  p_callback,
void *  user_data 
)

Set error handler.

Parameters
p_callbackthe callback function which will be used
user_dataclient object where will be returned the message

References grk::logger::error_handler, grk::logger::m_error_data, and grk::logger::m_logger.

◆ grk_set_info_handler()

bool GRK_CALLCONV grk_set_info_handler ( grk_msg_callback  p_callback,
void *  user_data 
)

Set info handler.

Parameters
p_callbackthe callback function which will be used
user_dataclient object where will be returned the message

References grk::logger::info_handler, grk::logger::m_info_data, and grk::logger::m_logger.

◆ grk_set_MCT()

bool GRK_CALLCONV grk_set_MCT ( grk_cparameters parameters,
float *  pEncodingMatrix,
int32_t *  p_dc_shift,
uint32_t  pNbComp 
)

Set the MCT matrix to use.

Parameters
parametersthe parameters to change.
pEncodingMatrixthe compressing matrix.
p_dc_shiftthe dc shift coefficients to use.
pNbCompthe number of components of the image.
Returns
true if the parameters could be set.

References GRK_EXTENSION_MCT, GRK_IS_PART2, grk::grk_malloc(), GRK_PROFILE_PART2, _grk_cparameters::irreversible, _grk_cparameters::mct_data, _grk_cparameters::rsiz, and _grk_cparameters::tcp_mct.

◆ grk_set_warning_handler()

bool GRK_CALLCONV grk_set_warning_handler ( grk_msg_callback  p_callback,
void *  user_data 
)

Set warning handler.

Parameters
p_callbackthe callback function which will be used
user_dataclient object where will be returned the message

References grk::logger::m_logger, grk::logger::m_warning_data, and grk::logger::warning_handler.

◆ grk_start_compress()

bool GRK_CALLCONV grk_start_compress ( grk_codec  codec)

Start compressing current image.

Parameters
codecCompressor handle

◆ grk_stream_create_file_stream()

grk_stream* GRK_CALLCONV grk_stream_create_file_stream ( const char *  fname,
size_t  buffer_size,
bool  is_read_stream 
)

Create stream from a file identified with its filename with a specific buffer size.

Parameters
fnamethe filename of the file to stream
buffer_sizesize of the chunk used to stream
is_read_streamwhether the stream is a read stream (true) or not (false)

References grk_free_file(), grk_get_data_length_from_file(), grk_read_from_file(), grk_seek_in_file(), grk_stream_create(), grk_stream_set_read_function(), grk_stream_set_seek_function(), grk_stream_set_user_data(), grk_stream_set_user_data_length(), grk_stream_set_write_function(), and grk_write_to_file().

◆ grk_stream_create_mapped_file_stream()

grk_stream* GRK_CALLCONV grk_stream_create_mapped_file_stream ( const char *  fname,
bool  read_stream 
)

Create mapped file stream.

Parameters
fnamefile name
read_streamtrue if this is a read stream, otherwise false

References grk::create_mapped_file_read_stream(), and grk::create_mapped_file_write_stream().

◆ grk_stream_create_mem_stream()

grk_stream* GRK_CALLCONV grk_stream_create_mem_stream ( uint8_t *  buf,
size_t  buffer_len,
bool  ownsBuffer,
bool  is_read_stream 
)

Create stream from buffer.

Parameters
bufbuffer
buffer_lenlength of buffer
ownsBufferif true, library will delete[] buffer. Otherwise, it is the caller's responsibility to delete the buffer
is_read_streamwhether the stream is a read stream (true) or not (false)

References grk::create_mem_stream().

◆ grk_stream_get_write_mem_stream_length()

GRK_API size_t GRK_CALLCONV grk_stream_get_write_mem_stream_length ( grk_stream stream)

Get length of memory stream.

Parameters
streammemory stream

References grk::get_mem_stream_offset().

◆ grk_version()

const char* GRK_CALLCONV grk_version ( void  )

library version

Referenced by grk::CodeStream::init_compress(), and main().

◆ grk_write_to_file()

static size_t grk_write_to_file ( void *  p_buffer,
size_t  nb_bytes,
FILE *  p_file 
)
static

Variable Documentation

◆ decodeCallback

grk_plugin_decompress_callback decodeCallback = 0

◆ funcPluginIsBatchComplete

PLUGIN_IS_BATCH_COMPLETE funcPluginIsBatchComplete = nullptr

◆ is_plugin_initialized

bool is_plugin_initialized = false
static

Referenced by grk_initialize().

◆ plugin_batch_decode_method_name

const char* plugin_batch_decode_method_name = "plugin_batch_decompress"
static

◆ plugin_batch_encode_method_name

const char* plugin_batch_encode_method_name = "plugin_batch_encode"
static

◆ plugin_decode_method_name

const char* plugin_decode_method_name = "plugin_decompress"
static

Referenced by grk_plugin_decompress().

◆ plugin_encode_method_name

const char* plugin_encode_method_name = "plugin_encode"
static

Referenced by grk_plugin_compress().

◆ plugin_get_debug_state_method_name

const char* plugin_get_debug_state_method_name = "plugin_get_debug_state"
static

◆ plugin_init_batch_decode_method_name

const char* plugin_init_batch_decode_method_name
static
Initial value:
=
"plugin_init_batch_decompress"

Referenced by grk_plugin_init_batch_decompress().

◆ plugin_init_method_name

const char* plugin_init_method_name = "plugin_init"
static

Referenced by grk_plugin_init().

◆ plugin_is_batch_complete_method_name

const char* plugin_is_batch_complete_method_name
static
Initial value:
=
"plugin_is_batch_complete"

Referenced by grk_plugin_is_batch_complete().

◆ plugin_stop_batch_decode_method_name

const char* plugin_stop_batch_decode_method_name
static
Initial value:
=
"plugin_stop_batch_decompress"

Referenced by grk_plugin_stop_batch_decompress().

◆ plugin_stop_batch_encode_method_name

const char* plugin_stop_batch_encode_method_name
static
Initial value:
=
"plugin_stop_batch_encode"

Referenced by grk_plugin_stop_batch_compress().

◆ pluginLoaded

bool pluginLoaded = false

◆ userEncodeCallback

GRK_PLUGIN_COMPRESS_USER_CALLBACK userEncodeCallback = 0