Grok 10.0.5
FileFormat.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016-2023 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_RES 0x72657320
48#define JP2_CAPTURE_RES 0x72657363
49#define JP2_DISPLAY_RES 0x72657364
50#define JP2_JP2I 0x6a703269
51#define JP2_XML 0x786d6c20
52#define JP2_UUID 0x75756964
53#define JP2_UINF 0x75696e66
54#define JP2_ULST 0x756c7374
55#define JP2_URL 0x75726c20
56#define JP2_ASOC 0x61736f63
57#define JP2_LBL 0x6c626c20
59#define JP2_MAX_NUM_UUIDS 128
60const uint8_t IPTC_UUID[16] = {0x33, 0xC7, 0xA4, 0xD2, 0xB8, 0x1D, 0x47, 0x23,
61 0xA0, 0xBA, 0xF1, 0xA3, 0xE0, 0x97, 0xAD, 0x38};
62const uint8_t XMP_UUID[16] = {0xBE, 0x7A, 0xCF, 0xCB, 0x97, 0xA9, 0x42, 0xE8,
63 0x9C, 0x71, 0x99, 0x94, 0x91, 0xE3, 0xAF, 0xAC};
64
65#define GRK_BOX_SIZE 1024
66#define GRK_RESOLUTION_BOX_SIZE (4 + 4 + 10)
67
69{
76 JP2_STATE_UNKNOWN = 0x7fffffff /* ISO C restricts enumerator values to range of 'int' */
77};
78
85
87{
90};
91
96{
97 ~AsocBox() override
98 {
99 dealloc();
100 }
101 void dealloc() override
102 {
104 for(auto& as : children)
105 {
106 delete as;
107 }
108 children.clear();
109 }
110 std::string label;
111 std::vector<AsocBox*> children;
112};
113
115{
117 {
118 memset(uuid, 0, sizeof(uuid));
119 }
120 UUIDBox(const uint8_t myuuid[16], uint8_t* buf, size_t size)
121 : FileFormatBox(), grk_buf8(buf, size, false)
122 {
123 memcpy(uuid, myuuid, 16);
124 }
126};
127
132{
133 public:
134 FileFormat(void);
135 virtual ~FileFormat();
136
137 protected:
138 bool exec(std::vector<PROCEDURE_FUNC>* procs);
140 std::vector<PROCEDURE_FUNC>* validation_list_;
142 std::vector<PROCEDURE_FUNC>* procedure_list_;
143
144 /* width of image */
146 /* height of image */
148 /* number of components in the image */
163
168
170
173};
174
177/* ----------------------------------------------------------------------- */
178
182
183} // namespace grk
#define JP2_MAX_NUM_UUIDS
Definition FileFormat.h:59
JPEG 2000 file format reader/writer.
Definition FileFormat.h:132
uint8_t C
Definition FileFormat.h:151
uint32_t h
Definition FileFormat.h:147
uint32_t w
Definition FileFormat.h:145
uint8_t precedence
Definition FileFormat.h:157
uint32_t minversion
Definition FileFormat.h:159
double capture_resolution[2]
Definition FileFormat.h:165
std::vector< PROCEDURE_FUNC > * validation_list_
list of validation procedures
Definition FileFormat.h:140
uint32_t brand
Definition FileFormat.h:158
virtual ~FileFormat()
Definition FileFormat.cpp:39
uint16_t numcomps
Definition FileFormat.h:149
FileFormat(void)
Definition FileFormat.cpp:26
uint8_t IPR
Definition FileFormat.h:153
uint32_t numUuids
Definition FileFormat.h:172
bool exec(std::vector< PROCEDURE_FUNC > *procs)
Definition FileFormat.cpp:50
ComponentInfo * comps
Definition FileFormat.h:162
bool has_display_resolution
Definition FileFormat.h:166
uint32_t numcl
Definition FileFormat.h:160
double display_resolution[2]
Definition FileFormat.h:167
uint32_t * cl
Definition FileFormat.h:161
uint8_t bpc
Definition FileFormat.h:150
uint8_t meth
Definition FileFormat.h:154
bool has_capture_resolution
Definition FileFormat.h:164
uint8_t UnkC
Definition FileFormat.h:152
std::vector< PROCEDURE_FUNC > * procedure_list_
list of execution procedures
Definition FileFormat.h:142
uint8_t approx
Definition FileFormat.h:155
UUIDBox uuids[JP2_MAX_NUM_UUIDS]
Definition FileFormat.h:171
GRK_ENUM_COLOUR_SPACE enumcs
Definition FileFormat.h:156
grk_buf8 xml
Definition FileFormat.h:169
enum _GRK_ENUM_COLOUR_SPACE GRK_ENUM_COLOUR_SPACE
Copyright (C) 2016-2023 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:60
JP2_STATE
Definition FileFormat.h:69
@ JP2_STATE_UNKNOWN
Definition FileFormat.h:76
@ JP2_STATE_FILE_TYPE
Definition FileFormat.h:72
@ JP2_STATE_SIGNATURE
Definition FileFormat.h:71
@ JP2_STATE_CODESTREAM
Definition FileFormat.h:74
@ JP2_STATE_NONE
Definition FileFormat.h:70
@ JP2_STATE_HEADER
Definition FileFormat.h:73
@ JP2_STATE_END_CODESTREAM
Definition FileFormat.h:75
const uint8_t XMP_UUID[16]
Definition FileFormat.h:62
Association box (defined in ITU 15444-2 Annex M 11.1 )
Definition FileFormat.h:96
std::string label
Definition FileFormat.h:110
void dealloc() override
Definition FileFormat.h:101
~AsocBox() override
Definition FileFormat.h:97
std::vector< AsocBox * > children
Definition FileFormat.h:111
Definition FileFormat.h:87
uint8_t bpc
Definition FileFormat.h:89
ComponentInfo()
Definition FileFormat.h:88
Definition FileFormat.h:80
uint64_t length
Definition FileFormat.h:82
FileFormatBox()
Definition FileFormat.h:81
uint32_t type
Definition FileFormat.h:83
Definition FileFormat.h:115
UUIDBox()
Definition FileFormat.h:116
UUIDBox(const uint8_t myuuid[16], uint8_t *buf, size_t size)
Definition FileFormat.h:120
uint8_t uuid[16]
Definition FileFormat.h:125
virtual void dealloc()
Definition buffer.h:117
uint8_t * buf
Definition buffer.h:195