diff --git a/src/apps/ojph_compress/ojph_compress.cpp b/src/apps/ojph_compress/ojph_compress.cpp index fcaea07..0c4aa0e 100644 --- a/src/apps/ojph_compress/ojph_compress.cpp +++ b/src/apps/ojph_compress/ojph_compress.cpp @@ -538,27 +538,25 @@ int main(int argc, char * argv[]) { " compression; quantization steps size for all subbands are\n" " derived from this value. {The default value for 8bit\n" " images is 0.0039}\n" - " -reversible (false) for irreversible; this should be false to perform\n" - " lossy compression using the 9/7 wavelet transform;\n" - " or true to perform reversible compression, where\n" - " the 5/3 wavelet is employed with lossless compression.\n" - " -colour_trans (true) this option employs a color transform, to\n" - " transform RGB color images into the YUV domain.\n" - " This option should not be used with YUV images, because\n" + " -reversible If this is 'false', an irreversible or\n" + " lossy compression is employed, using the 9/7 wavelet\n" + " transform; if 'true', a reversible compression is\n" + " performed, where the 5/3 wavelet is used.\n" + " Default value is 'false'.\n" + " -colour_trans This option employs a color transform,\n" + " to transform RGB color images into the YUV domain.\n" + " This option should NOT be used with YUV images, because\n" " they have already been transformed.\n" " If there are three color components that are\n" - " downsampled by the same amount then the color transform\n" - " can be true or false. This option is also available\n" - " when there are more than three colour components,\n" - " where it is applied to the first three colour\n" - " components.\n" - " it has already been applied to convert the original RGB\n" - " or whatever the original format to YUV.\n" + " downsampled by the same amount then this option can be\n" + " 'true' or 'false'. This option is also available when\n" + " there are more than three colour components, where it is\n" + " applied to the first three colour components.\n" " -prog_order (RPCL) is the progression order, and can be one of:\n" - " LRCP, RLCP, RPCL, PCRL, CPRL\n" + " LRCP, RLCP, RPCL, PCRL, CPRL.\n" " -block_size {x,y} (64,64) where x and y are the height and width of\n" " a codeblock. In unix-like environment, { and } must be\n" - " preceded by a ""\\""\n" + " preceded by a ""\\"".\n" " -precincts {x,y},{x,y},...,{x,y} where {x,y} is the precinct size\n" " starting from the coarsest resolution; the last precinct\n" " is repeated for all finer resolutions\n" @@ -568,14 +566,15 @@ int main(int argc, char * argv[]) { " -tileparts (None) employ tilepart divisions at each resolution, \n" " indicated by the letter R, and/or component, indicated \n" " by the letter C. For both, use \"-tileparts RC\".\n" - " -tlm_marker (false) insert a TLM marker, either \"true\" or \"false\"\n" + " -tlm_marker if 'true', a TLM marker is inserted.\n" + " Default value is false.\n" " -profile (None) is the profile, the code will check if the \n" " selected options meet the profile. Currently only \n" " BROADCAST and IMF are supported. This automatically \n" " sets tlm_marker to true and tileparts to C.\n" " -com (None) if set, inserts a COM marker with the specified\n" " string. If the string has spaces, please use\n" - " double quotes, as in -com \"This is a comment\"\n" + " double quotes, as in -com \"This is a comment\".\n" "\n" "When the input file is a YUV file, these arguments need to be \n" diff --git a/src/apps/ojph_expand/ojph_expand.cpp b/src/apps/ojph_expand/ojph_expand.cpp index 3e86a4f..7d6f3d5 100644 --- a/src/apps/ojph_expand/ojph_expand.cpp +++ b/src/apps/ojph_expand/ojph_expand.cpp @@ -187,8 +187,10 @@ int main(int argc, char *argv[]) { " number of skipped resolution for reconstruction, which is\n" " either equal to the first or smaller. If the second is not\n" " specified, it is made to equal to the first.\n" - " -resilient true if you want the decoder to be more tolerant of errors\n" - " in the codestream\n\n" + " -resilient if 'true', the decoder will not exit when\n" + " running into recoverable errors in the codestream.\n" + " Default: 'false'.\n" + "\n" ; return -1; } diff --git a/src/core/codestream/ojph_codestream_local.cpp b/src/core/codestream/ojph_codestream_local.cpp index e9f56d0..8279466 100644 --- a/src/core/codestream/ojph_codestream_local.cpp +++ b/src/core/codestream/ojph_codestream_local.cpp @@ -719,7 +719,7 @@ namespace ojph { { OJPH_ERROR(0x00030001, "%s", msg); } - else + else // there is the option of ALL_MSG but it should not be used here assert(0); } return 0; diff --git a/src/core/common/ojph_message.h b/src/core/common/ojph_message.h index 2271d0f..0064054 100644 --- a/src/core/common/ojph_message.h +++ b/src/core/common/ojph_message.h @@ -51,10 +51,11 @@ namespace ojph { */ enum OJPH_MSG_LEVEL : int { - NO_MSG = 0, - INFO = 1, - WARN = 2, - ERROR = 3 + ALL_MSG = 0, // uninitialized or print all message + INFO = 1, // info message + WARN = 2, // warning message + ERROR = 3, // error message (the highest severity) + NO_MSG = 4, // no message (higher severity for message printing only) }; ////////////////////////////////////////////////////////////////////////////// @@ -251,6 +252,16 @@ namespace ojph { */ OJPH_EXPORT message_error* get_error(); + + ////////////////////////////////////////////////////////////////////////////// + /** + * @brief Sets the minimum severity of the message to be reported. + * + * @param level is the level of the message severity; values are defined in + * OJPH_MSG_LEVEL. + */ + OJPH_EXPORT + void set_message_level(OJPH_MSG_LEVEL level); } ////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/common/ojph_version.h b/src/core/common/ojph_version.h index 7169d7d..593d4b7 100644 --- a/src/core/common/ojph_version.h +++ b/src/core/common/ojph_version.h @@ -34,5 +34,5 @@ //***************************************************************************/ #define OPENJPH_VERSION_MAJOR 0 -#define OPENJPH_VERSION_MINOR 14 -#define OPENJPH_VERSION_PATCH 2 +#define OPENJPH_VERSION_MINOR 15 +#define OPENJPH_VERSION_PATCH 0 diff --git a/src/core/others/ojph_message.cpp b/src/core/others/ojph_message.cpp index 9da0f17..6f91f74 100644 --- a/src/core/others/ojph_message.cpp +++ b/src/core/others/ojph_message.cpp @@ -35,6 +35,7 @@ // Date: 29 August 2019 //***************************************************************************/ +#include #include #include #include @@ -49,6 +50,7 @@ namespace ojph { //////////////////////////////////////////////////////////////////////////// message_info info; message_info* local_info = &info; + OJPH_MSG_LEVEL message_level = OJPH_MSG_LEVEL::ALL_MSG; //////////////////////////////////////////////////////////////////////////// void configure_info(message_info* info) @@ -72,7 +74,7 @@ namespace ojph { void message_info::operator()(int info_code, const char* file_name, int line_num, const char* fmt, ...) { - if (info_stream == NULL) + if (info_stream == NULL || message_level > OJPH_MSG_LEVEL::INFO) return; fprintf(info_stream, "ojph info 0x%08X at %s:%d: ", @@ -113,7 +115,7 @@ namespace ojph { void message_warning::operator()(int warn_code, const char* file_name, int line_num, const char *fmt, ...) { - if (warning_stream == NULL) + if (warning_stream == NULL || message_level > OJPH_MSG_LEVEL::WARN) return; fprintf(warning_stream, "ojph warning 0x%08X at %s:%d: ", @@ -154,7 +156,7 @@ namespace ojph { void message_error::operator()(int error_code, const char* file_name, int line_num, const char *fmt, ...) { - if (error_stream != NULL) + if (error_stream != NULL && message_level <= OJPH_MSG_LEVEL::ERROR) { fprintf(error_stream, "ojph error 0x%08X at %s:%d: ", error_code, file_name, line_num); @@ -167,4 +169,13 @@ namespace ojph { throw std::runtime_error("ojph error"); } + + //////////////////////////////////////////////////////////////////////////// + void set_message_level(OJPH_MSG_LEVEL level) + { + assert(level >= OJPH_MSG_LEVEL::ALL_MSG && + level <= OJPH_MSG_LEVEL::NO_MSG); + message_level = level; + } + } diff --git a/subprojects/js/CMakeLists.txt b/subprojects/js/CMakeLists.txt index ff7162b..b6a8c58 100644 --- a/subprojects/js/CMakeLists.txt +++ b/subprojects/js/CMakeLists.txt @@ -9,11 +9,11 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../html) add_subdirectory("../.." openjph EXCLUDE_FROM_ALL) add_executable(libopenjph "src/ojph_wrapper.cpp") -set_target_properties(libopenjph PROPERTIES SUFFIX ".js" LINK_FLAGS "-O3 -s WASM=1 -s EXPORT_ES6=1 -s MODULARIZE=1 -s ENVIRONMENT=web -s EXPORTED_FUNCTIONS=[_free,_malloc] -s EXPORTED_RUNTIME_METHODS=[ccall,cwrap,writeArrayToMemory] -s NO_EXIT_RUNTIME=1 -s ALLOW_MEMORY_GROWTH=1 -s INITIAL_MEMORY=134217728") +set_target_properties(libopenjph PROPERTIES SUFFIX ".js" LINK_FLAGS "-O3 -fexceptions -s WASM=1 -s EXPORT_ES6=1 -s MODULARIZE=1 -s ENVIRONMENT=web -s EXPORTED_FUNCTIONS=[_free,_malloc] -s EXPORTED_RUNTIME_METHODS=[ccall,cwrap,writeArrayToMemory] -s NO_EXIT_RUNTIME=1 -s ALLOW_MEMORY_GROWTH=1 -s INITIAL_MEMORY=134217728") target_link_libraries(libopenjph PRIVATE openjph) add_executable(libopenjph_simd "src/ojph_wrapper.cpp" ) target_compile_options(libopenjph_simd PRIVATE -DOJPH_ENABLE_WASM_SIMD -msimd128) -set_target_properties(libopenjph_simd PROPERTIES SUFFIX ".js" LINK_FLAGS "-O3 -s WASM=1 -s EXPORT_ES6=1 -s MODULARIZE=1 -s ENVIRONMENT=web -s EXPORTED_FUNCTIONS=[_free,_malloc] -s EXPORTED_RUNTIME_METHODS=[ccall,cwrap,writeArrayToMemory] -s NO_EXIT_RUNTIME=1 -s ALLOW_MEMORY_GROWTH=1 -s INITIAL_MEMORY=134217728") +set_target_properties(libopenjph_simd PROPERTIES SUFFIX ".js" LINK_FLAGS "-O3 -fexceptions -s WASM=1 -s EXPORT_ES6=1 -s MODULARIZE=1 -s ENVIRONMENT=web -s EXPORTED_FUNCTIONS=[_free,_malloc] -s EXPORTED_RUNTIME_METHODS=[ccall,cwrap,writeArrayToMemory] -s NO_EXIT_RUNTIME=1 -s ALLOW_MEMORY_GROWTH=1 -s INITIAL_MEMORY=134217728") target_link_libraries(libopenjph_simd PRIVATE openjphsimd)