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
47namespace 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
66 {
67 friend struct precinct;
68 public:
69 static void pre_alloc(codestream *codestream, const size& nominal);
71 const size& nominal, const size& cb_size,
73 ui32 K_max, int tbx0);
74 void push(line_buf *line);
75 void encode(mem_elastic_allocator *elastic);
77
78 void decode();
79 void pull_line(line_buf *line);
80
81 private:
95 bool zero_block; // true when the decoded block is all zero
96 ui32 max_val[8]; // supports up to 256 bits
99 };
100
103 {
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
static void pre_alloc(codestream *codestream, const size &nominal)
coded_cb_header * coded_cb
void push(line_buf *line)
void encode(mem_elastic_allocator *elastic)
void recreate(const size &cb_size, coded_cb_header *coded_cb)
void finalize_alloc(codestream *codestream, subband *parent, const size &nominal, const size &cb_size, coded_cb_header *coded_cb, ui32 K_max, int tbx0)
codeblock_fun codeblock_functions
void pull_line(line_buf *line)
uint32_t ui32
Definition: ojph_defs.h:54
static const int suffix_buf_size
static const int prefix_buf_size