Grok 15.1.0
grok.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016-2025 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
22#pragma once
23
24#include <stdint.h>
25#include <stdio.h>
26#include <stdbool.h>
27#include <limits.h>
28
29#ifndef SWIG
30#ifdef __cplusplus
31extern "C" {
32#endif
33#endif
34
35#include "grk_config.h"
36
37#ifndef SWIG
38#ifdef _WIN32
39#define GRK_CALLCONV __stdcall
40#ifdef GRK_STATIC
41#define GRK_API
42#else
43#ifdef GRK_EXPORTS
44#define GRK_API __declspec(dllexport)
45#else
46#define GRK_API __declspec(dllimport)
47#endif
48#endif
49#else
50#define GRK_CALLCONV
51#ifdef GRK_STATIC
52#define GRK_API __attribute__((visibility("hidden")))
53#else
54#define GRK_API __attribute__((visibility("default")))
55#endif
56#endif
57#else
58#define GRK_CALLCONV
59#define GRK_API
60#endif
61
75
91
96{
97 GRK_ENUM_CLRSPC_UNKNOWN = 0xFFFFFFFF, /* unknown */
98 GRK_ENUM_CLRSPC_BILEVEL1 = 0, /* bilevel 1 */
99 GRK_ENUM_CLRSPC_YCBCR1 = 1, /* YCbCr 4:2:2 */
100 GRK_ENUM_CLRSPC_YCBCR2 = 3, /* YCbCr 4:4:4 */
101 GRK_ENUM_CLRSPC_YCBCR3 = 4, /* YCbCr 4:2:0 */
102 GRK_ENUM_CLRSPC_PHOTO_YCC = 9, /* Kodak PhotoYCC */
103 GRK_ENUM_CLRSPC_CMY = 11, /* cyan, magenta, yellow */
104 GRK_ENUM_CLRSPC_CMYK = 12, /* cyan, magenta, yellow, black */
105 GRK_ENUM_CLRSPC_YCCK = 13, /* YCCK */
106 GRK_ENUM_CLRSPC_CIE = 14, /* CIE Lab (L*, a*, b*) */
107 GRK_ENUM_CLRSPC_BILEVEL2 = 15, /* bilevel 2 */
108 GRK_ENUM_CLRSPC_SRGB = 16, /* sRGB */
109 GRK_ENUM_CLRSPC_GRAY = 17, /* grayscale */
110 GRK_ENUM_CLRSPC_SYCC = 18, /* standard YCC */
111 GRK_ENUM_CLRSPC_CIEJAB = 19, /* CIEJAB */
112 GRK_ENUM_CLRSPC_ESRGB = 20, /* e-sRGB */
113 GRK_ENUM_CLRSPC_ROMMRGB = 21, /* Reference Output Medium Metric RGB */
114 GRK_ENUM_CLRSPC_YPBPR60 = 22, /* YPbPr 60 */
115 GRK_ENUM_CLRSPC_YPBPR50 = 23, /* YPbPr 50 */
116 GRK_ENUM_CLRSPC_EYCC = 24, /* extended YCC */
118
122#define GRK_NUM_COMMENTS_SUPPORTED 256
123
127#define GRK_NUM_ASOC_BOXES_SUPPORTED 256
128
132#define GRK_MAX_COMMENT_LENGTH (UINT16_MAX - 2)
133
137#define GRK_MAX_SUPPORTED_IMAGE_PRECISION 16
138
153#define GRK_BIBO_EXTRA_BITS 7
154
158#define GRK_MAX_PASSES (3 * (GRK_MAX_SUPPORTED_IMAGE_PRECISION + GRK_BIBO_EXTRA_BITS) - 2)
159
165typedef void (*grk_msg_callback)(const char* msg, void* client_data);
166
194typedef struct _grk_object
195{
196 void* wrapper; /* opaque wrapper */
198
203typedef struct _grk_progression
204{
205 GRK_PROG_ORDER progression; /* progression */
206 char progression_str[5]; /* progression as string */
207 GRK_PROG_ORDER specified_compression_poc_prog; /* compression specified POC*/
208 uint32_t tileno; /* tile number */
209
211 uint32_t tx0; /* tile x0 */
212 uint32_t ty0; /* tile y0 */
213 uint32_t tx1; /* tile x1 */
214 uint32_t ty1; /* tile y1 */
215
217 uint16_t comp_s; /* component start */
218 uint16_t comp_e; /* component end */
219 uint8_t res_s; /* resolution start */
220 uint8_t res_e; /* resolution end */
221 uint64_t prec_s; /* precinct start */
222 uint64_t prec_e; /* precinct end */
223 uint16_t lay_s; /* layer start */
224 uint16_t lay_e; /* layer end */
225 uint16_t tp_comp_s; /* tile part component start */
226 uint16_t tp_comp_e; /* tile part component end */
227 uint8_t tp_res_s; /* tile part resolution start */
228 uint8_t tp_res_e; /* tile part resolution end */
229 uint64_t tp_prec_e; /* tile part precinct end */
230 uint16_t tp_lay_e; /* tile part layer end */
231 uint32_t tp_tx_s; /* tile part x start */
232 uint32_t tp_tx_e; /* tile part x end */
233 uint32_t tp_ty_s; /* tile part y start */
234 uint32_t tp_ty_e; /* tile part y end */
235 uint32_t dx; /* dx */
236 uint32_t dy; /* dy */
237
238 /* temporary POC variables */
239 uint16_t comp_temp; /* component */
240 uint8_t res_temp; /* resolution */
241 uint64_t prec_temp; /* precinct */
242 uint16_t lay_temp; /* layer */
243 uint32_t tx0_temp; /* x0 */
244 uint32_t ty0_temp; /* y0 */
246
256
270
281
286{
287 GRK_FMT_UNK, /* unknown */
288 GRK_FMT_J2K, /* J2K */
289 GRK_FMT_JP2, /* JP2 */
290 GRK_FMT_PXM, /* PXM */
291 GRK_FMT_PGX, /* PGX */
292 GRK_FMT_PAM, /* PAM */
293 GRK_FMT_BMP, /* BMP */
294 GRK_FMT_TIF, /* TIF */
295 GRK_FMT_RAW, /* RAW Big Endian */
296 GRK_FMT_PNG, /* PNG */
297 GRK_FMT_RAWL, /* RAW Little Endian */
298 GRK_FMT_JPG, /* JPG */
299 GRK_FMT_YUV /* YUV */
301
312
313#define GRK_PATH_LEN 4096 /* Grok maximum supported filename size */
314#define GRK_MAX_LAYERS 256 /* Grok maximum number of quality layers */
315
316/*
317 * Note: range for number of decomposition levels is 0-32
318 * Accordingly, range for number of resolution levels is 1-33
319 */
320#define GRK_MAX_DECOMP_LVLS \
321 32 /* Maximum number of decomposition levels allowed by standard \
322 */
323#define GRK_MAXRLVLS \
324 (GRK_MAX_DECOMP_LVLS + 1) /* Maximum number of resolution levels allowed by standard*/
325#define GRK_MAXBANDS (3 * GRK_MAXRLVLS - 2) /* Maximum number of sub-bands allowed by standard */
326
333 */
334typedef struct _grk_component_mapping_comp
336 uint16_t component; /* component index */
337 uint8_t mapping_type; /* mapping type : 1 if mapped to paletted LUT otherwise 0 */
338 uint8_t palette_column; /* palette LUT column if mapped to palette */
340
344 */
345typedef struct _grk_palette_data
347 int32_t* lut; /* LUT */
348 uint16_t num_entries; /* number of LUT entries */
349 grk_component_mapping_comp* component_mapping; /* component mapping array*/
350 uint8_t num_channels; /* number of channels */
351 bool* channel_sign; /* channel signed array */
352 uint8_t* channel_prec; /* channel precision array */
354
355/***
356 * Channel Definition box structures and enums.
357 * When no Component mapping box is present, it is still possible to have
358 * a Channel definition box, in which case channels are associated with components
359 * in the obvious way : channel `k` corresponds to component `k`.
360 * */
361
362/* @brief Channel type */
363typedef enum _GRK_CHANNEL_TYPE
365 GRK_CHANNEL_TYPE_COLOUR = 0, /* colour */
366 GRK_CHANNEL_TYPE_OPACITY = 1, /* opacity */
367 GRK_CHANNEL_TYPE_PREMULTIPLIED_OPACITY = 2, /* premultiplied opacity */
368 GRK_CHANNEL_TYPE_UNSPECIFIED = 65535U /* unspecified */
370
373 */
374typedef enum _GRK_CHANNEL_ASSOC
376 GRK_CHANNEL_ASSOC_WHOLE_IMAGE = 0, /* whole image */
377 GRK_CHANNEL_ASSOC_COLOUR_1 = 1, /* colour 1 */
378 GRK_CHANNEL_ASSOC_COLOUR_2 = 2, /* colour 2 */
379 GRK_CHANNEL_ASSOC_COLOUR_3 = 3, /* colour 3 */
380 GRK_CHANNEL_ASSOC_UNASSOCIATED = 65535U /* unassociated */
382
386 */
387typedef struct _grk_channel_description
389 uint16_t channel; /* channel */
390 uint16_t typ; /* type */
391 uint16_t asoc; /* association */
393
397 */
398typedef struct _grk_channel_definition
400 grk_channel_description* descriptions; /* channel description array */
401 uint16_t num_channel_descriptions; /* size of channel description array */
403
407 */
408typedef struct _grk_asoc
410 uint32_t level; /* level: 0 for root level */
411 const char* label; /* label */
412 uint8_t* xml; /* xml */
413 uint32_t xml_len; /* xml length */
414} grk_asoc;
415
419 */
420typedef enum _grk_precision_mode
425
429 */
430typedef struct _grk_precision
432 uint8_t prec; /* precision */
435
440 */
441typedef struct _grk_progression_state
445 uint16_t numcomps;
446 uint16_t comp[256];
448 uint16_t tile_index;
450
454 */
455typedef struct _grk_io_buf
457 uint8_t* data; /* data */
458 size_t offset; /* offset */
459 size_t len; /* length */
460 size_t alloc_len; /* allocated length */
461 bool pooled; /* pooled */
462 uint32_t index; /* index */
463} grk_io_buf;
464
468 */
469typedef struct _grk_io_init
471 uint32_t max_pooled_requests; /* max pooled requests */
474
481typedef bool (*grk_io_callback)(uint32_t worker_id, grk_io_buf buffer, void* io_user_data);
482
490typedef void (*grk_io_register_reclaim_callback)(grk_io_init io_init,
491 grk_io_callback reclaim_callback,
492 void* io_user_data, void* reclaim_user_data);
493
500typedef bool (*grk_io_pixels_callback)(uint32_t worker_id, grk_io_buf buffer, void* user_data);
501
509typedef size_t (*grk_stream_read_fn)(uint8_t* buffer, size_t numBytes, void* user_data);
510
518typedef size_t (*grk_stream_write_fn)(const uint8_t* buffer, size_t numBytes, void* user_data);
519
525typedef bool (*grk_stream_seek_fn)(uint64_t offset, void* user_data);
526
531typedef void (*grk_stream_free_user_data_fn)(void* user_data);
532
538 */
539typedef struct _grk_stream_params
540{
541 /* 0. General Streaming */
542 size_t initial_offset; /* initial offset into stream */
543 size_t double_buffer_len; /* length of internal double buffer
544 for stdio and callback streaming */
545 size_t initial_double_buffer_len; /* choose a larger initial length
546 to read the main header in one go */
547 bool from_network; /* indicates stream source is on network if true */
548 bool is_read_stream;
549
550 /* 1. File Streaming */
551 const char* file;
552 bool use_stdio; /* use C file api - if false then use memory mapping */
553
554 /* 2. Buffer Streaming */
555 uint8_t* buf;
556 size_t buf_len; /* buffer length */
557 size_t buf_compressed_len; /* length of compressed stream (set by compressor, not client) */
558
559 /* 3. Callback Streaming */
560 grk_stream_read_fn read_fn; /* read function */
561 grk_stream_write_fn write_fn; /* write function */
562 grk_stream_seek_fn seek_fn; /* seek function */
564 void* user_data; /* user data */
565 size_t stream_len; /* mandatory for read stream */
566
567 /* 4 Authorization */
568 const char* username;
569 const char* password;
570 const char* bearer_token;
571 const char* custom_header;
572 const char* region;
575
579#define GRK_TILE_CACHE_NONE 0 /* no tile caching */
580#define GRK_TILE_CACHE_IMAGE 1 /* cache final tile image */
581#define GRK_TILE_CACHE_BLOCK 2 /* cache each code block output */
582#define GRK_TILE_CACHE_ALL 4 /* cache everything */
584typedef struct _grk_image grk_image;
585
589typedef void (*grk_decompress_callback)(void* codec, uint16_t tile_index, grk_image* tile_image,
590 uint8_t reduction, void* user_data);
591
595#define GRK_RANDOM_ACCESS_PLT 1 /* Disable PLT marker if present */
596#define GRK_RANDOM_ACCESS_TLM 2 /* Disable TLM marker if present */
597#define GRK_RANDOM_ACCESS_PLM 4 /* Disable PLM marker if present */
598
602 */
603typedef struct _grk_decompress_core_params
604{
613 uint8_t reduce;
621 uint32_t tile_cache_strategy; /* tile cache strategy */
622 uint32_t disable_random_access_flags; /* disable random access flags */
623 bool skip_allocate_composite; /* skip allocate composite image data for multi-tile */
625 void* io_user_data; /* IO user data */
628
633#define GRK_DECOMPRESS_COMPRESSION_LEVEL_DEFAULT (UINT_MAX)
634
638 */
639typedef struct _grk_decompress_params
641 grk_decompress_core_params core; /* core parameters */
642 bool asynchronous; /* if true then decompression is executed asynchronously */
644 grk_decompress_callback decompress_callback; /* callback for asynchronous decompression */
645 void* decompress_callback_user_data; /* user data passed to callback for asynchronous
646 decompression */
647 char infile[GRK_PATH_LEN]; /* input file */
648 char outfile[GRK_PATH_LEN]; /* output file */
649 GRK_CODEC_FORMAT decod_format; /* input decode format */
650 GRK_SUPPORTED_FILE_FMT cod_format; /* output code format */
651 double dw_x0; /* decompress window left boundary*/
652 double dw_x1; /* decompress window right boundary*/
653 double dw_y0; /* decompress window top boundary*/
654 double dw_y1; /* decompress window bottom boundary*/
655 uint16_t tile_index; /* index of decompressed tile*/
656 bool single_tile_decompress; /* single tile decompress */
657 grk_precision* precision; /* precision array */
658 uint32_t num_precision; /* size of precision array*/
659 bool force_rgb; /* force output to sRGB */
660 bool upsample; /* upsample components according to their dx and dy values*/
661 bool split_pnm; /* split output components to different files for PNM */
662 bool io_xml; /* serialize XML metedata to disk*/
663 uint32_t compression; /* compression */
664 uint32_t compression_level; /* compression "quality" - meaning depends on output file format */
665 uint32_t duration; /* duration of decompression in seconds */
666 uint32_t repeats; /* number of repetitions */
667 uint32_t num_threads; /* number of CPU threads */
669 uint32_t kernel_build_options; /* plugin OpenCL kernel build options */
670 int32_t device_id; /* plugin device ID */
671 void* user_data; /* plugin user data */
673
677 */
678typedef struct _grk_image_comp
680 uint32_t x0; /* x offset relative to whole image */
681 uint32_t y0; /* y offset relative to whole image */
682 uint32_t w; /* width */
683 uint32_t stride; /* stride */
684 uint32_t h; /* height */
685 uint8_t dx; /* horizontal separation of component samples with respect to reference grid */
686 uint8_t dy; /* vertical separation of component samples with respect to reference grid */
687 uint8_t prec; /* precision */
688 bool sgnd; /* true if component data is signed */
689 GRK_CHANNEL_TYPE type; /* channel type */
690 GRK_CHANNEL_ASSOC association; /* channel association */
691 uint16_t crg_x; /* CRG x */
692 uint16_t crg_y; /* CRG x */
693 int32_t* data; /* component data */
695
699 */
700typedef struct _grk_color
702 uint8_t* icc_profile_buf; /* ICC profile buffer */
703 uint32_t icc_profile_len; /* ICC profile length */
704 char* icc_profile_name; /* ICC profile name */
706 grk_palette_data* palette; /* palette */
707 bool has_colour_specification_box; /* true if colour specification box present*/
708} grk_color;
709
713 */
714typedef struct _grk_image_meta
716 grk_object obj; /* object */
717 grk_color color; /* color */
718 uint8_t* iptc_buf; /* IPTC buffer */
719 size_t iptc_len; /* IPTC length */
720 uint8_t* xmp_buf; /* XMP buffer */
721 size_t xmp_len; /* XMP length */
723
729 */
730typedef struct _grk_image
732 grk_object obj; /* object */
733 uint32_t x0; /* image horizontal offset from origin of reference grid */
734 uint32_t y0; /* image vertical offset from origin of reference grid */
735 uint32_t x1; /* image right boundary in reference grid*/
736 uint32_t y1; /* image bottom boundary in reference grid */
737 uint16_t numcomps; /* number of components */
738 GRK_COLOR_SPACE color_space; /* color space */
739 bool palette_applied; /* true if palette applied */
740 bool channel_definition_applied; /* true if channel definition applied */
741 bool has_capture_resolution; /* true if capture resolution present*/
742 double capture_resolution[2]; /* capture resolution */
743 bool has_display_resolution; /* true if display resolution present*/
744 double display_resolution[2]; /* display resolution */
745 GRK_SUPPORTED_FILE_FMT decompress_fmt; /* decompress format */
746 bool force_rgb; /* force RGB */
747 bool upsample; /* upsample */
748 grk_precision* precision; /* precision */
749 uint32_t num_precision; /* number of precision */
750 bool has_multiple_tiles; /* has multiple tiles */
751 bool split_by_component; /* split by component */
752 uint16_t decompress_num_comps; /* decompress number of components */
753 uint32_t decompress_width; /* decompress width */
754 uint32_t decompress_height; /* decompress height */
755 uint8_t decompress_prec; /* decompress precision */
756 GRK_COLOR_SPACE decompress_colour_space; /* decompress colour space */
757 grk_io_buf interleaved_data; /* interleaved data */
758 uint32_t rows_per_strip; /* for storage to output format */
759 uint32_t rows_per_task; /* for scheduling */
760 uint64_t packed_row_bytes; /* packed row bytes */
761 grk_image_meta* meta; /* image meta data */
762 grk_image_comp* comps; /* components array */
763} grk_image;
764
768 */
769typedef struct _grk_header_info
770{
771 /************************************************************
772 Variables below are populated by library after reading header
773 *************************************************************/
775 uint32_t cblockw_init; /* nominal code block width, default 64 */
776 uint32_t cblockh_init; /* nominal code block height, default 64 */
777 bool irreversible; /* true if image compressed irreversibly*/
778 uint8_t mct; /* multi-component transform */
779 uint16_t rsiz; /* RSIZ */
780 uint8_t numresolutions; /* number of resolutions */
781 GRK_PROG_ORDER prog_order; /* progression order */
782 /********************************************************************************
783 coding style
784 Can be specified in main header COD segment,
785 tile header COD segment, and tile component COC segment.
786 Important note: we assume that coding style does not vary across tile components
787 *********************************************************************************/
788 uint8_t csty;
789 /************************************************************************************
790 code block style
791 Can be specified in main header COD segment, and can be overridden in a tile header.
792 Important note: we assume that code block style does not vary across tiles
793 ************************************************************************************/
794 uint8_t cblk_sty;
795 uint32_t prcw_init[GRK_MAXRLVLS]; /* nominal precinct width */
796 uint32_t prch_init[GRK_MAXRLVLS]; /* nominal precinct height */
797 uint32_t tx0; /* XTOsiz */
798 uint32_t ty0; /* YTOsiz */
799 uint32_t t_width; /* XTsiz */
800 uint32_t t_height; /* YTsiz */
801 uint16_t t_grid_width; /* tile grid width */
802 uint16_t t_grid_height; /* tile grid height */
803 uint16_t num_layers; /* number of layers */
804 uint8_t* xml_data; /* XML data - will remain valid until codec destroyed */
805 size_t xml_data_len; /* XML data length */
806 size_t num_comments; /* number of comments */
808 uint16_t comment_len[GRK_NUM_COMMENTS_SUPPORTED]; /* comment length */
809 bool is_binary_comment[GRK_NUM_COMMENTS_SUPPORTED]; /* is binary comment */
811 uint32_t num_asocs; /* number of associations */
812
813 /**************************************************************
814 Variables below are set by client only if decompressing to file
815 **************************************************************/
816 GRK_SUPPORTED_FILE_FMT decompress_fmt; /* decompress format */
817 bool force_rgb; /* force RGB */
818 bool upsample; /* upsample */
819 grk_precision* precision; /* precision */
820 uint32_t num_precision; /* number of precision */
821 bool split_by_component; /* split by component */
822 bool single_tile_decompress; /* single tile decompress */
824
830 */
831typedef struct grk_wait_swath
833 uint32_t x0; // Pixel coordinate: top-left x
834 uint32_t y0; // Pixel coordinate: top-left y
835 uint32_t x1; // Pixel coordinate: bottom-right x (exclusive)
836 uint32_t y1; // Pixel coordinate: bottom-right y (exclusive)
837 uint16_t tile_x0; // Global tile coordinate: start x (inclusive)
838 uint16_t tile_y0; // Global tile coordinate: start y (inclusive)
839 uint16_t tile_x1; // Global tile coordinate: end x (exclusive)
840 uint16_t tile_y1; // Global tile coordinate: end y (exclusive)
841 uint16_t num_tile_cols; // Number of tile columns in the image's tile grid
846 */
847typedef struct _grk_plugin_pass
849 double distortion_decrease; /* distortion decrease up to and including this pass */
850 size_t rate; /* rate up to and including this pass */
851 size_t length; /* stream length for this pass */
853
857 */
858typedef struct _grk_plugin_code_block
859{
860 /**************************
861 debug info
862 **************************/
863 uint32_t x0, y0, x1, y1; /* x0, y0, x1, y1 */
864 unsigned int* context_stream; /* context stream */
865 /***************************/
867 uint32_t num_pix; /* number of pixels */
868 uint8_t* compressed_data; /* compressed data */
869 uint32_t compressed_data_length; /* compressed data length */
870 uint8_t num_bit_planes; /* number of bit planes */
871 uint8_t num_passes; /* number of passes */
873 unsigned int sorted_index; /* sorted index */
875
879 */
880typedef struct _grk_plugin_precinct
882 uint64_t num_blocks; /* number of blocks */
885
889 */
890typedef struct _grk_plugin_band
892 uint8_t orientation; /* orientation */
893 uint64_t num_precincts; /* number of precincts */
895 float stepsize; /* stepsize */
897
901 */
902typedef struct _grk_plugin_resolution
904 uint8_t level; /* level */
905 uint8_t num_bands; /* number of bands */
906 grk_plugin_band** band; /* band */
908
912 */
913typedef struct grk_plugin_tile_component
915 uint8_t numresolutions; /* number of resolutions */
919#define GRK_DECODE_HEADER (1 << 0)
920#define GRK_DECODE_T2 (1 << 1)
921#define GRK_DECODE_T1 (1 << 2)
922#define GRK_DECODE_POST_T1 (1 << 3)
923#define GRK_PLUGIN_DECODE_CLEAN (1 << 4)
924#define GRK_DECODE_ALL \
925 (GRK_PLUGIN_DECODE_CLEAN | GRK_DECODE_HEADER | GRK_DECODE_T2 | GRK_DECODE_T1 | GRK_DECODE_POST_T1)
926
930 */
931typedef struct _grk_plugin_tile
933 uint32_t decompress_flags; /* decompress flags */
934 uint16_t num_components; /* number of components */
937
941GRK_API const char* GRK_CALLCONV grk_version(void);
942
949GRK_API bool GRK_CALLCONV grk_initialize(const char* pluginPath, uint32_t num_threads);
950
956
962
963/*
964 * @brief Decrements ref count
965 * @param obj Grok object (see @ref grk_object)
966 */
968
974
983GRK_API grk_image* GRK_CALLCONV grk_image_new(uint16_t numcmpts, grk_image_comp* cmptparms,
984 GRK_COLOR_SPACE clrspc, bool alloc_data);
985
990
999GRK_API bool GRK_CALLCONV grk_decompress_detect_format(const char* file_name,
1000 GRK_CODEC_FORMAT* fmt);
1001
1013
1021 grk_object* codec);
1022
1031 grk_decompress_get_progression_state(grk_object* codec, uint16_t tile_index);
1032
1040 grk_progression_state state);
1041
1049 grk_header_info* header_info);
1050
1058 uint16_t tile_index, bool wait);
1059
1066
1079GRK_API bool GRK_CALLCONV grk_decompress_set_window(grk_object* codec, double start_x,
1080 double start_y, double end_x, double end_y);
1081
1089
1097
1104GRK_API bool GRK_CALLCONV grk_decompress_tile(grk_object* codec, uint16_t tile_index);
1105
1106/* COMPRESSION FUNCTIONS*/
1107
1112typedef struct _grk_synthesis
1114 bool do_synthesis; /* do synthesis */
1115 uint32_t width; /* width */
1116 uint32_t height; /* height */
1117 uint8_t precision; /* precision */
1118 uint16_t numcomps; /* number of components */
1120
1125typedef struct _grk_cparameters
1127 bool tile_size_on; /* tile size on */
1128 uint32_t tx0; /* XTOsiz */
1129 uint32_t ty0; /* YTOsiz */
1130 uint32_t t_width; /* XTsiz */
1131 uint32_t t_height; /* YTsiz */
1132 uint16_t numlayers; /* number of layers */
1134 bool allocation_by_rate_distortion; /* allocation by rate distortion */
1137 double layer_rate[GRK_MAX_LAYERS]; /* layer rate */
1138 bool allocation_by_quality; /* rate control allocation by fixed_PSNR quality */
1139 double layer_distortion[GRK_MAX_LAYERS]; /* layer PSNR values */
1141 uint16_t comment_len[GRK_NUM_COMMENTS_SUPPORTED]; /* comment length */
1142 bool is_binary_comment[GRK_NUM_COMMENTS_SUPPORTED]; /* is binary comment */
1143 size_t num_comments; /* number of comments */
1144 uint8_t csty; /* coding style */
1145 uint8_t numgbits; /* number of guard bits */
1146 GRK_PROG_ORDER prog_order; /* progression order (default LRCP)*/
1147 grk_progression progression[GRK_MAXRLVLS]; /* progression array */
1148 uint32_t numpocs; /* number of progression order changes (POCs) */
1149 uint8_t numresolution; /* number of resolutions */
1150 uint32_t cblockw_init; /* nominal code block width (default 64) */
1151 uint32_t cblockh_init; /* nominal code block height (default 64) */
1152 uint8_t cblk_sty; /* code block style */
1153 bool irreversible; /* true if irreversible compression enabled, default false */
1156 int32_t roi_compno; /* ROI component number */
1157 uint32_t roi_shift; /* ROI upshift */
1158 /* number of precinct size specifications */
1159 uint32_t res_spec; /* res spec */
1160 uint32_t prcw_init[GRK_MAXRLVLS]; /* nominal precinct width */
1161 uint32_t prch_init[GRK_MAXRLVLS]; /* nominal precinct height */
1162 char infile[GRK_PATH_LEN]; /* input file */
1163 char outfile[GRK_PATH_LEN]; /* output file */
1164 uint32_t image_offset_x0; /* image offset x0 */
1165 uint32_t image_offset_y0; /* image offset y0 */
1166 uint8_t subsampling_dx; /* subsampling dx */
1167 uint8_t subsampling_dy; /* subsampling dy */
1168 GRK_SUPPORTED_FILE_FMT decod_format; /* input decode format */
1169 GRK_SUPPORTED_FILE_FMT cod_format; /* output code format */
1170 grk_raw_cparameters raw_cp; /* raw parameters */
1171 bool enable_tile_part_generation; /* enable tile part generation */
1172 uint8_t new_tile_part_progression_divider; /* new tile part progression divider */
1173 uint8_t mct; /* MCT */
1176 void* mct_data; /* MCT data */
1183 uint64_t max_cs_size; /* max code stream size */
1188 uint64_t max_comp_size; /* max component size */
1191 uint16_t rsiz; /* RSIZ */
1192 uint16_t framerate; /* frame rate */
1194 bool write_capture_resolution_from_file; /* write capture resolution from file */
1195 double capture_resolution_from_file[2]; /* capture resolution from file */
1196 bool write_capture_resolution; /* write capture resolution */
1197 double capture_resolution[2]; /* capture resolution */
1198 bool write_display_resolution; /* write display resolution */
1199 double display_resolution[2]; /* display resolution */
1201 bool apply_icc; /* apply ICC */
1204 uint32_t num_threads; /* number of threads */
1205 int32_t device_id; /* device ID */
1206 uint32_t duration; /* duration seconds */
1207 uint32_t kernel_build_options; /* kernel build options */
1208 uint32_t repeats; /* repeats */
1209 bool write_plt; /* write PLT */
1210 bool write_tlm; /* write TLM */
1211 bool verbose; /* verbose */
1212 bool shared_memory_interface; /* shared memory interface */
1213 grk_synthesis synth; /* synthesis */
1215
1235
1244 grk_cparameters* parameters, grk_image* image);
1252
1259GRK_API void GRK_CALLCONV grk_dump_codec(grk_object* codec, uint32_t info_flag,
1260 FILE* output_stream);
1261
1271GRK_API bool GRK_CALLCONV grk_set_MCT(grk_cparameters* parameters, const float* encoding_matrix,
1272 int32_t* dc_shift, uint32_t nb_comp);
1273
1274/* Decoder state flags */
1275#define GRK_IMG_INFO 1 /* Basic image information provided to the user */
1276#define GRK_MH_INFO 2 /* Codestream information based only on the main header */
1277#define GRK_TH_INFO 4 /* Tile information based on the current tile header */
1278#define GRK_TCH_INFO 8
1279#define GRK_MH_IND 16
1280#define GRK_TH_IND 32
1281
1282/* Code block styles */
1283#define GRK_CBLKSTY_LAZY 0x01
1284#define GRK_CBLKSTY_RESET 0x02
1285#define GRK_CBLKSTY_TERMALL 0x04
1286#define GRK_CBLKSTY_VSC 0x08
1287#define GRK_CBLKSTY_PTERM 0x10
1288#define GRK_CBLKSTY_SEGSYM 0x20
1289#define GRK_CBLKSTY_HT_ONLY 0x40
1290#define GRK_CBLKSTY_HT_MIXED 0xC0
1291#define GRK_JPH_RSIZ_FLAG 0x4000
1292
1293/*****************************************************************************
1294 * JPEG 2000 Profiles, see Table A.10 from 15444-1 (updated in various AMDs)
1295 *
1296 * These values help choose the RSIZ value for the JPEG 2000 code stream.
1297 * The RSIZ value forces various compressing options, as detailed in Table A.10.
1298 * If GRK_PROFILE_PART2 is chosen, it must be combined with one or more extensions
1299 * described below.
1300 *
1301 * Example: rsiz = GRK_PROFILE_PART2 | GRK_EXTENSION_MCT;
1302 *
1303 * For broadcast profiles, the GRK_PROFILE_X value has to be combined with the target
1304 * level (3-0 LSB, value between 0 and 11):
1305 * Example: rsiz = GRK_PROFILE_BC_MULTI | 0x0005; //level equals 5
1306 *
1307 * For IMF profiles, the GRK_PROFILE_X value has to be combined with the target main-level
1308 * (3-0 LSB, value between 0 and 11) and sub-level (7-4 LSB, value between 0 and 9):
1309 * Example: rsiz = GRK_PROFILE_IMF_2K | 0x0040 | 0x0005; // main-level equals 5 and sub-level
1310 * equals 4
1311 *
1312 * */
1313#define GRK_PROFILE_NONE 0x0000
1314#define GRK_PROFILE_0 0x0001
1315#define GRK_PROFILE_1 0x0002
1316#define GRK_PROFILE_CINEMA_2K 0x0003
1317#define GRK_PROFILE_CINEMA_4K 0x0004
1318#define GRK_PROFILE_CINEMA_S2K 0x0005
1319#define GRK_PROFILE_CINEMA_S4K 0x0006
1320#define GRK_PROFILE_CINEMA_LTS \
1321 0x0007
1322#define GRK_PROFILE_BC_SINGLE 0x0100
1323#define GRK_PROFILE_BC_MULTI 0x0200
1324#define GRK_PROFILE_BC_MULTI_R \
1325 0x0300
1326#define GRK_PROFILE_BC_MASK 0x030F
1327#define GRK_PROFILE_IMF_2K 0x0400
1328#define GRK_PROFILE_IMF_4K 0x0500
1329#define GRK_PROFILE_IMF_8K 0x0600
1330#define GRK_PROFILE_IMF_2K_R \
1331 0x0700
1332#define GRK_PROFILE_IMF_4K_R \
1333 0x0800
1334#define GRK_PROFILE_IMF_8K_R \
1335 0x0900
1336#define GRK_PROFILE_MASK 0x0FFF
1337#define GRK_PROFILE_PART2 0x8000
1338#define GRK_PROFILE_PART2_EXTENSIONS_MASK 0x3FFF /* Mask for Part-2 extension bits */
1339
1343#define GRK_EXTENSION_NONE 0x0000
1344#define GRK_EXTENSION_MCT 0x0100
1345#define GRK_IS_PART2(v) ((v) & GRK_PROFILE_PART2)
1347#define GRK_IS_CINEMA(v) (((v) >= GRK_PROFILE_CINEMA_2K) && ((v) <= GRK_PROFILE_CINEMA_S4K))
1348#define GRK_IS_STORAGE(v) ((v) == GRK_PROFILE_CINEMA_LTS)
1349
1350/*
1351 *
1352 * *********************************************
1353 * Broadcast level (3-0 LSB) (15444-1 AMD4,AMD8)
1354 * *********************************************
1355 *
1356 * indicates maximum bit rate and sample rate for a code stream
1357 *
1358 * Note: Mbit/s == 10^6 bits/s; Msamples/s == 10^6 samples/s
1359 *
1360 * 0: no maximum rate
1361 * 1: 200 Mbits/s, 65 Msamples/s
1362 * 2: 200 Mbits/s, 130 Msamples/s
1363 * 3: 200 Mbits/s, 195 Msamples/s
1364 * 4: 400 Mbits/s, 260 Msamples/s
1365 * 5: 800Mbits/s, 520 Msamples/s
1366 * >= 6: 2^(level-6) * 1600 Mbits/s, 2^(level-6) * 1200 Msamples/s
1367 *
1368 * Note: level cannot be greater than 11
1369 *
1370 * ****************
1371 * Broadcast tiling
1372 * ****************
1373 *
1374 * Either single-tile or multi-tile. Multi-tile only permits
1375 * 1 or 4 tiles per frame, where multiple tiles have identical
1376 * sizes, and are configured in either 2x2 or 1x4 layout.
1377 *
1378 *************************************************************
1379 *
1380 * ***************************************
1381 * IMF main-level (3-0) LSB (15444-1 AMD8)
1382 * ***************************************
1383 *
1384 * main-level indicates maximum number of samples per second,
1385 * as listed above.
1386 *
1387 *
1388 * **************************************
1389 * IMF sub-level (7-4) LSB (15444-1 AMD8)
1390 * **************************************
1391 *
1392 * sub-level indicates maximum bit rate for a code stream:
1393 *
1394 * 0: no maximum rate
1395 * >0: 2^sub-level * 100 Mbits/second
1396 *
1397 * Note: sub-level cannot be greater than 9, and cannot be larger
1398 * then maximum of (main-level -2) and 1.
1399 *
1400 */
1402#define GRK_GET_IMF_OR_BROADCAST_PROFILE(v) \
1403 ((v) & 0x0f00)
1405#define GRK_LEVEL_MAX 11U
1406#define GRK_GET_LEVEL(v) ((v) & 0xf)
1407
1408/******* BROADCAST **********************************************************/
1410#define GRK_IS_BROADCAST(v) \
1411 (((v) >= GRK_PROFILE_BC_SINGLE) && ((v) <= (GRK_PROFILE_BC_MULTI_R | 0x000b)) && \
1412 (((v) & 0xf) <= 0xb))
1413
1414/* Maximum component sampling Rate (Mbits/sec) per level */
1415#define GRK_BROADCAST_LEVEL_1_MBITSSEC 200U
1416#define GRK_BROADCAST_LEVEL_2_MBITSSEC 200U
1417#define GRK_BROADCAST_LEVEL_3_MBITSSEC 200U
1418#define GRK_BROADCAST_LEVEL_4_MBITSSEC 400U
1419#define GRK_BROADCAST_LEVEL_5_MBITSSEC 800U
1420#define GRK_BROADCAST_LEVEL_6_MBITSSEC 1600U
1421#define GRK_BROADCAST_LEVEL_7_MBITSSEC 3200U
1422#define GRK_BROADCAST_LEVEL_8_MBITSSEC 6400U
1423#define GRK_BROADCAST_LEVEL_9_MBITSSEC 12800U
1424#define GRK_BROADCAST_LEVEL_10_MBITSSEC 25600U
1425#define GRK_BROADCAST_LEVEL_11_MBITSSEC 51200U
1427#define GRK_BROADCAST_LEVEL_1_MSAMPLESSEC 64U
1428#define GRK_BROADCAST_LEVEL_2_MSAMPLESSEC 130U
1429#define GRK_BROADCAST_LEVEL_3_MSAMPLESSEC 195U
1430#define GRK_BROADCAST_LEVEL_4_MSAMPLESSEC 260U
1431#define GRK_BROADCAST_LEVEL_5_MSAMPLESSEC 520U
1432#define GRK_BROADCAST_LEVEL_6_MSAMPLESSEC 1200U
1433#define GRK_BROADCAST_LEVEL_7_MSAMPLESSEC 2400U
1434#define GRK_BROADCAST_LEVEL_8_MSAMPLESSEC 4800U
1435#define GRK_BROADCAST_LEVEL_9_MSAMPLESSEC 9600U
1436#define GRK_BROADCAST_LEVEL_10_MSAMPLESSEC 19200U
1437#define GRK_BROADCAST_LEVEL_11_MSAMPLESSEC 38400U
1438
1439/********IMF *****************************************************************/
1441#define GRK_IS_IMF(v) \
1442 (((v) >= GRK_PROFILE_IMF_2K) && ((v) <= (GRK_PROFILE_IMF_8K_R | 0x009b)) && \
1443 (((v) & 0xf) <= 0xb) && (((v) & 0xf0) <= 0x90))
1444
1445/* Maximum component sampling rate (MSamples/sec) per main level */
1446#define GRK_IMF_MAINLEVEL_1_MSAMPLESSEC 65U
1447#define GRK_IMF_MAINLEVEL_2_MSAMPLESSEC 130U
1448#define GRK_IMF_MAINLEVEL_3_MSAMPLESSEC 195U
1449#define GRK_IMF_MAINLEVEL_4_MSAMPLESSEC 260U
1450#define GRK_IMF_MAINLEVEL_5_MSAMPLESSEC 520U
1451#define GRK_IMF_MAINLEVEL_6_MSAMPLESSEC 1200U
1452#define GRK_IMF_MAINLEVEL_7_MSAMPLESSEC 2400U
1453#define GRK_IMF_MAINLEVEL_8_MSAMPLESSEC 4800U
1454#define GRK_IMF_MAINLEVEL_9_MSAMPLESSEC 9600U
1455#define GRK_IMF_MAINLEVEL_10_MSAMPLESSEC 19200U
1456#define GRK_IMF_MAINLEVEL_11_MSAMPLESSEC 38400U
1458#define GRK_IMF_SUBLEVEL_MAX 9U
1459#define GRK_GET_IMF_SUBLEVEL(v) (((v) >> 4) & 0xf)
1460
1462#define GRK_IMF_SUBLEVEL_1_MBITSSEC 200U
1463#define GRK_IMF_SUBLEVEL_2_MBITSSEC 400U
1464#define GRK_IMF_SUBLEVEL_3_MBITSSEC 800U
1465#define GRK_IMF_SUBLEVEL_4_MBITSSEC 1600U
1466#define GRK_IMF_SUBLEVEL_5_MBITSSEC 3200U
1467#define GRK_IMF_SUBLEVEL_6_MBITSSEC 6400U
1468#define GRK_IMF_SUBLEVEL_7_MBITSSEC 12800U
1469#define GRK_IMF_SUBLEVEL_8_MBITSSEC 25600U
1470#define GRK_IMF_SUBLEVEL_9_MBITSSEC 51200U
1471/**********************************************************************************/
1472
1477#define GRK_CINEMA_DCI_MAX_BANDWIDTH 250000000
1479#define GRK_CINEMA_24_CS 1302083
1480#define GRK_CINEMA_24_COMP 1041666
1482#define GRK_CINEMA_48_CS 651041
1483#define GRK_CINEMA_48_COMP 520833
1485#define GRK_CINEMA_4K_DEFAULT_NUM_RESOLUTIONS 7 /* Default number of resolutions for 4K cinema */
1486
1487/*
1488 * CIE Lab #defines
1490#define GRK_CUSTOM_CIELAB_SPACE 0x0
1491#define GRK_DEFAULT_CIELAB_SPACE 0x44454600 /* 'DEF' */
1492
1493/*************************************************************************************
1494 Plugin Interface
1495 *************************************************************************************/
1496
1502typedef struct _grk_plugin_load_info
1504 const char* pluginPath; /* plugin path */
1505 bool verbose; /* verbose */
1507
1514
1519
1523#define GRK_PLUGIN_STATE_NO_DEBUG 0x0
1524
1525/*
1526 For compress debugging, the plugin first performs a T1 compress.
1527 Then:
1528 1. perform host DWT on plugin MCT data, and write to host image
1529 This way, both plugin and host start from same point
1530 (assume MCT is equivalent for both host and plugin)
1531 2. map plugin DWT data, compare with host DWT, and then write to plugin image
1532 At this point in the code, the plugin image holds plugin DWT data. And if no warnings are
1533 triggered, then we can safely say that host and plugin DWT data are identical.
1534 3. Perform host compress, skipping MCT and DWT (they have already been performed)
1535 4. during host compress, each context that is formed is compared against context stream from plugin
1536 5. rate control - synch with plugin code stream, and compare
1537 6. T2 and store to disk
1538 */
1540#define GRK_PLUGIN_STATE_DEBUG 0x1
1541#define GRK_PLUGIN_STATE_PRE_TR1 0x2
1542#define GRK_PLUGIN_STATE_DWT_QUANTIZATION 0x4
1543#define GRK_PLUGIN_STATE_MCT_ONLY 0x8
1544
1549
1550/*
1551 * @struct grk_plugin_init_info
1552 * @brief Plugin init info
1554typedef struct _grk_plugin_init_info
1556 int32_t device_id; /* device ID */
1557 bool verbose; /* verbose */
1558 const char* license; /* license */
1559 const char* server; /* server */
1561
1567
1574 const char* input_file_name; /* input file name */
1575 bool output_file_name_is_relative; /* output file name is relative */
1576 const char* output_file_name; /* output file name */
1577 grk_cparameters* compressor_parameters; /* compressor parameters */
1578 grk_image* image; /* image */
1580 grk_stream_params stream_params; /* stream parameters */
1581 unsigned int error_code; /* error code */
1582 bool transfer_exif_tags; /* transfer EXIF tags */
1584
1590
1594typedef struct grk_plugin_compress_batch_info
1596 const char* input_dir; /* input directory */
1597 const char* output_dir; /* output directory */
1598 grk_cparameters* compress_parameters; /* compress parameters */
1601
1607GRK_API int32_t GRK_CALLCONV grk_plugin_compress(grk_cparameters* compress_parameters,
1609
1617
1622
1627
1631typedef int (*GROK_INIT_DECOMPRESSORS)(grk_header_info* header_info, grk_image* image);
1632
1639 size_t device_id; /* device ID */
1641 const char* input_file_name; /* input file name */
1642 const char* output_file_name; /* output file name */
1643 /* input file format 0: J2K, 1: JP2 */
1644 GRK_CODEC_FORMAT decod_format; /* decode format */
1645 /* output file format 0: PGX, 1: PxM, 2: BMP etc */
1647 grk_object* codec; /* codec */
1648 grk_header_info header_info; /* header info */
1650 grk_image* image; /* image */
1651 bool plugin_owns_image; /* plugin owns image */
1653 unsigned int error_code; /* error code */
1654 uint32_t decompress_flags; /* decompress flags */
1655 uint32_t full_image_x0; /* full image x0 */
1656 uint32_t full_image_y0; /* full image y0 */
1657 void* user_data; /* user data */
1659
1666
1675
1685 const char* input_dir, const char* output_dir, grk_decompress_parameters* decompress_parameters,
1687
1693
1698
1699#ifndef SWIG
1700#ifdef __cplusplus
1701}
1702#endif
1703#endif
struct _grk_plugin_init_info grk_plugin_init_info
_GRK_SUPPORTED_FILE_FMT
All Grok supported file formats.
Definition grok.h:286
@ GRK_FMT_BMP
Definition grok.h:293
@ GRK_FMT_JP2
Definition grok.h:289
@ GRK_FMT_J2K
Definition grok.h:288
@ GRK_FMT_PNG
Definition grok.h:296
@ GRK_FMT_YUV
Definition grok.h:299
@ GRK_FMT_RAWL
Definition grok.h:297
@ GRK_FMT_UNK
Definition grok.h:287
@ GRK_FMT_TIF
Definition grok.h:294
@ GRK_FMT_JPG
Definition grok.h:298
@ GRK_FMT_PXM
Definition grok.h:290
@ GRK_FMT_RAW
Definition grok.h:295
@ GRK_FMT_PAM
Definition grok.h:292
@ GRK_FMT_PGX
Definition grok.h:291
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:478
struct _grk_cparameters grk_cparameters
struct _grk_progression grk_progression
struct _grk_image grk_image
Definition grok.h:583
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:489
GRK_API void GRK_CALLCONV grk_plugin_stop_batch_compress(void)
Stops batch compress.
Definition grok.cpp:974
GRK_API grk_object *GRK_CALLCONV grk_object_ref(grk_object *obj)
Increments ref count.
Definition grok.cpp:217
GRK_API void GRK_CALLCONV grk_plugin_stop_batch_decompress(void)
Stops batch decompress.
Definition grok.cpp:1071
void(* grk_decompress_callback)(void *codec, uint16_t tile_index, grk_image *tile_image, uint8_t reduction, void *user_data)
Callback called when decompression of a tile has completed.
Definition grok.h:588
struct _grk_channel_description grk_channel_description
#define GRK_NUM_COMMENTS_SUPPORTED
maximum Grok supported number of comments
Definition grok.h:122
void(* grk_msg_callback)(const char *msg, void *client_data)
Logging callback.
Definition grok.h:165
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:580
bool(* grk_io_pixels_callback)(uint32_t worker_id, grk_io_buf buffer, void *user_data)
Grok IO pixels callback.
Definition grok.h:499
GRK_API void GRK_CALLCONV grk_plugin_cleanup(void)
Cleans up plugin resources.
Definition grok.cpp:892
GRK_API void GRK_CALLCONV grk_set_msg_handlers(grk_msg_handlers msg_handlers)
Sets log message handlers.
Definition grok.cpp:235
GRK_API bool GRK_CALLCONV grk_plugin_load(grk_plugin_load_info info)
Loads plugin.
Definition grok.cpp:850
uint64_t(* GRK_PLUGIN_COMPRESS_USER_CALLBACK)(grk_plugin_compress_user_callback_info *info)
Plugin compress user callback.
Definition grok.h:1588
#define GRK_MAXRLVLS
Definition grok.h:322
bool(* grk_io_callback)(uint32_t worker_id, grk_io_buf buffer, void *io_user_data)
Grok IO callback.
Definition grok.h:480
enum _GRK_CODEC_FORMAT GRK_CODEC_FORMAT
Grok Supported JPEG 2000 formats.
enum _GRK_ENUM_COLOUR_SPACE GRK_ENUM_COLOUR_SPACE
JPEG 2000 enumerated color spaces.
GRK_API void GRK_CALLCONV grk_decompress_wait(grk_object *codec, grk_wait_swath *swath)
Waits for an asynchronous decompression to complete.
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:518
GRK_API uint32_t GRK_CALLCONV grk_plugin_get_debug_state()
Gets debug state of plugin.
Definition grok.cpp:877
struct _grk_precision grk_precision
#define GRK_MAX_PASSES
Grok maximum number of passes.
Definition grok.h:158
GRK_API int32_t GRK_CALLCONV grk_plugin_batch_decompress(void)
Initiates batch decompress.
Definition grok.cpp:1057
enum _GRK_PROG_ORDER GRK_PROG_ORDER
Progression orders.
struct _grk_object grk_object
GRK_API grk_image *GRK_CALLCONV grk_decompress_get_image(grk_object *codec)
Gets decompressed image.
Definition grok.cpp:587
GRK_API bool GRK_CALLCONV grk_initialize(const char *pluginPath, uint32_t num_threads)
Initializes Grok library Must be called before any Grok API calls.
Definition grok.cpp:159
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:464
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:926
_GRK_CHANNEL_ASSOC
Channel association.
Definition grok.h:374
@ GRK_CHANNEL_ASSOC_COLOUR_1
Definition grok.h:376
@ GRK_CHANNEL_ASSOC_COLOUR_2
Definition grok.h:377
@ GRK_CHANNEL_ASSOC_COLOUR_3
Definition grok.h:378
@ GRK_CHANNEL_ASSOC_WHOLE_IMAGE
Definition grok.h:375
@ GRK_CHANNEL_ASSOC_UNASSOCIATED
Definition grok.h:379
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:508
struct _grk_image_meta grk_image_meta
struct _grk_asoc grk_asoc
enum _GRK_SUPPORTED_FILE_FMT GRK_SUPPORTED_FILE_FMT
All Grok 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:572
GRK_API grk_image *GRK_CALLCONV grk_decompress_get_tile_image(grk_object *codec, uint16_t tile_index, bool wait)
Gets decompressed tile image.
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 Format is either GRK_FMT_J2K, GRK_FMT_JP2 or GRK_FMT_MJ2.
Definition grok.cpp:343
GRK_API bool GRK_CALLCONV grk_decompress_tile(grk_object *codec, uint16_t tile_index)
Decompresses a specific tile.
Definition grok.cpp:507
#define GRK_API
Definition grok.h:54
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 Grok library Not usually necessary to explicitly call this to de-initialize.
Definition grok.cpp:211
GRK_API void GRK_CALLCONV grk_object_unref(grk_object *obj)
Definition grok.cpp:226
#define GRK_MAX_LAYERS
Definition grok.h:314
GRK_API void GRK_CALLCONV grk_compress_set_default_params(grk_cparameters *parameters)
Sets compression parameters to default values: Lossless Single tile Size of precinct : 2^15 x 2^15 Si...
Definition grok.cpp:617
struct _grk_plugin_precinct grk_plugin_precinct
grk_plugin_precinct
GRK_API const char *GRK_CALLCONV grk_version(void)
Gets library version.
Definition grok.cpp:296
_GRK_COLOR_SPACE
Grok supported color spaces.
Definition grok.h:80
@ GRK_CLRSPC_SRGB
unknown
Definition grok.h:82
@ GRK_CLRSPC_EYCC
standard YCC (YUV)
Definition grok.h:85
@ GRK_CLRSPC_UNKNOWN
Definition grok.h:81
@ GRK_CLRSPC_SYCC
grayscale
Definition grok.h:84
@ GRK_CLRSPC_DEFAULT_CIE
CMYK.
Definition grok.h:87
@ GRK_CLRSPC_ICC
custom CIE LAB
Definition grok.h:89
@ GRK_CLRSPC_CMYK
extended YCC
Definition grok.h:86
@ GRK_CLRSPC_GRAY
sRGB
Definition grok.h:83
@ GRK_CLRSPC_CUSTOM_CIE
default CIE LAB
Definition grok.h:88
GRK_API bool GRK_CALLCONV grk_plugin_init(grk_plugin_init_info init_info)
Initializes plugin.
Definition grok.cpp:897
GRK_API bool GRK_CALLCONV grk_set_MCT(grk_cparameters *parameters, const float *encoding_matrix, int32_t *dc_shift, uint32_t nb_comp)
Sets MCT matrix.
Definition grok.cpp:529
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:490
struct _grk_io_buf grk_io_buf
_grk_precision_mode
Definition grok.h:420
@ GRK_PREC_MODE_SCALE
Definition grok.h:422
@ GRK_PREC_MODE_CLIP
Definition grok.h:421
GRK_API grk_image_meta *GRK_CALLCONV grk_image_meta_new(void)
Creates meta.
Definition grok.cpp:307
enum _GRK_COLOR_SPACE GRK_COLOR_SPACE
Grok supported color spaces.
#define GRK_PATH_LEN
Definition grok.h:313
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:301
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:1022
bool(* grk_stream_seek_fn)(uint64_t offset, void *user_data)
Seek (absolute) callback.
Definition grok.h:524
GRK_API grk_object *GRK_CALLCONV grk_decompress_init(grk_stream_params *stream_params, grk_decompress_parameters *params)
Initializes decompressor.
Definition grok.cpp:427
_GRK_ENUM_COLOUR_SPACE
JPEG 2000 enumerated color spaces.
Definition grok.h:96
@ GRK_ENUM_CLRSPC_ESRGB
Definition grok.h:112
@ GRK_ENUM_CLRSPC_CMY
Definition grok.h:103
@ GRK_ENUM_CLRSPC_EYCC
Definition grok.h:116
@ GRK_ENUM_CLRSPC_CIEJAB
Definition grok.h:111
@ GRK_ENUM_CLRSPC_GRAY
Definition grok.h:109
@ GRK_ENUM_CLRSPC_CIE
Definition grok.h:106
@ GRK_ENUM_CLRSPC_UNKNOWN
Definition grok.h:97
@ GRK_ENUM_CLRSPC_YCBCR3
Definition grok.h:101
@ GRK_ENUM_CLRSPC_ROMMRGB
Definition grok.h:113
@ GRK_ENUM_CLRSPC_YPBPR60
Definition grok.h:114
@ GRK_ENUM_CLRSPC_SRGB
Definition grok.h:108
@ GRK_ENUM_CLRSPC_BILEVEL2
Definition grok.h:107
@ GRK_ENUM_CLRSPC_SYCC
Definition grok.h:110
@ GRK_ENUM_CLRSPC_PHOTO_YCC
Definition grok.h:102
@ GRK_ENUM_CLRSPC_YCBCR1
Definition grok.h:99
@ GRK_ENUM_CLRSPC_CMYK
Definition grok.h:104
@ GRK_ENUM_CLRSPC_YCCK
Definition grok.h:105
@ GRK_ENUM_CLRSPC_YPBPR50
Definition grok.h:115
@ GRK_ENUM_CLRSPC_BILEVEL1
Definition grok.h:98
@ GRK_ENUM_CLRSPC_YCBCR2
Definition grok.h:100
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:1039
struct _grk_decompress_params grk_decompress_parameters
_GRK_CHANNEL_TYPE
Definition grok.h:363
@ GRK_CHANNEL_TYPE_OPACITY
Definition grok.h:365
@ GRK_CHANNEL_TYPE_PREMULTIPLIED_OPACITY
Definition grok.h:366
@ GRK_CHANNEL_TYPE_COLOUR
Definition grok.h:364
@ GRK_CHANNEL_TYPE_UNSPECIFIED
Definition grok.h:367
_GRK_RATE_CONTROL_ALGORITHM
Rate control algorithms.
Definition grok.h:277
@ GRK_RATE_CONTROL_PCRD_OPT
Definition grok.h:279
@ GRK_RATE_CONTROL_BISECT
Definition grok.h:278
GRK_API bool GRK_CALLCONV grk_decompress_update(grk_decompress_parameters *params, grk_object *codec)
Updates decompressor.
Definition grok.cpp:706
GRK_API int32_t GRK_CALLCONV grk_plugin_batch_compress(grk_plugin_compress_batch_info info)
Batch-compresses with plugin.
Definition grok.cpp:942
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:1630
_GRK_CODEC_FORMAT
Grok Supported JPEG 2000 formats.
Definition grok.h:306
@ GRK_CODEC_J2K
unknown format
Definition grok.h:308
@ GRK_CODEC_MJ2
JPEG 2000 JP2 file format.
Definition grok.h:310
@ GRK_CODEC_JP2
JPEG 2000 code-stream.
Definition grok.h:309
@ GRK_CODEC_UNK
Definition grok.h:307
struct _grk_plugin_tile grk_plugin_tile
#define GRK_CALLCONV
Definition grok.h:50
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:723
void(* grk_stream_free_user_data_fn)(void *user_data)
Free user data callback.
Definition grok.h:530
#define GRK_NUM_ASOC_BOXES_SUPPORTED
maximum Grok supported number of asoc boxes
Definition grok.h:127
_GRK_PROG_ORDER
Progression orders.
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:517
GRK_API void GRK_CALLCONV grk_plugin_wait_for_batch_complete(void)
Waits for batch job to complete.
Definition grok.cpp:960
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:646
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:1664
Definition grok.h:408
const char * label
Definition grok.h:410
uint8_t * xml
Definition grok.h:411
uint32_t level
Definition grok.h:409
uint32_t xml_len
Definition grok.h:412
Definition grok.h:398
uint16_t num_channel_descriptions
Definition grok.h:400
grk_channel_description * descriptions
Definition grok.h:399
Definition grok.h:387
uint16_t typ
Definition grok.h:389
uint16_t asoc
Definition grok.h:390
uint16_t channel
Definition grok.h:388
Definition grok.h:700
grk_channel_definition * channel_definition
Definition grok.h:704
char * icc_profile_name
Definition grok.h:703
uint32_t icc_profile_len
Definition grok.h:702
uint8_t * icc_profile_buf
Definition grok.h:701
grk_palette_data * palette
Definition grok.h:705
bool has_colour_specification_box
Definition grok.h:706
Definition grok.h:334
uint16_t component
Definition grok.h:335
uint8_t palette_column
Definition grok.h:337
uint8_t mapping_type
Definition grok.h:336
Definition grok.h:1125
uint32_t cblockw_init
Definition grok.h:1149
uint8_t numgbits
Definition grok.h:1144
grk_progression progression[GRK_MAXRLVLS]
Definition grok.h:1146
char outfile[GRK_PATH_LEN]
Definition grok.h:1162
bool apply_icc
Definition grok.h:1200
GRK_PROG_ORDER prog_order
Definition grok.h:1145
uint16_t comment_len[GRK_NUM_COMMENTS_SUPPORTED]
Definition grok.h:1140
uint32_t repeats
Definition grok.h:1207
uint32_t prch_init[GRK_MAXRLVLS]
Definition grok.h:1160
bool verbose
Definition grok.h:1210
uint32_t image_offset_x0
Definition grok.h:1163
uint64_t max_cs_size
Maximum size (in bytes) for the whole code stream.
Definition grok.h:1182
grk_synthesis synth
Definition grok.h:1212
grk_raw_cparameters raw_cp
Definition grok.h:1169
uint8_t numresolution
Definition grok.h:1148
uint32_t image_offset_y0
Definition grok.h:1164
GRK_SUPPORTED_FILE_FMT decod_format
Definition grok.h:1167
uint32_t cblockh_init
Definition grok.h:1150
uint32_t roi_shift
Definition grok.h:1156
bool shared_memory_interface
Definition grok.h:1211
uint8_t subsampling_dy
Definition grok.h:1166
uint32_t prcw_init[GRK_MAXRLVLS]
Definition grok.h:1159
bool tile_size_on
Definition grok.h:1126
uint32_t t_height
Definition grok.h:1130
bool write_capture_resolution_from_file
Definition grok.h:1193
uint32_t res_spec
Definition grok.h:1158
uint64_t max_comp_size
Maximum size (in bytes) for each component.
Definition grok.h:1187
uint32_t num_threads
Definition grok.h:1203
uint8_t mct
Definition grok.h:1172
uint16_t numlayers
Definition grok.h:1131
GRK_SUPPORTED_FILE_FMT cod_format
Definition grok.h:1168
double capture_resolution_from_file[2]
Definition grok.h:1194
bool irreversible
Definition grok.h:1152
uint32_t t_width
Definition grok.h:1129
bool write_display_resolution
Definition grok.h:1197
uint8_t cblk_sty
Definition grok.h:1151
uint8_t csty
Definition grok.h:1143
uint8_t new_tile_part_progression_divider
Definition grok.h:1171
bool is_binary_comment[GRK_NUM_COMMENTS_SUPPORTED]
Definition grok.h:1141
uint16_t rsiz
RSIZ value To be used to combine GRK_PROFILE_*, GRK_EXTENSION_* and (sub)levels values.
Definition grok.h:1190
char infile[GRK_PATH_LEN]
Definition grok.h:1161
double layer_distortion[GRK_MAX_LAYERS]
Definition grok.h:1138
GRK_RATE_CONTROL_ALGORITHM rate_control_algorithm
Definition grok.h:1202
uint32_t kernel_build_options
Definition grok.h:1206
bool write_plt
Definition grok.h:1208
void * mct_data
Naive implementation of MCT restricted to a single reversible array based compressing without offset ...
Definition grok.h:1175
uint32_t tx0
Definition grok.h:1127
char * comment[GRK_NUM_COMMENTS_SUPPORTED]
Definition grok.h:1139
bool write_capture_resolution
Definition grok.h:1195
uint8_t subsampling_dx
Definition grok.h:1165
int32_t device_id
Definition grok.h:1204
size_t num_comments
Definition grok.h:1142
uint16_t framerate
Definition grok.h:1191
bool allocation_by_rate_distortion
rate control allocation by rate/distortion curve
Definition grok.h:1133
bool allocation_by_quality
Definition grok.h:1137
bool write_tlm
Definition grok.h:1209
double display_resolution[2]
Definition grok.h:1198
int32_t roi_compno
region of interest: affected component in [0..3]; -1 indicates no ROI
Definition grok.h:1155
uint32_t ty0
Definition grok.h:1128
uint32_t duration
Definition grok.h:1205
double layer_rate[GRK_MAX_LAYERS]
layers rates expressed as compression ratios.
Definition grok.h:1136
bool enable_tile_part_generation
Definition grok.h:1170
uint32_t numpocs
Definition grok.h:1147
double capture_resolution[2]
Definition grok.h:1196
Definition grok.h:603
grk_io_pixels_callback io_buffer_callback
Definition grok.h:623
uint16_t layers_to_decompress
Set the maximum number of quality layers to decompress.
Definition grok.h:619
bool skip_allocate_composite
Definition grok.h:622
uint32_t disable_random_access_flags
Definition grok.h:621
uint32_t tile_cache_strategy
Definition grok.h:620
void * io_user_data
Definition grok.h:624
uint8_t reduce
Set the number of highest resolution levels to be discarded.
Definition grok.h:612
grk_io_register_reclaim_callback io_register_client_callback
Definition grok.h:625
Definition grok.h:639
double dw_x0
Definition grok.h:650
bool io_xml
Definition grok.h:661
grk_precision * precision
Definition grok.h:656
uint32_t compression_level
Definition grok.h:663
bool asynchronous
Definition grok.h:641
GRK_SUPPORTED_FILE_FMT cod_format
Definition grok.h:649
uint16_t tile_index
Definition grok.h:654
uint32_t num_precision
Definition grok.h:657
char infile[GRK_PATH_LEN]
Definition grok.h:646
double dw_x1
Definition grok.h:651
bool force_rgb
Definition grok.h:658
uint32_t compression
Definition grok.h:662
uint32_t num_threads
Definition grok.h:666
int32_t device_id
Definition grok.h:669
uint32_t kernel_build_options
Definition grok.h:668
void * user_data
Definition grok.h:670
bool single_tile_decompress
Definition grok.h:655
uint32_t repeats
Definition grok.h:665
bool simulate_synchronous
Definition grok.h:642
bool upsample
Definition grok.h:659
grk_decompress_core_params core
Definition grok.h:640
grk_decompress_callback decompress_callback
Definition grok.h:643
double dw_y1
Definition grok.h:653
uint32_t duration
Definition grok.h:664
double dw_y0
Definition grok.h:652
void * decompress_callback_user_data
Definition grok.h:644
bool split_pnm
Definition grok.h:660
GRK_CODEC_FORMAT decod_format
Definition grok.h:648
char outfile[GRK_PATH_LEN]
Definition grok.h:647
Definition grok.h:769
uint32_t cblockh_init
Definition grok.h:775
uint16_t comment_len[GRK_NUM_COMMENTS_SUPPORTED]
Definition grok.h:807
bool upsample
Definition grok.h:817
uint32_t num_precision
Definition grok.h:819
uint16_t num_layers
Definition grok.h:802
uint32_t num_asocs
Definition grok.h:810
char * comment[GRK_NUM_COMMENTS_SUPPORTED]
Definition grok.h:806
uint32_t t_width
Definition grok.h:798
GRK_PROG_ORDER prog_order
Definition grok.h:780
bool is_binary_comment[GRK_NUM_COMMENTS_SUPPORTED]
Definition grok.h:808
uint32_t prch_init[GRK_MAXRLVLS]
Definition grok.h:795
uint16_t t_grid_height
Definition grok.h:801
bool split_by_component
Definition grok.h:820
size_t xml_data_len
Definition grok.h:804
size_t num_comments
Definition grok.h:805
uint8_t csty
Definition grok.h:787
bool force_rgb
Definition grok.h:816
GRK_SUPPORTED_FILE_FMT decompress_fmt
Definition grok.h:815
grk_asoc asocs[GRK_NUM_ASOC_BOXES_SUPPORTED]
Definition grok.h:809
uint32_t tx0
Definition grok.h:796
uint32_t ty0
Definition grok.h:797
uint32_t cblockw_init
Definition grok.h:774
uint16_t rsiz
Definition grok.h:778
grk_precision * precision
Definition grok.h:818
uint8_t mct
Definition grok.h:777
uint8_t numresolutions
Definition grok.h:779
grk_image header_image
Definition grok.h:773
uint16_t t_grid_width
Definition grok.h:800
uint32_t t_height
Definition grok.h:799
uint8_t cblk_sty
Definition grok.h:793
uint32_t prcw_init[GRK_MAXRLVLS]
Definition grok.h:794
bool single_tile_decompress
Definition grok.h:821
uint8_t * xml_data
Definition grok.h:803
bool irreversible
Definition grok.h:776
Definition grok.h:678
uint32_t h
Definition grok.h:683
uint8_t dy
Definition grok.h:685
GRK_CHANNEL_ASSOC association
Definition grok.h:689
GRK_CHANNEL_TYPE type
Definition grok.h:688
uint8_t dx
Definition grok.h:684
bool sgnd
Definition grok.h:687
uint32_t w
Definition grok.h:681
uint8_t prec
Definition grok.h:686
uint16_t crg_x
Definition grok.h:690
int32_t * data
Definition grok.h:692
uint32_t x0
Definition grok.h:679
uint32_t y0
Definition grok.h:680
uint16_t crg_y
Definition grok.h:691
uint32_t stride
Definition grok.h:682
Definition grok.h:714
grk_color color
Definition grok.h:716
uint8_t * xmp_buf
Definition grok.h:719
grk_object obj
Definition grok.h:715
size_t xmp_len
Definition grok.h:720
size_t iptc_len
Definition grok.h:718
uint8_t * iptc_buf
Definition grok.h:717
Definition grok.h:730
uint64_t packed_row_bytes
Definition grok.h:759
grk_precision * precision
Definition grok.h:747
bool has_capture_resolution
Definition grok.h:740
uint16_t numcomps
Definition grok.h:736
bool force_rgb
Definition grok.h:745
uint32_t y0
Definition grok.h:733
bool split_by_component
Definition grok.h:750
GRK_COLOR_SPACE color_space
Definition grok.h:737
uint32_t rows_per_task
Definition grok.h:758
uint32_t rows_per_strip
Definition grok.h:757
bool upsample
Definition grok.h:746
grk_image_comp * comps
Definition grok.h:761
uint8_t decompress_prec
Definition grok.h:754
bool has_multiple_tiles
Definition grok.h:749
grk_io_buf interleaved_data
Definition grok.h:756
GRK_COLOR_SPACE decompress_colour_space
Definition grok.h:755
uint32_t x0
Definition grok.h:732
grk_object obj
Definition grok.h:731
uint32_t num_precision
Definition grok.h:748
uint16_t decompress_num_comps
Definition grok.h:751
bool has_display_resolution
Definition grok.h:742
GRK_SUPPORTED_FILE_FMT decompress_fmt
Definition grok.h:744
double display_resolution[2]
Definition grok.h:743
uint32_t y1
Definition grok.h:735
uint32_t decompress_width
Definition grok.h:752
uint32_t decompress_height
Definition grok.h:753
double capture_resolution[2]
Definition grok.h:741
grk_image_meta * meta
Definition grok.h:760
uint32_t x1
Definition grok.h:734
bool palette_applied
Definition grok.h:738
bool channel_definition_applied
Definition grok.h:739
Definition grok.h:455
size_t alloc_len
Definition grok.h:459
bool pooled
Definition grok.h:460
size_t len
Definition grok.h:458
size_t offset
Definition grok.h:457
uint8_t * data
Definition grok.h:456
uint32_t index
Definition grok.h:461
Definition grok.h:469
uint32_t max_pooled_requests
Definition grok.h:470
Definition grok.h:178
grk_msg_callback info_callback
Definition grok.h:179
void * warn_data
Definition grok.h:186
grk_msg_callback warn_callback
Definition grok.h:185
grk_msg_callback error_callback
Definition grok.h:187
void * trace_data
Definition grok.h:184
void * error_data
Definition grok.h:188
grk_msg_callback debug_callback
Definition grok.h:181
grk_msg_callback trace_callback
Definition grok.h:183
void * debug_data
Definition grok.h:182
void * info_data
Definition grok.h:180
Definition grok.h:195
void * wrapper
Definition grok.h:196
Definition grok.h:345
grk_component_mapping_comp * component_mapping
Definition grok.h:348
uint8_t num_channels
Definition grok.h:349
int32_t * lut
Definition grok.h:346
uint16_t num_entries
Definition grok.h:347
bool * channel_sign
Definition grok.h:350
uint8_t * channel_prec
Definition grok.h:351
Definition grok.h:890
uint64_t num_precincts
Definition grok.h:892
float stepsize
Definition grok.h:894
uint8_t orientation
Definition grok.h:891
grk_plugin_precinct ** precincts
Definition grok.h:893
Definition grok.h:858
uint32_t y0
Definition grok.h:862
uint8_t num_passes
Definition grok.h:870
uint32_t compressed_data_length
Definition grok.h:868
grk_plugin_pass passes[GRK_MAX_PASSES]
Definition grok.h:871
unsigned int sorted_index
Definition grok.h:872
uint32_t x0
Definition grok.h:862
uint8_t * compressed_data
Definition grok.h:867
uint32_t y1
Definition grok.h:862
uint32_t x1
Definition grok.h:862
unsigned int * context_stream
Definition grok.h:863
uint32_t num_pix
Definition grok.h:866
uint8_t num_bit_planes
Definition grok.h:869
uint32_t full_image_y0
Definition grok.h:1655
GRK_CODEC_FORMAT decod_format
Definition grok.h:1643
unsigned int error_code
Definition grok.h:1652
grk_decompress_parameters * decompressor_parameters
Definition grok.h:1648
grk_header_info header_info
Definition grok.h:1647
GRK_SUPPORTED_FILE_FMT cod_format
Definition grok.h:1645
grk_plugin_tile * tile
Definition grok.h:1651
size_t device_id
Definition grok.h:1638
uint32_t full_image_x0
Definition grok.h:1654
grk_object * codec
Definition grok.h:1646
void * user_data
Definition grok.h:1656
bool plugin_owns_image
Definition grok.h:1650
uint32_t decompress_flags
Definition grok.h:1653
const char * output_file_name
Definition grok.h:1641
GROK_INIT_DECOMPRESSORS init_decompressors_func
Definition grok.h:1639
const char * input_file_name
Definition grok.h:1640
grk_image * image
Definition grok.h:1649
Definition grok.h:1554
bool verbose
Definition grok.h:1556
const char * server
Definition grok.h:1558
int32_t device_id
Definition grok.h:1555
const char * license
Definition grok.h:1557
Definition grok.h:1502
const char * pluginPath
Definition grok.h:1503
bool verbose
Definition grok.h:1504
Definition grok.h:847
size_t rate
Definition grok.h:849
size_t length
Definition grok.h:850
double distortion_decrease
Definition grok.h:848
grk_plugin_precinct
Definition grok.h:880
uint64_t num_blocks
Definition grok.h:881
grk_plugin_code_block ** blocks
Definition grok.h:882
Definition grok.h:902
uint8_t num_bands
Definition grok.h:904
uint8_t level
Definition grok.h:903
grk_plugin_band ** band
Definition grok.h:905
Definition grok.h:931
uint16_t num_components
Definition grok.h:933
uint32_t decompress_flags
Definition grok.h:932
grk_plugin_tile_component ** tile_components
Definition grok.h:934
Definition grok.h:430
grk_precision_mode mode
Definition grok.h:432
uint8_t prec
Definition grok.h:431
Definition grok.h:441
uint16_t comp[256]
Definition grok.h:445
bool single_tile
Definition grok.h:446
uint8_t num_resolutions
Definition grok.h:442
uint16_t tile_index
Definition grok.h:447
uint16_t numcomps
Definition grok.h:444
uint16_t layers_per_resolution[33]
Definition grok.h:443
Definition grok.h:204
uint16_t comp_temp
Definition grok.h:239
uint32_t tx1
Definition grok.h:213
uint64_t prec_e
Definition grok.h:222
GRK_PROG_ORDER specified_compression_poc_prog
Definition grok.h:207
uint16_t comp_s
progression order bounds specified by POC
Definition grok.h:217
uint8_t res_temp
Definition grok.h:240
uint32_t tp_ty_e
Definition grok.h:234
uint32_t tp_tx_s
Definition grok.h:231
uint8_t res_s
Definition grok.h:219
uint32_t tx0
tile dimensions
Definition grok.h:211
uint8_t tp_res_s
Definition grok.h:227
uint64_t prec_temp
Definition grok.h:241
uint64_t tp_prec_e
Definition grok.h:229
uint32_t tp_ty_s
Definition grok.h:233
uint8_t tp_res_e
Definition grok.h:228
uint32_t ty0
Definition grok.h:212
uint32_t ty1
Definition grok.h:214
uint32_t ty0_temp
Definition grok.h:244
uint16_t comp_e
Definition grok.h:218
uint32_t dy
Definition grok.h:236
GRK_PROG_ORDER progression
Definition grok.h:205
uint32_t dx
Definition grok.h:235
uint16_t tp_comp_e
Definition grok.h:226
uint64_t prec_s
Definition grok.h:221
uint32_t tp_tx_e
Definition grok.h:232
uint32_t tx0_temp
Definition grok.h:243
uint16_t tp_lay_e
Definition grok.h:230
uint32_t tileno
Definition grok.h:208
uint16_t lay_temp
Definition grok.h:242
uint16_t tp_comp_s
Definition grok.h:225
uint16_t lay_e
Definition grok.h:224
uint16_t lay_s
Definition grok.h:223
char progression_str[5]
Definition grok.h:206
uint8_t res_e
Definition grok.h:220
Definition grok.h:252
uint8_t dy
subsampling in X direction
Definition grok.h:254
uint8_t dx
Definition grok.h:253
Definition grok.h:262
uint8_t prec
number of components
Definition grok.h:266
uint32_t width
Definition grok.h:263
uint16_t numcomps
height
Definition grok.h:265
grk_raw_comp_cparameters * comps
signed/unsigned
Definition grok.h:268
bool sgnd
bit depth
Definition grok.h:267
uint32_t height
width
Definition grok.h:264
Definition grok.h:539
uint8_t * buf
Definition grok.h:554
grk_stream_read_fn read_fn
Definition grok.h:559
size_t buf_len
Definition grok.h:555
const char * custom_header
Definition grok.h:570
bool use_stdio
Definition grok.h:551
const char * username
Definition grok.h:567
grk_stream_free_user_data_fn free_user_data_fn
Definition grok.h:562
const char * bearer_token
Definition grok.h:569
size_t double_buffer_len
Definition grok.h:542
size_t initial_offset
Definition grok.h:541
bool is_read_stream
Definition grok.h:547
size_t stream_len
Definition grok.h:564
grk_stream_write_fn write_fn
Definition grok.h:560
const char * password
Definition grok.h:568
const char * file
Definition grok.h:550
size_t initial_double_buffer_len
Definition grok.h:544
const char * region
Definition grok.h:571
grk_stream_seek_fn seek_fn
Definition grok.h:561
void * user_data
Definition grok.h:563
bool from_network
Definition grok.h:546
size_t buf_compressed_len
Definition grok.h:556
Definition grok.h:1112
uint32_t width
Definition grok.h:1114
uint32_t height
Definition grok.h:1115
bool do_synthesis
Definition grok.h:1113
uint8_t precision
Definition grok.h:1116
uint16_t numcomps
Definition grok.h:1117
Association box info.
Channel definition.
Channel definition: channel index, type, association.
ICC profile, palette, channel definition.
Component mappings: component index, mapping type, palette column Note: "component" refers to an imag...
Compression parameters.
Core decompression parameters.
Decompression parameters.
JPEG 2000 header info.
Image component.
Grok image Note: do not directly create a grk_image object.
Grok IO buffer.
Grok IO initialization.
Logging handlers.
Opaque reference-counted object.
Palette data.
Plugin band.
Plugin code block.
Plugin batch compress info.
Definition grok.h:1594
grk_cparameters * compress_parameters
Definition grok.h:1597
GRK_PLUGIN_COMPRESS_USER_CALLBACK callback
Definition grok.h:1598
const char * output_dir
Definition grok.h:1596
const char * input_dir
Definition grok.h:1595
Plugin compress user callback info.
Definition grok.h:1572
bool transfer_exif_tags
Definition grok.h:1581
grk_cparameters * compressor_parameters
Definition grok.h:1576
grk_image * image
Definition grok.h:1577
grk_plugin_tile * tile
Definition grok.h:1578
const char * output_file_name
Definition grok.h:1575
grk_stream_params stream_params
Definition grok.h:1579
unsigned int error_code
Definition grok.h:1580
const char * input_file_name
Definition grok.h:1573
bool output_file_name_is_relative
Definition grok.h:1574
Plugin decompress callback info.
Plugin load info.
Plugin pass.
Plugin resolution.
Plugin tile component.
Definition grok.h:913
uint8_t numresolutions
Definition grok.h:914
grk_plugin_resolution ** resolutions
Definition grok.h:915
Plugin tile.
Precision mode.
Precision.
Stores progression state information Note: limited to 256 components.
Progression order change (POC)
RAW component compress parameters.
RAW image compress parameters.
JPEG 2000 stream parameters There are three methods of streaming: by file, buffer or callback Client ...
compressed image synthesis parameters
Specify swath to wait on Holds swath coordinates and tile indices covering swath Tile indices are set...
Definition grok.h:831
uint32_t y0
Definition grok.h:833
uint16_t num_tile_cols
Definition grok.h:840
uint32_t x1
Definition grok.h:834
uint32_t y1
Definition grok.h:835
uint16_t tile_y0
Definition grok.h:837
uint16_t tile_y1
Definition grok.h:839
uint16_t tile_x0
Definition grok.h:836
uint16_t tile_x1
Definition grok.h:838
uint32_t x0
Definition grok.h:832