From 7fa0b0d6394a9ca87d5bac56bf9eb95edea46241 Mon Sep 17 00:00:00 2001 From: Aous Naman Date: Wed, 1 Jul 2026 21:02:32 +1000 Subject: [PATCH 1/2] Removes direct access to COC segment marker, and adds a test. This commit borrows from #272 and #309. --- src/core/codestream/ojph_params.cpp | 92 ++++++------ src/core/codestream/ojph_params_local.h | 13 ++ src/core/openjph/ojph_params.h | 155 +++++++++++---------- tests/CMakeLists.txt | 13 ++ tests/mixed_rev_irrev_4comp.j2c | Bin 0 -> 259 bytes tests/test_mixed_coc.cpp | 178 ++++++++++++++++++++++++ 6 files changed, 335 insertions(+), 116 deletions(-) create mode 100644 tests/mixed_rev_irrev_4comp.j2c create mode 100644 tests/test_mixed_coc.cpp diff --git a/src/core/codestream/ojph_params.cpp b/src/core/codestream/ojph_params.cpp index 886b4b6d..2fa0024b 100644 --- a/src/core/codestream/ojph_params.cpp +++ b/src/core/codestream/ojph_params.cpp @@ -253,12 +253,32 @@ namespace ojph { } //////////////////////////////////////////////////////////////////////////// - param_coc param_cod::get_coc(ui32 component_idx) + void param_cod::set_num_decomposition(ui32 comp_idx, ui32 num_decompositions) { - local::param_cod *p = state->get_coc(component_idx); - if (p == state) // no COC segment marker for this component - p = state->add_coc_object(component_idx); - return param_coc(p); + local::param_cod* cdp = state->get_or_add_coc(comp_idx); + ojph::param_cod(cdp).set_num_decomposition(num_decompositions); + } + + //////////////////////////////////////////////////////////////////////////// + void param_cod::set_block_dims(ui32 comp_idx, ui32 width, ui32 height) + { + local::param_cod* cdp = state->get_or_add_coc(comp_idx); + ojph::param_cod(cdp).set_block_dims(width, height); + } + + //////////////////////////////////////////////////////////////////////////// + void param_cod::set_precinct_size(ui32 comp_idx, int num_levels, + size* precinct_size) + { + local::param_cod* cdp = state->get_or_add_coc(comp_idx); + ojph::param_cod(cdp).set_precinct_size(num_levels, precinct_size); + } + + //////////////////////////////////////////////////////////////////////////// + void param_cod::set_reversible(ui32 comp_idx, bool reversible) + { + local::param_cod* cdp = state->get_or_add_coc(comp_idx); + ojph::param_cod(cdp).set_reversible(reversible); } //////////////////////////////////////////////////////////////////////////// @@ -352,56 +372,32 @@ namespace ojph { } //////////////////////////////////////////////////////////////////////////// - // - // - // - // - // - //////////////////////////////////////////////////////////////////////////// + ui32 param_cod::get_num_decompositions(ui32 comp_idx) const + { return state->get_coc(comp_idx)->get_num_decompositions(); } //////////////////////////////////////////////////////////////////////////// - void param_coc::set_num_decomposition(ui32 num_decompositions) - { ojph::param_cod(state).set_num_decomposition(num_decompositions); } + size param_cod::get_block_dims(ui32 comp_idx) const + { return state->get_coc(comp_idx)->get_block_dims(); } //////////////////////////////////////////////////////////////////////////// - void param_coc::set_block_dims(ui32 width, ui32 height) - { ojph::param_cod(state).set_block_dims(width, height); } + size param_cod::get_log_block_dims(ui32 comp_idx) const + { return state->get_coc(comp_idx)->get_log_block_dims(); } //////////////////////////////////////////////////////////////////////////// - void param_coc::set_precinct_size(int num_levels, size* precinct_size) - { ojph::param_cod(state).set_precinct_size(num_levels, precinct_size); } + bool param_cod::is_reversible(ui32 comp_idx) const + { return state->get_coc(comp_idx)->is_reversible(); } //////////////////////////////////////////////////////////////////////////// - void param_coc::set_reversible(bool reversible) - { ojph::param_cod(state).set_reversible(reversible); } + size param_cod::get_precinct_size(ui32 comp_idx, ui32 level_num) const + { return state->get_coc(comp_idx)->get_precinct_size(level_num); } //////////////////////////////////////////////////////////////////////////// - ui32 param_coc::get_num_decompositions() const - { return ojph::param_cod(state).get_num_decompositions(); } + size param_cod::get_log_precinct_size(ui32 comp_idx, ui32 level_num) const + { return state->get_coc(comp_idx)->get_log_precinct_size(level_num); } //////////////////////////////////////////////////////////////////////////// - size param_coc::get_block_dims() const - { return ojph::param_cod(state).get_block_dims(); } - - //////////////////////////////////////////////////////////////////////////// - size param_coc::get_log_block_dims() const - { return ojph::param_cod(state).get_log_block_dims(); } - - //////////////////////////////////////////////////////////////////////////// - bool param_coc::is_reversible() const - { return ojph::param_cod(state).is_reversible(); } - - //////////////////////////////////////////////////////////////////////////// - size param_coc::get_precinct_size(ui32 level_num) const - { return ojph::param_cod(state).get_precinct_size(level_num); } - - //////////////////////////////////////////////////////////////////////////// - size param_coc::get_log_precinct_size(ui32 level_num) const - { return ojph::param_cod(state).get_log_precinct_size(level_num); } - - //////////////////////////////////////////////////////////////////////////// - bool param_coc::get_block_vertical_causality() const - { return ojph::param_cod(state).get_block_vertical_causality(); } + bool param_cod::get_block_vertical_causality(ui32 comp_idx) const + { return state->get_coc(comp_idx)->get_block_vertical_causality(); } //////////////////////////////////////////////////////////////////////////// @@ -1139,6 +1135,16 @@ namespace ojph { return p->next; } + ////////////////////////////////////////////////////////////////////////// + param_cod* param_cod::get_or_add_coc(ui32 comp_idx) + { + assert(type == COD_MAIN); + local::param_cod *p = get_coc(comp_idx); + if (p == this) + p = add_coc_object(comp_idx); + return p; + } + ////////////////////////////////////////////////////////////////////////// // // diff --git a/src/core/codestream/ojph_params_local.h b/src/core/codestream/ojph_params_local.h index 4651a4ab..dce65a36 100644 --- a/src/core/codestream/ojph_params_local.h +++ b/src/core/codestream/ojph_params_local.h @@ -602,6 +602,9 @@ namespace ojph { //////////////////////////////////////// param_cod* add_coc_object(ui32 comp_idx); + /////////////////////////////////////// + param_cod* get_or_add_coc(ui32 comp_idx); + //////////////////////////////////////// const param_atk* access_atk() const { return atk; } @@ -631,6 +634,16 @@ namespace ojph { Scod = 0; next = NULL; atk = NULL; + if (top_cod) + { // Here we are initializing COC marker + // a freshly materialized COC inherits the COD's current + // settings at this very moment + // Lcod will be initialized on writing the marker segment to disk + Scod = top_cod->Scod & 0x1; // only the first bit is defined in COC + // SGcod does not exist in COC + SPcod = top_cod->SPcod; + atk = top_cod->atk; + } this->top_cod = top_cod; this->comp_idx = comp_idx; } diff --git a/src/core/openjph/ojph_params.h b/src/core/openjph/ojph_params.h index dce330d2..345bbb6e 100644 --- a/src/core/openjph/ojph_params.h +++ b/src/core/openjph/ojph_params.h @@ -2,21 +2,21 @@ // This software is released under the 2-Clause BSD license, included // below. // -// Copyright (c) 2019, Aous Naman +// Copyright (c) 2019, Aous Naman // Copyright (c) 2019, Kakadu Software Pty Ltd, Australia // Copyright (c) 2019, The University of New South Wales, Australia -// +// // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: -// +// // 1. Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. -// +// // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. -// +// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A @@ -48,7 +48,6 @@ namespace ojph { // defined here class param_siz; class param_cod; - class param_coc; class param_qcd; class param_cap; class param_nlt; @@ -59,7 +58,6 @@ namespace ojph { namespace local { struct param_siz; struct param_cod; - struct param_coc; struct param_qcd; struct param_cap; struct param_nlt; @@ -99,19 +97,39 @@ namespace ojph { local::param_siz* state; }; - /***************************************************************************/ + /***************************************************************************** + * @brief An interface to COD and COC marker segments. + * + * The param_cod object uses Pimpl design. + * The top set of functions give access to the COD marker segment, while + * the lower set, the ones that have comp_idx parameter, gives access to + * potentially COC marker segment. + * The functions: + * - set_num_decomposition(ui32 comp_idx, ...) + * - set_block_dims(ui32 comp_idx, ...) + * - set_precinct_size(ui32 comp_idx, ...) + * - set_reversible(ui32 comp_idx, ...) + * create a COC segment on first call; subsequent calls to these + * functions on the same component index will use the COC segment + * created by the first call. On first creation, the COC segment will + * inherit relevant COD segment properties at the moment of COC segment + * creation; therefore, you either configure COD first and rely on + * properties propagation to COC when it is first created, modifying these + * properties afterwards, or you create and configure COC segments as + * desired before finishing COD configuration. + */ class OJPH_EXPORT param_cod { public: param_cod(local::param_cod* p) : state(p) {} + // COD marker segment interface void set_num_decomposition(ui32 num_decompositions); void set_block_dims(ui32 width, ui32 height); void set_precinct_size(int num_levels, size* precinct_size); void set_progression_order(const char *name); void set_color_transform(bool color_transform); void set_reversible(bool reversible); - param_coc get_coc(ui32 component_idx); ui32 get_num_decompositions() const; size get_block_dims() const; @@ -127,28 +145,19 @@ namespace ojph { bool packets_use_eph() const; bool get_block_vertical_causality() const; - private: - local::param_cod* state; - }; + // COC marker segment interface + void set_num_decomposition(ui32 comp_idx, ui32 num_decompositions); + void set_block_dims(ui32 comp_idx, ui32 width, ui32 height); + void set_precinct_size(ui32 comp_idx, int num_levels, size* precinct_size); + void set_reversible(ui32 comp_idx, bool reversible); - /***************************************************************************/ - class OJPH_EXPORT param_coc - { - public: - param_coc(local::param_cod* p) : state(p) {} - - void set_num_decomposition(ui32 num_decompositions); - void set_block_dims(ui32 width, ui32 height); - void set_precinct_size(int num_levels, size* precinct_size); - void set_reversible(bool reversible); - - ui32 get_num_decompositions() const; - size get_block_dims() const; - size get_log_block_dims() const; - bool is_reversible() const; - size get_precinct_size(ui32 level_num) const; - size get_log_precinct_size(ui32 level_num) const; - bool get_block_vertical_causality() const; + ui32 get_num_decompositions(ui32 comp_idx) const; + size get_block_dims(ui32 comp_idx) const; + size get_log_block_dims(ui32 comp_idx) const; + bool is_reversible(ui32 comp_idx) const; + size get_precinct_size(ui32 comp_idx, ui32 level_num) const; + size get_log_precinct_size(ui32 comp_idx, ui32 level_num) const; + bool get_block_vertical_causality(ui32 comp_idx) const; private: local::param_cod* state; @@ -157,7 +166,7 @@ namespace ojph { /***************************************************************************/ /** * @brief Quantization parameters object - * + * */ class OJPH_EXPORT param_qcd { @@ -171,25 +180,25 @@ namespace ojph { param_qcd(local::param_qcd* p) : state(p) {} /** - * @brief Set the irreversible quantization base delta. - * - * This represents the default base delta and influences QCD marker + * @brief Set the irreversible quantization base delta. + * + * This represents the default base delta and influences QCD marker * segment - * - * @param delta + * + * @param delta */ void set_irrev_quant(float delta); /** - * @brief Set the irreversible quantization base delta for a specific + * @brief Set the irreversible quantization base delta for a specific * component - * - * This represents the default base delta for component comp_idx, and + * + * This represents the default base delta for component comp_idx, and * influences QCC marker segment for the component, inserting one * if needed, which is usually the case. - * - * @param comp_idx - * @param delta + * + * @param comp_idx + * @param delta */ void set_irrev_quant(ui32 comp_idx, float delta); @@ -212,82 +221,82 @@ namespace ojph { /** * @brief non-linearity point transformation object * (implements NLT marker segment) - * - * There are a few things to know here. - * The NLT marker segment contains the nonlinearity type and the + * + * There are a few things to know here. + * The NLT marker segment contains the nonlinearity type and the * bit depth and signedness of the component to which it applies. - * There is the default component ALL_COMPS which applies to all + * There is the default component ALL_COMPS which applies to all * components unless it is overridden by another NLT segment marker. * The library checks that the settings make sense, and also make * sure that bit depth and signedness are correct, creating any missing * NLT marker segments in the process. * If all components have the same bit depth and signedness, and need - * nonlinearity type 3 (Binary Complement to Sign Magnitude Conversion), + * nonlinearity type 3 (Binary Complement to Sign Magnitude Conversion), * then the best option is to set ALL_COMPS to type 3. - * Otherwise, the best option is to set type 3 only to components that + * Otherwise, the best option is to set type 3 only to components that * need it, leaving out the default ALL_COMPS nonlinearity not set. - * Another option is for the end-user can set the ALL_COMPS to type 3, - * and then put exception for the components that does not need type 3, + * Another option is for the end-user can set the ALL_COMPS to type 3, + * and then put exception for the components that does not need type 3, * by setting them to type 0. - * + * * The library, during validity check, which is run when the codestream * is created for writing, will do the following: - * -- If ALL_COMPS is set to type 0, it will be ignored, and the + * -- If ALL_COMPS is set to type 0, it will be ignored, and the * codestream will NOT have the corresponding NLT marker segment. * -- If ALL_COMPS is set to type 3, then the following will happen: - * - If all the components (except those with type 0 set for them) have - * the same bit depth and signedness, then the ALL_COMPS NLT marker + * - If all the components (except those with type 0 set for them) have + * the same bit depth and signedness, then the ALL_COMPS NLT marker * segment will be respected and inserted into the codestream. * Of course, components with NLT 0 will also have the corresponding * NLT marker segment inserted. * - If components, for which no NTL type 0 is specified, have differing - * bit depth or signedness, then the ALL_COMPS will be ignored, and + * bit depth or signedness, then the ALL_COMPS will be ignored, and * NLT markers are inserted for each component that needs type 3. * Components that have their component field larger than the number of * components in the codestream are removed. - * - * It also worth noting that type 3 nonlinearity has no effect on - * positive image samples. It is also not recommended for integer-valued - * types. It is only recommended for floating-point image samples, for - * which some of the samples are negative, where type 3 nonlinearity - * should be beneficial. This is because the encoding engine expects - * two-complement representation for negative values while floating point - * numbers have a sign bit followed by an exponent, which has a biased + * + * It also worth noting that type 3 nonlinearity has no effect on + * positive image samples. It is also not recommended for integer-valued + * types. It is only recommended for floating-point image samples, for + * which some of the samples are negative, where type 3 nonlinearity + * should be beneficial. This is because the encoding engine expects + * two-complement representation for negative values while floating point + * numbers have a sign bit followed by an exponent, which has a biased * integer representation. The core idea is to make floating-point * representation more compatible with integer representation. - * + * */ class OJPH_EXPORT param_nlt { public: enum special_comp_num : ui16 { ALL_COMPS = 65535 }; - enum nonlinearity : ui8 { + enum nonlinearity : ui8 { OJPH_NLT_NO_NLT = 0, // supported OJPH_NLT_GAMMA_STYLE_NLT = 1, // not supported OJPH_NLT_LUT_STYLE_NLT = 2, // not supported OJPH_NLT_BINARY_COMPLEMENT_NLT = 3, // supported - OJPH_NLT_UNDEFINED = 255 // This is used internally and is - // not part of the standard + OJPH_NLT_UNDEFINED = 255 // This is used internally and is + // not part of the standard }; public: param_nlt(local::param_nlt* p) : state(p) {} /** - * @brief enables or disables type 3 nonlinearity for a component + * @brief enables or disables type 3 nonlinearity for a component * or the default setting - * + * * When creating a codestream for writing, call this function before * you call codestream::write_headers. - * - * + * + * * @param comp_num: component number, or 65535 for the default setting * @param type: desired non-linearity from enum nonlinearity */ void set_nonlinear_transform(ui32 comp_num, ui8 nl_type); /** - * @brief get the nonlinearity type associated with comp_num, which + * @brief get the nonlinearity type associated with comp_num, which * should be one from enum nonlinearity * * @param comp_num: component number, or 65535 for the default setting @@ -296,7 +305,7 @@ namespace ojph { * @param type: nonlinearity type * @return true if the nonlinearity for comp_num is set */ - bool get_nonlinear_transform(ui32 comp_num, ui8& bit_depth, + bool get_nonlinear_transform(ui32 comp_num, ui8& bit_depth, bool& is_signed, ui8& nl_type) const; private: diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 56e6ba35..1b6252b4 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -40,8 +40,21 @@ target_link_libraries( GTest::gtest_main ) +# configure QCD/QCC marker tests (library API tests) +add_executable( + test_mixed_coc + test_mixed_coc.cpp +) + +target_link_libraries( + test_mixed_coc + openjph + GTest::gtest_main +) + include(GoogleTest) gtest_add_tests(TARGET test_executables) +gtest_add_tests(TARGET test_mixed_coc) if (MSVC) add_custom_command(TARGET test_executables POST_BUILD diff --git a/tests/mixed_rev_irrev_4comp.j2c b/tests/mixed_rev_irrev_4comp.j2c new file mode 100644 index 0000000000000000000000000000000000000000..dfacd42f7e65cc6ee2913099f690b3cf3678e758 GIT binary patch literal 259 zcmezG|38qy$bkU}Km-WGfCG>L!Vtj1&d3Ny{{t8}7?^+(O8 +#include + +#include "ojph_mem.h" +#include "ojph_file.h" +#include "ojph_codestream.h" +#include "ojph_params.h" +#include "gtest/gtest.h" + +/////////////////////////////////////////////////////////////////////////////// +// Test encoding a 4-component image where 3 components use the irreversible +// (9/7) wavelet and 1 component uses the reversible (5/3) wavelet. +// This exercises COC and QCC marker generation for mixed coding modes. +// Verifies that encoding succeeds, headers can be read back, and the +// per-component coding settings are preserved. +TEST(TestMixedCOC, FourCompMixedReversibility) { + const ojph::ui32 width = 64; + const ojph::ui32 height = 64; + const ojph::ui32 num_comps = 4; + const ojph::ui32 bit_depth = 8; + const ojph::ui32 num_decomps = 5; + + // samples fed into component 3 during encoding, kept around so they can + // be compared against the decoded output further down + std::vector comp3_orig(width * height); + + // encode + { + ojph::codestream codestream; + + ojph::param_siz siz = codestream.access_siz(); + siz.set_image_extent(ojph::point(width, height)); + siz.set_num_components(num_comps); + for (ojph::ui32 c = 0; c < num_comps; ++c) + siz.set_component(c, ojph::point(1, 1), bit_depth, false); + siz.set_image_offset(ojph::point(0, 0)); + siz.set_tile_size(ojph::size(width, height)); + siz.set_tile_offset(ojph::point(0, 0)); + + ojph::param_cod cod = codestream.access_cod(); + cod.set_num_decomposition(num_decomps); + cod.set_block_dims(64, 64); + cod.set_color_transform(false); + cod.set_reversible(false); + + cod.set_reversible(3, true); + + codestream.access_qcd().set_irrev_quant(0.01f); + codestream.set_planar(true); + + ojph::j2c_outfile j2c_file; + j2c_file.open("mixed_rev_irrev_4comp.j2c"); + codestream.write_headers(&j2c_file); + + ojph::ui32 next_comp; + ojph::line_buf* cur_line = codestream.exchange(NULL, next_comp); + + for (ojph::ui32 c = 0; c < num_comps; ++c) + { + for (ojph::ui32 y = 0; y < height; ++y) + { + ASSERT_EQ(next_comp, c); + if (c == 3) + { + // non-constant pattern so a roundtrip mismatch would be caught + for (ojph::ui32 x = 0; x < width; ++x) + { + ojph::si32 val = (ojph::si32)((x + y * width) % 256); + cur_line->i32[x] = val; + comp3_orig[y * width + x] = val; + } + } + else if (cur_line->flags & ojph::line_buf::LFT_INTEGER) + memset(cur_line->i32, 0, + sizeof(ojph::si32) * cur_line->size); + else + memset(cur_line->f32, 0, + sizeof(float) * cur_line->size); + cur_line = codestream.exchange(cur_line, next_comp); + } + } + + codestream.flush(); + codestream.close(); + } + + // read back headers and verify per-component settings + { + ojph::codestream codestream; + ojph::j2c_infile j2c_file; + j2c_file.open("mixed_rev_irrev_4comp.j2c"); + codestream.read_headers(&j2c_file); + + ojph::param_siz siz = codestream.access_siz(); + EXPECT_EQ(siz.get_num_components(), num_comps); + for (ojph::ui32 c = 0; c < num_comps; ++c) + EXPECT_EQ(siz.get_bit_depth(c), bit_depth); + + ojph::param_cod cod = codestream.access_cod(); + EXPECT_FALSE(cod.is_reversible()); + + for (ojph::ui32 c = 0; c < 3; ++c) { + EXPECT_FALSE(cod.is_reversible(c)) + << "Component " << c << " should be irreversible"; + } + + EXPECT_TRUE(cod.is_reversible(3)) + << "Component 3 should be reversible"; + + // decode all components and verify component 3 (reversible) samples + // are identical to what was encoded + codestream.restrict_input_resolution(0, 0); + codestream.set_planar(true); + codestream.create(); + + for (ojph::ui32 c = 0; c < num_comps; ++c) + { + ojph::ui32 comp_height = siz.get_recon_height(c); + ojph::ui32 comp_width = siz.get_recon_width(c); + for (ojph::ui32 y = 0; y < comp_height; ++y) + { + ojph::ui32 comp_num; + ojph::line_buf* line = codestream.pull(comp_num); + ASSERT_EQ(comp_num, c); + if (c == 3) + { + ASSERT_EQ(comp_width, width); + for (ojph::ui32 x = 0; x < width; ++x) + EXPECT_EQ(line->i32[x], comp3_orig[y * width + x]) + << "Component 3 sample mismatch at (" << x << ", " << y << ")"; + } + } + } + + codestream.close(); + } +} + +//////////////////////////////////////////////////////////////////////////////// +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} From 462681703bc8c172ac7023475734abd72be7f6f4 Mon Sep 17 00:00:00 2001 From: Aous Naman Date: Thu, 2 Jul 2026 10:15:59 +1000 Subject: [PATCH 2/2] Changed the default creation behaviour of COC marker segment and removed an unneeded file. --- src/core/codestream/ojph_params_local.h | 17 +++++++---------- src/core/openjph/ojph_params.h | 14 ++++++-------- tests/mixed_rev_irrev_4comp.j2c | Bin 259 -> 0 bytes 3 files changed, 13 insertions(+), 18 deletions(-) delete mode 100644 tests/mixed_rev_irrev_4comp.j2c diff --git a/src/core/codestream/ojph_params_local.h b/src/core/codestream/ojph_params_local.h index dce65a36..40f41173 100644 --- a/src/core/codestream/ojph_params_local.h +++ b/src/core/codestream/ojph_params_local.h @@ -632,18 +632,15 @@ namespace ojph { type = top_cod ? COC_MAIN : COD_MAIN; Lcod = 0; Scod = 0; + SPcod = cod_SPcod(); // SPcod is initialized to default values next = NULL; atk = NULL; - if (top_cod) - { // Here we are initializing COC marker - // a freshly materialized COC inherits the COD's current - // settings at this very moment - // Lcod will be initialized on writing the marker segment to disk - Scod = top_cod->Scod & 0x1; // only the first bit is defined in COC - // SGcod does not exist in COC - SPcod = top_cod->SPcod; - atk = top_cod->atk; - } + // For COC marker segment: + // Lcod will be initialized on writing the marker segment to disk + // Scod is initialized to 0 + // SGcod does not exist in COC + // SPcoc is initialized to default values + // atk is initialized to NULL this->top_cod = top_cod; this->comp_idx = comp_idx; } diff --git a/src/core/openjph/ojph_params.h b/src/core/openjph/ojph_params.h index 345bbb6e..4c7dafbf 100644 --- a/src/core/openjph/ojph_params.h +++ b/src/core/openjph/ojph_params.h @@ -102,8 +102,8 @@ namespace ojph { * * The param_cod object uses Pimpl design. * The top set of functions give access to the COD marker segment, while - * the lower set, the ones that have comp_idx parameter, gives access to - * potentially COC marker segment. + * the lower set, the ones that have comp_idx as the first parameter, + * gives access to COC marker segment. * The functions: * - set_num_decomposition(ui32 comp_idx, ...) * - set_block_dims(ui32 comp_idx, ...) @@ -111,12 +111,10 @@ namespace ojph { * - set_reversible(ui32 comp_idx, ...) * create a COC segment on first call; subsequent calls to these * functions on the same component index will use the COC segment - * created by the first call. On first creation, the COC segment will - * inherit relevant COD segment properties at the moment of COC segment - * creation; therefore, you either configure COD first and rely on - * properties propagation to COC when it is first created, modifying these - * properties afterwards, or you create and configure COC segments as - * desired before finishing COD configuration. + * created by the first call. On first creation, the COC segment is + * initialized to the default COD settings; in particular, 5 levels of + * decomposition, 64x64 codeblocks, reversible 5/3 transform and no + * precinct size is defined, which gives 32768x32768 precincts. */ class OJPH_EXPORT param_cod { diff --git a/tests/mixed_rev_irrev_4comp.j2c b/tests/mixed_rev_irrev_4comp.j2c deleted file mode 100644 index dfacd42f7e65cc6ee2913099f690b3cf3678e758..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 259 zcmezG|38qy$bkU}Km-WGfCG>L!Vtj1&d3Ny{{t8}7?^+(O8