Skip to content

Commit

Permalink
Merge branch 'aous72:master' into feature/add-openexr-support
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldsmith authored Jan 6, 2025
2 parents 4ce4d5e + 1b20dbc commit 47474b3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 11 deletions.
23 changes: 15 additions & 8 deletions src/core/codestream/ojph_params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -780,19 +780,26 @@ namespace ojph {
ui32
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();
if (atk->is_reversible() == false)
return 32;
else
{
ui32 bit_depth = 0;
if (comp_num < 3 && is_employing_color_transform())
{
for (ui32 c = 0; c < 3; ++c)
bit_depth = ojph_max(bit_depth, siz->get_bit_depth(c));
++bit_depth; // colour transform needs one extra bit
}
else
bit_depth = siz->get_bit_depth(comp_num);

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

return bit_depth;
return bit_depth;
}
}

//////////////////////////////////////////////////////////////////////////
Expand Down
16 changes: 13 additions & 3 deletions src/core/codestream/ojph_resolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,9 +586,19 @@ namespace ojph {
else
{
// vertical transform
si32* sp = aug->line->i32;
for (ui32 i = width; i > 0; --i)
*sp++ <<= 1;
if (aug->line->flags & line_buf::LFT_32BIT)
{
si32* sp = aug->line->i32;
for (ui32 i = width; i > 0; --i)
*sp++ <<= 1;
}
else
{
assert(aug->line->flags & line_buf::LFT_64BIT);
si64* sp = aug->line->i64;
for (ui32 i = width; i > 0; --i)
*sp++ <<= 1;
}
// horizontal transform
rev_horz_ana(atk, bands[2].get_line(),
bands[3].get_line(), aug->line, width, horz_even);
Expand Down

0 comments on commit 47474b3

Please sign in to comment.