Automated merge up from viewer-development

master
Loren Shih 2010-12-22 13:02:36 -05:00
commit a86e35aa0d
25 changed files with 1687 additions and 309 deletions

View File

@ -43,6 +43,7 @@ add_subdirectory(${LIBS_OPEN_PREFIX}llaudio)
add_subdirectory(${LIBS_OPEN_PREFIX}llcharacter)
add_subdirectory(${LIBS_OPEN_PREFIX}llcommon)
add_subdirectory(${LIBS_OPEN_PREFIX}llimage)
add_subdirectory(${LIBS_OPEN_PREFIX}llkdu)
add_subdirectory(${LIBS_OPEN_PREFIX}llimagej2coj)
add_subdirectory(${LIBS_OPEN_PREFIX}llinventory)
add_subdirectory(${LIBS_OPEN_PREFIX}llmath)
@ -53,10 +54,6 @@ add_subdirectory(${LIBS_OPEN_PREFIX}llvfs)
add_subdirectory(${LIBS_OPEN_PREFIX}llwindow)
add_subdirectory(${LIBS_OPEN_PREFIX}llxml)
if (EXISTS ${LIBS_CLOSED_DIR}llkdu)
add_subdirectory(${LIBS_CLOSED_PREFIX}llkdu)
endif (EXISTS ${LIBS_CLOSED_DIR}llkdu)
add_subdirectory(${LIBS_OPEN_PREFIX}lscript)
if (WINDOWS AND EXISTS ${LIBS_CLOSED_DIR}copy_win_scripts)

View File

