Ignacio Castano 4 years ago
commit e4301b3df7

@ -0,0 +1,33 @@
name: build
on: [push, pull_request]
jobs:
vs2017:
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- uses: microsoft/setup-msbuild@v1.0.0
- name: Build Debug/x64
run: msbuild .\project\vc2017\nvtt.sln /property:Configuration=Debug /property:Platform=x64
- name: Build Debug/Win32
run: msbuild .\project\vc2017\nvtt.sln /property:Configuration=Debug /property:Platform=Win32
- name: Build Release/x64
run: msbuild .\project\vc2017\nvtt.sln /property:Configuration=Release /property:Platform=x64
- name: Build Release/Win32
run: msbuild .\project\vc2017\nvtt.sln /property:Configuration=Release /property:Platform=Win32
unix:
strategy:
matrix:
os: [ubuntu, macos]
name: ${{matrix.os}}
runs-on: ${{matrix.os}}-latest
steps:
- uses: actions/checkout@v2
- name: make
run: |
./configure --debug
make
./configure --release
make

@ -16,23 +16,7 @@ else()
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
IF(WIN32)
# gnuwin32 paths:
#SET(GNUWIN32_PATH "${NV_SOURCE_DIR}/extern/gnuwin32")
#SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${GNUWIN32_PATH}/include")
#SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${GNUWIN32_PATH}/lib")
# Set GLUT path:
#SET(GLUT_ROOT_DIR "${NV_SOURCE_DIR}/extern/glut")
# Set FreeImage path:
#SET(FREEIMAGE_ROOT_DIR "${NV_SOURCE_DIR}/extern/FreeImage")
ENDIF(WIN32)
INCLUDE(${NV_CMAKE_DIR}/OptimalOptions.cmake)
MESSAGE(STATUS "Setting optimal options")
MESSAGE(STATUS " Processor: ${NV_SYSTEM_PROCESSOR}")
MESSAGE(STATUS " Compiler Flags: ${CMAKE_CXX_FLAGS}")
IF(CMAKE_BUILD_TYPE MATCHES "debug")
SET(CMAKE_DEBUG_POSTFIX "_d" CACHE STRING "Postfix for debug build libraries.")
@ -40,12 +24,6 @@ IF(CMAKE_BUILD_TYPE MATCHES "debug")
ENDIF()
#IF(NVTT_SHARED)
# SET(NVCORE_SHARED TRUE)
# SET(NVMATH_SHARED TRUE)
# SET(NVIMAGE_SHARED TRUE)
#ENDIF(NVTT_SHARED)
ADD_SUBDIRECTORY(extern)
ADD_SUBDIRECTORY(src)
@ -66,10 +44,9 @@ ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
SET(CPACK_PACKAGE_NAME "nvidia-texture-tools")
SET(CPACK_PACKAGE_VERSION_MAJOR "2")
SET(CPACK_PACKAGE_VERSION_MINOR "1")
SET(CPACK_PACKAGE_VERSION_PATCH "0")
SET(CPACK_PACKAGE_VERSION "2.1.0")
SET(CPACK_PACKAGE_VERSION_PATCH "1")
SET(CPACK_PACKAGE_VERSION "2.1.1")
SET(CPACK_PACKAGE_CONTACT "Ignacio Castaño <castano@gmail.com>")
#SET(CPACK_PACKAGE_VENDOR "NVIDIA Corporation")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Texture processing tools with support for Direct3D 10 and 11 formats.")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${NV_SOURCE_DIR}/README.md")
@ -79,7 +56,7 @@ SET(CPACK_RESOURCE_FILE_LICENSE "${NV_SOURCE_DIR}/LICENSE")
IF(WIN32)
SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_VENDOR}\\\\NVIDIA Texture Tools 2.1")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}\\\\NVIDIA Texture Tools 2.1")
SET(CPACK_PACKAGE_ICON "${NV_SOURCE_DIR}\\\\project\\\\vc8\\\\nvcompress\\\\nvidia.ico")
SET(CPACK_PACKAGE_ICON "${NV_SOURCE_DIR}\\\\project\\\\vc2017\\\\nvcompress\\\\nvidia.ico")
ENDIF(WIN32)
INCLUDE(CPack)

@ -1,6 +1,6 @@
NVIDIA Texture Tools is licensed under the MIT license.
Copyright (c) 2009-2017 Ignacio Castaño
Copyright (c) 2009-2020 Ignacio Castaño
Copyright (c) 2007-2009 NVIDIA Corporation
Permission is hereby granted, free of charge, to any person

