Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding DFS support and partial support for ATK to support low-latency HTJ2K images. #134

Merged
merged 39 commits into from
Apr 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
508eb92
Added DFS and ATK, but not fully tested. Need to add COC. Integrate…
aous72 Mar 28, 2024
4648f91
This fixes an issue with the previous commit
aous72 Mar 28, 2024
1a5925f
More fixes
aous72 Mar 28, 2024
2b38785
Implemented COC. Linked ATK to COD/COC.
aous72 Mar 30, 2024
0363e40
Warning fix.
aous72 Mar 30, 2024
02f6967
More changes to param_atk.
aous72 Mar 31, 2024
32f17b5
A bug fix.
aous72 Mar 31, 2024
abe4ccf
Remove warnings.
aous72 Mar 31, 2024
fc377de
Warning/bug fix.
aous72 Mar 31, 2024
1c08cf3
Added COC. ATK is used for wavelet transform. Modified wavelet synthe…
aous72 Apr 2, 2024
2c74db3
Syntax error fix.
aous72 Apr 2, 2024
be39386
reversible analysis is working; irreversible not. More testing is ne…
aous72 Apr 3, 2024
3322061
Merge branch 'dfs_atk_support' of https://github.com/aous72/OpenJPH i…
aous72 Apr 3, 2024
06eab9e
Merge branch 'master' into dfs_atk_support
aous72 Apr 3, 2024
12c3bf5
Fixed 97 analysis.
aous72 Apr 4, 2024
4dc10b6
A bug fix. Still buggy.
aous72 Apr 4, 2024
9846f01
Small touchup for error messages
aous72 Apr 5, 2024
86b139d
This is a very important bug fix -- Empty subbands/precincts.
aous72 Apr 5, 2024
5599326
A small improvement.
aous72 Apr 6, 2024
0e0d41d
Corrected Tests.
aous72 Apr 6, 2024
6e9cfdc
All changes needed for DFS and ATK are done. Still some bugs.
aous72 Apr 8, 2024
c87d3e4
Small bug fix for previous commit.
aous72 Apr 8, 2024
b1c7157
A small bug fix
aous72 Apr 9, 2024
a18e7fb
Working on SIMD. SSE and AVX is largely done, except the core horizon…
aous72 Apr 10, 2024
fe24e55
Editorial + compilation fix + a potential bug fix
aous72 Apr 11, 2024
5e4b627
Syntax fix.
aous72 Apr 11, 2024
4b72faa
A bug fix.
aous72 Apr 11, 2024
1e9bc41
A bug fix
aous72 Apr 11, 2024
7faf457
completed sse and avx.
aous72 Apr 11, 2024
2a7ff07
Corrected code for reversible path. Simplified DWT code.
aous72 Apr 12, 2024
03ef77a
Completed sse, sse2, avx, avx2. Still wasm and avx512.
aous72 Apr 12, 2024
d1f505f
Addresses compilation warnings.
aous72 Apr 12, 2024
1c4a14c
avx512 dwt implemented
aous72 Apr 12, 2024
30b32cc
Fix compilation, and a missing optimization.
aous72 Apr 12, 2024
f28a90f
Wasm completed -- not tested yet.
aous72 Apr 13, 2024
21bc405
Wasm simd is buggy.
aous72 Apr 13, 2024
e40fa17
A small bug fix.
aous72 Apr 13, 2024
a92f921
Added one test.
aous72 Apr 13, 2024
9345152
Fixing tests.
aous72 Apr 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/apps/ojph_compress/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ source_group("others" FILES ${OJPH_IMG_IO})
source_group("common" FILES ${OJPH_IMG_IO_H})

