Skip to content

Commit

Permalink
A small improvement.
Browse files Browse the repository at this point in the history
  • Loading branch information
aous72 committed Apr 6, 2024
1 parent 86b139d commit 5599326
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 21 deletions.
27 changes: 6 additions & 21 deletions src/core/codestream/ojph_precinct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,30 +332,15 @@ namespace ojph {
if (may_use_sop)
bb_skip_sop(&bb);

if (num_bands == 3)
if (bands[0].empty && bands[1].empty && bands[2].empty && bands[3].empty)
{
if (bands[1].empty && bands[2].empty && bands[3].empty)
{
ui32 bit = 0;
bb_read_bit(&bb, bit);
bb_terminate(&bb, uses_eph);
assert(bit == 0);
return;
}
}
else
{
if (bands[0].empty)
{
ui32 bit = 0;
bb_read_bit(&bb, bit);
bb_terminate(&bb, uses_eph);
assert(bit == 0);
return;
}
ui32 bit = 0;
bb_read_bit(&bb, bit);
bb_terminate(&bb, uses_eph);
assert(bit == 0);
return;
}


int sst = num_bands == 3 ? 1 : 0;
int send = num_bands == 3 ? 4 : 1;
bool empty_packet = true;
Expand Down
2 changes: 2 additions & 0 deletions src/core/codestream/ojph_resolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ namespace ojph {
ui32 trx1 = res_rect.org.x + res_rect.siz.w;
ui32 try1 = res_rect.org.y + res_rect.siz.h;
bands = allocator->post_alloc_obj<subband>(4);
for (int i = 0; i < 4; ++i)
new (bands + i) subband;
if (res_num > 0)
{
this->num_bands = 3;
Expand Down
2 changes: 2 additions & 0 deletions src/core/codestream/ojph_subband.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ namespace ojph {
{
friend struct precinct;
public:
subband() { memset(this, 0, sizeof(subband)); empty = true; }

static void pre_alloc(codestream *codestream, const rect& band_rect,
ui32 comp_num, ui32 res_num);
void finalize_alloc(codestream *codestream, const rect& band_rect,
Expand Down

0 comments on commit 5599326

Please sign in to comment.