Skip to content

Commit 1b20dbc

Browse files
authored
Merge pull request aous72#163 from aous72/make_all_colour_comps_use_same_precision
Makes all colour components involved in colour transform employ the same precision (32bit or 64bit).
2 parents 7d8ea08 + 23633ba commit 1b20dbc

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

src/core/codestream/ojph_params.cpp

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -780,19 +780,26 @@ namespace ojph {
780780
ui32
781781
param_cod::propose_precision(const param_siz* siz, ui32 comp_num) const
782782
{
783-
bool employing_color_transform = is_employing_color_transform() ? 1 : 0;
784-
bool reversible = atk->is_reversible();
783+
if (atk->is_reversible() == false)
784+
return 32;
785+
else
786+
{
787+
ui32 bit_depth = 0;
788+
if (comp_num < 3 && is_employing_color_transform())
789+
{
790+
for (ui32 c = 0; c < 3; ++c)
791+
bit_depth = ojph_max(bit_depth, siz->get_bit_depth(c));
792+
++bit_depth; // colour transform needs one extra bit
793+
}
794+
else
795+
bit_depth = siz->get_bit_depth(comp_num);
785796

786-
ui32 bit_depth = 32;
787-
if (reversible) {
788-
bit_depth = siz->get_bit_depth(comp_num);
789-
bit_depth += comp_num < 3 ? employing_color_transform : 0;
790797
// 3 or 4 is how many extra bits are needed for the HH band at the
791798
// bottom most level of decomposition.
792799
bit_depth += get_num_decompositions() > 5 ? 4 : 3;
793-
}
794800

795-
return bit_depth;
801+
return bit_depth;
802+
}
796803
}
797804

798805
//////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)