@ -10,10 +10,10 @@ else (STANDALONE)
use_prebuilt_binary(curl)
if (WINDOWS)
set(CURL_LIBRARIES
debug libcurld
optimized libcurl)
debug libcurld.lib
optimized libcurl.lib)
else (WINDOWS)
set(CURL_LIBRARIES curl)
set(CURL_LIBRARIES libcurl.a)
endif (WINDOWS)
set(CURL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
endif (STANDALONE)

View File

@ -64,22 +64,6 @@ if(WINDOWS)
set(release_files ${release_files} fmod.dll)
endif (FMOD)
#*******************************
# LLKDU
set(internal_llkdu_path "${CMAKE_SOURCE_DIR}/llkdu")
if(NOT EXISTS ${internal_llkdu_path})
if (EXISTS "${debug_src_dir}/llkdu.dll")
set(debug_llkdu_src "${debug_src_dir}/llkdu.dll")
set(debug_llkdu_dst "${SHARED_LIB_STAGING_DIR_DEBUG}/llkdu.dll")
endif (EXISTS "${debug_src_dir}/llkdu.dll")
if (EXISTS "${release_src_dir}/llkdu.dll")
set(release_llkdu_src "${release_src_dir}/llkdu.dll")
set(release_llkdu_dst "${SHARED_LIB_STAGING_DIR_RELEASE}/llkdu.dll")
set(relwithdebinfo_llkdu_dst "${SHARED_LIB_STAGING_DIR_RELWITHDEBINFO}/llkdu.dll")
endif (EXISTS "${release_src_dir}/llkdu.dll")
endif (NOT EXISTS ${internal_llkdu_path})
#*******************************
# Copy MS C runtime dlls, required for packaging.
# *TODO - Adapt this to support VC9
@ -180,21 +164,6 @@ elseif(DARWIN)
# fmod is statically linked on darwin
set(fmod_files "")
#*******************************
# LLKDU
set(internal_llkdu_path "${CMAKE_SOURCE_DIR}/llkdu")
if(NOT EXISTS ${internal_llkdu_path})
if (EXISTS "${debug_src_dir}/libllkdu.dylib")
set(debug_llkdu_src "${debug_src_dir}/libllkdu.dylib")
set(debug_llkdu_dst "${SHARED_LIB_STAGING_DIR_DEBUG}/libllkdu.dylib")
endif (EXISTS "${debug_src_dir}/libllkdu.dylib")
if (EXISTS "${release_src_dir}/libllkdu.dylib")
set(release_llkdu_src "${release_src_dir}/libllkdu.dylib")
set(release_llkdu_dst "${SHARED_LIB_STAGING_DIR_RELEASE}/libllkdu.dylib")
set(relwithdebinfo_llkdu_dst "${SHARED_LIB_STAGING_DIR_RELWITHDEBINFO}/libllkdu.dylib")
endif (EXISTS "${release_src_dir}/libllkdu.dylib")
endif (NOT EXISTS ${internal_llkdu_path})
elseif(LINUX)
# linux is weird, multiple side by side configurations aren't supported
# and we don't seem to have any debug shared libs built yet anyways...
@ -249,21 +218,6 @@ elseif(LINUX)
set(release_files ${release_files} "libfmod-3.75.so")
endif (FMOD)
#*******************************
# LLKDU
set(internal_llkdu_path "${CMAKE_SOURCE_DIR}/llkdu")
if(NOT EXISTS ${internal_llkdu_path})
if (EXISTS "${debug_src_dir}/libllkdu.so")
set(debug_llkdu_src "${debug_src_dir}/libllkdu.so")
set(debug_llkdu_dst "${SHARED_LIB_STAGING_DIR_DEBUG}/libllkdu.so")
endif (EXISTS "${debug_src_dir}/libllkdu.so")
if (EXISTS "${release_src_dir}/libllkdu.so")
set(release_llkdu_src "${release_src_dir}/libllkdu.so")
set(release_llkdu_dst "${SHARED_LIB_STAGING_DIR_RELEASE}/libllkdu.so")
set(relwithdebinfo_llkdu_dst "${SHARED_LIB_STAGING_DIR_RELWITHDEBINFO}/libllkdu.so")
endif (EXISTS "${release_src_dir}/libllkdu.so")
endif(NOT EXISTS ${internal_llkdu_path})
else(WINDOWS)
message(STATUS "WARNING: unrecognized platform for staging 3rd party libs, skipping...")
set(vivox_src_dir "${CMAKE_SOURCE_DIR}/newview/vivox-runtime/i686-linux")
@ -341,40 +295,29 @@ copy_if_different(
)
set(third_party_targets ${third_party_targets} ${out_targets})
#*******************************
# LLKDU
set(internal_llkdu_path "${CMAKE_SOURCE_DIR}/llkdu")
if(NOT EXISTS ${internal_llkdu_path})
if (EXISTS "${debug_llkdu_src}")
ADD_CUSTOM_COMMAND(
OUTPUT ${debug_llkdu_dst}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${debug_llkdu_src} ${debug_llkdu_dst}
DEPENDS ${debug_llkdu_src}
COMMENT "Copying llkdu.dll ${SHARED_LIB_STAGING_DIR_DEBUG}"
)
set(third_party_targets ${third_party_targets} $} ${debug_llkdu_dst})
endif (EXISTS "${debug_llkdu_src}")
if (EXISTS "${release_llkdu_src}")
ADD_CUSTOM_COMMAND(
OUTPUT ${release_llkdu_dst}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${release_llkdu_src} ${release_llkdu_dst}
DEPENDS ${release_llkdu_src}
COMMENT "Copying llkdu.dll ${SHARED_LIB_STAGING_DIR_RELEASE}"
)
set(third_party_targets ${third_party_targets} ${release_llkdu_dst})
ADD_CUSTOM_COMMAND(
OUTPUT ${relwithdebinfo_llkdu_dst}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${release_llkdu_src} ${relwithdebinfo_llkdu_dst}
DEPENDS ${release_llkdu_src}
COMMENT "Copying llkdu.dll ${SHARED_LIB_STAGING_DIR_RELWITHDEBINFO}"
)
set(third_party_targets ${third_party_targets} ${relwithdebinfo_llkdu_dst})
endif (EXISTS "${release_llkdu_src}")
endif (NOT EXISTS ${internal_llkdu_path})
if (FMOD_SDK_DIR)
copy_if_different(
${FMOD_SDK_DIR}
"${CMAKE_CURRENT_BINARY_DIR}/Debug"
out_targets
${fmod_files}
)
set(all_targets ${all_targets} ${out_targets})
copy_if_different(
${FMOD_SDK_DIR}
"${CMAKE_CURRENT_BINARY_DIR}/Release"
out_targets
${fmod_files}
)
set(all_targets ${all_targets} ${out_targets})
copy_if_different(
${FMOD_SDK_DIR}
"${CMAKE_CURRENT_BINARY_DIR}/RelWithDbgInfo"
out_targets
${fmod_files}
)
set(all_targets ${all_targets} ${out_targets})
endif (FMOD_SDK_DIR)
if(NOT STANDALONE)
add_custom_target(

View File

@ -1,7 +1,20 @@
# -*- cmake -*-
include(Prebuilt)
# USE_KDU can be set when launching cmake or develop.py as an option using the argument -DUSE_KDU:BOOL=ON
# When building using proprietary binaries though (i.e. having access to LL private servers), we always build with KDU
if (INSTALL_PROPRIETARY AND NOT STANDALONE)
use_prebuilt_binary(kdu)
set(LLKDU_LIBRARY llkdu)
set(USE_KDU ON)
endif (INSTALL_PROPRIETARY AND NOT STANDALONE)
if (USE_KDU)
use_prebuilt_binary(kdu)
if (WINDOWS)
set(KDU_LIBRARY kdu.lib)
else (WINDOWS)
set(KDU_LIBRARY libkdu.a)
endif (WINDOWS)
set(KDU_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/kdu)
set(LLKDU_INCLUDE_DIRS ${LIBS_OPEN_DIR}/llkdu)
set(LLKDU_LIBRARIES llkdu)
endif (USE_KDU)

View File

@ -10,6 +10,7 @@ include(00-Common)
include(LLCommon)
include(LLImage)
include(LLImageJ2COJ) # ugh, needed for images
include(LLKDU)
include(LLMath)
include(LLMessage)
include(LLRender)
@ -71,6 +72,11 @@ endif (DARWIN)
target_link_libraries(llui_libtest
llui
llmessage
${LLRENDER_LIBRARIES}
${LLIMAGE_LIBRARIES}
${LLKDU_LIBRARIES}
${KDU_LIBRARY}
${LLIMAGEJ2COJ_LIBRARIES}
${OS_LIBRARIES}
${GOOGLE_PERFTOOLS_LIBRARIES}
)

View File

@ -57,7 +57,6 @@ add_library (llimage ${llimage_SOURCE_FILES})
# Sort by high-level to low-level
target_link_libraries(llimage
llcommon
llimagej2coj # *HACK: In theory a noop for KDU builds?
${JPEG_LIBRARIES}
${PNG_LIBRARIES}
${ZLIB_LIBRARIES}

View File

@ -52,13 +52,11 @@ LLMutex* LLImage::sMutex = NULL;
void LLImage::initClass()
{
sMutex = new LLMutex(NULL);
LLImageJ2C::openDSO();
}
//static
void LLImage::cleanupClass()
{
LLImageJ2C::closeDSO();
delete sMutex;
sMutex = NULL;
}

View File

@ -24,9 +24,6 @@
*/
#include "linden_common.h"
#include "apr_pools.h"
#include "apr_dso.h"
#include "lldir.h"
#include "llimagej2c.h"
#include "llmemtype.h"
@ -37,18 +34,10 @@ typedef LLImageJ2CImpl* (*CreateLLImageJ2CFunction)();
typedef void (*DestroyLLImageJ2CFunction)(LLImageJ2CImpl*);
typedef const char* (*EngineInfoLLImageJ2CFunction)();
//some "private static" variables so we only attempt to load
//dynamic libaries once
CreateLLImageJ2CFunction j2cimpl_create_func;
DestroyLLImageJ2CFunction j2cimpl_destroy_func;
EngineInfoLLImageJ2CFunction j2cimpl_engineinfo_func;
apr_pool_t *j2cimpl_dso_memory_pool;
apr_dso_handle_t *j2cimpl_dso_handle;
//Declare the prototype for theses functions here, their functionality
//will be implemented in other files which define a derived LLImageJ2CImpl
//but only ONE static library which has the implementation for this
//function should ever be included
// Declare the prototype for theses functions here. Their functionality
// will be implemented in other files which define a derived LLImageJ2CImpl
// but only ONE static library which has the implementation for these
// functions should ever be included.
LLImageJ2CImpl* fallbackCreateLLImageJ2CImpl();
void fallbackDestroyLLImageJ2CImpl(LLImageJ2CImpl* impl);
const char* fallbackEngineInfoLLImageJ2CImpl();
@ -57,121 +46,10 @@ const char* fallbackEngineInfoLLImageJ2CImpl();
LLImageCompressionTester* LLImageJ2C::sTesterp = NULL ;
const std::string sTesterName("ImageCompressionTester");
//static
//Loads the required "create", "destroy" and "engineinfo" functions needed
void LLImageJ2C::openDSO()
{
//attempt to load a DSO and get some functions from it
std::string dso_name;
std::string dso_path;
bool all_functions_loaded = false;
apr_status_t rv;
#if LL_WINDOWS
dso_name = "llkdu.dll";
#elif LL_DARWIN
dso_name = "libllkdu.dylib";
#else
dso_name = "libllkdu.so";
#endif
dso_path = gDirUtilp->findFile(dso_name,
gDirUtilp->getAppRODataDir(),
gDirUtilp->getExecutableDir());
j2cimpl_dso_handle = NULL;
j2cimpl_dso_memory_pool = NULL;
//attempt to load the shared library
apr_pool_create(&j2cimpl_dso_memory_pool, NULL);
rv = apr_dso_load(&j2cimpl_dso_handle,
dso_path.c_str(),
j2cimpl_dso_memory_pool);
//now, check for success
if ( rv == APR_SUCCESS )
{
//found the dynamic library
//now we want to load the functions we're interested in
CreateLLImageJ2CFunction create_func = NULL;
DestroyLLImageJ2CFunction dest_func = NULL;
EngineInfoLLImageJ2CFunction engineinfo_func = NULL;
rv = apr_dso_sym((apr_dso_handle_sym_t*)&create_func,
j2cimpl_dso_handle,
"createLLImageJ2CKDU");
if ( rv == APR_SUCCESS )
{
//we've loaded the create function ok
//we need to delete via the DSO too
//so lets check for a destruction function
rv = apr_dso_sym((apr_dso_handle_sym_t*)&dest_func,
j2cimpl_dso_handle,
"destroyLLImageJ2CKDU");
if ( rv == APR_SUCCESS )
{
//we've loaded the destroy function ok
rv = apr_dso_sym((apr_dso_handle_sym_t*)&engineinfo_func,
j2cimpl_dso_handle,
"engineInfoLLImageJ2CKDU");
if ( rv == APR_SUCCESS )
{
//ok, everything is loaded alright
j2cimpl_create_func = create_func;
j2cimpl_destroy_func = dest_func;
j2cimpl_engineinfo_func = engineinfo_func;
all_functions_loaded = true;
}
}
}
}
if ( !all_functions_loaded )
{
//something went wrong with the DSO or function loading..
//fall back onto our satefy impl creation function
#if 0
// precious verbose debugging, sadly we can't use our
// 'llinfos' stream etc. this early in the initialisation seq.
char errbuf[256];
fprintf(stderr, "failed to load syms from DSO %s (%s)\n",
dso_name.c_str(), dso_path.c_str());
apr_strerror(rv, errbuf, sizeof(errbuf));
fprintf(stderr, "error: %d, %s\n", rv, errbuf);
apr_dso_error(j2cimpl_dso_handle, errbuf, sizeof(errbuf));
fprintf(stderr, "dso-error: %d, %s\n", rv, errbuf);
#endif
if ( j2cimpl_dso_handle )
{
apr_dso_unload(j2cimpl_dso_handle);
j2cimpl_dso_handle = NULL;
}
if ( j2cimpl_dso_memory_pool )
{
apr_pool_destroy(j2cimpl_dso_memory_pool);
j2cimpl_dso_memory_pool = NULL;
}
}
}
//static
void LLImageJ2C::closeDSO()
{
if ( j2cimpl_dso_handle ) apr_dso_unload(j2cimpl_dso_handle);
if (j2cimpl_dso_memory_pool) apr_pool_destroy(j2cimpl_dso_memory_pool);
}
//static
std::string LLImageJ2C::getEngineInfo()
{
if (!j2cimpl_engineinfo_func)
j2cimpl_engineinfo_func = fallbackEngineInfoLLImageJ2CImpl;
return j2cimpl_engineinfo_func();
return fallbackEngineInfoLLImageJ2CImpl();
}
LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C),
@ -181,20 +59,7 @@ LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C),
mReversible(FALSE),
mAreaUsedForDataSizeCalcs(0)
{
//We assume here that if we wanted to create via
//a dynamic library that the approriate open calls were made
//before any calls to this constructor.
//Therefore, a NULL creation function pointer here means
//we either did not want to create using functions from the dynamic
//library or there were issues loading it, either way
//use our fall back
if ( !j2cimpl_create_func )
{
j2cimpl_create_func = fallbackCreateLLImageJ2CImpl;
}
mImpl = j2cimpl_create_func();
mImpl = fallbackCreateLLImageJ2CImpl();
// Clear data size table
for( S32 i = 0; i <= MAX_DISCARD_LEVEL; i++)
@ -217,22 +82,9 @@ LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C),
// virtual
LLImageJ2C::~LLImageJ2C()
{
//We assume here that if we wanted to destroy via
//a dynamic library that the approriate open calls were made
//before any calls to this destructor.
//Therefore, a NULL creation function pointer here means
//we either did not want to destroy using functions from the dynamic
//library or there were issues loading it, either way
//use our fall back
if ( !j2cimpl_destroy_func )
{
j2cimpl_destroy_func = fallbackDestroyLLImageJ2CImpl;
}
if ( mImpl )
{
j2cimpl_destroy_func(mImpl);
fallbackDestroyLLImageJ2CImpl(mImpl);
}
}

