OpenJPH: /build/openjph/src/OpenJPH/src/core/openjph/ojph_params.h Source File

OpenJPH Open-source implementation of JPEG2000 Part-15

Loading...
Searching...
No Matches
ojph_params.h
Go to the documentation of this file.
1//***************************************************************************/
2// This software is released under the 2-Clause BSD license, included
3// below.
4//
5// Copyright (c) 2019, Aous Naman
6// Copyright (c) 2019, Kakadu Software Pty Ltd, Australia
7// Copyright (c) 2019, The University of New South Wales, Australia
8//
9// Redistribution and use in source and binary forms, with or without
10// modification, are permitted provided that the following conditions are
11// met:
12//
13// 1. Redistributions of source code must retain the above copyright
14// notice, this list of conditions and the following disclaimer.
15//
16// 2. Redistributions in binary form must reproduce the above copyright
17// notice, this list of conditions and the following disclaimer in the
18// documentation and/or other materials provided with the distribution.
19//
20// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
26// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31//***************************************************************************/
32// This file is part of the OpenJPH software implementation.
33// File: ojph_params.h
34// Author: Aous Naman
35// Date: 28 August 2019
36//***************************************************************************/
37
38
39#ifndef OJPH_PARAMS_H
40#define OJPH_PARAMS_H
41
42#include "ojph_arch.h"
43#include "ojph_base.h"
44
45namespace ojph {
46
47 /***************************************************************************/
48 // defined here
49 class param_siz;
50 class param_cod;
51 class param_coc;
52 class param_qcd;
53 class param_cap;
54 class param_nlt;
55 class codestream;
56
57 /***************************************************************************/
58 // prototyping from local
59 namespace local {
60 struct param_siz;
61 struct param_cod;
62 struct param_coc;
63 struct param_qcd;
64 struct param_cap;
65 struct param_nlt;
66 class codestream;
67 }
68
69 /***************************************************************************/
70 class OJPH_EXPORT param_siz
71 {
72 public:
73 param_siz(local::param_siz *p) : state(p) {}
74
75 //setters
76 void set_image_extent(point extent);
77 void set_tile_size(size s);
78 void set_image_offset(point offset);
79 void set_tile_offset(point offset);
80 void set_num_components(ui32 num_comps);
81 void set_component(ui32 comp_num, const point& downsampling,
82 ui32 bit_depth, bool is_signed);
83
84 //getters
85 point get_image_extent() const;
86 point get_image_offset() const;
87 size get_tile_size() const;
88 point get_tile_offset() const;
89 ui32 get_num_components() const;
90 ui32 get_bit_depth(ui32 comp_num) const;
91 bool is_signed(ui32 comp_num) const;
92 point get_downsampling(ui32 comp_num) const;
93
94 //deeper getters
95 ui32 get_recon_width(ui32 comp_num) const;
96 ui32 get_recon_height(ui32 comp_num) const;
97
98 private:
99 local::param_siz* state;
100 };
101
102 /***************************************************************************/
103 class OJPH_EXPORT param_cod
104 {
105 public:
106 param_cod(local::param_cod* p) : state(p) {}
107
108 void set_num_decomposition(ui32 num_decompositions);
109 void set_block_dims(ui32 width, ui32 height);
110 void set_precinct_size(int num_levels, size* precinct_size);
111 void set_progression_order(const char *name);
112 void set_color_transform(bool color_transform);
113 void set_reversible(bool reversible);
114 param_coc get_coc(ui32 component_idx);
115
116 ui32 get_num_decompositions() const;
117 size get_block_dims() const;
118 size get_log_block_dims() const;
119 bool is_reversible() const;
120 size get_precinct_size(ui32 level_num) const;
121 size get_log_precinct_size(ui32 level_num) const;
122 int get_progression_order() const;
123 const char* get_progression_order_as_string() const;
124 int get_num_layers() const;
125 bool is_using_color_transform() const;
126 bool packets_may_use_sop() const;
127 bool packets_use_eph() const;
128 bool get_block_vertical_causality() const;
129
130 private:
131 local::param_cod* state;
132 };
133
134 /***************************************************************************/
135 class OJPH_EXPORT param_coc
136 {
137 public:
138 param_coc(local::param_cod* p) : state(p) {}
139
140 void set_num_decomposition(ui32 num_decompositions);
141 void set_block_dims(ui32 width, ui32 height);
142 void set_precinct_size(int num_levels, size* precinct_size);
143 void set_reversible(bool reversible);
144
145 ui32 get_num_decompositions() const;
146 size get_block_dims() const;
147 size get_log_block_dims() const;
148 bool is_reversible() const;
149 size get_precinct_size(ui32 level_num) const;
150 size get_log_precinct_size(ui32 level_num) const;
151 bool get_block_vertical_causality() const;
152
153 private:
154 local::param_cod* state;
155 };
156
157 /***************************************************************************/
162 class OJPH_EXPORT param_qcd
163 {
164 public:
165 param_qcd(local::param_qcd* p) : state(p) {}
166
175 void set_irrev_quant(float delta);
176
188 void set_irrev_quant(ui32 comp_idx, float delta);
189
190 private:
191 local::param_qcd* state;
192 };
193
194 /*************************************************************************/
244 class OJPH_EXPORT param_nlt
245 {
246 public:
247 enum special_comp_num : ui16 { ALL_COMPS = 65535 };
248 enum nonlinearity : ui8 {
249 OJPH_NLT_NO_NLT = 0, // supported
250 OJPH_NLT_GAMMA_STYLE_NLT = 1, // not supported
251 OJPH_NLT_LUT_STYLE_NLT = 2, // not supported
252 OJPH_NLT_BINARY_COMPLEMENT_NLT = 3, // supported
253 OJPH_NLT_UNDEFINED = 255 // This is used internally and is
254 // not part of the standard
255 };
256 public:
257 param_nlt(local::param_nlt* p) : state(p) {}
258
270 void set_nonlinear_transform(ui32 comp_num, ui8 nl_type);
271
282 bool get_nonlinear_transform(ui32 comp_num, ui8& bit_depth,
283 bool& is_signed, ui8& nl_type) const;
284
285 private:
286 local::param_nlt* state;
287 };
288
289 /***************************************************************************/
290 class OJPH_EXPORT comment_exchange
291 {
292 friend class local::codestream;
293 public:
294 comment_exchange() : data(NULL), len(0), Rcom(0) {}
295 void set_string(const char* str);
296 void set_data(const char* data, ui16 len);
297
298 private:
299 const char* data;
300 ui16 len;
301 ui16 Rcom;
302 };
303
304}
305
306#endif // !OJPH_PARAMS_H
ojph::codestream
The object represent a codestream.
Definition ojph_codestream.h:89
ojph::comment_exchange::comment_exchange
comment_exchange()
Definition ojph_params.h:294
ojph::comment_exchange::len
ui16 len
Definition ojph_params.h:300
ojph::comment_exchange::Rcom
ui16 Rcom
Definition ojph_params.h:301
ojph::comment_exchange::data
const char * data
Definition ojph_params.h:299
ojph::local::codestream
Definition ojph_codestream_local.h:69
ojph::param_coc
Definition ojph_params.h:136
ojph::param_coc::param_coc
param_coc(local::param_cod *p)
Definition ojph_params.h:138
ojph::param_coc::state
local::param_cod * state
Definition ojph_params.h:154
ojph::param_cod
Definition ojph_params.h:104
ojph::param_cod::state
local::param_cod * state
Definition ojph_params.h:131
ojph::param_cod::param_cod
param_cod(local::param_cod *p)
Definition ojph_params.h:106
ojph::param_nlt
non-linearity point transformation object (implements NLT marker segment)
Definition ojph_params.h:245
ojph::param_nlt::nonlinearity
nonlinearity
Definition ojph_params.h:248
ojph::param_nlt::OJPH_NLT_NO_NLT
@ OJPH_NLT_NO_NLT
Definition ojph_params.h:249
ojph::param_nlt::OJPH_NLT_BINARY_COMPLEMENT_NLT
@ OJPH_NLT_BINARY_COMPLEMENT_NLT
Definition ojph_params.h:252
ojph::param_nlt::OJPH_NLT_UNDEFINED
@ OJPH_NLT_UNDEFINED
Definition ojph_params.h:253
ojph::param_nlt::OJPH_NLT_LUT_STYLE_NLT
@ OJPH_NLT_LUT_STYLE_NLT
Definition ojph_params.h:251
ojph::param_nlt::OJPH_NLT_GAMMA_STYLE_NLT
@ OJPH_NLT_GAMMA_STYLE_NLT
Definition ojph_params.h:250
ojph::param_nlt::special_comp_num
special_comp_num
Definition ojph_params.h:247
ojph::param_nlt::ALL_COMPS
@ ALL_COMPS
Definition ojph_params.h:247
ojph::param_nlt::param_nlt
param_nlt(local::param_nlt *p)
Definition ojph_params.h:257
ojph::param_nlt::state
local::param_nlt * state
Definition ojph_params.h:286
ojph::param_qcd
Quantization parameters object.
Definition ojph_params.h:163
ojph::param_qcd::state
local::param_qcd * state
Definition ojph_params.h:191
ojph::param_qcd::param_qcd
param_qcd(local::param_qcd *p)
Definition ojph_params.h:165
ojph::param_siz
Definition ojph_params.h:71
ojph::param_siz::state
local::param_siz * state
Definition ojph_params.h:99
ojph::param_siz::param_siz
param_siz(local::param_siz *p)
Definition ojph_params.h:73
ojph::local
Definition ojph_bitbuffer_read.h:52
ojph
Definition ojph_img_io.h:52
ojph::ui16
uint16_t ui16
Definition ojph_defs.h:52
ojph::ui32
uint32_t ui32
Definition ojph_defs.h:54
ojph::ui8
uint8_t ui8
Definition ojph_defs.h:50
ojph_arch.h
OJPH_EXPORT
#define OJPH_EXPORT
Definition ojph_arch.h:123
ojph_base.h
ojph::local::param_cap
Definition ojph_params_local.h:880
ojph::local::param_cod
Definition ojph_params_local.h:385
ojph::local::param_nlt
Definition ojph_params_local.h:802
ojph::local::param_qcd
Definition ojph_params_local.h:677
ojph::local::param_siz
Definition ojph_params_local.h:166
ojph::point
Definition ojph_base.h:58
ojph::size
Definition ojph_base.h:48