Grok 14.0.0
grok.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016-2024 Grok Image Compression Inc.
3 *
4 * This source code is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Affero General Public License, version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This source code is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Affero General Public License for more details.
12 *
13 * You should have received a copy of the GNU Affero General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 *
17 * This source code incorporates work covered by the BSD 2-clause license.
18 * Please see the LICENSE file in the root directory for details.
19 *
20 */
21#pragma once
22
23#include <stdint.h>
24#include <stdio.h>
25#include <stdbool.h>
26#include <limits.h>
27
28#ifndef SWIG
29#ifdef __cplusplus
30extern "C" {
31#endif
32#endif
33
34#include "grk_config.h"
35
36#ifndef SWIG
37#ifdef _WIN32
38#define GRK_CALLCONV __stdcall
39#ifdef GRK_STATIC
40#define GRK_API
41#else
42#ifdef GRK_EXPORTS
43#define GRK_API __declspec(dllexport)
44#else
45#define GRK_API __declspec(dllimport)
46#endif
47#endif
48#else
49#define GRK_CALLCONV
50#ifdef GRK_STATIC
51#define GRK_API __attribute__((visibility("hidden")))
52#else
53#define GRK_API __attribute__((visibility("default")))
54#endif
55#endif
56#else
57#define GRK_CALLCONV
58#define GRK_API
59#endif
60
75
92
98{
99 GRK_ENUM_CLRSPC_UNKNOWN = 0xFFFFFFFF, /* unknown */
100 GRK_ENUM_CLRSPC_BILEVEL1 = 0, /* bilevel 1 */
101 GRK_ENUM_CLRSPC_YCBCR1 = 1, /* YCbCr 4:2:2 */
102 GRK_ENUM_CLRSPC_YCBCR2 = 3, /* YCbCr 4:4:4 */
103 GRK_ENUM_CLRSPC_YCBCR3 = 4, /* YCbCr 4:2:0 */
104 GRK_ENUM_CLRSPC_PHOTO_YCC = 9, /* Kodak PhotoYCC */
105 GRK_ENUM_CLRSPC_CMY = 11, /* cyan, magenta, yellow */
106 GRK_ENUM_CLRSPC_CMYK = 12, /* cyan, magenta, yellow, black */
107 GRK_ENUM_CLRSPC_YCCK = 13, /* YCCK */
108 GRK_ENUM_CLRSPC_CIE = 14, /* CIE Lab (L*, a*, b*) */
109 GRK_ENUM_CLRSPC_BILEVEL2 = 15, /* bilevel 2 */
110 GRK_ENUM_CLRSPC_SRGB = 16, /* sRGB */
111 GRK_ENUM_CLRSPC_GRAY = 17, /* grayscale */
112 GRK_ENUM_CLRSPC_SYCC = 18, /* standard YCC */
113 GRK_ENUM_CLRSPC_CIEJAB = 19, /* CIEJAB */
114 GRK_ENUM_CLRSPC_ESRGB = 20, /* e-sRGB */
115 GRK_ENUM_CLRSPC_ROMMRGB = 21, /* Reference Output Medium Metric RGB */
116 GRK_ENUM_CLRSPC_YPBPR60 = 22, /* YPbPr 60 */
117 GRK_ENUM_CLRSPC_YPBPR50 = 23, /* YPbPr 50 */
118 GRK_ENUM_CLRSPC_EYCC = 24, /* extended YCC */
120
124#define GRK_NUM_COMMENTS_SUPPORTED 256
125
129#define GRK_NUM_ASOC_BOXES_SUPPORTED 256
130
134#define GRK_MAX_COMMENT_LENGTH (UINT16_MAX - 2)
135
139#define GRK_MAX_SUPPORTED_IMAGE_PRECISION 16
140
157#define GRK_BIBO_EXTRA_BITS 7
158
162#define GRK_MAX_PASSES (3 * (GRK_MAX_SUPPORTED_IMAGE_PRECISION + GRK_BIBO_EXTRA_BITS) - 2)
163
170typedef void (*grk_msg_callback)(const char* msg, void* client_data);
171
192
198typedef struct _grk_object
199{
200 void* wrapper; /* opaque wrapper */
202
208typedef struct _grk_progression
209{
210 GRK_PROG_ORDER progression; /* progression */
211 char progression_str[5]; /* progression as string */
212 GRK_PROG_ORDER specified_compression_poc_prog; /* specified compression POC progression */
213 uint32_t tileno; /* tile number */
214
216 uint32_t tx0; /* tile x0 */
217 uint32_t ty0; /* tile y0 */
218 uint32_t tx1; /* tile x1 */
219 uint32_t ty1; /* tile y1 */
220
222 uint16_t comp_s; /* component start */
223 uint16_t comp_e; /* component end */
224 uint8_t res_s; /* resolution start */
225 uint8_t res_e; /* resolution end */
226 uint64_t prec_s; /* precinct start */
227 uint64_t prec_e; /* precinct end */
228 uint16_t lay_s; /* layer start */
229 uint16_t lay_e; /* layer end */
230 uint16_t tp_comp_s; /* tile part component start */
231 uint16_t tp_comp_e; /* tile part component end */
232 uint8_t tp_res_s; /* tile part resolution start */
233 uint8_t tp_res_e; /* tile part resolution end */
234 uint64_t tp_prec_e; /* tile part precinct end */
235 uint16_t tp_lay_e; /* tile part layer end */
236 uint32_t tp_tx_s; /* tile part x start */
237 uint32_t tp_tx_e; /* tile part x end */
238 uint32_t tp_ty_s; /* tile part y start */
239 uint32_t tp_ty_e; /* tile part y end */
240 uint32_t dx; /* dx */
241 uint32_t dy; /* dy */
242 uint16_t comp_temp; /* component temp */
243 uint8_t res_temp; /* resolution temp */
244 uint64_t prec_temp; /* precinct temp */
245 uint16_t lay_temp; /* layer temp */
246 uint32_t tx0_temp; /* x0 temp */
247 uint32_t ty0_temp; /* y0 temp */
249
259
273
285
290{
291 GRK_FMT_UNK, /* unknown format */
292 GRK_FMT_J2K, /* J2K */
293 GRK_FMT_JP2, /* JP2 */
294 GRK_FMT_PXM, /* PXM */
295 GRK_FMT_PGX, /* PGX */
296 GRK_FMT_PAM, /* PAM */
297 GRK_FMT_BMP, /* BMP */
298 GRK_FMT_TIF, /* TIF */
299 GRK_FMT_RAW, /* RAW Big Endian */
300 GRK_FMT_PNG, /* PNG */
301 GRK_FMT_RAWL, /* RAW Little Endian */
302 GRK_FMT_JPG, /* JPG */
303 GRK_FMT_YUV /* YUV */
305
316
317#define GRK_PATH_LEN 4096 /* Maximum allowed filename size */
318#define GRK_MAX_LAYERS 256 /* Grok maximum number of quality layers */
319
320/*
321 * Note: range for number of decomposition levels is 0-32
322 * So, accordingly, range for number of resolutions is 1-33
323 */
324#define GRK_MAX_DECOMP_LVLS \
325 32 /* Maximum number of decomposition levels allowed by standard \
326 */
327#define GRK_MAXRLVLS \
328 (GRK_MAX_DECOMP_LVLS + 1) /* Maximum number of resolution levels allowed by standard*/
329#define GRK_MAXBANDS (3 * GRK_MAXRLVLS - 2) /* Maximum number of sub-bands allowed by standard */
330
340typedef struct _grk_component_mapping_comp
342 uint16_t component; /* component index */
343 uint8_t mapping_type; /* mapping type */
344 uint8_t palette_column; /* palette column */
346
351typedef struct _grk_palette_data
353 int32_t* lut; /* LUT */
354 uint16_t num_entries; /* number of entries */
356 uint8_t num_channels; /* number of channels */
357 bool* channel_sign; /* channel sign */
358 uint8_t* channel_prec; /* channel precision */
360
361/***
362 * Channel Definition box structures and enums.
363 * When no Component mapping box is present, it is still possible to have
364 * a Channel defintion box, in which case channels are associated with components
365 * in the obvious way : channel `k` corresponds to component `k`.
366 * */
367
368/* @brief Channel type */
369typedef enum _GRK_CHANNEL_TYPE
371 GRK_CHANNEL_TYPE_COLOUR = 0, /* colour */
372 GRK_CHANNEL_TYPE_OPACITY = 1, /* opacity */
373 GRK_CHANNEL_TYPE_PREMULTIPLIED_OPACITY = 2, /* premultiplied opacity */
374 GRK_CHANNEL_TYPE_UNSPECIFIED = 65535U /* unspecified */
377
381typedef enum _GRK_CHANNEL_ASSOC
382{
384 GRK_CHANNEL_ASSOC_WHOLE_IMAGE = 0, /* whole image */
385 GRK_CHANNEL_ASSOC_COLOUR_1 = 1, /* colour 1 */
386 GRK_CHANNEL_ASSOC_COLOUR_2 = 2, /* colour 2 */
387 GRK_CHANNEL_ASSOC_COLOUR_3 = 3, /* colour 3 */
388 GRK_CHANNEL_ASSOC_UNASSOCIATED = 65535U /* unassociated */
391
396typedef struct _grk_channel_description
398 uint16_t channel; /* channel */
399 uint16_t typ; /* type */
400 uint16_t asoc; /* association */
402
407typedef struct _grk_channel_definition
410 uint16_t num_channel_descriptions; /* number of channel descriptions */
412
417typedef struct _grk_asoc
419 uint32_t level; /* level: 0 for root level */
420 const char* label; /* label */
421 uint8_t* xml; /* xml */
422 uint32_t xml_len; /* xml length */
423} grk_asoc;
424
429typedef enum _grk_precision_mode
431 GRK_PREC_MODE_CLIP, /* clip */
434
439typedef struct _grk_precision
441 uint8_t prec; /* precision */
444
449typedef struct _grk_progression_state
453 uint16_t numcomps;
454 uint16_t comp[256];
456 uint16_t tile_index;
458
463typedef struct _grk_io_buf
465 uint8_t* data; /* data */
466 size_t offset; /* offset */
467 size_t len; /* length */
468 size_t alloc_len; /* allocated length */
469 bool pooled; /* pooled */
470 uint32_t index; /* index */
471} grk_io_buf;
472
477typedef struct _grk_io_init
479 uint32_t max_pooled_requests; /* max pooled requests */
482
490typedef bool (*grk_io_callback)(uint32_t thread_id, grk_io_buf buffer, void* io_user_data);
491
500typedef void (*grk_io_register_reclaim_callback)(grk_io_init io_init,
501 grk_io_callback reclaim_callback,
502 void* io_user_data, void* reclaim_user_data);
503
511typedef bool (*grk_io_pixels_callback)(uint32_t thread_id, grk_io_buf buffer, void* user_data);
512
521typedef size_t (*grk_stream_read_fn)(uint8_t* buffer, size_t numBytes, void* user_data);
522
531typedef size_t (*grk_stream_write_fn)(const uint8_t* buffer, size_t numBytes, void* user_data);
532
540typedef bool (*grk_stream_seek_fn)(uint64_t offset, void* user_data);
541
548typedef void (*grk_stream_free_user_data_fn)(void* user_data);
549
559typedef struct _grk_stream_params
560{
561 /* 1. File */
562 const char* file; /* file */
563
564 /* 2. Buffer */
565 uint8_t* buf; /* buffer */
566 size_t buf_len; /* buffer length */
567 /* length of compressed stream (set by compressor, not client) */
568 size_t buf_compressed_len; /* buffer compressed length */
569
570 /* 3. Callback */
571 grk_stream_read_fn read_fn; /* read function */
572 grk_stream_write_fn write_fn; /* write function */
573 grk_stream_seek_fn seek_fn; /* seek function */
575 void* user_data; /* user data */
576 size_t stream_len; /* must be set for read stream */
577 size_t double_buffer_len; /* optional - default value is 1024 * 1024 */
579
583typedef enum _GRK_TILE_CACHE_STRATEGY
585 GRK_TILE_CACHE_NONE, /* no tile caching */
586 GRK_TILE_CACHE_IMAGE, /* cache final tile image */
587 GRK_TILE_CACHE_ALL /* cache everything */
589
594typedef struct _grk_decompress_core_params
595{
603 uint8_t reduce; /* reduce */
610 uint16_t layers_to_decompress; /* layers to decompress */
611 GRK_TILE_CACHE_STRATEGY tile_cache_strategy; /* tile cache strategy */
613 uint32_t random_access_flags; /* random access flags */
616 void* io_user_data; /* IO user data */
619
625#define GRK_DECOMPRESS_COMPRESSION_LEVEL_DEFAULT (UINT_MAX)
626
631typedef struct _grk_decompress_params
632{
636 char infile[GRK_PATH_LEN]; /* input file */
638 char outfile[GRK_PATH_LEN]; /* output file */
640 GRK_CODEC_FORMAT decod_format; /* decode format */
642 GRK_SUPPORTED_FILE_FMT cod_format; /* code format */
644 double dw_x0; /* decompress window x0 */
646 double dw_x1; /* decompress window x1 */
648 double dw_y0; /* decompress window y0 */
650 double dw_y1; /* decompress window y1 */
652 uint16_t tile_index; /* tile index */
653 bool single_tile_decompress; /* single tile decompress */
654 grk_precision* precision; /* precision */
655 uint32_t num_precision; /* number of precision */
656 /* force output colorspace to RGB */
657 bool force_rgb; /* force RGB */
658 /* upsample components according to their dx/dy values */
659 bool upsample; /* upsample */
660 /* split output components to different files */
661 bool split_pnm; /* split PNM */
662 /* serialize XML metadata to disk */
663 bool io_xml; /* IO XML */
664 uint32_t compression; /* compression */
665 /*****************************************************
666 compression "quality". Meaning of "quality" depends
667 on file format we are writing to
668 *****************************************************/
669 uint32_t compression_level; /* compression level */
671 bool verbose; /* verbose */
672 int32_t device_id; /* device ID */
673 uint32_t duration; /* in seconds */
674 uint32_t kernel_build_options; /* kernel build options */
675 uint32_t repeats; /* repeats */
676 uint32_t num_threads; /* number of threads */
677 void* user_data; /* user data */
679
684typedef struct _grk_image_comp
685{
687 uint32_t x0; /* x0 */
689 uint32_t y0; /* y0 */
691 uint32_t w; /* width */
693 uint32_t stride; /* stride */
695 uint32_t h; /* height */
698 uint8_t dx; /* dx */
701 uint8_t dy; /* dy */
703 uint8_t prec; /* precision */
704 /* signed */
705 bool sgnd; /* signed */
707 GRK_CHANNEL_ASSOC association; /* association */
708 /* component registration coordinates */
709 uint16_t crg_x, crg_y; /* CRG x and y */
711 int32_t* data; /* data */
713
718typedef struct _grk_color
720 uint8_t* icc_profile_buf; /* ICC profile buffer */
721 uint32_t icc_profile_len; /* ICC profile length */
722 char* icc_profile_name; /* ICC profile name */
724 grk_palette_data* palette; /* palette */
725 bool has_colour_specification_box; /* has colour specification box */
726} grk_color;
727
732typedef struct _grk_image_meta
734 grk_object obj; /* object */
735 grk_color color; /* color */
736 uint8_t* iptc_buf; /* IPTC buffer */
737 size_t iptc_len; /* IPTC length */
738 uint8_t* xmp_buf; /* XMP buffer */
739 size_t xmp_len; /* XMP length */
741
749typedef struct _grk_image
751 grk_object obj; /* object */
754 uint32_t x0; /* x0 */
757 uint32_t y0; /* y0 */
759 uint32_t x1; /* x1 */
761 uint32_t y1; /* y1 */
763 uint16_t numcomps; /* number of components */
764 GRK_COLOR_SPACE color_space; /* color space */
765 bool palette_applied; /* palette applied */
766 bool channel_definition_applied; /* channel definition applied */
767 bool has_capture_resolution; /* has capture resolution */
768 double capture_resolution[2]; /* capture resolution */
769 bool has_display_resolution; /* has display resolution */
770 double display_resolution[2]; /* display resolution */
771 GRK_SUPPORTED_FILE_FMT decompress_fmt; /* decompress format */
772 bool force_rgb; /* force RGB */
773 bool upsample; /* upsample */
774 grk_precision* precision; /* precision */
775 uint32_t num_precision; /* number of precision */
776 bool has_multiple_tiles; /* has multiple tiles */
777 bool split_by_component; /* split by component */
778 uint16_t decompress_num_comps; /* decompress number of components */
779 uint32_t decompress_width; /* decompress width */
780 uint32_t decompress_height; /* decompress height */
781 uint8_t decompress_prec; /* decompress precision */
782 GRK_COLOR_SPACE decompress_colour_space; /* decompress colour space */
783 grk_io_buf interleaved_data; /* interleaved data */
784 uint32_t rows_per_strip; /* for storage to output format */
785 uint32_t rows_per_task; /* for scheduling */
786 uint64_t packed_row_bytes; /* packed row bytes */
787 grk_image_meta* meta; /* meta */
788 grk_image_comp* comps; /* components */
789} grk_image;
790
795typedef struct _grk_header_info
796{
797 /******************************************
798 set by client only if decompressing to file
799 *******************************************/
800 GRK_SUPPORTED_FILE_FMT decompress_fmt; /* decompress format */
801 bool force_rgb; /* force RGB */
802 bool upsample; /* upsample */
803 grk_precision* precision; /* precision */
804 uint32_t num_precision; /* number of precision */
805 bool split_by_component; /* split by component */
806 bool single_tile_decompress; /* single tile decompress */
807 /****************************************/
808
809 /*****************************************
810 populated by library after reading header
811 ******************************************/
814 uint32_t cblockw_init; /* initial code block width */
816 uint32_t cblockh_init; /* initial code block height */
818 bool irreversible; /* irreversible */
820 uint8_t mct; /* multi-component transform */
823 uint16_t rsiz; /* RSIZ */
825 uint8_t numresolutions; /* number of resolutions */
826 /*********************************************************
827 coding style can be specified in main header COD segment,
828 tile header COD segment, and tile component COC segment.
829 *********************************************************/
830 /* !!!! assume that coding style does not vary across tile components */
831 uint8_t csty; /* coding style */
832 /*******************************************************************
833 code block style is specified in main header COD segment, and can
834 be overridden in a tile header. !!! Assume that style does
835 not vary across tiles !!!
836 *******************************************************************/
837 uint8_t cblk_sty; /* code block style */
839 uint32_t prcw_init[GRK_MAXRLVLS]; /* initial precinct width */
841 uint32_t prch_init[GRK_MAXRLVLS]; /* initial precinct height */
843 uint32_t tx0; /* tx0 */
845 uint32_t ty0; /* ty0 */
847 uint32_t t_width; /* tile width */
849 uint32_t t_height; /* tile height */
851 uint16_t t_grid_width; /* tile grid width */
853 uint16_t t_grid_height; /* tile grid height */
855 uint16_t num_layers;
856 /*************************************
857 * note: xml_data will remain valid
858 * until codec is destroyed
859 ************************************/
860 uint8_t* xml_data; /* XML data */
861 size_t xml_data_len; /* XML data length */
862 size_t num_comments; /* number of comments */
864 uint16_t comment_len[GRK_NUM_COMMENTS_SUPPORTED]; /* comment length */
865 bool is_binary_comment[GRK_NUM_COMMENTS_SUPPORTED]; /* is binary comment */
868 uint32_t num_asocs; /* number of associations */
870
875typedef struct _grk_plugin_pass
877 double distortion_decrease; /* distortion decrease up to and including this pass */
878 size_t rate; /* rate up to and including this pass */
879 size_t length; /* stream length for this pass */
881
886typedef struct _grk_plugin_code_block
887{
888 /**************************
889 debug info
890 **************************/
891 uint32_t x0, y0, x1, y1; /* x0, y0, x1, y1 */
892 unsigned int* context_stream; /* context stream */
893 /***************************/
894 uint32_t num_pix; /* number of pixels */
895 uint8_t* compressed_data; /* compressed data */
896 uint32_t compressed_data_length; /* compressed data length */
897 uint8_t num_bit_planes; /* number of bit planes */
898 uint8_t num_passes; /* number of passes */
900 unsigned int sorted_index; /* sorted index */
902
907typedef struct _grk_plugin_precinct
909 uint64_t num_blocks; /* number of blocks */
912
917typedef struct _grk_plugin_band
919 uint8_t orientation; /* orientation */
920 uint64_t num_precincts; /* number of precincts */
922 float stepsize; /* stepsize */
924
929typedef struct _grk_plugin_resolution
931 uint8_t level; /* level */
932 uint8_t num_bands; /* number of bands */
933 grk_plugin_band** band; /* band */
935
940typedef struct grk_plugin_tile_component
942 uint8_t numresolutions; /* number of resolutions */
946#define GRK_DECODE_HEADER (1 << 0)
947#define GRK_DECODE_T2 (1 << 1)
948#define GRK_DECODE_T1 (1 << 2)
949#define GRK_DECODE_POST_T1 (1 << 3)
950#define GRK_PLUGIN_DECODE_CLEAN (1 << 4)
951#define GRK_DECODE_ALL \
952 (GRK_PLUGIN_DECODE_CLEAN | GRK_DECODE_HEADER | GRK_DECODE_T2 | GRK_DECODE_T1 | \
953 GRK_DECODE_POST_T1)
954
959typedef struct _grk_plugin_tile
961 uint32_t decompress_flags; /* decompress flags */
962 uint16_t num_components; /* number of components */
965
969GRK_API const char* GRK_CALLCONV grk_version(void);
970
978GRK_API bool GRK_CALLCONV grk_initialize(const char* pluginPath, uint32_t num_threads,
979 bool verbose);
980
985
992
993/*
994 * @brief Decrements ref count
995 *
996 * @param obj Grok object (see @ref grk_object)
997 *
998 */
1000
1008
1019GRK_API grk_image* GRK_CALLCONV grk_image_new(uint16_t numcmpts, grk_image_comp* cmptparms,
1020 GRK_COLOR_SPACE clrspc, bool alloc_data);
1021
1027
1039GRK_API bool GRK_CALLCONV grk_decompress_detect_format(const char* file_name,
1040 GRK_CODEC_FORMAT* fmt);
1041
1048
1061
1070 grk_object* codec);
1071
1081 grk_decompress_get_progression_state(grk_object* codec, uint16_t tile_index);
1082
1091 grk_progression_state state);
1092
1103 grk_header_info* header_info);
1104
1114 uint16_t tile_index);
1115
1124
1140GRK_API bool GRK_CALLCONV grk_decompress_set_window(grk_object* codec, double start_x,
1141 double start_y, double end_x, double end_y);
1142
1152
1161GRK_API bool GRK_CALLCONV grk_decompress_tile(grk_object* codec, uint16_t tile_index);
1162
1163/* COMPRESSION FUNCTIONS*/
1164
1165/*
1166 * @struct grk_synthesis
1167 * @ brief compressed image synthesis parameters
1169typedef struct _grk_synthesis
1171 bool do_synthesis; /* do synthesis */
1172 uint32_t width; /* width */
1173 uint32_t height; /* height */
1174 uint8_t precision; /* precision */
1175 uint16_t numcomps; /* number of components */
1177
1183typedef struct _grk_cparameters
1185 bool tile_size_on; /* tile size on */
1187 uint32_t tx0; /* tx0 */
1189 uint32_t ty0; /* ty0 */
1191 uint32_t t_width; /* tile width */
1193 uint32_t t_height; /* tile height */
1195 uint16_t numlayers; /* number of layers */
1197 bool allocation_by_rate_distortion; /* allocation by rate distortion */
1200 double layer_rate[GRK_MAX_LAYERS]; /* layer rate */
1202 bool allocation_by_quality; /* allocation by quality */
1204 double layer_distortion[GRK_MAX_LAYERS]; /* layer distortion */
1206 uint16_t comment_len[GRK_NUM_COMMENTS_SUPPORTED]; /* comment length */
1207 bool is_binary_comment[GRK_NUM_COMMENTS_SUPPORTED]; /* is binary comment */
1208 size_t num_comments; /* number of comments */
1210 uint8_t csty; /* coding style */
1211 /* number of guard bits */
1212 uint8_t numgbits; /* number of guard bits */
1214 GRK_PROG_ORDER prog_order; /* progression order */
1216 grk_progression progression[GRK_MAXRLVLS]; /* progression */
1218 uint32_t numpocs; /* number of POCs */
1220 uint8_t numresolution; /* number of resolutions */
1222 uint32_t cblockw_init; /* code block width */
1224 uint32_t cblockh_init; /* code block height */
1226 uint8_t cblk_sty; /* code block style */
1229 bool irreversible; /* irreversible */
1232 int32_t roi_compno; /* ROI component number */
1234 uint32_t roi_shift; /* ROI shift */
1235 /* number of precinct size specifications */
1236 uint32_t res_spec; /* res spec */
1238 uint32_t prcw_init[GRK_MAXRLVLS]; /* precinct width */
1240 uint32_t prch_init[GRK_MAXRLVLS]; /* precinct height */
1242 char infile[GRK_PATH_LEN]; /* input file */
1244 char outfile[GRK_PATH_LEN]; /* output file */
1246 uint32_t image_offset_x0; /* image offset x0 */
1248 uint32_t image_offset_y0; /* image offset y0 */
1250 uint8_t subsampling_dx; /* subsampling dx */
1252 uint8_t subsampling_dy; /* subsampling dy */
1254 GRK_SUPPORTED_FILE_FMT decod_format; /* decode format */
1257 grk_raw_cparameters raw_cp; /* raw parameters */
1259 bool enable_tile_part_generation; /* enable tile part generation */
1261 uint8_t new_tile_part_progression_divider; /* new tile part progression divider */
1263 uint8_t mct; /* MCT */
1266 void* mct_data; /* MCT data */
1273 uint64_t max_cs_size; /* max code stream size */
1278 uint64_t max_comp_size; /* max component size */
1281 uint16_t rsiz; /* RSIZ */
1282 uint16_t framerate; /* frame rate */
1283
1284 /* set to true if input file stores capture resolution */
1285 bool write_capture_resolution_from_file; /* write capture resolution from file */
1286 double capture_resolution_from_file[2]; /* capture resolution from file */
1288 bool write_capture_resolution; /* write capture resolution */
1289 double capture_resolution[2]; /* capture resolution */
1291 bool write_display_resolution; /* write display resolution */
1292 double display_resolution[2]; /* display resolution */
1294 bool apply_icc; /* apply ICC */
1297 uint32_t num_threads; /* number of threads */
1298 int32_t device_id; /* device ID */
1299 uint32_t duration; /* duration seconds */
1300 uint32_t kernel_build_options; /* kernel build options */
1301 uint32_t repeats; /* repeats */
1302 bool write_plt; /* write PLT */
1303 bool write_tlm; /* write TLM */
1304 bool verbose; /* verbose */
1305 bool shared_memory_interface; /* shared memory interface */
1306 grk_synthesis synth; /* synthesis */
1308
1329
1340 grk_cparameters* parameters, grk_image* image);
1350
1359GRK_API void GRK_CALLCONV grk_dump_codec(grk_object* codec, uint32_t info_flag,
1360 FILE* output_stream);
1361
1372GRK_API bool GRK_CALLCONV grk_set_MCT(grk_cparameters* parameters, float* encoding_matrix,
1373 int32_t* dc_shift, uint32_t nb_comp);
1375#define GRK_IMG_INFO 1 /* Basic image information provided to the user */
1376#define GRK_MH_INFO 2 /* Codestream information based only on the main header */
1377#define GRK_TH_INFO 4 /* Tile information based on the current tile header */
1378#define GRK_TCH_INFO 8
1379#define GRK_MH_IND 16
1380#define GRK_TH_IND 32
1382#define GRK_CBLKSTY_LAZY 0x01
1383#define GRK_CBLKSTY_RESET 0x02
1384#define GRK_CBLKSTY_TERMALL 0x04
1385#define GRK_CBLKSTY_VSC 0x08
1386#define GRK_CBLKSTY_PTERM 0x10
1387#define GRK_CBLKSTY_SEGSYM 0x20
1388#define GRK_CBLKSTY_HT_ONLY 0x40
1389#define GRK_CBLKSTY_HT_MIXED 0xC0
1390#define GRK_JPH_RSIZ_FLAG 0x4000
1392/*****************************************************************************
1393 * JPEG 2000 Profiles, see Table A.10 from 15444-1 (updated in various AMDs)
1394 *
1395 * These values help choose the RSIZ value for the JPEG 2000 code stream.
1396 * The RSIZ value forces various compressing options, as detailed in Table A.10.
1397 * If GRK_PROFILE_PART2 is chosen, it must be combined with one or more extensions
1398 * described below.
1399 *
1400 * Example: rsiz = GRK_PROFILE_PART2 | GRK_EXTENSION_MCT;
1401 *
1402 * For broadcast profiles, the GRK_PROFILE_X value has to be combined with the target
1403 * level (3-0 LSB, value between 0 and 11):
1404 * Example: rsiz = GRK_PROFILE_BC_MULTI | 0x0005; //level equals 5
1405 *
1406 * For IMF profiles, the GRK_PROFILE_X value has to be combined with the target main-level
1407 * (3-0 LSB, value between 0 and 11) and sub-level (7-4 LSB, value between 0 and 9):
1408 * Example: rsiz = GRK_PROFILE_IMF_2K | 0x0040 | 0x0005; // main-level equals 5 and sub-level
1409 * equals 4
1410 *
1411 * */
1412#define GRK_PROFILE_NONE 0x0000
1413#define GRK_PROFILE_0 0x0001
1414#define GRK_PROFILE_1 0x0002
1415#define GRK_PROFILE_CINEMA_2K 0x0003
1416#define GRK_PROFILE_CINEMA_4K 0x0004
1417#define GRK_PROFILE_CINEMA_S2K 0x0005
1418#define GRK_PROFILE_CINEMA_S4K 0x0006
1419#define GRK_PROFILE_CINEMA_LTS \
1420 0x0007
1421#define GRK_PROFILE_BC_SINGLE 0x0100
1422#define GRK_PROFILE_BC_MULTI 0x0200
1423#define GRK_PROFILE_BC_MULTI_R \
1424 0x0300
1425#define GRK_PROFILE_BC_MASK 0x030F
1426#define GRK_PROFILE_IMF_2K 0x0400
1427#define GRK_PROFILE_IMF_4K 0x0500
1428#define GRK_PROFILE_IMF_8K 0x0600
1429#define GRK_PROFILE_IMF_2K_R \
1430 0x0700
1431#define GRK_PROFILE_IMF_4K_R \
1432 0x0800
1433#define GRK_PROFILE_IMF_8K_R \
1434 0x0900
1435#define GRK_PROFILE_MASK 0x0FFF
1436#define GRK_PROFILE_PART2 0x8000
1437#define GRK_PROFILE_PART2_EXTENSIONS_MASK 0x3FFF /* Mask for Part-2 extension bits */
1438
1442#define GRK_EXTENSION_NONE 0x0000
1443#define GRK_EXTENSION_MCT 0x0100
1444#define GRK_IS_PART2(v) ((v) & GRK_PROFILE_PART2)
1446#define GRK_IS_CINEMA(v) (((v) >= GRK_PROFILE_CINEMA_2K) && ((v) <= GRK_PROFILE_CINEMA_S4K))
1447#define GRK_IS_STORAGE(v) ((v) == GRK_PROFILE_CINEMA_LTS)
1448
1449/*
1450 *
1451 * *********************************************
1452 * Broadcast level (3-0 LSB) (15444-1 AMD4,AMD8)
1453 * *********************************************
1454 *
1455 * indicates maximum bit rate and sample rate for a code stream
1456 *
1457 * Note: Mbit/s == 10^6 bits/s; Msamples/s == 10^6 samples/s
1458 *
1459 * 0: no maximum rate
1460 * 1: 200 Mbits/s, 65 Msamples/s
1461 * 2: 200 Mbits/s, 130 Msamples/s
1462 * 3: 200 Mbits/s, 195 Msamples/s
1463 * 4: 400 Mbits/s, 260 Msamples/s
1464 * 5: 800Mbits/s, 520 Msamples/s
1465 * >= 6: 2^(level-6) * 1600 Mbits/s, 2^(level-6) * 1200 Msamples/s
1466 *
1467 * Note: level cannot be greater than 11
1468 *
1469 * ****************
1470 * Broadcast tiling
1471 * ****************
1472 *
1473 * Either single-tile or multi-tile. Multi-tile only permits
1474 * 1 or 4 tiles per frame, where multiple tiles have identical
1475 * sizes, and are configured in either 2x2 or 1x4 layout.
1476 *
1477 *************************************************************
1478 *
1479 * ***************************************
1480 * IMF main-level (3-0) LSB (15444-1 AMD8)
1481 * ***************************************
1482 *
1483 * main-level indicates maximum number of samples per second,
1484 * as listed above.
1485 *
1486 *
1487 * **************************************
1488 * IMF sub-level (7-4) LSB (15444-1 AMD8)
1489 * **************************************
1490 *
1491 * sub-level indicates maximum bit rate for a code stream:
1492 *
1493 * 0: no maximum rate
1494 * >0: 2^sub-level * 100 Mbits/second
1495 *
1496 * Note: sub-level cannot be greater than 9, and cannot be larger
1497 * then maximum of (main-level -2) and 1.
1498 *
1499 */
1501#define GRK_GET_IMF_OR_BROADCAST_PROFILE(v) \
1502 ((v) & 0x0f00)
1504#define GRK_LEVEL_MAX 11U
1505#define GRK_GET_LEVEL(v) ((v) & 0xf)
1507/******* BROADCAST **********************************************************/
1509#define GRK_IS_BROADCAST(v) \
1510 (((v) >= GRK_PROFILE_BC_SINGLE) && ((v) <= (GRK_PROFILE_BC_MULTI_R | 0x000b)) && \
1511 (((v) & 0xf) <= 0xb))
1512
1513/* Maximum component sampling Rate (Mbits/sec) per level */
1514#define GRK_BROADCAST_LEVEL_1_MBITSSEC 200U
1515#define GRK_BROADCAST_LEVEL_2_MBITSSEC 200U
1516#define GRK_BROADCAST_LEVEL_3_MBITSSEC 200U
1517#define GRK_BROADCAST_LEVEL_4_MBITSSEC 400U
1518#define GRK_BROADCAST_LEVEL_5_MBITSSEC 800U
1519#define GRK_BROADCAST_LEVEL_6_MBITSSEC 1600U
1520#define GRK_BROADCAST_LEVEL_7_MBITSSEC 3200U
1521#define GRK_BROADCAST_LEVEL_8_MBITSSEC 6400U
1522#define GRK_BROADCAST_LEVEL_9_MBITSSEC 12800U
1523#define GRK_BROADCAST_LEVEL_10_MBITSSEC 25600U
1524#define GRK_BROADCAST_LEVEL_11_MBITSSEC 51200U
1526#define GRK_BROADCAST_LEVEL_1_MSAMPLESSEC 64U
1527#define GRK_BROADCAST_LEVEL_2_MSAMPLESSEC 130U
1528#define GRK_BROADCAST_LEVEL_3_MSAMPLESSEC 195U
1529#define GRK_BROADCAST_LEVEL_4_MSAMPLESSEC 260U
1530#define GRK_BROADCAST_LEVEL_5_MSAMPLESSEC 520U
1531#define GRK_BROADCAST_LEVEL_6_MSAMPLESSEC 1200U
1532#define GRK_BROADCAST_LEVEL_7_MSAMPLESSEC 2400U
1533#define GRK_BROADCAST_LEVEL_8_MSAMPLESSEC 4800U
1534#define GRK_BROADCAST_LEVEL_9_MSAMPLESSEC 9600U
1535#define GRK_BROADCAST_LEVEL_10_MSAMPLESSEC 19200U
1536#define GRK_BROADCAST_LEVEL_11_MSAMPLESSEC 38400U
1538/********IMF *****************************************************************/
1540#define GRK_IS_IMF(v) \
1541 (((v) >= GRK_PROFILE_IMF_2K) && ((v) <= (GRK_PROFILE_IMF_8K_R | 0x009b)) && \
1542 (((v) & 0xf) <= 0xb) && (((v) & 0xf0) <= 0x90))
1543
1544/* Maximum component sampling rate (MSamples/sec) per main level */
1545#define GRK_IMF_MAINLEVEL_1_MSAMPLESSEC 65U
1546#define GRK_IMF_MAINLEVEL_2_MSAMPLESSEC 130U
1547#define GRK_IMF_MAINLEVEL_3_MSAMPLESSEC 195U
1548#define GRK_IMF_MAINLEVEL_4_MSAMPLESSEC 260U
1549#define GRK_IMF_MAINLEVEL_5_MSAMPLESSEC 520U
1550#define GRK_IMF_MAINLEVEL_6_MSAMPLESSEC 1200U
1551#define GRK_IMF_MAINLEVEL_7_MSAMPLESSEC 2400U
1552#define GRK_IMF_MAINLEVEL_8_MSAMPLESSEC 4800U
1553#define GRK_IMF_MAINLEVEL_9_MSAMPLESSEC 9600U
1554#define GRK_IMF_MAINLEVEL_10_MSAMPLESSEC 19200U
1555#define GRK_IMF_MAINLEVEL_11_MSAMPLESSEC 38400U
1557#define GRK_IMF_SUBLEVEL_MAX 9U
1558#define GRK_GET_IMF_SUBLEVEL(v) (((v) >> 4) & 0xf)
1561#define GRK_IMF_SUBLEVEL_1_MBITSSEC 200U
1562#define GRK_IMF_SUBLEVEL_2_MBITSSEC 400U
1563#define GRK_IMF_SUBLEVEL_3_MBITSSEC 800U
1564#define GRK_IMF_SUBLEVEL_4_MBITSSEC 1600U
1565#define GRK_IMF_SUBLEVEL_5_MBITSSEC 3200U
1566#define GRK_IMF_SUBLEVEL_6_MBITSSEC 6400U
1567#define GRK_IMF_SUBLEVEL_7_MBITSSEC 12800U
1568#define GRK_IMF_SUBLEVEL_8_MBITSSEC 25600U
1569#define GRK_IMF_SUBLEVEL_9_MBITSSEC 51200U
1570/**********************************************************************************/
1571
1576#define GRK_CINEMA_DCI_MAX_BANDWIDTH 250000000
1578#define GRK_CINEMA_24_CS 1302083
1579#define GRK_CINEMA_24_COMP 1041666
1581#define GRK_CINEMA_48_CS 651041
1582#define GRK_CINEMA_48_COMP 520833
1584#define GRK_CINEMA_4K_DEFAULT_NUM_RESOLUTIONS 7 /* Default number of resolutions for 4K cinema */
1585
1586/*
1587 * CIE Lab #defines
1589#define GRK_CUSTOM_CIELAB_SPACE 0x0
1590#define GRK_DEFAULT_CIELAB_SPACE 0x44454600 /* 'DEF' */
1591
1595#define GRK_RANDOM_ACCESS_PLT 1 /* use PLT marker if present */
1596#define GRK_RANDOM_ACCESS_TLM 2 /* use TLM marker if present */
1597#define GRK_RANDOM_ACCESS_PLM 4 /* use PLM marker if present */
1598
1599/*************************************************************************************
1600 Plugin Interface
1601 *************************************************************************************/
1602
1608typedef struct _grk_plugin_load_info
1610 const char* pluginPath; /* plugin path */
1611 bool verbose; /* verbose */
1613
1620
1625
1629#define GRK_PLUGIN_STATE_NO_DEBUG 0x0
1630
1631/*
1632 For compress debugging, the plugin first performs a T1 compress.
1633 Then:
1634 1. perform host DWT on plugin MCT data, and write to host image
1635 This way, both plugin and host start from same point
1636 (assume MCT is equivalent for both host and plugin)
1637 2. map plugin DWT data, compare with host DWT, and then write to plugin image
1638 At this point in the code, the plugin image holds plugin DWT data. And if no warnings are
1639 triggered, then we can safely say that host and plugin DWT data are identical.
1640 3. Perform host compress, skipping MCT and DWT (they have already been performed)
1641 4. during host compress, each context that is formed is compared against context stream from plugin
1642 5. rate control - synch with plugin code stream, and compare
1643 6. T2 and store to disk
1644 */
1646#define GRK_PLUGIN_STATE_DEBUG 0x1
1647#define GRK_PLUGIN_STATE_PRE_TR1 0x2
1648#define GRK_PLUGIN_STATE_DWT_QUANTIZATION 0x4
1649#define GRK_PLUGIN_STATE_MCT_ONLY 0x8
1650
1655
1656/*
1657 * @struct grk_plugin_init_info
1658 * @brief Plugin init info
1660typedef struct _grk_plugin_init_info
1662 int32_t device_id; /* device ID */
1663 bool verbose; /* verbose */
1664 const char* license; /* license */
1665 const char* server; /* server */
1667
1674
1682 const char* input_file_name; /* input file name */
1683 bool output_file_name_is_relative; /* output file name is relative */
1684 const char* output_file_name; /* output file name */
1685 grk_cparameters* compressor_parameters; /* compressor parameters */
1686 grk_image* image; /* image */
1688 grk_stream_params stream_params; /* stream parameters */
1689 unsigned int error_code; /* error code */
1690 bool transfer_exif_tags; /* transfer EXIF tags */
1692
1699
1703typedef struct grk_plugin_compress_batch_info
1705 const char* input_dir; /* input directory */
1706 const char* output_dir; /* output directory */
1707 grk_cparameters* compress_parameters; /* compress parameters */
1710
1717GRK_API int32_t GRK_CALLCONV grk_plugin_compress(grk_cparameters* compress_parameters,
1719
1729
1734
1739
1743typedef int (*GROK_INIT_DECOMPRESSORS)(grk_header_info* header_info, grk_image* image);
1744
1752 size_t device_id; /* device ID */
1754 const char* input_file_name; /* input file name */
1755 const char* output_file_name; /* output file name */
1756 /* input file format 0: J2K, 1: JP2 */
1757 GRK_CODEC_FORMAT decod_format; /* decode format */
1758 /* output file format 0: PGX, 1: PxM, 2: BMP etc */
1760 grk_object* codec; /* codec */
1761 grk_header_info header_info; /* header info */
1763 grk_image* image; /* image */
1764 bool plugin_owns_image; /* plugin owns image */
1766 unsigned int error_code; /* error code */
1767 uint32_t decompress_flags; /* decompress flags */
1768 uint32_t full_image_x0; /* full image x0 */
1769 uint32_t full_image_y0; /* full image y0 */
1770 void* user_data; /* user data */
1772
1781
1792
1804 const char* input_dir, const char* output_dir, grk_decompress_parameters* decompress_parameters,
1806
1813
1818
1819#ifndef SWIG
1820#ifdef __cplusplus
1821}
1822#endif
1823#endif
struct _grk_plugin_init_info grk_plugin_init_info
enum _GRK_TILE_CACHE_STRATEGY GRK_TILE_CACHE_STRATEGY
Grok tile cache strategy.
_GRK_SUPPORTED_FILE_FMT
All supported file formats.
Definition grok.h:290
@ GRK_FMT_BMP
Definition grok.h:297
@ GRK_FMT_JP2
Definition grok.h:293
@ GRK_FMT_J2K
Definition grok.h:292
@ GRK_FMT_PNG
Definition grok.h:300
@ GRK_FMT_YUV
Definition grok.h:303
@ GRK_FMT_RAWL
Definition grok.h:301
@ GRK_FMT_UNK
Definition grok.h:291
@ GRK_FMT_TIF
Definition grok.h:298
@ GRK_FMT_JPG
Definition grok.h:302
@ GRK_FMT_PXM
Definition grok.h:294
@ GRK_FMT_RAW
Definition grok.h:299
@ GRK_FMT_PAM
Definition grok.h:296
@ GRK_FMT_PGX
Definition grok.h:295
GRK_API bool GRK_CALLCONV grk_decompress_set_window(grk_object *codec, double start_x, double start_y, double end_x, double end_y)
Specifies area to be decompressed.
Definition grok.cpp:415
struct _grk_cparameters grk_cparameters
GRK_API void GRK_CALLCONV grk_decompress_set_default_params(grk_decompress_parameters *parameters)
Initializes decompress parameters with default values.
Definition grok.cpp:353
struct _grk_progression grk_progression
enum _grk_precision_mode grk_precision_mode
struct _grk_image grk_image
void(* grk_io_register_reclaim_callback)(grk_io_init io_init, grk_io_callback reclaim_callback, void *io_user_data, void *reclaim_user_data)
Grok IO register reclaim callback.
Definition grok.h:499
GRK_API bool GRK_CALLCONV grk_initialize(const char *pluginPath, uint32_t num_threads, bool verbose)
Initializes library.
Definition grok.cpp:131
GRK_API void GRK_CALLCONV grk_plugin_stop_batch_compress(void)
Stops batch compress.
Definition grok.cpp:904
GRK_API bool GRK_CALLCONV grk_set_MCT(grk_cparameters *parameters, float *encoding_matrix, int32_t *dc_shift, uint32_t nb_comp)
Sets MCT matrix.
Definition grok.cpp:461
GRK_API grk_object *GRK_CALLCONV grk_object_ref(grk_object *obj)
Increments ref count.
Definition grok.cpp:160
GRK_API void GRK_CALLCONV grk_plugin_stop_batch_decompress(void)
Stops batch decompress.
Definition grok.cpp:1001
struct _grk_channel_description grk_channel_description
#define GRK_NUM_COMMENTS_SUPPORTED
maximum Grok supported number of comments
Definition grok.h:124
void(* grk_msg_callback)(const char *msg, void *client_data)
Logging callback.
Definition grok.h:170
enum _GRK_CHANNEL_TYPE GRK_CHANNEL_TYPE
struct _grk_stream_params grk_stream_params
GRK_API bool GRK_CALLCONV grk_decompress_set_progression_state(grk_object *codec, grk_progression_state state)
Sets grk_progression_state for a tile.
Definition grok.cpp:509
GRK_API void GRK_CALLCONV grk_plugin_cleanup(void)
Cleans up plugin resources.
Definition grok.cpp:822
GRK_API void GRK_CALLCONV grk_set_msg_handlers(grk_msg_handlers msg_handlers)
Sets log message handlers.
Definition grok.cpp:178
GRK_API bool GRK_CALLCONV grk_plugin_load(grk_plugin_load_info info)
Loads plugin.
Definition grok.cpp:780
struct _grk_progression_state grk_progression_state
struct grk_plugin_compress_batch_info grk_plugin_compress_batch_info
Plugin batch compress info.
uint64_t(* GRK_PLUGIN_COMPRESS_USER_CALLBACK)(grk_plugin_compress_user_callback_info *info)
Plugin compress user callback.
Definition grok.h:1697
#define GRK_MAXRLVLS
Definition grok.h:326
enum _GRK_CODEC_FORMAT GRK_CODEC_FORMAT
Supported JPEG 2000 formats.
enum _GRK_ENUM_COLOUR_SPACE GRK_ENUM_COLOUR_SPACE
JPEG 2000 standard color spaces.
GRK_API void GRK_CALLCONV grk_dump_codec(grk_object *codec, uint32_t info_flag, FILE *output_stream)
Dumps codec information to file.
Definition grok.cpp:450
GRK_API uint32_t GRK_CALLCONV grk_plugin_get_debug_state()
Gets debug state of plugin.
Definition grok.cpp:807
struct _grk_precision grk_precision
struct _grk_plugin_decompress_callback_info grk_plugin_decompress_callback_info
#define GRK_MAX_PASSES
Grok maximum number of passes.
Definition grok.h:162
GRK_API int32_t GRK_CALLCONV grk_plugin_batch_decompress(void)
Initiates batch decompress.
Definition grok.cpp:987
enum _GRK_PROG_ORDER GRK_PROG_ORDER
Progression order.
struct _grk_object grk_object
bool(* grk_io_pixels_callback)(uint32_t thread_id, grk_io_buf buffer, void *user_data)
Grok IO pixels callback.
Definition grok.h:510
GRK_API grk_image *GRK_CALLCONV grk_decompress_get_image(grk_object *codec)
Gets decompressed image.
Definition grok.cpp:516
struct _grk_raw_cparameters grk_raw_cparameters
GRK_API bool GRK_CALLCONV grk_decompress_read_header(grk_object *codec, grk_header_info *header_info)
Decompresses JPEG 2000 header.
Definition grok.cpp:401
struct _grk_plugin_load_info grk_plugin_load_info
GRK_API int32_t GRK_CALLCONV grk_plugin_compress(grk_cparameters *compress_parameters, GRK_PLUGIN_COMPRESS_USER_CALLBACK callback)
Compresses with plugin.
Definition grok.cpp:856
_GRK_CHANNEL_ASSOC
Channel association.
Definition grok.h:381
@ GRK_CHANNEL_ASSOC_COLOUR_1
Definition grok.h:384
@ GRK_CHANNEL_ASSOC_COLOUR_2
Definition grok.h:385
@ GRK_CHANNEL_ASSOC_COLOUR_3
Definition grok.h:386
@ GRK_CHANNEL_ASSOC_WHOLE_IMAGE
Definition grok.h:383
@ GRK_CHANNEL_ASSOC_UNASSOCIATED
Definition grok.h:387
struct _grk_msg_handlers grk_msg_handlers
enum _GRK_RATE_CONTROL_ALGORITHM GRK_RATE_CONTROL_ALGORITHM
Rate control algorithms.
struct _grk_decompress_core_params grk_decompress_core_params
size_t(* grk_stream_read_fn)(uint8_t *buffer, size_t numBytes, void *user_data)
Read stream callback.
Definition grok.h:520
struct _grk_image_meta grk_image_meta
struct _grk_asoc grk_asoc
GRK_API grk_image *GRK_CALLCONV grk_decompress_get_tile_image(grk_object *codec, uint16_t tile_index)
Gets decompressed tile image.
Definition grok.cpp:490
enum _GRK_SUPPORTED_FILE_FMT GRK_SUPPORTED_FILE_FMT
All supported file formats.
GRK_API grk_progression_state GRK_CALLCONV grk_decompress_get_progression_state(grk_object *codec, uint16_t tile_index)
Gets grk_progression_state for a tile.
Definition grok.cpp:501
struct _grk_palette_data grk_palette_data
GRK_API bool GRK_CALLCONV grk_decompress_detect_format(const char *file_name, GRK_CODEC_FORMAT *fmt)
Detects JPEG 2000 format from file.
Definition grok.cpp:279
GRK_API bool GRK_CALLCONV grk_decompress_tile(grk_object *codec, uint16_t tile_index)
Decompresses a specific tile.
Definition grok.cpp:439
#define GRK_API
Definition grok.h:53
struct _grk_component_mapping_comp grk_component_mapping_comp
struct _grk_image_comp grk_image_comp
struct _grk_raw_comp_cparameters grk_raw_comp_cparameters
GRK_API void GRK_CALLCONV grk_deinitialize()
De-initializes library.
Definition grok.cpp:154
struct grk_plugin_tile_component grk_plugin_tile_component
GRK_API void GRK_CALLCONV grk_object_unref(grk_object *obj)
Definition grok.cpp:169
#define GRK_MAX_LAYERS
Definition grok.h:318
GRK_API void GRK_CALLCONV grk_compress_set_default_params(grk_cparameters *parameters)
Sets compression parameters to default values:
Definition grok.cpp:546
struct _grk_plugin_precinct grk_plugin_precinct
grk_plugin_precinct
struct grk_plugin_compress_user_callback_info grk_plugin_compress_user_callback_info
GRK_API const char *GRK_CALLCONV grk_version(void)
Gets library version.
Definition grok.cpp:234
_GRK_COLOR_SPACE
Grok supported color spaces.
Definition grok.h:81
@ GRK_CLRSPC_SRGB
unknown
Definition grok.h:83
@ GRK_CLRSPC_EYCC
standard YCC (YUV)
Definition grok.h:86
@ GRK_CLRSPC_UNKNOWN
Definition grok.h:82
@ GRK_CLRSPC_SYCC
grayscale
Definition grok.h:85
@ GRK_CLRSPC_DEFAULT_CIE
CMYK.
Definition grok.h:88
@ GRK_CLRSPC_ICC
custom CIE LAB
Definition grok.h:90
@ GRK_CLRSPC_CMYK
extended YCC
Definition grok.h:87
@ GRK_CLRSPC_GRAY
sRGB
Definition grok.h:84
@ GRK_CLRSPC_CUSTOM_CIE
default CIE LAB
Definition grok.h:89
GRK_API bool GRK_CALLCONV grk_plugin_init(grk_plugin_init_info init_info)
Initializes plugin.
Definition grok.cpp:827
GRK_API bool GRK_CALLCONV grk_decompress(grk_object *codec, grk_plugin_tile *tile)
Decompresses image from a JPEG 2000 code stream.
Definition grok.cpp:427
struct _grk_io_buf grk_io_buf
_grk_precision_mode
Definition grok.h:429
@ GRK_PREC_MODE_SCALE
Definition grok.h:431
@ GRK_PREC_MODE_CLIP
Definition grok.h:430
GRK_API grk_image_meta *GRK_CALLCONV grk_image_meta_new(void)
Creates meta.
Definition grok.cpp:245
enum _GRK_COLOR_SPACE GRK_COLOR_SPACE
Grok supported color spaces.
#define GRK_PATH_LEN
Definition grok.h:317
bool(* grk_io_callback)(uint32_t thread_id, grk_io_buf buffer, void *io_user_data)
Grok IO callback.
Definition grok.h:489
GRK_API grk_image *GRK_CALLCONV grk_image_new(uint16_t numcmpts, grk_image_comp *cmptparms, GRK_COLOR_SPACE clrspc, bool alloc_data)
Creates image.
Definition grok.cpp:239
GRK_API int32_t GRK_CALLCONV grk_plugin_decompress(grk_decompress_parameters *decompress_parameters, grk_plugin_decompress_callback callback)
Decompresses single image with plugin.
Definition grok.cpp:952
bool(* grk_stream_seek_fn)(uint64_t offset, void *user_data)
Seek (absolute) callback.
Definition grok.h:539
struct _grk_io_init grk_io_init
GRK_API grk_object *GRK_CALLCONV grk_decompress_init(grk_stream_params *stream_params, grk_decompress_parameters *params)
Initializes decompressor.
Definition grok.cpp:364
_GRK_ENUM_COLOUR_SPACE
JPEG 2000 standard color spaces.
Definition grok.h:98
@ GRK_ENUM_CLRSPC_ESRGB
Definition grok.h:114
@ GRK_ENUM_CLRSPC_CMY
Definition grok.h:105
@ GRK_ENUM_CLRSPC_EYCC
Definition grok.h:118
@ GRK_ENUM_CLRSPC_CIEJAB
Definition grok.h:113
@ GRK_ENUM_CLRSPC_GRAY
Definition grok.h:111
@ GRK_ENUM_CLRSPC_CIE
Definition grok.h:108
@ GRK_ENUM_CLRSPC_UNKNOWN
Definition grok.h:99
@ GRK_ENUM_CLRSPC_YCBCR3
Definition grok.h:103
@ GRK_ENUM_CLRSPC_ROMMRGB
Definition grok.h:115
@ GRK_ENUM_CLRSPC_YPBPR60
Definition grok.h:116
@ GRK_ENUM_CLRSPC_SRGB
Definition grok.h:110
@ GRK_ENUM_CLRSPC_BILEVEL2
Definition grok.h:109
@ GRK_ENUM_CLRSPC_SYCC
Definition grok.h:112
@ GRK_ENUM_CLRSPC_PHOTO_YCC
Definition grok.h:104
@ GRK_ENUM_CLRSPC_YCBCR1
Definition grok.h:101
@ GRK_ENUM_CLRSPC_CMYK
Definition grok.h:106
@ GRK_ENUM_CLRSPC_YCCK
Definition grok.h:107
@ GRK_ENUM_CLRSPC_YPBPR50
Definition grok.h:117
@ GRK_ENUM_CLRSPC_BILEVEL1
Definition grok.h:100
@ GRK_ENUM_CLRSPC_YCBCR2
Definition grok.h:102
struct _grk_color grk_color
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)
Initializes batch decompress with plugin.
Definition grok.cpp:969
struct _grk_synthesis grk_synthesis
struct _grk_decompress_params grk_decompress_parameters
_GRK_CHANNEL_TYPE
Definition grok.h:369
@ GRK_CHANNEL_TYPE_OPACITY
Definition grok.h:371
@ GRK_CHANNEL_TYPE_PREMULTIPLIED_OPACITY
Definition grok.h:372
@ GRK_CHANNEL_TYPE_COLOUR
Definition grok.h:370
@ GRK_CHANNEL_TYPE_UNSPECIFIED
Definition grok.h:373
_GRK_RATE_CONTROL_ALGORITHM
Rate control algorithms.
Definition grok.h:281
@ GRK_RATE_CONTROL_PCRD_OPT
Definition grok.h:283
@ GRK_RATE_CONTROL_BISECT
Definition grok.h:282
GRK_API bool GRK_CALLCONV grk_decompress_update(grk_decompress_parameters *params, grk_object *codec)
Updates decompressor.
Definition grok.cpp:635
GRK_API int32_t GRK_CALLCONV grk_plugin_batch_compress(grk_plugin_compress_batch_info info)
Batch-compresses with plugin.
Definition grok.cpp:872
struct _grk_channel_definition grk_channel_definition
int(* GROK_INIT_DECOMPRESSORS)(grk_header_info *header_info, grk_image *image)
Plugin init decompressors.
Definition grok.h:1742
struct _grk_plugin_band grk_plugin_band
_GRK_CODEC_FORMAT
Supported JPEG 2000 formats.
Definition grok.h:310
@ GRK_CODEC_J2K
unknown format
Definition grok.h:312
@ GRK_CODEC_MJ2
JPEG 2000 JP2 file format.
Definition grok.h:314
@ GRK_CODEC_JP2
JPEG 2000 code-stream.
Definition grok.h:313
@ GRK_CODEC_UNK
Definition grok.h:311
struct _grk_plugin_tile grk_plugin_tile
#define GRK_CALLCONV
Definition grok.h:49
GRK_API uint64_t GRK_CALLCONV grk_compress(grk_object *codec, grk_plugin_tile *tile)
Compresses an image into a JPEG 2000 code stream using plugin.
Definition grok.cpp:652
void(* grk_stream_free_user_data_fn)(void *user_data)
Free user data callback.
Definition grok.h:547
#define GRK_NUM_ASOC_BOXES_SUPPORTED
maximum Grok supported number of asoc boxes
Definition grok.h:129
_GRK_PROG_ORDER
Progression order.
Definition grok.h:66
@ GRK_RPCL
resolution-layer-component-precinct order
Definition grok.h:70
@ GRK_CPRL
precinct-component-resolution-layer order
Definition grok.h:72
@ GRK_RLCP
layer-resolution-component-precinct order
Definition grok.h:69
@ GRK_PROG_UNKNOWN
Definition grok.h:67
@ GRK_LRCP
unknown progression order
Definition grok.h:68
@ GRK_NUM_PROGRESSION_ORDERS
component-precinct-resolution-layer order
Definition grok.h:73
@ GRK_PCRL
resolution-precinct-component-layer order
Definition grok.h:71
size_t(* grk_stream_write_fn)(const uint8_t *buffer, size_t numBytes, void *user_data)
Write stream callback.
Definition grok.h:530
GRK_API void GRK_CALLCONV grk_plugin_wait_for_batch_complete(void)
Waits for batch job to complete.
Definition grok.cpp:890
struct _grk_plugin_pass grk_plugin_pass
enum _GRK_CHANNEL_ASSOC GRK_CHANNEL_ASSOC
Channel association.
GRK_API grk_object *GRK_CALLCONV grk_compress_init(grk_stream_params *stream_params, grk_cparameters *parameters, grk_image *image)
Initializes compression process.
Definition grok.cpp:575
struct _grk_header_info grk_header_info
int32_t(* grk_plugin_decompress_callback)(grk_plugin_decompress_callback_info *info)
Plugin decompress callback.
Definition grok.h:1779
_GRK_TILE_CACHE_STRATEGY
Grok tile cache strategy.
Definition grok.h:583
@ GRK_TILE_CACHE_ALL
Definition grok.h:586
@ GRK_TILE_CACHE_IMAGE
Definition grok.h:585
@ GRK_TILE_CACHE_NONE
Definition grok.h:584
struct _grk_plugin_resolution grk_plugin_resolution
struct _grk_plugin_code_block grk_plugin_code_block
Definition grok.h:417
const char * label
Definition grok.h:419
uint8_t * xml
Definition grok.h:420
uint32_t level
Definition grok.h:418
uint32_t xml_len
Definition grok.h:421
Definition grok.h:407
uint16_t num_channel_descriptions
Definition grok.h:409
grk_channel_description * descriptions
Definition grok.h:408
Definition grok.h:396
uint16_t typ
Definition grok.h:398
uint16_t asoc
Definition grok.h:399
uint16_t channel
Definition grok.h:397
Definition grok.h:718
grk_channel_definition * channel_definition
Definition grok.h:722
char * icc_profile_name
Definition grok.h:721
uint32_t icc_profile_len
Definition grok.h:720
uint8_t * icc_profile_buf
Definition grok.h:719
grk_palette_data * palette
Definition grok.h:723
bool has_colour_specification_box
Definition grok.h:724
Definition grok.h:340
uint16_t component
Definition grok.h:341
uint8_t palette_column
Definition grok.h:343
uint8_t mapping_type
Definition grok.h:342
Definition grok.h:1183
uint32_t cblockw_init
initial code block width (default to 64)
Definition grok.h:1221
uint8_t numgbits
Definition grok.h:1211
grk_progression progression[GRK_MAXRLVLS]
progressions
Definition grok.h:1215
char outfile[GRK_PATH_LEN]
output file name
Definition grok.h:1243
bool apply_icc
Definition grok.h:1293
GRK_PROG_ORDER prog_order
progression order (default is LRCP)
Definition grok.h:1213
uint16_t comment_len[GRK_NUM_COMMENTS_SUPPORTED]
Definition grok.h:1205
uint32_t repeats
Definition grok.h:1300
uint32_t prch_init[GRK_MAXRLVLS]
initial precinct height
Definition grok.h:1239
bool verbose
Definition grok.h:1303
uint32_t image_offset_x0
subimage compressing: origin image offset in x direction
Definition grok.h:1245
uint64_t max_cs_size
Maximum size (in bytes) for the whole code stream.
Definition grok.h:1272
grk_synthesis synth
Definition grok.h:1305
grk_raw_cparameters raw_cp
Definition grok.h:1256
uint8_t numresolution
number of resolutions
Definition grok.h:1219
uint32_t image_offset_y0
subimage compressing: origin image offset in y direction
Definition grok.h:1247
GRK_SUPPORTED_FILE_FMT decod_format
input file format
Definition grok.h:1253
uint32_t cblockh_init
initial code block height (default to 64)
Definition grok.h:1223
uint32_t roi_shift
region of interest: upshift value
Definition grok.h:1233
bool shared_memory_interface
Definition grok.h:1304
uint8_t subsampling_dy
subsampling value for dy
Definition grok.h:1251
uint32_t prcw_init[GRK_MAXRLVLS]
initial precinct width
Definition grok.h:1237
bool tile_size_on
Definition grok.h:1184
uint32_t t_height
YTsiz.
Definition grok.h:1192
bool write_capture_resolution_from_file
Definition grok.h:1284
uint32_t res_spec
Definition grok.h:1235
uint64_t max_comp_size
Maximum size (in bytes) for each component.
Definition grok.h:1277
uint32_t num_threads
Definition grok.h:1296
uint8_t mct
MCT (multiple component transform)
Definition grok.h:1262
uint16_t numlayers
number of layers
Definition grok.h:1194
GRK_SUPPORTED_FILE_FMT cod_format
output file format
Definition grok.h:1255
double capture_resolution_from_file[2]
Definition grok.h:1285
bool irreversible
1 : use the irreversible DWT 9-7, 0 : use lossless compression (default)
Definition grok.h:1228
uint32_t t_width
XTsiz.
Definition grok.h:1190
bool write_display_resolution
Definition grok.h:1290
uint8_t cblk_sty
code block style
Definition grok.h:1225
uint8_t csty
csty : coding style
Definition grok.h:1209
uint8_t new_tile_part_progression_divider
new tile part progression divider
Definition grok.h:1260
bool is_binary_comment[GRK_NUM_COMMENTS_SUPPORTED]
Definition grok.h:1206
uint16_t rsiz
RSIZ value To be used to combine GRK_PROFILE_*, GRK_EXTENSION_* and (sub)levels values.
Definition grok.h:1280
char infile[GRK_PATH_LEN]
input file name
Definition grok.h:1241
double layer_distortion[GRK_MAX_LAYERS]
layer PSNR values
Definition grok.h:1203
GRK_RATE_CONTROL_ALGORITHM rate_control_algorithm
Definition grok.h:1295
uint32_t kernel_build_options
Definition grok.h:1299
bool write_plt
Definition grok.h:1301
void * mct_data
Naive implementation of MCT restricted to a single reversible array based compressing without offset ...
Definition grok.h:1265
uint32_t tx0
XTOsiz.
Definition grok.h:1186
char * comment[GRK_NUM_COMMENTS_SUPPORTED]
Definition grok.h:1204
bool write_capture_resolution
Definition grok.h:1287
uint8_t subsampling_dx
subsampling value for dx
Definition grok.h:1249
int32_t device_id
Definition grok.h:1297
size_t num_comments
Definition grok.h:1207
uint16_t framerate
Definition grok.h:1281
bool allocation_by_rate_distortion
rate control allocation by rate/distortion curve
Definition grok.h:1196
bool allocation_by_quality
rate control allocation by fixed_PSNR quality
Definition grok.h:1201
bool write_tlm
Definition grok.h:1302
double display_resolution[2]
Definition grok.h:1291
int32_t roi_compno
region of interest: affected component in [0..3]; -1 indicates no ROI
Definition grok.h:1231
uint32_t ty0
YTOsiz.
Definition grok.h:1188
uint32_t duration
Definition grok.h:1298
double layer_rate[GRK_MAX_LAYERS]
layers rates expressed as compression ratios.
Definition grok.h:1199
bool enable_tile_part_generation
Tile part generation.
Definition grok.h:1258
uint32_t numpocs
number of progression order changes (POCs), default to 0
Definition grok.h:1217
double capture_resolution[2]
Definition grok.h:1288
Definition grok.h:594
grk_io_pixels_callback io_buffer_callback
Definition grok.h:614
GRK_TILE_CACHE_STRATEGY tile_cache_strategy
Definition grok.h:610
uint32_t random_access_flags
Definition grok.h:612
uint16_t layers_to_decompress
Set the maximum number of quality layers to decompress.
Definition grok.h:609
void * io_user_data
Definition grok.h:615
uint8_t reduce
Set the number of highest resolution levels to be discarded.
Definition grok.h:602
grk_io_register_reclaim_callback io_register_client_callback
Definition grok.h:616
Definition grok.h:631
double dw_x0
Decompress window left boundary.
Definition grok.h:643
bool io_xml
Definition grok.h:662
grk_precision * precision
Definition grok.h:653
uint32_t compression_level
Definition grok.h:668
GRK_SUPPORTED_FILE_FMT cod_format
output file format
Definition grok.h:641
uint16_t tile_index
tile number of the decompressed tile
Definition grok.h:651
uint32_t num_precision
Definition grok.h:654
char infile[GRK_PATH_LEN]
input file name
Definition grok.h:635
double dw_x1
Decompress window right boundary.
Definition grok.h:645
bool force_rgb
Definition grok.h:656
uint32_t compression
Definition grok.h:663
uint32_t num_threads
Definition grok.h:675
int32_t device_id
Definition grok.h:671
uint32_t kernel_build_options
Definition grok.h:673
void * user_data
Definition grok.h:676
bool single_tile_decompress
Definition grok.h:652
uint32_t repeats
Definition grok.h:674
bool upsample
Definition grok.h:658
grk_decompress_core_params core
core library parameters
Definition grok.h:633
double dw_y1
Decompress window bottom boundary.
Definition grok.h:649
uint32_t duration
Definition grok.h:672
double dw_y0
Decompress window up boundary.
Definition grok.h:647
bool split_pnm
Definition grok.h:660
bool verbose
Verbose mode.
Definition grok.h:670
GRK_CODEC_FORMAT decod_format
input file format
Definition grok.h:639
char outfile[GRK_PATH_LEN]
output file name
Definition grok.h:637
Definition grok.h:795
uint32_t cblockh_init
initial code block height, default to 64
Definition grok.h:815
uint16_t comment_len[GRK_NUM_COMMENTS_SUPPORTED]
Definition grok.h:863
bool upsample
Definition grok.h:801
uint32_t num_precision
Definition grok.h:803
uint16_t num_layers
number of layers
Definition grok.h:854
uint32_t num_asocs
Definition grok.h:867
char * comment[GRK_NUM_COMMENTS_SUPPORTED]
Definition grok.h:862
uint32_t t_width
XTsiz.
Definition grok.h:846
bool is_binary_comment[GRK_NUM_COMMENTS_SUPPORTED]
Definition grok.h:864
uint32_t prch_init[GRK_MAXRLVLS]
initial precinct height
Definition grok.h:840
uint16_t t_grid_height
tile grid height
Definition grok.h:852
bool split_by_component
Definition grok.h:804
size_t xml_data_len
Definition grok.h:860
size_t num_comments
Definition grok.h:861
uint8_t csty
Definition grok.h:830
bool force_rgb
Definition grok.h:800
GRK_SUPPORTED_FILE_FMT decompress_fmt
Definition grok.h:799
grk_asoc asocs[GRK_NUM_ASOC_BOXES_SUPPORTED]
Definition grok.h:866
uint32_t tx0
XTOsiz.
Definition grok.h:842
uint32_t ty0
YTOsiz.
Definition grok.h:844
uint32_t cblockw_init
initial code block width, default to 64
Definition grok.h:813
uint16_t rsiz
RSIZ value To be used to combine GRK_PROFILE_*, GRK_EXTENSION_* and (sub)levels values.
Definition grok.h:822
grk_precision * precision
Definition grok.h:802
uint8_t mct
multi-component transform identifier
Definition grok.h:819
uint8_t numresolutions
number of resolutions
Definition grok.h:824
grk_image header_image
Definition grok.h:811
uint16_t t_grid_width
tile grid width
Definition grok.h:850
uint32_t t_height
YTsiz.
Definition grok.h:848
uint8_t cblk_sty
Definition grok.h:836
uint32_t prcw_init[GRK_MAXRLVLS]
initial precinct width
Definition grok.h:838
bool single_tile_decompress
Definition grok.h:805
uint8_t * xml_data
Definition grok.h:859
bool irreversible
1 : use the irreversible DWT 9-7, 0 : use lossless compression (default)
Definition grok.h:817
Definition grok.h:684
uint32_t h
data height
Definition grok.h:694
uint8_t dy
YRsiz: vertical separation of a sample of component with respect to the reference grid.
Definition grok.h:700
GRK_CHANNEL_ASSOC association
Definition grok.h:706
GRK_CHANNEL_TYPE type
Definition grok.h:705
uint8_t dx
XRsiz: horizontal separation of a sample of component with respect to the reference grid.
Definition grok.h:697
bool sgnd
Definition grok.h:704
uint32_t w
data width
Definition grok.h:690
uint8_t prec
precision
Definition grok.h:702
uint16_t crg_x
Definition grok.h:708
int32_t * data
image component data
Definition grok.h:710
uint32_t x0
x component offset compared to the whole image
Definition grok.h:686
uint32_t y0
y component offset compared to the whole image
Definition grok.h:688
uint16_t crg_y
Definition grok.h:708
uint32_t stride
data stride
Definition grok.h:692
Definition grok.h:732
grk_color color
Definition grok.h:734
uint8_t * xmp_buf
Definition grok.h:737
grk_object obj
Definition grok.h:733
size_t xmp_len
Definition grok.h:738
size_t iptc_len
Definition grok.h:736
uint8_t * iptc_buf
Definition grok.h:735
Definition grok.h:749
uint64_t packed_row_bytes
Definition grok.h:785
grk_precision * precision
Definition grok.h:773
bool has_capture_resolution
Definition grok.h:766
uint16_t numcomps
number of components in the image
Definition grok.h:762
bool force_rgb
Definition grok.h:771
uint32_t y0
YOsiz: vertical offset from the origin of the reference grid to the top side of the image area.
Definition grok.h:756
bool split_by_component
Definition grok.h:776
GRK_COLOR_SPACE color_space
Definition grok.h:763
uint32_t rows_per_task
Definition grok.h:784
uint32_t rows_per_strip
Definition grok.h:783
bool upsample
Definition grok.h:772
grk_image_comp * comps
Definition grok.h:787
uint8_t decompress_prec
Definition grok.h:780
bool has_multiple_tiles
Definition grok.h:775
grk_io_buf interleaved_data
Definition grok.h:782
GRK_COLOR_SPACE decompress_colour_space
Definition grok.h:781
uint32_t x0
XOsiz: horizontal offset from the origin of the reference grid to the left side of the image area.
Definition grok.h:753
grk_object obj
Definition grok.h:750
uint32_t num_precision
Definition grok.h:774
uint16_t decompress_num_comps
Definition grok.h:777
bool has_display_resolution
Definition grok.h:768
GRK_SUPPORTED_FILE_FMT decompress_fmt
Definition grok.h:770
double display_resolution[2]
Definition grok.h:769
uint32_t y1
Ysiz: height of the reference grid.
Definition grok.h:760
uint32_t decompress_width
Definition grok.h:778
uint32_t decompress_height
Definition grok.h:779
double capture_resolution[2]
Definition grok.h:767
grk_image_meta * meta
Definition grok.h:786
uint32_t x1
Xsiz: width of the reference grid.
Definition grok.h:758
bool palette_applied
Definition grok.h:764
bool channel_definition_applied
Definition grok.h:765
Definition grok.h:463
size_t alloc_len
Definition grok.h:467
bool pooled
Definition grok.h:468
size_t len
Definition grok.h:466
size_t offset
Definition grok.h:465
uint8_t * data
Definition grok.h:464
uint32_t index
Definition grok.h:469
Definition grok.h:477
uint32_t max_pooled_requests
Definition grok.h:478
Definition grok.h:184
grk_msg_callback info_callback
Definition grok.h:185
void * warn_data
Definition grok.h:188
grk_msg_callback warn_callback
Definition grok.h:187
grk_msg_callback error_callback
Definition grok.h:189
void * error_data
Definition grok.h:190
void * info_data
Definition grok.h:186
Definition grok.h:199
void * wrapper
Definition grok.h:200
Definition grok.h:351
grk_component_mapping_comp * component_mapping
Definition grok.h:354
uint8_t num_channels
Definition grok.h:355
int32_t * lut
Definition grok.h:352
uint16_t num_entries
Definition grok.h:353
bool * channel_sign
Definition grok.h:356
uint8_t * channel_prec
Definition grok.h:357
Definition grok.h:917
uint64_t num_precincts
Definition grok.h:919
float stepsize
Definition grok.h:921
uint8_t orientation
Definition grok.h:918
grk_plugin_precinct ** precincts
Definition grok.h:920
Definition grok.h:886
uint32_t y0
Definition grok.h:890
uint8_t num_passes
Definition grok.h:897
uint32_t compressed_data_length
Definition grok.h:895
grk_plugin_pass passes[GRK_MAX_PASSES]
Definition grok.h:898
unsigned int sorted_index
Definition grok.h:899
uint32_t x0
Definition grok.h:890
uint8_t * compressed_data
Definition grok.h:894
uint32_t y1
Definition grok.h:890
uint32_t x1
Definition grok.h:890
unsigned int * context_stream
Definition grok.h:891
uint32_t num_pix
Definition grok.h:893
uint8_t num_bit_planes
Definition grok.h:896
uint32_t full_image_y0
Definition grok.h:1768
GRK_CODEC_FORMAT decod_format
Definition grok.h:1756
unsigned int error_code
Definition grok.h:1765
grk_decompress_parameters * decompressor_parameters
Definition grok.h:1761
grk_header_info header_info
Definition grok.h:1760
GRK_SUPPORTED_FILE_FMT cod_format
Definition grok.h:1758
grk_plugin_tile * tile
Definition grok.h:1764
size_t device_id
Definition grok.h:1751
uint32_t full_image_x0
Definition grok.h:1767
grk_object * codec
Definition grok.h:1759
void * user_data
Definition grok.h:1769
bool plugin_owns_image
Definition grok.h:1763
uint32_t decompress_flags
Definition grok.h:1766
const char * output_file_name
Definition grok.h:1754
GROK_INIT_DECOMPRESSORS init_decompressors_func
Definition grok.h:1752
const char * input_file_name
Definition grok.h:1753
grk_image * image
Definition grok.h:1762
Definition grok.h:1660
bool verbose
Definition grok.h:1662
const char * server
Definition grok.h:1664
int32_t device_id
Definition grok.h:1661
const char * license
Definition grok.h:1663
Definition grok.h:1608
const char * pluginPath
Definition grok.h:1609
bool verbose
Definition grok.h:1610
Definition grok.h:875
size_t rate
Definition grok.h:877
size_t length
Definition grok.h:878
double distortion_decrease
Definition grok.h:876
grk_plugin_precinct
Definition grok.h:907
uint64_t num_blocks
Definition grok.h:908
grk_plugin_code_block ** blocks
Definition grok.h:909
Definition grok.h:929
uint8_t num_bands
Definition grok.h:931
uint8_t level
Definition grok.h:930
grk_plugin_band ** band
Definition grok.h:932
Definition grok.h:959
uint16_t num_components
Definition grok.h:961
uint32_t decompress_flags
Definition grok.h:960
grk_plugin_tile_component ** tile_components
Definition grok.h:962
Definition grok.h:439
grk_precision_mode mode
Definition grok.h:441
uint8_t prec
Definition grok.h:440
Definition grok.h:449
uint16_t comp[256]
Definition grok.h:453
bool single_tile
Definition grok.h:454
uint8_t num_resolutions
Definition grok.h:450
uint16_t tile_index
Definition grok.h:455
uint16_t numcomps
Definition grok.h:452
uint16_t layers_per_resolution[33]
Definition grok.h:451
Definition grok.h:209
uint16_t comp_temp
Definition grok.h:242
uint32_t tx1
Definition grok.h:218
uint64_t prec_e
Definition grok.h:227
GRK_PROG_ORDER specified_compression_poc_prog
Definition grok.h:212
uint16_t comp_s
progression order bounds specified by POC
Definition grok.h:222
uint8_t res_temp
Definition grok.h:243
uint32_t tp_ty_e
Definition grok.h:239
uint32_t tp_tx_s
Definition grok.h:236
uint8_t res_s
Definition grok.h:224
uint32_t tx0
tile dimensions
Definition grok.h:216
uint8_t tp_res_s
Definition grok.h:232
uint64_t prec_temp
Definition grok.h:244
uint64_t tp_prec_e
Definition grok.h:234
uint32_t tp_ty_s
Definition grok.h:238
uint8_t tp_res_e
Definition grok.h:233
uint32_t ty0
Definition grok.h:217
uint32_t ty1
Definition grok.h:219
uint32_t ty0_temp
Definition grok.h:247
uint16_t comp_e
Definition grok.h:223
uint32_t dy
Definition grok.h:241
GRK_PROG_ORDER progression
Definition grok.h:210
uint32_t dx
Definition grok.h:240
uint16_t tp_comp_e
Definition grok.h:231
uint64_t prec_s
Definition grok.h:226
uint32_t tp_tx_e
Definition grok.h:237
uint32_t tx0_temp
Definition grok.h:246
uint16_t tp_lay_e
Definition grok.h:235
uint32_t tileno
Definition grok.h:213
uint16_t lay_temp
Definition grok.h:245
uint16_t tp_comp_s
Definition grok.h:230
uint16_t lay_e
Definition grok.h:229
uint16_t lay_s
Definition grok.h:228
char progression_str[5]
Definition grok.h:211
uint8_t res_e
Definition grok.h:225
Definition grok.h:255
uint8_t dy
subsampling in X direction
Definition grok.h:257
uint8_t dx
Definition grok.h:256
Definition grok.h:265
uint8_t prec
number of components of the raw image
Definition grok.h:269
uint32_t width
Definition grok.h:266
uint16_t numcomps
height of the raw image
Definition grok.h:268
grk_raw_comp_cparameters * comps
signed/unsigned raw image
Definition grok.h:271
bool sgnd
bit depth of the raw image
Definition grok.h:270
uint32_t height
width of the raw image
Definition grok.h:267
Definition grok.h:559
uint8_t * buf
Definition grok.h:564
grk_stream_read_fn read_fn
Definition grok.h:570
size_t buf_len
Definition grok.h:565
grk_stream_free_user_data_fn free_user_data_fn
Definition grok.h:573
size_t double_buffer_len
Definition grok.h:576
size_t stream_len
Definition grok.h:575
grk_stream_write_fn write_fn
Definition grok.h:571
const char * file
Definition grok.h:561
grk_stream_seek_fn seek_fn
Definition grok.h:572
void * user_data
Definition grok.h:574
size_t buf_compressed_len
Definition grok.h:567
Definition grok.h:1169
uint32_t width
Definition grok.h:1171
uint32_t height
Definition grok.h:1172
bool do_synthesis
Definition grok.h:1170
uint8_t precision
Definition grok.h:1173
uint16_t numcomps
Definition grok.h:1174
Compression parameters.
Core decompression parameters.
Decompression parameters.
JPEG 2000 header info.
Image component.
Grok image.
Grok IO buffer.
Grok IO initialization.
Logging handlers.
Opaque reference-counted object.
Plugin band.
Plugin code block.
Plugin batch compress info.
Definition grok.h:1703
grk_cparameters * compress_parameters
Definition grok.h:1706
GRK_PLUGIN_COMPRESS_USER_CALLBACK callback
Definition grok.h:1707
const char * output_dir
Definition grok.h:1705
const char * input_dir
Definition grok.h:1704
Plugin compress user callback info.
Definition grok.h:1680
bool transfer_exif_tags
Definition grok.h:1689
grk_cparameters * compressor_parameters
Definition grok.h:1684
grk_image * image
Definition grok.h:1685
grk_plugin_tile * tile
Definition grok.h:1686
const char * output_file_name
Definition grok.h:1683
grk_stream_params stream_params
Definition grok.h:1687
unsigned int error_code
Definition grok.h:1688
const char * input_file_name
Definition grok.h:1681
bool output_file_name_is_relative
Definition grok.h:1682
Plugin decompress callback info.
Plugin load info.
Plugin resolution.
Plugin tile component.
Definition grok.h:940
uint8_t numresolutions
Definition grok.h:941
grk_plugin_resolution ** resolutions
Definition grok.h:942
Plugin tile.
Precision mode.
Stores progression state information.
JPEG 2000 stream parameters.