View File

@ -72,8 +72,6 @@ public:
static S32 calcHeaderSizeJ2C();
static S32 calcDataSizeJ2C(S32 w, S32 h, S32 comp, S32 discard_level, F32 rate = 0.f);
static void openDSO();
static void closeDSO();
static std::string getEngineInfo();
protected:

View File

@ -0,0 +1,45 @@
# -*- cmake -*-
project(llkdu)
# Visual Studio 2005 has a dumb bug that causes it to fail compilation
# of KDU if building with both optimisation and /WS (treat warnings as
# errors), even when the specific warnings that make it croak are
# disabled.
#set(VS_DISABLE_FATAL_WARNINGS ON)
include(00-Common)
include(LLCommon)
include(LLImage)
include(LLKDU)
include(LLMath)
include_directories(
${LLCOMMON_INCLUDE_DIRS}
${LLIMAGE_INCLUDE_DIRS}
${KDU_INCLUDE_DIR}
${LLMATH_INCLUDE_DIRS}
)
set(llkdu_SOURCE_FILES
llimagej2ckdu.cpp
llkdumem.cpp
)
set(llkdu_HEADER_FILES
CMakeLists.txt
llimagej2ckdu.h
llkdumem.h
)
set_source_files_properties(${llkdu_HEADER_FILES}
PROPERTIES HEADER_FILE_ONLY TRUE)
list(APPEND llkdu_SOURCE_FILES ${llkdu_HEADER_FILES})
if (USE_KDU)
add_library (${LLKDU_LIBRARIES} ${llkdu_SOURCE_FILES})
endif (USE_KDU)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,91 @@
/**
* @file llimagej2ckdu.h
* @brief This is an implementation of JPEG2000 encode/decode using Kakadu
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLIMAGEJ2CKDU_H
#define LL_LLIMAGEJ2CKDU_H
#include "llimagej2c.h"
//
// KDU core header files
//
#include "kdu_elementary.h"
#include "kdu_messaging.h"
#include "kdu_params.h"
#include "kdu_compressed.h"
#include "kdu_sample_processing.h"
class LLKDUDecodeState;
class LLKDUMemSource;
class LLImageJ2CKDU : public LLImageJ2CImpl
{
public:
enum ECodeStreamMode
{
MODE_FAST = 0,
MODE_RESILIENT = 1,
MODE_FUSSY = 2
};
public:
LLImageJ2CKDU();
virtual ~LLImageJ2CKDU();
protected:
/*virtual*/ BOOL getMetadata(LLImageJ2C &base);
/*virtual*/ BOOL decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count);
/*virtual*/ BOOL encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time=0.0,
BOOL reversible=FALSE);
void setupCodeStream(LLImageJ2C &base, BOOL keep_codestream, ECodeStreamMode mode);
void cleanupCodeStream();
BOOL initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, ECodeStreamMode mode, S32 first_channel, S32 max_channel_count );
// Encode variable
LLKDUMemSource *mInputp;
kdu_codestream *mCodeStreamp;
kdu_coords *mTPosp; // tile position
kdu_dims *mTileIndicesp;
// Temporary variables for in-progress decodes...
LLImageRaw *mRawImagep;
LLKDUDecodeState *mDecodeState;
};
#if LL_WINDOWS
# define LLSYMEXPORT __declspec(dllexport)
#elif LL_LINUX
# define LLSYMEXPORT __attribute__ ((visibility("default")))
#else
# define LLSYMEXPORT
#endif
extern "C" LLSYMEXPORT const char* engineInfoLLImageJ2CKDU();
extern "C" LLSYMEXPORT LLImageJ2CKDU* createLLImageJ2CKDU();
extern "C" LLSYMEXPORT void destroyLLImageJ2CKDU(LLImageJ2CKDU* kdu);
#endif

