Skip to content

Commit 47474b3

Browse files
Merge branch 'aous72:master' into feature/add-openexr-support
2 parents 4ce4d5e + 1b20dbc commit 47474b3

File tree

2 files changed

+28
-11
lines changed

2 files changed

+28
-11
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
//////////////////////////////////////////////////////////////////////////

src/core/codestream/ojph_resolution.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -586,9 +586,19 @@ namespace ojph {
586586
else
587587
{
588588
// vertical transform
589-
si32* sp = aug->line->i32;
590-
for (ui32 i = width; i > 0; --i)
591-
*sp++ <<= 1;
589+
if (aug->line->flags & line_buf::LFT_32BIT)
590+
{
591+
si32* sp = aug->line->i32;
592+
for (ui32 i = width; i > 0; --i)
593+
*sp++ <<= 1;
594+
}
595+
else
596+
{
597+
assert(aug->line->flags & line_buf::LFT_64BIT);
598+
si64* sp = aug->line->i64;
599+
for (ui32 i = width; i > 0; --i)
600+
*sp++ <<= 1;
601+
}
592602
// horizontal transform
593603
rev_horz_ana(atk, bands[2].get_line(),
594604
bands[3].get_line(), aug->line, width, horz_even);

0 commit comments

Comments
 (0)