33// This software is released under the 2-Clause BSD license, included
44// below.
55//
6- // Copyright (c) 2019, Aous Naman
6+ // Copyright (c) 2019, Aous Naman
77// Copyright (c) 2019, Kakadu Software Pty Ltd, Australia
88// Copyright (c) 2019, The University of New South Wales, Australia
9- //
9+ //
1010// Redistribution and use in source and binary forms, with or without
1111// modification, are permitted provided that the following conditions are
1212// met:
13- //
13+ //
1414// 1. Redistributions of source code must retain the above copyright
1515// notice, this list of conditions and the following disclaimer.
16- //
16+ //
1717// 2. Redistributions in binary form must reproduce the above copyright
1818// notice, this list of conditions and the following disclaimer in the
1919// documentation and/or other materials provided with the distribution.
20- //
20+ //
2121// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
2222// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2323// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
@@ -127,7 +127,8 @@ namespace ojph {
127127 this ->band_rect = band_rect;
128128 this ->parent = res;
129129
130- const param_cod* cdp = codestream->get_coc (parent->get_comp_num ());
130+ ui32 comp_num = parent->get_comp_num ();
131+ const param_cod* cdp = codestream->get_coc (comp_num);
131132 this ->reversible = cdp->access_atk ()->is_reversible ();
132133 size log_cb = cdp->get_log_block_dims ();
133134 log_PP = cdp->get_log_precinct_size (res_num);
@@ -149,14 +150,14 @@ namespace ojph {
149150 if (dfs != NULL )
150151 dfs = dfs->get_dfs (cdp->get_dfs_index ());
151152 }
152- ui32 comp_num = parent->get_comp_num ();
153153 const param_qcd* qcd = codestream->access_qcd ()->get_qcc (comp_num);
154154 ui32 num_decomps = cdp->get_num_decompositions ();
155155 this ->K_max = qcd->get_Kmax (dfs, num_decomps, this ->res_num , band_num);
156156 if (!reversible)
157157 {
158- float d =
159- qcd->get_irrev_delta (dfs, num_decomps, res_num, subband_num);
158+ float d =
159+ qcd->get_irrev_delta (dfs, num_decomps,
160+ comp_num, res_num, subband_num);
160161 d /= (float )(1u << (31 - this ->K_max ));
161162 delta = d;
162163 delta_inv = (1 .0f /d);
@@ -199,7 +200,7 @@ namespace ojph {
199200 ui32 cbx1 = ojph_min (tbx1, x_lower_bound + (i + 1 ) * nominal.w );
200201 cb_size.w = cbx1 - cbx0;
201202 blocks[i].finalize_alloc (codestream, this , nominal, cb_size,
202- coded_cbs + i, K_max, line_offset,
203+ coded_cbs + i, K_max, line_offset,
203204 precision, comp_num);
204205 line_offset += cb_size.w ;
205206 }
@@ -210,7 +211,7 @@ namespace ojph {
210211 ui32 width = band_rect.siz .w + 1 ;
211212 if (reversible)
212213 {
213- if (precision <= 32 )
214+ if (precision <= 32 )
214215 lines->wrap (allocator->post_alloc_data <si32>(width, 1 ), width, 1 );
215216 else
216217 lines->wrap (allocator->post_alloc_data <si64>(width, 1 ), width, 1 );
0 commit comments