Update KDU to 8.4.1 and fix kdu tests, also fix llimage_libtest utility

master
Rye 2024-10-27 19:02:55 -07:00
parent 6a78b5b43c
commit a80f2ba9a3
10 changed files with 80 additions and 149 deletions

View File

@ -1036,11 +1036,11 @@
<key>creds</key> <key>creds</key>
<string>github</string> <string>github</string>
<key>hash</key> <key>hash</key>
<string>ad72fa1d103df777906f0d98f3e882b9916aeada</string> <string>243709fbbb58a91dca81d16df650e9c6ff910d0d</string>
<key>hash_algorithm</key> <key>hash_algorithm</key>
<string>sha1</string> <string>sha1</string>
<key>url</key> <key>url</key>
<string>https://api.github.com/repos/secondlife/3p-kdu/releases/assets/136774118</string> <string>https://api.github.com/repos/secondlife/3p-kdu/releases/assets/202118207</string>
</map> </map>
<key>name</key> <key>name</key>
<string>darwin64</string> <string>darwin64</string>
@ -1052,11 +1052,11 @@
<key>creds</key> <key>creds</key>
<string>github</string> <string>github</string>
<key>hash</key> <key>hash</key>
<string>e46e4ac93a237b5c4a14183766f76ba5d58935a2</string> <string>7fd0a7ee71a4e76b49e31b75f8622852324d58a4</string>
<key>hash_algorithm</key> <key>hash_algorithm</key>
<string>sha1</string> <string>sha1</string>
<key>url</key> <key>url</key>
<string>https://api.github.com/repos/secondlife/3p-kdu/releases/assets/136774125</string> <string>https://api.github.com/repos/secondlife/3p-kdu/releases/assets/202118208</string>
</map> </map>
<key>name</key> <key>name</key>
<string>linux64</string> <string>linux64</string>
@ -1068,11 +1068,11 @@
<key>creds</key> <key>creds</key>
<string>github</string> <string>github</string>
<key>hash</key> <key>hash</key>
<string>bb37557f78c72b26580a521f8b8dabfa1b34e6e6</string> <string>8c475dd9616c7e0e3029cc38aefc1e0ab34d2e73</string>
<key>hash_algorithm</key> <key>hash_algorithm</key>
<string>sha1</string> <string>sha1</string>
<key>url</key> <key>url</key>
<string>https://api.github.com/repos/secondlife/3p-kdu/releases/assets/136774126</string> <string>https://api.github.com/repos/secondlife/3p-kdu/releases/assets/202118209</string>
</map> </map>
<key>name</key> <key>name</key>
<string>windows64</string> <string>windows64</string>
@ -1101,7 +1101,7 @@
<key>copyright</key> <key>copyright</key>
<string>Kakadu software</string> <string>Kakadu software</string>
<key>version</key> <key>version</key>
<string>7.10.4.4b9ec5f</string> <string>8.4.1.11540433907</string>
<key>name</key> <key>name</key>
<string>kdu</string> <string>kdu</string>
<key>description</key> <key>description</key>

View File

@ -23,4 +23,5 @@ if (USE_KDU)
${AUTOBUILD_INSTALL_DIR}/include/kdu ${AUTOBUILD_INSTALL_DIR}/include/kdu
${LIBS_OPEN_DIR}/llkdu ${LIBS_OPEN_DIR}/llkdu
) )
target_compile_definitions(ll::kdu INTERFACE KDU_X86_INTRINSICS=1 KDU_NO_THREADS=1)
endif (USE_KDU) endif (USE_KDU)

View File

@ -1,8 +1,3 @@
# -*- cmake -*- # -*- cmake -*-
add_subdirectory(llui_libtest) add_subdirectory(llui_libtest)
IF (LLIMAGE_LIBTEST)
MESSAGE(STATUS "Build llimage_libtest")
add_subdirectory(llimage_libtest) add_subdirectory(llimage_libtest)
ELSE (LLIMAGE_LIBTEST)
MESSAGE(STATUS "Skip llimage_libtest")
ENDIF (LLIMAGE_LIBTEST)

View File