if(EMSCRIPTEN)
add_compile_options(-std=c++11 -O3 -fexceptions -DOJPH_DISABLE_INTEL_SIMD)
add_compile_options(-std=c++11 -O3 -fexceptions)
add_link_options(-sWASM=1 -sASSERTIONS=1 -sALLOW_MEMORY_GROWTH=1 -sNODERAWFS=1 -sENVIRONMENT=node -sEXIT_RUNTIME=1 -sEXCEPTION_CATCHING_ALLOWED=['fake'])
add_executable(ojph_compress ${SOURCES})
add_executable(ojph_compress_simd ${SOURCES} ${OJPH_IMG_IO_SSE4})
target_compile_options(ojph_compress_simd PRIVATE -DOJPH_ENABLE_WASM_SIMD -msimd128 -msse4.1)
Expand Down
98 changes: 49 additions & 49 deletions src/apps/ojph_compress/ojph_compress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -917,55 +917,55 @@ int main(int argc, char * argv[]) {
}
else if (is_matching(".dpx", v))
{
dpx.open(input_filename);
ojph::param_siz siz = codestream.access_siz();
siz.set_image_extent(ojph::point(image_offset.x + dpx.get_size().w,
image_offset.y + dpx.get_size().h));
ojph::ui32 num_comps = dpx.get_num_components();
siz.set_num_components(num_comps);
//if (num_bit_depths > 0)
// dpx.set_bit_depth(num_bit_depths, bit_depth);
for (ojph::ui32 c = 0; c < num_comps; ++c)
siz.set_component(c, dpx.get_comp_subsampling(c),
dpx.get_bit_depth(c), dpx.get_is_signed(c));
siz.set_image_offset(image_offset);
siz.set_tile_size(tile_size);
siz.set_tile_offset(tile_offset);

ojph::param_cod cod = codestream.access_cod();
cod.set_num_decomposition(num_decompositions);
cod.set_block_dims(block_size.w, block_size.h);
if (num_precincts != -1)
cod.set_precinct_size(num_precincts, precinct_size);
cod.set_progression_order(prog_order);
if (employ_color_transform == -1 && num_comps >= 3)
cod.set_color_transform(true);
else
cod.set_color_transform(employ_color_transform == 1);
cod.set_reversible(reversible);
if (!reversible && quantization_step != -1)
codestream.access_qcd().set_irrev_quant(quantization_step);
codestream.set_planar(false);
if (profile_string[0] != '\0')
codestream.set_profile(profile_string);
codestream.set_tilepart_divisions(tileparts_at_resolutions,
tileparts_at_components);
codestream.request_tlm_marker(tlm_marker);

if (dims.w != 0 || dims.h != 0)
OJPH_WARN(0x01000071,
"-dims option is not needed and was not used\n");
if (num_components != 0)
OJPH_WARN(0x01000072,
"-num_comps is not needed and was not used\n");
if (is_signed[0] != -1)
OJPH_WARN(0x01000073,
"-signed is not needed and was not used\n");
if (comp_downsampling[0].x != 0 || comp_downsampling[0].y != 0)
OJPH_WARN(0x01000075,
"-downsamp is not needed and was not used\n");

base = &dpx;
dpx.open(input_filename);
ojph::param_siz siz = codestream.access_siz();
siz.set_image_extent(ojph::point(image_offset.x + dpx.get_size().w,
image_offset.y + dpx.get_size().h));
ojph::ui32 num_comps = dpx.get_num_components();
siz.set_num_components(num_comps);
//if (num_bit_depths > 0)
// dpx.set_bit_depth(num_bit_depths, bit_depth);
for (ojph::ui32 c = 0; c < num_comps; ++c)
siz.set_component(c, dpx.get_comp_subsampling(c),
dpx.get_bit_depth(c), dpx.get_is_signed(c));
siz.set_image_offset(image_offset);
siz.set_tile_size(tile_size);
siz.set_tile_offset(tile_offset);

ojph::param_cod cod = codestream.access_cod();
cod.set_num_decomposition(num_decompositions);
cod.set_block_dims(block_size.w, block_size.h);
if (num_precincts != -1)
cod.set_precinct_size(num_precincts, precinct_size);
cod.set_progression_order(prog_order);
if (employ_color_transform == -1 && num_comps >= 3)
cod.set_color_transform(true);
else
cod.set_color_transform(employ_color_transform == 1);
cod.set_reversible(reversible);
if (!reversible && quantization_step != -1)
codestream.access_qcd().set_irrev_quant(quantization_step);
codestream.set_planar(false);
if (profile_string[0] != '\0')
codestream.set_profile(profile_string);
codestream.set_tilepart_divisions(tileparts_at_resolutions,
tileparts_at_components);
codestream.request_tlm_marker(tlm_marker);

if (dims.w != 0 || dims.h != 0)
OJPH_WARN(0x01000071,
"-dims option is not needed and was not used\n");
if (num_components != 0)
OJPH_WARN(0x01000072,
"-num_comps is not needed and was not used\n");
if (is_signed[0] != -1)
OJPH_WARN(0x01000073,
"-signed is not needed and was not used\n");
if (comp_downsampling[0].x != 0 || comp_downsampling[0].y != 0)
OJPH_WARN(0x01000075,
"-downsamp is not needed and was not used\n");

base = &dpx;
}
else
#if defined( OJPH_ENABLE_TIFF_SUPPORT)
Expand Down
3 changes: 2 additions & 1 deletion src/apps/ojph_expand/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ source_group("others" FILES ${OJPH_IMG_IO})
source_group("common" FILES ${OJPH_IMG_IO_H})

