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);
113 for (
ui32 i = 0; i < 4; ++i)
115 ui32 tbx0 = (trx0 - (i & 1) + 1) >> 1;
116 ui32 tbx1 = (trx1 - (i & 1) + 1) >> 1;
117 ui32 tby0 = (try0 - (i >> 1) + 1) >> 1;
118 ui32 tby1 = (try1 - (i >> 1) + 1) >> 1;
123 re.
siz.
w = tbx1 - tbx0;
124 re.
siz.
h = tby1 - tby0;
140 tby0 = (try0 + 1) >> 1;
141 tby1 = (try1 + 1) >> 1;
143 re.
siz.
h = tby1 - tby0;
152 re.
siz.
h = tby1 - tby0;
160 tbx0 = (trx0 + 1) >> 1;
161 tbx1 = (trx1 + 1) >> 1;
163 re.
siz.
w = tbx1 - tbx0;
172 re.
siz.
w = tbx1 - tbx0;
192 if (trx0 != trx1 && try0 != try1)
216 if (precision <= 32) {
241 const rect& res_rect,
242 const rect& recon_res_rect,
269 OJPH_ERROR(0x00070011,
"There is a problem with codestream "
270 "marker segments. COD/COC specifies the use of a DFS marker "
271 "but there are no DFS markers within the main codestream "
278 OJPH_ERROR(0x00070012,
"There is a problem with codestream "
279 "marker segments. COD/COC specifies the use of a DFS marker "
280 "with index %d, but there are no such marker within the "
281 "main codestream headers", dfs_idx);
305 for (
int i = 0; i < 4; ++i)
311 for (
ui32 i = 0; i < 4; ++i)
313 ui32 tbx0 = (trx0 - (i & 1) + 1) >> 1;
314 ui32 tbx1 = (trx1 - (i & 1) + 1) >> 1;
315 ui32 tby0 = (try0 - (i >> 1) + 1) >> 1;
316 ui32 tby1 = (try1 - (i >> 1) + 1) >> 1;
321 re.
siz.
w = tbx1 - tbx0;
322 re.
siz.
h = tby1 - tby0;
324 point next_res_downsamp;
325 next_res_downsamp.
x = res_downsamp.
x * 2;
326 next_res_downsamp.
y = res_downsamp.
y * 2;
332 parent_tile_comp,
this);
342 tby0 = (try0 + 1) >> 1;
343 tby1 = (try1 + 1) >> 1;
345 re.
siz.
h = tby1 - tby0;
347 point next_res_downsamp;
348 next_res_downsamp.
x = res_downsamp.
x;
349 next_res_downsamp.
y = res_downsamp.
y * 2;
354 parent_tile_comp,
this);
359 re.
siz.
h = tby1 - tby0;
366 tbx0 = (trx0 + 1) >> 1;
367 tbx1 = (trx1 + 1) >> 1;
369 re.
siz.
w = tbx1 - tbx0;
371 point next_res_downsamp;
372 next_res_downsamp.
x = res_downsamp.
x * 2;
373 next_res_downsamp.
y = res_downsamp.
y;
378 parent_tile_comp,
this);
383 re.
siz.
w = tbx1 - tbx0;
404 if (trx0 != trx1 && try0 != try1)
413 for (
ui64 i = 0; i < num; ++i)
429 point t(res_downsamp.
x * ppx0, res_downsamp.
y * ppy0);
430 t.x = t.x > tile_top_left.
x ? t.x : tile_top_left.
x;
431 t.y = t.y > tile_top_left.
y ? t.y : tile_top_left.
y;
440 for (
int i = 0; i < 4; ++i)
441 if (
bands[i].exists())
457 for (
ui32 i = 1; i <= max_num_levels; ++i, val >>= 2)
619 for (
ui32 i = width; i > 0; --i)
626 for (
ui32 i = width; i > 0; --i)
674 const float K_inv = 1.0f /
atk->
get_K();
700 for (
ui32 i = width; i > 0; --i)
817 for (
ui32 i = width; i > 0; --i)
824 for (
ui32 i = width; i > 0; --i)
850 width *
sizeof(
float));
866 width *
sizeof(
float));
871 const float K_inv = 1.0f /
atk->
get_K();
908 width *
sizeof(
float));
917 width *
sizeof(
float));
919 for (
ui32 i = width; i > 0; --i)
945 width *
sizeof(
float));
954 ui32 lower_resolutions_bytes = 0;
960 for (
si32 i = 0; i < repeat; ++i)
963 return this->
num_bytes + lower_resolutions_bytes;
1040 if (this->
res_num == resolution_num)
1042 if (resolution_num < this->
res_num) {
void wrap(T *buffer, size_t num_ele, ui32 pre_size)
const param_cod * get_coc(ui32 comp_num)
mem_elastic_allocator * get_elastic_alloc()
ui32 get_skipped_res_for_read()
const param_qcd * access_qcd()
mem_fixed_allocator * get_allocator()
ui8 * get_precinct_scratch()
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
dfs_dwt_type get_dwt_type(ui32 decomp_level) const
const param_dfs * get_dfs(int index) const
ui32 propose_precision(const param_cod *cod) const
param_qcd * get_qcc(ui32 comp_idx)
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)