Sync merge with lindenlab/viewer-release

master
Merov Linden 2014-07-22 15:54:53 -07:00
commit 87a7eee21d
318 changed files with 32547 additions and 2939 deletions

View File

@ -482,3 +482,6 @@ d029faf69f20a23007f32420a1ac6a3b89a6d441 3.7.6-release
83959480cb986522d07b151a0c778ab7f920d41b 3.7.7-release
bba9b3722eea08949e4ff69591f736bf0f808434 3.7.8-release
a9f2d0cb11f73b06858e6083bb50083becc3f9cd 3.7.9-release
91dae9494b4d147541c7a01902334ba19a7ec05e 3.7.10-release
64799eb298834073a3e9992cd8d27c3cb9d30b10 3.7.11-release
3b44ea8988cb902f0dda8429e8d5e4569e304532 3.7.12-release

View File

@ -55,21 +55,9 @@ Amazon_viewer_channel_suffix = "Amazon"
Desura_sourceid = "1208_desura"
Desura_viewer_channel_suffix = "Desura"
# Report changes since...
viewer-development.show_changes_since = last_sprint
# Build Settings
viewer-development.build_debug_release_separately = true
# Notifications - to configure email notices, add a setting like this:
# <username>_<reponame>.email = <email-address>
viewer-release.viewer_channel = "Second Life Release"
viewer-release.build_debug_release_separately = true
viewer-release.build_viewer_update_version_manager = true
viewer-release.codeticket_add_context = false
# ========================================
# mesh-development
# ========================================
@ -121,25 +109,6 @@ viewer-mesh.viewer_channel = "Project Viewer - Mesh"
viewer-mesh.viewer_grid = aditi
viewer-mesh.email = shining@lists.lindenlab.com
# ========================================
# viewer-pathfinding
# ========================================
viewer-pathfinding.viewer_channel = "Project Viewer - Pathfinding"
viewer-pathfinding.viewer_grid = agni
viewer-pathfinding.build_debug_release_separately = true
viewer-pathfinding.build_CYGWIN_Debug = false
viewer-pathfinding.build_viewer_update_version_manager = false
# ========================================
# viewer-materials
# ========================================
viewer-materials.viewer_channel = "Second Life Beta Materials"
viewer-materials.build_debug_release_separately = true
viewer-materials.build_CYGWIN_Debug = false
viewer-materials.build_viewer_update_version_manager = false
# =================================================================
# asset delivery 2010 projects
# =================================================================

View File

@ -1251,14 +1251,14 @@
</map>
</map>
</map>
<key>libxml</key>
<key>libxml2</key>
<map>
<key>license</key>
<string>mit</string>
<key>license_file</key>
<string>LICENSES/libxml.txt</string>
<string>LICENSES/libxml2.txt</string>
<key>name</key>
<string>libxml</string>
<string>libxml2</string>
<key>platforms</key>
<map>
<key>linux</key>
@ -1266,9 +1266,9 @@
<key>archive</key>
<map>
<key>hash</key>
<string>6414642528f42dac1cd9a012c99cd748</string>
<string>fd34e3e818ad7dd26add1f05e6069c11</string>
<key>url</key>
<string>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/libxml-2.6.24-linux-20101013.tar.bz2</string>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-libxml/rev/282218/arch/Linux/installer/libxml2-2.7.8-linux-20131009.tar.bz2</string>
</map>
<key>name</key>
<string>linux</string>
@ -2321,7 +2321,7 @@
<string>make</string>
<key>options</key>
<array>
<string>-j 2</string>
<string>-j 7</string>
</array>
</map>
<key>configure</key>
@ -2371,7 +2371,7 @@
<string>make</string>
<key>options</key>
<array>
<string>-j 2</string>
<string>-j 7</string>
</array>
</map>
<key>configure</key>
@ -2419,7 +2419,7 @@
<string>make</string>
<key>options</key>
<array>
<string>-j 2</string>
<string>-j 7</string>
</array>
</map>
<key>configure</key>

View File

@ -180,6 +180,8 @@ Ansariel Hiller
MAINT-2368
STORM-1931
MAINT-2773
STORM-2011
MAINT-3187
BUG-3764
STORM-1984
STORM-1979
@ -313,11 +315,14 @@ Cinder Roxley
BUG-3863
OPEN-185
STORM-1703
STORM-1948
STORM-1948
STORM-1831
STORM-1888
STORM-1958
STORM-1952
STORM-1951
STORM-2035
STORM-2036
Clara Young
Coaldust Numbers
VWR-1095
@ -330,6 +335,9 @@ Cron Stardust
VWR-25120
STORM-1075
STORM-1919
STORM-1920
OPEN-209
STORM-2017
Cypren Christenson
STORM-417
Dante Tucker
@ -519,8 +527,16 @@ Ima Mechanique
STORM-959
STORM-1175
STORM-1708
STORM-1831
STORM-1832
STORM-1855
VWR-10791
VWR-20553
VWR-19213
VWR-22401
VWR-23739
VWR-24766
VWR-28065
Imnotgoing Sideways
Inma Rau
Innula Zenovka
@ -663,6 +679,7 @@ Jonathan Yap
STORM-1809
STORM-1793
STORM-1810
STORM-68
STORM-1838
STORM-1892
STORM-1894
@ -673,12 +690,15 @@ Jonathan Yap
STORM-1858
STORM-1862
STORM-1918
STORM-1915
STORM-1929
STORM-1953
OPEN-161
STORM-1953
STORM-1957
STORM-1993
STORM-2017
STORM-2007
STORM-1980
OPEN-113
STORM-1975
@ -691,6 +711,8 @@ Jonathan Yap
STORM-1987
STORM-1986
STORM-1981
STORM-2015
STORM-2018
Kadah Coba
STORM-1060
STORM-1843
@ -744,6 +766,7 @@ Kunnis Basiat
Lance Corrimal
STORM-1910
VWR-25269
STORM-2008
Latif Khalifa
VWR-5370
leliel Mirihi
@ -960,6 +983,7 @@ Nicky Dasmijn
OPEN-187
STORM-1937
OPEN-187
STORM-2010
Nicky Perian
OPEN-1
STORM-1087
@ -1157,6 +1181,7 @@ snowy Sidran
Sovereign Engineer
MAINT-2334
OPEN-189
STORM-1972
OPEN-195
SpacedOut Frye
VWR-34
@ -1198,6 +1223,7 @@ Takeda Terrawyng
TankMaster Finesmith
OPEN-140
OPEN-142
OPEN-154
STORM-1100
STORM-1258
STORM-1602
@ -1417,7 +1443,3 @@ Zipherius Turas
VWR-77
Zoex Flanagan

View File

@ -174,12 +174,12 @@ if (LINUX)
endif (WORD_SIZE EQUAL 32)
add_definitions(-mfpmath=sse)
#add_definitions(-ftree-vectorize) # THIS CRASHES GCC 3.1-3.2
if (NOT STANDALONE)
if (NOT USESYSTEMLIBS)
# this stops us requiring a really recent glibc at runtime
add_definitions(-fno-stack-protector)
# linking can be very memory-hungry, especially the final viewer link
set(CMAKE_CXX_LINK_FLAGS "-Wl,--no-keep-memory")
endif (NOT STANDALONE)
endif (NOT USESYSTEMLIBS)
set(CMAKE_CXX_FLAGS_DEBUG "-fno-inline ${CMAKE_CXX_FLAGS_DEBUG}")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 ${CMAKE_CXX_FLAGS_RELEASE}")
@ -226,14 +226,14 @@ if (LINUX OR DARWIN)
endif (LINUX OR DARWIN)
if (STANDALONE)
add_definitions(-DLL_STANDALONE=1)
if (USESYSTEMLIBS)
add_definitions(-DLL_USESYSTEMLIBS=1)
if (LINUX AND ${ARCH} STREQUAL "i686")
add_definitions(-march=pentiumpro)
endif (LINUX AND ${ARCH} STREQUAL "i686")
else (STANDALONE)
else (USESYSTEMLIBS)
set(${ARCH}_linux_INCLUDES
ELFIO
atk-1.0
@ -242,6 +242,6 @@ else (STANDALONE)
gtk-2.0
pango-1.0
)
endif (STANDALONE)
endif (USESYSTEMLIBS)
endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED)

View File

@ -8,9 +8,9 @@ set(APR_FIND_REQUIRED ON)
set(APRUTIL_FIND_QUIETLY ON)
set(APRUTIL_FIND_REQUIRED ON)
if (STANDALONE)
if (USESYSTEMLIBS)
include(FindAPR)
else (STANDALONE)
else (USESYSTEMLIBS)
use_prebuilt_binary(apr_suite)
if (WINDOWS)
if (LLCOMMON_LINK_SHARED)
@ -52,4 +52,4 @@ else (STANDALONE)
list(APPEND APRUTIL_LIBRARIES ${DB_LIBRARIES} uuid)
list(APPEND APRUTIL_LIBRARIES ${DB_LIBRARIES} rt)
endif (LINUX)
endif (STANDALONE)
endif (USESYSTEMLIBS)

View File

