Skip to content

Commit

Permalink
Merge pull request #120 from bradh/tilepart_accessors_2024-01-12
Browse files Browse the repository at this point in the history
add accessors for tilepart division
  • Loading branch information
aous72 authored Jan 12, 2024
2 parents 3b78417 + 8cb0d2b commit 4a4a4d4
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
14 changes: 14 additions & 0 deletions src/core/codestream/ojph_codestream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,20 @@ namespace ojph {
state->set_tilepart_divisions(value);
}

////////////////////////////////////////////////////////////////////////////
bool codestream::is_tilepart_division_at_resolutions()
{
ui32 res = state->get_tilepart_div() & OJPH_TILEPART_RESOLUTIONS;
return res ? true : false;
}

////////////////////////////////////////////////////////////////////////////
bool codestream::is_tilepart_division_at_components()
{
ui32 comp = state->get_tilepart_div() & OJPH_TILEPART_COMPONENTS;
return comp ? true : false;
}

////////////////////////////////////////////////////////////////////////////
void codestream::request_tlm_marker(bool needed)
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/codestream/ojph_codestream_local.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace ojph {
employ_color_transform = false;
planar = -1;
profile = OJPH_PN_UNDEFINED;
tilepart_div = OJPH_TILEPART_NODIVSIONS;
tilepart_div = OJPH_TILEPART_NO_DIVISIONS;
need_tlm = false;

cur_comp = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/core/codestream/ojph_params_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ namespace ojph {
const char OJPH_PN_STRING_IMF[] = "IMF";

////////////////////////////////////////////////////////////////////////////
enum OJPH_TILEPART_DIVISONS: ui32 {
OJPH_TILEPART_NODIVSIONS = 0x0, // no divisions to tile parts
enum OJPH_TILEPART_DIVISIONS: ui32 {
OJPH_TILEPART_NO_DIVISIONS = 0x0, // no divisions to tile parts
OJPH_TILEPART_RESOLUTIONS = 0x1,
OJPH_TILEPART_COMPONENTS = 0x2,
OJPH_TILEPART_LAYERS = 0x4, // these are meaningless with HTJ2K
Expand Down
6 changes: 3 additions & 3 deletions src/core/codestream/ojph_tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ namespace ojph {
//////////////////////////////////////////////////////////////////////////
void tile::fill_tlm(param_tlm *tlm)
{
if (tilepart_div == OJPH_TILEPART_NODIVSIONS) {
if (tilepart_div == OJPH_TILEPART_NO_DIVISIONS) {
tlm->set_next_pair(sot.get_tile_index(), this->num_bytes);
}
else if (tilepart_div == OJPH_TILEPART_RESOLUTIONS)
Expand Down Expand Up @@ -471,7 +471,7 @@ namespace ojph {
max_decompositions = ojph_max(max_decompositions,
comps[c].get_num_decompositions());

if (tilepart_div == OJPH_TILEPART_NODIVSIONS)
if (tilepart_div == OJPH_TILEPART_NO_DIVISIONS)
{
//write tile header
if (!sot.write(file, this->num_bytes))
Expand All @@ -487,7 +487,7 @@ namespace ojph {
//sequence the writing of precincts according to progression order
if (prog_order == OJPH_PO_LRCP || prog_order == OJPH_PO_RLCP)
{
if (tilepart_div == OJPH_TILEPART_NODIVSIONS)
if (tilepart_div == OJPH_TILEPART_NO_DIVISIONS)
{
for (ui32 r = 0; r <= max_decompositions; ++r)
for (ui32 c = 0; c < num_comps; ++c)
Expand Down
5 changes: 5 additions & 0 deletions src/core/common/ojph_codestream.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ namespace ojph {
void set_profile(const char* s);
OJPH_EXPORT
void set_tilepart_divisions(bool at_resolutions, bool at_components);
OJPH_EXPORT
bool is_tilepart_division_at_resolutions();
OJPH_EXPORT
bool is_tilepart_division_at_components();

OJPH_EXPORT
void request_tlm_marker(bool needed);
OJPH_EXPORT
Expand Down

0 comments on commit 4a4a4d4

Please sign in to comment.