Skip to content

Commit e366f55

Browse files
author
Grok Compression
committed
Revive SchedulerFreebyrd with full T1+DWT+MCT pipeline
Implement the freebyrd scheduler as a working alternative decompression path (activated via GRK_SCHEDULER=freebyrd). The scheduler runs a sequential pipeline: parallel T1 block decode → DWT → MCT/DC-shift. Key changes: - SchedulerFreebyrd.cpp: Full implementation of decodeBlocks(), runDWT(), and postProcess(). Blocks are collected across all components and decoded in parallel via tf::Taskflow::emplace(). DWT uses WaveletReverse with a DwtFlowHelper (minimal SchedulerStandard subclass) to provide the ImageComponentFlow infrastructure. MCT/DC-shift runs via Mct schedule_decompress_rev/irrev. - SchedulerFreebyrd.h: Added DwtFlowHelper forward decl, CoderPool member, updated constructor to accept CoderPool*. - TileProcessor.cpp: Pass coderPool to SchedulerFreebyrd constructor. Output is bit-exact with the standard scheduler for lossless (5/3) and matches for lossy (9/7). All 2069 existing tests pass.
1 parent 8315bd3 commit e366f55

10 files changed

Lines changed: 2473 additions & 21 deletions

File tree

CMakeLists.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,30 @@ option(GRK_BUILD_CODEC "Build the CODEC executables" ON)
211211
option(GRK_BUILD_PLUGIN_LOADER "Enable loading of T1 plugin" OFF)
212212
mark_as_advanced(GRK_BUILD_PLUGIN_LOADER)
213213

214+
# Sicorax Rust scheduling library (used by freebyrd scheduler)
215+
option(GRK_USE_SCX_SCHEDULING "Link sicorax Rust scheduling library for freebyrd scheduler" OFF)
216+
if(GRK_USE_SCX_SCHEDULING)
217+
set(SCX_SCHEDULING_DIR "${CMAKE_SOURCE_DIR}/../sicorax" CACHE PATH "Path to sicorax source tree")
218+
set(SCX_SCHEDULING_LIB "${SCX_SCHEDULING_DIR}/crates/scx-scheduling/target/release/libscx_scheduling.a")
219+
if(NOT EXISTS "${SCX_SCHEDULING_LIB}")
220+
message(STATUS "Building sicorax scx-scheduling Rust crate...")
221+
execute_process(
222+
COMMAND cargo build --release
223+
WORKING_DIRECTORY "${SCX_SCHEDULING_DIR}/crates/scx-scheduling"
224+
RESULT_VARIABLE SCX_BUILD_RESULT
225+
)
226+
if(NOT SCX_BUILD_RESULT EQUAL 0)
227+
message(FATAL_ERROR "Failed to build scx-scheduling Rust crate")
228+
endif()
229+
endif()
230+
add_library(scx_scheduling STATIC IMPORTED)
231+
set_target_properties(scx_scheduling PROPERTIES IMPORTED_LOCATION "${SCX_SCHEDULING_LIB}")
232+
# Rust static libs on Linux need pthread and dl
233+
if(UNIX AND NOT APPLE)
234+
set_target_properties(scx_scheduling PROPERTIES INTERFACE_LINK_LIBRARIES "pthread;dl")
235+
endif()
236+
endif()
237+
214238
set(SPDLOG_INSTALL OFF CACHE BOOL "" FORCE)
215239
set(SPDLOG_BUILD_EXAMPLE OFF CACHE BOOL "" FORCE)
216240
set(SPDLOG_BUILD_TESTS OFF CACHE BOOL "" FORCE)

src/lib/core/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,13 @@ if(UNIX)
276276
target_link_libraries(${GROK_CORE_NAME} PUBLIC ${CMAKE_THREAD_LIBS_INIT})
277277
endif(UNIX)
278278
target_link_libraries(${GROK_CORE_NAME} PRIVATE hwy ${LCMS_LIBNAME})
279+
if(GRK_USE_SCX_SCHEDULING)
280+
target_link_libraries(${GROK_CORE_NAME} PRIVATE scx_scheduling)
281+
target_include_directories(${GROK_CORE_NAME} PRIVATE "${SCX_SCHEDULING_DIR}/src/scheduling")
282+
target_compile_definitions(${GROK_CORE_NAME} PRIVATE GRK_USE_SCX_SCHEDULING)
283+
target_sources(${GROK_CORE_NAME} PRIVATE
284+
${CMAKE_CURRENT_SOURCE_DIR}/scheduling/freebyrd/ScxEngineSingleton.cpp)
285+
endif()
279286
if(GRK_ENABLE_LIBCURL AND GRK_HAVE_LIBCURL)
280287
target_link_libraries(${GROK_CORE_NAME} PRIVATE ${GRK_CURL_TARGET})
281288
target_include_directories(${GROK_CORE_NAME} PRIVATE

0 commit comments

Comments
 (0)