@ -11,9 +11,7 @@ conversion, and DXT compression.
### How to build (Windows)
Open `project/vc12/thekla.sln` using Visual Studio.
Solutions for previous versions are also available, but they may not be up to date.
Use the provided Visual Studio 2017 solution `project/vc2017/thekla.sln`.
### How to build (Linux/OSX)
@ -32,13 +30,13 @@ $ sudo make install
To use the NVIDIA Texture Tools in your own applications you just have to
include the following header file:
src/nvtt/nvtt.h
[src/nvtt/nvtt.h](https://github.com/castano/nvidia-texture-tools/blob/master/src/nvtt/nvtt.h)
And include the nvtt library in your projects.
The following file contains a simple example that shows how to use the library:
src/nvtt/tools/compress.cpp
[src/nvtt/tools/compress.cpp](https://github.com/castano/nvidia-texture-tools/blob/master/src/nvtt/tools/compress.cpp)
Detailed documentation of the API can be found at:

@ -4,9 +4,6 @@ tar zcvf nvidia-texture-tools-`cat VERSION`.tar.gz \
--exclude '.*' --exclude debian --exclude '*~' --exclude buildpkg \
--exclude 'build-*' --exclude data --exclude tags --exclude Makefile \
--exclude 'doc' --exclude 'nvidia-texture-tools-*.tar.gz' \
--exclude 'extern/skylight' --exclude 'extern/FreeImage' \
--exclude 'extern/atitc' --exclude 'extern/glew' \
--exclude 'extern/gnuwin32' \
--exclude '*.user' -s ',^,nvidia-texture-tools/,' *
# --exclude '*.user' --transform 's,^,nvidia-texture-tools/,' *
# --exclude '*.user' *

@ -1,72 +0,0 @@
# Assume i586 by default.
SET(NV_SYSTEM_PROCESSOR "i586")
IF(UNIX)
FIND_PROGRAM(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin )
IF(CMAKE_UNAME)
#EXEC_PROGRAM(uname ARGS -p OUTPUT_VARIABLE NV_SYSTEM_PROCESSOR RETURN_VALUE val)
#IF("${val}" GREATER 0 OR NV_SYSTEM_PROCESSOR STREQUAL "unknown")
EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE NV_SYSTEM_PROCESSOR RETURN_VALUE val)
#ENDIF("${val}" GREATER 0 OR NV_SYSTEM_PROCESSOR STREQUAL "unknown")
IF(NV_SYSTEM_PROCESSOR STREQUAL "Power Macintosh")
SET(NV_SYSTEM_PROCESSOR "powerpc")
ENDIF(NV_SYSTEM_PROCESSOR STREQUAL "Power Macintosh")
# processor may have double quote in the name, and that needs to be removed
STRING(REGEX REPLACE "\"" "" NV_SYSTEM_PROCESSOR "${NV_SYSTEM_PROCESSOR}")
STRING(REGEX REPLACE "/" "_" NV_SYSTEM_PROCESSOR "${NV_SYSTEM_PROCESSOR}")
ENDIF(CMAKE_UNAME)
#~ # Get extended processor information from /proc/cpuinfo
#~ IF(EXISTS "/proc/cpuinfo")
#~ FILE(READ /proc/cpuinfo PROC_CPUINFO)
#~ SET(VENDOR_ID_RX "vendor_id[ \t]*:[ \t]*([a-zA-Z]+)\n")
#~ STRING(REGEX MATCH "${VENDOR_ID_RX}" VENDOR_ID "${PROC_CPUINFO}")
#~ STRING(REGEX REPLACE "${VENDOR_ID_RX}" "\\1" VENDOR_ID "${VENDOR_ID}")
#~ SET(CPU_FAMILY_RX "cpu family[ \t]*:[ \t]*([0-9]+)")
#~ STRING(REGEX MATCH "${CPU_FAMILY_RX}" CPU_FAMILY "${PROC_CPUINFO}")
#~ STRING(REGEX REPLACE "${CPU_FAMILY_RX}" "\\1" CPU_FAMILY "${CPU_FAMILY}")
#~ SET(MODEL_RX "model[ \t]*:[ \t]*([0-9]+)")
#~ STRING(REGEX MATCH "${MODEL_RX}" MODEL "${PROC_CPUINFO}")
#~ STRING(REGEX REPLACE "${MODEL_RX}" "\\1" MODEL "${MODEL}")
#~ SET(FLAGS_RX "flags[ \t]*:[ \t]*([a-zA-Z0-9 _]+)\n")
#~ STRING(REGEX MATCH "${FLAGS_RX}" FLAGS "${PROC_CPUINFO}")
#~ STRING(REGEX REPLACE "${FLAGS_RX}" "\\1" FLAGS "${FLAGS}")
#~ # Debug output.
#~ IF(LINUX_CPUINFO)
#~ MESSAGE(STATUS "LinuxCPUInfo.cmake:")
#~ MESSAGE(STATUS "VENDOR_ID : ${VENDOR_ID}")
#~ MESSAGE(STATUS "CPU_FAMILY : ${CPU_FAMILY}")
#~ MESSAGE(STATUS "MODEL : ${MODEL}")
#~ MESSAGE(STATUS "FLAGS : ${FLAGS}")
#~ ENDIF(LINUX_CPUINFO)
#~ ENDIF(EXISTS "/proc/cpuinfo")
#~ # Information on how to decode CPU_FAMILY and MODEL:
#~ # http://balusc.xs4all.nl/srv/har-cpu-int-pm.php
ELSE(UNIX)
IF(WIN32)
# It's not OK to trust $ENV{PROCESSOR_ARCHITECTURE}: its value depends on the type of executable being run,
# so a 32-bit cmake (the default binary distribution) will always say "x86" regardless of the actual target.
IF (CMAKE_SIZEOF_VOID_P EQUAL 8)
SET (NV_SYSTEM_PROCESSOR "x86_64")
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
SET (NV_SYSTEM_PROCESSOR "x86")
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
ENDIF(WIN32)
ENDIF(UNIX)

@ -1,172 +0,0 @@
#
# Try to find NVIDIA's Cg compiler, runtime libraries, and include path.
# Once done this will define
#
# CG_FOUND =system has NVIDIA Cg and it can be used.
# CG_INCLUDE_DIR = directory where cg.h resides
# CG_LIBRARY = full path to libCg.so (Cg.DLL on win32)
# CG_GL_LIBRARY = full path to libCgGL.so (CgGL.dll on win32)
# CG_COMPILER = full path to cgc (cgc.exe on win32)
#
# On OSX default to using the framework version of Cg.
IF (APPLE)
INCLUDE(${CMAKE_ROOT}/Modules/CMakeFindFrameworks.cmake)
SET(CG_FRAMEWORK_INCLUDES)
CMAKE_FIND_FRAMEWORKS(Cg)
IF (Cg_FRAMEWORKS)
FOREACH(dir ${Cg_FRAMEWORKS})
SET(CG_FRAMEWORK_INCLUDES ${CG_FRAMEWORK_INCLUDES}
${dir}/Headers ${dir}/PrivateHeaders)
ENDFOREACH(dir)
# Find the include dir
FIND_PATH(CG_INCLUDE_DIR cg.h
${CG_FRAMEWORK_INCLUDES}
)
# Since we are using Cg framework, we must link to it.
# Note, we use weak linking, so that it works even when Cg is not available.
SET(CG_LIBRARY "-weak_framework Cg" CACHE STRING "Cg library")
SET(CG_GL_LIBRARY "-weak_framework Cg" CACHE STRING "Cg GL library")
ENDIF (Cg_FRAMEWORKS)
FIND_PROGRAM(CG_COMPILER cgc
/usr/bin
/usr/local/bin
DOC "The Cg compiler"
)
ELSE (APPLE)
IF (WIN32)
# When compiling 64-bit programs, the binaries and libs are in bin.x64 and lib.x64 directories,
# This will have only effect for 64bit versions of cmake, when running the default 32bit version
# both ProgramFiles and ProgramFiles(x86) point to the same place in Win64
SET(PFx86_VARNAME "ProgramFiles(x86)")
SET(PFx86 $ENV{${PFx86_VARNAME}})
# Let's play safe in case we are cross compiling to 64 bit: for cgc it doesn't really matter
FIND_PROGRAM( CG_COMPILER cgc
$ENV{CG_BIN64_PATH}
$ENV{CG_BIN_PATH}
$ENV{PROGRAMFILES}/NVIDIA\ Corporation/Cg/bin
$ENV{PFx86}/NVIDIA\ Corporation/Cg/bin
$ENV{PROGRAMFILES}/Cg
${PROJECT_SOURCE_DIR}/../Cg
DOC "The Cg Compiler"
)
IF (CG_COMPILER)
GET_FILENAME_COMPONENT(CG_COMPILER_DIR ${CG_COMPILER} PATH)
GET_FILENAME_COMPONENT(CG_COMPILER_SUPER_DIR ${CG_COMPILER_DIR} PATH)
ELSE (CG_COMPILER)
SET (CG_COMPILER_DIR .)
SET (CG_COMPILER_SUPER_DIR ..)
ENDIF (CG_COMPILER)
FIND_PATH( CG_INCLUDE_DIR Cg/cg.h
$ENV{CG_INC_PATH}
$ENV{PROGRAMFILES}/NVIDIA\ Corporation/Cg/include
$ENV{PROGRAMFILES}/Cg
${PROJECT_SOURCE_DIR}/../Cg
${CG_COMPILER_SUPER_DIR}/include
${CG_COMPILER_DIR}
DOC "The directory where Cg/cg.h resides"
)
IF (NV_SYSTEM_PROCESSOR STREQUAL "x86_64")
FIND_LIBRARY( CG_LIBRARY
NAMES Cg
PATHS
$ENV{CG_LIB64_PATH}
$ENV{PROGRAMFILES}/NVIDIA\ Corporation/Cg/lib.x64
$ENV{PFx86}/NVIDIA\ Corporation/Cg/lib.x64
$ENV{PROGRAMFILES}/Cg
$ENV{PFx86}/Cg
${PROJECT_SOURCE_DIR}/../Cg
${CG_COMPILER_SUPER_DIR}/lib.x64
${CG_COMPILER_DIR}
DOC "The Cg runtime library (64-bit)"
)
FIND_LIBRARY( CG_GL_LIBRARY
NAMES CgGL
PATHS
$ENV{CG_LIB64_PATH}
$ENV{PROGRAMFILES}/NVIDIA\ Corporation/Cg/lib.x64
$ENV{PFx86}/NVIDIA\ Corporation/Cg/lib.x64
$ENV{PROGRAMFILES}/Cg
$ENV{PFx86}/Cg
${PROJECT_SOURCE_DIR}/../Cg
${CG_COMPILER_SUPER_DIR}/lib.x64
${CG_COMPILER_DIR}
DOC "The Cg GL runtime library (64-bit)"
)
ELSE(NV_SYSTEM_PROCESSOR STREQUAL "x86_64")
FIND_LIBRARY( CG_LIBRARY
NAMES Cg
PATHS
$ENV{CG_LIB_PATH}
$ENV{PROGRAMFILES}/NVIDIA\ Corporation/Cg/lib
$ENV{PROGRAMFILES}/Cg
${PROJECT_SOURCE_DIR}/../Cg
${CG_COMPILER_SUPER_DIR}/lib
${CG_COMPILER_DIR}
DOC "The Cg runtime library"
)
FIND_LIBRARY( CG_GL_LIBRARY
NAMES CgGL
PATHS
$ENV{CG_LIB_PATH}
$ENV{PROGRAMFILES}/NVIDIA\ Corporation/Cg/lib
$ENV{PROGRAMFILES}/Cg
${PROJECT_SOURCE_DIR}/../Cg
${CG_COMPILER_SUPER_DIR}/lib
${CG_COMPILER_DIR}
DOC "The Cg GL runtime library"
)
ENDIF(NV_SYSTEM_PROCESSOR STREQUAL "x86_64")
ELSE (WIN32)
FIND_PROGRAM( CG_COMPILER cgc
/usr/bin
/usr/local/bin
DOC "The Cg Compiler"
)
GET_FILENAME_COMPONENT(CG_COMPILER_DIR "${CG_COMPILER}" PATH)
GET_FILENAME_COMPONENT(CG_COMPILER_SUPER_DIR "${CG_COMPILER_DIR}" PATH)
FIND_PATH( CG_INCLUDE_DIR Cg/cg.h
/usr/include
/usr/local/include
${CG_COMPILER_SUPER_DIR}/include
DOC "The directory where Cg/cg.h resides"
)
FIND_LIBRARY( CG_LIBRARY Cg
PATHS
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
${CG_COMPILER_SUPER_DIR}/lib64
${CG_COMPILER_SUPER_DIR}/lib
DOC "The Cg runtime library"
)
SET(CG_LIBRARY ${CG_LIBRARY} -lpthread)
FIND_LIBRARY( CG_GL_LIBRARY CgGL
PATHS
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
${CG_COMPILER_SUPER_DIR}/lib64
${CG_COMPILER_SUPER_DIR}/lib
DOC "The Cg runtime library"
)
ENDIF (WIN32)
ENDIF (APPLE)
IF (CG_INCLUDE_DIR)
SET( CG_FOUND 1 CACHE STRING "Set to 1 if CG is found, 0 otherwise")
ELSE (CG_INCLUDE_DIR)
SET( CG_FOUND 0 CACHE STRING "Set to 1 if CG is found, 0 otherwise")
ENDIF (CG_INCLUDE_DIR)
MARK_AS_ADVANCED( CG_FOUND )

@ -1,38 +0,0 @@
IF (WIN32)
FIND_PATH(DX9_INCLUDE_PATH d3d9.h
PATHS
"$ENV{DXSDK_DIR}/Include"
"$ENV{PROGRAMFILES}/Microsoft DirectX SDK/Include"
DOC "The directory where D3D9.h resides")
FIND_PATH(DX10_INCLUDE_PATH D3D10.h
PATHS
"$ENV{DXSDK_DIR}/Include"
"$ENV{PROGRAMFILES}/Microsoft DirectX SDK/Include"
DOC "The directory where D3D10.h resides")
FIND_LIBRARY(D3D10_LIBRARY d3d10.lib
PATHS
"$ENV{DXSDK_DIR}/Lib/x86"
"$ENV{PROGRAMFILES}/Microsoft DirectX SDK/Lib/x86"
DOC "The directory where d3d10.lib resides")
FIND_LIBRARY(D3DX10_LIBRARY d3dx10.lib
PATHS
"$ENV{DXSDK_DIR}/Lib/x86"
"$ENV{PROGRAMFILES}/Microsoft DirectX SDK/Lib/x86"
DOC "The directory where d3dx10.lib resides")
SET(DX10_LIBRARIES ${D3D10_LIBRARY} ${D3DX10_LIBRARY})
ENDIF (WIN32)
IF (DX10_INCLUDE_PATH)
SET( DX10_FOUND 1 CACHE STRING "Set to 1 if CG is found, 0 otherwise")
ELSE (DX10_INCLUDE_PATH)
SET( DX10_FOUND 0 CACHE STRING "Set to 1 if CG is found, 0 otherwise")
ENDIF (DX10_INCLUDE_PATH)
MARK_AS_ADVANCED( DX10_FOUND )

@ -1,53 +0,0 @@
#
# Try to find the FreeImage library and include path.
# Once done this will define
#
# FREEIMAGE_FOUND
# FREEIMAGE_INCLUDE_PATH
# FREEIMAGE_LIBRARY
#
IF (WIN32)
FIND_PATH( FREEIMAGE_INCLUDE_PATH FreeImage.h
${FREEIMAGE_ROOT_DIR}/include
${FREEIMAGE_ROOT_DIR}
DOC "The directory where FreeImage.h resides")
FIND_LIBRARY( FREEIMAGE_LIBRARY
NAMES FreeImage freeimage
PATHS
${FREEIMAGE_ROOT_DIR}/lib
${FREEIMAGE_ROOT_DIR}
DOC "The FreeImage library")
ELSE (WIN32)
FIND_PATH( FREEIMAGE_INCLUDE_PATH FreeImage.h
/usr/include
/usr/local/include
/sw/include
/opt/local/include
DOC "The directory where FreeImage.h resides")
FIND_LIBRARY( FREEIMAGE_LIBRARY
NAMES FreeImage freeimage
PATHS
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
/sw/lib
/opt/local/lib
DOC "The FreeImage library")
ENDIF (WIN32)
SET(FREEIMAGE_LIBRARIES ${FREEIMAGE_LIBRARY})
IF (FREEIMAGE_INCLUDE_PATH AND FREEIMAGE_LIBRARY)
SET( FREEIMAGE_FOUND TRUE CACHE BOOL "Set to TRUE if FreeImage is found, FALSE otherwise")
ELSE (FREEIMAGE_INCLUDE_PATH AND FREEIMAGE_LIBRARY)
SET( FREEIMAGE_FOUND FALSE CACHE BOOL "Set to TRUE if FreeImage is found, FALSE otherwise")
ENDIF (FREEIMAGE_INCLUDE_PATH AND FREEIMAGE_LIBRARY)
MARK_AS_ADVANCED(
FREEIMAGE_FOUND
FREEIMAGE_LIBRARY
FREEIMAGE_LIBRARIES
FREEIMAGE_INCLUDE_PATH)

@ -1,50 +0,0 @@
#
# Try to find GLEW library and include path.
# Once done this will define
#
# GLEW_FOUND
# GLEW_INCLUDE_PATH
# GLEW_LIBRARY
#
IF (WIN32)
FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h
$ENV{PROGRAMFILES}/GLEW/include
${GLEW_ROOT_DIR}/include
DOC "The directory where GL/glew.h resides")
FIND_LIBRARY( GLEW_LIBRARY
NAMES glew GLEW glew32 glew32s
PATHS
$ENV{PROGRAMFILES}/GLEW/lib
${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin
${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib
DOC "The GLEW library")
ELSE (WIN32)
FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h
/usr/include
/usr/local/include
/sw/include
/opt/local/include
${GLEW_ROOT_DIR}/include
DOC "The directory where GL/glew.h resides")
# Prefer the static library.
FIND_LIBRARY( GLEW_LIBRARY
NAMES libGLEW.a GLEW
PATHS
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
/sw/lib
/opt/local/lib
${GLEW_ROOT_DIR}/lib
DOC "The GLEW library")
ENDIF (WIN32)
SET(GLEW_FOUND "NO")
IF (GLEW_INCLUDE_PATH AND GLEW_LIBRARY)
SET(GLEW_LIBRARIES ${GLEW_LIBRARY})
SET(GLEW_FOUND "YES")
ENDIF (GLEW_INCLUDE_PATH AND GLEW_LIBRARY)

@ -1,67 +0,0 @@
IF (WIN32)
# Maya plugins can only be compiled with msvc
IF (MSVC)
FIND_PATH(MAYA_INCLUDE_PATH maya/MTypes.h
PATHS
"$ENV{PROGRAMFILES}/Autodesk/Maya8.5/include"
"$ENV{MAYA_LOCATION}/include"
DOC "The directory where MTypes.h resides")
# Find maya version!
FIND_LIBRARY(MAYA_FOUNDATION_LIBRARY Foundation
PATHS
"$ENV{PROGRAMFILES}/Autodesk/Maya8.5/lib"
"$ENV{MAYA_LOCATION}/lib"
DOC "The directory where Foundation.lib resides")
FIND_LIBRARY(MAYA_OPENMAYA_LIBRARY OpenMaya
PATHS
"$ENV{PROGRAMFILES}/Autodesk/Maya8.5/lib"
"$ENV{MAYA_LOCATION}/lib"
DOC "The directory where OpenMaya.lib resides")
FIND_LIBRARY(MAYA_OPENMAYAANIM_LIBRARY OpenMayaAnim
PATHS
"$ENV{PROGRAMFILES}/Autodesk/Maya8.5/lib"
"$ENV{MAYA_LOCATION}/lib"
DOC "The directory where OpenMayaAnim.lib resides")
SET(MAYA_LIBRARIES
${MAYA_FOUNDATION_LIBRARY}
${MAYA_OPENMAYA_LIBRARY}
${MAYA_OPENMAYAANIM_LIBRARY})
SET(MAYA_EXTENSION ".mll")
ENDIF (MSVC)
ELSE (WIN32)
# On linux, check gcc version.
# OSX and Linux
FIND_PATH(MAYA_INCLUDE_PATH maya/MTypes.h
PATHS
/usr/autodesk/maya/include
$ENV{MAYA_LOCATION}/include
DOC "The directory where MTypes.h resides")
# TODO
ENDIF (WIN32)
IF (MAYA_INCLUDE_PATH)
SET( MAYA_FOUND 1 CACHE STRING "Set to 1 if Maya is found, 0 otherwise")
ELSE (MAYA_INCLUDE_PATH)
SET( MAYA_FOUND 0 CACHE STRING "Set to 1 if Maya is found, 0 otherwise")
ENDIF (MAYA_INCLUDE_PATH)
MARK_AS_ADVANCED( MAYA_FOUND )

@ -1,75 +0,0 @@
#
# Try to find OpenEXR's libraries, and include path.
# Once done this will define:
#
# OPENEXR_FOUND = OpenEXR found.
# OPENEXR_INCLUDE_PATHS = OpenEXR include directories.
# OPENEXR_LIBRARIES = libraries that are needed to use OpenEXR.
#
INCLUDE(FindZLIB)
IF(ZLIB_FOUND)
SET(LIBRARY_PATHS
/usr/lib
/usr/local/lib
/sw/lib
/opt/local/lib
$ENV{PROGRAM_FILES}/OpenEXR/lib/static)
FIND_PATH(OPENEXR_INCLUDE_PATH ImfRgbaFile.h
PATH_SUFFIXES OpenEXR
/usr/include
/usr/local/include
/sw/include
/opt/local/include)
FIND_LIBRARY(OPENEXR_HALF_LIBRARY
NAMES Half
PATHS ${LIBRARY_PATHS})
FIND_LIBRARY(OPENEXR_IEX_LIBRARY
NAMES Iex
PATHS ${LIBRARY_PATHS})
FIND_LIBRARY(OPENEXR_IMATH_LIBRARY
NAMES Imath
PATHS ${LIBRARY_PATHS})
FIND_LIBRARY(OPENEXR_ILMIMF_LIBRARY
NAMES IlmImf
PATHS ${LIBRARY_PATHS})
FIND_LIBRARY(OPENEXR_ILMTHREAD_LIBRARY
NAMES IlmThread
PATHS ${LIBRARY_PATHS})
ENDIF(ZLIB_FOUND)
#MESSAGE(STATUS ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_ILMIMF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} ${OPENEXR_ILMTHREAD_LIBRARY} ${ZLIB_LIBRARY})
IF (OPENEXR_INCLUDE_PATH AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY)
SET(OPENEXR_FOUND TRUE)
SET(OPENEXR_INCLUDE_PATHS ${OPENEXR_INCLUDE_PATH} CACHE STRING "The include paths needed to use OpenEXR")
SET(OPENEXR_LIBRARIES ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_ILMIMF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} ${OPENEXR_ILMTHREAD_LIBRARY} ${ZLIB_LIBRARY} CACHE STRING "The libraries needed to use OpenEXR")
ENDIF (OPENEXR_INCLUDE_PATH AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY)
IF(OPENEXR_FOUND)
IF(NOT OPENEXR_FIND_QUIETLY)
MESSAGE(STATUS "Found OpenEXR: ${OPENEXR_ILMIMF_LIBRARY}")
ENDIF(NOT OPENEXR_FIND_QUIETLY)
ELSE(OPENEXR_FOUND)
IF(OPENEXR_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find OpenEXR library")
ENDIF(OPENEXR_FIND_REQUIRED)
ENDIF(OPENEXR_FOUND)
MARK_AS_ADVANCED(
OPENEXR_INCLUDE_PATHS
OPENEXR_LIBRARIES
OPENEXR_ILMIMF_LIBRARY
OPENEXR_IMATH_LIBRARY
OPENEXR_IEX_LIBRARY
OPENEXR_HALF_LIBRARY)

@ -1,56 +1,11 @@
INCLUDE(${NV_CMAKE_DIR}/DetermineProcessor.cmake)
# Set optimal options for gcc:
IF(CMAKE_COMPILER_IS_GNUCXX)
IF(NV_SYSTEM_PROCESSOR STREQUAL "i586")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=i586")
ENDIF(NV_SYSTEM_PROCESSOR STREQUAL "i586")
IF(NV_SYSTEM_PROCESSOR STREQUAL "i686")
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=i686")
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpmath=sse -mtune=i686 -msse3")
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=pentium4")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=prescott")
ENDIF(NV_SYSTEM_PROCESSOR STREQUAL "i686")
IF(NV_SYSTEM_PROCESSOR STREQUAL "x86_64")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=athlon64")
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=athlon64 -msse3")
ENDIF(NV_SYSTEM_PROCESSOR STREQUAL "x86_64")
IF(NV_SYSTEM_PROCESSOR STREQUAL "powerpc")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=powerpc -faltivec -maltivec -mabi=altivec -mpowerpc-gfxopt")
# ibook G4:
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=7450 -mtune=7450 -faltivec -maltivec -mabi=altivec -mpowerpc-gfxopt")
# G5
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=G5 -faltivec -maltivec -mabi=altivec -mpowerpc-gfxopt")
ENDIF(NV_SYSTEM_PROCESSOR STREQUAL "powerpc")
# IF(DARWIN)
# SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk")
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk")
# ENDIF(DARWIN)
IF(APPLE)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch i586 -arch x86_64 -msse3 -mmacosx-version-min=10.5")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch i586 -arch x86_64 -msse3 -mmacosx-version-min=10.5")
ENDIF(APPLE)
IF(CMAKE_BUILD_TYPE STREQUAL "debug")
ADD_DEFINITIONS(-D_DEBUG)
ENDIF(CMAKE_BUILD_TYPE STREQUAL "debug")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
ENDIF()
IF(MSVC)
# @@ Some of these might only be available in VC8.
# Code generation flags.
# SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:SSE2 /fp:fast")
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2 /fp:fast")

