Skip to content

Commit 5551112

Browse files
committed
Improvements and bug fixes.
1 parent bd914a9 commit 5551112

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/core/codestream/ojph_params.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,12 +1643,9 @@ namespace ojph {
16431643
param_nlt* p = get_nlt_object(c);
16441644
if (p == NULL || !p->enabled)
16451645
{ // captured by ALL_COMPS
1646-
if (p)
1647-
p->enabled = true;
1648-
else {
1646+
if (p == NULL)
16491647
p = add_object(c);
1650-
p->Cnlt = c;
1651-
}
1648+
p->enabled = true;
16521649
p->Tnlt = nonlinearity::OJPH_NLT_BINARY_COMPLEMENT_NLT;
16531650
p->BDnlt = (ui8)(siz.get_bit_depth(c) - 1);
16541651
p->BDnlt = (ui8)(p->BDnlt | (siz.is_signed(c) ? 0x80 : 0));
@@ -1696,8 +1693,9 @@ namespace ojph {
16961693
param_nlt::get_nonlinear_transform(ui32 comp_num, ui8& bit_depth,
16971694
bool& is_signed, ui8& nl_type) const
16981695
{
1696+
assert(Cnlt == special_comp_num::ALL_COMPS);
16991697
const param_nlt* p = get_nlt_object(comp_num);
1700-
p = p ? p : this;
1698+
p = (p && p->enabled) ? p : this;
17011699
if (p->enabled)
17021700
{
17031701
bit_depth = (ui8)((p->BDnlt & 0x7F) + 1);
@@ -1780,7 +1778,8 @@ namespace ojph {
17801778
//////////////////////////////////////////////////////////////////////////
17811779
param_nlt* param_nlt::add_object(ui32 comp_num)
17821780
{
1783-
assert(Cnlt != comp_num);
1781+
assert(comp_num != special_comp_num::ALL_COMPS);
1782+
assert(Cnlt == special_comp_num::ALL_COMPS);
17841783
param_nlt* p = this;
17851784
while (p->next != NULL) {
17861785
assert(p->Cnlt != comp_num);

0 commit comments

Comments
 (0)