196
indra/llkdu/llkdumem.cpp Normal file
View File

@ -0,0 +1,196 @@
/**
* @file llkdumem.cpp
* @brief Helper class for kdu memory management
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "linden_common.h"
#include "llkdumem.h"
#include "llerror.h"
#if defined(LL_WINDOWS)
# pragma warning(disable: 4702) // unreachable code
#endif
LLKDUMemIn::LLKDUMemIn(const U8 *data,
const U32 size,
const U16 width,
const U16 height,
const U8 in_num_components,
siz_params *siz)
{
U8 n;
first_comp_idx = 0;
rows = height;
cols = width;
num_components = in_num_components;
alignment_bytes = 0;
for (n=0; n<3; ++n)
{
precision[n] = 0;
}
for (n=0; n < num_components; ++n)
{
siz->set(Sdims,n,0,rows);
siz->set(Sdims,n,1,cols);
siz->set(Ssigned,n,0,false);
siz->set(Sprecision,n,0,8);
}
incomplete_lines = NULL;
free_lines = NULL;
num_unread_rows = rows;
mData = data;
mDataSize = size;
mCurPos = 0;
}
LLKDUMemIn::~LLKDUMemIn()
{
if ((num_unread_rows > 0) || (incomplete_lines != NULL))
{
kdu_warning w;
w << "Not all rows of image components "
<< first_comp_idx << " through "
<< first_comp_idx+num_components-1
<< " were consumed!";
}
image_line_buf *tmp;
while ((tmp=incomplete_lines) != NULL)
{
incomplete_lines = tmp->next;
delete tmp;
}
while ((tmp=free_lines) != NULL)
{
free_lines = tmp->next;
delete tmp;
}
}
bool LLKDUMemIn::get(int comp_idx, kdu_line_buf &line, int x_tnum)
{
int idx = comp_idx - this->first_comp_idx;
assert((idx >= 0) && (idx < num_components));
x_tnum = x_tnum*num_components+idx;
image_line_buf *scan, *prev=NULL;
for (scan=incomplete_lines; scan != NULL; prev=scan, scan=scan->next)
{
assert(scan->next_x_tnum >= x_tnum);
if (scan->next_x_tnum == x_tnum)
{
break;
}
}
if (scan == NULL)
{ // Need to read a new image line.
assert(x_tnum == 0); // Must consume in very specific order.
if (num_unread_rows == 0)
{
return false;
}
if ((scan = free_lines) == NULL)
{
scan = new image_line_buf(cols+3,num_components);
}
free_lines = scan->next;
if (prev == NULL)
{
incomplete_lines = scan;
}
else
{
prev->next = scan;
}
// Copy from image buffer into scan.
memcpy(scan->buf, mData+mCurPos, cols*num_components);
mCurPos += cols*num_components;
num_unread_rows--;
scan->accessed_samples = 0;
scan->next_x_tnum = 0;
}
assert((cols-scan->accessed_samples) >= line.get_width());
int comp_offset = idx;
kdu_byte *sp = scan->buf+num_components*scan->accessed_samples + comp_offset;
int n=line.get_width();
if (line.get_buf32() != NULL)
{
kdu_sample32 *dp = line.get_buf32();
if (line.is_absolute())
{ // 32-bit absolute integers
for (; n > 0; n--, sp+=num_components, dp++)
{
dp->ival = ((kdu_int32)(*sp)) - 128;
}
}
else
{ // true 32-bit floats
for (; n > 0; n--, sp+=num_components, dp++)
{
dp->fval = (((float)(*sp)) / 256.0F) - 0.5F;
}
}
}
else
{
kdu_sample16 *dp = line.get_buf16();
if (line.is_absolute())
{ // 16-bit absolute integers
for (; n > 0; n--, sp+=num_components, dp++)
{
dp->ival = ((kdu_int16)(*sp)) - 128;
}
}
else
{ // 16-bit normalized representation.
for (; n > 0; n--, sp+=num_components, dp++)
{
dp->ival = (((kdu_int16)(*sp)) - 128) << (KDU_FIX_POINT-8);
}
}
}
scan->next_x_tnum++;
if (idx == (num_components-1))
{
scan->accessed_samples += line.get_width();
}
if (scan->accessed_samples == cols)
{ // Send empty line to free list.
assert(scan == incomplete_lines);
incomplete_lines = scan->next;
scan->next = free_lines;
free_lines = scan;
}
return true;
}

145
indra/llkdu/llkdumem.h Normal file
View File

@ -0,0 +1,145 @@
/**
* @file llkdumem.h
* @brief Helper class for kdu memory management
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLKDUMEM_H
#define LL_LLKDUMEM_H
// Support classes for reading and writing from memory buffers in KDU
#include "kdu_image.h"
#include "kdu_elementary.h"
#include "kdu_messaging.h"
#include "kdu_params.h"
#include "kdu_compressed.h"
#include "kdu_sample_processing.h"
#include "image_local.h"
#include "stdtypes.h"
class LLKDUMemSource: public kdu_compressed_source
{
public: // Member functions
LLKDUMemSource(U8 *input_buffer, U32 size)
{
mData = input_buffer;
mSize = size;
mCurPos = 0;
}
~LLKDUMemSource()
{
}
int read(kdu_byte *buf, int num_bytes)
{
U32 num_out;
num_out = num_bytes;
if ((mSize - mCurPos) < (U32)num_bytes)
{
num_out = mSize -mCurPos;
}
memcpy(buf, mData + mCurPos, num_out);
mCurPos += num_out;
return num_out;
}
void reset()
{
mCurPos = 0;
}
private: // Data
U8 *mData;
U32 mSize;
U32 mCurPos;
};
class LLKDUMemTarget: public kdu_compressed_target
{
public: // Member functions
LLKDUMemTarget(U8 *output_buffer, U32 &output_size, const U32 buffer_size)
{
mData = output_buffer;
mSize = buffer_size;
mCurPos = 0;
mOutputSize = &output_size;
}
~LLKDUMemTarget()
{
}
bool write(const kdu_byte *buf, int num_bytes)
{
U32 num_out;
num_out = num_bytes;
if ((mSize - mCurPos) < (U32)num_bytes)
{
num_out = mSize - mCurPos;
memcpy(mData + mCurPos, buf, num_out);
return false;
}
memcpy(mData + mCurPos, buf, num_out);
mCurPos += num_out;
*mOutputSize = mCurPos;
return true;
}
private: // Data
U8 *mData;
U32 mSize;
U32 mCurPos;
U32 *mOutputSize;
};
class LLKDUMemIn : public kdu_image_in_base
{
public: // Member functions
LLKDUMemIn(const U8 *data,
const U32 size,
const U16 rows,
const U16 cols,
U8 in_num_components,
siz_params *siz);
~LLKDUMemIn();
bool get(int comp_idx, kdu_line_buf &line, int x_tnum);
private: // Data
const U8 *mData;
int first_comp_idx;
int num_components;
int rows, cols;
int alignment_bytes; // Number of 0's at end of each line.
int precision[3];
image_line_buf *incomplete_lines; // Each "sample" represents a full pixel
image_line_buf *free_lines;
int num_unread_rows;
U32 mCurPos;
U32 mDataSize;
};
#endif

View File

@ -3,6 +3,7 @@
project(mac_updater)
include(00-Common)
include(OpenSSL)
include(CURL)
include(LLCommon)
include(LLVFS)
@ -49,6 +50,8 @@ set_target_properties(mac-updater
target_link_libraries(mac-updater
${LLVFS_LIBRARIES}
${OPENSSL_LIBRARIES}
${CRYPTO_LIBRARIES}
${CURL_LIBRARIES}
${LLCOMMON_LIBRARIES}
)

View File

@ -54,6 +54,7 @@ include_directories(
${LLCOMMON_INCLUDE_DIRS}
${LLCONVEXDECOMP_INCLUDE_DIRS}
${LLIMAGE_INCLUDE_DIRS}
${LLKDU_INCLUDE_DIRS}
${LLINVENTORY_INCLUDE_DIRS}
${LLMATH_INCLUDE_DIRS}
${LLMESSAGE_INCLUDE_DIRS}
@ -1481,11 +1482,6 @@ if (WINDOWS)
# In the meantime, if you have any ideas on how to easily maintain one list, either here or in viewer_manifest.py
# and have the build deps get tracked *please* tell me about it.
if(LLKDU_LIBRARY)
# Configure a var for llkdu which may not exist for all builds.
set(LLKDU_DLL_SOURCE ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/llkdu.dll)
endif(LLKDU_LIBRARY)
if(USE_GOOGLE_PERFTOOLS)
# Configure a var for tcmalloc location, if used.
# Note the need to specify multiple names explicitly.
@ -1502,7 +1498,6 @@ if (WINDOWS)
#${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libtcmalloc_minimal.dll => None ... Skipping libtcmalloc_minimal.dll
${CMAKE_SOURCE_DIR}/../etc/message.xml
${CMAKE_SOURCE_DIR}/../scripts/messages/message_template.msg
${LLKDU_DLL_SOURCE}
${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/llcommon.dll
${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libapr-1.dll
${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libaprutil-1.dll
@ -1695,7 +1690,6 @@ target_link_libraries(${VIEWER_BINARY_NAME}
${LLAUDIO_LIBRARIES}
${LLCHARACTER_LIBRARIES}
${LLIMAGE_LIBRARIES}
${LLIMAGEJ2COJ_LIBRARIES}
${LLINVENTORY_LIBRARIES}
${LLMESSAGE_LIBRARIES}
${LLPLUGIN_LIBRARIES}
@ -1733,6 +1727,17 @@ target_link_libraries(${VIEWER_BINARY_NAME}
${TCMALLOC_LIBRARIES}
)
if (USE_KDU)
target_link_libraries(${VIEWER_BINARY_NAME}
${LLKDU_LIBRARIES}
${KDU_LIBRARY}
)
else (USE_KDU)
target_link_libraries(${VIEWER_BINARY_NAME}
${LLIMAGEJ2COJ_LIBRARIES}
)
endif (USE_KDU)
build_version(viewer)
set(ARTWORK_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH

View File

@ -33,6 +33,7 @@
#include "llfloaterreg.h"
#include "llcommandhandler.h"
#include "llviewercontrol.h"
#include "llstatusbar.h"
// support for secondlife:///app/buycurrencyhtml/{ACTION}/{NEXT_ACTION}/{RETURN_CODE} SLapps
class LLBuyCurrencyHTMLHandler :
@ -156,4 +157,7 @@ void LLBuyCurrencyHTML::closeDialog()
{
buy_currency_floater->closeFloater();
};
// Update L$ balance in the status bar in case L$ were purchased
LLStatusBar::sendMoneyBalanceRequest();
}

View File

@ -267,17 +267,23 @@ void LLFloaterBuyCurrencyUI::onClickBuy()
{
mManager.buy(getString("buy_currency"));
updateUI();
// Update L$ balance
LLStatusBar::sendMoneyBalanceRequest();
}
void LLFloaterBuyCurrencyUI::onClickCancel()
{
closeFloater();
// Update L$ balance
LLStatusBar::sendMoneyBalanceRequest();
}
void LLFloaterBuyCurrencyUI::onClickErrorWeb()
{
LLWeb::loadURLExternal(mManager.errorURI());
closeFloater();
// Update L$ balance
LLStatusBar::sendMoneyBalanceRequest();
}
// static

View File

@ -82,7 +82,7 @@ void LLFloaterBuyCurrencyHTML::navigateToFinalURL()
LLStringUtil::format( buy_currency_url, replace );
// write final URL to debug console
llinfos << "Buy currency HTML prased URL is " << buy_currency_url << llendl;
llinfos << "Buy currency HTML parsed URL is " << buy_currency_url << llendl;
// kick off the navigation
mBrowser->navigateTo( buy_currency_url, "text/html" );
@ -105,7 +105,7 @@ void LLFloaterBuyCurrencyHTML::handleMediaEvent( LLPluginClassMedia* self, EMedi
//
void LLFloaterBuyCurrencyHTML::onClose( bool app_quitting )
{
// update L$ balanace one more time
// Update L$ balance one more time
LLStatusBar::sendMoneyBalanceRequest();
destroy();

View File

@ -115,6 +115,7 @@ LLStatusBar::LLStatusBar(const LLRect& rect)
mSGBandwidth(NULL),
mSGPacketLoss(NULL),
mBtnVolume(NULL),
mBoxBalance(NULL),
mBalance(0),
mHealth(100),
mSquareMetersCredit(0),
@ -168,6 +169,9 @@ BOOL LLStatusBar::postBuild()
getChild<LLUICtrl>("buyL")->setCommitCallback(
boost::bind(&LLStatusBar::onClickBuyCurrency, this));
mBoxBalance = getChild<LLTextBox>("balance");
mBoxBalance->setClickedCallback( &LLStatusBar::onClickBalance, this );
mBtnVolume = getChild<LLButton>( "volume_btn" );
mBtnVolume->setClickedCallback( onClickVolume, this );
mBtnVolume->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterVolume, this));
@ -304,6 +308,7 @@ void LLStatusBar::setVisibleForMouselook(bool visible)
{
mTextTime->setVisible(visible);
getChild<LLUICtrl>("balance_bg")->setVisible(visible);
mBoxBalance->setVisible(visible);
mBtnVolume->setVisible(visible);
mMediaToggle->setVisible(visible);
mSGBandwidth->setVisible(visible);
@ -330,16 +335,15 @@ void LLStatusBar::setBalance(S32 balance)
std::string money_str = LLResMgr::getInstance()->getMonetaryString( balance );
LLTextBox* balance_box = getChild<LLTextBox>("balance");
LLStringUtil::format_map_t string_args;
string_args["[AMT]"] = llformat("%s", money_str.c_str());
std::string label_str = getString("buycurrencylabel", string_args);
balance_box->setValue(label_str);
mBoxBalance->setValue(label_str);
// Resize the L$ balance background to be wide enough for your balance plus the buy button
{
const S32 HPAD = 24;
LLRect balance_rect = balance_box->getTextBoundingRect();
LLRect balance_rect = mBoxBalance->getTextBoundingRect();
LLRect buy_rect = getChildView("buyL")->getRect();
LLView* balance_bg_view = getChildView("balance_bg");
LLRect balance_bg_rect = balance_bg_view->getRect();
@ -505,6 +509,14 @@ static void onClickVolume(void* data)
LLAppViewer::instance()->setMasterSystemAudioMute(!mute_audio);
}
//static
void LLStatusBar::onClickBalance(void* )
{
// Force a balance request message:
LLStatusBar::sendMoneyBalanceRequest();
// The refresh of the display (call to setBalance()) will be done by process_money_balance_reply()
}
//static
void LLStatusBar::onClickMediaToggle(void* data)
{

View File

@ -94,6 +94,7 @@ private:
void onClickScreen(S32 x, S32 y);
static void onClickMediaToggle(void* data);
static void onClickBalance(void* data);
private:
LLTextBox *mTextTime;
@ -102,6 +103,7 @@ private:
LLStatGraph *mSGPacketLoss;
LLButton *mBtnVolume;
LLTextBox *mBoxBalance;
LLButton *mMediaToggle;
LLView* mScriptOut;
LLFrameTimer mClockUpdateTimer;

View File

@ -101,7 +101,7 @@
left_pad="5"
name="go"
top_delta="0"
width="55">
width="50">
<button.commit_callback
function="MediaBrowser.Go" />
</button>

View File

@ -51,7 +51,7 @@
height="18"
left="0"
name="balance"
tool_tip="My Balance"
tool_tip="Click to refresh your L$ balance"
v_pad="4"
top="0"
wrap="false"

View File

@ -254,12 +254,6 @@ class WindowsManifest(ViewerManifest):
self.enable_crt_manifest_check()
# Get kdu dll, continue if missing.
try:
self.path('llkdu.dll', dst='llkdu.dll')
except RuntimeError:
print "Skipping llkdu.dll"
# Get llcommon and deps. If missing assume static linkage and continue.
try:
self.path('llcommon.dll')
@ -638,21 +632,21 @@ class DarwinManifest(ViewerManifest):
libdir = "../../libraries/universal-darwin/lib_release"
dylibs = {}
# need to get the kdu dll from any of the build directories as well
for lib in "llkdu", "llcommon":
libfile = "lib%s.dylib" % lib
try:
self.path(self.find_existing_file(os.path.join(os.pardir,
lib,
self.args['configuration'],
libfile),
os.path.join(libdir, libfile)),
dst=libfile)
except RuntimeError:
print "Skipping %s" % libfile
dylibs[lib] = False
else:
dylibs[lib] = True
# Need to get the llcommon dll from any of the build directories as well
lib = "llcommon"
libfile = "lib%s.dylib" % lib
try:
self.path(self.find_existing_file(os.path.join(os.pardir,
lib,
self.args['configuration'],
libfile),
os.path.join(libdir, libfile)),
dst=libfile)
except RuntimeError:
print "Skipping %s" % libfile
dylibs[lib] = False
else:
dylibs[lib] = True
if dylibs["llcommon"]:
for libfile in ("libapr-1.0.3.7.dylib",
@ -949,14 +943,6 @@ class Linux_i686Manifest(LinuxManifest):
def construct(self):
super(Linux_i686Manifest, self).construct()
# install either the libllkdu we just built, or a prebuilt one, in
# decreasing order of preference. for linux package, this goes to bin/
try:
self.path(self.find_existing_file('../llkdu/libllkdu.so',
'../../libraries/i686-linux/lib_release_client/libllkdu.so'),
dst='bin/libllkdu.so')
except:
print "Skipping libllkdu.so - not found"
for lib, destdir in ("llkdu", "bin"), ("llcommon", "lib"):
libfile = "lib%s.so" % lib
try:
@ -987,7 +973,6 @@ class Linux_i686Manifest(LinuxManifest):
self.path("featuretable_linux.txt")
#self.path("secondlife-i686.supp")
if self.prefix("../../libraries/i686-linux/lib_release_client", dst="lib"):
self.path("libapr-1.so.0")
self.path("libaprutil-1.so.0")
@ -1007,12 +992,6 @@ class Linux_i686Manifest(LinuxManifest):
self.path("libopenal.so", "libvivoxoal.so.1") # vivox's sdk expects this soname
self.path("libtcmalloc_minimal.so", "libtcmalloc_minimal.so") #formerly called google perf tools
self.path("libtcmalloc_minimal.so.0", "libtcmalloc_minimal.so.0") #formerly called google perf tools
try:
self.path("libkdu.so")
pass
except:
print "Skipping libkdu.so - not found"
pass
try:
self.path("libfmod-3.75.so")
pass

View File

@ -299,16 +299,16 @@
<key>darwin</key>
<map>
<key>md5sum</key>
<string>752e295ccb17f0dcb7c0167db3ad1e69</string>
<string>ca8f0134fa5ab6f34a6eeb8d0896c9b0</string>
<key>url</key>
<uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/curl-7.20.1-darwin-20100606.tar.bz2</uri>
<uri>https://s3.amazonaws.com/automated-builds-secondlife-com/hg/repo/brad_curl-autobuild/rev/216961/arch/Darwin/installer/curl-7.21.1-darwin-20101214.tar.bz2</uri>
</map>
<key>linux</key>
<map>
<key>md5sum</key>
<string>a20e73f2e7d6a032ff25a5161b1b7394</string>
<string>9c9b629b62bf874d550c430ad678dc04</string>
<key>url</key>
<uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/curl-7.20.1-linux-20100527.tar.bz2</uri>
<uri>https://s3.amazonaws.com/automated-builds-secondlife-com/hg/repo/brad_curl-autobuild/rev/216961/arch/Linux/installer/curl-7.21.1-linux-20101215.tar.bz2</uri>
</map>
<key>linux64</key>
<map>
@ -903,23 +903,23 @@
<key>darwin</key>
<map>
<key>md5sum</key>
<string>ae18dd120807a46ac961b881a631ad94</string>
<string>8261994de5af6581e08c26fefe1b2810</string>
<key>url</key>
<uri>scp:install-packages.lindenlab.com:/local/www/install-packages/doc/indra_private-2.1.1-darwin-20100820.tar.bz2</uri>
<uri>scp:install-packages.lindenlab.com:/local/www/install-packages/doc/kdu-6.4.1-darwin-20101123.tar.bz2</uri>
</map>
<key>linux</key>
<map>
<key>md5sum</key>
<string>b1f15bbabb68445e55ce23a2aeaca598</string>
<string>ed3e58899a424684dad49c94ba3813e7</string>
<key>url</key>
<uri>scp:install-packages.lindenlab.com:/local/www/install-packages/doc/indra_private-2.1.1-linux-20100826.tar.bz2</uri>
<uri>scp:install-packages.lindenlab.com:/local/www/install-packages/doc/kdu-6.4.1-linux-20101124.tar.bz2</uri>
</map>
<key>windows</key>
<map>
<key>md5sum</key>
<string>0e2fe621ce99085eba00d86d9a3bc130</string>
<string>066e089a5d9faeaf131e1f4e4860a163</string>
<key>url</key>
<uri>scp:install-packages.lindenlab.com:/local/www/install-packages/doc/indra_private-2.1.1-windows-20100820.tar.bz2</uri>
<uri>scp:install-packages.lindenlab.com:/local/www/install-packages/doc/kdu-6.4.1-windows-20101123.tar.bz2</uri>
</map>
</map>
</map>