Loading...
Searching...
No Matches
ojph_resolution.h
Go to the documentation of this file.
//***************************************************************************/
// This software is released under the 2-Clause BSD license, included
// below.
//
// Copyright (c) 2019, Aous Naman
// Copyright (c) 2019, Kakadu Software Pty Ltd, Australia
// Copyright (c) 2019, The University of New South Wales, Australia
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//***************************************************************************/
// This file is part of the OpenJPH software implementation.
// File: ojph_resolution.h
// Author: Aous Naman
// Date: 28 August 2019
//***************************************************************************/
#ifndef OJPH_RESOLUTION_H
#define OJPH_RESOLUTION_H
#include "ojph_defs.h"
namespace ojph {
//defined elsewhere
class line_buf;
class mem_elastic_allocator;
class codestream;
namespace local {
//defined here
class tile_comp;
struct precinct;
class subband;
class resolution
{
public:
enum : ui32 {
HORZ_TRX = 0x01, // horizontal transform
VERT_TRX = 0x02, // vertical transform
};
public:
static void pre_alloc(codestream *codestream, const rect& res_rect,
const rect& recon_res_rect,
ui32 comp_num, ui32 res_num);
void finalize_alloc(codestream *codestream, const rect& res_rect,
const rect& recon_res_rect, ui32 comp_num,
ui32 res_num, point comp_downsamp,
point res_downsamp, tile_comp *parent_tile_comp,
resolution *parent_res);
line_buf* get_line();
void push_line();
line_buf* pull_line();
rect get_rect() { return res_rect; }
ui32 get_comp_num() { return comp_num; }
bool has_horz_transform() { return (transform_flags & HORZ_TRX) != 0; }
bool has_vert_transform() { return (transform_flags & VERT_TRX) != 0; }
ui32 prepare_precinct();
void write_precincts(outfile_base *file);
bool get_top_left_precinct(point &top_left);
void write_one_precinct(outfile_base *file);
resolution *next_resolution() { return child_res; }
void parse_all_precincts(ui32& data_left, infile_base *file);
void parse_one_precinct(ui32& data_left, infile_base *file);
ui32 get_num_bytes() const { return num_bytes; }
ui32 get_num_bytes(ui32 resolution_num) const;
private:
bool reversible, skipped_res_for_read, skipped_res_for_recon;
ui32 num_steps;
ui32 res_num;
ui32 comp_num;
ui32 num_bytes; // number of bytes in this resolution
// used for tilepart length
point comp_downsamp;
rect res_rect; // resolution rectangle
line_buf* lines; // used to store lines
lifting_buf *ssp; // step state pointer
lifting_buf *aug, *sig;
subband *bands;
tile_comp *parent_comp;
resolution *parent_res, *child_res;
//precincts stuff
precinct *precincts;
size num_precincts;
size log_PP;
ui32 max_num_levels;
int tag_tree_size;
ui32 level_index[20]; //more than enough
point cur_precinct_loc; //used for progressing spatial modes (2, 3, 4)
const param_atk* atk;
ui32 transform_flags;
//wavelet machinery
ui32 cur_line;
ui32 rows_to_produce;
bool vert_even, horz_even;
mem_elastic_allocator *elastic;
};
}
}
#endif // !OJPH_RESOLUTION_H
ojph::codestream
The object represent a codestream.
Definition ojph_codestream.h:89
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::local::resolution
Definition ojph_resolution.h:62
ojph::local::resolution::get_top_left_precinct
bool get_top_left_precinct(point &top_left)
Definition ojph_resolution.cpp:975
ojph::local::resolution::sig
lifting_buf * sig
Definition ojph_resolution.h:109
ojph::local::resolution::rows_to_produce
ui32 rows_to_produce
Definition ojph_resolution.h:125
ojph::local::resolution::bands
subband * bands
Definition ojph_resolution.h:110
ojph::local::resolution::parse_one_precinct
void parse_one_precinct(ui32 &data_left, infile_base *file)
Definition ojph_resolution.cpp:1020
ojph::local::resolution::skipped_res_for_recon
bool skipped_res_for_recon
Definition ojph_resolution.h:99
ojph::local::resolution::tag_tree_size
int tag_tree_size
Definition ojph_resolution.h:118
ojph::local::resolution::push_line
void push_line()
Definition ojph_resolution.cpp:547
ojph::local::resolution::get_num_bytes
ui32 get_num_bytes() const
Definition ojph_resolution.h:95
ojph::local::resolution::atk
const param_atk * atk
Definition ojph_resolution.h:121
ojph::local::resolution::transform_flags
ui32 transform_flags
Definition ojph_resolution.h:122
ojph::local::resolution::elastic
mem_elastic_allocator * elastic
Definition ojph_resolution.h:127
ojph::local::resolution::comp_downsamp
point comp_downsamp
Definition ojph_resolution.h:105
ojph::local::resolution::parent_res
resolution * parent_res
Definition ojph_resolution.h:112
ojph::local::resolution::cur_precinct_loc
point cur_precinct_loc
Definition ojph_resolution.h:120
ojph::local::resolution::prepare_precinct
ui32 prepare_precinct()
Definition ojph_resolution.cpp:952
ojph::local::resolution::reversible
bool reversible
Definition ojph_resolution.h:99
ojph::local::resolution::write_precincts
void write_precincts(outfile_base *file)
Definition ojph_resolution.cpp:967
ojph::local::resolution::HORZ_TRX
@ HORZ_TRX
Definition ojph_resolution.h:65
ojph::local::resolution::VERT_TRX
@ VERT_TRX
Definition ojph_resolution.h:66
ojph::local::resolution::comp_num
ui32 comp_num
Definition ojph_resolution.h:102
ojph::local::resolution::get_rect
rect get_rect()
Definition ojph_resolution.h:82
ojph::local::resolution::res_rect
rect res_rect
Definition ojph_resolution.h:106
ojph::local::resolution::num_steps
ui32 num_steps
Definition ojph_resolution.h:100
ojph::local::resolution::precincts
precinct * precincts
Definition ojph_resolution.h:114
ojph::local::resolution::parent_comp
tile_comp * parent_comp
Definition ojph_resolution.h:111
ojph::local::resolution::pull_line
line_buf * pull_line()
Definition ojph_resolution.cpp:713
ojph::local::resolution::get_line
line_buf * get_line()
Definition ojph_resolution.cpp:530
ojph::local::resolution::has_vert_transform
bool has_vert_transform()
Definition ojph_resolution.h:85
ojph::local::resolution::num_precincts
size num_precincts
Definition ojph_resolution.h:115
ojph::local::resolution::pre_alloc
static void pre_alloc(codestream *codestream, const rect &res_rect, const rect &recon_res_rect, ui32 comp_num, ui32 res_num)
Definition ojph_resolution.cpp:59
ojph::local::resolution::get_comp_num
ui32 get_comp_num()
Definition ojph_resolution.h:83
ojph::local::resolution::skipped_res_for_read
bool skipped_res_for_read
Definition ojph_resolution.h:99
ojph::local::resolution::finalize_alloc
void finalize_alloc(codestream *codestream, const rect &res_rect, const rect &recon_res_rect, ui32 comp_num, ui32 res_num, point comp_downsamp, point res_downsamp, tile_comp *parent_tile_comp, resolution *parent_res)
Definition ojph_resolution.cpp:240
ojph::local::resolution::level_index
ui32 level_index[20]
Definition ojph_resolution.h:119
ojph::local::resolution::next_resolution
resolution * next_resolution()
Definition ojph_resolution.h:91
ojph::local::resolution::has_horz_transform
bool has_horz_transform()
Definition ojph_resolution.h:84
ojph::local::resolution::lines
line_buf * lines
Definition ojph_resolution.h:107
ojph::local::resolution::log_PP
size log_PP
Definition ojph_resolution.h:116
ojph::local::resolution::aug
lifting_buf * aug
Definition ojph_resolution.h:109
ojph::local::resolution::horz_even
bool horz_even
Definition ojph_resolution.h:126
ojph::local::resolution::parse_all_precincts
void parse_all_precincts(ui32 &data_left, infile_base *file)
Definition ojph_resolution.cpp:1001
ojph::local::resolution::res_num
ui32 res_num
Definition ojph_resolution.h:101
ojph::local::resolution::write_one_precinct
void write_one_precinct(outfile_base *file)
Definition ojph_resolution.cpp:987
ojph::local::resolution::max_num_levels
ui32 max_num_levels
Definition ojph_resolution.h:117
ojph::local::resolution::vert_even
bool vert_even
Definition ojph_resolution.h:126
ojph::local::resolution::cur_line
ui32 cur_line
Definition ojph_resolution.h:124
ojph::local::resolution::num_bytes
ui32 num_bytes
Definition ojph_resolution.h:103
ojph::local::resolution::ssp
lifting_buf * ssp
Definition ojph_resolution.h:108
ojph::local::resolution::child_res
resolution * child_res
Definition ojph_resolution.h:112
ojph::local::subband
Definition ojph_subband.h:63
ojph::local::tile_comp
Definition ojph_tile_comp.h:63
ojph::mem_elastic_allocator
Definition ojph_mem.h:218
ojph::outfile_base
Definition ojph_file.h:75
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_defs.h
ojph::lifting_buf
Definition ojph_mem.h:194
ojph::local::param_atk
Definition ojph_params_local.h:1085
ojph::local::precinct
Definition ojph_precinct.h:59
ojph::point
Definition ojph_base.h:58
ojph::rect
Definition ojph_base.h:65
ojph::size
Definition ojph_base.h:48