Import all sources from perforce.

2.0
castano 17 years ago
commit 7543dd1efa

@ -0,0 +1,45 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0)
PROJECT(NV)
ENABLE_TESTING()
SET(NV_CMAKE_DIR "${NV_SOURCE_DIR}/cmake")
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${NV_CMAKE_DIR}")
IF(WIN32)
SET(GNUWIN32 "${NV_SOURCE_DIR}/gnuwin32")
SET(CMAKE_INCLUDE_PATH "${GNUWIN32}/include")
SET(CMAKE_LIBRARY_PATH "${GNUWIN32}/lib")
ENDIF(WIN32)
# In single config builds:
#IF(NOT CMAKE_CONFIGURATION_TYPES)
# IF (CMAKE_BUILD_TYPE MATCHES Debug)
# ADD_DEFINITIONS(-D_DEBUG)
# # ADD_DEFINITIONS(-DDEBUG)
# ENDIF (CMAKE_BUILD_TYPE MATCHES Debug)
#ELSE(NOT CMAKE_CONFIGURATION_TYPES)
# SET(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG} "-D_DEBUG")
# SET(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE} "-DNDEBUG")
#ENDIF(NOT CMAKE_CONFIGURATION_TYPES)
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")
# Optimization flags.
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} /O2 /Ob2 /Oi /Ot /Oy /GL")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} /O2 /Ob2 /Oi /Ot /Oy /GL")
SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG")
SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG")
SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /LTCG")
# Definitions.
ADD_DEFINITIONS(-D__SSE2__ -D__SSE__ -D__MMX__)
ENDIF(MSVC)
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=pentium4")
ADD_SUBDIRECTORY(src)

@ -0,0 +1,15 @@
NVIDIA Texture Tools version 0.9.0
* Private beta prerelease.
NVIDIA Texture Tools version 0.9.1
* Bug fix release.
NVIDIA Texture Tools version 0.9.2
* Improved alpha compression.
* Improved fast DXT1 compression.
* Documentation and release notes.
NVIDIA Texture Tools version 0.9.3
* Fix non power of two textures.
* Fix estimateSize with rgb format.
* Fix error in cuda compressor block limit.

@ -0,0 +1,24 @@
The NVIDIA Texture Tools are licensed under the MIT license.
Copyright (c) 2007 NVIDIA Corporation
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 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 SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

@ -0,0 +1,24 @@
The NVIDIA Texture Tools are licensed under the MIT license.
Copyright (c) 2007 NVIDIA Corporation
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 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 SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

@ -0,0 +1,161 @@
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
NVIDIA Texture Tools
README.txt
Version 0.9.2
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
TABLE OF CONTENTS
--------------------------------------------------------------------------------
I. Instructions
II. Contents
III. Compilation Instructions
IV. Using NVIDIA Texture Tools in your own applications
V. Known Issues
VI. Frequently Asked Questions
--------------------------------------------------------------------------------
I. Introduction
--------------------------------------------------------------------------------
This is our first alpha release of our new Texture Tools. The main highlights of
this release are support for all DX10 texture formats, higher speed and improved
compression quality.
In addition to that it also comes with a hardware accelerated compressor that
uses CUDA to compress blocks in parallel on the GPU and runs around 10 times
faster than the CPU counterpart.
You can obtain CUDA from our developer site at:
http://developer.nvidia.com/object/cuda.html
The source code of the Texture Tools is being released under the terms of
the MIT license.
II. Contents
--------------------------------------------------------------------------------
This release contains only the source code of the texture compression library
and an example commandline application that shows its use.
III. Compilation Instructions
--------------------------------------------------------------------------------
The compression library and the example can be compiled with Visual Studio 8 on
Windows using the following solution file:
project\vc8\nvtt.sln
On most other platforms you can also use cmake. For more information about
cmake, visit:
http://www.cmake.org/
On unix systems you can use the standard build procedure (assuming cmake is
installed on your system):
$ ./configure
$ make
$ sudo make install
IV. Using NVIDIA Texture Tools
--------------------------------------------------------------------------------
To use the NVIDIA Texture Tools in your own applications you just have to
include the following header file:
src/nvimage/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/nvimage/nvtt/compress.cpp
The usage of the commandline tool is the following:
$ nvcompress [options] infile [outfile]
where 'infile' is and TGA, PNG or JPG file, 'outfile' is a DDS file and
'options' is one or more of the following:
Input options:
-color The input image is a color map (default).
-normal The input image is a normal map.
-tonormal Convert input to normal map.
-clamp Clamp wrapping mode (default).
-repeat Repeat wrapping mode.
-nomips Disable mipmap generation.
Compression options:
-fast Fast compression.
-nocuda Do not use cuda compressor.
-rgb RGBA format
-bc1 BC1 format (DXT1)
-bc2 BC2 format (DXT3)
-bc3 BC3 format (DXT5)
-bc3n BC3 normal map format (DXT5n/RXGB)
-bc4 BC4 format (ATI1)
-bc5 BC5 format (3Dc/ATI2)
In order to run the compiled example on a PC that doesn't have Microsoft Visual
Studio 2003 installed, you will have to install the Microsoft Visual Studio 2003
redistributable package that you can download at:
http://go.microsoft.com/fwlink/?linkid=65127&clcid=0x409
V. Known Issues
--------------------------------------------------------------------------------
None so far. Please send suggestions and bug reports to: TextureTools@nvidia.com.
VI. Frequently Asked Questions
--------------------------------------------------------------------------------
- Do the NVIDIA Texture Tools work on OSX?
It currently compiles and runs properly, but it has not been tested extensively.
In particular there may be endiannes errors in the code.
- Do the NVIDIA Texture Tools work on Linux?
Yes.
- Do the NVIDIA Texture Tools work on Vista?
Yes, but note that CUDA is not supported on Vista yet, so the tool is not hardware
accellerated.
- Is CUDA required?
No. The Visual Studio solution file contains a configuration that allows you
to compile the texture tools without CUDA support. The cmake scripts automatically
detect the CUDA installation and use it only when available.
- Where can I get CUDA?
http://developer.nvidia.com/object/cuda.html
- Why is feature XYZ not supported?
In order to keep the code small and reduce maintenance costs we have limited the
features available in our new texture tools. We also have open sourced the code, so
that people can modify it and add their own favourite features.
- Can I use the NVIDIA Texture Tools in my commercial application?
Yes, the NVIDIA Texture Tools are licensed under the MIT license.
- Can I use the NVIDIA Texture Tools in my GPL application?
Yes, the MIT license is compatible with the GPL and LGPL licenses.

@ -0,0 +1,21 @@
Short term:
- Improve quality of fast compressors.
- More accellerated compressors.
- Accellerate mipmap generation.
- Generic RGB pixel format conversion.
- Do not assume that alpha is used for transparency.
Longer term:
- support non power of two textures.
- support for DXT1a format.
- support for correct cubemap filtering.
- support for correct cubemap borders and atlas borders. (Crytek request)
- support for 3d textures & 3d compression.
- Add support for occlusion map, horizon map & bent normal map generation.
- Add support for accurate normal map mipmap computation. Using lighting integrals.
- Add support for YCoCg and JPEG-LS color transforms. Add high quality DXT5-RGB compression.
- Add full support for mirror wrap mode.
- Generation of cone maps for relief mapping.
- Add min/max box mipmap filters.

@ -0,0 +1 @@
0.9.3

@ -0,0 +1,131 @@
#
# Try to find CUDA compiler, runtime libraries, and include path.
# Once done this will define
#
# CUDA_FOUND
# CUDA_INCLUDE_PATH
# CUDA_LIBRARY
# CUDA_COMPILER
#
# It will also define the following macro:
#
# WRAP_CUDA
#
IF (WIN32)
FIND_PROGRAM (CUDA_COMPILER nvcc.exe
$ENV{CUDA_BIN_PATH}
DOC "The CUDA Compiler")
ELSE(WIN32)
FIND_PROGRAM (CUDA_COMPILER nvcc
$ENV{CUDA_BIN_PATH}
DOC "The CUDA Compiler")
ENDIF(WIN32)
IF (CUDA_COMPILER)
GET_FILENAME_COMPONENT (CUDA_COMPILER_DIR ${CUDA_COMPILER} PATH)
GET_FILENAME_COMPONENT (CUDA_COMPILER_SUPER_DIR ${CUDA_COMPILER_DIR} PATH)
ELSE (CUDA_COMPILER)
SET (CUDA_COMPILER_DIR .)
SET (CUDA_COMPILER_SUPER_DIR ..)
ENDIF (CUDA_COMPILER)
FIND_PATH (CUDA_INCLUDE_PATH cuda_runtime.h
$ENV{CUDA_INC_PATH}
${CUDA_COMPILER_SUPER_DIR}/include
${CUDA_COMPILER_DIR}
DOC "The directory where CUDA headers reside")
FIND_LIBRARY (CUDA_LIBRARY
NAMES cudart
PATHS
$ENV{CUDA_LIB_PATH}
${CUDA_COMPILER_SUPER_DIR}/lib
${CUDA_COMPILER_DIR}
DOC "The CUDA runtime library")
IF (CUDA_INCLUDE_PATH)
SET (CUDA_FOUND 1 CACHE STRING "Set to 1 if CUDA is found, 0 otherwise")
ELSE (CUDA_INCLUDE_PATH)
SET (CUDA_FOUND 0 CACHE STRING "Set to 1 if CUDA is found, 0 otherwise")
ENDIF (CUDA_INCLUDE_PATH)
MARK_AS_ADVANCED (CUDA_FOUND CUDA_COMPILER)
#SET(CUDA_OPTIONS "-ncfe")
SET(CUDA_OPTIONS "")
IF (CUDA_EMU)
SET (CUDA_OPTIONS "${CUDA_OPTIONS} -deviceemu")
ENDIF (CUDA_EMU)
# Get include directories.
MACRO(GET_CUDA_INC_DIRS _cuda_INC_DIRS)
SET(${_cuda_INC_DIRS})
GET_DIRECTORY_PROPERTY(_inc_DIRS INCLUDE_DIRECTORIES)
FOREACH(_current ${_inc_DIRS})
SET(${_cuda_INC_DIRS} ${${_cuda_INC_DIRS}} "-I" ${_current})
ENDFOREACH(_current ${_inc_DIRS})
SET(${_cuda_INC_DIRS} ${${_cuda_INC_DIRS}} "-I" ${CUDA_INCLUDE_PATH})
# IF (CMAKE_SYTEM_INCLUDE_PATH)
# SET(${_cuda_INC_DIRS} ${${_cuda_INC_DIRS}} "-I" ${CMAKE_SYSTEM_INCLUDE_PATH})
# ENDIF (CMAKE_SYTEM_INCLUDE_PATH)
# IF (CMAKE_INCLUDE_PATH)
# SET(${_cuda_INC_DIRS} ${${_cuda_INC_DIRS}} "-I" ${CMAKE_INCLUDE_PATH})
# ENDIF (CMAKE_INCLUDE_PATH)
ENDMACRO(GET_CUDA_INC_DIRS)
# Get file dependencies.
MACRO (GET_CUFILE_DEPENDENCIES dependencies file)
GET_FILENAME_COMPONENT(filepath ${file} PATH)
# parse file for dependencies
FILE(READ "${file}" CONTENTS)
STRING(REGEX MATCHALL "#[ \t]*include[ \t]+[<\"][^>\"]*" DEPS "${CONTENTS}")
SET(${dependencies})
FOREACH(DEP ${DEPS})
STRING(REGEX REPLACE "#[ \t]*include[ \t]+[<\"]" "" DEP "${DEP}")
SET(${dependencies} ${${dependencies}} ${filepath}/${DEP})
ENDFOREACH(DEP)
ENDMACRO (GET_CUFILE_DEPENDENCIES)
# WRAP_CUDA(outfile ...)
MACRO (WRAP_CUDA outfiles)
GET_CUDA_INC_DIRS(cuda_includes)
#MESSAGE(${cuda_includes})
FOREACH (CUFILE ${ARGN})
GET_FILENAME_COMPONENT (CUFILE ${CUFILE} ABSOLUTE)
GET_FILENAME_COMPONENT (CFILE ${CUFILE} NAME_WE)
SET (CFILE ${CMAKE_CURRENT_BINARY_DIR}/${CFILE}.gen.c)
GET_CUFILE_DEPENDENCIES(CUDEPS ${CUFILE})
#MESSAGE("${CUDEPS}")
ADD_CUSTOM_COMMAND (
OUTPUT ${CFILE}
COMMAND ${CUDA_COMPILER}
ARGS -cuda ${cuda_includes} ${CUDA_OPTIONS} -o ${CFILE} ${CUFILE}
MAIN_DEPENDENCY ${CUFILE}
DEPENDS ${CUDEPS})
#MACRO_ADD_FILE_DEPENDENCIES(${CUFILE} ${CFILE})
SET (${outfiles} ${${outfiles}} ${CFILE})
ENDFOREACH (CUFILE)
SET_SOURCE_FILES_PROPERTIES(${outfiles} PROPERTIES GENERATED 1)
ENDMACRO (WRAP_CUDA)

@ -0,0 +1,129 @@
#
# 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_PATH = 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_PATH 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)
FIND_PROGRAM( CG_COMPILER cgc
$ENV{CG_BIN_PATH}
$ENV{PROGRAMFILES}/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_PATH 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"
)
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{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"
)
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_PATH 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_PATH)
SET( CG_FOUND 1 CACHE STRING "Set to 1 if CG is found, 0 otherwise")
ELSE (CG_INCLUDE_PATH)
SET( CG_FOUND 0 CACHE STRING "Set to 1 if CG is found, 0 otherwise")
ENDIF (CG_INCLUDE_PATH)
MARK_AS_ADVANCED( CG_FOUND )

@ -0,0 +1,47 @@
#
# 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
${PROJECT_SOURCE_DIR}/src/nvgl/glew/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
DOC "The directory where GL/glew.h resides")
FIND_LIBRARY( GLEW_LIBRARY
NAMES GLEW glew
PATHS
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
/sw/lib
/opt/local/lib
DOC "The GLEW library")
ENDIF (WIN32)
IF (GLEW_INCLUDE_PATH)
SET( GLEW_FOUND 1 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise")
ELSE (GLEW_INCLUDE_PATH)
SET( GLEW_FOUND 0 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise")
ENDIF (GLEW_INCLUDE_PATH)
MARK_AS_ADVANCED( GLEW_FOUND )

@ -0,0 +1,127 @@
# - try to find glut library and include files
# GLUT_INCLUDE_DIR, where to find GL/glut.h, etc.
# GLUT_LIBRARIES, the libraries to link against
# GLUT_FOUND, If false, do not try to use GLUT.
# Also defined, but not for general use are:
# GLUT_glut_LIBRARY = the full path to the glut library.
# GLUT_Xmu_LIBRARY = the full path to the Xmu library.
# GLUT_Xi_LIBRARY = the full path to the Xi Library.
IF (WIN32)
IF(CYGWIN)
FIND_PATH( GLUT_INCLUDE_DIR GL/glut.h
/usr/include
)
FIND_LIBRARY( GLUT_glut_LIBRARY glut32
${OPENGL_LIBRARY_DIR}
/usr/lib
/usr/lib/w32api
/usr/local/lib
/usr/X11R6/lib
)
ELSE(CYGWIN)
# FIND_PATH( GLUT_INCLUDE_DIR GL/glut.h
# ${GLUT_ROOT_PATH}/include
# )
# FIND_LIBRARY( GLUT_glut_LIBRARY glut32
# ${GLUT_ROOT_PATH}/lib
# ${OPENGL_LIBRARY_DIR}
# )
FIND_PATH( GLUT_INCLUDE_DIR GL/glut.h
${GLUT_ROOT_PATH}/include
${PROJECT_SOURCE_DIR}/src/nvgl/glut/include
DOC "The directory where GL/glut.h resides")
FIND_LIBRARY( GLUT_glut_LIBRARY
NAMES glut GLUT glut32 glut32s
PATHS
${GLUT_ROOT_PATH}/lib
${PROJECT_SOURCE_DIR}/src/nvgl/glut/bin
${PROJECT_SOURCE_DIR}/src/nvgl/glut/lib
${OPENGL_LIBRARY_DIR}
DOC "The GLUT library")
ENDIF(CYGWIN)
ELSE (WIN32)
IF (APPLE)
# These values for Apple could probably do with improvement.
FIND_PATH( GLUT_INCLUDE_DIR glut.h
/System/Library/Frameworks/GLUT.framework/Versions/A/Headers
${OPENGL_LIBRARY_DIR}
)
SET(GLUT_glut_LIBRARY "-framework Glut" CACHE STRING "GLUT library for OSX")
SET(GLUT_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX")
ELSE (APPLE)
FIND_PATH( GLUT_INCLUDE_DIR GL/glut.h
/usr/include
/usr/include/GL
/usr/local/include
/usr/openwin/share/include
/usr/openwin/include
/usr/X11R6/include
/usr/include/X11
/opt/graphics/OpenGL/include
/opt/graphics/OpenGL/contrib/libglut
)
FIND_LIBRARY( GLUT_glut_LIBRARY glut
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
)
FIND_LIBRARY( GLUT_Xi_LIBRARY Xi
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
)
FIND_LIBRARY( GLUT_Xmu_LIBRARY Xmu
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
)
ENDIF (APPLE)
ENDIF (WIN32)
SET( GLUT_FOUND "NO" )
IF(GLUT_INCLUDE_DIR)
IF(GLUT_glut_LIBRARY)
# Is -lXi and -lXmu required on all platforms that have it?
# If not, we need some way to figure out what platform we are on.
SET( GLUT_LIBRARIES
${GLUT_glut_LIBRARY}
${GLUT_Xmu_LIBRARY}
${GLUT_Xi_LIBRARY}
${GLUT_cocoa_LIBRARY}
)
SET( GLUT_FOUND "YES" )
#The following deprecated settings are for backwards compatibility with CMake1.4
SET (GLUT_LIBRARY ${GLUT_LIBRARIES})
SET (GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR})
ENDIF(GLUT_glut_LIBRARY)
ENDIF(GLUT_INCLUDE_DIR)
MARK_AS_ADVANCED(
GLUT_INCLUDE_DIR
GLUT_glut_LIBRARY
GLUT_Xmu_LIBRARY
GLUT_Xi_LIBRARY
)

72
configure vendored

@ -0,0 +1,72 @@
#!/usr/bin/env sh
BOLD="\033[1m"
RED="\033[91m"
GREEN="\033[92m"
YELLOW="\033[93m"
CYAN="\033[96m"
NORMAL="\033[0m"
# Make sure cmake is available.
if command -v cmake >/dev/null 2>&1;
then
CMAKE=cmake
else
echo "Error - cmake is not available!"
exit 2
fi
help=false
build="Debug" # release
prefix=/usr/local
# Parse the args
for i in "$@"
do
case $i in
--help ) help=true ;;
--debug ) build="Debug" ;;
--release ) build="Release" ;;
--prefix=* ) prefix="${i#--prefix=}" ;;
--prefix=* ) prefix="${i#--prefix=}" ;;
* ) echo "Unrecognised argument $i" ;;
esac
done
if [ "$help" = "true" ]
then
echo "---------------------------------------"
echo "nv "`cat VERSION`" configuration script"
echo "---------------------------------------"
echo
echo "--help Show this message."
echo "--debug Configure debug build."
echo "--release Configure release build."
echo "--prefix=path Installation prefix."
echo "--include=path Include path."
echo "--lib=path Library path."
exit 0
fi
echo "-- Configuring nv "`cat VERSION`
mkdir -p ./build
cd ./build
$CMAKE .. -DCMAKE_BUILD_TYPE=$build -DCMAKE_INSTALL_PREFIX=$prefix -G "Unix Makefiles" || exit 1
cd ..
echo ""
echo -e "Your configure completed "$GREEN"successfully"$NORMAL", now type "$BOLD"make"$NORMAL
echo ""
cat > Makefile << EOF
all:
@make --no-print-directory -C build/
install:
@make install --no-print-directory -C build/
clean:
@make clean --no-print-directory -C build/
distclean:
@rm -Rf build/
EOF

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,58 @@
/* jconfig.h. Generated automatically by configure. */
/* jconfig.cfg --- source file edited by configure script */
/* see jconfig.doc for explanations */
#define HAVE_PROTOTYPES
#define HAVE_UNSIGNED_CHAR
#define HAVE_UNSIGNED_SHORT
#ifdef _WIN32
# include <windows.h>
/* Define "boolean" as unsigned char, not int, per Windows custom */
# if !defined __RPCNDR_H__ || defined __MINGW32__ /* don't conflict if rpcndr.h already read */
# ifndef boolean /* don't conflict if rpcndr.h already read */
typedef unsigned char boolean;
# endif /* boolean */
# endif /* __RPCNDR_H__ */
# define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
# define USE_WINDOWS_MESSAGEBOX 1
#endif /* _WIN32 */
#undef void
#undef const
#undef CHAR_IS_UNSIGNED
#define HAVE_STDDEF_H
#define HAVE_STDLIB_H
#undef NEED_BSD_STRINGS
#undef NEED_SYS_TYPES_H
#undef NEED_FAR_POINTERS
#undef NEED_SHORT_EXTERNAL_NAMES
/* Define this if you get warnings about undefined structures. */
#undef INCOMPLETE_TYPES_BROKEN
#ifdef JPEG_INTERNALS
#undef RIGHT_SHIFT_IS_UNSIGNED
#define INLINE __inline__
/* These are for configuring the JPEG memory manager. */
#undef DEFAULT_MAX_MEM
#undef NO_MKTEMP
#endif /* JPEG_INTERNALS */
#ifdef JPEG_CJPEG_DJPEG
#define BMP_SUPPORTED /* BMP image file format */
#define GIF_SUPPORTED /* GIF image file format */
#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */
#define RLE_SUPPORTED /* Utah RLE image file format */
#define TARGA_SUPPORTED /* Targa image file format */
#undef TWO_FILE_COMMANDLINE
#undef NEED_SIGNAL_CATCHER
#undef DONT_USE_B_MODE
/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
#undef PROGRESS_REPORT
#endif /* JPEG_CJPEG_DJPEG */

@ -0,0 +1,303 @@
/*
* jerror.h
*
* Copyright (C) 1994-1997, Thomas G. Lane.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
* This file defines the error and message codes for the JPEG library.
* Edit this file to add new codes, or to translate the message strings to
* some other language.
* A set of error-reporting macros are defined too. Some applications using
* the JPEG library may wish to include this file to get the error codes
* and/or the macros.
*/
/*
* To define the enum list of message codes, include this file without
* defining macro JMESSAGE. To create a message string table, include it
* again with a suitable JMESSAGE definition (see jerror.c for an example).
*/
#ifndef JMESSAGE
#ifndef JERROR_H
/* First time through, define the enum list */
#define JMAKE_ENUM_LIST
#else
/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */
#define JMESSAGE(code,string)
#endif /* JERROR_H */
#endif /* JMESSAGE */
#ifdef JMAKE_ENUM_LIST
typedef enum {
#define JMESSAGE(code,string) code ,
#endif /* JMAKE_ENUM_LIST */
JMESSAGE(JMSG_NOMESSAGE, "Bogus message code %d") /* Must be first entry! */
/* For maintenance convenience, list is alphabetical by message code name */
JMESSAGE(JERR_ARITH_NOTIMPL,
"Sorry, there are legal restrictions on arithmetic coding")
JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix")
JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix")
JMESSAGE(JERR_BAD_BUFFER_MODE, "Bogus buffer control mode")
JMESSAGE(JERR_BAD_COMPONENT_ID, "Invalid component ID %d in SOS")
JMESSAGE(JERR_BAD_CROP_SPEC, "Invalid crop request")
JMESSAGE(JERR_BAD_DCT_COEF, "DCT coefficient out of range")
JMESSAGE(JERR_BAD_DCTSIZE, "IDCT output block size %d not supported")
JMESSAGE(JERR_BAD_DROP_SAMPLING,
"Component index %d: mismatching sampling ratio %d:%d, %d:%d, %c")
JMESSAGE(JERR_BAD_HUFF_TABLE, "Bogus Huffman table definition")
JMESSAGE(JERR_BAD_IN_COLORSPACE, "Bogus input colorspace")
JMESSAGE(JERR_BAD_J_COLORSPACE, "Bogus JPEG colorspace")
JMESSAGE(JERR_BAD_LENGTH, "Bogus marker length")
JMESSAGE(JERR_BAD_LIB_VERSION,
"Wrong JPEG library version: library is %d, caller expects %d")
JMESSAGE(JERR_BAD_MCU_SIZE, "Sampling factors too large for interleaved scan")
JMESSAGE(JERR_BAD_POOL_ID, "Invalid memory pool code %d")
JMESSAGE(JERR_BAD_PRECISION, "Unsupported JPEG data precision %d")
JMESSAGE(JERR_BAD_PROGRESSION,
"Invalid progressive parameters Ss=%d Se=%d Ah=%d Al=%d")
JMESSAGE(JERR_BAD_PROG_SCRIPT,
"Invalid progressive parameters at scan script entry %d")
JMESSAGE(JERR_BAD_SAMPLING, "Bogus sampling factors")
JMESSAGE(JERR_BAD_SCAN_SCRIPT, "Invalid scan script at entry %d")
JMESSAGE(JERR_BAD_STATE, "Improper call to JPEG library in state %d")
JMESSAGE(JERR_BAD_STRUCT_SIZE,
"JPEG parameter struct mismatch: library thinks size is %u, caller expects %u")
JMESSAGE(JERR_BAD_VIRTUAL_ACCESS, "Bogus virtual array access")
JMESSAGE(JERR_BUFFER_SIZE, "Buffer passed to JPEG library is too small")
JMESSAGE(JERR_CANT_SUSPEND, "Suspension not allowed here")
JMESSAGE(JERR_CCIR601_NOTIMPL, "CCIR601 sampling not implemented yet")
JMESSAGE(JERR_COMPONENT_COUNT, "Too many color components: %d, max %d")
JMESSAGE(JERR_CONVERSION_NOTIMPL, "Unsupported color conversion request")
JMESSAGE(JERR_DAC_INDEX, "Bogus DAC index %d")
JMESSAGE(JERR_DAC_VALUE, "Bogus DAC value 0x%x")
JMESSAGE(JERR_DHT_INDEX, "Bogus DHT index %d")
JMESSAGE(JERR_DQT_INDEX, "Bogus DQT index %d")
JMESSAGE(JERR_EMPTY_IMAGE, "Empty JPEG image (DNL not supported)")
JMESSAGE(JERR_EMS_READ, "Read from EMS failed")
JMESSAGE(JERR_EMS_WRITE, "Write to EMS failed")
JMESSAGE(JERR_EOI_EXPECTED, "Didn't expect more than one scan")
JMESSAGE(JERR_FILE_READ, "Input file read error")
JMESSAGE(JERR_FILE_WRITE, "Output file write error --- out of disk space?")
JMESSAGE(JERR_FRACT_SAMPLE_NOTIMPL, "Fractional sampling not implemented yet")
JMESSAGE(JERR_HUFF_CLEN_OVERFLOW, "Huffman code size table overflow")
JMESSAGE(JERR_HUFF_MISSING_CODE, "Missing Huffman code table entry")
JMESSAGE(JERR_IMAGE_TOO_BIG, "Maximum supported image dimension is %u pixels")
JMESSAGE(JERR_INPUT_EMPTY, "Empty input file")
JMESSAGE(JERR_INPUT_EOF, "Premature end of input file")
JMESSAGE(JERR_MISMATCHED_QUANT_TABLE,
"Cannot transcode due to multiple use of quantization table %d")
JMESSAGE(JERR_MISSING_DATA, "Scan script does not transmit all data")
JMESSAGE(JERR_MODE_CHANGE, "Invalid color quantization mode change")
JMESSAGE(JERR_NOTIMPL, "Not implemented yet")
JMESSAGE(JERR_NOT_COMPILED, "Requested feature was omitted at compile time")
JMESSAGE(JERR_NO_BACKING_STORE, "Backing store not supported")
JMESSAGE(JERR_NO_HUFF_TABLE, "Huffman table 0x%02x was not defined")
JMESSAGE(JERR_NO_IMAGE, "JPEG datastream contains no image")
JMESSAGE(JERR_NO_QUANT_TABLE, "Quantization table 0x%02x was not defined")
JMESSAGE(JERR_NO_SOI, "Not a JPEG file: starts with 0x%02x 0x%02x")
JMESSAGE(JERR_OUT_OF_MEMORY, "Insufficient memory (case %d)")
JMESSAGE(JERR_QUANT_COMPONENTS,
"Cannot quantize more than %d color components")
JMESSAGE(JERR_QUANT_FEW_COLORS, "Cannot quantize to fewer than %d colors")
JMESSAGE(JERR_QUANT_MANY_COLORS, "Cannot quantize to more than %d colors")
JMESSAGE(JERR_SOF_DUPLICATE, "Invalid JPEG file structure: two SOF markers")
JMESSAGE(JERR_SOF_NO_SOS, "Invalid JPEG file structure: missing SOS marker")
JMESSAGE(JERR_SOF_UNSUPPORTED, "Unsupported JPEG process: SOF type 0x%02x")
JMESSAGE(JERR_SOI_DUPLICATE, "Invalid JPEG file structure: two SOI markers")
JMESSAGE(JERR_SOS_NO_SOF, "Invalid JPEG file structure: SOS before SOF")
JMESSAGE(JERR_TFILE_CREATE, "Failed to create temporary file %s")
JMESSAGE(JERR_TFILE_READ, "Read failed on temporary file")
JMESSAGE(JERR_TFILE_SEEK, "Seek failed on temporary file")
JMESSAGE(JERR_TFILE_WRITE,
"Write failed on temporary file --- out of disk space?")
JMESSAGE(JERR_TOO_LITTLE_DATA, "Application transferred too few scanlines")
JMESSAGE(JERR_UNKNOWN_MARKER, "Unsupported marker type 0x%02x")
JMESSAGE(JERR_VIRTUAL_BUG, "Virtual array controller messed up")
JMESSAGE(JERR_WIDTH_OVERFLOW, "Image too wide for this implementation")
JMESSAGE(JERR_XMS_READ, "Read from XMS failed")
JMESSAGE(JERR_XMS_WRITE, "Write to XMS failed")
JMESSAGE(JMSG_COPYRIGHT, JCOPYRIGHT)
JMESSAGE(JMSG_VERSION, JVERSION)
JMESSAGE(JTRC_16BIT_TABLES,
"Caution: quantization tables are too coarse for baseline JPEG")
JMESSAGE(JTRC_ADOBE,
"Adobe APP14 marker: version %d, flags 0x%04x 0x%04x, transform %d")
JMESSAGE(JTRC_APP0, "Unknown APP0 marker (not JFIF), length %u")
JMESSAGE(JTRC_APP14, "Unknown APP14 marker (not Adobe), length %u")
JMESSAGE(JTRC_DAC, "Define Arithmetic Table 0x%02x: 0x%02x")
JMESSAGE(JTRC_DHT, "Define Huffman Table 0x%02x")
JMESSAGE(JTRC_DQT, "Define Quantization Table %d precision %d")
JMESSAGE(JTRC_DRI, "Define Restart Interval %u")
JMESSAGE(JTRC_EMS_CLOSE, "Freed EMS handle %u")
JMESSAGE(JTRC_EMS_OPEN, "Obtained EMS handle %u")
JMESSAGE(JTRC_EOI, "End Of Image")
JMESSAGE(JTRC_HUFFBITS, " %3d %3d %3d %3d %3d %3d %3d %3d")
JMESSAGE(JTRC_JFIF, "JFIF APP0 marker: version %d.%02d, density %dx%d %d")
JMESSAGE(JTRC_JFIF_BADTHUMBNAILSIZE,
"Warning: thumbnail image size does not match data length %u")
JMESSAGE(JTRC_JFIF_EXTENSION,
"JFIF extension marker: type 0x%02x, length %u")
JMESSAGE(JTRC_JFIF_THUMBNAIL, " with %d x %d thumbnail image")
JMESSAGE(JTRC_MISC_MARKER, "Miscellaneous marker 0x%02x, length %u")
JMESSAGE(JTRC_PARMLESS_MARKER, "Unexpected marker 0x%02x")
JMESSAGE(JTRC_QUANTVALS, " %4u %4u %4u %4u %4u %4u %4u %4u")
JMESSAGE(JTRC_QUANT_3_NCOLORS, "Quantizing to %d = %d*%d*%d colors")
JMESSAGE(JTRC_QUANT_NCOLORS, "Quantizing to %d colors")
JMESSAGE(JTRC_QUANT_SELECTED, "Selected %d colors for quantization")
JMESSAGE(JTRC_RECOVERY_ACTION, "At marker 0x%02x, recovery action %d")
JMESSAGE(JTRC_RST, "RST%d")
JMESSAGE(JTRC_SMOOTH_NOTIMPL,
"Smoothing not supported with nonstandard sampling ratios")
JMESSAGE(JTRC_SOF, "Start Of Frame 0x%02x: width=%u, height=%u, components=%d")
JMESSAGE(JTRC_SOF_COMPONENT, " Component %d: %dhx%dv q=%d")
JMESSAGE(JTRC_SOI, "Start of Image")
JMESSAGE(JTRC_SOS, "Start Of Scan: %d components")
JMESSAGE(JTRC_SOS_COMPONENT, " Component %d: dc=%d ac=%d")
JMESSAGE(JTRC_SOS_PARAMS, " Ss=%d, Se=%d, Ah=%d, Al=%d")
JMESSAGE(JTRC_TFILE_CLOSE, "Closed temporary file %s")
JMESSAGE(JTRC_TFILE_OPEN, "Opened temporary file %s")
JMESSAGE(JTRC_THUMB_JPEG,
"JFIF extension marker: JPEG-compressed thumbnail image, length %u")
JMESSAGE(JTRC_THUMB_PALETTE,
"JFIF extension marker: palette thumbnail image, length %u")
JMESSAGE(JTRC_THUMB_RGB,
"JFIF extension marker: RGB thumbnail image, length %u")
JMESSAGE(JTRC_UNKNOWN_IDS,
"Unrecognized component IDs %d %d %d, assuming YCbCr")
JMESSAGE(JTRC_XMS_CLOSE, "Freed XMS handle %u")
JMESSAGE(JTRC_XMS_OPEN, "Obtained XMS handle %u")
JMESSAGE(JWRN_ADOBE_XFORM, "Unknown Adobe color transform code %d")
JMESSAGE(JWRN_BOGUS_PROGRESSION,
"Inconsistent progression sequence for component %d coefficient %d")
JMESSAGE(JWRN_EXTRANEOUS_DATA,
"Corrupt JPEG data: %u extraneous bytes before marker 0x%02x")
JMESSAGE(JWRN_HIT_MARKER, "Corrupt JPEG data: premature end of data segment")
JMESSAGE(JWRN_HUFF_BAD_CODE, "Corrupt JPEG data: bad Huffman code")
JMESSAGE(JWRN_JFIF_MAJOR, "Warning: unknown JFIF revision number %d.%02d")
JMESSAGE(JWRN_JPEG_EOF, "Premature end of JPEG file")
JMESSAGE(JWRN_MUST_RESYNC,
"Corrupt JPEG data: found marker 0x%02x instead of RST%d")
JMESSAGE(JWRN_NOT_SEQUENTIAL, "Invalid SOS parameters for sequential JPEG")
JMESSAGE(JWRN_TOO_MUCH_DATA, "Application transferred too many scanlines")
#ifdef JMAKE_ENUM_LIST
JMSG_LASTMSGCODE
} J_MESSAGE_CODE;
#undef JMAKE_ENUM_LIST
#endif /* JMAKE_ENUM_LIST */
/* Zap JMESSAGE macro so that future re-inclusions do nothing by default */
#undef JMESSAGE
#ifndef JERROR_H
#define JERROR_H
/* Macros to simplify using the error and trace message stuff */
/* The first parameter is either type of cinfo pointer */
/* Fatal errors (print message and exit) */
#define ERREXIT(cinfo,code) \
((cinfo)->err->msg_code = (code), \
(*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
#define ERREXIT1(cinfo,code,p1) \
((cinfo)->err->msg_code = (code), \
(cinfo)->err->msg_parm.i[0] = (p1), \
(*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
#define ERREXIT2(cinfo,code,p1,p2) \
((cinfo)->err->msg_code = (code), \
(cinfo)->err->msg_parm.i[0] = (p1), \
(cinfo)->err->msg_parm.i[1] = (p2), \
(*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
#define ERREXIT3(cinfo,code,p1,p2,p3) \
((cinfo)->err->msg_code = (code), \
(cinfo)->err->msg_parm.i[0] = (p1), \
(cinfo)->err->msg_parm.i[1] = (p2), \
(cinfo)->err->msg_parm.i[2] = (p3), \
(*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
#define ERREXIT4(cinfo,code,p1,p2,p3,p4) \
((cinfo)->err->msg_code = (code), \
(cinfo)->err->msg_parm.i[0] = (p1), \
(cinfo)->err->msg_parm.i[1] = (p2), \
(cinfo)->err->msg_parm.i[2] = (p3), \
(cinfo)->err->msg_parm.i[3] = (p4), \
(*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
#define ERREXIT6(cinfo,code,p1,p2,p3,p4,p5,p6) \
((cinfo)->err->msg_code = (code), \
(cinfo)->err->msg_parm.i[0] = (p1), \
(cinfo)->err->msg_parm.i[1] = (p2), \
(cinfo)->err->msg_parm.i[2] = (p3), \
(cinfo)->err->msg_parm.i[3] = (p4), \
(cinfo)->err->msg_parm.i[4] = (p5), \
(cinfo)->err->msg_parm.i[5] = (p6), \
(*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
#define ERREXITS(cinfo,code,str) \
((cinfo)->err->msg_code = (code), \
strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \
(*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
#define MAKESTMT(stuff) do { stuff } while (0)
/* Nonfatal errors (we can keep going, but the data is probably corrupt) */
#define WARNMS(cinfo,code) \
((cinfo)->err->msg_code = (code), \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))
#define WARNMS1(cinfo,code,p1) \
((cinfo)->err->msg_code = (code), \
(cinfo)->err->msg_parm.i[0] = (p1), \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))
#define WARNMS2(cinfo,code,p1,p2) \
((cinfo)->err->msg_code = (code), \
(cinfo)->err->msg_parm.i[0] = (p1), \
(cinfo)->err->msg_parm.i[1] = (p2), \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))
/* Informational/debugging messages */
#define TRACEMS(cinfo,lvl,code) \
((cinfo)->err->msg_code = (code), \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
#define TRACEMS1(cinfo,lvl,code,p1) \
((cinfo)->err->msg_code = (code), \
(cinfo)->err->msg_parm.i[0] = (p1), \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
#define TRACEMS2(cinfo,lvl,code,p1,p2) \
((cinfo)->err->msg_code = (code), \
(cinfo)->err->msg_parm.i[0] = (p1), \
(cinfo)->err->msg_parm.i[1] = (p2), \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
#define TRACEMS3(cinfo,lvl,code,p1,p2,p3) \
MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
_mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); \
(cinfo)->err->msg_code = (code); \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
#define TRACEMS4(cinfo,lvl,code,p1,p2,p3,p4) \
MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
_mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
(cinfo)->err->msg_code = (code); \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
#define TRACEMS5(cinfo,lvl,code,p1,p2,p3,p4,p5) \
MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
_mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
_mp[4] = (p5); \
(cinfo)->err->msg_code = (code); \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
#define TRACEMS8(cinfo,lvl,code,p1,p2,p3,p4,p5,p6,p7,p8) \
MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
_mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
_mp[4] = (p5); _mp[5] = (p6); _mp[6] = (p7); _mp[7] = (p8); \
(cinfo)->err->msg_code = (code); \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
#define TRACEMSS(cinfo,lvl,code,str) \
((cinfo)->err->msg_code = (code), \
strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
#endif /* JERROR_H */

@ -0,0 +1,426 @@
/*
* jmorecfg.h
*
* Copyright (C) 1991-1997, Thomas G. Lane.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
* This file contains additional configuration options that customize the
* JPEG software for special applications or support machine-dependent
* optimizations. Most users will not need to touch this file.
*/
/*
* Define BITS_IN_JSAMPLE as either
* 8 for 8-bit sample values (the usual setting)
* 12 for 12-bit sample values
* Only 8 and 12 are legal data precisions for lossy JPEG according to the
* JPEG standard, and the IJG code does not support anything else!
* We do not support run-time selection of data precision, sorry.
*/
#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */
#if (defined (_MSC_VER) && (_MSC_VER >= 800))
#define HAVE_UNSIGNED_CHAR
#define HAVE_ALL_INTS
#define EXTERN(type) extern type __cdecl
#endif
/*
* Maximum number of components (color channels) allowed in JPEG image.
* To meet the letter of the JPEG spec, set this to 255. However, darn
* few applications need more than 4 channels (maybe 5 for CMYK + alpha
* mask). We recommend 10 as a reasonable compromise; use 4 if you are
* really short on memory. (Each allowed component costs a hundred or so
* bytes of storage, whether actually used in an image or not.)
*/
#define MAX_COMPONENTS 10 /* maximum number of image components */
/*
* Basic data types.
* You may need to change these if you have a machine with unusual data
* type sizes; for example, "char" not 8 bits, "short" not 16 bits,
* or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits,
* but it had better be at least 16.
*/
/* Representation of a single sample (pixel element value).
* We frequently allocate large arrays of these, so it's important to keep
* them small. But if you have memory to burn and access to char or short
* arrays is very slow on your hardware, you might want to change these.
*/
#if BITS_IN_JSAMPLE == 8
/* JSAMPLE should be the smallest type that will hold the values 0..255.
* You can use a signed char by having GETJSAMPLE mask it with 0xFF.
*/
#ifdef HAVE_UNSIGNED_CHAR
typedef unsigned char JSAMPLE;
#define GETJSAMPLE(value) ((int) (value))
#else /* not HAVE_UNSIGNED_CHAR */
typedef char JSAMPLE;
#ifdef CHAR_IS_UNSIGNED
#define GETJSAMPLE(value) ((int) (value))
#else
#define GETJSAMPLE(value) ((int) (value) & 0xFF)
#endif /* CHAR_IS_UNSIGNED */
#endif /* HAVE_UNSIGNED_CHAR */
#define MAXJSAMPLE 255
#define CENTERJSAMPLE 128
#endif /* BITS_IN_JSAMPLE == 8 */
#if BITS_IN_JSAMPLE == 12
/* JSAMPLE should be the smallest type that will hold the values 0..4095.
* On nearly all machines "short" will do nicely.
*/
typedef short JSAMPLE;
#define GETJSAMPLE(value) ((int) (value))
#define MAXJSAMPLE 4095
#define CENTERJSAMPLE 2048
#endif /* BITS_IN_JSAMPLE == 12 */
/* Representation of a DCT frequency coefficient.
* This should be a signed value of at least 16 bits; "short" is usually OK.
* Again, we allocate large arrays of these, but you can change to int
* if you have memory to burn and "short" is really slow.
*/
typedef short JCOEF;
/* Compressed datastreams are represented as arrays of JOCTET.
* These must be EXACTLY 8 bits wide, at least once they are written to
* external storage. Note that when using the stdio data source/destination
* managers, this is also the data type passed to fread/fwrite.
*/
#ifdef HAVE_UNSIGNED_CHAR
typedef unsigned char JOCTET;
#define GETJOCTET(value) (value)
#else /* not HAVE_UNSIGNED_CHAR */
typedef char JOCTET;
#ifdef CHAR_IS_UNSIGNED
#define GETJOCTET(value) (value)
#else
#define GETJOCTET(value) ((value) & 0xFF)
#endif /* CHAR_IS_UNSIGNED */
#endif /* HAVE_UNSIGNED_CHAR */
/* These typedefs are used for various table entries and so forth.
* They must be at least as wide as specified; but making them too big
* won't cost a huge amount of memory, so we don't provide special
* extraction code like we did for JSAMPLE. (In other words, these
* typedefs live at a different point on the speed/space tradeoff curve.)
*/
/* UINT8 must hold at least the values 0..255. */
#ifndef HAVE_ALL_INTS
#ifdef HAVE_UNSIGNED_CHAR
typedef unsigned char UINT8;
#else /* not HAVE_UNSIGNED_CHAR */
#ifdef CHAR_IS_UNSIGNED
typedef char UINT8;
#else /* not CHAR_IS_UNSIGNED */
typedef short UINT8;
#endif /* CHAR_IS_UNSIGNED */
#endif /* HAVE_UNSIGNED_CHAR */
/* UINT16 must hold at least the values 0..65535. */
#ifdef HAVE_UNSIGNED_SHORT
typedef unsigned short UINT16;
#else /* not HAVE_UNSIGNED_SHORT */
typedef unsigned int UINT16;
#endif /* HAVE_UNSIGNED_SHORT */
/* INT16 must hold at least the values -32768..32767. */
#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */
typedef short INT16;
#endif
/* INT32 must hold at least signed 32-bit values. */
#if !defined(XMD_H) && !defined(_WIN32) /* X11/xmd.h correctly defines INT32 */
typedef long INT32;
#endif
#endif /* HAVE_ALL_INTS */
/* Datatype used for image dimensions. The JPEG standard only supports
* images up to 64K*64K due to 16-bit fields in SOF markers. Therefore
* "unsigned int" is sufficient on all machines. However, if you need to
* handle larger images and you don't mind deviating from the spec, you
* can change this datatype.
*/
typedef unsigned int JDIMENSION;
#define JPEG_MAX_DIMENSION 65500L /* a tad under 64K to prevent overflows */
/* These macros are used in all function definitions and extern declarations.
* You could modify them if you need to change function linkage conventions;
* in particular, you'll need to do that to make the library a Windows DLL.
* Another application is to make all functions global for use with debuggers
* or code profilers that require it.
*/
#ifdef _WIN32
# if defined(ALL_STATIC)
# if defined(JPEG_DLL)
# undef JPEG_DLL
# endif
# if !defined(JPEG_STATIC)
# define JPEG_STATIC
# endif
# endif
# if defined(JPEG_DLL)
# if defined(JPEG_STATIC)
# undef JPEG_STATIC
# endif
# endif
# if defined(JPEG_DLL)
/* building a DLL */
# define JPEG_IMPEXP __declspec(dllexport)
# elif defined(JPEG_STATIC)
/* building or linking to a static library */
# define JPEG_IMPEXP
# else
/* linking to the DLL */
# define JPEG_IMPEXP __declspec(dllimport)
# endif
# if !defined(JPEG_API)
# define JPEG_API __cdecl
# endif
/* The only remaining magic that is necessary for cygwin */
#elif defined(__CYGWIN__)
# if !defined(JPEG_IMPEXP)
# define JPEG_IMPEXP
# endif
# if !defined(JPEG_API)
# define JPEG_API __cdecl
# endif
#endif
/* Ensure our magic doesn't hurt other platforms */
#if !defined(JPEG_IMPEXP)
# define JPEG_IMPEXP
#endif
#if !defined(JPEG_API)
# define JPEG_API
#endif
/* a function called through method pointers: */
#define METHODDEF(type) static type
/* a function used only in its module: */
#define LOCAL(type) static type
/* a function referenced thru EXTERNs: */
#define GLOBAL(type) type JPEG_API
/* a reference to a GLOBAL function: */
#ifndef EXTERN
# define EXTERN(type) extern JPEG_IMPEXP type JPEG_API
/* a reference to a "GLOBAL" function exported by sourcefiles of utility progs */
#endif /* EXTERN */
#define EXTERN_1(type) extern type JPEG_API
/* This macro is used to declare a "method", that is, a function pointer.
* We want to supply prototype parameters if the compiler can cope.
* Note that the arglist parameter must be parenthesized!
* Again, you can customize this if you need special linkage keywords.
*/
#ifdef HAVE_PROTOTYPES
#define JMETHOD(type,methodname,arglist) type (*methodname) arglist
#else
#define JMETHOD(type,methodname,arglist) type (*methodname) ()
#endif
/* Here is the pseudo-keyword for declaring pointers that must be "far"
* on 80x86 machines. Most of the specialized coding for 80x86 is handled
* by just saying "FAR *" where such a pointer is needed. In a few places
* explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.
*/
/* jmorecfg.h line 220 */
/* HJH modification: several of the windows header files already define FAR
because of this, the code below was changed so that it only tinkers with
the FAR define if FAR is still undefined */
#ifndef FAR
#ifdef NEED_FAR_POINTERS
#define FAR far
#else
#define FAR
#endif
#endif
/*
* On a few systems, type boolean and/or its values FALSE, TRUE may appear
* in standard header files. Or you may have conflicts with application-
* specific header files that you want to include together with these files.
* Defining HAVE_BOOLEAN before including jpeglib.h should make it work.
*/
#ifndef HAVE_BOOLEAN
typedef int boolean;
#endif
#ifndef FALSE /* in case these macros already exist */
#define FALSE 0 /* values of boolean */
#endif
#ifndef TRUE
#define TRUE 1
#endif
/*
* The remaining options affect code selection within the JPEG library,
* but they don't need to be visible to most applications using the library.
* To minimize application namespace pollution, the symbols won't be
* defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined.
*/
#ifdef JPEG_INTERNALS
#define JPEG_INTERNAL_OPTIONS
#endif
#ifdef JPEG_INTERNAL_OPTIONS
/*
* These defines indicate whether to include various optional functions.
* Undefining some of these symbols will produce a smaller but less capable
* library. Note that you can leave certain source files out of the
* compilation/linking process if you've #undef'd the corresponding symbols.
* (You may HAVE to do that if your compiler doesn't like null source files.)
*/
/* Arithmetic coding is unsupported for legal reasons. Complaints to IBM. */
/* Capability options common to encoder and decoder: */
#define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */
#define DCT_IFAST_SUPPORTED /* faster, less accurate integer method */
#define DCT_FLOAT_SUPPORTED /* floating-point: accurate, fast on fast HW */
/* Encoder capability options: */
#undef C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */
/* Note: if you selected 12-bit data precision, it is dangerous to turn off
* ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit
* precision, so jchuff.c normally uses entropy optimization to compute
* usable tables for higher precision. If you don't want to do optimization,
* you'll have to supply different default Huffman tables.
* The exact same statements apply for progressive JPEG: the default tables
* don't work for progressive mode. (This may get fixed, however.)
*/
#define INPUT_SMOOTHING_SUPPORTED /* Input image smoothing option? */
/* Decoder capability options: */
#undef D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
#define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */
#define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */
#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */
#undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */
#define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */
#define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */
#define QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */
/* more capability options later, no doubt */
/*
* Ordering of RGB data in scanlines passed to or from the application.
* If your application wants to deal with data in the order B,G,R, just
* change these macros. You can also deal with formats such as R,G,B,X
* (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing
* the offsets will also change the order in which colormap data is organized.
* RESTRICTIONS:
* 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.
* 2. These macros only affect RGB<=>YCbCr color conversion, so they are not
* useful if you are using JPEG color spaces other than YCbCr or grayscale.
* 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE
* is not 3 (they don't understand about dummy color components!). So you
* can't use color quantization if you change that value.
*/
#define RGB_RED 0 /* Offset of Red in an RGB scanline element */
#define RGB_GREEN 1 /* Offset of Green */
#define RGB_BLUE 2 /* Offset of Blue */
#define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */
/* Definitions for speed-related optimizations. */
/* If your compiler supports inline functions, define INLINE
* as the inline keyword; otherwise define it as empty.
*/
#ifndef INLINE
#ifdef __GNUC__ /* for instance, GNU C knows about inline */
#define INLINE __inline__
#endif
#ifndef INLINE
#define INLINE /* default is to define it as empty */
#endif
#endif
/* On some machines (notably 68000 series) "int" is 32 bits, but multiplying
* two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER
* as short on such a machine. MULTIPLIER must be at least 16 bits wide.
*/
#ifndef MULTIPLIER
#define MULTIPLIER int /* type for fastest integer multiply */
#endif
/* FAST_FLOAT should be either float or double, whichever is done faster
* by your compiler. (Note that this type is only used in the floating point
* DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.)
* Typically, float is faster in ANSI C compilers, while double is faster in
* pre-ANSI compilers (because they insist on converting to double anyway).
* The code below therefore chooses float if we have ANSI-style prototypes.
*/
#ifndef FAST_FLOAT
#ifdef HAVE_PROTOTYPES
#define FAST_FLOAT float
#else
#define FAST_FLOAT double
#endif
#endif
#endif /* JPEG_INTERNAL_OPTIONS */

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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,647 @@
/* $Id: tiff.h,v 1.42 2005/12/23 15:10:45 dron Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the names of
* Sam Leffler and Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Sam Leffler and Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#ifndef _TIFF_
#define _TIFF_
#include "tiffconf.h"
/*
* Tag Image File Format (TIFF)
*
* Based on Rev 6.0 from:
* Developer's Desk
* Aldus Corporation
* 411 First Ave. South
* Suite 200
* Seattle, WA 98104
* 206-622-5500
*
* (http://partners.adobe.com/asn/developer/PDFS/TN/TIFF6.pdf)
*
* For Big TIFF design notes see the following link
* http://gdal.maptools.org/twiki/bin/view/libtiff/BigTIFFDesign
*/
#define TIFF_VERSION 42
#define TIFF_BIGTIFF_VERSION 43
#define TIFF_BIGENDIAN 0x4d4d
#define TIFF_LITTLEENDIAN 0x4949
#define MDI_LITTLEENDIAN 0x5045
#define MDI_BIGENDIAN 0x4550
/*
* Intrinsic data types required by the file format:
*
* 8-bit quantities int8/uint8
* 16-bit quantities int16/uint16
* 32-bit quantities int32/uint32
* strings unsigned char*
*/
#ifndef HAVE_INT8
typedef signed char int8; /* NB: non-ANSI compilers may not grok */
#endif
typedef unsigned char uint8;
#ifndef HAVE_INT16
typedef short int16;
#endif
typedef unsigned short uint16; /* sizeof (uint16) must == 2 */
#if SIZEOF_INT == 4
#ifndef HAVE_INT32
typedef int int32;
#endif
typedef unsigned int uint32; /* sizeof (uint32) must == 4 */
#elif SIZEOF_LONG == 4
#ifndef HAVE_INT32
typedef long int32;
#endif
typedef unsigned long uint32; /* sizeof (uint32) must == 4 */
#endif
/* For TIFFReassignTagToIgnore */
enum TIFFIgnoreSense /* IGNORE tag table */
{
TIS_STORE,
TIS_EXTRACT,
TIS_EMPTY
};
/*
* TIFF header.
*/
typedef struct {
uint16 tiff_magic; /* magic number (defines byte order) */
#define TIFF_MAGIC_SIZE 2
uint16 tiff_version; /* TIFF version number */
#define TIFF_VERSION_SIZE 2
uint32 tiff_diroff; /* byte offset to first directory */
#define TIFF_DIROFFSET_SIZE 4
} TIFFHeader;
/*
* TIFF Image File Directories are comprised of a table of field
* descriptors of the form shown below. The table is sorted in
* ascending order by tag. The values associated with each entry are
* disjoint and may appear anywhere in the file (so long as they are
* placed on a word boundary).
*
* If the value is 4 bytes or less, then it is placed in the offset
* field to save space. If the value is less than 4 bytes, it is
* left-justified in the offset field.
*/
typedef struct {
uint16 tdir_tag; /* see below */
uint16 tdir_type; /* data type; see below */
uint32 tdir_count; /* number of items; length in spec */
uint32 tdir_offset; /* byte offset to field data */
} TIFFDirEntry;
/*
* NB: In the comments below,
* - items marked with a + are obsoleted by revision 5.0,
* - items marked with a ! are introduced in revision 6.0.
* - items marked with a % are introduced post revision 6.0.
* - items marked with a $ are obsoleted by revision 6.0.
* - items marked with a & are introduced by Adobe DNG specification.
*/
/*
* Tag data type information.
*
* Note: RATIONALs are the ratio of two 32-bit integer values.
*/
typedef enum {
TIFF_NOTYPE = 0, /* placeholder */
TIFF_BYTE = 1, /* 8-bit unsigned integer */
TIFF_ASCII = 2, /* 8-bit bytes w/ last byte null */
TIFF_SHORT = 3, /* 16-bit unsigned integer */
TIFF_LONG = 4, /* 32-bit unsigned integer */
TIFF_RATIONAL = 5, /* 64-bit unsigned fraction */
TIFF_SBYTE = 6, /* !8-bit signed integer */
TIFF_UNDEFINED = 7, /* !8-bit untyped data */
TIFF_SSHORT = 8, /* !16-bit signed integer */
TIFF_SLONG = 9, /* !32-bit signed integer */
TIFF_SRATIONAL = 10, /* !64-bit signed fraction */
TIFF_FLOAT = 11, /* !32-bit IEEE floating point */
TIFF_DOUBLE = 12, /* !64-bit IEEE floating point */
TIFF_IFD = 13 /* %32-bit unsigned integer (offset) */
} TIFFDataType;
/*
* TIFF Tag Definitions.
*/
#define TIFFTAG_SUBFILETYPE 254 /* subfile data descriptor */
#define FILETYPE_REDUCEDIMAGE 0x1 /* reduced resolution version */
#define FILETYPE_PAGE 0x2 /* one page of many */
#define FILETYPE_MASK 0x4 /* transparency mask */
#define TIFFTAG_OSUBFILETYPE 255 /* +kind of data in subfile */
#define OFILETYPE_IMAGE 1 /* full resolution image data */
#define OFILETYPE_REDUCEDIMAGE 2 /* reduced size image data */
#define OFILETYPE_PAGE 3 /* one page of many */
#define TIFFTAG_IMAGEWIDTH 256 /* image width in pixels */
#define TIFFTAG_IMAGELENGTH 257 /* image height in pixels */
#define TIFFTAG_BITSPERSAMPLE 258 /* bits per channel (sample) */
#define TIFFTAG_COMPRESSION 259 /* data compression technique */
#define COMPRESSION_NONE 1 /* dump mode */
#define COMPRESSION_CCITTRLE 2 /* CCITT modified Huffman RLE */
#define COMPRESSION_CCITTFAX3 3 /* CCITT Group 3 fax encoding */
#define COMPRESSION_CCITT_T4 3 /* CCITT T.4 (TIFF 6 name) */
#define COMPRESSION_CCITTFAX4 4 /* CCITT Group 4 fax encoding */
#define COMPRESSION_CCITT_T6 4 /* CCITT T.6 (TIFF 6 name) */
#define COMPRESSION_LZW 5 /* Lempel-Ziv & Welch */
#define COMPRESSION_OJPEG 6 /* !6.0 JPEG */
#define COMPRESSION_JPEG 7 /* %JPEG DCT compression */
#define COMPRESSION_NEXT 32766 /* NeXT 2-bit RLE */
#define COMPRESSION_CCITTRLEW 32771 /* #1 w/ word alignment */
#define COMPRESSION_PACKBITS 32773 /* Macintosh RLE */
#define COMPRESSION_THUNDERSCAN 32809 /* ThunderScan RLE */
/* codes 32895-32898 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) */
#define COMPRESSION_IT8CTPAD 32895 /* IT8 CT w/padding */
#define COMPRESSION_IT8LW 32896 /* IT8 Linework RLE */
#define COMPRESSION_IT8MP 32897 /* IT8 Monochrome picture */
#define COMPRESSION_IT8BL 32898 /* IT8 Binary line art */
/* compression codes 32908-32911 are reserved for Pixar */
#define COMPRESSION_PIXARFILM 32908 /* Pixar companded 10bit LZW */
#define COMPRESSION_PIXARLOG 32909 /* Pixar companded 11bit ZIP */
#define COMPRESSION_DEFLATE 32946 /* Deflate compression */
#define COMPRESSION_ADOBE_DEFLATE 8 /* Deflate compression,
as recognized by Adobe */
/* compression code 32947 is reserved for Oceana Matrix <dev@oceana.com> */
#define COMPRESSION_DCS 32947 /* Kodak DCS encoding */
#define COMPRESSION_JBIG 34661 /* ISO JBIG */
#define COMPRESSION_SGILOG 34676 /* SGI Log Luminance RLE */
#define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */
#define COMPRESSION_JP2000 34712 /* Leadtools JPEG2000 */
#define TIFFTAG_PHOTOMETRIC 262 /* photometric interpretation */
#define PHOTOMETRIC_MINISWHITE 0 /* min value is white */
#define PHOTOMETRIC_MINISBLACK 1 /* min value is black */
#define PHOTOMETRIC_RGB 2 /* RGB color model */
#define PHOTOMETRIC_PALETTE 3 /* color map indexed */
#define PHOTOMETRIC_MASK 4 /* $holdout mask */
#define PHOTOMETRIC_SEPARATED 5 /* !color separations */
#define PHOTOMETRIC_YCBCR 6 /* !CCIR 601 */
#define PHOTOMETRIC_CIELAB 8 /* !1976 CIE L*a*b* */
#define PHOTOMETRIC_ICCLAB 9 /* ICC L*a*b* [Adobe TIFF Technote 4] */
#define PHOTOMETRIC_ITULAB 10 /* ITU L*a*b* */
#define PHOTOMETRIC_LOGL 32844 /* CIE Log2(L) */
#define PHOTOMETRIC_LOGLUV 32845 /* CIE Log2(L) (u',v') */
#define TIFFTAG_THRESHHOLDING 263 /* +thresholding used on data */
#define THRESHHOLD_BILEVEL 1 /* b&w art scan */
#define THRESHHOLD_HALFTONE 2 /* or dithered scan */
#define THRESHHOLD_ERRORDIFFUSE 3 /* usually floyd-steinberg */
#define TIFFTAG_CELLWIDTH 264 /* +dithering matrix width */
#define TIFFTAG_CELLLENGTH 265 /* +dithering matrix height */
#define TIFFTAG_FILLORDER 266 /* data order within a byte */
#define FILLORDER_MSB2LSB 1 /* most significant -> least */
#define FILLORDER_LSB2MSB 2 /* least significant -> most */
#define TIFFTAG_DOCUMENTNAME 269 /* name of doc. image is from */
#define TIFFTAG_IMAGEDESCRIPTION 270 /* info about image */
#define TIFFTAG_MAKE 271 /* scanner manufacturer name */
#define TIFFTAG_MODEL 272 /* scanner model name/number */
#define TIFFTAG_STRIPOFFSETS 273 /* offsets to data strips */
#define TIFFTAG_ORIENTATION 274 /* +image orientation */
#define ORIENTATION_TOPLEFT 1 /* row 0 top, col 0 lhs */
#define ORIENTATION_TOPRIGHT 2 /* row 0 top, col 0 rhs */
#define ORIENTATION_BOTRIGHT 3 /* row 0 bottom, col 0 rhs */
#define ORIENTATION_BOTLEFT 4 /* row 0 bottom, col 0 lhs */
#define ORIENTATION_LEFTTOP 5 /* row 0 lhs, col 0 top */
#define ORIENTATION_RIGHTTOP 6 /* row 0 rhs, col 0 top */
#define ORIENTATION_RIGHTBOT 7 /* row 0 rhs, col 0 bottom */
#define ORIENTATION_LEFTBOT 8 /* row 0 lhs, col 0 bottom */
#define TIFFTAG_SAMPLESPERPIXEL 277 /* samples per pixel */
#define TIFFTAG_ROWSPERSTRIP 278 /* rows per strip of data */
#define TIFFTAG_STRIPBYTECOUNTS 279 /* bytes counts for strips */
#define TIFFTAG_MINSAMPLEVALUE 280 /* +minimum sample value */
#define TIFFTAG_MAXSAMPLEVALUE 281 /* +maximum sample value */
#define TIFFTAG_XRESOLUTION 282 /* pixels/resolution in x */
#define TIFFTAG_YRESOLUTION 283 /* pixels/resolution in y */
#define TIFFTAG_PLANARCONFIG 284 /* storage organization */
#define PLANARCONFIG_CONTIG 1 /* single image plane */
#define PLANARCONFIG_SEPARATE 2 /* separate planes of data */
#define TIFFTAG_PAGENAME 285 /* page name image is from */
#define TIFFTAG_XPOSITION 286 /* x page offset of image lhs */
#define TIFFTAG_YPOSITION 287 /* y page offset of image lhs */
#define TIFFTAG_FREEOFFSETS 288 /* +byte offset to free block */
#define TIFFTAG_FREEBYTECOUNTS 289 /* +sizes of free blocks */
#define TIFFTAG_GRAYRESPONSEUNIT 290 /* $gray scale curve accuracy */
#define GRAYRESPONSEUNIT_10S 1 /* tenths of a unit */
#define GRAYRESPONSEUNIT_100S 2 /* hundredths of a unit */
#define GRAYRESPONSEUNIT_1000S 3 /* thousandths of a unit */
#define GRAYRESPONSEUNIT_10000S 4 /* ten-thousandths of a unit */
#define GRAYRESPONSEUNIT_100000S 5 /* hundred-thousandths */
#define TIFFTAG_GRAYRESPONSECURVE 291 /* $gray scale response curve */
#define TIFFTAG_GROUP3OPTIONS 292 /* 32 flag bits */
#define TIFFTAG_T4OPTIONS 292 /* TIFF 6.0 proper name alias */
#define GROUP3OPT_2DENCODING 0x1 /* 2-dimensional coding */
#define GROUP3OPT_UNCOMPRESSED 0x2 /* data not compressed */
#define GROUP3OPT_FILLBITS 0x4 /* fill to byte boundary */
#define TIFFTAG_GROUP4OPTIONS 293 /* 32 flag bits */
#define TIFFTAG_T6OPTIONS 293 /* TIFF 6.0 proper name */
#define GROUP4OPT_UNCOMPRESSED 0x2 /* data not compressed */
#define TIFFTAG_RESOLUTIONUNIT 296 /* units of resolutions */
#define RESUNIT_NONE 1 /* no meaningful units */
#define RESUNIT_INCH 2 /* english */
#define RESUNIT_CENTIMETER 3 /* metric */
#define TIFFTAG_PAGENUMBER 297 /* page numbers of multi-page */
#define TIFFTAG_COLORRESPONSEUNIT 300 /* $color curve accuracy */
#define COLORRESPONSEUNIT_10S 1 /* tenths of a unit */
#define COLORRESPONSEUNIT_100S 2 /* hundredths of a unit */
#define COLORRESPONSEUNIT_1000S 3 /* thousandths of a unit */
#define COLORRESPONSEUNIT_10000S 4 /* ten-thousandths of a unit */
#define COLORRESPONSEUNIT_100000S 5 /* hundred-thousandths */
#define TIFFTAG_TRANSFERFUNCTION 301 /* !colorimetry info */
#define TIFFTAG_SOFTWARE 305 /* name & release */
#define TIFFTAG_DATETIME 306 /* creation date and time */
#define TIFFTAG_ARTIST 315 /* creator of image */
#define TIFFTAG_HOSTCOMPUTER 316 /* machine where created */
#define TIFFTAG_PREDICTOR 317 /* prediction scheme w/ LZW */
#define PREDICTOR_NONE 1 /* no prediction scheme used */
#define PREDICTOR_HORIZONTAL 2 /* horizontal differencing */
#define PREDICTOR_FLOATINGPOINT 3 /* floating point predictor */
#define TIFFTAG_WHITEPOINT 318 /* image white point */
#define TIFFTAG_PRIMARYCHROMATICITIES 319 /* !primary chromaticities */
#define TIFFTAG_COLORMAP 320 /* RGB map for pallette image */
#define TIFFTAG_HALFTONEHINTS 321 /* !highlight+shadow info */
#define TIFFTAG_TILEWIDTH 322 /* !tile width in pixels */
#define TIFFTAG_TILELENGTH 323 /* !tile height in pixels */
#define TIFFTAG_TILEOFFSETS 324 /* !offsets to data tiles */
#define TIFFTAG_TILEBYTECOUNTS 325 /* !byte counts for tiles */
#define TIFFTAG_BADFAXLINES 326 /* lines w/ wrong pixel count */
#define TIFFTAG_CLEANFAXDATA 327 /* regenerated line info */
#define CLEANFAXDATA_CLEAN 0 /* no errors detected */
#define CLEANFAXDATA_REGENERATED 1 /* receiver regenerated lines */
#define CLEANFAXDATA_UNCLEAN 2 /* uncorrected errors exist */
#define TIFFTAG_CONSECUTIVEBADFAXLINES 328 /* max consecutive bad lines */
#define TIFFTAG_SUBIFD 330 /* subimage descriptors */
#define TIFFTAG_INKSET 332 /* !inks in separated image */
#define INKSET_CMYK 1 /* !cyan-magenta-yellow-black color */
#define INKSET_MULTIINK 2 /* !multi-ink or hi-fi color */
#define TIFFTAG_INKNAMES 333 /* !ascii names of inks */
#define TIFFTAG_NUMBEROFINKS 334 /* !number of inks */
#define TIFFTAG_DOTRANGE 336 /* !0% and 100% dot codes */
#define TIFFTAG_TARGETPRINTER 337 /* !separation target */
#define TIFFTAG_EXTRASAMPLES 338 /* !info about extra samples */
#define EXTRASAMPLE_UNSPECIFIED 0 /* !unspecified data */
#define EXTRASAMPLE_ASSOCALPHA 1 /* !associated alpha data */
#define EXTRASAMPLE_UNASSALPHA 2 /* !unassociated alpha data */
#define TIFFTAG_SAMPLEFORMAT 339 /* !data sample format */
#define SAMPLEFORMAT_UINT 1 /* !unsigned integer data */
#define SAMPLEFORMAT_INT 2 /* !signed integer data */
#define SAMPLEFORMAT_IEEEFP 3 /* !IEEE floating point data */
#define SAMPLEFORMAT_VOID 4 /* !untyped data */
#define SAMPLEFORMAT_COMPLEXINT 5 /* !complex signed int */
#define SAMPLEFORMAT_COMPLEXIEEEFP 6 /* !complex ieee floating */
#define TIFFTAG_SMINSAMPLEVALUE 340 /* !variable MinSampleValue */
#define TIFFTAG_SMAXSAMPLEVALUE 341 /* !variable MaxSampleValue */
#define TIFFTAG_CLIPPATH 343 /* %ClipPath
[Adobe TIFF technote 2] */
#define TIFFTAG_XCLIPPATHUNITS 344 /* %XClipPathUnits
[Adobe TIFF technote 2] */
#define TIFFTAG_YCLIPPATHUNITS 345 /* %YClipPathUnits
[Adobe TIFF technote 2] */
#define TIFFTAG_INDEXED 346 /* %Indexed
[Adobe TIFF Technote 3] */
#define TIFFTAG_JPEGTABLES 347 /* %JPEG table stream */
#define TIFFTAG_OPIPROXY 351 /* %OPI Proxy [Adobe TIFF technote] */
/*
* Tags 512-521 are obsoleted by Technical Note #2 which specifies a
* revised JPEG-in-TIFF scheme.
*/
#define TIFFTAG_JPEGPROC 512 /* !JPEG processing algorithm */
#define JPEGPROC_BASELINE 1 /* !baseline sequential */
#define JPEGPROC_LOSSLESS 14 /* !Huffman coded lossless */
#define TIFFTAG_JPEGIFOFFSET 513 /* !pointer to SOI marker */
#define TIFFTAG_JPEGIFBYTECOUNT 514 /* !JFIF stream length */
#define TIFFTAG_JPEGRESTARTINTERVAL 515 /* !restart interval length */
#define TIFFTAG_JPEGLOSSLESSPREDICTORS 517 /* !lossless proc predictor */
#define TIFFTAG_JPEGPOINTTRANSFORM 518 /* !lossless point transform */
#define TIFFTAG_JPEGQTABLES 519 /* !Q matrice offsets */
#define TIFFTAG_JPEGDCTABLES 520 /* !DCT table offsets */
#define TIFFTAG_JPEGACTABLES 521 /* !AC coefficient offsets */
#define TIFFTAG_YCBCRCOEFFICIENTS 529 /* !RGB -> YCbCr transform */
#define TIFFTAG_YCBCRSUBSAMPLING 530 /* !YCbCr subsampling factors */
#define TIFFTAG_YCBCRPOSITIONING 531 /* !subsample positioning */
#define YCBCRPOSITION_CENTERED 1 /* !as in PostScript Level 2 */
#define YCBCRPOSITION_COSITED 2 /* !as in CCIR 601-1 */
#define TIFFTAG_REFERENCEBLACKWHITE 532 /* !colorimetry info */
#define TIFFTAG_XMLPACKET 700 /* %XML packet
[Adobe XMP Specification,
January 2004 */
#define TIFFTAG_OPIIMAGEID 32781 /* %OPI ImageID
[Adobe TIFF technote] */
/* tags 32952-32956 are private tags registered to Island Graphics */
#define TIFFTAG_REFPTS 32953 /* image reference points */
#define TIFFTAG_REGIONTACKPOINT 32954 /* region-xform tack point */
#define TIFFTAG_REGIONWARPCORNERS 32955 /* warp quadrilateral */
#define TIFFTAG_REGIONAFFINE 32956 /* affine transformation mat */
/* tags 32995-32999 are private tags registered to SGI */
#define TIFFTAG_MATTEING 32995 /* $use ExtraSamples */
#define TIFFTAG_DATATYPE 32996 /* $use SampleFormat */
#define TIFFTAG_IMAGEDEPTH 32997 /* z depth of image */
#define TIFFTAG_TILEDEPTH 32998 /* z depth/data tile */
/* tags 33300-33309 are private tags registered to Pixar */
/*
* TIFFTAG_PIXAR_IMAGEFULLWIDTH and TIFFTAG_PIXAR_IMAGEFULLLENGTH
* are set when an image has been cropped out of a larger image.
* They reflect the size of the original uncropped image.
* The TIFFTAG_XPOSITION and TIFFTAG_YPOSITION can be used
* to determine the position of the smaller image in the larger one.
*/
#define TIFFTAG_PIXAR_IMAGEFULLWIDTH 33300 /* full image size in x */
#define TIFFTAG_PIXAR_IMAGEFULLLENGTH 33301 /* full image size in y */
/* Tags 33302-33306 are used to identify special image modes and data
* used by Pixar's texture formats.
*/
#define TIFFTAG_PIXAR_TEXTUREFORMAT 33302 /* texture map format */
#define TIFFTAG_PIXAR_WRAPMODES 33303 /* s & t wrap modes */
#define TIFFTAG_PIXAR_FOVCOT 33304 /* cotan(fov) for env. maps */
#define TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN 33305
#define TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA 33306
/* tag 33405 is a private tag registered to Eastman Kodak */
#define TIFFTAG_WRITERSERIALNUMBER 33405 /* device serial number */
/* tag 33432 is listed in the 6.0 spec w/ unknown ownership */
#define TIFFTAG_COPYRIGHT 33432 /* copyright string */
/* IPTC TAG from RichTIFF specifications */
#define TIFFTAG_RICHTIFFIPTC 33723
/* 34016-34029 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) */
#define TIFFTAG_IT8SITE 34016 /* site name */
#define TIFFTAG_IT8COLORSEQUENCE 34017 /* color seq. [RGB,CMYK,etc] */
#define TIFFTAG_IT8HEADER 34018 /* DDES Header */
#define TIFFTAG_IT8RASTERPADDING 34019 /* raster scanline padding */
#define TIFFTAG_IT8BITSPERRUNLENGTH 34020 /* # of bits in short run */
#define TIFFTAG_IT8BITSPEREXTENDEDRUNLENGTH 34021/* # of bits in long run */
#define TIFFTAG_IT8COLORTABLE 34022 /* LW colortable */
#define TIFFTAG_IT8IMAGECOLORINDICATOR 34023 /* BP/BL image color switch */
#define TIFFTAG_IT8BKGCOLORINDICATOR 34024 /* BP/BL bg color switch */
#define TIFFTAG_IT8IMAGECOLORVALUE 34025 /* BP/BL image color value */
#define TIFFTAG_IT8BKGCOLORVALUE 34026 /* BP/BL bg color value */
#define TIFFTAG_IT8PIXELINTENSITYRANGE 34027 /* MP pixel intensity value */
#define TIFFTAG_IT8TRANSPARENCYINDICATOR 34028 /* HC transparency switch */
#define TIFFTAG_IT8COLORCHARACTERIZATION 34029 /* color character. table */
#define TIFFTAG_IT8HCUSAGE 34030 /* HC usage indicator */
#define TIFFTAG_IT8TRAPINDICATOR 34031 /* Trapping indicator
(untrapped=0, trapped=1) */
#define TIFFTAG_IT8CMYKEQUIVALENT 34032 /* CMYK color equivalents */
/* tags 34232-34236 are private tags registered to Texas Instruments */
#define TIFFTAG_FRAMECOUNT 34232 /* Sequence Frame Count */
/* tag 34377 is private tag registered to Adobe for PhotoShop */
#define TIFFTAG_PHOTOSHOP 34377
/* tags 34665, 34853 and 40965 are documented in EXIF specification */
#define TIFFTAG_EXIFIFD 34665 /* Pointer to EXIF private directory */
/* tag 34750 is a private tag registered to Adobe? */
#define TIFFTAG_ICCPROFILE 34675 /* ICC profile data */
/* tag 34750 is a private tag registered to Pixel Magic */
#define TIFFTAG_JBIGOPTIONS 34750 /* JBIG options */
#define TIFFTAG_GPSIFD 34853 /* Pointer to GPS private directory */
/* tags 34908-34914 are private tags registered to SGI */
#define TIFFTAG_FAXRECVPARAMS 34908 /* encoded Class 2 ses. parms */
#define TIFFTAG_FAXSUBADDRESS 34909 /* received SubAddr string */
#define TIFFTAG_FAXRECVTIME 34910 /* receive time (secs) */
#define TIFFTAG_FAXDCS 34911 /* encoded fax ses. params, Table 2/T.30 */
/* tags 37439-37443 are registered to SGI <gregl@sgi.com> */
#define TIFFTAG_STONITS 37439 /* Sample value to Nits */
/* tag 34929 is a private tag registered to FedEx */
#define TIFFTAG_FEDEX_EDR 34929 /* unknown use */
#define TIFFTAG_INTEROPERABILITYIFD 40965 /* Pointer to Interoperability private directory */
/* Adobe Digital Negative (DNG) format tags */
#define TIFFTAG_DNGVERSION 50706 /* &DNG version number */
#define TIFFTAG_DNGBACKWARDVERSION 50707 /* &DNG compatibility version */
#define TIFFTAG_UNIQUECAMERAMODEL 50708 /* &name for the camera model */
#define TIFFTAG_LOCALIZEDCAMERAMODEL 50709 /* &localized camera model
name */
#define TIFFTAG_CFAPLANECOLOR 50710 /* &CFAPattern->LinearRaw space
mapping */
#define TIFFTAG_CFALAYOUT 50711 /* &spatial layout of the CFA */
#define TIFFTAG_LINEARIZATIONTABLE 50712 /* &lookup table description */
#define TIFFTAG_BLACKLEVELREPEATDIM 50713 /* &repeat pattern size for
the BlackLevel tag */
#define TIFFTAG_BLACKLEVEL 50714 /* &zero light encoding level */
#define TIFFTAG_BLACKLEVELDELTAH 50715 /* &zero light encoding level
differences (columns) */
#define TIFFTAG_BLACKLEVELDELTAV 50716 /* &zero light encoding level
differences (rows) */
#define TIFFTAG_WHITELEVEL 50717 /* &fully saturated encoding
level */
#define TIFFTAG_DEFAULTSCALE 50718 /* &default scale factors */
#define TIFFTAG_DEFAULTCROPORIGIN 50719 /* &origin of the final image
area */
#define TIFFTAG_DEFAULTCROPSIZE 50720 /* &size of the final image
area */
#define TIFFTAG_COLORMATRIX1 50721 /* &XYZ->reference color space
transformation matrix 1 */
#define TIFFTAG_COLORMATRIX2 50722 /* &XYZ->reference color space
transformation matrix 2 */
#define TIFFTAG_CAMERACALIBRATION1 50723 /* &calibration matrix 1 */
#define TIFFTAG_CAMERACALIBRATION2 50724 /* &calibration matrix 2 */
#define TIFFTAG_REDUCTIONMATRIX1 50725 /* &dimensionality reduction
matrix 1 */
#define TIFFTAG_REDUCTIONMATRIX2 50726 /* &dimensionality reduction
matrix 2 */
#define TIFFTAG_ANALOGBALANCE 50727 /* &gain applied the stored raw
values*/
#define TIFFTAG_ASSHOTNEUTRAL 50728 /* &selected white balance in
linear reference space */
#define TIFFTAG_ASSHOTWHITEXY 50729 /* &selected white balance in
x-y chromaticity
coordinates */
#define TIFFTAG_BASELINEEXPOSURE 50730 /* &how much to move the zero
point */
#define TIFFTAG_BASELINENOISE 50731 /* &relative noise level */
#define TIFFTAG_BASELINESHARPNESS 50732 /* &relative amount of
sharpening */
#define TIFFTAG_BAYERGREENSPLIT 50733 /* &how closely the values of
the green pixels in the
blue/green rows track the
values of the green pixels
in the red/green rows */
#define TIFFTAG_LINEARRESPONSELIMIT 50734 /* &non-linear encoding range */
#define TIFFTAG_CAMERASERIALNUMBER 50735 /* &camera's serial number */
#define TIFFTAG_LENSINFO 50736 /* info about the lens */
#define TIFFTAG_CHROMABLURRADIUS 50737 /* &chroma blur radius */
#define TIFFTAG_ANTIALIASSTRENGTH 50738 /* &relative strength of the
camera's anti-alias filter */
#define TIFFTAG_SHADOWSCALE 50739 /* &used by Adobe Camera Raw */
#define TIFFTAG_DNGPRIVATEDATA 50740 /* &manufacturer's private data */
#define TIFFTAG_MAKERNOTESAFETY 50741 /* &whether the EXIF MakerNote
tag is safe to preserve
along with the rest of the
EXIF data */
#define TIFFTAG_CALIBRATIONILLUMINANT1 50778 /* &illuminant 1 */
#define TIFFTAG_CALIBRATIONILLUMINANT2 50779 /* &illuminant 2 */
#define TIFFTAG_BESTQUALITYSCALE 50780 /* &best quality multiplier */
#define TIFFTAG_RAWDATAUNIQUEID 50781 /* &unique identifier for
the raw image data */
#define TIFFTAG_ORIGINALRAWFILENAME 50827 /* &file name of the original
raw file */
#define TIFFTAG_ORIGINALRAWFILEDATA 50828 /* &contents of the original
raw file */
#define TIFFTAG_ACTIVEAREA 50829 /* &active (non-masked) pixels
of the sensor */
#define TIFFTAG_MASKEDAREAS 50830 /* &list of coordinates
of fully masked pixels */
#define TIFFTAG_ASSHOTICCPROFILE 50831 /* &these two tags used to */
#define TIFFTAG_ASSHOTPREPROFILEMATRIX 50832 /* map cameras's color space
into ICC profile space */
#define TIFFTAG_CURRENTICCPROFILE 50833 /* & */
#define TIFFTAG_CURRENTPREPROFILEMATRIX 50834 /* & */
/* tag 65535 is an undefined tag used by Eastman Kodak */
#define TIFFTAG_DCSHUESHIFTVALUES 65535 /* hue shift correction data */
/*
* The following are ``pseudo tags'' that can be used to control
* codec-specific functionality. These tags are not written to file.
* Note that these values start at 0xffff+1 so that they'll never
* collide with Aldus-assigned tags.
*
* If you want your private pseudo tags ``registered'' (i.e. added to
* this file), please post a bug report via the tracking system at
* http://www.remotesensing.org/libtiff/bugs.html with the appropriate
* C definitions to add.
*/
#define TIFFTAG_FAXMODE 65536 /* Group 3/4 format control */
#define FAXMODE_CLASSIC 0x0000 /* default, include RTC */
#define FAXMODE_NORTC 0x0001 /* no RTC at end of data */
#define FAXMODE_NOEOL 0x0002 /* no EOL code at end of row */
#define FAXMODE_BYTEALIGN 0x0004 /* byte align row */
#define FAXMODE_WORDALIGN 0x0008 /* word align row */
#define FAXMODE_CLASSF FAXMODE_NORTC /* TIFF Class F */
#define TIFFTAG_JPEGQUALITY 65537 /* Compression quality level */
/* Note: quality level is on the IJG 0-100 scale. Default value is 75 */
#define TIFFTAG_JPEGCOLORMODE 65538 /* Auto RGB<=>YCbCr convert? */
#define JPEGCOLORMODE_RAW 0x0000 /* no conversion (default) */
#define JPEGCOLORMODE_RGB 0x0001 /* do auto conversion */
#define TIFFTAG_JPEGTABLESMODE 65539 /* What to put in JPEGTables */
#define JPEGTABLESMODE_QUANT 0x0001 /* include quantization tbls */
#define JPEGTABLESMODE_HUFF 0x0002 /* include Huffman tbls */
/* Note: default is JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF */
#define TIFFTAG_FAXFILLFUNC 65540 /* G3/G4 fill function */
#define TIFFTAG_PIXARLOGDATAFMT 65549 /* PixarLogCodec I/O data sz */
#define PIXARLOGDATAFMT_8BIT 0 /* regular u_char samples */
#define PIXARLOGDATAFMT_8BITABGR 1 /* ABGR-order u_chars */
#define PIXARLOGDATAFMT_11BITLOG 2 /* 11-bit log-encoded (raw) */
#define PIXARLOGDATAFMT_12BITPICIO 3 /* as per PICIO (1.0==2048) */
#define PIXARLOGDATAFMT_16BIT 4 /* signed short samples */
#define PIXARLOGDATAFMT_FLOAT 5 /* IEEE float samples */
/* 65550-65556 are allocated to Oceana Matrix <dev@oceana.com> */
#define TIFFTAG_DCSIMAGERTYPE 65550 /* imager model & filter */
#define DCSIMAGERMODEL_M3 0 /* M3 chip (1280 x 1024) */
#define DCSIMAGERMODEL_M5 1 /* M5 chip (1536 x 1024) */
#define DCSIMAGERMODEL_M6 2 /* M6 chip (3072 x 2048) */
#define DCSIMAGERFILTER_IR 0 /* infrared filter */
#define DCSIMAGERFILTER_MONO 1 /* monochrome filter */
#define DCSIMAGERFILTER_CFA 2 /* color filter array */
#define DCSIMAGERFILTER_OTHER 3 /* other filter */
#define TIFFTAG_DCSINTERPMODE 65551 /* interpolation mode */
#define DCSINTERPMODE_NORMAL 0x0 /* whole image, default */
#define DCSINTERPMODE_PREVIEW 0x1 /* preview of image (384x256) */
#define TIFFTAG_DCSBALANCEARRAY 65552 /* color balance values */
#define TIFFTAG_DCSCORRECTMATRIX 65553 /* color correction values */
#define TIFFTAG_DCSGAMMA 65554 /* gamma value */
#define TIFFTAG_DCSTOESHOULDERPTS 65555 /* toe & shoulder points */
#define TIFFTAG_DCSCALIBRATIONFD 65556 /* calibration file desc */
/* Note: quality level is on the ZLIB 1-9 scale. Default value is -1 */
#define TIFFTAG_ZIPQUALITY 65557 /* compression quality level */
#define TIFFTAG_PIXARLOGQUALITY 65558 /* PixarLog uses same scale */
/* 65559 is allocated to Oceana Matrix <dev@oceana.com> */
#define TIFFTAG_DCSCLIPRECTANGLE 65559 /* area of image to acquire */
#define TIFFTAG_SGILOGDATAFMT 65560 /* SGILog user data format */
#define SGILOGDATAFMT_FLOAT 0 /* IEEE float samples */
#define SGILOGDATAFMT_16BIT 1 /* 16-bit samples */
#define SGILOGDATAFMT_RAW 2 /* uninterpreted data */
#define SGILOGDATAFMT_8BIT 3 /* 8-bit RGB monitor values */
#define TIFFTAG_SGILOGENCODE 65561 /* SGILog data encoding control*/
#define SGILOGENCODE_NODITHER 0 /* do not dither encoded values*/
#define SGILOGENCODE_RANDITHER 1 /* randomly dither encd values */
/*
* EXIF tags
*/
#define EXIFTAG_EXPOSURETIME 33434 /* Exposure time */
#define EXIFTAG_FNUMBER 33437 /* F number */
#define EXIFTAG_EXPOSUREPROGRAM 34850 /* Exposure program */
#define EXIFTAG_SPECTRALSENSITIVITY 34852 /* Spectral sensitivity */
#define EXIFTAG_ISOSPEEDRATINGS 34855 /* ISO speed rating */
#define EXIFTAG_OECF 34856 /* Optoelectric conversion
factor */
#define EXIFTAG_EXIFVERSION 36864 /* Exif version */
#define EXIFTAG_DATETIMEORIGINAL 36867 /* Date and time of original
data generation */
#define EXIFTAG_DATETIMEDIGITIZED 36868 /* Date and time of digital
data generation */
#define EXIFTAG_COMPONENTSCONFIGURATION 37121 /* Meaning of each component */
#define EXIFTAG_COMPRESSEDBITSPERPIXEL 37122 /* Image compression mode */
#define EXIFTAG_SHUTTERSPEEDVALUE 37377 /* Shutter speed */
#define EXIFTAG_APERTUREVALUE 37378 /* Aperture */
#define EXIFTAG_BRIGHTNESSVALUE 37379 /* Brightness */
#define EXIFTAG_EXPOSUREBIASVALUE 37380 /* Exposure bias */
#define EXIFTAG_MAXAPERTUREVALUE 37381 /* Maximum lens aperture */
#define EXIFTAG_SUBJECTDISTANCE 37382 /* Subject distance */
#define EXIFTAG_METERINGMODE 37383 /* Metering mode */
#define EXIFTAG_LIGHTSOURCE 37384 /* Light source */
#define EXIFTAG_FLASH 37385 /* Flash */
#define EXIFTAG_FOCALLENGTH 37386 /* Lens focal length */
#define EXIFTAG_SUBJECTAREA 37396 /* Subject area */
#define EXIFTAG_MAKERNOTE 37500 /* Manufacturer notes */
#define EXIFTAG_USERCOMMENT 37510 /* User comments */
#define EXIFTAG_SUBSECTIME 37520 /* DateTime subseconds */
#define EXIFTAG_SUBSECTIMEORIGINAL 37521 /* DateTimeOriginal subseconds */
#define EXIFTAG_SUBSECTIMEDIGITIZED 37522 /* DateTimeDigitized subseconds */
#define EXIFTAG_FLASHPIXVERSION 40960 /* Supported Flashpix version */
#define EXIFTAG_COLORSPACE 40961 /* Color space information */
#define EXIFTAG_PIXELXDIMENSION 40962 /* Valid image width */
#define EXIFTAG_PIXELYDIMENSION 40963 /* Valid image height */
#define EXIFTAG_RELATEDSOUNDFILE 40964 /* Related audio file */
#define EXIFTAG_FLASHENERGY 41483 /* Flash energy */
#define EXIFTAG_SPATIALFREQUENCYRESPONSE 41484 /* Spatial frequency response */
#define EXIFTAG_FOCALPLANEXRESOLUTION 41486 /* Focal plane X resolution */
#define EXIFTAG_FOCALPLANEYRESOLUTION 41487 /* Focal plane Y resolution */
#define EXIFTAG_FOCALPLANERESOLUTIONUNIT 41488 /* Focal plane resolution unit */
#define EXIFTAG_SUBJECTLOCATION 41492 /* Subject location */
#define EXIFTAG_EXPOSUREINDEX 41493 /* Exposure index */
#define EXIFTAG_SENSINGMETHOD 41495 /* Sensing method */
#define EXIFTAG_FILESOURCE 41728 /* File source */
#define EXIFTAG_SCENETYPE 41729 /* Scene type */
#define EXIFTAG_CFAPATTERN 41730 /* CFA pattern */
#define EXIFTAG_CUSTOMRENDERED 41985 /* Custom image processing */
#define EXIFTAG_EXPOSUREMODE 41986 /* Exposure mode */
#define EXIFTAG_WHITEBALANCE 41987 /* White balance */
#define EXIFTAG_DIGITALZOOMRATIO 41988 /* Digital zoom ratio */
#define EXIFTAG_FOCALLENGTHIN35MMFILM 41989 /* Focal length in 35 mm film */
#define EXIFTAG_SCENECAPTURETYPE 41990 /* Scene capture type */
#define EXIFTAG_GAINCONTROL 41991 /* Gain control */
#define EXIFTAG_CONTRAST 41992 /* Contrast */
#define EXIFTAG_SATURATION 41993 /* Saturation */
#define EXIFTAG_SHARPNESS 41994 /* Sharpness */
#define EXIFTAG_DEVICESETTINGDESCRIPTION 41995 /* Device settings description */
#define EXIFTAG_SUBJECTDISTANCERANGE 41996 /* Subject distance range */
#define EXIFTAG_GAINCONTROL 41991 /* Gain control */
#define EXIFTAG_GAINCONTROL 41991 /* Gain control */
#define EXIFTAG_IMAGEUNIQUEID 42016 /* Unique image ID */
#endif /* _TIFF_ */
/* vim: set ts=8 sts=8 sw=8 noet: */

@ -0,0 +1,101 @@
/* libtiff/tiffconf.h. Generated by configure. */
/*
Configuration defines for installed libtiff.
This file maintained for backward compatibility. Do not use definitions
from this file in your programs.
*/
#ifndef _TIFFCONF_
#define _TIFFCONF_
/* Define to 1 if the system has the type `int16'. */
/* #undef HAVE_INT16 */
/* Define to 1 if the system has the type `int32'. */
/* #undef HAVE_INT32 */
/* Define to 1 if the system has the type `int8'. */
/* #undef HAVE_INT8 */
/* The size of a `int', as computed by sizeof. */
#define SIZEOF_INT 4
/* The size of a `long', as computed by sizeof. */
#define SIZEOF_LONG 4
/* Compatibility stuff. */
/* Define as 0 or 1 according to the floating point format suported by the
machine */
#define HAVE_IEEEFP 1
/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */
#define HOST_FILLORDER FILLORDER_LSB2MSB
/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian
(Intel) */
#define HOST_BIGENDIAN 0
/* Support CCITT Group 3 & 4 algorithms */
#define CCITT_SUPPORT 1
/* Support JPEG compression (requires IJG JPEG library) */
#define JPEG_SUPPORT 1
/* Support LogLuv high dynamic range encoding */
#define LOGLUV_SUPPORT 1
/* Support LZW algorithm */
#define LZW_SUPPORT 1
/* Support NeXT 2-bit RLE algorithm */
#define NEXT_SUPPORT 1
/* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation
fails with unpatched IJG JPEG library) */
/* #undef OJPEG_SUPPORT */
/* Support Macintosh PackBits algorithm */
#define PACKBITS_SUPPORT 1
/* Support Pixar log-format algorithm (requires Zlib) */
#define PIXARLOG_SUPPORT 1
/* Support ThunderScan 4-bit RLE algorithm */
#define THUNDER_SUPPORT 1
/* Support Deflate compression */
#define ZIP_SUPPORT 1
/* Support strip chopping (whether or not to convert single-strip uncompressed
images to mutiple strips of ~8Kb to reduce memory usage) */
#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP
/* Enable SubIFD tag (330) support */
#define SUBIFD_SUPPORT 1
/* Treat extra sample as alpha (default enabled). The RGBA interface will
treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many
packages produce RGBA files but don't mark the alpha properly. */
#define DEFAULT_EXTRASAMPLE_AS_ALPHA 1
/* Pick up YCbCr subsampling info from the JPEG data stream to support files
lacking the tag (default enabled). */
#define CHECK_JPEG_YCBCR_SUBSAMPLING 1
/* Support MS MDI magic number files as TIFF */
#define MDI_SUPPORT 1
/*
* Feature support definitions.
* XXX: These macros are obsoleted. Don't use them in your apps!
* Macros stays here for backward compatibility and should be always defined.
*/
#define COLORIMETRY_SUPPORT
#define YCBCR_SUPPORT
#define CMYK_SUPPORT
#define ICC_SUPPORT
#define PHOTOSHOP_SUPPORT
#define IPTC_SUPPORT
#endif /* _TIFFCONF_ */

@ -0,0 +1,549 @@
/* $Id: tiffio.h,v 1.50 2006/03/21 16:37:51 dron Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the names of
* Sam Leffler and Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Sam Leffler and Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#ifndef _TIFFIO_
#define _TIFFIO_
#ifndef __GNUC__
# define __DLL_IMPORT__ __declspec(dllimport)
# define __DLL_EXPORT__ __declspec(dllexport)
#else
# define __DLL_IMPORT__ __attribute__((dllimport)) extern
# define __DLL_EXPORT__ __attribute__((dllexport)) extern
#endif
#if (defined __WIN32__) || (defined _WIN32)
# ifdef BUILD_LIBTIFF_DLL
# define LIBTIFF_DLL_IMPEXP __DLL_EXPORT__
# elif defined(LIBTIFF_STATIC)
# define LIBTIFF_DLL_IMPEXP
# elif defined (USE_LIBTIFF_DLL)
# define LIBTIFF_DLL_IMPEXP __DLL_IMPORT__
# elif defined (USE_LIBTIFF_STATIC)
# define LIBTIFF_DLL_IMPEXP
# else /* assume USE_LIBTIFF_DLL */
# define LIBTIFF_DLL_IMPEXP __DLL_IMPORT__
# endif
#else /* __WIN32__ */
# define LIBTIFF_DLL_IMPEXP
#endif
/*
* TIFF I/O Library Definitions.
*/
#include "tiff.h"
#include "tiffvers.h"
/*
* TIFF is defined as an incomplete type to hide the
* library's internal data structures from clients.
*/
typedef struct tiff TIFF;
/*
* The following typedefs define the intrinsic size of
* data types used in the *exported* interfaces. These
* definitions depend on the proper definition of types
* in tiff.h. Note also that the varargs interface used
* to pass tag types and values uses the types defined in
* tiff.h directly.
*
* NB: ttag_t is unsigned int and not unsigned short because
* ANSI C requires that the type before the ellipsis be a
* promoted type (i.e. one of int, unsigned int, pointer,
* or double) and because we defined pseudo-tags that are
* outside the range of legal Aldus-assigned tags.
* NB: tsize_t is int32 and not uint32 because some functions
* return -1.
* NB: toff_t is not off_t for many reasons; TIFFs max out at
* 32-bit file offsets being the most important, and to ensure
* that it is unsigned, rather than signed.
*/
typedef uint32 ttag_t; /* directory tag */
typedef uint16 tdir_t; /* directory index */
typedef uint16 tsample_t; /* sample number */
typedef uint32 tstrip_t; /* strip number */
typedef uint32 ttile_t; /* tile number */
typedef int32 tsize_t; /* i/o size in bytes */
typedef void* tdata_t; /* image data ref */
typedef uint32 toff_t; /* file offset */
#if !defined(__WIN32__) && (defined(_WIN32) || defined(WIN32))
#define __WIN32__
#endif
/*
* On windows you should define USE_WIN32_FILEIO if you are using tif_win32.c
* or AVOID_WIN32_FILEIO if you are using something else (like tif_unix.c).
*
* By default tif_unix.c is assumed.
*/
#if defined(_WINDOWS) || defined(__WIN32__) || defined(_Windows)
# define BINMODE "b"
# if !defined(__CYGWIN) && !defined(AVOID_WIN32_FILEIO) && !defined(USE_WIN32_FILEIO)
# define AVOID_WIN32_FILEIO
# endif
# include <fcntl.h>
# include <io.h>
# ifdef SET_BINARY
# undef SET_BINARY
# endif /* SET_BINARY */
# define SET_BINARY(f) do {if (!_isatty(f)) _setmode(f,_O_BINARY);} while (0)
#else /* Windows */
# define BINMODE
# define SET_BINARY(f) (void)0
#endif /* Windows */
#if defined(USE_WIN32_FILEIO)
# define VC_EXTRALEAN
# include <windows.h>
# ifdef __WIN32__
DECLARE_HANDLE(thandle_t); /* Win32 file handle */
# else
typedef HFILE thandle_t; /* client data handle */
# endif /* __WIN32__ */
#else
typedef void* thandle_t; /* client data handle */
#endif /* USE_WIN32_FILEIO */
#ifndef NULL
# define NULL (void *)0
#endif
/*
* Flags to pass to TIFFPrintDirectory to control
* printing of data structures that are potentially
* very large. Bit-or these flags to enable printing
* multiple items.
*/
#define TIFFPRINT_NONE 0x0 /* no extra info */
#define TIFFPRINT_STRIPS 0x1 /* strips/tiles info */
#define TIFFPRINT_CURVES 0x2 /* color/gray response curves */
#define TIFFPRINT_COLORMAP 0x4 /* colormap */
#define TIFFPRINT_JPEGQTABLES 0x100 /* JPEG Q matrices */
#define TIFFPRINT_JPEGACTABLES 0x200 /* JPEG AC tables */
#define TIFFPRINT_JPEGDCTABLES 0x200 /* JPEG DC tables */
/*
* Colour conversion stuff
*/
/* reference white */
#define D65_X0 (95.0470F)
#define D65_Y0 (100.0F)
#define D65_Z0 (108.8827F)
#define D50_X0 (96.4250F)
#define D50_Y0 (100.0F)
#define D50_Z0 (82.4680F)
/* Structure for holding information about a display device. */
typedef unsigned char TIFFRGBValue; /* 8-bit samples */
typedef struct {
float d_mat[3][3]; /* XYZ -> luminance matrix */
float d_YCR; /* Light o/p for reference white */
float d_YCG;
float d_YCB;
uint32 d_Vrwr; /* Pixel values for ref. white */
uint32 d_Vrwg;
uint32 d_Vrwb;
float d_Y0R; /* Residual light for black pixel */
float d_Y0G;
float d_Y0B;
float d_gammaR; /* Gamma values for the three guns */
float d_gammaG;
float d_gammaB;
} TIFFDisplay;
typedef struct { /* YCbCr->RGB support */
TIFFRGBValue* clamptab; /* range clamping table */
int* Cr_r_tab;
int* Cb_b_tab;
int32* Cr_g_tab;
int32* Cb_g_tab;
int32* Y_tab;
} TIFFYCbCrToRGB;
typedef struct { /* CIE Lab 1976->RGB support */
int range; /* Size of conversion table */
#define CIELABTORGB_TABLE_RANGE 1500
float rstep, gstep, bstep;
float X0, Y0, Z0; /* Reference white point */
TIFFDisplay display;
float Yr2r[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yr to r */
float Yg2g[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yg to g */
float Yb2b[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yb to b */
} TIFFCIELabToRGB;
/*
* RGBA-style image support.
*/
typedef struct _TIFFRGBAImage TIFFRGBAImage;
/*
* The image reading and conversion routines invoke
* ``put routines'' to copy/image/whatever tiles of
* raw image data. A default set of routines are
* provided to convert/copy raw image data to 8-bit
* packed ABGR format rasters. Applications can supply
* alternate routines that unpack the data into a
* different format or, for example, unpack the data
* and draw the unpacked raster on the display.
*/
typedef void (*tileContigRoutine)
(TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32,
unsigned char*);
typedef void (*tileSeparateRoutine)
(TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32,
unsigned char*, unsigned char*, unsigned char*, unsigned char*);
/*
* RGBA-reader state.
*/
struct _TIFFRGBAImage {
TIFF* tif; /* image handle */
int stoponerr; /* stop on read error */
int isContig; /* data is packed/separate */
int alpha; /* type of alpha data present */
uint32 width; /* image width */
uint32 height; /* image height */
uint16 bitspersample; /* image bits/sample */
uint16 samplesperpixel; /* image samples/pixel */
uint16 orientation; /* image orientation */
uint16 req_orientation; /* requested orientation */
uint16 photometric; /* image photometric interp */
uint16* redcmap; /* colormap pallete */
uint16* greencmap;
uint16* bluecmap;
/* get image data routine */
int (*get)(TIFFRGBAImage*, uint32*, uint32, uint32);
union {
void (*any)(TIFFRGBAImage*);
tileContigRoutine contig;
tileSeparateRoutine separate;
} put; /* put decoded strip/tile */
TIFFRGBValue* Map; /* sample mapping array */
uint32** BWmap; /* black&white map */
uint32** PALmap; /* palette image map */
TIFFYCbCrToRGB* ycbcr; /* YCbCr conversion state */
TIFFCIELabToRGB* cielab; /* CIE L*a*b conversion state */
int row_offset;
int col_offset;
};
/*
* Macros for extracting components from the
* packed ABGR form returned by TIFFReadRGBAImage.
*/
#define TIFFGetR(abgr) ((abgr) & 0xff)
#define TIFFGetG(abgr) (((abgr) >> 8) & 0xff)
#define TIFFGetB(abgr) (((abgr) >> 16) & 0xff)
#define TIFFGetA(abgr) (((abgr) >> 24) & 0xff)
/*
* A CODEC is a software package that implements decoding,
* encoding, or decoding+encoding of a compression algorithm.
* The library provides a collection of builtin codecs.
* More codecs may be registered through calls to the library
* and/or the builtin implementations may be overridden.
*/
typedef int (*TIFFInitMethod)(TIFF*, int);
typedef struct {
char* name;
uint16 scheme;
TIFFInitMethod init;
} TIFFCodec;
#include <stdio.h>
#include <stdarg.h>
/* share internal LogLuv conversion routines? */
#ifndef LOGLUV_PUBLIC
#define LOGLUV_PUBLIC 1
#endif
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
typedef void (*TIFFErrorHandler)(const char*, const char*, va_list);
typedef void (*TIFFErrorHandlerExt)(thandle_t, const char*, const char*, va_list);
typedef tsize_t (*TIFFReadWriteProc)(thandle_t, tdata_t, tsize_t);
typedef toff_t (*TIFFSeekProc)(thandle_t, toff_t, int);
typedef int (*TIFFCloseProc)(thandle_t);
typedef toff_t (*TIFFSizeProc)(thandle_t);
typedef int (*TIFFMapFileProc)(thandle_t, tdata_t*, toff_t*);
typedef void (*TIFFUnmapFileProc)(thandle_t, tdata_t, toff_t);
typedef void (*TIFFExtendProc)(TIFF*);
LIBTIFF_DLL_IMPEXP const char* TIFFGetVersion(void);
LIBTIFF_DLL_IMPEXP const TIFFCodec* TIFFFindCODEC(uint16);
LIBTIFF_DLL_IMPEXP TIFFCodec* TIFFRegisterCODEC(uint16, const char*, TIFFInitMethod);
LIBTIFF_DLL_IMPEXP void TIFFUnRegisterCODEC(TIFFCodec*);
LIBTIFF_DLL_IMPEXP int TIFFIsCODECConfigured(uint16);
LIBTIFF_DLL_IMPEXP TIFFCodec* TIFFGetConfiguredCODECs(void);
/*
* Auxiliary functions.
*/
LIBTIFF_DLL_IMPEXP tdata_t _TIFFmalloc(tsize_t);
LIBTIFF_DLL_IMPEXP tdata_t _TIFFrealloc(tdata_t, tsize_t);
LIBTIFF_DLL_IMPEXP void _TIFFmemset(tdata_t, int, tsize_t);
LIBTIFF_DLL_IMPEXP void _TIFFmemcpy(tdata_t, const tdata_t, tsize_t);
LIBTIFF_DLL_IMPEXP int _TIFFmemcmp(const tdata_t, const tdata_t, tsize_t);
LIBTIFF_DLL_IMPEXP void _TIFFfree(tdata_t);
/*
** Stuff, related to tag handling and creating custom tags.
*/
LIBTIFF_DLL_IMPEXP int TIFFGetTagListCount( TIFF * );
LIBTIFF_DLL_IMPEXP ttag_t TIFFGetTagListEntry( TIFF *, int tag_index );
#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
#define TIFF_VARIABLE -1 /* marker for variable length tags */
#define TIFF_SPP -2 /* marker for SamplesPerPixel tags */
#define TIFF_VARIABLE2 -3 /* marker for uint32 var-length tags */
#define FIELD_CUSTOM 65
typedef struct {
ttag_t field_tag; /* field's tag */
short field_readcount; /* read count/TIFF_VARIABLE/TIFF_SPP */
short field_writecount; /* write count/TIFF_VARIABLE */
TIFFDataType field_type; /* type of associated data */
unsigned short field_bit; /* bit in fieldsset bit vector */
unsigned char field_oktochange; /* if true, can change while writing */
unsigned char field_passcount; /* if true, pass dir count on set */
char *field_name; /* ASCII name */
} TIFFFieldInfo;
typedef struct _TIFFTagValue {
const TIFFFieldInfo *info;
int count;
void *value;
} TIFFTagValue;
LIBTIFF_DLL_IMPEXP void TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], int);
LIBTIFF_DLL_IMPEXP const TIFFFieldInfo* TIFFFindFieldInfo(TIFF*, ttag_t, TIFFDataType);
LIBTIFF_DLL_IMPEXP const TIFFFieldInfo* TIFFFindFieldInfoByName(TIFF* , const char *,
TIFFDataType);
LIBTIFF_DLL_IMPEXP const TIFFFieldInfo* TIFFFieldWithTag(TIFF*, ttag_t);
LIBTIFF_DLL_IMPEXP const TIFFFieldInfo* TIFFFieldWithName(TIFF*, const char *);
typedef int (*TIFFVSetMethod)(TIFF*, ttag_t, va_list);
typedef int (*TIFFVGetMethod)(TIFF*, ttag_t, va_list);
typedef void (*TIFFPrintMethod)(TIFF*, FILE*, long);
typedef struct {
TIFFVSetMethod vsetfield; /* tag set routine */
TIFFVGetMethod vgetfield; /* tag get routine */
TIFFPrintMethod printdir; /* directory print routine */
} TIFFTagMethods;
LIBTIFF_DLL_IMPEXP TIFFTagMethods *TIFFAccessTagMethods( TIFF * );
LIBTIFF_DLL_IMPEXP void *TIFFGetClientInfo( TIFF *, const char * );
LIBTIFF_DLL_IMPEXP void TIFFSetClientInfo( TIFF *, void *, const char * );
LIBTIFF_DLL_IMPEXP void TIFFCleanup(TIFF*);
LIBTIFF_DLL_IMPEXP void TIFFClose(TIFF*);
LIBTIFF_DLL_IMPEXP int TIFFFlush(TIFF*);
LIBTIFF_DLL_IMPEXP int TIFFFlushData(TIFF*);
LIBTIFF_DLL_IMPEXP int TIFFGetField(TIFF*, ttag_t, ...);
LIBTIFF_DLL_IMPEXP int TIFFVGetField(TIFF*, ttag_t, va_list);
LIBTIFF_DLL_IMPEXP int TIFFGetFieldDefaulted(TIFF*, ttag_t, ...);
LIBTIFF_DLL_IMPEXP int TIFFVGetFieldDefaulted(TIFF*, ttag_t, va_list);
LIBTIFF_DLL_IMPEXP int TIFFReadDirectory(TIFF*);
LIBTIFF_DLL_IMPEXP int TIFFReadCustomDirectory(TIFF*, toff_t, const TIFFFieldInfo[],
size_t);
LIBTIFF_DLL_IMPEXP int TIFFReadEXIFDirectory(TIFF*, toff_t);
LIBTIFF_DLL_IMPEXP tsize_t TIFFScanlineSize(TIFF*);
LIBTIFF_DLL_IMPEXP tsize_t TIFFRasterScanlineSize(TIFF*);
LIBTIFF_DLL_IMPEXP tsize_t TIFFStripSize(TIFF*);
LIBTIFF_DLL_IMPEXP tsize_t TIFFRawStripSize(TIFF*, tstrip_t);
LIBTIFF_DLL_IMPEXP tsize_t TIFFVStripSize(TIFF*, uint32);
LIBTIFF_DLL_IMPEXP tsize_t TIFFTileRowSize(TIFF*);
LIBTIFF_DLL_IMPEXP tsize_t TIFFTileSize(TIFF*);
LIBTIFF_DLL_IMPEXP tsize_t TIFFVTileSize(TIFF*, uint32);
LIBTIFF_DLL_IMPEXP uint32 TIFFDefaultStripSize(TIFF*, uint32);
LIBTIFF_DLL_IMPEXP void TIFFDefaultTileSize(TIFF*, uint32*, uint32*);
LIBTIFF_DLL_IMPEXP int TIFFFileno(TIFF*);
LIBTIFF_DLL_IMPEXP int TIFFSetFileno(TIFF*, int);
LIBTIFF_DLL_IMPEXP thandle_t TIFFClientdata(TIFF*);
LIBTIFF_DLL_IMPEXP thandle_t TIFFSetClientdata(TIFF*, thandle_t);
LIBTIFF_DLL_IMPEXP int TIFFGetMode(TIFF*);
LIBTIFF_DLL_IMPEXP int TIFFSetMode(TIFF*, int);
LIBTIFF_DLL_IMPEXP int TIFFIsTiled(TIFF*);
LIBTIFF_DLL_IMPEXP int TIFFIsByteSwapped(TIFF*);
LIBTIFF_DLL_IMPEXP int TIFFIsUpSampled(TIFF*);
LIBTIFF_DLL_IMPEXP int TIFFIsMSB2LSB(TIFF*);
LIBTIFF_DLL_IMPEXP int TIFFIsBigEndian(TIFF*);
LIBTIFF_DLL_IMPEXP TIFFReadWriteProc TIFFGetReadProc(TIFF*);
LIBTIFF_DLL_IMPEXP TIFFReadWriteProc TIFFGetWriteProc(TIFF*);
LIBTIFF_DLL_IMPEXP TIFFSeekProc TIFFGetSeekProc(TIFF*);
LIBTIFF_DLL_IMPEXP TIFFCloseProc TIFFGetCloseProc(TIFF*);
LIBTIFF_DLL_IMPEXP TIFFSizeProc TIFFGetSizeProc(TIFF*);
LIBTIFF_DLL_IMPEXP TIFFMapFileProc TIFFGetMapFileProc(TIFF*);
LIBTIFF_DLL_IMPEXP TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF*);
LIBTIFF_DLL_IMPEXP uint32 TIFFCurrentRow(TIFF*);
LIBTIFF_DLL_IMPEXP tdir_t TIFFCurrentDirectory(TIFF*);
LIBTIFF_DLL_IMPEXP tdir_t TIFFNumberOfDirectories(TIFF*);
LIBTIFF_DLL_IMPEXP uint32 TIFFCurrentDirOffset(TIFF*);
LIBTIFF_DLL_IMPEXP tstrip_t TIFFCurrentStrip(TIFF*);
LIBTIFF_DLL_IMPEXP ttile_t TIFFCurrentTile(TIFF*);
LIBTIFF_DLL_IMPEXP int TIFFReadBufferSetup(TIFF*, tdata_t, tsize_t);
LIBTIFF_DLL_IMPEXP int TIFFWriteBufferSetup(TIFF*, tdata_t, tsize_t);
LIBTIFF_DLL_IMPEXP int TIFFSetupStrips(TIFF *);
LIBTIFF_DLL_IMPEXP int TIFFWriteCheck(TIFF*, int, const char *);
LIBTIFF_DLL_IMPEXP void TIFFFreeDirectory(TIFF*);
LIBTIFF_DLL_IMPEXP int TIFFCreateDirectory(TIFF*);
LIBTIFF_DLL_IMPEXP int TIFFLastDirectory(TIFF*);
LIBTIFF_DLL_IMPEXP int TIFFSetDirectory(TIFF*, tdir_t);
LIBTIFF_DLL_IMPEXP int TIFFSetSubDirectory(TIFF*, uint32);
LIBTIFF_DLL_IMPEXP int TIFFUnlinkDirectory(TIFF*, tdir_t);
LIBTIFF_DLL_IMPEXP int TIFFSetField(TIFF*, ttag_t, ...);
LIBTIFF_DLL_IMPEXP int TIFFVSetField(TIFF*, ttag_t, va_list);
LIBTIFF_DLL_IMPEXP int TIFFWriteDirectory(TIFF *);
LIBTIFF_DLL_IMPEXP int TIFFCheckpointDirectory(TIFF *);
LIBTIFF_DLL_IMPEXP int TIFFRewriteDirectory(TIFF *);
LIBTIFF_DLL_IMPEXP int TIFFReassignTagToIgnore(enum TIFFIgnoreSense, int);
#if defined(c_plusplus) || defined(__cplusplus)
LIBTIFF_DLL_IMPEXP void TIFFPrintDirectory(TIFF*, FILE*, long = 0);
LIBTIFF_DLL_IMPEXP int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t = 0);
LIBTIFF_DLL_IMPEXP int TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t = 0);
LIBTIFF_DLL_IMPEXP int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int = 0);
LIBTIFF_DLL_IMPEXP int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*,
int = ORIENTATION_BOTLEFT, int = 0);
#else
LIBTIFF_DLL_IMPEXP void TIFFPrintDirectory(TIFF*, FILE*, long);
LIBTIFF_DLL_IMPEXP int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t);
LIBTIFF_DLL_IMPEXP int TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t);
LIBTIFF_DLL_IMPEXP int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int);
LIBTIFF_DLL_IMPEXP int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, int, int);
#endif
LIBTIFF_DLL_IMPEXP int TIFFReadRGBAStrip(TIFF*, tstrip_t, uint32 * );
LIBTIFF_DLL_IMPEXP int TIFFReadRGBATile(TIFF*, uint32, uint32, uint32 * );
LIBTIFF_DLL_IMPEXP int TIFFRGBAImageOK(TIFF*, char [1024]);
LIBTIFF_DLL_IMPEXP int TIFFRGBAImageBegin(TIFFRGBAImage*, TIFF*, int, char [1024]);
LIBTIFF_DLL_IMPEXP int TIFFRGBAImageGet(TIFFRGBAImage*, uint32*, uint32, uint32);
LIBTIFF_DLL_IMPEXP void TIFFRGBAImageEnd(TIFFRGBAImage*);
LIBTIFF_DLL_IMPEXP TIFF* TIFFOpen(const char*, const char*);
# ifdef __WIN32__
LIBTIFF_DLL_IMPEXP TIFF* TIFFOpenW(const wchar_t*, const char*);
# endif /* __WIN32__ */
LIBTIFF_DLL_IMPEXP TIFF* TIFFFdOpen(int, const char*, const char*);
LIBTIFF_DLL_IMPEXP TIFF* TIFFClientOpen(const char*, const char*,
thandle_t,
TIFFReadWriteProc, TIFFReadWriteProc,
TIFFSeekProc, TIFFCloseProc,
TIFFSizeProc,
TIFFMapFileProc, TIFFUnmapFileProc);
LIBTIFF_DLL_IMPEXP const char* TIFFFileName(TIFF*);
LIBTIFF_DLL_IMPEXP const char* TIFFSetFileName(TIFF*, const char *);
LIBTIFF_DLL_IMPEXP void TIFFError(const char*, const char*, ...);
LIBTIFF_DLL_IMPEXP void TIFFErrorExt(thandle_t, const char*, const char*, ...);
LIBTIFF_DLL_IMPEXP void TIFFWarning(const char*, const char*, ...);
LIBTIFF_DLL_IMPEXP void TIFFWarningExt(thandle_t, const char*, const char*, ...);
LIBTIFF_DLL_IMPEXP TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler);
LIBTIFF_DLL_IMPEXP TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt);
LIBTIFF_DLL_IMPEXP TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler);
LIBTIFF_DLL_IMPEXP TIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt);
LIBTIFF_DLL_IMPEXP TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc);
LIBTIFF_DLL_IMPEXP ttile_t TIFFComputeTile(TIFF*, uint32, uint32, uint32, tsample_t);
LIBTIFF_DLL_IMPEXP int TIFFCheckTile(TIFF*, uint32, uint32, uint32, tsample_t);
LIBTIFF_DLL_IMPEXP ttile_t TIFFNumberOfTiles(TIFF*);
LIBTIFF_DLL_IMPEXP tsize_t TIFFReadTile(TIFF*,
tdata_t, uint32, uint32, uint32, tsample_t);
LIBTIFF_DLL_IMPEXP tsize_t TIFFWriteTile(TIFF*,
tdata_t, uint32, uint32, uint32, tsample_t);
LIBTIFF_DLL_IMPEXP tstrip_t TIFFComputeStrip(TIFF*, uint32, tsample_t);
LIBTIFF_DLL_IMPEXP tstrip_t TIFFNumberOfStrips(TIFF*);
LIBTIFF_DLL_IMPEXP tsize_t TIFFReadEncodedStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
LIBTIFF_DLL_IMPEXP tsize_t TIFFReadRawStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
LIBTIFF_DLL_IMPEXP tsize_t TIFFReadEncodedTile(TIFF*, ttile_t, tdata_t, tsize_t);
LIBTIFF_DLL_IMPEXP tsize_t TIFFReadRawTile(TIFF*, ttile_t, tdata_t, tsize_t);
LIBTIFF_DLL_IMPEXP tsize_t TIFFWriteEncodedStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
LIBTIFF_DLL_IMPEXP tsize_t TIFFWriteRawStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
LIBTIFF_DLL_IMPEXP tsize_t TIFFWriteEncodedTile(TIFF*, ttile_t, tdata_t, tsize_t);
LIBTIFF_DLL_IMPEXP tsize_t TIFFWriteRawTile(TIFF*, ttile_t, tdata_t, tsize_t);
LIBTIFF_DLL_IMPEXP int TIFFDataWidth(TIFFDataType); /* table of tag datatype widths */
LIBTIFF_DLL_IMPEXP void TIFFSetWriteOffset(TIFF*, toff_t);
LIBTIFF_DLL_IMPEXP void TIFFSwabShort(uint16*);
LIBTIFF_DLL_IMPEXP void TIFFSwabLong(uint32*);
LIBTIFF_DLL_IMPEXP void TIFFSwabDouble(double*);
LIBTIFF_DLL_IMPEXP void TIFFSwabArrayOfShort(uint16*, unsigned long);
LIBTIFF_DLL_IMPEXP void TIFFSwabArrayOfTriples(uint8*, unsigned long);
LIBTIFF_DLL_IMPEXP void TIFFSwabArrayOfLong(uint32*, unsigned long);
LIBTIFF_DLL_IMPEXP void TIFFSwabArrayOfDouble(double*, unsigned long);
LIBTIFF_DLL_IMPEXP void TIFFReverseBits(unsigned char *, unsigned long);
LIBTIFF_DLL_IMPEXP const unsigned char* TIFFGetBitRevTable(int);
#ifdef LOGLUV_PUBLIC
#define U_NEU 0.210526316
#define V_NEU 0.473684211
#define UVSCALE 410.
LIBTIFF_DLL_IMPEXP double LogL16toY(int);
LIBTIFF_DLL_IMPEXP double LogL10toY(int);
LIBTIFF_DLL_IMPEXP void XYZtoRGB24(float*, uint8*);
LIBTIFF_DLL_IMPEXP int uv_decode(double*, double*, int);
LIBTIFF_DLL_IMPEXP void LogLuv24toXYZ(uint32, float*);
LIBTIFF_DLL_IMPEXP void LogLuv32toXYZ(uint32, float*);
#if defined(c_plusplus) || defined(__cplusplus)
LIBTIFF_DLL_IMPEXP int LogL16fromY(double, int = SGILOGENCODE_NODITHER);
LIBTIFF_DLL_IMPEXP int LogL10fromY(double, int = SGILOGENCODE_NODITHER);
LIBTIFF_DLL_IMPEXP int uv_encode(double, double, int = SGILOGENCODE_NODITHER);
LIBTIFF_DLL_IMPEXP uint32 LogLuv24fromXYZ(float*, int = SGILOGENCODE_NODITHER);
LIBTIFF_DLL_IMPEXP uint32 LogLuv32fromXYZ(float*, int = SGILOGENCODE_NODITHER);
#else
LIBTIFF_DLL_IMPEXP int LogL16fromY(double, int);
LIBTIFF_DLL_IMPEXP int LogL10fromY(double, int);
LIBTIFF_DLL_IMPEXP int uv_encode(double, double, int);
LIBTIFF_DLL_IMPEXP uint32 LogLuv24fromXYZ(float*, int);
LIBTIFF_DLL_IMPEXP uint32 LogLuv32fromXYZ(float*, int);
#endif
#endif /* LOGLUV_PUBLIC */
LIBTIFF_DLL_IMPEXP int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, TIFFDisplay *, float*);
LIBTIFF_DLL_IMPEXP void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32, int32, int32,
float *, float *, float *);
LIBTIFF_DLL_IMPEXP void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float,
uint32 *, uint32 *, uint32 *);
LIBTIFF_DLL_IMPEXP int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*);
LIBTIFF_DLL_IMPEXP void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32, int32, int32,
uint32 *, uint32 *, uint32 *);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* _TIFFIO_ */
/* vim: set ts=8 sts=8 sw=8 noet: */

@ -0,0 +1,9 @@
#define TIFFLIB_VERSION_STR "LIBTIFF, Version 3.8.2\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
/*
* This define can be used in code that requires
* compilation-related definitions specific to a
* version or versions of the library. Runtime
* version checking should be done based on the
* string returned by TIFFGetVersion.
*/
#define TIFFLIB_VERSION 20060323

@ -0,0 +1,332 @@
/* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2005 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#ifndef ZCONF_H
#define ZCONF_H
/*
* If you *really* need a unique prefix for all types and library functions,
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
*/
#ifdef Z_PREFIX
# define deflateInit_ z_deflateInit_
# define deflate z_deflate
# define deflateEnd z_deflateEnd
# define inflateInit_ z_inflateInit_
# define inflate z_inflate
# define inflateEnd z_inflateEnd
# define deflateInit2_ z_deflateInit2_
# define deflateSetDictionary z_deflateSetDictionary
# define deflateCopy z_deflateCopy
# define deflateReset z_deflateReset
# define deflateParams z_deflateParams
# define deflateBound z_deflateBound
# define deflatePrime z_deflatePrime
# define inflateInit2_ z_inflateInit2_
# define inflateSetDictionary z_inflateSetDictionary
# define inflateSync z_inflateSync
# define inflateSyncPoint z_inflateSyncPoint
# define inflateCopy z_inflateCopy
# define inflateReset z_inflateReset
# define inflateBack z_inflateBack
# define inflateBackEnd z_inflateBackEnd
# define compress z_compress
# define compress2 z_compress2
# define compressBound z_compressBound
# define uncompress z_uncompress
# define adler32 z_adler32
# define crc32 z_crc32
# define get_crc_table z_get_crc_table
# define zError z_zError
# define alloc_func z_alloc_func
# define free_func z_free_func
# define in_func z_in_func
# define out_func z_out_func
# define Byte z_Byte
# define uInt z_uInt
# define uLong z_uLong
# define Bytef z_Bytef
# define charf z_charf
# define intf z_intf
# define uIntf z_uIntf
# define uLongf z_uLongf
# define voidpf z_voidpf
# define voidp z_voidp
#endif
#if defined(__MSDOS__) && !defined(MSDOS)
# define MSDOS
#endif
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
# define OS2
#endif
#if defined(_WINDOWS) && !defined(WINDOWS)
# define WINDOWS
#endif
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
# ifndef WIN32
# define WIN32
# endif
#endif
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
# ifndef SYS16BIT
# define SYS16BIT
# endif
# endif
#endif
/*
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
* than 64k bytes at a time (needed on systems with 16-bit int).
*/
#ifdef SYS16BIT
# define MAXSEG_64K
#endif
#ifdef MSDOS
# define UNALIGNED_OK
#endif
#ifdef __STDC_VERSION__
# ifndef STDC
# define STDC
# endif
# if __STDC_VERSION__ >= 199901L
# ifndef STDC99
# define STDC99
# endif
# endif
#endif
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
# define STDC
#endif
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
# define STDC
#endif
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
# define STDC
#endif
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
# define STDC
#endif
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
# define STDC
#endif
#ifndef STDC
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
# define const /* note: need a more gentle solution here */
# endif
#endif
/* Some Mac compilers merge all .h files incorrectly: */
#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
# define NO_DUMMY_DECL
#endif
/* Maximum value for memLevel in deflateInit2 */
#ifndef MAX_MEM_LEVEL
# ifdef MAXSEG_64K
# define MAX_MEM_LEVEL 8
# else
# define MAX_MEM_LEVEL 9
# endif
#endif
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
* created by gzip. (Files created by minigzip can still be extracted by
* gzip.)
*/
#ifndef MAX_WBITS
# define MAX_WBITS 15 /* 32K LZ77 window */
#endif
/* The memory requirements for deflate are (in bytes):
(1 << (windowBits+2)) + (1 << (memLevel+9))
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
plus a few kilobytes for small objects. For example, if you want to reduce
the default memory requirements from 256K to 128K, compile with
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
Of course this will generally degrade compression (there's no free lunch).
The memory requirements for inflate are (in bytes) 1 << windowBits
that is, 32K for windowBits=15 (default value) plus a few kilobytes
for small objects.
*/
/* Type declarations */
#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args
# else
# define OF(args) ()
# endif
#endif
/* The following definitions for FAR are needed only for MSDOS mixed
* model programming (small or medium model with some far allocations).
* This was tested only with MSC; for other MSDOS compilers you may have
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
* just define FAR to be empty.
*/
#ifdef SYS16BIT
# if defined(M_I86SM) || defined(M_I86MM)
/* MSC small or medium model */
# define SMALL_MEDIUM
# ifdef _MSC_VER
# define FAR _far
# else
# define FAR far
# endif
# endif
# if (defined(__SMALL__) || defined(__MEDIUM__))
/* Turbo C small or medium model */
# define SMALL_MEDIUM
# ifdef __BORLANDC__
# define FAR _far
# else
# define FAR far
# endif
# endif
#endif
#if defined(WINDOWS) || defined(WIN32)
/* If building or using zlib as a DLL, define ZLIB_DLL.
* This is not mandatory, but it offers a little performance increase.
*/
# ifdef ZLIB_DLL
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
# ifdef ZLIB_INTERNAL
# define ZEXTERN extern __declspec(dllexport)
# else
# define ZEXTERN extern __declspec(dllimport)
# endif
# endif
# endif /* ZLIB_DLL */
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
* define ZLIB_WINAPI.
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
*/
# ifdef ZLIB_WINAPI
# ifdef FAR
# undef FAR
# endif
# include <windows.h>
/* No need for _export, use ZLIB.DEF instead. */
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
# define ZEXPORT WINAPI
# ifdef WIN32
# define ZEXPORTVA WINAPIV
# else
# define ZEXPORTVA FAR CDECL
# endif
# endif
#endif
#if defined (__BEOS__)
# ifdef ZLIB_DLL
# ifdef ZLIB_INTERNAL
# define ZEXPORT __declspec(dllexport)
# define ZEXPORTVA __declspec(dllexport)
# else
# define ZEXPORT __declspec(dllimport)
# define ZEXPORTVA __declspec(dllimport)
# endif
# endif
#endif
#ifndef ZEXTERN
# define ZEXTERN extern
#endif
#ifndef ZEXPORT
# define ZEXPORT
#endif
#ifndef ZEXPORTVA
# define ZEXPORTVA
#endif
#ifndef FAR
# define FAR
#endif
#if !defined(__MACTYPES__)
typedef unsigned char Byte; /* 8 bits */
#endif
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */
#ifdef SMALL_MEDIUM
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
# define Bytef Byte FAR
#else
typedef Byte FAR Bytef;
#endif
typedef char FAR charf;
typedef int FAR intf;
typedef uInt FAR uIntf;
typedef uLong FAR uLongf;
#ifdef STDC
typedef void const *voidpc;
typedef void FAR *voidpf;
typedef void *voidp;
#else
typedef Byte const *voidpc;
typedef Byte FAR *voidpf;
typedef Byte *voidp;
#endif
#if defined(HAVE_UNISTD_H) /* HAVE_UNISTD_H -- this line is updated by ./configure */
# include <sys/types.h> /* for off_t */
# include <unistd.h> /* for SEEK_* and off_t */
# ifdef VMS
# include <unixio.h> /* for off_t */
# endif
# define z_off_t off_t
#endif
#ifndef SEEK_SET
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif
#ifndef z_off_t
# define z_off_t long
#endif
#if defined(__OS400__)
# define NO_vsnprintf
#endif
#if defined(__MVS__)
# define NO_vsnprintf
# ifdef FAR
# undef FAR
# endif
#endif
/* MVS linker does not support external names larger than 8 bytes */
#if defined(__MVS__)
# pragma map(deflateInit_,"DEIN")
# pragma map(deflateInit2_,"DEIN2")
# pragma map(deflateEnd,"DEEND")
# pragma map(deflateBound,"DEBND")
# pragma map(inflateInit_,"ININ")
# pragma map(inflateInit2_,"ININ2")
# pragma map(inflateEnd,"INEND")
# pragma map(inflateSync,"INSY")
# pragma map(inflateSetDictionary,"INSEDI")
# pragma map(compressBound,"CMBND")
# pragma map(inflate_table,"INTABL")
# pragma map(inflate_fast,"INFA")
# pragma map(inflate_copyright,"INCOPY")
#endif
#endif /* ZCONF_H */

File diff suppressed because it is too large Load Diff

Binary file not shown.

@ -0,0 +1,103 @@
; h:\mingw\3.3.1\bin\dlltool.exe --output-def=jpeg.def jcapimin.o jcapistd.o jctrans.o jcparam.o jdatadst.o jcinit.o jcmaster.o jcmarker.o jcmainct.o jcprepct.o jccoefct.o jccolor.o jcsample.o jchuff.o jcphuff.o jcdctmgr.o jfdctfst.o jfdctflt.o jfdctint.o jdapimin.o jdapistd.o jdtrans.o jdatasrc.o jdmaster.o jdinput.o jdmarker.o jdhuff.o jdphuff.o jdmainct.o jdcoefct.o jdpostct.o jddctmgr.o jidctfst.o jidctflt.o jidctint.o jidctred.o jdsample.o jdcolor.o jquant1.o jquant2.o jdmerge.o jcomapi.o jutils.o jerror.o jmemmgr.o jmemnobs.o jpeg-dllversion.o jpeg-dll-res.o
EXPORTS
jcopy_block_row @ 1 ;
jcopy_sample_rows @ 2 ;
jdiv_round_up @ 3 ;
jinit_1pass_quantizer @ 4 ;
jinit_2pass_quantizer @ 5 ;
jinit_c_coef_controller @ 6 ;
jinit_c_main_controller @ 7 ;
jinit_c_master_control @ 8 ;
jinit_c_prep_controller @ 9 ;
jinit_color_converter @ 10 ;
jinit_color_deconverter @ 11 ;
jinit_compress_master @ 12 ;
jinit_d_coef_controller @ 13 ;
jinit_d_main_controller @ 14 ;
jinit_d_post_controller @ 15 ;
jinit_downsampler @ 16 ;
jinit_forward_dct @ 17 ;
jinit_huff_decoder @ 18 ;
jinit_huff_encoder @ 19 ;
jinit_input_controller @ 20 ;
jinit_inverse_dct @ 21 ;
jinit_marker_reader @ 22 ;
jinit_marker_writer @ 23 ;
jinit_master_decompress @ 24 ;
jinit_memory_mgr @ 25 ;
jinit_merged_upsampler @ 26 ;
jinit_phuff_decoder @ 27 ;
jinit_phuff_encoder @ 28 ;
jinit_upsampler @ 29 ;
jpeg_CreateCompress @ 30 ;
jpeg_CreateDecompress @ 31 ;
jpeg_abort @ 32 ;
jpeg_abort_compress @ 33 ;
jpeg_abort_decompress @ 34 ;
jpeg_add_quant_table @ 35 ;
jpeg_alloc_huff_table @ 36 ;
jpeg_alloc_quant_table @ 37 ;
jpeg_calc_output_dimensions @ 38 ;
jpeg_consume_input @ 39 ;
jpeg_copy_critical_parameters @ 40 ;
jpeg_default_colorspace @ 41 ;
jpeg_destroy @ 42 ;
jpeg_destroy_compress @ 43 ;
jpeg_destroy_decompress @ 44 ;
jpeg_fdct_float @ 45 ;
jpeg_fdct_ifast @ 46 ;
jpeg_fdct_islow @ 47 ;
jpeg_fill_bit_buffer @ 48 ;
jpeg_finish_compress @ 49 ;
jpeg_finish_decompress @ 50 ;
jpeg_finish_output @ 51 ;
jpeg_free_large @ 52 ;
jpeg_free_small @ 53 ;
jpeg_gen_optimal_table @ 54 ;
jpeg_get_large @ 55 ;
jpeg_get_small @ 56 ;
jpeg_has_multiple_scans @ 57 ;
jpeg_huff_decode @ 58 ;
jpeg_idct_1x1 @ 59 ;
jpeg_idct_2x2 @ 60 ;
jpeg_idct_4x4 @ 61 ;
jpeg_idct_float @ 62 ;
jpeg_idct_ifast @ 63 ;
jpeg_idct_islow @ 64 ;
jpeg_input_complete @ 65 ;
jpeg_make_c_derived_tbl @ 66 ;
jpeg_make_d_derived_tbl @ 67 ;
jpeg_mem_available @ 68 ;
jpeg_mem_init @ 69 ;
jpeg_mem_term @ 70 ;
jpeg_new_colormap @ 71 ;
jpeg_open_backing_store @ 72 ;
jpeg_quality_scaling @ 73 ;
jpeg_read_coefficients @ 74 ;
jpeg_read_header @ 75 ;
jpeg_read_raw_data @ 76 ;
jpeg_read_scanlines @ 77 ;
jpeg_resync_to_restart @ 78 ;
jpeg_save_markers @ 79 ;
jpeg_set_colorspace @ 80 ;
jpeg_set_defaults @ 81 ;
jpeg_set_linear_quality @ 82 ;
jpeg_set_marker_processor @ 83 ;
jpeg_set_quality @ 84 ;
jpeg_simple_progression @ 85 ;
jpeg_start_compress @ 86 ;
jpeg_start_decompress @ 87 ;
jpeg_start_output @ 88 ;
jpeg_std_error @ 89 ;
jpeg_stdio_dest @ 90 ;
jpeg_stdio_src @ 91 ;
jpeg_suppress_tables @ 92 ;
jpeg_write_coefficients @ 93 ;
jpeg_write_m_byte @ 94 ;
jpeg_write_m_header @ 95 ;
jpeg_write_marker @ 96 ;
jpeg_write_raw_data @ 97 ;
jpeg_write_scanlines @ 98 ;
jpeg_write_tables @ 99 ;
jround_up @ 100 ;
jzero_far @ 101 ;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,372 @@
; h:\mingw\3.3.1\bin\dlltool.exe --export-all-symbols --output-def=libpng.def png.dll.o pngset.dll.o pngget.dll.o pngrutil.dll.o pngtrans.dll.o pngwutil.dll.o pngread.dll.o pngrio.dll.o pngwio.dll.o pngwrite.dll.o pngrtran.dll.o pngwtran.dll.o pngmem.dll.o pngerror.dll.o pngpread.dll.o pnggccrd.dll.o libpng-dllversion.dll.o libpng-dll-res.o
EXPORTS
ActiveMask @ 1 DATA ;
ActiveMask2 @ 2 DATA ;
ActiveMaskEnd @ 3 DATA ;
DllGetVersion @ 4 ;
HBClearMask @ 5 DATA ;
LBCarryMask @ 6 DATA ;
ShiftBpp @ 7 DATA ;
ShiftRem @ 8 DATA ;
png_IDAT @ 9 DATA ;
png_IEND @ 10 DATA ;
png_IHDR @ 11 DATA ;
png_PLTE @ 12 DATA ;
png_access_version_number @ 13 ;
png_bKGD @ 14 DATA ;
png_build_gamma_table @ 15 ;
png_build_grayscale_palette @ 16 ;
png_cHRM @ 17 DATA ;
png_calculate_crc @ 18 ;
png_check_chunk_name @ 19 ;
png_check_keyword @ 20 ;
png_check_sig @ 21 ;
png_chunk_error @ 22 ;
png_chunk_warning @ 23 ;
png_combine_row @ 24 ;
png_convert_from_struct_tm @ 25 ;
png_convert_from_time_t @ 26 ;
png_convert_to_rfc1123 @ 27 ;
png_crc_error @ 28 ;
png_crc_finish @ 29 ;
png_crc_read @ 30 ;
png_create_info_struct @ 31 ;
png_create_read_struct @ 32 ;
png_create_read_struct_2 @ 33 ;
png_create_struct @ 34 ;
png_create_struct_2 @ 35 ;
png_create_write_struct @ 36 ;
png_create_write_struct_2 @ 37 ;
png_data_freer @ 38 ;
png_decompress_chunk @ 39 ;
png_default_flush @ 40 ;
png_default_read_data @ 41 ;
png_default_write_data @ 42 ;
png_destroy_info_struct @ 43 ;
png_destroy_read_struct @ 44 ;
png_destroy_struct @ 45 ;
png_destroy_struct_2 @ 46 ;
png_destroy_write_struct @ 47 ;
png_do_background @ 48 ;
png_do_bgr @ 49 ;
png_do_chop @ 50 ;
png_do_dither @ 51 ;
png_do_expand @ 52 ;
png_do_expand_palette @ 53 ;
png_do_gamma @ 54 ;
png_do_gray_to_rgb @ 55 ;
png_do_invert @ 56 ;
png_do_pack @ 57 ;
png_do_packswap @ 58 ;
png_do_read_filler @ 59 ;
png_do_read_interlace @ 60 ;
png_do_read_intrapixel @ 61 ;
png_do_read_invert_alpha @ 62 ;
png_do_read_swap_alpha @ 63 ;
png_do_read_transformations @ 64 ;
png_do_rgb_to_gray @ 65 ;
png_do_shift @ 66 ;
png_do_strip_filler @ 67 ;
png_do_swap @ 68 ;
png_do_unpack @ 69 ;
png_do_unshift @ 70 ;
png_do_write_interlace @ 71 ;
png_do_write_intrapixel @ 72 ;
png_do_write_invert_alpha @ 73 ;
png_do_write_swap_alpha @ 74 ;
png_do_write_transformations @ 75 ;
png_error @ 76 ;
png_flush @ 77 ;
png_free @ 78 ;
png_free_data @ 79 ;
png_free_default @ 80 ;
png_gAMA @ 81 DATA ;
png_get_IHDR @ 82 ;
png_get_PLTE @ 83 ;
png_get_asm_flagmask @ 84 ;
png_get_asm_flags @ 85 ;
png_get_bKGD @ 86 ;
png_get_bit_depth @ 87 ;
png_get_cHRM @ 88 ;
png_get_cHRM_fixed @ 89 ;
png_get_channels @ 90 ;
png_get_color_type @ 91 ;
png_get_compression_buffer_size @ 92 ;
png_get_compression_type @ 93 ;
png_get_copyright @ 94 ;
png_get_error_ptr @ 95 ;
png_get_filter_type @ 96 ;
png_get_gAMA @ 97 ;
png_get_gAMA_fixed @ 98 ;
png_get_hIST @ 99 ;
png_get_header_ver @ 100 ;
png_get_header_version @ 101 ;
png_get_iCCP @ 102 ;
png_get_image_height @ 103 ;
png_get_image_width @ 104 ;
png_get_int_32 @ 105 ;
png_get_interlace_type @ 106 ;
png_get_io_ptr @ 107 ;
png_get_libpng_ver @ 108 ;
png_get_mem_ptr @ 109 ;
png_get_mmx_bitdepth_threshold @ 110 ;
png_get_mmx_flagmask @ 111 ;
png_get_mmx_rowbytes_threshold @ 112 ;
png_get_oFFs @ 113 ;
png_get_pCAL @ 114 ;
png_get_pHYs @ 115 ;
png_get_pixel_aspect_ratio @ 116 ;
png_get_pixels_per_meter @ 117 ;
png_get_progressive_ptr @ 118 ;
png_get_rgb_to_gray_status @ 119 ;
png_get_rowbytes @ 120 ;
png_get_rows @ 121 ;
png_get_sBIT @ 122 ;
png_get_sCAL @ 123 ;
png_get_sPLT @ 124 ;
png_get_sRGB @ 125 ;
png_get_signature @ 126 ;
png_get_tIME @ 127 ;
png_get_tRNS @ 128 ;
png_get_text @ 129 ;
png_get_uint_16 @ 130 ;
png_get_uint_31 @ 131 ;
png_get_uint_32 @ 132 ;
png_get_unknown_chunks @ 133 ;
png_get_user_chunk_ptr @ 134 ;
png_get_user_height_max @ 135 ;
png_get_user_transform_ptr @ 136 ;
png_get_user_width_max @ 137 ;
png_get_valid @ 138 ;
png_get_x_offset_microns @ 139 ;
png_get_x_offset_pixels @ 140 ;
png_get_x_pixels_per_meter @ 141 ;
png_get_y_offset_microns @ 142 ;
png_get_y_offset_pixels @ 143 ;
png_get_y_pixels_per_meter @ 144 ;
png_hIST @ 145 DATA ;
png_handle_IEND @ 146 ;
png_handle_IHDR @ 147 ;
png_handle_PLTE @ 148 ;
png_handle_as_unknown @ 149 ;
png_handle_bKGD @ 150 ;
png_handle_cHRM @ 151 ;
png_handle_gAMA @ 152 ;
png_handle_hIST @ 153 ;
png_handle_iCCP @ 154 ;
png_handle_oFFs @ 155 ;
png_handle_pCAL @ 156 ;
png_handle_pHYs @ 157 ;
png_handle_sBIT @ 158 ;
png_handle_sCAL @ 159 ;
png_handle_sPLT @ 160 ;
png_handle_sRGB @ 161 ;
png_handle_tEXt @ 162 ;
png_handle_tIME @ 163 ;
png_handle_tRNS @ 164 ;
png_handle_unknown @ 165 ;
png_handle_zTXt @ 166 ;
png_iCCP @ 167 DATA ;
png_iTXt @ 168 DATA ;
png_info_destroy @ 169 ;
png_info_init @ 170 ;
png_info_init_3 @ 171 ;
png_init_io @ 172 ;
png_init_mmx_flags @ 173 ;
png_init_read_transformations @ 174 ;
png_libpng_ver @ 175 DATA ;
png_malloc @ 176 ;
png_malloc_default @ 177 ;
png_malloc_warn @ 178 ;
png_memcpy_check @ 179 ;
png_memset_check @ 180 ;
png_mmx_support @ 181 ;
png_oFFs @ 182 DATA ;
png_pCAL @ 183 DATA ;
png_pHYs @ 184 DATA ;
png_pass_dsp_mask @ 185 DATA ;
png_pass_inc @ 186 DATA ;
png_pass_mask @ 187 DATA ;
png_pass_start @ 188 DATA ;
png_pass_width @ 189 DATA ;
png_pass_yinc @ 190 DATA ;
png_pass_ystart @ 191 DATA ;
png_permit_empty_plte @ 192 ;
png_permit_mng_features @ 193 ;
png_process_IDAT_data @ 194 ;
png_process_data @ 195 ;
png_process_some_data @ 196 ;
png_progressive_combine_row @ 197 ;
png_push_crc_finish @ 198 ;
png_push_crc_skip @ 199 ;
png_push_fill_buffer @ 200 ;
png_push_handle_tEXt @ 201 ;
png_push_handle_unknown @ 202 ;
png_push_handle_zTXt @ 203 ;
png_push_have_end @ 204 ;
png_push_have_info @ 205 ;
png_push_have_row @ 206 ;
png_push_process_row @ 207 ;
png_push_read_IDAT @ 208 ;
png_push_read_chunk @ 209 ;
png_push_read_sig @ 210 ;
png_push_read_tEXt @ 211 ;
png_push_read_zTXt @ 212 ;
png_push_restore_buffer @ 213 ;
png_push_save_buffer @ 214 ;
png_read_data @ 215 ;
png_read_destroy @ 216 ;
png_read_end @ 217 ;
png_read_filter_row @ 218 ;
png_read_finish_row @ 219 ;
png_read_image @ 220 ;
png_read_info @ 221 ;
png_read_init @ 222 ;
png_read_init_2 @ 223 ;
png_read_init_3 @ 224 ;
png_read_png @ 225 ;
png_read_push_finish_row @ 226 ;
png_read_row @ 227 ;
png_read_rows @ 228 ;
png_read_start_row @ 229 ;
png_read_transform_info @ 230 ;
png_read_update_info @ 231 ;
png_reset_crc @ 232 ;
png_reset_zstream @ 233 ;
png_sBIT @ 234 DATA ;
png_sCAL @ 235 DATA ;
png_sPLT @ 236 DATA ;
png_sRGB @ 237 DATA ;
png_save_int_32 @ 238 ;
png_save_uint_16 @ 239 ;
png_save_uint_32 @ 240 ;
png_set_IHDR @ 241 ;
png_set_PLTE @ 242 ;
png_set_add_alpha @ 243 ;
png_set_asm_flags @ 244 ;
png_set_bKGD @ 245 ;
png_set_background @ 246 ;
png_set_bgr @ 247 ;
png_set_cHRM @ 248 ;
png_set_cHRM_fixed @ 249 ;
png_set_compression_buffer_size @ 250 ;
png_set_compression_level @ 251 ;
png_set_compression_mem_level @ 252 ;
png_set_compression_method @ 253 ;
png_set_compression_strategy @ 254 ;
png_set_compression_window_bits @ 255 ;
png_set_crc_action @ 256 ;
png_set_dither @ 257 ;
png_set_error_fn @ 258 ;
png_set_expand @ 259 ;
png_set_filler @ 260 ;
png_set_filter @ 261 ;
png_set_filter_heuristics @ 262 ;
png_set_flush @ 263 ;
png_set_gAMA @ 264 ;
png_set_gAMA_fixed @ 265 ;
png_set_gamma @ 266 ;
png_set_gray_1_2_4_to_8 @ 267 ;
png_set_gray_to_rgb @ 268 ;
png_set_hIST @ 269 ;
png_set_iCCP @ 270 ;
png_set_interlace_handling @ 271 ;
png_set_invalid @ 272 ;
png_set_invert_alpha @ 273 ;
png_set_invert_mono @ 274 ;
png_set_keep_unknown_chunks @ 275 ;
png_set_mem_fn @ 276 ;
png_set_mmx_thresholds @ 277 ;
png_set_oFFs @ 278 ;
png_set_pCAL @ 279 ;
png_set_pHYs @ 280 ;
png_set_packing @ 281 ;
png_set_packswap @ 282 ;
png_set_palette_to_rgb @ 283 ;
png_set_progressive_read_fn @ 284 ;
png_set_read_fn @ 285 ;
png_set_read_status_fn @ 286 ;
png_set_read_user_chunk_fn @ 287 ;
png_set_read_user_transform_fn @ 288 ;
png_set_rgb_to_gray @ 289 ;
png_set_rgb_to_gray_fixed @ 290 ;
png_set_rows @ 291 ;
png_set_sBIT @ 292 ;
png_set_sCAL @ 293 ;
png_set_sPLT @ 294 ;
png_set_sRGB @ 295 ;
png_set_sRGB_gAMA_and_cHRM @ 296 ;
png_set_shift @ 297 ;
png_set_sig_bytes @ 298 ;
png_set_strip_16 @ 299 ;
png_set_strip_alpha @ 300 ;
png_set_strip_error_numbers @ 301 ;
png_set_swap @ 302 ;
png_set_swap_alpha @ 303 ;
png_set_tIME @ 304 ;
png_set_tRNS @ 305 ;
png_set_tRNS_to_alpha @ 306 ;
png_set_text @ 307 ;
png_set_text_2 @ 308 ;
png_set_unknown_chunk_location @ 309 ;
png_set_unknown_chunks @ 310 ;
png_set_user_limits @ 311 ;
png_set_user_transform_info @ 312 ;
png_set_write_fn @ 313 ;
png_set_write_status_fn @ 314 ;
png_set_write_user_transform_fn @ 315 ;
png_sig @ 316 DATA ;
png_sig_cmp @ 317 ;
png_squelch_warnings @ 318 ;
png_start_read_image @ 319 ;
png_tEXt @ 320 DATA ;
png_tIME @ 321 DATA ;
png_tRNS @ 322 DATA ;
png_warning @ 323 ;
png_write_IDAT @ 324 ;
png_write_IEND @ 325 ;
png_write_IHDR @ 326 ;
png_write_PLTE @ 327 ;
png_write_bKGD @ 328 ;
png_write_cHRM @ 329 ;
png_write_cHRM_fixed @ 330 ;
png_write_chunk @ 331 ;
png_write_chunk_data @ 332 ;
png_write_chunk_end @ 333 ;
png_write_chunk_start @ 334 ;
png_write_data @ 335 ;
png_write_destroy @ 336 ;
png_write_end @ 337 ;
png_write_filtered_row @ 338 ;
png_write_find_filter @ 339 ;
png_write_finish_row @ 340 ;
png_write_flush @ 341 ;
png_write_gAMA @ 342 ;
png_write_gAMA_fixed @ 343 ;
png_write_hIST @ 344 ;
png_write_iCCP @ 345 ;
png_write_image @ 346 ;
png_write_info @ 347 ;
png_write_info_before_PLTE @ 348 ;
png_write_init @ 349 ;
png_write_init_2 @ 350 ;
png_write_init_3 @ 351 ;
png_write_oFFs @ 352 ;
png_write_pCAL @ 353 ;
png_write_pHYs @ 354 ;
png_write_png @ 355 ;
png_write_row @ 356 ;
png_write_rows @ 357 ;
png_write_sBIT @ 358 ;
png_write_sCAL @ 359 ;
png_write_sPLT @ 360 ;
png_write_sRGB @ 361 ;
png_write_sig @ 362 ;
png_write_start_row @ 363 ;
png_write_tEXt @ 364 ;
png_write_tIME @ 365 ;
png_write_tRNS @ 366 ;
png_write_zTXt @ 367 ;
png_zTXt @ 368 DATA ;
png_zalloc @ 369 ;
png_zfree @ 370 ;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,154 @@
; g:\mingw\3.3.1\bin\dlltool.exe --output-def=libtiff.def tif_aux.o tif_close.o tif_codec.o tif_color.o tif_compress.o tif_dir.o tif_dirinfo.o tif_dirread.o tif_dirwrite.o tif_dumpmode.o tif_error.o tif_extension.o tif_fax3.o tif_fax3sm.o tif_flush.o tif_getimage.o tif_jpeg.o tif_luv.o tif_lzw.o tif_next.o tif_ojpeg.o tif_open.o tif_packbits.o tif_pixarlog.o tif_predict.o tif_print.o tif_read.o tif_strip.o tif_swab.o tif_thunder.o tif_tile.o tif_unix.o tif_version.o tif_warning.o tif_write.o tif_zip.o libtiff-dllversion.o libtiff-dll-res.o
EXPORTS
DllGetVersion @ 1 ;
LogL10fromY @ 2 ;
LogL10toY @ 3 ;
LogL16fromY @ 4 ;
LogL16toY @ 5 ;
LogLuv24fromXYZ @ 6 ;
LogLuv24toXYZ @ 7 ;
LogLuv32fromXYZ @ 8 ;
LogLuv32toXYZ @ 9 ;
TIFFAccessTagMethods @ 10 ;
TIFFCIELabToRGBInit @ 11 ;
TIFFCIELabToXYZ @ 12 ;
TIFFCheckTile @ 13 ;
TIFFCheckpointDirectory @ 14 ;
TIFFCleanup @ 15 ;
TIFFClientOpen @ 16 ;
TIFFClientdata @ 17 ;
TIFFClose @ 18 ;
TIFFComputeStrip @ 19 ;
TIFFComputeTile @ 20 ;
TIFFCreateDirectory @ 21 ;
TIFFCurrentDirOffset @ 22 ;
TIFFCurrentDirectory @ 23 ;
TIFFCurrentRow @ 24 ;
TIFFCurrentStrip @ 25 ;
TIFFCurrentTile @ 26 ;
TIFFDataWidth @ 27 ;
TIFFDefaultStripSize @ 28 ;
TIFFDefaultTileSize @ 29 ;
TIFFError @ 30 ;
TIFFErrorExt @ 31 ;
TIFFFdOpen @ 32 ;
TIFFFieldWithName @ 33 ;
TIFFFieldWithTag @ 34 ;
TIFFFileName @ 35 ;
TIFFFileno @ 36 ;
TIFFFindCODEC @ 37 ;
TIFFFindFieldInfo @ 38 ;
TIFFFindFieldInfoByName @ 39 ;
TIFFFlush @ 40 ;
TIFFFlushData @ 41 ;
TIFFFreeDirectory @ 42 ;
TIFFGetBitRevTable @ 43 ;
TIFFGetClientInfo @ 44 ;
TIFFGetCloseProc @ 45 ;
TIFFGetConfiguredCODECs @ 46 ;
TIFFGetField @ 47 ;
TIFFGetFieldDefaulted @ 48 ;
TIFFGetMapFileProc @ 49 ;
TIFFGetMode @ 50 ;
TIFFGetReadProc @ 51 ;
TIFFGetSeekProc @ 52 ;
TIFFGetSizeProc @ 53 ;
TIFFGetTagListCount @ 54 ;
TIFFGetTagListEntry @ 55 ;
TIFFGetUnmapFileProc @ 56 ;
TIFFGetVersion @ 57 ;
TIFFGetWriteProc @ 58 ;
TIFFIsBigEndian @ 59 ;
TIFFIsByteSwapped @ 60 ;
TIFFIsCODECConfigured @ 61 ;
TIFFIsMSB2LSB @ 62 ;
TIFFIsTiled @ 63 ;
TIFFIsUpSampled @ 64 ;
TIFFLastDirectory @ 65 ;
TIFFMergeFieldInfo @ 66 ;
TIFFNumberOfDirectories @ 67 ;
TIFFNumberOfStrips @ 68 ;
TIFFNumberOfTiles @ 69 ;
TIFFOpen @ 70 ;
TIFFOpenW @ 71 ;
TIFFPrintDirectory @ 72 ;
TIFFRGBAImageBegin @ 73 ;
TIFFRGBAImageEnd @ 74 ;
TIFFRGBAImageGet @ 75 ;
TIFFRGBAImageOK @ 76 ;
TIFFRasterScanlineSize @ 77 ;
TIFFRawStripSize @ 78 ;
TIFFReadBufferSetup @ 79 ;
TIFFReadCustomDirectory @ 80 ;
TIFFReadDirectory @ 81 ;
TIFFReadEXIFDirectory @ 82 ;
TIFFReadEncodedStrip @ 83 ;
TIFFReadEncodedTile @ 84 ;
TIFFReadRGBAImage @ 85 ;
TIFFReadRGBAImageOriented @ 86 ;
TIFFReadRGBAStrip @ 87 ;
TIFFReadRGBATile @ 88 ;
TIFFReadRawStrip @ 89 ;
TIFFReadRawTile @ 90 ;
TIFFReadScanline @ 91 ;
TIFFReadTile @ 92 ;
TIFFReassignTagToIgnore @ 93 ;
TIFFRegisterCODEC @ 94 ;
TIFFReverseBits @ 95 ;
TIFFRewriteDirectory @ 96 ;
TIFFScanlineSize @ 97 ;
TIFFSetClientInfo @ 98 ;
TIFFSetClientdata @ 99 ;
TIFFSetDirectory @ 100 ;
TIFFSetErrorHandler @ 101 ;
TIFFSetErrorHandlerExt @ 102 ;
TIFFSetField @ 103 ;
TIFFSetFileName @ 104 ;
TIFFSetFileno @ 105 ;
TIFFSetMode @ 106 ;
TIFFSetSubDirectory @ 107 ;
TIFFSetTagExtender @ 108 ;
TIFFSetWarningHandler @ 109 ;
TIFFSetWarningHandlerExt @ 110 ;
TIFFSetWriteOffset @ 111 ;
TIFFSetupStrips @ 112 ;
TIFFStripSize @ 113 ;
TIFFSwabArrayOfDouble @ 114 ;
TIFFSwabArrayOfLong @ 115 ;
TIFFSwabArrayOfShort @ 116 ;
TIFFSwabArrayOfTriples @ 117 ;
TIFFSwabDouble @ 118 ;
TIFFSwabLong @ 119 ;
TIFFSwabShort @ 120 ;
TIFFTileRowSize @ 121 ;
TIFFTileSize @ 122 ;
TIFFUnRegisterCODEC @ 123 ;
TIFFUnlinkDirectory @ 124 ;
TIFFVGetField @ 125 ;
TIFFVGetFieldDefaulted @ 126 ;
TIFFVSetField @ 127 ;
TIFFVStripSize @ 128 ;
TIFFVTileSize @ 129 ;
TIFFWarning @ 130 ;
TIFFWarningExt @ 131 ;
TIFFWriteBufferSetup @ 132 ;
TIFFWriteCheck @ 133 ;
TIFFWriteDirectory @ 134 ;
TIFFWriteEncodedStrip @ 135 ;
TIFFWriteEncodedTile @ 136 ;
TIFFWriteRawStrip @ 137 ;
TIFFWriteRawTile @ 138 ;
TIFFWriteScanline @ 139 ;
TIFFWriteTile @ 140 ;
TIFFXYZToRGB @ 141 ;
TIFFYCbCrToRGBInit @ 142 ;
TIFFYCbCrtoRGB @ 143 ;
XYZtoRGB24 @ 144 ;
_TIFFfree @ 145 ;
_TIFFmalloc @ 146 ;
_TIFFmemcmp @ 147 ;
_TIFFmemcpy @ 148 ;
_TIFFmemset @ 149 ;
_TIFFrealloc @ 150 ;
uv_decode @ 151 ;
uv_encode @ 152 ;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,75 @@
; h:\mingw\3.3.1\bin\dlltool.exe --export-all-symbols --output-def=zlib.def adler32.pic.o compress.pic.o crc32.pic.o gzio.pic.o uncompr.pic.o deflate.pic.o trees.pic.o zutil.pic.o inflate.pic.o infback.pic.o inftrees.pic.o inffast.pic.o zlib-dllversion.o zlib-dll-res.o
EXPORTS
DllGetVersion @ 1 ;
_dist_code @ 2 DATA ;
_length_code @ 3 DATA ;
_tr_align @ 4 ;
_tr_flush_block @ 5 ;
_tr_init @ 6 ;
_tr_stored_block @ 7 ;
_tr_tally @ 8 ;
adler32 @ 9 ;
adler32_combine @ 10 ;
compress @ 11 ;
compress2 @ 12 ;
compressBound @ 13 ;
crc32 @ 14 ;
crc32_combine @ 15 ;
deflate @ 16 ;
deflateBound @ 17 ;
deflateCopy @ 18 ;
deflateEnd @ 19 ;
deflateInit2_ @ 20 ;
deflateInit_ @ 21 ;
deflateParams @ 22 ;
deflatePrime @ 23 ;
deflateReset @ 24 ;
deflateSetDictionary @ 25 ;
deflateSetHeader @ 26 ;
deflateTune @ 27 ;
deflate_copyright @ 28 DATA ;
get_crc_table @ 29 ;
gzclearerr @ 30 ;
gzclose @ 31 ;
gzdirect @ 32 ;
gzdopen @ 33 ;
gzeof @ 34 ;
gzerror @ 35 ;
gzflush @ 36 ;
gzgetc @ 37 ;
gzgets @ 38 ;
gzopen @ 39 ;
gzprintf @ 40 ;
gzputc @ 41 ;
gzputs @ 42 ;
gzread @ 43 ;
gzrewind @ 44 ;
gzseek @ 45 ;
gzsetparams @ 46 ;
gztell @ 47 ;
gzungetc @ 48 ;
gzwrite @ 49 ;
inflate @ 50 ;
inflateBack @ 51 ;
inflateBackEnd @ 52 ;
inflateBackInit_ @ 53 ;
inflateCopy @ 54 ;
inflateEnd @ 55 ;
inflateGetHeader @ 56 ;
inflateInit2_ @ 57 ;
inflateInit_ @ 58 ;
inflatePrime @ 59 ;
inflateReset @ 60 ;
inflateSetDictionary @ 61 ;
inflateSync @ 62 ;
inflateSyncPoint @ 63 ;
inflate_copyright @ 64 DATA ;
inflate_fast @ 65 ;
inflate_table @ 66 ;
uncompress @ 67 ;
zError @ 68 ;
z_errmsg @ 69 DATA ;
zcalloc @ 70 ;
zcfree @ 71 ;
zlibCompileFlags @ 72 ;
zlibVersion @ 73 ;

Binary file not shown.

@ -0,0 +1,690 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="nvcompress"
ProjectGUID="{88079E38-83AA-4E8A-B18A-66A78D1B058B}"
RootNamespace="nvcompress"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(ConfigurationName)\$(PlatformName)"
IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libpng.lib jpeg.lib tiff.lib"
OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\gnuwin32\lib"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(ConfigurationName)\$(PlatformName)"
IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;..\..\..\src"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVDXT_SHARED"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\gnuwin32\lib"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(ConfigurationName)\$(PlatformName)"
IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libpng.lib jpeg.lib tiff.lib"
OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\gnuwin32\lib"
GenerateDebugInformation="false"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(ConfigurationName)\$(PlatformName)"
IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..;..\..\..\src"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVDXT_SHARED"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\gnuwin32\lib"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug (no cuda)|Win32"
OutputDirectory="$(ConfigurationName)\$(PlatformName)"
IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libpng.lib jpeg.lib tiff.lib"
OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\gnuwin32\lib"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug (no cuda)|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;..\..\..\src"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NVDXT_SHARED"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\gnuwin32\lib"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release (no cuda)|Win32"
OutputDirectory="$(ConfigurationName)\$(PlatformName)"
IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libpng.lib jpeg.lib tiff.lib"
OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\gnuwin32\lib"
GenerateDebugInformation="false"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release (no cuda)|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
WholeProgramOptimization="true"
AdditionalIncludeDirectories="..;..\..\..\src"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NVDXT_SHARED"
RuntimeLibrary="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).exe"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\gnuwin32\lib"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
LinkTimeCodeGeneration="1"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\..\src\nvimage\nvtt\compress.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\..\..\src\nvimage\nvtt\cmdline.h"
>
</File>
<File
RelativePath=".\resource.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath=".\nvcompress.rc"
>
</File>
<File
RelativePath=".\nvidia.ico"
DeploymentContent="true"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

@ -0,0 +1,16 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by nvcompress.rc
//
#define IDI_ICON1 101
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

@ -0,0 +1,16 @@
#ifndef NV_CONFIG
#define NV_CONFIG
//#cmakedefine HAVE_UNISTD_H
#define HAVE_STDARG_H
//#cmakedefine HAVE_SIGNAL_H
//#cmakedefine HAVE_EXECINFO_H
#define HAVE_MALLOC_H
#if !defined(_M_X64)
#define HAVE_PNG
#define HAVE_JPEG
//#define HAVE_TIFF
#endif
#endif // NV_CONFIG

@ -0,0 +1,330 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="nvcore"
ProjectGUID="{F143D180-D4C4-4037-B3DE-BE89A21C8D1D}"
RootNamespace="nvcore"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(ConfigurationName)\$(PlatformName)"
IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
ConfigurationType="4"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;..\..\..\src"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(ConfigurationName)\$(PlatformName)"
IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
ConfigurationType="4"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..;..\..\..\src"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;..\..\..\src"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..;..\..\..\src"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\..\src\nvcore\Debug.cpp"
>
</File>
<File
RelativePath="..\..\..\src\nvcore\Memory.cpp"
>
</File>
<File
RelativePath="..\..\..\src\nvcore\StrLib.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\..\..\src\nvcore\Containers.h"
>
</File>
<File
RelativePath="..\..\..\src\nvcore\Debug.h"
>
</File>
<File
RelativePath="..\..\..\src\nvcore\DefsVcWin32.h"
>
</File>
<File
RelativePath="..\..\..\src\nvcore\Memory.h"
>
</File>
<File
RelativePath="..\nvconfig.h"
>
</File>
<File
RelativePath="..\..\..\src\nvcore\nvcore.h"
>
</File>
<File
RelativePath="..\..\..\src\nvcore\StrLib.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

@ -0,0 +1,362 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="nvimage"
ProjectGUID="{4046F392-A18B-4C66-9639-3EABFFF5D531}"
RootNamespace="nvimage"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(ConfigurationName)\$(PlatformName)"
IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
ConfigurationType="4"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(ConfigurationName)\$(PlatformName)"
IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
ConfigurationType="4"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\..\src\nvimage\ColorBlock.cpp"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\DirectDrawSurface.cpp"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\Filter.cpp"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\FloatImage.cpp"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\Image.cpp"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\ImageIO.cpp"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\NormalMap.cpp"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\Quantize.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\..\..\src\nvimage\ColorBlock.h"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\DirectDrawSurface.h"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\Filter.h"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\FloatImage.h"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\Image.h"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\ImageIO.h"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\NormalMap.h"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvimage.h"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\Quantize.h"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\TgaFile.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

@ -0,0 +1,322 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="nvmath"
ProjectGUID="{50C465FE-B308-42BC-894D-89484482AF06}"
RootNamespace="nvmath"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(ConfigurationName)\$(PlatformName)"
IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
ConfigurationType="4"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;..\..\..\src"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(ConfigurationName)\$(PlatformName)"
IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
ConfigurationType="4"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..;..\..\..\src"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;..\..\..\src"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..;..\..\..\src"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\..\src\nvmath\Eigen.cpp"
>
</File>
<File
RelativePath="..\..\..\src\nvmath\Fitting.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\..\..\src\nvmath\Box.h"
>
</File>
<File
RelativePath="..\..\..\src\nvmath\Color.h"
>
</File>
<File
RelativePath="..\..\..\src\nvmath\Eigen.h"
>
</File>
<File
RelativePath="..\..\..\src\nvmath\Fitting.h"
>
</File>
<File
RelativePath="..\..\..\src\nvmath\Matrix.h"
>
</File>
<File
RelativePath="..\..\..\src\nvmath\Vector.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

@ -0,0 +1,127 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvtt", "nvtt\nvtt.vcproj", "{1AEB7681-57D8-48EE-813D-5C41CC38B647}"
ProjectSection(ProjectDependencies) = postProject
{50C465FE-B308-42BC-894D-89484482AF06} = {50C465FE-B308-42BC-894D-89484482AF06}
{4046F392-A18B-4C66-9639-3EABFFF5D531} = {4046F392-A18B-4C66-9639-3EABFFF5D531}
{F143D180-D4C4-4037-B3DE-BE89A21C8D1D} = {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}
{CE017322-01FC-4851-9C8B-64E9A8E26C38} = {CE017322-01FC-4851-9C8B-64E9A8E26C38}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvcompress", "nvcompress\nvcompress.vcproj", "{88079E38-83AA-4E8A-B18A-66A78D1B058B}"
ProjectSection(ProjectDependencies) = postProject
{F143D180-D4C4-4037-B3DE-BE89A21C8D1D} = {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}
{1AEB7681-57D8-48EE-813D-5C41CC38B647} = {1AEB7681-57D8-48EE-813D-5C41CC38B647}
{4046F392-A18B-4C66-9639-3EABFFF5D531} = {4046F392-A18B-4C66-9639-3EABFFF5D531}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvimage", "nvimage\nvimage.vcproj", "{4046F392-A18B-4C66-9639-3EABFFF5D531}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvcore", "nvcore\nvcore.vcproj", "{F143D180-D4C4-4037-B3DE-BE89A21C8D1D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvmath", "nvmath\nvmath.vcproj", "{50C465FE-B308-42BC-894D-89484482AF06}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "squish", "squish\squish.vcproj", "{CE017322-01FC-4851-9C8B-64E9A8E26C38}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug (no cuda)|Win32 = Debug (no cuda)|Win32
Debug (no cuda)|x64 = Debug (no cuda)|x64
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release (no cuda)|Win32 = Release (no cuda)|Win32
Release (no cuda)|x64 = Release (no cuda)|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug (no cuda)|Win32.ActiveCfg = Debug (no cuda)|Win32
{1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug (no cuda)|Win32.Build.0 = Debug (no cuda)|Win32
{1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug (no cuda)|x64.ActiveCfg = Debug (no cuda)|x64
{1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug (no cuda)|x64.Build.0 = Debug (no cuda)|x64
{1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug|Win32.ActiveCfg = Debug|Win32
{1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug|Win32.Build.0 = Debug|Win32
{1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug|x64.ActiveCfg = Debug|x64
{1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release (no cuda)|Win32.ActiveCfg = Release (no cuda)|Win32
{1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release (no cuda)|Win32.Build.0 = Release (no cuda)|Win32
{1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release (no cuda)|x64.ActiveCfg = Release (no cuda)|x64
{1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release (no cuda)|x64.Build.0 = Release (no cuda)|x64
{1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release|Win32.ActiveCfg = Release|Win32
{1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release|Win32.Build.0 = Release|Win32
{1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release|x64.ActiveCfg = Release|x64
{88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug (no cuda)|Win32.ActiveCfg = Debug (no cuda)|Win32
{88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug (no cuda)|Win32.Build.0 = Debug (no cuda)|Win32
{88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug (no cuda)|x64.ActiveCfg = Debug (no cuda)|x64
{88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug (no cuda)|x64.Build.0 = Debug (no cuda)|x64
{88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug|Win32.ActiveCfg = Debug|Win32
{88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug|Win32.Build.0 = Debug|Win32
{88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug|x64.ActiveCfg = Debug|x64
{88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release (no cuda)|Win32.ActiveCfg = Release (no cuda)|Win32
{88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release (no cuda)|Win32.Build.0 = Release (no cuda)|Win32
{88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release (no cuda)|x64.ActiveCfg = Release (no cuda)|x64
{88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release (no cuda)|x64.Build.0 = Release (no cuda)|x64
{88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release|Win32.ActiveCfg = Release|Win32
{88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release|Win32.Build.0 = Release|Win32
{88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release|x64.ActiveCfg = Release|x64
{4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32
{4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug (no cuda)|Win32.Build.0 = Debug|Win32
{4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug (no cuda)|x64.ActiveCfg = Debug|x64
{4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug (no cuda)|x64.Build.0 = Debug|x64
{4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug|Win32.ActiveCfg = Debug|Win32
{4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug|Win32.Build.0 = Debug|Win32
{4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug|x64.ActiveCfg = Debug|x64
{4046F392-A18B-4C66-9639-3EABFFF5D531}.Release (no cuda)|Win32.ActiveCfg = Release|Win32
{4046F392-A18B-4C66-9639-3EABFFF5D531}.Release (no cuda)|Win32.Build.0 = Release|Win32
{4046F392-A18B-4C66-9639-3EABFFF5D531}.Release (no cuda)|x64.ActiveCfg = Release|x64
{4046F392-A18B-4C66-9639-3EABFFF5D531}.Release (no cuda)|x64.Build.0 = Release|x64
{4046F392-A18B-4C66-9639-3EABFFF5D531}.Release|Win32.ActiveCfg = Release|Win32
{4046F392-A18B-4C66-9639-3EABFFF5D531}.Release|Win32.Build.0 = Release|Win32
{4046F392-A18B-4C66-9639-3EABFFF5D531}.Release|x64.ActiveCfg = Release|x64
{F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32
{F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug (no cuda)|Win32.Build.0 = Debug|Win32
{F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug (no cuda)|x64.ActiveCfg = Debug|x64
{F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug (no cuda)|x64.Build.0 = Debug|x64
{F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug|Win32.ActiveCfg = Debug|Win32
{F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug|Win32.Build.0 = Debug|Win32
{F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug|x64.ActiveCfg = Debug|x64
{F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release (no cuda)|Win32.ActiveCfg = Release|Win32
{F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release (no cuda)|Win32.Build.0 = Release|Win32
{F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release (no cuda)|x64.ActiveCfg = Release|x64
{F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release (no cuda)|x64.Build.0 = Release|x64
{F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release|Win32.ActiveCfg = Release|Win32
{F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release|Win32.Build.0 = Release|Win32
{F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release|x64.ActiveCfg = Release|x64
{50C465FE-B308-42BC-894D-89484482AF06}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32
{50C465FE-B308-42BC-894D-89484482AF06}.Debug (no cuda)|Win32.Build.0 = Debug|Win32
{50C465FE-B308-42BC-894D-89484482AF06}.Debug (no cuda)|x64.ActiveCfg = Debug|x64
{50C465FE-B308-42BC-894D-89484482AF06}.Debug (no cuda)|x64.Build.0 = Debug|x64
{50C465FE-B308-42BC-894D-89484482AF06}.Debug|Win32.ActiveCfg = Debug|Win32
{50C465FE-B308-42BC-894D-89484482AF06}.Debug|Win32.Build.0 = Debug|Win32
{50C465FE-B308-42BC-894D-89484482AF06}.Debug|x64.ActiveCfg = Debug|x64
{50C465FE-B308-42BC-894D-89484482AF06}.Release (no cuda)|Win32.ActiveCfg = Release|Win32
{50C465FE-B308-42BC-894D-89484482AF06}.Release (no cuda)|Win32.Build.0 = Release|Win32
{50C465FE-B308-42BC-894D-89484482AF06}.Release (no cuda)|x64.ActiveCfg = Release|x64
{50C465FE-B308-42BC-894D-89484482AF06}.Release (no cuda)|x64.Build.0 = Release|x64
{50C465FE-B308-42BC-894D-89484482AF06}.Release|Win32.ActiveCfg = Release|Win32
{50C465FE-B308-42BC-894D-89484482AF06}.Release|Win32.Build.0 = Release|Win32
{50C465FE-B308-42BC-894D-89484482AF06}.Release|x64.ActiveCfg = Release|x64
{CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32
{CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug (no cuda)|Win32.Build.0 = Debug|Win32
{CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug (no cuda)|x64.ActiveCfg = Debug|x64
{CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug (no cuda)|x64.Build.0 = Debug|x64
{CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug|Win32.ActiveCfg = Debug|Win32
{CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug|Win32.Build.0 = Debug|Win32
{CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug|x64.ActiveCfg = Debug|x64
{CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release (no cuda)|Win32.ActiveCfg = Release|Win32
{CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release (no cuda)|Win32.Build.0 = Release|Win32
{CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release (no cuda)|x64.ActiveCfg = Release|x64
{CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release (no cuda)|x64.Build.0 = Release|x64
{CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release|Win32.ActiveCfg = Release|Win32
{CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release|Win32.Build.0 = Release|Win32
{CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release|x64.ActiveCfg = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

@ -0,0 +1,102 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,9,3,0
PRODUCTVERSION 0,9,3,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "NVIDIA Corporation"
VALUE "FileDescription", "NVIDIA Texture Tools Dynamic Link Library"
VALUE "FileVersion", "0, 9, 3, 0"
VALUE "InternalName", "nvtt"
VALUE "LegalCopyright", "Copyright (C) 2007"
VALUE "OriginalFilename", "nvtt.dll"
VALUE "ProductName", "NVIDIA Texture Tools Dynamic Link Library"
VALUE "ProductVersion", "0, 9, 3, 0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

@ -0,0 +1,824 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="nvtt"
ProjectGUID="{1AEB7681-57D8-48EE-813D-5C41CC38B647}"
RootNamespace="nvtt"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(ConfigurationName)\$(PlatformName)"
IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
ConfigurationType="2"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include;$(CUDA_INC_PATH)"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;NVTT_EXPORTS;NVTT_SHARED;HAVE_CUDA;__SSE2__;__SSE__;__MMX__"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libpng.lib jpeg.lib tiff.lib cudart.lib"
OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).dll"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\gnuwin32\lib;$(CUDA_LIB_PATH)"
GenerateDebugInformation="true"
SubSystem="2"
ImportLibrary="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\lib\$(ProjectName).lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(ConfigurationName)\$(PlatformName)"
IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
ConfigurationType="2"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;NVTT_EXPORTS;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libpng.lib jpeg.lib tiff.lib"
OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).dll"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\gnuwin32\lib"
GenerateDebugInformation="true"
SubSystem="2"
ImportLibrary="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\lib\$(ProjectName).lib"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(ConfigurationName)\$(PlatformName)"
IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
ConfigurationType="2"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
EnableIntrinsicFunctions="true"
OmitFramePointers="true"
AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include;$(CUDA_INC_PATH)"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;NVTT_EXPORTS;NVTT_SHARED;HAVE_CUDA;__SSE2__;__SSE__;__MMX__"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libpng.lib jpeg.lib tiff.lib cudart.lib"
OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).dll"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\gnuwin32\lib;$(CUDA_LIB_PATH)"
GenerateDebugInformation="false"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\lib\$(ProjectName).lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(ConfigurationName)\$(PlatformName)"
IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
ConfigurationType="2"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
EnableIntrinsicFunctions="true"
OmitFramePointers="true"
AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;NVTT_EXPORTS;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libpng.lib jpeg.lib tiff.lib"
OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).dll"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\gnuwin32\lib"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\lib\$(ProjectName).lib"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug (no cuda)|Win32"
OutputDirectory="$(ConfigurationName)\$(PlatformName)"
IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
ConfigurationType="2"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include;"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;NVTT_EXPORTS;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libpng.lib jpeg.lib tiff.lib"
OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).dll"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\gnuwin32\lib;"
GenerateDebugInformation="true"
SubSystem="2"
ImportLibrary="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\lib\$(ProjectName).lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug (no cuda)|x64"
OutputDirectory="$(ConfigurationName)\$(PlatformName)"
IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
ConfigurationType="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;NVTT_EXPORTS;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libpng.lib jpeg.lib tiff.lib"
OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).dll"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\gnuwin32\lib"
GenerateDebugInformation="true"
SubSystem="2"
ImportLibrary="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\lib\$(ProjectName).lib"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release (no cuda)|Win32"
OutputDirectory="$(ConfigurationName)\$(PlatformName)"
IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
ConfigurationType="2"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
EnableIntrinsicFunctions="true"
OmitFramePointers="true"
AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include;"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;NVTT_EXPORTS;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libpng.lib jpeg.lib tiff.lib"
OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).dll"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\gnuwin32\lib;"
GenerateDebugInformation="false"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\lib\$(ProjectName).lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release (no cuda)|x64"
OutputDirectory="$(ConfigurationName)\$(PlatformName)"
IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
ConfigurationType="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
EnableIntrinsicFunctions="true"
OmitFramePointers="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;NVTT_EXPORTS;NVTT_SHARED;__SSE2__;__SSE__;__MMX__"
RuntimeLibrary="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libpng.lib jpeg.lib tiff.lib"
OutputFile="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\bin\$(ProjectName).dll"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\gnuwin32\lib"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
LinkTimeCodeGeneration="1"
ImportLibrary="$(SolutionDir)\$(ConfigurationName).$(PlatformName)\lib\$(ProjectName).lib"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\..\src\nvimage\nvtt\BlockDXT.cpp"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\CompressDXT.cpp"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\CompressionOptions.cpp"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\cuda\CompressKernel.cu"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="$(CUDA_BIN_PATH)\nvcc.exe -ccbin &quot;$(VCInstallDir)bin&quot; -c -D_DEBUG -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Wp64,/Od,/Zi,/RTC1,/MDd -I&quot;$(CUDA_INC_PATH)&quot; -I./ -o $(IntDir)\$(InputName).obj ..\\..\\..\\src\\nvimage\\nvtt\\cuda\\CompressKernel.cu&#x0D;&#x0A;"
AdditionalDependencies="CudaMath.h"
Outputs="$(IntDir)\$(InputName).obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="$(CUDA_BIN_PATH)\nvcc.exe -ccbin &quot;$(VCInstallDir)bin&quot; -c -DNDEBUG -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Wp64,/O2,/Zi,/MD -I&quot;$(CUDA_INC_PATH)&quot; -I./ -o $(IntDir)\$(InputName).obj ..\\..\\..\\src\\nvimage\\nvtt\\cuda\\CompressKernel.cu&#x0D;&#x0A;"
AdditionalDependencies="CudaMath.h"
Outputs="$(IntDir)\$(InputName).obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug (no cuda)|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="$(CUDA_BIN_PATH)\nvcc.exe -ccbin &quot;$(VCInstallDir)bin&quot; -c -D_DEBUG -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Wp64,/Od,/Zi,/RTC1,/MDd -I&quot;$(CUDA_INC_PATH)&quot; -I./ -o $(IntDir)\$(InputName).obj ..\\..\\..\\src\\nvimage\\nvtt\\cuda\\CompressKernel.cu&#x0D;&#x0A;"
AdditionalDependencies="CudaMath.h"
Outputs="$(IntDir)\$(InputName).obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Release (no cuda)|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="$(CUDA_BIN_PATH)\nvcc.exe -ccbin &quot;$(VCInstallDir)bin&quot; -c -DNDEBUG -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Wp64,/O2,/Zi,/MD -I&quot;$(CUDA_INC_PATH)&quot; -I./ -o $(IntDir)\$(InputName).obj ..\\..\\..\\src\\nvimage\\nvtt\\cuda\\CompressKernel.cu&#x0D;&#x0A;"
AdditionalDependencies="CudaMath.h"
Outputs="$(IntDir)\$(InputName).obj"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\CompressRGB.cpp"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\cuda\CudaCompressDXT.cpp"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\cuda\CudaUtils.cpp"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\dxtlib.cpp"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\FastCompressDXT.cpp"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\InputOptions.cpp"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\OutputOptions.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\..\..\src\nvimage\nvtt\BlockDXT.h"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\CompressDXT.h"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\CompressionOptions.h"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\CompressRGB.h"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\cuda\CudaCompressDXT.h"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\cuda\CudaMath.h"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\cuda\CudaUtils.h"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\FastCompressDXT.h"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\InputOptions.h"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\nvtt.h"
>
</File>
<File
RelativePath=".\resource.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath=".\nvtt.rc"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

@ -0,0 +1,14 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by nvtt.rc
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

@ -0,0 +1,354 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="squish"
ProjectGUID="{CE017322-01FC-4851-9C8B-64E9A8E26C38}"
RootNamespace="squish"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(ConfigurationName)\$(PlatformName)"
IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
ConfigurationType="4"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(ConfigurationName)\$(PlatformName)"
IntermediateDirectory="$(ConfigurationName)\$(PlatformName)"
ConfigurationType="4"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..;..\..\..\src;..\..\..\gnuwin32\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__SSE2__;__SSE__;__MMX__"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\..\src\nvimage\nvtt\squish\clusterfit.cpp"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\squish\colourblock.cpp"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\squish\colourfit.cpp"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\squish\colourset.cpp"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\squish\fastclusterfit.cpp"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\squish\maths.cpp"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\squish\weightedclusterfit.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\..\..\src\nvimage\nvtt\squish\clusterfit.h"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\squish\colourblock.h"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\squish\colourfit.h"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\squish\colourset.h"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\squish\fastclusterfit.h"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\squish\maths.h"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\squish\simd.h"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\squish\simd_sse.h"
>
</File>
<File
RelativePath="..\..\..\src\nvimage\nvtt\squish\weightedclusterfit.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

@ -0,0 +1,92 @@
SUBDIRS(nvcore)
SUBDIRS(nvmath)
SUBDIRS(nvimage)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
# 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(${NV_CMAKE_DIR}/FindGLUT.cmake)
#INCLUDE(FindGLUT)
IF(GLUT_FOUND)
MESSAGE(STATUS "Looking for GLUT - found")
ELSE(GLUT_FOUND)
MESSAGE(STATUS "Looking for GLUT - not found")
ENDIF(GLUT_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
INCLUDE(${NV_CMAKE_DIR}/FindCUDA.cmake)
IF(CUDA_FOUND)
MESSAGE(STATUS "Looking for CUDA - found")
ELSE(CUDA_FOUND)
MESSAGE(STATUS "Looking for CUDA - not found")
ENDIF(CUDA_FOUND)
# JPEG
INCLUDE(FindJPEG)
IF(JPEG_FOUND)
SET(HAVE_JPEG JPEG_FOUND)
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)
MESSAGE(STATUS "Looking for PNG - found")
ELSE(PNG_FOUND)
MESSAGE(STATUS "Looking for PNG - not found")
ENDIF(PNG_FOUND)
# TIFF
INCLUDE(FindTIFF)
IF(TIFF_FOUND)
SET(HAVE_TIFF TIFF_FOUND)
MESSAGE(STATUS "Looking for TIFF - found")
ELSE(TIFF_FOUND)
MESSAGE(STATUS "Looking for TIFF - not found")
ENDIF(TIFF_FOUND)
# Qt
FIND_PACKAGE(Qt4)
# Threads
FIND_PACKAGE(Threads)
# configuration file
INCLUDE(CheckIncludeFiles)
CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H)
CHECK_INCLUDE_FILES(stdarg.h HAVE_STDARG_H)
CHECK_INCLUDE_FILES(signal.h HAVE_SIGNAL_H)
CHECK_INCLUDE_FILES(execinfo.h HAVE_EXECINFO_H)
CHECK_INCLUDE_FILES(malloc.h HAVE_MALLOC_H)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/nvconfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/nvconfig.h)

@ -0,0 +1,14 @@
#ifndef NV_CONFIG
#define NV_CONFIG
#cmakedefine HAVE_UNISTD_H
#cmakedefine HAVE_STDARG_H
#cmakedefine HAVE_SIGNAL_H
#cmakedefine HAVE_EXECINFO_H
#cmakedefine HAVE_MALLOC_H
#cmakedefine HAVE_PNG
#cmakedefine HAVE_JPEG
#cmakedefine HAVE_TIFF
#endif // NV_CONFIG

@ -0,0 +1,168 @@
// This code is in the public domain -- castanyo@yahoo.es
#ifndef NV_CORE_BITARRAY_H
#define NV_CORE_BITARRAY_H
#include <nvcore/nvcore.h>
#include <nvcore/Containers.h>
namespace nv
{
/// Count the bits of @a x.
inline uint bitsSet(uint8 x) {
uint count = 0;
for(; x != 0; x >>= 1) {
count += (x & 1);
}
return count;
}
/// Count the bits of @a x.
inline uint bitsSet(uint32 x, int bits) {
uint count = 0;
for(; x != 0 && bits != 0; x >>= 1, bits--) {
count += (x & 1);
}
return count;
}
/// Simple bit array.
class BitArray
{
public:
/// Default ctor.
BitArray() {}
/// Ctor with initial m_size.
BitArray(uint sz)
{
resize(sz);
}
/// Get array m_size.
uint size() const { return m_size; }
/// Clear array m_size.
void clear() { resize(0); }
/// Set array m_size.
void resize(uint sz)
{
m_size = sz;
m_bitArray.resize( (m_size + 7) >> 3 );
}
/// Get bit.
bool bitAt(uint b) const
{
nvDebugCheck( b < m_size );
return (m_bitArray[b >> 3] & (1 << (b & 7))) != 0;
}
/// Set a bit.
void setBitAt(uint b)
{
nvDebugCheck( b < m_size );
m_bitArray[b >> 3] |= (1 << (b & 7));
}
/// Clear a bit.
void clearBitAt( uint b )
{
nvDebugCheck( b < m_size );
m_bitArray[b >> 3] &= ~(1 << (b & 7));
}
/// Clear all the bits.
void clearAll()
{
memset(m_bitArray.unsecureBuffer(), 0, m_bitArray.size());
}
/// Set all the bits.
void setAll()
{
memset(m_bitArray.unsecureBuffer(), 0xFF, m_bitArray.size());
}
/// Toggle all the bits.
void toggleAll()
{
const uint byte_num = m_bitArray.size();
for(uint b = 0; b < byte_num; b++) {
m_bitArray[b] ^= 0xFF;
}
}
/// Get a byte of the bit array.
const uint8 & byteAt(uint index) const
{
return m_bitArray[index];
}
/// Set the given byte of the byte array.
void setByteAt(uint index, uint8 b)
{
m_bitArray[index] = b;
}
/// Count the number of bits set.
uint countSetBits() const
{
const uint num = m_bitArray.size();
if( num == 0 ) {
return 0;
}
uint count = 0;
for(uint i = 0; i < num - 1; i++) {
count += bitsSet(m_bitArray[i]);
}
count += bitsSet(m_bitArray[num-1], m_size & 0x7);
//piDebugCheck(count + countClearBits() == m_size);
return count;
}
/// Count the number of bits clear.
uint countClearBits() const {
const uint num = m_bitArray.size();
if( num == 0 ) {
return 0;
}
uint count = 0;
for(uint i = 0; i < num - 1; i++) {
count += bitsSet(~m_bitArray[i]);
}
count += bitsSet(~m_bitArray[num-1], m_size & 0x7);
//piDebugCheck(count + countSetBits() == m_size);
return count;
}
friend void swap(BitArray & a, BitArray & b)
{
swap(a.m_size, b.m_size);
swap(a.m_bitArray, b.m_bitArray);
}
private:
/// Number of bits stored.
uint m_size;
/// Array of bits.
Array<uint8> m_bitArray;
};
} // nv namespace
#endif // _PI_CORE_BITARRAY_H_

@ -0,0 +1,36 @@
PROJECT(nvcore)
ADD_SUBDIRECTORY(poshlib)
SET(CORE_SRCS
nvcore.h
BitArray.h
Memory.h
Memory.cpp
Debug.h
Debug.cpp
Containers.h
StrLib.h
StrLib.cpp
Stream.h
StdStream.h
TextReader.h
TextReader.cpp
TextWriter.h
Tokenizer.h
Tokenizer.cpp
Radix.h
Radix.cpp)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
# targets
ADD_DEFINITIONS(-DNVCORE_EXPORTS)
IF(NVCORE_SHARED)
ADD_LIBRARY(nvcore SHARED ${CORE_SRCS})
ELSE(NVCORE_SHARED)
ADD_LIBRARY(nvcore ${CORE_SRCS})
ENDIF(NVCORE_SHARED)
TARGET_LINK_LIBRARIES(nvcore ${LIBS})

File diff suppressed because it is too large Load Diff

@ -0,0 +1,456 @@
// This code is in the public domain -- castanyo@yahoo.es
#include <nvcore/Debug.h>
#include <nvcore/StrLib.h>
// Extern
#if NV_OS_WIN32 //&& NV_CC_MSVC
# define WIN32_LEAN_AND_MEAN
# define VC_EXTRALEAN
# include <windows.h>
# include <direct.h>
# if NV_CC_MSVC
# include <crtdbg.h>
# if _MSC_VER < 1300
# define DECLSPEC_DEPRECATED
// VC6: change this path to your Platform SDK headers
# include <dbghelp.h> // must be XP version of file
// include "M:\\dev7\\vs\\devtools\\common\\win32sdk\\include\\dbghelp.h"
# else
// VC7: ships with updated headers
# include <dbghelp.h>
# endif
# endif
#endif
#if !NV_OS_WIN32 && defined(HAVE_SIGNAL_H)
# include <signal.h>
#endif
#if NV_OS_LINUX && defined(HAVE_EXECINFO_H)
# include <execinfo.h>
# if NV_CC_GNUC // defined(HAVE_CXXABI_H)
# include <cxxabi.h>
# endif
#endif
#if NV_OS_DARWIN
# include <unistd.h> // getpid
# include <sys/types.h>
# include <sys/sysctl.h> // sysctl
#endif
#include <stdexcept> // std::runtime_error
#undef assert // defined on mingw
using namespace nv;
namespace
{
static MessageHandler * s_message_handler = NULL;
static AssertHandler * s_assert_handler = NULL;
static bool s_sig_handler_enabled = false;
#if NV_OS_WIN32 && NV_CC_MSVC
// Old exception filter.
static LPTOP_LEVEL_EXCEPTION_FILTER s_old_exception_filter = NULL;
#elif !NV_OS_WIN32 && defined(HAVE_SIGNAL_H)
// Old signal handlers.
struct sigaction s_old_sigsegv;
struct sigaction s_old_sigtrap;
struct sigaction s_old_sigfpe;
struct sigaction s_old_sigbus;
#endif
#if NV_OS_WIN32 && NV_CC_MSVC
// TODO write minidump
static LONG WINAPI nvTopLevelFilter( struct _EXCEPTION_POINTERS *pExceptionInfo ) {
/* BOOL (WINAPI * Dump) (HANDLE, DWORD, HANDLE, MINIDUMP_TYPE, PMINIDUMP_EXCEPTION_INFORMATION, PMINIDUMP_USER_STREAM_INFORMATION, PMINIDUMP_CALLBACK_INFORMATION );
AutoString dbghelp_path(512);
getcwd(dbghelp_path, 512);
dbghelp_path.Append("\\DbgHelp.dll");
nvTranslatePath(dbghelp_path);
PiLibrary DbgHelp_lib(dbghelp_path, true);
if( !DbgHelp_lib.IsValid() ) {
nvDebug("*** 'DbgHelp.dll' not found.\n");
return EXCEPTION_CONTINUE_SEARCH;
}
if( !DbgHelp_lib.BindSymbol( (void **)&Dump, "MiniDumpWriteDump" ) ) {
nvDebug("*** 'DbgHelp.dll' too old.\n");
return EXCEPTION_CONTINUE_SEARCH;
}
// create the file
HANDLE hFile = ::CreateFile( "nv.dmp", GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );
if( hFile == INVALID_HANDLE_VALUE ) {
nvDebug("*** Failed to create dump file.\n");
return EXCEPTION_CONTINUE_SEARCH;
}
_MINIDUMP_EXCEPTION_INFORMATION ExInfo;
ExInfo.ThreadId = ::GetCurrentThreadId();
ExInfo.ExceptionPointers = pExceptionInfo;
ExInfo.ClientPointers = NULL;
// write the dump
bool ok = Dump( GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpNormal, &ExInfo, NULL, NULL )!=0;
::CloseHandle(hFile);
if( !ok ) {
nvDebug("*** Failed to save dump file.\n");
return EXCEPTION_CONTINUE_SEARCH;
}
nvDebug("--- Dump file saved.\n");
*/
return EXCEPTION_CONTINUE_SEARCH;
}
#elif !NV_OS_WIN32 && defined(HAVE_SIGNAL_H) // NV_OS_LINUX || NV_OS_OSX
#if defined(HAVE_EXECINFO_H) // NV_OS_LINUX
static void nvPrintStackTrace(void * trace[], int size, int start=0) {
char ** string_array = backtrace_symbols(trace, size);
nvDebug( "\nDumping stacktrace:\n" );
for(int i = start; i < size-1; i++ ) {
# if NV_CC_GNUC // defined(HAVE_CXXABI_H)
char * begin = strchr(string_array[i], '(');
char * end = strchr(string_array[i], '+');
if( begin != 0 && begin < end ) {
int stat;
*end = '\0';
*begin = '\0';
char * module = string_array[i];
char * name = abi::__cxa_demangle(begin+1, 0, 0, &stat);
if( name == NULL || begin[1] != '_' || begin[2] != 'Z' ) {
nvDebug( " In: [%s] '%s'\n", module, begin+1 );
}
else {
nvDebug( " In: [%s] '%s'\n", module, name );
}
free(name);
}
else {
nvDebug( " In: '%s'\n", string_array[i] );
}
# else
nvDebug( " In: '%s'\n", string_array[i] );
# endif
}
nvDebug("\n");
free(string_array);
}
#endif // defined(HAVE_EXECINFO_H)
static void nvSigHandler(int sig, siginfo_t *info, void *secret)
{
// Do something useful with siginfo_t
if (sig == SIGSEGV) {
# if NV_CPU_X86
ucontext_t * uc = (ucontext_t *)secret;
nvDebug("Got signal %d, faulty address is %p, from %p\n", sig, info->si_addr, (void *)uc->uc_mcontext.gregs[REG_EIP]);
# else
nvDebug("Got signal %d, faulty address is %p\n", sig, info->si_addr);
# endif
}
else if(sig == SIGTRAP) {
nvDebug("Breakpoint hit.\n");
}
else {
nvDebug("Got signal %d\n", sig);
}
# if defined(HAVE_EXECINFO_H)
void * trace[64];
int size = backtrace(trace, 64);
# if NV_CPU_X86
// Overwrite sigaction with caller's address.
ucontext_t * uc = (ucontext_t *)secret;
trace[1] = (void *) uc->uc_mcontext.gregs[REG_EIP];
# endif // NV_CPU_X86
nvPrintStackTrace(trace, size, 1);
# endif // defined(HAVE_EXECINFO_H)
exit(0);
}
#endif // defined(HAVE_SIGNAL_H)
#if NV_OS_WIN32 //&& NV_CC_MSVC
/** Win32 asset handler. */
struct Win32AssertHandler : public AssertHandler
{
// Code from Daniel Vogel.
static bool isDebuggerPresent()
{
bool result = false;
HINSTANCE kern_lib = LoadLibraryEx( "kernel32.dll", NULL, 0 );
if( kern_lib ) {
FARPROC lIsDebuggerPresent = GetProcAddress( kern_lib, "IsDebuggerPresent" );
if( lIsDebuggerPresent && lIsDebuggerPresent() ) {
result = true;
}
FreeLibrary( kern_lib );
}
return result;
}
// Flush the message queue. This is necessary for the message box to show up.
static void flushMessageQueue()
{
MSG msg;
while( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ) {
if( msg.message == WM_QUIT ) break;
TranslateMessage( &msg );
DispatchMessage( &msg );
}
}
// Assert handler method.
virtual int assert( const char * exp, const char * file, int line, const char * func/*=NULL*/ )
{
int ret = NV_ABORT_EXIT;
StringBuilder error_string;
if( func != NULL ) {
error_string.format( "*** Assertion failed: %s\n On file: %s\n On function: %s\n On line: %d\n ", exp, file, func, line );
nvDebug( error_string );
}
else {
error_string.format( "*** Assertion failed: %s\n On file: %s\n On line: %d\n ", exp, file, line );
nvDebug( error_string );
}
#if _DEBUG
if( isDebuggerPresent() ) {
return NV_ABORT_DEBUG;
}
flushMessageQueue();
int action = MessageBox(NULL, error_string, "Assertion failed", MB_ABORTRETRYIGNORE|MB_ICONERROR);
switch( action ) {
case IDRETRY:
ret = NV_ABORT_DEBUG;
break;
case IDIGNORE:
ret = NV_ABORT_IGNORE;
break;
case IDABORT:
default:
ret = NV_ABORT_EXIT;
break;
}
/*if( _CrtDbgReport( _CRT_ASSERT, file, line, module, exp ) == 1 ) {
return NV_ABORT_DEBUG;
}*/
#endif
if( ret == NV_ABORT_EXIT ) {
// Exit cleanly.
throw std::runtime_error("Assertion failed");
}
return ret;
}
};
#else
/** Unix asset handler. */
struct UnixAssertHandler : public AssertHandler
{
bool isDebuggerPresent()
{
# if NV_OS_DARWIN
int mib[4];
struct kinfo_proc info;
size_t size;
mib[0] = CTL_KERN;
mib[1] = KERN_PROC;
mib[2] = KERN_PROC_PID;
mib[3] = getpid();
size = sizeof(info);
info.kp_proc.p_flag = 0;
sysctl(mib,4,&info,&size,NULL,0);
return ((info.kp_proc.p_flag & P_TRACED) == P_TRACED);
# else
// if ppid != sid, some process spawned our app, probably a debugger.
return getsid(getpid()) != getppid();
# endif
}
// Assert handler method.
virtual int assert(const char * exp, const char * file, int line, const char * func)
{
if( func != NULL ) {
nvDebug( "*** Assertion failed: %s\n On file: %s\n On function: %s\n On line: %d\n ", exp, file, func, line );
}
else {
nvDebug( "*** Assertion failed: %s\n On file: %s\n On line: %d\n ", exp, file, line );
}
# if _DEBUG
if( isDebuggerPresent() ) {
return NV_ABORT_DEBUG;
}
# endif
# if defined(HAVE_EXECINFO_H)
void * trace[64];
int size = backtrace(trace, 64);
nvPrintStackTrace(trace, size, 3);
# endif
// Exit cleanly.
throw std::runtime_error("Assertion failed");
}
};
#endif
} // namespace
/// Handle assertion through the asset handler.
int nvAbort(const char * exp, const char * file, int line, const char * func)
{
#if NV_OS_WIN32 //&& NV_CC_MSVC
static Win32AssertHandler s_default_assert_handler;
#else
static UnixAssertHandler s_default_assert_handler;
#endif
if( s_assert_handler != NULL ) {
return s_assert_handler->assert( exp, file, line, func );
}
else {
return s_default_assert_handler.assert( exp, file, line, func );
}
}
/// Shows a message through the message handler.
void NV_CDECL nvDebug(const char *msg, ...)
{
va_list arg;
va_start(arg,msg);
if( s_message_handler != NULL ) {
s_message_handler->log( msg, arg );
}
va_end(arg);
}
/// Dump debug info.
void debug::dumpInfo()
{
#if defined(HAVE_EXECINFO_H)
void * trace[64];
int size = backtrace(trace, 64);
nvPrintStackTrace(trace, size, 1);
#endif
}
/// Set the debug message handler.
void debug::setMessageHandler(MessageHandler * message_handler)
{
s_message_handler = message_handler;
}
/// Reset the debug message handler.
void debug::resetMessageHandler()
{
s_message_handler = NULL;
}
/// Set the assert handler.
void debug::setAssertHandler(AssertHandler * assert_handler)
{
s_assert_handler = assert_handler;
}
/// Reset the assert handler.
void debug::resetAssertHandler()
{
s_assert_handler = NULL;
}
/// Enable signal handler.
void debug::enableSigHandler()
{
nvCheck(s_sig_handler_enabled != true);
s_sig_handler_enabled = true;
#if NV_OS_WIN32 && NV_CC_MSVC
s_old_exception_filter = ::SetUnhandledExceptionFilter( nvTopLevelFilter );
#elif !NV_OS_WIN32 && defined(HAVE_SIGNAL_H)
// Install our signal handler
struct sigaction sa;
sa.sa_sigaction = nvSigHandler;
sigemptyset (&sa.sa_mask);
sa.sa_flags = SA_RESTART | SA_SIGINFO;
sigaction(SIGSEGV, &sa, &s_old_sigsegv);
sigaction(SIGTRAP, &sa, &s_old_sigtrap);
sigaction(SIGFPE, &sa, &s_old_sigfpe);
sigaction(SIGBUS, &sa, &s_old_sigbus);
#endif
}
/// Disable signal handler.
void debug::disableSigHandler()
{
nvCheck(s_sig_handler_enabled == true);
s_sig_handler_enabled = false;
#if NV_OS_WIN32 && NV_CC_MSVC
::SetUnhandledExceptionFilter( s_old_exception_filter );
s_old_exception_filter = NULL;
#elif !NV_OS_WIN32 && defined(HAVE_SIGNAL_H)
sigaction(SIGSEGV, &s_old_sigsegv, NULL);
sigaction(SIGTRAP, &s_old_sigtrap, NULL);
sigaction(SIGFPE, &s_old_sigfpe, NULL);
sigaction(SIGBUS, &s_old_sigbus, NULL);
#endif
}

@ -0,0 +1,129 @@
// This code is in the public domain -- castanyo@yahoo.es
#ifndef NV_CORE_DEBUG_H
#define NV_CORE_DEBUG_H
#include <nvcore/nvcore.h>
#if defined(HAVE_STDARG_H)
# include <stdarg.h> // va_list
#endif
#define NV_ABORT_DEBUG 1
#define NV_ABORT_IGNORE 2
#define NV_ABORT_EXIT 3
#if NV_CC_MSVC
#define nvNoAssert __noop
#else
#define nvNoAssert(exp)
#endif
#if NV_NO_ASSERT
# define nvAssert(exp) nvNoAssert()
# define nvCheck(exp) nvNoAssert()
# define nvDebugAssert(exp) nvNoAssert()
# define nvDebugCheck(exp) nvNoAssert()
# define nvDebugBreak()
#else // NV_NO_ASSERT
# if NV_CC_MSVC && NV_CPU_X86 && 0
# define nvDebugBreak() __asm int 3
# elif NV_CC_MSVC // this is only on recent versions...
// Do I have to include <intrin.h> ?
# define nvDebugBreak() __debugbreak()
# elif NV_CC_GNUC && NV_CPU_PPC && NV_OS_DARWIN
# define nvDebugBreak() __asm__ volatile ("trap");
# elif NV_CC_GNUC && NV_CPU_X86 && NV_OS_DARWIN
# define nvDebugBreak() __asm__ volatile ("int3");
# elif NV_CC_GNUC && NV_CPU_X86
# define nvDebugBreak() __asm__ ( "int %0" : :"I"(3) )
# else
# include <signal.h>
# define nvDebugBreak() raise(SIGTRAP); //*((int *)(0)) = 0
# endif
# define nvAssertMacro(exp) \
do { \
if(!(exp)) { \
if( nvAbort(#exp, __FILE__, __LINE__, __FUNC__) == NV_ABORT_DEBUG ) { \
nvDebugBreak(); \
} \
} \
} while(false)
# define nvAssert(exp) nvAssertMacro(exp)
# define nvCheck(exp) nvAssertMacro(exp)
# if defined(_DEBUG)
# define nvDebugAssert(exp) nvAssertMacro(exp)
# define nvDebugCheck(exp) nvAssertMacro(exp)
# else // _DEBUG
# define nvDebugAssert(exp) nvNoAssert(exp)
# define nvDebugCheck(exp) nvNoAssert(exp)
# endif // _DEBUG
#endif // NV_NO_ASSERT
// Use nvAssume for very simple expresions only: piAssume(0), piAssume(value == true), etc.
#if defined(_DEBUG)
# if NV_CC_MSVC
# define nvAssume(exp) __assume(exp)
# else
# define nvAssume(exp) nvCheck(exp)
# endif
#else
# define nvAssume(exp) nvCheck(exp)
#endif
#define nvError(x) nvAbort(x, __FILE__, __LINE__, __FUNC__)
#define nvWarning(x) nvDebug("*** Warning %s/%d: %s\n", __FILE__, __LINE__, (x))
#if PI_CC_MSVC
// I'm not sure it's a good idea to use the default static assert.
#define nvStaticCheck(x) _STATIC_ASSERT(x)
#else
#define nvStaticCheck(x) typedef char NV_DO_STRING_JOIN2(__static_assert_,__LINE__)[(x)]
//#define nvStaticCheck(x) switch(0) { case 0: case x:; }
#endif
NVCORE_API int nvAbort(const char *exp, const char *file, int line, const char * func = 0);
NVCORE_API void NV_CDECL nvDebug( const char *msg, ... ) __attribute__((format (printf, 1, 2)));
namespace nv
{
/** Message handler interface. */
struct MessageHandler {
virtual void log(const char * str, va_list arg) = 0;
virtual ~MessageHandler() {}
};
/** Assert handler interface. */
struct AssertHandler {
virtual int assert(const char *exp, const char *file, int line, const char *func = 0) = 0;
virtual ~AssertHandler() {}
};
namespace debug
{
NVCORE_API void dumpInfo();
NVCORE_API void setMessageHandler( MessageHandler * messageHandler );
NVCORE_API void resetMessageHandler();
NVCORE_API void setAssertHandler( AssertHandler * assertHanlder );
NVCORE_API void resetAssertHandler();
NVCORE_API void enableSigHandler();
NVCORE_API void disableSigHandler();
}
} // nv namespace
#endif // NV_CORE_DEBUG_H

@ -0,0 +1,66 @@
#ifndef NV_CORE_H
#error "Do not include this file directly."
#endif
#include <stdlib.h> // uint8_t, int8_t, ...
// Function linkage
#define DLL_IMPORT
#if __GNUC__ >= 4
# define DLL_EXPORT __attribute__((visibility("default")))
# define DLL_EXPORT_CLASS DLL_EXPORT
#else
# define DLL_EXPORT
# define DLL_EXPORT_CLASS
#endif
// Function calling modes
#if NV_CPU_X86
# define NV_CDECL __attribute__((cdecl))
# define NV_STDCALL __attribute__((stdcall))
#else
# define NV_CDECL
# define NV_STDCALL
#endif
#define NV_FASTCALL __attribute__((fastcall))
#define NV_FORCEINLINE __attribute__((always_inline))
#if __GNUC__ > 2
#define NV_PURE __attribute__((pure))
#define NV_CONST __attribute__((const))
#else
#define NV_PURE
#define NV_CONST
#endif
// Define __FUNC__ properly.
#if __STDC_VERSION__ < 199901L
# if __GNUC__ >= 2
# define __FUNC__ __PRETTY_FUNCTION__ // __FUNCTION__
# else
# define __FUNC__ "<unknown>"
# endif
#else
# define __FUNC__ __PRETTY_FUNCTION__
#endif
#define restrict __restrict__
// Type definitions
typedef uint8_t uint8;
typedef int8_t int8;
typedef uint16_t uint16;
typedef int16_t int16;
typedef uint32_t uint32;
typedef int32_t int32;
typedef uint64_t uint64;
typedef int64_t int64;
// Aliases
typedef uint32 uint;

@ -0,0 +1,63 @@
#ifndef NV_CORE_H
#error "Do not include this file directly."
#endif
// Function linkage
#define DLL_IMPORT
#if __GNUC__ >= 4
# define DLL_EXPORT __attribute__((visibility("default")))
# define DLL_EXPORT_CLASS DLL_EXPORT
#else
# define DLL_EXPORT
# define DLL_EXPORT_CLASS
#endif
// Function calling modes
#if NV_CPU_X86
# define NV_CDECL __attribute__((cdecl))
# define NV_STDCALL __attribute__((stdcall))
#else
# define NV_CDECL
# define NV_STDCALL
#endif
#define NV_FASTCALL __attribute__((fastcall))
#define NV_FORCEINLINE __attribute__((always_inline))
#if __GNUC__ > 2
#define NV_PURE __attribute__((pure))
#define NV_CONST __attribute__((const))
#else
#define NV_PURE
#define NV_CONST
#endif
// Define __FUNC__ properly.
#if __STDC_VERSION__ < 199901L
# if __GNUC__ >= 2
# define __FUNC__ __PRETTY_FUNCTION__ // __FUNCTION__
# else
# define __FUNC__ "<unknown>"
# endif
#else
# define __FUNC__ __PRETTY_FUNCTION__
#endif
#define restrict __restrict__
// Type definitions
typedef unsigned char uint8;
typedef signed char int8;
typedef unsigned short uint16;
typedef signed short int16;
typedef unsigned int uint32;
typedef signed int int32;
typedef unsigned long long uint64;
typedef signed long long int64;
// Aliases
typedef uint32 uint;

@ -0,0 +1,58 @@
#ifndef NV_CORE_H
#error "Do not include this file directly."
#endif
// Function linkage
#define DLL_IMPORT __declspec(dllimport)
#define DLL_EXPORT __declspec(dllexport)
#define DLL_EXPORT_CLASS DLL_EXPORT
// Function calling modes
#if NV_CPU_X86
# define NV_CDECL __attribute__((cdecl))
# define NV_STDCALL __attribute__((stdcall))
#else
# define NV_CDECL
# define NV_STDCALL
#endif
#define NV_FASTCALL __attribute__((fastcall))
#define NV_FORCEINLINE __attribute__((always_inline))
#if __GNUC__ > 2
#define NV_PURE __attribute__((pure))
#define NV_CONST __attribute__((const))
#else
#define NV_PURE
#define NV_CONST
#endif
// Define __FUNC__ properly.
#if __STDC_VERSION__ < 199901L
# if __GNUC__ >= 2
# define __FUNC__ __PRETTY_FUNCTION__ // __FUNCTION__
# else
# define __FUNC__ "<unknown>"
# endif
#else
# define __FUNC__ __PRETTY_FUNCTION__
#endif
#define restrict __restrict__
// Type definitions
typedef unsigned char uint8;
typedef signed char int8;
typedef unsigned short uint16;
typedef signed short int16;
typedef unsigned int uint32;
typedef signed int int32;
typedef unsigned long long uint64;
typedef signed long long int64;
// Aliases
typedef uint32 uint;

@ -0,0 +1,94 @@
#ifndef NV_CORE_H
#error "Do not include this file directly."
#endif
// Function linkage
#define DLL_IMPORT __declspec(dllimport)
#define DLL_EXPORT __declspec(dllexport)
#define DLL_EXPORT_CLASS DLL_EXPORT
// Function calling modes
#define NV_CDECL __cdecl
#define NV_STDCALL __stdcall
#define NV_FASTCALL __fastcall
#define NV_FORCEINLINE __forceinline
#define NV_PURE
#define NV_CONST
// Set standard function names.
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#define vsscanf _vsscanf
#define chdir _chdir
#define getcwd _getcwd
#define va_copy(a, b) a = b
#if !defined restrict
#define restrict
#endif
#if !defined __attribute__
#define __attribute__(X)
#endif
#if !defined __FUNC__
#define __FUNC__ __FUNCTION__
#endif
// Type definitions
typedef unsigned char uint8;
typedef signed char int8;
typedef unsigned short uint16;
typedef signed short int16;
typedef unsigned int uint32;
typedef signed int int32;
typedef unsigned __int64 uint64;
typedef signed __int64 int64;
// Aliases
typedef uint32 uint;
// Unwanted VC++ warnings to disable.
#pragma warning(disable : 4244) // conversion to float, possible loss of data
#pragma warning(disable : 4245) // conversion from 'enum ' to 'unsigned long', signed/unsigned mismatch
#pragma warning(disable : 4100) // unreferenced formal parameter
#pragma warning(disable : 4514) // unreferenced inline function has been removed
#pragma warning(disable : 4710) // inline function not expanded
#pragma warning(disable : 4127) // Conditional expression is constant
#pragma warning(disable : 4305) // truncation from 'const double' to 'float'
#pragma warning(disable : 4505) // unreferenced local function has been removed
//#pragma warning(disable : 4699) // creating precompiled header
//#pragma warning(disable : 4201) // nonstandard extension used : nameless struct/union
#pragma warning(disable : 4702) // unreachable code in inline expanded function
#pragma warning(disable : 4711) // function selected for automatic inlining
#pragma warning(disable : 4725) // Pentium fdiv bug
//#pragma warning(disable : 4512) // assignment operator could not be generated
//#pragma warning(disable : 4530) // C++ exception handler used, but unwind semantics are not enabled
//#pragma warning(disable : 4238) // nonstandard extension used : class rvalue used as lvalue
//#pragma warning(disable : 4251) // needs to have dll-interface to be used by clients of class 'ULinker'
//#pragma warning(disable : 4275) // non dll-interface class used as base for dll-interface class
//#pragma warning(disable : 4511) // copy constructor could not be generated
//#pragma warning(disable : 4284) // return type is not a UDT or reference to a UDT
//#pragma warning(disable : 4355) // this used in base initializer list
//#pragma warning(disable : 4097) // typedef-name '' used as synonym for class-name ''
//#pragma warning(disable : 4291) // typedef-name '' used as synonym for class-name ''
#pragma warning(disable : 4345) // behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized
#pragma warning(disable : 4786) // Identifier was truncated and cannot be debugged.
//#pragma warning(disable : 4996) // function was declared deprecated.
//#pragma warning(disable : 4146) // unary minus operator applied to unsigned type, result still unsigned
#pragma warning(disable : 4675) // resolved overload was found by argument-dependent lookup

@ -0,0 +1,34 @@
#include "Memory.h"
#include "Debug.h"
//#if HAVE_MALLOC_H
//#include <malloc.h>
//#endif
#include <stdlib.h>
using namespace nv;
void * nv::mem::malloc(size_t size)
{
return ::malloc(size);
}
void * nv::mem::malloc(size_t size, const char * file, int line)
{
return ::malloc(size);
}
void nv::mem::free(const void * ptr)
{
::free(const_cast<void *>(ptr));
}
void * nv::mem::realloc(void * ptr, size_t size)
{
nvDebugCheck(ptr != NULL || size != 0); // undefined realloc behavior.
return ::realloc(ptr, size);
}

@ -0,0 +1,186 @@
// This code is in the public domain -- castanyo@yahoo.es
#ifndef NV_CORE_MEMORY_H
#define NV_CORE_MEMORY_H
#include <nvcore/nvcore.h>
#include <stdlib.h> // malloc(), realloc() and free()
#include <stddef.h> // size_t
#include <new> // new and delete
// Custom memory allocator
namespace nv
{
namespace mem
{
NVCORE_API void * malloc(size_t size);
NVCORE_API void * malloc(size_t size, const char * file, int line);
NVCORE_API void free(const void * ptr);
NVCORE_API void * realloc(void * ptr, size_t size);
} // mem namespace
} // nv namespace
// Override new/delete
inline void * operator new (size_t size) throw()
{
return nv::mem::malloc(size);
}
inline void operator delete (void *p) throw()
{
nv::mem::free(p);
}
inline void * operator new [] (size_t size) throw()
{
return nv::mem::malloc(size);
}
inline void operator delete [] (void * p) throw()
{
nv::mem::free(p);
}
/*
#ifdef _DEBUG
#define new new(__FILE__, __LINE__)
#define malloc(i) malloc(i, __FILE__, __LINE__)
#endif
*/
#if 0
/*
File: main.cpp
Version: 1.0
Abstract: Overrides the C++ 'operator new' and 'operator delete'.
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc.
("Apple") in consideration of your agreement to the following terms, and your
use, installation, modification or redistribution of this Apple software
constitutes acceptance of these terms. If you do not agree with these terms,
please do not use, install, modify or redistribute this Apple software.
In consideration of your agreement to abide by the following terms, and subject
to these terms, Apple grants you a personal, non-exclusive license, under Apples
copyrights in this original Apple software (the "Apple Software"), to use,
reproduce, modify and redistribute the Apple Software, with or without
modifications, in source and/or binary forms; provided that if you redistribute
the Apple Software in its entirety and without modifications, you must retain
this notice and the following text and disclaimers in all such redistributions of
the Apple Software. Neither the name, trademarks, service marks or logos of
Apple Computer, Inc. may be used to endorse or promote products derived from the
Apple Software without specific prior written permission from Apple. Except as
expressly stated in this notice, no other rights or licenses, express or implied,
are granted by Apple herein, including but not limited to any patent rights that
may be infringed by your derivative works or by other works in which the Apple
Software may be incorporated.
The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO
WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
COMBINATION WITH YOUR PRODUCTS.
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION
OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT
(INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Copyright © 2006 Apple Computer, Inc., All Rights Reserved
*/
/* This sample shows how to override the C++ global 'new' and 'delete' operators. */
#include <new>
#include <iostream>
#include <cstdlib>
#include <stdexcept>
#include <locale>
/* Some variables and code to make the example do something. */
namespace {
unsigned long long gNewCounter; // number of times 'new' was called
unsigned long long gDeleteCounter; // number of times 'delete' was called
void printCounters() // print the counters above
{
std::cout << "new was called " << gNewCounter << " times and delete was called " << gDeleteCounter << " times\n";
}
}
/* These are the overridden new and delete routines.
Most applications will want to override at least these four versions of new/delete if they override any of them.
In Mac OS, it's not necessary to override the array versions of operator new and delete if all
they would do is call the non-array versions; the C++ standard library, as an extension
to the C++ standard, does this for you.
Developers should consult the section [lib.support.dynamic] in the C++ standard to see the requirements
on the generic operators new and delete; the system may expect that your overridden operators meet all these
requirements.
Your operators may be called by the system, even early in start-up before constructors have been executed. */
void* operator new(std::size_t sz) throw (std::bad_alloc)
{
void *result = std::malloc (sz == 0 ? 1 : sz);
if (result == NULL)
throw std::bad_alloc();
gNewCounter++;
return result;
}
void operator delete(void* p) throw()
{
if (p == NULL)
return;
std::free (p);
gDeleteCounter++;
}
/* These are the 'nothrow' versions of the above operators.
The system version will try to call a std::new_handler if they
fail, but your overriding versions are not required to do this. */
void* operator new(std::size_t sz, const std::nothrow_t&) throw()
{
try {
void * result = ::operator new (sz); // calls our overridden operator new
return result;
} catch (std::bad_alloc &) {
return NULL;
}
}
void operator delete(void* p, const std::nothrow_t&) throw()
{
::operator delete (p);
}
/* Bug 4067110 is that if your program has no weak symbols at all, the linker will not set the
WEAK_DEFINES bit in the Mach-O header and as a result the new and delete operators above won't
be seen by system libraries. This is mostly a problem for test programs and small examples,
since almost all real C++ programs complicated enough to override new and delete will have at
least one weak symbol. However, this is a small example, so: */
void __attribute__((weak, visibility("default"))) workaroundFor4067110 () { }
/* This is a simple test program that causes the runtime library to call new and delete. */
int main()
{
atexit (printCounters);
try {
std::locale example("does_not_exist");
} catch (std::runtime_error &x) {
}
return 0;
}
#endif // 0
#endif // NV_CORE_MEMORY_H

@ -0,0 +1,24 @@
// nvPrefetch
#if NV_CC_GNUC
#define nvPrefetch(ptr) __builtin_prefetch(ptr)
#elif NV_CC_MSVC
#if NV_CPU_X86
__forceinline void nvPrefetch(const void * mem)
{
__asm mov ecx, mem
__asm prefetcht0 [ecx];
// __asm prefetchnta [ecx];
}
#endif // NV_CPU_X86
#else // NV_CC_MSVC
// do nothing in other case.
#define piPrefetch(ptr)
#endif // NV_CC_MSVC

@ -0,0 +1,420 @@
// This code is in the public domain -- castanyo@yahoo.es
#ifndef NV_CORE_PTR_H
#define NV_CORE_PTR_H
#include <nvcore/nvcore.h>
#include <nvcore/Debug.h>
#include <stdio.h> // NULL
namespace nv
{
/** Simple auto pointer template class.
*
* This is very similar to the standard auto_ptr class, but with some
* additional limitations to make its use less error prone:
* - Copy constructor and assignment operator are disabled.
* - reset method is removed.
*
* The semantics of the standard auto_ptr are not clear and change depending
* on the std implementation. For a discussion of the problems of auto_ptr read:
* http://www.awprofessional.com/content/images/020163371X/autoptrupdate\auto_ptr_update.html
*/
template <class T>
class AutoPtr
{
NV_FORBID_COPY(AutoPtr);
NV_FORBID_HEAPALLOC();
public:
/** Ctor. */
explicit AutoPtr( T * p ) {
m_ptr = p;
}
/** Dtor. Deletes owned pointer. */
~AutoPtr() {
delete m_ptr;
m_ptr = NULL;
}
/** Delete owned pointer and assign new one. */
void operator=( T * p ) {
delete m_ptr;
m_ptr = p;
}
/** Member access. */
T * operator -> () const {
nvDebugCheck(m_ptr != NULL);
return m_ptr;
}
/** Get reference. */
T & operator*() const {
nvDebugCheck(m_ptr != NULL);
return *m_ptr;
}
/** Get pointer. */
T * ptr() const { return m_ptr; }
/** Relinquish ownership of the underlying pointer and returns that pointer. */
T * release() {
T * tmp = m_ptr;
m_ptr = NULL;
return tmp;
}
/** Const pointer equal comparation. */
bool operator == (const T * const p) const {
return (m_ptr == p);
}
/** Const pointer nequal comparation. */
bool operator != (const T * const p) const {
return (m_ptr != p);
}
private:
T * m_ptr;
};
#if 0
/** Reference counted base class to be used with Pointer.
*
* The only requirement of the Pointer class is that the RefCounted class implements the
* addRef and release methods.
*/
class RefCounted
{
NV_FORBID_COPY(RefCounted);
public:
/// Ctor.
RefCounted() : m_count(0), m_weak_proxy(NULL)
{
s_total_obj_count++;
}
/// Virtual dtor.
virtual ~RefCounted()
{
nvCheck( m_count == 0 );
nvCheck( s_total_obj_count > 0 );
s_total_obj_count--;
}
/// Increase reference count.
uint addRef() const
{
s_total_ref_count++;
m_count++;
return m_count;
}
/// Decrease reference count and remove when 0.
uint release() const
{
nvCheck( m_count > 0 );
s_total_ref_count--;
m_count--;
if( m_count == 0 ) {
releaseWeakProxy();
delete this;
return 0;
}
return m_count;
}
/// Get weak proxy.
WeakProxy * getWeakProxy() const
{
if (m_weak_proxy == NULL) {
m_weak_proxy = new WeakProxy;
m_weak_proxy->AddRef();
}
return m_weak_proxy;
}
/// Release the weak proxy.
void releaseWeakProxy() const
{
if (m_weak_proxy != NULL) {
m_weak_proxy->NotifyObjectDied();
m_weak_proxy->Release();
m_weak_proxy = NULL;
}
}
/** @name Debug methods: */
//@{
/// Get reference count.
int refCount() const
{
return m_count;
}
/// Get total number of objects.
static int totalObjectCount()
{
return s_total_obj_count;
}
/// Get total number of references.
static int totalReferenceCount()
{
return s_total_ref_count;
}
//@}
private:
NVCORE_API static int s_total_ref_count;
NVCORE_API static int s_total_obj_count;
mutable int m_count;
mutable WeakProxy * weak_proxy;
};
#endif
/// Smart pointer template class.
template <class BaseClass>
class Pointer {
public:
// BaseClass must implement addRef() and release().
typedef Pointer<BaseClass> ThisType;
/// Default ctor.
Pointer() : m_ptr(NULL)
{
}
/** Other type assignment. */
template <class OtherBase>
Pointer( const Pointer<OtherBase> & tc )
{
m_ptr = static_cast<BaseClass *>( tc.ptr() );
if( m_ptr ) {
m_ptr->addRef();
}
}
/** Copy ctor. */
Pointer( const ThisType & bc )
{
m_ptr = bc.ptr();
if( m_ptr ) {
m_ptr->addRef();
}
}
/** Copy cast ctor. Pointer(NULL) is valid. */
explicit Pointer( BaseClass * bc )
{
m_ptr = bc;
if( m_ptr ) {
m_ptr->addRef();
}
}
/** Dtor. */
~Pointer()
{
set(NULL);
}
/** @name Accessors: */
//@{
/** -> operator. */
BaseClass * operator -> () const
{
piCheck( m_ptr != NULL );
return m_ptr;
}
/** * operator. */
BaseClass & operator*() const
{
piCheck( m_ptr != NULL );
return *m_ptr;
}
/** Get pointer. */
BaseClass * ptr() const
{
return m_ptr;
}
//@}
/** @name Mutators: */
//@{
/** Other type assignment. */
template <class OtherBase>
void operator = ( const Pointer<OtherBase> & tc )
{
set( static_cast<BaseClass *>(tc.ptr()) );
}
/** This type assignment. */
void operator = ( const ThisType & bc )
{
set( bc.ptr() );
}
/** Pointer assignment. */
void operator = ( BaseClass * bc )
{
set( bc );
}
//@}
/** @name Comparators: */
//@{
/** Other type equal comparation. */
template <class OtherBase>
bool operator == ( const Pointer<OtherBase> & other ) const
{
return m_ptr == other.ptr();
}
/** This type equal comparation. */
bool operator == ( const ThisType & bc ) const
{
return m_ptr == bc.ptr();
}
/** Const pointer equal comparation. */
bool operator == ( const BaseClass * const bc ) const
{
return m_ptr == bc;
}
/** Other type not equal comparation. */
template <class OtherBase>
bool operator != ( const Pointer<OtherBase> & other ) const
{
return m_ptr != other.ptr();
}
/** Other type not equal comparation. */
bool operator != ( const ThisType & bc ) const
{
return m_ptr != bc.ptr();
}
/** Const pointer not equal comparation. */
bool operator != (const BaseClass * const bc) const
{
return m_ptr != bc;
}
/** This type lower than comparation. */
bool operator < (const ThisType & p) const
{
return m_ptr < p.ptr();
}
//@}
private:
/** Set this pointer. */
void set( BaseClass * p )
{
if( m_ptr != p ) {
if( m_ptr ) m_ptr->release();
if( p ) p->addRef();
m_ptr = p;
}
}
private:
BaseClass * m_ptr;
};
/*
template <class T>
class QSharedDataPointer
{
public:
inline void detach() { if (d && d->ref != 1) detach_helper(); }
inline T &operator*() { detach(); return *d; }
inline const T &operator*() const { return *d; }
inline T *operator->() { detach(); return d; }
inline const T *operator->() const { return d; }
inline operator T *() { detach(); return d; }
inline operator const T *() const { return d; }
inline T *data() { detach(); return d; }
inline const T *data() const { return d; }
inline const T *constData() const { return d; }
inline bool operator==(const QSharedDataPointer<T> &other) const { return d == other.d; }
inline bool operator!=(const QSharedDataPointer<T> &other) const { return d != other.d; }
inline QSharedDataPointer() { d = 0; }
inline ~QSharedDataPointer() { if (d && !d->ref.deref()) delete d; }
explicit QSharedDataPointer(T *data);
inline QSharedDataPointer(const QSharedDataPointer<T> &o) : d(o.d) { if (d) d->ref.ref(); }
inline QSharedDataPointer<T> & operator=(const QSharedDataPointer<T> &o) {
if (o.d != d) {
T *x = o.d;
if (x) x->ref.ref();
x = qAtomicSetPtr(&d, x);
if (x && !x->ref.deref())
delete x;
}
return *this;
}
inline QSharedDataPointer &operator=(T *o) {
if (o != d) {
T *x = o;
if (x) x->ref.ref();
x = qAtomicSetPtr(&d, x);
if (x && !x->ref.deref())
delete x;
}
return *this;
}
inline bool operator!() const { return !d; }
private:
void detach_helper();
T *d;
};
template <class T>
Q_INLINE_TEMPLATE QSharedDataPointer<T>::QSharedDataPointer(T *adata) : d(adata)
{ if (d) d->ref.ref(); }
template <class T>
Q_OUTOFLINE_TEMPLATE void QSharedDataPointer<T>::detach_helper()
{
T *x = new T(*d);
x->ref.ref();
x = qAtomicSetPtr(&d, x);
if (!x->ref.deref())
delete x;
}
*/
} // nv namespace
#endif // NV_CORE_PTR_H

@ -0,0 +1,429 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Contains source code from the article "Radix Sort Revisited".
* \file Radix.cpp
* \author Pierre Terdiman
* \date April, 4, 2000
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Revisited Radix Sort.
* This is my new radix routine:
* - it uses indices and doesn't recopy the values anymore, hence wasting less ram
* - it creates all the histograms in one run instead of four
* - it sorts words faster than dwords and bytes faster than words
* - it correctly sorts negative floating-point values by patching the offsets
* - it automatically takes advantage of temporal coherence
* - multiple keys support is a side effect of temporal coherence
* - it may be worth recoding in asm... (mainly to use FCOMI, FCMOV, etc) [it's probably memory-bound anyway]
*
* History:
* - 08.15.98: very first version
* - 04.04.00: recoded for the radix article
* - 12.xx.00: code lifting
* - 09.18.01: faster CHECK_PASS_VALIDITY thanks to Mark D. Shattuck (who provided other tips, not included here)
* - 10.11.01: added local ram support
* - 01.20.02: bugfix! In very particular cases the last pass was skipped in the float code-path, leading to incorrect sorting......
*
* \class RadixSort
* \author Pierre Terdiman
* \version 1.3
* \date August, 15, 1998
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*
To do:
- add an offset parameter between two input values (avoid some data recopy sometimes)
- unroll ? asm ?
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Header
#include <nvcore/Radix.h>
#include <string.h> // memset
//using namespace IceCore;
#define DELETEARRAY(a) { delete [] a; a = NULL; }
#define CHECKALLOC(a)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Constructor.
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
RadixSort::RadixSort() : mCurrentSize(0), mPreviousSize(0), mIndices(NULL), mIndices2(NULL), mTotalCalls(0), mNbHits(0)
{
#ifndef RADIX_LOCAL_RAM
// Allocate input-independent ram
mHistogram = new uint32[256*4];
mOffset = new uint32[256];
#endif
// Initialize indices
resetIndices();
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Destructor.
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
RadixSort::~RadixSort()
{
// Release everything
#ifndef RADIX_LOCAL_RAM
DELETEARRAY(mOffset);
DELETEARRAY(mHistogram);
#endif
DELETEARRAY(mIndices2);
DELETEARRAY(mIndices);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Resizes the inner lists.
* \param nb [in] new size (number of dwords)
* \return true if success
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool RadixSort::resize(uint32 nb)
{
// Free previously used ram
DELETEARRAY(mIndices2);
DELETEARRAY(mIndices);
// Get some fresh one
mIndices = new uint32[nb]; CHECKALLOC(mIndices);
mIndices2 = new uint32[nb]; CHECKALLOC(mIndices2);
mCurrentSize = nb;
// Initialize indices so that the input buffer is read in sequential order
resetIndices();
return true;
}
#define CHECK_RESIZE(n) \
if(n!=mPreviousSize) \
{ \
if(n>mCurrentSize) resize(n); \
else resetIndices(); \
mPreviousSize = n; \
}
#define CREATE_HISTOGRAMS(type, buffer) \
/* Clear counters */ \
memset(mHistogram, 0, 256*4*sizeof(uint32)); \
\
/* Prepare for temporal coherence */ \
type PrevVal = (type)buffer[mIndices[0]]; \
bool AlreadySorted = true; /* Optimism... */ \
uint32* Indices = mIndices; \
\
/* Prepare to count */ \
uint8* p = (uint8*)input; \
uint8* pe = &p[nb*4]; \
uint32* h0= &mHistogram[0]; /* Histogram for first pass (LSB) */ \
uint32* h1= &mHistogram[256]; /* Histogram for second pass */ \
uint32* h2= &mHistogram[512]; /* Histogram for third pass */ \
uint32* h3= &mHistogram[768]; /* Histogram for last pass (MSB) */ \
\
while(p!=pe) \
{ \
/* Read input buffer in previous sorted order */ \
type Val = (type)buffer[*Indices++]; \
/* Check whether already sorted or not */ \
if(Val<PrevVal) { AlreadySorted = false; break; } /* Early out */ \
/* Update for next iteration */ \
PrevVal = Val; \
\
/* Create histograms */ \
h0[*p++]++; h1[*p++]++; h2[*p++]++; h3[*p++]++; \
} \
\
/* If all input values are already sorted, we just have to return and leave the */ \
/* previous list unchanged. That way the routine may take advantage of temporal */ \
/* coherence, for example when used to sort transparent faces. */ \
if(AlreadySorted) { mNbHits++; return *this; } \
\
/* Else there has been an early out and we must finish computing the histograms */ \
while(p!=pe) \
{ \
/* Create histograms without the previous overhead */ \
h0[*p++]++; h1[*p++]++; h2[*p++]++; h3[*p++]++; \
}
#define CHECK_PASS_VALIDITY(pass) \
/* Shortcut to current counters */ \
uint32* CurCount = &mHistogram[pass<<8]; \
\
/* Reset flag. The sorting pass is supposed to be performed. (default) */ \
bool PerformPass = true; \
\
/* Check pass validity */ \
\
/* If all values have the same byte, sorting is useless. */ \
/* It may happen when sorting bytes or words instead of dwords. */ \
/* This routine actually sorts words faster than dwords, and bytes */ \
/* faster than words. Standard running time (O(4*n))is reduced to O(2*n) */ \
/* for words and O(n) for bytes. Running time for floats depends on actual values... */ \
\
/* Get first byte */ \
uint8 UniqueVal = *(((uint8*)input)+pass); \
\
/* Check that byte's counter */ \
if(CurCount[UniqueVal]==nb) PerformPass=false;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Main sort routine.
* This one is for integer values. After the call, mIndices contains a list of indices in sorted order, i.e. in the order you may process your data.
* \param input [in] a list of integer values to sort
* \param nb [in] number of values to sort
* \param signedvalues [in] true to handle negative values, false if you know your input buffer only contains positive values
* \return Self-Reference
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
RadixSort& RadixSort::sort(const uint32* input, uint32 nb, bool signedvalues)
{
uint32 i, j;
// Checkings
if(!input || !nb) return *this;
// Stats
mTotalCalls++;
// Resize lists if needed
CHECK_RESIZE(nb);
#ifdef RADIX_LOCAL_RAM
// Allocate histograms & offsets on the stack
uint32 mHistogram[256*4];
uint32 mOffset[256];
#endif
// Create histograms (counters). Counters for all passes are created in one run.
// Pros: read input buffer once instead of four times
// Cons: mHistogram is 4Kb instead of 1Kb
// We must take care of signed/unsigned values for temporal coherence.... I just
// have 2 code paths even if just a single opcode changes. Self-modifying code, someone?
if(!signedvalues) { CREATE_HISTOGRAMS(uint32, input); }
else { CREATE_HISTOGRAMS(int32, input); }
// Compute #negative values involved if needed
uint32 NbNegativeValues = 0;
if(signedvalues)
{
// An efficient way to compute the number of negatives values we'll have to deal with is simply to sum the 128
// last values of the last histogram. Last histogram because that's the one for the Most Significant Byte,
// responsible for the sign. 128 last values because the 128 first ones are related to positive numbers.
uint32* h3= &mHistogram[768];
for( i=128;i<256;i++) NbNegativeValues += h3[i]; // 768 for last histogram, 128 for negative part
}
// Radix sort, j is the pass number (0=LSB, 3=MSB)
for( j=0;j<4;j++)
{
CHECK_PASS_VALIDITY(j);
// Sometimes the fourth (negative) pass is skipped because all numbers are negative and the MSB is 0xFF (for example). This is
// not a problem, numbers are correctly sorted anyway.
if(PerformPass)
{
// Should we care about negative values?
if(j!=3 || !signedvalues)
{
// Here we deal with positive values only
// Create offsets
mOffset[0] = 0;
for(i=1;i<256;i++) mOffset[i] = mOffset[i-1] + CurCount[i-1];
}
else
{
// This is a special case to correctly handle negative integers. They're sorted in the right order but at the wrong place.
// Create biased offsets, in order for negative numbers to be sorted as well
mOffset[0] = NbNegativeValues; // First positive number takes place after the negative ones
for(i=1;i<128;i++) mOffset[i] = mOffset[i-1] + CurCount[i-1]; // 1 to 128 for positive numbers
// Fixing the wrong place for negative values
mOffset[128] = 0;
for(i=129;i<256;i++) mOffset[i] = mOffset[i-1] + CurCount[i-1];
}
// Perform Radix Sort
uint8* InputBytes = (uint8*)input;
uint32* Indices = mIndices;
uint32* IndicesEnd = &mIndices[nb];
InputBytes += j;
while(Indices!=IndicesEnd)
{
uint32 id = *Indices++;
mIndices2[mOffset[InputBytes[id<<2]]++] = id;
}
// Swap pointers for next pass. Valid indices - the most recent ones - are in mIndices after the swap.
uint32* Tmp = mIndices; mIndices = mIndices2; mIndices2 = Tmp;
}
}
return *this;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Main sort routine.
* This one is for floating-point values. After the call, mIndices contains a list of indices in sorted order, i.e. in the order you may process your data.
* \param input [in] a list of floating-point values to sort
* \param nb [in] number of values to sort
* \return Self-Reference
* \warning only sorts IEEE floating-point values
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
RadixSort& RadixSort::sort(const float* input2, uint32 nb)
{
uint32 i, j;
// Checkings
if(!input2 || !nb) return *this;
// Stats
mTotalCalls++;
uint32* input = (uint32*)input2;
// Resize lists if needed
CHECK_RESIZE(nb);
#ifdef RADIX_LOCAL_RAM
// Allocate histograms & offsets on the stack
uint32 mHistogram[256*4];
uint32 mOffset[256];
#endif
// Create histograms (counters). Counters for all passes are created in one run.
// Pros: read input buffer once instead of four times
// Cons: mHistogram is 4Kb instead of 1Kb
// Floating-point values are always supposed to be signed values, so there's only one code path there.
// Please note the floating point comparison needed for temporal coherence! Although the resulting asm code
// is dreadful, this is surprisingly not such a performance hit - well, I suppose that's a big one on first
// generation Pentiums....We can't make comparison on integer representations because, as Chris said, it just
// wouldn't work with mixed positive/negative values....
{ CREATE_HISTOGRAMS(float, input2); }
// Compute #negative values involved if needed
uint32 NbNegativeValues = 0;
// An efficient way to compute the number of negatives values we'll have to deal with is simply to sum the 128
// last values of the last histogram. Last histogram because that's the one for the Most Significant Byte,
// responsible for the sign. 128 last values because the 128 first ones are related to positive numbers.
uint32* h3= &mHistogram[768];
for( i=128;i<256;i++) NbNegativeValues += h3[i]; // 768 for last histogram, 128 for negative part
// Radix sort, j is the pass number (0=LSB, 3=MSB)
for( j=0;j<4;j++)
{
// Should we care about negative values?
if(j!=3)
{
// Here we deal with positive values only
CHECK_PASS_VALIDITY(j);
if(PerformPass)
{
// Create offsets
mOffset[0] = 0;
for( i=1;i<256;i++) mOffset[i] = mOffset[i-1] + CurCount[i-1];
// Perform Radix Sort
uint8* InputBytes = (uint8*)input;
uint32* Indices = mIndices;
uint32* IndicesEnd = &mIndices[nb];
InputBytes += j;
while(Indices!=IndicesEnd)
{
uint32 id = *Indices++;
mIndices2[mOffset[InputBytes[id<<2]]++] = id;
}
// Swap pointers for next pass. Valid indices - the most recent ones - are in mIndices after the swap.
uint32* Tmp = mIndices; mIndices = mIndices2; mIndices2 = Tmp;
}
}
else
{
// This is a special case to correctly handle negative values
CHECK_PASS_VALIDITY(j);
if(PerformPass)
{
// Create biased offsets, in order for negative numbers to be sorted as well
mOffset[0] = NbNegativeValues; // First positive number takes place after the negative ones
for(i=1;i<128;i++) mOffset[i] = mOffset[i-1] + CurCount[i-1]; // 1 to 128 for positive numbers
// We must reverse the sorting order for negative numbers!
mOffset[255] = 0;
for(i=0;i<127;i++) mOffset[254-i] = mOffset[255-i] + CurCount[255-i]; // Fixing the wrong order for negative values
for(i=128;i<256;i++) mOffset[i] += CurCount[i]; // Fixing the wrong place for negative values
// Perform Radix Sort
for(i=0;i<nb;i++)
{
uint32 Radix = input[mIndices[i]]>>24; // Radix byte, same as above. AND is useless here (uint32).
// ### cmp to be killed. Not good. Later.
if(Radix<128) mIndices2[mOffset[Radix]++] = mIndices[i]; // Number is positive, same as above
else mIndices2[--mOffset[Radix]] = mIndices[i]; // Number is negative, flip the sorting order
}
// Swap pointers for next pass. Valid indices - the most recent ones - are in mIndices after the swap.
uint32* Tmp = mIndices; mIndices = mIndices2; mIndices2 = Tmp;
}
else
{
// The pass is useless, yet we still have to reverse the order of current list if all values are negative.
if(UniqueVal>=128)
{
for(i=0;i<nb;i++) mIndices2[i] = mIndices[nb-i-1];
// Swap pointers for next pass. Valid indices - the most recent ones - are in mIndices after the swap.
uint32* Tmp = mIndices; mIndices = mIndices2; mIndices2 = Tmp;
}
}
}
}
return *this;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Resets the inner indices. After the call, mIndices is reset.
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void RadixSort::resetIndices()
{
for(uint32 i=0;i<mCurrentSize;i++) mIndices[i] = i;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Gets the ram used.
* \return memory used in bytes
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
uint32 RadixSort::usedRam() const
{
uint32 UsedRam = sizeof(RadixSort);
#ifndef RADIX_LOCAL_RAM
UsedRam += 256*4*sizeof(uint32); // Histograms
UsedRam += 256*sizeof(uint32); // Offsets
#endif
UsedRam += 2*mCurrentSize*sizeof(uint32); // 2 lists of indices
return UsedRam;
}

@ -0,0 +1,69 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Contains source code from the article "Radix Sort Revisited".
* \file Radix.h
* \author Pierre Terdiman
* \date April, 4, 2000
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Include Guard
#ifndef NV_CORE_RADIXSORT_H
#define NV_CORE_RADIXSORT_H
#include <nvcore/nvcore.h>
#define RADIX_LOCAL_RAM
class NVCORE_API RadixSort {
NV_FORBID_COPY(RadixSort);
public:
// Constructor/Destructor
RadixSort();
~RadixSort();
// Sorting methods
RadixSort & sort(const uint32* input, uint32 nb, bool signedvalues=true);
RadixSort & sort(const float* input, uint32 nb);
//! Access to results. mIndices is a list of indices in sorted order, i.e. in the order you may further process your data
inline uint32 * indices() const { return mIndices; }
//! mIndices2 gets trashed on calling the sort routine, but otherwise you can recycle it the way you want.
inline uint32 * recyclable() const { return mIndices2; }
// Stats
uint32 usedRam() const;
//! Returns the total number of calls to the radix sorter.
inline uint32 totalCalls() const { return mTotalCalls; }
//! Returns the number of premature exits due to temporal coherence.
inline uint32 hits() const { return mNbHits; }
private:
#ifndef RADIX_LOCAL_RAM
uint32* mHistogram; //!< Counters for each byte
uint32* mOffset; //!< Offsets (nearly a cumulative distribution function)
#endif
uint32 mCurrentSize; //!< Current size of the indices list
uint32 mPreviousSize; //!< Size involved in previous call
uint32* mIndices; //!< Two lists, swapped each pass
uint32* mIndices2;
// Stats
uint32 mTotalCalls;
uint32 mNbHits;
// Internal methods
bool resize(uint32 nb);
void resetIndices();
};
#endif // NV_CORE_RADIXSORT_H

@ -0,0 +1,336 @@
#ifndef NV_STDSTREAM_H
#define NV_STDSTREAM_H
#include <nvcore/Stream.h>
#include <stdio.h> // fopen
#include <string.h> // memcpy
#include <exception> // std::exception
namespace nv
{
// Portable version of fopen.
inline FILE * fileOpen(const char * fileName, const char * mode)
{
#if NV_CC_MSVC && _MSC_VER >= 1400
FILE * fp;
if (fopen_s(&fp, fileName, mode) == 0) {
return fp;
}
return NULL;
#else
return fopen(fileName, mode);
#endif
}
/// Base stdio stream.
class StdStream : public Stream
{
public:
/// Ctor.
StdStream( FILE * fp, bool autoclose=true ) :
m_fp(fp), m_autoclose(autoclose) { }
/// Dtor.
virtual ~StdStream()
{
if( m_fp != NULL && m_autoclose ) {
fclose( m_fp );
}
}
/** @name Stream implementation. */
//@{
virtual void seek( int pos )
{
nvDebugCheck(m_fp != NULL);
fseek(m_fp, pos, SEEK_SET);
}
virtual int tell() const
{
nvDebugCheck(m_fp != NULL);
return ftell(m_fp);
}
virtual int size() const
{
int pos = ftell(m_fp);
fseek(m_fp, 0, SEEK_END);
int end = ftell(m_fp);
fseek(m_fp, pos, SEEK_SET);
return end;
}
virtual bool isError() const
{
return m_fp == NULL || ferror( m_fp ) != 0;
}
virtual bool isAtEnd() const
{
nvDebugCheck(m_fp != NULL);
return feof( m_fp ) != 0;
}
/// Always true.
virtual bool isSeekable() const { return true; }
//@}
protected:
FILE * m_fp;
bool m_autoclose;
};
/// Standard output stream.
class StdOutputStream : public StdStream
{
public:
/// Construct stream by file name.
StdOutputStream( const char * name ) :
StdStream(fileOpen(name, "wb")) { }
/// Construct stream by file handle.
StdOutputStream( FILE * fp, bool autoclose=true ) : StdStream(fp, autoclose)
{
}
/** @name Stream implementation. */
//@{
/// Write data.
virtual void serialize( void * data, int len )
{
nvDebugCheck(data != NULL);
nvDebugCheck(m_fp != NULL);
fwrite(data, len, 1, m_fp);
}
virtual bool isLoading() const
{
return false;
}
virtual bool isSaving() const
{
return true;
}
//@}
};
/// Standard input stream.
class StdInputStream : public StdStream
{
public:
/// Construct stream by file name.
StdInputStream( const char * name ) :
StdStream(fileOpen(name, "rb")) { }
/// Construct stream by file handle.
StdInputStream( FILE * fp, bool autoclose=true ) : StdStream(fp, autoclose)
{
}
/** @name Stream implementation. */
//@{
/// Read data.
virtual void serialize( void * data, int len )
{
nvDebugCheck(data != NULL);
nvDebugCheck(m_fp != NULL);
fread(data, len, 1, m_fp);
}
virtual bool isLoading() const
{
return true;
}
virtual bool isSaving() const
{
return false;
}
//@}
};
/// Memory input stream.
class MemoryInputStream : public Stream
{
public:
/// Ctor.
MemoryInputStream( const uint8 * mem, int size ) :
m_mem(mem), m_ptr(mem), m_size(size) { }
/** @name Stream implementation. */
//@{
/// Read data.
virtual void serialize( void * data, int len )
{
nvDebugCheck(data != NULL);
nvDebugCheck(!isError());
memcpy( data, m_ptr, len );
m_ptr += len;
}
virtual void seek( int pos )
{
nvDebugCheck(!isError());
m_ptr = m_mem + pos;
nvDebugCheck(!isError());
}
virtual int tell() const
{
return m_ptr - m_mem;
}
virtual int size() const
{
return m_size;
}
virtual bool isError() const
{
return m_mem == NULL || m_ptr > m_mem + m_size || m_ptr < m_mem;
}
virtual bool isAtEnd() const
{
return m_ptr == m_mem + m_size;
}
/// Always true.
virtual bool isSeekable() const
{
return true;
}
virtual bool isLoading() const
{
return true;
}
virtual bool isSaving() const
{
return false;
}
//@}
private:
const uint8 * m_mem;
const uint8 * m_ptr;
int m_size;
};
/// Protected input stream.
class ProtectedStream : public Stream
{
public:
/// Ctor.
ProtectedStream( Stream & s ) : m_s(&s), m_autodelete(false)
{
}
/// Ctor.
ProtectedStream( Stream * s, bool autodelete = true ) :
m_s(s), m_autodelete(autodelete)
{
nvDebugCheck(m_s != NULL);
}
/// Dtor.
virtual ~ProtectedStream()
{
if( m_autodelete ) {
delete m_s;
}
}
/** @name Stream implementation. */
//@{
/// Read data.
virtual void serialize( void * data, int len )
{
nvDebugCheck(data != NULL);
m_s->serialize( data, len );
if( m_s->isError() ) {
throw std::exception();
}
}
virtual void seek( int pos )
{
m_s->seek( pos );
if( m_s->isError() ) {
throw std::exception();
}
}
virtual int tell() const
{
return m_s->tell();
}
virtual int size() const
{
return m_s->size();
}
virtual bool isError() const
{
return m_s->isError();
}
virtual bool isAtEnd() const
{
return m_s->isAtEnd();
}
virtual bool isSeekable() const
{
return m_s->isSeekable();
}
virtual bool isLoading() const
{
return m_s->isLoading();
}
virtual bool isSaving() const
{
return m_s->isSaving();
}
//@}
private:
Stream * m_s;
bool m_autodelete;
};
} // nv namespace
#endif // NV_STDSTREAM_H

@ -0,0 +1,632 @@
// This code is in the public domain -- castanyo@yahoo.es
#include <nvcore/StrLib.h>
#include <math.h> // log
#include <stdio.h> // vsnprintf
#if NV_CC_MSVC
#include <stdarg.h> // vsnprintf
#endif
#if NV_OS_WIN32
#define NV_PATH_SEPARATOR '\\'
#else
#define NV_PATH_SEPARATOR '/'
#endif
using namespace nv;
namespace
{
static char * strAlloc(uint size)
{
return static_cast<char *>(mem::malloc(size));
}
static char * strReAlloc(char * str, uint size)
{
return static_cast<char *>(mem::realloc(str, size));
}
static void strFree(const char * str)
{
return mem::free(const_cast<char *>(str));
}
/*static char * strDup( const char * str )
{
nvDebugCheck( str != NULL );
uint len = uint(strlen( str ) + 1);
char * dup = strAlloc( len );
memcpy( dup, str, len );
return dup;
}*/
// helper function for integer to string conversion.
static char * i2a( uint i, char *a, uint r )
{
if( i / r > 0 ) {
a = i2a( i / r, a, r );
}
*a = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"[i % r];
return a + 1;
}
// Locale independent functions.
static inline char toUpper( char c ) {
return (c<'a' || c>'z') ? (c) : (c+'A'-'a');
}
static inline char toLower( char c ) {
return (c<'A' || c>'Z') ? (c) : (c+'a'-'A');
}
static inline bool isAlpha( char c ) {
return (c>='a' && c<='z') || (c>='A' && c<='Z');
}
static inline bool isDigit( char c ) {
return c>='0' && c<='9';
}
static inline bool isAlnum( char c ) {
return (c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9');
}
}
int nv::strCmp(const char * s1, const char * s2)
{
nvDebugCheck(s1 != NULL);
nvDebugCheck(s2 != NULL);
return strcmp(s1, s2);
}
int nv::strCaseCmp(const char * s1, const char * s2)
{
nvDebugCheck(s1 != NULL);
nvDebugCheck(s1 != NULL);
#if NV_CC_MSVC
return _stricmp(s1, s2);
#else
return strcasecmp(s1, s2);
#endif
}
void nv::strCpy(char * dst, int size, const char * src)
{
nvDebugCheck(dst != NULL);
nvDebugCheck(src != NULL);
#if NV_CC_MSVC && _MSC_VER >= 1400
strcpy_s(dst, size, src);
#else
NV_UNUSED(size);
strcpy(dst, src);
#endif
}
void nv::strCat(char * dst, int size, const char * src)
{
nvDebugCheck(dst != NULL);
nvDebugCheck(src != NULL);
#if NV_CC_MSVC && _MSC_VER >= 1400
strcat_s(dst, size, src);
#else
NV_UNUSED(size);
strcat(dst, src);
#endif
}
/** Pattern matching routine. I don't remember where did I get this. */
bool nv::strMatch(const char * str, const char * pat)
{
nvDebugCheck(str != NULL);
nvDebugCheck(pat != NULL);
char c2;
while (true) {
if (*pat==0) {
if (*str==0) return true;
else return false;
}
if ((*str==0) && (*pat!='*')) return false;
if (*pat=='*') {
pat++;
if (*pat==0) return true;
while (true) {
if (strMatch(str, pat)) return true;
if (*str==0) return false;
str++;
}
}
if (*pat=='?') goto match;
if (*pat=='[') {
pat++;
while (true) {
if ((*pat==']') || (*pat==0)) return false;
if (*pat==*str) break;
if (pat[1] == '-') {
c2 = pat[2];
if (c2==0) return false;
if ((*pat<=*str) && (c2>=*str)) break;
if ((*pat>=*str) && (c2<=*str)) break;
pat+=2;
}
pat++;
}
while (*pat!=']') {
if (*pat==0) {
pat--;
break;
}
pat++;
}
goto match;
}
if (*pat == NV_PATH_SEPARATOR) {
pat++;
if (*pat==0) return false;
}
if (*pat!=*str) return false;
match:
pat++;
str++;
}
}
/** Empty string. */
StringBuilder::StringBuilder() : m_size(0), m_str(NULL)
{
}
/** Preallocate space. */
StringBuilder::StringBuilder( int size_hint ) : m_size(size_hint)
{
nvDebugCheck(m_size > 0);
m_str = strAlloc(m_size);
*m_str = '\0';
}
/** Copy ctor. */
StringBuilder::StringBuilder( const StringBuilder & s ) : m_size(0), m_str(NULL)
{
copy(s);
}
/** Allocate and copy string. */
StringBuilder::StringBuilder( int size_hint, const StringBuilder & s) : m_size(size_hint), m_str(NULL)
{
nvDebugCheck(m_size > 0);
m_str = strAlloc(m_size);
copy(s);
}
/** Allocate and format string. */
StringBuilder::StringBuilder( const char * fmt, ... ) : m_size(0), m_str(NULL)
{
nvDebugCheck(fmt != NULL);
va_list arg;
va_start( arg, fmt );
format( fmt, arg );
va_end( arg );
}
/** Allocate and format string. */
StringBuilder::StringBuilder( int size_hint, const char * fmt, ... ) : m_size(size_hint), m_str(NULL)
{
nvDebugCheck(m_size > 0);
nvDebugCheck(fmt != NULL);
m_str = strAlloc(m_size);
va_list arg;
va_start( arg, fmt );
format( fmt, arg );
va_end( arg );
}
/** Delete the string. */
StringBuilder::~StringBuilder()
{
m_size = 0;
strFree(m_str);
m_str = NULL;
}
/** Format a string safely. */
StringBuilder & StringBuilder::format( const char * fmt, ... )
{
nvDebugCheck(fmt != NULL);
va_list arg;
va_start( arg, fmt );
format( fmt, arg );
va_end( arg );
return *this;
}
/** Format a string safely. */
StringBuilder & StringBuilder::format( const char * fmt, va_list arg )
{
nvCheck(fmt != NULL);
nvCheck(m_size >= 0);
if( m_size == 0 ) {
m_size = 64;
m_str = strAlloc( m_size );
}
va_list tmp;
va_copy(tmp, arg);
#if NV_CC_MSVC && _MSC_VER >= 1400
int n = vsnprintf_s(m_str, m_size, _TRUNCATE, fmt, tmp);
#else
int n = vsnprintf(m_str, m_size, fmt, tmp);
#endif
va_end(tmp);
while( n < 0 || n >= int(m_size) ) {
if( n > -1 ) {
m_size = n + 1;
}
else {
m_size *= 2;
}
m_str = strReAlloc(m_str, m_size);
va_copy(tmp, arg);
#if NV_CC_MSVC && _MSC_VER >= 1400
n = vsnprintf_s(m_str, m_size, _TRUNCATE, fmt, tmp);
#else
n = vsnprintf(m_str, m_size, fmt, tmp);
#endif
va_end(tmp);
}
nvDebugCheck(n < int(m_size));
// Make sure it's null terminated.
nvDebugCheck(m_str[n] == '\0');
//str[n] = '\0';
return *this;
}
/** Append a string. */
StringBuilder & StringBuilder::append( const char * s )
{
nvCheck(s != NULL);
nvCheck(m_size >= 0);
const uint slen = uint(strlen( s ));
if( m_str == NULL ) {
m_size = slen + 1;
m_str = strAlloc(m_size);
strCpy( m_str, m_size, s );
}
else {
const uint len = uint(strlen( m_str ));
if( m_size < len + slen + 1 ) {
m_size = len + slen + 1;
m_str = strReAlloc(m_str, m_size);
}
strCat( m_str, m_size, s );
}
return *this;
}
/** Append a formatted string. */
StringBuilder & StringBuilder::appendFormat( const char * format, ... )
{
nvDebugCheck( format != NULL );
va_list arg;
va_start( arg, format );
appendFormat( format, arg );
va_end( arg );
return *this;
}
/** Append a formatted string. */
StringBuilder & StringBuilder::appendFormat( const char * format, va_list arg )
{
nvDebugCheck( format != NULL );
va_list tmp;
va_copy(tmp, arg);
StringBuilder tmp_str;
tmp_str.format( format, tmp );
append( tmp_str );
va_end(tmp);
return *this;
}
/** Convert number to string in the given base. */
StringBuilder & StringBuilder::number( int i, int base )
{
nvCheck( base >= 2 );
nvCheck( base <= 36 );
// @@ This needs to be done correctly.
// length = floor(log(i, base));
uint len = uint(log(float(i)) / log(float(base)) + 2); // one more if negative
reserve(len);
if( i < 0 ) {
*m_str = '-';
*i2a(uint(-i), m_str+1, base) = 0;
}
else {
*i2a(i, m_str, base) = 0;
}
return *this;
}
/** Convert number to string in the given base. */
StringBuilder & StringBuilder::number( uint i, int base )
{
nvCheck( base >= 2 );
nvCheck( base <= 36 );
// @@ This needs to be done correctly.
// length = floor(log(i, base));
uint len = uint(log(float(i)) / log(float(base)) - 0.5f + 1);
reserve(len);
*i2a(i, m_str, base) = 0;
return *this;
}
/** Resize the string preserving the contents. */
StringBuilder & StringBuilder::reserve( uint size_hint )
{
nvCheck(size_hint != 0);
if( size_hint > m_size ) {
m_str = strReAlloc(m_str, size_hint);
m_size = size_hint;
}
return *this;
}
/** Copy a string safely. */
StringBuilder & StringBuilder::copy( const char * s )
{
nvCheck( s != NULL );
uint str_size = uint(strlen( s )) + 1;
reserve(str_size);
strCpy( m_str, str_size, s );
return *this;
}
/** Copy an StringBuilder. */
StringBuilder & StringBuilder::copy( const StringBuilder & s )
{
if( s.m_str == NULL ) {
nvCheck( s.m_size == 0 );
m_size = 0;
strFree( m_str );
m_str = NULL;
}
else {
reserve( s.m_size );
strCpy( m_str, s.m_size, s.m_str );
}
return *this;
}
/** Reset the string. */
void StringBuilder::reset()
{
m_size = 0;
strFree( m_str );
m_str = NULL;
}
Path::Path(const char * fmt, ...)
{
nvDebugCheck( fmt != NULL );
va_list arg;
va_start( arg, fmt );
format( fmt, arg );
va_end( arg );
}
Path::Path(int size_hint, const char * fmt, ...) : StringBuilder(size_hint)
{
nvDebugCheck( fmt != NULL );
va_list arg;
va_start( arg, fmt );
format( fmt, arg );
va_end( arg );
}
/// Get the file name from a path.
const char * Path::fileName() const
{
return fileName(m_str);
}
/// Get the extension from a file path.
const char * Path::extension() const
{
return extension(m_str);
}
/// Toggles path separators (ie. \\ into /).
void Path::translatePath()
{
nvCheck( m_str != NULL );
for(int i = 0; ; i++) {
if( m_str[i] == '\0' ) break;
#if NV_PATH_SEPARATOR == '/'
if( m_str[i] == '\\' ) m_str[i] = NV_PATH_SEPARATOR;
#else
if( m_str[i] == '/' ) m_str[i] = NV_PATH_SEPARATOR;
#endif
}
}
/**
* Strip the file name from a path.
* @warning path cannot end with '/' o '\\', can't it?
*/
void Path::stripFileName()
{
nvCheck( m_str != NULL );
int length = (int)strlen(m_str) - 1;
while (length > 0 && m_str[length] != '/' && m_str[length] != '\\'){
length--;
}
if( length ) {
m_str[length+1] = 0;
}
else {
m_str[0] = 0;
}
}
/// Strip the extension from a path name.
void Path::stripExtension()
{
nvCheck( m_str != NULL );
int length = (int)strlen(m_str) - 1;
while( length > 0 && m_str[length] != '.' ) {
length--;
if( m_str[length] == NV_PATH_SEPARATOR ) {
return; // no extension
}
}
if( length ) {
m_str[length] = 0;
}
}
/// Get the path separator.
// static
char Path::separator()
{
return NV_PATH_SEPARATOR;
}
// static
const char * Path::fileName(const char * str)
{
nvCheck( str != NULL );
int length = (int)strlen(str) - 1;
while( length >= 0 && str[length] != separator() ) {
length--;
}
return &str[length+1];
}
// static
const char * Path::extension(const char * str)
{
nvCheck( str != NULL );
int length, l;
l = length = (int)strlen( str );
while( length > 0 && str[length] != '.' ) {
length--;
if( str[length] == separator() ) {
return &str[l]; // no extension
}
}
if( length == 0 ) {
return &str[l];
}
return &str[length];
}
// static
String String::s_null(String::null);
/// Clone this string
String String::clone() const
{
String str(data);
return str;
}
void String::setString(const char * str)
{
if( str == NULL ) {
data = s_null.data;
}
else {
allocString( str );
}
addRef();
}
void String::setString(const char * str, int length)
{
nvDebugCheck(str != NULL);
allocString(str, length);
addRef();
}
void String::setString(const StringBuilder & str)
{
if( str.str() == NULL ) {
data = s_null.data;
}
else {
allocString(str);
}
addRef();
}

@ -0,0 +1,348 @@
// This code is in the public domain -- castanyo@yahoo.es
#ifndef NV_CORE_STRING_H
#define NV_CORE_STRING_H
#include <nvcore/nvcore.h>
#include <nvcore/Containers.h> // swap
#include <string.h> // strlen, strcmp, etc.
namespace nv
{
uint strHash(const char * str, uint h) NV_PURE;
/// String hash vased on Bernstein's hash.
inline uint strHash(const char * data, uint h = 5381)
{
uint i;
while(data[i] != 0) {
h = (33 * h) ^ uint(data[i]);
i++;
}
return h;
}
template <> struct hash<const char *> {
uint operator()(const char * str) const { return strHash(str); }
};
NVCORE_API int strCaseCmp(const char * s1, const char * s2) NV_PURE;
NVCORE_API int strCmp(const char * s1, const char * s2) NV_PURE;
NVCORE_API void strCpy(char * dst, int size, const char * src);
NVCORE_API void strCat(char * dst, int size, const char * src);
NVCORE_API bool strMatch(const char * str, const char * pat) NV_PURE;
/// String builder.
class StringBuilder
{
public:
NVCORE_API StringBuilder();
NVCORE_API explicit StringBuilder( int size_hint );
NVCORE_API StringBuilder( const StringBuilder & );
NVCORE_API StringBuilder( int size_hint, const StringBuilder & );
NVCORE_API StringBuilder( const char * format, ... ) __attribute__((format (printf, 2, 3)));
NVCORE_API StringBuilder( int size_hint, const char * format, ... ) __attribute__((format (printf, 3, 4)));
NVCORE_API ~StringBuilder();
NVCORE_API StringBuilder & format( const char * format, ... ) __attribute__((format (printf, 2, 3)));
NVCORE_API StringBuilder & format( const char * format, va_list arg );
NVCORE_API StringBuilder & append( const char * str );
NVCORE_API StringBuilder & appendFormat( const char * format, ... ) __attribute__((format (printf, 2, 3)));
NVCORE_API StringBuilder & appendFormat( const char * format, va_list arg );
NVCORE_API StringBuilder & number( int i, int base = 10 );
NVCORE_API StringBuilder & number( uint i, int base = 10 );
NVCORE_API StringBuilder & reserve( uint size_hint );
NVCORE_API StringBuilder & copy( const char * str );
NVCORE_API StringBuilder & copy( const StringBuilder & str );
NVCORE_API StringBuilder & toLower();
NVCORE_API StringBuilder & toUpper();
NVCORE_API void reset();
NVCORE_API bool empty() const { return m_size == 0; }
// const char * accessors
operator const char * () const { return m_str; }
operator char * () { return m_str; }
const char * str() const { return m_str; }
char * str() { return m_str; }
/// Implement value semantics.
StringBuilder & operator=( const StringBuilder & s ) {
return copy(s);
}
/// Equal operator.
bool operator==( const StringBuilder & s ) const {
nvCheck(m_str != NULL);
nvCheck(s.m_str != NULL);
return strcmp(s.m_str, m_str) != 0;
}
/// Return the exact length.
uint length() const { nvCheck(m_str != NULL); return uint(strlen(m_str)); }
/// Return the size of the string container.
uint capacity() const { nvCheck(m_str != NULL); return m_size; }
/// Return the hash of the string.
uint hash() const { nvCheck(m_str != NULL); return strHash(m_str); }
/// Swap strings.
friend void swap(StringBuilder & a, StringBuilder & b) {
nv::swap(a.m_size, b.m_size);
nv::swap(a.m_str, b.m_str);
}
static char separator();
protected:
/// Size of the string container.
uint m_size;
/// String.
char * m_str;
};
/// Path string.
class Path : public StringBuilder
{
public:
Path() : StringBuilder() {}
explicit Path(int size_hint) : StringBuilder(size_hint) {}
Path(const StringBuilder & str) : StringBuilder(str) {}
Path(int size_hint, const StringBuilder & str) : StringBuilder(size_hint, str) {}
NVCORE_API Path(const char * format, ...) __attribute__((format (printf, 2, 3)));
NVCORE_API Path(int size_hint, const char * format, ...) __attribute__((format (printf, 3, 4)));
NVCORE_API const char * fileName() const;
NVCORE_API const char * extension() const;
NVCORE_API void translatePath();
NVCORE_API void stripFileName();
NVCORE_API void stripExtension();
// statics
NVCORE_API static char separator();
NVCORE_API static const char * fileName(const char *);
NVCORE_API static const char * extension(const char *);
};
/// String class.
class String
{
public:
/// Constructs a null string. @sa isNull()
String()
{
data = s_null.data;
addRef();
}
/// Constructs a shared copy of str.
String(const String & str)
{
data = str.data;
addRef();
}
/// Constructs a shared string from a standard string.
String(const char * str)
{
setString(str);
}
/// Constructs a shared string from a standard string.
String(const char * str, int length)
{
setString(str, length);
}
/// Constructs a shared string from a StringBuilder.
String(const StringBuilder & str)
{
setString(str);
}
/// Dtor.
~String()
{
nvDebugCheck(data != NULL);
release();
}
NVCORE_API String clone() const;
/// Release the current string and allocate a new one.
const String & operator=( const char * str )
{
release();
setString( str );
return *this;
}
/// Release the current string and allocate a new one.
const String & operator=( const StringBuilder & str )
{
release();
setString( str );
return *this;
}
/// Implement value semantics.
String & operator=( const String & str )
{
release();
data = str.data;
addRef();
return *this;
}
/// Equal operator.
bool operator==( const String & str ) const
{
nvDebugCheck(data != NULL);
nvDebugCheck(str.data != NULL);
if( str.data == data ) {
return true;
}
return strcmp(data, str.data) == 0;
}
/// Equal operator.
bool operator==( const char * str ) const
{
nvDebugCheck(data != NULL);
nvCheck(str != NULL); // Use isNull!
return strcmp(data, str) == 0;
}
/// Not equal operator.
bool operator!=( const String & str ) const
{
nvDebugCheck(data != NULL);
nvDebugCheck(str.data != NULL);
if( str.data == data ) {
return false;
}
return strcmp(data, str.data) != 0;
}
/// Not equal operator.
bool operator!=( const char * str ) const
{
nvDebugCheck(data != NULL);
nvCheck(str != NULL); // Use isNull!
return strcmp(data, str) != 0;
}
/// Returns true if this string is the null string.
bool isNull() const { nvDebugCheck(data != NULL); return data == s_null.data; }
/// Return the exact length.
uint length() const { nvDebugCheck(data != NULL); return uint(strlen(data)); }
/// Return the hash of the string.
uint hash() const { nvDebugCheck(data != NULL); return strHash(data); }
/// const char * cast operator.
operator const char * () const { nvDebugCheck(data != NULL); return data; }
/// Get string pointer.
const char * str() const { nvDebugCheck(data != NULL); return data; }
private:
enum null_t { null };
// Private constructor for null string.
String(null_t) {
setString("");
}
// Add reference count.
void addRef() {
nvDebugCheck(data != NULL);
setRefCount(getRefCount() + 1);
}
// Decrease reference count.
void release() {
nvDebugCheck(data != NULL);
const uint16 count = getRefCount();
setRefCount(count - 1);
if( count - 1 == 0 ) {
mem::free(data - 2);
data = NULL;
}
}
uint16 getRefCount() const {
return *reinterpret_cast<const uint16 *>(data - 2);
}
void setRefCount(uint16 count) {
nvCheck(count < 0xFFFF);
*reinterpret_cast<uint16 *>(const_cast<char *>(data - 2)) = uint16(count);
}
void setData(const char * str) {
data = str + 2;
}
void allocString(const char * str)
{
allocString(str, (int)strlen(str));
}
void allocString(const char * str, int len)
{
const char * ptr = static_cast<const char *>(mem::malloc(2 + len + 1));
setData( ptr );
setRefCount( 0 );
// Copy string.
strCpy(const_cast<char *>(data), len + 1, str);
}
NVCORE_API void setString(const char * str);
NVCORE_API void setString(const char * str, int length);
NVCORE_API void setString(const StringBuilder & str);
/// Swap strings.
friend void swap(String & a, String & b) {
swap(a.data, b.data);
}
private:
NVCORE_API static String s_null;
const char * data;
};
} // nv namespace
#endif // NV_CORE_STRING_H

@ -0,0 +1,165 @@
// This code is in the public domain -- castanyo@yahoo.es
#ifndef NVCORE_STREAM_H
#define NVCORE_STREAM_H
#include <nvcore/nvcore.h>
#include <nvcore/Debug.h>
namespace nv
{
/** Base stream class. */
class Stream {
public:
enum ByteOrder {
LittleEndian = false,
BigEndian = true,
};
/// Get the byte order of the system.
static ByteOrder getSystemByteOrder() {
# if NV_LITTLE_ENDIAN
return LittleEndian;
# else
return BigEndian;
# endif
}
/// Ctor.
Stream() : m_byteOrder(LittleEndian) { }
/// Virtual destructor.
virtual ~Stream() {}
/// Set byte order.
void setByteOrder(ByteOrder bo) { m_byteOrder = bo; }
/// Get byte order.
ByteOrder byteOrder() const { return m_byteOrder; }
/// Serialize the given data.
virtual void serialize( void * data, int len ) = 0;
/// Move to the given position in the archive.
virtual void seek( int pos ) = 0;
/// Return the current position in the archive.
virtual int tell() const = 0;
/// Return the current size of the archive.
virtual int size() const = 0;
/// Determine if there has been any error.
virtual bool isError() const = 0;
/// Return true if the stream is at the end.
virtual bool isAtEnd() const = 0;
/// Return true if the stream is seekable.
virtual bool isSeekable() const = 0;
/// Return true if this is an input stream.
virtual bool isLoading() const = 0;
/// Return true if this is an output stream.
virtual bool isSaving() const = 0;
// friends
friend Stream & operator<<( Stream & s, bool & c ) {
# if NV_OS_DARWIN
nvStaticCheck(sizeof(bool) == 4);
uint8 b = c ? 1 : 0;
s.serialize( &b, 1 );
c = (b == 1);
# else
nvStaticCheck(sizeof(bool) == 1);
s.serialize( &c, 1 );
# endif
return s;
}
friend Stream & operator<<( Stream & s, char & c ) {
nvStaticCheck(sizeof(char) == 1);
s.serialize( &c, 1 );
return s;
}
friend Stream & operator<<( Stream & s, uint8 & c ) {
nvStaticCheck(sizeof(uint8) == 1);
s.serialize( &c, 1 );
return s;
}
friend Stream & operator<<( Stream & s, int8 & c ) {
nvStaticCheck(sizeof(int8) == 1);
s.serialize( &c, 1 );
return s;
}
friend Stream & operator<<( Stream & s, uint16 & c ) {
nvStaticCheck(sizeof(uint16) == 2);
s.byteOrderSerialize( &c, 2 );
return s;
}
friend Stream & operator<<( Stream & s, int16 & c ) {
nvStaticCheck(sizeof(int16) == 2);
s.byteOrderSerialize( &c, 2 );
return s;
}
friend Stream & operator<<( Stream & s, uint32 & c ) {
nvStaticCheck(sizeof(uint32) == 4);
s.byteOrderSerialize( &c, 4 );
return s;
}
friend Stream & operator<<( Stream & s, int32 & c ) {
nvStaticCheck(sizeof(int32) == 4);
s.byteOrderSerialize( &c, 4 );
return s;
}
friend Stream & operator<<( Stream & s, uint64 & c ) {
nvStaticCheck(sizeof(uint64) == 8);
s.byteOrderSerialize( &c, 8 );
return s;
}
friend Stream & operator<<( Stream & s, int64 & c ) {
nvStaticCheck(sizeof(int64) == 8);
s.byteOrderSerialize( &c, 8 );
return s;
}
friend Stream & operator<<( Stream & s, float & c ) {
nvStaticCheck(sizeof(float) == 4);
s.byteOrderSerialize( &c, 4 );
return s;
}
friend Stream & operator<<( Stream & s, double & c ) {
nvStaticCheck(sizeof(double) == 8);
s.byteOrderSerialize( &c, 8 );
return s;
}
protected:
/** Serialize in the stream byte order. */
Stream & byteOrderSerialize( void * v, int len ) {
if( m_byteOrder == getSystemByteOrder() ) {
serialize( v, len );
}
else {
for( int i=len-1; i>=0; i-- ) {
serialize( (uint8 *)v + i, 1 );
}
}
return *this;
}
private:
ByteOrder m_byteOrder;
};
} // nv namespace
#endif // NV_STREAM_H

@ -0,0 +1,85 @@
// This code is in the public domain -- castanyo@yahoo.es
#include <nvcore/TextReader.h>
using namespace nv;
/// Peek next character.
char TextReader::peek()
{
nvDebugCheck(m_stream != NULL);
nvDebugCheck(m_stream->isSeekable());
if (m_stream->isAtEnd()) {
return 0;
}
uint pos = m_stream->tell();
char c;
m_stream->serialize(&c, 1);
m_stream->seek(pos);
return c;
}
/// Read a single char.
char TextReader::read()
{
nvDebugCheck(m_stream != NULL);
if( m_stream->isAtEnd() ) {
return 0;
}
char c;
m_stream->serialize(&c, 1);
return c;
}
/// Read from the current location to the end of the stream.
const char * TextReader::readToEnd()
{
nvDebugCheck(m_stream != NULL);
const int size = m_stream->size();
m_text.clear();
m_text.reserve(size + 1);
m_text.resize(size);
m_stream->serialize(m_text.unsecureBuffer(), size);
m_text.pushBack('\0');
return m_text.buffer();
}
/// Read from the current location to the end of the line.
const char * TextReader::readLine()
{
m_text.clear();
if (m_stream->isAtEnd()) {
return NULL;
}
while (true) {
char c = read();
if (c == 0 || c == '\n') {
break;
}
else if (c == '\r') {
if( peek() == '\n' ) {
read();
}
break;
}
m_text.pushBack(c);
}
m_text.pushBack('\0');
return m_text.buffer();
}

@ -0,0 +1,38 @@
// This code is in the public domain -- castanyo@yahoo.es
#ifndef NVCORE_TEXTREADER_H
#define NVCORE_TEXTREADER_H
#include <nvcore/nvcore.h>
#include <nvcore/Stream.h>
#include <nvcore/Containers.h>
namespace nv
{
/// Text reader.
class NVCORE_CLASS TextReader {
public:
/// Ctor.
TextReader(Stream * stream) : m_stream(stream), m_text(512) {
nvCheck(stream != NULL);
nvCheck(stream->isLoading());
}
char peek();
char read();
const char *readToEnd();
// Returns a temporary string.
const char * readLine();
private:
Stream * m_stream;
Array<char> m_text;
};
} // nv namespace
#endif // NVCORE_TEXTREADER_H

@ -0,0 +1,44 @@
// This code is in the public domain -- castanyo@yahoo.es
#ifndef NVCORE_TEXTWRITER_H
#define NVCORE_TEXTWRITER_H
#include <nvcore/nvcore.h>
#include <nvcore/Stream.h>
#include <nvcore/StrLib.h>
// @@ NOT IMPLEMENTED !!!
namespace nv
{
/// Text writer.
class NVCORE_CLASS TextWriter
{
public:
/// Ctor.
TextWriter(Stream * s) : s(s), str(1024) {
nvDebugCheck(s != NULL);
nvCheck(s->IsSaving());
}
void write( const char * str, uint len );
void write( const char * format, ... ) __attribute__((format (printf, 2, 3)));
void write( const char * format, va_list arg );
private:
Stream * s;
// Temporary string.
StringBuilder str;
};
} // nv namespace
#endif // NVCORE_TEXTWRITER_H

@ -0,0 +1,245 @@
// This code is in the public domain -- castanyo@yahoo.es
#include <nvcore/Tokenizer.h>
#include <nvcore/StrLib.h>
#include <stdio.h> // vsscanf
#include <stdarg.h> // va_list
#include <stdlib.h> // atof, atoi
#if NV_CC_MSVC
/* vsscanf for Win32
* Written 5/2003 by <mgix@mgix.com>
* This code is in the Public Domain
*/
#include <malloc.h> // alloca
//#include <string.h>
static int vsscanf(const char * buffer, const char * format, va_list argPtr)
{
// Get an upper bound for the # of args
size_t count = 0;
const char *p = format;
while(1) {
char c = *(p++);
if(c==0) break;
if(c=='%' && (p[0]!='*' && p[0]!='%')) ++count;
}
// Make a local stack
size_t stackSize = (2+count)*sizeof(void*);
void **newStack = (void**)alloca(stackSize);
// Fill local stack the way sscanf likes it
newStack[0] = (void*)buffer;
newStack[1] = (void*)format;
memcpy(newStack+2, argPtr, count*sizeof(void*));
// @@ Use: CALL DWORD PTR [sscanf]
// Warp into system sscanf with new stack
int result;
void *savedESP;
__asm
{
mov savedESP, esp
mov esp, newStack
#if _MSC_VER >= 1400
call DWORD PTR [sscanf_s]
#else
call DWORD PTR [sscanf]
#endif
mov esp, savedESP
mov result, eax
}
return result;
}
/*
int hacky_vsscanf(const char *str, int count, const char *format, va_list ap) {
nvCheck(count < 8)
if (count == 0) {
}
void * arg0 = va_arg(ap, void *);
void * arg1 = va_arg(ap, void *);
void * arg2 = va_arg(ap, void *);
void * arg3 = va_arg(ap, void *);
void * arg4 = va_arg(ap, void *);
void * arg5 = va_arg(ap, void *);
void * arg6 = va_arg(ap, void *);
void * arg7 = va_arg(ap, void *);
return sscanf(str, format, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
}
*/
#endif
using namespace nv;
Token::Token() :
m_str(""), m_len(0)
{
}
Token::Token(const Token & token) :
m_str(token.m_str), m_len(token.m_len)
{
}
Token::Token(const char * str, int len) :
m_str(str), m_len(len)
{
}
bool Token::operator==(const char * str) const
{
return strncmp(m_str, str, m_len) == 0;
}
bool Token::operator!=(const char * str) const
{
return strncmp(m_str, str, m_len) != 0;
}
bool Token::isNull()
{
return m_len != 0;
}
float Token::toFloat() const
{
return float(atof(m_str));
}
int Token::toInt() const
{
return atoi(m_str);
}
uint Token::toUnsignedInt() const
{
// @@ TBD
return uint(atoi(m_str));
}
String Token::toString() const
{
return String(m_str, m_len);
}
bool Token::parse(const char * format, int count, ...) const
{
va_list arg;
va_start(arg, count);
int readCount = vsscanf(m_str, format, arg);
va_end(arg);
return readCount == count;
}
Tokenizer::Tokenizer(Stream * stream) :
m_reader(stream), m_lineNumber(0), m_columnNumber(0), m_delimiters("{}()="), m_spaces(" \t")
{
}
bool Tokenizer::nextLine(bool skipEmptyLines /*= true*/)
{
do {
if (!readLine()) {
return false;
}
}
while (!readToken() && skipEmptyLines);
return true;
}
bool Tokenizer::nextToken(bool skipEndOfLine /*= false*/)
{
if (!readToken()) {
if (!skipEndOfLine) {
return false;
}
else {
return nextLine(true);
}
}
return true;
}
bool Tokenizer::readToken()
{
skipSpaces();
const char * begin = m_line + m_columnNumber;
if (*begin == '\0') {
return false;
}
char c = readChar();
if (isDelimiter(c)) {
m_token = Token(begin, 1);
return true;
}
// @@ Add support for quoted tokens "", ''
int len = 0;
while (!isDelimiter(c) && !isSpace(c) && c != '\0') {
c = readChar();
len++;
}
m_columnNumber--;
m_token = Token(begin, len);
return true;
}
char Tokenizer::readChar()
{
return m_line[m_columnNumber++];
}
bool Tokenizer::readLine()
{
m_lineNumber++;
m_columnNumber = 0;
m_line = m_reader.readLine();
return m_line != NULL;
}
void Tokenizer::skipSpaces()
{
while (isSpace(readChar())) {}
m_columnNumber--;
}
bool Tokenizer::isSpace(char c)
{
uint i = 0;
while (m_spaces[i] != '\0') {
if (c == m_spaces[i]) {
return true;
}
i++;
}
return false;
}
bool Tokenizer::isDelimiter(char c)
{
uint i = 0;
while (m_delimiters[i] != '\0') {
if (c == m_delimiters[i]) {
return true;
}
i++;
}
return false;
}

@ -0,0 +1,95 @@
// This code is in the public domain -- castanyo@yahoo.es
#ifndef NV_CORE_TOKENIZER_H
#define NV_CORE_TOKENIZER_H
#include <nvcore/nvcore.h>
#include <nvcore/Stream.h>
#include <nvcore/TextReader.h>
#include <nvcore/StrLib.h>
namespace nv
{
/// A token produced by the Tokenizer.
class NVCORE_CLASS Token
{
public:
Token();
Token(const Token & token);
Token(const char * str, int len);
bool operator==(const char * str) const;
bool operator!=(const char * str) const;
bool isNull();
float toFloat() const;
int toInt() const;
uint toUnsignedInt() const;
String toString() const;
bool parse(const char * format, int count, ...) const __attribute__((format (scanf, 2, 4)));
private:
const char * m_str;
int m_len;
};
/// Exception thrown by the tokenizer.
class TokenizerException
{
public:
TokenizerException(int line, int column) : m_line(line), m_column(column) {}
int line() const { return m_line; }
int column() const { return m_column; }
private:
int m_line;
int m_column;
};
/// A simple stream tokenizer.
class NVCORE_CLASS Tokenizer
{
public:
Tokenizer(Stream * stream);
bool nextLine(bool skipEmptyLines = true);
bool nextToken(bool skipEndOfLine = false);
const Token & token() const { return m_token; }
int lineNumber() const { return m_lineNumber; }
int columnNumber() const { return m_columnNumber; }
void setDelimiters(const char * str) { m_delimiters = str; }
const char * delimiters() const { return m_delimiters; }
void setSpaces(const char * str) { m_spaces = str; }
const char * spaces() const { return m_spaces; }
private:
char readChar();
bool readLine();
bool readToken();
void skipSpaces();
bool isSpace(char c);
bool isDelimiter(char c);
private:
TextReader m_reader;
const char * m_line;
Token m_token;
int m_lineNumber;
int m_columnNumber;
const char * m_delimiters;
const char * m_spaces;
};
} // nv namespace
#endif // NV_CORE_TOKENIZER_H

@ -0,0 +1,172 @@
// This code is in the public domain -- castanyo@yahoo.es
#ifndef NV_CORE_H
#define NV_CORE_H
// cmake config
#include <nvconfig.h>
// Function linkage
#if NVCORE_SHARED
#ifdef NVCORE_EXPORTS
#define NVCORE_API DLL_EXPORT
#define NVCORE_CLASS DLL_EXPORT_CLASS
#else
#define NVCORE_API DLL_IMPORT
#define NVCORE_CLASS DLL_IMPORT
#endif
#else // NVCORE_SHARED
#define NVCORE_API
#define NVCORE_CLASS
#endif // NVCORE_SHARED
// Platform definitions
#include "poshlib/posh.h"
// OS:
// NV_OS_WIN32
// NV_OS_WIN64
// NV_OS_MINGW
// NV_OS_CYGWIN
// NV_OS_LINUX
// NV_OS_UNIX
// NV_OS_DARWIN
#define NV_OS_STRING POSH_OS_STRING
#if defined POSH_OS_LINUX
# define NV_OS_LINUX 1
# define NV_OS_UNIX 1
#elif defined POSH_OS_CYGWIN32
# define NV_OS_CYGWIN 1
#elif defined POSH_OS_MINGW
# define NV_OS_MINGW 1
# define NV_OS_WIN32 1
#elif defined POSH_OS_OSX
# define NV_OS_DARWIN 1
# define NV_OS_UNIX 1
#elif defined POSH_OS_UNIX
# define NV_OS_UNIX 1
#elif defined POSH_OS_WIN32
# define NV_OS_WIN32 1
#elif defined POSH_OS_WIN64
# define NV_OS_WIN64 1
#else
# error "Unsupported OS"
#endif
// CPUs:
// NV_CPU_X86
// NV_CPU_X86_64
// NV_CPU_PPC
#define NV_CPU_STRING POSH_CPU_STRING
#if defined POSH_CPU_X86_64
# define NV_CPU_X86_64 1
#elif defined POSH_CPU_X86
# define NV_CPU_X86 1
#elif defined POSH_CPU_PPC
# define NV_CPU_PPC 1
#else
# error "Unsupported CPU"
#endif
// Compiler:
// NV_CC_GNUC
// NV_CC_MSVC
// @@ NV_CC_MSVC6
// @@ NV_CC_MSVC7
// @@ NV_CC_MSVC8
#if defined POSH_COMPILER_GCC
# define NV_CC_GNUC 1
# define NV_CC_STRING "gcc"
#elif defined POSH_COMPILER_MSVC
# define NV_CC_MSVC 1
# define NV_CC_STRING "msvc"
#else
# error "Unsupported compiler"
#endif
// Endiannes:
#define NV_LITTLE_ENDIAN POSH_LITTLE_ENDIAN
#define NV_BIG_ENDIAN POSH_BIG_ENDIAN
#define NV_ENDIAN_STRING POSH_ENDIAN_STRING
// Version string:
#define NV_VERSION_STRING \
NV_OS_STRING "/" NV_CC_STRING "/" NV_CPU_STRING"/" \
NV_ENDIAN_STRING"-endian - " __DATE__ "-" __TIME__
/// Disable copy constructor and assignment operator.
/// @hideinitializer
#define NV_FORBID_COPY(C) \
private: \
C( const C & ); \
C &operator=( const C & );
/// Disable dynamic allocation on the heap.
/// See Prohibiting Heap-Based Objects in More Effective C++.
/// @hideinitializer
#define NV_FORBID_HEAPALLOC() \
private: \
static void *operator new(size_t size); \
static void *operator new[](size_t size);
// String concatenation macros.
#define NV_STRING_JOIN2(arg1, arg2) NV_DO_STRING_JOIN2(arg1, arg2)
#define NV_DO_STRING_JOIN2(arg1, arg2) arg1 ## arg2
#define NV_STRING_JOIN3(arg1, arg2, arg3) NV_DO_STRING_JOIN3(arg1, arg2, arg3)
#define NV_DO_STRING_JOIN3(arg1, arg2, arg3) arg1 ## arg2 ## arg3
// Startup initialization macro.
#define NV_AT_STARTUP(some_code) \
namespace { \
static struct NV_STRING_JOIN2(AtStartup_, __LINE__) { \
NV_STRING_JOIN2(AtStartup_, __LINE__)() { some_code; } \
} \
NV_STRING_JOIN3(AtStartup_, __LINE__, Instance); \
};
/// Indicate the compiler that the parameter is not used to suppress compier warnings.
/// @hideinitializer
#define NV_UNUSED(a) ((a)=(a))
/// Null index. @@ Move this somewhere else... This could have collisions with other definitions!
#define NIL uint(~0)
/// Null pointer.
#ifndef NULL
#define NULL 0
#endif
// Platform includes
#if NV_CC_MSVC
# if NV_OS_WIN32
# include "DefsVcWin32.h"
# else
# error "MSVC: Platform not supported"
# endif
#elif NV_CC_GNUC
# if NV_OS_LINUX
# include "DefsGnucLinux.h"
# elif NV_OS_DARWIN
# include "DefsGnucDarwin.h"
# elif NV_OS_MINGW
# include "DefsGnucWin32.h"
# elif NV_OS_CYGWIN
# error "GCC: Cygwin not supported"
# else
# error "GCC: Platform not supported"
# endif
#endif
#endif // NV_CORE_H

@ -0,0 +1,14 @@
SET(POSHLIB_SRCS
posh.c
posh.h)
ADD_LIBRARY(posh STATIC ${POSHLIB_SRCS})
ADD_EXECUTABLE(archtest tests/arch/archtest.c)
TARGET_LINK_LIBRARIES(archtest posh)
#ADD_EXECUTABLE(linktest tests/linktest/linktest.cpp tests/linktest/testlib.cpp)
#TARGET_LINK_LIBRARIES(linktest posh)
ADD_TEST(POSHTEST archtest)

@ -0,0 +1,926 @@
/*
LICENSE:
Copyright (c) 2004, Brian Hook
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 names of this package'ss contributors contributors may not
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.
*/
/**
@file posh.c
@author Brian Hook
@date 2002
@brief Portable Open Source Harness primary source file
*/
#include "posh.h"
#if !defined FORCE_DOXYGEN
#if !defined POSH_NO_FLOAT
# define POSH_FLOAT_STRING "enabled"
#else
# define POSH_FLOAT_STRING "disabled"
#endif
#if defined POSH_64BIT_INTEGER
# define POSH_64BIT_INTEGER_STRING "yes"
#else
# define POSH_64BIT_INTEGER_STRING "no"
#endif
#if defined POSH_64BIT_POINTER
# define POSH_POINTER_STRING "64-bits"
#else
# define POSH_POINTER_STRING "32-bits"
#endif
#if defined POSH_LITTLE_ENDIAN
# define IS_BIG_ENDIAN 0
# define NATIVE16 POSH_LittleU16
# define NATIVE32 POSH_LittleU32
# define NATIVE64 POSH_LittleU64
# define FOREIGN16 POSH_BigU16
# define FOREIGN32 POSH_BigU32
# define FOREIGN64 POSH_BigU64
#else
# define IS_BIG_ENDIAN 1
# define NATIVE16 POSH_BigU16
# define NATIVE32 POSH_BigU32
# define NATIVE64 POSH_BigU64
# define FOREIGN16 POSH_LittleU16
# define FOREIGN32 POSH_LittleU32
# define FOREIGN64 POSH_LittleU64
#endif /* POSH_LITTLE_ENDIAN */
static
int
s_testBigEndian( void )
{
union
{
posh_byte_t c[ 4 ];
posh_u32_t i;
} u;
u.i= 1;
if ( u.c[ 0 ] == 1 )
{
return 0;
}
return 1;
}
static
const char *
s_testSerialization( void )
{
posh_byte_t serbuf[ 8 ];
posh_u16_t tmp16;
posh_u32_t tmp32;
/* 16-bit serialization */
POSH_WriteU16ToLittle( serbuf, 0xABCD );
if ( ( tmp16 = POSH_ReadU16FromLittle( serbuf ) ) != 0xABCD )
{
return "*ERROR: failed little-endian 16-bit serialization test";
}
POSH_WriteU16ToBig( serbuf, 0xABCD );
if ( ( tmp16 = POSH_ReadU16FromBig( serbuf ) ) != 0xABCD )
{
return "*ERROR: failed big-endian 16-bit serialization test";
}
/* 32-bit serialization */
POSH_WriteU32ToLittle( serbuf, 0xABCD1234L );
if ( ( tmp32 = POSH_ReadU32FromLittle( serbuf ) ) != 0xABCD1234 )
{
return "*ERROR: failed little-endian 32-bit serialization test";
}
POSH_WriteU32ToBig( serbuf, 0xABCD1234L );
if ( ( tmp32 = POSH_ReadU32FromBig( serbuf ) ) != 0xABCD1234 )
{
return "*ERROR: failed big-endian 32-bit serialization test";
}
#if defined POSH_64BIT_INTEGER
{
#define REF64 POSH_U64(0xFEDCBA9876543210)
posh_u64_t tmp64;
POSH_WriteU64ToLittle( serbuf, REF64 );
if ( ( tmp64 = POSH_ReadU64FromLittle( serbuf ) ) != REF64 )
{
return "*ERROR: failed little-endian 64-bit serialization test";
}
POSH_WriteU64ToBig( serbuf, REF64 );
if ( ( tmp64 = POSH_ReadU64FromBig( serbuf ) ) != REF64 )
{
return "*ERROR: failed big-endian 64-bit serialization test";
}
}
#endif
return 0;
}
#if !defined POSH_NO_FLOAT
static
const char *
s_testFloatingPoint( void )
{
float fRef = 10.0f/30.0f;
double dRef = 10.0/30.0;
posh_byte_t dbuf[ 8 ];
float fTmp;
double dTmp;
fTmp = POSH_FloatFromLittleBits( POSH_LittleFloatBits( fRef ) );
if ( fTmp != fRef )
{
return "*ERROR: POSH little endian floating point conversion failed. Please report this to poshlib@poshlib.org!\n";
}
fTmp = POSH_FloatFromBigBits( POSH_BigFloatBits( fRef ) );
if ( fTmp != fRef )
{
return "*ERROR: POSH big endian floating point conversion failed. Please report this to poshlib@poshlib.org!\n";
}
POSH_DoubleBits( dRef, dbuf );
dTmp = POSH_DoubleFromBits( dbuf );
if ( dTmp != dRef )
{
return "*ERROR: POSH double precision floating point serialization failed. Please report this to poshlib@poshlib.org!\n";
}
return 0;
}
#endif /* !defined POSH_NO_FLOAT */
static
const char *
s_testEndianess( void )
{
/* check endianess */
if ( s_testBigEndian() != IS_BIG_ENDIAN )
{
return "*ERROR: POSH compile time endianess does not match run-time endianess verification. Please report this to poshlib@poshlib.org!\n";
}
/* make sure our endian swap routines work */
if ( ( NATIVE32( 0x11223344L ) != 0x11223344L ) ||
( FOREIGN32( 0x11223344L ) != 0x44332211L ) ||
( NATIVE16( 0x1234 ) != 0x1234 ) ||
( FOREIGN16( 0x1234 ) != 0x3412 ) )
{
return "*ERROR: POSH endianess macro selection failed. Please report this to poshlib@poshlib.org!\n";
}
/* test serialization routines */
return 0;
}
#endif /* !defined FORCE_DOXYGEN */
/**
Returns a string describing this platform's basic attributes.
POSH_GetArchString() reports on an architecture's statically determined
attributes. In addition, it will perform run-time verification checks
to make sure the various platform specific functions work. If an error
occurs, please contact me at poshlib@poshlib.org so we can try to resolve
what the specific failure case is.
@returns a string describing this platform on success, or a string in the
form "*ERROR: [text]" on failure. You can simply check to see if
the first character returned is '*' to verify an error condition.
*/
const char *
POSH_GetArchString( void )
{
const char *err;
const char *s = "OS:.............."POSH_OS_STRING"\n"
"CPU:............."POSH_CPU_STRING"\n"
"endian:.........."POSH_ENDIAN_STRING"\n"
"ptr size:........"POSH_POINTER_STRING"\n"
"64-bit ints......"POSH_64BIT_INTEGER_STRING"\n"
"floating point..."POSH_FLOAT_STRING"\n"
"compiler........."POSH_COMPILER_STRING"\n";
/* test endianess */
err = s_testEndianess();
if ( err != 0 )
{
return err;
}
/* test serialization */
err = s_testSerialization();
if ( err != 0 )
{
return err;
}
#if !defined POSH_NO_FLOAT
/* check that our floating point support is correct */
err = s_testFloatingPoint();
if ( err != 0 )
{
return err;
}
#endif
return s;
}
/* ---------------------------------------------------------------------------*/
/* BYTE SWAPPING SUPPORT */
/* ---------------------------------------------------------------------------*/
/**
* Byte swaps a 16-bit unsigned value
*
@param v [in] unsigned 16-bit input value to swap
@returns a byte swapped version of v
*/
posh_u16_t
POSH_SwapU16( posh_u16_t v )
{
posh_u16_t swapped;
swapped = v << 8;
swapped |= v >> 8;
return swapped;
}
/**
* Byte swaps a 16-bit signed value
*
@param v [in] signed 16-bit input value to swap
@returns a byte swapped version of v
@remarks This just calls back to the unsigned version, since byte swapping
is independent of sign. However, we still provide this function to
avoid signed/unsigned mismatch compiler warnings.
*/
posh_i16_t
POSH_SwapI16( posh_i16_t v )
{
return ( posh_i16_t ) POSH_SwapU16( v );
}
/**
* Byte swaps a 32-bit unsigned value
*
@param v [in] unsigned 32-bit input value to swap
@returns a byte swapped version of v
*/
posh_u32_t
POSH_SwapU32( posh_u32_t v )
{
posh_u32_t swapped;
swapped = ( v & 0xFF ) << 24;
swapped |= ( v & 0xFF00 ) << 8;
swapped |= ( v >> 8 ) & 0xFF00;
swapped |= ( v >> 24 );
return swapped;
}
/**
* Byte swaps a 32-bit signed value
*
@param v [in] signed 32-bit input value to swap
@returns a byte swapped version of v
@remarks This just calls back to the unsigned version, since byte swapping
is independent of sign. However, we still provide this function to
avoid signed/unsigned mismatch compiler warnings.
*/
posh_i32_t
POSH_SwapI32( posh_i32_t v )
{
return ( posh_i32_t ) POSH_SwapU32( ( posh_u32_t ) v );
}
#if defined POSH_64BIT_INTEGER
/**
* Byte swaps a 64-bit unsigned value
@param v [in] a 64-bit input value to swap
@ingroup SixtyFourBit
@returns a byte swapped version of v
*/
posh_u64_t
POSH_SwapU64( posh_u64_t v )
{
posh_byte_t tmp;
union {
posh_byte_t bytes[ 8 ];
posh_u64_t u64;
} u;
u.u64 = v;
tmp = u.bytes[ 0 ]; u.bytes[ 0 ] = u.bytes[ 7 ]; u.bytes[ 7 ] = tmp;
tmp = u.bytes[ 1 ]; u.bytes[ 1 ] = u.bytes[ 6 ]; u.bytes[ 6 ] = tmp;
tmp = u.bytes[ 2 ]; u.bytes[ 2 ] = u.bytes[ 5 ]; u.bytes[ 5 ] = tmp;
tmp = u.bytes[ 3 ]; u.bytes[ 3 ] = u.bytes[ 4 ]; u.bytes[ 4 ] = tmp;
return u.u64;
}
/**
* Byte swaps a 64-bit signed value
@param v [in] a 64-bit input value to swap
@ingroup SixtyFourBit
@returns a byte swapped version of v
*/
posh_i64_t
POSH_SwapI64( posh_i64_t v )
{
return ( posh_i64_t ) POSH_SwapU64( ( posh_u64_t ) v );
}
#endif /* defined POSH_64BIT_INTEGER */
/* ---------------------------------------------------------------------------*/
/* IN-MEMORY SERIALIZATION */
/* ---------------------------------------------------------------------------*/
/**
* Writes an unsigned 16-bit value to a little endian buffer
@param dst [out] pointer to the destination buffer, may not be NULL
@param value [in] host-endian unsigned 16-bit value
@returns a pointer to the location two bytes after dst
@remarks does no validation of the inputs
*/
posh_u16_t *
POSH_WriteU16ToLittle( void *dst, posh_u16_t value )
{
posh_u16_t *p16 = ( posh_u16_t * ) dst;
*p16 = POSH_LittleU16(value);
return p16 + 1;
}
/**
* Writes a signed 16-bit value to a little endian buffer
@param dst [out] pointer to the destination buffer, may not be NULL
@param value [in] host-endian signed 16-bit value
@returns a pointer to the location two bytes after dst
@remarks does no validation of the inputs. This simply calls
POSH_WriteU16ToLittle() with appropriate casting.
*/
posh_i16_t *
POSH_WriteI16ToLittle( void *dst, posh_i16_t value )
{
return ( posh_i16_t * ) POSH_WriteU16ToLittle( dst, ( posh_u16_t ) value );
}
/**
* Writes an unsigned 32-bit value to a little endian buffer
@param dst [out] pointer to the destination buffer, may not be NULL
@param value [in] host-endian signed 32-bit value
@returns a pointer to the location four bytes after dst
@remarks does no validation of the inputs.
*/
posh_u32_t *
POSH_WriteU32ToLittle( void *dst, posh_u32_t value )
{
posh_u32_t *p32 = ( posh_u32_t * ) dst;
*p32 = POSH_LittleU32(value);
return p32 + 1;
}
/**
* Writes a signed 32-bit value to a little endian buffer
@param dst [out] pointer to the destination buffer, may not be NULL
@param value [in] host-endian signed 32-bit value
@returns a pointer to the location four bytes after dst
@remarks does no validation of the inputs. This simply calls
POSH_WriteU32ToLittle() with appropriate casting.
*/
posh_i32_t *
POSH_WriteI32ToLittle( void *dst, posh_i32_t value )
{
return ( posh_i32_t * ) POSH_WriteU32ToLittle( dst, ( posh_u32_t ) value );
}
/**
* Writes an unsigned 16-bit value to a big endian buffer
@param dst [out] pointer to the destination buffer, may not be NULL
@param value [in] host-endian unsigned 16-bit value
@returns a pointer to the location two bytes after dst
@remarks does no validation of the inputs
*/
posh_u16_t *
POSH_WriteU16ToBig( void *dst, posh_u16_t value )
{
posh_u16_t *p16 = ( posh_u16_t * ) dst;
*p16 = POSH_BigU16(value);
return p16 + 1;
}
/**
* Writes a signed 16-bit value to a big endian buffer
@param dst [out] pointer to the destination buffer, may not be NULL
@param value [in] host-endian signed 16-bit value
@returns a pointer to the location two bytes after dst
@remarks does no validation of the inputs. This simply calls
POSH_WriteU16ToLittle() with appropriate casting.
*/
posh_i16_t *
POSH_WriteI16ToBig( void *dst, posh_i16_t value )
{
return ( posh_i16_t * ) POSH_WriteU16ToBig( dst, ( posh_u16_t ) value );
}
/**
* Writes an unsigned 32-bit value to a big endian buffer
@param dst [out] pointer to the destination buffer, may not be NULL
@param value [in] host-endian unsigned 32-bit value
@returns a pointer to the location four bytes after dst
@remarks does no validation of the inputs.
*/
posh_u32_t *
POSH_WriteU32ToBig( void *dst, posh_u32_t value )
{
posh_u32_t *p32 = ( posh_u32_t * ) dst;
*p32 = POSH_BigU32(value);
return p32 + 1;
}
/**
* Writes a signed 32-bit value to a big endian buffer
@param dst [out] pointer to the destination buffer, may not be NULL
@param value [in] host-endian signed 32-bit value
@returns a pointer to the location four bytes after dst
@remarks does no validation of the inputs. This simply calls
POSH_WriteU32ToBig() with appropriate casting.
*/
posh_i32_t *
POSH_WriteI32ToBig( void *dst, posh_i32_t value )
{
return ( posh_i32_t * ) POSH_WriteU32ToBig( dst, ( posh_u32_t ) value );
}
#if defined POSH_64BIT_INTEGER
/**
* Writes an unsigned 64-bit value to a little-endian buffer
@ingroup SixtyFourBit
@param dst [out] pointer to the destination buffer, may not be NULL
@param value [in] host-endian unsigned 64-bit value
@returns a pointer to the location eight bytes after dst
@remarks does no validation of the inputs.
*/
posh_u64_t *
POSH_WriteU64ToLittle( void *dst, posh_u64_t value )
{
posh_u64_t *p64 = ( posh_u64_t * ) dst;
*p64 = POSH_LittleU64(value);
return p64 + 1;
}
/**
* Writes a signed 64-bit value to a little-endian buffer
@ingroup SixtyFourBit
@param dst [out] pointer to the destination buffer, may not be NULL
@param value [in] host-endian unsigned 64-bit value
@returns a pointer to the location eight bytes after dst
@remarks does no validation of the inputs.
*/
posh_i64_t *
POSH_WriteI64ToLittle( void *dst, posh_i64_t value )
{
return ( posh_i64_t * ) POSH_WriteU64ToLittle( dst, ( posh_u64_t ) value );
}
/**
* Writes an unsigned 64-bit value to a big-endian buffer
@ingroup SixtyFourBit
@param dst [out] pointer to the destination buffer, may not be NULL
@param value [in] host-endian unsigned 64-bit value
@returns a pointer to the location eight bytes after dst
@remarks does no validation of the inputs.
*/
posh_u64_t *
POSH_WriteU64ToBig( void *dst, posh_u64_t value )
{
posh_u64_t *p64 = ( posh_u64_t * ) dst;
*p64 = POSH_BigU64(value);
return p64 + 8;
}
/**
* Writes a signed 64-bit value to a big-endian buffer
@ingroup SixtyFourBit
@param dst [out] pointer to the destination buffer, may not be NULL
@param value [in] host-endian signed 64-bit value
@returns a pointer to the location eight bytes after dst
@remarks does no validation of the inputs.
*/
posh_i64_t *
POSH_WriteI64ToBig( void *dst, posh_i64_t value )
{
return ( posh_i64_t * ) POSH_WriteU64ToBig( dst, ( posh_u64_t ) value );
}
#endif /* POSH_64BIT_INTEGER */
/* ---------------------------------------------------------------------------*/
/* IN-MEMORY DESERIALIZATION */
/* ---------------------------------------------------------------------------*/
/**
* Reads an unsigned 16-bit value from a little-endian buffer
@param src [in] source buffer
@returns host-endian unsigned 16-bit value
*/
posh_u16_t
POSH_ReadU16FromLittle( const void *src )
{
return POSH_LittleU16( (*(const posh_u16_t*)src) );
}
/**
* Reads a signed 16-bit value from a little-endian buffer
@param src [in] source buffer
@returns host-endian signed 16-bit value
*/
posh_i16_t
POSH_ReadI16FromLittle( const void *src )
{
return POSH_LittleI16( (*(const posh_i16_t*)src) );
}
/**
* Reads an unsigned 32-bit value from a little-endian buffer
@param src [in] source buffer
@returns host-endian unsigned 32-bit value
*/
posh_u32_t
POSH_ReadU32FromLittle( const void *src )
{
return POSH_LittleU32( (*(const posh_u32_t*)src) );
}
/**
* Reads a signed 32-bit value from a little-endian buffer
@param src [in] source buffer
@returns host-endian signed 32-bit value
*/
posh_i32_t
POSH_ReadI32FromLittle( const void *src )
{
return POSH_LittleI32( (*(const posh_i32_t*)src) );
}
/**
* Reads an unsigned 16-bit value from a big-endian buffer
@param src [in] source buffer
@returns host-endian unsigned 16-bit value
*/
posh_u16_t
POSH_ReadU16FromBig( const void *src )
{
return POSH_BigU16( (*(const posh_u16_t*)src) );
}
/**
* Reads a signed 16-bit value from a big-endian buffer
@param src [in] source buffer
@returns host-endian signed 16-bit value
*/
posh_i16_t
POSH_ReadI16FromBig( const void *src )
{
return POSH_BigI16( (*(const posh_i16_t*)src));
}
/**
* Reads an unsigned 32-bit value from a big-endian buffer
@param src [in] source buffer
@returns host-endian unsigned 32-bit value
*/
posh_u32_t
POSH_ReadU32FromBig( const void *src )
{
return POSH_BigU32( (*(const posh_u32_t*)src) );
}
/**
* Reads a signed 32-bit value from a big-endian buffer
@param src [in] source buffer
@returns host-endian signed 32-bit value
*/
posh_i32_t
POSH_ReadI32FromBig( const void *src )
{
return POSH_BigI32( (*(const posh_i32_t*)src ) );
}
#if defined POSH_64BIT_INTEGER
/**
* Reads an unsigned 64-bit value from a little-endian buffer
@param src [in] source buffer
@returns host-endian unsigned 32-bit value
*/
posh_u64_t
POSH_ReadU64FromLittle( const void *src )
{
return POSH_LittleU64( (*(const posh_u64_t*)src) );
}
/**
* Reads a signed 64-bit value from a little-endian buffer
@param src [in] source buffer
@returns host-endian signed 32-bit value
*/
posh_i64_t
POSH_ReadI64FromLittle( const void *src )
{
return POSH_LittleI64( (*(const posh_i64_t*)src) );
}
/**
* Reads an unsigned 64-bit value from a big-endian buffer
@param src [in] source buffer
@returns host-endian unsigned 32-bit value
*/
posh_u64_t
POSH_ReadU64FromBig( const void *src )
{
return POSH_BigU64( (*(const posh_u64_t*)src) );
}
/**
* Reads an signed 64-bit value from a big-endian buffer
@param src [in] source buffer
@returns host-endian signed 32-bit value
*/
posh_i64_t
POSH_ReadI64FromBig( const void *src )
{
return POSH_BigI64( (*(const posh_i64_t*)src) );
}
#endif /* POSH_64BIT_INTEGER */
/* ---------------------------------------------------------------------------*/
/* FLOATING POINT SUPPORT */
/* ---------------------------------------------------------------------------*/
#if !defined POSH_NO_FLOAT
/** @ingroup FloatingPoint
@param[in] f floating point value
@returns a little-endian bit representation of f
*/
posh_u32_t
POSH_LittleFloatBits( float f )
{
union
{
float f32;
posh_u32_t u32;
} u;
u.f32 = f;
#if defined POSH_LITTLE_ENDIAN
return u.u32;
#else
return POSH_SwapU32( u.u32 );
#endif
}
/**
* Extracts raw big-endian bits from a 32-bit floating point value
*
@ingroup FloatingPoint
@param f [in] floating point value
@returns a big-endian bit representation of f
*/
posh_u32_t
POSH_BigFloatBits( float f )
{
union
{
float f32;
posh_u32_t u32;
} u;
u.f32 = f;
#if defined POSH_LITTLE_ENDIAN
return POSH_SwapU32( u.u32 );
#else
return u.u32;
#endif
}
/**
* Extracts raw, little-endian bit representation from a 64-bit double.
*
@param d [in] 64-bit double precision value
@param dst [out] 8-byte storage buffer
@ingroup FloatingPoint
@returns the raw bits used to represent the value 'd', in the form dst[0]=LSB
*/
void
POSH_DoubleBits( double d, posh_byte_t dst[ 8 ] )
{
union
{
double d64;
posh_byte_t bytes[ 8 ];
} u;
u.d64 = d;
#if defined POSH_LITTLE_ENDIAN
dst[ 0 ] = u.bytes[ 0 ];
dst[ 1 ] = u.bytes[ 1 ];
dst[ 2 ] = u.bytes[ 2 ];
dst[ 3 ] = u.bytes[ 3 ];
dst[ 4 ] = u.bytes[ 4 ];
dst[ 5 ] = u.bytes[ 5 ];
dst[ 6 ] = u.bytes[ 6 ];
dst[ 7 ] = u.bytes[ 7 ];
#else
dst[ 0 ] = u.bytes[ 7 ];
dst[ 1 ] = u.bytes[ 6 ];
dst[ 2 ] = u.bytes[ 5 ];
dst[ 3 ] = u.bytes[ 4 ];
dst[ 4 ] = u.bytes[ 3 ];
dst[ 5 ] = u.bytes[ 2 ];
dst[ 6 ] = u.bytes[ 1 ];
dst[ 7 ] = u.bytes[ 0 ];
#endif
}
/**
* Creates a double-precision, 64-bit floating point value from a set of raw,
* little-endian bits
@ingroup FloatingPoint
@param src [in] little-endian byte representation of 64-bit double precision
floating point value
@returns double precision floating point representation of the raw bits
@remarks No error checking is performed, so there are no guarantees that the
result is a valid number, nor is there any check to ensure that src is
non-NULL. BE CAREFUL USING THIS.
*/
double
POSH_DoubleFromBits( const posh_byte_t src[ 8 ] )
{
union
{
double d64;
posh_byte_t bytes[ 8 ];
} u;
#if defined POSH_LITTLE_ENDIAN
u.bytes[ 0 ] = src[ 0 ];
u.bytes[ 1 ] = src[ 1 ];
u.bytes[ 2 ] = src[ 2 ];
u.bytes[ 3 ] = src[ 3 ];
u.bytes[ 4 ] = src[ 4 ];
u.bytes[ 5 ] = src[ 5 ];
u.bytes[ 6 ] = src[ 6 ];
u.bytes[ 7 ] = src[ 7 ];
#else
u.bytes[ 0 ] = src[ 7 ];
u.bytes[ 1 ] = src[ 6 ];
u.bytes[ 2 ] = src[ 5 ];
u.bytes[ 3 ] = src[ 4 ];
u.bytes[ 4 ] = src[ 3 ];
u.bytes[ 5 ] = src[ 2 ];
u.bytes[ 6 ] = src[ 1 ];
u.bytes[ 7 ] = src[ 0 ];
#endif
return u.d64;
}
/**
* Creates a floating point number from little endian bits
*
@ingroup FloatingPoint
@param bits [in] raw floating point bits in little-endian form
@returns a floating point number based on the given bit representation
@remarks No error checking is performed, so there are no guarantees that the
result is a valid number. BE CAREFUL USING THIS.
*/
float
POSH_FloatFromLittleBits( posh_u32_t bits )
{
union
{
float f32;
posh_u32_t u32;
} u;
u.u32 = bits;
#if defined POSH_BIG_ENDIAN
u.u32 = POSH_SwapU32( u.u32 );
#endif
return u.f32;
}
/**
* Creates a floating point number from big-endian bits
*
@ingroup FloatingPoint
@param bits [in] raw floating point bits in big-endian form
@returns a floating point number based on the given bit representation
@remarks No error checking is performed, so there are no guarantees that the
result is a valid number. BE CAREFUL USING THIS.
*/
float
POSH_FloatFromBigBits( posh_u32_t bits )
{
union
{
float f32;
posh_u32_t u32;
} u;
u.u32 = bits;
#if defined POSH_LITTLE_ENDIAN
u.u32 = POSH_SwapU32( u.u32 );
#endif
return u.f32;
}
#endif /* !defined POSH_NO_FLOAT */

@ -0,0 +1,989 @@
/**
@file posh.h
@author Brian Hook
Header file for POSH, the Portable Open Source Harness project.
NOTE: Unlike most header files, this one is designed to be included
multiple times, which is why it does not have the @#ifndef/@#define
preamble.
POSH relies on environment specified preprocessor symbols in order
to infer as much as possible about the target OS/architecture and
the host compiler capabilities.
NOTE: POSH is simple and focused. It attempts to provide basic
functionality and information, but it does NOT attempt to emulate
missing functionality. I am also not willing to make POSH dirty
and hackish to support truly ancient and/or outmoded and/or bizarre
technologies such as non-ANSI compilers, systems with non-IEEE
floating point formats, segmented 16-bit operating systems, etc.
Please refer to the accompanying HTML documentation or visit
http://www.poshlib.org for more information on how to use POSH.
LICENSE:
Copyright (c) 2004, Brian Hook
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 names of this package'ss contributors contributors may not
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.
*/
/*
I have yet to find an authoritative reference on preprocessor
symbols, but so far this is what I've gleaned:
GNU GCC/G++:
- __GNUC__: GNU C version
- __GNUG__: GNU C++ compiler
- __sun__ : on Sun platforms
- __svr4__: on Solaris and other SysV R4 platforms
- __mips__: on MIPS processor platforms
- __sparc_v9__: on Sparc 64-bit CPUs
- __sparcv9: 64-bit Solaris
- __MIPSEL__: mips processor, compiled for little endian
- __MIPSEB__: mips processor, compiled for big endian
- _R5900: MIPS/Sony/Toshiba R5900 (PS2)
- mc68000: 68K
- m68000: 68K
- m68k: 68K
- __palmos__: PalmOS
Intel C/C++ Compiler:
- __ECC : compiler version, IA64 only
- __EDG__
- __ELF__
- __GXX_ABI_VERSION
- __i386 : IA-32 only
- __i386__ : IA-32 only
- i386 : IA-32 only
- __ia64 : IA-64 only
- __ia64__ : IA-64 only
- ia64 : IA-64 only
- __ICC : IA-32 only
- __INTEL_COMPILER : IA-32 or IA-64, newer versions only
Apple's C/C++ Compiler for OS X:
- __APPLE_CC__
- __APPLE__
- __BIG_ENDIAN__
- __APPLE__
- __ppc__
- __MACH__
DJGPP:
- __MSDOS__
- __unix__
- __unix
- __GNUC__
- __GO32
- DJGPP
- __i386, __i386, i386
Cray's C compiler:
- _ADDR64: if 64-bit pointers
- _UNICOS:
- __unix:
SGI's CC compiler predefines the following (and more) with -ansi:
- __sgi
- __unix
- __host_mips
- _SYSTYPE_SVR4
- __mips
- _MIPSEB
- anyone know if there is a predefined symbol for the compiler?!
MinGW:
- as GnuC but also defines _WIN32, __WIN32, WIN32, _X86_, __i386, __i386__, and several others
- __MINGW32__
Cygwin:
- as Gnu C, but also
- __unix__
- __CYGWIN32__
Microsoft Visual Studio predefines the following:
- _MSC_VER
- _WIN32: on Win32
- _M_IX6 (on x86 systems)
- _M_ALPHA (on DEC AXP systems)
- _SH3: WinCE, Hitachi SH-3
- _MIPS: WinCE, MIPS
- _ARM: WinCE, ARM
Sun's C Compiler:
- sun and _sun
- unix and _unix
- sparc and _sparc (SPARC systems only)
- i386 and _i386 (x86 systems only)
- __SVR4 (Solaris only)
- __sparcv9: 64-bit solaris
- __SUNPRO_C
- _LP64: defined in 64-bit LP64 mode, but only if <sys/types.h> is included
Borland C/C++ predefines the following:
- __BORLANDC__:
DEC/Compaq C/C++ on Alpha:
- __alpha
- __arch64__
- __unix__ (on Tru64 Unix)
- __osf__
- __DECC
- __DECCXX (C++ compilation)
- __DECC_VER
- __DECCXX_VER
IBM's AIX compiler:
- __64BIT__ if 64-bit mode
- _AIX
- __IBMC__: C compiler version
- __IBMCPP__: C++ compiler version
- _LONG_LONG: compiler allows long long
Watcom:
- __WATCOMC__
- __DOS__ : if targeting DOS
- __386__ : if 32-bit support
- __WIN32__ : if targetin 32-bit Windows
HP-UX C/C++ Compiler:
- __hpux
- __unix
- __hppa (on PA-RISC)
- __LP64__: if compiled in 64-bit mode
Metrowerks:
- __MWERKS__
- __powerpc__
- _powerc
- __MC68K__
- macintosh when compiling for MacOS
- __INTEL__ for x86 targets
- __POWERPC__
*/
#ifndef HAVE_POSH_H
#define HAVE_POSH_H
/*
** ----------------------------------------------------------------------------
** Include <limits.h> optionally
** ----------------------------------------------------------------------------
*/
#ifdef POSH_USE_LIMITS_H
# include <limits.h>
#endif
/*
** ----------------------------------------------------------------------------
** Determine compilation environment
** ----------------------------------------------------------------------------
*/
#if defined __ECC || defined __ICC || defined __INTEL_COMPILER
# define POSH_COMPILER_STRING "Intel C/C++"
# define POSH_COMPILER_INTEL 1
#endif
#if ( defined __host_mips || defined __sgi ) && !defined __GNUC__
# define POSH_COMPILER_STRING "MIPSpro C/C++"
# define POSH_COMPILER_MIPSPRO 1
#endif
#if defined __hpux && !defined __GNUC__
# define POSH_COMPILER_STRING "HP-UX CC"
# define POSH_COMPILER_HPCC 1
#endif
#if defined __GNUC__
# define POSH_COMPILER_STRING "Gnu GCC"
# define POSH_COMPILER_GCC 1
#endif
#if defined __APPLE_CC__
/* we don't define the compiler string here, let it be GNU */
# define POSH_COMPILER_APPLECC 1
#endif
#if defined __IBMC__ || defined __IBMCPP__
# define POSH_COMPILER_STRING "IBM C/C++"
# define POSH_COMPILER_IBM 1
#endif
#if defined _MSC_VER
# define POSH_COMPILER_STRING "Microsoft Visual C++"
# define POSH_COMPILER_MSVC 1
#endif
#if defined __SUNPRO_C
# define POSH_COMPILER_STRING "Sun Pro"
# define POSH_COMPILER_SUN 1
#endif
#if defined __BORLANDC__
# define POSH_COMPILER_STRING "Borland C/C++"
# define POSH_COMPILER_BORLAND 1
#endif
#if defined __MWERKS__
# define POSH_COMPILER_STRING "MetroWerks CodeWarrior"
# define POSH_COMPILER_METROWERKS 1
#endif
#if defined __DECC || defined __DECCXX
# define POSH_COMPILER_STRING "Compaq/DEC C/C++"
# define POSH_COMPILER_DEC 1
#endif
#if defined __WATCOMC__
# define POSH_COMPILER_STRING "Watcom C/C++"
# define POSH_COMPILER_WATCOM 1
#endif
#if !defined POSH_COMPILER_STRING
# define POSH_COMPILER_STRING "Unknown compiler"
#endif
/*
** ----------------------------------------------------------------------------
** Determine target operating system
** ----------------------------------------------------------------------------
*/
#if defined linux || defined __linux__
# define POSH_OS_LINUX 1
# define POSH_OS_STRING "Linux"
#endif
#if defined __CYGWIN32__
# define POSH_OS_CYGWIN32 1
# define POSH_OS_STRING "Cygwin"
#endif
#if defined __MINGW32__
# define POSH_OS_MINGW 1
# define POSH_OS_STRING "MinGW"
#endif
#if defined GO32 && defined DJGPP && defined __MSDOS__
# define POSH_OS_GO32 1
# define POSH_OS_STRING "GO32/MS-DOS"
#endif
/* NOTE: make sure you use /bt=DOS if compiling for 32-bit DOS,
otherwise Watcom assumes host=target */
#if defined __WATCOMC__ && defined __386__ && defined __DOS__
# define POSH_OS_DOS32 1
# define POSH_OS_STRING "DOS/32-bit"
#endif
#if defined _UNICOS
# define POSH_OS_UNICOS 1
# define POSH_OS_STRING "UNICOS"
#endif
#if ( defined __MWERKS__ && defined __powerc && !defined macintosh ) || defined __APPLE_CC__ || defined macosx
# define POSH_OS_OSX 1
# define POSH_OS_STRING "MacOS X"
#endif
#if defined __sun__ || defined sun || defined __sun || defined __solaris__
# if defined __SVR4 || defined __svr4__ || defined __solaris__
# define POSH_OS_STRING "Solaris"
# define POSH_OS_SOLARIS 1
# endif
# if !defined POSH_OS_STRING
# define POSH_OS_STRING "SunOS"
# define POSH_OS_SUNOS 1
# endif
#endif
#if defined __sgi__ || defined sgi || defined __sgi
# define POSH_OS_IRIX 1
# define POSH_OS_STRING "Irix"
#endif
#if defined __hpux__ || defined __hpux
# define POSH_OS_HPUX 1
# define POSH_OS_STRING "HP-UX"
#endif
#if defined _AIX
# define POSH_OS_AIX 1
# define POSH_OS_STRING "AIX"
#endif
#if ( defined __alpha && defined __osf__ )
# define POSH_OS_TRU64 1
# define POSH_OS_STRING "Tru64"
#endif
#if defined __BEOS__ || defined __beos__
# define POSH_OS_BEOS 1
# define POSH_OS_STRING "BeOS"
#endif
#if defined amiga || defined amigados || defined AMIGA || defined _AMIGA
# define POSH_OS_AMIGA 1
# define POSH_OS_STRING "Amiga"
#endif
#if defined __unix__
# define POSH_OS_UNIX 1
# if !defined POSH_OS_STRING
# define POSH_OS_STRING "Unix-like(generic)"
# endif
#endif
#if defined _WIN32_WCE
# define POSH_OS_WINCE 1
# define POSH_OS_STRING "Windows CE"
#endif
#if defined _XBOX_VER == 200
# define POSH_OS_XBOX360 1
# define POSH_OS_STRING "XBOX-360"
#elif defined _XBOX
# define POSH_OS_XBOX 1
# define POSH_OS_STRING "XBOX"
#endif
#if defined _WIN32 || defined WIN32 || defined __NT__ || defined __WIN32__
# define POSH_OS_WIN32 1
# if !defined POSH_OS_XBOX
# if defined _WIN64
# define POSH_OS_WIN64 1
# define POSH_OS_STRING "Win64"
# else
# if !defined POSH_OS_STRING
# define POSH_OS_STRING "Win32"
# endif
# endif
# endif
#endif
#if defined __palmos__
# define POSH_OS_PALM 1
# define POSH_OS_STRING "PalmOS"
#endif
#if defined THINK_C || defined macintosh
# define POSH_OS_MACOS 1
# define POSH_OS_STRING "MacOS"
#endif
/*
** -----------------------------------------------------------------------------
** Determine target CPU
** -----------------------------------------------------------------------------
*/
#if defined mc68000 || defined m68k || defined __MC68K__ || defined m68000
# define POSH_CPU_68K 1
# define POSH_CPU_STRING "MC68000"
#endif
#if defined __PPC__ || defined __POWERPC__ || defined powerpc || defined _POWER || defined __ppc__ || defined __powerpc__
# define POSH_CPU_PPC 1
# if defined __powerpc64__
# define POSH_CPU_STRING "PowerPC64"
# else
# define POSH_CPU_STRING "PowerPC"
# endif
#endif
#if defined _CRAYT3E || defined _CRAYMPP
# define POSH_CPU_CRAYT3E 1 /* target processor is a DEC Alpha 21164 used in a Cray T3E*/
# define POSH_CPU_STRING "Cray T3E (Alpha 21164)"
#endif
#if defined CRAY || defined _CRAY && !defined _CRAYT3E
# error Non-AXP Cray systems not supported
#endif
#if defined _SH3
# define POSH_CPU_SH3 1
# define POSH_CPU_STRING "Hitachi SH-3"
#endif
#if defined __sh4__ || defined __SH4__
# define POSH_CPU_SH3 1
# define POSH_CPU_SH4 1
# define POSH_CPU_STRING "Hitachi SH-4"
#endif
#if defined __sparc__ || defined __sparc
# if defined __arch64__ || defined __sparcv9 || defined __sparc_v9__
# define POSH_CPU_SPARC64 1
# define POSH_CPU_STRING "Sparc/64"
# else
# define POSH_CPU_STRING "Sparc/32"
# endif
# define POSH_CPU_SPARC 1
#endif
#if defined ARM || defined __arm__ || defined _ARM
# define POSH_CPU_STRONGARM 1
# define POSH_CPU_STRING "ARM"
#endif
#if defined mips || defined __mips__ || defined __MIPS__ || defined _MIPS
# define POSH_CPU_MIPS 1
# if defined _R5900
# define POSH_CPU_STRING "MIPS R5900 (PS2)"
# else
# define POSH_CPU_STRING "MIPS"
# endif
#endif
#if defined __ia64 || defined _M_IA64 || defined __ia64__
# define POSH_CPU_IA64 1
# define POSH_CPU_STRING "IA64"
#endif
#if defined __X86__ || defined __i386__ || defined i386 || defined _M_IX86 || defined __386__ || defined __x86_64__ || defined _M_X64
# define POSH_CPU_X86 1
# if defined __x86_64__ || defined _M_X64
# define POSH_CPU_X86_64 1
# endif
# if defined POSH_CPU_X86_64
# define POSH_CPU_STRING "AMD x86-64"
# else
# define POSH_CPU_STRING "Intel 386+"
# endif
#endif
#if defined __alpha || defined alpha || defined _M_ALPHA || defined __alpha__
# define POSH_CPU_AXP 1
# define POSH_CPU_STRING "AXP"
#endif
#if defined __hppa || defined hppa
# define POSH_CPU_HPPA 1
# define POSH_CPU_STRING "PA-RISC"
#endif
#if !defined POSH_CPU_STRING
# error POSH cannot determine target CPU
# define POSH_CPU_STRING "Unknown" /* this is here for Doxygen's benefit */
#endif
/*
** -----------------------------------------------------------------------------
** Attempt to autodetect building for embedded on Sony PS2
** -----------------------------------------------------------------------------
*/
#if !defined POSH_OS_STRING
# if !defined FORCE_DOXYGEN
# define POSH_OS_EMBEDDED 1
# endif
# if defined _R5900
# define POSH_OS_STRING "Sony PS2(embedded)"
# else
# define POSH_OS_STRING "Embedded/Unknown"
# endif
#endif
/*
** ---------------------------------------------------------------------------
** Handle cdecl, stdcall, fastcall, etc.
** ---------------------------------------------------------------------------
*/
#if defined POSH_CPU_X86 && !defined POSH_CPU_X86_64
# if defined __GNUC__
# define POSH_CDECL __attribute__((cdecl))
# define POSH_STDCALL __attribute__((stdcall))
# define POSH_FASTCALL __attribute__((fastcall))
# elif ( defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__ || defined __MWERKS__ )
# define POSH_CDECL __cdecl
# define POSH_STDCALL __stdcall
# define POSH_FASTCALL __fastcall
# endif
#else
# define POSH_CDECL
# define POSH_STDCALL
# define POSH_FASTCALL
#endif
/*
** ---------------------------------------------------------------------------
** Define POSH_IMPORTEXPORT signature based on POSH_DLL and POSH_BUILDING_LIB
** ---------------------------------------------------------------------------
*/
/*
** We undefine this so that multiple inclusions will work
*/
#if defined POSH_IMPORTEXPORT
# undef POSH_IMPORTEXPORT
#endif
#if defined POSH_DLL
# if defined POSH_OS_WIN32
# if defined _MSC_VER
# if ( _MSC_VER >= 800 )
# if defined POSH_BUILDING_LIB
# define POSH_IMPORTEXPORT __declspec( dllexport )
# else
# define POSH_IMPORTEXPORT __declspec( dllimport )
# endif
# else
# if defined POSH_BUILDING_LIB
# define POSH_IMPORTEXPORT __export
# else
# define POSH_IMPORTEXPORT
# endif
# endif
# endif /* defined _MSC_VER */
# if defined __BORLANDC__
# if ( __BORLANDC__ >= 0x500 )
# if defined POSH_BUILDING_LIB
# define POSH_IMPORTEXPORT __declspec( dllexport )
# else
# define POSH_IMPORTEXPORT __declspec( dllimport )
# endif
# else
# if defined POSH_BUILDING_LIB
# define POSH_IMPORTEXPORT __export
# else
# define POSH_IMPORTEXPORT
# endif
# endif
# endif /* defined __BORLANDC__ */
/* for all other compilers, we're just making a blanket assumption */
# if defined __GNUC__ || defined __WATCOMC__ || defined __MWERKS__
# if defined POSH_BUILDING_LIB
# define POSH_IMPORTEXPORT __declspec( dllexport )
# else
# define POSH_IMPORTEXPORT __declspec( dllimport )
# endif
# endif /* all other compilers */
# if !defined POSH_IMPORTEXPORT
# error Building DLLs not supported on this compiler (poshlib@poshlib.org if you know how)
# endif
# endif /* defined POSH_OS_WIN32 */
#endif
/* On pretty much everything else, we can thankfully just ignore this */
#if !defined POSH_IMPORTEXPORT
# define POSH_IMPORTEXPORT
#endif
#if defined FORCE_DOXYGEN
# define POSH_DLL
# define POSH_BUILDING_LIB
# undef POSH_DLL
# undef POSH_BUILDING_LIB
#endif
/*
** ----------------------------------------------------------------------------
** (Re)define POSH_PUBLIC_API export signature
** ----------------------------------------------------------------------------
*/
#ifdef POSH_PUBLIC_API
# undef POSH_PUBLIC_API
#endif
#if ( ( defined _MSC_VER ) && ( _MSC_VER < 800 ) ) || ( defined __BORLANDC__ && ( __BORLANDC__ < 0x500 ) )
# define POSH_PUBLIC_API(rtype) extern rtype POSH_IMPORTEXPORT
#else
# define POSH_PUBLIC_API(rtype) extern POSH_IMPORTEXPORT rtype
#endif
/*
** ----------------------------------------------------------------------------
** Try to infer endianess. Basically we just go through the CPUs we know are
** little endian, and assume anything that isn't one of those is big endian.
** As a sanity check, we also do this with operating systems we know are
** little endian, such as Windows. Some processors are bi-endian, such as
** the MIPS series, so we have to be careful about those.
** ----------------------------------------------------------------------------
*/
#if defined POSH_CPU_X86 || defined POSH_CPU_AXP || defined POSH_CPU_STRONGARM || defined POSH_OS_WIN32 || defined POSH_OS_WINCE || defined __MIPSEL__
# define POSH_ENDIAN_STRING "little"
# define POSH_LITTLE_ENDIAN 1
#else
# define POSH_ENDIAN_STRING "big"
# define POSH_BIG_ENDIAN 1
#endif
#if defined FORCE_DOXYGEN
# define POSH_LITTLE_ENDIAN
#endif
/*
** ----------------------------------------------------------------------------
** Cross-platform compile time assertion macro
** ----------------------------------------------------------------------------
*/
#define POSH_COMPILE_TIME_ASSERT(name, x) typedef int _POSH_dummy_ ## name[(x) ? 1 : -1 ]
/*
** ----------------------------------------------------------------------------
** 64-bit Integer
**
** We don't require 64-bit support, nor do we emulate its functionality, we
** simply export it if it's available. Since we can't count on <limits.h>
** for 64-bit support, we ignore the POSH_USE_LIMITS_H directive.
** ----------------------------------------------------------------------------
*/
#if defined ( __LP64__ ) || defined ( __powerpc64__ ) || defined POSH_CPU_SPARC64
# define POSH_64BIT_INTEGER 1
typedef long posh_i64_t;
typedef unsigned long posh_u64_t;
# define POSH_I64( x ) ((posh_i64_t)x)
# define POSH_U64( x ) ((posh_u64_t)x)
# define POSH_I64_PRINTF_PREFIX "l"
#elif defined _MSC_VER || defined __BORLANDC__ || defined __WATCOMC__ || ( defined __alpha && defined __DECC )
# define POSH_64BIT_INTEGER 1
typedef __int64 posh_i64_t;
typedef unsigned __int64 posh_u64_t;
# define POSH_I64( x ) ((posh_i64_t)x)
# define POSH_U64( x ) ((posh_u64_t)x)
# define POSH_I64_PRINTF_PREFIX "I64"
#elif defined __GNUC__ || defined __MWERKS__ || defined __SUNPRO_C || defined __SUNPRO_CC || defined __APPLE_CC__ || defined POSH_OS_IRIX || defined _LONG_LONG || defined _CRAYC
# define POSH_64BIT_INTEGER 1
typedef long long posh_i64_t;
typedef unsigned long long posh_u64_t;
# define POSH_U64( x ) ((posh_u64_t)(x##LL))
# define POSH_I64( x ) ((posh_i64_t)(x##LL))
# define POSH_I64_PRINTF_PREFIX "ll"
#endif
/* hack */
#ifdef __MINGW32__
# undef POSH_I64
# undef POSH_U64
# undef POSH_I64_PRINTF_PREFIX
# define POSH_U64( x ) ((posh_u64_t)(x##LL))
# define POSH_I64( x ) ((posh_i64_t)(x##LL))
# define POSH_I64_PRINTF_PREFIX "I64"
#endif
#ifdef FORCE_DOXYGEN
typedef long long posh_i64_t;
typedef unsigned long posh_u64_t;
# define POSH_64BIT_INTEGER
# define POSH_I64_PRINTF_PREFIX
# define POSH_I64(x)
# define POSH_U64(x)
#endif
/** Minimum value for a 64-bit signed integer */
#define POSH_I64_MIN POSH_I64(0x8000000000000000)
/** Maximum value for a 64-bit signed integer */
#define POSH_I64_MAX POSH_I64(0x7FFFFFFFFFFFFFFF)
/** Minimum value for a 64-bit unsigned integer */
#define POSH_U64_MIN POSH_U64(0)
/** Maximum value for a 64-bit unsigned integer */
#define POSH_U64_MAX POSH_U64(0xFFFFFFFFFFFFFFFF)
/* ----------------------------------------------------------------------------
** Basic Sized Types
**
** These types are expected to be EXACTLY sized so you can use them for
** serialization.
** ----------------------------------------------------------------------------
*/
#define POSH_FALSE 0
#define POSH_TRUE 1
typedef int posh_bool_t;
typedef unsigned char posh_byte_t;
/* NOTE: These assume that CHAR_BIT is 8!! */
typedef unsigned char posh_u8_t;
typedef signed char posh_i8_t;
#if defined POSH_USE_LIMITS_H
# if CHAR_BITS > 8
# error This machine uses 9-bit characters. This is a warning, you can comment this out now.
# endif /* CHAR_BITS > 8 */
/* 16-bit */
# if ( USHRT_MAX == 65535 )
typedef unsigned short posh_u16_t;
typedef short posh_i16_t;
# else
/* Yes, in theory there could still be a 16-bit character type and shorts are
32-bits in size...if you find such an architecture, let me know =P */
# error No 16-bit type found
# endif
/* 32-bit */
# if ( INT_MAX == 2147483647 )
typedef unsigned posh_u32_t;
typedef int posh_i32_t;
# elif ( LONG_MAX == 2147483647 )
typedef unsigned long posh_u32_t;
typedef long posh_i32_t;
# else
error No 32-bit type found
# endif
#else /* POSH_USE_LIMITS_H */
typedef unsigned short posh_u16_t;
typedef short posh_i16_t;
# if !defined POSH_OS_PALM
typedef unsigned posh_u32_t;
typedef int posh_i32_t;
# else
typedef unsigned long posh_u32_t;
typedef long posh_i32_t;
# endif
#endif
/** Minimum value for a byte */
#define POSH_BYTE_MIN 0
/** Maximum value for an 8-bit unsigned value */
#define POSH_BYTE_MAX 255
/** Minimum value for a byte */
#define POSH_I16_MIN ( ( posh_i16_t ) 0x8000 )
/** Maximum value for a 16-bit signed value */
#define POSH_I16_MAX ( ( posh_i16_t ) 0x7FFF )
/** Minimum value for a 16-bit unsigned value */
#define POSH_U16_MIN 0
/** Maximum value for a 16-bit unsigned value */
#define POSH_U16_MAX ( ( posh_u16_t ) 0xFFFF )
/** Minimum value for a 32-bit signed value */
#define POSH_I32_MIN ( ( posh_i32_t ) 0x80000000 )
/** Maximum value for a 32-bit signed value */
#define POSH_I32_MAX ( ( posh_i32_t ) 0x7FFFFFFF )
/** Minimum value for a 32-bit unsigned value */
#define POSH_U32_MIN 0
/** Maximum value for a 32-bit unsigned value */
#define POSH_U32_MAX ( ( posh_u32_t ) 0xFFFFFFFF )
/*
** ----------------------------------------------------------------------------
** Sanity checks on expected sizes
** ----------------------------------------------------------------------------
*/
#if !defined FORCE_DOXYGEN
POSH_COMPILE_TIME_ASSERT(posh_byte_t, sizeof(posh_byte_t) == 1);
POSH_COMPILE_TIME_ASSERT(posh_u8_t, sizeof(posh_u8_t) == 1);
POSH_COMPILE_TIME_ASSERT(posh_i8_t, sizeof(posh_i8_t) == 1);
POSH_COMPILE_TIME_ASSERT(posh_u16_t, sizeof(posh_u16_t) == 2);
POSH_COMPILE_TIME_ASSERT(posh_i16_t, sizeof(posh_i16_t) == 2);
POSH_COMPILE_TIME_ASSERT(posh_u32_t, sizeof(posh_u32_t) == 4);
POSH_COMPILE_TIME_ASSERT(posh_i32_t, sizeof(posh_i32_t) == 4);
#if !defined POSH_NO_FLOAT
POSH_COMPILE_TIME_ASSERT(posh_testfloat_t, sizeof(float)==4 );
POSH_COMPILE_TIME_ASSERT(posh_testdouble_t, sizeof(double)==8);
#endif
#if defined POSH_64BIT_INTEGER
POSH_COMPILE_TIME_ASSERT(posh_u64_t, sizeof(posh_u64_t) == 8);
POSH_COMPILE_TIME_ASSERT(posh_i64_t, sizeof(posh_i64_t) == 8);
#endif
#endif
/*
** ----------------------------------------------------------------------------
** 64-bit pointer support
** ----------------------------------------------------------------------------
*/
#if defined POSH_CPU_AXP && ( defined POSH_OS_TRU64 || defined POSH_OS_LINUX )
# define POSH_64BIT_POINTER 1
#endif
#if defined POSH_CPU_X86_64 && defined POSH_OS_LINUX
# define POSH_64BIT_POINTER 1
#endif
#if defined POSH_CPU_SPARC64 || defined POSH_OS_WIN64 || defined __64BIT__ || defined __LP64 || defined _LP64 || defined __LP64__ || defined _ADDR64 || defined _CRAYC
# define POSH_64BIT_POINTER 1
#endif
#if defined POSH_64BIT_POINTER
POSH_COMPILE_TIME_ASSERT( posh_64bit_pointer, sizeof( void * ) == 8 );
#elif !defined FORCE_DOXYGEN
/* if this assertion is hit then you're on a system that either has 64-bit
addressing and we didn't catch it, or you're on a system with 16-bit
pointers. In the latter case, POSH doesn't actually care, we're just
triggering this assertion to make sure you're aware of the situation,
so feel free to delete it.
If this assertion is triggered on a known 32 or 64-bit platform,
please let us know (poshlib@poshlib.org) */
POSH_COMPILE_TIME_ASSERT( posh_32bit_pointer, sizeof( void * ) == 4 );
#endif
#if defined FORCE_DOXYGEN
# define POSH_64BIT_POINTER
#endif
/*
** ----------------------------------------------------------------------------
** POSH Utility Functions
**
** These are optional POSH utility functions that are not required if you don't
** need anything except static checking of your host and target environment.
**
** These functions are NOT wrapped with POSH_PUBLIC_API because I didn't want
** to enforce their export if your own library is only using them internally.
** ----------------------------------------------------------------------------
*/
#ifdef __cplusplus
extern "C" {
#endif
const char *POSH_GetArchString( void );
#if !defined POSH_NO_FLOAT
posh_u32_t POSH_LittleFloatBits( float f );
posh_u32_t POSH_BigFloatBits( float f );
float POSH_FloatFromLittleBits( posh_u32_t bits );
float POSH_FloatFromBigBits( posh_u32_t bits );
void POSH_DoubleBits( double d, posh_byte_t dst[ 8 ] );
double POSH_DoubleFromBits( const posh_byte_t src[ 8 ] );
/* unimplemented
float *POSH_WriteFloatToLittle( void *dst, float f );
float *POSH_WriteFloatToBig( void *dst, float f );
float POSH_ReadFloatFromLittle( const void *src );
float POSH_ReadFloatFromBig( const void *src );
double *POSH_WriteDoubleToLittle( void *dst, double d );
double *POSH_WriteDoubleToBig( void *dst, double d );
double POSH_ReadDoubleFromLittle( const void *src );
double POSH_ReadDoubleFromBig( const void *src );
*/
#endif /* !defined POSH_NO_FLOAT */
#if defined FORCE_DOXYGEN
# define POSH_NO_FLOAT
# undef POSH_NO_FLOAT
#endif
extern posh_u16_t POSH_SwapU16( posh_u16_t u );
extern posh_i16_t POSH_SwapI16( posh_i16_t u );
extern posh_u32_t POSH_SwapU32( posh_u32_t u );
extern posh_i32_t POSH_SwapI32( posh_i32_t u );
#if defined POSH_64BIT_INTEGER
extern posh_u64_t POSH_SwapU64( posh_u64_t u );
extern posh_i64_t POSH_SwapI64( posh_i64_t u );
#endif /*POSH_64BIT_INTEGER */
extern posh_u16_t *POSH_WriteU16ToLittle( void *dst, posh_u16_t value );
extern posh_i16_t *POSH_WriteI16ToLittle( void *dst, posh_i16_t value );
extern posh_u32_t *POSH_WriteU32ToLittle( void *dst, posh_u32_t value );
extern posh_i32_t *POSH_WriteI32ToLittle( void *dst, posh_i32_t value );
extern posh_u16_t *POSH_WriteU16ToBig( void *dst, posh_u16_t value );
extern posh_i16_t *POSH_WriteI16ToBig( void *dst, posh_i16_t value );
extern posh_u32_t *POSH_WriteU32ToBig( void *dst, posh_u32_t value );
extern posh_i32_t *POSH_WriteI32ToBig( void *dst, posh_i32_t value );
extern posh_u16_t POSH_ReadU16FromLittle( const void *src );
extern posh_i16_t POSH_ReadI16FromLittle( const void *src );
extern posh_u32_t POSH_ReadU32FromLittle( const void *src );
extern posh_i32_t POSH_ReadI32FromLittle( const void *src );
extern posh_u16_t POSH_ReadU16FromBig( const void *src );
extern posh_i16_t POSH_ReadI16FromBig( const void *src );
extern posh_u32_t POSH_ReadU32FromBig( const void *src );
extern posh_i32_t POSH_ReadI32FromBig( const void *src );
#if defined POSH_64BIT_INTEGER
extern posh_u64_t *POSH_WriteU64ToLittle( void *dst, posh_u64_t value );
extern posh_i64_t *POSH_WriteI64ToLittle( void *dst, posh_i64_t value );
extern posh_u64_t *POSH_WriteU64ToBig( void *dst, posh_u64_t value );
extern posh_i64_t *POSH_WriteI64ToBig( void *dst, posh_i64_t value );
extern posh_u64_t POSH_ReadU64FromLittle( const void *src );
extern posh_i64_t POSH_ReadI64FromLittle( const void *src );
extern posh_u64_t POSH_ReadU64FromBig( const void *src );
extern posh_i64_t POSH_ReadI64FromBig( const void *src );
#endif /* POSH_64BIT_INTEGER */
#if defined POSH_LITTLE_ENDIAN
# define POSH_LittleU16(x) (x)
# define POSH_LittleU32(x) (x)
# define POSH_LittleI16(x) (x)
# define POSH_LittleI32(x) (x)
# if defined POSH_64BIT_INTEGER
# define POSH_LittleU64(x) (x)
# define POSH_LittleI64(x) (x)
# endif /* defined POSH_64BIT_INTEGER */
# define POSH_BigU16(x) POSH_SwapU16(x)
# define POSH_BigU32(x) POSH_SwapU32(x)
# define POSH_BigI16(x) POSH_SwapI16(x)
# define POSH_BigI32(x) POSH_SwapI32(x)
# if defined POSH_64BIT_INTEGER
# define POSH_BigU64(x) POSH_SwapU64(x)
# define POSH_BigI64(x) POSH_SwapI64(x)
# endif /* defined POSH_64BIT_INTEGER */
#else
# define POSH_BigU16(x) (x)
# define POSH_BigU32(x) (x)
# define POSH_BigI16(x) (x)
# define POSH_BigI32(x) (x)
# if defined POSH_64BIT_INTEGER
# define POSH_BigU64(x) (x)
# define POSH_BigI64(x) (x)
# endif /* POSH_64BIT_INTEGER */
# define POSH_LittleU16(x) POSH_SwapU16(x)
# define POSH_LittleU32(x) POSH_SwapU32(x)
# define POSH_LittleI16(x) POSH_SwapI16(x)
# define POSH_LittleI32(x) POSH_SwapI32(x)
# if defined POSH_64BIT_INTEGER
# define POSH_LittleU64(x) POSH_SwapU64(x)
# define POSH_LittleI64(x) POSH_SwapI64(x)
# endif /* POSH_64BIT_INTEGER */
#endif
#ifdef __cplusplus
}
#endif
#endif /* HAVE_POSH_H */

@ -0,0 +1,29 @@
#include "../../posh.c"
#include <stdio.h>
int main( void )
{
printf( "archtest:\n" );
printf( "--------\n" );
printf( "%s", POSH_GetArchString() );
printf( "byte min: %d\n", POSH_BYTE_MIN );
printf( "byte max: %d\n", POSH_BYTE_MAX );
printf( "i16 min: %d\n", POSH_I16_MIN );
printf( "i16 max: %d\n", POSH_I16_MAX );
printf( "i32 min: %d\n", POSH_I32_MIN );
printf( "i32 max: %d\n", POSH_I32_MAX );
printf( "u16 min: %u\n", POSH_U16_MIN );
printf( "u16 max: %u\n", POSH_U16_MAX );
printf( "u32 min: %u\n", POSH_U32_MIN );
printf( "u32 max: %u\n", POSH_U32_MAX );
#ifdef POSH_64BIT_INTEGER
printf( "i64 min: %"POSH_I64_PRINTF_PREFIX"d\n", POSH_I64_MIN );
printf( "i64 max: %"POSH_I64_PRINTF_PREFIX"d\n", POSH_I64_MAX );
printf( "u64 min: %"POSH_I64_PRINTF_PREFIX"u\n", POSH_U64_MIN );
printf( "u64 max: %"POSH_I64_PRINTF_PREFIX"u\n", POSH_U64_MAX );
#endif
return 0;
}

@ -0,0 +1,23 @@
#include "testlib.hpp"
#include "testdll.h"
#include <stdio.h>
int main( void )
{
printf( "linktest:\n" );
printf( "---------\n" );
printf( "linktest is a simple verification test that tests:\n" );
printf( " * correct linkage between C and C++\n" );
printf( " * proper handling when multiple libs use posh\n" );
printf( " * correct handling of DLL vs. LIB linkage (Windows)\n" );
printf( "\n\n" );
printf( "POSH_GetArchString() reporting:\n%s\n\n", POSH_GetArchString() );
TestLib_Foo();
TestDLL_Foo();
printf( "\n\nlinktest succeeded!\n" );
return 0;
}

@ -0,0 +1,20 @@
#ifndef TESTDLL_H
#define TESTDLL_H
#define POSH_DLL 1 //define this since poshtestdll is a DLL
#include "../../posh.h"
#undef POSH_DLL //undefine so that another include of posh.h doesn't cause problems
#define TESTDLL_PUBLIC_API POSH_PUBLIC_API
#if defined __cplusplus
extern "C" {
#endif
TESTDLL_PUBLIC_API(void) TestDLL_Foo( void );
#if defined __cplusplus
}
#endif
#endif /* TESTDLL_H */

@ -0,0 +1,11 @@
#define POSH_BUILDING_LIB 1
#include "testlib.hpp"
#include <stdio.h>
void TestLib_Foo( void )
{
printf( "...TestLib_Foo called successfully!\n" );
}

@ -0,0 +1,19 @@
#ifndef TESTLIB_HPP
#define TESTLIB_HPP
#undef POSH_DLL
#include "../../posh.h"
#define TESTLIB_PUBLIC_API POSH_PUBLIC_API
#if defined __cplusplus && defined POSH_DLL
extern "C" {
#endif
TESTLIB_PUBLIC_API(void) TestLib_Foo( void );
#if defined __cplusplus && defined POSH_DLL
}
#endif
#endif /* POSHTESTLIB_H */

@ -0,0 +1,54 @@
PROJECT(nvimage)
SUBDIRS(nvtt)
SET(IMAGE_SRCS
nvimage.h
FloatImage.h
FloatImage.cpp
Filter.h
Filter.cpp
Image.h
Image.cpp
ImageIO.h
ImageIO.cpp
ColorBlock.h
ColorBlock.cpp
HoleFilling.h
HoleFilling.cpp
DirectDrawSurface.h
DirectDrawSurface.cpp
Quantize.h
Quantize.cpp
NormalMap.h
NormalMap.cpp)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
IF(PNG_FOUND)
SET(LIBS ${LIBS} ${PNG_LIBRARIES})
INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIR})
ENDIF(PNG_FOUND)
IF(JPEG_FOUND)
SET(LIBS ${LIBS} ${JPEG_LIBRARIES})
INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR})
ENDIF(JPEG_FOUND)
IF(TIFF_FOUND)
SET(LIBS ${LIBS} ${TIFF_LIBRARIES})
INCLUDE_DIRECTORIES(${TIFF_INCLUDE_DIR})
ENDIF(TIFF_FOUND)
# targets
ADD_DEFINITIONS(-DNVIMAGE_EXPORTS)
IF(NVIMAGE_SHARED)
ADD_LIBRARY(nvimage SHARED ${IMAGE_SRCS})
ELSE(NVIMAGE_SHARED)
ADD_LIBRARY(nvimage ${IMAGE_SRCS})
ENDIF(NVIMAGE_SHARED)
TARGET_LINK_LIBRARIES(nvimage ${LIBS} nvcore nvmath posh)

@ -0,0 +1,392 @@
// This code is in the public domain -- castanyo@yahoo.es
#include <nvmath/Box.h>
#include <nvimage/ColorBlock.h>
#include <nvimage/Image.h>
using namespace nv;
namespace {
// Get approximate luminance.
inline static uint colorLuminance(Color32 c)
{
return c.r + c.g + c.b;
}
// Get the euclidean distance between the given colors.
inline static uint colorDistance(Color32 c0, Color32 c1)
{
return (c0.r - c1.r) * (c0.r - c1.r) + (c0.g - c1.g) * (c0.g - c1.g) + (c0.b - c1.b) * (c0.b - c1.b);
}
} // namespace`
/// Default constructor.
ColorBlock::ColorBlock()
{
}
/// Init the color block with the contents of the given block.
ColorBlock::ColorBlock(const ColorBlock & block)
{
for(uint i = 0; i < 16; i++) {
color(i) = block.color(i);
}
}
/// Initialize this color block.
ColorBlock::ColorBlock(const Image * img, uint x, uint y)
{
init(img, x, y);
}
void ColorBlock::init(const Image * img, uint x, uint y)
{
nvDebugCheck(img != NULL);
const uint bw = min(img->width() - x, 4U);
const uint bh = min(img->height() - y, 4U);
nvDebugCheck(bw != 0);
nvDebugCheck(bh != 0);
int remainder[] = {
0, 0, 0, 0,
0, 1, 0, 1,
0, 1, 2, 0,
0, 1, 2, 3,
};
// Blocks that are smaller than 4x4 are handled by repeating the pixels.
// @@ Thats only correct when block size is 1, 2 or 4, but not with 3.
for(uint i = 0; i < 4; i++) {
//const int by = i % bh;
const int by = remainder[(bh - 1) * 4 + i];
for(uint e = 0; e < 4; e++) {
//const int bx = e % bw;
const int bx = remainder[(bw - 1) * 4 + e];
color(e, i) = img->pixel(x + bx, y + by);
}
}
}
void ColorBlock::swizzleDXT5n()
{
for(int i = 0; i < 16; i++)
{
Color32 c = m_color[i];
m_color[i] = Color32(0, c.r, 0, c.g);
}
}
void ColorBlock::splatX()
{
for(int i = 0; i < 16; i++)
{
uint8 x = m_color[i].r;
m_color[i] = Color32(x, x, x, x);
}
}
void ColorBlock::splatY()
{
for(int i = 0; i < 16; i++)
{
uint8 y = m_color[i].g;
m_color[i] = Color32(y, y, y, y);
}
}
/// Count number of unique colors in this color block.
uint ColorBlock::countUniqueColors() const
{
uint count = 0;
// @@ This does not have to be o(n^2)
for(int i = 0; i < 16; i++)
{
bool unique = true;
for(int j = 0; j < i; j++) {
if( m_color[i] != m_color[j] ) {
unique = false;
}
}
if( unique ) {
count++;
}
}
return count;
}
/// Get average color of the block.
Color32 ColorBlock::averageColor() const
{
uint r, g, b, a;
r = g = b = a = 0;
for(uint i = 0; i < 16; i++) {
r += m_color[i].r;
g += m_color[i].g;
b += m_color[i].b;
a += m_color[i].a;
}
return Color32(uint8(r / 16), uint8(g / 16), uint8(b / 16), uint8(a / 16));
}
/// Get diameter color range.
void ColorBlock::diameterRange(Color32 * start, Color32 * end) const
{
nvDebugCheck(start != NULL);
nvDebugCheck(end != NULL);
Color32 c0, c1;
uint best_dist = 0;
for(int i = 0; i < 16; i++) {
for (int j = i+1; j < 16; j++) {
uint dist = colorDistance(m_color[i], m_color[j]);
if( dist > best_dist ) {
best_dist = dist;
c0 = m_color[i];
c1 = m_color[j];
}
}
}
*start = c0;
*end = c1;
}
/// Get luminance color range.
void ColorBlock::luminanceRange(Color32 * start, Color32 * end) const
{
nvDebugCheck(start != NULL);
nvDebugCheck(end != NULL);
Color32 minColor, maxColor;
uint minLuminance, maxLuminance;
maxLuminance = minLuminance = colorLuminance(m_color[0]);
for(uint i = 1; i < 16; i++)
{
uint luminance = colorLuminance(m_color[i]);
if (luminance > maxLuminance) {
maxLuminance = luminance;
maxColor = m_color[i];
}
else if (luminance < minLuminance) {
minLuminance = luminance;
minColor = m_color[i];
}
}
*start = minColor;
*end = maxColor;
}
/// Get color range based on the bounding box.
void ColorBlock::boundsRange(Color32 * start, Color32 * end) const
{
nvDebugCheck(start != NULL);
nvDebugCheck(end != NULL);
Color32 minColor(255, 255, 255);
Color32 maxColor(0, 0, 0);
for(uint i = 0; i < 16; i++)
{
if (m_color[i].r < minColor.r) { minColor.r = m_color[i].r; }
if (m_color[i].g < minColor.g) { minColor.g = m_color[i].g; }
if (m_color[i].b < minColor.b) { minColor.b = m_color[i].b; }
if (m_color[i].r > maxColor.r) { maxColor.r = m_color[i].r; }
if (m_color[i].g > maxColor.g) { maxColor.g = m_color[i].g; }
if (m_color[i].b > maxColor.b) { maxColor.b = m_color[i].b; }
}
// Offset range by 1/16 of the extents
Color32 inset;
inset.r = (maxColor.r - minColor.r) >> 4;
inset.g = (maxColor.g - minColor.g) >> 4;
inset.b = (maxColor.b - minColor.b) >> 4;
minColor.r = (minColor.r + inset.r <= 255) ? minColor.r + inset.r : 255;
minColor.g = (minColor.g + inset.g <= 255) ? minColor.g + inset.g : 255;
minColor.b = (minColor.b + inset.b <= 255) ? minColor.b + inset.b : 255;
maxColor.r = (maxColor.r >= inset.r) ? maxColor.r - inset.r : 0;
maxColor.g = (maxColor.g >= inset.g) ? maxColor.g - inset.g : 0;
maxColor.b = (maxColor.b >= inset.b) ? maxColor.b - inset.b : 0;
*start = minColor;
*end = maxColor;
}
/// Get color range based on the bounding box.
void ColorBlock::boundsRangeAlpha(Color32 * start, Color32 * end) const
{
nvDebugCheck(start != NULL);
nvDebugCheck(end != NULL);
Color32 minColor(255, 255, 255, 255);
Color32 maxColor(0, 0, 0, 0);
for(uint i = 0; i < 16; i++)
{
if (m_color[i].r < minColor.r) { minColor.r = m_color[i].r; }
if (m_color[i].g < minColor.g) { minColor.g = m_color[i].g; }
if (m_color[i].b < minColor.b) { minColor.b = m_color[i].b; }
if (m_color[i].a < minColor.a) { minColor.a = m_color[i].a; }
if (m_color[i].r > maxColor.r) { maxColor.r = m_color[i].r; }
if (m_color[i].g > maxColor.g) { maxColor.g = m_color[i].g; }
if (m_color[i].b > maxColor.b) { maxColor.b = m_color[i].b; }
if (m_color[i].a > maxColor.a) { maxColor.a = m_color[i].a; }
}
// Offset range by 1/16 of the extents
Color32 inset;
inset.r = (maxColor.r - minColor.r) >> 4;
inset.g = (maxColor.g - minColor.g) >> 4;
inset.b = (maxColor.b - minColor.b) >> 4;
inset.a = (maxColor.a - minColor.a) >> 4;
minColor.r = (minColor.r + inset.r <= 255) ? minColor.r + inset.r : 255;
minColor.g = (minColor.g + inset.g <= 255) ? minColor.g + inset.g : 255;
minColor.b = (minColor.b + inset.b <= 255) ? minColor.b + inset.b : 255;
minColor.a = (minColor.a + inset.a <= 255) ? minColor.a + inset.a : 255;
maxColor.r = (maxColor.r >= inset.r) ? maxColor.r - inset.r : 0;
maxColor.g = (maxColor.g >= inset.g) ? maxColor.g - inset.g : 0;
maxColor.b = (maxColor.b >= inset.b) ? maxColor.b - inset.b : 0;
maxColor.a = (maxColor.a >= inset.a) ? maxColor.a - inset.a : 0;
*start = minColor;
*end = maxColor;
}
void ColorBlock::bestFitRange(Color32 * start, Color32 * end) const
{
nvDebugCheck(start != NULL);
nvDebugCheck(end != NULL);
Vector3 axis = bestFitLine().direction();
computeRange(axis, start, end);
}
/// Sort colors by abosolute value in their 16 bit representation.
void ColorBlock::sortColorsByAbsoluteValue()
{
// Dummy selection sort.
for( uint a = 0; a < 16; a++ ) {
uint max = a;
Color16 cmax(m_color[a]);
for( uint b = a+1; b < 16; b++ ) {
Color16 cb(m_color[b]);
if( cb.u > cmax.u ) {
max = b;
cmax = cb;
}
}
swap( m_color[a], m_color[max] );
}
}
/// Find extreme colors in the given axis.
void ColorBlock::computeRange(Vector3::Arg axis, Color32 * start, Color32 * end) const
{
nvDebugCheck(start != NULL);
nvDebugCheck(end != NULL);
int mini, maxi;
mini = maxi = 0;
float min, max;
min = max = dot(Vector3(m_color[0].r, m_color[0].g, m_color[0].b), axis);
for(uint i = 1; i < 16; i++)
{
const Vector3 vec(m_color[i].r, m_color[i].g, m_color[i].b);
float val = dot(vec, axis);
if( val < min ) {
mini = i;
min = val;
}
else if( val > max ) {
maxi = i;
max = val;
}
}
*start = m_color[mini];
*end = m_color[maxi];
}
/// Sort colors in the given axis.
void ColorBlock::sortColors(const Vector3 & axis)
{
float luma_array[16];
for(uint i = 0; i < 16; i++) {
const Vector3 vec(m_color[i].r, m_color[i].g, m_color[i].b);
luma_array[i] = dot(vec, axis);
}
// Dummy selection sort.
for( uint a = 0; a < 16; a++ ) {
uint min = a;
for( uint b = a+1; b < 16; b++ ) {
if( luma_array[b] < luma_array[min] ) {
min = b;
}
}
swap( luma_array[a], luma_array[min] );
swap( m_color[a], m_color[min] );
}
}
/// Get least squares line that best approxiamtes the points of the color block.
Line3 ColorBlock::bestFitLine() const
{
Array<Vector3> pointArray(16);
for(int i = 0; i < 16; i++) {
pointArray.append(Vector3(m_color[i].r, m_color[i].g, m_color[i].b));
}
return Fit::bestLine(pointArray);
}
/// Get the volume of the color block.
float ColorBlock::volume() const
{
Box bounds;
bounds.clearBounds();
for(int i = 0; i < 16; i++) {
const Vector3 point(m_color[i].r, m_color[i].g, m_color[i].b);
bounds.addPointToBounds(point);
}
return bounds.volume();
}

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

Loading…
Cancel
Save