@ -1,6 +1,7 @@
# -*- cmake -*- # -*- cmake -*-
# Integration tests of the llimage library (JPEG2000, PNG, jpeg, etc... images reading and writing) # Integration tests of the llimage library (JPEG2000, PNG, jpeg, etc... images reading and writing)
if (LL_TESTS)
project (llimage_libtest) project (llimage_libtest)
@ -8,9 +9,7 @@ include(00-Common)
include(LLCommon) include(LLCommon)
include(LLImage) include(LLImage)
include(LLMath) include(LLMath)
include(LLImageJ2COJ)
include(LLKDU) include(LLKDU)
include(LLFileSystem)
set(llimage_libtest_SOURCE_FILES set(llimage_libtest_SOURCE_FILES
llimage_libtest.cpp llimage_libtest.cpp
@ -24,17 +23,9 @@ set(llimage_libtest_HEADER_FILES
list(APPEND llimage_libtest_SOURCE_FILES ${llimage_libtest_HEADER_FILES}) list(APPEND llimage_libtest_SOURCE_FILES ${llimage_libtest_HEADER_FILES})
add_executable(llimage_libtest add_executable(llimage_libtest
WIN32
MACOSX_BUNDLE
${llimage_libtest_SOURCE_FILES} ${llimage_libtest_SOURCE_FILES}
) )
set_target_properties(llimage_libtest
PROPERTIES
WIN32_EXECUTABLE
FALSE
)
# Libraries on which this application depends on # Libraries on which this application depends on
# Sort by high-level to low-level # Sort by high-level to low-level
target_link_libraries(llimage_libtest target_link_libraries(llimage_libtest
@ -46,60 +37,7 @@ target_link_libraries(llimage_libtest
llimagej2coj llimagej2coj
) )
if (DARWIN)
# Path inside the app bundle where we'll need to copy libraries
set(LLIMAGE_LIBTEST_DESTINATION_DIR
${CMAKE_CURRENT_BINARY_DIR}/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,>/llimage_libtest.app/Contents/Resources
)
# Create the Contents/Resources directory
add_custom_command(
TARGET llimage_libtest POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS
-E
make_directory
${LLIMAGE_LIBTEST_DESTINATION_DIR}
COMMENT "Creating Resources directory in app bundle."
)
else (DARWIN)
set(LLIMAGE_LIBTEST_DESTINATION_DIR
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/
)
endif (DARWIN)
get_target_property(BUILT_LLCOMMON llcommon LOCATION)
add_custom_command(TARGET llimage_libtest POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_LLCOMMON} ${LLIMAGE_LIBTEST_DESTINATION_DIR}
DEPENDS ${BUILT_LLCOMMON}
)
if (DARWIN)
# Copy the required libraries to the package app
add_custom_command(TARGET llimage_libtest POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${AUTOBUILD_INSTALL_DIR}/lib/release/libapr-1.0.dylib ${LLIMAGE_LIBTEST_DESTINATION_DIR}
DEPENDS ${AUTOBUILD_INSTALL_DIR}/lib/release/libapr-1.0.dylib
)
add_custom_command(TARGET llimage_libtest POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${AUTOBUILD_INSTALL_DIR}/lib/release/libaprutil-1.0.dylib ${LLIMAGE_LIBTEST_DESTINATION_DIR}
DEPENDS ${AUTOBUILD_INSTALL_DIR}/lib/release/libaprutil-1.0.dylib
)
add_custom_command(TARGET llimage_libtest POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${AUTOBUILD_INSTALL_DIR}/lib/release/libexception_handler.dylib ${LLIMAGE_LIBTEST_DESTINATION_DIR}
DEPENDS ${AUTOBUILD_INSTALL_DIR}/lib/release/libexception_handler.dylib
)
foreach(expat ${EXPAT_COPY})
add_custom_command(TARGET llimage_libtest POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${AUTOBUILD_INSTALL_DIR}/lib/release/${expat} ${LLIMAGE_LIBTEST_DESTINATION_DIR}
DEPENDS ${AUTOBUILD_INSTALL_DIR}/lib/release/${expat}
)
endforeach(expat)
endif (DARWIN)
if (WINDOWS)
# Check indra/test_apps/llplugintest/CMakeLists.txt for an example of what to copy over for Windows and how
endif (WINDOWS)
# Ensure people working on the viewer don't break this library # Ensure people working on the viewer don't break this library
# *NOTE: This could be removed, or only built by TeamCity, if the build
# and link times become too long.
add_dependencies(viewer llimage_libtest) add_dependencies(viewer llimage_libtest)
endif(LL_TESTS)

View File

@ -43,6 +43,8 @@
#include "v4coloru.h" #include "v4coloru.h"
#include "llsdserialize.h" #include "llsdserialize.h"
#include "llcleanup.h" #include "llcleanup.h"
#include "lltrace.h"
#include "llfasttimer.h"
// system libraries // system libraries
#include <iostream> #include <iostream>
@ -573,10 +575,10 @@ int main(int argc, char** argv)
// Create the logging thread if required // Create the logging thread if required
if (LLFastTimer::sMetricLog) if (LLTrace::BlockTimer::sMetricLog)
{ {
LLFastTimer::sLogLock = new LLMutex(NULL); LLTrace::BlockTimer::setLogLock(new LLMutex());
fast_timer_log_thread = new LogThread(LLFastTimer::sLogName); fast_timer_log_thread = new LogThread(LLTrace::BlockTimer::sLogName);
fast_timer_log_thread->start(); fast_timer_log_thread->start();
} }
@ -618,9 +620,9 @@ int main(int argc, char** argv)
// Output perf data if requested by user // Output perf data if requested by user
if (analyze_performance) if (analyze_performance)
{ {
std::string baseline_name = LLFastTimer::sLogName + "_baseline.slp"; std::string baseline_name = LLTrace::BlockTimer::sLogName + "_baseline.slp";
std::string current_name = LLFastTimer::sLogName + ".slp"; std::string current_name = LLTrace::BlockTimer::sLogName + ".slp";
std::string report_name = LLFastTimer::sLogName + "_report.csv"; std::string report_name = LLTrace::BlockTimer::sLogName + "_report.csv";
std::cout << "Analyzing performance, check report in : " << report_name << std::endl; std::cout << "Analyzing performance, check report in : " << report_name << std::endl;
@ -628,9 +630,9 @@ int main(int argc, char** argv)
} }
// Stop the perf gathering system if needed // Stop the perf gathering system if needed
if (LLFastTimer::sMetricLog) if (LLTrace::BlockTimer::sMetricLog)
{ {
LLMetricPerformanceTesterBasic::deleteTester(LLFastTimer::sLogName); LLMetricPerformanceTesterBasic::deleteTester(LLTrace::BlockTimer::sLogName);
sAllDone = true; sAllDone = true;
} }

View File

@ -42,10 +42,7 @@ if (USE_KDU)
target_include_directories( llkdu INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories( llkdu INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
# Add tests # Add tests
# ND: llkdu tests are very strange as they include stubs for KDU classes/methods if (LL_TESTS)
# if not having access to the right KDU version this test will fail to compile, incidentally I do not
# have access to a matching version of KDU and thus cannot get this tests to compile
if (LL_TESTS_KDU)
include(LLAddBuildTest) include(LLAddBuildTest)
include(Tut) include(Tut)
SET(llkdu_TEST_SOURCE_FILES SET(llkdu_TEST_SOURCE_FILES
@ -62,6 +59,6 @@ if (USE_KDU)
set_property( SOURCE ${llkdu_TEST_SOURCE_FILES} PROPERTY LL_TEST_ADDITIONAL_INCLUDE_DIRS ${llimage_include_dir}) set_property( SOURCE ${llkdu_TEST_SOURCE_FILES} PROPERTY LL_TEST_ADDITIONAL_INCLUDE_DIRS ${llimage_include_dir})
LL_ADD_PROJECT_UNIT_TESTS(llkdu "${llkdu_TEST_SOURCE_FILES}") LL_ADD_PROJECT_UNIT_TESTS(llkdu "${llkdu_TEST_SOURCE_FILES}")
endif (LL_TESTS_KDU) endif (LL_TESTS)
endif (USE_KDU) endif (USE_KDU)

View File

@ -163,6 +163,7 @@ private:
S32 mNumComponents; S32 mNumComponents;
bool mUseYCC; bool mUseYCC;
kdu_dims mDims; kdu_dims mDims;
kdu_push_pull_params mParams;
kdu_sample_allocator mAllocator; kdu_sample_allocator mAllocator;
kdu_tile_comp mComps[4]; kdu_tile_comp mComps[4];
kdu_line_buf mLines[4]; kdu_line_buf mLines[4];
@ -255,7 +256,7 @@ LLImageJ2CKDU::LLImageJ2CKDU() : LLImageJ2CImpl(),
mCodeStreamp(), mCodeStreamp(),
mTPosp(), mTPosp(),
mTileIndicesp(), mTileIndicesp(),
mRawImagep(NULL), mRawImagep(nullptr),
mDecodeState(), mDecodeState(),
mBlocksSize(-1), mBlocksSize(-1),
mPrecinctsSize(-1), mPrecinctsSize(-1),
@ -292,17 +293,17 @@ void LLImageJ2CKDU::setupCodeStream(LLImageJ2C &base, bool keep_codestream, ECod
// two U32s and a pointer, so it's not as if it would be a huge overhead // two U32s and a pointer, so it's not as if it would be a huge overhead
// to allocate a new one every time. // to allocate a new one every time.
// Also -- why is base.getData() tested specifically here? If that returns // Also -- why is base.getData() tested specifically here? If that returns
// NULL, shouldn't we bail out of the whole method? // nullptr, shouldn't we bail out of the whole method?
if (!mInputp && base.getData()) if (!mInputp && base.getData())
{ {
// The compressed data has been loaded // The compressed data has been loaded
// Setup the source for the codestream // Setup the source for the codestream
mInputp.reset(new LLKDUMemSource(base.getData(), data_size)); mInputp = std::make_unique<LLKDUMemSource>(base.getData(), data_size);
} }
if (mInputp) if (mInputp)
{ {
// This is LLKDUMemSource::reset(), not boost::scoped_ptr::reset(). // This is LLKDUMemSource::reset(), not std::unique_ptr::reset().
mInputp->reset(); mInputp->reset();
} }
@ -312,7 +313,7 @@ void LLImageJ2CKDU::setupCodeStream(LLImageJ2C &base, bool keep_codestream, ECod
// *TODO: This seems to be wrong. The base class should have no idea of // *TODO: This seems to be wrong. The base class should have no idea of
// how j2c compression works so no good way of computing what's the byte // how j2c compression works so no good way of computing what's the byte
// range to be used. // range to be used.
mCodeStreamp->set_max_bytes(max_bytes,true); mCodeStreamp->set_max_bytes(max_bytes);
// If you want to flip or rotate the image for some reason, change // If you want to flip or rotate the image for some reason, change
// the resolution, or identify a restricted region of interest, this is // the resolution, or identify a restricted region of interest, this is
@ -446,8 +447,8 @@ bool LLImageJ2CKDU::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco
mCodeStreamp->change_appearance(false, true, false); mCodeStreamp->change_appearance(false, true, false);
// Apply loading discard level and cropping if required // Apply loading discard level and cropping if required
kdu_dims* region_kdu = NULL; kdu_dims* region_kdu = nullptr;
if (region != NULL) if (region != nullptr)
{ {
region_kdu = new kdu_dims; region_kdu = new kdu_dims;
region_kdu->pos.x = region[0]; region_kdu->pos.x = region[0];
@ -464,7 +465,7 @@ bool LLImageJ2CKDU::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco
if (region_kdu) if (region_kdu)
{ {
delete region_kdu; delete region_kdu;
region_kdu = NULL; region_kdu = nullptr;
} }
// Resize raw_image according to the image to be decoded // Resize raw_image according to the image to be decoded
@ -475,12 +476,12 @@ bool LLImageJ2CKDU::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco
if (!mTileIndicesp) if (!mTileIndicesp)
{ {
mTileIndicesp.reset(new kdu_dims); mTileIndicesp = std::make_unique<kdu_dims>();
} }
mCodeStreamp->get_valid_tiles(*mTileIndicesp); mCodeStreamp->get_valid_tiles(*mTileIndicesp);
if (!mTPosp) if (!mTPosp)
{ {
mTPosp.reset(new kdu_coords); mTPosp = std::make_unique<kdu_coords>();
mTPosp->y = 0; mTPosp->y = 0;
mTPosp->x = 0; mTPosp->x = 0;
} }
@ -490,7 +491,7 @@ bool LLImageJ2CKDU::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco
base.setLastError(msg.what()); base.setLastError(msg.what());
return false; return false;
} }
catch (kdu_exception kdu_value) catch (const kdu_exception& kdu_value)
{ {
// KDU internally throws kdu_exception. It's possible that such an // KDU internally throws kdu_exception. It's possible that such an
// exception might leak out into our code. Catch kdu_exception // exception might leak out into our code. Catch kdu_exception
@ -581,8 +582,7 @@ bool LLImageJ2CKDU::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco
kdu_coords offset = tile_dims.pos - dims.pos; kdu_coords offset = tile_dims.pos - dims.pos;
int row_gap = channels*dims.size.x; // inter-row separation int row_gap = channels*dims.size.x; // inter-row separation
kdu_byte *buf = buffer + offset.y*row_gap + offset.x*channels; kdu_byte *buf = buffer + offset.y*row_gap + offset.x*channels;
mDecodeState.reset(new LLKDUDecodeState(tile, buf, row_gap, mDecodeState = std::make_unique<LLKDUDecodeState>(tile, buf, row_gap, mCodeStreamp.get());
mCodeStreamp.get()));
} }
// Do the actual processing // Do the actual processing
F32 remaining_time = limit_time ? decode_time - decode_timer.getElapsedTimeF32().value() : 0.0f; F32 remaining_time = limit_time ? decode_time - decode_timer.getElapsedTimeF32().value() : 0.0f;
@ -607,7 +607,7 @@ bool LLImageJ2CKDU::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco
cleanupCodeStream(); cleanupCodeStream();
return true; // done return true; // done
} }
catch (kdu_exception kdu_value) catch (const kdu_exception& kdu_value)
{ {
// KDU internally throws kdu_exception. It's possible that such an // KDU internally throws kdu_exception. It's possible that such an
// exception might leak out into our code. Catch kdu_exception // exception might leak out into our code. Catch kdu_exception
@ -810,7 +810,7 @@ bool LLImageJ2CKDU::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, co
base.setLastError(msg.what()); base.setLastError(msg.what());
return false; return false;
} }
catch (kdu_exception kdu_value) catch (const kdu_exception& kdu_value)
{ {
// KDU internally throws kdu_exception. It's possible that such an // KDU internally throws kdu_exception. It's possible that such an
// exception might leak out into our code. Catch kdu_exception // exception might leak out into our code. Catch kdu_exception
@ -844,7 +844,7 @@ bool LLImageJ2CKDU::getMetadata(LLImageJ2C &base)
base.setLastError(msg.what()); base.setLastError(msg.what());
return false; return false;
} }
catch (kdu_exception kdu_value) catch (const kdu_exception& kdu_value)
{ {
// KDU internally throws kdu_exception. It's possible that such an // KDU internally throws kdu_exception. It's possible that such an
// exception might leak out into our code. Catch kdu_exception // exception might leak out into our code. Catch kdu_exception
@ -976,8 +976,8 @@ void LLImageJ2CKDU::findDiscardLevelsBoundaries(LLImageJ2C &base)
//std::cout << "Parsing discard level = " << discard_level << std::endl; //std::cout << "Parsing discard level = " << discard_level << std::endl;
// Create the input codestream object. // Create the input codestream object.
setupCodeStream(base, true, MODE_FAST); setupCodeStream(base, true, MODE_FAST);
mCodeStreamp->apply_input_restrictions(0, 4, discard_level, 0, NULL); mCodeStreamp->apply_input_restrictions(0, 4, discard_level, 0, nullptr);
mCodeStreamp->set_max_bytes(KDU_LONG_MAX,true); mCodeStreamp->set_max_bytes(KDU_LONG_MAX,false);
siz_params *siz_in = mCodeStreamp->access_siz(); siz_params *siz_in = mCodeStreamp->access_siz();
// Create the output codestream object. // Create the output codestream object.
@ -1073,8 +1073,10 @@ void LLImageJ2CKDU::findDiscardLevelsBoundaries(LLImageJ2C &base)
void set_default_colour_weights(kdu_params *siz) void set_default_colour_weights(kdu_params *siz)
{ {
kdu_params *enc = siz->access_cluster(ENC_params);
assert(enc != nullptr);
kdu_params *cod = siz->access_cluster(COD_params); kdu_params *cod = siz->access_cluster(COD_params);
assert(cod != NULL); assert(cod != nullptr);
bool can_use_ycc = true; bool can_use_ycc = true;
bool rev0 = false; bool rev0 = false;
@ -1111,7 +1113,7 @@ void set_default_colour_weights(kdu_params *siz)
return; return;
} }
float weight; float weight;
if (cod->get(Clev_weights,0,0,weight) || cod->get(Cband_weights,0,0,weight)) if (enc->get(Clev_weights,0,0,weight) || enc->get(Cband_weights,0,0,weight))
{ {
// Weights already specified explicitly -> nothing to do // Weights already specified explicitly -> nothing to do
return; return;
@ -1120,17 +1122,16 @@ void set_default_colour_weights(kdu_params *siz)
// These example weights are adapted from numbers generated by Marcus Nadenau // These example weights are adapted from numbers generated by Marcus Nadenau
// at EPFL, for a viewing distance of 15 cm and a display resolution of // at EPFL, for a viewing distance of 15 cm and a display resolution of
// 300 DPI. // 300 DPI.
enc->parse_string("Cband_weights:C0="
cod->parse_string("Cband_weights:C0="
"{0.0901},{0.2758},{0.2758}," "{0.0901},{0.2758},{0.2758},"
"{0.7018},{0.8378},{0.8378},{1}"); "{0.7018},{0.8378},{0.8378},{1}");
cod->parse_string("Cband_weights:C1=" enc->parse_string("Cband_weights:C1="
"{0.0263},{0.0863},{0.0863}," "{0.0263},{0.0863},{0.0863},"
"{0.1362},{0.2564},{0.2564}," "{0.1362},{0.2564},{0.2564},"
"{0.3346},{0.4691},{0.4691}," "{0.3346},{0.4691},{0.4691},"
"{0.5444},{0.6523},{0.6523}," "{0.5444},{0.6523},{0.6523},"
"{0.7078},{0.7797},{0.7797},{1}"); "{0.7078},{0.7797},{0.7797},{1}");
cod->parse_string("Cband_weights:C2=" enc->parse_string("Cband_weights:C2="
"{0.0773},{0.1835},{0.1835}," "{0.0773},{0.1835},{0.1835},"
"{0.2598},{0.4130},{0.4130}," "{0.2598},{0.4130},{0.4130},"
"{0.5040},{0.6464},{0.6464}," "{0.5040},{0.6464},{0.6464},"
@ -1149,7 +1150,7 @@ byte buffer, spacing successive output samples apart by `gap' bytes
all necessary level shifting, type conversion, rounding and truncation. */ all necessary level shifting, type conversion, rounding and truncation. */
{ {
int width = src.get_width(); int width = src.get_width();
if (src.get_buf32() != NULL) if (src.get_buf32() != nullptr)
{ // Decompressed samples have a 32-bit representation (integer or float) { // Decompressed samples have a 32-bit representation (integer or float)
assert(precision >= 8); // Else would have used 16 bit representation assert(precision >= 8); // Else would have used 16 bit representation
kdu_sample32 *sp = src.get_buf32(); kdu_sample32 *sp = src.get_buf32();
@ -1312,11 +1313,11 @@ LLKDUDecodeState::LLKDUDecodeState(kdu_tile tile, kdu_byte *buf, S32 row_gap,
mLines[c].pre_create(&mAllocator,mDims.size.x,mReversible[c],use_shorts,0,0); mLines[c].pre_create(&mAllocator,mDims.size.x,mReversible[c],use_shorts,0,0);
if (res.which() == 0) // No DWT levels used if (res.which() == 0) // No DWT levels used
{ {
mEngines[c] = kdu_decoder(res.access_subband(LL_BAND),&mAllocator,use_shorts); mEngines[c] = kdu_decoder(res.access_subband(LL_BAND), &mAllocator, mParams, use_shorts);
} }
else else
{ {
mEngines[c] = kdu_synthesis(res,&mAllocator,use_shorts); mEngines[c] = kdu_synthesis(res, &mAllocator, mParams, use_shorts);
} }
} }
mAllocator.finalize(*codestreamp); // Actually creates buffering resources mAllocator.finalize(*codestreamp); // Actually creates buffering resources
@ -1394,7 +1395,7 @@ kdc_flow_control::kdc_flow_control (kdu_supp::kdu_image_in_base *img_in, kdu_cod
this->codestream = codestream; this->codestream = codestream;
codestream.get_valid_tiles(valid_tile_indices); codestream.get_valid_tiles(valid_tile_indices);
tile_idx = valid_tile_indices.pos; tile_idx = valid_tile_indices.pos;
tile = codestream.open_tile(tile_idx,NULL); tile = codestream.open_tile(tile_idx, nullptr);
// Set up the individual components // Set up the individual components
num_components = codestream.get_num_components(true); num_components = codestream.get_num_components(true);
@ -1403,7 +1404,7 @@ kdc_flow_control::kdc_flow_control (kdu_supp::kdu_image_in_base *img_in, kdu_cod
kdc_component_flow_control *comp = components; kdc_component_flow_control *comp = components;
for (n = 0; n < num_components; n++, comp++) for (n = 0; n < num_components; n++, comp++)
{ {
comp->line = NULL; comp->line = nullptr;
comp->reader = img_in; comp->reader = img_in;
kdu_coords subsampling; kdu_coords subsampling;
codestream.get_subsampling(n,subsampling,true); codestream.get_subsampling(n,subsampling,true);
@ -1420,12 +1421,12 @@ kdc_flow_control::kdc_flow_control (kdu_supp::kdu_image_in_base *img_in, kdu_cod
assert(num_components >= 0); assert(num_components >= 0);
tile.set_components_of_interest(num_components); tile.set_components_of_interest(num_components);
max_buffer_memory = engine.create(codestream,tile,false,NULL,false,1,NULL,NULL,false); max_buffer_memory = engine.create(codestream, tile, false, nullptr, false, 1, nullptr, nullptr,false);
} }
kdc_flow_control::~kdc_flow_control() kdc_flow_control::~kdc_flow_control()
{ {
if (components != NULL) if (components != nullptr)
{ {
delete[] components; delete[] components;
} }
@ -1452,8 +1453,8 @@ bool kdc_flow_control::advance_components()
if (comp->ratio_counter < 0) if (comp->ratio_counter < 0)
{ {
found_line = true; found_line = true;
comp->line = engine.exchange_line(n,NULL,NULL); comp->line = engine.exchange_line(n,nullptr,nullptr);
assert(comp->line != NULL); assert(comp->line != nullptr);
if (comp->line->get_width()) if (comp->line->get_width())
{ {
comp->reader->get(n,*(comp->line),0); comp->reader->get(n,*(comp->line),0);
@ -1480,9 +1481,9 @@ void kdc_flow_control::process_components()
assert(comp->ratio_counter >= 0); assert(comp->ratio_counter >= 0);
assert(comp->remaining_lines > 0); assert(comp->remaining_lines > 0);
comp->remaining_lines--; comp->remaining_lines--;
assert(comp->line != NULL); assert(comp->line != nullptr);
engine.exchange_line(n,comp->line,NULL); engine.exchange_line(n,comp->line,nullptr);
comp->line = NULL; comp->line = nullptr;
} }
} }
} }

View File

@ -32,7 +32,6 @@
// //
// KDU core header files // KDU core header files
// //
#define KDU_NO_THREADS
#include "kdu_elementary.h" #include "kdu_elementary.h"
#include "kdu_messaging.h" #include "kdu_messaging.h"
#include "kdu_params.h" #include "kdu_params.h"
@ -41,7 +40,6 @@
#include "include_kdu_xxxx.h" #include "include_kdu_xxxx.h"
#include "kdu_sample_processing.h" #include "kdu_sample_processing.h"
#include <boost/scoped_ptr.hpp>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
class LLKDUDecodeState; class LLKDUDecodeState;

View File

@ -28,8 +28,6 @@
#define LL_LLKDUMEM_H #define LL_LLKDUMEM_H
// Support classes for reading and writing from memory buffers in KDU // Support classes for reading and writing from memory buffers in KDU
#define KDU_NO_THREADS
#define kdu_xxxx "kdu_image.h" #define kdu_xxxx "kdu_image.h"
#include "include_kdu_xxxx.h" #include "include_kdu_xxxx.h"
@ -54,9 +52,7 @@ public:
mCurPos = 0; mCurPos = 0;
} }
~LLKDUMemSource() ~LLKDUMemSource() = default;
{
}
int read(kdu_core::kdu_byte *buf, int num_bytes) int read(kdu_core::kdu_byte *buf, int num_bytes)
{ {
@ -94,9 +90,7 @@ public:
mOutputSize = &output_size; mOutputSize = &output_size;
} }
~LLKDUMemTarget() ~LLKDUMemTarget() = default;
{
}
bool write(const kdu_core::kdu_byte *buf, int num_bytes) bool write(const kdu_core::kdu_byte *buf, int num_bytes)
{ {

View File

@ -139,18 +139,19 @@ int kdu_tile_comp::get_bit_depth(bool ) { return 8; }
bool kdu_tile_comp::get_reversible() { return false; } bool kdu_tile_comp::get_reversible() { return false; }
int kdu_tile_comp::get_num_resolutions() { return 1; } int kdu_tile_comp::get_num_resolutions() { return 1; }
kdu_subband kdu_resolution::access_subband(int ) { kdu_subband a; return a; } kdu_subband kdu_resolution::access_subband(int ) { kdu_subband a; return a; }
void kdu_resolution::get_dims(kdu_dims& ) { } void kdu_resolution::get_dims(kdu_dims& ) const { }
int kdu_resolution::which() { return 0; } int kdu_resolution::which() const { return 0; }
int kdu_resolution::get_valid_band_indices(int &) { return 1; } int kdu_resolution::get_valid_band_indices(int &) const { return 1; }
kdu_synthesis::kdu_synthesis(kdu_resolution, kdu_sample_allocator*, bool, float, kdu_thread_env*, kdu_thread_queue*) { } kdu_synthesis::kdu_synthesis(kdu_resolution, kdu_sample_allocator*, kdu_push_pull_params&, bool, float, kdu_thread_env*, kdu_thread_queue*) { }
//kdu_params::kdu_params(const char*, bool, bool, bool, bool, bool) { } //kdu_params::kdu_params(const char*, bool, bool, bool, bool, bool) { }
kdu_params::kdu_params(const char*, bool, bool, bool, bool, bool, kd_core_local::kd_coremem*) {} kdu_params::kdu_params(const char*, bool, bool, bool, bool, bool) {}
kdu_params::~kdu_params() { } kdu_params::~kdu_params() { }
void kdu_params::destroy() { }
void kdu_params::set(const char* , int , int , bool ) { } void kdu_params::set(const char* , int , int , bool ) { }
void kdu_params::set(const char* , int , int , int ) { } void kdu_params::set(const char* , int , int , int ) { }
void kdu_params::finalize_all(bool ) { } void kdu_params::finalize_all(bool ) { }
void kdu_params::finalize_all(int, bool ) { } void kdu_params::finalize_all(int, bool ) { }
void kdu_params::copy_from(kdu_params*, int, int, int, int, int, bool, bool, bool) { } void kdu_params::copy_from(kdu_params*, int, int, int, int, int, bool, bool, bool, bool) { }
bool kdu_params::parse_string(const char*) { return false; } bool kdu_params::parse_string(const char*) { return false; }
bool kdu_params::get(const char*, int, int, bool&, bool, bool, bool) { return false; } bool kdu_params::get(const char*, int, int, bool&, bool, bool, bool) { return false; }
bool kdu_params::get(const char*, int, int, float&, bool, bool, bool) { return false; } bool kdu_params::get(const char*, int, int, float&, bool, bool, bool) { return false; }
@ -159,13 +160,13 @@ kdu_params* kdu_params::access_relation(int, int, int, bool) { return NULL; }
kdu_params* kdu_params::access_cluster(const char*) { return NULL; } kdu_params* kdu_params::access_cluster(const char*) { return NULL; }
void kdu_codestream::set_fast() { } void kdu_codestream::set_fast() { }
void kdu_codestream::set_fussy() { } void kdu_codestream::set_fussy() { }
void kdu_codestream::get_dims(int, kdu_dims&, bool ) { } void kdu_codestream::get_dims(int, kdu_dims&, bool ) const { }
int kdu_codestream::get_min_dwt_levels() { return 5; } int kdu_codestream::get_min_dwt_levels() { return 5; }
int kdu_codestream::get_max_tile_layers() { return 1; } int kdu_codestream::get_max_tile_layers() { return 1; }
void kdu_codestream::change_appearance(bool, bool, bool, kdu_thread_env *) {} void kdu_codestream::change_appearance(bool, bool, bool, kdu_thread_env *) {}
void kdu_codestream::get_tile_dims(kdu_coords, int, kdu_dims&, bool ) { } void kdu_codestream::get_tile_dims(kdu_coords, int, kdu_dims&, bool ) { }
void kdu_codestream::destroy() { } void kdu_codestream::destroy() { }
void kdu_codestream::collect_timing_stats(int ) { } void kdu_codestream::collect_timing_stats(int ) const { }
void kdu_codestream::set_max_bytes(kdu_long, bool, bool ) { } void kdu_codestream::set_max_bytes(kdu_long, bool, bool ) { }
void kdu_codestream::get_valid_tiles(kdu_dims& ) { } void kdu_codestream::get_valid_tiles(kdu_dims& ) { }
void kdu_codestream::create( void kdu_codestream::create(
@ -182,19 +183,21 @@ void kdu_codestream::get_subsampling(int , kdu_coords&, bool ) { }
void kdu_codestream::flush(kdu_long *, int, kdu_uint16 *, bool, bool, double, kdu_thread_env*, int) { } void kdu_codestream::flush(kdu_long *, int, kdu_uint16 *, bool, bool, double, kdu_thread_env*, int) { }
void kdu_codestream::set_resilient(bool ) { } void kdu_codestream::set_resilient(bool ) { }
int kdu_codestream::get_num_components(bool ) { return 0; } int kdu_codestream::get_num_components(bool ) { return 0; }
kdu_long kdu_codestream::get_total_bytes(bool ) { return 0; } kdu_long kdu_codestream::get_total_bytes(bool ) const { return 0; }
kdu_long kdu_codestream::get_compressed_data_memory(bool ) const {return 0; } kdu_long kdu_codestream::get_compressed_data_memory(bool ) const {return 0; }
void kdu_codestream::share_buffering(kdu_codestream ) { } void kdu_codestream::share_buffering(kdu_codestream ) { }
int kdu_codestream::get_num_tparts() { return 0; } int kdu_codestream::get_num_tparts() const { return 0; }
int kdu_codestream::trans_out(kdu_long, kdu_long*, int, bool, kdu_thread_env* ) { return 0; } int kdu_codestream::trans_out(kdu_long, kdu_long*, int, bool, kdu_thread_env* ) { return 0; }
bool kdu_codestream::ready_for_flush(kdu_thread_env*) { return false; } bool kdu_codestream::ready_for_flush(kdu_thread_env*) { return false; }
siz_params* kdu_codestream::access_siz() { return NULL; } siz_params* kdu_codestream::access_siz() { return NULL; }
kdu_tile kdu_codestream::open_tile(kdu_coords , kdu_thread_env* ) { kdu_tile a; return a; } kdu_tile kdu_codestream::open_tile(kdu_coords , kdu_thread_env* ) { kdu_tile a; return a; }
kdu_codestream_comment kdu_codestream::add_comment(kdu_thread_env*) { kdu_codestream_comment a; return a; } kdu_codestream_comment kdu_codestream::add_comment(kdu_thread_env*) { kdu_codestream_comment a; return a; }
kdu_codestream_comment kdu_codestream::get_comment(kdu_codestream_comment) { kdu_codestream_comment a; return a; };
void kdu_subband::close_block(kdu_block*, kdu_thread_env*) { } void kdu_subband::close_block(kdu_block*, kdu_thread_env*) { }
void kdu_subband::get_valid_blocks(kdu_dims &indices) const { } void kdu_subband::get_valid_blocks(kdu_dims &indices) const { }
kdu_block * kdu_subband::open_block(kdu_coords, int *, kdu_thread_env *, int, bool) { return NULL; } kdu_block * kdu_subband::open_block(kdu_coords, int *, kdu_thread_env *, int, bool) { return NULL; }
bool kdu_codestream_comment::put_text(const char*) { return false; } bool kdu_codestream_comment::put_text(const char*) { return false; }
const char *kdu_codestream_comment::get_text() { return nullptr; };
void kdu_customize_warnings(kdu_message*) { } void kdu_customize_warnings(kdu_message*) { }
void kdu_customize_errors(kdu_message*) { } void kdu_customize_errors(kdu_message*) { }
kdu_long kdu_multi_analysis::create( kdu_long kdu_multi_analysis::create(
@ -209,16 +212,18 @@ kdu_long kdu_multi_analysis::create(
const kdu_push_pull_params*, const kdu_push_pull_params*,
kdu_membroker*) { return kdu_long(0); } kdu_membroker*) { return kdu_long(0); }
void kdu_multi_analysis::destroy(kdu_thread_env *) {} void kdu_multi_analysis::destroy(kdu_thread_env *) {}
siz_params::siz_params() : kdu_params(NULL, false, false, false, false, false) { }
siz_params::siz_params(kd_core_local::kd_coremem*) : kdu_params(NULL, false, false, false, false, false) { } siz_params::siz_params(kd_core_local::kd_coremem*) : kdu_params(NULL, false, false, false, false, false) { }
siz_params::~siz_params() {} siz_params::~siz_params() {}
void siz_params::finalize(bool ) { } void siz_params::finalize(bool ) { }
void siz_params::copy_with_xforms(kdu_params*, int, int, bool, bool, bool) { } void siz_params::copy_with_xforms(kdu_params*, int, int, bool, bool, bool) { }
int siz_params::write_marker_segment(kdu_output*, kdu_params*, int) { return 0; } int siz_params::write_marker_segment(kdu_output*, kdu_params*, int, int&) { return 0; }
bool siz_params::check_marker_segment(kdu_uint16, int, kdu_byte a[], int&) { return false; } bool siz_params::check_marker_segment(kdu_uint16, int, kdu_byte a[], int&) { return false; }
bool siz_params::read_marker_segment(kdu_uint16, int, kdu_byte a[], int) { return false; } int siz_params::read_marker_segment(kdu_uint16 code, int num_bytes, kdu_byte bytes[], int tpart_idx) { return false; }
kdu_decoder::kdu_decoder( kdu_decoder::kdu_decoder(
kdu_subband subband, kdu_subband subband,
kdu_sample_allocator*, kdu_sample_allocator*,
kdu_push_pull_params&,
bool, float, int, bool, float, int,
kdu_thread_env*, kdu_thread_env*,
kdu_thread_queue*, kdu_thread_queue*,