grok.h
Go to the documentation of this file.
/*
* Copyright (C) 2016-2023 Grok Image Compression Inc.
*
* This source code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This source code is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
* This source code incorporates work covered by the BSD 2-clause license.
* Please see the LICENSE file in the root directory for details.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include "grk_config.h"
#include <stdint.h>
#include <stdio.h>
#include <stdbool.h>
#include <limits.h>
#ifdef _WIN32
#define GRK_CALLCONV __stdcall
#ifdef GRK_STATIC
#define GRK_API
#else
#ifdef GRK_EXPORTS
#define GRK_API __declspec(dllexport)
#else
#define GRK_API __declspec(dllimport)
#endif
#endif
#else
#define GRK_CALLCONV
#ifdef GRK_STATIC
#define GRK_API __attribute__((visibility("hidden")))
#else
#define GRK_API __attribute__((visibility("default")))
#endif
#endif
typedef enum _GRK_PROG_ORDER
{
GRK_PROG_UNKNOWN = -1,
GRK_LRCP = 0,
GRK_RLCP = 1,
GRK_RPCL = 2,
GRK_PCRL = 3,
GRK_CPRL = 4,
GRK_NUM_PROGRESSION_ORDERS = 5
} GRK_PROG_ORDER;
typedef enum _GRK_COLOR_SPACE
{
GRK_CLRSPC_UNKNOWN = 0,
GRK_CLRSPC_SRGB = 2,
GRK_CLRSPC_GRAY = 3,
GRK_CLRSPC_SYCC = 4,
GRK_CLRSPC_EYCC = 5,
GRK_CLRSPC_CMYK = 6,
GRK_CLRSPC_DEFAULT_CIE = 7,
GRK_CLRSPC_CUSTOM_CIE = 8,
GRK_CLRSPC_ICC = 9
} GRK_COLOR_SPACE;
/* JPEG 2000 standard colour space enumeration */
typedef enum _GRK_ENUM_COLOUR_SPACE
{
GRK_ENUM_CLRSPC_UNKNOWN = 0xFFFFFFFF,
GRK_ENUM_CLRSPC_BILEVEL1 = 0,
GRK_ENUM_CLRSPC_YCBCR1 = 1,
GRK_ENUM_CLRSPC_YCBCR2 = 3,
GRK_ENUM_CLRSPC_YCBCR3 = 4,
GRK_ENUM_CLRSPC_PHOTO_YCC = 9, /* Kodak PhotoYCC */
GRK_ENUM_CLRSPC_CMY = 11, /* cyan, magenta, yellow */
GRK_ENUM_CLRSPC_CMYK = 12, /* cyan, magenta, yellow, black */
GRK_ENUM_CLRSPC_YCCK = 13,
GRK_ENUM_CLRSPC_CIE = 14,
GRK_ENUM_CLRSPC_BILEVEL2 = 15,
GRK_ENUM_CLRSPC_SRGB = 16,
GRK_ENUM_CLRSPC_GRAY = 17,
GRK_ENUM_CLRSPC_SYCC = 18, /* standard YCC */
GRK_ENUM_CLRSPC_CIEJAB = 19,
GRK_ENUM_CLRSPC_ESRGB = 20,
GRK_ENUM_CLRSPC_ROMMRGB = 21, /* Reference Output Medium Metric RGB */
GRK_ENUM_CLRSPC_YPBPR60 = 22,
GRK_ENUM_CLRSPC_YPBPR50 = 23,
GRK_ENUM_CLRSPC_EYCC = 24, /* extended YCC */
} GRK_ENUM_COLOUR_SPACE;
#define GRK_NUM_COMMENTS_SUPPORTED 256
#define GRK_NUM_ASOC_BOXES_SUPPORTED 256
#define GRK_MAX_COMMENT_LENGTH (UINT16_MAX - 2)
typedef void (*grk_msg_callback)(const char* msg, void* client_data);
typedef struct _grk_object
{
void* wrapper;
} grk_object;
typedef struct _grk_progression
{
GRK_PROG_ORDER progression;
char progressionString[5];
GRK_PROG_ORDER specifiedCompressionPocProg;
uint32_t tileno;
uint32_t tx0;
uint32_t ty0;
uint32_t tx1;
uint32_t ty1;
uint16_t compS;
uint16_t compE;
uint8_t resS;
uint8_t resE;
uint64_t precS;
uint64_t precE;
uint16_t layS;
uint16_t layE;
uint16_t tpCompS;
uint16_t tpCompE;
uint8_t tpResS;
uint8_t tpResE;
uint64_t tpPrecE;
uint16_t tpLayE;
uint32_t tp_txS;
uint32_t tp_txE;
uint32_t tp_tyS;
uint32_t tp_tyE;
uint32_t dx;
uint32_t dy;
uint16_t comp_temp;
uint8_t res_temp;
uint64_t prec_temp;
uint16_t lay_temp;
uint32_t tx0_temp;
uint32_t ty0_temp;
} grk_progression;
typedef struct _grk_raw_comp_cparameters
{
uint8_t dx;
uint8_t dy;
} grk_raw_comp_cparameters;
typedef struct _grk_raw_cparameters
{
uint32_t width;
uint32_t height;
uint16_t numcomps;
uint8_t prec;
bool sgnd;
grk_raw_comp_cparameters* comps;
} grk_raw_cparameters;
typedef enum _GRK_RATE_CONTROL_ALGORITHM
{
GRK_RATE_CONTROL_BISECT,
GRK_RATE_CONTROL_PCRD_OPT
} GRK_RATE_CONTROL_ALGORITHM;
typedef enum _GRK_SUPPORTED_FILE_FMT
{
GRK_FMT_UNK,
GRK_FMT_J2K,
GRK_FMT_JP2,
GRK_FMT_PXM,
GRK_FMT_PGX,
GRK_FMT_PAM,
GRK_FMT_BMP,
GRK_FMT_TIF,
GRK_FMT_RAW, /* MSB / Big Endian */
GRK_FMT_PNG,
GRK_FMT_RAWL, /* LSB / Little Endian */
GRK_FMT_JPG
} GRK_SUPPORTED_FILE_FMT;
#define GRK_PATH_LEN 4096 /* Maximum allowed filename size */
#define GRK_MAX_LAYERS 100 /* Maximum number of quality layers */
/*
* Note: range for number of decomposition levels is 0-32
* So, accordingly, range for number of resolutions is 1-33
*/
#define GRK_J2K_MAX_DECOMP_LVLS \
32 /* Maximum number of decomposition levels allowed by standard \
*/
#define GRK_J2K_MAXRLVLS \
(GRK_J2K_MAX_DECOMP_LVLS + 1) /* Maximum number of resolution levels allowed by standard*/
#define GRK_J2K_MAXBANDS \
(3 * GRK_J2K_MAXRLVLS - 2) /* Maximum number of sub-bands allowed by standard */
typedef struct _grk_component_mapping_comp
{
uint16_t component_index;
uint8_t mapping_type;
uint8_t palette_column;
} grk_component_mapping_comp;
typedef struct _grk_palette_data
{
int32_t* lut;
uint16_t num_entries;
grk_component_mapping_comp* component_mapping;
uint8_t num_channels;
bool* channel_sign;
uint8_t* channel_prec;
} grk_palette_data;
/***
* Channel Definition box structures and enums.
* When no Component mapping box is present, it is still possible to have
* a Channel defintion box, in which case channels are associated with components
* in the obvious way : channel `k` corresponds to component `k`.
* */
/* channel type */
typedef enum _GRK_CHANNEL_TYPE
{
GRK_CHANNEL_TYPE_COLOUR = 0,
GRK_CHANNEL_TYPE_OPACITY = 1,
GRK_CHANNEL_TYPE_PREMULTIPLIED_OPACITY = 2,
GRK_CHANNEL_TYPE_UNSPECIFIED = 65535U
} GRK_CHANNEL_TYPE;
/* channel association */
typedef enum _GRK_CHANNEL_ASSOC
{
GRK_CHANNEL_ASSOC_WHOLE_IMAGE = 0,
GRK_CHANNEL_ASSOC_COLOUR_1 = 1,
GRK_CHANNEL_ASSOC_COLOUR_2 = 2,
GRK_CHANNEL_ASSOC_COLOUR_3 = 3,
GRK_CHANNEL_ASSOC_UNASSOCIATED = 65535U
} GRK_CHANNEL_ASSOC;
typedef struct _grk_channel_description
{
uint16_t channel;
uint16_t typ;
uint16_t asoc;
} grk_channel_description;
typedef struct _grk_channel_definition
{
grk_channel_description* descriptions;
uint16_t num_channel_descriptions;
} grk_channel_definition;
typedef struct _grk_color
{
uint8_t* icc_profile_buf;
uint32_t icc_profile_len;
char* icc_profile_name;
grk_channel_definition* channel_definition;
grk_palette_data* palette;
bool has_colour_specification_box;
} grk_color;
typedef struct _grk_asoc
{
uint32_t level; /* 0 for root level */
const char* label;
uint8_t* xml;
uint32_t xml_len;
} grk_asoc;
typedef enum _grk_precision_mode
{
GRK_PREC_MODE_CLIP,
GRK_PREC_MODE_SCALE
} grk_precision_mode;
typedef struct _grk_precision
{
uint8_t prec;
grk_precision_mode mode;
} grk_precision;
typedef struct _grk_header_info
{
/******************************************
set by client only if decompressing to file
*******************************************/
GRK_SUPPORTED_FILE_FMT decompressFormat;
bool forceRGB;
bool upsample;
grk_precision* precision;
uint32_t numPrecision;
bool splitByComponent;
bool singleTileDecompress;
/****************************************/
/*****************************************
populated by library after reading header
******************************************/
uint32_t cblockw_init;
uint32_t cblockh_init;
bool irreversible;
uint32_t mct;
uint16_t rsiz;
uint32_t numresolutions;
/*********************************************************
coding style can be specified in main header COD segment,
tile header COD segment, and tile component COC segment.
*********************************************************/
/* !!!! assume that coding style does not vary across tile components */
uint8_t csty;
/*******************************************************************
code block style is specified in main header COD segment, and can
be overridden in a tile header. !!! Assume that style does
not vary across tiles !!!
*******************************************************************/
uint8_t cblk_sty;
uint32_t prcw_init[GRK_J2K_MAXRLVLS];
uint32_t prch_init[GRK_J2K_MAXRLVLS];
uint32_t tx0;
uint32_t ty0;
uint32_t t_width;
uint32_t t_height;
uint32_t t_grid_width;
uint32_t t_grid_height;
uint16_t numlayers;
/*************************************
note: xml_data will remain valid
until codec is destroyed
************************************/
uint8_t* xml_data;
size_t xml_data_len;
size_t num_comments;
char* comment[GRK_NUM_COMMENTS_SUPPORTED];
uint16_t comment_len[GRK_NUM_COMMENTS_SUPPORTED];
bool isBinaryComment[GRK_NUM_COMMENTS_SUPPORTED];
grk_asoc asocs[GRK_NUM_ASOC_BOXES_SUPPORTED];
uint32_t num_asocs;
} grk_header_info;
typedef struct _grk_io_buf
{
uint8_t* data_;
size_t offset_;
size_t len_;
size_t allocLen_;
bool pooled_;
uint32_t index_;
} grk_io_buf;
typedef struct _grk_io_init
{
uint32_t maxPooledRequests_;
} grk_io_init;
typedef bool (*grk_io_callback)(uint32_t threadId, grk_io_buf buffer, void* io_user_data);
typedef void (*grk_io_register_reclaim_callback)(grk_io_init io_init,
grk_io_callback reclaim_callback,
void* io_user_data, void* reclaim_user_data);
typedef bool (*grk_io_pixels_callback)(uint32_t threadId, grk_io_buf buffer, void* user_data);
typedef struct _grk_stream_params
{
// file name
const char* file;
// buffer and buffer length
uint8_t* buf;
size_t len;
} grk_stream_params;
typedef enum _GRK_TILE_CACHE_STRATEGY
{
GRK_TILE_CACHE_NONE, /* no tile caching */
GRK_TILE_CACHE_IMAGE /* cache final tile image */
} GRK_TILE_CACHE_STRATEGY;
typedef struct _grk_decompress_core_params
{
uint8_t reduce;
uint16_t max_layers;
GRK_TILE_CACHE_STRATEGY tileCacheStrategy;
uint32_t randomAccessFlags_;
grk_io_pixels_callback io_buffer_callback;
void* io_user_data;
grk_io_register_reclaim_callback io_register_client_callback;
} grk_decompress_core_params;
#define GRK_DECOMPRESS_COMPRESSION_LEVEL_DEFAULT (UINT_MAX)
typedef enum _GRK_CODEC_FORMAT
{
GRK_CODEC_UNK = -1,
GRK_CODEC_J2K = 0,
GRK_CODEC_JP2 = 2
} GRK_CODEC_FORMAT;
typedef struct _grk_decompress_params
{
grk_decompress_core_params core;
char infile[GRK_PATH_LEN];
char outfile[GRK_PATH_LEN];
GRK_CODEC_FORMAT decod_format;
GRK_SUPPORTED_FILE_FMT cod_format;
float dw_x0;
float dw_x1;
float dw_y0;
float dw_y1;
uint16_t tileIndex;
bool singleTileDecompress;
grk_precision* precision;
uint32_t numPrecision;
/* force output colorspace to RGB */
bool force_rgb;
/* upsample components according to their dx/dy values */
bool upsample;
/* split output components to different files */
bool split_pnm;
/* serialize XML metadata to disk */
bool io_xml;
uint32_t compression;
/*****************************************************
compression "quality". Meaning of "quality" depends
on file format we are writing to
*****************************************************/
uint32_t compressionLevel;
bool verbose_;
int32_t deviceId;
uint32_t duration; /* in seconds */
uint32_t kernelBuildOptions;
uint32_t repeats;
uint32_t numThreads;
} grk_decompress_parameters;
typedef struct _grk_image_comp
{
uint32_t x0;
uint32_t y0;
uint32_t w;
uint32_t stride;
uint32_t h;
uint8_t dx;
uint8_t dy;
uint8_t prec;
/* signed */
bool sgnd;
GRK_CHANNEL_TYPE type;
GRK_CHANNEL_ASSOC association;
/* component registration coordinates */
uint16_t Xcrg, Ycrg;
int32_t* data;
} grk_image_comp;
/* Image meta data: colour, IPTC and XMP */
typedef struct _grk_image_meta
{
grk_object obj;
grk_color color;
uint8_t* iptc_buf;
size_t iptc_len;
uint8_t* xmp_buf;
size_t xmp_len;
} grk_image_meta;
typedef struct _grk_image
{
grk_object obj;
uint32_t x0;
uint32_t y0;
uint32_t x1;
uint32_t y1;
uint16_t numcomps;
GRK_COLOR_SPACE color_space;
bool paletteApplied_;
bool channelDefinitionApplied_;
bool has_capture_resolution;
double capture_resolution[2];
bool has_display_resolution;
double display_resolution[2];
GRK_SUPPORTED_FILE_FMT decompressFormat;
bool forceRGB;
bool upsample;
grk_precision* precision;
uint32_t numPrecision;
bool hasMultipleTiles;
bool splitByComponent;
uint16_t decompressNumComps;
uint32_t decompressWidth;
uint32_t decompressHeight;
uint8_t decompressPrec;
GRK_COLOR_SPACE decompressColourSpace;
grk_io_buf interleavedData;
uint32_t rowsPerStrip; // for storage to output format
uint32_t rowsPerTask; // for scheduling
uint64_t packedRowBytes;
grk_image_meta* meta;
grk_image_comp* comps;
} grk_image;
/*************************************************
Structs to pass data between grok and plugin
************************************************/
typedef struct _grk_plugin_pass
{
double distortionDecrease; /* distortion decrease up to and including this pass */
size_t rate; /* rate up to and including this pass */
size_t length; /* stream length for this pass */
} grk_plugin_pass;
typedef struct _grk_plugin_code_block
{
/**************************
debug info
**************************/
uint32_t x0, y0, x1, y1;
unsigned int* contextStream;
/***************************/
uint32_t numPix;
uint8_t* compressedData;
uint32_t compressedDataLength;
uint8_t numBitPlanes;
size_t numPasses;
grk_plugin_pass passes[67];
unsigned int sortedIndex;
} grk_plugin_code_block;
typedef struct _grk_plugin_precinct
{
uint64_t numBlocks;
grk_plugin_code_block** blocks;
} grk_plugin_precinct;
typedef struct _grk_plugin_band
{
uint8_t orientation;
uint64_t numPrecincts;
grk_plugin_precinct** precincts;
float stepsize;
} grk_plugin_band;
typedef struct _grk_plugin_resolution
{
size_t level;
size_t numBands;
grk_plugin_band** band;
} grk_plugin_resolution;
typedef struct grk_plugin_tile_component
{
size_t numResolutions;
grk_plugin_resolution** resolutions;
} grk_plugin_tile_component;
#define GRK_DECODE_HEADER (1 << 0)
#define GRK_DECODE_T2 (1 << 1)
#define GRK_DECODE_T1 (1 << 2)
#define GRK_DECODE_POST_T1 (1 << 3)
#define GRK_PLUGIN_DECODE_CLEAN (1 << 4)
#define GRK_DECODE_ALL \
(GRK_PLUGIN_DECODE_CLEAN | GRK_DECODE_HEADER | GRK_DECODE_T2 | GRK_DECODE_T1 | \
GRK_DECODE_POST_T1)
typedef struct _grk_plugin_tile
{
uint32_t decompress_flags;
size_t numComponents;
grk_plugin_tile_component** tileComponents;
} grk_plugin_tile;
/* opaque codec object */
typedef grk_object grk_codec;
GRK_API const char* GRK_CALLCONV grk_version(void);
GRK_API bool GRK_CALLCONV grk_initialize(const char* pluginPath, uint32_t numthreads);
GRK_API void GRK_CALLCONV grk_deinitialize();
GRK_API grk_object* GRK_CALLCONV grk_object_ref(grk_object* obj);
/*
* Decrement ref count
*
*/
GRK_API void GRK_CALLCONV grk_object_unref(grk_object* obj);
GRK_API void GRK_CALLCONV grk_set_msg_handlers(grk_msg_callback info_callback, void* info_user_data,
grk_msg_callback warn_callback, void* warn_user_data,
grk_msg_callback error_callback,
void* error_user_data);
GRK_API grk_image* GRK_CALLCONV grk_image_new(uint16_t numcmpts, grk_image_comp* cmptparms,
GRK_COLOR_SPACE clrspc);
GRK_API grk_image_meta* GRK_CALLCONV grk_image_meta_new(void);
GRK_API bool GRK_CALLCONV grk_decompress_detect_format(const char* fileName, GRK_CODEC_FORMAT* fmt);
GRK_API bool GRK_CALLCONV grk_decompress_buffer_detect_format(uint8_t* buffer, size_t len,
GRK_CODEC_FORMAT* fmt);
GRK_API void GRK_CALLCONV grk_decompress_set_default_params(grk_decompress_core_params* parameters);
GRK_API grk_codec* GRK_CALLCONV grk_decompress_init(grk_stream_params* stream_params,
grk_decompress_core_params* core_params);
GRK_API bool GRK_CALLCONV grk_decompress_read_header(grk_codec* codec,
grk_header_info* header_info);
GRK_API grk_image* GRK_CALLCONV grk_decompress_get_tile_image(grk_codec* codec, uint16_t tileIndex);
GRK_API grk_image* GRK_CALLCONV grk_decompress_get_composited_image(grk_codec* codec);
GRK_API bool GRK_CALLCONV grk_decompress_set_window(grk_codec* codec, float start_x, float start_y,
float end_x, float end_y);
GRK_API bool GRK_CALLCONV grk_decompress(grk_codec* codec, grk_plugin_tile* tile);
GRK_API bool GRK_CALLCONV grk_decompress_tile(grk_codec* codec, uint16_t tileIndex);
/* COMPRESSION FUNCTIONS*/
typedef struct _grk_cparameters
{
bool tile_size_on;
uint32_t tx0;
uint32_t ty0;
uint32_t t_width;
uint32_t t_height;
uint16_t numlayers;
bool allocationByRateDistoration;
double layer_rate[GRK_MAX_LAYERS];
bool allocationByQuality;
double layer_distortion[GRK_MAX_LAYERS];
char* comment[GRK_NUM_COMMENTS_SUPPORTED];
uint16_t comment_len[GRK_NUM_COMMENTS_SUPPORTED];
bool is_binary_comment[GRK_NUM_COMMENTS_SUPPORTED];
size_t num_comments;
uint8_t csty;
/* number of guard bits */
uint8_t numgbits;
GRK_PROG_ORDER prog_order;
grk_progression progression[GRK_J2K_MAXRLVLS];
uint32_t numpocs;
uint8_t numresolution;
uint32_t cblockw_init;
uint32_t cblockh_init;
uint8_t cblk_sty;
bool irreversible;
int32_t roi_compno;
uint32_t roi_shift;
/* number of precinct size specifications */
uint32_t res_spec;
uint32_t prcw_init[GRK_J2K_MAXRLVLS];
uint32_t prch_init[GRK_J2K_MAXRLVLS];
char infile[GRK_PATH_LEN];
char outfile[GRK_PATH_LEN];
uint32_t image_offset_x0;
uint32_t image_offset_y0;
uint8_t subsampling_dx;
uint8_t subsampling_dy;
GRK_SUPPORTED_FILE_FMT decod_format;
GRK_SUPPORTED_FILE_FMT cod_format;
grk_raw_cparameters raw_cp;
uint32_t max_comp_size;
bool enableTilePartGeneration;
uint8_t newTilePartProgressionDivider;
uint8_t mct;
void* mct_data;
uint64_t max_cs_size;
uint16_t rsiz;
uint16_t framerate;
/* set to true if input file stores capture resolution */
bool write_capture_resolution_from_file;
double capture_resolution_from_file[2];
bool write_capture_resolution;
double capture_resolution[2];
bool write_display_resolution;
double display_resolution[2];
bool apply_icc_;
GRK_RATE_CONTROL_ALGORITHM rateControlAlgorithm;
uint32_t numThreads;
int32_t deviceId;
uint32_t duration; /* seconds */
uint32_t kernelBuildOptions;
uint32_t repeats;
bool writePLT;
bool writeTLM;
bool verbose;
} grk_cparameters;
GRK_API void GRK_CALLCONV grk_compress_set_default_params(grk_cparameters* parameters);
GRK_API grk_codec* GRK_CALLCONV grk_compress_init(grk_stream_params* stream_params,
grk_cparameters* parameters, grk_image* p_image);
GRK_API bool GRK_CALLCONV grk_compress(grk_codec* codec, grk_plugin_tile* tile);
GRK_API void GRK_CALLCONV grk_dump_codec(grk_codec* codec, uint32_t info_flag, FILE* output_stream);
GRK_API bool GRK_CALLCONV grk_set_MCT(grk_cparameters* parameters, float* encodingMatrix,
int32_t* dc_shift, uint32_t nbComp);
#define GRK_MAX_SUPPORTED_IMAGE_PRECISION 16 /* Maximum supported precision in library */
#define GRK_IMG_INFO 1 /* Basic image information provided to the user */
#define GRK_J2K_MH_INFO 2 /* Codestream information based only on the main header */
#define GRK_J2K_TH_INFO 4 /* Tile information based on the current tile header */
#define GRK_J2K_TCH_INFO 8
#define GRK_J2K_MH_IND 16
#define GRK_J2K_TH_IND 32
#define GRK_JP2_INFO 128
#define GRK_JP2_IND 256
#define GRK_CBLKSTY_LAZY 0x001
#define GRK_CBLKSTY_RESET 0x002
#define GRK_CBLKSTY_TERMALL 0x004
#define GRK_CBLKSTY_VSC 0x008
#define GRK_CBLKSTY_PTERM 0x010
#define GRK_CBLKSTY_SEGSYM 0x020
#define GRK_CBLKSTY_HT 0x040
#define GRK_CBLKSTY_HT_MIXED 0x080
#define GRK_CBLKSTY_HT_PHLD 0x100
#define GRK_JPH_RSIZ_FLAG 0x4000
/*****************************************************************************
* JPEG 2000 Profiles, see Table A.10 from 15444-1 (updated in various AMDs)
*
* These values help choose the RSIZ value for the JPEG 2000 code stream.
* The RSIZ value forces various compressing options, as detailed in Table A.10.
* If GRK_PROFILE_PART2 is chosen, it must be combined with one or more extensions
* described below.
*
* Example: rsiz = GRK_PROFILE_PART2 | GRK_EXTENSION_MCT;
*
* For broadcast profiles, the GRK_PROFILE_X value has to be combined with the target
* level (3-0 LSB, value between 0 and 11):
* Example: rsiz = GRK_PROFILE_BC_MULTI | 0x0005; //level equals 5
*
* For IMF profiles, the GRK_PROFILE_X value has to be combined with the target main-level
* (3-0 LSB, value between 0 and 11) and sub-level (7-4 LSB, value between 0 and 9):
* Example: rsiz = GRK_PROFILE_IMF_2K | 0x0040 | 0x0005; // main-level equals 5 and sub-level
* equals 4
*
* */
#define GRK_PROFILE_NONE 0x0000
#define GRK_PROFILE_0 0x0001
#define GRK_PROFILE_1 0x0002
#define GRK_PROFILE_CINEMA_2K 0x0003
#define GRK_PROFILE_CINEMA_4K 0x0004
#define GRK_PROFILE_CINEMA_S2K 0x0005
#define GRK_PROFILE_CINEMA_S4K 0x0006
#define GRK_PROFILE_CINEMA_LTS \
0x0007
#define GRK_PROFILE_BC_SINGLE 0x0100
#define GRK_PROFILE_BC_MULTI 0x0200
#define GRK_PROFILE_BC_MULTI_R \
0x0300
#define GRK_PROFILE_BC_MASK 0x030F
#define GRK_PROFILE_IMF_2K 0x0400
#define GRK_PROFILE_IMF_4K 0x0500
#define GRK_PROFILE_IMF_8K 0x0600
#define GRK_PROFILE_IMF_2K_R \
0x0700
#define GRK_PROFILE_IMF_4K_R \
0x0800
#define GRK_PROFILE_IMF_8K_R \
0x0900
#define GRK_PROFILE_MASK 0x0FFF
#define GRK_PROFILE_PART2 0x8000
#define GRK_PROFILE_PART2_EXTENSIONS_MASK 0x3FFF // Mask for Part-2 extension bits
#define GRK_EXTENSION_NONE 0x0000
#define GRK_EXTENSION_MCT 0x0100
#define GRK_IS_PART2(v) ((v)&GRK_PROFILE_PART2)
#define GRK_IS_CINEMA(v) (((v) >= GRK_PROFILE_CINEMA_2K) && ((v) <= GRK_PROFILE_CINEMA_S4K))
#define GRK_IS_STORAGE(v) ((v) == GRK_PROFILE_CINEMA_LTS)
/*
*
* *********************************************
* Broadcast level (3-0 LSB) (15444-1 AMD4,AMD8)
* *********************************************
*
* indicates maximum bit rate and sample rate for a code stream
*
* Note: Mbit/s == 10^6 bits/s; Msamples/s == 10^6 samples/s
*
* 0: no maximum rate
* 1: 200 Mbits/s, 65 Msamples/s
* 2: 200 Mbits/s, 130 Msamples/s
* 3: 200 Mbits/s, 195 Msamples/s
* 4: 400 Mbits/s, 260 Msamples/s
* 5: 800Mbits/s, 520 Msamples/s
* >= 6: 2^(level-6) * 1600 Mbits/s, 2^(level-6) * 1200 Msamples/s
*
* Note: level cannot be greater than 11
*
* ****************
* Broadcast tiling
* ****************
*
* Either single-tile or multi-tile. Multi-tile only permits
* 1 or 4 tiles per frame, where multiple tiles have identical
* sizes, and are configured in either 2x2 or 1x4 layout.
*
*************************************************************
*
* ***************************************
* IMF main-level (3-0) LSB (15444-1 AMD8)
* ***************************************
*
* main-level indicates maximum number of samples per second,
* as listed above.
*
*
* **************************************
* IMF sub-level (7-4) LSB (15444-1 AMD8)
* **************************************
*
* sub-level indicates maximum bit rate for a code stream:
*
* 0: no maximum rate
* >0: 2^sub-level * 100 Mbits/second
*
* Note: sub-level cannot be greater than 9, and cannot be larger
* then maximum of (main-level -2) and 1.
*
*/
#define GRK_GET_IMF_OR_BROADCAST_PROFILE(v) \
((v)&0x0f00)
#define GRK_LEVEL_MAX 11U
#define GRK_GET_LEVEL(v) ((v)&0xf)
/******* BROADCAST **********************************************************/
#define GRK_IS_BROADCAST(v) \
(((v) >= GRK_PROFILE_BC_SINGLE) && ((v) <= (GRK_PROFILE_BC_MULTI_R | 0x000b)) && \
(((v)&0xf) <= 0xb))
/* Maximum component sampling Rate (Mbits/sec) per level */
#define GRK_BROADCAST_LEVEL_1_MBITSSEC 200U
#define GRK_BROADCAST_LEVEL_2_MBITSSEC 200U
#define GRK_BROADCAST_LEVEL_3_MBITSSEC 200U
#define GRK_BROADCAST_LEVEL_4_MBITSSEC 400U
#define GRK_BROADCAST_LEVEL_5_MBITSSEC 800U
#define GRK_BROADCAST_LEVEL_6_MBITSSEC 1600U
#define GRK_BROADCAST_LEVEL_7_MBITSSEC 3200U
#define GRK_BROADCAST_LEVEL_8_MBITSSEC 6400U
#define GRK_BROADCAST_LEVEL_9_MBITSSEC 12800U
#define GRK_BROADCAST_LEVEL_10_MBITSSEC 25600U
#define GRK_BROADCAST_LEVEL_11_MBITSSEC 51200U
#define GRK_BROADCAST_LEVEL_1_MSAMPLESSEC 64U
#define GRK_BROADCAST_LEVEL_2_MSAMPLESSEC 130U
#define GRK_BROADCAST_LEVEL_3_MSAMPLESSEC 195U
#define GRK_BROADCAST_LEVEL_4_MSAMPLESSEC 260U
#define GRK_BROADCAST_LEVEL_5_MSAMPLESSEC 520U
#define GRK_BROADCAST_LEVEL_6_MSAMPLESSEC 1200U
#define GRK_BROADCAST_LEVEL_7_MSAMPLESSEC 2400U
#define GRK_BROADCAST_LEVEL_8_MSAMPLESSEC 4800U
#define GRK_BROADCAST_LEVEL_9_MSAMPLESSEC 9600U
#define GRK_BROADCAST_LEVEL_10_MSAMPLESSEC 19200U
#define GRK_BROADCAST_LEVEL_11_MSAMPLESSEC 38400U
/********IMF *****************************************************************/
#define GRK_IS_IMF(v) \
(((v) >= GRK_PROFILE_IMF_2K) && ((v) <= (GRK_PROFILE_IMF_8K_R | 0x009b)) && \
(((v)&0xf) <= 0xb) && (((v)&0xf0) <= 0x90))
/* Maximum component sampling rate (MSamples/sec) per main level */
#define GRK_IMF_MAINLEVEL_1_MSAMPLESSEC 65U
#define GRK_IMF_MAINLEVEL_2_MSAMPLESSEC 130U
#define GRK_IMF_MAINLEVEL_3_MSAMPLESSEC 195U
#define GRK_IMF_MAINLEVEL_4_MSAMPLESSEC 260U
#define GRK_IMF_MAINLEVEL_5_MSAMPLESSEC 520U
#define GRK_IMF_MAINLEVEL_6_MSAMPLESSEC 1200U
#define GRK_IMF_MAINLEVEL_7_MSAMPLESSEC 2400U
#define GRK_IMF_MAINLEVEL_8_MSAMPLESSEC 4800U
#define GRK_IMF_MAINLEVEL_9_MSAMPLESSEC 9600U
#define GRK_IMF_MAINLEVEL_10_MSAMPLESSEC 19200U
#define GRK_IMF_MAINLEVEL_11_MSAMPLESSEC 38400U
#define GRK_IMF_SUBLEVEL_MAX 9U
#define GRK_GET_IMF_SUBLEVEL(v) (((v) >> 4) & 0xf)
#define GRK_IMF_SUBLEVEL_1_MBITSSEC 200U
#define GRK_IMF_SUBLEVEL_2_MBITSSEC 400U
#define GRK_IMF_SUBLEVEL_3_MBITSSEC 800U
#define GRK_IMF_SUBLEVEL_4_MBITSSEC 1600U
#define GRK_IMF_SUBLEVEL_5_MBITSSEC 3200U
#define GRK_IMF_SUBLEVEL_6_MBITSSEC 6400U
#define GRK_IMF_SUBLEVEL_7_MBITSSEC 12800U
#define GRK_IMF_SUBLEVEL_8_MBITSSEC 25600U
#define GRK_IMF_SUBLEVEL_9_MBITSSEC 51200U
/**********************************************************************************/
#define GRK_CINEMA_24_CS 1302083U
#define GRK_CINEMA_48_CS 651041U
#define GRK_CINEMA_24_COMP 1041666U
#define GRK_CINEMA_48_COMP 520833U
/*
*
* CIE Lab #defines
*/
#define GRK_CUSTOM_CIELAB_SPACE 0x0
#define GRK_DEFAULT_CIELAB_SPACE 0x44454600 /* 'DEF' */
#define GRK_CIE_DAY ((((uint32_t)'C') << 24) + (((uint32_t)'T') << 16))
#define GRK_CIE_D50 ((uint32_t)0x00443530)
#define GRK_CIE_D65 ((uint32_t)0x00443635)
#define GRK_CIE_D75 ((uint32_t)0x00443735)
#define GRK_CIE_SA ((uint32_t)0x00005341)
#define GRK_CIE_SC ((uint32_t)0x00005343)
#define GRK_CIE_F2 ((uint32_t)0x00004632)
#define GRK_CIE_F7 ((uint32_t)0x00004637)
#define GRK_CIE_F11 ((uint32_t)0x00463131)
#define GRK_RANDOM_ACCESS_PLT 1 /* use PLT marker if present */
#define GRK_RANDOM_ACCESS_TLM 2 /* use TLM marker if present */
#define GRK_RANDOM_ACCESS_PLM 4 /* use PLM marker if present */
/*************************************************************************************
Plugin Interface
*************************************************************************************/
/*
Plugin management
*/
typedef struct _grk_plugin_load_info
{
const char* pluginPath;
} grk_plugin_load_info;
GRK_API bool GRK_CALLCONV grk_plugin_load(grk_plugin_load_info info);
GRK_API void GRK_CALLCONV grk_plugin_cleanup(void);
/* No debug is done on plugin. Production setting. */
#define GRK_PLUGIN_STATE_NO_DEBUG 0x0
/*
For compress debugging, the plugin first performs a T1 compress.
Then:
1. perform host DWT on plugin MCT data, and write to host image
This way, both plugin and host start from same point
(assume MCT is equivalent for both host and plugin)
2. map plugin DWT data, compare with host DWT, and then write to plugin image
At this point in the code, the plugin image holds plugin DWT data. And if no warnings are
triggered, then we can safely say that host and plugin DWT data are identical.
3. Perform host compress, skipping MCT and DWT (they have already been performed)
4. during host compress, each context that is formed is compared against context stream from plugin
5. rate control - synch with plugin code stream, and compare
6. T2 and store to disk
*/
#define GRK_PLUGIN_STATE_DEBUG 0x1
#define GRK_PLUGIN_STATE_PRE_TR1 0x2
#define GRK_PLUGIN_STATE_DWT_QUANTIZATION 0x4
#define GRK_PLUGIN_STATE_MCT_ONLY 0x8
GRK_API uint32_t GRK_CALLCONV grk_plugin_get_debug_state();
/*
Plugin compressing
*/
typedef struct _grk_plugin_init_info
{
int32_t deviceId;
bool verbose;
} grk_plugin_init_info;
GRK_API bool GRK_CALLCONV grk_plugin_init(grk_plugin_init_info initInfo);
typedef struct grk_plugin_compress_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;
grk_stream_params stream_params;
unsigned int error_code;
bool transferExifTags;
} grk_plugin_compress_user_callback_info;
typedef bool (*GRK_PLUGIN_COMPRESS_USER_CALLBACK)(grk_plugin_compress_user_callback_info* info);
GRK_API int32_t GRK_CALLCONV grk_plugin_compress(grk_cparameters* compress_parameters,
GRK_PLUGIN_COMPRESS_USER_CALLBACK callback);
GRK_API 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);
GRK_API bool GRK_CALLCONV grk_plugin_is_batch_complete(void);
GRK_API void GRK_CALLCONV grk_plugin_stop_batch_compress(void);
/*
Plugin decompression
*/
typedef int (*GROK_INIT_DECOMPRESSORS)(grk_header_info* header_info, grk_image* image);
typedef struct _grk_plugin_decompress_callback_info
{
size_t deviceId;
GROK_INIT_DECOMPRESSORS init_decompressors_func;
const char* input_file_name;
const char* output_file_name;
/* 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_header_info header_info;
grk_decompress_parameters* decompressor_parameters;
grk_image* image;
bool plugin_owns_image;
grk_plugin_tile* tile;
unsigned int error_code;
uint32_t decompress_flags;
uint32_t full_image_x0;
uint32_t full_image_y0;
void* user_data;
} grk_plugin_decompress_callback_info;
typedef int32_t (*grk_plugin_decompress_callback)(grk_plugin_decompress_callback_info* info);
GRK_API int32_t GRK_CALLCONV grk_plugin_decompress(grk_decompress_parameters* decompress_parameters,
grk_plugin_decompress_callback callback);
GRK_API 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);
GRK_API int32_t GRK_CALLCONV grk_plugin_batch_decompress(void);
GRK_API void GRK_CALLCONV grk_plugin_stop_batch_decompress(void);
#ifdef __cplusplus
}
#endif
grk_plugin_init_info
struct _grk_plugin_init_info grk_plugin_init_info
GRK_TILE_CACHE_STRATEGY
enum _GRK_TILE_CACHE_STRATEGY GRK_TILE_CACHE_STRATEGY
_GRK_SUPPORTED_FILE_FMT
_GRK_SUPPORTED_FILE_FMT
All supported file formats.
Definition grok.h:208
GRK_FMT_BMP
@ GRK_FMT_BMP
Definition grok.h:215
GRK_FMT_JP2
@ GRK_FMT_JP2
Definition grok.h:211
GRK_FMT_J2K
@ GRK_FMT_J2K
Definition grok.h:210
GRK_FMT_PNG
@ GRK_FMT_PNG
Definition grok.h:218
GRK_FMT_RAWL
@ GRK_FMT_RAWL
Definition grok.h:219
GRK_FMT_UNK
@ GRK_FMT_UNK
Definition grok.h:209
GRK_FMT_TIF
@ GRK_FMT_TIF
Definition grok.h:216
GRK_FMT_JPG
@ GRK_FMT_JPG
Definition grok.h:220
GRK_FMT_PXM
@ GRK_FMT_PXM
Definition grok.h:212
GRK_FMT_RAW
@ GRK_FMT_RAW
Definition grok.h:217
GRK_FMT_PAM
@ GRK_FMT_PAM
Definition grok.h:214
GRK_FMT_PGX
@ GRK_FMT_PGX
Definition grok.h:213
grk_cparameters
struct _grk_cparameters grk_cparameters
Compress parameters.
grk_progression
struct _grk_progression grk_progression
Progression order change.
grk_precision_mode
enum _grk_precision_mode grk_precision_mode
Precision mode.
grk_image
struct _grk_image grk_image
grk_io_register_reclaim_callback
void(* grk_io_register_reclaim_callback)(grk_io_init io_init, grk_io_callback reclaim_callback, void *io_user_data, void *reclaim_user_data)
Definition grok.h:452
grk_set_MCT
GRK_API bool GRK_CALLCONV grk_set_MCT(grk_cparameters *parameters, float *encodingMatrix, int32_t *dc_shift, uint32_t nbComp)
Set the MCT matrix to use.
Definition grok.cpp:405
grk_plugin_stop_batch_compress
GRK_API void GRK_CALLCONV grk_plugin_stop_batch_compress(void)
Stop batch compress.
Definition grok.cpp:796
grk_object_ref
GRK_API grk_object *GRK_CALLCONV grk_object_ref(grk_object *obj)
Increment ref count.
Definition grok.cpp:133
grk_image_new
GRK_API grk_image *GRK_CALLCONV grk_image_new(uint16_t numcmpts, grk_image_comp *cmptparms, GRK_COLOR_SPACE clrspc)
Create image.
Definition grok.cpp:215
grk_plugin_stop_batch_decompress
GRK_API void GRK_CALLCONV grk_plugin_stop_batch_decompress(void)
Stop batch decompress.
Definition grok.cpp:892
grk_channel_description
struct _grk_channel_description grk_channel_description
Channel definition: channel index, type, association.
GRK_NUM_COMMENTS_SUPPORTED
#define GRK_NUM_COMMENTS_SUPPORTED
Definition grok.h:108
grk_msg_callback
void(* grk_msg_callback)(const char *msg, void *client_data)
Logging callback.
Definition grok.h:118
GRK_CHANNEL_TYPE
enum _GRK_CHANNEL_TYPE GRK_CHANNEL_TYPE
grk_io_pixels_callback
bool(* grk_io_pixels_callback)(uint32_t threadId, grk_io_buf buffer, void *user_data)
Definition grok.h:455
grk_stream_params
struct _grk_stream_params grk_stream_params
JPEG 2000 stream parameters - either file or buffer.
grk_plugin_cleanup
GRK_API void GRK_CALLCONV grk_plugin_cleanup(void)
Release plugin resources.
Definition grok.cpp:702
grk_plugin_load
GRK_API bool GRK_CALLCONV grk_plugin_load(grk_plugin_load_info info)
Load plugin.
Definition grok.cpp:660
grk_decompress_detect_format
GRK_API bool GRK_CALLCONV grk_decompress_detect_format(const char *fileName, GRK_CODEC_FORMAT *fmt)
Detect jpeg 2000 format from file Format is either GRK_FMT_J2K or GRK_FMT_JP2.
Definition grok.cpp:256
GRK_CODEC_FORMAT
enum _GRK_CODEC_FORMAT GRK_CODEC_FORMAT
Supported JPEG 2000 formats.
GRK_ENUM_COLOUR_SPACE
enum _GRK_ENUM_COLOUR_SPACE GRK_ENUM_COLOUR_SPACE
grk_set_msg_handlers
GRK_API void GRK_CALLCONV grk_set_msg_handlers(grk_msg_callback info_callback, void *info_user_data, grk_msg_callback warn_callback, void *warn_user_data, grk_msg_callback error_callback, void *error_user_data)
Definition grok.cpp:151
grk_plugin_get_debug_state
GRK_API uint32_t GRK_CALLCONV grk_plugin_get_debug_state()
Get debug state of plugin.
Definition grok.cpp:687
grk_precision
struct _grk_precision grk_precision
Precision.
grk_plugin_decompress_callback_info
struct _grk_plugin_decompress_callback_info grk_plugin_decompress_callback_info
grk_decompress_set_default_params
GRK_API void GRK_CALLCONV grk_decompress_set_default_params(grk_decompress_core_params *parameters)
Initialize decompress parameters with default values.
Definition grok.cpp:310
grk_plugin_batch_decompress
GRK_API int32_t GRK_CALLCONV grk_plugin_batch_decompress(void)
Initiate batch decompress.
Definition grok.cpp:878
GRK_PROG_ORDER
enum _GRK_PROG_ORDER GRK_PROG_ORDER
Progression order.
grk_object
struct _grk_object grk_object
Grok ref-counted object.
grk_raw_cparameters
struct _grk_raw_cparameters grk_raw_cparameters
RAW image compress parameters.
grk_plugin_load_info
struct _grk_plugin_load_info grk_plugin_load_info
grk_plugin_compress
GRK_API int32_t GRK_CALLCONV grk_plugin_compress(grk_cparameters *compress_parameters, GRK_PLUGIN_COMPRESS_USER_CALLBACK callback)
Compress with plugin.
Definition grok.cpp:743
_GRK_CHANNEL_ASSOC
_GRK_CHANNEL_ASSOC
Definition grok.h:286
GRK_CHANNEL_ASSOC_COLOUR_1
@ GRK_CHANNEL_ASSOC_COLOUR_1
Definition grok.h:289
GRK_CHANNEL_ASSOC_COLOUR_2
@ GRK_CHANNEL_ASSOC_COLOUR_2
Definition grok.h:290
GRK_CHANNEL_ASSOC_COLOUR_3
@ GRK_CHANNEL_ASSOC_COLOUR_3
Definition grok.h:291
GRK_CHANNEL_ASSOC_WHOLE_IMAGE
@ GRK_CHANNEL_ASSOC_WHOLE_IMAGE
Definition grok.h:288
GRK_CHANNEL_ASSOC_UNASSOCIATED
@ GRK_CHANNEL_ASSOC_UNASSOCIATED
Definition grok.h:292
GRK_RATE_CONTROL_ALGORITHM
enum _GRK_RATE_CONTROL_ALGORITHM GRK_RATE_CONTROL_ALGORITHM
Rate control algorithms GRK_RATE_CONTROL_BISECT: bisect with all truncation points GRK_RATE_CONTROL_P...
grk_decompress_core_params
struct _grk_decompress_core_params grk_decompress_core_params
Core decompression parameters.
grk_image_meta
struct _grk_image_meta grk_image_meta
grk_asoc
struct _grk_asoc grk_asoc
Association box info.
grk_codec
grk_object grk_codec
Definition grok.h:746
GRK_SUPPORTED_FILE_FMT
enum _GRK_SUPPORTED_FILE_FMT GRK_SUPPORTED_FILE_FMT
All supported file formats.
GRK_J2K_MAXRLVLS
#define GRK_J2K_MAXRLVLS
Definition grok.h:232
grk_palette_data
struct _grk_palette_data grk_palette_data
Palette data.
grk_compress
GRK_API bool GRK_CALLCONV grk_compress(grk_codec *codec, grk_plugin_tile *tile)
Compress an image into a JPEG 2000 code stream using plugin.
Definition grok.cpp:567
GRK_API
#define GRK_API
Definition grok.h:49
grk_decompress_read_header
GRK_API bool GRK_CALLCONV grk_decompress_read_header(grk_codec *codec, grk_header_info *header_info)
Decompress JPEG 2000 header.
Definition grok.cpp:345
grk_component_mapping_comp
struct _grk_component_mapping_comp grk_component_mapping_comp
Note: "component" refers to an image component as decompressed from the code stream,...
grk_decompress_buffer_detect_format
GRK_API bool GRK_CALLCONV grk_decompress_buffer_detect_format(uint8_t *buffer, size_t len, GRK_CODEC_FORMAT *fmt)
Detect jpeg 2000 format from buffer Format is either GRK_FMT_J2K or GRK_FMT_JP2.
Definition grok.cpp:230
grk_compress_init
GRK_API grk_codec *GRK_CALLCONV grk_compress_init(grk_stream_params *stream_params, grk_cparameters *parameters, grk_image *p_image)
Set up the compressor parameters using the current image and user parameters.
Definition grok.cpp:503
grk_image_comp
struct _grk_image_comp grk_image_comp
Image component.
grk_raw_comp_cparameters
struct _grk_raw_comp_cparameters grk_raw_comp_cparameters
RAW component compress parameters.
grk_deinitialize
GRK_API void GRK_CALLCONV grk_deinitialize()
De-initialize library.
Definition grok.cpp:127
grk_plugin_batch_compress
GRK_API 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.
Definition grok.cpp:759
grk_object_unref
GRK_API void GRK_CALLCONV grk_object_unref(grk_object *obj)
Definition grok.cpp:142
GRK_MAX_LAYERS
#define GRK_MAX_LAYERS
Definition grok.h:224
grk_decompress_init
GRK_API grk_codec *GRK_CALLCONV grk_decompress_init(grk_stream_params *stream_params, grk_decompress_core_params *core_params)
Initialize decompressor.
Definition grok.cpp:320
grk_compress_set_default_params
GRK_API void GRK_CALLCONV grk_compress_set_default_params(grk_cparameters *parameters)
Set compressing parameters to default values:
Definition grok.cpp:474
grk_plugin_precinct
struct _grk_plugin_precinct grk_plugin_precinct
Plugin precinct.
grk_version
GRK_API const char *GRK_CALLCONV grk_version(void)
Library version.
Definition grok.cpp:210
_GRK_COLOR_SPACE
_GRK_COLOR_SPACE
Supported color spaces.
Definition grok.h:71
GRK_CLRSPC_SRGB
@ GRK_CLRSPC_SRGB
sRGB
Definition grok.h:73
GRK_CLRSPC_EYCC
@ GRK_CLRSPC_EYCC
extended YCC
Definition grok.h:76
GRK_CLRSPC_UNKNOWN
@ GRK_CLRSPC_UNKNOWN
unknown
Definition grok.h:72
GRK_CLRSPC_SYCC
@ GRK_CLRSPC_SYCC
standard YCC (YUV)
Definition grok.h:75
GRK_CLRSPC_DEFAULT_CIE
@ GRK_CLRSPC_DEFAULT_CIE
default CIE LAB
Definition grok.h:78
GRK_CLRSPC_ICC
@ GRK_CLRSPC_ICC
ICC profile.
Definition grok.h:80
GRK_CLRSPC_CMYK
@ GRK_CLRSPC_CMYK
CMYK.
Definition grok.h:77
GRK_CLRSPC_GRAY
@ GRK_CLRSPC_GRAY
grayscale
Definition grok.h:74
GRK_CLRSPC_CUSTOM_CIE
@ GRK_CLRSPC_CUSTOM_CIE
custom CIE LAB
Definition grok.h:79
grk_io_buf
struct _grk_io_buf grk_io_buf
_grk_precision_mode
_grk_precision_mode
Precision mode.
Definition grok.h:343
GRK_PREC_MODE_SCALE
@ GRK_PREC_MODE_SCALE
Definition grok.h:345
GRK_PREC_MODE_CLIP
@ GRK_PREC_MODE_CLIP
Definition grok.h:344
grk_image_meta_new
GRK_API grk_image_meta *GRK_CALLCONV grk_image_meta_new(void)
Definition grok.cpp:221
GRK_PLUGIN_COMPRESS_USER_CALLBACK
bool(* GRK_PLUGIN_COMPRESS_USER_CALLBACK)(grk_plugin_compress_user_callback_info *info)
Definition grok.h:1413
grk_plugin_is_batch_complete
GRK_API bool GRK_CALLCONV grk_plugin_is_batch_complete(void)
Check if batch job is complete.
Definition grok.cpp:781
GRK_COLOR_SPACE
enum _GRK_COLOR_SPACE GRK_COLOR_SPACE
Supported color spaces.
GRK_PATH_LEN
#define GRK_PATH_LEN
Definition grok.h:223
grk_decompress_set_window
GRK_API bool GRK_CALLCONV grk_decompress_set_window(grk_codec *codec, float start_x, float start_y, float end_x, float end_y)
Set the given area to be decompressed.
Definition grok.cpp:359
grk_plugin_decompress
GRK_API int32_t GRK_CALLCONV grk_plugin_decompress(grk_decompress_parameters *decompress_parameters, grk_plugin_decompress_callback callback)
Decompress with plugin.
Definition grok.cpp:843
grk_io_init
struct _grk_io_init grk_io_init
grk_decompress_get_composited_image
GRK_API grk_image *GRK_CALLCONV grk_decompress_get_composited_image(grk_codec *codec)
Get decompressed composite image.
Definition grok.cpp:444
grk_dump_codec
GRK_API void GRK_CALLCONV grk_dump_codec(grk_codec *codec, uint32_t info_flag, FILE *output_stream)
Dump codec information to file.
Definition grok.cpp:394
_GRK_ENUM_COLOUR_SPACE
_GRK_ENUM_COLOUR_SPACE
Definition grok.h:85
GRK_ENUM_CLRSPC_ESRGB
@ GRK_ENUM_CLRSPC_ESRGB
Definition grok.h:101
GRK_ENUM_CLRSPC_CMY
@ GRK_ENUM_CLRSPC_CMY
Definition grok.h:92
GRK_ENUM_CLRSPC_EYCC
@ GRK_ENUM_CLRSPC_EYCC
Definition grok.h:105
GRK_ENUM_CLRSPC_CIEJAB
@ GRK_ENUM_CLRSPC_CIEJAB
Definition grok.h:100
GRK_ENUM_CLRSPC_GRAY
@ GRK_ENUM_CLRSPC_GRAY
Definition grok.h:98
GRK_ENUM_CLRSPC_CIE
@ GRK_ENUM_CLRSPC_CIE
Definition grok.h:95
GRK_ENUM_CLRSPC_UNKNOWN
@ GRK_ENUM_CLRSPC_UNKNOWN
Definition grok.h:86
GRK_ENUM_CLRSPC_YCBCR3
@ GRK_ENUM_CLRSPC_YCBCR3
Definition grok.h:90
GRK_ENUM_CLRSPC_ROMMRGB
@ GRK_ENUM_CLRSPC_ROMMRGB
Definition grok.h:102
GRK_ENUM_CLRSPC_YPBPR60
@ GRK_ENUM_CLRSPC_YPBPR60
Definition grok.h:103
GRK_ENUM_CLRSPC_SRGB
@ GRK_ENUM_CLRSPC_SRGB
Definition grok.h:97
GRK_ENUM_CLRSPC_BILEVEL2
@ GRK_ENUM_CLRSPC_BILEVEL2
Definition grok.h:96
GRK_ENUM_CLRSPC_SYCC
@ GRK_ENUM_CLRSPC_SYCC
Definition grok.h:99
GRK_ENUM_CLRSPC_PHOTO_YCC
@ GRK_ENUM_CLRSPC_PHOTO_YCC
Definition grok.h:91
GRK_ENUM_CLRSPC_YCBCR1
@ GRK_ENUM_CLRSPC_YCBCR1
Definition grok.h:88
GRK_ENUM_CLRSPC_CMYK
@ GRK_ENUM_CLRSPC_CMYK
Definition grok.h:93
GRK_ENUM_CLRSPC_YCCK
@ GRK_ENUM_CLRSPC_YCCK
Definition grok.h:94
GRK_ENUM_CLRSPC_YPBPR50
@ GRK_ENUM_CLRSPC_YPBPR50
Definition grok.h:104
GRK_ENUM_CLRSPC_BILEVEL1
@ GRK_ENUM_CLRSPC_BILEVEL1
Definition grok.h:87
GRK_ENUM_CLRSPC_YCBCR2
@ GRK_ENUM_CLRSPC_YCBCR2
Definition grok.h:89
grk_color
struct _grk_color grk_color
ICC profile, palette, channel definition.
grk_plugin_init_batch_decompress
GRK_API 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.
Definition grok.cpp:860
grk_decompress_parameters
struct _grk_decompress_params grk_decompress_parameters
Decompression parameters.
_GRK_CHANNEL_TYPE
_GRK_CHANNEL_TYPE
Definition grok.h:275
GRK_CHANNEL_TYPE_OPACITY
@ GRK_CHANNEL_TYPE_OPACITY
Definition grok.h:278
GRK_CHANNEL_TYPE_PREMULTIPLIED_OPACITY
@ GRK_CHANNEL_TYPE_PREMULTIPLIED_OPACITY
Definition grok.h:279
GRK_CHANNEL_TYPE_COLOUR
@ GRK_CHANNEL_TYPE_COLOUR
Definition grok.h:277
GRK_CHANNEL_TYPE_UNSPECIFIED
@ GRK_CHANNEL_TYPE_UNSPECIFIED
Definition grok.h:280
_GRK_RATE_CONTROL_ALGORITHM
_GRK_RATE_CONTROL_ALGORITHM
Rate control algorithms GRK_RATE_CONTROL_BISECT: bisect with all truncation points GRK_RATE_CONTROL_P...
Definition grok.h:199
GRK_RATE_CONTROL_PCRD_OPT
@ GRK_RATE_CONTROL_PCRD_OPT
Definition grok.h:201
GRK_RATE_CONTROL_BISECT
@ GRK_RATE_CONTROL_BISECT
Definition grok.h:200
grk_decompress_tile
GRK_API bool GRK_CALLCONV grk_decompress_tile(grk_codec *codec, uint16_t tileIndex)
Decompress a specific tile.
Definition grok.cpp:383
grk_channel_definition
struct _grk_channel_definition grk_channel_definition
Channel definitions and number of definitions.
GROK_INIT_DECOMPRESSORS
int(* GROK_INIT_DECOMPRESSORS)(grk_header_info *header_info, grk_image *image)
Definition grok.h:1454
grk_plugin_band
struct _grk_plugin_band grk_plugin_band
Plugin band.
_GRK_CODEC_FORMAT
_GRK_CODEC_FORMAT
Supported JPEG 2000 formats.
Definition grok.h:511
GRK_CODEC_J2K
@ GRK_CODEC_J2K
JPEG 2000 code stream : read/write.
Definition grok.h:513
GRK_CODEC_JP2
@ GRK_CODEC_JP2
JP2 file format : read/write.
Definition grok.h:514
GRK_CODEC_UNK
@ GRK_CODEC_UNK
place-holder
Definition grok.h:512
grk_plugin_tile
struct _grk_plugin_tile grk_plugin_tile
Plugin tile.
GRK_CALLCONV
#define GRK_CALLCONV
Definition grok.h:45
grk_decompress_get_tile_image
GRK_API grk_image *GRK_CALLCONV grk_decompress_get_tile_image(grk_codec *codec, uint16_t tileIndex)
Get decompressed tile image.
Definition grok.cpp:434
GRK_NUM_ASOC_BOXES_SUPPORTED
#define GRK_NUM_ASOC_BOXES_SUPPORTED
Definition grok.h:109
_GRK_PROG_ORDER
_GRK_PROG_ORDER
Progression order.
Definition grok.h:57
GRK_RPCL
@ GRK_RPCL
resolution-precinct-component-layer order
Definition grok.h:61
GRK_CPRL
@ GRK_CPRL
component-precinct-resolution-layer order
Definition grok.h:63
GRK_RLCP
@ GRK_RLCP
resolution-layer-component-precinct order
Definition grok.h:60
GRK_PROG_UNKNOWN
@ GRK_PROG_UNKNOWN
place-holder
Definition grok.h:58
GRK_LRCP
@ GRK_LRCP
layer-resolution-component-precinct order
Definition grok.h:59
GRK_NUM_PROGRESSION_ORDERS
@ GRK_NUM_PROGRESSION_ORDERS
Definition grok.h:64
GRK_PCRL
@ GRK_PCRL
precinct-component-resolution-layer order
Definition grok.h:62
grk_plugin_pass
struct _grk_plugin_pass grk_plugin_pass
Plugin pass.
GRK_CHANNEL_ASSOC
enum _GRK_CHANNEL_ASSOC GRK_CHANNEL_ASSOC
grk_io_callback
bool(* grk_io_callback)(uint32_t threadId, grk_io_buf buffer, void *io_user_data)
Definition grok.h:451
grk_header_info
struct _grk_header_info grk_header_info
Header info.
grk_plugin_decompress_callback
int32_t(* grk_plugin_decompress_callback)(grk_plugin_decompress_callback_info *info)
Definition grok.h:1479
_GRK_TILE_CACHE_STRATEGY
_GRK_TILE_CACHE_STRATEGY
Definition grok.h:471
GRK_TILE_CACHE_IMAGE
@ GRK_TILE_CACHE_IMAGE
Definition grok.h:473
GRK_TILE_CACHE_NONE
@ GRK_TILE_CACHE_NONE
Definition grok.h:472
grk_initialize
GRK_API bool GRK_CALLCONV grk_initialize(const char *pluginPath, uint32_t numthreads)
Initialize library.
Definition grok.cpp:114
grk_plugin_resolution
struct _grk_plugin_resolution grk_plugin_resolution
Plugin resolution.
grk_plugin_code_block
struct _grk_plugin_code_block grk_plugin_code_block
Plugin code block.
grk_plugin_init
GRK_API bool GRK_CALLCONV grk_plugin_init(grk_plugin_init_info initInfo)
Initialize plugin.
Definition grok.cpp:707
grk_decompress
GRK_API bool GRK_CALLCONV grk_decompress(grk_codec *codec, grk_plugin_tile *tile)
Decompress image from a JPEG 2000 code stream.
Definition grok.cpp:371
_grk_asoc
Association box info.
Definition grok.h:332
_grk_asoc::label
const char * label
Definition grok.h:334
_grk_asoc::xml
uint8_t * xml
Definition grok.h:335
_grk_asoc::level
uint32_t level
Definition grok.h:333
_grk_asoc::xml_len
uint32_t xml_len
Definition grok.h:336
_grk_channel_definition
Channel definitions and number of definitions.
Definition grok.h:310
_grk_channel_definition::num_channel_descriptions
uint16_t num_channel_descriptions
Definition grok.h:312
_grk_channel_definition::descriptions
grk_channel_description * descriptions
Definition grok.h:311
_grk_channel_description
Channel definition: channel index, type, association.
Definition grok.h:300
_grk_channel_description::typ
uint16_t typ
Definition grok.h:302
_grk_channel_description::asoc
uint16_t asoc
Definition grok.h:303
_grk_channel_description::channel
uint16_t channel
Definition grok.h:301
_grk_color
ICC profile, palette, channel definition.
Definition grok.h:319
_grk_color::channel_definition
grk_channel_definition * channel_definition
Definition grok.h:323
_grk_color::icc_profile_name
char * icc_profile_name
Definition grok.h:322
_grk_color::icc_profile_len
uint32_t icc_profile_len
Definition grok.h:321
_grk_color::icc_profile_buf
uint8_t * icc_profile_buf
Definition grok.h:320
_grk_color::palette
grk_palette_data * palette
Definition grok.h:324
_grk_color::has_colour_specification_box
bool has_colour_specification_box
Definition grok.h:325
_grk_component_mapping_comp
Note: "component" refers to an image component as decompressed from the code stream,...
Definition grok.h:247
_grk_component_mapping_comp::palette_column
uint8_t palette_column
Definition grok.h:250
_grk_component_mapping_comp::mapping_type
uint8_t mapping_type
Definition grok.h:249
_grk_component_mapping_comp::component_index
uint16_t component_index
Definition grok.h:248
_grk_cparameters
Compress parameters.
Definition grok.h:912
_grk_cparameters::cblockw_init
uint32_t cblockw_init
initial code block width (default to 64)
Definition grok.h:951
_grk_cparameters::numgbits
uint8_t numgbits
Definition grok.h:941
_grk_cparameters::outfile
char outfile[GRK_PATH_LEN]
output file name
Definition grok.h:973
_grk_cparameters::allocationByRateDistoration
bool allocationByRateDistoration
rate control allocation by rate/distortion curve
Definition grok.h:926
_grk_cparameters::prog_order
GRK_PROG_ORDER prog_order
progression order (default is LRCP)
Definition grok.h:943
_grk_cparameters::comment_len
uint16_t comment_len[GRK_NUM_COMMENTS_SUPPORTED]
Definition grok.h:935
_grk_cparameters::repeats
uint32_t repeats
Definition grok.h:1030
_grk_cparameters::numThreads
uint32_t numThreads
Definition grok.h:1026
_grk_cparameters::verbose
bool verbose
Definition grok.h:1033
_grk_cparameters::image_offset_x0
uint32_t image_offset_x0
subimage compressing: origin image offset in x direction
Definition grok.h:975
_grk_cparameters::max_cs_size
uint64_t max_cs_size
Maximum size (in bytes) for the whole code stream.
Definition grok.h:1007
_grk_cparameters::raw_cp
grk_raw_cparameters raw_cp
Definition grok.h:986
_grk_cparameters::numresolution
uint8_t numresolution
number of resolutions
Definition grok.h:949
_grk_cparameters::image_offset_y0
uint32_t image_offset_y0
subimage compressing: origin image offset in y direction
Definition grok.h:977
_grk_cparameters::decod_format
GRK_SUPPORTED_FILE_FMT decod_format
input file format
Definition grok.h:983
_grk_cparameters::newTilePartProgressionDivider
uint8_t newTilePartProgressionDivider
new tile part progression divider
Definition grok.h:995
_grk_cparameters::cblockh_init
uint32_t cblockh_init
initial code block height (default to 64)
Definition grok.h:953
_grk_cparameters::rateControlAlgorithm
GRK_RATE_CONTROL_ALGORITHM rateControlAlgorithm
Definition grok.h:1025
_grk_cparameters::allocationByQuality
bool allocationByQuality
rate control allocation by fixed_PSNR quality
Definition grok.h:931
_grk_cparameters::roi_shift
uint32_t roi_shift
region of interest: upshift value
Definition grok.h:963
_grk_cparameters::subsampling_dy
uint8_t subsampling_dy
subsampling value for dy
Definition grok.h:981
_grk_cparameters::tile_size_on
bool tile_size_on
size of tile: tile_size_on = false (not in argument) or = true (in argument)
Definition grok.h:914
_grk_cparameters::t_height
uint32_t t_height
YTsiz.
Definition grok.h:922
_grk_cparameters::write_capture_resolution_from_file
bool write_capture_resolution_from_file
Definition grok.h:1014
_grk_cparameters::enableTilePartGeneration
bool enableTilePartGeneration
Tile part generation.
Definition grok.h:993
_grk_cparameters::res_spec
uint32_t res_spec
Definition grok.h:965
_grk_cparameters::mct
uint8_t mct
MCT (multiple component transform)
Definition grok.h:997
_grk_cparameters::numlayers
uint16_t numlayers
number of layers
Definition grok.h:924
_grk_cparameters::deviceId
int32_t deviceId
Definition grok.h:1027
_grk_cparameters::cod_format
GRK_SUPPORTED_FILE_FMT cod_format
output file format
Definition grok.h:985
_grk_cparameters::capture_resolution_from_file
double capture_resolution_from_file[2]
Definition grok.h:1015
_grk_cparameters::max_comp_size
uint32_t max_comp_size
Maximum size (in bytes) for each component.
Definition grok.h:991
_grk_cparameters::irreversible
bool irreversible
1 : use the irreversible DWT 9-7, 0 : use lossless compression (default)
Definition grok.h:958
_grk_cparameters::t_width
uint32_t t_width
XTsiz.
Definition grok.h:920
_grk_cparameters::write_display_resolution
bool write_display_resolution
Definition grok.h:1020
_grk_cparameters::cblk_sty
uint8_t cblk_sty
code block style
Definition grok.h:955
_grk_cparameters::csty
uint8_t csty
csty : coding style
Definition grok.h:939
_grk_cparameters::prch_init
uint32_t prch_init[GRK_J2K_MAXRLVLS]
initial precinct height
Definition grok.h:969
_grk_cparameters::is_binary_comment
bool is_binary_comment[GRK_NUM_COMMENTS_SUPPORTED]
Definition grok.h:936
_grk_cparameters::rsiz
uint16_t rsiz
RSIZ value To be used to combine GRK_PROFILE_*, GRK_EXTENSION_* and (sub)levels values.
Definition grok.h:1010
_grk_cparameters::infile
char infile[GRK_PATH_LEN]
input file name
Definition grok.h:971
_grk_cparameters::layer_distortion
double layer_distortion[GRK_MAX_LAYERS]
layer PSNR values
Definition grok.h:933
_grk_cparameters::mct_data
void * mct_data
Naive implementation of MCT restricted to a single reversible array based compressing without offset ...
Definition grok.h:1000
_grk_cparameters::tx0
uint32_t tx0
XTOsiz.
Definition grok.h:916
_grk_cparameters::comment
char * comment[GRK_NUM_COMMENTS_SUPPORTED]
Definition grok.h:934
_grk_cparameters::write_capture_resolution
bool write_capture_resolution
Definition grok.h:1017
_grk_cparameters::subsampling_dx
uint8_t subsampling_dx
subsampling value for dx
Definition grok.h:979
_grk_cparameters::writeTLM
bool writeTLM
Definition grok.h:1032
_grk_cparameters::prcw_init
uint32_t prcw_init[GRK_J2K_MAXRLVLS]
initial precinct width
Definition grok.h:967
_grk_cparameters::num_comments
size_t num_comments
Definition grok.h:937
_grk_cparameters::framerate
uint16_t framerate
Definition grok.h:1011
_grk_cparameters::display_resolution
double display_resolution[2]
Definition grok.h:1021
_grk_cparameters::writePLT
bool writePLT
Definition grok.h:1031
_grk_cparameters::roi_compno
int32_t roi_compno
region of interest: affected component in [0..3]; -1 indicates no ROI
Definition grok.h:961
_grk_cparameters::ty0
uint32_t ty0
YTOsiz.
Definition grok.h:918
_grk_cparameters::duration
uint32_t duration
Definition grok.h:1028
_grk_cparameters::apply_icc_
bool apply_icc_
Definition grok.h:1023
_grk_cparameters::layer_rate
double layer_rate[GRK_MAX_LAYERS]
layers rates expressed as compression ratios.
Definition grok.h:929
_grk_cparameters::kernelBuildOptions
uint32_t kernelBuildOptions
Definition grok.h:1029
_grk_cparameters::progression
grk_progression progression[GRK_J2K_MAXRLVLS]
progressions
Definition grok.h:945
_grk_cparameters::numpocs
uint32_t numpocs
number of progression order changes (POCs), default to 0
Definition grok.h:947
_grk_cparameters::capture_resolution
double capture_resolution[2]
Definition grok.h:1018
_grk_decompress_core_params
Core decompression parameters.
Definition grok.h:480
_grk_decompress_core_params::randomAccessFlags_
uint32_t randomAccessFlags_
Definition grok.h:498
_grk_decompress_core_params::io_buffer_callback
grk_io_pixels_callback io_buffer_callback
Definition grok.h:500
_grk_decompress_core_params::tileCacheStrategy
GRK_TILE_CACHE_STRATEGY tileCacheStrategy
Definition grok.h:496
_grk_decompress_core_params::io_user_data
void * io_user_data
Definition grok.h:501
_grk_decompress_core_params::reduce
uint8_t reduce
Set the number of highest resolution levels to be discarded.
Definition grok.h:488
_grk_decompress_core_params::max_layers
uint16_t max_layers
Set the maximum number of quality layers to decompress.
Definition grok.h:495
_grk_decompress_core_params::io_register_client_callback
grk_io_register_reclaim_callback io_register_client_callback
Definition grok.h:502
_grk_decompress_params
Decompression parameters.
Definition grok.h:521
_grk_decompress_params::dw_y1
float dw_y1
Decompress window bottom boundary.
Definition grok.h:539
_grk_decompress_params::deviceId
int32_t deviceId
Definition grok.h:561
_grk_decompress_params::dw_x0
float dw_x0
Decompress window left boundary.
Definition grok.h:533
_grk_decompress_params::io_xml
bool io_xml
Definition grok.h:552
_grk_decompress_params::precision
grk_precision * precision
Definition grok.h:543
_grk_decompress_params::numThreads
uint32_t numThreads
Definition grok.h:565
_grk_decompress_params::cod_format
GRK_SUPPORTED_FILE_FMT cod_format
output file format
Definition grok.h:531
_grk_decompress_params::kernelBuildOptions
uint32_t kernelBuildOptions
Definition grok.h:563
_grk_decompress_params::infile
char infile[GRK_PATH_LEN]
input file name
Definition grok.h:525
_grk_decompress_params::compressionLevel
uint32_t compressionLevel
Definition grok.h:558
_grk_decompress_params::force_rgb
bool force_rgb
Definition grok.h:546
_grk_decompress_params::compression
uint32_t compression
Definition grok.h:553
_grk_decompress_params::singleTileDecompress
bool singleTileDecompress
Definition grok.h:542
_grk_decompress_params::repeats
uint32_t repeats
Definition grok.h:564
_grk_decompress_params::upsample
bool upsample
Definition grok.h:548
_grk_decompress_params::core
grk_decompress_core_params core
core library parameters
Definition grok.h:523
_grk_decompress_params::tileIndex
uint16_t tileIndex
tile number of the decompressed tile
Definition grok.h:541
_grk_decompress_params::verbose_
bool verbose_
Verbose mode.
Definition grok.h:560
_grk_decompress_params::duration
uint32_t duration
Definition grok.h:562
_grk_decompress_params::dw_y0
float dw_y0
Decompress window up boundary.
Definition grok.h:537
_grk_decompress_params::numPrecision
uint32_t numPrecision
Definition grok.h:544
_grk_decompress_params::split_pnm
bool split_pnm
Definition grok.h:550
_grk_decompress_params::decod_format
GRK_CODEC_FORMAT decod_format
input file format
Definition grok.h:529
_grk_decompress_params::dw_x1
float dw_x1
Decompress window right boundary.
Definition grok.h:535
_grk_decompress_params::outfile
char outfile[GRK_PATH_LEN]
output file name
Definition grok.h:527
_grk_header_info
Header info.
Definition grok.h:361
_grk_header_info::cblockh_init
uint32_t cblockh_init
initial code block height, default to 64
Definition grok.h:380
_grk_header_info::comment_len
uint16_t comment_len[GRK_NUM_COMMENTS_SUPPORTED]
Definition grok.h:428
_grk_header_info::upsample
bool upsample
Definition grok.h:367
_grk_header_info::forceRGB
bool forceRGB
Definition grok.h:366
_grk_header_info::splitByComponent
bool splitByComponent
Definition grok.h:370
_grk_header_info::num_asocs
uint32_t num_asocs
Definition grok.h:432
_grk_header_info::comment
char * comment[GRK_NUM_COMMENTS_SUPPORTED]
Definition grok.h:427
_grk_header_info::t_width
uint32_t t_width
XTsiz.
Definition grok.h:411
_grk_header_info::numresolutions
uint32_t numresolutions
number of resolutions
Definition grok.h:389
_grk_header_info::prch_init
uint32_t prch_init[GRK_J2K_MAXRLVLS]
initial precinct height
Definition grok.h:405
_grk_header_info::xml_data_len
size_t xml_data_len
Definition grok.h:425
_grk_header_info::num_comments
size_t num_comments
Definition grok.h:426
_grk_header_info::numPrecision
uint32_t numPrecision
Definition grok.h:369
_grk_header_info::csty
uint8_t csty
Definition grok.h:395
_grk_header_info::t_grid_height
uint32_t t_grid_height
tile grid height
Definition grok.h:417
_grk_header_info::asocs
grk_asoc asocs[GRK_NUM_ASOC_BOXES_SUPPORTED]
Definition grok.h:431
_grk_header_info::tx0
uint32_t tx0
XTOsiz.
Definition grok.h:407
_grk_header_info::ty0
uint32_t ty0
YTOsiz.
Definition grok.h:409
_grk_header_info::cblockw_init
uint32_t cblockw_init
initial code block width, default to 64
Definition grok.h:378
_grk_header_info::rsiz
uint16_t rsiz
RSIZ value To be used to combine GRK_PROFILE_*, GRK_EXTENSION_* and (sub)levels values.
Definition grok.h:387
_grk_header_info::mct
uint32_t mct
multi-component transform identifier
Definition grok.h:384
_grk_header_info::prcw_init
uint32_t prcw_init[GRK_J2K_MAXRLVLS]
initial precinct width
Definition grok.h:403
_grk_header_info::precision
grk_precision * precision
Definition grok.h:368
_grk_header_info::t_height
uint32_t t_height
YTsiz.
Definition grok.h:413
_grk_header_info::decompressFormat
GRK_SUPPORTED_FILE_FMT decompressFormat
Definition grok.h:365
_grk_header_info::cblk_sty
uint8_t cblk_sty
Definition grok.h:401
_grk_header_info::t_grid_width
uint32_t t_grid_width
tile grid width
Definition grok.h:415
_grk_header_info::xml_data
uint8_t * xml_data
Definition grok.h:424
_grk_header_info::isBinaryComment
bool isBinaryComment[GRK_NUM_COMMENTS_SUPPORTED]
Definition grok.h:429
_grk_header_info::singleTileDecompress
bool singleTileDecompress
Definition grok.h:371
_grk_header_info::irreversible
bool irreversible
1 : use the irreversible DWT 9-7, 0 : use lossless compression (default)
Definition grok.h:382
_grk_header_info::numlayers
uint16_t numlayers
number of layers
Definition grok.h:419
_grk_image_comp
Image component.
Definition grok.h:572
_grk_image_comp::h
uint32_t h
data height
Definition grok.h:582
_grk_image_comp::dy
uint8_t dy
YRsiz: vertical separation of a sample of component with respect to the reference grid.
Definition grok.h:588
_grk_image_comp::association
GRK_CHANNEL_ASSOC association
Definition grok.h:594
_grk_image_comp::type
GRK_CHANNEL_TYPE type
Definition grok.h:593
_grk_image_comp::dx
uint8_t dx
XRsiz: horizontal separation of a sample of component with respect to the reference grid.
Definition grok.h:585
_grk_image_comp::sgnd
bool sgnd
Definition grok.h:592
_grk_image_comp::w
uint32_t w
data width
Definition grok.h:578
_grk_image_comp::prec
uint8_t prec
precision
Definition grok.h:590
_grk_image_comp::Ycrg
uint16_t Ycrg
Definition grok.h:596
_grk_image_comp::data
int32_t * data
image component data
Definition grok.h:598
_grk_image_comp::x0
uint32_t x0
x component offset compared to the whole image
Definition grok.h:574
_grk_image_comp::Xcrg
uint16_t Xcrg
Definition grok.h:596
_grk_image_comp::y0
uint32_t y0
y component offset compared to the whole image
Definition grok.h:576
_grk_image_comp::stride
uint32_t stride
data stride
Definition grok.h:580
_grk_image_meta
Definition grok.h:603
_grk_image_meta::color
grk_color color
Definition grok.h:605
_grk_image_meta::xmp_buf
uint8_t * xmp_buf
Definition grok.h:608
_grk_image_meta::obj
grk_object obj
Definition grok.h:604
_grk_image_meta::xmp_len
size_t xmp_len
Definition grok.h:609
_grk_image_meta::iptc_len
size_t iptc_len
Definition grok.h:607
_grk_image_meta::iptc_buf
uint8_t * iptc_buf
Definition grok.h:606
_grk_image
Definition grok.h:613
_grk_image::decompressNumComps
uint16_t decompressNumComps
Definition grok.h:641
_grk_image::precision
grk_precision * precision
Definition grok.h:637
_grk_image::has_capture_resolution
bool has_capture_resolution
Definition grok.h:630
_grk_image::numcomps
uint16_t numcomps
number of components in the image
Definition grok.h:626
_grk_image::packedRowBytes
uint64_t packedRowBytes
Definition grok.h:649
_grk_image::y0
uint32_t y0
YOsiz: vertical offset from the origin of the reference grid to the top side of the image area.
Definition grok.h:620
_grk_image::color_space
GRK_COLOR_SPACE color_space
Definition grok.h:627
_grk_image::upsample
bool upsample
Definition grok.h:636
_grk_image::comps
grk_image_comp * comps
Definition grok.h:651
_grk_image::splitByComponent
bool splitByComponent
Definition grok.h:640
_grk_image::channelDefinitionApplied_
bool channelDefinitionApplied_
Definition grok.h:629
_grk_image::decompressWidth
uint32_t decompressWidth
Definition grok.h:642
_grk_image::interleavedData
grk_io_buf interleavedData
Definition grok.h:646
_grk_image::decompressColourSpace
GRK_COLOR_SPACE decompressColourSpace
Definition grok.h:645
_grk_image::hasMultipleTiles
bool hasMultipleTiles
Definition grok.h:639
_grk_image::x0
uint32_t x0
XOsiz: horizontal offset from the origin of the reference grid to the left side of the image area.
Definition grok.h:617
_grk_image::decompressPrec
uint8_t decompressPrec
Definition grok.h:644
_grk_image::obj
grk_object obj
Definition grok.h:614
_grk_image::numPrecision
uint32_t numPrecision
Definition grok.h:638
_grk_image::has_display_resolution
bool has_display_resolution
Definition grok.h:632
_grk_image::display_resolution
double display_resolution[2]
Definition grok.h:633
_grk_image::y1
uint32_t y1
Ysiz: height of the reference grid.
Definition grok.h:624
_grk_image::capture_resolution
double capture_resolution[2]
Definition grok.h:631
_grk_image::meta
grk_image_meta * meta
Definition grok.h:650
_grk_image::x1
uint32_t x1
Xsiz: width of the reference grid.
Definition grok.h:622
_grk_image::decompressFormat
GRK_SUPPORTED_FILE_FMT decompressFormat
Definition grok.h:634
_grk_image::forceRGB
bool forceRGB
Definition grok.h:635
_grk_image::rowsPerTask
uint32_t rowsPerTask
Definition grok.h:648
_grk_image::rowsPerStrip
uint32_t rowsPerStrip
Definition grok.h:647
_grk_image::decompressHeight
uint32_t decompressHeight
Definition grok.h:643
_grk_image::paletteApplied_
bool paletteApplied_
Definition grok.h:628
_grk_io_buf
Definition grok.h:436
_grk_io_buf::pooled_
bool pooled_
Definition grok.h:441
_grk_io_buf::offset_
size_t offset_
Definition grok.h:438
_grk_io_buf::allocLen_
size_t allocLen_
Definition grok.h:440
_grk_io_buf::data_
uint8_t * data_
Definition grok.h:437
_grk_io_buf::len_
size_t len_
Definition grok.h:439
_grk_io_buf::index_
uint32_t index_
Definition grok.h:442
_grk_io_init
Definition grok.h:446
_grk_io_init::maxPooledRequests_
uint32_t maxPooledRequests_
Definition grok.h:447
_grk_object
Grok ref-counted object.
Definition grok.h:126
_grk_object::wrapper
void * wrapper
Definition grok.h:127
_grk_palette_data
Palette data.
Definition grok.h:257
_grk_palette_data::component_mapping
grk_component_mapping_comp * component_mapping
Definition grok.h:260
_grk_palette_data::num_channels
uint8_t num_channels
Definition grok.h:261
_grk_palette_data::lut
int32_t * lut
Definition grok.h:258
_grk_palette_data::num_entries
uint16_t num_entries
Definition grok.h:259
_grk_palette_data::channel_sign
bool * channel_sign
Definition grok.h:262
_grk_palette_data::channel_prec
uint8_t * channel_prec
Definition grok.h:263
_grk_plugin_band
Plugin band.
Definition grok.h:700
_grk_plugin_band::stepsize
float stepsize
Definition grok.h:704
_grk_plugin_band::orientation
uint8_t orientation
Definition grok.h:701
_grk_plugin_band::numPrecincts
uint64_t numPrecincts
Definition grok.h:702
_grk_plugin_band::precincts
grk_plugin_precinct ** precincts
Definition grok.h:703
_grk_plugin_code_block
Plugin code block.
Definition grok.h:671
_grk_plugin_code_block::compressedData
uint8_t * compressedData
Definition grok.h:679
_grk_plugin_code_block::y0
uint32_t y0
Definition grok.h:675
_grk_plugin_code_block::numPasses
size_t numPasses
Definition grok.h:682
_grk_plugin_code_block::sortedIndex
unsigned int sortedIndex
Definition grok.h:684
_grk_plugin_code_block::numBitPlanes
uint8_t numBitPlanes
Definition grok.h:681
_grk_plugin_code_block::passes
grk_plugin_pass passes[67]
Definition grok.h:683
_grk_plugin_code_block::x0
uint32_t x0
Definition grok.h:675
_grk_plugin_code_block::contextStream
unsigned int * contextStream
Definition grok.h:676
_grk_plugin_code_block::y1
uint32_t y1
Definition grok.h:675
_grk_plugin_code_block::numPix
uint32_t numPix
Definition grok.h:678
_grk_plugin_code_block::x1
uint32_t x1
Definition grok.h:675
_grk_plugin_code_block::compressedDataLength
uint32_t compressedDataLength
Definition grok.h:680
_grk_plugin_decompress_callback_info
Definition grok.h:1457
_grk_plugin_decompress_callback_info::codec
grk_codec * codec
Definition grok.h:1466
_grk_plugin_decompress_callback_info::full_image_y0
uint32_t full_image_y0
Definition grok.h:1475
_grk_plugin_decompress_callback_info::decod_format
GRK_CODEC_FORMAT decod_format
Definition grok.h:1463
_grk_plugin_decompress_callback_info::error_code
unsigned int error_code
Definition grok.h:1472
_grk_plugin_decompress_callback_info::decompressor_parameters
grk_decompress_parameters * decompressor_parameters
Definition grok.h:1468
_grk_plugin_decompress_callback_info::header_info
grk_header_info header_info
Definition grok.h:1467
_grk_plugin_decompress_callback_info::cod_format
GRK_SUPPORTED_FILE_FMT cod_format
Definition grok.h:1465
_grk_plugin_decompress_callback_info::deviceId
size_t deviceId
Definition grok.h:1458
_grk_plugin_decompress_callback_info::tile
grk_plugin_tile * tile
Definition grok.h:1471
_grk_plugin_decompress_callback_info::full_image_x0
uint32_t full_image_x0
Definition grok.h:1474
_grk_plugin_decompress_callback_info::user_data
void * user_data
Definition grok.h:1476
_grk_plugin_decompress_callback_info::plugin_owns_image
bool plugin_owns_image
Definition grok.h:1470
_grk_plugin_decompress_callback_info::decompress_flags
uint32_t decompress_flags
Definition grok.h:1473
_grk_plugin_decompress_callback_info::output_file_name
const char * output_file_name
Definition grok.h:1461
_grk_plugin_decompress_callback_info::init_decompressors_func
GROK_INIT_DECOMPRESSORS init_decompressors_func
Definition grok.h:1459
_grk_plugin_decompress_callback_info::input_file_name
const char * input_file_name
Definition grok.h:1460
_grk_plugin_decompress_callback_info::image
grk_image * image
Definition grok.h:1469
_grk_plugin_init_info
Definition grok.h:1390
_grk_plugin_init_info::verbose
bool verbose
Definition grok.h:1392
_grk_plugin_init_info::deviceId
int32_t deviceId
Definition grok.h:1391
_grk_plugin_load_info
Definition grok.h:1342
_grk_plugin_load_info::pluginPath
const char * pluginPath
Definition grok.h:1343
_grk_plugin_pass
Plugin pass.
Definition grok.h:661
_grk_plugin_pass::rate
size_t rate
Definition grok.h:663
_grk_plugin_pass::length
size_t length
Definition grok.h:664
_grk_plugin_pass::distortionDecrease
double distortionDecrease
Definition grok.h:662
_grk_plugin_precinct
Plugin precinct.
Definition grok.h:691
_grk_plugin_precinct::blocks
grk_plugin_code_block ** blocks
Definition grok.h:693
_grk_plugin_precinct::numBlocks
uint64_t numBlocks
Definition grok.h:692
_grk_plugin_resolution
Plugin resolution.
Definition grok.h:711
_grk_plugin_resolution::numBands
size_t numBands
Definition grok.h:713
_grk_plugin_resolution::level
size_t level
Definition grok.h:712
_grk_plugin_resolution::band
grk_plugin_band ** band
Definition grok.h:714
_grk_plugin_tile
Plugin tile.
Definition grok.h:739
_grk_plugin_tile::decompress_flags
uint32_t decompress_flags
Definition grok.h:740
_grk_plugin_tile::tileComponents
grk_plugin_tile_component ** tileComponents
Definition grok.h:742
_grk_plugin_tile::numComponents
size_t numComponents
Definition grok.h:741
_grk_precision
Precision.
Definition grok.h:352
_grk_precision::mode
grk_precision_mode mode
Definition grok.h:354
_grk_precision::prec
uint8_t prec
Definition grok.h:353
_grk_progression
Progression order change.
Definition grok.h:135
_grk_progression::comp_temp
uint16_t comp_temp
Definition grok.h:166
_grk_progression::tx1
uint32_t tx1
Definition grok.h:143
_grk_progression::tp_txE
uint32_t tp_txE
Definition grok.h:161
_grk_progression::res_temp
uint8_t res_temp
Definition grok.h:167
_grk_progression::specifiedCompressionPocProg
GRK_PROG_ORDER specifiedCompressionPocProg
Definition grok.h:138
_grk_progression::tx0
uint32_t tx0
tile dimensions
Definition grok.h:141
_grk_progression::compE
uint16_t compE
Definition grok.h:147
_grk_progression::resS
uint8_t resS
Definition grok.h:148
_grk_progression::prec_temp
uint64_t prec_temp
Definition grok.h:168
_grk_progression::tp_tyE
uint32_t tp_tyE
Definition grok.h:163
_grk_progression::precE
uint64_t precE
Definition grok.h:151
_grk_progression::precS
uint64_t precS
Definition grok.h:150
_grk_progression::ty0
uint32_t ty0
Definition grok.h:142
_grk_progression::ty1
uint32_t ty1
Definition grok.h:144
_grk_progression::ty0_temp
uint32_t ty0_temp
Definition grok.h:171
_grk_progression::tpCompE
uint16_t tpCompE
Definition grok.h:155
_grk_progression::tp_tyS
uint32_t tp_tyS
Definition grok.h:162
_grk_progression::dy
uint32_t dy
Definition grok.h:165
_grk_progression::progression
GRK_PROG_ORDER progression
Definition grok.h:136
_grk_progression::dx
uint32_t dx
Definition grok.h:164
_grk_progression::layE
uint16_t layE
Definition grok.h:153
_grk_progression::layS
uint16_t layS
Definition grok.h:152
_grk_progression::progressionString
char progressionString[5]
Definition grok.h:137
_grk_progression::tpResE
uint8_t tpResE
Definition grok.h:157
_grk_progression::tx0_temp
uint32_t tx0_temp
Definition grok.h:170
_grk_progression::tileno
uint32_t tileno
Definition grok.h:139
_grk_progression::lay_temp
uint16_t lay_temp
Definition grok.h:169
_grk_progression::tpLayE
uint16_t tpLayE
Definition grok.h:159
_grk_progression::tpPrecE
uint64_t tpPrecE
Definition grok.h:158
_grk_progression::tpCompS
uint16_t tpCompS
Definition grok.h:154
_grk_progression::compS
uint16_t compS
progression order bounds specified by POC
Definition grok.h:146
_grk_progression::tp_txS
uint32_t tp_txS
Definition grok.h:160
_grk_progression::resE
uint8_t resE
Definition grok.h:149
_grk_progression::tpResS
uint8_t tpResS
Definition grok.h:156
_grk_raw_comp_cparameters
RAW component compress parameters.
Definition grok.h:176
_grk_raw_comp_cparameters::dy
uint8_t dy
subsampling in X direction
Definition grok.h:178
_grk_raw_comp_cparameters::dx
uint8_t dx
Definition grok.h:177
_grk_raw_cparameters
RAW image compress parameters.
Definition grok.h:184
_grk_raw_cparameters::prec
uint8_t prec
number of components of the raw image
Definition grok.h:188
_grk_raw_cparameters::width
uint32_t width
Definition grok.h:185
_grk_raw_cparameters::numcomps
uint16_t numcomps
height of the raw image
Definition grok.h:187
_grk_raw_cparameters::comps
grk_raw_comp_cparameters * comps
signed/unsigned raw image
Definition grok.h:190
_grk_raw_cparameters::sgnd
bool sgnd
bit depth of the raw image
Definition grok.h:189
_grk_raw_cparameters::height
uint32_t height
width of the raw image
Definition grok.h:186
_grk_stream_params
JPEG 2000 stream parameters - either file or buffer.
Definition grok.h:461
_grk_stream_params::buf
uint8_t * buf
Definition grok.h:466
_grk_stream_params::len
size_t len
Definition grok.h:467
_grk_stream_params::file
const char * file
Definition grok.h:463
grk_plugin_compress_user_callback_info
Definition grok.h:1401
grk_plugin_compress_user_callback_info::outputFileNameIsRelative
bool outputFileNameIsRelative
Definition grok.h:1403
grk_plugin_compress_user_callback_info::compressor_parameters
grk_cparameters * compressor_parameters
Definition grok.h:1405
grk_plugin_compress_user_callback_info::image
grk_image * image
Definition grok.h:1406
grk_plugin_compress_user_callback_info::tile
grk_plugin_tile * tile
Definition grok.h:1407
grk_plugin_compress_user_callback_info::output_file_name
const char * output_file_name
Definition grok.h:1404
grk_plugin_compress_user_callback_info::transferExifTags
bool transferExifTags
Definition grok.h:1410
grk_plugin_compress_user_callback_info::stream_params
grk_stream_params stream_params
Definition grok.h:1408
grk_plugin_compress_user_callback_info::error_code
unsigned int error_code
Definition grok.h:1409
grk_plugin_compress_user_callback_info::input_file_name
const char * input_file_name
Definition grok.h:1402
grk_plugin_tile_component
Plugin tile component.
Definition grok.h:721
grk_plugin_tile_component::resolutions
grk_plugin_resolution ** resolutions
Definition grok.h:723
grk_plugin_tile_component::numResolutions
size_t numResolutions
Definition grok.h:722