OpenJPH
Open-source implementation of JPEG2000 Part-15
ojph_codestream.cpp
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_codestream.cpp
34// Author: Aous Naman
35// Date: 28 August 2019
36//***************************************************************************/
37
38
39#include <climits>
40#include <cmath>
41
42#include "ojph_mem.h"
43#include "ojph_params.h"
44#include "ojph_codestream.h"
46
47namespace ojph {
48
50 //
51 //
52 //
53 //
54 //
56
59 {
60 if (state) delete state;
61 }
62
65 {
67 }
68
71 {
72 return param_siz(&state->siz);
73 }
74
77 {
78 return param_cod(&state->cod);
79 }
80
83 {
84 return param_qcd(&state->qcd);
85 }
86
88 void codestream::set_planar(bool planar)
89 {
90 state->set_planar(planar ? 1 : 0);
91 }
92
94 void codestream::set_profile(const char *s)
95 {
97 }
98
100 void codestream::set_tilepart_divisions(bool at_resolutions,
101 bool at_components)
102 {
103 ui32 value = 0;
104 if (at_resolutions)
106 if (at_components)
109 }
110
113 {
114 state->request_tlm_marker(needed);
115 }
116
119 {
120 return state->is_planar();
121 }
122
125 const comment_exchange* comments,
126 ui32 num_comments)
127 {
128 state->write_headers(file, comments, num_comments);
129 }
130
133 {
135 }
136
139 {
140 state->read_headers(file);
141 }
142
145 ui32 skipped_res_for_recon)
146 {
147 state->restrict_input_resolution(skipped_res_for_read,
148 skipped_res_for_recon);
149 }
150
153 {
154 state->read();
155 }
156
159 {
160 return state->pull(comp_num);
161 }
162
163
166 {
167 state->flush();
168 }
169
172 {
173 state->close();
174 }
175
178 {
179 return state->exchange(line, next_component);
180 }
181
182}
OJPH_EXPORT param_siz access_siz()
OJPH_EXPORT param_cod access_cod()
OJPH_EXPORT void restrict_input_resolution(ui32 skipped_res_for_data, ui32 skipped_res_for_recon)
local::codestream * state
OJPH_EXPORT void close()
OJPH_EXPORT void set_planar(bool planar)
OJPH_EXPORT ~codestream()
OJPH_EXPORT void enable_resilience()
OJPH_EXPORT line_buf * exchange(line_buf *line, ui32 &next_component)
OJPH_EXPORT void request_tlm_marker(bool needed)
OJPH_EXPORT codestream()
OJPH_EXPORT void set_profile(const char *s)
OJPH_EXPORT param_qcd access_qcd()
OJPH_EXPORT void read_headers(infile_base *file)
OJPH_EXPORT void set_tilepart_divisions(bool at_resolutions, bool at_components)
OJPH_EXPORT void write_headers(outfile_base *file, const comment_exchange *comments=NULL, ui32 num_comments=0)
OJPH_EXPORT void create()
OJPH_EXPORT bool is_planar() const
OJPH_EXPORT void flush()
OJPH_EXPORT line_buf * pull(ui32 &comp_num)
line_buf * exchange(line_buf *line, ui32 &next_component)
void restrict_input_resolution(ui32 skipped_res_for_data, ui32 skipped_res_for_recon)
void write_headers(outfile_base *file, const comment_exchange *comments, ui32 num_comments)
void read_headers(infile_base *file)
line_buf * pull(ui32 &comp_num)
@ OJPH_TILEPART_RESOLUTIONS
@ OJPH_TILEPART_COMPONENTS
uint32_t ui32
Definition: ojph_defs.h:54