Grok 20.3.2
grok.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016-2026 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
18#pragma once
19
20#include <stdint.h>
21#include <stdio.h>
22#include <stdbool.h>
23#include <limits.h>
24
25#ifndef SWIG
26#ifdef __cplusplus
27extern "C" {
28#endif
29#endif
30
31#include "grk_config.h"
32
33#ifndef SWIG
34#ifdef _WIN32
35#define GRK_CALLCONV __stdcall
36#ifdef GRK_STATIC
37#define GRK_API
38#else
39#ifdef GRK_EXPORTS
40#define GRK_API __declspec(dllexport)
41#else
42#define GRK_API __declspec(dllimport)
43#endif
44#endif
45#else
46#define GRK_CALLCONV
47#ifdef GRK_STATIC
48#define GRK_API __attribute__((visibility("hidden")))
49#else
50#define GRK_API __attribute__((visibility("default")))
51#endif
52#endif
53#else
54#define GRK_CALLCONV
55#define GRK_API
56#endif
57
69
83
99
104{
105 GRK_ENUM_CLRSPC_UNKNOWN = 0xFFFFFFFF, /* unknown */
106 GRK_ENUM_CLRSPC_BILEVEL1 = 0, /* bilevel 1 */
107 GRK_ENUM_CLRSPC_YCBCR1 = 1, /* YCbCr 4:2:2 */
108 GRK_ENUM_CLRSPC_YCBCR2 = 3, /* YCbCr 4:4:4 */
109 GRK_ENUM_CLRSPC_YCBCR3 = 4, /* YCbCr 4:2:0 */
110 GRK_ENUM_CLRSPC_PHOTO_YCC = 9, /* Kodak PhotoYCC */
111 GRK_ENUM_CLRSPC_CMY = 11, /* cyan, magenta, yellow */
112 GRK_ENUM_CLRSPC_CMYK = 12, /* cyan, magenta, yellow, black */
113 GRK_ENUM_CLRSPC_YCCK = 13, /* YCCK */
114 GRK_ENUM_CLRSPC_CIE = 14, /* CIE Lab (L*, a*, b*) */
115 GRK_ENUM_CLRSPC_BILEVEL2 = 15, /* bilevel 2 */
116 GRK_ENUM_CLRSPC_SRGB = 16, /* sRGB */
117 GRK_ENUM_CLRSPC_GRAY = 17, /* grayscale */
118 GRK_ENUM_CLRSPC_SYCC = 18, /* standard YCC */
119 GRK_ENUM_CLRSPC_CIEJAB = 19, /* CIEJAB */
120 GRK_ENUM_CLRSPC_ESRGB = 20, /* e-sRGB */
121 GRK_ENUM_CLRSPC_ROMMRGB = 21, /* Reference Output Medium Metric RGB */
122 GRK_ENUM_CLRSPC_YPBPR60 = 22, /* YPbPr 60 */
123 GRK_ENUM_CLRSPC_YPBPR50 = 23, /* YPbPr 50 */
124 GRK_ENUM_CLRSPC_EYCC = 24, /* extended YCC */
126
130#define GRK_NUM_COMMENTS_SUPPORTED 256
131
135#define GRK_NUM_ASOC_BOXES_SUPPORTED 256
136
140#define GRK_NUM_XML_BOXES_SUPPORTED 64
141
145#define GRK_MAX_COMMENT_LENGTH (UINT16_MAX - 2)
146
150#define GRK_MAX_SUPPORTED_IMAGE_PRECISION 16
151
166#define GRK_BIBO_EXTRA_BITS 7
167
171#define GRK_MAX_PASSES (3 * (GRK_MAX_SUPPORTED_IMAGE_PRECISION + GRK_BIBO_EXTRA_BITS) - 2)
172
178typedef void (*grk_msg_callback)(const char* msg, void* client_data);
179
203
208typedef struct _grk_object
209{
210 void* wrapper; /* opaque wrapper */
212
217typedef struct _grk_progression
218{
219 GRK_PROG_ORDER progression; /* progression */
220 char progression_str[5]; /* progression as string */
221 GRK_PROG_ORDER specified_compression_poc_prog; /* compression specified POC*/
222 uint32_t tileno; /* tile number */
223
225 uint32_t tx0; /* tile x0 */
226 uint32_t ty0; /* tile y0 */
227 uint32_t tx1; /* tile x1 */
228 uint32_t ty1; /* tile y1 */
229
231 uint16_t comp_s; /* component start */
232 uint16_t comp_e; /* component end */
233 uint8_t res_s; /* resolution start */
234 uint8_t res_e; /* resolution end */
235 uint64_t prec_s; /* precinct start */
236 uint64_t prec_e; /* precinct end */
237 uint16_t lay_s; /* layer start */
238 uint16_t lay_e; /* layer end */
239 uint16_t tp_comp_s; /* tile part component start */
240 uint16_t tp_comp_e; /* tile part component end */
241 uint8_t tp_res_s; /* tile part resolution start */
242 uint8_t tp_res_e; /* tile part resolution end */
243 uint64_t tp_prec_e; /* tile part precinct end */
244 uint16_t tp_lay_e; /* tile part layer end */
245 uint32_t tp_tx_s; /* tile part x start */
246 uint32_t tp_tx_e; /* tile part x end */
247 uint32_t tp_ty_s; /* tile part y start */
248 uint32_t tp_ty_e; /* tile part y end */
249 uint32_t dx; /* dx */
250 uint32_t dy; /* dy */
251
252 /* temporary POC variables */
253 uint16_t comp_temp; /* component */
254 uint8_t res_temp; /* resolution */
255 uint64_t prec_temp; /* precinct */
256 uint16_t lay_temp; /* layer */
257 uint32_t tx0_temp; /* x0 */
258 uint32_t ty0_temp; /* y0 */
260
270
284
295
300{
301 GRK_FMT_UNK, /* unknown */
302 GRK_FMT_J2K, /* J2K */
303 GRK_FMT_JP2, /* JP2 */
304 GRK_FMT_PXM, /* PXM */
305 GRK_FMT_PGX, /* PGX */
306 GRK_FMT_PAM, /* PAM */
307 GRK_FMT_BMP, /* BMP */
308 GRK_FMT_TIF, /* TIF */
309 GRK_FMT_RAW, /* RAW Big Endian */
310 GRK_FMT_PNG, /* PNG */
311 GRK_FMT_RAWL, /* RAW Little Endian */
312 GRK_FMT_JPG, /* JPG */
313 GRK_FMT_MJ2 /* MJ2 */
315
326
327#define GRK_PATH_LEN 4096 /* Grok maximum supported filename size */
328#define GRK_MAX_LAYERS 256 /* Grok maximum number of quality layers */
329
330/*
331 * Note: range for number of decomposition levels is 0-32
332 * Accordingly, range for number of resolution levels is 1-33
333 */
334#define GRK_MAX_DECOMP_LVLS \
335 32 /* Maximum number of decomposition levels allowed by standard \
336 */
337#define GRK_MAXRLVLS \
338 (GRK_MAX_DECOMP_LVLS + 1) /* Maximum number of resolution levels allowed by standard*/
339#define GRK_MAXBANDS (3 * GRK_MAXRLVLS - 2) /* Maximum number of sub-bands allowed by standard */
340
347 */
348typedef struct _grk_component_mapping_comp
350 uint16_t component; /* component index */
351 uint8_t mapping_type; /* mapping type : 1 if mapped to paletted LUT otherwise 0 */
352 uint8_t palette_column; /* palette LUT column if mapped to palette */
354
358 */
359typedef struct _grk_palette_data
361 int32_t* lut; /* LUT */
362 uint16_t num_entries; /* number of LUT entries */
363 grk_component_mapping_comp* component_mapping; /* component mapping array*/
364 uint8_t num_channels; /* number of channels */
365 bool* channel_sign; /* channel signed array */
366 uint8_t* channel_prec; /* channel precision array */
368
369/***
370 * Channel Definition box structures and enums.
371 * When no Component mapping box is present, it is still possible to have
372 * a Channel definition box, in which case channels are associated with components
373 * in the obvious way : channel `k` corresponds to component `k`.
374 * */
375
376/* @brief Channel type */
377typedef enum _GRK_CHANNEL_TYPE
379 GRK_CHANNEL_TYPE_COLOUR = 0, /* colour */
380 GRK_CHANNEL_TYPE_OPACITY = 1, /* opacity */
381 GRK_CHANNEL_TYPE_PREMULTIPLIED_OPACITY = 2, /* premultiplied opacity */
382 GRK_CHANNEL_TYPE_UNSPECIFIED = 65535U /* unspecified */
384
387 */
388typedef enum _GRK_CHANNEL_ASSOC
390 GRK_CHANNEL_ASSOC_WHOLE_IMAGE = 0, /* whole image */
391 GRK_CHANNEL_ASSOC_COLOUR_1 = 1, /* colour 1 */
392 GRK_CHANNEL_ASSOC_COLOUR_2 = 2, /* colour 2 */
393 GRK_CHANNEL_ASSOC_COLOUR_3 = 3, /* colour 3 */
394 GRK_CHANNEL_ASSOC_UNASSOCIATED = 65535U /* unassociated */
396
400 */
401typedef struct _grk_channel_description
403 uint16_t channel; /* channel */
404 uint16_t typ; /* type */
405 uint16_t asoc; /* association */
407
411 */
412typedef struct _grk_channel_definition
414 grk_channel_description* descriptions; /* channel description array */
415 uint16_t num_channel_descriptions; /* size of channel description array */
417
421 */
422typedef struct _grk_asoc
424 uint32_t level; /* level: 0 for root level */
425 const char* label; /* label */
426 uint8_t* xml; /* xml */
427 uint32_t xml_len; /* xml length */
428} grk_asoc;
429
432 */
433typedef enum _grk_precision_mode
438
442 */
443typedef struct _grk_precision
445 uint8_t prec; /* precision */
448
453 */
454typedef struct _grk_progression_state
458 uint16_t numcomps;
459 uint16_t comp[256];
461 uint16_t tile_index;
463
467 */
468typedef struct _grk_io_buf
470 uint8_t* data; /* data */
471 size_t offset; /* offset */
472 size_t len; /* length */
473 size_t alloc_len; /* allocated length */
474 bool pooled; /* pooled */
475 uint32_t index; /* index */
476} grk_io_buf;
477
481 */
482typedef struct _grk_io_init
484 uint32_t max_pooled_requests; /* max pooled requests */
487
494typedef bool (*grk_io_callback)(uint32_t worker_id, grk_io_buf buffer, void* io_user_data);
495
503typedef void (*grk_io_register_reclaim_callback)(grk_io_init io_init,
504 grk_io_callback reclaim_callback,
505 void* io_user_data, void* reclaim_user_data);
506
513typedef bool (*grk_io_pixels_callback)(uint32_t worker_id, grk_io_buf buffer, void* user_data);
514
522typedef size_t (*grk_stream_read_fn)(uint8_t* buffer, size_t numBytes, void* user_data);
523
531typedef size_t (*grk_stream_write_fn)(const uint8_t* buffer, size_t numBytes, void* user_data);
532
538typedef bool (*grk_stream_seek_fn)(uint64_t offset, void* user_data);
539
544typedef void (*grk_stream_free_user_data_fn)(void* user_data);
545
551 */
552typedef struct _grk_stream_params
553{
554 /* 0. General Streaming */
555 size_t initial_offset; /* initial offset into stream */
556 size_t double_buffer_len; /* length of internal double buffer
557 for stdio and callback streaming */
558 size_t initial_double_buffer_len; /* choose a larger initial length
559 to read the main header in one go */
560 bool from_network; /* indicates stream source is on network if true */
561 bool is_read_stream; /* true if read stream, otherwise false */
562
563 /* 1. File Streaming */
565 bool use_stdio; /* use C file api - if false then use memory mapping */
566
567 /* 2. Buffer Streaming */
568 uint8_t* buf; /* data buffer */
569 size_t buf_len; /* data buffer length */
570 size_t buf_compressed_len; /* length of compressed stream (set by compressor, not client) */
571
572 /* 3. Callback Streaming */
573 grk_stream_read_fn read_fn; /* read function */
574 grk_stream_write_fn write_fn; /* write function */
575 grk_stream_seek_fn seek_fn; /* seek function */
577 void* user_data; /* user data */
578 size_t stream_len; /* mandatory for read stream */
579
580 /* 4 Authorization */
581 char username[129]; /* AWS access key ID: max 128 chars + null */
582 char password[129]; /* Secret access key: max 128 chars + null */
583 char bearer_token[4097]; /* Session token: up to 4096 chars + null */
584#define GRK_MAX_CUSTOM_HEADERS 16
585 char custom_headers[GRK_MAX_CUSTOM_HEADERS][1024]; /* Custom HTTP headers */
586 uint8_t
587 num_custom_headers; /* Number of entries in custom_headers[] (0..GRK_MAX_CUSTOM_HEADERS) */
588 char region[64]; /* Region code: max 50 chars + buffer */
589
590 /* 5 S3 Endpoint Configuration (for S3-compatible services like MinIO) */
591 char s3_endpoint[256]; /* Custom S3 endpoint URL (e.g. "http://localhost:9000") */
592 int8_t s3_use_https; /* 0 = auto (default), 1 = HTTPS, -1 = HTTP */
593 int8_t s3_use_virtual_hosting; /* 0 = auto (default), 1 = virtual-hosted, -1 = path-style */
594 bool s3_no_sign_request; /* true = skip authentication (public buckets) */
595 bool s3_allow_insecure; /* true = disable SSL certificate verification */
596
597 /* 6 HTTP cookies */
598 char cookie[4096]; /* inline cookie string for CURLOPT_COOKIE
599 (e.g. "name1=value1; name2=value2") */
600 char cookie_file[GRK_PATH_LEN]; /* path passed to CURLOPT_COOKIEFILE
601 (read cookies from a Netscape/HTTP file) */
602 char cookie_jar[GRK_PATH_LEN]; /* path passed to CURLOPT_COOKIEJAR
603 (write cookies on cleanup) */
604
605 /* 7 .netrc credentials */
606 bool netrc; /* true = enable .netrc lookup (CURLOPT_NETRC=REQUIRED) */
607 char netrc_file[GRK_PATH_LEN]; /* optional explicit .netrc path
608 (CURLOPT_NETRC_FILE) */
609
610 /* 8 Proxy */
611 char proxy[512]; /* proxy URL (e.g. "http://proxy:8080") */
612 char proxy_userpwd[256]; /* proxy credentials ("user:password") */
613
614 /* 9 Requester pays (S3) */
615 char request_payer[64]; /* e.g. "requester" for x-amz-request-payer header */
616
617 /* 10 User agent */
618 char user_agent[256]; /* custom User-Agent header string */
619
620 /* 11 Timeouts (seconds, 0 = use default) */
621 long timeout; /* overall request timeout (CURLOPT_TIMEOUT) */
622 long connect_timeout; /* connection timeout (CURLOPT_CONNECTTIMEOUT) */
623
624 /* 12 Retry configuration (0 = use default) */
625 uint32_t max_retry; /* maximum number of retries */
626 uint32_t retry_delay; /* delay between retries in seconds */
629
633#define GRK_TILE_CACHE_NONE 0 /* no tile caching */
634#define GRK_TILE_CACHE_IMAGE 1 /* cache final tile image */
635#define GRK_TILE_CACHE_ALL 2 /* cache everything */
636#define GRK_TILE_CACHE_LRU 4 /* LRU: release decompressed data, keep processor */
638typedef struct _grk_image grk_image;
639
648typedef bool (*grk_io_band_callback)(uint32_t yBegin, uint32_t yEnd, grk_image* image,
649 void* user_data);
650
654typedef void (*grk_decompress_callback)(void* codec, uint16_t tile_index, grk_image* tile_image,
655 uint8_t reduction, void* user_data);
656
660#define GRK_RANDOM_ACCESS_PLT 1 /* Disable PLT marker if present */
661#define GRK_RANDOM_ACCESS_TLM 2 /* Disable TLM marker if present */
662#define GRK_RANDOM_ACCESS_PLM 4 /* Disable PLM marker if present */
663
667 */
668typedef struct _grk_decompress_core_params
669{
678 uint8_t reduce;
686 uint32_t tile_cache_strategy; /* tile cache strategy */
687 uint16_t
688 max_active_tiles; /* max tiles with decompressed data (LRU eviction limit, 0 = unlimited) */
689 uint32_t disable_random_access_flags; /* disable random access flags */
690 bool skip_allocate_composite; /* skip allocate composite image data for multi-tile */
692 void* io_user_data; /* IO user data */
694 grk_io_band_callback io_band_callback; /* band completion callback for incremental write */
695 void* io_band_user_data; /* band callback user data */
705 bool fast_16bit_mct; /* opt into fast 16-bit DWT path for 9/7 MCT decompress (prec <= 12) */
707
712#define GRK_DECOMPRESS_COMPRESSION_LEVEL_DEFAULT (UINT_MAX)
713
717 */
718typedef struct _grk_decompress_params
720 grk_decompress_core_params core; /* core parameters */
721 bool asynchronous; /* if true then decompression is executed asynchronously */
723 grk_decompress_callback decompress_callback; /* callback for asynchronous decompression */
724 void* decompress_callback_user_data; /* user data passed to callback for asynchronous
725 decompression */
726 char infile[GRK_PATH_LEN]; /* input file */
727 char outfile[GRK_PATH_LEN]; /* output file */
728 GRK_CODEC_FORMAT decod_format; /* input decode format */
729 GRK_SUPPORTED_FILE_FMT cod_format; /* output code format */
730 double dw_x0; /* decompress window left boundary*/
731 double dw_x1; /* decompress window right boundary*/
732 double dw_y0; /* decompress window top boundary*/
733 double dw_y1; /* decompress window bottom boundary*/
734 uint16_t tile_index; /* index of decompressed tile*/
735
736 /***************************************************************************
737 Note: when using Grok API, the following parameters should be set
738 on the HeaderInfo struct before reading the header. Otherwise they
739 will be ignored
740 */
742 bool force_rgb; /* force output to sRGB */
743 bool upsample; /* upsample components according to their dx and dy values*/
744 grk_precision* precision; /* precision array */
745 uint32_t num_precision; /* size of precision array*/
746 bool split_by_component; /* split output components to different files for PNM */
747 bool single_tile_decompress; /* single tile decompress */
748 /************************************************************************** */
750 bool io_xml; /* serialize XML metedata to disk*/
751 uint32_t compression; /* compression */
752 uint32_t compression_level; /* compression "quality" - meaning depends on output file format */
753 uint32_t duration; /* duration of decompression in seconds */
754 uint32_t repeats; /* number of repetitions */
755 uint32_t num_threads; /* number of CPU threads */
757 uint32_t kernel_build_options; /* plugin OpenCL kernel build options */
758 int32_t device_id; /* plugin device ID */
759 void* user_data; /* plugin user data */
761
775
779 */
780typedef struct _grk_image_comp
782 uint32_t x0; /* x offset relative to whole image */
783 uint32_t y0; /* y offset relative to whole image */
784 uint32_t w; /* width */
785 uint32_t stride; /* stride */
786 uint32_t h; /* height */
787 uint8_t dx; /* horizontal separation of component samples with respect to reference grid */
788 uint8_t dy; /* vertical separation of component samples with respect to reference grid */
789 uint8_t prec; /* precision */
790 bool sgnd; /* true if component data is signed */
791 GRK_CHANNEL_TYPE type; /* channel type */
792 GRK_CHANNEL_ASSOC association; /* channel association */
793 uint16_t crg_x; /* component registration x coordinate */
794 uint16_t crg_y; /* component registration y coordinate */
796 void* data; /* component data */
797 bool owns_data; /* true if data is owned by component */
799
803 */
804typedef struct _grk_color
806 uint8_t* icc_profile_buf; /* ICC profile buffer */
807 uint32_t icc_profile_len; /* ICC profile length */
808 char* icc_profile_name; /* ICC profile name */
810 grk_palette_data* palette; /* palette */
811 bool has_colour_specification_box; /* true if colour specification box present*/
812} grk_color;
813
817 */
818typedef struct _grk_image_meta
820 grk_object obj; /* object */
821 grk_color color; /* color */
822 uint8_t* iptc_buf; /* IPTC buffer */
823 size_t iptc_len; /* IPTC length */
824 uint8_t* xmp_buf; /* XMP buffer */
825 size_t xmp_len; /* XMP length */
826 uint8_t* exif_buf; /* EXIF buffer (TIFF-structured) */
827 size_t exif_len; /* EXIF length */
828 uint8_t* geotiff_buf; /* GeoTIFF UUID box data (degenerate GeoTIFF) */
829 size_t geotiff_len; /* GeoTIFF UUID box data length */
830 uint8_t* ipr_data; /* IPR (Intellectual Property) box data */
831 size_t ipr_len; /* IPR box data length */
832 uint8_t* xml_buf; /* XML box data */
833 size_t xml_len; /* XML box data length */
834 grk_asoc* asoc_boxes; /* association boxes (for GMLJP2, etc.) */
835 uint32_t num_asoc_boxes; /* number of association box entries */
837
843 */
844typedef struct _grk_image
846 grk_object obj; /* object */
847 uint32_t x0; /* image horizontal offset from origin of reference grid */
848 uint32_t y0; /* image vertical offset from origin of reference grid */
849 uint32_t x1; /* image right boundary in reference grid*/
850 uint32_t y1; /* image bottom boundary in reference grid */
851 uint16_t numcomps; /* number of components */
852 GRK_COLOR_SPACE color_space; /* color space */
853 bool palette_applied; /* true if palette applied */
854 bool channel_definition_applied; /* true if channel definition applied */
855 bool has_capture_resolution; /* true if capture resolution present*/
856 double capture_resolution[2]; /* capture resolution */
857 bool has_display_resolution; /* true if display resolution present*/
858 double display_resolution[2]; /* display resolution */
859 GRK_SUPPORTED_FILE_FMT decompress_fmt; /* decompress format */
860 bool force_rgb; /* force RGB */
861 bool upsample; /* upsample */
862 grk_precision* precision; /* precision */
863 uint32_t num_precision; /* number of precision */
864 bool has_multiple_tiles; /* has multiple tiles */
865 bool split_by_component; /* split by component */
866 uint16_t decompress_num_comps; /* decompress number of components */
867 uint32_t decompress_width; /* decompress width */
868 uint32_t decompress_height; /* decompress height */
869 uint8_t decompress_prec; /* decompress precision */
870 GRK_COLOR_SPACE decompress_colour_space; /* decompress colour space */
871 grk_io_buf interleaved_data; /* interleaved data */
872 uint32_t rows_per_strip; /* for storage to output format */
873 uint32_t rows_per_task; /* for scheduling */
874 uint64_t packed_row_bytes; /* packed row bytes */
875 grk_image_meta* meta; /* image meta data */
876 grk_image_comp* comps; /* components array */
877} grk_image;
878
882 */
883typedef struct _grk_header_info
884{
885 /************************************************************
886 Variables below are populated by library after reading header
887 *************************************************************/
889 uint32_t cblockw_init; /* nominal code block width, default 64 */
890 uint32_t cblockh_init; /* nominal code block height, default 64 */
891 bool irreversible; /* true if image compressed irreversibly*/
892 uint8_t mct; /* multi-component transform */
893 uint16_t rsiz; /* RSIZ */
894 uint8_t numresolutions; /* number of resolutions */
895 GRK_PROG_ORDER prog_order; /* progression order */
896 /********************************************************************************
897 coding style
898 Can be specified in main header COD segment,
899 tile header COD segment, and tile component COC segment.
900 Important note: we assume that coding style does not vary across tile components
901 *********************************************************************************/
902 uint8_t csty;
903 /************************************************************************************
904 code block style
905 Can be specified in main header COD segment, and can be overridden in a tile header.
906 Important note: we assume that code block style does not vary across tiles
907 ************************************************************************************/
908 uint8_t cblk_sty;
909 uint32_t prcw_init[GRK_MAXRLVLS]; /* nominal precinct width */
910 uint32_t prch_init[GRK_MAXRLVLS]; /* nominal precinct height */
911 uint32_t tx0; /* XTOsiz */
912 uint32_t ty0; /* YTOsiz */
913 uint32_t t_width; /* XTsiz */
914 uint32_t t_height; /* YTsiz */
915 uint16_t t_grid_width; /* tile grid width */
916 uint16_t t_grid_height; /* tile grid height */
917 uint16_t num_layers; /* number of layers */
918 uint8_t* xml_data; /* XML data - will remain valid until codec destroyed */
919 size_t xml_data_len; /* XML data length */
920 uint8_t* xml_boxes_data[GRK_NUM_XML_BOXES_SUPPORTED]; /* additional XML box data */
921 size_t xml_boxes_len[GRK_NUM_XML_BOXES_SUPPORTED]; /* additional XML box lengths */
922 uint32_t num_xml_boxes; /* total number of XML boxes (including xml_data if present) */
923 size_t num_comments; /* number of comments */
925 uint16_t comment_len[GRK_NUM_COMMENTS_SUPPORTED]; /* comment length */
926 bool is_binary_comment[GRK_NUM_COMMENTS_SUPPORTED]; /* is binary comment */
928 uint32_t num_asocs; /* number of associations */
929
930 /********************************
931 Variables below are set by client
932 ********************************/
934 GRK_SUPPORTED_FILE_FMT decompress_fmt; /* decompress format */
935 bool force_rgb; /* force RGB */
936 bool upsample; /* upsample */
937 grk_precision* precision; /* precision */
938 uint32_t num_precision; /* number of precision */
939 bool split_by_component; /* split by component */
940 bool single_tile_decompress; /* single tile decompress */
942
973 */
974typedef struct grk_swath_buffer
976 void* data;
977 uint8_t prec;
978 bool sgnd;
979 uint16_t numcomps;
980 int64_t pixel_space;
981 int64_t line_space;
982 int64_t band_space;
983 int* band_map;
985 uint32_t x0;
986 uint32_t y0;
987 uint32_t x1;
988 uint32_t y1;
990
1004typedef struct grk_wait_swath
1006 uint32_t x0;
1007 uint32_t y0;
1008 uint32_t x1;
1009 uint32_t y1;
1010 uint16_t tile_x0;
1011 uint16_t tile_y0;
1012 uint16_t tile_x1;
1013 uint16_t tile_y1;
1014 uint16_t num_tile_cols;
1020typedef struct _grk_plugin_pass
1022 double distortion_decrease; /* distortion decrease up to and including this pass */
1023 size_t rate; /* rate up to and including this pass */
1024 size_t length; /* stream length for this pass */
1026
1031typedef struct _grk_plugin_code_block
1032{
1033 /**************************
1034 debug info
1035 **************************/
1036 uint32_t x0, y0, x1, y1; /* x0, y0, x1, y1 */
1037 unsigned int* context_stream; /* context stream */
1038 /***************************/
1040 uint32_t num_pix; /* number of pixels */
1041 uint8_t* compressed_data; /* compressed data */
1042 uint32_t compressed_data_length; /* compressed data length */
1043 uint8_t num_bit_planes; /* number of bit planes */
1044 uint8_t num_passes; /* number of passes */
1046 unsigned int sorted_index; /* sorted index */
1048
1053typedef struct _grk_plugin_precinct
1055 uint64_t num_blocks; /* number of blocks */
1058
1063typedef struct _grk_plugin_band
1065 uint8_t orientation; /* orientation */
1066 uint64_t num_precincts; /* number of precincts */
1068 float stepsize; /* stepsize */
1070
1075typedef struct _grk_plugin_resolution
1077 uint8_t level; /* level */
1078 uint8_t num_bands; /* number of bands */
1079 grk_plugin_band** band; /* band */
1081
1086typedef struct grk_plugin_tile_component
1088 uint8_t numresolutions; /* number of resolutions */
1092#define GRK_DECODE_HEADER (1 << 0)
1093#define GRK_DECODE_T2 (1 << 1)
1094#define GRK_DECODE_T1 (1 << 2)
1095#define GRK_DECODE_POST_T1 (1 << 3)
1096#define GRK_PLUGIN_DECODE_CLEAN (1 << 4)
1097#define GRK_DECODE_ALL \
1098 (GRK_PLUGIN_DECODE_CLEAN | GRK_DECODE_HEADER | GRK_DECODE_T2 | GRK_DECODE_T1 | GRK_DECODE_POST_T1)
1099
1104typedef struct _grk_plugin_tile
1106 uint32_t decompress_flags; /* decompress flags */
1107 uint16_t num_components; /* number of components */
1110
1119GRK_API const char* GRK_CALLCONV grk_version(void);
1120
1133GRK_API bool GRK_CALLCONV grk_detect_format(const char* file_path, GRK_CODEC_FORMAT* format);
1134
1151GRK_API void GRK_CALLCONV grk_initialize(const char* plugin_path, uint32_t num_threads,
1152 bool* plugin_initialized);
1153
1161
1173
1188
1202
1224GRK_API grk_image* GRK_CALLCONV grk_image_new(uint16_t numcmpts, grk_image_comp* cmptparms,
1225 GRK_COLOR_SPACE clrspc, bool alloc_data);
1226
1240GRK_API grk_data_type GRK_CALLCONV grk_get_data_type(bool compress, uint8_t prec, bool is_mct,
1241 uint8_t qmfbid, bool fast_mct);
1242
1253
1267GRK_API bool GRK_CALLCONV grk_image_meta_set_field(grk_image_meta* meta, const char* field,
1268 const uint8_t* data, size_t len);
1269
1283GRK_API bool GRK_CALLCONV grk_image_meta_get_field(grk_image_meta* meta, const char* field,
1284 uint8_t** data, size_t* len);
1285
1302 uint32_t num_asocs);
1303
1324
1338 grk_object* codec);
1339
1357 grk_decompress_get_progression_state(grk_object* codec, uint16_t tile_index);
1358
1380 grk_progression_state state);
1381
1402 grk_header_info* header_info);
1403
1418 uint16_t tile_index, bool wait);
1419
1432
1445 grk_io_band_callback callback,
1446 void* user_data);
1447
1456
1479
1495
1518 const grk_wait_swath* swath,
1519 grk_swath_buffer* buf);
1520
1530
1546 const grk_swath_buffer* buf);
1547
1562GRK_API bool GRK_CALLCONV grk_decompress_tile(grk_object* codec, uint16_t tile_index);
1563
1572
1579GRK_API bool GRK_CALLCONV grk_decompress_sample(grk_object* codec, uint32_t sample_index);
1580
1588 uint32_t sample_index);
1589
1601 uint32_t sample_index,
1602 uint16_t tile_index);
1603
1604/* COMPRESSION FUNCTIONS*/
1605
1610typedef struct _grk_cparameters
1612 bool tile_size_on; /* tile size on */
1613 uint32_t tx0; /* XTOsiz */
1614 uint32_t ty0; /* YTOsiz */
1615 uint32_t t_width; /* XTsiz */
1616 uint32_t t_height; /* YTsiz */
1617 uint16_t numlayers; /* number of layers */
1619 bool allocation_by_rate_distortion; /* allocation by rate distortion */
1622 double layer_rate[GRK_MAX_LAYERS]; /* layer rate */
1623 bool allocation_by_quality; /* rate control allocation by fixed_PSNR quality */
1624 double layer_distortion[GRK_MAX_LAYERS]; /* layer PSNR values */
1626 uint16_t comment_len[GRK_NUM_COMMENTS_SUPPORTED]; /* comment length */
1627 bool is_binary_comment[GRK_NUM_COMMENTS_SUPPORTED]; /* is binary comment */
1628 size_t num_comments; /* number of comments */
1629 uint8_t csty; /* coding style */
1630 uint8_t numgbits; /* number of guard bits */
1631 GRK_PROG_ORDER prog_order; /* progression order (default LRCP)*/
1632 grk_progression progression[GRK_MAXRLVLS]; /* progression array */
1633 uint32_t numpocs; /* number of progression order changes (POCs) */
1634 uint8_t numresolution; /* number of resolutions */
1635 uint32_t cblockw_init; /* nominal code block width (default 64) */
1636 uint32_t cblockh_init; /* nominal code block height (default 64) */
1637 uint8_t cblk_sty; /* code block style */
1638 bool irreversible; /* true if irreversible compression enabled, default false */
1641 int32_t roi_compno; /* ROI component number */
1642 uint32_t roi_shift; /* ROI upshift */
1643 /* number of precinct size specifications */
1644 uint32_t res_spec; /* res spec */
1645 uint32_t prcw_init[GRK_MAXRLVLS]; /* nominal precinct width */
1646 uint32_t prch_init[GRK_MAXRLVLS]; /* nominal precinct height */
1647 char infile[GRK_PATH_LEN]; /* input file */
1648 char outfile[GRK_PATH_LEN]; /* output file */
1649 uint32_t image_offset_x0; /* image offset x0 */
1650 uint32_t image_offset_y0; /* image offset y0 */
1651 uint8_t subsampling_dx; /* subsampling dx */
1652 uint8_t subsampling_dy; /* subsampling dy */
1653 GRK_SUPPORTED_FILE_FMT decod_format; /* input decode format */
1654 GRK_SUPPORTED_FILE_FMT cod_format; /* output code format */
1655 grk_raw_cparameters raw_cp; /* raw parameters */
1656 bool enable_tile_part_generation; /* enable tile part generation */
1657 uint8_t new_tile_part_progression_divider; /* new tile part progression divider */
1658 uint8_t mct; /* MCT */
1661 void* mct_data; /* MCT data */
1668 uint64_t max_cs_size; /* max code stream size */
1673 uint64_t max_comp_size; /* max component size */
1676 uint16_t rsiz; /* RSIZ */
1677 uint16_t framerate; /* frame rate */
1679 bool write_capture_resolution_from_file; /* write capture resolution from file */
1680 double capture_resolution_from_file[2]; /* capture resolution from file */
1681 bool write_capture_resolution; /* write capture resolution */
1682 double capture_resolution[2]; /* capture resolution */
1683 bool write_display_resolution; /* write display resolution */
1684 double display_resolution[2]; /* display resolution */
1686 bool apply_icc; /* apply ICC */
1689 uint32_t num_threads; /* number of threads */
1690 int32_t device_id; /* device ID */
1691 uint32_t duration; /* duration seconds */
1692 uint32_t kernel_build_options; /* kernel build options */
1693 uint32_t repeats; /* repeats */
1694 bool write_plt; /* write PLT */
1695 bool write_tlm; /* write TLM */
1696 bool shared_memory_interface; /* shared memory interface */
1697 bool jpx_branding; /* advertise jpx brand (enables asoc/lbl boxes) */
1698 bool write_rreq; /* write reader requirements box */
1699 uint16_t rreq_standard_features[8]; /* standard features for rreq box */
1700 uint8_t num_rreq_standard_features; /* number of standard features */
1701 bool geoboxes_after_jp2c; /* write metadata boxes (UUID, asoc, XML) after codestream */
1702
1703 /* Transcode mode: rewrite JP2 boxes while copying the codestream verbatim.
1704 * Set transcode=true and populate transcode_src with the source stream.
1705 * The image passed to grk_transcode() provides the metadata for the new boxes.
1706 * Codestream modification (TLM/PLT insertion, SOP/EPH injection, layer/resolution
1707 * stripping, progression reorder) is also supported in this mode. */
1708 bool transcode; /* enable transcode mode */
1709 grk_stream_params transcode_src; /* source stream to copy codestream from */
1710 bool write_sop; /* inject SOP markers during transcode */
1711 bool write_eph; /* inject EPH markers during transcode */
1712 uint16_t max_layers_transcode; /* max quality layers to keep (0 = all) */
1713 uint8_t max_res_transcode; /* max resolutions to keep (0 = all) */
1715 transcode_prog_order; /* reorder packets to this progression (GRK_PROG_UNKNOWN = keep) */
1717
1741
1761 grk_cparameters* parameters, grk_image* image);
1777
1787 grk_plugin_tile* tile);
1788
1796
1803
1835 grk_stream_params* dst_stream,
1836 grk_cparameters* parameters, grk_image* image);
1837
1853GRK_API void GRK_CALLCONV grk_dump_codec(grk_object* codec, uint32_t info_flag,
1854 FILE* output_stream);
1855
1873GRK_API bool GRK_CALLCONV grk_set_MCT(grk_cparameters* parameters, const float* encoding_matrix,
1874 const int32_t* dc_shift, uint32_t nb_comp);
1875
1876/* Decoder state flags */
1877#define GRK_IMG_INFO 1 /* Basic image information provided to the user */
1878#define GRK_MH_INFO 2 /* Codestream information based only on the main header */
1879#define GRK_TH_INFO 4 /* Tile information based on the current tile header */
1880#define GRK_TCH_INFO 8
1881#define GRK_MH_IND 16
1882#define GRK_TH_IND 32
1883
1884/* Code block styles */
1885#define GRK_CBLKSTY_LAZY 0x01
1886#define GRK_CBLKSTY_RESET 0x02
1887#define GRK_CBLKSTY_TERMALL 0x04
1888#define GRK_CBLKSTY_VSC 0x08
1889#define GRK_CBLKSTY_PTERM 0x10
1890#define GRK_CBLKSTY_SEGSYM 0x20
1891#define GRK_CBLKSTY_HT_ONLY 0x40
1892#define GRK_CBLKSTY_HT_MIXED 0xC0
1893#define GRK_JPH_RSIZ_FLAG 0x4000
1894
1895/*****************************************************************************
1896 * JPEG 2000 Profiles, see Table A.10 from 15444-1 (updated in various AMDs)
1897 *
1898 * These values help choose the RSIZ value for the JPEG 2000 code stream.
1899 * The RSIZ value forces various compressing options, as detailed in Table A.10.
1900 * If GRK_PROFILE_PART2 is chosen, it must be combined with one or more extensions
1901 * described below.
1902 *
1903 * Example: rsiz = GRK_PROFILE_PART2 | GRK_EXTENSION_MCT;
1904 *
1905 * For broadcast profiles, the GRK_PROFILE_X value has to be combined with the target
1906 * level (3-0 LSB, value between 0 and 11):
1907 * Example: rsiz = GRK_PROFILE_BC_MULTI | 0x0005; (level equals 5)
1908 *
1909 * For IMF profiles, the GRK_PROFILE_X value has to be combined with the target main-level
1910 * (3-0 LSB, value between 0 and 11) and sub-level (7-4 LSB, value between 0 and 9):
1911 * Example: rsiz = GRK_PROFILE_IMF_2K | 0x0040 | 0x0005; (main-level equals 5 and sub-level
1912 * equals 4
1913 *
1914 * */
1915#define GRK_PROFILE_NONE 0x0000
1916#define GRK_PROFILE_0 0x0001
1917#define GRK_PROFILE_1 0x0002
1918#define GRK_PROFILE_CINEMA_2K 0x0003
1919#define GRK_PROFILE_CINEMA_4K 0x0004
1920#define GRK_PROFILE_CINEMA_S2K 0x0005
1921#define GRK_PROFILE_CINEMA_S4K 0x0006
1922#define GRK_PROFILE_CINEMA_LTS \
1923 0x0007
1924#define GRK_PROFILE_BC_SINGLE 0x0100
1925#define GRK_PROFILE_BC_MULTI 0x0200
1926#define GRK_PROFILE_BC_MULTI_R \
1927 0x0300
1928#define GRK_PROFILE_BC_MASK 0x030F
1929#define GRK_PROFILE_IMF_2K 0x0400
1930#define GRK_PROFILE_IMF_4K 0x0500
1931#define GRK_PROFILE_IMF_8K 0x0600
1932#define GRK_PROFILE_IMF_2K_R \
1933 0x0700
1934#define GRK_PROFILE_IMF_4K_R \
1935 0x0800
1936#define GRK_PROFILE_IMF_8K_R \
1937 0x0900
1938#define GRK_PROFILE_MASK 0x0FFF
1939#define GRK_PROFILE_PART2 0x8000
1940#define GRK_PROFILE_PART2_EXTENSIONS_MASK 0x3FFF /* Mask for Part-2 extension bits */
1941
1945#define GRK_EXTENSION_NONE 0x0000
1946#define GRK_EXTENSION_MCT 0x0100
1947#define GRK_IS_PART2(v) ((v) & GRK_PROFILE_PART2)
1949#define GRK_IS_CINEMA(v) (((v) >= GRK_PROFILE_CINEMA_2K) && ((v) <= GRK_PROFILE_CINEMA_S4K))
1950#define GRK_IS_STORAGE(v) ((v) == GRK_PROFILE_CINEMA_LTS)
1951
1952/*
1953 *
1954 * *********************************************
1955 * Broadcast level (3-0 LSB) (15444-1 AMD4,AMD8)
1956 * *********************************************
1957 *
1958 * indicates maximum bit rate and sample rate for a code stream
1959 *
1960 * Note: Mbit/s == 10^6 bits/s; Msamples/s == 10^6 samples/s
1961 *
1962 * 0: no maximum rate
1963 * 1: 200 Mbits/s, 65 Msamples/s
1964 * 2: 200 Mbits/s, 130 Msamples/s
1965 * 3: 200 Mbits/s, 195 Msamples/s
1966 * 4: 400 Mbits/s, 260 Msamples/s
1967 * 5: 800Mbits/s, 520 Msamples/s
1968 * >= 6: 2^(level-6) * 1600 Mbits/s, 2^(level-6) * 1200 Msamples/s
1969 *
1970 * Note: level cannot be greater than 11
1971 *
1972 * ****************
1973 * Broadcast tiling
1974 * ****************
1975 *
1976 * Either single-tile or multi-tile. Multi-tile only permits
1977 * 1 or 4 tiles per frame, where multiple tiles have identical
1978 * sizes, and are configured in either 2x2 or 1x4 layout.
1979 *
1980 *************************************************************
1981 *
1982 * ***************************************
1983 * IMF main-level (3-0) LSB (15444-1 AMD8)
1984 * ***************************************
1985 *
1986 * main-level indicates maximum number of samples per second,
1987 * as listed above.
1988 *
1989 *
1990 * **************************************
1991 * IMF sub-level (7-4) LSB (15444-1 AMD8)
1992 * **************************************
1993 *
1994 * sub-level indicates maximum bit rate for a code stream:
1995 *
1996 * 0: no maximum rate
1997 * >0: 2^sub-level * 100 Mbits/second
1998 *
1999 * Note: sub-level cannot be greater than 9, and cannot be larger
2000 * then maximum of (main-level -2) and 1.
2001 *
2002 */
2004#define GRK_GET_IMF_OR_BROADCAST_PROFILE(v) \
2005 ((v) & 0x0f00)
2007#define GRK_LEVEL_MAX 11U
2008#define GRK_GET_LEVEL(v) ((v) & 0xf)
2009
2010/******* BROADCAST **********************************************************/
2012#define GRK_IS_BROADCAST(v) \
2013 (((v) >= GRK_PROFILE_BC_SINGLE) && ((v) <= (GRK_PROFILE_BC_MULTI_R | 0x000b)) && \
2014 (((v) & 0xf) <= 0xb))
2015
2016/* Maximum component sampling Rate (Mbits/sec) per level */
2017#define GRK_BROADCAST_LEVEL_1_MBITSSEC 200U
2018#define GRK_BROADCAST_LEVEL_2_MBITSSEC 200U
2019#define GRK_BROADCAST_LEVEL_3_MBITSSEC 200U
2020#define GRK_BROADCAST_LEVEL_4_MBITSSEC 400U
2021#define GRK_BROADCAST_LEVEL_5_MBITSSEC 800U
2022#define GRK_BROADCAST_LEVEL_6_MBITSSEC 1600U
2023#define GRK_BROADCAST_LEVEL_7_MBITSSEC 3200U
2024#define GRK_BROADCAST_LEVEL_8_MBITSSEC 6400U
2025#define GRK_BROADCAST_LEVEL_9_MBITSSEC 12800U
2026#define GRK_BROADCAST_LEVEL_10_MBITSSEC 25600U
2027#define GRK_BROADCAST_LEVEL_11_MBITSSEC 51200U
2029#define GRK_BROADCAST_LEVEL_1_MSAMPLESSEC 64U
2030#define GRK_BROADCAST_LEVEL_2_MSAMPLESSEC 130U
2031#define GRK_BROADCAST_LEVEL_3_MSAMPLESSEC 195U
2032#define GRK_BROADCAST_LEVEL_4_MSAMPLESSEC 260U
2033#define GRK_BROADCAST_LEVEL_5_MSAMPLESSEC 520U
2034#define GRK_BROADCAST_LEVEL_6_MSAMPLESSEC 1200U
2035#define GRK_BROADCAST_LEVEL_7_MSAMPLESSEC 2400U
2036#define GRK_BROADCAST_LEVEL_8_MSAMPLESSEC 4800U
2037#define GRK_BROADCAST_LEVEL_9_MSAMPLESSEC 9600U
2038#define GRK_BROADCAST_LEVEL_10_MSAMPLESSEC 19200U
2039#define GRK_BROADCAST_LEVEL_11_MSAMPLESSEC 38400U
2040
2041/********IMF *****************************************************************/
2043#define GRK_IS_IMF(v) \
2044 (((v) >= GRK_PROFILE_IMF_2K) && ((v) <= (GRK_PROFILE_IMF_8K_R | 0x009b)) && \
2045 (((v) & 0xf) <= 0xb) && (((v) & 0xf0) <= 0x90))
2046
2047/* Maximum component sampling rate (MSamples/sec) per main level */
2048#define GRK_IMF_MAINLEVEL_1_MSAMPLESSEC 65U
2049#define GRK_IMF_MAINLEVEL_2_MSAMPLESSEC 130U
2050#define GRK_IMF_MAINLEVEL_3_MSAMPLESSEC 195U
2051#define GRK_IMF_MAINLEVEL_4_MSAMPLESSEC 260U
2052#define GRK_IMF_MAINLEVEL_5_MSAMPLESSEC 520U
2053#define GRK_IMF_MAINLEVEL_6_MSAMPLESSEC 1200U
2054#define GRK_IMF_MAINLEVEL_7_MSAMPLESSEC 2400U
2055#define GRK_IMF_MAINLEVEL_8_MSAMPLESSEC 4800U
2056#define GRK_IMF_MAINLEVEL_9_MSAMPLESSEC 9600U
2057#define GRK_IMF_MAINLEVEL_10_MSAMPLESSEC 19200U
2058#define GRK_IMF_MAINLEVEL_11_MSAMPLESSEC 38400U
2060#define GRK_IMF_SUBLEVEL_MAX 9U
2061#define GRK_GET_IMF_SUBLEVEL(v) (((v) >> 4) & 0xf)
2062
2064#define GRK_IMF_SUBLEVEL_1_MBITSSEC 200U
2065#define GRK_IMF_SUBLEVEL_2_MBITSSEC 400U
2066#define GRK_IMF_SUBLEVEL_3_MBITSSEC 800U
2067#define GRK_IMF_SUBLEVEL_4_MBITSSEC 1600U
2068#define GRK_IMF_SUBLEVEL_5_MBITSSEC 3200U
2069#define GRK_IMF_SUBLEVEL_6_MBITSSEC 6400U
2070#define GRK_IMF_SUBLEVEL_7_MBITSSEC 12800U
2071#define GRK_IMF_SUBLEVEL_8_MBITSSEC 25600U
2072#define GRK_IMF_SUBLEVEL_9_MBITSSEC 51200U
2073/**********************************************************************************/
2074
2079#define GRK_CINEMA_DCI_MAX_BANDWIDTH 250000000
2081#define GRK_CINEMA_24_CS 1302083
2082#define GRK_CINEMA_24_COMP 1041666
2084#define GRK_CINEMA_48_CS 651041
2085#define GRK_CINEMA_48_COMP 520833
2087#define GRK_CINEMA_4K_DEFAULT_NUM_RESOLUTIONS 7 /* Default number of resolutions for 4K cinema */
2088
2089/*
2090 * CIE Lab #defines
2092#define GRK_CUSTOM_CIELAB_SPACE 0x0
2093#define GRK_DEFAULT_CIELAB_SPACE 0x44454600 /* 'DEF' */
2094
2095/*************************************************************************************
2096 Plugin Interface
2097 *************************************************************************************/
2098
2104typedef struct _grk_plugin_load_info
2106 const char* pluginPath; /* plugin path */
2108
2125
2136
2140#define GRK_PLUGIN_STATE_NO_DEBUG 0x0
2141
2142/*
2143 For compress debugging, the plugin first performs a T1 compress.
2144 Then:
2145 1. perform host DWT on plugin MCT data, and write to host image
2146 This way, both plugin and host start from same point
2147 (assume MCT is equivalent for both host and plugin)
2148 2. map plugin DWT data, compare with host DWT, and then write to plugin image
2149 At this point in the code, the plugin image holds plugin DWT data. And if no warnings are
2150 triggered, then we can safely say that host and plugin DWT data are identical.
2151 3. Perform host compress, skipping MCT and DWT (they have already been performed)
2152 4. during host compress, each context that is formed is compared against context stream from plugin
2153 5. rate control - synch with plugin code stream, and compare
2154 6. T2 and store to disk
2155 */
2157#define GRK_PLUGIN_STATE_DEBUG 0x1
2158#define GRK_PLUGIN_STATE_PRE_TR1 0x2
2159#define GRK_PLUGIN_STATE_DWT_QUANTIZATION 0x4
2160#define GRK_PLUGIN_STATE_MCT_ONLY 0x8
2161
2177
2178/*
2179 * @struct grk_plugin_init_info
2180 * @brief Plugin init info
2182typedef struct _grk_plugin_init_info
2184 int32_t device_id; /* device ID */
2185 bool verbose; /* enable diagnostic logging */
2186 const char* license; /* license */
2187 const char* server; /* server */
2189
2203
2210 const char* input_file_name; /* input file name */
2211 bool output_file_name_is_relative; /* output file name is relative */
2212 const char* output_file_name; /* output file name */
2213 grk_cparameters* compressor_parameters; /* compressor parameters */
2214 grk_image* image; /* image */
2216 grk_stream_params stream_params; /* stream parameters */
2217 unsigned int error_code; /* error code */
2219
2225
2229typedef struct grk_plugin_compress_batch_info
2231 const char* input_dir; /* input directory */
2232 const char* output_dir; /* output directory */
2233 grk_cparameters* compress_parameters; /* compress parameters */
2236
2249GRK_API int32_t GRK_CALLCONV grk_plugin_compress(grk_cparameters* compress_parameters,
2251
2266
2275
2285
2289typedef int (*GROK_INIT_DECOMPRESSORS)(grk_header_info* header_info, grk_image* image);
2290
2297 size_t device_id; /* device ID */
2299 const char* input_file_name; /* input file name */
2300 const char* output_file_name; /* output file name */
2301 /* input file format 0: J2K, 1: JP2 */
2302 GRK_CODEC_FORMAT decod_format; /* decode format */
2303 /* output file format 0: PGX, 1: PxM, 2: BMP etc */
2305 grk_object* codec; /* codec */
2306 grk_header_info header_info; /* header info */
2308 grk_image* image; /* image */
2309 bool plugin_owns_image; /* plugin owns image */
2311 unsigned int error_code; /* error code */
2312 uint32_t decompress_flags; /* decompress flags */
2313 uint32_t full_image_x0; /* full image x0 */
2314 uint32_t full_image_y0; /* full image y0 */
2315 void* user_data; /* user data */
2316 void* format_private; /* format-specific private data */
2318
2325
2340
2357 const char* input_dir, const char* output_dir, grk_decompress_parameters* decompress_parameters,
2359
2371
2380
2381/*******************************************************************************
2382 * Thread-pool access
2383 *
2384 * These functions expose the core library's TaskFlow thread pool so that
2385 * other libraries (e.g. the codec library) can submit work to the same
2386 * pool, avoiding thread contention.
2387 *
2388 * The returned handle is only valid between grk_initialize() and
2389 * grk_deinitialize(). Internal C++ consumers should prefer the typed
2390 * wrappers in grk_thread_pool.h.
2391 ******************************************************************************/
2392
2403
2410
2416GRK_API uint32_t GRK_CALLCONV grk_worker_id(void);
2417
2418#ifndef SWIG
2419#ifdef __cplusplus
2420}
2421#endif
2422#endif
enum _grk_data_type grk_data_type
Grok Data types Used to specify the actual data type of Grok image components.
GRK_API bool GRK_CALLCONV grk_detect_format(const char *file_path, GRK_CODEC_FORMAT *format)
Detect the JPEG 2000 codec format of a file by reading its magic bytes.
Definition grok.cpp:379
struct _grk_plugin_init_info grk_plugin_init_info
_GRK_SUPPORTED_FILE_FMT
All Grok supported file formats.
Definition grok.h:300
@ GRK_FMT_BMP
Definition grok.h:307
@ GRK_FMT_JP2
Definition grok.h:303
@ GRK_FMT_J2K
Definition grok.h:302
@ GRK_FMT_PNG
Definition grok.h:310
@ GRK_FMT_MJ2
Definition grok.h:313
@ GRK_FMT_RAWL
Definition grok.h:311
@ GRK_FMT_UNK
Definition grok.h:301
@ GRK_FMT_TIF
Definition grok.h:308
@ GRK_FMT_JPG
Definition grok.h:312
@ GRK_FMT_PXM
Definition grok.h:304
@ GRK_FMT_RAW
Definition grok.h:309
@ GRK_FMT_PAM
Definition grok.h:306
@ GRK_FMT_PGX
Definition grok.h:305
struct _grk_cparameters grk_cparameters
struct _grk_progression grk_progression
enum _grk_precision_mode grk_precision_mode
Precision mode.
struct _grk_image grk_image
Definition grok.h:637
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:502
GRK_API void GRK_CALLCONV grk_plugin_stop_batch_compress(void)
Requests cancellation of a running batch compress operation.
Definition grok.cpp:1386
GRK_API grk_object *GRK_CALLCONV grk_object_ref(grk_object *obj)
Increments the reference count on a Grok object.
Definition grok.cpp:340
GRK_API void *GRK_CALLCONV grk_thread_pool(void)
Returns an opaque handle to the core thread-pool executor.
Definition grok.cpp:226
GRK_API uint64_t GRK_CALLCONV grk_transcode(grk_stream_params *src_stream, grk_stream_params *dst_stream, grk_cparameters *parameters, grk_image *image)
Transcodes a JPEG 2000 file by rewriting JP2 boxes while copying the codestream verbatim.
Definition grok.cpp:1066
GRK_API void GRK_CALLCONV grk_plugin_stop_batch_decompress(void)
Requests cancellation of a running batch decompress operation.
Definition grok.cpp:1612
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:653
struct _grk_channel_description grk_channel_description
#define GRK_NUM_COMMENTS_SUPPORTED
maximum Grok supported number of comments
Definition grok.h:130
void(* grk_msg_callback)(const char *msg, void *client_data)
Logging callback.
Definition grok.h:178
GRK_API uint32_t GRK_CALLCONV grk_decompress_num_samples(grk_object *codec)
Gets the number of samples (frames) in the codec container.
Definition grok.cpp:781
enum _GRK_CHANNEL_TYPE GRK_CHANNEL_TYPE
GRK_API bool GRK_CALLCONV grk_compress_finish(grk_object *codec)
Finalizes a multi-frame compress container (e.g.
Definition grok.cpp:1045
struct _grk_stream_params grk_stream_params
GRK_API bool GRK_CALLCONV grk_decompress_set_progression_state(grk_object *codec, grk_progression_state state)
Applies a new progression state to one or all cached tiles.
Definition grok.cpp:679
bool(* grk_io_pixels_callback)(uint32_t worker_id, grk_io_buf buffer, void *user_data)
Grok IO pixels callback.
Definition grok.h:512
GRK_API void GRK_CALLCONV grk_plugin_cleanup(void)
Unloads the plugin and releases all plugin-owned resources.
Definition grok.cpp:1223
GRK_API void GRK_CALLCONV grk_deinitialize(void)
Deinitialize the Grok library.
Definition grok.cpp:220
GRK_API void GRK_CALLCONV grk_set_msg_handlers(grk_msg_handlers msg_handlers)
Installs application-defined log message handlers.
Definition grok.cpp:360
GRK_API bool GRK_CALLCONV grk_plugin_load(grk_plugin_load_info info)
Loads a hardware-accelerator plugin (.so / .dll).
Definition grok.cpp:1179
GRK_API void GRK_CALLCONV grk_decompress_set_band_callback(grk_object *codec, grk_io_band_callback callback, void *user_data)
Set a band-completion callback on the decompressor.
Definition grok.cpp:879
uint64_t(* GRK_PLUGIN_COMPRESS_USER_CALLBACK)(grk_plugin_compress_user_callback_info *info)
Plugin compress user callback.
Definition grok.h:2223
#define GRK_MAXRLVLS
Definition grok.h:336
bool(* grk_io_callback)(uint32_t worker_id, grk_io_buf buffer, void *io_user_data)
Grok IO callback.
Definition grok.h:493
GRK_API bool GRK_CALLCONV grk_image_meta_set_field(grk_image_meta *meta, const char *field, const uint8_t *data, size_t len)
Set a metadata buffer on a grk_image_meta object.
Definition grok.cpp:524
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.
Definition grok.cpp:727
GRK_API void GRK_CALLCONV grk_dump_codec(grk_object *codec, uint32_t info_flag, FILE *output_stream)
Dumps codec diagnostic information to a stream.
Definition grok.cpp:819
GRK_API uint32_t GRK_CALLCONV grk_plugin_get_debug_state()
Returns the current debug state bitmask of the loaded plugin.
Definition grok.cpp:1208
struct _grk_precision grk_precision
#define GRK_MAX_PASSES
Grok maximum number of passes.
Definition grok.h:171
GRK_API int32_t GRK_CALLCONV grk_plugin_batch_decompress(void)
Starts (resumes) the queued batch decompress operation.
Definition grok.cpp:1598
enum _GRK_PROG_ORDER GRK_PROG_ORDER
Environment variables.
struct _grk_object grk_object
GRK_API grk_image *GRK_CALLCONV grk_decompress_get_image(grk_object *codec)
Gets the composite decompressed image.
Definition grok.cpp:869
struct _grk_raw_cparameters grk_raw_cparameters
GRK_API bool GRK_CALLCONV grk_decompress_read_header(grk_object *codec, grk_header_info *header_info)
Reads and parses the JPEG 2000 image header.
Definition grok.cpp:716
GRK_API bool GRK_CALLCONV grk_image_is_post_process_no_op(grk_image *image)
Checks whether the image requires post-processing (palette, ICC, colour space conversion,...
Definition grok.cpp:889
GRK_API int32_t GRK_CALLCONV grk_plugin_compress(grk_cparameters *compress_parameters, GRK_PLUGIN_COMPRESS_USER_CALLBACK callback)
Compresses a single image using the loaded hardware plugin.
Definition grok.cpp:1324
_GRK_CHANNEL_ASSOC
Channel association.
Definition grok.h:388
@ GRK_CHANNEL_ASSOC_COLOUR_1
Definition grok.h:390
@ GRK_CHANNEL_ASSOC_COLOUR_2
Definition grok.h:391
@ GRK_CHANNEL_ASSOC_COLOUR_3
Definition grok.h:392
@ GRK_CHANNEL_ASSOC_WHOLE_IMAGE
Definition grok.h:389
@ GRK_CHANNEL_ASSOC_UNASSOCIATED
Definition grok.h:393
enum _GRK_RATE_CONTROL_ALGORITHM GRK_RATE_CONTROL_ALGORITHM
Rate control algorithms.
struct _grk_decompress_core_params grk_decompress_core_params
GRK_API uint64_t GRK_CALLCONV grk_compress_get_compressed_length(grk_object *codec)
Gets the total compressed length (bytes written to output stream/buffer).
Definition grok.cpp:1055
size_t(* grk_stream_read_fn)(uint8_t *buffer, size_t numBytes, void *user_data)
Read stream callback.
Definition grok.h:521
struct _grk_image_meta grk_image_meta
struct _grk_asoc grk_asoc
_grk_data_type
Grok Data types Used to specify the actual data type of Grok image components.
Definition grok.h:767
@ GRK_FLOAT
Definition grok.h:771
@ GRK_INT_32
Definition grok.h:768
@ GRK_INT_8
Definition grok.h:770
@ GRK_DOUBLE
Definition grok.h:772
@ GRK_INT_16
Definition grok.h:769
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)
Retrieves the current progression state for a cached tile.
Definition grok.cpp:664
GRK_API grk_image *GRK_CALLCONV grk_decompress_get_tile_image(grk_object *codec, uint16_t tile_index, bool wait)
Gets decompressed tile image by tile index.
Definition grok.cpp:859
struct _grk_palette_data grk_palette_data
bool(* grk_io_band_callback)(uint32_t yBegin, uint32_t yEnd, grk_image *image, void *user_data)
Callback invoked when a horizontal band of the decompressed image is ready for writing.
Definition grok.h:647
GRK_API bool GRK_CALLCONV grk_decompress_tile(grk_object *codec, uint16_t tile_index)
Decompresses a single tile by index.
Definition grok.cpp:772
#define GRK_API
Definition grok.h:50
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 bool GRK_CALLCONV grk_set_MCT(grk_cparameters *parameters, const float *encoding_matrix, const int32_t *dc_shift, uint32_t nb_comp)
Installs a custom Multi-Component Transform (MCT) matrix.
Definition grok.cpp:830
GRK_API grk_image *GRK_CALLCONV grk_decompress_get_sample_image(grk_object *codec, uint32_t sample_index)
Gets the decompressed image for a specific sample (frame).
Definition grok.cpp:799
GRK_API void GRK_CALLCONV grk_object_unref(grk_object *obj)
Decrements the reference count on a Grok object.
Definition grok.cpp:350
#define GRK_MAX_LAYERS
Definition grok.h:328
GRK_API bool GRK_CALLCONV grk_image_meta_get_field(grk_image_meta *meta, const char *field, uint8_t **data, size_t *len)
Get a metadata buffer from a grk_image_meta object.
Definition grok.cpp:547
GRK_API void GRK_CALLCONV grk_compress_set_default_params(grk_cparameters *parameters)
Fills a grk_cparameters struct with safe default values.
Definition grok.cpp:933
struct _grk_plugin_precinct grk_plugin_precinct
grk_plugin_precinct
GRK_API bool GRK_CALLCONV grk_decompress_sample(grk_object *codec, uint32_t sample_index)
Decompresses a single sample (frame) by index.
Definition grok.cpp:790
GRK_API const char *GRK_CALLCONV grk_version(void)
Gets the Grok library version string.
Definition grok.cpp:374
_GRK_COLOR_SPACE
Grok supported color spaces.
Definition grok.h:88
@ GRK_CLRSPC_SRGB
unknown
Definition grok.h:90
@ GRK_CLRSPC_EYCC
standard YCC (YUV)
Definition grok.h:93
@ GRK_CLRSPC_UNKNOWN
Definition grok.h:89
@ GRK_CLRSPC_SYCC
grayscale
Definition grok.h:92
@ GRK_CLRSPC_DEFAULT_CIE
CMYK.
Definition grok.h:95
@ GRK_CLRSPC_ICC
custom CIE LAB
Definition grok.h:97
@ GRK_CLRSPC_CMYK
extended YCC
Definition grok.h:94
@ GRK_CLRSPC_GRAY
sRGB
Definition grok.h:91
@ GRK_CLRSPC_CUSTOM_CIE
default CIE LAB
Definition grok.h:96
GRK_API bool GRK_CALLCONV grk_plugin_init(grk_plugin_init_info init_info)
Initializes a loaded plugin with a device and license.
Definition grok.cpp:1228
GRK_API bool GRK_CALLCONV grk_decompress(grk_object *codec, grk_plugin_tile *tile)
Starts (or continues) decompression of the JPEG 2000 image.
Definition grok.cpp:762
struct _grk_io_buf grk_io_buf
#define GRK_NUM_XML_BOXES_SUPPORTED
maximum Grok supported number of XML boxes
Definition grok.h:140
_grk_precision_mode
Precision mode.
Definition grok.h:433
@ GRK_PREC_MODE_SCALE
Definition grok.h:435
@ GRK_PREC_MODE_CLIP
Definition grok.h:434
GRK_API grk_image_meta *GRK_CALLCONV grk_image_meta_new(void)
Allocates an empty image metadata object.
Definition grok.cpp:477
enum _GRK_COLOR_SPACE GRK_COLOR_SPACE
Grok supported color spaces.
#define GRK_PATH_LEN
Definition grok.h:327
GRK_API grk_image *GRK_CALLCONV grk_image_new(uint16_t numcmpts, grk_image_comp *cmptparms, GRK_COLOR_SPACE clrspc, bool alloc_data)
Allocates a new Grok image with the specified component layout.
Definition grok.cpp:400
GRK_API bool GRK_CALLCONV grk_image_meta_set_asocs(grk_image_meta *meta, const grk_asoc *asocs, uint32_t num_asocs)
Set association boxes on a grk_image_meta object for writing.
Definition grok.cpp:561
GRK_API int32_t GRK_CALLCONV grk_plugin_decompress(grk_decompress_parameters *decompress_parameters, grk_plugin_decompress_callback callback)
Decompresses a single JPEG 2000 image using the loaded hardware plugin.
Definition grok.cpp:1555
bool(* grk_stream_seek_fn)(uint64_t offset, void *user_data)
Seek (absolute) callback.
Definition grok.h:537
GRK_API size_t GRK_CALLCONV grk_num_workers(void)
Returns the number of worker threads in the core thread pool.
Definition grok.cpp:231
GRK_API grk_object *GRK_CALLCONV grk_decompress_init(grk_stream_params *stream_params, grk_decompress_parameters *params)
Creates and initializes a JPEG 2000 decompressor.
Definition grok.cpp:612
_GRK_ENUM_COLOUR_SPACE
JPEG 2000 enumerated color spaces.
Definition grok.h:104
@ GRK_ENUM_CLRSPC_ESRGB
Definition grok.h:120
@ GRK_ENUM_CLRSPC_CMY
Definition grok.h:111
@ GRK_ENUM_CLRSPC_EYCC
Definition grok.h:124
@ GRK_ENUM_CLRSPC_CIEJAB
Definition grok.h:119
@ GRK_ENUM_CLRSPC_GRAY
Definition grok.h:117
@ GRK_ENUM_CLRSPC_CIE
Definition grok.h:114
@ GRK_ENUM_CLRSPC_UNKNOWN
Definition grok.h:105
@ GRK_ENUM_CLRSPC_YCBCR3
Definition grok.h:109
@ GRK_ENUM_CLRSPC_ROMMRGB
Definition grok.h:121
@ GRK_ENUM_CLRSPC_YPBPR60
Definition grok.h:122
@ GRK_ENUM_CLRSPC_SRGB
Definition grok.h:116
@ GRK_ENUM_CLRSPC_BILEVEL2
Definition grok.h:115
@ GRK_ENUM_CLRSPC_SYCC
Definition grok.h:118
@ GRK_ENUM_CLRSPC_PHOTO_YCC
Definition grok.h:110
@ GRK_ENUM_CLRSPC_YCBCR1
Definition grok.h:107
@ GRK_ENUM_CLRSPC_CMYK
Definition grok.h:112
@ GRK_ENUM_CLRSPC_YCCK
Definition grok.h:113
@ GRK_ENUM_CLRSPC_YPBPR50
Definition grok.h:123
@ GRK_ENUM_CLRSPC_BILEVEL1
Definition grok.h:106
@ GRK_ENUM_CLRSPC_YCBCR2
Definition grok.h:108
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)
Initialises a batch plugin decompress operation but does not start it.
Definition grok.cpp:1576
GRK_API void GRK_CALLCONV grk_decompress_wait_swath_copy(grk_object *codec)
Wait for all in-flight swath copy tasks to complete.
Definition grok.cpp:748
struct _grk_decompress_params grk_decompress_parameters
_GRK_CHANNEL_TYPE
Definition grok.h:377
@ GRK_CHANNEL_TYPE_OPACITY
Definition grok.h:379
@ GRK_CHANNEL_TYPE_PREMULTIPLIED_OPACITY
Definition grok.h:380
@ GRK_CHANNEL_TYPE_COLOUR
Definition grok.h:378
@ GRK_CHANNEL_TYPE_UNSPECIFIED
Definition grok.h:381
#define GRK_MAX_CUSTOM_HEADERS
Definition grok.h:583
_GRK_RATE_CONTROL_ALGORITHM
Rate control algorithms.
Definition grok.h:291
@ GRK_RATE_CONTROL_PCRD_OPT
Definition grok.h:293
@ GRK_RATE_CONTROL_BISECT
Definition grok.h:292
GRK_API bool GRK_CALLCONV grk_decompress_update(grk_decompress_parameters *params, grk_object *codec)
Updates decompression parameters on an already-initialized codec.
Definition grok.cpp:695
GRK_API int32_t GRK_CALLCONV grk_plugin_batch_compress(grk_plugin_compress_batch_info info)
Compresses a directory of images in batch using the hardware plugin.
Definition grok.cpp:1345
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:2288
_GRK_CODEC_FORMAT
Grok Supported JPEG 2000 formats.
Definition grok.h:320
@ GRK_CODEC_J2K
unknown format
Definition grok.h:322
@ GRK_CODEC_MJ2
JPEG 2000 JP2 file format.
Definition grok.h:324
@ GRK_CODEC_JP2
JPEG 2000 code-stream.
Definition grok.h:323
@ GRK_CODEC_UNK
Definition grok.h:321
struct _grk_plugin_tile grk_plugin_tile
#define GRK_CALLCONV
Definition grok.h:46
GRK_API void GRK_CALLCONV grk_decompress_schedule_swath_copy(grk_object *codec, const grk_wait_swath *swath, grk_swath_buffer *buf)
Schedule tile-to-swath copies for a completed swath.
Definition grok.cpp:737
GRK_API uint64_t GRK_CALLCONV grk_compress(grk_object *codec, grk_plugin_tile *tile)
Compresses the image into a JPEG 2000 codestream.
Definition grok.cpp:1026
void(* grk_stream_free_user_data_fn)(void *user_data)
Free user data callback.
Definition grok.h:543
GRK_API void GRK_CALLCONV grk_copy_tile_to_swath(const grk_image *tile_img, const grk_swath_buffer *buf)
Copy a single decoded tile image into a swath buffer using Highway SIMD.
Definition grok.cpp:758
GRK_API grk_data_type GRK_CALLCONV grk_get_data_type(bool compress, uint8_t prec, bool is_mct, uint8_t qmfbid, bool fast_mct)
Determine the data type used by Grok for image component data.
Definition grok.cpp:406
#define GRK_NUM_ASOC_BOXES_SUPPORTED
maximum Grok supported number of asoc boxes
Definition grok.h:135
_GRK_PROG_ORDER
Environment variables.
Definition grok.h:74
@ GRK_RPCL
resolution-layer-component-precinct order
Definition grok.h:78
@ GRK_CPRL
precinct-component-resolution-layer order
Definition grok.h:80
@ GRK_RLCP
layer-resolution-component-precinct order
Definition grok.h:77
@ GRK_PROG_UNKNOWN
Definition grok.h:75
@ GRK_LRCP
unknown progression order
Definition grok.h:76
@ GRK_NUM_PROGRESSION_ORDERS
component-precinct-resolution-layer order
Definition grok.h:81
@ GRK_PCRL
resolution-precinct-component-layer order
Definition grok.h:79
GRK_API uint32_t GRK_CALLCONV grk_worker_id(void)
Returns the TaskFlow worker id of the calling thread.
Definition grok.cpp:236
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)
Blocks until all pending plugin batch jobs have completed.
Definition grok.cpp:1372
struct _grk_plugin_pass grk_plugin_pass
GRK_API uint64_t GRK_CALLCONV grk_compress_frame(grk_object *codec, grk_image *image, grk_plugin_tile *tile)
Compresses an additional frame into a multi-frame container (MJ2).
Definition grok.cpp:1036
enum _GRK_CHANNEL_ASSOC GRK_CHANNEL_ASSOC
Channel association.
GRK_API void GRK_CALLCONV grk_initialize(const char *plugin_path, uint32_t num_threads, bool *plugin_initialized)
Initializes the Grok library.
Definition grok.cpp:274
GRK_API grk_object *GRK_CALLCONV grk_compress_init(grk_stream_params *stream_params, grk_cparameters *parameters, grk_image *image)
Creates and initializes a JPEG 2000 compressor.
Definition grok.cpp:966
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:2323
GRK_API grk_image *GRK_CALLCONV grk_decompress_get_sample_tile_image(grk_object *codec, uint32_t sample_index, uint16_t tile_index)
Gets a decompressed tile image from a specific sample (frame).
Definition grok.cpp:808
Definition grok.h:422
const char * label
Definition grok.h:424
uint8_t * xml
Definition grok.h:425
uint32_t level
Definition grok.h:423
uint32_t xml_len
Definition grok.h:426
Definition grok.h:412
uint16_t num_channel_descriptions
Definition grok.h:414
grk_channel_description * descriptions
Definition grok.h:413
Definition grok.h:401
uint16_t typ
Definition grok.h:403
uint16_t asoc
Definition grok.h:404
uint16_t channel
Definition grok.h:402
Definition grok.h:804
grk_channel_definition * channel_definition
Definition grok.h:808
char * icc_profile_name
Definition grok.h:807
uint32_t icc_profile_len
Definition grok.h:806
uint8_t * icc_profile_buf
Definition grok.h:805
grk_palette_data * palette
Definition grok.h:809
bool has_colour_specification_box
Definition grok.h:810
Definition grok.h:348
uint16_t component
Definition grok.h:349
uint8_t palette_column
Definition grok.h:351
uint8_t mapping_type
Definition grok.h:350
Definition grok.h:1610
uint32_t cblockw_init
Definition grok.h:1634
uint8_t numgbits
Definition grok.h:1629
grk_progression progression[GRK_MAXRLVLS]
Definition grok.h:1631
char outfile[GRK_PATH_LEN]
Definition grok.h:1647
bool apply_icc
Definition grok.h:1685
bool write_sop
Definition grok.h:1709
GRK_PROG_ORDER prog_order
Definition grok.h:1630
uint16_t comment_len[GRK_NUM_COMMENTS_SUPPORTED]
Definition grok.h:1625
uint32_t repeats
Definition grok.h:1692
uint32_t prch_init[GRK_MAXRLVLS]
Definition grok.h:1645
uint32_t image_offset_x0
Definition grok.h:1648
uint64_t max_cs_size
Maximum size (in bytes) for the whole code stream.
Definition grok.h:1667
grk_raw_cparameters raw_cp
Definition grok.h:1654
uint8_t numresolution
Definition grok.h:1633
uint32_t image_offset_y0
Definition grok.h:1649
uint16_t rreq_standard_features[8]
Definition grok.h:1698
GRK_SUPPORTED_FILE_FMT decod_format
Definition grok.h:1652
uint32_t cblockh_init
Definition grok.h:1635
GRK_PROG_ORDER transcode_prog_order
Definition grok.h:1714
bool transcode
Definition grok.h:1707
uint32_t roi_shift
Definition grok.h:1641
bool shared_memory_interface
Definition grok.h:1695
uint8_t subsampling_dy
Definition grok.h:1651
uint32_t prcw_init[GRK_MAXRLVLS]
Definition grok.h:1644
bool tile_size_on
Definition grok.h:1611
uint32_t t_height
Definition grok.h:1615
bool write_capture_resolution_from_file
Definition grok.h:1678
uint32_t res_spec
Definition grok.h:1643
uint64_t max_comp_size
Maximum size (in bytes) for each component.
Definition grok.h:1672
uint32_t num_threads
Definition grok.h:1688
uint8_t mct
Definition grok.h:1657
uint16_t numlayers
Definition grok.h:1616
GRK_SUPPORTED_FILE_FMT cod_format
Definition grok.h:1653
bool write_rreq
Definition grok.h:1697
double capture_resolution_from_file[2]
Definition grok.h:1679
bool irreversible
Definition grok.h:1637
uint32_t t_width
Definition grok.h:1614
bool write_display_resolution
Definition grok.h:1682
uint8_t cblk_sty
Definition grok.h:1636
uint8_t csty
Definition grok.h:1628
uint8_t new_tile_part_progression_divider
Definition grok.h:1656
bool is_binary_comment[GRK_NUM_COMMENTS_SUPPORTED]
Definition grok.h:1626
uint16_t rsiz
RSIZ value To be used to combine GRK_PROFILE_*, GRK_EXTENSION_* and (sub)levels values.
Definition grok.h:1675
char infile[GRK_PATH_LEN]
Definition grok.h:1646
double layer_distortion[GRK_MAX_LAYERS]
Definition grok.h:1623
GRK_RATE_CONTROL_ALGORITHM rate_control_algorithm
Definition grok.h:1687
uint32_t kernel_build_options
Definition grok.h:1691
bool write_plt
Definition grok.h:1693
void * mct_data
Naive implementation of MCT restricted to a single reversible array based compressing without offset ...
Definition grok.h:1660
uint32_t tx0
Definition grok.h:1612
bool write_eph
Definition grok.h:1710
char * comment[GRK_NUM_COMMENTS_SUPPORTED]
Definition grok.h:1624
bool write_capture_resolution
Definition grok.h:1680
uint8_t subsampling_dx
Definition grok.h:1650
int32_t device_id
Definition grok.h:1689
uint16_t max_layers_transcode
Definition grok.h:1711
size_t num_comments
Definition grok.h:1627
uint16_t framerate
Definition grok.h:1676
bool allocation_by_rate_distortion
rate control allocation by rate/distortion curve
Definition grok.h:1618
bool allocation_by_quality
Definition grok.h:1622
bool write_tlm
Definition grok.h:1694
double display_resolution[2]
Definition grok.h:1683
uint8_t max_res_transcode
Definition grok.h:1712
int32_t roi_compno
region of interest: affected component in [0..3]; -1 indicates no ROI
Definition grok.h:1640
uint32_t ty0
Definition grok.h:1613
uint32_t duration
Definition grok.h:1690
grk_stream_params transcode_src
Definition grok.h:1708
bool jpx_branding
Definition grok.h:1696
double layer_rate[GRK_MAX_LAYERS]
layers rates expressed as compression ratios.
Definition grok.h:1621
bool geoboxes_after_jp2c
Definition grok.h:1700
bool enable_tile_part_generation
Definition grok.h:1655
uint8_t num_rreq_standard_features
Definition grok.h:1699
uint32_t numpocs
Definition grok.h:1632
double capture_resolution[2]
Definition grok.h:1681
Definition grok.h:668
grk_io_pixels_callback io_buffer_callback
Definition grok.h:690
grk_io_band_callback io_band_callback
Definition grok.h:693
uint16_t layers_to_decompress
Set the maximum number of quality layers to decompress.
Definition grok.h:684
uint16_t max_active_tiles
Definition grok.h:687
bool skip_allocate_composite
Definition grok.h:689
uint32_t disable_random_access_flags
Definition grok.h:688
bool fast_16bit_mct
Definition grok.h:704
uint32_t tile_cache_strategy
Definition grok.h:685
uint16_t * comps_to_decode
Array of 0-based component indices to decode.
Definition grok.h:702
void * io_band_user_data
Definition grok.h:694
void * io_user_data
Definition grok.h:691
uint8_t reduce
Set the number of highest resolution levels to be discarded.
Definition grok.h:677
uint16_t num_comps_to_decode
Definition grok.h:703
grk_io_register_reclaim_callback io_register_client_callback
Definition grok.h:692
Definition grok.h:718
GRK_COLOR_SPACE color_space
Definition grok.h:740
double dw_x0
Definition grok.h:729
bool io_xml
Definition grok.h:749
grk_precision * precision
Definition grok.h:743
uint32_t compression_level
Definition grok.h:751
bool asynchronous
Definition grok.h:720
GRK_SUPPORTED_FILE_FMT cod_format
Definition grok.h:728
uint16_t tile_index
Definition grok.h:733
uint32_t num_precision
Definition grok.h:744
bool split_by_component
Definition grok.h:745
char infile[GRK_PATH_LEN]
Definition grok.h:725
double dw_x1
Definition grok.h:730
bool force_rgb
Definition grok.h:741
uint32_t compression
Definition grok.h:750
uint32_t num_threads
Definition grok.h:754
int32_t device_id
Definition grok.h:757
uint32_t kernel_build_options
Definition grok.h:756
void * user_data
Definition grok.h:758
bool single_tile_decompress
Definition grok.h:746
uint32_t repeats
Definition grok.h:753
bool simulate_synchronous
Definition grok.h:721
bool upsample
Definition grok.h:742
grk_decompress_core_params core
Definition grok.h:719
grk_decompress_callback decompress_callback
Definition grok.h:722
double dw_y1
Definition grok.h:732
uint32_t duration
Definition grok.h:752
double dw_y0
Definition grok.h:731
void * decompress_callback_user_data
Definition grok.h:723
GRK_CODEC_FORMAT decod_format
Definition grok.h:727
char outfile[GRK_PATH_LEN]
Definition grok.h:726
Definition grok.h:883
uint32_t cblockh_init
Definition grok.h:889
uint16_t comment_len[GRK_NUM_COMMENTS_SUPPORTED]
Definition grok.h:924
bool upsample
Definition grok.h:935
GRK_COLOR_SPACE color_space
Definition grok.h:932
uint32_t num_precision
Definition grok.h:937
uint16_t num_layers
Definition grok.h:916
uint32_t num_asocs
Definition grok.h:927
char * comment[GRK_NUM_COMMENTS_SUPPORTED]
Definition grok.h:923
uint32_t t_width
Definition grok.h:912
uint32_t num_xml_boxes
Definition grok.h:921
GRK_PROG_ORDER prog_order
Definition grok.h:894
bool is_binary_comment[GRK_NUM_COMMENTS_SUPPORTED]
Definition grok.h:925
uint8_t * xml_boxes_data[GRK_NUM_XML_BOXES_SUPPORTED]
Definition grok.h:919
uint32_t prch_init[GRK_MAXRLVLS]
Definition grok.h:909
uint16_t t_grid_height
Definition grok.h:915
bool split_by_component
Definition grok.h:938
size_t xml_data_len
Definition grok.h:918
size_t num_comments
Definition grok.h:922
uint8_t csty
Definition grok.h:901
bool force_rgb
Definition grok.h:934
GRK_SUPPORTED_FILE_FMT decompress_fmt
Definition grok.h:933
grk_asoc asocs[GRK_NUM_ASOC_BOXES_SUPPORTED]
Definition grok.h:926
uint32_t tx0
Definition grok.h:910
uint32_t ty0
Definition grok.h:911
uint32_t cblockw_init
Definition grok.h:888
uint16_t rsiz
Definition grok.h:892
grk_precision * precision
Definition grok.h:936
uint8_t mct
Definition grok.h:891
uint8_t numresolutions
Definition grok.h:893
grk_image header_image
Definition grok.h:887
size_t xml_boxes_len[GRK_NUM_XML_BOXES_SUPPORTED]
Definition grok.h:920
uint16_t t_grid_width
Definition grok.h:914
uint32_t t_height
Definition grok.h:913
uint8_t cblk_sty
Definition grok.h:907
uint32_t prcw_init[GRK_MAXRLVLS]
Definition grok.h:908
bool single_tile_decompress
Definition grok.h:939
uint8_t * xml_data
Definition grok.h:917
bool irreversible
Definition grok.h:890
Definition grok.h:780
uint32_t h
Definition grok.h:785
uint8_t dy
Definition grok.h:787
bool owns_data
Definition grok.h:796
GRK_CHANNEL_ASSOC association
Definition grok.h:791
GRK_CHANNEL_TYPE type
Definition grok.h:790
uint8_t dx
Definition grok.h:786
void * data
Definition grok.h:795
bool sgnd
Definition grok.h:789
uint32_t w
Definition grok.h:783
uint8_t prec
Definition grok.h:788
uint16_t crg_x
Definition grok.h:792
grk_data_type data_type
Definition grok.h:794
uint32_t x0
Definition grok.h:781
uint32_t y0
Definition grok.h:782
uint16_t crg_y
Definition grok.h:793
uint32_t stride
Definition grok.h:784
Definition grok.h:818
grk_color color
Definition grok.h:820
uint32_t num_asoc_boxes
Definition grok.h:834
size_t xml_len
Definition grok.h:832
uint8_t * xmp_buf
Definition grok.h:823
grk_object obj
Definition grok.h:819
uint8_t * geotiff_buf
Definition grok.h:827
size_t xmp_len
Definition grok.h:824
uint8_t * ipr_data
Definition grok.h:829
uint8_t * exif_buf
Definition grok.h:825
uint8_t * xml_buf
Definition grok.h:831
size_t geotiff_len
Definition grok.h:828
grk_asoc * asoc_boxes
Definition grok.h:833
size_t exif_len
Definition grok.h:826
size_t iptc_len
Definition grok.h:822
size_t ipr_len
Definition grok.h:830
uint8_t * iptc_buf
Definition grok.h:821
Definition grok.h:844
uint64_t packed_row_bytes
Definition grok.h:873
grk_precision * precision
Definition grok.h:861
bool has_capture_resolution
Definition grok.h:854
uint16_t numcomps
Definition grok.h:850
bool force_rgb
Definition grok.h:859
uint32_t y0
Definition grok.h:847
bool split_by_component
Definition grok.h:864
GRK_COLOR_SPACE color_space
Definition grok.h:851
uint32_t rows_per_task
Definition grok.h:872
uint32_t rows_per_strip
Definition grok.h:871
bool upsample
Definition grok.h:860
grk_image_comp * comps
Definition grok.h:875
uint8_t decompress_prec
Definition grok.h:868
bool has_multiple_tiles
Definition grok.h:863
grk_io_buf interleaved_data
Definition grok.h:870
GRK_COLOR_SPACE decompress_colour_space
Definition grok.h:869
uint32_t x0
Definition grok.h:846
grk_object obj
Definition grok.h:845
uint32_t num_precision
Definition grok.h:862
uint16_t decompress_num_comps
Definition grok.h:865
bool has_display_resolution
Definition grok.h:856
GRK_SUPPORTED_FILE_FMT decompress_fmt
Definition grok.h:858
double display_resolution[2]
Definition grok.h:857
uint32_t y1
Definition grok.h:849
uint32_t decompress_width
Definition grok.h:866
uint32_t decompress_height
Definition grok.h:867
double capture_resolution[2]
Definition grok.h:855
grk_image_meta * meta
Definition grok.h:874
uint32_t x1
Definition grok.h:848
bool palette_applied
Definition grok.h:852
bool channel_definition_applied
Definition grok.h:853
Definition grok.h:468
size_t alloc_len
Definition grok.h:472
bool pooled
Definition grok.h:473
size_t len
Definition grok.h:471
size_t offset
Definition grok.h:470
uint8_t * data
Definition grok.h:469
uint32_t index
Definition grok.h:474
Definition grok.h:482
uint32_t max_pooled_requests
Definition grok.h:483
Definition grok.h:191
grk_msg_callback info_callback
Definition grok.h:192
void * warn_data
Definition grok.h:199
grk_msg_callback warn_callback
Definition grok.h:198
grk_msg_callback error_callback
Definition grok.h:200
void * trace_data
Definition grok.h:197
void * error_data
Definition grok.h:201
grk_msg_callback debug_callback
Definition grok.h:194
grk_msg_callback trace_callback
Definition grok.h:196
void * debug_data
Definition grok.h:195
void * info_data
Definition grok.h:193
Definition grok.h:209
void * wrapper
Definition grok.h:210
Definition grok.h:359
grk_component_mapping_comp * component_mapping
Definition grok.h:362
uint8_t num_channels
Definition grok.h:363
int32_t * lut
Definition grok.h:360
uint16_t num_entries
Definition grok.h:361
bool * channel_sign
Definition grok.h:364
uint8_t * channel_prec
Definition grok.h:365
Definition grok.h:1063
uint64_t num_precincts
Definition grok.h:1065
float stepsize
Definition grok.h:1067
uint8_t orientation
Definition grok.h:1064
grk_plugin_precinct ** precincts
Definition grok.h:1066
Definition grok.h:1031
uint32_t y0
Definition grok.h:1035
uint8_t num_passes
Definition grok.h:1043
uint32_t compressed_data_length
Definition grok.h:1041
grk_plugin_pass passes[GRK_MAX_PASSES]
Definition grok.h:1044
unsigned int sorted_index
Definition grok.h:1045
uint32_t x0
Definition grok.h:1035
uint8_t * compressed_data
Definition grok.h:1040
uint32_t y1
Definition grok.h:1035
uint32_t x1
Definition grok.h:1035
unsigned int * context_stream
Definition grok.h:1036
uint32_t num_pix
Definition grok.h:1039
uint8_t num_bit_planes
Definition grok.h:1042
uint32_t full_image_y0
Definition grok.h:2313
GRK_CODEC_FORMAT decod_format
Definition grok.h:2301
unsigned int error_code
Definition grok.h:2310
grk_decompress_parameters * decompressor_parameters
Definition grok.h:2306
grk_header_info header_info
Definition grok.h:2305
GRK_SUPPORTED_FILE_FMT cod_format
Definition grok.h:2303
grk_plugin_tile * tile
Definition grok.h:2309
size_t device_id
Definition grok.h:2296
uint32_t full_image_x0
Definition grok.h:2312
grk_object * codec
Definition grok.h:2304
void * user_data
Definition grok.h:2314
bool plugin_owns_image
Definition grok.h:2308
uint32_t decompress_flags
Definition grok.h:2311
const char * output_file_name
Definition grok.h:2299
GROK_INIT_DECOMPRESSORS init_decompressors_func
Definition grok.h:2297
void * format_private
Definition grok.h:2315
const char * input_file_name
Definition grok.h:2298
grk_image * image
Definition grok.h:2307
Definition grok.h:2182
bool verbose
Definition grok.h:2184
const char * server
Definition grok.h:2186
int32_t device_id
Definition grok.h:2183
const char * license
Definition grok.h:2185
Definition grok.h:2104
const char * pluginPath
Definition grok.h:2105
Definition grok.h:1020
size_t rate
Definition grok.h:1022
size_t length
Definition grok.h:1023
double distortion_decrease
Definition grok.h:1021
grk_plugin_precinct
Definition grok.h:1053
uint64_t num_blocks
Definition grok.h:1054
grk_plugin_code_block ** blocks
Definition grok.h:1055
Definition grok.h:1075
uint8_t num_bands
Definition grok.h:1077
uint8_t level
Definition grok.h:1076
grk_plugin_band ** band
Definition grok.h:1078
Definition grok.h:1104
uint16_t num_components
Definition grok.h:1106
uint32_t decompress_flags
Definition grok.h:1105
grk_plugin_tile_component ** tile_components
Definition grok.h:1107
Definition grok.h:443
grk_precision_mode mode
Definition grok.h:445
uint8_t prec
Definition grok.h:444
Definition grok.h:454
uint16_t comp[256]
Definition grok.h:458
bool single_tile
Definition grok.h:459
uint8_t num_resolutions
Definition grok.h:455
uint16_t tile_index
Definition grok.h:460
uint16_t numcomps
Definition grok.h:457
uint16_t layers_per_resolution[33]
Definition grok.h:456
Definition grok.h:218
uint16_t comp_temp
Definition grok.h:253
uint32_t tx1
Definition grok.h:227
uint64_t prec_e
Definition grok.h:236
GRK_PROG_ORDER specified_compression_poc_prog
Definition grok.h:221
uint16_t comp_s
progression order bounds specified by POC
Definition grok.h:231
uint8_t res_temp
Definition grok.h:254
uint32_t tp_ty_e
Definition grok.h:248
uint32_t tp_tx_s
Definition grok.h:245
uint8_t res_s
Definition grok.h:233
uint32_t tx0
tile dimensions
Definition grok.h:225
uint8_t tp_res_s
Definition grok.h:241
uint64_t prec_temp
Definition grok.h:255
uint64_t tp_prec_e
Definition grok.h:243
uint32_t tp_ty_s
Definition grok.h:247
uint8_t tp_res_e
Definition grok.h:242
uint32_t ty0
Definition grok.h:226
uint32_t ty1
Definition grok.h:228
uint32_t ty0_temp
Definition grok.h:258
uint16_t comp_e
Definition grok.h:232
uint32_t dy
Definition grok.h:250
GRK_PROG_ORDER progression
Definition grok.h:219
uint32_t dx
Definition grok.h:249
uint16_t tp_comp_e
Definition grok.h:240
uint64_t prec_s
Definition grok.h:235
uint32_t tp_tx_e
Definition grok.h:246
uint32_t tx0_temp
Definition grok.h:257
uint16_t tp_lay_e
Definition grok.h:244
uint32_t tileno
Definition grok.h:222
uint16_t lay_temp
Definition grok.h:256
uint16_t tp_comp_s
Definition grok.h:239
uint16_t lay_e
Definition grok.h:238
uint16_t lay_s
Definition grok.h:237
char progression_str[5]
Definition grok.h:220
uint8_t res_e
Definition grok.h:234
Definition grok.h:266
uint8_t dy
subsampling in X direction
Definition grok.h:268
uint8_t dx
Definition grok.h:267
Definition grok.h:276
uint8_t prec
number of components
Definition grok.h:280
uint32_t width
Definition grok.h:277
uint16_t numcomps
height
Definition grok.h:279
grk_raw_comp_cparameters * comps
signed/unsigned
Definition grok.h:282
bool sgnd
bit depth
Definition grok.h:281
uint32_t height
width
Definition grok.h:278
Definition grok.h:552
uint8_t * buf
Definition grok.h:567
char proxy_userpwd[256]
Definition grok.h:611
grk_stream_read_fn read_fn
Definition grok.h:572
char request_payer[64]
Definition grok.h:614
size_t buf_len
Definition grok.h:568
char proxy[512]
Definition grok.h:610
char region[64]
Definition grok.h:587
char user_agent[256]
Definition grok.h:617
int8_t s3_use_virtual_hosting
Definition grok.h:592
char cookie[4096]
Definition grok.h:597
int8_t s3_use_https
Definition grok.h:591
bool use_stdio
Definition grok.h:564
grk_stream_free_user_data_fn free_user_data_fn
Definition grok.h:575
char cookie_file[GRK_PATH_LEN]
Definition grok.h:599
size_t double_buffer_len
Definition grok.h:555
size_t initial_offset
Definition grok.h:554
char netrc_file[GRK_PATH_LEN]
Definition grok.h:606
bool is_read_stream
Definition grok.h:560
bool s3_allow_insecure
Definition grok.h:594
char username[129]
Definition grok.h:580
size_t stream_len
Definition grok.h:577
char cookie_jar[GRK_PATH_LEN]
Definition grok.h:601
uint8_t num_custom_headers
Definition grok.h:586
uint32_t max_retry
Definition grok.h:624
grk_stream_write_fn write_fn
Definition grok.h:573
char custom_headers[GRK_MAX_CUSTOM_HEADERS][1024]
Definition grok.h:584
uint32_t retry_delay
Definition grok.h:625
size_t initial_double_buffer_len
Definition grok.h:557
long timeout
Definition grok.h:620
grk_stream_seek_fn seek_fn
Definition grok.h:574
void * user_data
Definition grok.h:576
char s3_endpoint[256]
Definition grok.h:590
bool from_network
Definition grok.h:559
char bearer_token[4097]
Definition grok.h:582
long connect_timeout
Definition grok.h:621
bool netrc
Definition grok.h:605
bool s3_no_sign_request
Definition grok.h:593
char password[129]
Definition grok.h:581
char file[GRK_PATH_LEN]
Definition grok.h:563
size_t buf_compressed_len
Definition grok.h:569
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:2229
grk_cparameters * compress_parameters
Definition grok.h:2232
GRK_PLUGIN_COMPRESS_USER_CALLBACK callback
Definition grok.h:2233
const char * output_dir
Definition grok.h:2231
const char * input_dir
Definition grok.h:2230
Plugin compress user callback info.
Definition grok.h:2208
grk_cparameters * compressor_parameters
Definition grok.h:2212
grk_image * image
Definition grok.h:2213
grk_plugin_tile * tile
Definition grok.h:2214
const char * output_file_name
Definition grok.h:2211
grk_stream_params stream_params
Definition grok.h:2215
unsigned int error_code
Definition grok.h:2216
const char * input_file_name
Definition grok.h:2209
bool output_file_name_is_relative
Definition grok.h:2210
Plugin decompress callback info.
Plugin load info.
Plugin pass.
Plugin resolution.
Plugin tile component.
Definition grok.h:1086
uint8_t numresolutions
Definition grok.h:1087
grk_plugin_resolution ** resolutions
Definition grok.h:1088
Plugin tile.
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 ...
User-managed output buffer for asynchronous swath tile copy-and-convert.
Definition grok.h:974
uint16_t numcomps
Number of output bands.
Definition grok.h:978
uint32_t x1
Swath image x end, exclusive (image pixel coordinates).
Definition grok.h:986
bool sgnd
true = signed output (int16/int32); false = unsigned
Definition grok.h:977
int * band_map
numcomps-element array of 1-based component indices, or NULL
Definition grok.h:982
void * data
Output buffer pointer.
Definition grok.h:975
uint8_t prec
Output bit depth: 8, 16, or 32.
Definition grok.h:976
uint32_t y0
Swath image y origin (image pixel coordinates).
Definition grok.h:985
int64_t band_space
Bytes between adjacent bands (GDAL nBandSpace).
Definition grok.h:981
int64_t pixel_space
Bytes between adjacent pixels in same row and band (GDAL nPixelSpace).
Definition grok.h:979
int64_t line_space
Bytes between adjacent rows in same band (GDAL nLineSpace).
Definition grok.h:980
uint32_t x0
Swath image x origin (image pixel coordinates).
Definition grok.h:984
uint32_t y1
Swath image y end, exclusive (image pixel coordinates).
Definition grok.h:987
int promote_alpha
0-based component index for 1-bit alpha promotion, or -1
Definition grok.h:983
Specify swath region to wait on during asynchronous decompression.
Definition grok.h:1004
uint32_t y0
Input: Pixel coordinate: top-left y.
Definition grok.h:1006
uint16_t num_tile_cols
Output: Total tile columns in the image tile grid.
Definition grok.h:1013
uint32_t x1
Input: Pixel coordinate: bottom-right x (exclusive).
Definition grok.h:1007
uint32_t y1
Input: Pixel coordinate: bottom-right y (exclusive).
Definition grok.h:1008
uint16_t tile_y0
Output: Global tile row start (inclusive).
Definition grok.h:1010
uint16_t tile_y1
Output: Global tile row end (exclusive).
Definition grok.h:1012
uint16_t tile_x0
Output: Global tile column start (inclusive).
Definition grok.h:1009
uint16_t tile_x1
Output: Global tile column end (exclusive).
Definition grok.h:1011
uint32_t x0
Input: Pixel coordinate: top-left x.
Definition grok.h:1005