@ -1,4 +1,4 @@
Update version number in nvtt/nvtt.h
Update version number in nvimage/DirectDrawSurface.cpp
Update version number in CMakeLists.txt
Update version number in VERSION
Update version number in NVIDIA_Texture_Tools_README.txt

@ -5,8 +5,6 @@ ADD_SUBDIRECTORY(EtcLib)
ADD_SUBDIRECTORY(rg_etc1_v104)
#ADD_SUBDIRECTORY(etcpack)
#ADD_SUBDIRECTORY(butteraugli)
ADD_SUBDIRECTORY(libsquish-1.15)
ADD_SUBDIRECTORY(CMP_Core)

Binary file not shown.

@ -1,175 +0,0 @@
//////////////////////////////////////////////////////////////////////////////
//
// Advanced Micro Devices, Inc.
// 1 AMD Place
// Sunnyvale, CA
// USA 94088
//
// File Name: ATI_Compress.h
// Description: A library to compress/decompress textures
//
// Copyright (c) 2007,2008 Advanced Micro Devices, Inc.
// Copyright (c) 2004-2006 ATI Technologies Inc.
//
// Version: 1.7
//
// Developer: Seth Sowerby
// Email: gputools.support@amd.com
//
//////////////////////////////////////////////////////////////////////////////
/// \file
/// ATI_Compress.h declares the interface to the ATI_Compress library.
#ifndef ATI_COMPRESS
#define ATI_COMPRESS
#define ATI_COMPRESS_VERSION_MAJOR 1 ///< The major version number of this release.
#define ATI_COMPRESS_VERSION_MINOR 7 ///< The minor version number of this release.
typedef unsigned long ATI_TC_DWORD; ///< A 32-bit integer format.
typedef unsigned short ATI_TC_WORD; ///< A 16-bit integer format.
typedef unsigned char ATI_TC_BYTE; ///< An 8-bit integer format.
#if defined(WIN32) || defined(_WIN64)
# define ATI_TC_API __cdecl
#else
# define ATI_TC_API
#endif
#ifdef ATI_COMPRESS_INTERNAL_BUILD
# include "ATI_Compress_Internal.h"
#else // ATI_COMPRESS_INTERNAL_BUILD
/// Texture format.
typedef enum
{
ATI_TC_FORMAT_Unknown, ///< An undefined texture format.
ATI_TC_FORMAT_ARGB_8888, ///< An ARGB format with 8-bit fixed channels.
ATI_TC_FORMAT_RGB_888, ///< A RGB format with 8-bit fixed channels.
ATI_TC_FORMAT_RG_8, ///< A two component format with 8-bit fixed channels.
ATI_TC_FORMAT_R_8, ///< A single component format with 8-bit fixed channels.
ATI_TC_FORMAT_ARGB_2101010, ///< An ARGB format with 10-bit fixed channels for color & a 2-bit fixed channel for alpha.
ATI_TC_FORMAT_ARGB_16, ///< A ARGB format with 16-bit fixed channels.
ATI_TC_FORMAT_RG_16, ///< A two component format with 16-bit fixed channels.
ATI_TC_FORMAT_R_16, ///< A single component format with 16-bit fixed channels.
ATI_TC_FORMAT_ARGB_16F, ///< An ARGB format with 16-bit floating-point channels.
ATI_TC_FORMAT_RG_16F, ///< A two component format with 16-bit floating-point channels.
ATI_TC_FORMAT_R_16F, ///< A single component with 16-bit floating-point channels.
ATI_TC_FORMAT_ARGB_32F, ///< An ARGB format with 32-bit floating-point channels.
ATI_TC_FORMAT_RG_32F, ///< A two component format with 32-bit floating-point channels.
ATI_TC_FORMAT_R_32F, ///< A single component with 32-bit floating-point channels.
ATI_TC_FORMAT_DXT1, ///< An opaque (or 1-bit alpha) DXTC compressed texture format. Four bits per pixel.
ATI_TC_FORMAT_DXT3, ///< A DXTC compressed texture format with explicit alpha. Eight bits per pixel.
ATI_TC_FORMAT_DXT5, ///< A DXTC compressed texture format with interpolated alpha. Eight bits per pixel.
ATI_TC_FORMAT_DXT5_xGBR, ///< A DXT5 with the red component swizzled into the alpha channel. Eight bits per pixel.
ATI_TC_FORMAT_DXT5_RxBG, ///< A swizzled DXT5 format with the green component swizzled into the alpha channel. Eight bits per pixel.
ATI_TC_FORMAT_DXT5_RBxG, ///< A swizzled DXT5 format with the green component swizzled into the alpha channel & the blue component swizzled into the green channel. Eight bits per pixel.
ATI_TC_FORMAT_DXT5_xRBG, ///< A swizzled DXT5 format with the green component swizzled into the alpha channel & the red component swizzled into the green channel. Eight bits per pixel.
ATI_TC_FORMAT_DXT5_RGxB, ///< A swizzled DXT5 format with the blue component swizzled into the alpha channel. Eight bits per pixel.
ATI_TC_FORMAT_DXT5_xGxR, ///< A two-component swizzled DXT5 format with the red component swizzled into the alpha channel & the green component in the green channel. Eight bits per pixel.
ATI_TC_FORMAT_ATI1N, ///< A single component compression format using the same technique as DXT5 alpha. Four bits per pixel.
ATI_TC_FORMAT_ATI2N, ///< A two component compression format using the same technique as DXT5 alpha. Designed for compression object space normal maps. Eight bits per pixel.
ATI_TC_FORMAT_ATI2N_XY, ///< A two component compression format using the same technique as DXT5 alpha. The same as ATI2N but with the channels swizzled. Eight bits per pixel.
ATI_TC_FORMAT_ATI2N_DXT5, ///< An ATI2N like format using DXT5. Intended for use on GPUs that do not natively support ATI2N. Eight bits per pixel.
ATI_TC_FORMAT_BC1, ///< A four component opaque (or 1-bit alpha) compressed texture format for Microsoft DirectX10. Identical to DXT1. Four bits per pixel.
ATI_TC_FORMAT_BC2, ///< A four component compressed texture format with explicit alpha for Microsoft DirectX10. Identical to DXT3. Eight bits per pixel.
ATI_TC_FORMAT_BC3, ///< A four component compressed texture format with interpolated alpha for Microsoft DirectX10. Identical to DXT5. Eight bits per pixel.
ATI_TC_FORMAT_BC4, ///< A single component compressed texture format for Microsoft DirectX10. Identical to ATI1N. Four bits per pixel.
ATI_TC_FORMAT_BC5, ///< A two component compressed texture format for Microsoft DirectX10. Identical to ATI2N. Eight bits per pixel.
ATI_TC_FORMAT_ATC_RGB, ///< ATI_TC - a compressed RGB format for cellphones & hand-held devices.
ATI_TC_FORMAT_ATC_RGBA_Explicit, ///< ATI_TC - a compressed ARGB format with explicit alpha for cellphones & hand-held devices.
ATI_TC_FORMAT_ATC_RGBA_Interpolated, ///< ATI_TC - a compressed ARGB format with interpolated alpha for cellphones & hand-held devices.
ATI_TC_FORMAT_ETC_RGB, ///< ETC (aka Ericsson Texture Compression) - a compressed RGB format for cellphones.
ATI_TC_FORMAT_MAX = ATI_TC_FORMAT_ETC_RGB
} ATI_TC_FORMAT;
/// An enum selecting the speed vs. quality trade-off.
typedef enum
{
ATI_TC_Speed_Normal, ///< Highest quality mode
ATI_TC_Speed_Fast, ///< Slightly lower quality but much faster compression mode - DXTn & ATInN only
ATI_TC_Speed_SuperFast, ///< Slightly lower quality but much, much faster compression mode - DXTn & ATInN only
} ATI_TC_Speed;
/// ATI_Compress error codes
typedef enum
{
ATI_TC_OK = 0, ///< Ok.
ATI_TC_ABORTED, ///< The conversion was aborted.
ATI_TC_ERR_INVALID_SOURCE_TEXTURE, ///< The source texture is invalid.
ATI_TC_ERR_INVALID_DEST_TEXTURE, ///< The destination texture is invalid.
ATI_TC_ERR_UNSUPPORTED_SOURCE_FORMAT, ///< The source format is not a supported format.
ATI_TC_ERR_UNSUPPORTED_DEST_FORMAT, ///< The destination format is not a supported format.
ATI_TC_ERR_SIZE_MISMATCH, ///< The source and destination texture sizes do not match.
ATI_TC_ERR_UNABLE_TO_INIT_CODEC, ///< ATI_Compress was unable to initialize the codec needed for conversion.
ATI_TC_ERR_GENERIC ///< An unknown error occurred.
} ATI_TC_ERROR;
/// Options for the compression.
/// Passing this structure is optional
typedef struct
{
ATI_TC_DWORD dwSize; ///< The size of this structure.
BOOL bUseChannelWeighting; ///< Use channel weightings. With swizzled formats the weighting applies to the data within the specified channel not the channel itself.
double fWeightingRed; ///< The weighting of the Red or X Channel.
double fWeightingGreen; ///< The weighting of the Green or Y Channel.
double fWeightingBlue; ///< The weighting of the Blue or Z Channel.
BOOL bUseAdaptiveWeighting; ///< Adapt weighting on a per-block basis.
BOOL bDXT1UseAlpha; ///< Encode single-bit alpha data. Only valid when compressing to DXT1 & BC1.
ATI_TC_BYTE nAlphaThreshold; ///< The alpha threshold to use when compressing to DXT1 & BC1 with bDXT1UseAlpha. Texels with an alpha value less than the threshold are treated as transparent.
BOOL bDisableMultiThreading; ///< Disable multi-threading of the compression. This will slow the compression but can be useful if you're managing threads in your application.
ATI_TC_Speed nCompressionSpeed; ///< The trade-off between compression speed & quality.
} ATI_TC_CompressOptions;
#endif // !ATI_COMPRESS_INTERNAL_BUILD
/// The structure describing a texture.
typedef struct
{
ATI_TC_DWORD dwSize; ///< Size of this structure.
ATI_TC_DWORD dwWidth; ///< Width of the texture.
ATI_TC_DWORD dwHeight; ///< Height of the texture.
ATI_TC_DWORD dwPitch; ///< Distance to start of next line - necessary only for uncompressed textures.
ATI_TC_FORMAT format; ///< Format of the texture.
ATI_TC_DWORD dwDataSize; ///< Size of the allocated texture data.
ATI_TC_BYTE* pData; ///< Pointer to the texture data
} ATI_TC_Texture;
#define MINIMUM_WEIGHT_VALUE 0.01f
#ifdef __cplusplus
extern "C" {
#endif
/// ATI_TC_Feedback_Proc
/// Feedback function for conversion.
/// \param[in] fProgress The percentage progress of the texture compression.
/// \param[in] pUser1 User data as passed to ATI_TC_ConvertTexture.
/// \param[in] pUser2 User data as passed to ATI_TC_ConvertTexture.
/// \return non-NULL(true) value to abort conversion
typedef bool (ATI_TC_API * ATI_TC_Feedback_Proc)(float fProgress, DWORD_PTR pUser1, DWORD_PTR pUser2);
/// Calculates the required buffer size for the specified texture
/// \param[in] pTexture A pointer to the texture.
/// \return The size of the buffer required to hold the texture data.
ATI_TC_DWORD ATI_TC_API ATI_TC_CalculateBufferSize(const ATI_TC_Texture* pTexture);
/// Converts the source texture to the destination texture
/// This can be compression, decompression or converting between two uncompressed formats.
/// \param[in] pSourceTexture A pointer to the source texture.
/// \param[in] pDestTexture A pointer to the destination texture.
/// \param[in] pOptions A pointer to the compression options - can be NULL.
/// \param[in] pFeedbackProc A pointer to the feedback function - can be NULL.
/// \param[in] pUser1 User data to pass to the feedback function.
/// \param[in] pUser2 User data to pass to the feedback function.
/// \return ATI_TC_OK if successful, otherwise the error code.
ATI_TC_ERROR ATI_TC_API ATI_TC_ConvertTexture(const ATI_TC_Texture* pSourceTexture, ATI_TC_Texture* pDestTexture,
const ATI_TC_CompressOptions* pOptions,
ATI_TC_Feedback_Proc pFeedbackProc, DWORD_PTR pUser1, DWORD_PTR pUser2);
#ifdef __cplusplus
};
#endif
#endif // !ATI_COMPRESS

