OpenJPH
Open-source implementation of JPEG2000 Part-15
ojph_codeblock.h
Go to the documentation of this file.
1
2
//***************************************************************************/
3
// This software is released under the 2-Clause BSD license, included
4
// below.
5
//
6
// Copyright (c) 2019, Aous Naman
7
// Copyright (c) 2019, Kakadu Software Pty Ltd, Australia
8
// Copyright (c) 2019, The University of New South Wales, Australia
9
//
10
// Redistribution and use in source and binary forms, with or without
11
// modification, are permitted provided that the following conditions are
12
// met:
13
//
14
// 1. Redistributions of source code must retain the above copyright
15
// notice, this list of conditions and the following disclaimer.
16
//
17
// 2. Redistributions in binary form must reproduce the above copyright
18
// notice, this list of conditions and the following disclaimer in the
19
// documentation and/or other materials provided with the distribution.
20
//
21
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
22
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23
// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
24
// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
27
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
//***************************************************************************/
33
// This file is part of the OpenJPH software implementation.
34
// File: ojph_codeblock.h
35
// Author: Aous Naman
36
// Date: 28 August 2019
37
//***************************************************************************/
38
39
40
#ifndef OJPH_CODEBLOCK_H
41
#define OJPH_CODEBLOCK_H
42
43
#include "
ojph_defs.h
"
44
#include "
ojph_file.h
"
45
#include "
ojph_codeblock_fun.h
"
46
47
namespace
ojph
{
48
50
//defined elsewhere
51
class
line_buf;
52
class
mem_elastic_allocator;
53
class
codestream;
54
struct
coded_lists;
55
56
namespace
local {
57
59
//defined here
60
struct
precinct;
61
class
subband;
62
struct
coded_cb_header;
63
65
class
codeblock
66
{
67
friend
struct
precinct
;
68
enum :
ui32
{
69
BUF32
= 4,
70
BUF64
= 8,
71
};
72
73
public
:
74
static
void
pre_alloc
(
codestream
*
codestream
,
const
size
& nominal,
75
ui32
precision
);
76
void
finalize_alloc
(
codestream
*
codestream
,
subband
*
parent
,
77
const
size
& nominal,
const
size
&
cb_size
,
78
coded_cb_header
*
coded_cb
,
ui32
K_max
,
79
int
tbx0,
ui32
precision
,
ui32
comp_idx);
80
void
push
(
line_buf
*line);
81
void
encode
(
mem_elastic_allocator
*elastic);
82
void
recreate
(
const
size
&
cb_size
,
coded_cb_header
*
coded_cb
);
83
84
void
decode
();
85
void
pull_line
(
line_buf
*line);
86
87
private
:
88
ui32
precision
;
89
union
{
90
ui32
*
buf32
;
91
ui64
*
buf64
;
92
};
93
size
nominal_size
;
94
size
cb_size
;
95
ui32
stride
;
96
ui32
buf_size
;
97
subband
*
parent
;
98
int
line_offset
;
99
ui32
cur_line
;
100
float
delta
,
delta_inv
;
101
ui32
K_max
;
102
bool
reversible
;
103
bool
resilient
;
104
bool
stripe_causal
;
105
bool
zero_block
;
// true when the decoded block is all zero
106
union
{
107
ui32
max_val32
[8];
// supports up to 256 bits
108
ui64
max_val64
[4];
// supports up to 256 bits
109
};
110
coded_cb_header
*
coded_cb
;
111
codeblock_fun
codeblock_functions
;
112
};
113
115
struct
coded_cb_header
116
{
117
ui32
pass_length
[2];
118
ui32
num_passes
;
119
ui32
Kmax
;
120
ui32
missing_msbs
;
121
coded_lists
*
next_coded
;
122
123
static
const
int
prefix_buf_size
= 8;
124
static
const
int
suffix_buf_size
= 16;
125
};
126
127
}
128
}
129
130
#endif
// !OJPH_CODEBLOCK_H
ojph::line_buf
Definition:
ojph_mem.h:136
ojph::local::codeblock
Definition:
ojph_codeblock.h:66
ojph::local::codeblock::BUF32
@ BUF32
Definition:
ojph_codeblock.h:69
ojph::local::codeblock::BUF64
@ BUF64
Definition:
ojph_codeblock.h:70
ojph::local::codeblock::nominal_size
size nominal_size
Definition:
ojph_codeblock.h:93
ojph::local::codeblock::line_offset
int line_offset
Definition:
ojph_codeblock.h:98
ojph::local::codeblock::max_val64
ui64 max_val64[4]
Definition:
ojph_codeblock.h:108
ojph::local::codeblock::stripe_causal
bool stripe_causal
Definition:
ojph_codeblock.h:104
ojph::local::codeblock::resilient
bool resilient
Definition:
ojph_codeblock.h:103
ojph::local::codeblock::coded_cb
coded_cb_header * coded_cb
Definition:
ojph_codeblock.h:110
ojph::local::codeblock::decode
void decode()
Definition:
ojph_codeblock.cpp:188
ojph::local::codeblock::parent
subband * parent
Definition:
ojph_codeblock.h:97
ojph::local::codeblock::finalize_alloc
void finalize_alloc(codestream *codestream, subband *parent, const size &nominal, const size &cb_size, coded_cb_header *coded_cb, ui32 K_max, int tbx0, ui32 precision, ui32 comp_idx)
Definition:
ojph_codeblock.cpp:72
ojph::local::codeblock::precision
ui32 precision
Definition:
ojph_codeblock.h:88
ojph::local::codeblock::push
void push(line_buf *line)
Definition:
ojph_codeblock.cpp:115
ojph::local::codeblock::buf64
ui64 * buf64
Definition:
ojph_codeblock.h:91
ojph::local::codeblock::cb_size
size cb_size
Definition:
ojph_codeblock.h:94
ojph::local::codeblock::buf_size
ui32 buf_size
Definition:
ojph_codeblock.h:96
ojph::local::codeblock::K_max
ui32 K_max
Definition:
ojph_codeblock.h:101
ojph::local::codeblock::pre_alloc
static void pre_alloc(codestream *codestream, const size &nominal, ui32 precision)
Definition:
ojph_codeblock.cpp:56
ojph::local::codeblock::delta_inv
float delta_inv
Definition:
ojph_codeblock.h:100
ojph::local::codeblock::encode
void encode(mem_elastic_allocator *elastic)
Definition:
ojph_codeblock.cpp:140
ojph::local::codeblock::recreate
void recreate(const size &cb_size, coded_cb_header *coded_cb)
Definition:
ojph_codeblock.cpp:176
ojph::local::codeblock::delta
float delta
Definition:
ojph_codeblock.h:100
ojph::local::codeblock::max_val32
ui32 max_val32[8]
Definition:
ojph_codeblock.h:107
ojph::local::codeblock::stride
ui32 stride
Definition:
ojph_codeblock.h:95
ojph::local::codeblock::reversible
bool reversible
Definition:
ojph_codeblock.h:102
ojph::local::codeblock::cur_line
ui32 cur_line
Definition:
ojph_codeblock.h:99
ojph::local::codeblock::zero_block
bool zero_block
Definition:
ojph_codeblock.h:105
ojph::local::codeblock::codeblock_functions
codeblock_fun codeblock_functions
Definition:
ojph_codeblock.h:111
ojph::local::codeblock::pull_line
void pull_line(line_buf *line)
Definition:
ojph_codeblock.cpp:228
ojph::local::codeblock::buf32
ui32 * buf32
Definition:
ojph_codeblock.h:90
ojph::local::codestream
Definition:
ojph_codestream_local.h:69
ojph::local::subband
Definition:
ojph_subband.h:63
ojph::mem_elastic_allocator
Definition:
ojph_mem.h:193
ojph
Definition:
ojph_img_io.h:52
ojph::ui64
uint64_t ui64
Definition:
ojph_defs.h:56
ojph::ui32
uint32_t ui32
Definition:
ojph_defs.h:54
ojph_codeblock_fun.h
ojph_defs.h
ojph_file.h
ojph::coded_lists
Definition:
ojph_mem.h:177
ojph::local::codeblock_fun
Definition:
ojph_codeblock_fun.h:93
ojph::local::coded_cb_header
Definition:
ojph_codeblock.h:116
ojph::local::coded_cb_header::next_coded
coded_lists * next_coded
Definition:
ojph_codeblock.h:121
ojph::local::coded_cb_header::suffix_buf_size
static const int suffix_buf_size
Definition:
ojph_codeblock.h:124
ojph::local::coded_cb_header::pass_length
ui32 pass_length[2]
Definition:
ojph_codeblock.h:117
ojph::local::coded_cb_header::missing_msbs
ui32 missing_msbs
Definition:
ojph_codeblock.h:120
ojph::local::coded_cb_header::prefix_buf_size
static const int prefix_buf_size
Definition:
ojph_codeblock.h:123
ojph::local::coded_cb_header::Kmax
ui32 Kmax
Definition:
ojph_codeblock.h:119
ojph::local::coded_cb_header::num_passes
ui32 num_passes
Definition:
ojph_codeblock.h:118
ojph::local::precinct
Definition:
ojph_precinct.h:59
ojph::size
Definition:
ojph_base.h:48
src
core
codestream
ojph_codeblock.h
Generated by
1.9.4