if(EMSCRIPTEN)
add_compile_options(-std=c++11 -O3 -fexceptions -DOJPH_DISABLE_INTEL_SIMD)
add_compile_options(-std=c++11 -O3 -fexceptions)
add_link_options(-sWASM=1 -sASSERTIONS=1 -sALLOW_MEMORY_GROWTH=1 -sNODERAWFS=1 -sENVIRONMENT=node -sEXIT_RUNTIME=1 -sEXCEPTION_CATCHING_ALLOWED=['fake'])
add_executable(ojph_expand ${SOURCES})
add_executable(ojph_expand_simd ${SOURCES} ${OJPH_IMG_IO_SSE4})
target_compile_options(ojph_expand_simd PRIVATE -DOJPH_ENABLE_WASM_SIMD -msimd128 -msse4.1)
Expand Down
11 changes: 7 additions & 4 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ file(GLOB TRANSFORM_SSE "transform/*_sse.cpp")
file(GLOB TRANSFORM_SSE2 "transform/*_sse2.cpp")
file(GLOB TRANSFORM_AVX "transform/*_avx.cpp")
file(GLOB TRANSFORM_AVX2 "transform/*_avx2.cpp")
file(GLOB TRANSFORM_AVX512 "transform/*_avx512.cpp")
file(GLOB TRANSFORM_WASM "transform/*_wasm.cpp")

list(REMOVE_ITEM CODESTREAM ${CODESTREAM_SSE} ${CODESTREAM_SSE2} ${CODESTREAM_AVX} ${CODESTREAM_AVX2} ${CODESTREAM_WASM})
list(REMOVE_ITEM CODING ${CODING_SSSE3} ${CODING_WASM} ${CODING_AVX512})
list(REMOVE_ITEM TRANSFORM ${TRANSFORM_SSE} ${TRANSFORM_SSE2} ${TRANSFORM_AVX} ${TRANSFORM_AVX2} ${TRANSFORM_WASM})
list(REMOVE_ITEM TRANSFORM ${TRANSFORM_SSE} ${TRANSFORM_SSE2} ${TRANSFORM_AVX} ${TRANSFORM_AVX2} ${TRANSFORM_AVX512} ${TRANSFORM_WASM})
list(APPEND SOURCES ${CODESTREAM} ${CODING} ${COMMON} ${OTHERS} ${TRANSFORM})

source_group("codestream" FILES ${CODESTREAM})
Expand All @@ -32,7 +33,7 @@ source_group("others" FILES ${OTHERS})
source_group("transform" FILES ${TRANSFORM})

