From a0052fac052c527e67f07a978a9413804427a736 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 25 Apr 2016 22:56:58 -0400 Subject: DRTVWR-418: Fix indra/llkdu wrapper for changes in KDU 7.8 API. KDU 7.8 introduces a number of changes to its API, most notably by moving public symbols into a variety of kdu_something namespaces. While this is laudable in a general sense, it does require quite a bit of diagnostic building and patching to update legacy code. Since llimagej2ckdu_test.cpp lamentably stubs out pretty much the entire KDU API, we must also fix those stubs for signature changes even to functions we don't otherwise reference. NOTE: This commit still leaves four symbols undefined. Below I have taken the liberty of juxtaposing the error line with the output from dumpbin /exports build-vc120/packages/lib/release/kdu.lib. I see no differences. unresolved symbol (?kdu_convert_ycc_to_rgb_rev16@kdu_core@@3P6AXPAF00H@ZA) "void (__cdecl* kdu_core::kdu_convert_ycc_to_rgb_rev16)(short *,short *,short *,int)" ?kdu_convert_ycc_to_rgb_rev16@kdu_core@@3P6AXPAF00H@ZA (void (__cdecl* kdu_core::kdu_convert_ycc_to_rgb_rev16)(short *,short *,short *,int)) unresolved symbol (?kdu_convert_ycc_to_rgb_irrev16@kdu_core@@3P6AXPAF00H@ZA) "void (__cdecl* kdu_core::kdu_convert_ycc_to_rgb_irrev16)(short *,short *,short *,int)" ?kdu_convert_ycc_to_rgb_irrev16@kdu_core@@3P6AXPAF00H@ZA (void (__cdecl* kdu_core::kdu_convert_ycc_to_rgb_irrev16)(short *,short *,short *,int)) unresolved symbol (?kdu_convert_ycc_to_rgb_rev32@kdu_core@@3P6AXPAH00H@ZA) "void (__cdecl* kdu_core::kdu_convert_ycc_to_rgb_rev32)(int *,int *,int *,int)" ?kdu_convert_ycc_to_rgb_rev32@kdu_core@@3P6AXPAH00H@ZA (void (__cdecl* kdu_core::kdu_convert_ycc_to_rgb_rev32)(int *,int *,int *,int)) unresolved symbol (?kdu_convert_ycc_to_rgb_irrev32@kdu_core@@3P6AXPAM00H@ZA) "void (__cdecl* kdu_core::kdu_convert_ycc_to_rgb_irrev32)(float *,float *,float *,int)" ?kdu_convert_ycc_to_rgb_irrev32@kdu_core@@3P6AXPAM00H@ZA (void (__cdecl* kdu_core::kdu_convert_ycc_to_rgb_irrev32)(float *,float *,float *,int)) 24>C:\Users\Nat\linden\viewer64\build-vc120\newview\RelWithDebInfo\secondlife-bin.exe : fatal error LNK1120: 4 unresolved externals --- indra/llkdu/llimagej2ckdu.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'indra/llkdu/llimagej2ckdu.cpp') diff --git a/indra/llkdu/llimagej2ckdu.cpp b/indra/llkdu/llimagej2ckdu.cpp index 6a8959517d..f48e544813 100755 --- a/indra/llkdu/llimagej2ckdu.cpp +++ b/indra/llkdu/llimagej2ckdu.cpp @@ -32,12 +32,16 @@ #include "llmath.h" #include "llkdumem.h" -#include "kdu_block_coding.h" +#define kdu_xxxx "kdu_block_coding.h" +#include "include_kdu_xxxx.h" + +// Avoid ubiquitous necessity of kdu_core:: qualification +using namespace kdu_core; class kdc_flow_control { public: - kdc_flow_control(kdu_image_in_base *img_in, kdu_codestream codestream); + kdc_flow_control(kdu_supp::kdu_image_in_base *img_in, kdu_codestream codestream); ~kdc_flow_control(); bool advance_components(); void process_components(); @@ -46,7 +50,7 @@ private: struct kdc_component_flow_control { public: - kdu_image_in_base *reader; + kdu_supp::kdu_image_in_base *reader; int vert_subsampling; int ratio_counter; /* Initialized to 0, decremented by `count_delta'; when < 0, a new line must be processed, after @@ -108,7 +112,8 @@ const char* fallbackEngineInfoLLImageJ2CImpl() class LLKDUDecodeState { public: - LLKDUDecodeState(kdu_tile tile, kdu_byte *buf, S32 row_gap); + LLKDUDecodeState(kdu_tile tile, kdu_byte *buf, S32 row_gap, + kdu_codestream* codestreamp); ~LLKDUDecodeState(); BOOL processTileDecode(F32 decode_time, BOOL limit_time = TRUE); @@ -495,7 +500,7 @@ BOOL LLImageJ2CKDU::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco kdu_coords offset = tile_dims.pos - dims.pos; int row_gap = channels*dims.size.x; // inter-row separation kdu_byte *buf = buffer + offset.y*row_gap + offset.x*channels; - mDecodeState = new LLKDUDecodeState(tile, buf, row_gap); + mDecodeState = new LLKDUDecodeState(tile, buf, row_gap, mCodeStreamp); } // Do the actual processing F32 remaining_time = decode_time - decode_timer.getElapsedTimeF32(); @@ -1143,7 +1148,8 @@ all necessary level shifting, type conversion, rounding and truncation. */ } } -LLKDUDecodeState::LLKDUDecodeState(kdu_tile tile, kdu_byte *buf, S32 row_gap) +LLKDUDecodeState::LLKDUDecodeState(kdu_tile tile, kdu_byte *buf, S32 row_gap, + kdu_codestream* codestreamp) { S32 c; @@ -1189,7 +1195,7 @@ LLKDUDecodeState::LLKDUDecodeState(kdu_tile tile, kdu_byte *buf, S32 row_gap) mEngines[c] = kdu_synthesis(res,&mAllocator,use_shorts); } } - mAllocator.finalize(); // Actually creates buffering resources + mAllocator.finalize(*codestreamp); // Actually creates buffering resources for (c = 0; c < mNumComponents; c++) { mLines[c].create(); // Grabs resources from the allocator. @@ -1247,7 +1253,7 @@ separation between consecutive rows in the real buffer. */ // kdc_flow_control -kdc_flow_control::kdc_flow_control (kdu_image_in_base *img_in, kdu_codestream codestream) +kdc_flow_control::kdc_flow_control (kdu_supp::kdu_image_in_base *img_in, kdu_codestream codestream) { int n; -- cgit v1.2.3 From 811a0b5726ed965f9f21ace2d3ec97bb95a91311 Mon Sep 17 00:00:00 2001 From: callum_linden Date: Tue, 26 Apr 2016 12:14:29 -0700 Subject: DRTVWR-418: add preprocessor define to fix linker error introduced in v7.8 --- indra/llkdu/llimagej2ckdu.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/llkdu/llimagej2ckdu.cpp') diff --git a/indra/llkdu/llimagej2ckdu.cpp b/indra/llkdu/llimagej2ckdu.cpp index f48e544813..4f93d85529 100755 --- a/indra/llkdu/llimagej2ckdu.cpp +++ b/indra/llkdu/llimagej2ckdu.cpp @@ -25,6 +25,12 @@ */ #include "linden_common.h" + +// based on this KDU support group posting: +// https://groups.yahoo.com/neo/groups/kakadu_jpeg2000/conversations/messages/6691 +// Defining this values seems to fix the linker error that appeared with the 7.8 release +#define CORESYS_IMPORTS + #include "llimagej2ckdu.h" #include "lltimer.h" -- cgit v1.2.3 From 0413e40d82cc53c1e8180023db36108557b6f21c Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 3 Nov 2016 20:48:41 -0400 Subject: DRTVWR-418: Update KDU and llimagej2ckdu* with certain clang fixes. --- indra/llkdu/llimagej2ckdu.cpp | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'indra/llkdu/llimagej2ckdu.cpp') diff --git a/indra/llkdu/llimagej2ckdu.cpp b/indra/llkdu/llimagej2ckdu.cpp index b85e39b452..0540e55e07 100644 --- a/indra/llkdu/llimagej2ckdu.cpp +++ b/indra/llkdu/llimagej2ckdu.cpp @@ -37,7 +37,6 @@ #include "llpointer.h" #include "llmath.h" #include "llkdumem.h" -#include "stringize.h" #define kdu_xxxx "kdu_block_coding.h" #include "include_kdu_xxxx.h" @@ -50,6 +49,18 @@ using namespace kdu_core; #include #include +// stream kdu_dims to std::ostream +// Turns out this must NOT be in the anonymous namespace! +// It must also precede #include "stringize.h". +inline +std::ostream& operator<<(std::ostream& out, const kdu_dims& dims) +{ + return out << "(" << dims.pos.x << "," << dims.pos.y << ")," + "[" << dims.size.x << "x" << dims.size.y << "]"; +} + +#include "stringize.h" + namespace { // Failure to load an image shouldn't crash the whole viewer. struct KDUError: public LLContinueError @@ -92,15 +103,6 @@ std::string report_kdu_exception(kdu_exception mb) } } // anonymous namespace -// stream kdu_dims to std::ostream -// Turns out this must NOT be in the anonymous namespace! -inline -std::ostream& operator<<(std::ostream& out, const kdu_dims& dims) -{ - return out << "(" << dims.pos.x << "," << dims.pos.y << ")," - "[" << dims.size.x << "x" << dims.size.y << "]"; -} - class kdc_flow_control { public: @@ -356,9 +358,9 @@ void LLImageJ2CKDU::setupCodeStream(LLImageJ2C &base, bool keep_codestream, ECod // This method is only called from methods that catch KDUError. // We want to fail the image load, not crash the viewer. LLTHROW(KDUError(STRINGIZE("Component " << idx << " dimensions " - << other_dims - << " do not match component 0 dimensions " - << dims << "!"))); + << stringize(other_dims) + << " do not match component 0 dimensions " + << stringize(dims) << "!"))); } } @@ -570,7 +572,8 @@ bool LLImageJ2CKDU::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco kdu_coords offset = tile_dims.pos - dims.pos; int row_gap = channels*dims.size.x; // inter-row separation kdu_byte *buf = buffer + offset.y*row_gap + offset.x*channels; - mDecodeState.reset(new LLKDUDecodeState(tile, buf, row_gap)); + mDecodeState.reset(new LLKDUDecodeState(tile, buf, row_gap, + mCodeStreamp.get())); } // Do the actual processing F32 remaining_time = decode_time - decode_timer.getElapsedTimeF32(); -- cgit v1.2.3 From 7b2cf53f782ac9ffa2766d006c870f10c320c9a0 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Wed, 30 Nov 2016 12:21:05 -0800 Subject: Pull in new version of KDU third party package that is build (correctly) as a static library vs. a stub library/DLL --- indra/llkdu/llimagej2ckdu.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'indra/llkdu/llimagej2ckdu.cpp') diff --git a/indra/llkdu/llimagej2ckdu.cpp b/indra/llkdu/llimagej2ckdu.cpp index 0540e55e07..cb29da8f5f 100644 --- a/indra/llkdu/llimagej2ckdu.cpp +++ b/indra/llkdu/llimagej2ckdu.cpp @@ -26,11 +26,6 @@ #include "linden_common.h" -// based on this KDU support group posting: -// https://groups.yahoo.com/neo/groups/kakadu_jpeg2000/conversations/messages/6691 -// Defining this values seems to fix the linker error that appeared with the 7.8 release -#define CORESYS_IMPORTS - #include "llimagej2ckdu.h" #include "lltimer.h" -- cgit v1.2.3