52#include "../transform/ojph_transform.h"
60 const rect& recon_res_rect,
74 OJPH_ERROR(0x00070001,
"There is a problem with codestream "
75 "marker segments. COD/COC specifies the use of a DFS marker "
76 "but there are no DFS markers within the main codestream "
83 OJPH_ERROR(0x00070002,
"There is a problem with codestream "
84 "marker segments. COD/COC specifies the use of a DFS marker "
85 "with index %d, but there are no such marker within the "
86 "main codestream headers", dfs_idx);
114 for (
ui32 i = 0; i < 4; ++i)
116 ui32 tbx0 = (trx0 - (i & 1) + 1) >> 1;
117 ui32 tbx1 = (trx1 - (i & 1) + 1) >> 1;
118 ui32 tby0 = (try0 - (i >> 1) + 1) >> 1;
119 ui32 tby1 = (try1 - (i >> 1) + 1) >> 1;
124 re.
siz.
w = tbx1 - tbx0;
125 re.
siz.
h = tby1 - tby0;
141 tby0 = (try0 + 1) >> 1;
142 tby1 = (try1 + 1) >> 1;
144 re.
siz.
h = tby1 - tby0;
153 re.
siz.
h = tby1 - tby0;
161 tbx0 = (trx0 + 1) >> 1;
162 tbx1 = (trx1 + 1) >> 1;
164 re.
siz.
w = tbx1 - tbx0;
173 re.
siz.
w = tbx1 - tbx0;
193 if (trx0 != trx1 && try0 != try1)
213 if (precision <= 32) {
231 const rect& res_rect,
232 const rect& recon_res_rect,
259 OJPH_ERROR(0x00070011,
"There is a problem with codestream "
260 "marker segments. COD/COC specifies the use of a DFS marker "
261 "but there are no DFS markers within the main codestream "
268 OJPH_ERROR(0x00070012,
"There is a problem with codestream "
269 "marker segments. COD/COC specifies the use of a DFS marker "
270 "with index %d, but there are no such marker within the "
271 "main codestream headers", dfs_idx);
295 for (
int i = 0; i < 4; ++i)
301 for (
ui32 i = 0; i < 4; ++i)
303 ui32 tbx0 = (trx0 - (i & 1) + 1) >> 1;
304 ui32 tbx1 = (trx1 - (i & 1) + 1) >> 1;
305 ui32 tby0 = (try0 - (i >> 1) + 1) >> 1;
306 ui32 tby1 = (try1 - (i >> 1) + 1) >> 1;
311 re.
siz.
w = tbx1 - tbx0;
312 re.
siz.
h = tby1 - tby0;
314 point next_res_downsamp;
315 next_res_downsamp.
x = res_downsamp.
x * 2;
316 next_res_downsamp.
y = res_downsamp.
y * 2;
322 parent_tile_comp,
this);
332 tby0 = (try0 + 1) >> 1;
333 tby1 = (try1 + 1) >> 1;
335 re.
siz.
h = tby1 - tby0;
337 point next_res_downsamp;
338 next_res_downsamp.
x = res_downsamp.
x;
339 next_res_downsamp.
y = res_downsamp.
y * 2;
344 parent_tile_comp,
this);
349 re.
siz.
h = tby1 - tby0;
356 tbx0 = (trx0 + 1) >> 1;
357 tbx1 = (trx1 + 1) >> 1;
359 re.
siz.
w = tbx1 - tbx0;
361 point next_res_downsamp;
362 next_res_downsamp.
x = res_downsamp.
x * 2;
363 next_res_downsamp.
y = res_downsamp.
y;
368 parent_tile_comp,
this);
373 re.
siz.
w = tbx1 - tbx0;
394 if (trx0 != trx1 && try0 != try1)
403 for (
ui64 i = 0; i < num; ++i)
419 point t(res_downsamp.
x * ppx0, res_downsamp.
y * ppy0);
420 t.x = t.x > tile_top_left.
x ? t.x : tile_top_left.
x;
421 t.y = t.y > tile_top_left.
y ? t.y : tile_top_left.
y;
430 for (
int i = 0; i < 4; ++i)
431 if (
bands[i].exists())
447 for (
ui32 i = 1; i <= max_num_levels; ++i, val >>= 2)
590 for (
ui32 i = width; i > 0; --i)
637 const float K_inv = 1.0f /
atk->
get_K();
663 for (
ui32 i = width; i > 0; --i)
780 for (
ui32 i = width; i > 0; --i)
787 for (
ui32 i = width; i > 0; --i)
813 width *
sizeof(
float));
829 width *
sizeof(
float));
834 const float K_inv = 1.0f /
atk->
get_K();
871 width *
sizeof(
float));
880 width *
sizeof(
float));
882 for (
ui32 i = width; i > 0; --i)
908 width *
sizeof(
float));
917 ui32 lower_resolutions_bytes = 0;
923 for (
si32 i = 0; i < repeat; ++i)
926 return this->
num_bytes + lower_resolutions_bytes;
1003 if (this->
res_num == resolution_num)
void wrap(T *buffer, size_t num_ele, ui32 pre_size)
mem_elastic_allocator * get_elastic_alloc()
ui32 get_skipped_res_for_read()
const param_siz * get_siz()
mem_fixed_allocator * get_allocator()
ui8 * get_precinct_scratch()
const param_cod * get_cod()
const param_dfs * access_dfs()
ui32 get_skipped_res_for_recon()
bool get_top_left_precinct(point &top_left)
void parse_one_precinct(ui32 &data_left, infile_base *file)
bool skipped_res_for_recon
ui32 get_num_bytes() const
mem_elastic_allocator * elastic
void write_precincts(outfile_base *file)
static void pre_alloc(codestream *codestream, const rect &res_rect, const rect &recon_res_rect, ui32 comp_num, ui32 res_num)
bool skipped_res_for_read
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)
void parse_all_precincts(ui32 &data_left, infile_base *file)
void write_one_precinct(outfile_base *file)
static void pre_alloc(codestream *codestream, const rect &band_rect, ui32 comp_num, ui32 res_num, ui32 transform_flags)
void exchange_buf(line_buf *l)
void get_cb_indices(const size &num_precincts, precinct *precincts)
void finalize_alloc(codestream *codestream, const rect &band_rect, resolution *res, ui32 res_num, ui32 subband_num)
void pre_alloc_data(size_t num_ele, ui32 pre_size)
void pre_alloc_obj(size_t num_ele)
T * post_alloc_data(size_t num_ele, ui32 pre_size)
T * post_alloc_obj(size_t num_ele)
void(* rev_horz_ana)(const param_atk *atk, const line_buf *ldst, const line_buf *hdst, const line_buf *src, ui32 width, bool even)
void(* irv_vert_times_K)(float K, const line_buf *aug, ui32 repeat)
void(* irv_vert_step)(const lifting_step *s, const line_buf *sig, const line_buf *other, const line_buf *aug, ui32 repeat, bool synthesis)
void(* rev_horz_syn)(const param_atk *atk, const line_buf *dst, const line_buf *lsrc, const line_buf *hsrc, ui32 width, bool even)
void(* irv_horz_ana)(const param_atk *atk, const line_buf *ldst, const line_buf *hdst, const line_buf *src, ui32 width, bool even)
void(* rev_vert_step)(const lifting_step *s, const line_buf *sig, const line_buf *other, const line_buf *aug, ui32 repeat, bool synthesis)
void(* irv_horz_syn)(const param_atk *atk, const line_buf *dst, const line_buf *lsrc, const line_buf *hsrc, ui32 width, bool even)
#define OJPH_ERROR(t,...)
ui32 get_num_steps() const
bool is_reversible() const
const lifting_step * get_step(ui32 s) const
size get_log_block_dims() const
ui16 get_dfs_index() const
const param_atk * access_atk() const
size get_log_precinct_size(ui32 res_num) const
bool is_dfs_defined() const
bool packets_use_eph() const
ui8 get_num_decompositions() const
bool packets_may_use_sop() const
ui32 propose_precision(const param_siz *siz, ui32 comp_num) const
dfs_dwt_type get_dwt_type(ui32 decomp_level) const
const param_dfs * get_dfs(int index) const
void write(outfile_base *file)
void parse(int tag_tree_size, ui32 *lev_idx, mem_elastic_allocator *elastic, ui32 &data_left, infile_base *file, bool skipped)