if(EMSCRIPTEN)
add_compile_options(-std=c++11 -O3 -fexceptions -DOJPH_DISABLE_INTEL_SIMD)
add_compile_options(-std=c++11 -O3 -fexceptions)
add_library(openjph ${SOURCES})
add_library(openjphsimd ${SOURCES} ${CODESTREAM_WASM} ${CODING_WASM} ${TRANSFORM_WASM})
target_include_directories(openjph PUBLIC common)
Expand All @@ -42,10 +43,10 @@ if(EMSCRIPTEN)
source_group("coding" FILES ${CODING_WASM})
source_group("transform" FILES ${TRANSFORM_WASM})
elseif(NOT OJPH_DISABLE_INTEL_SIMD)
add_library(openjph ${SOURCES} ${CODESTREAM_SSE} ${CODESTREAM_SSE2} ${CODESTREAM_AVX} ${CODESTREAM_AVX2} ${CODING_SSSE3} ${TRANSFORM_SSE} ${TRANSFORM_SSE2} ${TRANSFORM_AVX} ${TRANSFORM_AVX2})
add_library(openjph ${SOURCES} ${CODESTREAM_SSE} ${CODESTREAM_SSE2} ${CODESTREAM_AVX} ${CODESTREAM_AVX2} ${CODING_SSSE3} ${TRANSFORM_SSE} ${TRANSFORM_SSE2} ${TRANSFORM_AVX} ${TRANSFORM_AVX2} ${TRANSFORM_AVX512})
source_group("codestream" FILES ${CODESTREAM_SSE} ${CODESTREAM_SSE2} ${CODESTREAM_AVX} ${CODESTREAM_AVX2})
source_group("coding" FILES ${CODING_SSSE3})
source_group("transform" FILES ${TRANSFORM_SSE} ${TRANSFORM_SSE2} ${TRANSFORM_AVX} ${TRANSFORM_AVX2})
source_group("transform" FILES ${TRANSFORM_SSE} ${TRANSFORM_SSE2} ${TRANSFORM_AVX} ${TRANSFORM_AVX2} ${TRANSFORM_AVX512})
if (OJPH_ENABLE_INTEL_AVX512)
target_sources(openjph PRIVATE ${CODING_AVX512})
source_group("coding" FILES ${CODING_AVX512})
Expand All @@ -71,6 +72,7 @@ if (MSVC)
set_source_files_properties(transform/ojph_colour_avx2.cpp PROPERTIES COMPILE_FLAGS "/arch:AVX2")
set_source_files_properties(transform/ojph_transform_avx.cpp PROPERTIES COMPILE_FLAGS "/arch:AVX")
set_source_files_properties(transform/ojph_transform_avx2.cpp PROPERTIES COMPILE_FLAGS "/arch:AVX2")
set_source_files_properties(transform/ojph_transform_avx512.cpp PROPERTIES COMPILE_FLAGS "/arch:AVX512")
else()
set_source_files_properties(codestream/ojph_codestream_avx.cpp PROPERTIES COMPILE_FLAGS -mavx)
set_source_files_properties(codestream/ojph_codestream_avx2.cpp PROPERTIES COMPILE_FLAGS -mavx2)
Expand All @@ -80,6 +82,7 @@ else()
set_source_files_properties(transform/ojph_colour_avx2.cpp PROPERTIES COMPILE_FLAGS -mavx2)
set_source_files_properties(transform/ojph_transform_avx.cpp PROPERTIES COMPILE_FLAGS -mavx)
set_source_files_properties(transform/ojph_transform_avx2.cpp PROPERTIES COMPILE_FLAGS -mavx2)
set_source_files_properties(transform/ojph_transform_avx512.cpp PROPERTIES COMPILE_FLAGS -mavx512f)
endif()

if (MSVC)
Expand Down
12 changes: 7 additions & 5 deletions src/core/codestream/ojph_codeblock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,14 @@ namespace ojph {
cb_size.w, cb_size.h, stride, stripe_causal);

if (result == false)
{
if (resilient == true)
zero_block = true;
else
OJPH_ERROR(0x000300A1, "Error decoding a codeblock\n");
{
if (resilient == true) {
OJPH_INFO(0x000300A1, "Error decoding a codeblock");
zero_block = true;
}
else
OJPH_ERROR(0x000300A1, "Error decoding a codeblock");
}
}
else
zero_block = true;
Expand Down