Skip to content

Commit

Permalink
Merge pull request #161 from aous72/implementation_precision_bug
Browse files Browse the repository at this point in the history
This fixes a bug which wrongly sets implementation precision.
  • Loading branch information
aous72 authored Dec 9, 2024
2 parents 4c1cad5 + ca66e88 commit 949d376
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/core/codestream/ojph_codeblock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ui32>(nominal.h * (size_t)stride, 0);
else
Expand All @@ -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<ui32>(this->buf_size, 0);
Expand Down
2 changes: 1 addition & 1 deletion src/core/codestream/ojph_params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions src/core/codestream/ojph_params_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
};

///////////////////////////////////////////////////////////////////////////
Expand Down
4 changes: 2 additions & 2 deletions src/core/codestream/ojph_resolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
7 changes: 4 additions & 3 deletions src/core/codestream/ojph_subband.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<si32>(width, 1);
else
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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<si32>(width, 1), width, 1);
else
Expand Down
2 changes: 1 addition & 1 deletion src/core/common/ojph_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@

#define OPENJPH_VERSION_MAJOR 0
#define OPENJPH_VERSION_MINOR 18
#define OPENJPH_VERSION_PATCH 1
#define OPENJPH_VERSION_PATCH 2

0 comments on commit 949d376

Please sign in to comment.