@@ -253,12 +253,32 @@ namespace ojph {
253253 }
254254
255255 // //////////////////////////////////////////////////////////////////////////
256- param_coc param_cod::get_coc (ui32 component_idx )
256+ void param_cod::set_num_decomposition (ui32 comp_idx, ui32 num_decompositions )
257257 {
258- local::param_cod *p = state->get_coc (component_idx);
259- if (p == state) // no COC segment marker for this component
260- p = state->add_coc_object (component_idx);
261- return param_coc (p);
258+ local::param_cod* cdp = state->get_or_add_coc (comp_idx);
259+ ojph::param_cod (cdp).set_num_decomposition (num_decompositions);
260+ }
261+
262+ // //////////////////////////////////////////////////////////////////////////
263+ void param_cod::set_block_dims (ui32 comp_idx, ui32 width, ui32 height)
264+ {
265+ local::param_cod* cdp = state->get_or_add_coc (comp_idx);
266+ ojph::param_cod (cdp).set_block_dims (width, height);
267+ }
268+
269+ // //////////////////////////////////////////////////////////////////////////
270+ void param_cod::set_precinct_size (ui32 comp_idx, int num_levels,
271+ size* precinct_size)
272+ {
273+ local::param_cod* cdp = state->get_or_add_coc (comp_idx);
274+ ojph::param_cod (cdp).set_precinct_size (num_levels, precinct_size);
275+ }
276+
277+ // //////////////////////////////////////////////////////////////////////////
278+ void param_cod::set_reversible (ui32 comp_idx, bool reversible)
279+ {
280+ local::param_cod* cdp = state->get_or_add_coc (comp_idx);
281+ ojph::param_cod (cdp).set_reversible (reversible);
262282 }
263283
264284 // //////////////////////////////////////////////////////////////////////////
@@ -352,56 +372,32 @@ namespace ojph {
352372 }
353373
354374 // //////////////////////////////////////////////////////////////////////////
355- //
356- //
357- //
358- //
359- //
360- // //////////////////////////////////////////////////////////////////////////
375+ ui32 param_cod::get_num_decompositions (ui32 comp_idx) const
376+ { return state->get_coc (comp_idx)->get_num_decompositions (); }
361377
362378 // //////////////////////////////////////////////////////////////////////////
363- void param_coc::set_num_decomposition (ui32 num_decompositions)
364- { ojph::param_cod ( state). set_num_decomposition (num_decompositions ); }
379+ size param_cod::get_block_dims (ui32 comp_idx) const
380+ { return state-> get_coc (comp_idx)-> get_block_dims ( ); }
365381
366382 // //////////////////////////////////////////////////////////////////////////
367- void param_coc::set_block_dims (ui32 width, ui32 height)
368- { ojph::param_cod ( state). set_block_dims (width, height ); }
383+ size param_cod::get_log_block_dims (ui32 comp_idx) const
384+ { return state-> get_coc (comp_idx)-> get_log_block_dims ( ); }
369385
370386 // //////////////////////////////////////////////////////////////////////////
371- void param_coc::set_precinct_size ( int num_levels, size* precinct_size)
372- { ojph::param_cod ( state). set_precinct_size (num_levels, precinct_size ); }
387+ bool param_cod::is_reversible (ui32 comp_idx) const
388+ { return state-> get_coc (comp_idx)-> is_reversible ( ); }
373389
374390 // //////////////////////////////////////////////////////////////////////////
375- void param_coc::set_reversible ( bool reversible)
376- { ojph::param_cod ( state). set_reversible (reversible ); }
391+ size param_cod::get_precinct_size (ui32 comp_idx, ui32 level_num) const
392+ { return state-> get_coc (comp_idx)-> get_precinct_size (level_num ); }
377393
378394 // //////////////////////////////////////////////////////////////////////////
379- ui32 param_coc::get_num_decompositions ( ) const
380- { return ojph::param_cod ( state). get_num_decompositions ( ); }
395+ size param_cod::get_log_precinct_size (ui32 comp_idx, ui32 level_num ) const
396+ { return state-> get_coc (comp_idx)-> get_log_precinct_size (level_num ); }
381397
382398 // //////////////////////////////////////////////////////////////////////////
383- size param_coc::get_block_dims () const
384- { return ojph::param_cod (state).get_block_dims (); }
385-
386- // //////////////////////////////////////////////////////////////////////////
387- size param_coc::get_log_block_dims () const
388- { return ojph::param_cod (state).get_log_block_dims (); }
389-
390- // //////////////////////////////////////////////////////////////////////////
391- bool param_coc::is_reversible () const
392- { return ojph::param_cod (state).is_reversible (); }
393-
394- // //////////////////////////////////////////////////////////////////////////
395- size param_coc::get_precinct_size (ui32 level_num) const
396- { return ojph::param_cod (state).get_precinct_size (level_num); }
397-
398- // //////////////////////////////////////////////////////////////////////////
399- size param_coc::get_log_precinct_size (ui32 level_num) const
400- { return ojph::param_cod (state).get_log_precinct_size (level_num); }
401-
402- // //////////////////////////////////////////////////////////////////////////
403- bool param_coc::get_block_vertical_causality () const
404- { return ojph::param_cod (state).get_block_vertical_causality (); }
399+ bool param_cod::get_block_vertical_causality (ui32 comp_idx) const
400+ { return state->get_coc (comp_idx)->get_block_vertical_causality (); }
405401
406402
407403 // //////////////////////////////////////////////////////////////////////////
@@ -1139,6 +1135,16 @@ namespace ojph {
11391135 return p->next ;
11401136 }
11411137
1138+ // ////////////////////////////////////////////////////////////////////////
1139+ param_cod* param_cod::get_or_add_coc (ui32 comp_idx)
1140+ {
1141+ assert (type == COD_MAIN );
1142+ local::param_cod *p = get_coc (comp_idx);
1143+ if (p == this )
1144+ p = add_coc_object (comp_idx);
1145+ return p;
1146+ }
1147+
11421148 // ////////////////////////////////////////////////////////////////////////
11431149 //
11441150 //
0 commit comments