From 67460927cbe65ba216f6b4db49112dd61d2bef9a Mon Sep 17 00:00:00 2001 From: OSAMU WATANABE Date: Fri, 15 Nov 2024 11:43:39 +0900 Subject: [PATCH] - Fix incorrect packet parsing for RPCL, PCRL, CPRL - Change cmake configuration for MIngW environments --- CHANGELOG | 6 ++++++ CMakeLists.txt | 4 +--- source/core/coding/coding_units.cpp | 14 +++++--------- source/core/common/open_htj2k_version.hpp | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index df24fd7..0306b68 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ +# [0.2.8] - 2024-11-12 + +* Fix incorrect packet parsing for RPCL, PCRL, CPRL +* Introduce stride access into DWT +* Change cmake configuration for MinGW environments + # [0.2.7] - 2024-06-13 * Refactor non-SIMD HT cleanup decoding diff --git a/CMakeLists.txt b/CMakeLists.txt index b3de7a1..b73d1c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,9 +153,7 @@ endif() if(NOT EMSCRIPTEN) if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^[xX]86_64$|^[aA][mM][dD]64$") # x86_64 - if(NOT MINGW) - option(ENABLE_AVX2 "Enable the use of Intel AVX2 intrinsics" ON) - endif() + option(ENABLE_AVX2 "Enable the use of Intel AVX2 intrinsics" ON) if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX2 /EHsc /D \"_CRT_SECURE_NO_WARNINGS\"") diff --git a/source/core/coding/coding_units.cpp b/source/core/coding/coding_units.cpp index eb8af08..555f495 100644 --- a/source/core/coding/coding_units.cpp +++ b/source/core/coding/coding_units.cpp @@ -551,9 +551,7 @@ void j2k_precinct_subband::parse_packet_header(buf_chain *packet_header, uint16_ if (!(block->Cmodes & HT_MIXED)) { // Must be the first HT Cleanup pass if (segment_bytes < 2) { - printf( - "ERROR: Length information for a HT-codeblock is " - "invalid\n"); + printf("ERROR: Length information for a HT-codeblock is invalid\n"); throw std::exception(); } next_segment_passes = 2; @@ -595,9 +593,7 @@ void j2k_precinct_subband::parse_packet_header(buf_chain *packet_header, uint16_ if (block->Cmodes & HT_MIXED) { block->Cmodes &= static_cast(~(HT_PHLD | HT)); } else { - printf( - "ERROR: Length information for a HT-codeblock is " - "invalid\n"); + printf("ERROR: Length information for a HT-codeblock is invalid\n"); throw std::exception(); } } @@ -1402,7 +1398,7 @@ void j2k_tile_component::init(j2k_main_header *hdr, j2k_tilepart_header *tphdr, const uint32_t aligned_stride = round_up((ceil_int(pos1.x, 1U << tile->reduce_NL) - ceil_int(pos0.x, 1U << tile->reduce_NL)), 32U); const auto height = static_cast(ceil_int(pos1.y, 1U << tile->reduce_NL) - - ceil_int(pos0.y, 1U << tile->reduce_NL)); + - ceil_int(pos0.y, 1U << tile->reduce_NL)); const uint32_t num_bufsamples = aligned_stride * height; samples = static_cast(aligned_mem_alloc(sizeof(int32_t) * num_bufsamples, 32)); @@ -2459,7 +2455,7 @@ void j2k_tile::decode() { #endif } } // end of codeblock loop - } // end of subbnad loop + } // end of subbnad loop #ifdef OPENHTJ2K_THREAD for (auto &result : results) { result.get(); @@ -2667,7 +2663,7 @@ void j2k_tile::find_gcd_of_precinct_size(element_siz &out) { for (uint8_t r = 0; r <= this->tcomp[c].get_dwt_levels(); r++) { PP = this->tcomp[c].get_precinct_size(r); PPx = (PPx > PP.x) ? static_cast(PP.x) : PPx; - PPy = (PPy > PP.y) ? static_cast(PP.y) : PPx; + PPy = (PPy > PP.y) ? static_cast(PP.y) : PPy; } } out.x = PPx; diff --git a/source/core/common/open_htj2k_version.hpp b/source/core/common/open_htj2k_version.hpp index 028a808..ead0ea1 100644 --- a/source/core/common/open_htj2k_version.hpp +++ b/source/core/common/open_htj2k_version.hpp @@ -28,4 +28,4 @@ #define OPENHTJ2K_VERSION_MAJOR 0 #define OPENHTJ2K_VERSION_MINOR 2 -#define OPENHTJ2K_VERSION_PATCH 7 +#define OPENHTJ2K_VERSION_PATCH 8