@ -1,7 +0,0 @@
SET(BUTTERAUGLI_SRCS
butteraugli.cc
butteraugli.h)
ADD_LIBRARY(butteraugli STATIC ${BUTTERAUGLI_SRCS})

File diff suppressed because it is too large Load Diff

@ -1,560 +0,0 @@
// Copyright 2016 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Disclaimer: This is not an official Google product.
//
// Author: Jyrki Alakuijala (jyrki.alakuijala@gmail.com)
#ifndef BUTTERAUGLI_BUTTERAUGLI_H_
#define BUTTERAUGLI_BUTTERAUGLI_H_
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <memory>
#include <vector>
#ifndef PROFILER_ENABLED
#define PROFILER_ENABLED 0
#endif
#if PROFILER_ENABLED
#else
#define PROFILER_FUNC
#define PROFILER_ZONE(name)
#endif
#define BUTTERAUGLI_ENABLE_CHECKS 0
// This is the main interface to butteraugli image similarity
// analysis function.
namespace butteraugli {
template<typename T>
class Image;
using Image8 = Image<uint8_t>;
using ImageF = Image<float>;
using ImageD = Image<double>;
// ButteraugliInterface defines the public interface for butteraugli.
//
// It calculates the difference between rgb0 and rgb1.
//
// rgb0 and rgb1 contain the images. rgb0[c][px] and rgb1[c][px] contains
// the red image for c == 0, green for c == 1, blue for c == 2. Location index
// px is calculated as y * xsize + x.
//
// Value of pixels of images rgb0 and rgb1 need to be represented as raw
// intensity. Most image formats store gamma corrected intensity in pixel
// values. This gamma correction has to be removed, by applying the following
// function:
// butteraugli_val = 255.0 * pow(png_val / 255.0, gamma);
// A typical value of gamma is 2.2. It is usually stored in the image header.
// Take care not to confuse that value with its inverse. The gamma value should
// be always greater than one.
// Butteraugli does not work as intended if the caller does not perform
// gamma correction.
//
// diffmap will contain an image of the size xsize * ysize, containing
// localized differences for values px (indexed with the px the same as rgb0
// and rgb1). diffvalue will give a global score of similarity.
//
// A diffvalue smaller than kButteraugliGood indicates that images can be
// observed as the same image.
// diffvalue larger than kButteraugliBad indicates that a difference between
// the images can be observed.
// A diffvalue between kButteraugliGood and kButteraugliBad indicates that
// a subtle difference can be observed between the images.
//
// Returns true on success.
bool ButteraugliInterface(const std::vector<ImageF> &rgb0,
const std::vector<ImageF> &rgb1,
ImageF &diffmap,
double &diffvalue);
const double kButteraugliQuantLow = 0.26;
const double kButteraugliQuantHigh = 1.454;
// Converts the butteraugli score into fuzzy class values that are continuous
// at the class boundary. The class boundary location is based on human
// raters, but the slope is arbitrary. Particularly, it does not reflect
// the expectation value of probabilities of the human raters. It is just
// expected that a smoother class boundary will allow for higher-level
// optimization algorithms to work faster.
//
// Returns 2.0 for a perfect match, and 1.0 for 'ok', 0.0 for bad. Because the
// scoring is fuzzy, a butteraugli score of 0.96 would return a class of
// around 1.9.
double ButteraugliFuzzyClass(double score);
// Input values should be in range 0 (bad) to 2 (good). Use
// kButteraugliNormalization as normalization.
double ButteraugliFuzzyInverse(double seek);
// Returns a map which can be used for adaptive quantization. Values can
// typically range from kButteraugliQuantLow to kButteraugliQuantHigh. Low
// values require coarse quantization (e.g. near random noise), high values
// require fine quantization (e.g. in smooth bright areas).
bool ButteraugliAdaptiveQuantization(size_t xsize, size_t ysize,
const std::vector<std::vector<float> > &rgb, std::vector<float> &quant);
// Implementation details, don't use anything below or your code will
// break in the future.
#ifdef _MSC_VER
#define BUTTERAUGLI_RESTRICT __restrict
#else
#define BUTTERAUGLI_RESTRICT __restrict__
#endif
#ifdef _MSC_VER
#define BUTTERAUGLI_CACHE_ALIGNED_RETURN /* not supported */
#else
#define BUTTERAUGLI_CACHE_ALIGNED_RETURN __attribute__((assume_aligned(64)))
#endif
// Alias for unchangeable, non-aliased pointers. T is a pointer type,
// possibly to a const type. Example: ConstRestrict<uint8_t*> ptr = nullptr.
// The conventional syntax uint8_t* const RESTRICT is more confusing - it is
// not immediately obvious that the pointee is non-const.
template <typename T>
using ConstRestrict = T const BUTTERAUGLI_RESTRICT;
// Functions that depend on the cache line size.
class CacheAligned {
public:
static constexpr size_t kPointerSize = sizeof(void *);
static constexpr size_t kCacheLineSize = 64;
// The aligned-return annotation is only allowed on function declarations.
static void *Allocate(const size_t bytes) BUTTERAUGLI_CACHE_ALIGNED_RETURN;
static void Free(void *aligned_pointer);
};
template <typename T>
using CacheAlignedUniquePtrT = std::unique_ptr<T[], void (*)(void *)>;
using CacheAlignedUniquePtr = CacheAlignedUniquePtrT<uint8_t>;
template <typename T = uint8_t>
static inline CacheAlignedUniquePtrT<T> Allocate(const size_t entries) {
return CacheAlignedUniquePtrT<T>(
static_cast<ConstRestrict<T *>>(
CacheAligned::Allocate(entries * sizeof(T))),
CacheAligned::Free);
}
// Returns the smallest integer not less than "amount" that is divisible by
// "multiple", which must be a power of two.
template <size_t multiple>
static inline size_t Align(const size_t amount) {
static_assert(multiple != 0 && ((multiple & (multiple - 1)) == 0),
"Align<> argument must be a power of two");
return (amount + multiple - 1) & ~(multiple - 1);
}
// Single channel, contiguous (cache-aligned) rows separated by padding.
// T must be POD.
//
// Rationale: vectorization benefits from aligned operands - unaligned loads and
// especially stores are expensive when the address crosses cache line
// boundaries. Introducing padding after each row ensures the start of a row is
// aligned, and that row loops can process entire vectors (writes to the padding
// are allowed and ignored).
//
// We prefer a planar representation, where channels are stored as separate
// 2D arrays, because that simplifies vectorization (repeating the same
// operation on multiple adjacent components) without the complexity of a
// hybrid layout (8 R, 8 G, 8 B, ...). In particular, clients can easily iterate
// over all components in a row and Image requires no knowledge of the pixel
// format beyond the component type "T". The downside is that we duplicate the
// xsize/ysize members for each channel.
//
// This image layout could also be achieved with a vector and a row accessor
// function, but a class wrapper with support for "deleter" allows wrapping
// existing memory allocated by clients without copying the pixels. It also
// provides convenient accessors for xsize/ysize, which shortens function
// argument lists. Supports move-construction so it can be stored in containers.
template <typename ComponentType>
class Image {
// Returns cache-aligned row stride, being careful to avoid 2K aliasing.
static size_t BytesPerRow(const size_t xsize) {
// Allow reading one extra AVX-2 vector on the right margin.
const size_t row_size = xsize * sizeof(T) + 32;
const size_t align = CacheAligned::kCacheLineSize;
size_t bytes_per_row = (row_size + align - 1) & ~(align - 1);
// During the lengthy window before writes are committed to memory, CPUs
// guard against read after write hazards by checking the address, but
// only the lower 11 bits. We avoid a false dependency between writes to
// consecutive rows by ensuring their sizes are not multiples of 2 KiB.
if (bytes_per_row % 2048 == 0) {
bytes_per_row += align;
}
return bytes_per_row;
}
public:
using T = ComponentType;
Image() : xsize_(0), ysize_(0), bytes_per_row_(0), bytes_(nullptr, Ignore) {}
Image(const size_t xsize, const size_t ysize)
: xsize_(xsize),
ysize_(ysize),
bytes_per_row_(BytesPerRow(xsize)),
bytes_(Allocate(bytes_per_row_ * ysize)) {}
Image(const size_t xsize, const size_t ysize, ConstRestrict<uint8_t *> bytes,
const size_t bytes_per_row)
: xsize_(xsize),
ysize_(ysize),
bytes_per_row_(bytes_per_row),
bytes_(bytes, Ignore) {}
// Move constructor (required for returning Image from function)
Image(Image &&other)
: xsize_(other.xsize_),
ysize_(other.ysize_),
bytes_per_row_(other.bytes_per_row_),
bytes_(std::move(other.bytes_)) {}
// Move assignment (required for std::vector)
Image &operator=(Image &&other) {
xsize_ = other.xsize_;
ysize_ = other.ysize_;
bytes_per_row_ = other.bytes_per_row_;
bytes_ = std::move(other.bytes_);
return *this;
}
void Swap(Image &other) {
std::swap(xsize_, other.xsize_);
std::swap(ysize_, other.ysize_);
std::swap(bytes_per_row_, other.bytes_per_row_);
std::swap(bytes_, other.bytes_);
}
// How many pixels.
size_t xsize() const { return xsize_; }
size_t ysize() const { return ysize_; }
ConstRestrict<T *> Row(const size_t y) BUTTERAUGLI_CACHE_ALIGNED_RETURN {
#ifdef BUTTERAUGLI_ENABLE_CHECKS
if (y >= ysize_) {
printf("Row %zu out of bounds (ysize=%zu)\n", y, ysize_);
abort();
}
#endif
return reinterpret_cast<T *>(bytes_.get() + y * bytes_per_row_);
}
ConstRestrict<const T *> Row(const size_t y) const
BUTTERAUGLI_CACHE_ALIGNED_RETURN {
#ifdef BUTTERAUGLI_ENABLE_CHECKS
if (y >= ysize_) {
printf("Const row %zu out of bounds (ysize=%zu)\n", y, ysize_);
abort();
}
#endif
return reinterpret_cast<const T *>(bytes_.get() + y * bytes_per_row_);
}
// Raw access to byte contents, for interfacing with other libraries.
// Unsigned char instead of char to avoid surprises (sign extension).
ConstRestrict<uint8_t *> bytes() { return bytes_.get(); }
ConstRestrict<const uint8_t *> bytes() const { return bytes_.get(); }
size_t bytes_per_row() const { return bytes_per_row_; }
// Returns number of pixels (some of which are padding) per row. Useful for
// computing other rows via pointer arithmetic.
intptr_t PixelsPerRow() const {
static_assert(CacheAligned::kCacheLineSize % sizeof(T) == 0,
"Padding must be divisible by the pixel size.");
return static_cast<intptr_t>(bytes_per_row_ / sizeof(T));
}
private:
// Deleter used when bytes are not owned.
static void Ignore(void *ptr) {}
// (Members are non-const to enable assignment during move-assignment.)
size_t xsize_; // original intended pixels, not including any padding.
size_t ysize_;
size_t bytes_per_row_; // [bytes] including padding.
CacheAlignedUniquePtr bytes_;
};
// Returns newly allocated planes of the given dimensions.
template <typename T>
static inline std::vector<Image<T>> CreatePlanes(const size_t xsize,
const size_t ysize,
const size_t num_planes) {
std::vector<Image<T>> planes;
planes.reserve(num_planes);
for (size_t i = 0; i < num_planes; ++i) {
planes.emplace_back(xsize, ysize);
}
return planes;
}
// Returns a new image with the same dimensions and pixel values.
template <typename T>
static inline Image<T> CopyPixels(const Image<T> &other) {
Image<T> copy(other.xsize(), other.ysize());
const void *BUTTERAUGLI_RESTRICT from = other.bytes();
void *BUTTERAUGLI_RESTRICT to = copy.bytes();
memcpy(to, from, other.ysize() * other.bytes_per_row());
return copy;
}
// Returns new planes with the same dimensions and pixel values.
template <typename T>
static inline std::vector<Image<T>> CopyPlanes(
const std::vector<Image<T>> &planes) {
std::vector<Image<T>> copy;
copy.reserve(planes.size());
for (const Image<T> &plane : planes) {
copy.push_back(CopyPixels(plane));
}
return copy;
}
// Compacts a padded image into a preallocated packed vector.
template <typename T>
static inline void CopyToPacked(const Image<T> &from, std::vector<T> *to) {
const size_t xsize = from.xsize();
const size_t ysize = from.ysize();
#if BUTTERAUGLI_ENABLE_CHECKS
if (to->size() < xsize * ysize) {
printf("%zu x %zu exceeds %zu capacity\n", xsize, ysize, to->size());
abort();
}
#endif
for (size_t y = 0; y < ysize; ++y) {
ConstRestrict<const float*> row_from = from.Row(y);
ConstRestrict<float*> row_to = to->data() + y * xsize;
memcpy(row_to, row_from, xsize * sizeof(T));
}
}
// Expands a packed vector into a preallocated padded image.
template <typename T>
static inline void CopyFromPacked(const std::vector<T> &from, Image<T> *to) {
const size_t xsize = to->xsize();
const size_t ysize = to->ysize();
assert(from.size() == xsize * ysize);
for (size_t y = 0; y < ysize; ++y) {
ConstRestrict<const float*> row_from = from.data() + y * xsize;
ConstRestrict<float*> row_to = to->Row(y);
memcpy(row_to, row_from, xsize * sizeof(T));
}
}
template <typename T>
static inline std::vector<Image<T>> PlanesFromPacked(
const size_t xsize, const size_t ysize,
const std::vector<std::vector<T>> &packed) {
std::vector<Image<T>> planes;
planes.reserve(packed.size());
for (const std::vector<T> &p : packed) {
planes.push_back(Image<T>(xsize, ysize));
CopyFromPacked(p, &planes.back());
}
return planes;
}
template <typename T>
static inline std::vector<std::vector<T>> PackedFromPlanes(
const std::vector<Image<T>> &planes) {
assert(!planes.empty());
const size_t num_pixels = planes[0].xsize() * planes[0].ysize();
std::vector<std::vector<T>> packed;
packed.reserve(planes.size());
for (const Image<T> &image : planes) {
packed.push_back(std::vector<T>(num_pixels));
CopyToPacked(image, &packed.back());
}
return packed;
}
class ButteraugliComparator {
public:
ButteraugliComparator(size_t xsize, size_t ysize, int step);
// Computes the butteraugli map between rgb0 and rgb1 and updates result.
void Diffmap(const std::vector<ImageF> &rgb0,
const std::vector<ImageF> &rgb1,
ImageF &result);
// Same as above, but OpsinDynamicsImage() was already applied to
// rgb0 and rgb1.
void DiffmapOpsinDynamicsImage(const std::vector<ImageF> &rgb0,
const std::vector<ImageF> &rgb1,
ImageF &result);
private:
void BlockDiffMap(const std::vector<std::vector<float> > &rgb0,
const std::vector<std::vector<float> > &rgb1,
std::vector<float>* block_diff_dc,
std::vector<float>* block_diff_ac);
void EdgeDetectorMap(const std::vector<std::vector<float> > &rgb0,
const std::vector<std::vector<float> > &rgb1,
std::vector<float>* edge_detector_map);
void EdgeDetectorLowFreq(const std::vector<std::vector<float> > &rgb0,
const std::vector<std::vector<float> > &rgb1,
std::vector<float>* block_diff_ac);
void CombineChannels(const std::vector<std::vector<float> >& scale_xyb,
const std::vector<std::vector<float> >& scale_xyb_dc,
const std::vector<float>& block_diff_dc,
const std::vector<float>& block_diff_ac,
const std::vector<float>& edge_detector_map,
std::vector<float>* result);
const size_t xsize_;
const size_t ysize_;
const size_t num_pixels_;
const int step_;
const size_t res_xsize_;
const size_t res_ysize_;
};
void ButteraugliDiffmap(const std::vector<ImageF> &rgb0,
const std::vector<ImageF> &rgb1,
ImageF &diffmap);
double ButteraugliScoreFromDiffmap(const ImageF& distmap);
// Compute values of local frequency and dc masking based on the activity
// in the two images.
void Mask(const std::vector<std::vector<float> > &rgb0,
const std::vector<std::vector<float> > &rgb1,
size_t xsize, size_t ysize,
std::vector<std::vector<float> > *mask,
std::vector<std::vector<float> > *mask_dc);
// Computes difference metrics for one 8x8 block.
void ButteraugliBlockDiff(double rgb0[192],
double rgb1[192],
double diff_xyb_dc[3],
double diff_xyb_ac[3],
double diff_xyb_edge_dc[3]);
void OpsinAbsorbance(const double in[3], double out[3]);
void OpsinDynamicsImage(size_t xsize, size_t ysize,
std::vector<std::vector<float> > &rgb);
void MaskHighIntensityChange(
size_t xsize, size_t ysize,
const std::vector<std::vector<float> > &c0,
const std::vector<std::vector<float> > &c1,
std::vector<std::vector<float> > &rgb0,
std::vector<std::vector<float> > &rgb1);
void Blur(size_t xsize, size_t ysize, float* channel, double sigma,
double border_ratio = 0.0);
void RgbToXyb(double r, double g, double b,
double *valx, double *valy, double *valz);
double SimpleGamma(double v);
double GammaMinArg();
double GammaMaxArg();
// Polynomial evaluation via Clenshaw's scheme (similar to Horner's).
// Template enables compile-time unrolling of the recursion, but must reside
// outside of a class due to the specialization.
template <int INDEX>
static inline void ClenshawRecursion(const double x, const double *coefficients,
double *b1, double *b2) {
const double x_b1 = x * (*b1);
const double t = (x_b1 + x_b1) - (*b2) + coefficients[INDEX];
*b2 = *b1;
*b1 = t;
ClenshawRecursion<INDEX - 1>(x, coefficients, b1, b2);
}
// Base case
template <>
inline void ClenshawRecursion<0>(const double x, const double *coefficients,
double *b1, double *b2) {
const double x_b1 = x * (*b1);
// The final iteration differs - no 2 * x_b1 here.
*b1 = x_b1 - (*b2) + coefficients[0];
}
// Rational polynomial := dividing two polynomial evaluations. These are easier
// to find than minimax polynomials.
struct RationalPolynomial {
template <int N>
static double EvaluatePolynomial(const double x,
const double (&coefficients)[N]) {
double b1 = 0.0;
double b2 = 0.0;
ClenshawRecursion<N - 1>(x, coefficients, &b1, &b2);
return b1;
}
// Evaluates the polynomial at x (in [min_value, max_value]).
inline double operator()(const float x) const {
// First normalize to [0, 1].
const double x01 = (x - min_value) / (max_value - min_value);
// And then to [-1, 1] domain of Chebyshev polynomials.
const double xc = 2.0 * x01 - 1.0;
const double yp = EvaluatePolynomial(xc, p);
const double yq = EvaluatePolynomial(xc, q);
if (yq == 0.0) return 0.0;
return static_cast<float>(yp / yq);
}
// Domain of the polynomials; they are undefined elsewhere.
double min_value;
double max_value;
// Coefficients of T_n (Chebyshev polynomials of the first kind).
// Degree 5/5 is a compromise between accuracy (0.1%) and numerical stability.
double p[5 + 1];
double q[5 + 1];
};
static inline float GammaPolynomial(float value) {
// Generated by gamma_polynomial.m from equispaced x/gamma(x) samples.
static const RationalPolynomial r = {
0.770000000000000, 274.579999999999984,
{
881.979476556478289, 1496.058452015812463, 908.662212739659481,
373.566100223287378, 85.840860336314364, 6.683258861509244,
},
{
12.262350348616792, 20.557285797683576, 12.161463238367844,
4.711532733641639, 0.899112889751053, 0.035662329617191,
}};
return r(value);
}
} // namespace butteraugli
#endif // BUTTERAUGLI_BUTTERAUGLI_H_

