Skip to content

Commit

Permalink
Merge branch 'aous72:master' into feature/add-openexr-support
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldsmith authored Jan 15, 2025
2 parents 47474b3 + 579d7dd commit 0c1dc13
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 30 deletions.
6 changes: 3 additions & 3 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ if(EMSCRIPTEN)
add_library(openjph ${SOURCES})
add_library(openjphsimd ${SOURCES} ${CODESTREAM_WASM} ${CODING_WASM} ${TRANSFORM_WASM})

target_include_directories(openjph PUBLIC common)
target_include_directories(openjphsimd PUBLIC common)
target_include_directories(openjph PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/common> $<INSTALL_INTERFACE:include>)
target_include_directories(openjphsimd PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/common> $<INSTALL_INTERFACE:include>)

target_compile_options(openjphsimd PRIVATE -DOJPH_ENABLE_WASM_SIMD -msimd128)

Expand Down Expand Up @@ -124,7 +124,7 @@ if (BUILD_SHARED_LIBS AND WIN32)
endif()

## include library version/name
target_include_directories(openjph PUBLIC common)
target_include_directories(openjph PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/common> $<INSTALL_INTERFACE:include>)
target_compile_definitions(openjph PUBLIC _FILE_OFFSET_BITS=64)

if (MSVC)
Expand Down
28 changes: 28 additions & 0 deletions src/core/codestream/ojph_params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,34 @@ namespace ojph {
//
//////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////
void param_qcd::check_validity(const param_siz& siz, const param_cod& cod)
{
ui32 num_decomps = cod.get_num_decompositions();
num_subbands = 1 + 3 * num_decomps;
if (cod.get_wavelet_kern() == param_cod::DWT_REV53)
{
ui32 bit_depth = 0;
for (ui32 i = 0; i < siz.get_num_components(); ++i)
bit_depth = ojph_max(bit_depth, siz.get_bit_depth(i));
set_rev_quant(num_decomps, bit_depth,
cod.is_employing_color_transform());
}
else if (cod.get_wavelet_kern() == param_cod::DWT_IRV97)
{
if (base_delta == -1.0f) {
ui32 bit_depth = 0;
for (ui32 i = 0; i < siz.get_num_components(); ++i)
bit_depth =
ojph_max(bit_depth, siz.get_bit_depth(i) + siz.is_signed(i));
base_delta = 1.0f / (float)(1 << bit_depth);
}
set_irrev_quant(num_decomps);
}
else
assert(0);
}

//////////////////////////////////////////////////////////////////////////
void param_qcd::set_rev_quant(ui32 num_decomps, ui32 bit_depth,
bool is_employing_color_transform)
Expand Down
30 changes: 3 additions & 27 deletions src/core/codestream/ojph_params_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,8 @@ namespace ojph {
}

//check the progression order matches downsampling
if (SGCod.prog_order == 2 || SGCod.prog_order == 3)
if (SGCod.prog_order == OJPH_PO_RPCL ||
SGCod.prog_order == OJPH_PO_PCRL)
{
ui32 num_comps = siz.get_num_components();
for (ui32 i = 0; i < num_comps; ++i)
Expand Down Expand Up @@ -606,33 +607,8 @@ namespace ojph {
}

void set_delta(float delta) { base_delta = delta; }
void check_validity(const param_siz& siz, const param_cod& cod);

void check_validity(const param_siz& siz, const param_cod& cod)
{
ui32 num_decomps = cod.get_num_decompositions();
num_subbands = 1 + 3 * num_decomps;
if (cod.get_wavelet_kern() == param_cod::DWT_REV53)
{
ui32 bit_depth = 0;
for (ui32 i = 0; i < siz.get_num_components(); ++i)
bit_depth = ojph_max(bit_depth, siz.get_bit_depth(i));
set_rev_quant(num_decomps, bit_depth,
cod.is_employing_color_transform());
}
else if (cod.get_wavelet_kern() == param_cod::DWT_IRV97)
{
if (base_delta == -1.0f) {
ui32 bit_depth = 0;
for (ui32 i = 0; i < siz.get_num_components(); ++i)
bit_depth =
ojph_max(bit_depth, siz.get_bit_depth(i) + siz.is_signed(i));
base_delta = 1.0f / (float)(1 << bit_depth);
}
set_irrev_quant(num_decomps);
}
else
assert(0);
}
ui32 get_num_guard_bits() const;
ui32 get_MAGBp() const;
ui32 get_Kmax(const param_dfs* dfs, ui32 num_decompositions,
Expand Down

0 comments on commit 0c1dc13

Please sign in to comment.