@ -1,13 +1,13 @@
# -*- cmake -*-
include(Prebuilt)
if (STANDALONE)
if (USESYSTEMLIBS)
include(FindPkgConfig)
pkg_check_modules(OGG REQUIRED ogg)
pkg_check_modules(VORBIS REQUIRED vorbis)
pkg_check_modules(VORBISENC REQUIRED vorbisenc)
pkg_check_modules(VORBISFILE REQUIRED vorbisfile)
else (STANDALONE)
else (USESYSTEMLIBS)
use_prebuilt_binary(ogg-vorbis)
set(VORBIS_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
set(VORBISENC_INCLUDE_DIRS ${VORBIS_INCLUDE_DIRS})
@ -32,7 +32,7 @@ else (STANDALONE)
set(VORBISENC_LIBRARIES vorbisenc)
set(VORBISFILE_LIBRARIES vorbisfile)
endif (WINDOWS)
endif (STANDALONE)
endif (USESYSTEMLIBS)
link_directories(
${VORBIS_LIBRARY_DIRS}

View File

@ -3,9 +3,9 @@
set(DB_FIND_QUIETLY ON)
set(DB_FIND_REQUIRED ON)
if (STANDALONE)
if (USESYSTEMLIBS)
include(FindBerkeleyDB)
else (STANDALONE)
else (USESYSTEMLIBS)
if (LINUX)
# Need to add dependency pthread explicitely to support ld.gold.
use_prebuilt_binary(db)
@ -14,4 +14,4 @@ else (STANDALONE)
set(DB_LIBRARIES db-4.2)
endif (LINUX)
set(DB_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
endif (STANDALONE)
endif (USESYSTEMLIBS)

View File

@ -4,7 +4,7 @@ include(Prebuilt)
set(Boost_FIND_QUIETLY ON)
set(Boost_FIND_REQUIRED ON)
if (STANDALONE)
if (USESYSTEMLIBS)
include(FindBoost)
set(BOOST_CONTEXT_LIBRARY boost_context-mt)
@ -14,7 +14,7 @@ if (STANDALONE)
set(BOOST_SIGNALS_LIBRARY boost_signals-mt)
set(BOOST_SYSTEM_LIBRARY boost_system-mt)
set(BOOST_THREAD_LIBRARY boost_thread-mt)
else (STANDALONE)
else (USESYSTEMLIBS)
use_prebuilt_binary(boost)
set(Boost_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
set(BOOST_VERSION "1.52")
@ -111,4 +111,4 @@ else (STANDALONE)
optimized boost_thread-mt
debug boost_thread-mt-d)
endif (WINDOWS)
endif (STANDALONE)
endif (USESYSTEMLIBS)

View File

@ -5,9 +5,9 @@ include(Prebuilt)
set(CARES_FIND_QUIETLY ON)
set(CARES_FIND_REQUIRED ON)
if (STANDALONE)
if (USESYSTEMLIBS)
include(FindCARes)
else (STANDALONE)
else (USESYSTEMLIBS)
use_prebuilt_binary(ares)
add_definitions("-DCARES_STATICLIB")
if (WINDOWS)
@ -18,4 +18,4 @@ else (STANDALONE)
set(CARES_LIBRARIES cares)
endif (WINDOWS)
set(CARES_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/ares)
endif (STANDALONE)
endif (USESYSTEMLIBS)

View File

@ -4,9 +4,9 @@ include(Prebuilt)
set(CURL_FIND_QUIETLY ON)
set(CURL_FIND_REQUIRED ON)
if (STANDALONE)
if (USESYSTEMLIBS)
include(FindCURL)
else (STANDALONE)
else (USESYSTEMLIBS)
use_prebuilt_binary(curl)
if (WINDOWS)
set(CURL_LIBRARIES
@ -16,4 +16,4 @@ else (STANDALONE)
set(CURL_LIBRARIES libcurl.a)
endif (WINDOWS)
set(CURL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
endif (STANDALONE)
endif (USESYSTEMLIBS)

View File

@ -374,9 +374,9 @@ copy_if_different(
)
set(third_party_targets ${third_party_targets} ${out_targets})
if(NOT STANDALONE)
if(NOT USESYSTEMLIBS)
add_custom_target(
stage_third_party_libs ALL
DEPENDS ${third_party_targets}
)
endif(NOT STANDALONE)
endif(NOT USESYSTEMLIBS)

View File

@ -1,7 +1,7 @@
# -*- cmake -*-
include(Prebuilt)
if (STANDALONE)
if (USESYSTEMLIBS)
include(FindPkgConfig)
pkg_check_modules(DBUSGLIB REQUIRED dbus-glib-1)
@ -18,7 +18,7 @@ elseif (LINUX)
gobject-2.0
glib-2.0
)
endif (STANDALONE)
endif (USESYSTEMLIBS)
if (DBUSGLIB_FOUND)
set(DBUSGLIB ON CACHE BOOL "Build with dbus-glib message bus support.")

View File

@ -4,9 +4,9 @@ include(Prebuilt)
set(EXPAT_FIND_QUIETLY ON)
set(EXPAT_FIND_REQUIRED ON)
if (STANDALONE)
if (USESYSTEMLIBS)
include(FindEXPAT)
else (STANDALONE)
else (USESYSTEMLIBS)
use_prebuilt_binary(expat)
if (WINDOWS)
set(EXPAT_LIBRARIES libexpatMT)
@ -14,4 +14,4 @@ else (STANDALONE)
set(EXPAT_LIBRARIES expat)
endif (WINDOWS)
set(EXPAT_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
endif (STANDALONE)
endif (USESYSTEMLIBS)

View File

@ -2,13 +2,13 @@
include(Linking)
include(Prebuilt)
if (STANDALONE)
if (USESYSTEMLIBS)
set(EXAMPLEPLUGIN OFF CACHE BOOL
"EXAMPLEPLUGIN support for the llplugin/llmedia test apps.")
else (STANDALONE)
else (USESYSTEMLIBS)
set(EXAMPLEPLUGIN ON CACHE BOOL
"EXAMPLEPLUGIN support for the llplugin/llmedia test apps.")
endif (STANDALONE)
endif (USESYSTEMLIBS)
if (WINDOWS)
elseif (DARWIN)

View File

@ -4,17 +4,17 @@
# When building using proprietary binaries though (i.e. having access to LL private servers),
# we always build with FMODEX.
# Open source devs should use the -DFMODEX:BOOL=ON then if they want to build with FMOD, whether
# they are using STANDALONE or not.
# they are using USESYSTEMLIBS or not.
if (INSTALL_PROPRIETARY)
set(FMODEX ON CACHE BOOL "Using FMOD Ex sound library.")
endif (INSTALL_PROPRIETARY)
if (FMODEX)
if (STANDALONE)
if (USESYSTEMLIBS)
# In that case, we use the version of the library installed on the system
set(FMODEX_FIND_REQUIRED ON)
include(FindFMODEX)
else (STANDALONE)
else (USESYSTEMLIBS)
if (FMODEX_LIBRARY AND FMODEX_INCLUDE_DIR)
# If the path have been specified in the arguments, use that
set(FMODEX_LIBRARIES ${FMODEX_LIBRARY})
@ -41,6 +41,6 @@ if (FMODEX)
set(FMODEX_LIBRARIES ${FMODEX_LIBRARY})
set(FMODEX_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/fmodex)
endif (FMODEX_LIBRARY AND FMODEX_INCLUDE_DIR)
endif (STANDALONE)
endif (USESYSTEMLIBS)
endif (FMODEX)

View File

@ -23,10 +23,10 @@ EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
# Try to find a library that was compiled with the same compiler version as we currently use.
SET(JSONCPP_NAMES ${JSONCPP_NAMES} libjson_linux-gcc-${_gcc_COMPILER_VERSION}_libmt.so)
IF (STANDALONE)
IF (USESYSTEMLIBS)
# On standalone, assume that the system installed library was compiled with the used compiler.
SET(JSONCPP_NAMES ${JSONCPP_NAMES} libjson.so)
ENDIF (STANDALONE)
ENDIF (USESYSTEMLIBS)
FIND_LIBRARY(JSONCPP_LIBRARY
NAMES ${JSONCPP_NAMES}
PATHS /usr/lib /usr/local/lib

View File

@ -1,14 +1,14 @@
# -*- cmake -*-
include(Prebuilt)
if (STANDALONE)
if (USESYSTEMLIBS)
include(FindPkgConfig)
pkg_check_modules(FREETYPE REQUIRED freetype2)
else (STANDALONE)
else (USESYSTEMLIBS)
use_prebuilt_binary(freetype)
set(FREETYPE_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
set(FREETYPE_LIBRARIES freetype)
endif (STANDALONE)
endif (USESYSTEMLIBS)
link_directories(${FREETYPE_LIBRARY_DIRS})

View File

@ -1,8 +1,8 @@
# -*- cmake -*-
include(Prebuilt)
if (NOT STANDALONE)
if (NOT USESYSTEMLIBS)
use_prebuilt_binary(glext)
use_prebuilt_binary(glh_linear)
set(GLEXT_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include)
endif (NOT STANDALONE)
endif (NOT USESYSTEMLIBS)

View File

@ -4,8 +4,8 @@ include(Prebuilt)
set(GLH_FIND_REQUIRED TRUE)
set(GLH_FIND_QUIETLY TRUE)
if (STANDALONE)
if (USESYSTEMLIBS)
include(FindGLH)
else (STANDALONE)
else (USESYSTEMLIBS)
use_prebuilt_binary(glh_linear)
endif (STANDALONE)
endif (USESYSTEMLIBS)

View File

@ -1,9 +1,9 @@
# -*- cmake -*-
include(Prebuilt)
if (NOT STANDALONE)
if (NOT USESYSTEMLIBS)
use_prebuilt_binary(GLOD)
endif (NOT STANDALONE)
endif (NOT USESYSTEMLIBS)
set(GLOD_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include)
set(GLOD_LIBRARIES GLOD)

View File

@ -1,15 +1,15 @@
# -*- cmake -*-
include(Prebuilt)
if (STANDALONE)
if (USESYSTEMLIBS)
include(FindPkgConfig)
pkg_check_modules(GSTREAMER010 REQUIRED gstreamer-0.10)
pkg_check_modules(GSTREAMER010_PLUGINS_BASE REQUIRED gstreamer-plugins-base-0.10)
elseif (LINUX)
use_prebuilt_binary(gstreamer)
# possible libxml should have its own .cmake file instead
use_prebuilt_binary(libxml)
# possible libxml2 should have its own .cmake file instead
use_prebuilt_binary(libxml2)
set(GSTREAMER010_FOUND ON FORCE BOOL)
set(GSTREAMER010_PLUGINS_BASE_FOUND ON FORCE BOOL)
set(GSTREAMER010_INCLUDE_DIRS
@ -26,7 +26,7 @@ elseif (LINUX)
gthread-2.0
glib-2.0
)
endif (STANDALONE)
endif (USESYSTEMLIBS)
if (GSTREAMER010_FOUND AND GSTREAMER010_PLUGINS_BASE_FOUND)
set(GSTREAMER010 ON CACHE BOOL "Build with GStreamer-0.10 streaming media support.")

View File

@ -2,14 +2,14 @@
include(Linking)
include(Prebuilt)
if (STANDALONE)
if (USESYSTEMLIBS)
set(GLUI OFF CACHE BOOL
"GLUI support for the llplugin/llmedia test apps.")
else (STANDALONE)
else (USESYSTEMLIBS)
use_prebuilt_binary(glui)
set(GLUI ON CACHE BOOL
"GLUI support for the llplugin/llmedia test apps.")
endif (STANDALONE)
endif (USESYSTEMLIBS)
if (LINUX)
set(GLUI ON CACHE BOOL

View File

@ -1,10 +1,10 @@
# -*- cmake -*-
include(Prebuilt)
if (STANDALONE)
if (USESYSTEMLIBS)
set(BREAKPAD_EXCEPTION_HANDLER_FIND_REQUIRED ON)
include(FindGoogleBreakpad)
else (STANDALONE)
else (USESYSTEMLIBS)
use_prebuilt_binary(google_breakpad)
if (DARWIN)
set(BREAKPAD_EXCEPTION_HANDLER_LIBRARIES exception_handler)
@ -18,5 +18,5 @@ else (STANDALONE)
# yes, this does look dumb, no, it's not incorrect
#
set(BREAKPAD_INCLUDE_DIRECTORIES "${LIBS_PREBUILT_DIR}/include/google_breakpad" "${LIBS_PREBUILT_DIR}/include/google_breakpad/google_breakpad")
endif (STANDALONE)
endif (USESYSTEMLIBS)

View File

@ -5,9 +5,9 @@ include(Prebuilt)
# set ON or OFF as desired.
set (USE_TCMALLOC OFF)
if (STANDALONE)
if (USESYSTEMLIBS)
include(FindGooglePerfTools)
else (STANDALONE)
else (USESYSTEMLIBS)
if (WINDOWS)
if (USE_TCMALLOC)
use_prebuilt_binary(gperftools)
@ -34,7 +34,7 @@ else (STANDALONE)
${LIBS_PREBUILT_DIR}/include)
set(GOOGLE_PERFTOOLS_FOUND "YES")
endif (LINUX)
endif (STANDALONE)
endif (USESYSTEMLIBS)
if (GOOGLE_PERFTOOLS_FOUND)
# XXX Disable temporarily, until we have compilation issues on 64-bit

View File

@ -4,9 +4,9 @@ include(Prebuilt)
set(HUNSPELL_FIND_QUIETLY ON)
set(HUNSPELL_FIND_REQUIRED ON)
if (STANDALONE)
if (USESYSTEMLIBS)
include(FindHUNSPELL)
else (STANDALONE)
else (USESYSTEMLIBS)
use_prebuilt_binary(libhunspell)
if (WINDOWS)
set(HUNSPELL_LIBRARY libhunspell)
@ -19,4 +19,4 @@ else (STANDALONE)
endif()
set(HUNSPELL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/hunspell)
use_prebuilt_binary(dictionaries)
endif (STANDALONE)
endif (USESYSTEMLIBS)

View File

@ -5,9 +5,9 @@ include(Linking)
set(JPEG_FIND_QUIETLY ON)
set(JPEG_FIND_REQUIRED ON)
if (STANDALONE)
if (USESYSTEMLIBS)
include(FindJPEG)
else (STANDALONE)
else (USESYSTEMLIBS)
use_prebuilt_binary(jpeglib)
if (LINUX)
set(JPEG_LIBRARIES jpeg)
@ -17,4 +17,4 @@ else (STANDALONE)
set(JPEG_LIBRARIES jpeglib)
endif (LINUX)
set(JPEG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
endif (STANDALONE)
endif (USESYSTEMLIBS)

View File

@ -5,9 +5,9 @@ include(Prebuilt)
set(JSONCPP_FIND_QUIETLY ON)
set(JSONCPP_FIND_REQUIRED ON)
if (STANDALONE)
if (USESYSTEMLIBS)
include(FindJsonCpp)
else (STANDALONE)
else (USESYSTEMLIBS)
use_prebuilt_binary(jsoncpp)
if (WINDOWS)
set(JSONCPP_LIBRARIES
@ -19,4 +19,4 @@ else (STANDALONE)
set(JSONCPP_LIBRARIES libjson_linux-gcc-4.1.3_libmt.a)
endif (WINDOWS)
set(JSONCPP_INCLUDE_DIR "${LIBS_PREBUILT_DIR}/include/jsoncpp" "${LIBS_PREBUILT_DIR}/include/json")
endif (STANDALONE)
endif (USESYSTEMLIBS)

10
indra/cmake/LLAddBuildTest.cmake Executable file → Normal file
View File

@ -202,9 +202,9 @@ FUNCTION(LL_ADD_INTEGRATION_TEST
ADD_EXECUTABLE(INTEGRATION_TEST_${testname} ${source_files})
SET_TARGET_PROPERTIES(INTEGRATION_TEST_${testname} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${EXE_STAGING_DIR}")
if(STANDALONE)
if(USESYSTEMLIBS)
SET_TARGET_PROPERTIES(INTEGRATION_TEST_${testname} PROPERTIES COMPILE_FLAGS -I"${TUT_INCLUDE_DIR}")
endif(STANDALONE)
endif(USESYSTEMLIBS)
# The following was copied to llcorehttp/CMakeLists.txt's texture_load target.
# Any changes made here should be replicated there.
@ -275,10 +275,10 @@ MACRO(SET_TEST_PATH LISTVAR)
set(${LISTVAR} ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/Resources ${SHARED_LIB_STAGING_DIR}/Release/Resources /usr/lib)
ELSE(WINDOWS)
# Linux uses a single staging directory anyway.
IF (STANDALONE)
IF (USESYSTEMLIBS)
set(${LISTVAR} ${CMAKE_BINARY_DIR}/llcommon /usr/lib /usr/local/lib)
ELSE (STANDALONE)
ELSE (USESYSTEMLIBS)
set(${LISTVAR} ${SHARED_LIB_STAGING_DIR} /usr/lib)
ENDIF (STANDALONE)
ENDIF (USESYSTEMLIBS)
ENDIF(WINDOWS)
ENDMACRO(SET_TEST_PATH)

View File

@ -6,21 +6,30 @@ include(Boost)
use_prebuilt_binary(colladadom)
use_prebuilt_binary(pcre)
use_prebuilt_binary(libxml)
set(LLPRIMITIVE_INCLUDE_DIRS
${LIBS_OPEN_DIR}/llprimitive
)
if (WINDOWS)
set(LLPRIMITIVE_LIBRARIES
set(LLPRIMITIVE_LIBRARIES
debug llprimitive
optimized llprimitive
debug libcollada14dom22-d
optimized libcollada14dom22
${BOOST_SYSTEM_LIBRARIES}
)
elseif (LINUX)
use_prebuilt_binary(libxml2)
set(LLPRIMITIVE_LIBRARIES
llprimitive
collada14dom
minizip
xml2
pcrecpp
pcre
)
else (WINDOWS)
set(LLPRIMITIVE_LIBRARIES
set(LLPRIMITIVE_LIBRARIES
llprimitive
collada14dom
minizip

View File

@ -4,7 +4,7 @@ include(Variables)
include(GLEXT)
include(Prebuilt)
if (STANDALONE)
if (USESYSTEMLIBS)
include(FindSDL)
# This should be done by FindSDL. Sigh.
@ -13,14 +13,14 @@ if (STANDALONE)
SDL_INCLUDE_DIR
SDL_LIBRARY
)
else (STANDALONE)
else (USESYSTEMLIBS)
if (LINUX)
use_prebuilt_binary(SDL)
set (SDL_FOUND TRUE)
set (SDL_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/i686-linux)
set (SDL_LIBRARY SDL directfb fusion direct)
endif (LINUX)
endif (STANDALONE)
endif (USESYSTEMLIBS)
if (SDL_FOUND)
include_directories(${SDL_INCLUDE_DIR})

View File

@ -4,10 +4,10 @@ include(Prebuilt)
set(NDOF ON CACHE BOOL "Use NDOF space navigator joystick library.")
if (NDOF)
if (STANDALONE)
if (USESYSTEMLIBS)
set(NDOF_FIND_REQUIRED ON)
include(FindNDOF)
else (STANDALONE)
else (USESYSTEMLIBS)
use_prebuilt_binary(ndofdev)
if (WINDOWS)
@ -18,7 +18,7 @@ if (NDOF)
set(NDOF_INCLUDE_DIR ${ARCH_PREBUILT_DIRS}/include/ndofdev)
set(NDOF_FOUND 1)
endif (STANDALONE)
endif (USESYSTEMLIBS)
endif (NDOF)
if (NDOF_FOUND)

View File

@ -10,14 +10,14 @@ endif (LINUX)
if (OPENAL)
set(OPENAL_LIB_INCLUDE_DIRS "${LIBS_PREBUILT_DIR}/include/AL")
if (STANDALONE)
if (USESYSTEMLIBS)
include(FindPkgConfig)
include(FindOpenAL)
pkg_check_modules(OPENAL_LIB REQUIRED openal)
pkg_check_modules(FREEALUT_LIB REQUIRED freealut)
else (STANDALONE)
else (USESYSTEMLIBS)
use_prebuilt_binary(openal_soft)
endif (STANDALONE)
endif (USESYSTEMLIBS)
if(WINDOWS)
set(OPENAL_LIBRARIES
OpenAL32

View File

@ -4,9 +4,9 @@ include(Prebuilt)
set(OPENJPEG_FIND_QUIETLY ON)
set(OPENJPEG_FIND_REQUIRED ON)
if (STANDALONE)
if (USESYSTEMLIBS)
include(FindOpenJPEG)
else (STANDALONE)
else (USESYSTEMLIBS)
use_prebuilt_binary(openjpeg)
if(WINDOWS)
@ -19,4 +19,4 @@ else (STANDALONE)
endif(WINDOWS)
set(OPENJPEG_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/openjpeg)
endif (STANDALONE)
endif (USESYSTEMLIBS)

View File

@ -4,9 +4,9 @@ include(Prebuilt)
set(OpenSSL_FIND_QUIETLY ON)
set(OpenSSL_FIND_REQUIRED ON)
if (STANDALONE)
if (USESYSTEMLIBS)
include(FindOpenSSL)
else (STANDALONE)
else (USESYSTEMLIBS)
use_prebuilt_binary(openSSL)
if (WINDOWS)
set(OPENSSL_LIBRARIES ssleay32 libeay32)
@ -14,7 +14,7 @@ else (STANDALONE)
set(OPENSSL_LIBRARIES ssl crypto)
endif (WINDOWS)
set(OPENSSL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
endif (STANDALONE)
endif (USESYSTEMLIBS)
if (LINUX)
set(CRYPTO_LIBRARIES crypto)

View File

@ -4,9 +4,9 @@ include(Prebuilt)
set(PNG_FIND_QUIETLY ON)
set(PNG_FIND_REQUIRED ON)
if (STANDALONE)
if (USESYSTEMLIBS)
include(FindPNG)
else (STANDALONE)
else (USESYSTEMLIBS)
use_prebuilt_binary(libpng)
if (WINDOWS)
set(PNG_LIBRARIES libpng15)
@ -18,4 +18,4 @@ else (STANDALONE)
set(PNG_LIBRARIES png15)
set(PNG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/libpng15)
endif()
endif (STANDALONE)
endif (USESYSTEMLIBS)

View File

@ -17,11 +17,11 @@ endif(INSTALL_PROPRIETARY)
# of previous attempts is serialized in the file
# ${CMAKE_BINARY_DIR}/temp/${_binary}_installed)
macro (use_prebuilt_binary _binary)
if (NOT DEFINED STANDALONE_${_binary})
set(STANDALONE_${_binary} ${STANDALONE})
endif (NOT DEFINED STANDALONE_${_binary})
if (NOT DEFINED USESYSTEMLIBS_${_binary})
set(USESYSTEMLIBS_${_binary} ${USESYSTEMLIBS})
endif (NOT DEFINED USESYSTEMLIBS_${_binary})
if (NOT STANDALONE_${_binary})
if (NOT USESYSTEMLIBS_${_binary})
if("${${_binary}_installed}" STREQUAL "" AND EXISTS "${CMAKE_BINARY_DIR}/temp/${_binary}_installed")
file(READ ${CMAKE_BINARY_DIR}/temp/${_binary}_installed "${_binary}_installed")
if(DEBUG_PREBUILT)
@ -52,7 +52,7 @@ macro (use_prebuilt_binary _binary)
"Failed to download or unpack prebuilt '${_binary}'."
" Process returned ${${_binary}_installed}.")
endif (NOT ${_binary}_installed EQUAL 0)
endif (NOT STANDALONE_${_binary})
endif (NOT USESYSTEMLIBS_${_binary})
endmacro (use_prebuilt_binary _binary)
endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED)

View File

@ -4,7 +4,7 @@ include(Prebuilt)
set(PULSEAUDIO OFF CACHE BOOL "Build with PulseAudio support, if available.")
if (PULSEAUDIO)
if (STANDALONE)
if (USESYSTEMLIBS)
include(FindPkgConfig)
pkg_check_modules(PULSEAUDIO libpulse)
@ -20,7 +20,7 @@ if (PULSEAUDIO)
set(PULSEAUDIO_LIBRARIES
# none needed!
)
endif (STANDALONE)
endif (USESYSTEMLIBS)
endif (PULSEAUDIO)
if (PULSEAUDIO_FOUND)

View File

@ -1,6 +1,6 @@
# -*- cmake -*-
include(Prebuilt)
if (NOT STANDALONE)
if (NOT USESYSTEMLIBS)
use_prebuilt_binary(tut)
endif(NOT STANDALONE)
endif(NOT USESYSTEMLIBS)

View File

@ -2,7 +2,7 @@
include(Prebuilt)
include(FreeType)
if (STANDALONE)
if (USESYSTEMLIBS)
include(FindPkgConfig)
if (LINUX)
@ -31,7 +31,7 @@ if (STANDALONE)
list(APPEND UI_LIBRARIES ${${pkg}_LIBRARIES})
add_definitions(${${pkg}_CFLAGS_OTHERS})
endforeach(pkg)
else (STANDALONE)
else (USESYSTEMLIBS)
use_prebuilt_binary(gtk-atk-pango-glib)
if (LINUX)
set(UI_LIBRARIES
@ -59,7 +59,7 @@ else (STANDALONE)
foreach(include ${${LL_ARCH}_INCLUDES})
include_directories(${LIBS_PREBUILT_DIR}/include/${include})
endforeach(include)
endif (STANDALONE)
endif (USESYSTEMLIBS)
if (LINUX)
add_definitions(-DLL_GTK=1 -DLL_X11=1)

View File

@ -183,7 +183,7 @@ if (XCODE_VERSION GREATER 4.2)
endif (XCODE_VERSION GREATER 4.2)
set(VERSION_BUILD "0" CACHE STRING "Revision number passed in from the outside")
set(STANDALONE OFF CACHE BOOL "Do not use Linden-supplied prebuilt libraries.")
set(USESYSTEMLIBS OFF CACHE BOOL "Use libraries from your system rather than Linden-supplied prebuilt libraries.")
set(UNATTENDED OFF CACHE BOOL "Should be set to ON for building with VC Express editions.")
set(USE_PRECOMPILED_HEADERS ON CACHE BOOL "Enable use of precompiled header directives where supported.")

View File

@ -1,10 +1,10 @@
# -*- cmake -*-
include(Prebuilt)
if (NOT STANDALONE)
if (NOT USESYSTEMLIBS)
use_prebuilt_binary(libhunspell)
use_prebuilt_binary(libuuid)
use_prebuilt_binary(slvoice)
use_prebuilt_binary(fontconfig)
endif(NOT STANDALONE)
endif(NOT USESYSTEMLIBS)

View File

@ -2,7 +2,7 @@
include(Linking)
include(Prebuilt)
if (STANDALONE)
if (USESYSTEMLIBS)
# The minimal version, 4.4.3, is rather arbitrary: it's the version in Debian/Lenny.
find_package(Qt4 4.4.3 COMPONENTS QtCore QtGui QtNetwork QtOpenGL QtWebKit REQUIRED)
include(${QT_USE_FILE})
@ -28,11 +28,11 @@ if (STANDALONE)
list(APPEND QT_PLUGIN_LIBRARIES jpeg)
set(WEBKITLIBPLUGIN OFF CACHE BOOL
"WEBKITLIBPLUGIN support for the llplugin/llmedia test apps.")
else (STANDALONE)
else (USESYSTEMLIBS)
use_prebuilt_binary(llqtwebkit)
set(WEBKITLIBPLUGIN ON CACHE BOOL
"WEBKITLIBPLUGIN support for the llplugin/llmedia test apps.")
endif (STANDALONE)
endif (USESYSTEMLIBS)
if (WINDOWS)
set(WEBKIT_PLUGIN_LIBRARIES

View File

@ -4,9 +4,9 @@ include(Prebuilt)
set(XMLRPCEPI_FIND_QUIETLY ON)
set(XMLRPCEPI_FIND_REQUIRED ON)
if (STANDALONE)
if (USESYSTEMLIBS)
include(FindXmlRpcEpi)
else (STANDALONE)
else (USESYSTEMLIBS)
use_prebuilt_binary(xmlrpc-epi)
if (WINDOWS)
set(XMLRPCEPI_LIBRARIES
@ -17,4 +17,4 @@ else (STANDALONE)
set(XMLRPCEPI_LIBRARIES xmlrpc-epi)
endif (WINDOWS)
set(XMLRPCEPI_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
endif (STANDALONE)
endif (USESYSTEMLIBS)

View File

@ -5,9 +5,9 @@ set(ZLIB_FIND_REQUIRED ON)
include(Prebuilt)
if (STANDALONE)
if (USESYSTEMLIBS)
include(FindZLIB)
else (STANDALONE)
else (USESYSTEMLIBS)
use_prebuilt_binary(zlib)
if (WINDOWS)
set(ZLIB_LIBRARIES
@ -19,4 +19,4 @@ else (STANDALONE)
if (WINDOWS OR LINUX)
set(ZLIB_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/zlib)
endif (WINDOWS OR LINUX)
endif (STANDALONE)
endif (USESYSTEMLIBS)

View File

@ -7,6 +7,7 @@ project (llimage_libtest)
include(00-Common)
include(LLCommon)
include(LLImage)
include(LLMath)
include(LLImageJ2COJ)
include(LLKDU)
include(LLVFS)
@ -15,6 +16,7 @@ include_directories(
${LLCOMMON_INCLUDE_DIRS}
${LLVFS_INCLUDE_DIRS}
${LLIMAGE_INCLUDE_DIRS}
${LLMATH_INCLUDE_DIRS}
)
include_directories(SYSTEM
${LLCOMMON_SYSTEM_INCLUDE_DIRS}
@ -64,6 +66,7 @@ endif (DARWIN)
target_link_libraries(llimage_libtest
${LLCOMMON_LIBRARIES}
${LLVFS_LIBRARIES}
${LLMATH_LIBRARIES}
${LLIMAGE_LIBRARIES}
${LLKDU_LIBRARIES}
${KDU_LIBRARY}

View File

@ -0,0 +1,41 @@
<llsd>
<array>
<array>
<string>linearize</string>
<real>0.1</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>contrast</string>
<real>0.8</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>colorize</string>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
<real>0.5</real>
<real>0.0</real>
<real>0.0</real>
</array>
<array>
<string>blend</string>
<real>10.0</real>
<real>0.0</real>
</array>
<array>
<string>colorize</string>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
<real>0.1</real>
<real>0.1</real>
<real>0.0</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,11 @@
<llsd>
<array>
<array>
<string>linearize</string>
<real>0.01</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,36 @@
<llsd>
<array>
<array>
<string>grayscale</string>
</array>
<array>
<string>linearize</string>
<real>0.1</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>posterize</string>
<real>10.0</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>gradient</string>
</array>
<array>
<string>colorize</string>
<real>0.0</real>
<real>0.0</real>
<real>1.0</real>
<real>0.0</real>
<real>0.0</real>
<real>0.15</real>
</array>
<array>
<string>blur</string>
</array>
</array>
</llsd>

View File

@ -0,0 +1,25 @@
<llsd>
<array>
<array>
<string>linearize</string>
<real>0.0</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>stencil</string>
<string>uniform</string>
<string>add</string>
<real>0.0</real>
<real>1.0</real>
</array>
<array>
<string>gamma</string>
<real>0.25</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,7 @@
<llsd>
<array>
<array>
<string>blur</string>
</array>
</array>
</llsd>

View File

@ -0,0 +1,11 @@
<llsd>
<array>
<array>
<string>brighten</string>
<real>0.5</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,24 @@
<llsd>
<array>
<array>
<string>stencil</string>
<string>vignette</string>
<string>blend</string>
<real>0.0</real>
<real>1.0</real>
<real>0.0</real>
<real>0.0</real>
<real>1.0</real>
<real>10.0</real>
</array>
<array>
<string>colorize</string>
<real>1.0</real>
<real>0.0</real>
<real>0.0</real>
<real>0.5</real>
<real>0.5</real>
<real>0.0</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,16 @@
<llsd>
<array>
<array>
<string>colortransform</string>
<real>0.2125</real>
<real>0.7154</real>
<real>0.0721</real>
<real>0.2125</real>
<real>0.7154</real>
<real>0.0721</real>
<real>0.2125</real>
<real>0.7154</real>
<real>0.0721</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,11 @@
<llsd>
<array>
<array>
<string>contrast</string>
<real>1.5</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,18 @@
<llsd>
<array>
<array>
<string>convolve</string>
<real>1.0</real>
<real>0.0</real>
<real>4.0</real>
<real>1.0</real>
<real>4.0</real>
<real>1.0</real>
<real>0.0</real>
<real>1.0</real>
<real>4.0</real>
<real>1.0</real>
<real>4.0</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,11 @@
<llsd>
<array>
<array>
<string>darken</string>
<real>0.5</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,47 @@
<llsd>
<array>
<array>
<string>linearize</string>
<real>0.0</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>stencil</string>
<string>vignette</string>
<string>add</string>
<real>0.0</real>
<real>0.4</real>
<real>0.0</real>
<real>0.0</real>
<real>1.0</real>
<real>2.0</real>
</array>
<array>
<string>contrast</string>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>stencil</string>
<string>vignette</string>
<string>add</string>
<real>-0.8</real>
<real>0.0</real>
<real>0.0</real>
<real>0.0</real>
<real>1.0</real>
<real>2.0</real>
</array>
<array>
<string>contrast</string>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,24 @@
<llsd>
<array>
<array>
<string>gradient</string>
</array>
<array>
<string>blur</string>
</array>
<array>
<string>linearize</string>
<real>0.0</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>contrast</string>
<real>2.0</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,39 @@
<llsd>
<array>
<array>
<string>linearize</string>
<real>0.0</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>stencil</string>
<string>vignette</string>
<string>blend</string>
<real>0.0</real>
<real>0.4</real>
<real>0.0</real>
<real>0.0</real>
<real>0.5</real>
<real>2.0</real>
</array>
<array>
<string>sharpen</string>
</array>
<array>
<string>stencil</string>
<string>vignette</string>
<string>blend</string>
<real>1.0</real>
<real>0.0</real>
<real>0.0</real>
<real>0.0</real>
<real>0.5</real>
<real>2.0</real>
</array>
<array>
<string>blur</string>
</array>
</array>
</llsd>

View File

@ -0,0 +1,11 @@
<llsd>
<array>
<array>
<string>gamma</string>
<real>1.7</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,14 @@
<llsd>
<array>
<array>
<string>linearize</string>
<real>0.0</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>grayscale</string>
</array>
</array>
</llsd>

View File

@ -0,0 +1,38 @@
<llsd>
<array>
<array>
<string>linearize</string>
<real>0.1</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>contrast</string>
<real>0.8</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>stencil</string>
<string>vignette</string>
<string>fade</string>
<real>0.5</real>
<real>1.0</real>
<real>0.0</real>
<real>0.0</real>
<real>1.0</real>
<real>4.0</real>
</array>
<array>
<string>colorize</string>
<real>1.0</real>
<real>0.0</real>
<real>1.0</real>
<real>0.4</real>
<real>0.0</real>
<real>0.2</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,20 @@
<llsd>
<array>
<array>
<string>linearize</string>
<real>0.0</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>grayscale</string>
</array>
<array>
<string>screen</string>
<string>line</string>
<real>0.015</real>
<real>0.0</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,20 @@
<llsd>
<array>
<array>
<string>linearize</string>
<real>0.1</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>grayscale</string>
</array>
<array>
<string>screen</string>
<string>line</string>
<real>0.02</real>
<real>0.0</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,131 @@
<llsd>
<array>
<array>
<string>linearize</string>
<real>0.01</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>stencil</string>
<string>gradient</string>
<string>add</string>
<real>1.0</real>
<real>0.0</real>
<real>-1.0</real>
<real>1.0</real>
<real>1.0</real>
<real>-1.0</real>
</array>
<array>
<string>colorize</string>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
<real>0.1</real>
<real>0.1</real>
<real>0.0</real>
</array>
<array>
<string>stencil</string>
<string>vignette</string>
<string>add</string>
<real>0.0</real>
<real>1.0</real>
<real>-1.0</real>
<real>1.0</real>
<real>1.5</real>
<real>5.0</real>
</array>
<array>
<string>colorize</string>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
<real>0.6</real>
<real>0.0</real>
<real>0.0</real>
</array>
<array>
<string>stencil</string>
<string>vignette</string>
<string>add</string>
<real>0.0</real>
<real>1.0</real>
<real>-1.0</real>
<real>1.0</real>
<real>1.0</real>
<real>5.0</real>
</array>
<array>
<string>colorize</string>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
<real>0.6</real>
<real>0.6</real>
<real>0.0</real>
</array>
<array>
<string>stencil</string>
<string>vignette</string>
<string>add</string>
<real>0.0</real>
<real>0.5</real>
<real>0.5</real>
<real>-0.5</real>
<real>0.10</real>
<real>20.0</real>
</array>
<array>
<string>colorize</string>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
<real>0.7</real>
<real>0.0</real>
<real>0.0</real>
</array>
<array>
<string>stencil</string>
<string>vignette</string>
<string>add</string>
<real>0.0</real>
<real>0.5</real>
<real>0.6</real>
<real>-0.6</real>
<real>0.05</real>
<real>20.0</real>
</array>
<array>
<string>colorize</string>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
<real>0.7</real>
<real>0.0</real>
<real>0.0</real>
</array>
<array>
<string>stencil</string>
<string>vignette</string>
<string>add</string>
<real>0.0</real>
<real>0.5</real>
<real>0.4</real>
<real>-0.4</real>
<real>0.025</real>
<real>20.0</real>
</array>
<array>
<string>colorize</string>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
<real>0.7</real>
<real>0.0</real>
<real>0.0</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,78 @@
<llsd>
<array>
<array>
<string>linearize</string>
<real>0.01</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>brighten</string>
<real>0.1</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>stencil</string>
<string>gradient</string>
<string>add</string>
<real>1.0</real>
<real>0.0</real>
<real>-1.0</real>
<real>1.0</real>
<real>1.0</real>
<real>-1.0</real>
</array>
<array>
<string>colorize</string>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
<real>0.1</real>
<real>0.1</real>
<real>0.0</real>
</array>
<array>
<string>stencil</string>
<string>vignette</string>
<string>add</string>
<real>0.0</real>
<real>1.0</real>
<real>-1.0</real>
<real>1.0</real>
<real>1.5</real>
<real>5.0</real>
</array>
<array>
<string>colorize</string>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
<real>0.8</real>
<real>0.0</real>
<real>0.0</real>
</array>
<array>
<string>stencil</string>
<string>vignette</string>
<string>add</string>
<real>0.0</real>
<real>1.0</real>
<real>-1.0</real>
<real>1.0</real>
<real>1.0</real>
<real>5.0</real>
</array>
<array>
<string>colorize</string>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
<real>0.8</real>
<real>0.8</real>
<real>0.0</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,11 @@
<llsd>
<array>
<array>
<string>linearize</string>
<real>0.1</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,118 @@
<llsd>
<array>
<array>
<string>linearize</string>
<real>0.02</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>contrast</string>
<real>1.02</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>saturate</string>
<real>1.2</real>
</array>
<array>
<string>stencil</string>
<string>vignette</string>
<string>blend</string>
<real>0.0</real>
<real>0.25</real>
<real>0.0</real>
<real>0.0</real>
<real>0.25</real>
<real>2.0</real>
</array>
<array>
<string>sharpen</string>
</array>
<array>
<string>stencil</string>
<string>gradient</string>
<string>blend</string>
<real>1.0</real>
<real>0.0</real>
<real>0.0</real>
<real>-1.0</real>
<real>0.0</real>
<real>-0.25</real>
</array>
<array>
<string>blur</string>
</array>
<array>
<string>blur</string>
</array>
<array>
<string>blur</string>
</array>
<array>
<string>blur</string>
</array>
<array>
<string>blur</string>
</array>
<array>
<string>blur</string>
</array>
<array>
<string>blur</string>
</array>
<array>
<string>blur</string>
</array>
<array>
<string>blur</string>
</array>
<array>
<string>blur</string>
</array>
<array>
<string>stencil</string>
<string>gradient</string>
<string>blend</string>
<real>1.0</real>
<real>0.0</real>
<real>0.0</real>
<real>1.0</real>
<real>0.0</real>
<real>0.25</real>
</array>
<array>
<string>blur</string>
</array>
<array>
<string>blur</string>
</array>
<array>
<string>blur</string>
</array>
<array>
<string>blur</string>
</array>
<array>
<string>blur</string>
</array>
<array>
<string>blur</string>
</array>
<array>
<string>blur</string>
</array>
<array>
<string>blur</string>
</array>
<array>
<string>blur</string>
</array>
<array>
<string>blur</string>
</array>
</array>
</llsd>

View File

@ -0,0 +1,20 @@
<llsd>
<array>
<array>
<string>linearize</string>
<real>0.0</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>grayscale</string>
</array>
<array>
<string>screen</string>
<string>2Dsine</string>
<real>0.015</real>
<real>0.0</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,24 @@
<llsd>
<array>
<array>
<string>linearize</string>
<real>0.1</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>colorize</string>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
<real>0.0</real>
<real>0.3</real>
<real>0.0</real>
</array>
<array>
<string>saturate</string>
<real>0.35</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,35 @@
<llsd>
<array>
<array>
<string>blur</string>
</array>
<array>
<string>darken</string>
<real>0.1</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>contrast</string>
<real>0.9</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>linearize</string>
<real>0.01</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>posterize</string>
<real>4.0</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,11 @@
<llsd>
<array>
<array>
<string>posterize</string>
<real>10.0</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,8 @@
<llsd>
<array>
<array>
<string>rotate</string>
<real>180.0</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,8 @@
<llsd>
<array>
<array>
<string>saturate</string>
<real>3.0</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,14 @@
<llsd>
<array>
<array>
<string>linearize</string>
<real>0.0</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>sepia</string>
</array>
</array>
</llsd>

View File

@ -0,0 +1,7 @@
<llsd>
<array>
<array>
<string>sharpen</string>
</array>
</array>
</llsd>

View File

@ -0,0 +1,20 @@
<llsd>
<array>
<array>
<string>linearize</string>
<real>0.0</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>grayscale</string>
</array>
<array>
<string>screen</string>
<string>line</string>
<real>0.015</real>
<real>45.0</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,45 @@
<llsd>
<array>
<array>
<string>linearize</string>
<real>0.1</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>contrast</string>
<real>0.8</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>saturate</string>
<real>1.5</real>
</array>
<array>
<string>fade</string>
<real>1.0</real>
<real>0.25</real>
</array>
<array>
<string>saturate</string>
<real>0.8</real>
</array>
<array>
<string>contrast</string>
<real>1.1</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>brighten</string>
<real>30</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,24 @@
<llsd>
<array>
<array>
<string>stencil</string>
<string>gradient</string>
<string>blend</string>
<real>0.0</real>
<real>1.0</real>
<real>0.0</real>
<real>-1.0</real>
<real>0.0</real>
<real>1.0</real>
</array>
<array>
<string>colorize</string>
<real>1.0</real>
<real>0.0</real>
<real>0.0</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,22 @@
<llsd>
<array>
<array>
<string>stencil</string>
<string>scanlines</string>
<string>blend</string>
<real>0.0</real>
<real>0.5</real>
<real>0.1</real>
<real>45.0</real>
</array>
<array>
<string>colorize</string>
<real>1.0</real>
<real>0.0</real>
<real>0.0</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,20 @@
<llsd>
<array>
<array>
<string>stencil</string>
<string>uniform</string>
<string>blend</string>
<real>0.0</real>
<real>0.5</real>
</array>
<array>
<string>colorize</string>
<real>1.0</real>
<real>0.0</real>
<real>0.0</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,24 @@
<llsd>
<array>
<array>
<string>stencil</string>
<string>vignette</string>
<string>blend</string>
<real>0.0</real>
<real>0.5</real>
<real>0.0</real>
<real>0.0</real>
<real>1.0</real>
<real>10.0</real>
</array>
<array>
<string>colorize</string>
<real>1.0</real>
<real>0.0</real>
<real>0.0</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,42 @@
<llsd>
<array>
<array>
<string>grayscale</string>
</array>
<array>
<string>linearize</string>
<real>0.1</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>posterize</string>
<real>50.0</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>gradient</string>
</array>
<array>
<string>screen</string>
<string>line</string>
<real>0.025</real>
<real>90.0</real>
</array>
<array>
<string>colorize</string>
<real>0.0</real>
<real>1.0</real>
<real>0.0</real>
<real>0.1</real>
<real>0.2</real>
<real>0.2</real>
</array>
<array>
<string>blur</string>
</array>
</array>
</llsd>

View File

@ -0,0 +1,46 @@
<llsd>
<array>
<array>
<string>stencil</string>
<string>vignette</string>
<string>fade</string>
<real>0.0</real>
<real>1.0</real>
<real>0.0</real>
<real>0.0</real>
<real>1.2</real>
<real>3.0</real>
</array>
<array>
<string>linearize</string>
<real>0.05</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>grayscale</string>
</array>
<array>
<string>contrast</string>
<real>1.1</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>stencil</string>
<string>vignette</string>
<string>blend</string>
<real>1.0</real>
<real>0.0</real>
<real>0.0</real>
<real>0.0</real>
<real>0.5</real>
<real>2.0</real>
</array>
<array>
<string>blur</string>
</array>
</array>
</llsd>

View File

@ -0,0 +1,20 @@
<llsd>
<array>
<array>
<string>linearize</string>
<real>0.0</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>grayscale</string>
</array>
<array>
<string>screen</string>
<string>line</string>
<real>0.015</real>
<real>90.0</real>
</array>
</array>
</llsd>

View File

@ -0,0 +1,44 @@
<llsd>
<array>
<array>
<string>linearize</string>
<real>0.0</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>darken</string>
<real>0.15</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>stencil</string>
<string>uniform</string>
<string>add</string>
<real>0.0</real>
<real>0.5</real>
</array>
<array>
<string>screen</string>
<string>line</string>
<real>0.02</real>
<real>0.0</real>
</array>
<array>
<string>gamma</string>
<real>0.25</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
<array>
<string>blur</string>
</array>
<array>
<string>blur</string>
</array>
</array>
</llsd>

View File

@ -32,6 +32,7 @@
// Linden library includes
#include "llimage.h"
#include "llimagefilter.h"
#include "llimagejpeg.h"
#include "llimagepng.h"
#include "llimagebmp.h"
@ -39,6 +40,8 @@
#include "llimagej2c.h"
#include "lldir.h"
#include "lldiriterator.h"
#include "v4coloru.h"
#include "llsdserialize.h"
// system libraries
#include <iostream>
@ -83,6 +86,8 @@ static const char USAGE[] = "\n"
" -rev, --reversible\n"
" Set the compression to be lossless (reversible in j2c parlance).\n"
" Only valid for output j2c images.\n"
" -f, --filter <file>\n"
" Apply the filter <file> to the input images.\n"
" -log, --logmetrics <metric>\n"
" Log performance data for <metric>. Results in <metric>.slp\n"
" Note: so far, only ImageCompressionTester has been tested.\n"
@ -99,7 +104,7 @@ static bool sAllDone = false;
// Create an empty formatted image instance of the correct type from the filename
LLPointer<LLImageFormatted> create_image(const std::string &filename)
{
std::string exten = gDirUtilp->getExtension(filename);
std::string exten = gDirUtilp->getExtension(filename);
LLPointer<LLImageFormatted> image = LLImageFormatted::createFromExtension(exten);
return image;
}
@ -350,6 +355,7 @@ int main(int argc, char** argv)
int blocks_size = -1;
int levels = 0;
bool reversible = false;
std::string filter_name = "";
// Init whatever is necessary
ll_init_apr();
@ -523,7 +529,26 @@ int main(int argc, char** argv)
break;
}
}
else if (!strcmp(argv[arg], "--analyzeperformance") || !strcmp(argv[arg], "-a"))
else if (!strcmp(argv[arg], "--filter") || !strcmp(argv[arg], "-f"))
{
// '--filter' needs to be specified with a named filter argument
if ((arg + 1) < argc)
{
filter_name = argv[arg+1];
}
if (((arg + 1) >= argc) || (filter_name[0] == '-'))
{
// We don't have an argument left in the arg list or the next argument is another option
std::cout << "No --filter argument given, no filter will be applied" << std::endl;
}
else
{
arg += 1; // Skip that arg now we know it's a valid test name
if ((arg + 1) == argc) // Break out of the loop if we reach the end of the arg list
break;
}
}
else if (!strcmp(argv[arg], "--analyzeperformance") || !strcmp(argv[arg], "-a"))
{
analyze_performance = true;
}
@ -553,7 +578,10 @@ int main(int argc, char** argv)
fast_timer_log_thread = new LogThread(LLFastTimer::sLogName);
fast_timer_log_thread->start();
}
// Load the filter once and for all
LLImageFilter filter(filter_name);
// Perform action on each input file
std::list<std::string>::iterator in_file = input_filenames.begin();
std::list<std::string>::iterator out_file = output_filenames.begin();
@ -568,7 +596,10 @@ int main(int argc, char** argv)
std::cout << "Error: Image " << *in_file << " could not be loaded" << std::endl;
continue;
}
// Apply the filter
filter.executeFilter(raw_image);
// Save file
if (out_file != out_end)
{

View File

@ -34,7 +34,7 @@
#include <iostream>
#include "apr_base64.h"
#ifdef LL_STANDALONE
#ifdef LL_USESYSTEMLIBS
# include <zlib.h>
#else
# include "zlib/zlib.h" // for davep's dirty little zip functions

View File

@ -35,7 +35,7 @@
extern "C"
{
#ifdef LL_STANDALONE
#ifdef LL_USESYSTEMLIBS
# include <expat.h>
#else
# include "expat/expat.h"

View File

@ -33,7 +33,7 @@
#include "llsys.h"
#include <iostream>
#ifdef LL_STANDALONE
#ifdef LL_USESYSTEMLIBS
# include <zlib.h>
#else
# include "zlib/zlib.h"

View File

@ -27,6 +27,7 @@ set(llimage_SOURCE_FILES
llimage.cpp
llimagedimensionsinfo.cpp
llimagedxt.cpp
llimagefilter.cpp
llimagej2c.cpp
llimagejpeg.cpp
llimagepng.cpp
@ -42,6 +43,7 @@ set(llimage_HEADER_FILES
llimagebmp.h
llimagedimensionsinfo.h
llimagedxt.h
llimagefilter.h
llimagej2c.h
llimagejpeg.h
llimagepng.h

View File

@ -452,18 +452,8 @@ void LLImageRaw::verticalFlip()
void LLImageRaw::expandToPowerOfTwo(S32 max_dim, BOOL scale_image)
{
// Find new sizes
S32 new_width = MIN_IMAGE_SIZE;
S32 new_height = MIN_IMAGE_SIZE;
while( (new_width < getWidth()) && (new_width < max_dim) )
{
new_width <<= 1;
}
while( (new_height < getHeight()) && (new_height < max_dim) )
{
new_height <<= 1;
}
S32 new_width = expandDimToPowerOfTwo(getWidth(), max_dim);
S32 new_height = expandDimToPowerOfTwo(getHeight(), max_dim);
scale( new_width, new_height, scale_image );
}
@ -471,55 +461,61 @@ void LLImageRaw::expandToPowerOfTwo(S32 max_dim, BOOL scale_image)
void LLImageRaw::contractToPowerOfTwo(S32 max_dim, BOOL scale_image)
{
// Find new sizes
S32 new_width = max_dim;
S32 new_height = max_dim;
while( (new_width > getWidth()) && (new_width > MIN_IMAGE_SIZE) )
{
new_width >>= 1;
}
while( (new_height > getHeight()) && (new_height > MIN_IMAGE_SIZE) )
{
new_height >>= 1;
}
S32 new_width = contractDimToPowerOfTwo(getWidth(), MIN_IMAGE_SIZE);
S32 new_height = contractDimToPowerOfTwo(getHeight(), MIN_IMAGE_SIZE);
scale( new_width, new_height, scale_image );
}
void LLImageRaw::biasedScaleToPowerOfTwo(S32 max_dim)
// static
S32 LLImageRaw::biasedDimToPowerOfTwo(S32 curr_dim, S32 max_dim)
{
// Strong bias towards rounding down (to save bandwidth)
// No bias would mean THRESHOLD == 1.5f;
const F32 THRESHOLD = 1.75f;
const F32 THRESHOLD = 1.75f;
// Find new sizes
S32 larger_w = max_dim; // 2^n >= mWidth
S32 smaller_w = max_dim; // 2^(n-1) <= mWidth
while( (smaller_w > getWidth()) && (smaller_w > MIN_IMAGE_SIZE) )
S32 larger_dim = max_dim; // 2^n >= curr_dim
S32 smaller_dim = max_dim; // 2^(n-1) <= curr_dim
while( (smaller_dim > curr_dim) && (smaller_dim > MIN_IMAGE_SIZE) )
{
larger_w = smaller_w;
smaller_w >>= 1;
larger_dim = smaller_dim;
smaller_dim >>= 1;
}
S32 new_width = ( (F32)getWidth() / smaller_w > THRESHOLD ) ? larger_w : smaller_w;
return ( ((F32)curr_dim / (F32)smaller_dim) > THRESHOLD ) ? larger_dim : smaller_dim;
}
S32 larger_h = max_dim; // 2^m >= mHeight
S32 smaller_h = max_dim; // 2^(m-1) <= mHeight
while( (smaller_h > getHeight()) && (smaller_h > MIN_IMAGE_SIZE) )
// static
S32 LLImageRaw::expandDimToPowerOfTwo(S32 curr_dim, S32 max_dim)
{
S32 new_dim = MIN_IMAGE_SIZE;
while( (new_dim < curr_dim) && (new_dim < max_dim) )
{
larger_h = smaller_h;
smaller_h >>= 1;
new_dim <<= 1;
}
S32 new_height = ( (F32)getHeight() / smaller_h > THRESHOLD ) ? larger_h : smaller_h;
return new_dim;
}
// static
S32 LLImageRaw::contractDimToPowerOfTwo(S32 curr_dim, S32 min_dim)
{
S32 new_dim = MAX_IMAGE_SIZE;
while( (new_dim > curr_dim) && (new_dim > min_dim) )
{
new_dim >>= 1;
}
return new_dim;
}
void LLImageRaw::biasedScaleToPowerOfTwo(S32 max_dim)
{
// Find new sizes
S32 new_width = biasedDimToPowerOfTwo(getWidth(),max_dim);
S32 new_height = biasedDimToPowerOfTwo(getHeight(),max_dim);
scale( new_width, new_height );
}
// Calculates (U8)(255*(a/255.f)*(b/255.f) + 0.5f). Thanks, Jim Blinn!
inline U8 LLImageRaw::fastFractionalMult( U8 a, U8 b )
{

View File

@ -209,6 +209,9 @@ public:
void verticalFlip();
static S32 biasedDimToPowerOfTwo(S32 curr_dim, S32 max_dim = MAX_IMAGE_SIZE);
static S32 expandDimToPowerOfTwo(S32 curr_dim, S32 max_dim = MAX_IMAGE_SIZE);
static S32 contractDimToPowerOfTwo(S32 curr_dim, S32 min_dim = MIN_IMAGE_SIZE);
void expandToPowerOfTwo(S32 max_dim = MAX_IMAGE_SIZE, BOOL scale_image = TRUE);
void contractToPowerOfTwo(S32 max_dim = MAX_IMAGE_SIZE, BOOL scale_image = TRUE);
void biasedScaleToPowerOfTwo(S32 max_dim = MAX_IMAGE_SIZE);

939
indra/llimage/llimagefilter.cpp Executable file
View File

@ -0,0 +1,939 @@
/**
* @file llimagefilter.cpp
* @brief Simple Image Filtering. See https://wiki.lindenlab.com/wiki/SL_Viewer_Image_Filters for complete documentation.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2014, 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 "llimagefilter.h"
#include "llmath.h"
#include "v3color.h"
#include "v4coloru.h"
#include "m3math.h"
#include "v3math.h"
#include "llsdserialize.h"
#include "llstring.h"
//---------------------------------------------------------------------------
// LLImageFilter
//---------------------------------------------------------------------------
LLImageFilter::LLImageFilter(const std::string& file_path) :
mFilterData(LLSD::emptyArray()),
mImage(NULL),
mHistoRed(NULL),
mHistoGreen(NULL),
mHistoBlue(NULL),
mHistoBrightness(NULL),
mStencilBlendMode(STENCIL_BLEND_MODE_BLEND),
mStencilShape(STENCIL_SHAPE_UNIFORM),
mStencilGamma(1.0),
mStencilMin(0.0),
mStencilMax(1.0)
{
// Load filter description from file
llifstream filter_xml(file_path);
if (filter_xml.is_open())
{
// Load and parse the file
LLPointer<LLSDParser> parser = new LLSDXMLParser();
parser->parse(filter_xml, mFilterData, LLSDSerialize::SIZE_UNLIMITED);
filter_xml.close();
}
}
LLImageFilter::~LLImageFilter()
{
mImage = NULL;
ll_aligned_free_16(mHistoRed);
ll_aligned_free_16(mHistoGreen);
ll_aligned_free_16(mHistoBlue);
ll_aligned_free_16(mHistoBrightness);
}
/*
*TODO
* Rename stencil to mask
* Improve perf: use LUT for alpha blending in uniform case
* Add gradient coloring as a filter
*/
//============================================================================
// Apply the filter data to the image passed as parameter
//============================================================================
void LLImageFilter::executeFilter(LLPointer<LLImageRaw> raw_image)
{
mImage = raw_image;
//std::cout << "Filter : size = " << mFilterData.size() << std::endl;
for (S32 i = 0; i < mFilterData.size(); ++i)
{
std::string filter_name = mFilterData[i][0].asString();
// Dump out the filter values (for debug)
//std::cout << "Filter : name = " << mFilterData[i][0].asString() << ", params = ";
//for (S32 j = 1; j < mFilterData[i].size(); ++j)
//{
// std::cout << mFilterData[i][j].asString() << ", ";
//}
//std::cout << std::endl;
if (filter_name == "stencil")
{
// Get the shape of the stencil, that is how the procedural alpha is computed geometrically
std::string filter_shape = mFilterData[i][1].asString();
EStencilShape shape = STENCIL_SHAPE_UNIFORM;
if (filter_shape == "uniform")
{
shape = STENCIL_SHAPE_UNIFORM;
}
else if (filter_shape == "gradient")
{
shape = STENCIL_SHAPE_GRADIENT;
}
else if (filter_shape == "vignette")
{
shape = STENCIL_SHAPE_VIGNETTE;
}
else if (filter_shape == "scanlines")
{
shape = STENCIL_SHAPE_SCAN_LINES;
}
// Get the blend mode of the stencil, that is how the effect is blended in the background through the stencil
std::string filter_mode = mFilterData[i][2].asString();
EStencilBlendMode mode = STENCIL_BLEND_MODE_BLEND;
if (filter_mode == "blend")
{
mode = STENCIL_BLEND_MODE_BLEND;
}
else if (filter_mode == "add")
{
mode = STENCIL_BLEND_MODE_ADD;
}
else if (filter_mode == "add_back")
{
mode = STENCIL_BLEND_MODE_ABACK;
}
else if (filter_mode == "fade")
{
mode = STENCIL_BLEND_MODE_FADE;
}
// Get the float params: mandatory min, max then the optional parameters (4 max)
F32 min = (F32)(mFilterData[i][3].asReal());
F32 max = (F32)(mFilterData[i][4].asReal());
F32 params[4] = {0.0, 0.0, 0.0, 0.0};
for (S32 j = 5; (j < mFilterData[i].size()) && (j < 9); j++)
{
params[j-5] = (F32)(mFilterData[i][j].asReal());
}
// Set the stencil
setStencil(shape,mode,min,max,params);
}
else if (filter_name == "sepia")
{
filterSepia();
}
else if (filter_name == "grayscale")
{
filterGrayScale();
}
else if (filter_name == "saturate")
{
filterSaturate((float)(mFilterData[i][1].asReal()));
}
else if (filter_name == "rotate")
{
filterRotate((float)(mFilterData[i][1].asReal()));
}
else if (filter_name == "gamma")
{
LLColor3 color((float)(mFilterData[i][2].asReal()),(float)(mFilterData[i][3].asReal()),(float)(mFilterData[i][4].asReal()));
filterGamma((float)(mFilterData[i][1].asReal()),color);
}
else if (filter_name == "colorize")
{
LLColor3 color((float)(mFilterData[i][1].asReal()),(float)(mFilterData[i][2].asReal()),(float)(mFilterData[i][3].asReal()));
LLColor3 alpha((F32)(mFilterData[i][4].asReal()),(float)(mFilterData[i][5].asReal()),(float)(mFilterData[i][6].asReal()));
filterColorize(color,alpha);
}
else if (filter_name == "contrast")
{
LLColor3 color((float)(mFilterData[i][2].asReal()),(float)(mFilterData[i][3].asReal()),(float)(mFilterData[i][4].asReal()));
filterContrast((float)(mFilterData[i][1].asReal()),color);
}
else if (filter_name == "brighten")
{
LLColor3 color((float)(mFilterData[i][2].asReal()),(float)(mFilterData[i][3].asReal()),(float)(mFilterData[i][4].asReal()));
filterBrightness((float)(mFilterData[i][1].asReal()),color);
}
else if (filter_name == "darken")
{
LLColor3 color((float)(mFilterData[i][2].asReal()),(float)(mFilterData[i][3].asReal()),(float)(mFilterData[i][4].asReal()));
filterBrightness((float)(-mFilterData[i][1].asReal()),color);
}
else if (filter_name == "linearize")
{
LLColor3 color((float)(mFilterData[i][2].asReal()),(float)(mFilterData[i][3].asReal()),(float)(mFilterData[i][4].asReal()));
filterLinearize((float)(mFilterData[i][1].asReal()),color);
}
else if (filter_name == "posterize")
{
LLColor3 color((float)(mFilterData[i][2].asReal()),(float)(mFilterData[i][3].asReal()),(float)(mFilterData[i][4].asReal()));
filterEqualize((S32)(mFilterData[i][1].asReal()),color);
}
else if (filter_name == "screen")
{
std::string screen_name = mFilterData[i][1].asString();
EScreenMode mode = SCREEN_MODE_2DSINE;
if (screen_name == "2Dsine")
{
mode = SCREEN_MODE_2DSINE;
}
else if (screen_name == "line")
{
mode = SCREEN_MODE_LINE;
}
filterScreen(mode,(F32)(mFilterData[i][2].asReal()),(F32)(mFilterData[i][3].asReal()));
}
else if (filter_name == "blur")
{
LLMatrix3 kernel;
for (S32 i = 0; i < NUM_VALUES_IN_MAT3; i++)
for (S32 j = 0; j < NUM_VALUES_IN_MAT3; j++)
kernel.mMatrix[i][j] = 1.0;
convolve(kernel,true,false);
}
else if (filter_name == "sharpen")
{
LLMatrix3 kernel;
for (S32 k = 0; k < NUM_VALUES_IN_MAT3; k++)
for (S32 j = 0; j < NUM_VALUES_IN_MAT3; j++)
kernel.mMatrix[k][j] = -1.0;
kernel.mMatrix[1][1] = 9.0;
convolve(kernel,false,false);
}
else if (filter_name == "gradient")
{
LLMatrix3 kernel;
for (S32 k = 0; k < NUM_VALUES_IN_MAT3; k++)
for (S32 j = 0; j < NUM_VALUES_IN_MAT3; j++)
kernel.mMatrix[k][j] = -1.0;
kernel.mMatrix[1][1] = 8.0;
convolve(kernel,false,true);
}
else if (filter_name == "convolve")
{
LLMatrix3 kernel;
S32 index = 1;
bool normalize = (mFilterData[i][index++].asReal() > 0.0);
bool abs_value = (mFilterData[i][index++].asReal() > 0.0);
for (S32 k = 0; k < NUM_VALUES_IN_MAT3; k++)
for (S32 j = 0; j < NUM_VALUES_IN_MAT3; j++)
kernel.mMatrix[k][j] = mFilterData[i][index++].asReal();
convolve(kernel,normalize,abs_value);
}
else if (filter_name == "colortransform")
{
LLMatrix3 transform;
S32 index = 1;
for (S32 k = 0; k < NUM_VALUES_IN_MAT3; k++)
for (S32 j = 0; j < NUM_VALUES_IN_MAT3; j++)
transform.mMatrix[k][j] = mFilterData[i][index++].asReal();
transform.transpose();
colorTransform(transform);
}
else
{
llwarns << "Filter unknown, cannot execute filter command : " << filter_name << llendl;
}
}
}
//============================================================================
// Filter Primitives
//============================================================================
void LLImageFilter::blendStencil(F32 alpha, U8* pixel, U8 red, U8 green, U8 blue)
{
F32 inv_alpha = 1.0 - alpha;
switch (mStencilBlendMode)
{
case STENCIL_BLEND_MODE_BLEND:
// Classic blend of incoming color with the background image
pixel[VRED] = inv_alpha * pixel[VRED] + alpha * red;
pixel[VGREEN] = inv_alpha * pixel[VGREEN] + alpha * green;
pixel[VBLUE] = inv_alpha * pixel[VBLUE] + alpha * blue;
break;
case STENCIL_BLEND_MODE_ADD:
// Add incoming color to the background image
pixel[VRED] = llclampb(pixel[VRED] + alpha * red);
pixel[VGREEN] = llclampb(pixel[VGREEN] + alpha * green);
pixel[VBLUE] = llclampb(pixel[VBLUE] + alpha * blue);
break;
case STENCIL_BLEND_MODE_ABACK:
// Add back background image to the incoming color
pixel[VRED] = llclampb(inv_alpha * pixel[VRED] + red);
pixel[VGREEN] = llclampb(inv_alpha * pixel[VGREEN] + green);
pixel[VBLUE] = llclampb(inv_alpha * pixel[VBLUE] + blue);
break;
case STENCIL_BLEND_MODE_FADE:
// Fade incoming color to black
pixel[VRED] = alpha * red;
pixel[VGREEN] = alpha * green;
pixel[VBLUE] = alpha * blue;
break;
}
}
void LLImageFilter::colorCorrect(const U8* lut_red, const U8* lut_green, const U8* lut_blue)
{
const S32 components = mImage->getComponents();
llassert( components >= 1 && components <= 4 );
S32 width = mImage->getWidth();
S32 height = mImage->getHeight();
U8* dst_data = mImage->getData();
for (S32 j = 0; j < height; j++)
{
for (S32 i = 0; i < width; i++)
{
// Blend LUT value
blendStencil(getStencilAlpha(i,j), dst_data, lut_red[dst_data[VRED]], lut_green[dst_data[VGREEN]], lut_blue[dst_data[VBLUE]]);
dst_data += components;
}
}
}
void LLImageFilter::colorTransform(const LLMatrix3 &transform)
{
const S32 components = mImage->getComponents();
llassert( components >= 1 && components <= 4 );
S32 width = mImage->getWidth();
S32 height = mImage->getHeight();
U8* dst_data = mImage->getData();
for (S32 j = 0; j < height; j++)
{
for (S32 i = 0; i < width; i++)
{
// Compute transform
LLVector3 src((F32)(dst_data[VRED]),(F32)(dst_data[VGREEN]),(F32)(dst_data[VBLUE]));
LLVector3 dst = src * transform;
dst.clamp(0.0f,255.0f);
// Blend result
blendStencil(getStencilAlpha(i,j), dst_data, dst.mV[VRED], dst.mV[VGREEN], dst.mV[VBLUE]);
dst_data += components;
}
}
}
void LLImageFilter::convolve(const LLMatrix3 &kernel, bool normalize, bool abs_value)
{
const S32 components = mImage->getComponents();
llassert( components >= 1 && components <= 4 );
// Compute normalization factors
F32 kernel_min = 0.0;
F32 kernel_max = 0.0;
for (S32 i = 0; i < NUM_VALUES_IN_MAT3; i++)
{
for (S32 j = 0; j < NUM_VALUES_IN_MAT3; j++)
{
if (kernel.mMatrix[i][j] >= 0.0)
kernel_max += kernel.mMatrix[i][j];
else
kernel_min += kernel.mMatrix[i][j];
}
}
if (abs_value)
{
kernel_max = llabs(kernel_max);
kernel_min = llabs(kernel_min);
kernel_max = llmax(kernel_max,kernel_min);
kernel_min = 0.0;
}
F32 kernel_range = kernel_max - kernel_min;
// Allocate temporary buffers and initialize algorithm's data
S32 width = mImage->getWidth();
S32 height = mImage->getHeight();
U8* dst_data = mImage->getData();
S32 buffer_size = width * components;
llassert_always(buffer_size > 0);
std::vector<U8> even_buffer(buffer_size);
std::vector<U8> odd_buffer(buffer_size);
U8* south_data = dst_data + buffer_size;
U8* east_west_data;
U8* north_data;
// Line 0 : we set the line to 0 (debatable)
memcpy( &even_buffer[0], dst_data, buffer_size ); /* Flawfinder: ignore */
for (S32 i = 0; i < width; i++)
{
blendStencil(getStencilAlpha(i,0), dst_data, 0, 0, 0);
dst_data += components;
}
south_data += buffer_size;
// All other lines
for (S32 j = 1; j < (height-1); j++)
{
// We need to buffer 2 lines. We flip north and east-west (current) to avoid moving too much memory around
if (j % 2)
{
memcpy( &odd_buffer[0], dst_data, buffer_size ); /* Flawfinder: ignore */
east_west_data = &odd_buffer[0];
north_data = &even_buffer[0];
}
else
{
memcpy( &even_buffer[0], dst_data, buffer_size ); /* Flawfinder: ignore */
east_west_data = &even_buffer[0];
north_data = &odd_buffer[0];
}
// First pixel : set to 0
blendStencil(getStencilAlpha(0,j), dst_data, 0, 0, 0);
dst_data += components;
// Set pointers to kernel
U8* NW = north_data;
U8* N = NW+components;
U8* NE = N+components;
U8* W = east_west_data;
U8* C = W+components;
U8* E = C+components;
U8* SW = south_data;
U8* S = SW+components;
U8* SE = S+components;
// All other pixels
for (S32 i = 1; i < (width-1); i++)
{
// Compute convolution
LLVector3 dst;
dst.mV[VRED] = (kernel.mMatrix[0][0]*NW[VRED] + kernel.mMatrix[0][1]*N[VRED] + kernel.mMatrix[0][2]*NE[VRED] +
kernel.mMatrix[1][0]*W[VRED] + kernel.mMatrix[1][1]*C[VRED] + kernel.mMatrix[1][2]*E[VRED] +
kernel.mMatrix[2][0]*SW[VRED] + kernel.mMatrix[2][1]*S[VRED] + kernel.mMatrix[2][2]*SE[VRED]);
dst.mV[VGREEN] = (kernel.mMatrix[0][0]*NW[VGREEN] + kernel.mMatrix[0][1]*N[VGREEN] + kernel.mMatrix[0][2]*NE[VGREEN] +
kernel.mMatrix[1][0]*W[VGREEN] + kernel.mMatrix[1][1]*C[VGREEN] + kernel.mMatrix[1][2]*E[VGREEN] +
kernel.mMatrix[2][0]*SW[VGREEN] + kernel.mMatrix[2][1]*S[VGREEN] + kernel.mMatrix[2][2]*SE[VGREEN]);
dst.mV[VBLUE] = (kernel.mMatrix[0][0]*NW[VBLUE] + kernel.mMatrix[0][1]*N[VBLUE] + kernel.mMatrix[0][2]*NE[VBLUE] +
kernel.mMatrix[1][0]*W[VBLUE] + kernel.mMatrix[1][1]*C[VBLUE] + kernel.mMatrix[1][2]*E[VBLUE] +
kernel.mMatrix[2][0]*SW[VBLUE] + kernel.mMatrix[2][1]*S[VBLUE] + kernel.mMatrix[2][2]*SE[VBLUE]);
if (abs_value)
{
dst.mV[VRED] = llabs(dst.mV[VRED]);
dst.mV[VGREEN] = llabs(dst.mV[VGREEN]);
dst.mV[VBLUE] = llabs(dst.mV[VBLUE]);
}
if (normalize)
{
dst.mV[VRED] = (dst.mV[VRED] - kernel_min)/kernel_range;
dst.mV[VGREEN] = (dst.mV[VGREEN] - kernel_min)/kernel_range;
dst.mV[VBLUE] = (dst.mV[VBLUE] - kernel_min)/kernel_range;
}
dst.clamp(0.0f,255.0f);
// Blend result
blendStencil(getStencilAlpha(i,j), dst_data, dst.mV[VRED], dst.mV[VGREEN], dst.mV[VBLUE]);
// Next pixel
dst_data += components;
NW += components;
N += components;
NE += components;
W += components;
C += components;
E += components;
SW += components;
S += components;
SE += components;
}
// Last pixel : set to 0
blendStencil(getStencilAlpha(width-1,j), dst_data, 0, 0, 0);
dst_data += components;
south_data += buffer_size;
}
// Last line
for (S32 i = 0; i < width; i++)
{
blendStencil(getStencilAlpha(i,0), dst_data, 0, 0, 0);
dst_data += components;
}
}
void LLImageFilter::filterScreen(EScreenMode mode, const F32 wave_length, const F32 angle)
{
const S32 components = mImage->getComponents();
llassert( components >= 1 && components <= 4 );
S32 width = mImage->getWidth();
S32 height = mImage->getHeight();
F32 wave_length_pixels = wave_length * (F32)(height) / 2.0;
F32 sin = sinf(angle*DEG_TO_RAD);
F32 cos = cosf(angle*DEG_TO_RAD);
// Precompute the gamma table : gives us the gray level to use when cutting outside the screen (prevents strong aliasing on the screen)
U8 gamma[256];
for (S32 i = 0; i < 256; i++)
{
F32 gamma_i = llclampf((float)(powf((float)(i)/255.0,1.0/4.0)));
gamma[i] = (U8)(255.0 * gamma_i);
}
U8* dst_data = mImage->getData();
for (S32 j = 0; j < height; j++)
{
for (S32 i = 0; i < width; i++)
{
// Compute screen value
F32 value = 0.0;
F32 di = 0.0;
F32 dj = 0.0;
switch (mode)
{
case SCREEN_MODE_2DSINE:
di = cos*i + sin*j;
dj = -sin*i + cos*j;
value = (sinf(2*F_PI*di/wave_length_pixels)*sinf(2*F_PI*dj/wave_length_pixels)+1.0)*255.0/2.0;
break;
case SCREEN_MODE_LINE:
dj = sin*i - cos*j;
value = (sinf(2*F_PI*dj/wave_length_pixels)+1.0)*255.0/2.0;
break;
}
U8 dst_value = (dst_data[VRED] >= (U8)(value) ? gamma[dst_data[VRED] - (U8)(value)] : 0);
// Blend result
blendStencil(getStencilAlpha(i,j), dst_data, dst_value, dst_value, dst_value);
dst_data += components;
}
}
}
//============================================================================
// Procedural Stencils
//============================================================================
void LLImageFilter::setStencil(EStencilShape shape, EStencilBlendMode mode, F32 min, F32 max, F32* params)
{
mStencilShape = shape;
mStencilBlendMode = mode;
mStencilMin = llmin(llmax(min, -1.0f), 1.0f);
mStencilMax = llmin(llmax(max, -1.0f), 1.0f);
// Each shape will interpret the 4 params differenly.
// We compute each systematically, though, clearly, values are meaningless when the shape doesn't correspond to the parameters
mStencilCenterX = (S32)(mImage->getWidth() + params[0] * (F32)(mImage->getHeight()))/2;
mStencilCenterY = (S32)(mImage->getHeight() + params[1] * (F32)(mImage->getHeight()))/2;
mStencilWidth = (S32)(params[2] * (F32)(mImage->getHeight()))/2;
mStencilGamma = (params[3] <= 0.0 ? 1.0 : params[3]);
mStencilWavelength = (params[0] <= 0.0 ? 10.0 : params[0] * (F32)(mImage->getHeight()) / 2.0);
mStencilSine = sinf(params[1]*DEG_TO_RAD);
mStencilCosine = cosf(params[1]*DEG_TO_RAD);
mStencilStartX = ((F32)(mImage->getWidth()) + params[0] * (F32)(mImage->getHeight()))/2.0;
mStencilStartY = ((F32)(mImage->getHeight()) + params[1] * (F32)(mImage->getHeight()))/2.0;
F32 end_x = ((F32)(mImage->getWidth()) + params[2] * (F32)(mImage->getHeight()))/2.0;
F32 end_y = ((F32)(mImage->getHeight()) + params[3] * (F32)(mImage->getHeight()))/2.0;
mStencilGradX = end_x - mStencilStartX;
mStencilGradY = end_y - mStencilStartY;
mStencilGradN = mStencilGradX*mStencilGradX + mStencilGradY*mStencilGradY;
}
F32 LLImageFilter::getStencilAlpha(S32 i, S32 j)
{
F32 alpha = 1.0; // That init actually takes care of the STENCIL_SHAPE_UNIFORM case...
if (mStencilShape == STENCIL_SHAPE_VIGNETTE)
{
// alpha is a modified gaussian value, with a center and fading in a circular pattern toward the edges
// The gamma parameter controls the intensity of the drop down from alpha 1.0 (center) to 0.0
F32 d_center_square = (i - mStencilCenterX)*(i - mStencilCenterX) + (j - mStencilCenterY)*(j - mStencilCenterY);
alpha = powf(F_E, -(powf((d_center_square/(mStencilWidth*mStencilWidth)),mStencilGamma)/2.0f));
}
else if (mStencilShape == STENCIL_SHAPE_SCAN_LINES)
{
// alpha varies according to a squared sine function.
F32 d = mStencilSine*i - mStencilCosine*j;
alpha = (sinf(2*F_PI*d/mStencilWavelength) > 0.0 ? 1.0 : 0.0);
}
else if (mStencilShape == STENCIL_SHAPE_GRADIENT)
{
alpha = (((F32)(i) - mStencilStartX)*mStencilGradX + ((F32)(j) - mStencilStartY)*mStencilGradY) / mStencilGradN;
alpha = llclampf(alpha);
}
// We rescale alpha between min and max
return (mStencilMin + alpha * (mStencilMax - mStencilMin));
}
//============================================================================
// Histograms
//============================================================================
U32* LLImageFilter::getBrightnessHistogram()
{
if (!mHistoBrightness)
{
computeHistograms();
}
return mHistoBrightness;
}
void LLImageFilter::computeHistograms()
{
const S32 components = mImage->getComponents();
llassert( components >= 1 && components <= 4 );
// Allocate memory for the histograms
if (!mHistoRed)
{
mHistoRed = (U32*) ll_aligned_malloc_16(256*sizeof(U32));
}
if (!mHistoGreen)
{
mHistoGreen = (U32*) ll_aligned_malloc_16(256*sizeof(U32));
}
if (!mHistoBlue)
{
mHistoBlue = (U32*) ll_aligned_malloc_16(256*sizeof(U32));
}
if (!mHistoBrightness)
{
mHistoBrightness = (U32*) ll_aligned_malloc_16(256*sizeof(U32));
}
// Initialize them
for (S32 i = 0; i < 256; i++)
{
mHistoRed[i] = 0;
mHistoGreen[i] = 0;
mHistoBlue[i] = 0;
mHistoBrightness[i] = 0;
}
// Compute them
S32 pixels = mImage->getWidth() * mImage->getHeight();
U8* dst_data = mImage->getData();
for (S32 i = 0; i < pixels; i++)
{
mHistoRed[dst_data[VRED]]++;
mHistoGreen[dst_data[VGREEN]]++;
mHistoBlue[dst_data[VBLUE]]++;
// Note: this is a very simple shorthand for brightness but it's OK for our use
S32 brightness = ((S32)(dst_data[VRED]) + (S32)(dst_data[VGREEN]) + (S32)(dst_data[VBLUE])) / 3;
mHistoBrightness[brightness]++;
// next pixel...
dst_data += components;
}
}
//============================================================================
// Secondary Filters
//============================================================================
void LLImageFilter::filterGrayScale()
{
LLMatrix3 gray_scale;
LLVector3 luminosity(0.2125, 0.7154, 0.0721);
gray_scale.setRows(luminosity, luminosity, luminosity);
gray_scale.transpose();
colorTransform(gray_scale);
}
void LLImageFilter::filterSepia()
{
LLMatrix3 sepia;
sepia.setRows(LLVector3(0.3588, 0.7044, 0.1368),
LLVector3(0.2990, 0.5870, 0.1140),
LLVector3(0.2392, 0.4696, 0.0912));
sepia.transpose();
colorTransform(sepia);
}
void LLImageFilter::filterSaturate(F32 saturation)
{
// Matrix to Lij
LLMatrix3 r_a;
LLMatrix3 r_b;
// 45 degre rotation around z
r_a.setRows(LLVector3( OO_SQRT2, OO_SQRT2, 0.0),
LLVector3(-OO_SQRT2, OO_SQRT2, 0.0),
LLVector3( 0.0, 0.0, 1.0));
// 54.73 degre rotation around y
float oo_sqrt3 = 1.0f / F_SQRT3;
float sin_54 = F_SQRT2 * oo_sqrt3;
r_b.setRows(LLVector3(oo_sqrt3, 0.0, -sin_54),
LLVector3(0.0, 1.0, 0.0),
LLVector3(sin_54, 0.0, oo_sqrt3));
// Coordinate conversion
LLMatrix3 Lij = r_b * r_a;
LLMatrix3 Lij_inv = Lij;
Lij_inv.transpose();
// Local saturation transform
LLMatrix3 s;
s.setRows(LLVector3(saturation, 0.0, 0.0),
LLVector3(0.0, saturation, 0.0),
LLVector3(0.0, 0.0, 1.0));
// Global saturation transform
LLMatrix3 transfo = Lij_inv * s * Lij;
colorTransform(transfo);
}
void LLImageFilter::filterRotate(F32 angle)
{
// Matrix to Lij
LLMatrix3 r_a;
LLMatrix3 r_b;
// 45 degre rotation around z
r_a.setRows(LLVector3( OO_SQRT2, OO_SQRT2, 0.0),
LLVector3(-OO_SQRT2, OO_SQRT2, 0.0),
LLVector3( 0.0, 0.0, 1.0));
// 54.73 degre rotation around y
float oo_sqrt3 = 1.0f / F_SQRT3;
float sin_54 = F_SQRT2 * oo_sqrt3;
r_b.setRows(LLVector3(oo_sqrt3, 0.0, -sin_54),
LLVector3(0.0, 1.0, 0.0),
LLVector3(sin_54, 0.0, oo_sqrt3));
// Coordinate conversion
LLMatrix3 Lij = r_b * r_a;
LLMatrix3 Lij_inv = Lij;
Lij_inv.transpose();
// Local color rotation transform
LLMatrix3 r;
angle *= DEG_TO_RAD;
r.setRows(LLVector3( cosf(angle), sinf(angle), 0.0),
LLVector3(-sinf(angle), cosf(angle), 0.0),
LLVector3( 0.0, 0.0, 1.0));
// Global color rotation transform
LLMatrix3 transfo = Lij_inv * r * Lij;
colorTransform(transfo);
}
void LLImageFilter::filterGamma(F32 gamma, const LLColor3& alpha)
{
U8 gamma_red_lut[256];
U8 gamma_green_lut[256];
U8 gamma_blue_lut[256];
for (S32 i = 0; i < 256; i++)
{
F32 gamma_i = llclampf((float)(powf((float)(i)/255.0,1.0/gamma)));
// Blend in with alpha values
gamma_red_lut[i] = (U8)((1.0 - alpha.mV[0]) * (float)(i) + alpha.mV[0] * 255.0 * gamma_i);
gamma_green_lut[i] = (U8)((1.0 - alpha.mV[1]) * (float)(i) + alpha.mV[1] * 255.0 * gamma_i);
gamma_blue_lut[i] = (U8)((1.0 - alpha.mV[2]) * (float)(i) + alpha.mV[2] * 255.0 * gamma_i);
}
colorCorrect(gamma_red_lut,gamma_green_lut,gamma_blue_lut);
}
void LLImageFilter::filterLinearize(F32 tail, const LLColor3& alpha)
{
// Get the histogram
U32* histo = getBrightnessHistogram();
// Compute cumulated histogram
U32 cumulated_histo[256];
cumulated_histo[0] = histo[0];
for (S32 i = 1; i < 256; i++)
{
cumulated_histo[i] = cumulated_histo[i-1] + histo[i];
}
// Compute min and max counts minus tail
tail = llclampf(tail);
S32 total = cumulated_histo[255];
S32 min_c = (S32)((F32)(total) * tail);
S32 max_c = (S32)((F32)(total) * (1.0 - tail));
// Find min and max values
S32 min_v = 0;
while (cumulated_histo[min_v] < min_c)
{
min_v++;
}
S32 max_v = 255;
while (cumulated_histo[max_v] > max_c)
{
max_v--;
}
// Compute linear lookup table
U8 linear_red_lut[256];
U8 linear_green_lut[256];
U8 linear_blue_lut[256];
if (max_v == min_v)
{
// Degenerated binary split case
for (S32 i = 0; i < 256; i++)
{
U8 value_i = (i < min_v ? 0 : 255);
// Blend in with alpha values
linear_red_lut[i] = (U8)((1.0 - alpha.mV[0]) * (float)(i) + alpha.mV[0] * value_i);
linear_green_lut[i] = (U8)((1.0 - alpha.mV[1]) * (float)(i) + alpha.mV[1] * value_i);
linear_blue_lut[i] = (U8)((1.0 - alpha.mV[2]) * (float)(i) + alpha.mV[2] * value_i);
}
}
else
{
// Linearize between min and max
F32 slope = 255.0 / (F32)(max_v - min_v);
F32 translate = -min_v * slope;
for (S32 i = 0; i < 256; i++)
{
U8 value_i = (U8)(llclampb((S32)(slope*i + translate)));
// Blend in with alpha values
linear_red_lut[i] = (U8)((1.0 - alpha.mV[0]) * (float)(i) + alpha.mV[0] * value_i);
linear_green_lut[i] = (U8)((1.0 - alpha.mV[1]) * (float)(i) + alpha.mV[1] * value_i);
linear_blue_lut[i] = (U8)((1.0 - alpha.mV[2]) * (float)(i) + alpha.mV[2] * value_i);
}
}
// Apply lookup table
colorCorrect(linear_red_lut,linear_green_lut,linear_blue_lut);
}
void LLImageFilter::filterEqualize(S32 nb_classes, const LLColor3& alpha)
{
// Regularize the parameter: must be between 2 and 255
nb_classes = llmax(nb_classes,2);
nb_classes = llclampb(nb_classes);
// Get the histogram
U32* histo = getBrightnessHistogram();
// Compute cumulated histogram
U32 cumulated_histo[256];
cumulated_histo[0] = histo[0];
for (S32 i = 1; i < 256; i++)
{
cumulated_histo[i] = cumulated_histo[i-1] + histo[i];
}
// Compute deltas
S32 total = cumulated_histo[255];
S32 delta_count = total / nb_classes;
S32 current_count = delta_count;
S32 delta_value = 256 / (nb_classes - 1);
S32 current_value = 0;
// Compute equalized lookup table
U8 equalize_red_lut[256];
U8 equalize_green_lut[256];
U8 equalize_blue_lut[256];
for (S32 i = 0; i < 256; i++)
{
// Blend in current_value with alpha values
equalize_red_lut[i] = (U8)((1.0 - alpha.mV[0]) * (float)(i) + alpha.mV[0] * current_value);
equalize_green_lut[i] = (U8)((1.0 - alpha.mV[1]) * (float)(i) + alpha.mV[1] * current_value);
equalize_blue_lut[i] = (U8)((1.0 - alpha.mV[2]) * (float)(i) + alpha.mV[2] * current_value);
if (cumulated_histo[i] >= current_count)
{
current_count += delta_count;
current_value += delta_value;
current_value = llclampb(current_value);
}
}
// Apply lookup table
colorCorrect(equalize_red_lut,equalize_green_lut,equalize_blue_lut);
}
void LLImageFilter::filterColorize(const LLColor3& color, const LLColor3& alpha)
{
U8 red_lut[256];
U8 green_lut[256];
U8 blue_lut[256];
F32 red_composite = 255.0 * alpha.mV[0] * color.mV[0];
F32 green_composite = 255.0 * alpha.mV[1] * color.mV[1];
F32 blue_composite = 255.0 * alpha.mV[2] * color.mV[2];
for (S32 i = 0; i < 256; i++)
{
red_lut[i] = (U8)(llclampb((S32)((1.0 - alpha.mV[0]) * (F32)(i) + red_composite)));
green_lut[i] = (U8)(llclampb((S32)((1.0 - alpha.mV[1]) * (F32)(i) + green_composite)));
blue_lut[i] = (U8)(llclampb((S32)((1.0 - alpha.mV[2]) * (F32)(i) + blue_composite)));
}
colorCorrect(red_lut,green_lut,blue_lut);
}
void LLImageFilter::filterContrast(F32 slope, const LLColor3& alpha)
{
U8 contrast_red_lut[256];
U8 contrast_green_lut[256];
U8 contrast_blue_lut[256];
F32 translate = 128.0 * (1.0 - slope);
for (S32 i = 0; i < 256; i++)
{
U8 value_i = (U8)(llclampb((S32)(slope*i + translate)));
// Blend in with alpha values
contrast_red_lut[i] = (U8)((1.0 - alpha.mV[0]) * (float)(i) + alpha.mV[0] * value_i);
contrast_green_lut[i] = (U8)((1.0 - alpha.mV[1]) * (float)(i) + alpha.mV[1] * value_i);
contrast_blue_lut[i] = (U8)((1.0 - alpha.mV[2]) * (float)(i) + alpha.mV[2] * value_i);
}
colorCorrect(contrast_red_lut,contrast_green_lut,contrast_blue_lut);
}
void LLImageFilter::filterBrightness(F32 add, const LLColor3& alpha)
{
U8 brightness_red_lut[256];
U8 brightness_green_lut[256];
U8 brightness_blue_lut[256];
S32 add_value = (S32)(add * 255.0);
for (S32 i = 0; i < 256; i++)
{
U8 value_i = (U8)(llclampb(i + add_value));
// Blend in with alpha values
brightness_red_lut[i] = (U8)((1.0 - alpha.mV[0]) * (float)(i) + alpha.mV[0] * value_i);
brightness_green_lut[i] = (U8)((1.0 - alpha.mV[1]) * (float)(i) + alpha.mV[1] * value_i);
brightness_blue_lut[i] = (U8)((1.0 - alpha.mV[2]) * (float)(i) + alpha.mV[2] * value_i);
}
colorCorrect(brightness_red_lut,brightness_green_lut,brightness_blue_lut);
}
//============================================================================

137
indra/llimage/llimagefilter.h Executable file
View File

@ -0,0 +1,137 @@
/**
* @file llimagefilter.h
* @brief Simple Image Filtering. See https://wiki.lindenlab.com/wiki/SL_Viewer_Image_Filters for complete documentation.
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2014, 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_LLIMAGEFILTER_H
#define LL_LLIMAGEFILTER_H
#include "llsd.h"
#include "llimage.h"
class LLImageRaw;
class LLColor4U;
class LLColor3;
class LLMatrix3;
typedef enum e_stencil_blend_mode
{
STENCIL_BLEND_MODE_BLEND = 0,
STENCIL_BLEND_MODE_ADD = 1,
STENCIL_BLEND_MODE_ABACK = 2,
STENCIL_BLEND_MODE_FADE = 3
} EStencilBlendMode;
typedef enum e_stencil_shape
{
STENCIL_SHAPE_UNIFORM = 0,
STENCIL_SHAPE_GRADIENT = 1,
STENCIL_SHAPE_VIGNETTE = 2,
STENCIL_SHAPE_SCAN_LINES = 3
} EStencilShape;
typedef enum e_screen_mode
{
SCREEN_MODE_2DSINE = 0,
SCREEN_MODE_LINE = 1
} EScreenMode;
//============================================================================
// LLImageFilter
//============================================================================
class LLImageFilter
{
public:
LLImageFilter(const std::string& file_path);
~LLImageFilter();
void executeFilter(LLPointer<LLImageRaw> raw_image);
private:
// Filter Operations : Transforms
void filterGrayScale(); // Convert to grayscale
void filterSepia(); // Convert to sepia
void filterSaturate(F32 saturation); // < 1.0 desaturates, > 1.0 saturates
void filterRotate(F32 angle); // Rotates hue according to angle, angle in degrees
// Filter Operations : Color Corrections
// When specified, the LLColor3 alpha parameter indicates the intensity of the effect for each color channel
// acting in effect as an alpha blending factor different for each channel. For instance (1.0,0.0,0.0) will apply
// the effect only to the Red channel. Intermediate values blends the effect with the source color.
void filterGamma(F32 gamma, const LLColor3& alpha); // Apply gamma to each channel
void filterLinearize(F32 tail, const LLColor3& alpha); // Use histogram to linearize constrast between min and max values minus tail
void filterEqualize(S32 nb_classes, const LLColor3& alpha); // Use histogram to equalize constrast between nb_classes throughout the image
void filterColorize(const LLColor3& color, const LLColor3& alpha); // Colorize with color and alpha per channel
void filterContrast(F32 slope, const LLColor3& alpha); // Change contrast according to slope: > 1.0 more contrast, < 1.0 less contrast
void filterBrightness(F32 add, const LLColor3& alpha); // Change brightness according to add: > 0 brighter, < 0 darker
// Filter Primitives
void colorTransform(const LLMatrix3 &transform);
void colorCorrect(const U8* lut_red, const U8* lut_green, const U8* lut_blue);
void filterScreen(EScreenMode mode, const F32 wave_length, const F32 angle);
void blendStencil(F32 alpha, U8* pixel, U8 red, U8 green, U8 blue);
void convolve(const LLMatrix3 &kernel, bool normalize, bool abs_value);
// Procedural Stencils
void setStencil(EStencilShape shape, EStencilBlendMode mode, F32 min, F32 max, F32* params);
F32 getStencilAlpha(S32 i, S32 j);
// Histograms
U32* getBrightnessHistogram();
void computeHistograms();
LLSD mFilterData;
LLPointer<LLImageRaw> mImage;
// Histograms (if we ever happen to need them)
U32 *mHistoRed;
U32 *mHistoGreen;
U32 *mHistoBlue;
U32 *mHistoBrightness;
// Current Stencil Settings
EStencilBlendMode mStencilBlendMode;
EStencilShape mStencilShape;
F32 mStencilMin;
F32 mStencilMax;
S32 mStencilCenterX;
S32 mStencilCenterY;
S32 mStencilWidth;
F32 mStencilGamma;
F32 mStencilWavelength;
F32 mStencilSine;
F32 mStencilCosine;
F32 mStencilStartX;
F32 mStencilStartY;
F32 mStencilGradX;
F32 mStencilGradY;
F32 mStencilGradN;
};
#endif

View File

@ -33,7 +33,7 @@
#include "llwin32headerslean.h"
extern "C" {
#ifdef LL_STANDALONE
#ifdef LL_USESYSTEMLIBS
# include <jpeglib.h>
# include <jerror.h>
#else

View File

@ -92,7 +92,7 @@ LLFolderDictionary::LLFolderDictionary()
addEntry(LLFolderType::FT_MESH, new FolderEntry("mesh", TRUE));
addEntry(LLFolderType::FT_INBOX, new FolderEntry("inbox", FALSE));
addEntry(LLFolderType::FT_INBOX, new FolderEntry("inbox", TRUE));
addEntry(LLFolderType::FT_OUTBOX, new FolderEntry("outbox", FALSE));
addEntry(LLFolderType::FT_BASIC_ROOT, new FolderEntry("basic_rt", TRUE));

View File

@ -1,4 +1,4 @@
/**
/**
* @file llmath.h
* @brief Useful math constants and macros.
*
@ -73,6 +73,7 @@ const F32 F_E = 2.71828182845904523536f;
const F32 F_SQRT2 = 1.4142135623730950488016887242097f;
const F32 F_SQRT3 = 1.73205080756888288657986402541f;
const F32 OO_SQRT2 = 0.7071067811865475244008443621049f;
const F32 OO_SQRT3 = 0.577350269189625764509f;
const F32 DEG_TO_RAD = 0.017453292519943295769236907684886f;
const F32 RAD_TO_DEG = 57.295779513082320876798154814105f;
const F32 F_APPROXIMATELY_ZERO = 0.00001f;
@ -84,6 +85,9 @@ const F32 OO_LN2 = 1.4426950408889634073599246810019f;
const F32 F_ALMOST_ZERO = 0.0001f;
const F32 F_ALMOST_ONE = 1.0f - F_ALMOST_ZERO;
const F32 GIMBAL_THRESHOLD = 0.000436f; // sets the gimballock threshold 0.025 away from +/-90 degrees
// formula: GIMBAL_THRESHOLD = sin(DEG_TO_RAD * gimbal_threshold_angle);
// BUG: Eliminate in favor of F_APPROXIMATELY_ZERO above?
const F32 FP_MAG_THRESHOLD = 0.0000001f;

View File

@ -36,6 +36,8 @@
extern U32 gOctreeMaxCapacity;
extern float gOctreeMinSize;
/*#define LL_OCTREE_PARANOIA_CHECK 0
#if LL_DARWIN
#define LL_OCTREE_MAX_CAPACITY 32
@ -106,6 +108,7 @@ public:
: mParent((oct_node*)parent),
mOctant(octant)
{
llassert(size[0] >= gOctreeMinSize*0.5f);
//always keep a NULL terminated list to avoid out of bounds exceptions in debug builds
mData.push_back(NULL);
mDataEnd = &mData[0];
@ -213,7 +216,7 @@ public:
F32 size = mSize[0];
F32 p_size = size * 2.f;
return (radius <= 0.001f && size <= 0.001f) ||
return (radius <= gOctreeMinSize && size <= gOctreeMinSize) ||
(radius <= p_size && radius > size);
}
@ -319,7 +322,7 @@ public:
//is it here?
if (isInside(data->getPositionGroup()))
{
if ((getElementCount() < gOctreeMaxCapacity && contains(data->getBinRadius()) ||
if (((getElementCount() < gOctreeMaxCapacity || getSize()[0] <= gOctreeMinSize) && contains(data->getBinRadius()) ||
(data->getBinRadius() > getSize()[0] && parent && parent->getElementCount() >= gOctreeMaxCapacity)))
{ //it belongs here
mData.push_back(NULL);
@ -356,8 +359,9 @@ public:
LLVector4a val;
val.setSub(center, getCenter());
val.setAbs(val);
S32 lt = val.lessThan(LLVector4a::getEpsilon()).getGatheredBits() & 0x7;
LLVector4a min_diff(gOctreeMinSize);
S32 lt = val.lessThan(min_diff).getGatheredBits() & 0x7;
if( lt == 0x7 )
{
@ -389,6 +393,7 @@ public:
}
#endif
llassert(size[0] >= gOctreeMinSize*0.5f);
//make the new kid
child = new LLOctreeNode<T>(center, size, this);
addChild(child);
@ -796,6 +801,8 @@ public:
this->setSize(size2);
this->updateMinMax();
llassert(size[0] >= gOctreeMinSize);
//copy our children to a new branch
LLOctreeNode<T>* newnode = new LLOctreeNode<T>(center, size, this);

Some files were not shown because too many files have changed in this diff Show More