From ca66e88ddb5b00e1c97c4e565dbe7749086524d6 Mon Sep 17 00:00:00 2001 From: Aous Naman Date: Mon, 9 Dec 2024 19:51:26 +1100 Subject: [PATCH] This fixes a bug which wrongly sets implementation precision. --- src/core/codestream/ojph_codeblock.cpp | 4 ++-- src/core/codestream/ojph_params.cpp | 2 +- src/core/codestream/ojph_params_local.h | 4 ++-- src/core/codestream/ojph_resolution.cpp | 4 ++-- src/core/codestream/ojph_subband.cpp | 7 ++++--- src/core/common/ojph_version.h | 2 +- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/core/codestream/ojph_codeblock.cpp b/src/core/codestream/ojph_codeblock.cpp index 351284b..35dc1b5 100644 --- a/src/core/codestream/ojph_codeblock.cpp +++ b/src/core/codestream/ojph_codeblock.cpp @@ -64,7 +64,7 @@ namespace ojph { const param_siz* sz = codestream->get_siz(); const param_cod* cd = codestream->get_cod(comp_num); - ui32 precision = cd->propose_implementation_precision(sz); + ui32 precision = cd->propose_precision(sz, comp_num); if (precision <= 32) allocator->pre_alloc_data(nominal.h * (size_t)stride, 0); else @@ -87,7 +87,7 @@ namespace ojph { ui32 comp_num = parent->get_parent()->get_comp_num(); const param_siz* sz = codestream->get_siz(); const param_cod* cd = codestream->get_cod(comp_num); - ui32 bit_depth = cd->propose_implementation_precision(sz); + ui32 bit_depth = cd->propose_precision(sz, comp_num); if (bit_depth <= 32) { precision = BUF32; this->buf32 = allocator->post_alloc_data(this->buf_size, 0); diff --git a/src/core/codestream/ojph_params.cpp b/src/core/codestream/ojph_params.cpp index 8a234e5..40934cb 100644 --- a/src/core/codestream/ojph_params.cpp +++ b/src/core/codestream/ojph_params.cpp @@ -778,7 +778,7 @@ namespace ojph { ////////////////////////////////////////////////////////////////////////// ui32 - param_cod::propose_implementation_precision(const param_siz* siz) const + param_cod::propose_precision(const param_siz* siz, ui32 comp_num) const { bool employing_color_transform = is_employing_color_transform() ? 1 : 0; bool reversible = atk->is_reversible(); diff --git a/src/core/codestream/ojph_params_local.h b/src/core/codestream/ojph_params_local.h index cce5cd8..f8fcd75 100644 --- a/src/core/codestream/ojph_params_local.h +++ b/src/core/codestream/ojph_params_local.h @@ -524,7 +524,7 @@ namespace ojph { } //////////////////////////////////////// - ui32 propose_implementation_precision(const param_siz* siz) const; + ui32 propose_precision(const param_siz* siz, ui32 comp_num) const; //////////////////////////////////////// bool write(outfile_base *file); @@ -578,11 +578,11 @@ namespace ojph { cod_SGcod SGCod; // Used in COD and copied to COC cod_SPcod SPcod; // serves as SPcod and SPcoc const param_cod* next;// to chain coc parameters to cod + const param_atk* atk; // used to read transform information private: // COC only variables param_cod* parent; // parent COD structure ui16 comp_num; // component index of this COC structure - const param_atk* atk; // useful when SPcod.wavelet_trans > 1 }; /////////////////////////////////////////////////////////////////////////// diff --git a/src/core/codestream/ojph_resolution.cpp b/src/core/codestream/ojph_resolution.cpp index 0246400..3a59ef5 100644 --- a/src/core/codestream/ojph_resolution.cpp +++ b/src/core/codestream/ojph_resolution.cpp @@ -200,7 +200,7 @@ namespace ojph { } const param_siz* szp = codestream->get_siz(); - ui32 precision = cdp->propose_implementation_precision(szp); + ui32 precision = cdp->propose_precision(szp, comp_num); //allocate lines if (skipped_res_for_recon == false) @@ -449,7 +449,7 @@ namespace ojph { cur_precinct_loc = point(0, 0); const param_siz* szp = codestream->get_siz(); - ui32 precision = cdp->propose_implementation_precision(szp); + ui32 precision = cdp->propose_precision(szp, comp_num); //allocate lines if (skipped_res_for_recon == false) diff --git a/src/core/codestream/ojph_subband.cpp b/src/core/codestream/ojph_subband.cpp index 8efc8de..7e6594e 100644 --- a/src/core/codestream/ojph_subband.cpp +++ b/src/core/codestream/ojph_subband.cpp @@ -98,7 +98,7 @@ namespace ojph { //allocate line_buf ui32 width = band_rect.siz.w + 1; const param_siz* szp = codestream->get_siz(); - ui32 precision = cdp->propose_implementation_precision(szp); + ui32 precision = cdp->propose_precision(szp, comp_num); if (precision <= 32) allocator->pre_alloc_data(width, 1); else @@ -141,7 +141,8 @@ namespace ojph { if (dfs != NULL) dfs = dfs->get_dfs(cdp->get_dfs_index()); } - param_qcd* qcd = codestream->access_qcd(parent->get_comp_num()); + ui32 comp_num = parent->get_comp_num(); + param_qcd* qcd = codestream->access_qcd(comp_num); ui32 num_decomps = cdp->get_num_decompositions(); this->K_max = qcd->get_Kmax(dfs, num_decomps, this->res_num, band_num); if (!reversible) @@ -198,7 +199,7 @@ namespace ojph { //allocate line_buf ui32 width = band_rect.siz.w + 1; const param_siz* szp = codestream->get_siz(); - ui32 precision = cdp->propose_implementation_precision(szp); + ui32 precision = cdp->propose_precision(szp, comp_num); if (precision <= 32) lines->wrap(allocator->post_alloc_data(width, 1), width, 1); else diff --git a/src/core/common/ojph_version.h b/src/core/common/ojph_version.h index 44b59d4..a5b578e 100644 --- a/src/core/common/ojph_version.h +++ b/src/core/common/ojph_version.h @@ -35,4 +35,4 @@ #define OPENJPH_VERSION_MAJOR 0 #define OPENJPH_VERSION_MINOR 18 -#define OPENJPH_VERSION_PATCH 1 +#define OPENJPH_VERSION_PATCH 2