plugin_interface.h
Go to the documentation of this file.
#include <plugin/minpf_plugin.h>
#include "grok.h"
#include <cstring>
#include <string>
#pragma once
namespace grk
{
// Debug Interface
#define DEBUG_CONTEXT_CACHE_SIZE 3
// debugging variables
struct grk_plugin_debug_mqc
{
uint32_t debug_state;
uint8_t context_number;
uint32_t* contextStream;
uint32_t contextStreamByteCount;
uint8_t contextCache[DEBUG_CONTEXT_CACHE_SIZE];
uint32_t contextCacheCount;
uint8_t orientation;
uint16_t compno;
uint32_t level;
};
typedef uint32_t (*PLUGIN_GET_DEBUG_STATE)(void);
typedef void (*PLUGIN_DEBUG_MQC_NEXT_CXD)(grk_plugin_debug_mqc* mqc, uint32_t d);
typedef void (*PLUGIN_DEBUG_MQC_NEXT_PLANE)(grk_plugin_debug_mqc* mqc);
// compressor interface
struct plugin_encode_user_callback_info
{
const char* input_file_name;
bool outputFileNameIsRelative;
const char* output_file_name;
grk_cparameters* compressor_parameters;
grk_image* image;
grk_plugin_tile* tile;
int32_t error_code;
};
typedef void (*PLUGIN_ENCODE_USER_CALLBACK)(plugin_encode_user_callback_info* info);
typedef bool (*PLUGIN_INIT)(grk_plugin_init_info initInfo);
typedef int32_t (*PLUGIN_ENCODE)(grk_cparameters* encoding_parameters,
PLUGIN_ENCODE_USER_CALLBACK callback);
typedef int32_t (*PLUGIN_BATCH_ENCODE)(const char* input_dir, const char* output_dir,
grk_cparameters* encoding_parameters,
PLUGIN_ENCODE_USER_CALLBACK userCallback);
typedef void (*PLUGIN_STOP_BATCH_ENCODE)(void);
typedef bool (*PLUGIN_IS_BATCH_COMPLETE)(void);
// decompressor interface
struct PluginDecodeCallbackInfo
{
PluginDecodeCallbackInfo() : PluginDecodeCallbackInfo("", "", nullptr, GRK_CODEC_UNK, 0) {}
PluginDecodeCallbackInfo(std::string input, std::string output,
grk_decompress_parameters* decompressorParameters,
GRK_CODEC_FORMAT format, uint32_t flags)
: deviceId(0), init_decompressors_func(nullptr), inputFile(input), outputFile(output),
decod_format(format), cod_format(GRK_FMT_UNK), codec(nullptr),
decompressor_parameters(decompressorParameters), image(nullptr), plugin_owns_image(false),
tile(nullptr), error_code(0), decompress_flags(flags), user_data(nullptr)
{
memset(&header_info, 0, sizeof(header_info));
}
size_t deviceId;
GROK_INIT_DECOMPRESSORS init_decompressors_func;
std::string inputFile;
std::string outputFile;
// input file format 0: J2K, 1: JP2
GRK_CODEC_FORMAT decod_format;
// output file format 0: PGX, 1: PxM, 2: BMP etc
GRK_SUPPORTED_FILE_FMT cod_format;
grk_codec* codec;
grk_decompress_parameters* decompressor_parameters;
grk_header_info header_info;
grk_image* image;
bool plugin_owns_image;
grk_plugin_tile* tile;
int32_t error_code;
uint32_t decompress_flags;
void* user_data;
};
typedef int32_t (*PLUGIN_DECODE_USER_CALLBACK)(PluginDecodeCallbackInfo* info);
typedef int32_t (*PLUGIN_DECODE)(grk_decompress_parameters* decoding_parameters,
PLUGIN_DECODE_USER_CALLBACK userCallback);
typedef int32_t (*PLUGIN_INIT_BATCH_DECODE)(const char* input_dir, const char* output_dir,
grk_decompress_parameters* decoding_parameters,
PLUGIN_DECODE_USER_CALLBACK userCallback);
typedef int32_t (*PLUGIN_BATCH_DECODE)(void);
typedef void (*PLUGIN_STOP_BATCH_DECODE)(void);
} // namespace grk
grok.h
GRK_FMT_UNK
@ GRK_FMT_UNK
Definition grok.h:209
GRK_CODEC_FORMAT
enum _GRK_CODEC_FORMAT GRK_CODEC_FORMAT
Supported JPEG 2000 formats.
GRK_SUPPORTED_FILE_FMT
enum _GRK_SUPPORTED_FILE_FMT GRK_SUPPORTED_FILE_FMT
All supported file formats.
GROK_INIT_DECOMPRESSORS
int(* GROK_INIT_DECOMPRESSORS)(grk_header_info *header_info, grk_image *image)
Definition grok.h:1454
GRK_CODEC_UNK
@ GRK_CODEC_UNK
place-holder
Definition grok.h:512
minpf_plugin.h
grk
Copyright (C) 2016-2023 Grok Image Compression Inc.
Definition ICacheable.h:20
grk::grk_read
void grk_read(const uint8_t *buffer, TYPE *value, uint32_t numBytes)
Definition BufferedStream.h:239
grk::PLUGIN_ENCODE_USER_CALLBACK
void(* PLUGIN_ENCODE_USER_CALLBACK)(plugin_encode_user_callback_info *info)
Definition plugin_interface.h:68
grk::PLUGIN_DECODE
int32_t(* PLUGIN_DECODE)(grk_decompress_parameters *decoding_parameters, PLUGIN_DECODE_USER_CALLBACK userCallback)
Definition plugin_interface.h:122
grk::PLUGIN_STOP_BATCH_DECODE
void(* PLUGIN_STOP_BATCH_DECODE)(void)
Definition plugin_interface.h:131
grk::PLUGIN_INIT
bool(* PLUGIN_INIT)(grk_plugin_init_info initInfo)
Definition plugin_interface.h:70
grk::PLUGIN_STOP_BATCH_ENCODE
void(* PLUGIN_STOP_BATCH_ENCODE)(void)
Definition plugin_interface.h:79
grk::PLUGIN_GET_DEBUG_STATE
uint32_t(* PLUGIN_GET_DEBUG_STATE)(void)
Definition plugin_interface.h:47
grk::PLUGIN_DEBUG_MQC_NEXT_CXD
void(* PLUGIN_DEBUG_MQC_NEXT_CXD)(grk_plugin_debug_mqc *mqc, uint32_t d)
Definition plugin_interface.h:49
grk::PLUGIN_BATCH_ENCODE
int32_t(* PLUGIN_BATCH_ENCODE)(const char *input_dir, const char *output_dir, grk_cparameters *encoding_parameters, PLUGIN_ENCODE_USER_CALLBACK userCallback)
Definition plugin_interface.h:75
grk::PLUGIN_DEBUG_MQC_NEXT_PLANE
void(* PLUGIN_DEBUG_MQC_NEXT_PLANE)(grk_plugin_debug_mqc *mqc)
Definition plugin_interface.h:51
grk::PLUGIN_IS_BATCH_COMPLETE
bool(* PLUGIN_IS_BATCH_COMPLETE)(void)
Definition plugin_interface.h:81
grk::PLUGIN_INIT_BATCH_DECODE
int32_t(* PLUGIN_INIT_BATCH_DECODE)(const char *input_dir, const char *output_dir, grk_decompress_parameters *decoding_parameters, PLUGIN_DECODE_USER_CALLBACK userCallback)
Definition plugin_interface.h:125
grk::PLUGIN_ENCODE
int32_t(* PLUGIN_ENCODE)(grk_cparameters *encoding_parameters, PLUGIN_ENCODE_USER_CALLBACK callback)
Definition plugin_interface.h:72
grk::PLUGIN_BATCH_DECODE
int32_t(* PLUGIN_BATCH_DECODE)(void)
Definition plugin_interface.h:129
grk::PLUGIN_DECODE_USER_CALLBACK
int32_t(* PLUGIN_DECODE_USER_CALLBACK)(PluginDecodeCallbackInfo *info)
Definition plugin_interface.h:120
DEBUG_CONTEXT_CACHE_SIZE
#define DEBUG_CONTEXT_CACHE_SIZE
Definition plugin_interface.h:31
_grk_cparameters
Compress parameters.
Definition grok.h:912
_grk_decompress_params
Decompression parameters.
Definition grok.h:521
_grk_header_info
Header info.
Definition grok.h:361
_grk_image
Definition grok.h:613
_grk_object
Grok ref-counted object.
Definition grok.h:126
_grk_plugin_init_info
Definition grok.h:1390
_grk_plugin_tile
Plugin tile.
Definition grok.h:739
grk::PluginDecodeCallbackInfo
Definition plugin_interface.h:88
grk::PluginDecodeCallbackInfo::image
grk_image * image
Definition plugin_interface.h:112
grk::PluginDecodeCallbackInfo::tile
grk_plugin_tile * tile
Definition plugin_interface.h:114
grk::PluginDecodeCallbackInfo::inputFile
std::string inputFile
Definition plugin_interface.h:103
grk::PluginDecodeCallbackInfo::init_decompressors_func
GROK_INIT_DECOMPRESSORS init_decompressors_func
Definition plugin_interface.h:102
grk::PluginDecodeCallbackInfo::header_info
grk_header_info header_info
Definition plugin_interface.h:111
grk::PluginDecodeCallbackInfo::decompress_flags
uint32_t decompress_flags
Definition plugin_interface.h:116
grk::PluginDecodeCallbackInfo::user_data
void * user_data
Definition plugin_interface.h:117
grk::PluginDecodeCallbackInfo::codec
grk_codec * codec
Definition plugin_interface.h:109
grk::PluginDecodeCallbackInfo::outputFile
std::string outputFile
Definition plugin_interface.h:104
grk::PluginDecodeCallbackInfo::cod_format
GRK_SUPPORTED_FILE_FMT cod_format
Definition plugin_interface.h:108
grk::PluginDecodeCallbackInfo::error_code
int32_t error_code
Definition plugin_interface.h:115
grk::PluginDecodeCallbackInfo::deviceId
size_t deviceId
Definition plugin_interface.h:101
grk::PluginDecodeCallbackInfo::decompressor_parameters
grk_decompress_parameters * decompressor_parameters
Definition plugin_interface.h:110
grk::PluginDecodeCallbackInfo::decod_format
GRK_CODEC_FORMAT decod_format
Definition plugin_interface.h:106
grk::PluginDecodeCallbackInfo::PluginDecodeCallbackInfo
PluginDecodeCallbackInfo()
Definition plugin_interface.h:89
grk::PluginDecodeCallbackInfo::PluginDecodeCallbackInfo
PluginDecodeCallbackInfo(std::string input, std::string output, grk_decompress_parameters *decompressorParameters, GRK_CODEC_FORMAT format, uint32_t flags)
Definition plugin_interface.h:90
grk::PluginDecodeCallbackInfo::plugin_owns_image
bool plugin_owns_image
Definition plugin_interface.h:113
grk::grk_plugin_debug_mqc
Definition plugin_interface.h:35
grk::grk_plugin_debug_mqc::debug_state
uint32_t debug_state
Definition plugin_interface.h:36
grk::grk_plugin_debug_mqc::contextStream
uint32_t * contextStream
Definition plugin_interface.h:38
grk::grk_plugin_debug_mqc::contextCache
uint8_t contextCache[DEBUG_CONTEXT_CACHE_SIZE]
Definition plugin_interface.h:40
grk::grk_plugin_debug_mqc::context_number
uint8_t context_number
Definition plugin_interface.h:37
grk::grk_plugin_debug_mqc::contextCacheCount
uint32_t contextCacheCount
Definition plugin_interface.h:41
grk::grk_plugin_debug_mqc::compno
uint16_t compno
Definition plugin_interface.h:43
grk::grk_plugin_debug_mqc::orientation
uint8_t orientation
Definition plugin_interface.h:42
grk::grk_plugin_debug_mqc::contextStreamByteCount
uint32_t contextStreamByteCount
Definition plugin_interface.h:39
grk::grk_plugin_debug_mqc::level
uint32_t level
Definition plugin_interface.h:44
grk::plugin_encode_user_callback_info
Definition plugin_interface.h:58
grk::plugin_encode_user_callback_info::tile
grk_plugin_tile * tile
Definition plugin_interface.h:64
grk::plugin_encode_user_callback_info::error_code
int32_t error_code
Definition plugin_interface.h:65
grk::plugin_encode_user_callback_info::outputFileNameIsRelative
bool outputFileNameIsRelative
Definition plugin_interface.h:60
grk::plugin_encode_user_callback_info::input_file_name
const char * input_file_name
Definition plugin_interface.h:59
grk::plugin_encode_user_callback_info::image
grk_image * image
Definition plugin_interface.h:63
grk::plugin_encode_user_callback_info::output_file_name
const char * output_file_name
Definition plugin_interface.h:61
grk::plugin_encode_user_callback_info::compressor_parameters
grk_cparameters * compressor_parameters
Definition plugin_interface.h:62