Skip to content

Commit 949d376

Browse files
authored
Merge pull request #161 from aous72/implementation_precision_bug
This fixes a bug which wrongly sets implementation precision.
2 parents 4c1cad5 + ca66e88 commit 949d376

File tree

6 files changed

+12
-11
lines changed

6 files changed

+12
-11
lines changed

src/core/codestream/ojph_codeblock.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ namespace ojph {
6464

6565
const param_siz* sz = codestream->get_siz();
6666
const param_cod* cd = codestream->get_cod(comp_num);
67-
ui32 precision = cd->propose_implementation_precision(sz);
67+
ui32 precision = cd->propose_precision(sz, comp_num);
6868
if (precision <= 32)
6969
allocator->pre_alloc_data<ui32>(nominal.h * (size_t)stride, 0);
7070
else
@@ -87,7 +87,7 @@ namespace ojph {
8787
ui32 comp_num = parent->get_parent()->get_comp_num();
8888
const param_siz* sz = codestream->get_siz();
8989
const param_cod* cd = codestream->get_cod(comp_num);
90-
ui32 bit_depth = cd->propose_implementation_precision(sz);
90+
ui32 bit_depth = cd->propose_precision(sz, comp_num);
9191
if (bit_depth <= 32) {
9292
precision = BUF32;
9393
this->buf32 = allocator->post_alloc_data<ui32>(this->buf_size, 0);

src/core/codestream/ojph_params.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ namespace ojph {
778778

779779
//////////////////////////////////////////////////////////////////////////
780780
ui32
781-
param_cod::propose_implementation_precision(const param_siz* siz) const
781+
param_cod::propose_precision(const param_siz* siz, ui32 comp_num) const
782782
{
783783
bool employing_color_transform = is_employing_color_transform() ? 1 : 0;
784784
bool reversible = atk->is_reversible();

src/core/codestream/ojph_params_local.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ namespace ojph {
524524
}
525525

526526
////////////////////////////////////////
527-
ui32 propose_implementation_precision(const param_siz* siz) const;
527+
ui32 propose_precision(const param_siz* siz, ui32 comp_num) const;
528528

529529
////////////////////////////////////////
530530
bool write(outfile_base *file);
@@ -578,11 +578,11 @@ namespace ojph {
578578
cod_SGcod SGCod; // Used in COD and copied to COC
579579
cod_SPcod SPcod; // serves as SPcod and SPcoc
580580
const param_cod* next;// to chain coc parameters to cod
581+
const param_atk* atk; // used to read transform information
581582

582583
private: // COC only variables
583584
param_cod* parent; // parent COD structure
584585
ui16 comp_num; // component index of this COC structure
585-
const param_atk* atk; // useful when SPcod.wavelet_trans > 1
586586
};
587587

588588
///////////////////////////////////////////////////////////////////////////

src/core/codestream/ojph_resolution.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ namespace ojph {
200200
}
201201

202202
const param_siz* szp = codestream->get_siz();
203-
ui32 precision = cdp->propose_implementation_precision(szp);
203+
ui32 precision = cdp->propose_precision(szp, comp_num);
204204

205205
//allocate lines
206206
if (skipped_res_for_recon == false)
@@ -449,7 +449,7 @@ namespace ojph {
449449
cur_precinct_loc = point(0, 0);
450450

451451
const param_siz* szp = codestream->get_siz();
452-
ui32 precision = cdp->propose_implementation_precision(szp);
452+
ui32 precision = cdp->propose_precision(szp, comp_num);
453453

454454
//allocate lines
455455
if (skipped_res_for_recon == false)

src/core/codestream/ojph_subband.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ namespace ojph {
9898
//allocate line_buf
9999
ui32 width = band_rect.siz.w + 1;
100100
const param_siz* szp = codestream->get_siz();
101-
ui32 precision = cdp->propose_implementation_precision(szp);
101+
ui32 precision = cdp->propose_precision(szp, comp_num);
102102
if (precision <= 32)
103103
allocator->pre_alloc_data<si32>(width, 1);
104104
else
@@ -141,7 +141,8 @@ namespace ojph {
141141
if (dfs != NULL)
142142
dfs = dfs->get_dfs(cdp->get_dfs_index());
143143
}
144-
param_qcd* qcd = codestream->access_qcd(parent->get_comp_num());
144+
ui32 comp_num = parent->get_comp_num();
145+
param_qcd* qcd = codestream->access_qcd(comp_num);
145146
ui32 num_decomps = cdp->get_num_decompositions();
146147
this->K_max = qcd->get_Kmax(dfs, num_decomps, this->res_num, band_num);
147148
if (!reversible)
@@ -198,7 +199,7 @@ namespace ojph {
198199
//allocate line_buf
199200
ui32 width = band_rect.siz.w + 1;
200201
const param_siz* szp = codestream->get_siz();
201-
ui32 precision = cdp->propose_implementation_precision(szp);
202+
ui32 precision = cdp->propose_precision(szp, comp_num);
202203
if (precision <= 32)
203204
lines->wrap(allocator->post_alloc_data<si32>(width, 1), width, 1);
204205
else

src/core/common/ojph_version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@
3535

3636
#define OPENJPH_VERSION_MAJOR 0
3737
#define OPENJPH_VERSION_MINOR 18
38-
#define OPENJPH_VERSION_PATCH 1
38+
#define OPENJPH_VERSION_PATCH 2

0 commit comments

Comments
 (0)