diff --git a/src/core/codestream/ojph_precinct.cpp b/src/core/codestream/ojph_precinct.cpp index f8d69fb..b7e25aa 100644 --- a/src/core/codestream/ojph_precinct.cpp +++ b/src/core/codestream/ojph_precinct.cpp @@ -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; diff --git a/src/core/codestream/ojph_resolution.cpp b/src/core/codestream/ojph_resolution.cpp index c450770..a0413b7 100644 --- a/src/core/codestream/ojph_resolution.cpp +++ b/src/core/codestream/ojph_resolution.cpp @@ -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(4); + for (int i = 0; i < 4; ++i) + new (bands + i) subband; if (res_num > 0) { this->num_bands = 3; diff --git a/src/core/codestream/ojph_subband.h b/src/core/codestream/ojph_subband.h index 9928c5e..34cc739 100644 --- a/src/core/codestream/ojph_subband.h +++ b/src/core/codestream/ojph_subband.h @@ -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,