OpenJPH Open-source implementation of JPEG2000 Part-15

Loading...
Searching...
No Matches
ojph_resolution.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_resolution.h
34// Author: Aous Naman
35// Date: 28 August 2019
36//***************************************************************************/
37
38
39#ifndef OJPH_RESOLUTION_H
40#define OJPH_RESOLUTION_H
41
42#include "ojph_defs.h"
43
44 namespace ojph {
45
47 //defined elsewhere
48 class line_buf;
49 class mem_elastic_allocator;
50 class codestream;
51
52 namespace local {
53
55 //defined here
56 class tile_comp;
57 struct precinct;
58 class subband;
59
61 class resolution
62 {
63 public:
64 enum : ui32 {
65 HORZ_TRX = 0x01, // horizontal transform
66 VERT_TRX = 0x02, // vertical transform
67 };
68
69 public:
70 static void pre_alloc(codestream *codestream, const rect& res_rect,
71 const rect& recon_res_rect,
72 ui32 comp_num, ui32 res_num);
73 void finalize_alloc(codestream *codestream, const rect& res_rect,
74 const rect& recon_res_rect, ui32 comp_num,
75 ui32 res_num, point comp_downsamp,
76 point res_downsamp, tile_comp *parent_tile_comp,
77 resolution *parent_res);
78
79 line_buf* get_line();
80 void push_line();
81 line_buf* pull_line();
82 rect get_rect() { return res_rect; }
83 ui32 get_comp_num() { return comp_num; }
84 bool has_horz_transform() { return (transform_flags & HORZ_TRX) != 0; }
85 bool has_vert_transform() { return (transform_flags & VERT_TRX) != 0; }
86
87 ui32 prepare_precinct();
88 void write_precincts(outfile_base *file);
89 bool get_top_left_precinct(point &top_left);
90 void write_one_precinct(outfile_base *file);
91 resolution *next_resolution() { return child_res; }
92 void parse_all_precincts(ui32& data_left, infile_base *file);
93 void parse_one_precinct(ui32& data_left, infile_base *file);
94
95 ui32 get_num_bytes() const { return num_bytes; }
96 ui32 get_num_bytes(ui32 resolution_num) const;
97
98 private:
99 bool reversible, skipped_res_for_read, skipped_res_for_recon;
100 ui32 num_steps;
101 ui32 res_num;
102 ui32 comp_num;
103 ui32 num_bytes; // number of bytes in this resolution
104 // used for tilepart length
105 point comp_downsamp;
106 rect res_rect; // resolution rectangle
107 line_buf* lines; // used to store lines
108 lifting_buf *ssp; // step state pointer
109 lifting_buf *aug, *sig;
110 subband *bands;
111 tile_comp *parent_comp;
112 resolution *parent_res, *child_res;
113 //precincts stuff
114 precinct *precincts;
115 size num_precincts;
116 size log_PP;
117 ui32 max_num_levels;
118 int tag_tree_size;
119 ui32 level_index[20]; //more than enough
120 point cur_precinct_loc; //used for progressing spatial modes (2, 3, 4)
121 const param_atk* atk;
122 ui32 transform_flags;
123 //wavelet machinery
124 ui32 cur_line;
125 ui32 rows_to_produce;
126 bool vert_even, horz_even;
127 mem_elastic_allocator *elastic;
128 };
129
130 }
131}
132
133#endif // !OJPH_RESOLUTION_H
ojph::codestream
The object represent a codestream.
Definition ojph_codestream.h:89
ojph::infile_base
Definition ojph_file.h:247
ojph::line_buf
Definition ojph_mem.h:160
ojph::local::codestream
Definition ojph_codestream_local.h:69
ojph::local::resolution
Definition ojph_resolution.h:62
ojph::local::resolution::get_top_left_precinct
bool get_top_left_precinct(point &top_left)
Definition ojph_resolution.cpp:975
ojph::local::resolution::sig
lifting_buf * sig
Definition ojph_resolution.h:109
ojph::local::resolution::rows_to_produce
ui32 rows_to_produce
Definition ojph_resolution.h:125
ojph::local::resolution::bands
subband * bands
Definition ojph_resolution.h:110
ojph::local::resolution::parse_one_precinct
void parse_one_precinct(ui32 &data_left, infile_base *file)
Definition ojph_resolution.cpp:1020
ojph::local::resolution::skipped_res_for_recon
bool skipped_res_for_recon
Definition ojph_resolution.h:99
ojph::local::resolution::tag_tree_size
int tag_tree_size
Definition ojph_resolution.h:118
ojph::local::resolution::push_line
void push_line()
Definition ojph_resolution.cpp:547
ojph::local::resolution::get_num_bytes
ui32 get_num_bytes() const
Definition ojph_resolution.h:95
ojph::local::resolution::atk
const param_atk * atk
Definition ojph_resolution.h:121
ojph::local::resolution::transform_flags
ui32 transform_flags
Definition ojph_resolution.h:122
ojph::local::resolution::elastic
mem_elastic_allocator * elastic
Definition ojph_resolution.h:127
ojph::local::resolution::comp_downsamp
point comp_downsamp
Definition ojph_resolution.h:105
ojph::local::resolution::parent_res
resolution * parent_res
Definition ojph_resolution.h:112
ojph::local::resolution::cur_precinct_loc
point cur_precinct_loc
Definition ojph_resolution.h:120
ojph::local::resolution::prepare_precinct
ui32 prepare_precinct()
Definition ojph_resolution.cpp:952
ojph::local::resolution::reversible
bool reversible
Definition ojph_resolution.h:99
ojph::local::resolution::write_precincts
void write_precincts(outfile_base *file)
Definition ojph_resolution.cpp:967
ojph::local::resolution::comp_num
ui32 comp_num
Definition ojph_resolution.h:102
ojph::local::resolution::get_rect
rect get_rect()
Definition ojph_resolution.h:82
ojph::local::resolution::res_rect
rect res_rect
Definition ojph_resolution.h:106
ojph::local::resolution::num_steps
ui32 num_steps
Definition ojph_resolution.h:100
ojph::local::resolution::precincts
precinct * precincts
Definition ojph_resolution.h:114
ojph::local::resolution::parent_comp
tile_comp * parent_comp
Definition ojph_resolution.h:111
ojph::local::resolution::pull_line
line_buf * pull_line()
Definition ojph_resolution.cpp:713
ojph::local::resolution::get_line
line_buf * get_line()
Definition ojph_resolution.cpp:530
ojph::local::resolution::HORZ_TRX
@ HORZ_TRX
Definition ojph_resolution.h:65
ojph::local::resolution::VERT_TRX
@ VERT_TRX
Definition ojph_resolution.h:66
ojph::local::resolution::has_vert_transform
bool has_vert_transform()
Definition ojph_resolution.h:85
ojph::local::resolution::num_precincts
size num_precincts
Definition ojph_resolution.h:115
ojph::local::resolution::pre_alloc
static void pre_alloc(codestream *codestream, const rect &res_rect, const rect &recon_res_rect, ui32 comp_num, ui32 res_num)
Definition ojph_resolution.cpp:59
ojph::local::resolution::get_comp_num
ui32 get_comp_num()
Definition ojph_resolution.h:83
ojph::local::resolution::skipped_res_for_read
bool skipped_res_for_read
Definition ojph_resolution.h:99
ojph::local::resolution::finalize_alloc
void finalize_alloc(codestream *codestream, const rect &res_rect, const rect &recon_res_rect, ui32 comp_num, ui32 res_num, point comp_downsamp, point res_downsamp, tile_comp *parent_tile_comp, resolution *parent_res)
Definition ojph_resolution.cpp:240
ojph::local::resolution::level_index
ui32 level_index[20]
Definition ojph_resolution.h:119
ojph::local::resolution::next_resolution
resolution * next_resolution()
Definition ojph_resolution.h:91
ojph::local::resolution::has_horz_transform
bool has_horz_transform()
Definition ojph_resolution.h:84
ojph::local::resolution::lines
line_buf * lines
Definition ojph_resolution.h:107
ojph::local::resolution::log_PP
size log_PP
Definition ojph_resolution.h:116
ojph::local::resolution::aug
lifting_buf * aug
Definition ojph_resolution.h:109
ojph::local::resolution::horz_even
bool horz_even
Definition ojph_resolution.h:126
ojph::local::resolution::parse_all_precincts
void parse_all_precincts(ui32 &data_left, infile_base *file)
Definition ojph_resolution.cpp:1001
ojph::local::resolution::res_num
ui32 res_num
Definition ojph_resolution.h:101
ojph::local::resolution::write_one_precinct
void write_one_precinct(outfile_base *file)
Definition ojph_resolution.cpp:987
ojph::local::resolution::max_num_levels
ui32 max_num_levels
Definition ojph_resolution.h:117
ojph::local::resolution::vert_even
bool vert_even
Definition ojph_resolution.h:126
ojph::local::resolution::cur_line
ui32 cur_line
Definition ojph_resolution.h:124
ojph::local::resolution::num_bytes
ui32 num_bytes
Definition ojph_resolution.h:103
ojph::local::resolution::ssp
lifting_buf * ssp
Definition ojph_resolution.h:108
ojph::local::resolution::child_res
resolution * child_res
Definition ojph_resolution.h:112
ojph::local::subband
Definition ojph_subband.h:63
ojph::local::tile_comp
Definition ojph_tile_comp.h:63
ojph::mem_elastic_allocator
Definition ojph_mem.h:217
ojph::outfile_base
Definition ojph_file.h:75
ojph::local
Definition ojph_bitbuffer_read.h:52
ojph
Definition ojph_img_io.h:52
ojph::ui32
uint32_t ui32
Definition ojph_defs.h:54
ojph_defs.h
ojph::lifting_buf
Definition ojph_mem.h:193
ojph::local::param_atk
Definition ojph_params_local.h:1071
ojph::local::precinct
Definition ojph_precinct.h:59
ojph::point
Definition ojph_base.h:58
ojph::rect
Definition ojph_base.h:65
ojph::size
Definition ojph_base.h:48