Go to the documentation of this file.
40 #define JPIP_JPIP 0x6a706970
42 #define JP2_JP 0x6a502020
43 #define JP2_FTYP 0x66747970
44 #define JP2_JP2H 0x6a703268
45 #define JP2_IHDR 0x69686472
46 #define JP2_COLR 0x636f6c72
47 #define JP2_JP2C 0x6a703263
48 #define JP2_URL 0x75726c20
49 #define JP2_DTBL 0x6474626c
50 #define JP2_BPCC 0x62706363
51 #define JP2_JP2 0x6a703220
52 #define JP2_PCLR 0x70636c72
53 #define JP2_CMAP 0x636d6170
54 #define JP2_CDEF 0x63646566
unsigned short typ
Definition: jp2.h:62
void jp2_write_jp2h(opj_jp2_t *jp2, opj_cio_t *cio)
Write the JP2H box - JP2 Header box (used in MJ2)
Definition: jp2.c:813
struct opj_jp2_box opj_jp2_box_t
JP2 Box.
Palette data: table entries, palette columns.
Definition: jp2.h:86
#define opj_free(m)
Deallocates or frees a memory block.
Definition: opj_malloc.h:152
int cio_numbytesleft(opj_cio_t *cio)
Number of bytes left before the end of the stream.
Definition: cio.c:121
int x1
Xsiz: width of the reference grid.
Definition: openjpeg.h:539
void jp2_setup_decoder(opj_jp2_t *jp2, opj_dparameters_t *parameters)
Setup the decoder decoding parameters using user parameters.
Definition: jp2.c:1105
unsigned int w
Definition: jp2.h:125
#define opj_malloc(size)
Allocate an uninitialized memory block.
Definition: opj_malloc.h:51
unsigned char pcol
Definition: jp2.h:80
static int write_fidx(int offset_jp2c, int length_jp2c, int offset_idx, int length_idx, opj_cio_t *cio)
Write file Index (superbox)
Definition: jp2.c:1012
opj_jp2_cmap_comp_t * cmap
Definition: jp2.h:91
int type
Definition: jp2.h:152
@ CLRSPC_SYCC
YUV.
Definition: openjpeg.h:135
#define JP2_JP2
File type fields.
Definition: jp2.h:51
JPEG-2000 codestream reader/writer.
Definition: j2k.h:314
void jp2_write_jp2h(opj_jp2_t *jp2, opj_cio_t *cio)
Write the JP2H box - JP2 Header box (used in MJ2)
Definition: jp2.c:813
JPEG-2000 file format reader/writer.
Definition: jp2.h:120
unsigned int UnkC
Definition: jp2.h:130
#define OPJ_ARG_NOT_USED(x)
Definition: openjpeg.h:68
opj_bool jp2_read_jp2h(opj_jp2_t *jp2, opj_cio_t *cio, opj_jp2_color_t *color)
Read the JP2H box - JP2 Header box (used in MJ2)
Definition: jp2.c:648
int icc_profile_len
Definition: jp2.h:101
int prec
precision
Definition: openjpeg.h:517
opj_bool jpip_on
Enable JPIP indexing.
Definition: openjpeg.h:355
unsigned int j2k_codestream_length
Definition: jp2.h:142
unsigned int j2k_codestream_offset
Definition: jp2.h:141
struct opj_jp2_cdef_info opj_jp2_cdef_info_t
Channel description: channel index, type, assocation.
void j2k_destroy_decompress(opj_j2k_t *j2k)
Destroy a J2K decompressor handle.
Definition: j2k.c:1835
opj_bool jp2_read_jp2h(opj_jp2_t *jp2, opj_cio_t *cio, opj_jp2_color_t *color)
Read the JP2H box - JP2 Header box (used in MJ2)
Definition: jp2.c:648
opj_j2k_t * j2k_create_decompress(opj_common_ptr cinfo)
Creates a J2K decompression structure.
Definition: j2k.c:1818
static void jp2_write_colr(opj_jp2_t *jp2, opj_cio_t *cio)
Definition: jp2.c:313
Channel description: channel index, type, assocation.
Definition: jp2.h:60
struct opj_jp2_pclr opj_jp2_pclr_t
Palette data: table entries, palette columns.
opj_jp2_pclr_t * jp2_pclr
Definition: jp2.h:104
unsigned int numcomps
Definition: jp2.h:127
OPJ_COLOR_SPACE color_space
color space: sRGB, Greyscale or YUV
Definition: openjpeg.h:545
static void jp2_write_ihdr(opj_jp2_t *jp2, opj_cio_t *cio)
Definition: jp2.c:244
static void jp2_free_pclr(opj_jp2_color_t *color)
Definition: jp2.c:335
static void jp2_write_jp(opj_cio_t *cio)
Definition: jp2.c:957
#define JP2_URL
URL box.
Definition: jp2.h:48
Defines a single image component.
Definition: openjpeg.h:503
#define opj_calloc(num, size)
Allocate a memory block with elements initialized to 0.
Definition: opj_malloc.h:63
int sgnd
signed (1) / unsigned (0)
Definition: openjpeg.h:521
void jp2_destroy_compress(opj_jp2_t *jp2)
Destroy a JP2 compressor handle.
Definition: jp2.c:1130
opj_jp2_t * jp2_create_decompress(opj_common_ptr cinfo)
Creates a JP2 decompression structure.
Definition: jp2.c:1076
unsigned short asoc
Definition: jp2.h:62
opj_bool ignore_pclr_cmap_cdef
Definition: jp2.h:144
opj_j2k_t * j2k_create_compress(opj_common_ptr cinfo)
Creates a J2K compression structure.
Definition: j2k.c:2119
unsigned int cio_read(opj_cio_t *cio, int n)
Read some bytes.
Definition: cio.c:183
struct opj_jp2_cmap_comp opj_jp2_cmap_comp_t
Component mappings: channel index, mapping type, palette index.
unsigned int enumcs
Definition: jp2.h:134
Compression parameters.
Definition: openjpeg.h:230
static opj_bool jp2_read_struct(opj_jp2_t *jp2, opj_cio_t *cio, opj_jp2_color_t *color)
Decode the structure of a JP2 file.
Definition: jp2.c:997
struct opj_jp2_comps opj_jp2_comps_t
JP2 component.
Collector for ICC profile, palette, component mapping, channel description.
Definition: jp2.h:98
unsigned short nr_entries
Definition: jp2.h:92
unsigned char * channel_sign
Definition: jp2.h:89
opj_common_ptr cinfo
codec context
Definition: j2k.h:316
unsigned char * channel_size
Definition: jp2.h:90
static int jp2_write_jp2c(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info)
Definition: jp2.c:904
#define JP2_JP2H
JP2 header box.
Definition: jp2.h:44
#define JP2_IHDR
Image header box.
Definition: jp2.h:45
int w
data width
Definition: openjpeg.h:509
opj_bool jpip_on
Definition: jp2.h:143
int x0
XOsiz: horizontal offset from the origin of the reference grid to the left side of the image area.
Definition: openjpeg.h:535
opj_bool opj_jp2_encode(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info)
Encode an image into a JPEG-2000 file stream.
Definition: jp2.c:1212
unsigned char jp2_has_colr
Definition: jp2.h:105
unsigned int flags
Definition: openjpeg.h:412
unsigned int cio_write(opj_cio_t *cio, unsigned int64 v, int n)
Write some bytes.
Definition: cio.c:167
Byte input-output stream (CIO)
Definition: openjpeg.h:475
unsigned int bpc
Definition: jp2.h:128
void jp2_setup_encoder(opj_jp2_t *jp2, opj_cparameters_t *parameters, opj_image_t *image)
Setup the encoder parameters using the current image and using user parameters.
Definition: jp2.c:1145
int sgnd
Definition: jp2.h:113
static void jp2_write_ftyp(opj_jp2_t *jp2, opj_cio_t *cio)
Write the FTYP box - File type box.
Definition: jp2.c:844
#define JP2_COLR
Colour specification box.
Definition: jp2.h:46
unsigned short cmp
Definition: jp2.h:79
JP2 Box.
Definition: jp2.h:150
static opj_bool jp2_read_jp(opj_jp2_t *jp2, opj_cio_t *cio)
Read the JP box - JPEG 2000 signature.
Definition: jp2.c:971
#define JP2_CMAP
Component Mapping box.
Definition: jp2.h:53
int depth
Definition: jp2.h:112
void jp2_setup_decoder(opj_jp2_t *jp2, opj_dparameters_t *parameters)
Setup the decoder decoding parameters using user parameters.
Definition: jp2.c:1105
static opj_bool jp2_read_cdef(opj_jp2_t *jp2, opj_cio_t *cio, opj_jp2_box_t *box, opj_jp2_color_t *color)
Definition: jp2.c:560
int y0
YOsiz: vertical offset from the origin of the reference grid to the top side of the image area.
Definition: openjpeg.h:537
static void jp2_apply_pclr(opj_jp2_color_t *color, opj_image_t *image, opj_common_ptr cinfo)
Apply collected palette data.
Definition: jp2.c:360
@ CLRSPC_GRAY
grayscale
Definition: openjpeg.h:134
unsigned char * icc_profile_buf
Definition: jp2.h:100
#define JPIP_IPTR
Definition: indexbox_manager.h:55
unsigned char * end
pointer to the end of the stream
Definition: openjpeg.h:489
unsigned int * entries
Definition: jp2.h:88
static opj_bool jp2_read_cmap(opj_jp2_t *jp2, opj_cio_t *cio, opj_jp2_box_t *box, opj_jp2_color_t *color)
Collect component mapping data.
Definition: jp2.c:492
int write_cidx(int offset, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t cstr_info, int j2klen)
Definition: cidx_manager.c:68
opj_jp2_t * jp2_create_decompress(opj_common_ptr cinfo)
Creates a JP2 decompression structure.
Definition: jp2.c:1076
opj_image_t * opj_jp2_decode(opj_jp2_t *jp2, opj_cio_t *cio, opj_codestream_info_t *cstr_info)
Decode an image from a JPEG-2000 file stream.
Definition: jp2.c:744
int OPJ_CALLCONV cio_tell(opj_cio_t *cio)
Get position in byte stream.
Definition: cio.c:100
struct opj_jp2_cdef opj_jp2_cdef_t
Channel descriptions and number of descriptions.
#define OPJ_TRUE
Definition: openjpeg.h:64
unsigned int C
Definition: jp2.h:129
#define JP2_JP2C
Contiguous codestream box.
Definition: jp2.h:47
int * data
image component data
Definition: openjpeg.h:527
opj_jp2_cdef_info_t * info
Definition: jp2.h:70
#define JPIP_FIDX
Definition: indexbox_manager.h:52
static opj_bool jp2_read_bpcc(opj_jp2_t *jp2, opj_cio_t *cio)
Definition: jp2.c:286
struct opj_jp2 opj_jp2_t
JPEG-2000 file format reader/writer.
void jp2_destroy_decompress(opj_jp2_t *jp2)
Destroy a JP2 decompressor handle.
Definition: jp2.c:1090
static opj_bool jp2_read_boxhdr(opj_common_ptr cinfo, opj_cio_t *cio, opj_jp2_box_t *box)
Read box headers.
Definition: jp2.c:160
opj_bool opj_event_msg(opj_common_ptr cinfo, int event_type, const char *fmt,...)
Write formatted data to a string and send the string to a user callback.
Definition: event.c:76
void cio_skip(opj_cio_t *cio, int n)
Skip some bytes.
Definition: cio.c:198
Definition: openjpeg.h:430
#define JPIP_PRXY
Definition: indexbox_manager.h:54
static opj_bool jp2_read_colr(opj_jp2_t *jp2, opj_cio_t *cio, opj_jp2_box_t *box, opj_jp2_color_t *color)
Collect colour specification data.
Definition: jp2.c:593
static opj_bool jp2_read_ihdr(opj_jp2_t *jp2, opj_cio_t *cio)
Read the IHDR box - Image Header box.
Definition: jp2.c:211
void jp2_destroy_decompress(opj_jp2_t *jp2)
Destroy a JP2 decompressor handle.
Definition: jp2.c:1090
#define JP2_CDEF
Channel Definition box.
Definition: jp2.h:54
unsigned int brand
Definition: jp2.h:136
unsigned char * bp
pointer to the current position
Definition: openjpeg.h:491
static void jp2_apply_cdef(opj_image_t *image, opj_jp2_color_t *color)
Definition: jp2.c:525
unsigned int * cl
Definition: jp2.h:139
static void write_prxy(int offset_jp2c, int length_jp2c, int offset_idx, int length_idx, opj_cio_t *cio)
Write proxy box.
Definition: jp2.c:1030
opj_jp2_t * jp2_create_compress(opj_common_ptr cinfo)
Creates a JP2 compression structure.
Definition: jp2.c:1116
unsigned int approx
Definition: jp2.h:133
#define JP2_JP
JPEG 2000 signature box.
Definition: jp2.h:42
static opj_bool jp2_read_jp2c(opj_jp2_t *jp2, opj_cio_t *cio, unsigned int *j2k_codestream_length, unsigned int *j2k_codestream_offset)
Definition: jp2.c:933
int opj_bool
Definition: openjpeg.h:63
unsigned short cn
Definition: jp2.h:62
void j2k_setup_encoder(opj_j2k_t *j2k, opj_cparameters_t *parameters, opj_image_t *image)
Setup the encoder parameters using the current image and using user parameters.
Definition: j2k.c:2150
Channel descriptions and number of descriptions.
Definition: jp2.h:68
unsigned short n
Definition: jp2.h:71
#define JP2_PCLR
Palette box.
Definition: jp2.h:52
Decompression parameters.
Definition: openjpeg.h:363
int h
data height
Definition: openjpeg.h:511
unsigned int numcl
Definition: jp2.h:138
void OPJ_CALLCONV cio_seek(opj_cio_t *cio, int pos)
Set position in byte stream.
Definition: cio.c:109
opj_image_comp_t * comps
image components
Definition: openjpeg.h:547
opj_common_ptr cinfo
codec context
Definition: jp2.h:122
static void write_iptr(int offset, int length, opj_cio_t *cio)
Write index Finder box.
Definition: jp2.c:1054
static void free_color_data(opj_jp2_color_t *color)
Definition: jp2.c:346
Component mappings: channel index, mapping type, palette index.
Definition: jp2.h:77
Index structure of the codestream.
Definition: openjpeg.h:672
#define JP2_FTYP
File type box.
Definition: jp2.h:43
static opj_bool jp2_read_pclr(opj_jp2_t *jp2, opj_cio_t *cio, opj_jp2_box_t *box, opj_jp2_color_t *color)
Collect palette data.
Definition: jp2.c:437
static void jp2_write_bpcc(opj_jp2_t *jp2, opj_cio_t *cio)
Definition: jp2.c:267
opj_bool opj_jp2_encode(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info)
Encode an image into a JPEG-2000 file stream.
Definition: jp2.c:1212
#define EVT_ERROR
Error event type.
Definition: event.h:35
opj_j2k_t * j2k
handle to the J2K codec
Definition: jp2.h:124
struct opj_jp2_color opj_jp2_color_t
Collector for ICC profile, palette, component mapping, channel description.
opj_jp2_cdef_t * jp2_cdef
Definition: jp2.h:103
#define JPIP_CIDX
Definition: indexbox_manager.h:43
void jp2_setup_encoder(opj_jp2_t *jp2, opj_cparameters_t *parameters, opj_image_t *image)
Setup the encoder parameters using the current image and using user parameters.
Definition: jp2.c:1145
unsigned char * cio_getbp(opj_cio_t *cio)
Get pointer to the current position in the stream.
Definition: cio.c:129
int length
Definition: jp2.h:151
opj_jp2_comps_t * comps
Definition: jp2.h:140
int bpcc
Definition: jp2.h:114
unsigned char mtyp
Definition: jp2.h:80
unsigned int h
Definition: jp2.h:126
#define OPJ_FALSE
Definition: openjpeg.h:65
JP2 component.
Definition: jp2.h:111
#define OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG
Definition: openjpeg.h:358
@ CLRSPC_SRGB
sRGB
Definition: openjpeg.h:133
opj_image_t * j2k_decode(opj_j2k_t *j2k, opj_cio_t *cio, opj_codestream_info_t *cstr_info)
Decode an image from a JPEG-2000 codestream.
Definition: j2k.c:1912
int icc_profile_len
size of ICC profile
Definition: openjpeg.h:551
int y1
Ysiz: height of the reference grid.
Definition: openjpeg.h:541
void jp2_destroy_compress(opj_jp2_t *jp2)
Destroy a JP2 compressor handle.
Definition: jp2.c:1130
int init_pos
Definition: jp2.h:153
opj_bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info)
Encode an image into a JPEG-2000 codestream.
Definition: j2k.c:2408
opj_jp2_t * jp2_create_compress(opj_common_ptr cinfo)
Creates a JP2 compression structure.
Definition: jp2.c:1116
unsigned char * icc_profile_buf
'restricted' ICC profile
Definition: openjpeg.h:549
unsigned int minversion
Definition: jp2.h:137
Defines image data and characteristics.
Definition: openjpeg.h:533
unsigned short nr_channels
Definition: jp2.h:92
static opj_bool jp2_read_ftyp(opj_jp2_t *jp2, opj_cio_t *cio)
Read the FTYP box - File type box.
Definition: jp2.c:865
void j2k_setup_decoder(opj_j2k_t *j2k, opj_dparameters_t *parameters)
Setup the decoder decoding parameters using user parameters.
Definition: j2k.c:1892
opj_image_t * opj_jp2_decode(opj_jp2_t *jp2, opj_cio_t *cio, opj_codestream_info_t *cstr_info)
Decode an image from a JPEG-2000 file stream.
Definition: jp2.c:744
@ CLRSPC_UNKNOWN
not supported by the library
Definition: openjpeg.h:131
unsigned int precedence
Definition: jp2.h:135
#define JP2_BPCC
Bits per component box.
Definition: jp2.h:50
int numcomps
number of components in the image
Definition: openjpeg.h:543
void j2k_destroy_compress(opj_j2k_t *j2k)
Destroy a J2K compressor handle.
Definition: j2k.c:2127
unsigned int meth
Definition: jp2.h:132
unsigned int IPR
Definition: jp2.h:131