Skip to content

Commit

Permalink
This is a very important bug fix -- Empty subbands/precincts.
Browse files Browse the repository at this point in the history
  • Loading branch information
aous72 committed Apr 5, 2024
1 parent 9846f01 commit 86b139d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
24 changes: 24 additions & 0 deletions src/core/codestream/ojph_precinct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,30 @@ namespace ojph {
if (may_use_sop)
bb_skip_sop(&bb);

if (num_bands == 3)
{
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;
}
}


int sst = num_bands == 3 ? 1 : 0;
int send = num_bands == 3 ? 4 : 1;
bool empty_packet = true;
Expand Down
2 changes: 1 addition & 1 deletion src/core/codestream/ojph_precinct.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ namespace ojph {
ui32& data_left, infile_base *file, bool skipped);

ui8 *scratch;
point img_point; //the precinct projected to full resolution
point img_point; //the precinct projected to full resolution
rect cb_idxs[4]; //indices of codeblocks
subband *bands; //the subbands
coded_lists* coded;
Expand Down

0 comments on commit 86b139d

Please sign in to comment.