Grok 12.0.1
FileFormat.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016-2024 Grok Image Compression Inc.
3 *
4 * This source code is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Affero General Public License, version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This source code is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Affero General Public License for more details.
12 *
13 * You should have received a copy of the GNU Affero General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 *
17 * This source code incorporates work covered by the BSD 2-clause license.
18 * Please see the LICENSE file in the root directory for details.
19 *
20 */
21#pragma once
22#include <string>
23
24namespace grk
25{
34
35#define JP2_JP 0x6a502020
36#define JP2_FTYP 0x66747970
37#define JP2_JP2H 0x6a703268
38#define JP2_IHDR 0x69686472
39#define JP2_COLR 0x636f6c72
40#define JP2_JP2C 0x6a703263
41#define JP2_PCLR 0x70636c72
42#define JP2_CMAP 0x636d6170
43#define JP2_CDEF 0x63646566
44#define JP2_DTBL 0x6474626c
45#define JP2_BPCC 0x62706363
46#define JP2_JP2 0x6a703220
47#define JP2_JPH 0x6A706820
48#define JP2_RES 0x72657320
49#define JP2_CAPTURE_RES 0x72657363
50#define JP2_DISPLAY_RES 0x72657364
51#define JP2_JP2I 0x6a703269
52#define JP2_XML 0x786d6c20
53#define JP2_UUID 0x75756964
54#define JP2_UINF 0x75696e66
55#define JP2_ULST 0x756c7374
56#define JP2_URL 0x75726c20
57#define JP2_ASOC 0x61736f63
58#define JP2_LBL 0x6c626c20
60#define JP2_MAX_NUM_UUIDS 128
61const uint8_t IPTC_UUID[16] = {0x33, 0xC7, 0xA4, 0xD2, 0xB8, 0x1D, 0x47, 0x23,
62 0xA0, 0xBA, 0xF1, 0xA3, 0xE0, 0x97, 0xAD, 0x38};
63const uint8_t XMP_UUID[16] = {0xBE, 0x7A, 0xCF, 0xCB, 0x97, 0xA9, 0x42, 0xE8,
64 0x9C, 0x71, 0x99, 0x94, 0x91, 0xE3, 0xAF, 0xAC};
65
66#define GRK_BOX_SIZE 1024
67#define GRK_RESOLUTION_BOX_SIZE (4 + 4 + 10)
68
70{
77 JP2_STATE_UNKNOWN = 0x7fffffff /* ISO C restricts enumerator values to range of 'int' */
78};
79
86
88{
91};
92
97{
98 ~AsocBox() override
99 {
100 dealloc();
101 }
102 void dealloc() override
103 {
105 for(auto& as : children)
106 {
107 delete as;
108 }
109 children.clear();
110 }
111 std::string label;
112 std::vector<AsocBox*> children;
113};
114
116{
118 {
119 memset(uuid, 0, sizeof(uuid));
120 }
121 UUIDBox(const uint8_t myuuid[16], uint8_t* buf, size_t size)
122 : FileFormatBox(), grk_buf8(buf, size, false)
123 {
124 memcpy(uuid, myuuid, 16);
125 }
127};
128
133{
134 public:
135 FileFormat(void);
136 virtual ~FileFormat();
137
138 protected:
139 bool exec(std::vector<PROCEDURE_FUNC>* procs);
141 std::vector<PROCEDURE_FUNC>* validation_list_;
143 std::vector<PROCEDURE_FUNC>* procedure_list_;
144
145 /* width of image */
147 /* height of image */
149 /* number of components in the image */
164
169
171
174};
175
178/* ----------------------------------------------------------------------- */
179
183
184} // namespace grk
#define JP2_MAX_NUM_UUIDS
Definition FileFormat.h:60
JPEG 2000 file format reader/writer.
Definition FileFormat.h:133
uint8_t C
Definition FileFormat.h:152
uint32_t h
Definition FileFormat.h:148
uint32_t w
Definition FileFormat.h:146
uint8_t precedence
Definition FileFormat.h:158
uint32_t minversion
Definition FileFormat.h:160
double capture_resolution[2]
Definition FileFormat.h:166
std::vector< PROCEDURE_FUNC > * validation_list_
list of validation procedures
Definition FileFormat.h:141
uint32_t brand
Definition FileFormat.h:159
virtual ~FileFormat()
Definition FileFormat.cpp:39
uint16_t numcomps
Definition FileFormat.h:150
FileFormat(void)
Definition FileFormat.cpp:26
uint8_t IPR
Definition FileFormat.h:154
uint32_t numUuids
Definition FileFormat.h:173
bool exec(std::vector< PROCEDURE_FUNC > *procs)
Definition FileFormat.cpp:50
ComponentInfo * comps
Definition FileFormat.h:163
bool has_display_resolution
Definition FileFormat.h:167
uint32_t numcl
Definition FileFormat.h:161
double display_resolution[2]
Definition FileFormat.h:168
uint32_t * cl
Definition FileFormat.h:162
uint8_t bpc
Definition FileFormat.h:151
uint8_t meth
Definition FileFormat.h:155
bool has_capture_resolution
Definition FileFormat.h:165
uint8_t UnkC
Definition FileFormat.h:153
std::vector< PROCEDURE_FUNC > * procedure_list_
list of execution procedures
Definition FileFormat.h:143
uint8_t approx
Definition FileFormat.h:156
UUIDBox uuids[JP2_MAX_NUM_UUIDS]
Definition FileFormat.h:172
GRK_ENUM_COLOUR_SPACE enumcs
Definition FileFormat.h:157
grk_buf8 xml
Definition FileFormat.h:170
enum _GRK_ENUM_COLOUR_SPACE GRK_ENUM_COLOUR_SPACE
Copyright (C) 2016-2024 Grok Image Compression Inc.
Definition ICacheable.h:20
void grk_read(const uint8_t *buffer, TYPE *value, uint32_t numBytes)
Definition BufferedStream.h:239
const uint8_t IPTC_UUID[16]
Definition FileFormat.h:61
JP2_STATE
Definition FileFormat.h:70
@ JP2_STATE_UNKNOWN
Definition FileFormat.h:77
@ JP2_STATE_FILE_TYPE
Definition FileFormat.h:73
@ JP2_STATE_SIGNATURE
Definition FileFormat.h:72
@ JP2_STATE_CODESTREAM
Definition FileFormat.h:75
@ JP2_STATE_NONE
Definition FileFormat.h:71
@ JP2_STATE_HEADER
Definition FileFormat.h:74
@ JP2_STATE_END_CODESTREAM
Definition FileFormat.h:76
const uint8_t XMP_UUID[16]
Definition FileFormat.h:63
Association box (defined in ITU 15444-2 Annex M 11.1 )
Definition FileFormat.h:97
std::string label
Definition FileFormat.h:111
void dealloc() override
Definition FileFormat.h:102
~AsocBox() override
Definition FileFormat.h:98
std::vector< AsocBox * > children
Definition FileFormat.h:112
Definition FileFormat.h:88
uint8_t bpc
Definition FileFormat.h:90
ComponentInfo()
Definition FileFormat.h:89
Definition FileFormat.h:81
uint64_t length
Definition FileFormat.h:83
FileFormatBox()
Definition FileFormat.h:82
uint32_t type
Definition FileFormat.h:84
Definition FileFormat.h:116
UUIDBox()
Definition FileFormat.h:117
UUIDBox(const uint8_t myuuid[16], uint8_t *buf, size_t size)
Definition FileFormat.h:121
uint8_t uuid[16]
Definition FileFormat.h:126
virtual void dealloc()
Definition buffer.h:117
uint8_t * buf
Definition buffer.h:195