@ -1,73 +0,0 @@
The OpenGL Extension Wrangler Library
Copyright (C) 2002-2007, Milan Ikits <milan ikits[]ieee org>
Copyright (C) 2002-2007, Marcelo E. Magallon <mmagallo[]debian org>
Copyright (C) 2002, Lev Povalahev
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* The name of the author may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
Mesa 3-D graphics library
Version: 7.0
Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright (c) 2007 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and/or associated documentation files (the
"Materials"), to deal in the Materials without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Materials, and to
permit persons to whom the Materials are furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Materials.
THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.

@ -1,18 +0,0 @@
See doc/index.html for more information.
If you downloaded the tarball from the GLEW website, you just need to:
Unix:
make
Windows:
use the project file in build/vc6/
If you wish to build GLEW from scratch (update the extension data from
the net or add your own extension information), you need a Unix
environment (including wget, perl, and GNU make). The extension data
is regenerated from the top level source directory with:
make extensions

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

1565
extern/goofy_tc.h vendored

File diff suppressed because it is too large Load Diff

@ -0,0 +1,15 @@
{
"folders": [
{
"path": ".."
}
],
"settings": {
"files.exclude": {
"**/build*": true,
"**/.svn": true,
"**/.gitignore": true,
"**/*.user": true,
},
}
}

