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
struct
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
public
:
69
static
void
pre_alloc
(
codestream
*
codestream
,
const
size
& nominal);
70
void
finalize_alloc
(
codestream
*
codestream
,
subband
*
parent
,
71
const
size
& nominal,
const
size
&
cb_size
,
72
coded_cb_header
*
coded_cb
,
73
ui32
K_max
,
int
tbx0);
74
void
push
(
line_buf
*line);
75
void
encode
(
mem_elastic_allocator
*elastic);
76
void
recreate
(
const
size
&
cb_size
,
coded_cb_header
*
coded_cb
);
77
78
void
decode
();
79
void
pull_line
(
line_buf
*line);
80
81
private
:
82
ui32
*
buf
;
83
size
nominal_size
;
84
size
cb_size
;
85
ui32
stride
;
86
ui32
buf_size
;
87
subband
*
parent
;
88
int
line_offset
;
89
ui32
cur_line
;
90
float
delta
,
delta_inv
;
91
ui32
K_max
;
92
bool
reversible
;
93
bool
resilient
;
94
bool
stripe_causal
;
95
bool
zero_block
;
// true when the decoded block is all zero
96
ui32
max_val
[8];
// supports up to 256 bits
97
coded_cb_header
*
coded_cb
;
98
codeblock_fun
codeblock_functions
;
99
};
100
102
struct
coded_cb_header
103
{
104
ui32
pass_length
[2];
105
ui32
num_passes
;
106
ui32
Kmax
;
107
ui32
missing_msbs
;
108
coded_lists
*
next_coded
;
109
110
static
const
int
prefix_buf_size
= 8;
111
static
const
int
suffix_buf_size
= 16;
112
};
113
114
}
115
}
116
117
#endif
// !OJPH_CODEBLOCK_H
ojph::local::codeblock
Definition:
ojph_codeblock.h:66
ojph::local::codeblock::nominal_size
size nominal_size
Definition:
ojph_codeblock.h:83
ojph::local::codeblock::line_offset
int line_offset
Definition:
ojph_codeblock.h:88
ojph::local::codeblock::buf
ui32 * buf
Definition:
ojph_codeblock.h:82
ojph::local::codeblock::stripe_causal
bool stripe_causal
Definition:
ojph_codeblock.h:94
ojph::local::codeblock::resilient
bool resilient
Definition:
ojph_codeblock.h:93
ojph::local::codeblock::pre_alloc
static void pre_alloc(codestream *codestream, const size &nominal)
Definition:
ojph_codeblock.cpp:55
ojph::local::codeblock::coded_cb
coded_cb_header * coded_cb
Definition:
ojph_codeblock.h:97
ojph::local::codeblock::decode
void decode()
Definition:
ojph_codeblock.cpp:141
ojph::local::codeblock::parent
subband * parent
Definition:
ojph_codeblock.h:87
ojph::local::codeblock::push
void push(line_buf *line)
Definition:
ojph_codeblock.cpp:101
ojph::local::codeblock::cb_size
size cb_size
Definition:
ojph_codeblock.h:84
ojph::local::codeblock::buf_size
ui32 buf_size
Definition:
ojph_codeblock.h:86
ojph::local::codeblock::K_max
ui32 K_max
Definition:
ojph_codeblock.h:91
ojph::local::codeblock::max_val
ui32 max_val[8]
Definition:
ojph_codeblock.h:96
ojph::local::codeblock::delta_inv
float delta_inv
Definition:
ojph_codeblock.h:90
ojph::local::codeblock::encode
void encode(mem_elastic_allocator *elastic)
Definition:
ojph_codeblock.cpp:112
ojph::local::codeblock::recreate
void recreate(const size &cb_size, coded_cb_header *coded_cb)
Definition:
ojph_codeblock.cpp:129
ojph::local::codeblock::delta
float delta
Definition:
ojph_codeblock.h:90
ojph::local::codeblock::stride
ui32 stride
Definition:
ojph_codeblock.h:85
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)
Definition:
ojph_codeblock.cpp:67
ojph::local::codeblock::reversible
bool reversible
Definition:
ojph_codeblock.h:92
ojph::local::codeblock::cur_line
ui32 cur_line
Definition:
ojph_codeblock.h:89
ojph::local::codeblock::zero_block
bool zero_block
Definition:
ojph_codeblock.h:95
ojph::local::codeblock::codeblock_functions
codeblock_fun codeblock_functions
Definition:
ojph_codeblock.h:98
ojph::local::codeblock::pull_line
void pull_line(line_buf *line)
Definition:
ojph_codeblock.cpp:166
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:178
ojph
Definition:
ojph_img_io.h:52
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:162
ojph::line_buf
Definition:
ojph_mem.h:136
ojph::local::codeblock_fun
Definition:
ojph_codeblock_fun.h:76
ojph::local::coded_cb_header
Definition:
ojph_codeblock.h:103
ojph::local::coded_cb_header::next_coded
coded_lists * next_coded
Definition:
ojph_codeblock.h:108
ojph::local::coded_cb_header::suffix_buf_size
static const int suffix_buf_size
Definition:
ojph_codeblock.h:111
ojph::local::coded_cb_header::pass_length
ui32 pass_length[2]
Definition:
ojph_codeblock.h:104
ojph::local::coded_cb_header::missing_msbs
ui32 missing_msbs
Definition:
ojph_codeblock.h:107
ojph::local::coded_cb_header::prefix_buf_size
static const int prefix_buf_size
Definition:
ojph_codeblock.h:110
ojph::local::coded_cb_header::Kmax
ui32 Kmax
Definition:
ojph_codeblock.h:106
ojph::local::coded_cb_header::num_passes
ui32 num_passes
Definition:
ojph_codeblock.h:105
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