Skip to content

Commit

Permalink
avx512 dwt implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
aous72 committed Apr 12, 2024
1 parent d1f505f commit 1c4a14c
Show file tree
Hide file tree
Showing 7 changed files with 855 additions and 73 deletions.
9 changes: 6 additions & 3 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 @@ -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
6 changes: 1 addition & 5 deletions src/core/common/ojph_arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,7 @@ namespace ojph {
////////////////////////////////////////////////////////////////////////////
// constants
////////////////////////////////////////////////////////////////////////////
#ifdef OJPH_ENABLE_INTEL_AVX512
const ui32 byte_alignment = 64; //64 bytes == 512 bits
#else
const ui32 byte_alignment = 32; //32 bytes == 256 bits
#endif
const ui32 byte_alignment = 64; // 64 bytes == 512 bits
const ui32 log_byte_alignment = 31 - count_leading_zeros(byte_alignment);
const ui32 object_alignment = 8;

Expand Down
24 changes: 13 additions & 11 deletions src/core/transform/ojph_transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,17 +145,19 @@ namespace ojph {
rev_horz_syn = avx2_rev_horz_syn;
}

//if (level >= X86_CPU_EXT_LEVEL_AVX512)
//{
// rev_vert_step = avx512_rev_vert_ana_step;
// rev_horz_ana = avx512_rev_horz_ana;
// rev_horz_syn = avx512_rev_horz_syn;

// irv_vert_step = avx512_irv_vert_step;
// irv_vert_times_K = avx512_irv_vert_times_K;
// irv_vert_syn_step = avx512_irv_vert_syn_step;
// irv_horz_syn = avx512_irv_horz_syn;
//}
#ifdef OJPH_ENABLE_INTEL_AVX512
if (level >= X86_CPU_EXT_LEVEL_AVX512)
{
rev_vert_step = avx512_rev_vert_step;
rev_horz_ana = avx512_rev_horz_ana;
rev_horz_syn = avx512_rev_horz_syn;

irv_vert_step = avx512_irv_vert_step;
irv_vert_times_K = avx512_irv_vert_times_K;
irv_horz_ana = avx512_irv_horz_ana;
irv_horz_syn = avx512_irv_horz_syn;
}
#endif // !OJPH_ENABLE_INTEL_AVX512

#endif // !OJPH_DISABLE_INTEL_SIMD

Expand Down
9 changes: 1 addition & 8 deletions src/core/transform/ojph_transform_avx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,7 @@ namespace ojph {
//////////////////////////////////////////////////////////////////////////
void avx_irv_vert_times_K(float K, const line_buf* aug, ui32 repeat)
{
__m256 factor = _mm256_set1_ps(K);
float* dst = aug->f32;
int i = (int)repeat;
for (; i > 0; i -= 8, dst += 8)
{
__m256 s = _mm256_load_ps(dst);
_mm256_store_ps(dst, _mm256_mul_ps(factor, s));
}
avx_multiply_const(aug->f32, K, (int)repeat);
}

/////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 0 additions & 2 deletions src/core/transform/ojph_transform_avx2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,5 @@ namespace ojph {
}
}



} // !local
} // !ojph
Loading

0 comments on commit 1c4a14c

Please sign in to comment.