@ -0,0 +1,10 @@
{
"folders":
[
{
"path": "..",
"file_exclude_patterns": ["*.user"],
"folder_exclude_patterns": ["build*", ".vscode", ".vc"]
}
]
}

@ -11,46 +11,6 @@ SUBDIRS(nvtt)
SUBDIRS(bc6h)
SUBDIRS(bc7)
# OpenGL
#INCLUDE(FindOpenGL)
#IF(OPENGL_FOUND)
# MESSAGE(STATUS "Looking for OpenGL - found")
#ELSE(OPENGL_FOUND)
# MESSAGE(STATUS "Looking for OpenGL - not found")
#ENDIF(OPENGL_FOUND)
# GLUT
#INCLUDE(FindGLUT)
#IF(GLUT_FOUND)
# MESSAGE(STATUS "Looking for GLUT - found")
#ELSE(GLUT_FOUND)
# MESSAGE(STATUS "Looking for GLUT - not found")
#ENDIF(GLUT_FOUND)
# DirectX
#INCLUDE(${NV_CMAKE_DIR}/FindDirectX.cmake)
#IF(DX10_FOUND)
# MESSAGE(STATUS "Looking for DirectX - found")
#ELSE(DX10_FOUND)
# MESSAGE(STATUS "Looking for DirectX - not found")
#ENDIF(DX10_FOUND)
# GLEW
#INCLUDE(${NV_CMAKE_DIR}/FindGLEW.cmake)
#IF(GLEW_FOUND)
# MESSAGE(STATUS "Looking for GLEW - found")
#ELSE(GLEW_FOUND)
# MESSAGE(STATUS "Looking for GLEW - not found")
#ENDIF(GLEW_FOUND)
# Cg
#INCLUDE(${NV_CMAKE_DIR}/FindCg.cmake)
#IF(CG_FOUND)
# MESSAGE(STATUS "Looking for Cg - found")
#ELSE(CG_FOUND)
# MESSAGE(STATUS "Looking for Cg - not found")
#ENDIF(CG_FOUND)
# CUDA
FIND_PACKAGE(CUDA)
IF(CUDA_FOUND)
@ -66,71 +26,16 @@ ELSE(CUDA_FOUND)
MESSAGE(STATUS "Looking for CUDA - not found")
ENDIF(CUDA_FOUND)
# Maya
#INCLUDE(${NV_CMAKE_DIR}/FindMaya.cmake)
#IF(MAYA_FOUND)
# SET(HAVE_MAYA ${MAYA_FOUND} CACHE BOOL "Set to TRUE if Maya is found, FALSE otherwise")
# MESSAGE(STATUS "Looking for Maya - found")
#ELSE(MAYA_FOUND)
# MESSAGE(STATUS "Looking for Maya - not found")
#ENDIF(MAYA_FOUND)
# FreeImage
#INCLUDE(${NV_CMAKE_DIR}/FindFreeImage.cmake)
#IF(FREEIMAGE_FOUND)
# SET(HAVE_FREEIMAGE ${FREEIMAGE_FOUND} CACHE BOOL "Set to TRUE if FreeImage is found, FALSE otherwise")
# MESSAGE(STATUS "Looking for FreeImage - found")
#ELSE(FREEIMAGE_FOUND)
# MESSAGE(STATUS "Looking for FreeImage - not found")
#ENDIF(FREEIMAGE_FOUND)
# JPEG
#INCLUDE(FindJPEG)
#IF(JPEG_FOUND)
# SET(HAVE_JPEG ${JPEG_FOUND} CACHE BOOL "Set to TRUE if JPEG is found, FALSE otherwise")
# MESSAGE(STATUS "Looking for JPEG - found")
#ELSE(JPEG_FOUND)
# MESSAGE(STATUS "Looking for JPEG - not found")
#ENDIF(JPEG_FOUND)
# PNG
#INCLUDE(FindPNG)
#IF(PNG_FOUND)
# SET(HAVE_PNG ${PNG_FOUND} CACHE BOOL "Set to TRUE if PNG is found, FALSE otherwise")
# MESSAGE(STATUS "Looking for PNG - found")
#ELSE(PNG_FOUND)
# MESSAGE(STATUS "Looking for PNG - not found")
#ENDIF(PNG_FOUND)
# TIFF
#SET(TIFF_NAMES libtiff)
#INCLUDE(FindTIFF)
#IF(TIFF_FOUND)
# SET(HAVE_TIFF ${TIFF_FOUND} CACHE BOOL "Set to TRUE if TIFF is found, FALSE otherwise")
# MESSAGE(STATUS "Looking for TIFF - found")
#ELSE(TIFF_FOUND)
# MESSAGE(STATUS "Looking for TIFF - not found")
#ENDIF(TIFF_FOUND)
# OpenEXR
#INCLUDE(${NV_CMAKE_DIR}/FindOpenEXR.cmake)
#IF(OPENEXR_FOUND)
# SET(HAVE_OPENEXR ${OPENEXR_FOUND} CACHE BOOL "Set to TRUE if OpenEXR is found, FALSE otherwise")
# MESSAGE(STATUS "Looking for OpenEXR - found")
#ELSE(OPENEXR_FOUND)
# MESSAGE(STATUS "Looking for OpenEXR - not found")
#ENDIF(OPENEXR_FOUND)
# OpenMP
INCLUDE(FindOpenMP)
IF(OPENMP_FOUND)
SET(HAVE_OPENMP ${OPENMP_FOUND} CACHE BOOL "Set to TRUE if OpenMP is found, FALSE otherwise")
MESSAGE(STATUS "Looking for OpenMP - found")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
ELSE(OPENMP_FOUND)
MESSAGE(STATUS "Looking for OpenMP - not found")
ENDIF(OPENMP_FOUND)
# INCLUDE(FindOpenMP)
# IF(OPENMP_FOUND)
# SET(HAVE_OPENMP ${OPENMP_FOUND} CACHE BOOL "Set to TRUE if OpenMP is found, FALSE otherwise")
# MESSAGE(STATUS "Looking for OpenMP - found")
# SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
# ELSE(OPENMP_FOUND)
# MESSAGE(STATUS "Looking for OpenMP - not found")
# ENDIF(OPENMP_FOUND)
# Threads
FIND_PACKAGE(Threads REQUIRED)
@ -149,5 +54,3 @@ CHECK_INCLUDE_FILES("dispatch/dispatch.h" HAVE_DISPATCH_H)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/nvconfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/nvconfig.h)
#INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/nvconfig.h DESTINATION include)

