OpenJPH Open-source implementation of JPEG2000 Part-15

Loading...
Searching...
No Matches
ojph_codestream.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_codestream.h
34// Author: Aous Naman
35// Date: 28 August 2019
36//***************************************************************************/
37
38
39#ifndef OJPH_CODESTREAM_H
40#define OJPH_CODESTREAM_H
41
42#include <cstdlib>
43
44#include "ojph_arch.h"
45#include "ojph_defs.h"
46
47 namespace ojph {
48
50 //local prototyping
51 namespace local {
52 class codestream;
53 };
54
56 //defined elsewhere
57 class param_siz;
58 class param_cod;
59 class param_qcd;
60 class param_nlt;
61 class comment_exchange;
62 class mem_fixed_allocator;
63 struct point;
64 class line_buf;
65 class outfile_base;
66 class infile_base;
67
69
88 class OJPH_EXPORT codestream
89 {
90 public:
98 codestream();
99
106 ~codestream();
107
122 void restart();
123
138 void set_planar(bool planar);
139
151 void set_profile(const char* s);
152
173 void set_tilepart_divisions(bool at_resolutions, bool at_components);
174
182 bool is_tilepart_division_at_resolutions();
183
191 bool is_tilepart_division_at_components();
192
200 void request_tlm_marker(bool needed);
201
210
211 bool is_tlm_requested();
212
229 void write_headers(outfile_base *file,
230 const comment_exchange* comments = NULL,
231 ui32 num_comments = 0);
232
254
255 line_buf* exchange(line_buf* line, ui32& next_component);
256
264 void flush();
265
273 void enable_resilience(); // before read_headers
274
285 void read_headers(infile_base *file); // before resolution restrictions
286
305 void restrict_input_resolution(ui32 skipped_res_for_data,
306 ui32 skipped_res_for_recon); //before create
307
313 void create();
314
326 line_buf* pull(ui32 &comp_num);
327
333 void close();
334
342 param_siz access_siz();
343
352 param_cod access_cod();
353
361 param_qcd access_qcd();
362
370 param_nlt access_nlt();
371
379 bool is_planar() const;
380
381 private:
382 local::codestream* state;
383 };
384
385}
386
387#endif // !OJPH_CODESTREAM_H
ojph::codestream::access_siz
param_siz access_siz()
Returns the underlying SIZ marker segment object.
Definition ojph_codestream.cpp:79
ojph::codestream::access_cod
param_cod access_cod()
Returns the underlying COD marker segment object.
Definition ojph_codestream.cpp:85
ojph::codestream::is_tilepart_division_at_resolutions
bool is_tilepart_division_at_resolutions()
Query if the tile will be partitioned at resolution boundary.
Definition ojph_codestream.cpp:127
ojph::codestream::state
local::codestream * state
Definition ojph_codestream.h:382
ojph::codestream::close
void close()
Call this function to close the underlying file; works for both encoding and decoding codestreams.
Definition ojph_codestream.cpp:206
ojph::codestream::set_planar
void set_planar(bool planar)
Sets the sequence of pushing or pull rows from the machinery.
Definition ojph_codestream.cpp:103
ojph::codestream::exchange
line_buf * exchange(line_buf *line, ui32 &next_component)
This call is used to send image data rows to the library. We expect to send one row from a single com...
Definition ojph_codestream.cpp:212
ojph::codestream::request_tlm_marker
void request_tlm_marker(bool needed)
Request the addition of the optional TLM marker segment. This request should occur before writing cod...
Definition ojph_codestream.cpp:141
ojph::codestream::codestream
codestream()
default constructor
Definition ojph_codestream.cpp:66
ojph::codestream::set_profile
void set_profile(const char *s)
Sets the codestream profile.
Definition ojph_codestream.cpp:109
ojph::codestream::access_qcd
param_qcd access_qcd()
Returns the underlying QCD marker segment object.
Definition ojph_codestream.cpp:91
ojph::codestream::is_tilepart_division_at_components
bool is_tilepart_division_at_components()
Query if the tile will be partitioned at component boundary.
Definition ojph_codestream.cpp:134
ojph::codestream::read_headers
void read_headers(infile_base *file)
This call reads the headers of a codestream. It is for a reading (or decoding) codestream,...
Definition ojph_codestream.cpp:173
ojph::codestream::set_tilepart_divisions
void set_tilepart_divisions(bool at_resolutions, bool at_components)
Sets the locations where a tile is partitioned into tile parts.
Definition ojph_codestream.cpp:115
ojph::codestream::is_tlm_requested
bool is_tlm_requested()
Query if the optional TLM marker segment is to be added.
Definition ojph_codestream.cpp:147
ojph::codestream::write_headers
void write_headers(outfile_base *file, const comment_exchange *comments=NULL, ui32 num_comments=0)
Writes codestream headers when the codestream is used for writing. This function should be called aft...
Definition ojph_codestream.cpp:159
ojph::codestream::create
void create()
This call is for a decoding (or reading) codestream. Call this function after calling restrict_input_...
Definition ojph_codestream.cpp:187
ojph::codestream::access_nlt
param_nlt access_nlt()
Returns the underlying NLT marker segment object.
Definition ojph_codestream.cpp:97
ojph::codestream::is_planar
bool is_planar() const
Query if the codestream extraction is planar or not. See the documentation for ojph::codestream::set_...
Definition ojph_codestream.cpp:153
ojph::codestream::flush
void flush()
This is the last call to a writing (encoding) codestream. This will write encoded bitstream data to t...
Definition ojph_codestream.cpp:200
ojph::codestream::restart
void restart()
Restarts the codestream.
Definition ojph_codestream.cpp:72
ojph::codestream::pull
line_buf * pull(ui32 &comp_num)
This call is to pull one row from the codestream, being decoded. The returned line_buf object holds o...
Definition ojph_codestream.cpp:193
ojph::comment_exchange
Definition ojph_params.h:291
ojph::infile_base
Definition ojph_file.h:267
ojph::line_buf
Definition ojph_mem.h:161
ojph::local::codestream
Definition ojph_codestream_local.h:69
ojph::mem_fixed_allocator
Definition ojph_mem.h:59
ojph::outfile_base
Definition ojph_file.h:75
ojph::param_cod
Definition ojph_params.h:104
ojph::param_nlt
non-linearity point transformation object (implements NLT marker segment)
Definition ojph_params.h:245
ojph::param_qcd
Quantization parameters object.
Definition ojph_params.h:163
ojph::param_siz
Definition ojph_params.h:71
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_arch.h
OJPH_EXPORT
#define OJPH_EXPORT
Definition ojph_arch.h:123
ojph_defs.h
enable_resilience
EMSCRIPTEN_KEEPALIVE void enable_resilience(j2k_struct *j2c)
Definition ojph_wrapper.cpp:229
restrict_input_resolution
EMSCRIPTEN_KEEPALIVE void restrict_input_resolution(j2k_struct *j2c, int skipped_res_for_read, int skipped_res_for_recon)
Definition ojph_wrapper.cpp:219
ojph::point
Definition ojph_base.h:58