@ -1015,15 +1015,7 @@ void debug::dumpInfo()
#endif
}
static va_list getEmptyVAList(va_list list, ...)
{
va_start(list, list);
va_end(list);
return list;
}
/// Dump callstack using the specified handler.
void debug::dumpCallstack(MessageHandler *messageHandler, int callstackLevelsToSkip /*= 0*/)
static void dumpCallstackImpl(MessageHandler *messageHandler, int callstackLevelsToSkip, ...)
{
#if (NV_OS_WIN32 && NV_CC_MSVC) || (defined(HAVE_SIGNAL_H) && defined(HAVE_EXECINFO_H))
if (hasStackTrace())
@ -1035,7 +1027,8 @@ void debug::dumpCallstack(MessageHandler *messageHandler, int callstackLevelsToS
writeStackTrace(trace, size, callstackLevelsToSkip + 1, lines); // + 1 to skip the call to dumpCallstack
va_list empty;
empty = getEmptyVAList(empty);
va_start(empty, callstackLevelsToSkip);
va_end(empty);
for (uint i = 0; i < lines.count(); i++) {
messageHandler->log(lines[i], empty);
@ -1045,6 +1038,12 @@ void debug::dumpCallstack(MessageHandler *messageHandler, int callstackLevelsToS
#endif
}
/// Dump callstack using the specified handler.
void debug::dumpCallstack(MessageHandler *messageHandler, int callstackLevelsToSkip /*= 0*/)
{
dumpCallstackImpl(messageHandler, callstackLevelsToSkip);
}
/// Set the debug message handler.
void debug::setMessageHandler(MessageHandler * message_handler)

@ -585,7 +585,7 @@ DDSHeader::DDSHeader()
// Store version information on the reserved header attributes.
this->reserved[9] = FOURCC_NVTT;
this->reserved[10] = (2 << 16) | (1 << 8) | (0); // major.minor.revision
this->reserved[10] = (2 << 16) | (1 << 8) | (1); // major.minor.revision
this->pf.size = 32;
this->pf.flags = 0;

@ -1,122 +0,0 @@
/*
For more info:
http://developer.valvesoftware.com/wiki/VTF
File Layout:
VTF Header
VTF Low Resolution Image Data
For Each Mipmap (Smallest to Largest)
For Each Frame (First to Last)
For Each Face (First to Last)
For Each Z Slice (Min to Max; Varies with Mipmap)
VTF High Resolution Image Data
*/
enum
{
IMAGE_FORMAT_NONE = -1,
IMAGE_FORMAT_RGBA8888 = 0,
IMAGE_FORMAT_ABGR8888,
IMAGE_FORMAT_RGB888,
IMAGE_FORMAT_BGR888,
IMAGE_FORMAT_RGB565,
IMAGE_FORMAT_I8,
IMAGE_FORMAT_IA88,
IMAGE_FORMAT_P8,
IMAGE_FORMAT_A8,
IMAGE_FORMAT_RGB888_BLUESCREEN,
IMAGE_FORMAT_BGR888_BLUESCREEN,
IMAGE_FORMAT_ARGB8888,
IMAGE_FORMAT_BGRA8888,
IMAGE_FORMAT_DXT1,
IMAGE_FORMAT_DXT3,
IMAGE_FORMAT_DXT5,
IMAGE_FORMAT_BGRX8888,
IMAGE_FORMAT_BGR565,
IMAGE_FORMAT_BGRX5551,
IMAGE_FORMAT_BGRA4444,
IMAGE_FORMAT_DXT1_ONEBITALPHA,
IMAGE_FORMAT_BGRA5551,
IMAGE_FORMAT_UV88,
IMAGE_FORMAT_UVWQ8888,
IMAGE_FORMAT_RGBA16161616F,
IMAGE_FORMAT_RGBA16161616,
IMAGE_FORMAT_UVLX8888,
IMAGE_FORMAT_R32F, //!< = Luminance - 32 bpp
IMAGE_FORMAT_RGB323232F, //!< = Red, Green, Blue - 96 bpp
IMAGE_FORMAT_RGBA32323232F, //!< = Red, Green, Blue, Alpha - 128 bpp
IMAGE_FORMAT_NV_DST16,
IMAGE_FORMAT_NV_DST24,
IMAGE_FORMAT_NV_INTZ,
IMAGE_FORMAT_NV_RAWZ,
IMAGE_FORMAT_ATI_DST16,
IMAGE_FORMAT_ATI_DST24,
IMAGE_FORMAT_NV_NULL,
IMAGE_FORMAT_ATI2N,
IMAGE_FORMAT_ATI1N,
};
enum
{
TEXTUREFLAGS_POINTSAMPLE = 0x00000001,
TEXTUREFLAGS_TRILINEAR = 0x00000002,
TEXTUREFLAGS_CLAMPS = 0x00000004,
TEXTUREFLAGS_CLAMPT = 0x00000008,
TEXTUREFLAGS_ANISOTROPIC = 0x00000010,
TEXTUREFLAGS_HINT_DXT5 = 0x00000020,
TEXTUREFLAGS_NOCOMPRESS = 0x00000040,
TEXTUREFLAGS_NORMAL = 0x00000080,
TEXTUREFLAGS_NOMIP = 0x00000100,
TEXTUREFLAGS_NOLOD = 0x00000200,
TEXTUREFLAGS_MINMIP = 0x00000400,
TEXTUREFLAGS_PROCEDURAL = 0x00000800,
TEXTUREFLAGS_ONEBITALPHA = 0x00001000,
TEXTUREFLAGS_EIGHTBITALPHA = 0x00002000,
TEXTUREFLAGS_ENVMAP = 0x00004000,
TEXTUREFLAGS_RENDERTARGET = 0x00008000,
TEXTUREFLAGS_DEPTHRENDERTARGET = 0x00010000,
TEXTUREFLAGS_NODEBUGOVERRIDE = 0x00020000,
TEXTUREFLAGS_SINGLECOPY = 0x00040000,
TEXTUREFLAGS_ONEOVERMIPLEVELINALPHA = 0x00080000,
TEXTUREFLAGS_PREMULTCOLORBYONEOVERMIPLEVEL = 0x00100000,
TEXTUREFLAGS_NORMALTODUDV = 0x00200000,
TEXTUREFLAGS_ALPHATESTMIPGENERATION = 0x00400000,
TEXTUREFLAGS_NODEPTHBUFFER = 0x00800000,
TEXTUREFLAGS_NICEFILTERED = 0x01000000,
TEXTUREFLAGS_CLAMPU = 0x02000000
};
struct VtfHeader
{
char signature[4]; // File signature ("VTF\0").
uint32 version[2]; // version[0].version[1] (currently 7.2).
uint32 headerSize; // Size of the header struct (16 byte aligned; currently 80 bytes).
// 7.0
uint16 width; // Width of the largest mipmap in pixels. Must be a power of 2.
uint16 height; // Height of the largest mipmap in pixels. Must be a power of 2.
uint32 flags; // VTF flags.
uint16 frames; // Number of frames, if animated (1 for no animation).
uint16 firstFrame; // First frame in animation (0 based).
uint8 padding0[4]; // reflectivity padding (16 byte alignment).
float reflectivity[3]; // reflectivity vector.
uint8 padding1[4]; // reflectivity padding (8 byte packing).
float bumpmapScale; // Bumpmap scale.
uint32 highResImageFormat; // High resolution image format.
uint8 mipmapCount; // Number of mipmaps.
uint32 lowResImageFormat; // Low resolution image format (always DXT1).
uint8 lowResImageWidth; // Low resolution image width.
uint8 lowResImageHeight; // Low resolution image height.
// 7.2
uint16 depth; // Depth of the largest mipmap in pixels.
// Must be a power of 2. Can be 0 or 1 for a 2D texture (v7.2 only).
};

@ -6,6 +6,8 @@
#include "nvcore/Debug.h" // nvDebugCheck
#include "nvcore/Utils.h" // max, clamp
// Both cmath and math for C++11 and C function definitions.
#include <cmath>
#include <math.h>
#if NV_OS_WIN32 || NV_OS_XBOX
@ -162,7 +164,9 @@ namespace nv
inline bool isNan(const float f)
{
#if NV_OS_WIN32 || NV_OS_XBOX
#if __cplusplus >= 199711L
return std::isnan(f);
#elif NV_OS_WIN32 || NV_OS_XBOX
return _isnan(f) != 0;
#elif NV_OS_DARWIN || NV_OS_FREEBSD || NV_OS_NETBSD || NV_OS_OPENBSD || NV_OS_ORBIS || NV_OS_LINUX
return isnan(f);

@ -276,145 +276,6 @@ void CompressorETC2_RGBM::compressBlock(Vector4 colors[16], float weights[16], c
// External compressors.
#if defined(HAVE_ATITC)
typedef int BOOL;
typedef _W64 unsigned long ULONG_PTR;
typedef ULONG_PTR DWORD_PTR;
#include "atitc/ATI_Compress.h"
void AtiCompressorDXT1::compress(InputFormat inputFormat, AlphaMode alphaMode, uint w, uint h, uint d, void * data, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions)
{
nvDebugCheck(d == 1);
// Init source texture
ATI_TC_Texture srcTexture;
srcTexture.dwSize = sizeof(srcTexture);
srcTexture.dwWidth = w;
srcTexture.dwHeight = h;
if (inputFormat == InputFormat_BGRA_8UB)
{
srcTexture.dwPitch = w * 4;
srcTexture.format = ATI_TC_FORMAT_ARGB_8888;
}
else
{
// @@ Floating point input is not swizzled.
srcTexture.dwPitch = w * 16;
srcTexture.format = ATI_TC_FORMAT_ARGB_32F;
}
srcTexture.dwDataSize = ATI_TC_CalculateBufferSize(&srcTexture);
srcTexture.pData = (ATI_TC_BYTE*) data;
// Init dest texture
ATI_TC_Texture destTexture;
destTexture.dwSize = sizeof(destTexture);
destTexture.dwWidth = w;
destTexture.dwHeight = h;
destTexture.dwPitch = 0;
destTexture.format = ATI_TC_FORMAT_DXT1;
destTexture.dwDataSize = ATI_TC_CalculateBufferSize(&destTexture);
destTexture.pData = (ATI_TC_BYTE*) mem::malloc(destTexture.dwDataSize);
ATI_TC_CompressOptions options;
options.dwSize = sizeof(options);
options.bUseChannelWeighting = false;
options.bUseAdaptiveWeighting = false;
options.bDXT1UseAlpha = false;
options.nCompressionSpeed = ATI_TC_Speed_Normal;
options.bDisableMultiThreading = false;
//options.bDisableMultiThreading = true;
// Compress
ATI_TC_ConvertTexture(&srcTexture, &destTexture, &options, NULL, NULL, NULL);
if (outputOptions.outputHandler != NULL) {
outputOptions.outputHandler->writeData(destTexture.pData, destTexture.dwDataSize);
}
mem::free(destTexture.pData);
}
void AtiCompressorDXT5::compress(InputFormat inputFormat, AlphaMode alphaMode, uint w, uint h, uint d, void * data, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions)
{
nvDebugCheck(d == 1);
// Init source texture
ATI_TC_Texture srcTexture;
srcTexture.dwSize = sizeof(srcTexture);
srcTexture.dwWidth = w;
srcTexture.dwHeight = h;
if (inputFormat == InputFormat_BGRA_8UB)
{
srcTexture.dwPitch = w * 4;
srcTexture.format = ATI_TC_FORMAT_ARGB_8888;
}
else
{
srcTexture.dwPitch = w * 16;
srcTexture.format = ATI_TC_FORMAT_ARGB_32F;
}
srcTexture.dwDataSize = ATI_TC_CalculateBufferSize(&srcTexture);
srcTexture.pData = (ATI_TC_BYTE*) data;
// Init dest texture
ATI_TC_Texture destTexture;
destTexture.dwSize = sizeof(destTexture);
destTexture.dwWidth = w;
destTexture.dwHeight = h;
destTexture.dwPitch = 0;
destTexture.format = ATI_TC_FORMAT_DXT5;
destTexture.dwDataSize = ATI_TC_CalculateBufferSize(&destTexture);
destTexture.pData = (ATI_TC_BYTE*) mem::malloc(destTexture.dwDataSize);
// Compress
ATI_TC_ConvertTexture(&srcTexture, &destTexture, NULL, NULL, NULL, NULL);
if (outputOptions.outputHandler != NULL) {
outputOptions.outputHandler->writeData(destTexture.pData, destTexture.dwDataSize);
}
mem::free(destTexture.pData);
}
#endif // defined(HAVE_ATITC)
#if defined(HAVE_SQUISH)
//#include "squish/squish.h"
#include "squish-1.10/squish.h"
void SquishCompressorDXT1::compress(InputFormat inputFormat, AlphaMode alphaMode, uint w, uint h, uint d, void * data, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions)
{
nvDebugCheck(d == 1);
nvDebugCheck(false);
#pragma message(NV_FILE_LINE "TODO: Convert input to fixed point ABGR format instead of ARGB")
/*
Image img(*image);
int count = img.width() * img.height();
for (int i = 0; i < count; i++)
{
Color32 c = img.pixel(i);
img.pixel(i) = Color32(c.b, c.g, c.r, c.a);
}
int size = squish::GetStorageRequirements(img.width(), img.height(), squish::kDxt1);
void * blocks = mem::malloc(size);
squish::CompressImage((const squish::u8 *)img.pixels(), img.width(), img.height(), blocks, squish::kDxt1 | squish::kColourClusterFit);
if (outputOptions.outputHandler != NULL) {
outputOptions.outputHandler->writeData(blocks, size);
}
mem::free(blocks);
*/
}
#endif // defined(HAVE_SQUISH)
#if defined(HAVE_D3DX)
void D3DXCompressorDXT1::compress(InputFormat inputFormat, AlphaMode alphaMode, uint w, uint h, uint d, void * data, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions)

@ -79,25 +79,6 @@ namespace nv
// External compressors.
#if defined(HAVE_ATITC)
struct AtiCompressorDXT1 : public CompressorInterface
{
virtual void compress(nvtt::InputFormat inputFormat, nvtt::AlphaMode alphaMode, uint w, uint h, uint d, void * data, const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions);
};
struct AtiCompressorDXT5 : public CompressorInterface
{
virtual void compress(nvtt::InputFormat inputFormat, nvtt::AlphaMode alphaMode, uint w, uint h, uint d, void * data, const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions);
};
#endif
#if defined(HAVE_SQUISH)
struct SquishCompressorDXT1 : public CompressorInterface
{
virtual void compress(nvtt::InputFormat inputFormat, nvtt::AlphaMode alphaMode, uint w, uint h, uint d, void * data, const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions);
};
#endif
#if defined(HAVE_D3DX)
struct D3DXCompressorDXT1 : public CompressorInterface
{

@ -1043,22 +1043,12 @@ CompressorInterface * Compressor::Private::chooseCpuCompressor(const Compression
}
else if (compressionOptions.format == Format_DXT1)
{
#if defined(HAVE_ATITC)
if (compressionOptions.externalCompressor == "ati") return new AtiCompressorDXT1;
else
#endif
#if defined(HAVE_SQUISH)
if (compressionOptions.externalCompressor == "squish") return new SquishCompressorDXT1;
else
#endif
#if defined(HAVE_D3DX)
if (compressionOptions.externalCompressor == "d3dx") return new D3DXCompressorDXT1;
else
#endif
#if defined(HAVE_D3DX)
#if defined(HAVE_STB)
if (compressionOptions.externalCompressor == "stb") return new StbCompressorDXT1;
else
#endif
@ -1094,11 +1084,6 @@ CompressorInterface * Compressor::Private::chooseCpuCompressor(const Compression
}
else if (compressionOptions.format == Format_DXT5)
{
#if defined(HAVE_ATITC)
if (compressionOptions.externalCompressor == "ati") return new AtiCompressorDXT5;
else
#endif
if (compressionOptions.quality == Quality_Fastest)
{
return new FastCompressorDXT5;

@ -1027,21 +1027,6 @@ CubeSurface CubeSurface::fastResample(int size, EdgeFixup fixupMethod) const
return resampledCube;
}
void CubeSurface::_irradianceFilter(int size, EdgeFixup fixupMethod) {
*this = irradianceFilter(size, fixupMethod);
}
void CubeSurface::_cosinePowerFilter(int size, float cosinePower, EdgeFixup fixupMethod) {
*this = cosinePowerFilter(size, cosinePower, fixupMethod);
}
void CubeSurface::_fastResample(int size, EdgeFixup fixupMethod) {
*this = fastResample(size, fixupMethod);
}
void CubeSurface::toLinear(float gamma)
{
if (isNull()) return;

@ -49,7 +49,7 @@
# define NVTT_API
#endif
#define NVTT_VERSION 20100
#define NVTT_VERSION 20101
#define NVTT_FORBID_COPY(Class) \
private: \
@ -463,8 +463,8 @@ namespace nvtt
ToneMapper_Lightmap,
};
// Transform the given x,y coordinates.
typedef void WarpFunction(float & x, float & y, float & d);
// Transform the given x,y,z coordinates.
typedef void WarpFunction(float & x, float & y, float & z);
// A surface is one level of a 2D or 3D texture. (New in NVTT 2.1)
@ -664,11 +664,6 @@ namespace nvtt
NVTT_API CubeSurface fastResample(int size, EdgeFixup fixupMethod) const;
// Jai doesn't support non-pod structs as return types, so expose some other function to do the same, but operate in place:
NVTT_API void _irradianceFilter(int size, EdgeFixup fixupMethod);
NVTT_API void _cosinePowerFilter(int size, float cosinePower, EdgeFixup fixupMethod);
NVTT_API void _fastResample(int size, EdgeFixup fixupMethod);
// Spherical Harmonics:
NVTT_API void computeLuminanceIrradianceSH3(float sh[9]) const;
NVTT_API void computeIrradianceSH3(int channel, float sh[9]) const;

@ -21,8 +21,8 @@
#define ICETC_IMPLEMENTATION
#include "nvtt/icetc.h"
#define GOOFYTC_IMPLEMENTATION
#include "../extern/goofy_tc.h"
//#define GOOFYTC_IMPLEMENTATION
//#include "../extern/goofy_tc.h"
#include "../extern/rg_etc1_v104/rg_etc1.h"
#include "../extern/rg_etc1_v104/rg_etc1.cpp"

Loading…
Cancel
Save