diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f1e86c..33adb31 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ 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}/extern/gnuwin32") + SET(GNUWIN32 "${NV_SOURCE_DIR}/gnuwin32") SET(CMAKE_INCLUDE_PATH "${GNUWIN32}/include") SET(CMAKE_LIBRARY_PATH "${GNUWIN32}/lib") ENDIF(WIN32) diff --git a/ChangeLog b/ChangeLog index f34d8e9..66f64fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,13 +1,3 @@ -NVIDIA Texture Tools version 2.1.0 - * CTX1 CUDA compressor. - * DXT1n CUDA compressor. - * Support alpha premultiplication by Charles Nicholson. See issue 30. - * Improved decompressor tool submitted by Amorilia. See issue 41. - * Add support for YCoCg color transform. Fixes issue 18. - * Add support for linear and swizzle transforms. Fixes issue 4. - * Fix loading of EXR files using OpenEXR. - * Use FreeImage as primary image loading library. Fixes issue 31. - NVIDIA Texture Tools version 2.0.3 * More accurate DXT3 compressor. Fixes issue 38. * Remove legacy compressors. Fix issue 34. diff --git a/NVIDIA_Texture_Tools_README.txt b/NVIDIA_Texture_Tools_README.txt index 46faefa..93a26c1 100644 --- a/NVIDIA_Texture_Tools_README.txt +++ b/NVIDIA_Texture_Tools_README.txt @@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- NVIDIA Texture Tools README.txt -Version 2.1 +Version 2.0 -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- diff --git a/VERSION b/VERSION index 7ec1d6d..50ffc5a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.1.0 +2.0.3 diff --git a/cmake/FindFreeImage.cmake b/cmake/FindFreeImage.cmake deleted file mode 100644 index 16ae7a3..0000000 --- a/cmake/FindFreeImage.cmake +++ /dev/null @@ -1,51 +0,0 @@ -# -# Try to find the FreeImage library and include path. -# Once done this will define -# -# FREEIMAGE_FOUND -# FREEIMAGE_INCLUDE_PATH -# FREEIMAGE_LIBRARY -# - -IF (WIN32) - FIND_PATH( FREEIMAGE_INCLUDE_PATH FreeImage.h - ${PROJECT_SOURCE_DIR}/extern/FreeImage - DOC "The directory where FreeImage.h resides") - FIND_LIBRARY( FREEIMAGE_LIBRARY - NAMES FreeImage freeimage - PATHS - ${PROJECT_SOURCE_DIR}/FreeImage - DOC "The FreeImage library") -ELSE (WIN32) - FIND_PATH( FREEIMAGE_INCLUDE_PATH FreeImage.h - /usr/include - /usr/local/include - /sw/include - /opt/local/include - DOC "The directory where FreeImage.h resides") - FIND_LIBRARY( FREEIMAGE_LIBRARY - NAMES FreeImage freeimage - PATHS - /usr/lib64 - /usr/lib - /usr/local/lib64 - /usr/local/lib - /sw/lib - /opt/local/lib - DOC "The FreeImage library") -ENDIF (WIN32) - -SET(FREEIMAGE_LIBRARIES ${FREEIMAGE_LIBRARY}) - -IF (FREEIMAGE_INCLUDE_PATH AND FREEIMAGE_LIBRARY) - SET( FREEIMAGE_FOUND TRUE CACHE BOOL "Set to TRUE if GLEW is found, FALSE otherwise") -ELSE (FREEIMAGE_INCLUDE_PATH AND FREEIMAGE_LIBRARY) - SET( FREEIMAGE_FOUND FALSE CACHE BOOL "Set to TRUE if GLEW is found, FALSE otherwise") -ENDIF (FREEIMAGE_INCLUDE_PATH AND FREEIMAGE_LIBRARY) - -MARK_AS_ADVANCED( - FREEIMAGE_FOUND - FREEIMAGE_LIBRARY - FREEIMAGE_LIBRARIES - FREEIMAGE_INCLUDE_PATH) - diff --git a/cmake/OptimalOptions.cmake b/cmake/OptimalOptions.cmake index 50aa865..f91f180 100644 --- a/cmake/OptimalOptions.cmake +++ b/cmake/OptimalOptions.cmake @@ -20,21 +20,12 @@ IF(CMAKE_COMPILER_IS_GNUCXX) ENDIF(NV_SYSTEM_PROCESSOR STREQUAL "x86_64") IF(NV_SYSTEM_PROCESSOR STREQUAL "powerpc") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=powerpc -faltivec -maltivec -mabi=altivec -mpowerpc-gfxopt") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=powerpc -maltivec -mabi=altivec -mpowerpc-gfxopt") # ibook G4: - #SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=7450 -mtune=7450 -faltivec -maltivec -mabi=altivec -mpowerpc-gfxopt") - - # G5 - #SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=G5 -faltivec -maltivec -mabi=altivec -mpowerpc-gfxopt") - + #SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=7450 -mtune=7450 -maltivec -mabi=altivec -mpowerpc-gfxopt") ENDIF(NV_SYSTEM_PROCESSOR STREQUAL "powerpc") -# IF(DARWIN) -# SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk") -# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk") -# ENDIF(DARWIN) - ENDIF(CMAKE_COMPILER_IS_GNUCXX) IF(MSVC) diff --git a/extern/FreeImage/FreeImage.dll b/extern/FreeImage/FreeImage.dll deleted file mode 100755 index 05859a8..0000000 Binary files a/extern/FreeImage/FreeImage.dll and /dev/null differ diff --git a/extern/FreeImage/FreeImage.h b/extern/FreeImage/FreeImage.h deleted file mode 100644 index 7125acc..0000000 --- a/extern/FreeImage/FreeImage.h +++ /dev/null @@ -1,1046 +0,0 @@ -// ========================================================== -// FreeImage 3 -// -// Design and implementation by -// - Floris van den Berg (flvdberg@wxs.nl) -// - Hervé Drolon (drolon@infonie.fr) -// -// Contributors: -// - Adam Gates (radad@xoasis.com) -// - Alex Kwak -// - Alexander Dymerets (sashad@te.net.ua) -// - Detlev Vendt (detlev.vendt@brillit.de) -// - Jan L. Nauta (jln@magentammt.com) -// - Jani Kajala (janik@remedy.fi) -// - Juergen Riecker (j.riecker@gmx.de) -// - Karl-Heinz Bussian (khbussian@moss.de) -// - Laurent Rocher (rocherl@club-internet.fr) -// - Luca Piergentili (l.pierge@terra.es) -// - Machiel ten Brinke (brinkem@uni-one.nl) -// - Markus Loibl (markus.loibl@epost.de) -// - Martin Weber (martweb@gmx.net) -// - Matthias Wandel (mwandel@rim.net) -// - Michal Novotny (michal@etc.cz) -// - Petr Pytelka (pyta@lightcomp.com) -// - Riley McNiff (rmcniff@marexgroup.com) -// - Ryan Rubley (ryan@lostreality.org) -// - Volker Gärtner (volkerg@gmx.at) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#ifndef FREEIMAGE_H -#define FREEIMAGE_H - -// Version information ------------------------------------------------------ - -#define FREEIMAGE_MAJOR_VERSION 3 -#define FREEIMAGE_MINOR_VERSION 10 -#define FREEIMAGE_RELEASE_SERIAL 0 - -// Compiler options --------------------------------------------------------- - -#include // needed for UNICODE functions - -#if defined(FREEIMAGE_LIB) - #define DLL_API - #define DLL_CALLCONV -#else - #if defined(_WIN32) || defined(__WIN32__) - #define DLL_CALLCONV __stdcall - // The following ifdef block is the standard way of creating macros which make exporting - // from a DLL simpler. All files within this DLL are compiled with the FREEIMAGE_EXPORTS - // symbol defined on the command line. this symbol should not be defined on any project - // that uses this DLL. This way any other project whose source files include this file see - // DLL_API functions as being imported from a DLL, wheras this DLL sees symbols - // defined with this macro as being exported. - #ifdef FREEIMAGE_EXPORTS - #define DLL_API __declspec(dllexport) - #else - #define DLL_API __declspec(dllimport) - #endif // FREEIMAGE_EXPORTS - #else - // try the gcc visibility support (see http://gcc.gnu.org/wiki/Visibility) - #if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) - #ifndef GCC_HASCLASSVISIBILITY - #define GCC_HASCLASSVISIBILITY - #endif - #endif // __GNUC__ - #define DLL_CALLCONV - #if defined(GCC_HASCLASSVISIBILITY) - #define DLL_API __attribute__ ((visibility("default"))) - #else - #define DLL_API - #endif - #endif // WIN32 / !WIN32 -#endif // FREEIMAGE_LIB - -// Some versions of gcc may have BYTE_ORDER or __BYTE_ORDER defined -// If your big endian system isn't being detected, add an OS specific check -#if (defined(BYTE_ORDER) && BYTE_ORDER==BIG_ENDIAN) || \ - (defined(__BYTE_ORDER) && __BYTE_ORDER==__BIG_ENDIAN) || \ - defined(__BIG_ENDIAN__) -#define FREEIMAGE_BIGENDIAN -#endif // BYTE_ORDER - -// This really only affects 24 and 32 bit formats, the rest are always RGB order. -#define FREEIMAGE_COLORORDER_BGR 0 -#define FREEIMAGE_COLORORDER_RGB 1 -#if defined(__APPLE__) || defined(FREEIMAGE_BIGENDIAN) -#define FREEIMAGE_COLORORDER FREEIMAGE_COLORORDER_RGB -#else -#define FREEIMAGE_COLORORDER FREEIMAGE_COLORORDER_BGR -#endif - -// Ensure 4-byte enums if we're using Borland C++ compilers -#if defined(__BORLANDC__) -#pragma option push -b -#endif - -// For C compatibility -------------------------------------------------------- - -#ifdef __cplusplus -#define FI_DEFAULT(x) = x -#define FI_ENUM(x) enum x -#define FI_STRUCT(x) struct x -#else -#define FI_DEFAULT(x) -#define FI_ENUM(x) typedef int x; enum x -#define FI_STRUCT(x) typedef struct x x; struct x -#endif - -// Bitmap types ------------------------------------------------------------- - -FI_STRUCT (FIBITMAP) { void *data; }; -FI_STRUCT (FIMULTIBITMAP) { void *data; }; - -// Types used in the library (directly copied from Windows) ----------------- - -#ifndef _WINDOWS_ -#define _WINDOWS_ - -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE 1 -#endif -#ifndef NULL -#define NULL 0 -#endif - -#ifndef SEEK_SET -#define SEEK_SET 0 -#define SEEK_CUR 1 -#define SEEK_END 2 -#endif - -#ifndef _MSC_VER -// define portable types for 32-bit / 64-bit OS -#include -typedef int32_t BOOL; -typedef uint8_t BYTE; -typedef uint16_t WORD; -typedef uint32_t DWORD; -typedef int32_t LONG; -#else -// MS is not C99 ISO compliant -typedef long BOOL; -typedef unsigned char BYTE; -typedef unsigned short WORD; -typedef unsigned long DWORD; -typedef long LONG; -#endif // _MSC_VER - -#if (defined(_WIN32) || defined(__WIN32__)) -#pragma pack(push, 1) -#else -#pragma pack(1) -#endif // WIN32 - -typedef struct tagRGBQUAD { -#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR - BYTE rgbBlue; - BYTE rgbGreen; - BYTE rgbRed; -#else - BYTE rgbRed; - BYTE rgbGreen; - BYTE rgbBlue; -#endif // FREEIMAGE_COLORORDER - BYTE rgbReserved; -} RGBQUAD; - -typedef struct tagRGBTRIPLE { -#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR - BYTE rgbtBlue; - BYTE rgbtGreen; - BYTE rgbtRed; -#else - BYTE rgbtRed; - BYTE rgbtGreen; - BYTE rgbtBlue; -#endif // FREEIMAGE_COLORORDER -} RGBTRIPLE; - -#if (defined(_WIN32) || defined(__WIN32__)) -#pragma pack(pop) -#else -#pragma pack() -#endif // WIN32 - -typedef struct tagBITMAPINFOHEADER{ - DWORD biSize; - LONG biWidth; - LONG biHeight; - WORD biPlanes; - WORD biBitCount; - DWORD biCompression; - DWORD biSizeImage; - LONG biXPelsPerMeter; - LONG biYPelsPerMeter; - DWORD biClrUsed; - DWORD biClrImportant; -} BITMAPINFOHEADER, *PBITMAPINFOHEADER; - -typedef struct tagBITMAPINFO { - BITMAPINFOHEADER bmiHeader; - RGBQUAD bmiColors[1]; -} BITMAPINFO, *PBITMAPINFO; - -#endif // _WINDOWS_ - -// Types used in the library (specific to FreeImage) ------------------------ - -#if (defined(_WIN32) || defined(__WIN32__)) -#pragma pack(push, 1) -#else -#pragma pack(1) -#endif // WIN32 - -/** 48-bit RGB -*/ -typedef struct tagFIRGB16 { - WORD red; - WORD green; - WORD blue; -} FIRGB16; - -/** 64-bit RGBA -*/ -typedef struct tagFIRGBA16 { - WORD red; - WORD green; - WORD blue; - WORD alpha; -} FIRGBA16; - -/** 96-bit RGB Float -*/ -typedef struct tagFIRGBF { - float red; - float green; - float blue; -} FIRGBF; - -/** 128-bit RGBA Float -*/ -typedef struct tagFIRGBAF { - float red; - float green; - float blue; - float alpha; -} FIRGBAF; - -/** Data structure for COMPLEX type (complex number) -*/ -typedef struct tagFICOMPLEX { - /// real part - double r; - /// imaginary part - double i; -} FICOMPLEX; - -#if (defined(_WIN32) || defined(__WIN32__)) -#pragma pack(pop) -#else -#pragma pack() -#endif // WIN32 - -// Indexes for byte arrays, masks and shifts for treating pixels as words --- -// These coincide with the order of RGBQUAD and RGBTRIPLE ------------------- - -#ifndef FREEIMAGE_BIGENDIAN -#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR -// Little Endian (x86 / MS Windows, Linux) : BGR(A) order -#define FI_RGBA_RED 2 -#define FI_RGBA_GREEN 1 -#define FI_RGBA_BLUE 0 -#define FI_RGBA_ALPHA 3 -#define FI_RGBA_RED_MASK 0x00FF0000 -#define FI_RGBA_GREEN_MASK 0x0000FF00 -#define FI_RGBA_BLUE_MASK 0x000000FF -#define FI_RGBA_ALPHA_MASK 0xFF000000 -#define FI_RGBA_RED_SHIFT 16 -#define FI_RGBA_GREEN_SHIFT 8 -#define FI_RGBA_BLUE_SHIFT 0 -#define FI_RGBA_ALPHA_SHIFT 24 -#else -// Little Endian (x86 / MaxOSX) : RGB(A) order -#define FI_RGBA_RED 0 -#define FI_RGBA_GREEN 1 -#define FI_RGBA_BLUE 2 -#define FI_RGBA_ALPHA 3 -#define FI_RGBA_RED_MASK 0x000000FF -#define FI_RGBA_GREEN_MASK 0x0000FF00 -#define FI_RGBA_BLUE_MASK 0x00FF0000 -#define FI_RGBA_ALPHA_MASK 0xFF000000 -#define FI_RGBA_RED_SHIFT 0 -#define FI_RGBA_GREEN_SHIFT 8 -#define FI_RGBA_BLUE_SHIFT 16 -#define FI_RGBA_ALPHA_SHIFT 24 -#endif // FREEIMAGE_COLORORDER -#else -#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR -// Big Endian (PPC / none) : BGR(A) order -#define FI_RGBA_RED 2 -#define FI_RGBA_GREEN 1 -#define FI_RGBA_BLUE 0 -#define FI_RGBA_ALPHA 3 -#define FI_RGBA_RED_MASK 0x0000FF00 -#define FI_RGBA_GREEN_MASK 0x00FF0000 -#define FI_RGBA_BLUE_MASK 0xFF000000 -#define FI_RGBA_ALPHA_MASK 0x000000FF -#define FI_RGBA_RED_SHIFT 8 -#define FI_RGBA_GREEN_SHIFT 16 -#define FI_RGBA_BLUE_SHIFT 24 -#define FI_RGBA_ALPHA_SHIFT 0 -#else -// Big Endian (PPC / Linux, MaxOSX) : RGB(A) order -#define FI_RGBA_RED 0 -#define FI_RGBA_GREEN 1 -#define FI_RGBA_BLUE 2 -#define FI_RGBA_ALPHA 3 -#define FI_RGBA_RED_MASK 0xFF000000 -#define FI_RGBA_GREEN_MASK 0x00FF0000 -#define FI_RGBA_BLUE_MASK 0x0000FF00 -#define FI_RGBA_ALPHA_MASK 0x000000FF -#define FI_RGBA_RED_SHIFT 24 -#define FI_RGBA_GREEN_SHIFT 16 -#define FI_RGBA_BLUE_SHIFT 8 -#define FI_RGBA_ALPHA_SHIFT 0 -#endif // FREEIMAGE_COLORORDER -#endif // FREEIMAGE_BIGENDIAN - -#define FI_RGBA_RGB_MASK (FI_RGBA_RED_MASK|FI_RGBA_GREEN_MASK|FI_RGBA_BLUE_MASK) - -// The 16bit macros only include masks and shifts, since each color element is not byte aligned - -#define FI16_555_RED_MASK 0x7C00 -#define FI16_555_GREEN_MASK 0x03E0 -#define FI16_555_BLUE_MASK 0x001F -#define FI16_555_RED_SHIFT 10 -#define FI16_555_GREEN_SHIFT 5 -#define FI16_555_BLUE_SHIFT 0 -#define FI16_565_RED_MASK 0xF800 -#define FI16_565_GREEN_MASK 0x07E0 -#define FI16_565_BLUE_MASK 0x001F -#define FI16_565_RED_SHIFT 11 -#define FI16_565_GREEN_SHIFT 5 -#define FI16_565_BLUE_SHIFT 0 - -// ICC profile support ------------------------------------------------------ - -#define FIICC_DEFAULT 0x00 -#define FIICC_COLOR_IS_CMYK 0x01 - -FI_STRUCT (FIICCPROFILE) { - WORD flags; // info flag - DWORD size; // profile's size measured in bytes - void *data; // points to a block of contiguous memory containing the profile -}; - -// Important enums ---------------------------------------------------------- - -/** I/O image format identifiers. -*/ -FI_ENUM(FREE_IMAGE_FORMAT) { - FIF_UNKNOWN = -1, - FIF_BMP = 0, - FIF_ICO = 1, - FIF_JPEG = 2, - FIF_JNG = 3, - FIF_KOALA = 4, - FIF_LBM = 5, - FIF_IFF = FIF_LBM, - FIF_MNG = 6, - FIF_PBM = 7, - FIF_PBMRAW = 8, - FIF_PCD = 9, - FIF_PCX = 10, - FIF_PGM = 11, - FIF_PGMRAW = 12, - FIF_PNG = 13, - FIF_PPM = 14, - FIF_PPMRAW = 15, - FIF_RAS = 16, - FIF_TARGA = 17, - FIF_TIFF = 18, - FIF_WBMP = 19, - FIF_PSD = 20, - FIF_CUT = 21, - FIF_XBM = 22, - FIF_XPM = 23, - FIF_DDS = 24, - FIF_GIF = 25, - FIF_HDR = 26, - FIF_FAXG3 = 27, - FIF_SGI = 28, - FIF_EXR = 29, - FIF_J2K = 30, - FIF_JP2 = 31 -}; - -/** Image type used in FreeImage. -*/ -FI_ENUM(FREE_IMAGE_TYPE) { - FIT_UNKNOWN = 0, // unknown type - FIT_BITMAP = 1, // standard image : 1-, 4-, 8-, 16-, 24-, 32-bit - FIT_UINT16 = 2, // array of unsigned short : unsigned 16-bit - FIT_INT16 = 3, // array of short : signed 16-bit - FIT_UINT32 = 4, // array of unsigned long : unsigned 32-bit - FIT_INT32 = 5, // array of long : signed 32-bit - FIT_FLOAT = 6, // array of float : 32-bit IEEE floating point - FIT_DOUBLE = 7, // array of double : 64-bit IEEE floating point - FIT_COMPLEX = 8, // array of FICOMPLEX : 2 x 64-bit IEEE floating point - FIT_RGB16 = 9, // 48-bit RGB image : 3 x 16-bit - FIT_RGBA16 = 10, // 64-bit RGBA image : 4 x 16-bit - FIT_RGBF = 11, // 96-bit RGB float image : 3 x 32-bit IEEE floating point - FIT_RGBAF = 12 // 128-bit RGBA float image : 4 x 32-bit IEEE floating point -}; - -/** Image color type used in FreeImage. -*/ -FI_ENUM(FREE_IMAGE_COLOR_TYPE) { - FIC_MINISWHITE = 0, // min value is white - FIC_MINISBLACK = 1, // min value is black - FIC_RGB = 2, // RGB color model - FIC_PALETTE = 3, // color map indexed - FIC_RGBALPHA = 4, // RGB color model with alpha channel - FIC_CMYK = 5 // CMYK color model -}; - -/** Color quantization algorithms. -Constants used in FreeImage_ColorQuantize. -*/ -FI_ENUM(FREE_IMAGE_QUANTIZE) { - FIQ_WUQUANT = 0, // Xiaolin Wu color quantization algorithm - FIQ_NNQUANT = 1 // NeuQuant neural-net quantization algorithm by Anthony Dekker -}; - -/** Dithering algorithms. -Constants used in FreeImage_Dither. -*/ -FI_ENUM(FREE_IMAGE_DITHER) { - FID_FS = 0, // Floyd & Steinberg error diffusion - FID_BAYER4x4 = 1, // Bayer ordered dispersed dot dithering (order 2 dithering matrix) - FID_BAYER8x8 = 2, // Bayer ordered dispersed dot dithering (order 3 dithering matrix) - FID_CLUSTER6x6 = 3, // Ordered clustered dot dithering (order 3 - 6x6 matrix) - FID_CLUSTER8x8 = 4, // Ordered clustered dot dithering (order 4 - 8x8 matrix) - FID_CLUSTER16x16= 5, // Ordered clustered dot dithering (order 8 - 16x16 matrix) - FID_BAYER16x16 = 6 // Bayer ordered dispersed dot dithering (order 4 dithering matrix) -}; - -/** Lossless JPEG transformations -Constants used in FreeImage_JPEGTransform -*/ -FI_ENUM(FREE_IMAGE_JPEG_OPERATION) { - FIJPEG_OP_NONE = 0, // no transformation - FIJPEG_OP_FLIP_H = 1, // horizontal flip - FIJPEG_OP_FLIP_V = 2, // vertical flip - FIJPEG_OP_TRANSPOSE = 3, // transpose across UL-to-LR axis - FIJPEG_OP_TRANSVERSE = 4, // transpose across UR-to-LL axis - FIJPEG_OP_ROTATE_90 = 5, // 90-degree clockwise rotation - FIJPEG_OP_ROTATE_180 = 6, // 180-degree rotation - FIJPEG_OP_ROTATE_270 = 7 // 270-degree clockwise (or 90 ccw) -}; - -/** Tone mapping operators. -Constants used in FreeImage_ToneMapping. -*/ -FI_ENUM(FREE_IMAGE_TMO) { - FITMO_DRAGO03 = 0, // Adaptive logarithmic mapping (F. Drago, 2003) - FITMO_REINHARD05 = 1, // Dynamic range reduction inspired by photoreceptor physiology (E. Reinhard, 2005) - FITMO_FATTAL02 = 2 // Gradient domain high dynamic range compression (R. Fattal, 2002) -}; - -/** Upsampling / downsampling filters. -Constants used in FreeImage_Rescale. -*/ -FI_ENUM(FREE_IMAGE_FILTER) { - FILTER_BOX = 0, // Box, pulse, Fourier window, 1st order (constant) b-spline - FILTER_BICUBIC = 1, // Mitchell & Netravali's two-param cubic filter - FILTER_BILINEAR = 2, // Bilinear filter - FILTER_BSPLINE = 3, // 4th order (cubic) b-spline - FILTER_CATMULLROM = 4, // Catmull-Rom spline, Overhauser spline - FILTER_LANCZOS3 = 5 // Lanczos3 filter -}; - -/** Color channels. -Constants used in color manipulation routines. -*/ -FI_ENUM(FREE_IMAGE_COLOR_CHANNEL) { - FICC_RGB = 0, // Use red, green and blue channels - FICC_RED = 1, // Use red channel - FICC_GREEN = 2, // Use green channel - FICC_BLUE = 3, // Use blue channel - FICC_ALPHA = 4, // Use alpha channel - FICC_BLACK = 5, // Use black channel - FICC_REAL = 6, // Complex images: use real part - FICC_IMAG = 7, // Complex images: use imaginary part - FICC_MAG = 8, // Complex images: use magnitude - FICC_PHASE = 9 // Complex images: use phase -}; - -// Metadata support --------------------------------------------------------- - -/** - Tag data type information (based on TIFF specifications) - - Note: RATIONALs are the ratio of two 32-bit integer values. -*/ -FI_ENUM(FREE_IMAGE_MDTYPE) { - FIDT_NOTYPE = 0, // placeholder - FIDT_BYTE = 1, // 8-bit unsigned integer - FIDT_ASCII = 2, // 8-bit bytes w/ last byte null - FIDT_SHORT = 3, // 16-bit unsigned integer - FIDT_LONG = 4, // 32-bit unsigned integer - FIDT_RATIONAL = 5, // 64-bit unsigned fraction - FIDT_SBYTE = 6, // 8-bit signed integer - FIDT_UNDEFINED = 7, // 8-bit untyped data - FIDT_SSHORT = 8, // 16-bit signed integer - FIDT_SLONG = 9, // 32-bit signed integer - FIDT_SRATIONAL = 10, // 64-bit signed fraction - FIDT_FLOAT = 11, // 32-bit IEEE floating point - FIDT_DOUBLE = 12, // 64-bit IEEE floating point - FIDT_IFD = 13, // 32-bit unsigned integer (offset) - FIDT_PALETTE = 14 // 32-bit RGBQUAD -}; - -/** - Metadata models supported by FreeImage -*/ -FI_ENUM(FREE_IMAGE_MDMODEL) { - FIMD_NODATA = -1, - FIMD_COMMENTS = 0, // single comment or keywords - FIMD_EXIF_MAIN = 1, // Exif-TIFF metadata - FIMD_EXIF_EXIF = 2, // Exif-specific metadata - FIMD_EXIF_GPS = 3, // Exif GPS metadata - FIMD_EXIF_MAKERNOTE = 4, // Exif maker note metadata - FIMD_EXIF_INTEROP = 5, // Exif interoperability metadata - FIMD_IPTC = 6, // IPTC/NAA metadata - FIMD_XMP = 7, // Abobe XMP metadata - FIMD_GEOTIFF = 8, // GeoTIFF metadata - FIMD_ANIMATION = 9, // Animation metadata - FIMD_CUSTOM = 10 // Used to attach other metadata types to a dib -}; - -/** - Handle to a metadata model -*/ -FI_STRUCT (FIMETADATA) { void *data; }; - -/** - Handle to a FreeImage tag -*/ -FI_STRUCT (FITAG) { void *data; }; - -// File IO routines --------------------------------------------------------- - -#ifndef FREEIMAGE_IO -#define FREEIMAGE_IO - -typedef void* fi_handle; -typedef unsigned (DLL_CALLCONV *FI_ReadProc) (void *buffer, unsigned size, unsigned count, fi_handle handle); -typedef unsigned (DLL_CALLCONV *FI_WriteProc) (void *buffer, unsigned size, unsigned count, fi_handle handle); -typedef int (DLL_CALLCONV *FI_SeekProc) (fi_handle handle, long offset, int origin); -typedef long (DLL_CALLCONV *FI_TellProc) (fi_handle handle); - -#if (defined(_WIN32) || defined(__WIN32__)) -#pragma pack(push, 1) -#else -#pragma pack(1) -#endif // WIN32 - -FI_STRUCT(FreeImageIO) { - FI_ReadProc read_proc; // pointer to the function used to read data - FI_WriteProc write_proc; // pointer to the function used to write data - FI_SeekProc seek_proc; // pointer to the function used to seek - FI_TellProc tell_proc; // pointer to the function used to aquire the current position -}; - -#if (defined(_WIN32) || defined(__WIN32__)) -#pragma pack(pop) -#else -#pragma pack() -#endif // WIN32 - -/** -Handle to a memory I/O stream -*/ -FI_STRUCT (FIMEMORY) { void *data; }; - -#endif // FREEIMAGE_IO - -// Plugin routines ---------------------------------------------------------- - -#ifndef PLUGINS -#define PLUGINS - -typedef const char *(DLL_CALLCONV *FI_FormatProc) (); -typedef const char *(DLL_CALLCONV *FI_DescriptionProc) (); -typedef const char *(DLL_CALLCONV *FI_ExtensionListProc) (); -typedef const char *(DLL_CALLCONV *FI_RegExprProc) (); -typedef void *(DLL_CALLCONV *FI_OpenProc)(FreeImageIO *io, fi_handle handle, BOOL read); -typedef void (DLL_CALLCONV *FI_CloseProc)(FreeImageIO *io, fi_handle handle, void *data); -typedef int (DLL_CALLCONV *FI_PageCountProc)(FreeImageIO *io, fi_handle handle, void *data); -typedef int (DLL_CALLCONV *FI_PageCapabilityProc)(FreeImageIO *io, fi_handle handle, void *data); -typedef FIBITMAP *(DLL_CALLCONV *FI_LoadProc)(FreeImageIO *io, fi_handle handle, int page, int flags, void *data); -typedef BOOL (DLL_CALLCONV *FI_SaveProc)(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void *data); -typedef BOOL (DLL_CALLCONV *FI_ValidateProc)(FreeImageIO *io, fi_handle handle); -typedef const char *(DLL_CALLCONV *FI_MimeProc) (); -typedef BOOL (DLL_CALLCONV *FI_SupportsExportBPPProc)(int bpp); -typedef BOOL (DLL_CALLCONV *FI_SupportsExportTypeProc)(FREE_IMAGE_TYPE type); -typedef BOOL (DLL_CALLCONV *FI_SupportsICCProfilesProc)(); - -FI_STRUCT (Plugin) { - FI_FormatProc format_proc; - FI_DescriptionProc description_proc; - FI_ExtensionListProc extension_proc; - FI_RegExprProc regexpr_proc; - FI_OpenProc open_proc; - FI_CloseProc close_proc; - FI_PageCountProc pagecount_proc; - FI_PageCapabilityProc pagecapability_proc; - FI_LoadProc load_proc; - FI_SaveProc save_proc; - FI_ValidateProc validate_proc; - FI_MimeProc mime_proc; - FI_SupportsExportBPPProc supports_export_bpp_proc; - FI_SupportsExportTypeProc supports_export_type_proc; - FI_SupportsICCProfilesProc supports_icc_profiles_proc; -}; - -typedef void (DLL_CALLCONV *FI_InitProc)(Plugin *plugin, int format_id); - -#endif // PLUGINS - - -// Load / Save flag constants ----------------------------------------------- - -#define BMP_DEFAULT 0 -#define BMP_SAVE_RLE 1 -#define CUT_DEFAULT 0 -#define DDS_DEFAULT 0 -#define EXR_DEFAULT 0 // save data as half with piz-based wavelet compression -#define EXR_FLOAT 0x0001 // save data as float instead of as half (not recommended) -#define EXR_NONE 0x0002 // save with no compression -#define EXR_ZIP 0x0004 // save with zlib compression, in blocks of 16 scan lines -#define EXR_PIZ 0x0008 // save with piz-based wavelet compression -#define EXR_PXR24 0x0010 // save with lossy 24-bit float compression -#define EXR_B44 0x0020 // save with lossy 44% float compression - goes to 22% when combined with EXR_LC -#define EXR_LC 0x0040 // save images with one luminance and two chroma channels, rather than as RGB (lossy compression) -#define FAXG3_DEFAULT 0 -#define GIF_DEFAULT 0 -#define GIF_LOAD256 1 // Load the image as a 256 color image with ununsed palette entries, if it's 16 or 2 color -#define GIF_PLAYBACK 2 // 'Play' the GIF to generate each frame (as 32bpp) instead of returning raw frame data when loading -#define HDR_DEFAULT 0 -#define ICO_DEFAULT 0 -#define ICO_MAKEALPHA 1 // convert to 32bpp and create an alpha channel from the AND-mask when loading -#define IFF_DEFAULT 0 -#define J2K_DEFAULT 0 // save with a 16:1 rate -#define JP2_DEFAULT 0 // save with a 16:1 rate -#define JPEG_DEFAULT 0 // loading (see JPEG_FAST); saving (see JPEG_QUALITYGOOD) -#define JPEG_FAST 0x0001 // load the file as fast as possible, sacrificing some quality -#define JPEG_ACCURATE 0x0002 // load the file with the best quality, sacrificing some speed -#define JPEG_CMYK 0x0004 // load separated CMYK "as is" (use | to combine with other load flags) -#define JPEG_QUALITYSUPERB 0x80 // save with superb quality (100:1) -#define JPEG_QUALITYGOOD 0x0100 // save with good quality (75:1) -#define JPEG_QUALITYNORMAL 0x0200 // save with normal quality (50:1) -#define JPEG_QUALITYAVERAGE 0x0400 // save with average quality (25:1) -#define JPEG_QUALITYBAD 0x0800 // save with bad quality (10:1) -#define JPEG_PROGRESSIVE 0x2000 // save as a progressive-JPEG (use | to combine with other save flags) -#define KOALA_DEFAULT 0 -#define LBM_DEFAULT 0 -#define MNG_DEFAULT 0 -#define PCD_DEFAULT 0 -#define PCD_BASE 1 // load the bitmap sized 768 x 512 -#define PCD_BASEDIV4 2 // load the bitmap sized 384 x 256 -#define PCD_BASEDIV16 3 // load the bitmap sized 192 x 128 -#define PCX_DEFAULT 0 -#define PNG_DEFAULT 0 -#define PNG_IGNOREGAMMA 1 // avoid gamma correction -#define PNM_DEFAULT 0 -#define PNM_SAVE_RAW 0 // If set the writer saves in RAW format (i.e. P4, P5 or P6) -#define PNM_SAVE_ASCII 1 // If set the writer saves in ASCII format (i.e. P1, P2 or P3) -#define PSD_DEFAULT 0 -#define RAS_DEFAULT 0 -#define SGI_DEFAULT 0 -#define TARGA_DEFAULT 0 -#define TARGA_LOAD_RGB888 1 // If set the loader converts RGB555 and ARGB8888 -> RGB888. -#define TIFF_DEFAULT 0 -#define TIFF_CMYK 0x0001 // reads/stores tags for separated CMYK (use | to combine with compression flags) -#define TIFF_PACKBITS 0x0100 // save using PACKBITS compression -#define TIFF_DEFLATE 0x0200 // save using DEFLATE compression (a.k.a. ZLIB compression) -#define TIFF_ADOBE_DEFLATE 0x0400 // save using ADOBE DEFLATE compression -#define TIFF_NONE 0x0800 // save without any compression -#define TIFF_CCITTFAX3 0x1000 // save using CCITT Group 3 fax encoding -#define TIFF_CCITTFAX4 0x2000 // save using CCITT Group 4 fax encoding -#define TIFF_LZW 0x4000 // save using LZW compression -#define TIFF_JPEG 0x8000 // save using JPEG compression -#define WBMP_DEFAULT 0 -#define XBM_DEFAULT 0 -#define XPM_DEFAULT 0 - - -#ifdef __cplusplus -extern "C" { -#endif - -// Init / Error routines ---------------------------------------------------- - -DLL_API void DLL_CALLCONV FreeImage_Initialise(BOOL load_local_plugins_only FI_DEFAULT(FALSE)); -DLL_API void DLL_CALLCONV FreeImage_DeInitialise(void); - -// Version routines --------------------------------------------------------- - -DLL_API const char *DLL_CALLCONV FreeImage_GetVersion(void); -DLL_API const char *DLL_CALLCONV FreeImage_GetCopyrightMessage(void); - -// Message output functions ------------------------------------------------- - -typedef void (*FreeImage_OutputMessageFunction)(FREE_IMAGE_FORMAT fif, const char *msg); -typedef void (DLL_CALLCONV *FreeImage_OutputMessageFunctionStdCall)(FREE_IMAGE_FORMAT fif, const char *msg); - -DLL_API void DLL_CALLCONV FreeImage_SetOutputMessageStdCall(FreeImage_OutputMessageFunctionStdCall omf); -DLL_API void DLL_CALLCONV FreeImage_SetOutputMessage(FreeImage_OutputMessageFunction omf); -DLL_API void DLL_CALLCONV FreeImage_OutputMessageProc(int fif, const char *fmt, ...); - -// Allocate / Clone / Unload routines --------------------------------------- - -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Allocate(int width, int height, int bpp, unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_AllocateT(FREE_IMAGE_TYPE type, int width, int height, int bpp FI_DEFAULT(8), unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0)); -DLL_API FIBITMAP * DLL_CALLCONV FreeImage_Clone(FIBITMAP *dib); -DLL_API void DLL_CALLCONV FreeImage_Unload(FIBITMAP *dib); - -// Load / Save routines ----------------------------------------------------- - -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Load(FREE_IMAGE_FORMAT fif, const char *filename, int flags FI_DEFAULT(0)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadU(FREE_IMAGE_FORMAT fif, const wchar_t *filename, int flags FI_DEFAULT(0)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadFromHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0)); -DLL_API BOOL DLL_CALLCONV FreeImage_Save(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, const char *filename, int flags FI_DEFAULT(0)); -DLL_API BOOL DLL_CALLCONV FreeImage_SaveU(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, const wchar_t *filename, int flags FI_DEFAULT(0)); -DLL_API BOOL DLL_CALLCONV FreeImage_SaveToHandle(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0)); - -// Memory I/O stream routines ----------------------------------------------- - -DLL_API FIMEMORY *DLL_CALLCONV FreeImage_OpenMemory(BYTE *data FI_DEFAULT(0), DWORD size_in_bytes FI_DEFAULT(0)); -DLL_API void DLL_CALLCONV FreeImage_CloseMemory(FIMEMORY *stream); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY *stream, int flags FI_DEFAULT(0)); -DLL_API BOOL DLL_CALLCONV FreeImage_SaveToMemory(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, FIMEMORY *stream, int flags FI_DEFAULT(0)); -DLL_API long DLL_CALLCONV FreeImage_TellMemory(FIMEMORY *stream); -DLL_API BOOL DLL_CALLCONV FreeImage_SeekMemory(FIMEMORY *stream, long offset, int origin); -DLL_API BOOL DLL_CALLCONV FreeImage_AcquireMemory(FIMEMORY *stream, BYTE **data, DWORD *size_in_bytes); -DLL_API unsigned DLL_CALLCONV FreeImage_ReadMemory(void *buffer, unsigned size, unsigned count, FIMEMORY *stream); -DLL_API unsigned DLL_CALLCONV FreeImage_WriteMemory(const void *buffer, unsigned size, unsigned count, FIMEMORY *stream); -DLL_API FIMULTIBITMAP *DLL_CALLCONV FreeImage_LoadMultiBitmapFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY *stream, int flags FI_DEFAULT(0)); - -// Plugin Interface --------------------------------------------------------- - -DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_RegisterLocalPlugin(FI_InitProc proc_address, const char *format FI_DEFAULT(0), const char *description FI_DEFAULT(0), const char *extension FI_DEFAULT(0), const char *regexpr FI_DEFAULT(0)); -DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_RegisterExternalPlugin(const char *path, const char *format FI_DEFAULT(0), const char *description FI_DEFAULT(0), const char *extension FI_DEFAULT(0), const char *regexpr FI_DEFAULT(0)); -DLL_API int DLL_CALLCONV FreeImage_GetFIFCount(void); -DLL_API int DLL_CALLCONV FreeImage_SetPluginEnabled(FREE_IMAGE_FORMAT fif, BOOL enable); -DLL_API int DLL_CALLCONV FreeImage_IsPluginEnabled(FREE_IMAGE_FORMAT fif); -DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFormat(const char *format); -DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromMime(const char *mime); -DLL_API const char *DLL_CALLCONV FreeImage_GetFormatFromFIF(FREE_IMAGE_FORMAT fif); -DLL_API const char *DLL_CALLCONV FreeImage_GetFIFExtensionList(FREE_IMAGE_FORMAT fif); -DLL_API const char *DLL_CALLCONV FreeImage_GetFIFDescription(FREE_IMAGE_FORMAT fif); -DLL_API const char *DLL_CALLCONV FreeImage_GetFIFRegExpr(FREE_IMAGE_FORMAT fif); -DLL_API const char *DLL_CALLCONV FreeImage_GetFIFMimeType(FREE_IMAGE_FORMAT fif); -DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFilename(const char *filename); -DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFilenameU(const wchar_t *filename); -DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsReading(FREE_IMAGE_FORMAT fif); -DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsWriting(FREE_IMAGE_FORMAT fif); -DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsExportBPP(FREE_IMAGE_FORMAT fif, int bpp); -DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsExportType(FREE_IMAGE_FORMAT fif, FREE_IMAGE_TYPE type); -DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsICCProfiles(FREE_IMAGE_FORMAT fif); - -// Multipaging interface ---------------------------------------------------- - -DLL_API FIMULTIBITMAP * DLL_CALLCONV FreeImage_OpenMultiBitmap(FREE_IMAGE_FORMAT fif, const char *filename, BOOL create_new, BOOL read_only, BOOL keep_cache_in_memory FI_DEFAULT(FALSE), int flags FI_DEFAULT(0)); -DLL_API BOOL DLL_CALLCONV FreeImage_CloseMultiBitmap(FIMULTIBITMAP *bitmap, int flags FI_DEFAULT(0)); -DLL_API int DLL_CALLCONV FreeImage_GetPageCount(FIMULTIBITMAP *bitmap); -DLL_API void DLL_CALLCONV FreeImage_AppendPage(FIMULTIBITMAP *bitmap, FIBITMAP *data); -DLL_API void DLL_CALLCONV FreeImage_InsertPage(FIMULTIBITMAP *bitmap, int page, FIBITMAP *data); -DLL_API void DLL_CALLCONV FreeImage_DeletePage(FIMULTIBITMAP *bitmap, int page); -DLL_API FIBITMAP * DLL_CALLCONV FreeImage_LockPage(FIMULTIBITMAP *bitmap, int page); -DLL_API void DLL_CALLCONV FreeImage_UnlockPage(FIMULTIBITMAP *bitmap, FIBITMAP *data, BOOL changed); -DLL_API BOOL DLL_CALLCONV FreeImage_MovePage(FIMULTIBITMAP *bitmap, int target, int source); -DLL_API BOOL DLL_CALLCONV FreeImage_GetLockedPageNumbers(FIMULTIBITMAP *bitmap, int *pages, int *count); - -// Filetype request routines ------------------------------------------------ - -DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileType(const char *filename, int size FI_DEFAULT(0)); -DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeU(const wchar_t *filename, int size FI_DEFAULT(0)); -DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeFromHandle(FreeImageIO *io, fi_handle handle, int size FI_DEFAULT(0)); -DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeFromMemory(FIMEMORY *stream, int size FI_DEFAULT(0)); - -// Image type request routine ----------------------------------------------- - -DLL_API FREE_IMAGE_TYPE DLL_CALLCONV FreeImage_GetImageType(FIBITMAP *dib); - -// FreeImage helper routines ------------------------------------------------ - -DLL_API BOOL DLL_CALLCONV FreeImage_IsLittleEndian(void); -DLL_API BOOL DLL_CALLCONV FreeImage_LookupX11Color(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nBlue); -DLL_API BOOL DLL_CALLCONV FreeImage_LookupSVGColor(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nBlue); - - -// Pixel access routines ---------------------------------------------------- - -DLL_API BYTE *DLL_CALLCONV FreeImage_GetBits(FIBITMAP *dib); -DLL_API BYTE *DLL_CALLCONV FreeImage_GetScanLine(FIBITMAP *dib, int scanline); - -DLL_API BOOL DLL_CALLCONV FreeImage_GetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value); -DLL_API BOOL DLL_CALLCONV FreeImage_GetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value); -DLL_API BOOL DLL_CALLCONV FreeImage_SetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value); -DLL_API BOOL DLL_CALLCONV FreeImage_SetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value); - -// DIB info routines -------------------------------------------------------- - -DLL_API unsigned DLL_CALLCONV FreeImage_GetColorsUsed(FIBITMAP *dib); -DLL_API unsigned DLL_CALLCONV FreeImage_GetBPP(FIBITMAP *dib); -DLL_API unsigned DLL_CALLCONV FreeImage_GetWidth(FIBITMAP *dib); -DLL_API unsigned DLL_CALLCONV FreeImage_GetHeight(FIBITMAP *dib); -DLL_API unsigned DLL_CALLCONV FreeImage_GetLine(FIBITMAP *dib); -DLL_API unsigned DLL_CALLCONV FreeImage_GetPitch(FIBITMAP *dib); -DLL_API unsigned DLL_CALLCONV FreeImage_GetDIBSize(FIBITMAP *dib); -DLL_API RGBQUAD *DLL_CALLCONV FreeImage_GetPalette(FIBITMAP *dib); - -DLL_API unsigned DLL_CALLCONV FreeImage_GetDotsPerMeterX(FIBITMAP *dib); -DLL_API unsigned DLL_CALLCONV FreeImage_GetDotsPerMeterY(FIBITMAP *dib); -DLL_API void DLL_CALLCONV FreeImage_SetDotsPerMeterX(FIBITMAP *dib, unsigned res); -DLL_API void DLL_CALLCONV FreeImage_SetDotsPerMeterY(FIBITMAP *dib, unsigned res); - -DLL_API BITMAPINFOHEADER *DLL_CALLCONV FreeImage_GetInfoHeader(FIBITMAP *dib); -DLL_API BITMAPINFO *DLL_CALLCONV FreeImage_GetInfo(FIBITMAP *dib); -DLL_API FREE_IMAGE_COLOR_TYPE DLL_CALLCONV FreeImage_GetColorType(FIBITMAP *dib); - -DLL_API unsigned DLL_CALLCONV FreeImage_GetRedMask(FIBITMAP *dib); -DLL_API unsigned DLL_CALLCONV FreeImage_GetGreenMask(FIBITMAP *dib); -DLL_API unsigned DLL_CALLCONV FreeImage_GetBlueMask(FIBITMAP *dib); - -DLL_API unsigned DLL_CALLCONV FreeImage_GetTransparencyCount(FIBITMAP *dib); -DLL_API BYTE * DLL_CALLCONV FreeImage_GetTransparencyTable(FIBITMAP *dib); -DLL_API void DLL_CALLCONV FreeImage_SetTransparent(FIBITMAP *dib, BOOL enabled); -DLL_API void DLL_CALLCONV FreeImage_SetTransparencyTable(FIBITMAP *dib, BYTE *table, int count); -DLL_API BOOL DLL_CALLCONV FreeImage_IsTransparent(FIBITMAP *dib); -DLL_API void DLL_CALLCONV FreeImage_SetTransparentIndex(FIBITMAP *dib, int index); -DLL_API int DLL_CALLCONV FreeImage_GetTransparentIndex(FIBITMAP *dib); - -DLL_API BOOL DLL_CALLCONV FreeImage_HasBackgroundColor(FIBITMAP *dib); -DLL_API BOOL DLL_CALLCONV FreeImage_GetBackgroundColor(FIBITMAP *dib, RGBQUAD *bkcolor); -DLL_API BOOL DLL_CALLCONV FreeImage_SetBackgroundColor(FIBITMAP *dib, RGBQUAD *bkcolor); - - -// ICC profile routines ----------------------------------------------------- - -DLL_API FIICCPROFILE *DLL_CALLCONV FreeImage_GetICCProfile(FIBITMAP *dib); -DLL_API FIICCPROFILE *DLL_CALLCONV FreeImage_CreateICCProfile(FIBITMAP *dib, void *data, long size); -DLL_API void DLL_CALLCONV FreeImage_DestroyICCProfile(FIBITMAP *dib); - -// Line conversion routines ------------------------------------------------- - -DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To4(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To4(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To4_555(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To4_565(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To4(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To4(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To8(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To8(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To8_555(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To8_565(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To8(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To8(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16_565_To16_555(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To16_555(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To16_555(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16_555_To16_565(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To16_565(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To16_565(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To24_555(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To24_565(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To24(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To32_555(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To32_565(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To32(BYTE *target, BYTE *source, int width_in_pixels); - -// Smart conversion routines ------------------------------------------------ - -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo4Bits(FIBITMAP *dib); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo8Bits(FIBITMAP *dib); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToGreyscale(FIBITMAP *dib); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo16Bits555(FIBITMAP *dib); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo16Bits565(FIBITMAP *dib); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo24Bits(FIBITMAP *dib); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo32Bits(FIBITMAP *dib); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ColorQuantize(FIBITMAP *dib, FREE_IMAGE_QUANTIZE quantize); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ColorQuantizeEx(FIBITMAP *dib, FREE_IMAGE_QUANTIZE quantize FI_DEFAULT(FIQ_WUQUANT), int PaletteSize FI_DEFAULT(256), int ReserveSize FI_DEFAULT(0), RGBQUAD *ReservePalette FI_DEFAULT(NULL)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Threshold(FIBITMAP *dib, BYTE T); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Dither(FIBITMAP *dib, FREE_IMAGE_DITHER algorithm); - -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertFromRawBits(BYTE *bits, int width, int height, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown FI_DEFAULT(FALSE)); -DLL_API void DLL_CALLCONV FreeImage_ConvertToRawBits(BYTE *bits, FIBITMAP *dib, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown FI_DEFAULT(FALSE)); - -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToRGBF(FIBITMAP *dib); - -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToStandardType(FIBITMAP *src, BOOL scale_linear FI_DEFAULT(TRUE)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToType(FIBITMAP *src, FREE_IMAGE_TYPE dst_type, BOOL scale_linear FI_DEFAULT(TRUE)); - -// tone mapping operators -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ToneMapping(FIBITMAP *dib, FREE_IMAGE_TMO tmo, double first_param FI_DEFAULT(0), double second_param FI_DEFAULT(0)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoDrago03(FIBITMAP *src, double gamma FI_DEFAULT(2.2), double exposure FI_DEFAULT(0)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoReinhard05(FIBITMAP *src, double intensity FI_DEFAULT(0), double contrast FI_DEFAULT(0)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoFattal02(FIBITMAP *src, double color_saturation FI_DEFAULT(0.5), double attenuation FI_DEFAULT(0.85)); - -// ZLib interface ----------------------------------------------------------- - -DLL_API DWORD DLL_CALLCONV FreeImage_ZLibCompress(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size); -DLL_API DWORD DLL_CALLCONV FreeImage_ZLibUncompress(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size); -DLL_API DWORD DLL_CALLCONV FreeImage_ZLibGZip(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size); -DLL_API DWORD DLL_CALLCONV FreeImage_ZLibGUnzip(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size); -DLL_API DWORD DLL_CALLCONV FreeImage_ZLibCRC32(DWORD crc, BYTE *source, DWORD source_size); - -// -------------------------------------------------------------------------- -// Metadata routines -------------------------------------------------------- -// -------------------------------------------------------------------------- - -// tag creation / destruction -DLL_API FITAG *DLL_CALLCONV FreeImage_CreateTag(); -DLL_API void DLL_CALLCONV FreeImage_DeleteTag(FITAG *tag); -DLL_API FITAG *DLL_CALLCONV FreeImage_CloneTag(FITAG *tag); - -// tag getters and setters -DLL_API const char *DLL_CALLCONV FreeImage_GetTagKey(FITAG *tag); -DLL_API const char *DLL_CALLCONV FreeImage_GetTagDescription(FITAG *tag); -DLL_API WORD DLL_CALLCONV FreeImage_GetTagID(FITAG *tag); -DLL_API FREE_IMAGE_MDTYPE DLL_CALLCONV FreeImage_GetTagType(FITAG *tag); -DLL_API DWORD DLL_CALLCONV FreeImage_GetTagCount(FITAG *tag); -DLL_API DWORD DLL_CALLCONV FreeImage_GetTagLength(FITAG *tag); -DLL_API const void *DLL_CALLCONV FreeImage_GetTagValue(FITAG *tag); - -DLL_API BOOL DLL_CALLCONV FreeImage_SetTagKey(FITAG *tag, const char *key); -DLL_API BOOL DLL_CALLCONV FreeImage_SetTagDescription(FITAG *tag, const char *description); -DLL_API BOOL DLL_CALLCONV FreeImage_SetTagID(FITAG *tag, WORD id); -DLL_API BOOL DLL_CALLCONV FreeImage_SetTagType(FITAG *tag, FREE_IMAGE_MDTYPE type); -DLL_API BOOL DLL_CALLCONV FreeImage_SetTagCount(FITAG *tag, DWORD count); -DLL_API BOOL DLL_CALLCONV FreeImage_SetTagLength(FITAG *tag, DWORD length); -DLL_API BOOL DLL_CALLCONV FreeImage_SetTagValue(FITAG *tag, const void *value); - -// iterator -DLL_API FIMETADATA *DLL_CALLCONV FreeImage_FindFirstMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, FITAG **tag); -DLL_API BOOL DLL_CALLCONV FreeImage_FindNextMetadata(FIMETADATA *mdhandle, FITAG **tag); -DLL_API void DLL_CALLCONV FreeImage_FindCloseMetadata(FIMETADATA *mdhandle); - -// metadata setter and getter -DLL_API BOOL DLL_CALLCONV FreeImage_SetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, FITAG *tag); -DLL_API BOOL DLL_CALLCONV FreeImage_GetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, FITAG **tag); - -// helpers -DLL_API unsigned DLL_CALLCONV FreeImage_GetMetadataCount(FREE_IMAGE_MDMODEL model, FIBITMAP *dib); - -// tag to C string conversion -DLL_API const char* DLL_CALLCONV FreeImage_TagToString(FREE_IMAGE_MDMODEL model, FITAG *tag, char *Make FI_DEFAULT(NULL)); - -// -------------------------------------------------------------------------- -// Image manipulation toolkit ----------------------------------------------- -// -------------------------------------------------------------------------- - -// rotation and flipping -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_RotateClassic(FIBITMAP *dib, double angle); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_RotateEx(FIBITMAP *dib, double angle, double x_shift, double y_shift, double x_origin, double y_origin, BOOL use_mask); -DLL_API BOOL DLL_CALLCONV FreeImage_FlipHorizontal(FIBITMAP *dib); -DLL_API BOOL DLL_CALLCONV FreeImage_FlipVertical(FIBITMAP *dib); -DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransform(const char *src_file, const char *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(FALSE)); - -// upsampling / downsampling -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Rescale(FIBITMAP *dib, int dst_width, int dst_height, FREE_IMAGE_FILTER filter); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_MakeThumbnail(FIBITMAP *dib, int max_pixel_size, BOOL convert FI_DEFAULT(TRUE)); - -// color manipulation routines (point operations) -DLL_API BOOL DLL_CALLCONV FreeImage_AdjustCurve(FIBITMAP *dib, BYTE *LUT, FREE_IMAGE_COLOR_CHANNEL channel); -DLL_API BOOL DLL_CALLCONV FreeImage_AdjustGamma(FIBITMAP *dib, double gamma); -DLL_API BOOL DLL_CALLCONV FreeImage_AdjustBrightness(FIBITMAP *dib, double percentage); -DLL_API BOOL DLL_CALLCONV FreeImage_AdjustContrast(FIBITMAP *dib, double percentage); -DLL_API BOOL DLL_CALLCONV FreeImage_Invert(FIBITMAP *dib); -DLL_API BOOL DLL_CALLCONV FreeImage_GetHistogram(FIBITMAP *dib, DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel FI_DEFAULT(FICC_BLACK)); -DLL_API int DLL_CALLCONV FreeImage_GetAdjustColorsLookupTable(BYTE *LUT, double brightness, double contrast, double gamma, BOOL invert); -DLL_API BOOL DLL_CALLCONV FreeImage_AdjustColors(FIBITMAP *dib, double brightness, double contrast, double gamma, BOOL invert FI_DEFAULT(FALSE)); -DLL_API unsigned DLL_CALLCONV FreeImage_ApplyColorMapping(FIBITMAP *dib, RGBQUAD *srccolors, RGBQUAD *dstcolors, unsigned count, BOOL ignore_alpha, BOOL swap); -DLL_API unsigned DLL_CALLCONV FreeImage_SwapColors(FIBITMAP *dib, RGBQUAD *color_a, RGBQUAD *color_b, BOOL ignore_alpha); -DLL_API unsigned DLL_CALLCONV FreeImage_ApplyPaletteIndexMapping(FIBITMAP *dib, BYTE *srcindices, BYTE *dstindices, unsigned count, BOOL swap); -DLL_API unsigned DLL_CALLCONV FreeImage_SwapPaletteIndices(FIBITMAP *dib, BYTE *index_a, BYTE *index_b); - -// channel processing routines -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_GetChannel(FIBITMAP *dib, FREE_IMAGE_COLOR_CHANNEL channel); -DLL_API BOOL DLL_CALLCONV FreeImage_SetChannel(FIBITMAP *dib, FIBITMAP *dib8, FREE_IMAGE_COLOR_CHANNEL channel); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_GetComplexChannel(FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel); -DLL_API BOOL DLL_CALLCONV FreeImage_SetComplexChannel(FIBITMAP *dst, FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel); - -// copy / paste / composite routines -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Copy(FIBITMAP *dib, int left, int top, int right, int bottom); -DLL_API BOOL DLL_CALLCONV FreeImage_Paste(FIBITMAP *dst, FIBITMAP *src, int left, int top, int alpha); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Composite(FIBITMAP *fg, BOOL useFileBkg FI_DEFAULT(FALSE), RGBQUAD *appBkColor FI_DEFAULT(NULL), FIBITMAP *bg FI_DEFAULT(NULL)); -DLL_API BOOL DLL_CALLCONV FreeImage_JPEGCrop(const char *src_file, const char *dst_file, int left, int top, int right, int bottom); -DLL_API BOOL DLL_CALLCONV FreeImage_PreMultiplyWithAlpha(FIBITMAP *dib); - -// miscellaneous algorithms -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_MultigridPoissonSolver(FIBITMAP *Laplacian, int ncycle FI_DEFAULT(3)); - -// restore the borland-specific enum size option -#if defined(__BORLANDC__) -#pragma option pop -#endif - -#ifdef __cplusplus -} -#endif - -#endif // FREEIMAGE_H diff --git a/extern/FreeImage/FreeImage.lib b/extern/FreeImage/FreeImage.lib deleted file mode 100644 index 7e6e825..0000000 Binary files a/extern/FreeImage/FreeImage.lib and /dev/null differ diff --git a/extern/FreeImage/Whatsnew.txt b/extern/FreeImage/Whatsnew.txt deleted file mode 100644 index aaddffb..0000000 --- a/extern/FreeImage/Whatsnew.txt +++ /dev/null @@ -1,898 +0,0 @@ -What's New for FreeImage - -* : fixed -- : removed -! : changed -+ : added - -November 19th, 2007 - 3.10.0 -! FreeImage now uses libTIFF 3.9.0beta (CVS patch 2007-10-05) -! FreeImage now uses OpenJPEG 1.2.0 (SVN patch 2007-07-13) -! FreeImage now uses OpenEXR 1.6.1 -! FreeImage now uses libPNG 1.2.23 -! FreeImage now hides its internal functions and internal libraries when compiled with gcc -- [Herve Drolon] removed VS C+ 6.0 project files : this IDE is no longer supported because of OpenEXR -+ [Herve Drolon] added VS 2005 project files -+ [Herve Drolon] added full support for the OpenEXR format -+ [Herve Drolon] added full support for the JPEG-2000 format -+ [Herve Drolon] added FreeImage_TmoFattal02 tone mapping operator -+ [Ryan Rubley] added support for RGB vs BGR regardless of endian -+ [Herve Drolon] added FreeImage_MultigridPoissonSolver -+ [Carsten Klein] added FreeImage_PreMultiplyWithAlpha -+ [Carsten Klein] added __stdcall version of FreeImage_OutputMessage -+ [Carsten Klein] added new palette and color manipulation functions (see below) : - added FreeImage_SetTransparentIndex - added FreeImage_GetTransparentIndex - added FreeImage_GetAdjustColorsLookupTable - added FreeImage_AdjustColors - added FreeImage_ApplyColorMapping - added FreeImage_SwapColors - added FreeImage_ApplyPaletteIndexMapping - added FreeImage_SwapPaletteIndices -* [Herve Drolon] fixed a bug in TIFF plugin when reading 8-bit + 8-bit alpha images -* [Herve Drolon] fixed a bug in TIFF plugin when reading images with uncommon bitdepths -* [rodrigo] fixed FreeImage exception handling under gcc (added -fexceptions to gcc compiler flags) -* [Martin Dyring-Andersen] fixed GIF plugin crashing on some corrupted files -* [Herve Drolon] fixed a bug with RLE encoding for 8-bit BMP images -* [Herve Drolon] fixed GPS metadata being skipped when reading metadata in Exif images -* [Herve Drolon] fixed a bug when reading OS/2 BMP images with a negative height -* [Ryan Rubley] fixed a bug with loading of GIFs with large amounts of solid color areas -* [Ryan Rubley] fixed OS X compile error in BitmapAccess.cpp -* [Herve Drolon] fixed a bug in FreeImage_Paste when pasting non-standard image types -* [Herve Drolon] saving 1-bit TIF with the TIFF_CCITTFAX3 flag is now compliant with the TIFF Class F specification -* [Carsten Klein] fixed topdown parameter in FreeImage_ConvertFromRawBits and FreeImage_ConvertToRawBits being handled in reverse -* [Herve Drolon] fixed a bug when reading some RLE-4 encoded BMP data -* [Carsten Klein] conversion from 1-bit to 32-bit now keep possibly present transparency - -February 11th, 2007 - 3.9.3 -! FreeImage now uses libPNG 1.2.16 -! [Ryan Rubley/Ryan Davis] reworked the MacOSX makefile in order to fully support Universal Binary builds of FreeImage -! [Herve Drolon] makefiles are now generated from VS2003 project files instead of VS6 project files -! [Herve Drolon] changed JPEG load/save flag option values -+ [Herve Drolon] added support for RGBAF images to FreeImage_ConvertToRGBF -+ [Herve Drolon] FreeImage_Paste now works with any bitmap type -+ [Herve Drolon] added full support for 64-bit RGBA images to the PNG and TIFF plugins -+ [Jascha Wetzel] added JPEG downsampling feature to PluginJPEG:Load -* [Thomas Chmielewski] fixed a bug in FreeImage_Dither and Bayer dithering, added FID_BAYER16x16 -* [Raphael Gaquer] greatly improved the speed of the GIF encoder -* [Herve Drolon] fixed saving of metadata in the PNG plugin -* [rampelstinskin] fixed transparency table to alpha channel conversion for 4-bit images in FreeImage_ConvertTo32Bits -* [Scott Smith] added missing IPTC tag named "Country/PrimaryLocationCode" -* [Herve Drolon] changed #include by #include in FreeImage.h (needed by Solaris 9) -* [Pierre Arnaud] fixed the use of FreeImage in low memory condition by checking some returned values of the malloc function -* [Pierre Arnaud] fixed TagLib::getTagFieldName not being thread safe - -October 30th, 2006 - 3.9.2 -! FreeImage now uses libTIFF 3.8.2 (with patch 2006-10-13) -+ [Herve Drolon] added full support for 16-bit greyscale and 48-bit RGB to the PNM plugin -+ [Herve Drolon] added IPTC writing support to JPEG & TIFF plugins -+ [Herve Drolon] added new Exif maker note tags -+ [Herve Drolon] added FreeImage_JPEGCrop -+ [Thorsten Radde] added support for 8-bit palettized bitmaps in FreeImage_RotateClassic -+ [Matt Rice] added automatic call to FreeImage_Initialise / FreeImage_DeInitialise when using FreeImage as a .so -+ [Martin Dyring-Andersen] added FreeImage_LoadMultiBitmapFromMemory to the multi-page API -+ [Herve Drolon] added support for tiled TIFF images -* [Carsten Klein] fixed a bug in FreeImage_SetMetadata occuring when deleting a tag -* [Herve Drolon] fixed a bug in PNG plugin when reading Macromedia 'false' PNG files -* [Thorsten Radde] added resolution support to PluginPSD -* [Ryan Rubley] fixed a bug in PluginGIF occuring with interlaced GIF -* [Ryan Rubley] fixed a bug in the multipage cache mechanism (internal FreeImage_FindBlock function) -* [Thorsten Radde] fixed a stack corruption in TIFF plugin occuring when reading exif tags -* [checkered] fixed a bug in the multipage cache mechanism causing VS2005 to crash on multipage files -* [Herve Drolon] fixed a bug with transparency support of 1- and 4-bit images -* [Roar Flolo] fixed a bug in PSD plugin when reading non compressed RGB images (alpha channel initialization) -* [Nicolas Hatier] fixed a bug in PluginGIF when using the GIF_PLAYBACK flag -* [Herve Drolon] fixed a bug in TIFF plugin when saving 8-bit images using LZW with differenciation -* [Herve Drolon] fixed 64-bit compilation issue with LibPNG and assembler code - -July 16th, 2006 - 3.9.1 -* [Ryan Rubley] fixed a bug in PluginGIF plugin causing FreeImage to crash on malformed GIF files - -July 6th, 2006 - 3.9.0 -! FreeImage now uses libPNG 1.2.12 -! FreeImage now uses libTIFF 3.8.2 (with patch 2006-06-24) -! FreeImage_Allocate/FreeImage_Allocate now set the resolution to 72 dpi instead of 0 -+ [Herve Drolon/Petr Pytelka] added a raw FAX G3 format loader -+ [Herve Drolon] added support for most image types to FreeImage_Rescale -+ [Herve Drolon] added FreeImage_MakeThumbnail -+ [Herve Drolon] added support for 64-bit images to FreeImage_ConvertTo32Bits -+ [Herve Drolon] added support for Exif tags to TIF plugin (read only) -+ [Herve Drolon] added FreeImage_ReadMemory -+ [Herve Drolon] added FreeImage_WriteMemory -+ [Herve Drolon] added new Exif maker note tags -+ [Sherman Wilcox] added a SGI file format loader -+ [Herve Drolon] added support for separated images to PluginTIFF -+ [Herve Drolon] added support for progressive-JPEG saving to PluginJPEG -* [Carsten Klein] FreeImage_Dither and FreeImage_Threshold now work with palettized 8-bit dib -* [Christophe Petit] fixed a bug in FreeImage_GetFIFFromFilenameU occuring with files without extension -* [Leigh Brasington] fixed a bug in PluginGIF causing FreeImage not working on Win/98/ME -* [Herve Drolon] fixed a bug in PluginTIFF with writing of JPEG-in-TIFF files -* [Jojakim Stahl] fixed a bug occuring with 4-bit PCX files -* [Sandor Szalacsi] fixed a bug in FreeImage_SetBackgroundColor (bkgnd clearing) -* [Petr Pytelka] fixed PluginTIFF::_tiffSizeProc failing on some images -* [Sherman Wilcox] fixed a bug in DDS plugin when loading images whose size is not a multiple of 4 -* [Sherman Wilcox] fixed a memory leak in PluginDDS::LoadDXT_Helper -* [Sherman Wilcox] fixed DDS plugin bad behavior with invalid DDS files (such as files with zero length) -* [Floris van den Berg] fixed a memory leak in the MultiPage cache mechanism -* [Herve Drolon] replaced WIN32 #define by _WIN32 #define as this is needed by VS2005 -* [Herve Drolon] fixed a VS2005 error in FreeImage_DeletePage -* [Petr Supina] fixed a pow(long,long) function not being standard ANSI C/C++ -* [Petr Supina] fixed FreeImage_FindBlock function not being standard ANSI C/C++ -* [Olaf Stoyke] added support for 64-bit Linux OS -* [Craig Stark] fixed FreeImage support on Intel based Mac OS -* [Herve Drolon] fixed PluginTIFF failing on bad fax tiff images (bad images are now loaded 'as is') -* [Zack Simpson] fixed a bug occuring in rare situations with FreeImage_Aligned_Malloc - -September 5, 2005 - 3.8.0 -! FreeImage now uses libTIFF 3.7.3 -! FreeImage now uses ZLib 1.2.3 -+ [Herve Drolon] added support for 48-bit images to FreeImage_ConvertTo24Bits -+ [Herve Drolon] added FreeImage_ConvertToGreyscale -+ [Herve Drolon] added support for 16-bit greyscale images to FreeImage_ConvertTo8Bits -+ [Petr Pytelka] added UNICODE functions (see below) - added FreeImage_LoadU - added FreeImage_SaveU - added FreeImage_GetFIFFromFilenameU - added FreeImage_GetFileTypeU -+ [Herve Drolon] FreeImage_Copy now works with any bitmap type -+ [Herve Drolon] added support for 1-bit images to FreeImage_Paste -* [Ryan Rubley] fixed PluginGIF failing to link on some broken gcc versions -* [Karl-Heinz Bussian] fixed a bug in LookupX11Color/LookupSVGColor with handling of grey color names -* [Herve Drolon] FreeImage_Dither now uses FreeImage_ConvertToGreyscale and handles 4/8-bit palletized images -* [Herve Drolon] FreeImage_Threshold now uses FreeImage_ConvertToGreyscale and handles 4/8-bit palletized images -* [Craig Hockenberry] fixed PluginGIF::Save swapping the byte order for the height on big endian machines (e.g. PPC on Mac OS X.) -* [Herve Drolon] fixed a bug in JPEG plugin when reading Exif maker notes from images produced by Nikon Editor -* [Herve Drolon] fixed a bug in BMP plugin when reading some malformed RLE8 bmp -* [Herve Drolon] fixed a bug in RAS plugin when loading 8-bit palettized images with less than 256 colors -* [Herve Drolon] fixed a bug in FreeImage_Rescale with 16-,48-,64-bit images -* [Herve Drolon] fixed a bug in the ICC profiles API when loading profile-less CMYK TIFF -* [Herve Drolon] 4-bit PNG are now loaded as 4-bit and no longer converted to 8-bit -* [Greg Ng] fixed a bug in FreeImage_ConvertToRGBF (FIT_BITMAP -> FIT_RGBF conversion) - -May 7, 2005 - 3.7.0 -! FreeImage now uses libTIFF 3.7.2 -! [Ryan Rubley] improved FreeImage_OpenMultiBitmap -+ [Detlev Vendt] added FreeImage_ZLibGUnzip -+ [Herve Drolon] added new image data types FIT_RGB16, FIT_RGBA16, FIT_RGBF, FIT_RGBAF -+ [Herve Drolon] FreeImage_FlipHorizontal & FreeImage_FlipVertical now work with any bitmap type -+ [Herve Drolon] added conversions to float and double in FreeImage_ConvertToType -+ [Herve Drolon] added FreeImage_ConvertToRGBF -+ [Herve Drolon] added support for 16-, 48- and 96-bit images to FreeImage_Rescale -+ [Ryan Rubley] added FreeImage_ColorQuantizeEx -+ [Ryan Rubley] added FIMD_ANIMATION and FIDT_PALETTE -+ [Ryan Rubley] added brand new PluginGIF with full animation multipage and metadata support -+ [Herve Drolon] added support for FIC_MINISWHITE 8-bit images to FreeImage_Rescale -+ [Herve Drolon] added HDR (High Dynamic Range) format (loader & writer) -+ [Herve Drolon] added support for 48-bit images in TIFF plugin -+ [Herve Drolon] added support for 48-bit images in PNG plugin -+ [Herve Drolon] added tone mapping operators (see below) -+ added FreeImage_ToneMapping -+ added FreeImage_TmoDrago03 -+ added FreeImage_TmoReinhard05 -+ [Petr Pytelka] added FreeImage_JPEGTransform -* [Herve Drolon] allowed loading of corrupted JPEG with a premature end of file -* [Herve Drolon] fixed a memory leak with loading of exif JPEG images -* [Detlev Vendt] changed some 'pointer-to-int' casts to 'pointer-to-long' for 64bit machines -* [Ryan Rubley] fixed a memory leak in the multipage API -* [Ryan Rubley] updated VB6 wrapper generation for new functions -* [Herve Drolon] fixed incorrect behavior when reading JPEG comments containing special characters -* [Herve Drolon] fixed incorrect behavior when reading JPEG ICC profiles with a size greater than 64 KB -* [Herve Drolon] fixed a bug in TIFF plugin when loading malformed multipage TIFF -* [Herve Drolon] fixed PluginTIFF not being thread safe - -February 20, 2005 - 3.6.1 -* [Ryan Rubley] fixed a memory leak in the metadata API -* [luedi] improved the robustness of FIBITMAP allocations - -February 13, 2005 - 3.6.0 -! FreeImage now uses libMNG 1.0.9 -! [Herve Drolon] improved the speed of FreeImage_Rescale -! [Herve Drolon] improved FreeImage_RotateClassic (more compact code, a little faster) -! [Herve Drolon] improved the metadata API using tag accessors -+ [Detlev Vendt] added LZW support to PluginGIF:Save -+ [Herve Drolon] added VS.Net 2003 project files -+ [Herve Drolon] added VERSIONINFO resource to the DLL -+ [Herve Drolon] added support for CMYK JPEG on loading -+ [Petr Supina] added 16-bytes alignment to FIBITMAP palette and pixels starting address -+ [Petr Supina] added support for MMX/SSE2 code in LibJPEG (based on Mozilla/Firefox code) -+ [Herve Drolon] added TIFF_JPEG compression flag to the TIFF plugin -+ [Detlev Vendt] added FreeImage_ZLibGZip -+ [Detlev Vendt] added FreeImage_ZLibCRC32 -* [Detlev Vendt] fixed PluginPNG not being thread safe -* [Herve Drolon] fixed compiler warning C4018 occuring with VS.Net 2003 - -December 29, 2004 - 3.5.3 -! FreeImage now uses ZLib 1.2.2 -! FreeImage now uses libPNG 1.2.8 -! FreeImage now uses libTIFF 3.7.1 -! [Herve Drolon] improved FreeImage_RotateClassic -! [Detlev Vendt] improved FreeImage_Rescale (more compact code, preserving 8-bpp colors) -+ [Herve Drolon] added support for transparency saving in ICO plugin -+ [Herve Drolon] added support for 1-bit images to FreeImage_RotateClassic -+ [Herve Drolon] added FreeImage_SetDotsPerMeterX and FreeImage_SetDotsPerMeterY -* [Nan Feng] fixed memory leak in FreeImage_DeleteTag (internal stuff) -* [Nigel Stewart] added conditional #pragma with #ifdef _MSC_VER / #endif -* [Herve Drolon] fixed the '65536 lines' limit on loading in PNM plugin - -November 27th, 2004 - 3.5.2 -* [Herve Drolon] fixed a second bug in FreeImage_Clone function - -November 26th, 2004 - 3.5.1 -+ [Riley McNiff] added FreeImage_ConvertTo4Bits -* [Herve Drolon] fixed a buffer overrun with some ILBM images -* [Riley McNiff] fixed a potential problem when reading TIFF resolution info -* [Dimitar Atanasov] fixed a bug in FreeImage_Clone function -* [Dimitar Atanasov] fixed several bugs in TIFF plugin - -November 1st, 2004 - 3.5.0 -! FreeImage now uses libPNG 1.2.7 -! FreeImage now uses libTIFF 3.7.0 -! FreeImage now uses libMNG 1.0.8 -! [Herve Drolon] improved TIFF LZW compression using a predictor -! [Detlev Vendt] FreeImagesPlus: corrected references to FreeImage.h and FreeImage.lib -+ [Herve Drolon] added support for loading/saving of 8-bit transparent TIFF -+ [Riley McNiff] added support for 4-bit dib in FreeImage_Paste -+ [Herve Drolon] added support for memory IO streams (see below) -+ added FreeImage_OpenMemory -+ added FreeImage_CloseMemory -+ added FreeImage_LoadFromMemory -+ added FreeImage_SaveToMemory -+ added FreeImage_TellMemory -+ added FreeImage_SeekMemory -+ added FreeImage_AcquireMemory -+ added FreeImage_GetFileTypeFromMemory -+ [Petr Pytelka] added FreeImage_GetFIFMimeType to the plugins function list -+ [Herve Drolon] added ICC profile support to JPEG plugin -+ [Herve Drolon] added support for metadata (see below) -+ added FreeImage_SetMetadata -+ added FreeImage_GetMetadata -+ added FreeImage_GetMetadataCount -+ added FreeImage_TagToString -+ added FreeImage_FindFirstMetadata -+ added FreeImage_FindNextMetadata -+ added FreeImage_FindCloseMetadata -* [Riley McNiff] fixed a bug with FreeImage_SetPixelIndex and 4-bit images -* [Petr Pytelka] fixed returned value in FreeImage_CloseMultiBitmap -* [Petr Pytelka] fixed index of new page in FreeImage_InsertPage -* [Aaron Shumate] fixed a minor bug in PNG plugin -* [Aaron Shumate] fixed a bug in IFF plugin (odd-length chunks) -* [Rupert Hewitt] fixed FreeImage not compiling on National Instruments Cvi Ccompiler -* [Herve Drolon] fixed a bug in IFF plugin (ILBM data) -* [Fred Harju] added a Makefile for Solaris 9 -* [Roddy Pratt] fixed FreeImage not linking under Borland C++ Builder -* [Vadim Alexandrov] fixed a memory leak in the multipage API -* [Herve Drolon] fixed a bug with DDS plugin behaviour on Big Endian OS -* [Herve Drolon] fixed a bug with conversion of JPEG resolution info on saving - -July 8th, 2004 - 3.4.0 -! [Jim Keir] improved FreeImage_FlipVertical function -! [Herve Drolon] LZW compression is now enabled in FreeImage -+ [Karl-Heinz Bussian] added constants to FreeImage.h to get at compile time the library version -+ [Karl-Heinz Bussian] added color lookup functions for X11 and SVG -+ [Herve Drolon] added TIFF tags TIFF_CCITTFAX3, TIFF_CCITTFAX4 and TIFF_LZW -+ [Detlev Vendt] added support for CMYK TIFF files with alpha channel -+ [Detlev Vendt] added (re-introduction of) PluginGIF -* [Herve Drolon] fixed a bug with loading of FAX TIFF images (introduced with LibTIFF 3.6.1) -* [Herve Drolon] fixed a bug in Floyd-Steinberg dithering algorithm -* [Herve Drolon] fixed a bug in Targa plugin save function -* [Herve Drolon] fixed a bug in FreeImage_AdjustCurve function -* [Ryan Rubley] fixed a bug with FreeImage_Rescale's filters accuracy -* [Ryan Rubley] fixed a bug in NN quantizer -* [Herve Drolon] fixed a bug with TIFF files containing additional Photoshop alpha channels -* [James Rossfeld] fixed a memory leak with some PSD images -* [Herve Drolon] fixed a bug with saving of 32-bit non transparent PNG images -* [Alexandr Zamaraev] fixed FreeImage not compiling with mingw32 -* [Herve Drolon] fixed FreeImage not compiling with VC.NET (pow function needs casts) - -May 2, 2004 - 3.3.0 -! [Ryan Rubley] FreeImage has been ported to MacOSX and should also work on other big endian processors -+ [Ryan Rubley] rewrote XPM plugin (better load support) and added save support -+ [Ryan Rubley] added ICO_MAKEALPHA flag to ICO plugin -+ [Ryan Rubley] Set/GetPixelColor now works with 16-bit pixels (555 or 565) -+ [Herve Drolon] PNG plugin now supports loading and saving of unsigned 16-bit greyscale images -* [Herve Drolon] fixed a bug with loading of 8-bit and 16-bit PNG with a 8-bit alpha channel -* [Herve Drolon] fixed a bug in NN quantizer algorithm with handling of 4-byte boundary alignment. -* [Herve Drolon] fixed a bug in PluginIFF Validate function -* [Herve Drolon] fixed a minor design issue in FreeImage_GetFIFFromFormat -* [Brad Schick] fixed some compiler warnings with VC++ 7.1 -* [Herve Drolon] fixed a bug with saving of 8-bit palettized images to 24-bit JPEG (channel inversion) - -March 16, 2004 - 3.2.1 -! [Volker Gärtner] improved the DDS plugin -! [Herve Drolon] FreeImage_Rescale now works on 8-, 24- and 32-bit images -! [Herve Drolon] FreeImage_Copy now works on 1-, 4-, 8-, 16-, 24- and 32-bit images -* [Floris van den Berg] fixed a bug in the MultiPage cache mechanism -* [Herve Drolon] fixed a bug with loading/saving of 8-bit transparent tga images -* [Herve Drolon] fixed a bug with loading of 1-bit TIFF (introduced with LibTIFF 3.6.1) - -February 18, 2004 - 3.2.0 -! FreeImage now uses libTIFF 3.6.1 -+ [Herve Drolon] added FreeImage_HasBackgroundColor -+ [Herve Drolon] added FreeImage_GetBackgroundColor -+ [Herve Drolon] added FreeImage_SetBackgroundColor -+ [Herve Drolon] added FreeImage_Composite -+ [Herve Drolon] added ICC profile support to PNG plugin -+ [Herve Drolon] added background color support to PNG plugin -+ [Volker Gärtner] added support for DDS format (loader) -* [Steve Johnson] improved FreeImage_OpenMultiBitmap/FreeImage_CloseMultiBitmap -* [Steve Johnson] fixed a bug in FreeImage_InsertPage -* [Herve Drolon] fixed a bug with JPEG compressed TIFF (red/blue swapping) -* [Herve Drolon] fixed a bug in PluginTarga where 8-bit images were saved incorrectly - -January 26, 2004 - 3.1.0 -! FreeImage now uses ZLib 1.2.1 -+ [Herve Drolon] added support for integer, real and complex image types (see below) -+ added FREE_IMAGE_TYPE enum -+ added FreeImage_AllocateT -+ added FreeImage_GetImageType -+ added FreeImage_FIFSupportsExportType -+ added FreeImage_ConvertToStandardType -+ added FreeImage_ConvertToType -+ added load/save support of all image types to TIFF plugin -+ [Peter Lemmens] added a Validate function to TARGA plugin -+ [Herve Drolon] added FreeImage_GetPixelIndex / FreeImage_SetPixelIndex -+ [Herve Drolon] added FreeImage_GetPixelColor / FreeImage_SetPixelColor -+ [Herve Drolon] added FreeImage_GetComplexChannel / FreeImage_SetComplexChannel -* [Serge Ivanchenko] TIFF_DEFLATE compression is now enabled in TIFF plugin -* [Herve Drolon] fixed a bug in NeuQuant color reduction algorithm - -November 16, 2003 - 3.0.4 -* [Tobias Persson] fixed FreeImage_GetChannel not working with FICC_ALPHA channel -* [Detlev Vendt] fixed a minor bug with PNG plugin and PNG_IGNOREGAMMA flag -* [Detlev Vendt] fixed a memory leak in PNG plugin save routine -* [Detlev Vendt] fixed JPEG validation problem with .jpe files -* [Ryan Rubley] added Source/LibTIFF/tif_extension.c to LibTIFF (needed for MacOSX) -* [Herve Drolon] improved error handling in TIFF plugin -+ [Karl-Heinz Bussian] added FreeImage_IsLittleEndian -+ [Karl-Heinz Bussian] added JPEG save support for 8-bit miniswhite bitmaps (transparent conversion to minisblack) -+ [Karl-Heinz Bussian] FreeImage_GetColorType now recognizes 8-bit FIC_MINISWHITE images -! [Herve Drolon] FreeImage_Rescale now supports rescaling of 32-bit images with alpha channel -! [Herve Drolon] FreeImage_Invert now supports inversion of 32-bit images with alpha channel -! [Herve Drolon] FreeImage_AdjustCurve now supports working with FICC_ALPHA channel - -November 2, 2003 - 3.0.3 -* [Ryan Rubley] improved makefile for Linux -* [Ryan Rubley] fixed FreeImage not compiling under MacOSX -* [Detlev Vendt] fixed still present inconsistancy with 32bpp transparency handling -* [Herve Drolon] fixed incorrect loading of 4-bit greyscale images in TIFF plugin - -October 27, 2003 - 3.0.2 -! FreeImage now uses libMNG 1.0.6 -* [Herve Drolon] fixed a boolean test in PluginCUT returning always false -* [Herve Drolon] fixed a warning in PluginIFF generated with g++ -* [Linus Tan] fixed a bug in FreeImage_Copy -* [Herve Drolon] fixed FreeImage not compiling under Linux (thanks to Michal) - -October 20, 2003 - 3.0.1 - -! FreeImage now uses libTIFF 3.6.0 -* [Detlev Vendt] fixed incorrect definition of the FREE_IMAGE_FORMAT enum -* [Detlev Vendt] fixed a potential crash problem with Load / Save routines -* [Herve Drolon] fixed incorrect loading of 16-bit greyscale images in TIFF plugin -* [Dennis Lim] fixed a memory leak in Floyd & Steinberg dithering routine -* [Herve Drolon] fixed a bug in BMP loader (incorrect loading of RLE4 bmp) -* [Detlev Vendt] fixed some inconsistancy with 32bpp transparency handling -+ [David Boland] added a C# wrapper -// Linux compatibility issues -- [Michal Novotny] removed the round function in Utilities.h -! [Herve Drolon] replaced the round routine by the clamp routine in PluginPCD -+ [Herve Drolon] added _itoa version in Utilities.h -* [Michal Novotny] fixed untyped consts not accepted by g++ in PluginBMP - -September 8, 2003 - 3.0.0 -- [Herve Drolon] removed deprecated functions -- [Herve Drolon] removed deprecated flags (TARGA_LOAD_RGB555, ICO_*, except ICO_DEFAULT) -- [Herve Drolon] removed the FreeImage pointer table (internal stuff) -+ [Herve Drolon] added a C++ wrapper -+ [Herve Drolon] added the FreeImage Toolkit (see below) -+ added FreeImage_Rescale -+ added FreeImage_RotateClassic -+ added FreeImage_RotateEx -+ added FreeImage_FlipHorizontal -+ added FreeImage_FlipVertical -+ added FreeImage_Invert -+ added FreeImage_AdjustCurve -+ added FreeImage_AdjustGamma -+ added FreeImage_AdjustBrightness -+ added FreeImage_AdjustContrast -+ added FreeImage_GetHistogram -+ added FreeImage_GetChannel -+ added FreeImage_SetChannel -+ added FreeImage_Copy -+ added FreeImage_Paste -+ [Karl-Heinz Bussian] added XPM loader -+ [Karl-Heinz Bussian] added flags parameter to FreeImage_CloseMultiBitmap -+ [Karl-Heinz Bussian] added JPEG save support for 8-bit palettized bitmaps (transparent conversion to 24-bit) -+ [Herve Drolon] added interface to ZLib compression functions -+ [Herve Drolon] added ICO format to the multipage API (loader & writer) -+ [Herve Drolon] added a MIME type to all plugins -* [Karl-Heinz Bussian] fixed incorrect conversion from 1-bit FIC_MINISWHITE bitmaps to 8-bit -* [Herve Drolon] fixed a bug in FreeImage_CloseMultiBitmap -* [Herve Drolon] fixed a potential memory leak in conversion functions (8-, 24-, 32-bit) -* [Robert Walker] fixed incorrect conversion from 16-bit to 24-bit and 16-bit to 32-bit -* [blurble] fixed TIFF validate signature problem (3DS files were recognized as TIFF) -* [Kurt Jankowski-Tepe] fixed FreeImage not compiling on MinGW / LCC WIN32 -* [Jani Peltonen] fixed bug in PluginTARGA where 32-bit bitmaps are not always correctly flipped -* [Detlev Vendt] fixed a bug with TIFF (memory leak with ICC profiles) - -May 25, 2003 - 2.6.1 -+ [Detlev Vendt] added FIC_CMYK to FREE_IMAGE_COLOR_TYPE -+ [Detlev Vendt] added ICC profile support to the library (see below) -+ added FreeImage_GetICCProfile -+ added FreeImage_CreateICCProfile -+ added FreeImage_DestroyICCProfile -+ added FIICCPROFILE & FIICCPROFILE flags -+ added plugin function FreeImage_FIFSupportsICCProfiles -+ [Detlev Vendt] added ICC profile support for TIFF -+ [Herve Drolon] added XBM (X11 Bitmap Format) support : loading -* [Herve Drolon] fixed incorrect IFF file detection (thanks Floris) -* [Herve Drolon] fixed incorrect conversion from 1/4-bit greyscale bitmaps to 8-bit -* [Herve Drolon] fixed a bug in TIFF writer when saving 1,4,8 bit dib (introduced in 2.6.0, sorry) -* [Herve Drolon] fixed a palette problem in TIFF loader when loading 1-bit b & w images -* [Herve Drolon] improved FreeImage_Dither to handle any bitdepth - -May 5th, 2003 - 2.6.0 -! FreeImage now uses libPNG 1.2.5 -! FreeImage now uses libMNG 1.0.5 -! [Markus Loibl] ActiveX wrapper is now distributed in a separate release (since 2.5.5) -! [Herve Drolon] the function FreeImage_Free is now deprecated : use FreeImage_Unload instead -! [Herve Drolon] updated the generic samples and removed deprecated functions -+ [Detlev Vendt] added CMYK support to TIFF save function -+ [Detlev Vendt] added TIFF_SAVE_CMYK flag constant -+ [Detlev Vendt] added 32-bit support (with transparency handling) to TIFF plugin -+ [Herve Drolon] added FreeImage_Threshold -+ [Herve Drolon] added FreeImage_Dither -+ [Herve Drolon] added FREE_IMAGE_DITHER parameter to FreeImage_Dither -* [Herve Drolon] improved error handling in PluginMNG -* [Herve Drolon] improved TIFF flags handling in TIFF save function -* [Herve Drolon] fixed a potential crash-problem in FreeImage_OutputMessage (in case of a null message) -* [Detlev Vendt] fixed a bug with the deprecated FreeImage_GetBitsRowCol (trailling backslash behind the DEPRECATE macro) - -July 24th, 2002 - 2.5.5 -! FreeImage now uses libPNG 1.2.4 -! FreeImage now uses libMNG 1.0.4 -+ [Markus Loibl] added ActiveX wrapper - -June 22th, 2002 - 2.5.4 -* [Timothy Roughton] fixed FreeImage not compiling on LCC WIN32 -* [Markus Loibl] fixed PluginTIFF sometimes saving with wrong X/Y resolution -* fixed crashbug when loading some RLE4 BMPs -! FreeImage now uses LibPNG 1.2.3 -! [Markus Loibl] improved startup plugin locate handling code -! [Gerhard Gruber] made some changes so that FreeImage compiles on VC5 -+ [Markus Loibl] added flags TIFF_PACKBITS, TIFF_DEFLATE, TIFF_ADOBE_DEFLATE and TIFF_NONE - -May 21th, 2002 - 2.5.3 -* fixed wrong colors when loading 16-bit grayscale TIFF -* fixed crash-problem with FreeImageQt -* fixed PluginTIFF saving some bitmaps flipped vertically -* [Laurent Rocher] fixed bug in FreeImage_GetLockedPageNumbers -* [Laurent Rocher] fixed bug in FreeImage_UnlockPage -! FreeImage now uses libpng 1.2.2 -+ added TARGA save support -+ added BMP RLE8 save support - -March 30th, 2002 - 2.5.2 -* fixed bug in PluginTARGA where 32-bit bitmaps are not always correctly flipped -* fixed FreeImage_GetLockedPageNumber being mentioned in FreeImage.h -* fixed crash bug when handling read-only multipage bitmaps -- removed internal function FreeImage_GetExtraDataPointer -! FreeImage now uses zlib 1.1.4 -+ added function FreeImage_GetLockedPageNumbers - -March 2nd 2002 - 2.5.1 -* fixed pluginTIFF not being able to save 32-bit bitmaps -* fixed not being able to save PNM bitmaps through the LoadXXX wrappers -* fixed a webcam generated BMP image being loaded with wrong colors -! FI_ReadProc, FI_WriteProc, etc. do now carry the DLL_CALLCONV flag -! the function FreeImage_GetBitsRowCol is now deprecated -! FreeImage_SetTransparencyTable now taken an integer as count parameter -! FreeImage_IsTransparent now always returns true for 32-bit bitmaps -! PluginPNG::Save now ignores the result of FreeImage_IsTransparent -! PluginTIFF now converts all 32-bit bitmaps to 24-bit, until our patch - to fully support alpha in TIFF is applied in libtiff -+ added full multi-paging support -+ added octal and hexadecimal number support to FreeImage_OutputMessage - -January 3rd 2002 - 2.5.0 -* fixed bug in FreeImage_SaveJPEG -* fixed bug in FreeImage_LoadMNG -* fixed bug in FreeImage_LoadPNG -* fixed small Visual C++ 5.0 compiler issue in PluginMNG.cpp -* fixed FreeImage crashing on JPEG 6.0 encoded TIFFs -! FreeImage now uses libTIFF 3.5.7 -! FreeImage now uses libPNG 1.2.1 -! all the FreeImage_LoadXXX and FreeImage_SaveXXX functions are now deprecated -+ added Dr. Halo (*.cut) support -+ added printf-like format string support to SetOutputMessage -+ added basic multi-paging support: open, close, counting and grabbing -+ added deprecation manager -+ added FreeImage_Clone function - -October 3rd 2001 - 2.4.2 -* fixed missing BI_BITFIELDS support for 32-bit BMPs -* fixed bug in FreeImage_ConvertLine16_555_To16_565 and vice versa -* fixed bug in FreeImage_ConvertToRawBits -* fixed PluginTIFF behaving incorrectly on PHOTOMETRIC_MASK images -* fixed 16 bit TIFFs not loading correctly -* fixed incorrect handling of CCITTFAX3 and CCITTFAX4 TIFFs -* fixed JPEG encoded TIFFs not being supported -! [Yours Detlev] patched libTIFF to handle EXTRASAMPLE_UNSPECIFIED -! [Juergen Riecker] improved speed of PCX loading a lot -! rewrote parts of FreeImage to improve support for c -! the internal RGB555 and RGB565 macros now read BGR instead of RGB -! FreeImage now uses libMNG 1.0.3 -! FreeImage now uses libPNG 1.2.0 -! FreeImage_Save now opens files with the "w+b" flag -! renamed internal macro CalculateUsedColors to CalculateUsedPaletteEntries -! enabling/disabling plugins no longer has effect on FIFSupportsReading -! enabling/disabling plugins no longer has effect on FIFSupportsWriting -+ added flag PNG_IGNOREGAMMA -+ added function FreeImage_FIFSupportsExportBPP - -July 30th 2001 - 2.4.1 -* [Jan Nauta] fixed some plugin ids not being passed to plugins -* [Jan Nauta] fixed some functions being natively called instead of indirect -* [Jan Nauta] fixed BMPs with signature BA not being regognised -* [Remo Eichenberger] fixed memory leak in the plugin system -* fixed seek bug in PluginIFF's Validate -* fixed transparency issue in PluginPNG -* fixed uncaught exceptions in WUQuantizer and NNQuantizer -* fixed some problems with PluginTARGA -* fixed some problems with PluginICO -* fixed some problems with PluginBMP -! improved FreeImageQt's load function a little -! tell/seek control for validation is now handled inside the plugin framework - -July 22th 2001 - 2.4.0 -* (Yours Detlev) fixed memory leak in FreeImage_GetFIFFromFilename -* (Yours Detlev) fixed memory leak in the ICO plugin -* (Yours Detlev) fixed memory leak in the PNG plugin -* fixed potential NULL-pointer access bug in Plugin::AddNode -* fixed problems with linking the static lib -- removed LBM plugin. Its functionality is placed in the IFF plugin now -- removed FreeImage_GetFIFByIndex -! FreeImage now uses LibMNG 1.0.2 -! FreeImage_SetTransparent now only enables alpha when the bitmap is 8 or 32 bit -! FreeImage_SetTransparencyTable now only enables alpha when the bitmap is 8 bit -! FreeImage_LoadLBM now uses Mark Sibly's IFF plugin -! FreeImage_SaveBMP now converts to 24-bit when bpp is 32 and transparency is off -! FreeImage_SaveJPEG now converts to 24-bit when bpp is 32 and transparency is off -! FreeImage_SavePNM now converts to 24-bit when bpp is 32 and transparency is off -! FreeImage_SaveTIFF now converts to 24-bit when bpp is 32 and transparency is off -+ [Mark Sibly] added IFF (ILBM) support -+ added basic support for Photoshop files -+ added mime type support (FreeImage_GetFIFFromMime) -+ added functions FreeImage_SetPluginEnabled and FreeImage_IsPluginEnabled - Disabling plugins modifies the behaviour of the following functions: - * FreeImage_LoadFromHandle - * FreeImage_SaveToHandle - * FreeImage_FIFSupportsReading - * FreeImage_FIFSupportsWriting - * FreeImage_GetFIFFromFormat - * FreeImage_GetFIFFromFilename - * FreeImage_GetFIFFromMime - * FreeImage_Validate - -June 30th 2001 - 2.3.2 -* fixed missing "targa" extension in targa extension list -* fixed small memory leak in PluginList::AddNode -* fixed 32 bit PNG saving suddenly disappeared from the distro? -* fixed 'black line' bug in LoadTARGA -- removed project FreeImageM2 -- removed FreeImage_Combine -! FreeImage_RegisterLocalPlugin now receives a FI_InitProc as first parameter -! FreeImage_GetFIFFromFilename now also takes the format id into account -! cleanup up the code a little for PluginPCD and PluginPCX -+ added static lib project - -June 11th 2001 - 2.3.1 -* [Machiel ten Brinke] fixed the loading of some 'ancient' TARGAs -* [Rui Lopes] fixed some bugs in the external plugin registration -* fixed the plugin system crashing when the init function isn't called -- removed project FreeImagePy -- removed 32 to 24 bit conversion while saving PNG in FreeImageQt -! the scanline convert functions are now accessable in plugins -! FreeImage now uses an STL map to store the plugin list -! PluginSDK.h is now integrated into FreeImage.h -! FreeImage_Register now receives the boolean parameter 'load_local_plugins_only' -! FreeImage now uses LibPNG 1.0.12 -+ [Rui Lopes] added plugin for GIF reading/writing support -+ added function FreeImage_SetTransparencyCount -+ added support for 32 bit PNG saving -+ added FreeImage_RegisterLocalPlugin to allow plugins inside apps -+ added FreeImage_RegisterExternalPlugin to manually load DLLs -+ added plugin for JBIG reading/writing support - -May 4th 2001 - 2.3.0 -* [Martin Weber] fixed some small bugs in the TARGA and BMP plugins -* [Martin Weber] fixed tiny bug in new 16 bit conversions -* [Martin Weber] fixed load flag inconsistency in the TARGA plugin -* [Martin Weber] fixed plugin id / load reference inconsistency for PNM -* [Jan Nauta] fixed bug in conversion 16 -> 16 -* [Herve Drolon] fixed small bug in 4-bit PCX loader -- removed code that loads BMPs renamed to ICO in PluginICO -! the flag TARGA_LOAD_RGB555 is now obsolete -! the plugin list is now sorted internally -! ConvertTo32Bits now stores the transparency table as alpha mask -! FreeImage now uses LibMNG 1.0,1 -! FreeImage now uses LibPNG 1.0.11 -+ added external plugin support via DLLs -+ added function FreeImage_GetFIFByIndex -+ added internal function CalculateScanLine -+ added transparency support for high-color PNGs -+ added transparency support for high-color TIFFs -+ added functions FreeImage_SetTransparent and FreeImage_IsTransparent -+ added constant FIC_RGBALPHA to FREE_IMAGE_COLOR_TYPE - -April 5th 2001 - 2.2.0 -* [Remo Eichenberger] fixed small bug concerning DLLMain and static LIB generation -* fixed 1-bit bitmaps not properly loading in FreeImageQt -* fixed bug in conversion 16->16 -* FreeImage now uses LibPNG 1.0.10 -! [Martin Weber] improved loading of BMP files -! [Martin Weber] improved loading of TARGA files -! [Dave Larson] improved visual appearance after 16 conversions -! FreeImageQt now converts 32-bit bitmaps to 24-bit when saving PNGs and JPEGs -+ added functions FreeImage_Initialise and FreeImage_DeInitialise -+ added internal plugins -+ re-added combine/alphablend functions - -March 8th 2001 - 2.1.0 -* [Martin Hemming] fixed bug in 16-bit TARGA loading code -* fixed PNG's with alpha masks not loading correctly -! FreeImage is now dual-licensed: the FI-License and the GPL license -! FreeImage now uses LibPNG 1.0.9 -! FreeImage now uses LibTIFF 3.5.6 Beta -! FreeImage now uses LiBMNG 1.0.0 -! changed the ordering of the FREE_IMAGE_FORMAT table -! improved linux support -! improved test script -+ added transparency table support to SavePNG -+ added BI_BITFIELDS support to LoadBMP and SaveBMP -+ added reading support for OS/2 2.x BMPs -+ added support for MNG and JNG reading using LibMNG -+ added support for Deluxe Paint reading -+ added 'hot swap' support to the Core DLL -+ added 'hot swap' support to FreeImage Qt -+ added functions GetFIFFromFormat and GetFIFFromFilename -+ added functions FIFSupportsReading and FIFSupportsWriting -+ added function GetFIFRegExpr - -January 14th 2001 - 2.0.0 -* [Herve Drolon] fixed a bug in the conversion 4->8 -* [Herve Drolon] fixed a bug in metrics handling in SaveJPEG -* [Herve Drolon] fixed a bug in the return value of the function SaveTIFF -* fixed the presence of two WuQuantizer.cpp files in the distribution -* fixed bug where a BMP renamed to ICO isn't loaded -- removed FreeImage_ConvertToGreyScale. Use FreeImage_ConvertTo8Bits instead. -- removed the boolean parameters from all conversion routines -- removed page handling in LoadTIFF. A new range of functions will be added. -! The void pointers used in FreeImage are now typed -! LoadBMP now takes palettes in 24/32 bit images in respect -! All effects and MMX functions are now stored in a new library (FreeEffects) -! [Herve Drolon] fixed bug in FreeImage_GetColorType -! [Herve Drolon] improved PCX loader. It can now read 1, 4, 8 and 24-bit images -! [Manfred Tausch] improved FreeImage_Rotate -! [Luca Piergentili] fixed crash bug when saving some 1-bit TIFFs -! rewrote all bitdepth conversion routines making use of the new scanline converters -! rewrote bitdepth conversion in FreeImageQt (uses less memory) -! FreeImage is now compiled __stdcall -+ [Herve Drolon] added WBMP (Wireless Bitmap Format) support: loading and saving -+ [Herve Drolon] added 4, 16 and 32 bitdepth handling in GetColorType -+ [Herve Drolon] added handling of 8-bit greyscale bitmaps in SaveJPEG -+ [Herve Drolon] added NeuQuant color reduction algorithm to ColorQuantize -+ added DLL_CALLCONV (calling convention) flag -+ added bitmask support to all bitmaps -+ added a series of functions converting scanlines from one bitdepth to another -+ added functions ConvertFromRawBits and ConvertToRawBits -+ added project FreeImageM2: Magenta II MMT bindings for FreeImage -+ added basic foundation for linux support - -December 2th 2000 - 1.4.4 -* fixed small bug related to TIFFSetDirectory in FreeImage_LoadTIFF -* fixed FreeImage_Rotate sometimes clipping too much pixels -* fixed other small bug in FreeImage_Rotate -* fixed FreeImage_Clone not taking the FREEIMAGEHEADER in account -* fixed bug in FreeImageQt where 1-bit images are not correctly allocated -* fixed FreeImage_Crop not copying the palette -* fixed message function pointer crash bug -* fixed bug where the palette wasn't copied when saving in FreeImageQt -* fixed FreeImage_Clone not copying the transparency table -- removed FreeImage_WritePaletteEntry -! [Adam Gates] rewrote parts of FreeImage so that c compilers can handle it better -! FreeImageQt doesn't statically link with the FreeImage lib anymore -! FreeImageQt now uses atexit() to automatically unregister -! rewrote parts of FreeImage_LoadBMP to increase speed -+ [Markus Loibl] added metrics handling code to LoadBMP, LoadJPEG, LoadTIFF and LoadPCX -+ added metrics handling code to FreeImageQt -+ added functions FIQT_IsLoaded, FIQT_GetVersion and FIQT_GetCopyrightMessage -+ added conversion 1 -> 16 -+ added FreeImage_SaveJPEG and JPEG quality settings -+ added FreeImage_GetBitsRowCol -+ added function FIQT_SetOutputMessage to FreeImageQt -+ added FreeImage_GetFileTypeFromExtension and FIQT_GetFileTypeFromFormat -+ added project FreeImagePy: python bindings for FreeImage - -November 7th 2000 - 1.4.3 -* fixed FreeImage_SavePNG crash bug -* fixed slighly corrupt size filter in FreeImage_Combine -* fixed FreeImage_SaveTIFF not saving 4-bit images -* [Herve Drolon] fixed bug in FreeImage_LoadTIFF -* [Herve Drolon] fixed bug in FreeImage_GetColorType -- removed fclose from FreeImage_SavePNM (who put it there?) -! rewrote FreeImage_Rotate -! FreeImageQt now automatically detects which formats are supported by Qt and which not -! FreeImage_Allocate now returns a void pointer -! FreeImage_Unload is now called FreeImage_Free -+ added 16-bit 5-5-5 support to FreeImage_LoadBMP -+ added RLE_DELTA support to FreeImage_LoadBMP -+ added directory support to FreeImage_LoadTIFF -+ added functions dealing with transparency -+ added transparency support to 8-bit PNG's in Qt -+ added FREE_IMAGE_QUANTIZE parameter to FreeImage_ColorQuantize -+ added custom FREEIMAGEHEADER header prepended to internal bitmaps -+ added new documentation - -October 18th 2000 - 1.4.2 -* fixed FreeImage_SaveBMP storing an incorrect bfSize value in the BITMAPFILEHEADER -* fixed bug where JPEG and PNG wouldn't load in FreeImageQt -* fixed FreeImage_Mirror mirroring one pixel less than needed -! FreeImage_MaskedCombine24 is now called FreeImage_MaskedCombine24Ex -! FreeImage_MaskedCombine32 is now called FreeImage_MaskedCombine32Ex -+ added 16-bit bitmap support to FreeImage_Mirror -+ added 16-bit bitmap support to FreeImage_ConvertTo8Bits -+ added simple version of FreeImage_MaskedCombine24 -+ added simple version of FreeImage_MaskedCombine32 - -October 17th 2000 - 1.4.1 -* [Herve Drolon] fixed bug in FreeImage_ConvertTo8Bits -* fixed bug in conversion with 16 -> 24 and 16 -> 32 -- removed static library support -- removed all unnecessary files from LibTIFF, LibPNG, LibJPEG and ZLib -- removed all absolute seeks from the library -! FreeImageQt now makes use of the DLL distro -! rebuilt the entire directory structure -! improved handling of BMP -! renamed FreeImage_MaskedCombine to FreeImage_MaskedCombine32 -+ [Alexander Dymerets] added 24-bit masked alpha blending with a seperate alpha mask -+ added FreeImage_Rotate (known bug in degrees 76 to 106) -+ added 4-bit bitmap support to FreeImage_ConvertTo16Bits -+ added 8-bit bitmap support to FreeImage_ConvertTo16Bits -+ added 32-bit bitmap support to FreeImage_ConvertTo16Bits -+ added 32-bit bitmap support to FreeImage_Mirror -+ added 16-bit 5-5-5 support to FreeImage_ConvertTo24Bits -+ added 16-bit 5-5-5 support to FreeImage_ConvertTo32Bits - -October 2th 2000 - 1.4.0 -* [Jani Kajala] fixed bug in conversion with 4 -> 24 and 8 -> 32 -* [Jani Kajala] fixed bug in FreeImage_Flip -* [Jani Kajala] fixed minor bug in FreeImage_LoadBMP -- [Herve Drolon] removed PBMFlags, PGMFlags and PPMFlags -- [Herve Drolon] removed FI_LoadGeneric -- removed FreeImage_Win32.h -! [Herve Drolon] changed FI_GetFileType -! [Herve Drolon] replaced FI_LoadPBM, FI_LoadPGM and FI_LoadPPM with FI_LoadPNM -! [Herve Drolon] improved FreeImage_LoadPNG -! FreeImage_WritePaletteEntry is now exported -+ [Herve Drolon] added FreeImage_SavePNG -+ [Herve Drolon] added FreeImage_SavePNM and PNMFlags -+ [Herve Drolon] added XXXFlags parameter to save functions -+ [Herve Drolon] added FreeImage_LoadRAS and FIF_RAS -+ added FreeImage_GetFileTypeFromExt - -September 7th 2000 - 1.3.5 -+ added conversion 4 -> 8 to FI_ConvertTo8Bits -+ added simple version of FI_GetFileType -+ added project FreeImageQt; a port of the library to the TrollTech library - -August 31th 2000 - 1.3.4 -* fixed 'ice effect' bug in new 24 bit PCX code -* fixed some bugs with the conversion 16 -> 24 and 16 -> 32 -! FI_Blur now returns void -! A debug build of the library now produces FreeImaged.dll and FreeImaged.lib -! TARGA_LOAD_ARGB8888 is now called TARGA_LOAD_RGB888 -! Alpha channels are now automatically loaded unless TARGA_LOAD_RGB888 is specified -! cleaned up the code a lot -+ added 32-bit bitmap support to FreeImage_ConvertToGreyscale -+ added support for 32-bit bottom-left TARGA images -+ added internal functions FreeImage_WritePaletteEntry() and FreeImage_GetScanLine() -+ added FreeImage_Win32.h, containing Windows functions needed to create DIBs -+ added documentation through Doxygen - -July 30th 2000 - 1.3.3 -* [Jani Kajala] fixed some bugs with the conversion 4 -> 24 and 8 -> 24 -* [Jani Kajala] fixed some bugs with the conversion 4 -> 32 and 8 -> 32 -* fixed bug in FI_LoadPNM's ASCII number loader -! [Herve Drolon] improved FI_LoadPNG -! [Herve Drolon] changed FI_ConvertToGreyScale (added changeable macro for conversion) -! improved FI_ConvertTo24Bits -! improved FI_ConvertTo32Bits -! freeImage now uses LibPNG 1.0.8 -+ [Herve Drolon] added FI_ColorQuantize, based on Wu's color quantizer -+ added the conversion 1 -> 24 -+ added the conversion 1 -> 32 -+ added FI_ConvertTo8Bits -+ added FI_Invert (very useful for image processing) -+ added FI_GetColorType and 'enum FREE_IMAGE_COLOR_TYPE' - -June 30th 2000 - 1.3.2 -- removed color reduction functions from the project -! [Herve Drolon] Improved FI_LoadTIFF code -! renamed FI_ToGrayscale to FI_ConvertToGreyScale -! renamed FI_IncreaseColors to FI_ConvertTo24Bits -! LoadBMP now supports 32-bit bitmaps -! [Jani Kajala] Improved FI_LoadTARGA and FI_LoadPCX code -+ added FI_ConvertTo32Bits to convert a bitmap to 32-bit -+ added FI_MaskCombine to combine two 32-bit bitmaps using a alpha mask -+ added FI_AddAlphaMask to enrich a 32-bit bitmap with an alpha mask -+ added FI_SaveTIFF -+ added 16-bit bitmap (565) support to the ConvertToXXX functions. -+ added FI_ConvertTo16Bits (555 and 565) - -June 1th 2000 - 1.3.1 -- removed Standard Template Library (STL) code -* [Jani Kajala] fixed minor bug in FI_LoadTARGA -* [Jani Kajala] fixed some minor bugs in FI_LoadPCX -! streamlined FI_LoadJPEG a little -! FreeImage now uses LibPNG 1.0.6 -! FreeImage now uses LibTIFF 3.5.5 -! FreeImage now uses malloc and free instead of new and delete -+ introduced compiler flags to disable certain features in the DLL -+ added experimental nearest color reduction (FI_ReduceColorsNearestColor) - -April 13th 2000 - 1.3.0 -* fixed some 8 bit PCX files loading incorrectly -* fixed tiny bug in internally used CalculateUsedColors function -- removed FI_SaveXPM. Only BMP is supported now. -- removed Windows dependencies for easier porting -! optimized FI_LoadKOALA a little -! optimized FI_Combine using MMX technology -! FI_Combine now receives an 'unsigned integer' as alpha blend parameter -! FI_InCreaseColors and FI_ReduceColors don't dispose the old bitmap anymore -+ added PNM support (PGM, PPM and PBM; both binary and ascii) -+ [Alexander Dymerets] added FI_EnableMMX and FI_DisableMMX -+ added various effect functions (FI_Blur, FI_Brighten and FI_Crop) - -March 1st 2000 - 1.2.1 -* fixed some 24 bit PCX files loading incorrectly - -February 8th 2000 - 1.2.0 -* fixed last bitmap data block in JPEG files being truncated -* fixed 4/8 bit BMP's incorrectly loading when the palette is smaller than the bitcount predicts -- removed FI_Load. There is no reliable way to identify all image formats -- removed FI_SetJpegDecodeMode. - Mode selection is now done using the 'DataEnum data' parameter of FI_LoadJPEG -! read_proc/write_proc/tell_proc in FreeImageIO now are same as fread/fwrite/ftell -+ added a 'DataEnum data' parameter to all FI_LoadXXX functions. -+ added 16 bit TARGA support -+ added RLE support for TARGA images -+ added FI_GetDIBSize to get the size of a DIB in bytes -+ added Kodak PhotoCD support (Base, Base/4 and Base/16 encoding) -+ added KOALA support -+ added FI_GetFileType. Note: there is no reliable way to identify TARGA, ICO and PCD. Therefore they have been excluded -In KOALA files only the files converted by a C64 emulator can be identified. -+ added FI_Combine to combine two 24-bit bitmaps with (optional) alpha blending - -January 15th 2000 - 1.1.1 -! FI_Copy is now called FI_Clone -+ added FI_ToGrayscale to convert a color bitmap to grayscale -+ added 32 bit TARGA support -+ added FI_IncreaseColors to increase the bitmap bitdepth from 4/8 bit to 24 bit - -January 14th 2000 - 1.1.0 -* FI_MIRROR: fixed nibbles not being mirrored in 4 bit images -* FI_MIRROR: fixed bits not being mirrored in 1 bit images -* fixed improper loading of 1, 4 and 8 bit OS/2 BMP's -* fixed some inconsistensies in the calculation of lines and pitches -* fixed incorrectly loading of Huffman and FAX encoded TIFFs -* fixed LoadTGA accepting 16 bit TGA's and returning corrupt DIB's -- removed LZW support for TIFFs -! FreeImage now uses LibTIFF 3.5.4 -+ added ICO support -+ added overridable file I/O support in the form of FreeImageIO and fi_handle -+ added FI_Load for generic image loading -+ added FI_ReduceColors for color reduction -+ added FI_Copy to copy a bitmap in memory - -January 5th 2000 - 1.0.0 diff --git a/extern/FreeImage/license-fi.txt b/extern/FreeImage/license-fi.txt deleted file mode 100644 index 03b666c..0000000 --- a/extern/FreeImage/license-fi.txt +++ /dev/null @@ -1,142 +0,0 @@ -FreeImage Public License - Version 1.0 ---------------------------------------------- - -1. Definitions. - -1.1. "Contributor" means each entity that creates or contributes to the creation of Modifications. - -1.2. "Contributor Version" means the combination of the Original Code, prior Modifications used by a Contributor, and the Modifications made by that particular Contributor. - -1.3. "Covered Code" means the Original Code or Modifications or the combination of the Original Code and Modifications, in each case including portions thereof. - -1.4. "Electronic Distribution Mechanism" means a mechanism generally accepted in the software development community for the electronic transfer of data. - -1.5. "Executable" means Covered Code in any form other than Source Code. - -1.6. "Initial Developer" means the individual or entity identified as the Initial Developer in the Source Code notice required by Exhibit A. - -1.7. "Larger Work" means a work which combines Covered Code or portions thereof with code not governed by the terms of this License. - -1.8. "License" means this document. - -1.9. "Modifications" means any addition to or deletion from the substance or structure of either the Original Code or any previous Modifications. When Covered Code is released as a series of files, a -Modification is: - -A. Any addition to or deletion from the contents of a file containing Original Code or previous Modifications. - -B. Any new file that contains any part of the Original Code or previous Modifications. - -1.10. "Original Code" means Source Code of computer software code which is described in the Source Code notice required by Exhibit A as Original Code, and which, at the time of its release under this License is not already Covered Code governed by this License. - -1.11. "Source Code" means the preferred form of the Covered Code for making modifications to it, including all modules it contains, plus any associated interface definition files, scripts used to control -compilation and installation of an Executable, or a list of source code differential comparisons against either the Original Code or another well known, available Covered Code of the Contributor's choice. The Source Code can be in a compressed or archival form, provided the appropriate decompression or de-archiving software is widely available for no charge. - -1.12. "You" means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License or a future version of this License issued under Section 6.1. For legal entities, "You" includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the -direction or management of such entity, whether by contract or otherwise, or (b) ownership of fifty percent (50%) or more of the outstanding shares or beneficial ownership of such entity. - -2. Source Code License. - -2.1. The Initial Developer Grant. -The Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims: - -(a) to use, reproduce, modify, display, perform, sublicense and distribute the Original Code (or portions thereof) with or without Modifications, or as part of a Larger Work; and - -(b) under patents now or hereafter owned or controlled by Initial Developer, to make, have made, use and sell ("Utilize") the Original Code (or portions thereof), but solely to the extent that -any such patent is reasonably necessary to enable You to Utilize the Original Code (or portions thereof) and not to any greater extent that may be necessary to Utilize further Modifications or -combinations. - -2.2. Contributor Grant. -Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims: - -(a) to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof) either on an unmodified basis, with other Modifications, as Covered Code or as part of a Larger Work; and - -(b) under patents now or hereafter owned or controlled by Contributor, to Utilize the Contributor Version (or portions thereof), but solely to the extent that any such patent is reasonably necessary to enable You to Utilize the Contributor Version (or portions thereof), and not to any greater extent that -may be necessary to Utilize further Modifications or combinations. - -3. Distribution Obligations. - -3.1. Application of License. -The Modifications which You create or to which You contribute are governed by the terms of this License, including without limitation Section 2.2. The Source Code version of Covered Code may be distributed only under the terms of this License or a future version of this License released under Section 6.1, and You must include a copy of this License with every copy of the Source Code You distribute. You may not offer or impose any terms on any Source Code version that alters or -restricts the applicable version of this License or the recipients' rights hereunder. However, You may include an additional document offering the additional rights described in Section 3.5. - -3.2. Availability of Source Code. -Any Modification which You create or to which You contribute must be made available in Source Code form under the terms of this License either on the same media as an Executable version or via an accepted Electronic Distribution Mechanism to anyone to whom you made an Executable version available; and if made available via Electronic Distribution Mechanism, must remain available for at least twelve (12) months after the date it initially became available, or at least six (6) months after a subsequent version of that particular Modification has been made available to such recipients. You are responsible for ensuring that the Source Code version remains available even if the Electronic Distribution Mechanism is maintained by a third party. - -3.3. Description of Modifications. -You must cause all Covered Code to which you contribute to contain a file documenting the changes You made to create that Covered Code and the date of any change. You must include a prominent statement that the Modification is derived, directly or indirectly, from Original Code provided by the Initial Developer and including the name of the Initial Developer in (a) the Source Code, and (b) in any notice in an Executable version or related documentation in which You describe the origin or ownership of the Covered Code. - -3.4. Intellectual Property Matters - -(a) Third Party Claims. -If You have knowledge that a party claims an intellectual property right in particular functionality or code (or its utilization under this License), you must include a text file with the source code distribution titled "LEGAL" which describes the claim and the party making the claim in sufficient detail that a recipient will know whom to contact. If you obtain such knowledge after You make Your Modification available as described in Section 3.2, You shall promptly modify the LEGAL file in all copies You make -available thereafter and shall take other steps (such as notifying appropriate mailing lists or newsgroups) reasonably calculated to inform those who received the Covered Code that new knowledge has been obtained. - -(b) Contributor APIs. -If Your Modification is an application programming interface and You own or control patents which are reasonably necessary to implement that API, you must also include this information in the LEGAL file. - -3.5. Required Notices. -You must duplicate the notice in Exhibit A in each file of the Source Code, and this License in any documentation for the Source Code, where You describe recipients' rights relating to Covered Code. If You created one or more Modification(s), You may add your name as a Contributor to the notice described in Exhibit A. If it is not possible to put such notice in a particular Source Code file due to its -structure, then you must include such notice in a location (such as a relevant directory file) where a user would be likely to look for such a notice. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Code. However, You may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear than any such warranty, support, indemnity or -liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of -warranty, support, indemnity or liability terms You offer. - -3.6. Distribution of Executable Versions. -You may distribute Covered Code in Executable form only if the requirements of Section 3.1-3.5 have been met for that Covered Code, and if You include a notice stating that the Source Code version of the Covered Code is available under the terms of this License, including a description of how and where You have fulfilled the obligations of Section 3.2. The notice must be conspicuously included in any notice in an Executable version, related documentation or collateral in which You -describe recipients' rights relating to the Covered Code. You may distribute the Executable version of Covered Code under a license of Your choice, which may contain terms different from this License, -provided that You are in compliance with the terms of this License and that the license for the Executable version does not attempt to limit or alter the recipient's rights in the Source Code version from the rights set forth in this License. If You distribute the Executable version under a different license You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer or any Contributor. You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of any such terms You offer. - -3.7. Larger Works. -You may create a Larger Work by combining Covered Code with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Code. - -4. Inability to Comply Due to Statute or Regulation. - -If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Code due to statute or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be included in the LEGAL file described in Section 3.4 and must be included with all distributions of the Source Code. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it. - -5. Application of this License. - -This License applies to code to which the Initial Developer has attached the notice in Exhibit A, and to related Covered Code. - -6. Versions of the License. - -6.1. New Versions. -Floris van den Berg may publish revised and/or new versions of the License from time to time. Each version will be given a distinguishing version number. - -6.2. Effect of New Versions. -Once Covered Code has been published under a particular version of the License, You may always continue to use it under the terms of that version. You may also choose to use such Covered Code under the terms of any subsequent version of the License published by Floris van den Berg -No one other than Floris van den Berg has the right to modify the terms applicable to Covered Code created under this License. - -6.3. Derivative Works. -If you create or use a modified version of this License (which you may only do in order to apply it to code which is not already Covered Code governed by this License), you must (a) rename Your license so that the phrases "FreeImage", `FreeImage Public License", "FIPL", or any confusingly similar phrase do not appear anywhere in your license and (b) otherwise make it clear that your version of the license contains terms which differ from the FreeImage Public License. (Filling in the name of the Initial Developer, Original Code or Contributor in the notice described in Exhibit A shall not of themselves be deemed to be modifications of this License.) - -7. DISCLAIMER OF WARRANTY. - -COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. - -8. TERMINATION. - -This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. All sublicenses to the Covered Code which are properly granted shall survive any termination of this License. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive. - -9. LIMITATION OF LIABILITY. - -UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO YOU OR ANY OTHER PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE -EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THAT EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. - -10. U.S. GOVERNMENT END USERS. - -The Covered Code is a "commercial item," as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and "commercial computer software documentation," as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Code with only those rights set forth herein. - -11. MISCELLANEOUS. - -This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by Dutch law provisions (except to the extent applicable law, if any, provides otherwise), excluding its conflict-of-law provisions. With respect to disputes in which at least one party is a citizen of, or an entity chartered or registered to do business in, the The Netherlands: (a) unless otherwise agreed in writing, all disputes relating to this License (excepting any dispute relating to intellectual property rights) shall be subject to final and binding arbitration, with the losing party paying all costs of arbitration; (b) any arbitration relating to this Agreement shall be held in Almelo, The Netherlands; and (c) any litigation relating to this Agreement shall be subject to the jurisdiction of the court of Almelo, The Netherlands with the losing party responsible for costs, including without limitation, court costs and reasonable attorneys fees and expenses. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License. - -12. RESPONSIBILITY FOR CLAIMS. - -Except in cases where another Contributor has failed to comply with Section 3.4, You are responsible for damages arising, directly or indirectly, out of Your utilization of rights under this License, based -on the number of copies of Covered Code you made available, the revenues you received from utilizing such rights, and other relevant factors. You agree to work with affected parties to distribute -responsibility on an equitable basis. - -EXHIBIT A. - -"The contents of this file are subject to the FreeImage Public License Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://home.wxs.nl/~flvdberg/freeimage-license.txt - -Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. \ No newline at end of file diff --git a/extern/FreeImage/license-gpl.txt b/extern/FreeImage/license-gpl.txt deleted file mode 100644 index 7d1f860..0000000 --- a/extern/FreeImage/license-gpl.txt +++ /dev/null @@ -1,342 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. - - diff --git a/extern/gnuwin32/CMakeLists.txt b/gnuwin32/CMakeLists.txt similarity index 100% rename from extern/gnuwin32/CMakeLists.txt rename to gnuwin32/CMakeLists.txt diff --git a/extern/gnuwin32/bin/jpeg62.dll b/gnuwin32/bin/jpeg62.dll similarity index 100% rename from extern/gnuwin32/bin/jpeg62.dll rename to gnuwin32/bin/jpeg62.dll diff --git a/extern/gnuwin32/bin/libpng12.dll b/gnuwin32/bin/libpng12.dll old mode 100755 new mode 100644 similarity index 100% rename from extern/gnuwin32/bin/libpng12.dll rename to gnuwin32/bin/libpng12.dll diff --git a/extern/gnuwin32/bin/libtiff3.dll b/gnuwin32/bin/libtiff3.dll similarity index 100% rename from extern/gnuwin32/bin/libtiff3.dll rename to gnuwin32/bin/libtiff3.dll diff --git a/extern/gnuwin32/bin/zlib1.dll b/gnuwin32/bin/zlib1.dll similarity index 100% rename from extern/gnuwin32/bin/zlib1.dll rename to gnuwin32/bin/zlib1.dll diff --git a/extern/gnuwin32/include/jconfig.h b/gnuwin32/include/jconfig.h similarity index 100% rename from extern/gnuwin32/include/jconfig.h rename to gnuwin32/include/jconfig.h diff --git a/extern/gnuwin32/include/jerror.h b/gnuwin32/include/jerror.h similarity index 100% rename from extern/gnuwin32/include/jerror.h rename to gnuwin32/include/jerror.h diff --git a/extern/gnuwin32/include/jmorecfg.h b/gnuwin32/include/jmorecfg.h similarity index 100% rename from extern/gnuwin32/include/jmorecfg.h rename to gnuwin32/include/jmorecfg.h diff --git a/extern/gnuwin32/include/jpeglib.h b/gnuwin32/include/jpeglib.h similarity index 100% rename from extern/gnuwin32/include/jpeglib.h rename to gnuwin32/include/jpeglib.h diff --git a/extern/gnuwin32/include/png.h b/gnuwin32/include/png.h similarity index 100% rename from extern/gnuwin32/include/png.h rename to gnuwin32/include/png.h diff --git a/extern/gnuwin32/include/pngconf.h b/gnuwin32/include/pngconf.h similarity index 100% rename from extern/gnuwin32/include/pngconf.h rename to gnuwin32/include/pngconf.h diff --git a/extern/gnuwin32/include/tiff.h b/gnuwin32/include/tiff.h similarity index 100% rename from extern/gnuwin32/include/tiff.h rename to gnuwin32/include/tiff.h diff --git a/extern/gnuwin32/include/tiffconf.h b/gnuwin32/include/tiffconf.h similarity index 100% rename from extern/gnuwin32/include/tiffconf.h rename to gnuwin32/include/tiffconf.h diff --git a/extern/gnuwin32/include/tiffio.h b/gnuwin32/include/tiffio.h similarity index 100% rename from extern/gnuwin32/include/tiffio.h rename to gnuwin32/include/tiffio.h diff --git a/extern/gnuwin32/include/tiffvers.h b/gnuwin32/include/tiffvers.h similarity index 100% rename from extern/gnuwin32/include/tiffvers.h rename to gnuwin32/include/tiffvers.h diff --git a/extern/gnuwin32/include/zconf.h b/gnuwin32/include/zconf.h similarity index 100% rename from extern/gnuwin32/include/zconf.h rename to gnuwin32/include/zconf.h diff --git a/extern/gnuwin32/include/zlib.h b/gnuwin32/include/zlib.h similarity index 100% rename from extern/gnuwin32/include/zlib.h rename to gnuwin32/include/zlib.h diff --git a/extern/gnuwin32/lib/jpeg.def b/gnuwin32/lib/jpeg.def similarity index 100% rename from extern/gnuwin32/lib/jpeg.def rename to gnuwin32/lib/jpeg.def diff --git a/extern/gnuwin32/lib/jpeg.lib b/gnuwin32/lib/jpeg.lib similarity index 100% rename from extern/gnuwin32/lib/jpeg.lib rename to gnuwin32/lib/jpeg.lib diff --git a/extern/gnuwin32/lib/libjpeg.dll.a b/gnuwin32/lib/libjpeg.dll.a similarity index 100% rename from extern/gnuwin32/lib/libjpeg.dll.a rename to gnuwin32/lib/libjpeg.dll.a diff --git a/gnuwin32/lib/libpng.a b/gnuwin32/lib/libpng.a new file mode 100644 index 0000000..e8b58ae Binary files /dev/null and b/gnuwin32/lib/libpng.a differ diff --git a/extern/gnuwin32/lib/libpng.def b/gnuwin32/lib/libpng.def similarity index 100% rename from extern/gnuwin32/lib/libpng.def rename to gnuwin32/lib/libpng.def diff --git a/extern/gnuwin32/lib/libpng.dll.a b/gnuwin32/lib/libpng.dll.a similarity index 100% rename from extern/gnuwin32/lib/libpng.dll.a rename to gnuwin32/lib/libpng.dll.a diff --git a/extern/gnuwin32/lib/libpng.lib b/gnuwin32/lib/libpng.lib similarity index 100% rename from extern/gnuwin32/lib/libpng.lib rename to gnuwin32/lib/libpng.lib diff --git a/extern/gnuwin32/lib/libpng12.def b/gnuwin32/lib/libpng12.def similarity index 100% rename from extern/gnuwin32/lib/libpng12.def rename to gnuwin32/lib/libpng12.def diff --git a/extern/gnuwin32/lib/libpng12.dll.a b/gnuwin32/lib/libpng12.dll.a similarity index 100% rename from extern/gnuwin32/lib/libpng12.dll.a rename to gnuwin32/lib/libpng12.dll.a diff --git a/extern/gnuwin32/lib/libtiff.def b/gnuwin32/lib/libtiff.def similarity index 100% rename from extern/gnuwin32/lib/libtiff.def rename to gnuwin32/lib/libtiff.def diff --git a/extern/gnuwin32/lib/libtiff.dll.a b/gnuwin32/lib/libtiff.dll.a similarity index 100% rename from extern/gnuwin32/lib/libtiff.dll.a rename to gnuwin32/lib/libtiff.dll.a diff --git a/gnuwin32/lib/libz.a b/gnuwin32/lib/libz.a new file mode 100644 index 0000000..876f898 Binary files /dev/null and b/gnuwin32/lib/libz.a differ diff --git a/extern/gnuwin32/lib/libz.dll.a b/gnuwin32/lib/libz.dll.a similarity index 100% rename from extern/gnuwin32/lib/libz.dll.a rename to gnuwin32/lib/libz.dll.a diff --git a/extern/gnuwin32/lib/tiff.lib b/gnuwin32/lib/tiff.lib similarity index 100% rename from extern/gnuwin32/lib/tiff.lib rename to gnuwin32/lib/tiff.lib diff --git a/extern/gnuwin32/lib/zlib.def b/gnuwin32/lib/zlib.def similarity index 100% rename from extern/gnuwin32/lib/zlib.def rename to gnuwin32/lib/zlib.def diff --git a/extern/gnuwin32/lib/zlib.lib b/gnuwin32/lib/zlib.lib similarity index 100% rename from extern/gnuwin32/lib/zlib.lib rename to gnuwin32/lib/zlib.lib diff --git a/project/vc8/nvassemble/nvassemble.vcproj b/project/vc8/nvassemble/nvassemble.vcproj index 0d4892c..fbc8022 100644 --- a/project/vc8/nvassemble/nvassemble.vcproj +++ b/project/vc8/nvassemble/nvassemble.vcproj @@ -61,10 +61,10 @@ /> @@ -274,8 +275,9 @@ /> diff --git a/project/vc8/nvcompress/nvcompress.vcproj b/project/vc8/nvcompress/nvcompress.vcproj index b7f3e54..9058e14 100644 --- a/project/vc8/nvcompress/nvcompress.vcproj +++ b/project/vc8/nvcompress/nvcompress.vcproj @@ -64,10 +64,10 @@ /> - - - - diff --git a/project/vc8/nvddsinfo/nvddsinfo.vcproj b/project/vc8/nvddsinfo/nvddsinfo.vcproj index 80a7aff..a16c15b 100644 --- a/project/vc8/nvddsinfo/nvddsinfo.vcproj +++ b/project/vc8/nvddsinfo/nvddsinfo.vcproj @@ -60,10 +60,10 @@ /> @@ -273,8 +274,9 @@ /> diff --git a/project/vc8/nvdecompress/nvdecompress.vcproj b/project/vc8/nvdecompress/nvdecompress.vcproj index cd889ce..a74b828 100644 --- a/project/vc8/nvdecompress/nvdecompress.vcproj +++ b/project/vc8/nvdecompress/nvdecompress.vcproj @@ -64,10 +64,10 @@ /> - - @@ -331,10 +327,6 @@ RelativePath="..\..\..\src\nvimage\ColorBlock.h" > - - diff --git a/project/vc8/nvimgdiff/nvimgdiff.vcproj b/project/vc8/nvimgdiff/nvimgdiff.vcproj index e4d63dc..3441505 100644 --- a/project/vc8/nvimgdiff/nvimgdiff.vcproj +++ b/project/vc8/nvimgdiff/nvimgdiff.vcproj @@ -64,10 +64,10 @@ /> @@ -701,7 +701,7 @@ > @@ -711,7 +711,7 @@ > @@ -721,7 +721,7 @@ > diff --git a/project/vc8/nvzoom/nvzoom.vcproj b/project/vc8/nvzoom/nvzoom.vcproj index 1f87f5a..e346ead 100644 --- a/project/vc8/nvzoom/nvzoom.vcproj +++ b/project/vc8/nvzoom/nvzoom.vcproj @@ -64,10 +64,10 @@ /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/project/vc9/Nvidia.TextureTools/Nvidia.TextureTools.csproj b/project/vc9/Nvidia.TextureTools/Nvidia.TextureTools.csproj deleted file mode 100644 index e52efae..0000000 --- a/project/vc9/Nvidia.TextureTools/Nvidia.TextureTools.csproj +++ /dev/null @@ -1,52 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {CAB55C39-8FA9-4912-98D9-E52669C8911D} - Library - Properties - Nvidia.TextureTools - Nvidia.TextureTools - - - 2.0 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - \ No newline at end of file diff --git a/project/vc9/Nvidia.TextureTools/Properties/AssemblyInfo.cs b/project/vc9/Nvidia.TextureTools/Properties/AssemblyInfo.cs deleted file mode 100644 index ecd652e..0000000 --- a/project/vc9/Nvidia.TextureTools/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Nvidia.TextureTools")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("NVIDIA Corporation")] -[assembly: AssemblyProduct("Nvidia.TextureTools")] -[assembly: AssemblyCopyright("Copyright © NVIDIA 2008")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("5fa03fb3-b7a3-4ba8-90e7-545929731356")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/project/vc9/Nvidia.TextureTools/TextureTools.cs b/project/vc9/Nvidia.TextureTools/TextureTools.cs deleted file mode 100644 index 74cdc9b..0000000 --- a/project/vc9/Nvidia.TextureTools/TextureTools.cs +++ /dev/null @@ -1,526 +0,0 @@ -using System; -using System.Security; -using System.Runtime.InteropServices; - -namespace Nvidia.TextureTools -{ - #region Enums - - #region public enum Format - /// - /// Compression format. - /// - public enum Format - { - // No compression. - RGB, - RGBA = RGB, - - // DX9 formats. - DXT1, - DXT1a, - DXT3, - DXT5, - DXT5n, - - // DX10 formats. - BC1 = DXT1, - BC1a = DXT1a, - BC2 = DXT3, - BC3 = DXT5, - BC3n = DXT5n, - BC4, - BC5, - } - #endregion - - #region public enum Quality - /// - /// Quality modes. - /// - public enum Quality - { - Fastest, - Normal, - Production, - Highest, - } - #endregion - - #region public enum WrapMode - /// - /// Wrap modes. - /// - public enum WrapMode - { - Clamp, - Repeat, - Mirror, - } - #endregion - - #region public enum TextureType - /// - /// Texture types. - /// - public enum TextureType - { - Texture2D, - TextureCube, - } - #endregion - - #region public enum InputFormat - /// - /// Input formats. - /// - public enum InputFormat - { - BGRA_8UB - } - #endregion - - #region public enum MipmapFilter - /// - /// Mipmap downsampling filters. - /// - public enum MipmapFilter - { - Box, - Triangle, - Kaiser - } - #endregion - - #region public enum ColorTransform - /// - /// Color transformation. - /// - public enum ColorTransform - { - None, - Linear - } - #endregion - - #region public enum RoundMode - /// - /// Extents rounding mode. - /// - public enum RoundMode - { - None, - ToNextPowerOfTwo, - ToNearestPowerOfTwo, - ToPreviousPowerOfTwo - } - #endregion - - #region public enum AlphaMode - /// - /// Alpha mode. - /// - public enum AlphaMode - { - None, - Transparency, - Premultiplied - } - #endregion - - #region public enum Error - /// - /// Error codes. - /// - public enum Error - { - InvalidInput, - UserInterruption, - UnsupportedFeature, - CudaError, - Unknown, - FileOpen, - FileWrite, - } - #endregion - - #endregion - - #region public class InputOptions - /// - /// Input options. - /// - public class InputOptions - { - #region Bindings - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static IntPtr nvttCreateInputOptions(); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static void nvttDestroyInputOptions(IntPtr inputOptions); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static void nvttSetInputOptionsTextureLayout(IntPtr inputOptions, TextureType type, int w, int h, int d); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static void nvttResetInputOptionsTextureLayout(IntPtr inputOptions); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static bool nvttSetInputOptionsMipmapData(IntPtr inputOptions, IntPtr data, int w, int h, int d, int face, int mipmap); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static void nvttSetInputOptionsFormat(IntPtr inputOptions, InputFormat format); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static void nvttSetInputOptionsAlphaMode(IntPtr inputOptions, AlphaMode alphaMode); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static void nvttSetInputOptionsGamma(IntPtr inputOptions, float inputGamma, float outputGamma); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static void nvttSetInputOptionsWrapMode(IntPtr inputOptions, WrapMode mode); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static void nvttSetInputOptionsMipmapFilter(IntPtr inputOptions, MipmapFilter filter); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static void nvttSetInputOptionsMipmapGeneration(IntPtr inputOptions, bool generateMipmaps, int maxLevel); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static void nvttSetInputOptionsKaiserParameters(IntPtr inputOptions, float width, float alpha, float stretch); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static void nvttSetInputOptionsNormalMap(IntPtr inputOptions, bool b); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static void nvttSetInputOptionsConvertToNormalMap(IntPtr inputOptions, bool convert); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static void nvttSetInputOptionsHeightEvaluation(IntPtr inputOptions, float redScale, float greenScale, float blueScale, float alphaScale); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static void nvttSetInputOptionsNormalFilter(IntPtr inputOptions, float small, float medium, float big, float large); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static void nvttSetInputOptionsNormalizeMipmaps(IntPtr inputOptions, bool b); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static void nvttSetInputOptionsColorTransform(IntPtr inputOptions, ColorTransform t); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static void nvttSetInputOptionsLinearTransfrom(IntPtr inputOptions, int channel, float w0, float w1, float w2, float w3); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static void nvttSetInputOptionsMaxExtents(IntPtr inputOptions, int d); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static void nvttSetInputOptionsRoundMode(IntPtr inputOptions, RoundMode mode); - #endregion - - internal IntPtr options; - - public InputOptions() - { - options = nvttCreateInputOptions(); - } - ~InputOptions() - { - nvttDestroyInputOptions(options); - } - - public void SetTextureLayout(TextureType type, int w, int h, int d) - { - nvttSetInputOptionsTextureLayout(options, type, w, h, d); - } - public void ResetTextureLayout() - { - nvttResetInputOptionsTextureLayout(options); - } - - public void SetMipmapData(IntPtr data, int width, int height, int depth, int face, int mipmap) - { - nvttSetInputOptionsMipmapData(options, data, width, height, depth, face, mipmap); - } - - public void SetFormat(InputFormat format) - { - nvttSetInputOptionsFormat(options, format); - } - - public void SetAlphaMode(AlphaMode alphaMode) - { - nvttSetInputOptionsAlphaMode(options, alphaMode); - } - - public void SetGamma(float inputGamma, float outputGamma) - { - nvttSetInputOptionsGamma(options, inputGamma, outputGamma); - } - - public void SetWrapMode(WrapMode wrapMode) - { - nvttSetInputOptionsWrapMode(options, wrapMode); - } - - public void SetMipmapFilter(MipmapFilter filter) - { - nvttSetInputOptionsMipmapFilter(options, filter); - } - - public void SetMipmapGeneration(bool enabled) - { - nvttSetInputOptionsMipmapGeneration(options, enabled, -1); - } - - public void SetMipmapGeneration(bool enabled, int maxLevel) - { - nvttSetInputOptionsMipmapGeneration(options, enabled, maxLevel); - } - - public void SetKaiserParameters(float width, float alpha, float stretch) - { - nvttSetInputOptionsKaiserParameters(options, width, alpha, stretch); - } - - public void SetNormalMap(bool b) - { - nvttSetInputOptionsNormalMap(options, b); - } - - public void SetConvertToNormalMap(bool convert) - { - nvttSetInputOptionsConvertToNormalMap(options, convert); - } - - public void SetHeightEvaluation(float redScale, float greenScale, float blueScale, float alphaScale) - { - nvttSetInputOptionsHeightEvaluation(options, redScale, greenScale, blueScale, alphaScale); - } - - public void SetNormalFilter(float small, float medium, float big, float large) - { - nvttSetInputOptionsNormalFilter(options, small, medium, big, large); - } - - public void SetNormalizeMipmaps(bool b) - { - nvttSetInputOptionsNormalizeMipmaps(options, b); - } - - public void SetColorTransform(ColorTransform t) - { - nvttSetInputOptionsColorTransform(options, t); - } - - public void SetLinearTransfrom(int channel, float w0, float w1, float w2, float w3) - { - nvttSetInputOptionsLinearTransfrom(options, channel, w0, w1, w2, w3); - } - - public void SetMaxExtents(int dim) - { - nvttSetInputOptionsMaxExtents(options, dim); - } - - public void SetRoundMode(RoundMode mode) - { - nvttSetInputOptionsRoundMode(options, mode); - } - } - #endregion - - #region public class CompressionOptions - /// - /// Compression options. - /// - public class CompressionOptions - { - #region Bindings - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static IntPtr nvttCreateCompressionOptions(); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static void nvttDestroyCompressionOptions(IntPtr compressionOptions); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static void nvttSetCompressionOptionsFormat(IntPtr compressionOptions, Format format); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static void nvttSetCompressionOptionsQuality(IntPtr compressionOptions, Quality quality); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static void nvttSetCompressionOptionsColorWeights(IntPtr compressionOptions, float red, float green, float blue, float alpha); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static void nvttSetCompressionOptionsPixelFormat(IntPtr compressionOptions, uint bitcount, uint rmask, uint gmask, uint bmask, uint amask); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static void nvttSetCompressionOptionsQuantization(IntPtr compressionOptions, bool colorDithering, bool alphaDithering, bool binaryAlpha, int alphaThreshold); - #endregion - - internal IntPtr options; - - public CompressionOptions() - { - options = nvttCreateCompressionOptions(); - } - ~CompressionOptions() - { - nvttDestroyCompressionOptions(options); - } - - public void SetFormat(Format format) - { - nvttSetCompressionOptionsFormat(options, format); - } - - public void SetQuality(Quality quality) - { - nvttSetCompressionOptionsQuality(options, quality); - } - - public void SetColorWeights(float red, float green, float blue) - { - nvttSetCompressionOptionsColorWeights(options, red, green, blue, 1.0f); - } - - public void SetColorWeights(float red, float green, float blue, float alpha) - { - nvttSetCompressionOptionsColorWeights(options, red, green, blue, alpha); - } - - public void SetPixelFormat(uint bitcount, uint rmask, uint gmask, uint bmask, uint amask) - { - nvttSetCompressionOptionsPixelFormat(options, bitcount, rmask, gmask, bmask, amask); - } - - public void SetQuantization(bool colorDithering, bool alphaDithering, bool binaryAlpha) - { - nvttSetCompressionOptionsQuantization(options, colorDithering, alphaDithering, binaryAlpha, 127); - } - - public void SetQuantization(bool colorDithering, bool alphaDithering, bool binaryAlpha, int alphaThreshold) - { - nvttSetCompressionOptionsQuantization(options, colorDithering, alphaDithering, binaryAlpha, alphaThreshold); - } - } - #endregion - - #region public class OutputOptions - /// - /// Output options. - /// - public class OutputOptions - { - #region Delegates - public delegate void ErrorHandler(Error error); - private delegate void WriteDataDelegate(IntPtr data, int size); - private delegate void ImageDelegate(int size, int width, int height, int depth, int face, int miplevel); - #endregion - - #region Bindings - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static IntPtr nvttCreateOutputOptions(); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static void nvttDestroyOutputOptions(IntPtr outputOptions); - - [DllImport("nvtt", CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity] - private extern static void nvttSetOutputOptionsFileName(IntPtr outputOptions, string fileName); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static void nvttSetOutputOptionsErrorHandler(IntPtr outputOptions, ErrorHandler errorHandler); - - private void ErrorCallback(Error error) - { - if (Error != null) Error(error); - } - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static void nvttSetOutputOptionsOutputHeader(IntPtr outputOptions, bool b); - - //[DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - //private extern static void nvttSetOutputOptionsOutputHandler(IntPtr outputOptions, WriteDataDelegate writeData, ImageDelegate image); - - #endregion - - internal IntPtr options; - - public OutputOptions() - { - options = nvttCreateOutputOptions(); - nvttSetOutputOptionsErrorHandler(options, new ErrorHandler(ErrorCallback)); - } - ~OutputOptions() - { - nvttDestroyOutputOptions(options); - } - - public void SetFileName(string fileName) - { - nvttSetOutputOptionsFileName(options, fileName); - } - - public event ErrorHandler Error; - - public void SetOutputHeader(bool b) - { - nvttSetOutputOptionsOutputHeader(options, b); - } - - // @@ Add OutputHandler interface. - } - #endregion - - #region public static class Compressor - public class Compressor - { - #region Bindings - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static IntPtr nvttCreateCompressor(); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static void nvttDestroyCompressor(IntPtr compressor); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static bool nvttCompress(IntPtr compressor, IntPtr inputOptions, IntPtr compressionOptions, IntPtr outputOptions); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private extern static int nvttEstimateSize(IntPtr compressor, IntPtr inputOptions, IntPtr compressionOptions); - - [DllImport("nvtt"), SuppressUnmanagedCodeSecurity] - private static extern IntPtr nvttErrorString(Error error); - - #endregion - - internal IntPtr compressor; - - public Compressor() - { - compressor = nvttCreateCompressor(); - } - - ~Compressor() - { - nvttDestroyCompressor(compressor); - } - - public bool Compress(InputOptions input, CompressionOptions compression, OutputOptions output) - { - return nvttCompress(compressor, input.options, compression.options, output.options); - } - - public int EstimateSize(InputOptions input, CompressionOptions compression) - { - return nvttEstimateSize(compressor, input.options, compression.options); - } - - public static string ErrorString(Error error) - { - return Marshal.PtrToStringAnsi(nvttErrorString(error)); - } - - } - #endregion - -} // Nvidia.TextureTools namespace diff --git a/project/vc9/nvassemble/nvassemble.rc b/project/vc9/nvassemble/nvassemble.rc deleted file mode 100644 index 842ded1..0000000 Binary files a/project/vc9/nvassemble/nvassemble.rc and /dev/null differ diff --git a/project/vc9/nvassemble/nvassemble.vcproj b/project/vc9/nvassemble/nvassemble.vcproj deleted file mode 100644 index 9d7ed90..0000000 --- a/project/vc9/nvassemble/nvassemble.vcproj +++ /dev/null @@ -1,349 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/project/vc9/nvassemble/nvidia.ico b/project/vc9/nvassemble/nvidia.ico deleted file mode 100644 index 6aa721e..0000000 Binary files a/project/vc9/nvassemble/nvidia.ico and /dev/null differ diff --git a/project/vc9/nvassemble/resource.h b/project/vc9/nvassemble/resource.h deleted file mode 100644 index e765787..0000000 --- a/project/vc9/nvassemble/resource.h +++ /dev/null @@ -1,16 +0,0 @@ -//{{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 diff --git a/project/vc9/nvcompress/nvcompress.rc b/project/vc9/nvcompress/nvcompress.rc deleted file mode 100644 index 842ded1..0000000 Binary files a/project/vc9/nvcompress/nvcompress.rc and /dev/null differ diff --git a/project/vc9/nvcompress/nvcompress.vcproj b/project/vc9/nvcompress/nvcompress.vcproj deleted file mode 100644 index f65e39f..0000000 --- a/project/vc9/nvcompress/nvcompress.vcproj +++ /dev/null @@ -1,673 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/project/vc9/nvcompress/nvidia.ico b/project/vc9/nvcompress/nvidia.ico deleted file mode 100644 index 6aa721e..0000000 Binary files a/project/vc9/nvcompress/nvidia.ico and /dev/null differ diff --git a/project/vc9/nvcompress/resource.h b/project/vc9/nvcompress/resource.h deleted file mode 100644 index e765787..0000000 --- a/project/vc9/nvcompress/resource.h +++ /dev/null @@ -1,16 +0,0 @@ -//{{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 diff --git a/project/vc9/nvconfig.h b/project/vc9/nvconfig.h deleted file mode 100644 index ffe00a1..0000000 --- a/project/vc9/nvconfig.h +++ /dev/null @@ -1,16 +0,0 @@ -#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 diff --git a/project/vc9/nvcore/nvcore.vcproj b/project/vc9/nvcore/nvcore.vcproj deleted file mode 100644 index a4f23d0..0000000 --- a/project/vc9/nvcore/nvcore.vcproj +++ /dev/null @@ -1,347 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/project/vc9/nvddsinfo/nvddsinfo.rc b/project/vc9/nvddsinfo/nvddsinfo.rc deleted file mode 100644 index 842ded1..0000000 Binary files a/project/vc9/nvddsinfo/nvddsinfo.rc and /dev/null differ diff --git a/project/vc9/nvddsinfo/nvddsinfo.vcproj b/project/vc9/nvddsinfo/nvddsinfo.vcproj deleted file mode 100644 index 56a04af..0000000 --- a/project/vc9/nvddsinfo/nvddsinfo.vcproj +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/project/vc9/nvddsinfo/nvidia.ico b/project/vc9/nvddsinfo/nvidia.ico deleted file mode 100644 index 6aa721e..0000000 Binary files a/project/vc9/nvddsinfo/nvidia.ico and /dev/null differ diff --git a/project/vc9/nvddsinfo/resource.h b/project/vc9/nvddsinfo/resource.h deleted file mode 100644 index e765787..0000000 --- a/project/vc9/nvddsinfo/resource.h +++ /dev/null @@ -1,16 +0,0 @@ -//{{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 diff --git a/project/vc9/nvdecompress/nvdecompress.rc b/project/vc9/nvdecompress/nvdecompress.rc deleted file mode 100644 index 842ded1..0000000 Binary files a/project/vc9/nvdecompress/nvdecompress.rc and /dev/null differ diff --git a/project/vc9/nvdecompress/nvdecompress.vcproj b/project/vc9/nvdecompress/nvdecompress.vcproj deleted file mode 100644 index e31eb93..0000000 --- a/project/vc9/nvdecompress/nvdecompress.vcproj +++ /dev/null @@ -1,374 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/project/vc9/nvdecompress/nvidia.ico b/project/vc9/nvdecompress/nvidia.ico deleted file mode 100644 index 6aa721e..0000000 Binary files a/project/vc9/nvdecompress/nvidia.ico and /dev/null differ diff --git a/project/vc9/nvdecompress/resource.h b/project/vc9/nvdecompress/resource.h deleted file mode 100644 index e765787..0000000 --- a/project/vc9/nvdecompress/resource.h +++ /dev/null @@ -1,16 +0,0 @@ -//{{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 diff --git a/project/vc9/nvimage/nvimage.vcproj b/project/vc9/nvimage/nvimage.vcproj deleted file mode 100644 index 267e85e..0000000 --- a/project/vc9/nvimage/nvimage.vcproj +++ /dev/null @@ -1,379 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/project/vc9/nvimgdiff/nvidia.ico b/project/vc9/nvimgdiff/nvidia.ico deleted file mode 100644 index 6aa721e..0000000 Binary files a/project/vc9/nvimgdiff/nvidia.ico and /dev/null differ diff --git a/project/vc9/nvimgdiff/nvimgdiff.rc b/project/vc9/nvimgdiff/nvimgdiff.rc deleted file mode 100644 index 842ded1..0000000 Binary files a/project/vc9/nvimgdiff/nvimgdiff.rc and /dev/null differ diff --git a/project/vc9/nvimgdiff/nvimgdiff.vcproj b/project/vc9/nvimgdiff/nvimgdiff.vcproj deleted file mode 100644 index 72b9bdd..0000000 --- a/project/vc9/nvimgdiff/nvimgdiff.vcproj +++ /dev/null @@ -1,374 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/project/vc9/nvimgdiff/resource.h b/project/vc9/nvimgdiff/resource.h deleted file mode 100644 index e765787..0000000 --- a/project/vc9/nvimgdiff/resource.h +++ /dev/null @@ -1,16 +0,0 @@ -//{{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 diff --git a/project/vc9/nvmath/nvmath.vcproj b/project/vc9/nvmath/nvmath.vcproj deleted file mode 100644 index 3746bb8..0000000 --- a/project/vc9/nvmath/nvmath.vcproj +++ /dev/null @@ -1,311 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/project/vc9/nvtt.sln b/project/vc9/nvtt.sln deleted file mode 100644 index 8b54776..0000000 --- a/project/vc9/nvtt.sln +++ /dev/null @@ -1,342 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -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 - {50C465FE-B308-42BC-894D-89484482AF06} = {50C465FE-B308-42BC-894D-89484482AF06} - {4046F392-A18B-4C66-9639-3EABFFF5D531} = {4046F392-A18B-4C66-9639-3EABFFF5D531} - {1AEB7681-57D8-48EE-813D-5C41CC38B647} = {1AEB7681-57D8-48EE-813D-5C41CC38B647} - {F143D180-D4C4-4037-B3DE-BE89A21C8D1D} = {F143D180-D4C4-4037-B3DE-BE89A21C8D1D} - 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 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvddsinfo", "nvddsinfo\nvddsinfo.vcproj", "{841B73C5-C679-4EEF-A50A-7D6106642B49}" - 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} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvdecompress", "nvdecompress\nvdecompress.vcproj", "{75A0527D-BFC9-49C3-B46B-CD1A901D5927}" - 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} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvimgdiff", "nvimgdiff\nvimgdiff.vcproj", "{05A59E8B-EA70-4F22-89E8-E0927BA13064}" - 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} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvassemble", "nvassemble\nvassemble.vcproj", "{3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}" - 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} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvzoom", "nvzoom\nvzoom.vcproj", "{51999D3E-EF22-4BDD-965F-4201034D3DCE}" - 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} - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nvidia.TextureTools", "Nvidia.TextureTools\Nvidia.TextureTools.csproj", "{CAB55C39-8FA9-4912-98D9-E52669C8911D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stress", "stress\stress.vcproj", "{317B694E-B5C1-42A6-956F-FC12B69175A6}" - ProjectSection(ProjectDependencies) = postProject - {1AEB7681-57D8-48EE-813D-5C41CC38B647} = {1AEB7681-57D8-48EE-813D-5C41CC38B647} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug (no cuda)|Any CPU = Debug (no cuda)|Any CPU - Debug (no cuda)|Win32 = Debug (no cuda)|Win32 - Debug (no cuda)|x64 = Debug (no cuda)|x64 - Debug|Any CPU = Debug|Any CPU - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release (no cuda)|Any CPU = Release (no cuda)|Any CPU - Release (no cuda)|Win32 = Release (no cuda)|Win32 - Release (no cuda)|x64 = Release (no cuda)|x64 - Release|Any CPU = Release|Any CPU - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Debug (no cuda)|Any CPU.ActiveCfg = Debug (no cuda)|x64 - {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|Any CPU.ActiveCfg = Debug|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}.Debug|x64.Build.0 = Debug|x64 - {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release (no cuda)|Any CPU.ActiveCfg = Release (no cuda)|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|Any CPU.ActiveCfg = Release|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 - {1AEB7681-57D8-48EE-813D-5C41CC38B647}.Release|x64.Build.0 = Release|x64 - {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Debug (no cuda)|Any CPU.ActiveCfg = Debug (no cuda)|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|Any CPU.ActiveCfg = Debug|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}.Debug|x64.Build.0 = Debug|x64 - {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release (no cuda)|Any CPU.ActiveCfg = Release (no cuda)|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|Any CPU.ActiveCfg = Release|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 - {88079E38-83AA-4E8A-B18A-66A78D1B058B}.Release|x64.Build.0 = Release|x64 - {4046F392-A18B-4C66-9639-3EABFFF5D531}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|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|Any CPU.ActiveCfg = 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}.Debug|x64.Build.0 = Debug|x64 - {4046F392-A18B-4C66-9639-3EABFFF5D531}.Release (no cuda)|Any CPU.ActiveCfg = Release|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|Any CPU.ActiveCfg = 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 - {4046F392-A18B-4C66-9639-3EABFFF5D531}.Release|x64.Build.0 = Release|x64 - {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|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|Any CPU.ActiveCfg = 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}.Debug|x64.Build.0 = Debug|x64 - {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release (no cuda)|Any CPU.ActiveCfg = Release|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|Any CPU.ActiveCfg = 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 - {F143D180-D4C4-4037-B3DE-BE89A21C8D1D}.Release|x64.Build.0 = Release|x64 - {50C465FE-B308-42BC-894D-89484482AF06}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|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|Any CPU.ActiveCfg = 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}.Debug|x64.Build.0 = Debug|x64 - {50C465FE-B308-42BC-894D-89484482AF06}.Release (no cuda)|Any CPU.ActiveCfg = Release|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|Any CPU.ActiveCfg = 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 - {50C465FE-B308-42BC-894D-89484482AF06}.Release|x64.Build.0 = Release|x64 - {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|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|Any CPU.ActiveCfg = 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}.Debug|x64.Build.0 = Debug|x64 - {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release (no cuda)|Any CPU.ActiveCfg = Release|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|Any CPU.ActiveCfg = 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 - {CE017322-01FC-4851-9C8B-64E9A8E26C38}.Release|x64.Build.0 = Release|x64 - {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|x64 - {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32 - {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug (no cuda)|Win32.Build.0 = Debug|Win32 - {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug (no cuda)|x64.ActiveCfg = Debug|x64 - {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug (no cuda)|x64.Build.0 = Debug|x64 - {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug|Any CPU.ActiveCfg = Debug|x64 - {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug|Win32.ActiveCfg = Debug|Win32 - {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug|Win32.Build.0 = Debug|Win32 - {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug|x64.ActiveCfg = Debug|x64 - {841B73C5-C679-4EEF-A50A-7D6106642B49}.Debug|x64.Build.0 = Debug|x64 - {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release (no cuda)|Any CPU.ActiveCfg = Release|x64 - {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release (no cuda)|Win32.ActiveCfg = Release|Win32 - {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release (no cuda)|Win32.Build.0 = Release|Win32 - {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release (no cuda)|x64.ActiveCfg = Release|x64 - {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release (no cuda)|x64.Build.0 = Release|x64 - {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release|Any CPU.ActiveCfg = Release|x64 - {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release|Win32.ActiveCfg = Release|Win32 - {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release|Win32.Build.0 = Release|Win32 - {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release|x64.ActiveCfg = Release|x64 - {841B73C5-C679-4EEF-A50A-7D6106642B49}.Release|x64.Build.0 = Release|x64 - {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|x64 - {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32 - {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug (no cuda)|Win32.Build.0 = Debug|Win32 - {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug (no cuda)|x64.ActiveCfg = Debug|x64 - {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug (no cuda)|x64.Build.0 = Debug|x64 - {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug|Any CPU.ActiveCfg = Debug|x64 - {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug|Win32.ActiveCfg = Debug|Win32 - {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug|Win32.Build.0 = Debug|Win32 - {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug|x64.ActiveCfg = Debug|x64 - {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Debug|x64.Build.0 = Debug|x64 - {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release (no cuda)|Any CPU.ActiveCfg = Release|x64 - {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release (no cuda)|Win32.ActiveCfg = Release|Win32 - {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release (no cuda)|Win32.Build.0 = Release|Win32 - {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release (no cuda)|x64.ActiveCfg = Release|x64 - {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release (no cuda)|x64.Build.0 = Release|x64 - {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release|Any CPU.ActiveCfg = Release|x64 - {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release|Win32.ActiveCfg = Release|Win32 - {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release|Win32.Build.0 = Release|Win32 - {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release|x64.ActiveCfg = Release|x64 - {75A0527D-BFC9-49C3-B46B-CD1A901D5927}.Release|x64.Build.0 = Release|x64 - {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|x64 - {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32 - {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug (no cuda)|Win32.Build.0 = Debug|Win32 - {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug (no cuda)|x64.ActiveCfg = Debug|x64 - {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug (no cuda)|x64.Build.0 = Debug|x64 - {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug|Any CPU.ActiveCfg = Debug|x64 - {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug|Win32.ActiveCfg = Debug|Win32 - {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug|Win32.Build.0 = Debug|Win32 - {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug|x64.ActiveCfg = Debug|x64 - {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Debug|x64.Build.0 = Debug|x64 - {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release (no cuda)|Any CPU.ActiveCfg = Release|x64 - {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release (no cuda)|Win32.ActiveCfg = Release|Win32 - {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release (no cuda)|Win32.Build.0 = Release|Win32 - {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release (no cuda)|x64.ActiveCfg = Release|x64 - {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release (no cuda)|x64.Build.0 = Release|x64 - {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release|Any CPU.ActiveCfg = Release|x64 - {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release|Win32.ActiveCfg = Release|Win32 - {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release|Win32.Build.0 = Release|Win32 - {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release|x64.ActiveCfg = Release|x64 - {05A59E8B-EA70-4F22-89E8-E0927BA13064}.Release|x64.Build.0 = Release|x64 - {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|x64 - {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32 - {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug (no cuda)|Win32.Build.0 = Debug|Win32 - {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug (no cuda)|x64.ActiveCfg = Debug|x64 - {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug (no cuda)|x64.Build.0 = Debug|x64 - {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug|Any CPU.ActiveCfg = Debug|x64 - {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug|Win32.ActiveCfg = Debug|Win32 - {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug|Win32.Build.0 = Debug|Win32 - {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug|x64.ActiveCfg = Debug|x64 - {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Debug|x64.Build.0 = Debug|x64 - {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release (no cuda)|Any CPU.ActiveCfg = Release|x64 - {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release (no cuda)|Win32.ActiveCfg = Release|Win32 - {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release (no cuda)|Win32.Build.0 = Release|Win32 - {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release (no cuda)|x64.ActiveCfg = Release|x64 - {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release (no cuda)|x64.Build.0 = Release|x64 - {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release|Any CPU.ActiveCfg = Release|x64 - {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release|Win32.ActiveCfg = Release|Win32 - {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release|Win32.Build.0 = Release|Win32 - {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release|x64.ActiveCfg = Release|x64 - {3BC6D760-91E8-4FFB-BD0E-F86F367AD8EA}.Release|x64.Build.0 = Release|x64 - {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|x64 - {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32 - {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug (no cuda)|Win32.Build.0 = Debug|Win32 - {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug (no cuda)|x64.ActiveCfg = Debug|x64 - {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug (no cuda)|x64.Build.0 = Debug|x64 - {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug|Any CPU.ActiveCfg = Debug|x64 - {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug|Win32.ActiveCfg = Debug|Win32 - {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug|Win32.Build.0 = Debug|Win32 - {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug|x64.ActiveCfg = Debug|x64 - {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Debug|x64.Build.0 = Debug|x64 - {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release (no cuda)|Any CPU.ActiveCfg = Release|x64 - {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release (no cuda)|Win32.ActiveCfg = Release|Win32 - {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release (no cuda)|Win32.Build.0 = Release|Win32 - {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release (no cuda)|x64.ActiveCfg = Release|x64 - {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release (no cuda)|x64.Build.0 = Release|x64 - {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release|Any CPU.ActiveCfg = Release|x64 - {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release|Win32.ActiveCfg = Release|Win32 - {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release|Win32.Build.0 = Release|Win32 - {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release|x64.ActiveCfg = Release|x64 - {51999D3E-EF22-4BDD-965F-4201034D3DCE}.Release|x64.Build.0 = Release|x64 - {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|Any CPU - {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Debug (no cuda)|Any CPU.Build.0 = Debug|Any CPU - {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Debug (no cuda)|Win32.ActiveCfg = Debug|Any CPU - {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Debug (no cuda)|x64.ActiveCfg = Debug|Any CPU - {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Debug|Win32.ActiveCfg = Debug|Any CPU - {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Debug|x64.ActiveCfg = Debug|Any CPU - {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Release (no cuda)|Any CPU.ActiveCfg = Release|Any CPU - {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Release (no cuda)|Any CPU.Build.0 = Release|Any CPU - {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Release (no cuda)|Win32.ActiveCfg = Release|Any CPU - {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Release (no cuda)|x64.ActiveCfg = Release|Any CPU - {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Release|Any CPU.Build.0 = Release|Any CPU - {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Release|Win32.ActiveCfg = Release|Any CPU - {CAB55C39-8FA9-4912-98D9-E52669C8911D}.Release|x64.ActiveCfg = Release|Any CPU - {317B694E-B5C1-42A6-956F-FC12B69175A6}.Debug (no cuda)|Any CPU.ActiveCfg = Debug|Win32 - {317B694E-B5C1-42A6-956F-FC12B69175A6}.Debug (no cuda)|Win32.ActiveCfg = Debug|Win32 - {317B694E-B5C1-42A6-956F-FC12B69175A6}.Debug (no cuda)|Win32.Build.0 = Debug|Win32 - {317B694E-B5C1-42A6-956F-FC12B69175A6}.Debug (no cuda)|x64.ActiveCfg = Debug|Win32 - {317B694E-B5C1-42A6-956F-FC12B69175A6}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {317B694E-B5C1-42A6-956F-FC12B69175A6}.Debug|Win32.ActiveCfg = Debug|Win32 - {317B694E-B5C1-42A6-956F-FC12B69175A6}.Debug|Win32.Build.0 = Debug|Win32 - {317B694E-B5C1-42A6-956F-FC12B69175A6}.Debug|x64.ActiveCfg = Debug|Win32 - {317B694E-B5C1-42A6-956F-FC12B69175A6}.Release (no cuda)|Any CPU.ActiveCfg = Release|Win32 - {317B694E-B5C1-42A6-956F-FC12B69175A6}.Release (no cuda)|Win32.ActiveCfg = Release|Win32 - {317B694E-B5C1-42A6-956F-FC12B69175A6}.Release (no cuda)|Win32.Build.0 = Release|Win32 - {317B694E-B5C1-42A6-956F-FC12B69175A6}.Release (no cuda)|x64.ActiveCfg = Release|Win32 - {317B694E-B5C1-42A6-956F-FC12B69175A6}.Release|Any CPU.ActiveCfg = Release|Win32 - {317B694E-B5C1-42A6-956F-FC12B69175A6}.Release|Win32.ActiveCfg = Release|Win32 - {317B694E-B5C1-42A6-956F-FC12B69175A6}.Release|Win32.Build.0 = Release|Win32 - {317B694E-B5C1-42A6-956F-FC12B69175A6}.Release|x64.ActiveCfg = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/project/vc9/nvtt/nvtt.rc b/project/vc9/nvtt/nvtt.rc deleted file mode 100644 index 089d1e9..0000000 --- a/project/vc9/nvtt/nvtt.rc +++ /dev/null @@ -1,102 +0,0 @@ -// 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 2,1,0,0 - PRODUCTVERSION 2,1,0,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", "2, 1, 0, 0" - VALUE "InternalName", "nvtt" - VALUE "LegalCopyright", "Copyright (C) 2007" - VALUE "OriginalFilename", "nvtt.dll" - VALUE "ProductName", "NVIDIA Texture Tools Dynamic Link Library" - VALUE "ProductVersion", "2, 1, 0, 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 - diff --git a/project/vc9/nvtt/nvtt.vcproj b/project/vc9/nvtt/nvtt.vcproj deleted file mode 100644 index d8d7e79..0000000 --- a/project/vc9/nvtt/nvtt.vcproj +++ /dev/null @@ -1,941 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/project/vc9/nvtt/resource.h b/project/vc9/nvtt/resource.h deleted file mode 100644 index 4df7169..0000000 --- a/project/vc9/nvtt/resource.h +++ /dev/null @@ -1,14 +0,0 @@ -//{{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 diff --git a/project/vc9/nvzoom/nvidia.ico b/project/vc9/nvzoom/nvidia.ico deleted file mode 100644 index 6aa721e..0000000 Binary files a/project/vc9/nvzoom/nvidia.ico and /dev/null differ diff --git a/project/vc9/nvzoom/nvzoom.rc b/project/vc9/nvzoom/nvzoom.rc deleted file mode 100644 index 842ded1..0000000 Binary files a/project/vc9/nvzoom/nvzoom.rc and /dev/null differ diff --git a/project/vc9/nvzoom/nvzoom.vcproj b/project/vc9/nvzoom/nvzoom.vcproj deleted file mode 100644 index f781cdf..0000000 --- a/project/vc9/nvzoom/nvzoom.vcproj +++ /dev/null @@ -1,374 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/project/vc9/nvzoom/resource.h b/project/vc9/nvzoom/resource.h deleted file mode 100644 index e765787..0000000 --- a/project/vc9/nvzoom/resource.h +++ /dev/null @@ -1,16 +0,0 @@ -//{{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 diff --git a/project/vc9/squish/squish.vcproj b/project/vc9/squish/squish.vcproj deleted file mode 100644 index cd18d1c..0000000 --- a/project/vc9/squish/squish.vcproj +++ /dev/null @@ -1,351 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/project/vc9/stress/stress.vcproj b/project/vc9/stress/stress.vcproj deleted file mode 100644 index 90e7897..0000000 --- a/project/vc9/stress/stress.vcproj +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3056a01..0da13fd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,11 +1,11 @@ -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) - SUBDIRS(nvcore) SUBDIRS(nvmath) SUBDIRS(nvimage) SUBDIRS(nvtt) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) + # OpenGL INCLUDE(FindOpenGL) IF(OPENGL_FOUND) @@ -84,7 +84,6 @@ ELSE(PNG_FOUND) ENDIF(PNG_FOUND) # TIFF -SET(TIFF_NAMES libtiff) INCLUDE(FindTIFF) IF(TIFF_FOUND) SET(HAVE_TIFF ${TIFF_FOUND} CACHE BOOL "Set to TRUE if TIFF is found, FALSE otherwise") @@ -102,15 +101,6 @@ ELSE(OPENEXR_FOUND) MESSAGE(STATUS "Looking for OpenEXR - not found") ENDIF(OPENEXR_FOUND) -# FreeImage -INCLUDE(${NV_CMAKE_DIR}/FindFreeImage.cmake) -IF(FREEIMAGE_FOUND) - SET(HAVE_FREEIMAGE ${FREEIMAGE_FOUND} CACHE BOOL "Set to TRUE if FreeImage is found, FALSE otherwise") - MESSAGE(STATUS "Looking for FreeImage - found") -ELSE(FREEIMAGE_FOUND) - MESSAGE(STATUS "Looking for FreeImage - not found") -ENDIF(FREEIMAGE_FOUND) - # Qt FIND_PACKAGE(Qt4) diff --git a/src/nvconfig.h.in b/src/nvconfig.h.in index a4911ee..ac9bd57 100644 --- a/src/nvconfig.h.in +++ b/src/nvconfig.h.in @@ -11,7 +11,6 @@ #cmakedefine HAVE_JPEG #cmakedefine HAVE_TIFF #cmakedefine HAVE_OPENEXR -#cmakedefine HAVE_FREEIMAGE #cmakedefine HAVE_MAYA diff --git a/src/nvcore/Algorithms.h b/src/nvcore/Algorithms.h deleted file mode 100644 index 6bb0796..0000000 --- a/src/nvcore/Algorithms.h +++ /dev/null @@ -1,147 +0,0 @@ -// This code is in the public domain -- castanyo@yahoo.es - -#ifndef NV_CORE_ALGORITHMS_H -#define NV_CORE_ALGORITHMS_H - -namespace nv -{ - - /// Return the maximum of two values. - template - inline const T & max(const T & a, const T & b) - { - //return std::max(a, b); - if( a < b ) { - return b; - } - return a; - } - - /// Return the minimum of two values. - template - inline const T & min(const T & a, const T & b) - { - //return std::min(a, b); - if( b < a ) { - return b; - } - return a; - } - - /// Clamp between two values. - template - inline const T & clamp(const T & x, const T & a, const T & b) - { - return min(max(x, a), b); - } - - /// Delete all the elements of a container. - template - void deleteAll(T & container) - { - for (typename T::PseudoIndex i = container.start(); !container.isDone(i); container.advance(i)) - { - delete container[i]; - } - } - - - // @@ Swap should be implemented here. - - -#if 0 - // This does not use swap, but copies, in some cases swaps are much faster than copies! - // Container should implement operator[], and size() - template - void insertionSort(Container & container) - { - const uint n = container.size(); - for (uint i=1; i < n; ++i) - { - T value = container[i]; - uint j = i; - while (j > 0 && container[j-1] > value) - { - container[j] = container[j-1]; - --j; - } - if (i != j) - { - container[j] = value; - } - } - } - - template - void quickSort(Container & container) - { - quickSort(container, 0, container.count()); - } - - { - /* threshhold for transitioning to insertion sort */ - while (n > 12) { - int c01,c12,c,m,i,j; - - /* compute median of three */ - m = n >> 1; - c = p[0] > p[m]; - c01 = c; - c = &p[m] > &p[n-1]; - c12 = c; - /* if 0 >= mid >= end, or 0 < mid < end, then use mid */ - if (c01 != c12) { - /* otherwise, we'll need to swap something else to middle */ - int z; - c = p[0] < p[n-1]; - /* 0>mid && midn => n; 0 0 */ - /* 0n: 0>n => 0; 0 n */ - z = (c == c12) ? 0 : n-1; - swap(p[z], p[m]); - } - /* now p[m] is the median-of-three */ - /* swap it to the beginning so it won't move around */ - swap(p[0], p[m]); - - /* partition loop */ - i=1; - j=n-1; - for(;;) { - /* handling of equality is crucial here */ - /* for sentinels & efficiency with duplicates */ - for (;;++i) { - c = p[i] > p[0]; - if (!c) break; - } - a = &p[0]; - for (;;--j) { - b=&p[j]; - c = p[j] > p[0] - if (!c) break; - } - /* make sure we haven't crossed */ - if (i >= j) break; - swap(p[i], p[j]); - - ++i; - --j; - } - /* recurse on smaller side, iterate on larger */ - if (j < (n-i)) { - quickSort(p, j); - p = p+i; - n = n-i; - } - else { - quickSort(p+i, n-i); - n = j; - } - } - - insertionSort(); - } -#endif // 0 - -} // nv namespace - -#endif // NV_CORE_ALGORITHMS_H diff --git a/src/nvcore/BitArray.h b/src/nvcore/BitArray.h index 695dd7a..01ab141 100644 --- a/src/nvcore/BitArray.h +++ b/src/nvcore/BitArray.h @@ -80,13 +80,13 @@ public: /// Clear all the bits. void clearAll() { - memset(m_bitArray.mutableBuffer(), 0, m_bitArray.size()); + memset(m_bitArray.unsecureBuffer(), 0, m_bitArray.size()); } /// Set all the bits. void setAll() { - memset(m_bitArray.mutableBuffer(), 0xFF, m_bitArray.size()); + memset(m_bitArray.unsecureBuffer(), 0xFF, m_bitArray.size()); } /// Toggle all the bits. diff --git a/src/nvcore/CMakeLists.txt b/src/nvcore/CMakeLists.txt index 4cf2c9b..e376686 100644 --- a/src/nvcore/CMakeLists.txt +++ b/src/nvcore/CMakeLists.txt @@ -3,13 +3,7 @@ ADD_SUBDIRECTORY(poshlib) SET(CORE_SRCS nvcore.h - DefsGnucDarwin.h - DefsGnucLinux.h - DefsGnucWin32.h - DefsVcWin32.h Ptr.h - RefCounted.h - RefCounted.cpp BitArray.h Memory.h Memory.cpp @@ -25,10 +19,7 @@ SET(CORE_SRCS TextWriter.h TextWriter.cpp Radix.h - Radix.cpp - CpuInfo.h - CpuInfo.cpp - Algorithms.h) + Radix.cpp) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/src/nvcore/Containers.h b/src/nvcore/Containers.h index af47087..5455a2e 100644 --- a/src/nvcore/Containers.h +++ b/src/nvcore/Containers.h @@ -19,7 +19,6 @@ Do not use memmove in insert & remove, use copy ctors instead. #include #include #include -//#include #include // memmove #include // for placement new @@ -71,10 +70,40 @@ namespace nv { // Templates + /// Return the maximum of two values. + template + inline const T & max(const T & a, const T & b) + { + //return std::max(a, b); + if( a < b ) { + return b; + } + return a; + } + + /// Return the minimum of two values. + template + inline const T & min(const T & a, const T & b) + { + //return std::min(a, b); + if( b < a ) { + return b; + } + return a; + } + + /// Clamp between two values. + template + inline const T & clamp(const T & x, const T & a, const T & b) + { + return min(max(x, a), b); + } + /// Swap two values. template inline void swap(T & a, T & b) { + //return std::swap(a, b); T temp = a; a = b; b = temp; @@ -105,6 +134,16 @@ namespace nv uint operator()(uint x) const { return x; } }; + /// Delete all the elements of a container. + template + void deleteAll(T & container) + { + for(typename T::PseudoIndex i = container.start(); !container.isDone(i); container.advance(i)) + { + delete container[i]; + } + } + /** Return the next power of two. * @see http://graphics.stanford.edu/~seander/bithacks.html @@ -115,7 +154,7 @@ namespace nv inline uint nextPowerOfTwo( uint x ) { nvDebugCheck( x != 0 ); - #if 1 // On modern CPUs this is supposed to be as fast as using the bsr instruction. + #if 1 // On modern CPUs this is as fast as using the bsr instruction. x--; x |= x >> 1; x |= x >> 2; @@ -138,6 +177,15 @@ namespace nv return (n & (n-1)) == 0; } + /// Simple iterator interface. + template + struct Iterator + { + virtual void advance(); + virtual bool isDone(); + virtual T current(); + }; + /** * Replacement for std::vector that is easier to debug and provides @@ -204,7 +252,7 @@ namespace nv const T * buffer() const { return m_buffer; } /// Get vector pointer. - T * mutableBuffer() { return m_buffer; } + T * unsecureBuffer() { return m_buffer; } /// Is vector empty. bool isEmpty() const { return m_size == 0; } diff --git a/src/nvcore/CpuInfo.cpp b/src/nvcore/CpuInfo.cpp deleted file mode 100644 index 0b4ada6..0000000 --- a/src/nvcore/CpuInfo.cpp +++ /dev/null @@ -1,88 +0,0 @@ -// This code is in the public domain -- castanyo@yahoo.es - -#include -#include - -using namespace nv; - -#if NV_OS_WIN32 - -#define _WIN32_WINNT 0x0501 -#define WIN32_LEAN_AND_MEAN -#include - -typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL); - -static bool isWow64() -{ - LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle(TEXT("kernel32")), "IsWow64Process"); - - BOOL bIsWow64 = FALSE; - - if (NULL != fnIsWow64Process) - { - if (!fnIsWow64Process(GetCurrentProcess(), &bIsWow64)) - { - return false; - } - } - - return bIsWow64 == TRUE; -} - -#endif // NV_OS_WIN32 - - - -uint CpuInfo::processorCount() -{ -#if NV_OS_WIN32 - SYSTEM_INFO sysInfo; - - typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL); - - if (isWow64()) - { - GetNativeSystemInfo(&sysInfo); - } - else - { - GetSystemInfo(&sysInfo); - } - - uint count = (uint)sysInfo.dwNumberOfProcessors; - nvDebugCheck(count >= 1); - - return count; -#else - return 1; -#endif -} - -uint CpuInfo::coreCount() -{ - return 1; -} - -bool CpuInfo::hasMMX() -{ - return false; -} - -bool CpuInfo::hasSSE() -{ - return false; -} - -bool CpuInfo::hasSSE2() -{ - return false; -} - -bool CpuInfo::hasSSE3() -{ - return false; -} - - - diff --git a/src/nvcore/CpuInfo.h b/src/nvcore/CpuInfo.h deleted file mode 100644 index 08a77ab..0000000 --- a/src/nvcore/CpuInfo.h +++ /dev/null @@ -1,88 +0,0 @@ -// This code is in the public domain -- castanyo@yahoo.es - -#ifndef NV_CORE_CPUINFO_H -#define NV_CORE_CPUINFO_H - -#include - -#if NV_CC_MSVC -# include // __rdtsc -#endif - - -namespace nv -{ - - // CPU Information. - class CpuInfo - { - static uint processorCount(); - static uint coreCount(); - - static bool hasMMX(); - static bool hasSSE(); - static bool hasSSE2(); - static bool hasSSE3(); - - }; - -#if NV_CC_MSVC - #pragma intrinsic(__rdtsc) - - inline uint64 rdtsc() - { - return __rdtsc(); - } -#endif - -#if NV_CC_GNUC - -#if defined(__i386__) - - inline /*volatile*/ uint64 rdtsc() - { - uint64 x; - //__asm__ volatile ("rdtsc" : "=A" (x)); - __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x)); - return x; - } - -#elif defined(__x86_64__) - - static __inline__ uint64 rdtsc(void) - { - unsigned int hi, lo; - __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi)); - return ( (unsigned long long)lo)|( ((unsigned long long)hi)<<32 ); - } - -#elif defined(__powerpc__) - - static __inline__ uint64 rdtsc(void) - { - uint64 result=0; - unsigned long int upper, lower, tmp; - __asm__ volatile( - "0: \n" - "\tmftbu %0 \n" - "\tmftb %1 \n" - "\tmftbu %2 \n" - "\tcmpw %2,%0 \n" - "\tbne 0b \n" - : "=r"(upper),"=r"(lower),"=r"(tmp) - ); - result = upper; - result = result<<32; - result = result|lower; - - return(result); - } - -#endif - -#endif // NV_CC_GNUC - - -} // nv namespace - -#endif // NV_CORE_CPUINFO_H diff --git a/src/nvcore/Debug.cpp b/src/nvcore/Debug.cpp index 341a988..837e16e 100644 --- a/src/nvcore/Debug.cpp +++ b/src/nvcore/Debug.cpp @@ -28,7 +28,7 @@ #endif #if NV_OS_LINUX && defined(HAVE_EXECINFO_H) -# include // backtrace +# include # if NV_CC_GNUC // defined(HAVE_CXXABI_H) # include # endif @@ -39,13 +39,6 @@ # include # include // sysctl # include -# undef HAVE_EXECINFO_H -# if defined(HAVE_EXECINFO_H) // only after OSX 10.5 -# include // backtrace -# if NV_CC_GNUC // defined(HAVE_CXXABI_H) -# include -# endif -# endif #endif #include // std::runtime_error @@ -135,10 +128,6 @@ namespace #if defined(HAVE_EXECINFO_H) // NV_OS_LINUX - static bool nvHasStackTrace() { - return backtrace != NULL; - } - static void nvPrintStackTrace(void * trace[], int size, int start=0) { char ** string_array = backtrace_symbols(trace, size); @@ -239,18 +228,17 @@ namespace } # if defined(HAVE_EXECINFO_H) - if (nvHasStackTrace()) // in case of weak linking - { - void * trace[64]; - int size = backtrace(trace, 64); - if (pnt != NULL) { - // Overwrite sigaction with caller's address. - trace[1] = pnt; - } - - nvPrintStackTrace(trace, size, 1); + void * trace[64]; + int size = backtrace(trace, 64); + + if (pnt != NULL) { + // Overwrite sigaction with caller's address. + trace[1] = pnt; } + + nvPrintStackTrace(trace, size, 1); + # endif // defined(HAVE_EXECINFO_H) exit(0); @@ -385,12 +373,9 @@ namespace # endif # if defined(HAVE_EXECINFO_H) - if (nvHasStackTrace()) - { - void * trace[64]; - int size = backtrace(trace, 64); - nvPrintStackTrace(trace, size, 3); - } + void * trace[64]; + int size = backtrace(trace, 64); + nvPrintStackTrace(trace, size, 3); # endif // Exit cleanly. @@ -437,12 +422,9 @@ void NV_CDECL nvDebug(const char *msg, ...) void debug::dumpInfo() { #if !NV_OS_WIN32 && defined(HAVE_SIGNAL_H) && defined(HAVE_EXECINFO_H) - if (nvHasStackTrace()) - { - void * trace[64]; - int size = backtrace(trace, 64); - nvPrintStackTrace(trace, size, 1); - } + void * trace[64]; + int size = backtrace(trace, 64); + nvPrintStackTrace(trace, size, 1); #endif } diff --git a/src/nvcore/DefsGnucDarwin.h b/src/nvcore/DefsGnucDarwin.h index 5442b79..1e6e41a 100644 --- a/src/nvcore/DefsGnucDarwin.h +++ b/src/nvcore/DefsGnucDarwin.h @@ -2,7 +2,8 @@ #error "Do not include this file directly." #endif -#include // uint8_t, int8_t, ... +#include // uint8_t, int8_t, ... + // Function linkage #define DLL_IMPORT diff --git a/src/nvcore/DefsVcWin32.h b/src/nvcore/DefsVcWin32.h index c1b6d36..6149cbb 100644 --- a/src/nvcore/DefsVcWin32.h +++ b/src/nvcore/DefsVcWin32.h @@ -19,9 +19,7 @@ // Set standard function names. #define snprintf _snprintf -#if _MSC_VER < 1500 -# define vsnprintf _vsnprintf -#endif +#define vsnprintf _vsnprintf #define vsscanf _vsscanf #define chdir _chdir #define getcwd _getcwd @@ -72,6 +70,8 @@ typedef uint32 uint; #pragma warning(disable : 4711) // function selected for automatic inlining #pragma warning(disable : 4725) // Pentium fdiv bug +#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 : 4675) // resolved overload was found by argument-dependent lookup diff --git a/src/nvcore/Prefetch.h b/src/nvcore/Prefetch.h index 71bd0ed..aa0bcfc 100644 --- a/src/nvcore/Prefetch.h +++ b/src/nvcore/Prefetch.h @@ -24,7 +24,7 @@ __forceinline void nvPrefetch(const void * mem) #else // NV_CC_MSVC // do nothing in other case. -#define nvPrefetch(ptr) +#define piPrefetch(ptr) #endif // NV_CC_MSVC diff --git a/src/nvcore/Ptr.h b/src/nvcore/Ptr.h index b5e9fe7..f260aa4 100644 --- a/src/nvcore/Ptr.h +++ b/src/nvcore/Ptr.h @@ -8,11 +8,6 @@ #include // NULL -#define NV_DECLARE_PTR(Class) \ - typedef SmartPtr Class ## Ptr; \ - typedef SmartPtr ClassConst ## Ptr - - namespace nv { @@ -48,11 +43,8 @@ public: /** Delete owned pointer and assign new one. */ void operator=( T * p ) { - if (p != m_ptr) - { - delete m_ptr; - m_ptr = p; - } + delete m_ptr; + m_ptr = p; } /** Member access. */ @@ -101,23 +93,125 @@ 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 SmartPtr { +class Pointer { public: // BaseClass must implement addRef() and release(). - typedef SmartPtr ThisType; + typedef Pointer ThisType; /// Default ctor. - SmartPtr() : m_ptr(NULL) + Pointer() : m_ptr(NULL) { } /** Other type assignment. */ template - SmartPtr( const SmartPtr & tc ) + Pointer( const Pointer & tc ) { m_ptr = static_cast( tc.ptr() ); if( m_ptr ) { @@ -126,7 +220,7 @@ public: } /** Copy ctor. */ - SmartPtr( const ThisType & bc ) + Pointer( const ThisType & bc ) { m_ptr = bc.ptr(); if( m_ptr ) { @@ -134,8 +228,8 @@ public: } } - /** Copy cast ctor. SmartPtr(NULL) is valid. */ - explicit SmartPtr( BaseClass * bc ) + /** Copy cast ctor. Pointer(NULL) is valid. */ + explicit Pointer( BaseClass * bc ) { m_ptr = bc; if( m_ptr ) { @@ -144,7 +238,7 @@ public: } /** Dtor. */ - ~SmartPtr() + ~Pointer() { set(NULL); } @@ -155,14 +249,14 @@ public: /** -> operator. */ BaseClass * operator -> () const { - nvCheck( m_ptr != NULL ); + piCheck( m_ptr != NULL ); return m_ptr; } /** * operator. */ BaseClass & operator*() const { - nvCheck( m_ptr != NULL ); + piCheck( m_ptr != NULL ); return *m_ptr; } @@ -178,7 +272,7 @@ public: //@{ /** Other type assignment. */ template - void operator = ( const SmartPtr & tc ) + void operator = ( const Pointer & tc ) { set( static_cast(tc.ptr()) ); } @@ -201,7 +295,7 @@ public: //@{ /** Other type equal comparation. */ template - bool operator == ( const SmartPtr & other ) const + bool operator == ( const Pointer & other ) const { return m_ptr == other.ptr(); } @@ -220,7 +314,7 @@ public: /** Other type not equal comparation. */ template - bool operator != ( const SmartPtr & other ) const + bool operator != ( const Pointer & other ) const { return m_ptr != other.ptr(); } diff --git a/src/nvcore/RefCounted.cpp b/src/nvcore/RefCounted.cpp deleted file mode 100644 index 595c74c..0000000 --- a/src/nvcore/RefCounted.cpp +++ /dev/null @@ -1,9 +0,0 @@ -// This code is in the public domain -- castanyo@yahoo.es - -#include "RefCounted.h" - -using namespace nv; - -int nv::RefCounted::s_total_ref_count = 0; -int nv::RefCounted::s_total_obj_count = 0; - diff --git a/src/nvcore/RefCounted.h b/src/nvcore/RefCounted.h deleted file mode 100644 index 309b2ad..0000000 --- a/src/nvcore/RefCounted.h +++ /dev/null @@ -1,114 +0,0 @@ -// This code is in the public domain -- castanyo@yahoo.es - -#ifndef NV_CORE_REFCOUNTED_H -#define NV_CORE_REFCOUNTED_H - -#include -#include - - -namespace nv -{ - - /// Reference counted base class to be used with SmartPtr and WeakPtr. - 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; - - }; - - -} // nv namespace - - -#endif // NV_CORE_REFCOUNTED_H diff --git a/src/nvcore/StrLib.h b/src/nvcore/StrLib.h index ac383d3..95d5cf4 100644 --- a/src/nvcore/StrLib.h +++ b/src/nvcore/StrLib.h @@ -213,12 +213,9 @@ namespace nv /// Implement value semantics. String & operator=( const String & str ) { - if (str.data != data) - { - release(); - data = str.data; - addRef(); - } + release(); + data = str.data; + addRef(); return *this; } diff --git a/src/nvcore/TextReader.cpp b/src/nvcore/TextReader.cpp index 8795c59..8eb7461 100644 --- a/src/nvcore/TextReader.cpp +++ b/src/nvcore/TextReader.cpp @@ -48,7 +48,7 @@ const char * TextReader::readToEnd() m_text.reserve(size + 1); m_text.resize(size); - m_stream->serialize(m_text.mutableBuffer(), size); + m_stream->serialize(m_text.unsecureBuffer(), size); m_text.pushBack('\0'); return m_text.buffer(); diff --git a/src/nvcore/ThreadLocalStorage.h b/src/nvcore/ThreadLocalStorage.h deleted file mode 100644 index f71a07d..0000000 --- a/src/nvcore/ThreadLocalStorage.h +++ /dev/null @@ -1,73 +0,0 @@ -// This code is in the public domain -- castanyo@yahoo.es - -#ifndef NV_CORE_THREADLOCALSTORAGE_H -#define NV_CORE_THREADLOCALSTORAGE_H - -#include - -// ThreadLocal context; -// -// context.allocate(); -// -// context = new Context(); -// context->member(); -// context = NULL; -// -// context.free(); - -#if NV_CC_GNUC - -#elif NV_CC_MSVC - -template -class ThreadLocal -{ -public: - ThreadLocal() : index(0) {} - ~ThreadLocal() { nvCheck(index == 0); } - - void allocate() - { - index = TlsAlloc(); - } - void free() - { - delete ptr(); - TlsFree(index); - index = 0; - } - bool isValid() - { - return index != 0; - } - - void operator=( T * p ) - { - if (p != ptr()) - { - delete ptr(); - TlsSetValue(index, p); - } - } - - T * operator -> () const - { - return ptr(); - } - - T & operator*() const - { - return *ptr(); - } - - T * ptr() const { - return static_cast(TlsGetValue(index)); - } - - DWORD index; -}; - - -#endif // NV_CC_MSVC - -#endif // NV_CORE_THREADLOCALSTORAGE_H diff --git a/src/nvimage/BlockDXT.cpp b/src/nvimage/BlockDXT.cpp index 8066f78..6e185b5 100644 --- a/src/nvimage/BlockDXT.cpp +++ b/src/nvimage/BlockDXT.cpp @@ -22,7 +22,6 @@ // OTHER DEALINGS IN THE SOFTWARE. #include -#include // swap #include "ColorBlock.h" #include "BlockDXT.h" diff --git a/src/nvimage/CMakeLists.txt b/src/nvimage/CMakeLists.txt index ed7ad40..3f66b00 100644 --- a/src/nvimage/CMakeLists.txt +++ b/src/nvimage/CMakeLists.txt @@ -25,9 +25,7 @@ SET(IMAGE_SRCS NormalMipmap.h NormalMipmap.cpp PsdFile.h - TgaFile.h - ColorSpace.h - ColorSpace.cpp) + TgaFile.h) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) @@ -51,11 +49,6 @@ IF(OPENEXR_FOUND) INCLUDE_DIRECTORIES(${OPENEXR_INCLUDE_PATHS}) ENDIF(OPENEXR_FOUND) -IF(FREEIMAGE_FOUND) - SET(LIBS ${LIBS} ${FREEIMAGE_LIBRARIES}) - INCLUDE_DIRECTORIES(${FREEIMAGE_INCLUDE_PATHS}) -ENDIF(FREEIMAGE_FOUND) - # targets ADD_DEFINITIONS(-DNVIMAGE_EXPORTS) diff --git a/src/nvimage/ColorBlock.cpp b/src/nvimage/ColorBlock.cpp index 2c9945f..fac8859 100644 --- a/src/nvimage/ColorBlock.cpp +++ b/src/nvimage/ColorBlock.cpp @@ -1,6 +1,5 @@ // This code is in the public domain -- castanyo@yahoo.es -#include // swap #include #include #include @@ -114,36 +113,9 @@ void ColorBlock::splatY() /// Returns true if the block has a single color. bool ColorBlock::isSingleColor() const { - Color32 mask(0xFF, 0xFF, 0xFF, 0x00); - uint u = m_color[0].u & mask.u; - - for (int i = 1; i < 16; i++) - { - if (u != (m_color[i].u & mask.u)) - { - return false; - } - } - - return true; -} - -/// Returns true if the block has a single color, ignoring transparent pixels. -bool ColorBlock::isSingleColorNoAlpha() const -{ - Color32 c; - int i; - for(i = 0; i < 16; i++) - { - if (m_color[i].a != 0) c = m_color[i]; - } - - Color32 mask(0xFF, 0xFF, 0xFF, 0x00); - uint u = c.u & mask.u; - - for(; i < 16; i++) + for(int i = 1; i < 16; i++) { - if (u != (m_color[i].u & mask.u)) + if (m_color[0] != m_color[i]) { return false; } diff --git a/src/nvimage/ColorBlock.h b/src/nvimage/ColorBlock.h index 53ba76b..00f9c8e 100644 --- a/src/nvimage/ColorBlock.h +++ b/src/nvimage/ColorBlock.h @@ -24,7 +24,6 @@ namespace nv void splatY(); bool isSingleColor() const; - bool isSingleColorNoAlpha() const; uint countUniqueColors() const; Color32 averageColor() const; bool hasAlpha() const; diff --git a/src/nvimage/ColorSpace.cpp b/src/nvimage/ColorSpace.cpp deleted file mode 100644 index f6ac4ce..0000000 --- a/src/nvimage/ColorSpace.cpp +++ /dev/null @@ -1,70 +0,0 @@ -// This code is in the public domain -- jim@tilander.org - -#include - -#include -#include - -#include "ColorSpace.h" - -namespace nv -{ - void ColorSpace::RGBtoYCoCg_R(Image* img) - { - const uint w = img->width(); - const uint h = img->height(); - - for( uint y=0; y < h; y++ ) - { - for( uint x=0; x < w; x++ ) - { - Color32 pixel = img->pixel(x, y); - - const int r = pixel.r; - const int g = pixel.g; - const int b = pixel.b; - - const int Co = r - b; - const int t = b + Co/2; - const int Cg = g - t; - const int Y = t + Cg/2; - - // Just saturate the chroma here (we loose out of one bit in each channel) - // this just means that we won't have as high dynamic range. Perhaps a better option - // is to loose the least significant bit instead? - pixel.r = clamp(Co + 128, 0, 255); - pixel.g = clamp(Cg + 128, 0, 255); - pixel.b = 0; - pixel.a = Y; - } - } - } - - void ColorSpace::YCoCg_RtoRGB(Image* img) - { - const uint w = img->width(); - const uint h = img->height(); - - for( uint y=0; y < h; y++ ) - { - for( uint x=0; x < w; x++ ) - { - Color32 pixel = img->pixel(x, y); - - const int Co = (int)pixel.r - 128; - const int Cg = (int)pixel.g - 128; - const int Y = pixel.a; - - const int t = Y - Cg/2; - const int g = Cg + t; - const int b = t - Co/2; - const int r = b + Co; - - pixel.r = r; - pixel.g = g; - pixel.b = b; - pixel.a = 1; - } - } - } -} diff --git a/src/nvimage/ColorSpace.h b/src/nvimage/ColorSpace.h deleted file mode 100644 index 8c35760..0000000 --- a/src/nvimage/ColorSpace.h +++ /dev/null @@ -1,21 +0,0 @@ -// This code is in the public domain -- jim@tilander.org - -#ifndef NV_IMAGE_COLORSPACE_H -#define NV_IMAGE_COLORSPACE_H - -namespace nv -{ - class Image; - - // Defines simple mappings between different color spaces and encodes them in the - // input image. - namespace ColorSpace - { - void RGBtoYCoCg_R(Image* img); - void YCoCg_RtoRGB(Image* img); - } -} - - - -#endif diff --git a/src/nvimage/DirectDrawSurface.cpp b/src/nvimage/DirectDrawSurface.cpp index 9c14565..cac2627 100644 --- a/src/nvimage/DirectDrawSurface.cpp +++ b/src/nvimage/DirectDrawSurface.cpp @@ -532,7 +532,7 @@ DDSHeader::DDSHeader() // Store version information on the reserved header attributes. this->reserved[9] = MAKEFOURCC('N', 'V', 'T', 'T'); - this->reserved[10] = (0 << 16) | (9 << 8) | (5); // major.minor.revision + this->reserved[10] = (2 << 16) | (0 << 8) | (3); // major.minor.revision this->pf.size = 32; this->pf.flags = 0; diff --git a/src/nvimage/Filter.h b/src/nvimage/Filter.h index ae762f6..55171ac 100644 --- a/src/nvimage/Filter.h +++ b/src/nvimage/Filter.h @@ -11,16 +11,16 @@ namespace nv class Vector4; /// Base filter class. - class NVIMAGE_CLASS Filter + class Filter { public: - Filter(float width); - virtual ~Filter(); + NVIMAGE_API Filter(float width); + NVIMAGE_API virtual ~Filter(); - float width() const { return m_width; } - float sampleDelta(float x, float scale) const; - float sampleBox(float x, float scale, int samples) const; - float sampleTriangle(float x, float scale, int samples) const; + NVIMAGE_API float width() const { return m_width; } + NVIMAGE_API float sampleDelta(float x, float scale) const; + NVIMAGE_API float sampleBox(float x, float scale, int samples) const; + NVIMAGE_API float sampleTriangle(float x, float scale, int samples) const; virtual float evaluate(float x) const = 0; @@ -29,56 +29,56 @@ namespace nv }; // Box filter. - class NVIMAGE_CLASS BoxFilter : public Filter + class BoxFilter : public Filter { public: - BoxFilter(); - BoxFilter(float width); - virtual float evaluate(float x) const; + NVIMAGE_API BoxFilter(); + NVIMAGE_API BoxFilter(float width); + NVIMAGE_API virtual float evaluate(float x) const; }; // Triangle (bilinear/tent) filter. - class NVIMAGE_CLASS TriangleFilter : public Filter + class TriangleFilter : public Filter { public: - TriangleFilter(); - TriangleFilter(float width); - virtual float evaluate(float x) const; + NVIMAGE_API TriangleFilter(); + NVIMAGE_API TriangleFilter(float width); + NVIMAGE_API virtual float evaluate(float x) const; }; // Quadratic (bell) filter. - class NVIMAGE_CLASS QuadraticFilter : public Filter + class QuadraticFilter : public Filter { public: - QuadraticFilter(); - virtual float evaluate(float x) const; + NVIMAGE_API QuadraticFilter(); + NVIMAGE_API virtual float evaluate(float x) const; }; // Cubic filter from Thatcher Ulrich. - class NVIMAGE_CLASS CubicFilter : public Filter + class CubicFilter : public Filter { public: - CubicFilter(); - virtual float evaluate(float x) const; + NVIMAGE_API CubicFilter(); + NVIMAGE_API virtual float evaluate(float x) const; }; // Cubic b-spline filter from Paul Heckbert. - class NVIMAGE_CLASS BSplineFilter : public Filter + class BSplineFilter : public Filter { public: - BSplineFilter(); - virtual float evaluate(float x) const; + NVIMAGE_API BSplineFilter(); + NVIMAGE_API virtual float evaluate(float x) const; }; /// Mitchell & Netravali's two-param cubic /// @see "Reconstruction Filters in Computer Graphics", SIGGRAPH 88 - class NVIMAGE_CLASS MitchellFilter : public Filter + class MitchellFilter : public Filter { public: - MitchellFilter(); - virtual float evaluate(float x) const; + NVIMAGE_API MitchellFilter(); + NVIMAGE_API virtual float evaluate(float x) const; - void setParameters(float a, float b); + NVIMAGE_API void setParameters(float a, float b); private: float p0, p2, p3; @@ -86,29 +86,29 @@ namespace nv }; // Lanczos3 filter. - class NVIMAGE_CLASS LanczosFilter : public Filter + class LanczosFilter : public Filter { public: - LanczosFilter(); - virtual float evaluate(float x) const; + NVIMAGE_API LanczosFilter(); + NVIMAGE_API virtual float evaluate(float x) const; }; // Sinc filter. - class NVIMAGE_CLASS SincFilter : public Filter + class SincFilter : public Filter { public: - SincFilter(float w); - virtual float evaluate(float x) const; + NVIMAGE_API SincFilter(float w); + NVIMAGE_API virtual float evaluate(float x) const; }; // Kaiser filter. - class NVIMAGE_CLASS KaiserFilter : public Filter + class KaiserFilter : public Filter { public: - KaiserFilter(float w); - virtual float evaluate(float x) const; + NVIMAGE_API KaiserFilter(float w); + NVIMAGE_API virtual float evaluate(float x) const; - void setParameters(float a, float stretch); + NVIMAGE_API void setParameters(float a, float stretch); private: float alpha; @@ -118,12 +118,12 @@ namespace nv /// A 1D kernel. Used to precompute filter weights. - class NVIMAGE_CLASS Kernel1 + class Kernel1 { NV_FORBID_COPY(Kernel1); public: - Kernel1(const Filter & f, int iscale, int samples = 32); - ~Kernel1(); + NVIMAGE_API Kernel1(const Filter & f, int iscale, int samples = 32); + NVIMAGE_API ~Kernel1(); float valueAt(uint x) const { nvDebugCheck(x < (uint)m_windowSize); @@ -138,7 +138,7 @@ namespace nv return m_width; } - void debugPrint(); + NVIMAGE_API void debugPrint(); private: int m_windowSize; @@ -148,15 +148,15 @@ namespace nv /// A 2D kernel. - class NVIMAGE_CLASS Kernel2 + class Kernel2 { public: - Kernel2(uint width); - Kernel2(const Kernel2 & k); - ~Kernel2(); + NVIMAGE_API Kernel2(uint width); + NVIMAGE_API Kernel2(const Kernel2 & k); + NVIMAGE_API ~Kernel2(); - void normalize(); - void transpose(); + NVIMAGE_API void normalize(); + NVIMAGE_API void transpose(); float valueAt(uint x, uint y) const { return m_data[y * m_windowSize + x]; @@ -166,12 +166,12 @@ namespace nv return m_windowSize; } - void initLaplacian(); - void initEdgeDetection(); - void initSobel(); - void initPrewitt(); + NVIMAGE_API void initLaplacian(); + NVIMAGE_API void initEdgeDetection(); + NVIMAGE_API void initSobel(); + NVIMAGE_API void initPrewitt(); - void initBlendedSobel(const Vector4 & scale); + NVIMAGE_API void initBlendedSobel(const Vector4 & scale); private: const uint m_windowSize; @@ -180,12 +180,12 @@ namespace nv /// A 1D polyphase kernel - class NVIMAGE_CLASS PolyphaseKernel + class PolyphaseKernel { NV_FORBID_COPY(PolyphaseKernel); public: - PolyphaseKernel(const Filter & f, uint srcLength, uint dstLength, int samples = 32); - ~PolyphaseKernel(); + NVIMAGE_API PolyphaseKernel(const Filter & f, uint srcLength, uint dstLength, int samples = 32); + NVIMAGE_API ~PolyphaseKernel(); int windowSize() const { return m_windowSize; @@ -205,7 +205,7 @@ namespace nv return m_data[column * m_windowSize + x]; } - void debugPrint() const; + NVIMAGE_API void debugPrint() const; private: int m_windowSize; diff --git a/src/nvimage/FloatImage.cpp b/src/nvimage/FloatImage.cpp index 0fcea3c..baa99dd 100644 --- a/src/nvimage/FloatImage.cpp +++ b/src/nvimage/FloatImage.cpp @@ -4,7 +4,6 @@ #include #include -#include #include "FloatImage.h" #include "Filter.h" @@ -241,52 +240,6 @@ void FloatImage::exponentiate(uint base_component, uint num, float power) } } -/// Apply linear transform. -void FloatImage::transform(uint base_component, const Matrix & m) -{ - nvCheck(base_component + 4 <= m_componentNum); - - const uint size = m_width * m_height; - - float * r = this->channel(base_component + 0); - float * g = this->channel(base_component + 1); - float * b = this->channel(base_component + 2); - float * a = this->channel(base_component + 3); - - for (uint i = 0; i < size; i++) - { - Vector4 color = nv::transform(m, Vector4(*r, *g, *b, *a)); - - *r++ = color.x(); - *g++ = color.y(); - *b++ = color.z(); - *a++ = color.w(); - } -} - -void FloatImage::swizzle(uint base_component, uint r, uint g, uint b, uint a) -{ - nvCheck(base_component + 4 <= m_componentNum); - - const uint size = m_width * m_height; - - float * c[4]; - c[0] = this->channel(base_component + 0); - c[1] = this->channel(base_component + 1); - c[2] = this->channel(base_component + 2); - c[3] = this->channel(base_component + 3); - - for (uint i = 0; i < size; i++) - { - float tmp[4] = { *c[r], *c[g], *c[b], *c[a] }; - - *c[0]++ = tmp[0]; - *c[1]++ = tmp[1]; - *c[2]++ = tmp[2]; - *c[3]++ = tmp[3]; - } -} - float FloatImage::sampleNearest(const float x, const float y, const int c, const WrapMode wm) const { if( wm == WrapMode_Clamp ) return sampleNearestClamp(x, y, c); @@ -683,7 +636,7 @@ FloatImage * FloatImage::downSample(const Filter & filter, uint w, uint h, WrapM float * dst_channel = dst_image->channel(c); for (uint x = 0; x < w; x++) { - tmp_image->applyKernelVertical(ykernel, x, c, wm, tmp_column.mutableBuffer()); + tmp_image->applyKernelVertical(ykernel, x, c, wm, tmp_column.unsecureBuffer()); for (uint y = 0; y < h; y++) { dst_channel[y * w + x] = tmp_column[y]; @@ -704,7 +657,7 @@ FloatImage * FloatImage::downSample(const Filter & filter, uint w, uint h, WrapM float * tmp_channel = tmp_image->channel(c); for (uint x = 0; x < w; x++) { - tmp_image->applyKernelVertical(ykernel, x, c, wm, tmp_column.mutableBuffer()); + tmp_image->applyKernelVertical(ykernel, x, c, wm, tmp_column.unsecureBuffer()); for (uint y = 0; y < h; y++) { tmp_channel[y * w + x] = tmp_column[y]; @@ -862,20 +815,3 @@ void FloatImage::applyKernelHorizontal(const PolyphaseKernel & k, int y, int c, } } -FloatImage* FloatImage::clone() const -{ - FloatImage* copy = new FloatImage(); - copy->m_width = m_width; - copy->m_height = m_height; - copy->m_componentNum = m_componentNum; - copy->m_count = m_count; - - if(m_mem) - { - copy->allocate(m_componentNum, m_width, m_height); - memcpy(copy->m_mem, m_mem, m_count * sizeof(float)); - } - - return copy; -} - diff --git a/src/nvimage/FloatImage.h b/src/nvimage/FloatImage.h index 9ef6f55..b51a0d6 100644 --- a/src/nvimage/FloatImage.h +++ b/src/nvimage/FloatImage.h @@ -3,15 +3,12 @@ #ifndef NV_IMAGE_FLOATIMAGE_H #define NV_IMAGE_FLOATIMAGE_H -#include // abs - #include -#include // clamp +#include // clamp #include namespace nv { -class Matrix; class Image; class Filter; class Kernel1; @@ -63,8 +60,6 @@ public: NVIMAGE_API void toGamma(uint base_component, uint num, float gamma = 2.2f); NVIMAGE_API void exponentiate(uint base_component, uint num, float power); - NVIMAGE_API void transform(uint base_component, const Matrix & m); - NVIMAGE_API void swizzle(uint base_component, uint r, uint g, uint b, uint a); NVIMAGE_API FloatImage * fastDownSample() const; NVIMAGE_API FloatImage * downSample(const Filter & filter, WrapMode wm) const; @@ -114,9 +109,6 @@ public: float sampleLinearMirror(float x, float y, int c) const; //@} - - FloatImage* clone() const; - public: uint index(uint x, uint y) const; diff --git a/src/nvimage/Image.cpp b/src/nvimage/Image.cpp index d96b0d9..53c0b5f 100644 --- a/src/nvimage/Image.cpp +++ b/src/nvimage/Image.cpp @@ -2,7 +2,6 @@ #include #include -#include // swap #include diff --git a/src/nvimage/ImageIO.cpp b/src/nvimage/ImageIO.cpp index 157eff2..0b24600 100644 --- a/src/nvimage/ImageIO.cpp +++ b/src/nvimage/ImageIO.cpp @@ -40,10 +40,6 @@ extern "C" { # include #endif -#if defined(HAVE_FREEIMAGE) -# include -#endif - using namespace nv; namespace { @@ -62,10 +58,6 @@ namespace { } // namespace -#if defined(HAVE_FREEIMAGE) -static Image * loadFreeImage(FREE_IMAGE_FORMAT fif, Stream & s); -static FloatImage * loadFloatFreeImage(FREE_IMAGE_FORMAT fif, Stream & s); -#endif Image * nv::ImageIO::load(const char * fileName) { @@ -86,16 +78,10 @@ Image * nv::ImageIO::load(const char * fileName, Stream & s) nvDebugCheck(s.isLoading()); const char * extension = Path::extension(fileName); - + if (strCaseCmp(extension, ".tga") == 0) { return ImageIO::loadTGA(s); } -#if defined(HAVE_FREEIMAGE) - FREE_IMAGE_FORMAT fif = FreeImage_GetFIFFromFilename(fileName); - if (fif != FIF_UNKNOWN && FreeImage_FIFSupportsReading(fif)) { - return loadFreeImage(fif, s); - } -#endif #if defined(HAVE_JPEG) if (strCaseCmp(extension, ".jpg") == 0 || strCaseCmp(extension, ".jpeg") == 0) { return loadJPG(s); @@ -106,13 +92,10 @@ Image * nv::ImageIO::load(const char * fileName, Stream & s) return loadPNG(s); } #endif - if (strCaseCmp(extension, ".psd") == 0) { return loadPSD(s); } - // @@ use image plugins? - return NULL; } @@ -174,20 +157,11 @@ FloatImage * nv::ImageIO::loadFloat(const char * fileName, Stream & s) return loadFloatEXR(fileName, s); } #endif -#if defined(HAVE_FREEIMAGE) - FREE_IMAGE_FORMAT fif = FreeImage_GetFIFFromFilename(fileName); - if (fif != FIF_UNKNOWN && FreeImage_FIFSupportsReading(fif)) { - return loadFloatFreeImage(fif, s); - } -#endif /* // @@ Disable temporarily if (strCaseCmp(extension, ".pfm") == 0) { return loadFloatPFM(fileName, s); } - if (strCaseCmp(extension, ".hdr") == 0) { - return loadGridFloat(fileName, s); - } */ return NULL; @@ -623,206 +597,6 @@ Image * nv::ImageIO::loadPSD(Stream & s) return img.release(); } - -#if defined(HAVE_FREEIMAGE) - -unsigned DLL_CALLCONV ReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle) -{ - Stream * s = (Stream *) handle; - s->serialize(buffer, size * count); - return count; -} - -int DLL_CALLCONV SeekProc(fi_handle handle, long offset, int origin) -{ - Stream * s = (Stream *) handle; - - switch(origin) { - case SEEK_SET : - s->seek(offset); - break; - case SEEK_CUR : - s->seek(s->tell() + offset); - break; - default : - return 1; - } - - return 0; -} - -long DLL_CALLCONV TellProc(fi_handle handle) -{ - Stream * s = (Stream *) handle; - return s->tell(); -} - - -Image * loadFreeImage(FREE_IMAGE_FORMAT fif, Stream & s) -{ - nvCheck(!s.isError()); - - FreeImageIO io; - io.read_proc = ReadProc; - io.write_proc = NULL; - io.seek_proc = SeekProc; - io.tell_proc = TellProc; - - FIBITMAP * bitmap = FreeImage_LoadFromHandle(fif, &io, (fi_handle)&s, 0); - - if (bitmap == NULL) - { - return NULL; - } - - const int w = FreeImage_GetWidth(bitmap); - const int h = FreeImage_GetHeight(bitmap); - - if (FreeImage_GetImageType(bitmap) == FIT_BITMAP) - { - if (FreeImage_GetBPP(bitmap) != 32) - { - FIBITMAP * tmp = FreeImage_ConvertTo32Bits(bitmap); - FreeImage_Unload(bitmap); - bitmap = tmp; - } - } - else - { - // @@ Use tone mapping? - FIBITMAP * tmp = FreeImage_ConvertToType(bitmap, FIT_BITMAP, true); - FreeImage_Unload(bitmap); - bitmap = tmp; - } - - - Image * image = new Image(); - image->allocate(w, h); - - // Copy the image over to our internal format, FreeImage has the scanlines bottom to top though. - for (int y=0; y < h; y++) - { - const void * src = FreeImage_GetScanLine(bitmap, h - y - 1); - void * dst = image->scanline(y); - - memcpy(dst, src, 4 * w); - } - - FreeImage_Unload(bitmap); - - return image; -} - -FloatImage * loadFloatFreeImage(FREE_IMAGE_FORMAT fif, Stream & s) -{ - nvCheck(!s.isError()); - - FreeImageIO io; - io.read_proc = ReadProc; - io.write_proc = NULL; - io.seek_proc = SeekProc; - io.tell_proc = TellProc; - - FIBITMAP * bitmap = FreeImage_LoadFromHandle(fif, &io, (fi_handle)&s, 0); - - if (bitmap == NULL) - { - return NULL; - } - - const int w = FreeImage_GetWidth(bitmap); - const int h = FreeImage_GetHeight(bitmap); - - FREE_IMAGE_TYPE fit = FreeImage_GetImageType(bitmap); - - FloatImage * floatImage = new FloatImage(); - - switch (fit) - { - case FIT_FLOAT: - floatImage->allocate(1, w, h); - - for (int y=0; y < h; y++) - { - const float * src = (const float *)FreeImage_GetScanLine(bitmap, h - y - 1 ); - float * dst = floatImage->scanline(y, 0); - - for (int x=0; x < w; x++) - { - dst[x] = src[x]; - } - } - break; - case FIT_COMPLEX: - floatImage->allocate(2, w, h); - - for (int y=0; y < h; y++) - { - const FICOMPLEX * src = (const FICOMPLEX *)FreeImage_GetScanLine(bitmap, h - y - 1 ); - - float * dst_real = floatImage->scanline(y, 0); - float * dst_imag = floatImage->scanline(y, 1); - - for (int x=0; x < w; x++) - { - dst_real[x] = (float)src[x].r; - dst_imag[x] = (float)src[x].i; - } - } - break; - case FIT_RGBF: - floatImage->allocate(3, w, h); - - for (int y=0; y < h; y++) - { - const FIRGBF * src = (const FIRGBF *)FreeImage_GetScanLine(bitmap, h - y - 1 ); - - float * dst_red = floatImage->scanline(y, 0); - float * dst_green = floatImage->scanline(y, 1); - float * dst_blue = floatImage->scanline(y, 2); - - for (int x=0; x < w; x++) - { - dst_red[x] = src[x].red; - dst_green[x] = src[x].green; - dst_blue[x] = src[x].blue; - } - } - break; - case FIT_RGBAF: - floatImage->allocate(4, w, h); - - for (int y=0; y < h; y++) - { - const FIRGBAF * src = (const FIRGBAF *)FreeImage_GetScanLine(bitmap, h - y - 1 ); - - float * dst_red = floatImage->scanline(y, 0); - float * dst_green = floatImage->scanline(y, 1); - float * dst_blue = floatImage->scanline(y, 2); - float * dst_alpha = floatImage->scanline(y, 3); - - for (int x=0; x < w; x++) - { - dst_red[x] = src[x].red; - dst_green[x] = src[x].green; - dst_blue[x] = src[x].blue; - dst_alpha[x] = src[x].alpha; - } - } - break; - default: - delete floatImage; - floatImage = NULL; - } - - FreeImage_Unload(bitmap); - - return floatImage; -} - -#endif // defined(HAVE_FREEIMAGE) - - #if defined(HAVE_PNG) static void user_read_data(png_structp png_ptr, png_bytep data, png_size_t length) @@ -1020,7 +794,7 @@ Image * nv::ImageIO::loadJPG(Stream & s) // Read the entire file. Array byte_array; byte_array.resize(s.size()); - s.serialize(byte_array.mutableBuffer(), s.size()); + s.serialize(byte_array.unsecureBuffer(), s.size()); jpeg_decompress_struct cinfo; jpeg_error_mgr jerr; @@ -1315,8 +1089,7 @@ namespace virtual void seekg(Imf::Int64 pos) { - nvDebugCheck(pos >= 0 && pos < UINT_MAX); - m_stream.seek((uint)pos); + m_stream.seek(pos); } virtual void clear() @@ -1328,23 +1101,6 @@ namespace Stream & m_stream; }; - static int channelIndexFromName(const char* name) - { - char c = tolower(name[0]); - switch (c) - { - default: - case 'r': - return 0; - case 'g': - return 1; - case 'b': - return 2; - case 'a': - return 3; - } - } - } // namespace FloatImage * nv::ImageIO::loadFloatEXR(const char * fileName, Stream & s) @@ -1378,8 +1134,7 @@ FloatImage * nv::ImageIO::loadFloatEXR(const char * fileName, Stream & s) uint i = 0; for (Imf::ChannelList::ConstIterator it = channels.begin(); it != channels.end(); ++it, ++i) { - int channelIndex = channelIndexFromName(it.name()); - frameBuffer.insert(it.name(), Imf::Slice(Imf::FLOAT, (char *)fimage->channel(channelIndex), sizeof(float), sizeof(float) * width)); + frameBuffer.insert(it.name(), Imf::Slice(Imf::FLOAT, (char *)fimage->channel(i), sizeof(float), sizeof(float) * width)); } // Read it. @@ -1543,77 +1298,6 @@ bool nv::ImageIO::saveFloatPFM(const char * fileName, const FloatImage * fimage, return true; } -//#pragma warning(disable : 4996) - -NVIMAGE_API FloatImage * nv::ImageIO::loadGridFloat(const char * fileName, Stream & s) -{ - nvCheck(s.isLoading()); - nvCheck(!s.isError()); - - Tokenizer parser(&s); - - parser.nextLine(); - - if (parser.token() != "ncols") - { - nvDebug("Failed to find 'ncols' token in file '%s'.\n", fileName); - return NULL; - } - - parser.nextToken(true); - const int nCols = parser.token().toInt(); - - parser.nextToken(true); - if (parser.token() != "nrows") - { - nvDebug("Failed to find 'nrows' token in file '%s'.\n", fileName); - return NULL; - } - - parser.nextToken(true); - const int nRows = parser.token().toInt(); - - /* There's a byte order defined in the header. We could read it. However, here we - just assume that it matches the platform's byte order. - // There is then a bunch of data that we don't care about (lat, long definitions, etc). - for (int i=0; i!=9; ++i) - parser.nextToken(true); - - if (parser.token() != "byteorder") - return NULL; - - parser.nextToken(true); - - const Stream::ByteOrder byteOrder = (parser.token() == "LSBFIRST")? Stream::LittleEndian: Stream::BigEndian; - */ - - // GridFloat comes in two files: an ASCII header which was parsed above (.hdr) and a big blob - // of binary data in a .flt file. - Path dataPath(fileName); - dataPath.stripExtension(); - dataPath.append(".flt"); - - // Open the binary data. - FILE* file = fopen(dataPath.fileName(), "rb"); - if (!file) - { - nvDebug("Failed to find GridFloat blob file '%s' corresponding to '%s'.\n", dataPath.fileName(), fileName); - return NULL; - } - - // Allocate image. - AutoPtr fimage(new FloatImage()); - fimage->allocate(1, nCols, nRows); - - float * channel = fimage->channel(0); - - // The binary blob is defined to be in row-major order, containing IEEE floats. - // So we can just slurp it in. Theoretically, we ought to use the byte order. - const size_t nRead = fread((void*) channel, sizeof(float), nRows * nCols, file); - fclose(file); - - return fimage.release(); -} #endif #if 0 diff --git a/src/nvimage/ImageIO.h b/src/nvimage/ImageIO.h index 8e64093..0902a5d 100644 --- a/src/nvimage/ImageIO.h +++ b/src/nvimage/ImageIO.h @@ -47,15 +47,10 @@ namespace nv NVIMAGE_API bool saveFloatEXR(const char * fileName, const FloatImage * fimage, uint base_component, uint num_components); #endif -/* - NVIMAGE_API FloatImage * loadFloatPFM(const char * fileName, Stream & s); - NVIMAGE_API bool saveFloatPFM(const char * fileName, const FloatImage * fimage, uint base_component, uint num_components); - // GridFloat is a simple, open format for terrain elevation data. See http://ned.usgs.gov/Ned/faq.asp. - // Expects: 1) fileName will be an ".hdr" header file, 2) there will also exist a corresponding float data - // blob in a ".flt" file. (This is what USGS gives you.) - NVIMAGE_API FloatImage * loadGridFloat(const char * fileName, Stream & s); -*/ + // NVIMAGE_API FloatImage * loadFloatPFM(const char * fileName, Stream & s); + // NVIMAGE_API bool saveFloatPFM(const char * fileName, const FloatImage * fimage, uint base_component, uint num_components); + } // ImageIO namespace } // nv namespace diff --git a/src/nvimage/Quantize.cpp b/src/nvimage/Quantize.cpp index 0f0b075..8dd3a67 100644 --- a/src/nvimage/Quantize.cpp +++ b/src/nvimage/Quantize.cpp @@ -12,10 +12,6 @@ http://www.efg2.com/Lab/Library/ImageProcessing/DHALF.TXT @@ This code needs to be reviewed, I'm not sure it's correct. */ -#include // memset - -#include // swap - #include #include diff --git a/src/nvmath/Basis.cpp b/src/nvmath/Basis.cpp index 19e28ed..085e25b 100644 --- a/src/nvmath/Basis.cpp +++ b/src/nvmath/Basis.cpp @@ -27,7 +27,8 @@ void Basis::orthonormalize(float epsilon /*= NV_EPSILON*/) tangent -= normal * dot(normal, tangent); tangent = ::normalize(tangent, epsilon); - bitangent -= normal * dot(normal, bitangent) + tangent * dot(tangent, bitangent); + bitangent -= normal * dot(normal, bitangent); + bitangent -= tangent * dot(tangent, bitangent); bitangent = ::normalize(bitangent, epsilon); } @@ -48,7 +49,7 @@ void Basis::robustOrthonormalize(float epsilon /*= NV_EPSILON*/) return; } } - normal = nv::normalize(normal, epsilon); + normal = ::normalize(normal, epsilon); tangent -= normal * dot(normal, tangent); bitangent -= normal * dot(normal, bitangent); @@ -67,8 +68,7 @@ void Basis::robustOrthonormalize(float epsilon /*= NV_EPSILON*/) } else { -#if 0 - tangent = nv::normalize(tangent, epsilon); + tangent = ::normalize(tangent, epsilon); bitangent -= tangent * dot(tangent, bitangent); if (length(bitangent) < epsilon) @@ -78,47 +78,11 @@ void Basis::robustOrthonormalize(float epsilon /*= NV_EPSILON*/) } else { - bitangent = nv::normalize(bitangent, epsilon); - } -#else - if (length(bitangent) < epsilon) - { - bitangent = cross(tangent, normal); - nvCheck(isNormalized(bitangent)); - } - else - { - tangent = nv::normalize(tangent); - bitangent = nv::normalize(bitangent); - - Vector3 bisector = nv::normalize(tangent + bitangent); - Vector3 axis = cross(bisector, normal); - - nvDebugCheck(isNormalized(axis, epsilon)); - nvDebugCheck(equal(dot(axis, tangent), -dot(axis, bitangent), epsilon)); - - if (dot(axis, tangent) > 0) - { - tangent = nv::normalize(bisector + axis); - bitangent = nv::normalize(bisector - axis); - } - else - { - tangent = nv::normalize(bisector - axis); - bitangent = nv::normalize(bisector + axis); - } + tangent = ::normalize(tangent, epsilon); } -#endif } - /*// Check vector lengths. - if (!isNormalized(normal, epsilon)) - { - nvDebug("%f %f %f\n", normal.x(), normal.y(), normal.z()); - nvDebug("%f %f %f\n", tangent.x(), tangent.y(), tangent.z()); - nvDebug("%f %f %f\n", bitangent.x(), bitangent.y(), bitangent.z()); - }*/ - + // Check vector lengths. nvCheck(isNormalized(normal, epsilon)); nvCheck(isNormalized(tangent, epsilon)); nvCheck(isNormalized(bitangent, epsilon)); @@ -161,18 +125,9 @@ void Basis::buildFrameForDirection(Vector3::Arg d) bitangent = cross(normal, tangent); } -bool Basis::isValid() const -{ - if (equal(normal, Vector3(zero))) return false; - if (equal(tangent, Vector3(zero))) return false; - if (equal(bitangent, Vector3(zero))) return false; - - if (equal(determinant(), 0.0f)) return false; - - return true; -} +/* /// Transform by this basis. (From this basis to object space). Vector3 Basis::transform(Vector3::Arg v) const { @@ -189,31 +144,30 @@ Vector3 Basis::transformT(Vector3::Arg v) } /// Transform by the inverse. (From object space to this basis). -/// @note Uses Cramer's rule so the inverse is not accurate if the basis is ill-conditioned. +/// @note Uses Kramer's rule so the inverse is not accurate if the basis is ill-conditioned. Vector3 Basis::transformI(Vector3::Arg v) const { const float det = determinant(); - nvDebugCheck(!equal(det, 0.0f, 0.0f)); + nvCheck(!equalf(det, 0.0f)); const float idet = 1.0f / det; // Rows of the inverse matrix. - Vector3 r0( - (bitangent.y() * normal.z() - bitangent.z() * normal.y()), - -(bitangent.x() * normal.z() - bitangent.z() * normal.x()), - (bitangent.x() * normal.y() - bitangent.y() * normal.x())); - - Vector3 r1( - -(tangent.y() * normal.z() - tangent.z() * normal.y()), - (tangent.x() * normal.z() - tangent.z() * normal.x()), - -(tangent.x() * normal.y() - tangent.y() * normal.x())); - - Vector3 r2( - (tangent.y() * bitangent.z() - tangent.z() * bitangent.y()), - -(tangent.x() * bitangent.z() - tangent.z() * bitangent.x()), - (tangent.x() * bitangent.y() - tangent.y() * bitangent.x())); - - return Vector3(dot(v, r0), dot(v, r1), dot(v, r2)) * idet; + Vector3 r0, r1, r2; + r0.x = (bitangent.y() * normal.z() - bitangent.z() * normal.y()) * idet; + r0.y = -(bitangent.x() * normal.z() - bitangent.z() * normal.x()) * idet; + r0.z = (bitangent.x() * normal.y() - bitangent.y() * normal.x()) * idet; + + r1.x = -(tangent.y() * normal.z() - tangent.z() * normal.y()) * idet; + r1.y = (tangent.x() * normal.z() - tangent.z() * normal.x()) * idet; + r1.z = -(tangent.x() * normal.y() - tangent.y() * normal.x()) * idet; + + r2.x = (tangent.y() * bitangent.z() - tangent.z() * bitangent.y()) * idet; + r2.y = -(tangent.x() * bitangent.z() - tangent.z() * bitangent.x()) * idet; + r2.z = (tangent.x() * bitangent.y() - tangent.y() * bitangent.x()) * idet; + + return Vector3(dot(v, r0), dot(v, r1), dot(v, r2)); } +*/ diff --git a/src/nvmath/Basis.h b/src/nvmath/Basis.h index dca0442..7adde57 100644 --- a/src/nvmath/Basis.h +++ b/src/nvmath/Basis.h @@ -54,8 +54,7 @@ namespace nv tangent.z() * bitangent.x() * normal.y() - tangent.x() * bitangent.z() * normal.y(); } - bool isValid() const; - + /* // Get transform matrix for this basis. NVMATH_API Matrix matrix() const; @@ -67,7 +66,7 @@ namespace nv // Transform by the inverse. (From object space to this basis). NVMATH_API Vector3 transformI(Vector3::Arg v) const; - + */ Vector3 tangent; Vector3 bitangent; diff --git a/src/nvmath/Box.h b/src/nvmath/Box.h index ed88a1b..a8426a3 100644 --- a/src/nvmath/Box.h +++ b/src/nvmath/Box.h @@ -9,7 +9,6 @@ namespace nv { -class Stream; /// Axis Aligned Bounding Box. class Box @@ -28,13 +27,11 @@ public: // Cast operators. operator const float * () const { return reinterpret_cast(this); } - // Min corner of the box. - Vector3 minCorner() const { return m_mins; } - Vector3 & minCorner() { return m_mins; } + /// Min corner of the box. + Vector3 mins() const { return m_mins; } - // Max corner of the box. - Vector3 maxCorner() const { return m_maxs; } - Vector3 & maxCorner() { return m_maxs; } + /// Max corner of the box. + Vector3 maxs() const { return m_maxs; } /// Clear the bounds. void clearBounds() @@ -111,7 +108,7 @@ public: float area() const { const Vector3 d = extents(); - return 8.0f * (d.x()*d.y() + d.x()*d.z() + d.y()*d.z()); + return 4.0f * (d.x()*d.y() + d.x()*d.z() + d.y()*d.z()); } /// Get the volume of the box. @@ -121,16 +118,6 @@ public: return 8.0f * (d.x() * d.y() * d.z()); } - /// Return true if the box contains the given point. - bool contains(Vector3::Arg p) const - { - return - m_mins.x() < p.x() && m_mins.y() < p.y() && m_mins.z() < p.z() && - m_maxs.x() > p.x() && m_maxs.y() > p.y() && m_maxs.z() > p.z(); - } - - friend Stream & operator<< (Stream & s, Box & box); - private: Vector3 m_mins; @@ -138,6 +125,15 @@ private: }; +/* +/// Point inside box test. +inline bool pointInsideBox(const Box & b, Vector3::Arg p) const +{ + return (m_mins.x() < p.x() && m_mins.y() < p.y() && m_mins.z() < p.z() && + m_maxs.x() > p.x() && m_maxs.y() > p.y() && m_maxs.z() > p.z()); +} +*/ + } // nv namespace diff --git a/src/nvmath/CMakeLists.txt b/src/nvmath/CMakeLists.txt index c7d7e94..7ea4a80 100644 --- a/src/nvmath/CMakeLists.txt +++ b/src/nvmath/CMakeLists.txt @@ -5,19 +5,13 @@ SET(MATH_SRCS Vector.h Matrix.h Quaternion.h - Plane.h Plane.cpp Box.h Color.h Montecarlo.h Montecarlo.cpp Random.h Random.cpp SphericalHarmonic.h SphericalHarmonic.cpp Basis.h Basis.cpp - Triangle.h Triangle.cpp TriBox.cpp - Polygon.h Polygon.cpp - TypeSerialization.h TypeSerialization.cpp - Sparse.h Sparse.cpp - Solver.h Solver.cpp - KahanSum.h) + Triangle.h Triangle.cpp TriBox.cpp) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/src/nvmath/KahanSum.h b/src/nvmath/KahanSum.h deleted file mode 100644 index dac706f..0000000 --- a/src/nvmath/KahanSum.h +++ /dev/null @@ -1,38 +0,0 @@ -// This code is in the public domain -- castanyo@yahoo.es - -#ifndef NV_MATH_KAHANSUM_H -#define NV_MATH_KAHANSUM_H - -#include - -namespace nv -{ - - class KahanSum - { - public: - KahanSum() : accum(0.0f), err(0) {}; - - void add(float f) - { - float compensated = f + err; - float tmp = accum + compensated; - err = accum - tmp; - err += compensated; - accum = tmp; - } - - float sum() const - { - return accum; - } - - private: - float accum; - float err; - }; - -} // nv namespace - - -#endif // NV_MATH_KAHANSUM_H diff --git a/src/nvmath/Polygon.cpp b/src/nvmath/Polygon.cpp deleted file mode 100644 index c5f6282..0000000 --- a/src/nvmath/Polygon.cpp +++ /dev/null @@ -1,168 +0,0 @@ -// This code is in the public domain -- Ignacio Castaño - -#include - -#include -#include - -using namespace nv; - - -Polygon::Polygon() -{ -} - -Polygon::Polygon(const Triangle & t) -{ - pointArray.resize(3); - pointArray[0] = t.v[0]; - pointArray[1] = t.v[1]; - pointArray[2] = t.v[2]; -} - -Polygon::Polygon(const Vector3 * points, uint vertexCount) -{ - pointArray.resize(vertexCount); - - for (uint i = 0; i < vertexCount; i++) - { - pointArray[i] = points[i]; - } -} - - -/// Compute polygon area. -float Polygon::area() const -{ - float total = 0; - - const uint pointCount = pointArray.count(); - for (uint i = 2; i < pointCount; i++) - { - Vector3 v1 = pointArray[i-1] - pointArray[0]; - Vector3 v2 = pointArray[i] - pointArray[0]; - - total += 0.5f * length(cross(v1, v2)); - } - - return total; -} - -/// Get the bounds of the polygon. -Box Polygon::bounds() const -{ - Box bounds; - bounds.clearBounds(); - foreach(p, pointArray) - { - bounds.addPointToBounds(pointArray[p]); - } - return bounds; -} - - -/// Get the plane of the polygon. -Plane Polygon::plane() const -{ - // @@ Do something better than this? - Vector3 n = cross(pointArray[1] - pointArray[0], pointArray[2] - pointArray[0]); - return Vector4(n, dot(n, pointArray[0])); -} - - -/// Clip polygon to box. -uint Polygon::clipTo(const Box & box) -{ - const Plane posX( 1, 0, 0, box.maxCorner().x()); - const Plane negX(-1, 0, 0,-box.minCorner().x()); - const Plane posY( 0, 1, 0, box.maxCorner().y()); - const Plane negY( 0,-1, 0,-box.minCorner().y()); - const Plane posZ( 0, 0, 1, box.maxCorner().z()); - const Plane negZ( 0, 0,-1,-box.minCorner().z()); - - if (clipTo(posX) == 0) return 0; - if (clipTo(negX) == 0) return 0; - if (clipTo(posY) == 0) return 0; - if (clipTo(negY) == 0) return 0; - if (clipTo(posZ) == 0) return 0; - if (clipTo(negZ) == 0) return 0; - - return pointArray.count(); -} - - -/// Clip polygon to plane. -uint Polygon::clipTo(const Plane & plane) -{ - int count = 0; - - const uint pointCount = pointArray.count(); - - Array newPointArray(pointCount + 1); // @@ Do not create copy every time. - - Vector3 prevPoint = pointArray[pointCount - 1]; - float prevDist = dot(plane.vector(), prevPoint) - plane.offset(); - - for (uint i = 0; i < pointCount; i++) - { - const Vector3 point = pointArray[i]; - float dist = dot(plane.vector(), point) - plane.offset(); - - // @@ Handle points on plane better. - - if (dist <= 0) // interior. - { - if (prevDist > 0) // exterior - { - // Add segment intersection point. - Vector3 dp = point - prevPoint; - - float t = dist / prevDist; - newPointArray.append(point - dp * t); - } - - // Add interior point. - newPointArray.append(point); - } - else if (dist > 0 && prevDist < 0) - { - // Add segment intersection point. - Vector3 dp = point - prevPoint; - - float t = dist / prevDist; - newPointArray.append(point - dp * t); - } - - prevPoint = point; - prevDist = dist; - } - - swap(pointArray, newPointArray); - - return count; -} - - -void Polygon::removeColinearPoints() -{ - const uint pointCount = pointArray.count(); - - Array newPointArray(pointCount); - - for (uint i = 0 ; i < pointCount; i++) - { - int j = (i + 1) % pointCount; - int k = (i + pointCount - 1) % pointCount; - - Vector3 v1 = normalize(pointArray[j] - pointArray[i]); - Vector3 v2 = normalize(pointArray[i] - pointArray[k]); - - if (dot(v1, v2) < 0.999) - { - newPointArray.append(pointArray[i]); - } - } - - swap(pointArray, newPointArray); -} - diff --git a/src/nvmath/Polygon.h b/src/nvmath/Polygon.h deleted file mode 100644 index e70463a..0000000 --- a/src/nvmath/Polygon.h +++ /dev/null @@ -1,45 +0,0 @@ -// This code is in the public domain -- Ignacio Castaño - -#ifndef NV_MATH_POLYGON_H -#define NV_MATH_POLYGON_H - -#include - -#include -#include -#include - -namespace nv -{ - class Box; - class Plane; - class Triangle; - - - class Polygon - { - NV_FORBID_COPY(Polygon); - public: - - Polygon(); - Polygon(const Triangle & t); - Polygon(const Vector3 * points, uint vertexCount); - - float area() const; - Box bounds() const; - Plane plane() const; - - uint clipTo(const Box & box); - uint clipTo(const Plane & plane); - - void removeColinearPoints(); - - private: - - Array pointArray; - }; - - -} // nv namespace - -#endif // NV_MATH_POLYGON_H diff --git a/src/nvmath/Quaternion.h b/src/nvmath/Quaternion.h index 1002ff9..b5007cc 100644 --- a/src/nvmath/Quaternion.h +++ b/src/nvmath/Quaternion.h @@ -51,6 +51,7 @@ namespace nv inline Quaternion mul(Quaternion::Arg a, Quaternion::Arg b) { + // @@ Efficient SIMD implementation? return Quaternion( + a.x() * b.w() + a.y()*b.z() - a.z()*b.y() + a.w()*b.x(), - a.x() * b.z() + a.y()*b.w() + a.z()*b.x() + a.w()*b.y(), @@ -58,40 +59,6 @@ namespace nv - a.x() * b.x() - a.y()*b.y() - a.z()*b.z() + a.w()*b.w()); } - inline Quaternion mul(Quaternion::Arg a, Vector3::Arg b) - { - return Quaternion( - + a.y()*b.z() - a.z()*b.y() + a.w()*b.x(), - - a.x() * b.z() + a.z()*b.x() + a.w()*b.y(), - + a.x() * b.y() - a.y()*b.x() + a.w()*b.z(), - - a.x() * b.x() - a.y()*b.y() - a.z()*b.z() ); - } - - inline Quaternion mul(Vector3::Arg a, Quaternion::Arg b) - { - return Quaternion( - + a.x() * b.w() + a.y()*b.z() - a.z()*b.y(), - - a.x() * b.z() + a.y()*b.w() + a.z()*b.x(), - + a.x() * b.y() - a.y()*b.x() + a.z()*b.w(), - - a.x() * b.x() - a.y()*b.y() - a.z()*b.z()); - } - - inline Quaternion operator *(Quaternion::Arg a, Quaternion::Arg b) - { - return mul(a, b); - } - - inline Quaternion operator *(Quaternion::Arg a, Vector3::Arg b) - { - return mul(a, b); - } - - inline Quaternion operator *(Vector3::Arg a, Quaternion::Arg b) - { - return mul(a, b); - } - - inline Quaternion scale(Quaternion::Arg q, float s) { return scale(q.asVector(), s); @@ -155,24 +122,6 @@ namespace nv return Quaternion(Vector4(v * s, c)); } - inline Vector3 imag(Quaternion::Arg q) - { - return q.asVector().xyz(); - } - - inline float real(Quaternion::Arg q) - { - return q.w(); - } - - - /// Transform vector. - inline Vector3 transform(Quaternion::Arg q, Vector3::Arg v) - { - Quaternion t = q * v * conjugate(q); - return imag(t); - } - } // nv namespace diff --git a/src/nvmath/Solver.cpp b/src/nvmath/Solver.cpp deleted file mode 100644 index 785376b..0000000 --- a/src/nvmath/Solver.cpp +++ /dev/null @@ -1,726 +0,0 @@ -// This code is in the public domain -- castanyo@yahoo.es - -#include - -using namespace nv; - -namespace -{ - class Preconditioner - { - public: - // Virtual dtor. - virtual ~Preconditioner() { } - - // Apply preconditioning step. - virtual void apply(const FullVector & x, FullVector & y) const = 0; - }; - - - // Jacobi preconditioner. - class JacobiPreconditioner : public Preconditioner - { - public: - - JacobiPreconditioner(const SparseMatrix & M, bool symmetric) : m_inverseDiagonal(M.width()) - { - nvCheck(M.isSquare()); - - for(uint x = 0; x < M.width(); x++) - { - float elem = M.getCoefficient(x, x); - nvDebugCheck( elem != 0.0f ); - - if (symmetric) - { - m_inverseDiagonal[x] = 1.0f / sqrt(fabs(elem)); - } - else - { - m_inverseDiagonal[x] = 1.0f / elem; - } - } - } - - void apply(const FullVector & x, FullVector & y) const - { - y *= x; - } - - private: - - FullVector m_inverseDiagonal; - - }; - -} // namespace - - -static int ConjugateGradientSolver(const SparseMatrix & A, const FullVector & b, FullVector & x, float epsilon); -static int ConjugateGradientSolver(const Preconditioner & preconditioner, const SparseMatrix & A, const FullVector & b, FullVector & x, float epsilon); - - -// Solve the symmetric system: At·A·x = At·b -void nv::LeastSquaresSolver(const SparseMatrix & A, const FullVector & b, FullVector & x, float epsilon/*1e-5f*/) -{ - nvDebugCheck(A.width() == x.dimension()); - nvDebugCheck(A.height() == b.dimension()); - nvDebugCheck(A.height() >= A.width()); // @@ If height == width we could solve it directly... - - const uint D = A.width(); - - FullVector Atb(D); - mult(Transposed, A, b, Atb); - - SparseMatrix AtA(D); - mult(Transposed, A, NoTransposed, A, AtA); - - SymmetricSolver(AtA, Atb, x, epsilon); -} - - -// See section 10.4.3 in: Mesh Parameterization: Theory and Practice, Siggraph Course Notes, August 2007 -void nv::LeastSquaresSolver(const SparseMatrix & A, const FullVector & b, FullVector & x, const uint * lockedParameters, uint lockedCount, float epsilon/*= 1e-5f*/) -{ - nvDebugCheck(A.width() == x.dimension()); - nvDebugCheck(A.height() == b.dimension()); - nvDebugCheck(A.height() >= A.width() - lockedCount); - - // @@ This is not the most efficient way of building a system with reduced degrees of freedom. It would be faster to do it on the fly. - - const uint D = A.width() - lockedCount; - nvDebugCheck(D > 0); - - // Compute: b - Al * xl - FullVector b_Alxl(b); - - for (uint y = 0; y < A.height(); y++) - { - const uint count = A.getRow(y).count(); - for (uint e = 0; e < count; e++) - { - uint column = A.getRow(y)[e].x; - - bool isFree = true; - for (uint i = 0; i < lockedCount; i++) - { - isFree &= (lockedParameters[i] != column); - } - - if (!isFree) - { - b_Alxl[y] -= x[column] * A.getRow(y)[e].v; - } - } - } - - // Remove locked columns from A. - SparseMatrix Af(D, A.height()); - - for (uint y = 0; y < A.height(); y++) - { - const uint count = A.getRow(y).count(); - for (uint e = 0; e < count; e++) - { - uint column = A.getRow(y)[e].x; - uint ix = column; - - bool isFree = true; - for (uint i = 0; i < lockedCount; i++) - { - isFree &= (lockedParameters[i] != column); - if (column > lockedParameters[i]) ix--; // shift columns - } - - if (isFree) - { - Af.setCoefficient(ix, y, A.getRow(y)[e].v); - } - } - } - - // Remove elements from x - FullVector xf(D); - - for (uint i = 0, j = 0; i < A.width(); i++) - { - bool isFree = true; - for (uint l = 0; l < lockedCount; l++) - { - isFree &= (lockedParameters[l] != i); - } - - if (isFree) - { - xf[j++] = x[i]; - } - } - - // Solve reduced system. - LeastSquaresSolver(Af, b_Alxl, xf, epsilon); - - // Copy results back to x. - for (uint i = 0, j = 0; i < A.width(); i++) - { - bool isFree = true; - for (uint l = 0; l < lockedCount; l++) - { - isFree &= (lockedParameters[l] != i); - } - - if (isFree) - { - x[i] = xf[j++]; - } - } -} - - -void nv::SymmetricSolver(const SparseMatrix & A, const FullVector & b, FullVector & x, float epsilon/*1e-5f*/) -{ - nvDebugCheck(A.height() == A.width()); - nvDebugCheck(A.height() == b.dimension()); - nvDebugCheck(b.dimension() == x.dimension()); - -// JacobiPreconditioner jacobi(A, true); - -// ConjugateGradientSolver(jacobi, A, b, x, epsilon); - ConjugateGradientSolver(A, b, x, epsilon); -} - - -/** - * Compute the solution of the sparse linear system Ab=x using the Conjugate - * Gradient method. - * - * Solving sparse linear systems: - * (1) A·x = b - * - * The conjugate gradient algorithm solves (1) only in the case that A is - * symmetric and positive definite. It is based on the idea of minimizing the - * function - * - * (2) f(x) = 1/2·x·A·x - b·x - * - * This function is minimized when its gradient - * - * (3) df = A·x - b - * - * is zero, which is equivalent to (1). The minimization is carried out by - * generating a succession of search directions p.k and improved minimizers x.k. - * At each stage a quantity alfa.k is found that minimizes f(x.k + alfa.k·p.k), - * and x.k+1 is set equal to the new point x.k + alfa.k·p.k. The p.k and x.k are - * built up in such a way that x.k+1 is also the minimizer of f over the whole - * vector space of directions already taken, {p.1, p.2, . . . , p.k}. After N - * iterations you arrive at the minimizer over the entire vector space, i.e., the - * solution to (1). - * - * For a really good explanation of the method see: - * - * "An Introduction to the Conjugate Gradient Method Without the Agonizing Pain", - * Jonhathan Richard Shewchuk. - * -**/ -/*static*/ int ConjugateGradientSolver(const SparseMatrix & A, const FullVector & b, FullVector & x, float epsilon) -{ - nvDebugCheck( A.isSquare() ); - nvDebugCheck( A.width() == b.dimension() ); - nvDebugCheck( A.width() == x.dimension() ); - - int i = 0; - const int D = A.width(); - const int i_max = 4 * D; // Convergence should be linear, but in some cases, it's not. - - FullVector r(D); // residual - FullVector p(D); // search direction - FullVector q(D); // - float delta_0; - float delta_old; - float delta_new; - float alpha; - float beta; - - // r = b - A·x; - copy(b, r); - sgemv(-1, A, x, 1, r); - - // p = r; - copy(r, p); - - delta_new = dot( r, r ); - delta_0 = delta_new; - - while (i < i_max && delta_new > epsilon*epsilon*delta_0) - { - i++; - - // q = A·p - mult(A, p, q); - - // alpha = delta_new / p·q - alpha = delta_new / dot( p, q ); - - // x = alfa·p + x - saxpy(alpha, p, x); - - if ((i & 31) == 0) // recompute r after 32 steps - { - // r = b - A·x - copy(b, r); - sgemv(-1, A, x, 1, r); - } - else - { - // r = r - alpha·q - saxpy(-alpha, q, r); - } - - delta_old = delta_new; - delta_new = dot( r, r ); - - beta = delta_new / delta_old; - - // p = r + beta·p - copy(r, p); - saxpy(beta, p, r); - } - - return i; -} - - -// Conjugate gradient with preconditioner. -/*static*/ int ConjugateGradientSolver(const Preconditioner & preconditioner, const SparseMatrix & A, const FullVector & b, FullVector & x, float epsilon) -{ - nvDebugCheck( A.isSquare() ); - nvDebugCheck( A.width() == b.dimension() ); - nvDebugCheck( A.width() == x.dimension() ); - - int i = 0; - const int D = A.width(); - const int i_max = 4 * D; // Convergence should be linear, but in some cases, it's not. - - FullVector r(D); // residual - FullVector p(D); // search direction - FullVector q(D); // - FullVector s(D); // preconditioned - float delta_0; - float delta_old; - float delta_new; - float alpha; - float beta; - - // r = b - A·x - copy(b, r); - sgemv(-1, A, x, 1, r); - - - // p = M^-1 · r - preconditioner.apply(r, p); - //copy(r, p); - - - delta_new = dot(r, p); - delta_0 = delta_new; - - while (i < i_max && delta_new > epsilon*epsilon*delta_0) - { - i++; - - // q = A·p - mult(A, p, q); - - // alpha = delta_new / p·q - alpha = delta_new / dot(p, q); - - // x = alfa·p + x - saxpy(alpha, p, x); - - if ((i & 31) == 0) // recompute r after 32 steps - { - // r = b - A·x - copy(b, r); - sgemv(-1, A, x, 1, r); - } - else - { - // r = r - alfa·q - saxpy(-alpha, q, r); - } - - // s = M^-1 · r - preconditioner.apply(r, s); - //copy(r, s); - - delta_old = delta_new; - delta_new = dot( r, s ); - - beta = delta_new / delta_old; - - // p = s + beta·p - copy(s, p); - saxpy(beta, p, s); - } - - return i; -} - - -#if 0 // Nonsymmetric solvers - -/** Bi-conjugate gradient method. */ -MATHLIB_API int BiConjugateGradientSolve( const SparseMatrix &A, const DenseVector &b, DenseVector &x, float epsilon ) { - piDebugCheck( A.IsSquare() ); - piDebugCheck( A.Width() == b.Dim() ); - piDebugCheck( A.Width() == x.Dim() ); - - int i = 0; - const int D = A.Width(); - const int i_max = 4 * D; - - float resid; - float rho_1 = 0; - float rho_2 = 0; - float alpha; - float beta; - - DenseVector r(D); - DenseVector rtilde(D); - DenseVector p(D); - DenseVector ptilde(D); - DenseVector q(D); - DenseVector qtilde(D); - DenseVector tmp(D); // temporal vector. - - // r = b - A·x; - A.Product( x, tmp ); - r.Sub( b, tmp ); - - // rtilde = r - rtilde.Set( r ); - - // p = r; - p.Set( r ); - - // ptilde = rtilde - ptilde.Set( rtilde ); - - - - float normb = b.Norm(); - if( normb == 0.0 ) normb = 1; - - // test convergence - resid = r.Norm() / normb; - if( resid < epsilon ) { - // method converges? - return 0; - } - - - while( i < i_max ) { - - i++; - - rho_1 = DenseVectorDotProduct( r, rtilde ); - - if( rho_1 == 0 ) { - // method fails. - return -i; - } - - if (i == 1) { - p.Set( r ); - ptilde.Set( rtilde ); - } - else { - beta = rho_1 / rho_2; - - // p = r + beta * p; - p.Mad( r, p, beta ); - - // ptilde = ztilde + beta * ptilde; - ptilde.Mad( rtilde, ptilde, beta ); - } - - // q = A * p; - A.Product( p, q ); - - // qtilde = A^t * ptilde; - A.TransProduct( ptilde, qtilde ); - - alpha = rho_1 / DenseVectorDotProduct( ptilde, q ); - - // x += alpha * p; - x.Mad( x, p, alpha ); - - // r -= alpha * q; - r.Mad( r, q, -alpha ); - - // rtilde -= alpha * qtilde; - rtilde.Mad( rtilde, qtilde, -alpha ); - - rho_2 = rho_1; - - // test convergence - resid = r.Norm() / normb; - if( resid < epsilon ) { - // method converges - return i; - } - } - - return i; -} - - -/** Bi-conjugate gradient stabilized method. */ -int BiCGSTABSolve( const SparseMatrix &A, const DenseVector &b, DenseVector &x, float epsilon ) { - piDebugCheck( A.IsSquare() ); - piDebugCheck( A.Width() == b.Dim() ); - piDebugCheck( A.Width() == x.Dim() ); - - int i = 0; - const int D = A.Width(); - const int i_max = 2 * D; - - - float resid; - float rho_1 = 0; - float rho_2 = 0; - float alpha = 0; - float beta = 0; - float omega = 0; - - DenseVector p(D); - DenseVector phat(D); - DenseVector s(D); - DenseVector shat(D); - DenseVector t(D); - DenseVector v(D); - - DenseVector r(D); - DenseVector rtilde(D); - - DenseVector tmp(D); - - // r = b - A·x; - A.Product( x, tmp ); - r.Sub( b, tmp ); - - // rtilde = r - rtilde.Set( r ); - - - float normb = b.Norm(); - if( normb == 0.0 ) normb = 1; - - // test convergence - resid = r.Norm() / normb; - if( resid < epsilon ) { - // method converges? - return 0; - } - - - while( i - -namespace nv -{ - - // Linear solvers. - NVMATH_API void LeastSquaresSolver(const SparseMatrix & A, const FullVector & b, FullVector & x, float epsilon = 1e-5f); - NVMATH_API void LeastSquaresSolver(const SparseMatrix & A, const FullVector & b, FullVector & x, const uint * lockedParameters, uint lockedCount, float epsilon = 1e-5f); - NVMATH_API void SymmetricSolver(const SparseMatrix & A, const FullVector & b, FullVector & x, float epsilon = 1e-5f); -// NVMATH_API void NonSymmetricSolver(const SparseMatrix & A, const FullVector & b, FullVector & x, float epsilon = 1e-5f); - -} // nv namespace - - -#endif // NV_MATH_SOLVER_H diff --git a/src/nvmath/Sparse.cpp b/src/nvmath/Sparse.cpp deleted file mode 100644 index 885c49f..0000000 --- a/src/nvmath/Sparse.cpp +++ /dev/null @@ -1,831 +0,0 @@ -// This code is in the public domain -- Ignacio Castaño - -#include -#include - -using namespace nv; - - -/// Ctor. -FullVector::FullVector(uint dim) -{ - m_array.resize(dim); -} - -/// Copy ctor. -FullVector::FullVector(const FullVector & v) : m_array(v.m_array) -{ -} - -/// Copy operator -const FullVector & FullVector::operator=(const FullVector & v) -{ - nvCheck(dimension() == v.dimension()); - - m_array = v.m_array; - - return *this; -} - - -void FullVector::fill(float f) -{ - const uint dim = dimension(); - for (uint i = 0; i < dim; i++) - { - m_array[i] = f; - } -} - -void FullVector::operator+= (const FullVector & v) -{ - nvDebugCheck(dimension() == v.dimension()); - - const uint dim = dimension(); - for (uint i = 0; i < dim; i++) - { - m_array[i] += v.m_array[i]; - } -} - -void FullVector::operator-= (const FullVector & v) -{ - nvDebugCheck(dimension() == v.dimension()); - - const uint dim = dimension(); - for (uint i = 0; i < dim; i++) - { - m_array[i] -= v.m_array[i]; - } -} - -void FullVector::operator*= (const FullVector & v) -{ - nvDebugCheck(dimension() == v.dimension()); - - const uint dim = dimension(); - for (uint i = 0; i < dim; i++) - { - m_array[i] *= v.m_array[i]; - } -} - -void FullVector::operator+= (float f) -{ - const uint dim = dimension(); - for (uint i = 0; i < dim; i++) - { - m_array[i] += f; - } -} - -void FullVector::operator-= (float f) -{ - const uint dim = dimension(); - for (uint i = 0; i < dim; i++) - { - m_array[i] -= f; - } -} - -void FullVector::operator*= (float f) -{ - const uint dim = dimension(); - for (uint i = 0; i < dim; i++) - { - m_array[i] *= f; - } -} - - -void nv::saxpy(float a, const FullVector & x, FullVector & y) -{ - nvDebugCheck(x.dimension() == y.dimension()); - - const uint dim = x.dimension(); - for (uint i = 0; i < dim; i++) - { - y[i] += a * x[i]; - } -} - -void nv::copy(const FullVector & x, FullVector & y) -{ - nvDebugCheck(x.dimension() == y.dimension()); - - const uint dim = x.dimension(); - for (uint i = 0; i < dim; i++) - { - y[i] = x[i]; - } -} - -void nv::scal(float a, FullVector & x) -{ - const uint dim = x.dimension(); - for (uint i = 0; i < dim; i++) - { - x[i] *= a; - } -} - -float nv::dot(const FullVector & x, const FullVector & y) -{ - nvDebugCheck(x.dimension() == y.dimension()); - - const uint dim = x.dimension(); - - /*float sum = 0; - for (uint i = 0; i < dim; i++) - { - sum += x[i] * y[i]; - } - return sum;*/ - - KahanSum kahan; - - for (uint i = 0; i < dim; i++) - { - kahan.add(x[i] * y[i]); - } - - return kahan.sum(); -} - - -FullMatrix::FullMatrix(uint d) : m_width(d), m_height(d) -{ - m_array.resize(d*d, 0.0f); -} - -FullMatrix::FullMatrix(uint w, uint h) : m_width(w), m_height(h) -{ - m_array.resize(w*h, 0.0f); -} - -FullMatrix::FullMatrix(const FullMatrix & m) : m_width(m.m_width), m_height(m.m_height) -{ - m_array = m.m_array; -} - -const FullMatrix & FullMatrix::operator=(const FullMatrix & m) -{ - nvCheck(width() == m.width()); - nvCheck(height() == m.height()); - - m_array = m.m_array; - - return *this; -} - - -float FullMatrix::getCoefficient(uint x, uint y) const -{ - nvDebugCheck( x < width() ); - nvDebugCheck( y < height() ); - - return m_array[y * width() + x]; -} - -void FullMatrix::setCoefficient(uint x, uint y, float f) -{ - nvDebugCheck( x < width() ); - nvDebugCheck( y < height() ); - - m_array[y * width() + x] = f; -} - -void FullMatrix::addCoefficient(uint x, uint y, float f) -{ - nvDebugCheck( x < width() ); - nvDebugCheck( y < height() ); - - m_array[y * width() + x] += f; -} - -void FullMatrix::mulCoefficient(uint x, uint y, float f) -{ - nvDebugCheck( x < width() ); - nvDebugCheck( y < height() ); - - m_array[y * width() + x] *= f; -} - -float FullMatrix::dotRow(uint y, const FullVector & v) const -{ - nvDebugCheck( v.dimension() == width() ); - nvDebugCheck( y < height() ); - - float sum = 0; - - const uint count = v.dimension(); - for (uint i = 0; i < count; i++) - { - sum += m_array[y * count + i] * v[i]; - } - - return sum; -} - -void FullMatrix::madRow(uint y, float alpha, FullVector & v) const -{ - nvDebugCheck( v.dimension() == width() ); - nvDebugCheck( y < height() ); - - const uint count = v.dimension(); - for (uint i = 0; i < count; i++) - { - v[i] += m_array[y * count + i]; - } -} - - -// y = M * x -void nv::mult(const FullMatrix & M, const FullVector & x, FullVector & y) -{ - mult(NoTransposed, M, x, y); -} - -void nv::mult(Transpose TM, const FullMatrix & M, const FullVector & x, FullVector & y) -{ - const uint w = M.width(); - const uint h = M.height(); - - if (TM == Transposed) - { - nvDebugCheck( h == x.dimension() ); - nvDebugCheck( w == y.dimension() ); - - y.fill(0.0f); - - for (uint i = 0; i < h; i++) - { - M.madRow(i, x[i], y); - } - } - else - { - nvDebugCheck( w == x.dimension() ); - nvDebugCheck( h == y.dimension() ); - - for (uint i = 0; i < h; i++) - { - y[i] = M.dotRow(i, x); - } - } -} - -// y = alpha*A*x + beta*y -void nv::sgemv(float alpha, const FullMatrix & A, const FullVector & x, float beta, FullVector & y) -{ - sgemv(alpha, NoTransposed, A, x, beta, y); -} - -void nv::sgemv(float alpha, Transpose TA, const FullMatrix & A, const FullVector & x, float beta, FullVector & y) -{ - const uint w = A.width(); - const uint h = A.height(); - - if (TA == Transposed) - { - nvDebugCheck( h == x.dimension() ); - nvDebugCheck( w == y.dimension() ); - - for (uint i = 0; i < h; i++) - { - A.madRow(i, alpha * x[i], y); - } - } - else - { - nvDebugCheck( w == x.dimension() ); - nvDebugCheck( h == y.dimension() ); - - for (uint i = 0; i < h; i++) - { - y[i] = alpha * A.dotRow(i, x) + beta * y[i]; - } - } -} - - -// Multiply a row of A by a column of B. -static float dot(uint j, Transpose TA, const FullMatrix & A, uint i, Transpose TB, const FullMatrix & B) -{ - const uint w = (TA == NoTransposed) ? A.width() : A.height(); - nvDebugCheck(w == (TB == NoTransposed) ? B.height() : A.width()); - - float sum = 0.0f; - - for (uint k = 0; k < w; k++) - { - const float a = (TA == NoTransposed) ? A.getCoefficient(k, j) : A.getCoefficient(j, k); // @@ Move branches out of the loop? - const float b = (TB == NoTransposed) ? B.getCoefficient(i, k) : A.getCoefficient(k, i); - sum += a * b; - } - - return sum; -} - - -// C = A * B -void nv::mult(const FullMatrix & A, const FullMatrix & B, FullMatrix & C) -{ - mult(NoTransposed, A, NoTransposed, B, C); -} - -void nv::mult(Transpose TA, const FullMatrix & A, Transpose TB, const FullMatrix & B, FullMatrix & C) -{ - sgemm(1.0f, TA, A, TB, B, 0.0f, C); -} - -// C = alpha*A*B + beta*C -void nv::sgemm(float alpha, const FullMatrix & A, const FullMatrix & B, float beta, FullMatrix & C) -{ - sgemm(alpha, NoTransposed, A, NoTransposed, B, beta, C); -} - -void nv::sgemm(float alpha, Transpose TA, const FullMatrix & A, Transpose TB, const FullMatrix & B, float beta, FullMatrix & C) -{ - const uint w = C.width(); - const uint h = C.height(); - - uint aw = (TA == NoTransposed) ? A.width() : A.height(); - uint ah = (TA == NoTransposed) ? A.height() : A.width(); - uint bw = (TB == NoTransposed) ? B.width() : B.height(); - uint bh = (TB == NoTransposed) ? B.height() : B.width(); - - nvDebugCheck(aw == bh); - nvDebugCheck(bw == ah); - nvDebugCheck(w == bw); - nvDebugCheck(h == ah); - - for (uint y = 0; y < h; y++) - { - for (uint x = 0; x < w; x++) - { - float c = alpha * ::dot(x, TA, A, y, TB, B) + beta * C.getCoefficient(x, y); - C.setCoefficient(x, y, c); - } - } -} - - - - - -/// Ctor. Init the size of the sparse matrix. -SparseMatrix::SparseMatrix(uint d) : m_width(d) -{ - m_array.resize(d); -} - -/// Ctor. Init the size of the sparse matrix. -SparseMatrix::SparseMatrix(uint w, uint h) : m_width(w) -{ - m_array.resize(h); -} - -SparseMatrix::SparseMatrix(const SparseMatrix & m) : m_width(m.m_width) -{ - m_array = m.m_array; -} - -const SparseMatrix & SparseMatrix::operator=(const SparseMatrix & m) -{ - nvCheck(width() == m.width()); - nvCheck(height() == m.height()); - - m_array = m.m_array; - - return *this; -} - - -// x is column, y is row -float SparseMatrix::getCoefficient(uint x, uint y) const -{ - nvDebugCheck( x < width() ); - nvDebugCheck( y < height() ); - - const uint count = m_array[y].count(); - for (uint i = 0; i < count; i++) - { - if (m_array[y][i].x == x) return m_array[y][i].v; - } - - return 0.0f; -} - -void SparseMatrix::setCoefficient(uint x, uint y, float f) -{ - nvDebugCheck( x < width() ); - nvDebugCheck( y < height() ); - - const uint count = m_array[y].count(); - for (uint i = 0; i < count; i++) - { - if (m_array[y][i].x == x) - { - m_array[y][i].v = f; - return; - } - } - - Coefficient c = { x, f }; - m_array[y].append( c ); -} - -void SparseMatrix::addCoefficient(uint x, uint y, float f) -{ - nvDebugCheck( x < width() ); - nvDebugCheck( y < height() ); - - const uint count = m_array[y].count(); - for (uint i = 0; i < count; i++) - { - if (m_array[y][i].x == x) - { - m_array[y][i].v += f; - return; - } - } - - Coefficient c = { x, f }; - m_array[y].append( c ); -} - -void SparseMatrix::mulCoefficient(uint x, uint y, float f) -{ - nvDebugCheck( x < width() ); - nvDebugCheck( y < height() ); - - const uint count = m_array[y].count(); - for (uint i = 0; i < count; i++) - { - if (m_array[y][i].x == x) - { - m_array[y][i].v *= f; - return; - } - } - - Coefficient c = { x, f }; - m_array[y].append( c ); -} - - -float SparseMatrix::sumRow(uint y) const -{ - nvDebugCheck( y < height() ); - - const uint count = m_array[y].count(); - - /*float sum = 0; - for (uint i = 0; i < count; i++) - { - sum += m_array[y][i].v; - } - return sum;*/ - - KahanSum kahan; - - for (uint i = 0; i < count; i++) - { - kahan.add(m_array[y][i].v); - } - - return kahan.sum(); -} - -float SparseMatrix::dotRow(uint y, const FullVector & v) const -{ - nvDebugCheck( y < height() ); - - const uint count = m_array[y].count(); - - /*float sum = 0; - for (uint i = 0; i < count; i++) - { - sum += m_array[y][i].v * v[m_array[y][i].x]; - } - return sum;*/ - - KahanSum kahan; - - for (uint i = 0; i < count; i++) - { - kahan.add(m_array[y][i].v * v[m_array[y][i].x]); - } - - return kahan.sum(); -} - -void SparseMatrix::madRow(uint y, float alpha, FullVector & v) const -{ - nvDebugCheck(y < height()); - - const uint count = m_array[y].count(); - for (uint i = 0; i < count; i++) - { - v[m_array[y][i].x] += alpha * m_array[y][i].v; - } -} - - -void SparseMatrix::clearRow(uint y) -{ - nvDebugCheck( y < height() ); - - m_array[y].clear(); -} - -void SparseMatrix::scaleRow(uint y, float f) -{ - nvDebugCheck( y < height() ); - - const uint count = m_array[y].count(); - for (uint i = 0; i < count; i++) - { - m_array[y][i].v *= f; - } -} - -void SparseMatrix::normalizeRow(uint y) -{ - nvDebugCheck( y < height() ); - - float norm = 0.0f; - - const uint count = m_array[y].count(); - for (uint i = 0; i < count; i++) - { - float f = m_array[y][i].v; - norm += f * f; - } - - scaleRow(y, 1.0f / sqrtf(norm)); -} - - -void SparseMatrix::clearColumn(uint x) -{ - nvDebugCheck(x < width()); - - for (uint y = 0; y < height(); y++) - { - const uint count = m_array[y].count(); - for (uint e = 0; e < count; e++) - { - if (m_array[y][e].x == x) - { - m_array[y][e].v = 0.0f; - break; - } - } - } -} - -void SparseMatrix::scaleColumn(uint x, float f) -{ - nvDebugCheck(x < width()); - - for (uint y = 0; y < height(); y++) - { - const uint count = m_array[y].count(); - for (uint e = 0; e < count; e++) - { - if (m_array[y][e].x == x) - { - m_array[y][e].v *= f; - break; - } - } - } -} - -const Array & SparseMatrix::getRow(uint y) const -{ - return m_array[y]; -} - - -// y = M * x -void nv::mult(const SparseMatrix & M, const FullVector & x, FullVector & y) -{ - mult(NoTransposed, M, x, y); -} - -void nv::mult(Transpose TM, const SparseMatrix & M, const FullVector & x, FullVector & y) -{ - const uint w = M.width(); - const uint h = M.height(); - - if (TM == Transposed) - { - nvDebugCheck( h == x.dimension() ); - nvDebugCheck( w == y.dimension() ); - - y.fill(0.0f); - - for (uint i = 0; i < h; i++) - { - M.madRow(i, x[i], y); - } - } - else - { - nvDebugCheck( w == x.dimension() ); - nvDebugCheck( h == y.dimension() ); - - for (uint i = 0; i < h; i++) - { - y[i] = M.dotRow(i, x); - } - } -} - -// y = alpha*A*x + beta*y -void nv::sgemv(float alpha, const SparseMatrix & A, const FullVector & x, float beta, FullVector & y) -{ - sgemv(alpha, NoTransposed, A, x, beta, y); -} - -void nv::sgemv(float alpha, Transpose TA, const SparseMatrix & A, const FullVector & x, float beta, FullVector & y) -{ - const uint w = A.width(); - const uint h = A.height(); - - if (TA == Transposed) - { - nvDebugCheck( h == x.dimension() ); - nvDebugCheck( w == y.dimension() ); - - for (uint i = 0; i < h; i++) - { - A.madRow(i, alpha * x[i], y); - } - } - else - { - nvDebugCheck( w == x.dimension() ); - nvDebugCheck( h == y.dimension() ); - - for (uint i = 0; i < h; i++) - { - y[i] = alpha * A.dotRow(i, x) + beta * y[i]; - } - } -} - - -// dot y-row of A by x-column of B -static float dotRowColumn(int y, const SparseMatrix & A, int x, const SparseMatrix & B) -{ - const Array & row = A.getRow(y); - - const uint count = row.count(); - - /*float sum = 0.0f; - for (uint i = 0; i < count; i++) - { - const SparseMatrix::Coefficient & c = row[i]; - sum += c.v * B.getCoefficient(x, c.x); - } - return sum;*/ - - KahanSum kahan; - for (uint i = 0; i < count; i++) - { - const SparseMatrix::Coefficient & c = row[i]; - kahan.add(c.v * B.getCoefficient(x, c.x)); - } - - return kahan.sum(); -} - -// dot y-row of A by x-row of B -static float dotRowRow(int y, const SparseMatrix & A, int x, const SparseMatrix & B) -{ - const Array & row = A.getRow(y); - - const uint count = row.count(); - - /*float sum = 0.0f; - for (uint i = 0; i < count; i++) - { - const SparseMatrix::Coefficient & c = row[i]; - sum += c.v * B.getCoefficient(c.x, x); - } - //return sum;*/ - - KahanSum kahan; - for (uint i = 0; i < count; i++) - { - const SparseMatrix::Coefficient & c = row[i]; - kahan.add(c.v * B.getCoefficient(c.x, x)); - } - - return kahan.sum(); -} - -// dot y-column of A by x-column of B -static float dotColumnColumn(int y, const SparseMatrix & A, int x, const SparseMatrix & B) -{ - nvDebugCheck(A.height() == B.height()); - - const uint h = A.height(); - - /*float sum = 0.0f; - for (uint i = 0; i < h; i++) - { - sum += A.getCoefficient(y, i) * B.getCoefficient(x, i); - } - //return sum;*/ - - KahanSum kahan; - for (uint i = 0; i < h; i++) - { - kahan.add(A.getCoefficient(y, i) * B.getCoefficient(x, i)); - } - - return kahan.sum(); -} - - - -// C = A * B -void nv::mult(const SparseMatrix & A, const SparseMatrix & B, SparseMatrix & C) -{ - mult(NoTransposed, A, NoTransposed, B, C); -} - -void nv::mult(Transpose TA, const SparseMatrix & A, Transpose TB, const SparseMatrix & B, SparseMatrix & C) -{ - sgemm(1.0f, TA, A, TB, B, 0.0f, C); -} - -// C = alpha*A*B + beta*C -void nv::sgemm(float alpha, const SparseMatrix & A, const SparseMatrix & B, float beta, SparseMatrix & C) -{ - sgemm(alpha, NoTransposed, A, NoTransposed, B, beta, C); -} - -void nv::sgemm(float alpha, Transpose TA, const SparseMatrix & A, Transpose TB, const SparseMatrix & B, float beta, SparseMatrix & C) -{ - const uint w = C.width(); - const uint h = C.height(); - - uint aw = (TA == NoTransposed) ? A.width() : A.height(); - uint ah = (TA == NoTransposed) ? A.height() : A.width(); - uint bw = (TB == NoTransposed) ? B.width() : B.height(); - uint bh = (TB == NoTransposed) ? B.height() : B.width(); - - nvDebugCheck(aw == bh); - nvDebugCheck(bw == ah); - nvDebugCheck(w == bw); - nvDebugCheck(h == ah); - - - for (uint y = 0; y < h; y++) - { - for (uint x = 0; x < w; x++) - { - float c = beta * C.getCoefficient(x, y); - - if (TA == NoTransposed && TB == NoTransposed) - { - // dot y-row of A by x-column of B. - c += alpha * dotRowColumn(y, A, x, B); - } - else if (TA == Transposed && TB == Transposed) - { - // dot y-column of A by x-row of B. - c += alpha * dotRowColumn(x, B, y, A); - } - else if (TA == Transposed && TB == NoTransposed) - { - // dot y-column of A by x-column of B. - c += alpha * dotColumnColumn(y, A, x, B); - } - else if (TA == NoTransposed && TB == Transposed) - { - // dot y-row of A by x-row of B. - c += alpha * dotRowRow(y, A, x, B); - } - - if (c != 0.0f) - { - C.setCoefficient(x, y, c); - } - } - } - -} - -// C = At * A -void nv::sqm(const SparseMatrix & A, SparseMatrix & C) -{ - // This is quite expensive... - mult(Transposed, A, NoTransposed, A, C); -} diff --git a/src/nvmath/Sparse.h b/src/nvmath/Sparse.h deleted file mode 100644 index 29439f8..0000000 --- a/src/nvmath/Sparse.h +++ /dev/null @@ -1,198 +0,0 @@ -// This code is in the public domain -- castanyo@yahoo.es - -#ifndef NV_MATH_SPARSE_H -#define NV_MATH_SPARSE_H - -#include -#include - -// Full and sparse vector and matrix classes. BLAS subset. - -namespace nv -{ - class FullVector; - class FullMatrix; - class SparseMatrix; - - - /// Fixed size vector class. - class FullVector - { - public: - - FullVector(uint dim); - FullVector(const FullVector & v); - - const FullVector & operator=(const FullVector & v); - - uint dimension() const { return m_array.count(); } - - const float & operator[]( uint index ) const { return m_array[index]; } - float & operator[] ( uint index ) { return m_array[index]; } - - void fill(float f); - - void operator+= (const FullVector & v); - void operator-= (const FullVector & v); - void operator*= (const FullVector & v); - - void operator+= (float f); - void operator-= (float f); - void operator*= (float f); - - - private: - - Array m_array; - - }; - - // Pseudo-BLAS interface. - NVMATH_API void saxpy(float a, const FullVector & x, FullVector & y); // y = a * x + y - NVMATH_API void copy(const FullVector & x, FullVector & y); - NVMATH_API void scal(float a, FullVector & x); - NVMATH_API float dot(const FullVector & x, const FullVector & y); - - - enum Transpose - { - NoTransposed = 0, - Transposed = 1 - }; - - /// Full matrix class. - class FullMatrix - { - public: - - FullMatrix(uint d); - FullMatrix(uint w, uint h); - FullMatrix(const FullMatrix & m); - - const FullMatrix & operator=(const FullMatrix & m); - - uint width() const { return m_width; } - uint height() const { return m_height; } - bool isSquare() const { return m_width == m_height; } - - float getCoefficient(uint x, uint y) const; - - void setCoefficient(uint x, uint y, float f); - void addCoefficient(uint x, uint y, float f); - void mulCoefficient(uint x, uint y, float f); - - float dotRow(uint y, const FullVector & v) const; - void madRow(uint y, float alpha, FullVector & v) const; - - protected: - - bool isValid() const { - return m_array.size() == (m_width * m_height); - } - - private: - - const uint m_width; - const uint m_height; - Array m_array; - - }; - - NVMATH_API void mult(const FullMatrix & M, const FullVector & x, FullVector & y); - NVMATH_API void mult(Transpose TM, const FullMatrix & M, const FullVector & x, FullVector & y); - - // y = alpha*A*x + beta*y - NVMATH_API void sgemv(float alpha, const FullMatrix & A, const FullVector & x, float beta, FullVector & y); - NVMATH_API void sgemv(float alpha, Transpose TA, const FullMatrix & A, const FullVector & x, float beta, FullVector & y); - - NVMATH_API void mult(const FullMatrix & A, const FullMatrix & B, FullMatrix & C); - NVMATH_API void mult(Transpose TA, const FullMatrix & A, Transpose TB, const FullMatrix & B, FullMatrix & C); - - // C = alpha*A*B + beta*C - NVMATH_API void sgemm(float alpha, const FullMatrix & A, const FullMatrix & B, float beta, FullMatrix & C); - NVMATH_API void sgemm(float alpha, Transpose TA, const FullMatrix & A, Transpose TB, const FullMatrix & B, float beta, FullMatrix & C); - - - /** - * Sparse matrix class. The matrix is assumed to be sparse and to have - * very few non-zero elements, for this reason it's stored in indexed - * format. To multiply column vectors efficiently, the matrix stores - * the elements in indexed-column order, there is a list of indexed - * elements for each row of the matrix. As with the FullVector the - * dimension of the matrix is constant. - **/ - class SparseMatrix - { - friend class FullMatrix; - public: - - // An element of the sparse array. - struct Coefficient { - uint x; // column - float v; // value - }; - - - public: - - SparseMatrix(uint d); - SparseMatrix(uint w, uint h); - SparseMatrix(const SparseMatrix & m); - - const SparseMatrix & operator=(const SparseMatrix & m); - - - uint width() const { return m_width; } - uint height() const { return m_array.count(); } - bool isSquare() const { return width() == height(); } - - float getCoefficient(uint x, uint y) const; // x is column, y is row - - void setCoefficient(uint x, uint y, float f); - void addCoefficient(uint x, uint y, float f); - void mulCoefficient(uint x, uint y, float f); - - float sumRow(uint y) const; - float dotRow(uint y, const FullVector & v) const; - void madRow(uint y, float alpha, FullVector & v) const; - - void clearRow(uint y); - void scaleRow(uint y, float f); - void normalizeRow(uint y); - - void clearColumn(uint x); - void scaleColumn(uint x, float f); - - const Array & getRow(uint y) const; - - private: - - /// Number of columns. - const uint m_width; - - /// Array of matrix elements. - Array< Array > m_array; - - }; - - NVMATH_API void mult(const SparseMatrix & M, const FullVector & x, FullVector & y); - NVMATH_API void mult(Transpose TM, const SparseMatrix & M, const FullVector & x, FullVector & y); - - // y = alpha*A*x + beta*y - NVMATH_API void sgemv(float alpha, const SparseMatrix & A, const FullVector & x, float beta, FullVector & y); - NVMATH_API void sgemv(float alpha, Transpose TA, const SparseMatrix & A, const FullVector & x, float beta, FullVector & y); - - NVMATH_API void mult(const SparseMatrix & A, const SparseMatrix & B, SparseMatrix & C); - NVMATH_API void mult(Transpose TA, const SparseMatrix & A, Transpose TB, const SparseMatrix & B, SparseMatrix & C); - - // C = alpha*A*B + beta*C - NVMATH_API void sgemm(float alpha, const SparseMatrix & A, const SparseMatrix & B, float beta, SparseMatrix & C); - NVMATH_API void sgemm(float alpha, Transpose TA, const SparseMatrix & A, Transpose TB, const SparseMatrix & B, float beta, SparseMatrix & C); - - // C = At * A - NVMATH_API void sqm(const SparseMatrix & A, SparseMatrix & C); - -} // nv namespace - - -#endif // NV_MATH_SPARSE_H diff --git a/src/nvmath/SphericalHarmonic.cpp b/src/nvmath/SphericalHarmonic.cpp index 256045b..f005b51 100644 --- a/src/nvmath/SphericalHarmonic.cpp +++ b/src/nvmath/SphericalHarmonic.cpp @@ -11,10 +11,8 @@ namespace // Basic integer factorial. inline static int factorial( int v ) { - const static int fac_table[] = { 1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800 }; - - if(v <= 11){ - return fac_table[v]; + if (v == 0) { + return 1; } int result = v; diff --git a/src/nvmath/SphericalHarmonic.h b/src/nvmath/SphericalHarmonic.h index a925d93..7e8341c 100644 --- a/src/nvmath/SphericalHarmonic.h +++ b/src/nvmath/SphericalHarmonic.h @@ -3,7 +3,6 @@ #ifndef NV_MATH_SPHERICALHARMONIC_H #define NV_MATH_SPHERICALHARMONIC_H -#include // memcpy #include namespace nv diff --git a/src/nvmath/TriBox.cpp b/src/nvmath/TriBox.cpp index f58af13..61d69bb 100644 --- a/src/nvmath/TriBox.cpp +++ b/src/nvmath/TriBox.cpp @@ -96,7 +96,7 @@ static bool planeBoxOverlap(Vector3::Arg normal, Vector3::Arg vert, Vector3::Arg if(min>rad || max<-rad) return false; -bool nv::triBoxOverlap(Vector3::Arg boxcenter, Vector3::Arg boxhalfsize, const Triangle & tri) +bool triBoxOverlap(Vector3::Arg boxcenter, Vector3::Arg boxhalfsize, const Triangle & tri) { // use separating axis theorem to test overlap between triangle and box // need to test for overlap in these directions: @@ -170,7 +170,7 @@ bool nv::triBoxOverlap(Vector3::Arg boxcenter, Vector3::Arg boxhalfsize, const T } -bool nv::triBoxOverlapNoBounds(Vector3::Arg boxcenter, Vector3::Arg boxhalfsize, const Triangle & tri) +bool triBoxOverlapNoBounds(Vector3::Arg boxcenter, Vector3::Arg boxhalfsize, const Triangle & tri) { // use separating axis theorem to test overlap between triangle and box // need to test for overlap in these directions: diff --git a/src/nvmath/TypeSerialization.cpp b/src/nvmath/TypeSerialization.cpp deleted file mode 100644 index d70ddeb..0000000 --- a/src/nvmath/TypeSerialization.cpp +++ /dev/null @@ -1,82 +0,0 @@ -// This code is in the public domain -- castanyo@yahoo.es - -#include - -#include -#include -#include -#include -#include - -#include - -using namespace nv; - -Stream & nv::operator<< (Stream & s, Vector2 & v) -{ - float x = v.x(); - float y = v.y(); - - s << x << y; - - if (s.isLoading()) - { - v.set(x, y); - } - - return s; -} - -Stream & nv::operator<< (Stream & s, Vector3 & v) -{ - float x = v.x(); - float y = v.y(); - float z = v.z(); - - s << x << y << z; - - if (s.isLoading()) - { - v.set(x, y, z); - } - - return s; -} - -Stream & nv::operator<< (Stream & s, Vector4 & v) -{ - float x = v.x(); - float y = v.y(); - float z = v.z(); - float w = v.w(); - - s << x << y << z << w; - - if (s.isLoading()) - { - v.set(x, y, z, w); - } - - return s; -} - -Stream & nv::operator<< (Stream & s, Matrix & m) -{ - return s; -} - -Stream & nv::operator<< (Stream & s, Quaternion & q) -{ - return s << q.asVector(); -} - -Stream & nv::operator<< (Stream & s, Basis & basis) -{ - return s << basis.tangent << basis.bitangent << basis.normal; -} - -Stream & nv::operator<< (Stream & s, Box & box) -{ - return s << box.m_mins << box.m_maxs; -} - diff --git a/src/nvmath/TypeSerialization.h b/src/nvmath/TypeSerialization.h deleted file mode 100644 index 3c50a24..0000000 --- a/src/nvmath/TypeSerialization.h +++ /dev/null @@ -1,32 +0,0 @@ -// This code is in the public domain -- castanyo@yahoo.es - -#ifndef NV_MATH_TYPESERIALIZATION_H -#define NV_MATH_TYPESERIALIZATION_H - -#include - -namespace nv -{ - class Stream; - - class Vector2; - class Vector3; - class Vector4; - - class Matrix; - class Quaternion; - struct Basis; - class Box; - - NVMATH_API Stream & operator<< (Stream & s, Vector2 & obj); - NVMATH_API Stream & operator<< (Stream & s, Vector3 & obj); - NVMATH_API Stream & operator<< (Stream & s, Vector4 & obj); - - NVMATH_API Stream & operator<< (Stream & s, Matrix & obj); - NVMATH_API Stream & operator<< (Stream & s, Quaternion & obj); - NVMATH_API Stream & operator<< (Stream & s, Basis & obj); - NVMATH_API Stream & operator<< (Stream & s, Box & obj); - -} // nv namespace - -#endif // NV_MATH_TYPESERIALIZATION_H diff --git a/src/nvmath/Vector.h b/src/nvmath/Vector.h index d474090..bffdfbe 100644 --- a/src/nvmath/Vector.h +++ b/src/nvmath/Vector.h @@ -4,7 +4,7 @@ #define NV_MATH_VECTOR_H #include -#include // min, max +#include // min, max namespace nv { @@ -71,7 +71,6 @@ public: const Vector2 & xy() const; scalar component(uint idx) const; - void setComponent(uint idx, scalar f); const scalar * ptr() const; @@ -240,21 +239,13 @@ inline const Vector2 & Vector3::xy() const inline scalar Vector3::component(uint idx) const { nvDebugCheck(idx < 3); - if (idx == 0) return m_x; - if (idx == 1) return m_y; - if (idx == 2) return m_z; + if (idx == 0) return x(); + if (idx == 1) return y(); + if (idx == 2) return z(); nvAssume(false); return 0.0f; } -inline void Vector3::setComponent(uint idx, float f) -{ - nvDebugCheck(idx < 3); - if (idx == 0) m_x = f; - else if (idx == 1) m_y = f; - else if (idx == 2) m_z = f; -} - inline const scalar * Vector3::ptr() const { return &m_x; @@ -486,35 +477,6 @@ inline scalar length(Vector2::Arg v) return sqrtf(length_squared(v)); } -inline scalar inverse_length(Vector2::Arg v) -{ - return 1.0f / sqrtf(length_squared(v)); -} - -inline bool isNormalized(Vector2::Arg v, float epsilon = NV_NORMAL_EPSILON) -{ - return equal(length(v), 1, epsilon); -} - -inline Vector2 normalize(Vector2::Arg v, float epsilon = NV_EPSILON) -{ - float l = length(v); - nvDebugCheck(!isZero(l, epsilon)); - Vector2 n = scale(v, 1.0f / l); - nvDebugCheck(isNormalized(n)); - return n; -} - -inline Vector2 normalizeSafe(Vector2::Arg v, Vector2::Arg fallback, float epsilon = NV_EPSILON) -{ - float l = length(v); - if (isZero(l, epsilon)) { - return fallback; - } - return scale(v, 1.0f / l); -} - - inline bool equal(Vector2::Arg v1, Vector2::Arg v2, float epsilon = NV_EPSILON) { return equal(v1.x(), v2.x(), epsilon) && equal(v1.y(), v2.y(), epsilon); @@ -633,11 +595,6 @@ inline scalar length(Vector3::Arg v) return sqrtf(length_squared(v)); } -inline scalar inverse_length(Vector3::Arg v) -{ - return 1.0f / sqrtf(length_squared(v)); -} - inline bool isNormalized(Vector3::Arg v, float epsilon = NV_NORMAL_EPSILON) { return equal(length(v), 1, epsilon); @@ -759,11 +716,6 @@ inline scalar length(Vector4::Arg v) return sqrtf(length_squared(v)); } -inline scalar inverse_length(Vector4::Arg v) -{ - return 1.0f / sqrtf(length_squared(v)); -} - inline bool isNormalized(Vector4::Arg v, float epsilon = NV_NORMAL_EPSILON) { return equal(length(v), 1, epsilon); diff --git a/src/nvmath/nvmath.h b/src/nvmath/nvmath.h index 1bba967..7710921 100644 --- a/src/nvmath/nvmath.h +++ b/src/nvmath/nvmath.h @@ -136,11 +136,6 @@ inline float lerp(float f0, float f1, float t) return f0 * s + f1 * t; } -inline float square(float f) -{ - return f * f; -} - } // nv #endif // NV_MATH_H diff --git a/src/nvtt/CMakeLists.txt b/src/nvtt/CMakeLists.txt index e9b951a..e1d8e3c 100644 --- a/src/nvtt/CMakeLists.txt +++ b/src/nvtt/CMakeLists.txt @@ -79,15 +79,12 @@ TARGET_LINK_LIBRARIES(nvassemble nvcore nvmath nvimage) ADD_EXECUTABLE(filtertest tests/filtertest.cpp tools/cmdline.h) TARGET_LINK_LIBRARIES(filtertest nvcore nvmath nvimage) -ADD_EXECUTABLE(stress tests/stress.cpp tools/cmdline.h) -TARGET_LINK_LIBRARIES(stress nvcore nvmath nvimage nvtt) - ADD_EXECUTABLE(nvzoom tools/resize.cpp tools/cmdline.h) TARGET_LINK_LIBRARIES(nvzoom nvcore nvmath nvimage) INSTALL(TARGETS nvcompress nvdecompress nvddsinfo nvimgdiff nvassemble nvzoom DESTINATION bin) -# UI tools +# UI tools IF(QT4_FOUND AND NOT MSVC) SET(QT_USE_QTOPENGL TRUE) INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) @@ -109,7 +106,7 @@ IF(QT4_FOUND AND NOT MSVC) ADD_EXECUTABLE(nvcompressui MACOSX_BUNDLE ${SRCS} ${UICS} ${MOCS}) TARGET_LINK_LIBRARIES(nvcompressui ${LIBS}) - + ENDIF(QT4_FOUND AND NOT MSVC) diff --git a/src/nvtt/CompressDXT.cpp b/src/nvtt/CompressDXT.cpp index 24eb48d..19124dc 100644 --- a/src/nvtt/CompressDXT.cpp +++ b/src/nvtt/CompressDXT.cpp @@ -57,13 +57,13 @@ using namespace nv; using namespace nvtt; -nv::FastCompressor::FastCompressor() : m_image(NULL), m_alphaMode(AlphaMode_None) -{ -} - -nv::FastCompressor::~FastCompressor() -{ -} +nv::FastCompressor::FastCompressor() : m_image(NULL), m_alphaMode(AlphaMode_None) +{ +} + +nv::FastCompressor::~FastCompressor() +{ +} void nv::FastCompressor::setImage(const Image * image, nvtt::AlphaMode alphaMode) { @@ -183,13 +183,13 @@ void nv::FastCompressor::compressDXT5n(const nvtt::OutputOptions::Private & outp } -nv::SlowCompressor::SlowCompressor() : m_image(NULL), m_alphaMode(AlphaMode_None) -{ -} - -nv::SlowCompressor::~SlowCompressor() -{ -} +nv::SlowCompressor::SlowCompressor() : m_image(NULL), m_alphaMode(AlphaMode_None) +{ +} + +nv::SlowCompressor::~SlowCompressor() +{ +} void nv::SlowCompressor::setImage(const Image * image, nvtt::AlphaMode alphaMode) { diff --git a/src/nvtt/CompressDXT.h b/src/nvtt/CompressDXT.h index 3b7d343..841999d 100644 --- a/src/nvtt/CompressDXT.h +++ b/src/nvtt/CompressDXT.h @@ -32,14 +32,14 @@ namespace nv class Image; class FloatImage; - class FastCompressor - { - public: - FastCompressor(); - ~FastCompressor(); + class FastCompressor + { + public: + FastCompressor(); + ~FastCompressor(); + + void setImage(const Image * image, nvtt::AlphaMode alphaMode); - void setImage(const Image * image, nvtt::AlphaMode alphaMode); - void compressDXT1(const nvtt::OutputOptions::Private & outputOptions); void compressDXT1a(const nvtt::OutputOptions::Private & outputOptions); void compressDXT3(const nvtt::OutputOptions::Private & outputOptions); @@ -47,9 +47,9 @@ namespace nv void compressDXT5n(const nvtt::OutputOptions::Private & outputOptions); private: - const Image * m_image; - nvtt::AlphaMode m_alphaMode; - }; + const Image * m_image; + nvtt::AlphaMode m_alphaMode; + }; class SlowCompressor { @@ -68,7 +68,7 @@ namespace nv void compressBC5(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions); private: - const Image * m_image; + const Image * m_image; nvtt::AlphaMode m_alphaMode; }; diff --git a/src/nvtt/Compressor.cpp b/src/nvtt/Compressor.cpp index d2a22a0..bc681ce 100644 --- a/src/nvtt/Compressor.cpp +++ b/src/nvtt/Compressor.cpp @@ -34,7 +34,6 @@ #include #include #include -#include #include "Compressor.h" #include "InputOptions.h" @@ -56,7 +55,7 @@ namespace static int blockSize(Format format) { - if (format == Format_DXT1 || format == Format_DXT1a || format == Format_DXT1n) { + if (format == Format_DXT1 || format == Format_DXT1a) { return 8; } else if (format == Format_DXT3) { @@ -71,9 +70,6 @@ namespace else if (format == Format_BC5) { return 16; } - else if (format == Format_CTX1) { - return 8; - } return 0; } @@ -115,11 +111,6 @@ namespace nvtt m_inputImage = inputOptions.image(idx); m_fixedImage = NULL; m_floatImage = NULL; - - if (const FloatImage * floatImage = inputOptions.floatImage(idx)) - { - m_floatImage = floatImage->clone(); - } } // Assign and take ownership of given image. @@ -353,7 +344,7 @@ bool Compressor::Private::outputHeader(const InputOptions::Private & inputOption { header.setLinearSize(computeImageSize(inputOptions.targetWidth, inputOptions.targetHeight, inputOptions.targetDepth, compressionOptions.bitcount, compressionOptions.format)); - if (compressionOptions.format == Format_DXT1 || compressionOptions.format == Format_DXT1a || compressionOptions.format == Format_DXT1n) { + if (compressionOptions.format == Format_DXT1 || compressionOptions.format == Format_DXT1a) { header.setFourCC('D', 'X', 'T', '1'); if (inputOptions.isNormalMap) header.setNormalFlag(true); } @@ -374,10 +365,6 @@ bool Compressor::Private::outputHeader(const InputOptions::Private & inputOption header.setFourCC('A', 'T', 'I', '2'); if (inputOptions.isNormalMap) header.setNormalFlag(true); } - else if (compressionOptions.format == Format_CTX1) { - header.setFourCC('C', 'T', 'X', '1'); - if (inputOptions.isNormalMap) header.setNormalFlag(true); - } } // Swap bytes if necessary. @@ -419,6 +406,10 @@ bool Compressor::Private::compressMipmaps(uint f, const InputOptions::Private & outputOptions.outputHandler->beginImage(size, w, h, d, f, m); } + // @@ Where to do the color transform? + // - Color transform may not be linear, so we cannot do before computing mipmaps. + // - Should be done in linear space, that is, after gamma correction. + if (!initMipmap(mipmap, inputOptions, w, h, d, f, m)) { if (outputOptions.errorHandler != NULL) @@ -479,22 +470,6 @@ bool Compressor::Private::initMipmap(Mipmap & mipmap, const InputOptions::Privat // Convert linear float image to fixed image ready for compression. mipmap.toFixedImage(inputOptions); - if (inputOptions.premultiplyAlpha) - { - premultiplyAlphaMipmap(mipmap, inputOptions); - } - - // Apply gamma space color transforms: - if (inputOptions.colorTransform == ColorTransform_YCoCg) - { - ColorSpace::RGBtoYCoCg_R(mipmap.asMutableFixedImage()); - } - else if (inputOptions.colorTransform == ColorTransform_ScaledYCoCg) - { - // @@ TODO - //ColorSpace::RGBtoYCoCg_R(mipmap.asMutableFixedImage()); - } - return true; } @@ -507,7 +482,7 @@ int Compressor::Private::findExactMipmap(const InputOptions::Private & inputOpti if (inputImage.width == int(w) && inputImage.height == int(h) && inputImage.depth == int(d)) { - if (inputImage.hasValidData()) + if (inputImage.data != NULL) { return idx; } @@ -531,7 +506,7 @@ int Compressor::Private::findClosestMipmap(const InputOptions::Private & inputOp int idx = f * inputOptions.mipmapCount + m; const InputOptions::Private::InputImage & inputImage = inputOptions.images[idx]; - if (inputImage.hasValidData()) + if (inputImage.data != NULL) { int difference = (inputImage.width - w) + (inputImage.height - h) + (inputImage.depth - d); @@ -599,29 +574,6 @@ void Compressor::Private::scaleMipmap(Mipmap & mipmap, const InputOptions::Priva } -void Compressor::Private::premultiplyAlphaMipmap(Mipmap & mipmap, const InputOptions::Private & inputOptions) const -{ - nvDebugCheck(mipmap.asFixedImage() != NULL); - - Image * image = mipmap.asMutableFixedImage(); - - const uint w = image->width(); - const uint h = image->height(); - - const uint count = w * h; - - for (uint i = 0; i < count; ++i) - { - Color32 c = image->pixel(i); - - c.r = (uint(c.r) * uint(c.a)) >> 8; - c.g = (uint(c.g) * uint(c.a)) >> 8; - c.b = (uint(c.b) * uint(c.a)) >> 8; - - image->pixel(i) = c; - } -} - // Process an input image: Convert to normal map, normalize, or convert to linear space. void Compressor::Private::processInputImage(Mipmap & mipmap, const InputOptions::Private & inputOptions) const { @@ -652,28 +604,10 @@ void Compressor::Private::processInputImage(Mipmap & mipmap, const InputOptions: } else { - if (inputOptions.inputGamma != inputOptions.outputGamma || - inputOptions.colorTransform == ColorTransform_Linear || - inputOptions.colorTransform == ColorTransform_Swizzle) + if (inputOptions.inputGamma != inputOptions.outputGamma) { mipmap.toFloatImage(inputOptions); } - - // Apply linear transforms in linear space. - if (inputOptions.colorTransform == ColorTransform_Linear) - { - FloatImage * image = mipmap.asFloatImage(); - nvDebugCheck(image != NULL); - - image->transform(0, inputOptions.linearTransform); - } - else if (inputOptions.colorTransform == ColorTransform_Swizzle) - { - FloatImage * image = mipmap.asFloatImage(); - nvDebugCheck(image != NULL); - - image->swizzle(0, inputOptions.swizzleTransform[0], inputOptions.swizzleTransform[1], inputOptions.swizzleTransform[2], inputOptions.swizzleTransform[3]); - } } } @@ -789,19 +723,6 @@ bool Compressor::Private::compressMipmap(const Mipmap & mipmap, const InputOptio } } } - else if (compressionOptions.format == Format_DXT1n) - { - if (cudaEnabled) - { - nvDebugCheck(cudaSupported); - cuda->setImage(image, inputOptions.alphaMode); - cuda->compressDXT1n(compressionOptions, outputOptions); - } - else - { - if (outputOptions.errorHandler) outputOptions.errorHandler->error(Error_UnsupportedFeature); - } - } else if (compressionOptions.format == Format_DXT3) { if (compressionOptions.quality == Quality_Fastest) @@ -861,19 +782,6 @@ bool Compressor::Private::compressMipmap(const Mipmap & mipmap, const InputOptio { slow.compressBC5(compressionOptions, outputOptions); } - else if (compressionOptions.format == Format_CTX1) - { - if (cudaEnabled) - { - nvDebugCheck(cudaSupported); - cuda->setImage(image, inputOptions.alphaMode); - cuda->compressCTX1(compressionOptions, outputOptions); - } - else - { - if (outputOptions.errorHandler) outputOptions.errorHandler->error(Error_UnsupportedFeature); - } - } return true; } diff --git a/src/nvtt/Compressor.h b/src/nvtt/Compressor.h index 9b98bdb..55b9563 100644 --- a/src/nvtt/Compressor.h +++ b/src/nvtt/Compressor.h @@ -58,7 +58,6 @@ namespace nvtt void downsampleMipmap(Mipmap & mipmap, const InputOptions::Private & inputOptions) const; void scaleMipmap(Mipmap & mipmap, const InputOptions::Private & inputOptions, uint w, uint h, uint d) const; - void premultiplyAlphaMipmap(Mipmap & mipmap, const InputOptions::Private & inputOptions) const; void processInputImage(Mipmap & mipmap, const InputOptions::Private & inputOptions) const; void quantizeMipmap(Mipmap & mipmap, const CompressionOptions::Private & compressionOptions) const; bool compressMipmap(const Mipmap & mipmap, const InputOptions::Private & inputOptions, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) const; diff --git a/src/nvtt/InputOptions.cpp b/src/nvtt/InputOptions.cpp index 82a23ec..cb52e42 100644 --- a/src/nvtt/InputOptions.cpp +++ b/src/nvtt/InputOptions.cpp @@ -23,8 +23,6 @@ #include // memcpy -#include // nextPowerOfTwo - #include #include "nvtt.h" @@ -120,8 +118,6 @@ void InputOptions::reset() m.maxExtent = 0; m.roundMode = RoundMode_None; - - m.premultiplyAlpha = false; } @@ -165,8 +161,7 @@ void InputOptions::setTextureLayout(TextureType type, int width, int height, int img.mipLevel = mipLevel; img.face = f; - img.uint8data = NULL; - img.floatdata = NULL; + img.data = NULL; w = max(1U, w / 2); h = max(1U, h / 2); @@ -204,47 +199,9 @@ bool InputOptions::setMipmapData(const void * data, int width, int height, int d return false; } - switch(m.inputFormat) - { - case InputFormat_BGRA_8UB: - if (Image * image = new nv::Image()) - { - image->allocate(width, height); - memcpy(image->pixels(), data, width * height * 4); - m.images[idx].uint8data = image; - } - else - { - // @@ Out of memory error. - return false; - } - break; - case InputFormat_RGBA_32F: - if (FloatImage * image = new nv::FloatImage()) - { - const float * floatData = (const float *)data; - image->allocate(4, width, height); - - for (int c = 0; c < 4; c++) - { - float * channel = image->channel(c); - for (int i = 0; i < width * height; i++) - { - channel[i] = floatData[i*4 + c]; - } - } - - m.images[idx].floatdata = image; - } - else - { - // @@ Out of memory error. - return false; - } - break; - default: - return false; - } + m.images[idx].data = new nv::Image(); + m.images[idx].data->allocate(width, height); + memcpy(m.images[idx].data->pixels(), data, width * height * 4); return true; } @@ -348,19 +305,6 @@ void InputOptions::setLinearTransform(int channel, float w0, float w1, float w2, //m.linearTransform.setRow(channel, w); } -void InputOptions::setSwizzleTransform(int x, int y, int z, int w) -{ - nvCheck(x >= 0 && x < 3); - nvCheck(y >= 0 && y < 3); - nvCheck(z >= 0 && z < 3); - nvCheck(w >= 0 && w < 3); - - m.swizzleTransform[0] = x; - m.swizzleTransform[1] = y; - m.swizzleTransform[2] = z; - m.swizzleTransform[3] = w; -} - void InputOptions::setMaxExtents(int e) { nvDebugCheck(e > 0); @@ -372,10 +316,6 @@ void InputOptions::setRoundMode(RoundMode mode) m.roundMode = mode; } -void InputOptions::setPremultiplyAlpha(bool b) -{ - m.premultiplyAlpha = b; -} void InputOptions::Private::computeTargetExtents() const { @@ -455,7 +395,7 @@ const Image * InputOptions::Private::image(uint face, uint mipmap) const nvDebugCheck(image.face == face); nvDebugCheck(image.mipLevel == mipmap); - return image.uint8data.ptr(); + return image.data.ptr(); } const Image * InputOptions::Private::image(uint idx) const @@ -464,14 +404,5 @@ const Image * InputOptions::Private::image(uint idx) const const InputImage & image = this->images[idx]; - return image.uint8data.ptr(); -} - -const FloatImage * InputOptions::Private::floatImage(uint idx) const -{ - nvDebugCheck(idx < faceCount * mipmapCount); - - const InputImage & image = this->images[idx]; - - return image.floatdata.ptr(); + return image.data.ptr(); } diff --git a/src/nvtt/InputOptions.h b/src/nvtt/InputOptions.h index 4906173..2c922af 100644 --- a/src/nvtt/InputOptions.h +++ b/src/nvtt/InputOptions.h @@ -28,7 +28,6 @@ #include #include #include -#include #include "nvtt.h" namespace nvtt @@ -57,7 +56,6 @@ namespace nvtt // Color transform. ColorTransform colorTransform; nv::Matrix linearTransform; - uint swizzleTransform[4]; // Mipmap generation options. bool generateMipmaps; @@ -80,8 +78,6 @@ namespace nvtt uint maxExtent; RoundMode roundMode; - bool premultiplyAlpha; - // @@ These are computed in nvtt::compress, so they should be mutable or stored elsewhere... mutable uint targetWidth; mutable uint targetHeight; @@ -93,9 +89,7 @@ namespace nvtt int realMipmapCount() const; const nv::Image * image(uint face, uint mipmap) const; - const nv::Image * image(uint idx) const; - - const nv::FloatImage * floatImage(uint idx) const; + const nv::Image * image(uint idx) const; }; @@ -104,8 +98,6 @@ namespace nvtt { InputImage() {} - bool hasValidData() const { return uint8data != NULL || floatdata != NULL; } - int mipLevel; int face; @@ -113,8 +105,7 @@ namespace nvtt int height; int depth; - nv::AutoPtr uint8data; - nv::AutoPtr floatdata; + nv::AutoPtr data; }; } // nvtt namespace diff --git a/src/nvtt/QuickCompressDXT.cpp b/src/nvtt/QuickCompressDXT.cpp index b31b46a..a8e086f 100644 --- a/src/nvtt/QuickCompressDXT.cpp +++ b/src/nvtt/QuickCompressDXT.cpp @@ -21,8 +21,6 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // OTHER DEALINGS IN THE SOFTWARE. -#include // swap - #include #include diff --git a/src/nvtt/cuda/Bitmaps.h b/src/nvtt/cuda/Bitmaps.h index d05e9f3..1494092 100644 --- a/src/nvtt/cuda/Bitmaps.h +++ b/src/nvtt/cuda/Bitmaps.h @@ -1117,770 +1117,3 @@ const static uint s_bitmapTable[992] = 0x55555557, 0x55555557, }; - - -/* -void precomp() -{ - unsigned int bitmaps[1024]; - - int num = 0; - - printf("const static uint s_bitmapTableCTX[704] =\n{\n"); - - for (int a = 1; a <= 15; a++) - { - for (int b = a; b <= 15; b++) - { - for (int c = b; c <= 15; c++) - { - int indices[16]; - - int i = 0; - for(; i < a; i++) { - indices[i] = 0; - } - for(; i < a+b; i++) { - indices[i] = 2; - } - for(; i < a+b+c; i++) { - indices[i] = 3; - } - for(; i < 16; i++) { - indices[i] = 1; - } - - unsigned int bm = 0; - for(i = 0; i < 16; i++) { - bm |= indices[i] << (i * 2); - } - - printf("\t0x%8X, // %d %d %d %d\n", bm, a-0, b-a, c-b, 16-c); - - bitmaps[num] = bm; - num++; - } - } - } - - // Align to 32: 680 -> 704 - while (num < 704) - { - printf("\t0x80000000,\n"); - - bitmaps[num] = 0x80000000; // 15 0 0 1; - num++; - } - - printf("}; // num = %d\n", num); -} -*/ - -const static uint s_bitmapTableCTX[704] = -{ - 0x55555578, // 1 0 0 15 - 0x555555F8, // 1 0 1 14 - 0x555557F8, // 1 0 2 13 - 0x55555FF8, // 1 0 3 12 - 0x55557FF8, // 1 0 4 11 - 0x5555FFF8, // 1 0 5 10 - 0x5557FFF8, // 1 0 6 9 - 0x555FFFF8, // 1 0 7 8 - 0x557FFFF8, // 1 0 8 7 - 0x55FFFFF8, // 1 0 9 6 - 0x57FFFFF8, // 1 0 10 5 - 0x5FFFFFF8, // 1 0 11 4 - 0x7FFFFFF8, // 1 0 12 3 - 0xFFFFFFF8, // 1 0 13 2 - 0xFFFFFFF8, // 1 0 14 1 - 0x555557E8, // 1 1 0 14 - 0x55555FE8, // 1 1 1 13 - 0x55557FE8, // 1 1 2 12 - 0x5555FFE8, // 1 1 3 11 - 0x5557FFE8, // 1 1 4 10 - 0x555FFFE8, // 1 1 5 9 - 0x557FFFE8, // 1 1 6 8 - 0x55FFFFE8, // 1 1 7 7 - 0x57FFFFE8, // 1 1 8 6 - 0x5FFFFFE8, // 1 1 9 5 - 0x7FFFFFE8, // 1 1 10 4 - 0xFFFFFFE8, // 1 1 11 3 - 0xFFFFFFE8, // 1 1 12 2 - 0xFFFFFFE8, // 1 1 13 1 - 0x55557FA8, // 1 2 0 13 - 0x5555FFA8, // 1 2 1 12 - 0x5557FFA8, // 1 2 2 11 - 0x555FFFA8, // 1 2 3 10 - 0x557FFFA8, // 1 2 4 9 - 0x55FFFFA8, // 1 2 5 8 - 0x57FFFFA8, // 1 2 6 7 - 0x5FFFFFA8, // 1 2 7 6 - 0x7FFFFFA8, // 1 2 8 5 - 0xFFFFFFA8, // 1 2 9 4 - 0xFFFFFFA8, // 1 2 10 3 - 0xFFFFFFA8, // 1 2 11 2 - 0xFFFFFFA8, // 1 2 12 1 - 0x5557FEA8, // 1 3 0 12 - 0x555FFEA8, // 1 3 1 11 - 0x557FFEA8, // 1 3 2 10 - 0x55FFFEA8, // 1 3 3 9 - 0x57FFFEA8, // 1 3 4 8 - 0x5FFFFEA8, // 1 3 5 7 - 0x7FFFFEA8, // 1 3 6 6 - 0xFFFFFEA8, // 1 3 7 5 - 0xFFFFFEA8, // 1 3 8 4 - 0xFFFFFEA8, // 1 3 9 3 - 0xFFFFFEA8, // 1 3 10 2 - 0xFFFFFEA8, // 1 3 11 1 - 0x557FFAA8, // 1 4 0 11 - 0x55FFFAA8, // 1 4 1 10 - 0x57FFFAA8, // 1 4 2 9 - 0x5FFFFAA8, // 1 4 3 8 - 0x7FFFFAA8, // 1 4 4 7 - 0xFFFFFAA8, // 1 4 5 6 - 0xFFFFFAA8, // 1 4 6 5 - 0xFFFFFAA8, // 1 4 7 4 - 0xFFFFFAA8, // 1 4 8 3 - 0xFFFFFAA8, // 1 4 9 2 - 0xFFFFFAA8, // 1 4 10 1 - 0x57FFEAA8, // 1 5 0 10 - 0x5FFFEAA8, // 1 5 1 9 - 0x7FFFEAA8, // 1 5 2 8 - 0xFFFFEAA8, // 1 5 3 7 - 0xFFFFEAA8, // 1 5 4 6 - 0xFFFFEAA8, // 1 5 5 5 - 0xFFFFEAA8, // 1 5 6 4 - 0xFFFFEAA8, // 1 5 7 3 - 0xFFFFEAA8, // 1 5 8 2 - 0xFFFFEAA8, // 1 5 9 1 - 0x7FFFAAA8, // 1 6 0 9 - 0xFFFFAAA8, // 1 6 1 8 - 0xFFFFAAA8, // 1 6 2 7 - 0xFFFFAAA8, // 1 6 3 6 - 0xFFFFAAA8, // 1 6 4 5 - 0xFFFFAAA8, // 1 6 5 4 - 0xFFFFAAA8, // 1 6 6 3 - 0xFFFFAAA8, // 1 6 7 2 - 0xFFFFAAA8, // 1 6 8 1 - 0xFFFEAAA8, // 1 7 0 8 - 0xFFFEAAA8, // 1 7 1 7 - 0xFFFEAAA8, // 1 7 2 6 - 0xFFFEAAA8, // 1 7 3 5 - 0xFFFEAAA8, // 1 7 4 4 - 0xFFFEAAA8, // 1 7 5 3 - 0xFFFEAAA8, // 1 7 6 2 - 0xFFFEAAA8, // 1 7 7 1 - 0xFFFAAAA8, // 1 8 0 7 - 0xFFFAAAA8, // 1 8 1 6 - 0xFFFAAAA8, // 1 8 2 5 - 0xFFFAAAA8, // 1 8 3 4 - 0xFFFAAAA8, // 1 8 4 3 - 0xFFFAAAA8, // 1 8 5 2 - 0xFFFAAAA8, // 1 8 6 1 - 0xFFEAAAA8, // 1 9 0 6 - 0xFFEAAAA8, // 1 9 1 5 - 0xFFEAAAA8, // 1 9 2 4 - 0xFFEAAAA8, // 1 9 3 3 - 0xFFEAAAA8, // 1 9 4 2 - 0xFFEAAAA8, // 1 9 5 1 - 0xFFAAAAA8, // 1 10 0 5 - 0xFFAAAAA8, // 1 10 1 4 - 0xFFAAAAA8, // 1 10 2 3 - 0xFFAAAAA8, // 1 10 3 2 - 0xFFAAAAA8, // 1 10 4 1 - 0xFEAAAAA8, // 1 11 0 4 - 0xFEAAAAA8, // 1 11 1 3 - 0xFEAAAAA8, // 1 11 2 2 - 0xFEAAAAA8, // 1 11 3 1 - 0xFAAAAAA8, // 1 12 0 3 - 0xFAAAAAA8, // 1 12 1 2 - 0xFAAAAAA8, // 1 12 2 1 - 0xEAAAAAA8, // 1 13 0 2 - 0xEAAAAAA8, // 1 13 1 1 - 0xAAAAAAA8, // 1 14 0 1 - 0x55555FA0, // 2 0 0 14 - 0x55557FA0, // 2 0 1 13 - 0x5555FFA0, // 2 0 2 12 - 0x5557FFA0, // 2 0 3 11 - 0x555FFFA0, // 2 0 4 10 - 0x557FFFA0, // 2 0 5 9 - 0x55FFFFA0, // 2 0 6 8 - 0x57FFFFA0, // 2 0 7 7 - 0x5FFFFFA0, // 2 0 8 6 - 0x7FFFFFA0, // 2 0 9 5 - 0xFFFFFFA0, // 2 0 10 4 - 0xFFFFFFA0, // 2 0 11 3 - 0xFFFFFFA0, // 2 0 12 2 - 0xFFFFFFA0, // 2 0 13 1 - 0x5555FEA0, // 2 1 0 13 - 0x5557FEA0, // 2 1 1 12 - 0x555FFEA0, // 2 1 2 11 - 0x557FFEA0, // 2 1 3 10 - 0x55FFFEA0, // 2 1 4 9 - 0x57FFFEA0, // 2 1 5 8 - 0x5FFFFEA0, // 2 1 6 7 - 0x7FFFFEA0, // 2 1 7 6 - 0xFFFFFEA0, // 2 1 8 5 - 0xFFFFFEA0, // 2 1 9 4 - 0xFFFFFEA0, // 2 1 10 3 - 0xFFFFFEA0, // 2 1 11 2 - 0xFFFFFEA0, // 2 1 12 1 - 0x555FFAA0, // 2 2 0 12 - 0x557FFAA0, // 2 2 1 11 - 0x55FFFAA0, // 2 2 2 10 - 0x57FFFAA0, // 2 2 3 9 - 0x5FFFFAA0, // 2 2 4 8 - 0x7FFFFAA0, // 2 2 5 7 - 0xFFFFFAA0, // 2 2 6 6 - 0xFFFFFAA0, // 2 2 7 5 - 0xFFFFFAA0, // 2 2 8 4 - 0xFFFFFAA0, // 2 2 9 3 - 0xFFFFFAA0, // 2 2 10 2 - 0xFFFFFAA0, // 2 2 11 1 - 0x55FFEAA0, // 2 3 0 11 - 0x57FFEAA0, // 2 3 1 10 - 0x5FFFEAA0, // 2 3 2 9 - 0x7FFFEAA0, // 2 3 3 8 - 0xFFFFEAA0, // 2 3 4 7 - 0xFFFFEAA0, // 2 3 5 6 - 0xFFFFEAA0, // 2 3 6 5 - 0xFFFFEAA0, // 2 3 7 4 - 0xFFFFEAA0, // 2 3 8 3 - 0xFFFFEAA0, // 2 3 9 2 - 0xFFFFEAA0, // 2 3 10 1 - 0x5FFFAAA0, // 2 4 0 10 - 0x7FFFAAA0, // 2 4 1 9 - 0xFFFFAAA0, // 2 4 2 8 - 0xFFFFAAA0, // 2 4 3 7 - 0xFFFFAAA0, // 2 4 4 6 - 0xFFFFAAA0, // 2 4 5 5 - 0xFFFFAAA0, // 2 4 6 4 - 0xFFFFAAA0, // 2 4 7 3 - 0xFFFFAAA0, // 2 4 8 2 - 0xFFFFAAA0, // 2 4 9 1 - 0xFFFEAAA0, // 2 5 0 9 - 0xFFFEAAA0, // 2 5 1 8 - 0xFFFEAAA0, // 2 5 2 7 - 0xFFFEAAA0, // 2 5 3 6 - 0xFFFEAAA0, // 2 5 4 5 - 0xFFFEAAA0, // 2 5 5 4 - 0xFFFEAAA0, // 2 5 6 3 - 0xFFFEAAA0, // 2 5 7 2 - 0xFFFEAAA0, // 2 5 8 1 - 0xFFFAAAA0, // 2 6 0 8 - 0xFFFAAAA0, // 2 6 1 7 - 0xFFFAAAA0, // 2 6 2 6 - 0xFFFAAAA0, // 2 6 3 5 - 0xFFFAAAA0, // 2 6 4 4 - 0xFFFAAAA0, // 2 6 5 3 - 0xFFFAAAA0, // 2 6 6 2 - 0xFFFAAAA0, // 2 6 7 1 - 0xFFEAAAA0, // 2 7 0 7 - 0xFFEAAAA0, // 2 7 1 6 - 0xFFEAAAA0, // 2 7 2 5 - 0xFFEAAAA0, // 2 7 3 4 - 0xFFEAAAA0, // 2 7 4 3 - 0xFFEAAAA0, // 2 7 5 2 - 0xFFEAAAA0, // 2 7 6 1 - 0xFFAAAAA0, // 2 8 0 6 - 0xFFAAAAA0, // 2 8 1 5 - 0xFFAAAAA0, // 2 8 2 4 - 0xFFAAAAA0, // 2 8 3 3 - 0xFFAAAAA0, // 2 8 4 2 - 0xFFAAAAA0, // 2 8 5 1 - 0xFEAAAAA0, // 2 9 0 5 - 0xFEAAAAA0, // 2 9 1 4 - 0xFEAAAAA0, // 2 9 2 3 - 0xFEAAAAA0, // 2 9 3 2 - 0xFEAAAAA0, // 2 9 4 1 - 0xFAAAAAA0, // 2 10 0 4 - 0xFAAAAAA0, // 2 10 1 3 - 0xFAAAAAA0, // 2 10 2 2 - 0xFAAAAAA0, // 2 10 3 1 - 0xEAAAAAA0, // 2 11 0 3 - 0xEAAAAAA0, // 2 11 1 2 - 0xEAAAAAA0, // 2 11 2 1 - 0xAAAAAAA0, // 2 12 0 2 - 0xAAAAAAA0, // 2 12 1 1 - 0xAAAAAAA0, // 2 13 0 1 - 0x5557FA80, // 3 0 0 13 - 0x555FFA80, // 3 0 1 12 - 0x557FFA80, // 3 0 2 11 - 0x55FFFA80, // 3 0 3 10 - 0x57FFFA80, // 3 0 4 9 - 0x5FFFFA80, // 3 0 5 8 - 0x7FFFFA80, // 3 0 6 7 - 0xFFFFFA80, // 3 0 7 6 - 0xFFFFFA80, // 3 0 8 5 - 0xFFFFFA80, // 3 0 9 4 - 0xFFFFFA80, // 3 0 10 3 - 0xFFFFFA80, // 3 0 11 2 - 0xFFFFFA80, // 3 0 12 1 - 0x557FEA80, // 3 1 0 12 - 0x55FFEA80, // 3 1 1 11 - 0x57FFEA80, // 3 1 2 10 - 0x5FFFEA80, // 3 1 3 9 - 0x7FFFEA80, // 3 1 4 8 - 0xFFFFEA80, // 3 1 5 7 - 0xFFFFEA80, // 3 1 6 6 - 0xFFFFEA80, // 3 1 7 5 - 0xFFFFEA80, // 3 1 8 4 - 0xFFFFEA80, // 3 1 9 3 - 0xFFFFEA80, // 3 1 10 2 - 0xFFFFEA80, // 3 1 11 1 - 0x57FFAA80, // 3 2 0 11 - 0x5FFFAA80, // 3 2 1 10 - 0x7FFFAA80, // 3 2 2 9 - 0xFFFFAA80, // 3 2 3 8 - 0xFFFFAA80, // 3 2 4 7 - 0xFFFFAA80, // 3 2 5 6 - 0xFFFFAA80, // 3 2 6 5 - 0xFFFFAA80, // 3 2 7 4 - 0xFFFFAA80, // 3 2 8 3 - 0xFFFFAA80, // 3 2 9 2 - 0xFFFFAA80, // 3 2 10 1 - 0x7FFEAA80, // 3 3 0 10 - 0xFFFEAA80, // 3 3 1 9 - 0xFFFEAA80, // 3 3 2 8 - 0xFFFEAA80, // 3 3 3 7 - 0xFFFEAA80, // 3 3 4 6 - 0xFFFEAA80, // 3 3 5 5 - 0xFFFEAA80, // 3 3 6 4 - 0xFFFEAA80, // 3 3 7 3 - 0xFFFEAA80, // 3 3 8 2 - 0xFFFEAA80, // 3 3 9 1 - 0xFFFAAA80, // 3 4 0 9 - 0xFFFAAA80, // 3 4 1 8 - 0xFFFAAA80, // 3 4 2 7 - 0xFFFAAA80, // 3 4 3 6 - 0xFFFAAA80, // 3 4 4 5 - 0xFFFAAA80, // 3 4 5 4 - 0xFFFAAA80, // 3 4 6 3 - 0xFFFAAA80, // 3 4 7 2 - 0xFFFAAA80, // 3 4 8 1 - 0xFFEAAA80, // 3 5 0 8 - 0xFFEAAA80, // 3 5 1 7 - 0xFFEAAA80, // 3 5 2 6 - 0xFFEAAA80, // 3 5 3 5 - 0xFFEAAA80, // 3 5 4 4 - 0xFFEAAA80, // 3 5 5 3 - 0xFFEAAA80, // 3 5 6 2 - 0xFFEAAA80, // 3 5 7 1 - 0xFFAAAA80, // 3 6 0 7 - 0xFFAAAA80, // 3 6 1 6 - 0xFFAAAA80, // 3 6 2 5 - 0xFFAAAA80, // 3 6 3 4 - 0xFFAAAA80, // 3 6 4 3 - 0xFFAAAA80, // 3 6 5 2 - 0xFFAAAA80, // 3 6 6 1 - 0xFEAAAA80, // 3 7 0 6 - 0xFEAAAA80, // 3 7 1 5 - 0xFEAAAA80, // 3 7 2 4 - 0xFEAAAA80, // 3 7 3 3 - 0xFEAAAA80, // 3 7 4 2 - 0xFEAAAA80, // 3 7 5 1 - 0xFAAAAA80, // 3 8 0 5 - 0xFAAAAA80, // 3 8 1 4 - 0xFAAAAA80, // 3 8 2 3 - 0xFAAAAA80, // 3 8 3 2 - 0xFAAAAA80, // 3 8 4 1 - 0xEAAAAA80, // 3 9 0 4 - 0xEAAAAA80, // 3 9 1 3 - 0xEAAAAA80, // 3 9 2 2 - 0xEAAAAA80, // 3 9 3 1 - 0xAAAAAA80, // 3 10 0 3 - 0xAAAAAA80, // 3 10 1 2 - 0xAAAAAA80, // 3 10 2 1 - 0xAAAAAA80, // 3 11 0 2 - 0xAAAAAA80, // 3 11 1 1 - 0xAAAAAA80, // 3 12 0 1 - 0x55FFAA00, // 4 0 0 12 - 0x57FFAA00, // 4 0 1 11 - 0x5FFFAA00, // 4 0 2 10 - 0x7FFFAA00, // 4 0 3 9 - 0xFFFFAA00, // 4 0 4 8 - 0xFFFFAA00, // 4 0 5 7 - 0xFFFFAA00, // 4 0 6 6 - 0xFFFFAA00, // 4 0 7 5 - 0xFFFFAA00, // 4 0 8 4 - 0xFFFFAA00, // 4 0 9 3 - 0xFFFFAA00, // 4 0 10 2 - 0xFFFFAA00, // 4 0 11 1 - 0x5FFEAA00, // 4 1 0 11 - 0x7FFEAA00, // 4 1 1 10 - 0xFFFEAA00, // 4 1 2 9 - 0xFFFEAA00, // 4 1 3 8 - 0xFFFEAA00, // 4 1 4 7 - 0xFFFEAA00, // 4 1 5 6 - 0xFFFEAA00, // 4 1 6 5 - 0xFFFEAA00, // 4 1 7 4 - 0xFFFEAA00, // 4 1 8 3 - 0xFFFEAA00, // 4 1 9 2 - 0xFFFEAA00, // 4 1 10 1 - 0xFFFAAA00, // 4 2 0 10 - 0xFFFAAA00, // 4 2 1 9 - 0xFFFAAA00, // 4 2 2 8 - 0xFFFAAA00, // 4 2 3 7 - 0xFFFAAA00, // 4 2 4 6 - 0xFFFAAA00, // 4 2 5 5 - 0xFFFAAA00, // 4 2 6 4 - 0xFFFAAA00, // 4 2 7 3 - 0xFFFAAA00, // 4 2 8 2 - 0xFFFAAA00, // 4 2 9 1 - 0xFFEAAA00, // 4 3 0 9 - 0xFFEAAA00, // 4 3 1 8 - 0xFFEAAA00, // 4 3 2 7 - 0xFFEAAA00, // 4 3 3 6 - 0xFFEAAA00, // 4 3 4 5 - 0xFFEAAA00, // 4 3 5 4 - 0xFFEAAA00, // 4 3 6 3 - 0xFFEAAA00, // 4 3 7 2 - 0xFFEAAA00, // 4 3 8 1 - 0xFFAAAA00, // 4 4 0 8 - 0xFFAAAA00, // 4 4 1 7 - 0xFFAAAA00, // 4 4 2 6 - 0xFFAAAA00, // 4 4 3 5 - 0xFFAAAA00, // 4 4 4 4 - 0xFFAAAA00, // 4 4 5 3 - 0xFFAAAA00, // 4 4 6 2 - 0xFFAAAA00, // 4 4 7 1 - 0xFEAAAA00, // 4 5 0 7 - 0xFEAAAA00, // 4 5 1 6 - 0xFEAAAA00, // 4 5 2 5 - 0xFEAAAA00, // 4 5 3 4 - 0xFEAAAA00, // 4 5 4 3 - 0xFEAAAA00, // 4 5 5 2 - 0xFEAAAA00, // 4 5 6 1 - 0xFAAAAA00, // 4 6 0 6 - 0xFAAAAA00, // 4 6 1 5 - 0xFAAAAA00, // 4 6 2 4 - 0xFAAAAA00, // 4 6 3 3 - 0xFAAAAA00, // 4 6 4 2 - 0xFAAAAA00, // 4 6 5 1 - 0xEAAAAA00, // 4 7 0 5 - 0xEAAAAA00, // 4 7 1 4 - 0xEAAAAA00, // 4 7 2 3 - 0xEAAAAA00, // 4 7 3 2 - 0xEAAAAA00, // 4 7 4 1 - 0xAAAAAA00, // 4 8 0 4 - 0xAAAAAA00, // 4 8 1 3 - 0xAAAAAA00, // 4 8 2 2 - 0xAAAAAA00, // 4 8 3 1 - 0xAAAAAA00, // 4 9 0 3 - 0xAAAAAA00, // 4 9 1 2 - 0xAAAAAA00, // 4 9 2 1 - 0xAAAAAA00, // 4 10 0 2 - 0xAAAAAA00, // 4 10 1 1 - 0xAAAAAA00, // 4 11 0 1 - 0x7FFAA800, // 5 0 0 11 - 0xFFFAA800, // 5 0 1 10 - 0xFFFAA800, // 5 0 2 9 - 0xFFFAA800, // 5 0 3 8 - 0xFFFAA800, // 5 0 4 7 - 0xFFFAA800, // 5 0 5 6 - 0xFFFAA800, // 5 0 6 5 - 0xFFFAA800, // 5 0 7 4 - 0xFFFAA800, // 5 0 8 3 - 0xFFFAA800, // 5 0 9 2 - 0xFFFAA800, // 5 0 10 1 - 0xFFEAA800, // 5 1 0 10 - 0xFFEAA800, // 5 1 1 9 - 0xFFEAA800, // 5 1 2 8 - 0xFFEAA800, // 5 1 3 7 - 0xFFEAA800, // 5 1 4 6 - 0xFFEAA800, // 5 1 5 5 - 0xFFEAA800, // 5 1 6 4 - 0xFFEAA800, // 5 1 7 3 - 0xFFEAA800, // 5 1 8 2 - 0xFFEAA800, // 5 1 9 1 - 0xFFAAA800, // 5 2 0 9 - 0xFFAAA800, // 5 2 1 8 - 0xFFAAA800, // 5 2 2 7 - 0xFFAAA800, // 5 2 3 6 - 0xFFAAA800, // 5 2 4 5 - 0xFFAAA800, // 5 2 5 4 - 0xFFAAA800, // 5 2 6 3 - 0xFFAAA800, // 5 2 7 2 - 0xFFAAA800, // 5 2 8 1 - 0xFEAAA800, // 5 3 0 8 - 0xFEAAA800, // 5 3 1 7 - 0xFEAAA800, // 5 3 2 6 - 0xFEAAA800, // 5 3 3 5 - 0xFEAAA800, // 5 3 4 4 - 0xFEAAA800, // 5 3 5 3 - 0xFEAAA800, // 5 3 6 2 - 0xFEAAA800, // 5 3 7 1 - 0xFAAAA800, // 5 4 0 7 - 0xFAAAA800, // 5 4 1 6 - 0xFAAAA800, // 5 4 2 5 - 0xFAAAA800, // 5 4 3 4 - 0xFAAAA800, // 5 4 4 3 - 0xFAAAA800, // 5 4 5 2 - 0xFAAAA800, // 5 4 6 1 - 0xEAAAA800, // 5 5 0 6 - 0xEAAAA800, // 5 5 1 5 - 0xEAAAA800, // 5 5 2 4 - 0xEAAAA800, // 5 5 3 3 - 0xEAAAA800, // 5 5 4 2 - 0xEAAAA800, // 5 5 5 1 - 0xAAAAA800, // 5 6 0 5 - 0xAAAAA800, // 5 6 1 4 - 0xAAAAA800, // 5 6 2 3 - 0xAAAAA800, // 5 6 3 2 - 0xAAAAA800, // 5 6 4 1 - 0xAAAAA800, // 5 7 0 4 - 0xAAAAA800, // 5 7 1 3 - 0xAAAAA800, // 5 7 2 2 - 0xAAAAA800, // 5 7 3 1 - 0xAAAAA800, // 5 8 0 3 - 0xAAAAA800, // 5 8 1 2 - 0xAAAAA800, // 5 8 2 1 - 0xAAAAA800, // 5 9 0 2 - 0xAAAAA800, // 5 9 1 1 - 0xAAAAA800, // 5 10 0 1 - 0xFFAAA000, // 6 0 0 10 - 0xFFAAA000, // 6 0 1 9 - 0xFFAAA000, // 6 0 2 8 - 0xFFAAA000, // 6 0 3 7 - 0xFFAAA000, // 6 0 4 6 - 0xFFAAA000, // 6 0 5 5 - 0xFFAAA000, // 6 0 6 4 - 0xFFAAA000, // 6 0 7 3 - 0xFFAAA000, // 6 0 8 2 - 0xFFAAA000, // 6 0 9 1 - 0xFEAAA000, // 6 1 0 9 - 0xFEAAA000, // 6 1 1 8 - 0xFEAAA000, // 6 1 2 7 - 0xFEAAA000, // 6 1 3 6 - 0xFEAAA000, // 6 1 4 5 - 0xFEAAA000, // 6 1 5 4 - 0xFEAAA000, // 6 1 6 3 - 0xFEAAA000, // 6 1 7 2 - 0xFEAAA000, // 6 1 8 1 - 0xFAAAA000, // 6 2 0 8 - 0xFAAAA000, // 6 2 1 7 - 0xFAAAA000, // 6 2 2 6 - 0xFAAAA000, // 6 2 3 5 - 0xFAAAA000, // 6 2 4 4 - 0xFAAAA000, // 6 2 5 3 - 0xFAAAA000, // 6 2 6 2 - 0xFAAAA000, // 6 2 7 1 - 0xEAAAA000, // 6 3 0 7 - 0xEAAAA000, // 6 3 1 6 - 0xEAAAA000, // 6 3 2 5 - 0xEAAAA000, // 6 3 3 4 - 0xEAAAA000, // 6 3 4 3 - 0xEAAAA000, // 6 3 5 2 - 0xEAAAA000, // 6 3 6 1 - 0xAAAAA000, // 6 4 0 6 - 0xAAAAA000, // 6 4 1 5 - 0xAAAAA000, // 6 4 2 4 - 0xAAAAA000, // 6 4 3 3 - 0xAAAAA000, // 6 4 4 2 - 0xAAAAA000, // 6 4 5 1 - 0xAAAAA000, // 6 5 0 5 - 0xAAAAA000, // 6 5 1 4 - 0xAAAAA000, // 6 5 2 3 - 0xAAAAA000, // 6 5 3 2 - 0xAAAAA000, // 6 5 4 1 - 0xAAAAA000, // 6 6 0 4 - 0xAAAAA000, // 6 6 1 3 - 0xAAAAA000, // 6 6 2 2 - 0xAAAAA000, // 6 6 3 1 - 0xAAAAA000, // 6 7 0 3 - 0xAAAAA000, // 6 7 1 2 - 0xAAAAA000, // 6 7 2 1 - 0xAAAAA000, // 6 8 0 2 - 0xAAAAA000, // 6 8 1 1 - 0xAAAAA000, // 6 9 0 1 - 0xFAAA8000, // 7 0 0 9 - 0xFAAA8000, // 7 0 1 8 - 0xFAAA8000, // 7 0 2 7 - 0xFAAA8000, // 7 0 3 6 - 0xFAAA8000, // 7 0 4 5 - 0xFAAA8000, // 7 0 5 4 - 0xFAAA8000, // 7 0 6 3 - 0xFAAA8000, // 7 0 7 2 - 0xFAAA8000, // 7 0 8 1 - 0xEAAA8000, // 7 1 0 8 - 0xEAAA8000, // 7 1 1 7 - 0xEAAA8000, // 7 1 2 6 - 0xEAAA8000, // 7 1 3 5 - 0xEAAA8000, // 7 1 4 4 - 0xEAAA8000, // 7 1 5 3 - 0xEAAA8000, // 7 1 6 2 - 0xEAAA8000, // 7 1 7 1 - 0xAAAA8000, // 7 2 0 7 - 0xAAAA8000, // 7 2 1 6 - 0xAAAA8000, // 7 2 2 5 - 0xAAAA8000, // 7 2 3 4 - 0xAAAA8000, // 7 2 4 3 - 0xAAAA8000, // 7 2 5 2 - 0xAAAA8000, // 7 2 6 1 - 0xAAAA8000, // 7 3 0 6 - 0xAAAA8000, // 7 3 1 5 - 0xAAAA8000, // 7 3 2 4 - 0xAAAA8000, // 7 3 3 3 - 0xAAAA8000, // 7 3 4 2 - 0xAAAA8000, // 7 3 5 1 - 0xAAAA8000, // 7 4 0 5 - 0xAAAA8000, // 7 4 1 4 - 0xAAAA8000, // 7 4 2 3 - 0xAAAA8000, // 7 4 3 2 - 0xAAAA8000, // 7 4 4 1 - 0xAAAA8000, // 7 5 0 4 - 0xAAAA8000, // 7 5 1 3 - 0xAAAA8000, // 7 5 2 2 - 0xAAAA8000, // 7 5 3 1 - 0xAAAA8000, // 7 6 0 3 - 0xAAAA8000, // 7 6 1 2 - 0xAAAA8000, // 7 6 2 1 - 0xAAAA8000, // 7 7 0 2 - 0xAAAA8000, // 7 7 1 1 - 0xAAAA8000, // 7 8 0 1 - 0xAAAA0000, // 8 0 0 8 - 0xAAAA0000, // 8 0 1 7 - 0xAAAA0000, // 8 0 2 6 - 0xAAAA0000, // 8 0 3 5 - 0xAAAA0000, // 8 0 4 4 - 0xAAAA0000, // 8 0 5 3 - 0xAAAA0000, // 8 0 6 2 - 0xAAAA0000, // 8 0 7 1 - 0xAAAA0000, // 8 1 0 7 - 0xAAAA0000, // 8 1 1 6 - 0xAAAA0000, // 8 1 2 5 - 0xAAAA0000, // 8 1 3 4 - 0xAAAA0000, // 8 1 4 3 - 0xAAAA0000, // 8 1 5 2 - 0xAAAA0000, // 8 1 6 1 - 0xAAAA0000, // 8 2 0 6 - 0xAAAA0000, // 8 2 1 5 - 0xAAAA0000, // 8 2 2 4 - 0xAAAA0000, // 8 2 3 3 - 0xAAAA0000, // 8 2 4 2 - 0xAAAA0000, // 8 2 5 1 - 0xAAAA0000, // 8 3 0 5 - 0xAAAA0000, // 8 3 1 4 - 0xAAAA0000, // 8 3 2 3 - 0xAAAA0000, // 8 3 3 2 - 0xAAAA0000, // 8 3 4 1 - 0xAAAA0000, // 8 4 0 4 - 0xAAAA0000, // 8 4 1 3 - 0xAAAA0000, // 8 4 2 2 - 0xAAAA0000, // 8 4 3 1 - 0xAAAA0000, // 8 5 0 3 - 0xAAAA0000, // 8 5 1 2 - 0xAAAA0000, // 8 5 2 1 - 0xAAAA0000, // 8 6 0 2 - 0xAAAA0000, // 8 6 1 1 - 0xAAAA0000, // 8 7 0 1 - 0xAAA80000, // 9 0 0 7 - 0xAAA80000, // 9 0 1 6 - 0xAAA80000, // 9 0 2 5 - 0xAAA80000, // 9 0 3 4 - 0xAAA80000, // 9 0 4 3 - 0xAAA80000, // 9 0 5 2 - 0xAAA80000, // 9 0 6 1 - 0xAAA80000, // 9 1 0 6 - 0xAAA80000, // 9 1 1 5 - 0xAAA80000, // 9 1 2 4 - 0xAAA80000, // 9 1 3 3 - 0xAAA80000, // 9 1 4 2 - 0xAAA80000, // 9 1 5 1 - 0xAAA80000, // 9 2 0 5 - 0xAAA80000, // 9 2 1 4 - 0xAAA80000, // 9 2 2 3 - 0xAAA80000, // 9 2 3 2 - 0xAAA80000, // 9 2 4 1 - 0xAAA80000, // 9 3 0 4 - 0xAAA80000, // 9 3 1 3 - 0xAAA80000, // 9 3 2 2 - 0xAAA80000, // 9 3 3 1 - 0xAAA80000, // 9 4 0 3 - 0xAAA80000, // 9 4 1 2 - 0xAAA80000, // 9 4 2 1 - 0xAAA80000, // 9 5 0 2 - 0xAAA80000, // 9 5 1 1 - 0xAAA80000, // 9 6 0 1 - 0xAAA00000, // 10 0 0 6 - 0xAAA00000, // 10 0 1 5 - 0xAAA00000, // 10 0 2 4 - 0xAAA00000, // 10 0 3 3 - 0xAAA00000, // 10 0 4 2 - 0xAAA00000, // 10 0 5 1 - 0xAAA00000, // 10 1 0 5 - 0xAAA00000, // 10 1 1 4 - 0xAAA00000, // 10 1 2 3 - 0xAAA00000, // 10 1 3 2 - 0xAAA00000, // 10 1 4 1 - 0xAAA00000, // 10 2 0 4 - 0xAAA00000, // 10 2 1 3 - 0xAAA00000, // 10 2 2 2 - 0xAAA00000, // 10 2 3 1 - 0xAAA00000, // 10 3 0 3 - 0xAAA00000, // 10 3 1 2 - 0xAAA00000, // 10 3 2 1 - 0xAAA00000, // 10 4 0 2 - 0xAAA00000, // 10 4 1 1 - 0xAAA00000, // 10 5 0 1 - 0xAA800000, // 11 0 0 5 - 0xAA800000, // 11 0 1 4 - 0xAA800000, // 11 0 2 3 - 0xAA800000, // 11 0 3 2 - 0xAA800000, // 11 0 4 1 - 0xAA800000, // 11 1 0 4 - 0xAA800000, // 11 1 1 3 - 0xAA800000, // 11 1 2 2 - 0xAA800000, // 11 1 3 1 - 0xAA800000, // 11 2 0 3 - 0xAA800000, // 11 2 1 2 - 0xAA800000, // 11 2 2 1 - 0xAA800000, // 11 3 0 2 - 0xAA800000, // 11 3 1 1 - 0xAA800000, // 11 4 0 1 - 0xAA000000, // 12 0 0 4 - 0xAA000000, // 12 0 1 3 - 0xAA000000, // 12 0 2 2 - 0xAA000000, // 12 0 3 1 - 0xAA000000, // 12 1 0 3 - 0xAA000000, // 12 1 1 2 - 0xAA000000, // 12 1 2 1 - 0xAA000000, // 12 2 0 2 - 0xAA000000, // 12 2 1 1 - 0xAA000000, // 12 3 0 1 - 0xA8000000, // 13 0 0 3 - 0xA8000000, // 13 0 1 2 - 0xA8000000, // 13 0 2 1 - 0xA8000000, // 13 1 0 2 - 0xA8000000, // 13 1 1 1 - 0xA8000000, // 13 2 0 1 - 0xA0000000, // 14 0 0 2 - 0xA0000000, // 14 0 1 1 - 0xA0000000, // 14 1 0 1 - 0x80000000, // 15 0 0 1 - 0x80000000, - 0x80000000, - 0x80000000, - 0x80000000, - 0x80000000, - 0x80000000, - 0x80000000, - 0x80000000, - 0x80000000, - 0x80000000, - 0x80000000, - 0x80000000, - 0x80000000, - 0x80000000, - 0x80000000, - 0x80000000, - 0x80000000, - 0x80000000, - 0x80000000, - 0x80000000, - 0x80000000, - 0x80000000, - 0x80000000, - 0x80000000, -}; - diff --git a/src/nvtt/cuda/CompressKernel.cu b/src/nvtt/cuda/CompressKernel.cu index 60ec132..916e3a3 100644 --- a/src/nvtt/cuda/CompressKernel.cu +++ b/src/nvtt/cuda/CompressKernel.cu @@ -207,45 +207,6 @@ __device__ void loadColorBlock(const uint * image, float3 colors[16], float3 sum } } -__device__ void loadColorBlock(const uint * image, float2 colors[16], float2 sums[16], int xrefs[16], int * sameColor) -{ - const int bid = blockIdx.x; - const int idx = threadIdx.x; - - __shared__ float dps[16]; - - if (idx < 16) - { - // Read color and copy to shared mem. - uint c = image[(bid) * 16 + idx]; - - colors[idx].y = ((c >> 8) & 0xFF) * (1.0f / 255.0f); - colors[idx].x = ((c >> 16) & 0xFF) * (1.0f / 255.0f); - - // No need to synchronize, 16 < warp size. -#if __DEVICE_EMULATION__ - } __debugsync(); if (idx < 16) { -#endif - - // Sort colors along the best fit line. - colorSums(colors, sums); - float2 axis = bestFitLine(colors, sums[0]); - - *sameColor = (axis == make_float2(0, 0)); - - dps[idx] = dot(colors[idx], axis); - -#if __DEVICE_EMULATION__ - } __debugsync(); if (idx < 16) { -#endif - - sortColors(dps, xrefs); - - float2 tmp = colors[idx]; - colors[xrefs[idx]] = tmp; - } -} - //////////////////////////////////////////////////////////////////////////////// // Round color to RGB565 and expand @@ -262,26 +223,6 @@ inline __device__ float3 roundAndExpand565(float3 v, ushort * w) return v; } -inline __device__ float2 roundAndExpand56(float2 v, ushort * w) -{ - v.x = rintf(__saturatef(v.x) * 31.0f); - v.y = rintf(__saturatef(v.y) * 63.0f); - *w = ((ushort)v.x << 11) | ((ushort)v.y << 5); - v.x *= 0.03227752766457f; // approximate integer bit expansion. - v.y *= 0.01583151765563f; - return v; -} - -inline __device__ float2 roundAndExpand88(float2 v, ushort * w) -{ - v.x = rintf(__saturatef(v.x) * 255.0f); - v.y = rintf(__saturatef(v.y) * 255.0f); - *w = ((ushort)v.x << 8) | ((ushort)v.y); - v.x *= 1.0f / 255.0f; - v.y *= 1.0f / 255.0f; - return v; -} - //////////////////////////////////////////////////////////////////////////////// // Evaluate permutations @@ -525,114 +466,6 @@ __device__ float evalPermutation3(const float3 * colors, const float * weights, } */ -__device__ float evalPermutation4(const float2 * colors, float2 color_sum, uint permutation, ushort * start, ushort * end) -{ - // Compute endpoints using least squares. - float2 alphax_sum = make_float2(0.0f, 0.0f); - uint akku = 0; - - // Compute alpha & beta for this permutation. - #pragma unroll - for (int i = 0; i < 16; i++) - { - const uint bits = permutation >> (2*i); - - alphax_sum += alphaTable4[bits & 3] * colors[i]; - akku += prods4[bits & 3]; - } - - float alpha2_sum = float(akku >> 16); - float beta2_sum = float((akku >> 8) & 0xff); - float alphabeta_sum = float(akku & 0xff); - float2 betax_sum = 9.0f * color_sum - alphax_sum; - - const float factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum); - - float2 a = (alphax_sum * beta2_sum - betax_sum * alphabeta_sum) * factor; - float2 b = (betax_sum * alpha2_sum - alphax_sum * alphabeta_sum) * factor; - - // Round a, b to the closest 5-6 color and expand... - a = roundAndExpand56(a, start); - b = roundAndExpand56(b, end); - - // compute the error - float2 e = a * a * alpha2_sum + b * b * beta2_sum + 2.0f * (a * b * alphabeta_sum - a * alphax_sum - b * betax_sum); - - return (1.0f / 9.0f) * (e.x + e.y); -} - -__device__ float evalPermutation3(const float2 * colors, float2 color_sum, uint permutation, ushort * start, ushort * end) -{ - // Compute endpoints using least squares. - float2 alphax_sum = make_float2(0.0f, 0.0f); - uint akku = 0; - - // Compute alpha & beta for this permutation. - #pragma unroll - for (int i = 0; i < 16; i++) - { - const uint bits = permutation >> (2*i); - - alphax_sum += alphaTable3[bits & 3] * colors[i]; - akku += prods3[bits & 3]; - } - - float alpha2_sum = float(akku >> 16); - float beta2_sum = float((akku >> 8) & 0xff); - float alphabeta_sum = float(akku & 0xff); - float2 betax_sum = 4.0f * color_sum - alphax_sum; - - const float factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum); - - float2 a = (alphax_sum * beta2_sum - betax_sum * alphabeta_sum) * factor; - float2 b = (betax_sum * alpha2_sum - alphax_sum * alphabeta_sum) * factor; - - // Round a, b to the closest 5-6 color and expand... - a = roundAndExpand56(a, start); - b = roundAndExpand56(b, end); - - // compute the error - float2 e = a * a * alpha2_sum + b * b * beta2_sum + 2.0f * (a * b * alphabeta_sum - a * alphax_sum - b * betax_sum); - - return (1.0f / 4.0f) * (e.x + e.y); -} - -__device__ float evalPermutationCTX(const float2 * colors, float2 color_sum, uint permutation, ushort * start, ushort * end) -{ - // Compute endpoints using least squares. - float2 alphax_sum = make_float2(0.0f, 0.0f); - uint akku = 0; - - // Compute alpha & beta for this permutation. - #pragma unroll - for (int i = 0; i < 16; i++) - { - const uint bits = permutation >> (2*i); - - alphax_sum += alphaTable4[bits & 3] * colors[i]; - akku += prods4[bits & 3]; - } - - float alpha2_sum = float(akku >> 16); - float beta2_sum = float((akku >> 8) & 0xff); - float alphabeta_sum = float(akku & 0xff); - float2 betax_sum = 9.0f * color_sum - alphax_sum; - - const float factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum); - - float2 a = (alphax_sum * beta2_sum - betax_sum * alphabeta_sum) * factor; - float2 b = (betax_sum * alpha2_sum - alphax_sum * alphabeta_sum) * factor; - - // Round a, b to the closest 8-8 color and expand... - a = roundAndExpand88(a, start); - b = roundAndExpand88(b, end); - - // compute the error - float2 e = a * a * alpha2_sum + b * b * beta2_sum + 2.0f * (a * b * alphabeta_sum - a * alphax_sum - b * betax_sum); - - return (1.0f / 9.0f) * (e.x + e.y); -} - //////////////////////////////////////////////////////////////////////////////// // Evaluate all permutations @@ -761,67 +594,6 @@ __device__ void evalAllPermutations(const float3 * colors, const float * weights } */ -__device__ void evalAllPermutations(const float2 * colors, float2 colorSum, const uint * permutations, ushort & bestStart, ushort & bestEnd, uint & bestPermutation, float * errors) -{ - const int idx = threadIdx.x; - - float bestError = FLT_MAX; - - __shared__ uint s_permutations[160]; - - for(int i = 0; i < 16; i++) - { - int pidx = idx + NUM_THREADS * i; - if (pidx >= 992) break; - - ushort start, end; - uint permutation = permutations[pidx]; - if (pidx < 160) s_permutations[pidx] = permutation; - - float error = evalPermutation4(colors, colorSum, permutation, &start, &end); - - if (error < bestError) - { - bestError = error; - bestPermutation = permutation; - bestStart = start; - bestEnd = end; - } - } - - if (bestStart < bestEnd) - { - swap(bestEnd, bestStart); - bestPermutation ^= 0x55555555; // Flip indices. - } - - for(int i = 0; i < 3; i++) - { - int pidx = idx + NUM_THREADS * i; - if (pidx >= 160) break; - - ushort start, end; - uint permutation = s_permutations[pidx]; - float error = evalPermutation3(colors, colorSum, permutation, &start, &end); - - if (error < bestError) - { - bestError = error; - bestPermutation = permutation; - bestStart = start; - bestEnd = end; - - if (bestStart > bestEnd) - { - swap(bestEnd, bestStart); - bestPermutation ^= (~bestPermutation >> 1) & 0x55555555; // Flip indices. - } - } - } - - errors[idx] = bestError; -} - __device__ void evalLevel4Permutations(const float3 * colors, float3 colorSum, const uint * permutations, ushort & bestStart, ushort & bestEnd, uint & bestPermutation, float * errors) { const int idx = threadIdx.x; @@ -890,40 +662,6 @@ __device__ void evalLevel4Permutations(const float3 * colors, const float * weig errors[idx] = bestError; } -__device__ void evalAllPermutationsCTX(const float2 * colors, float2 colorSum, const uint * permutations, ushort & bestStart, ushort & bestEnd, uint & bestPermutation, float * errors) -{ - const int idx = threadIdx.x; - - float bestError = FLT_MAX; - - for(int i = 0; i < 16; i++) - { - int pidx = idx + NUM_THREADS * i; - if (pidx >= 704) break; - - ushort start, end; - uint permutation = permutations[pidx]; - - float error = evalPermutationCTX(colors, colorSum, permutation, &start, &end); - - if (error < bestError) - { - bestError = error; - bestPermutation = permutation; - bestStart = start; - bestEnd = end; - } - } - - if (bestStart < bestEnd) - { - swap(bestEnd, bestStart); - bestPermutation ^= 0x55555555; // Flip indices. - } - - errors[idx] = bestError; -} - //////////////////////////////////////////////////////////////////////////////// // Find index with minimum error @@ -1034,11 +772,6 @@ __device__ void saveBlockDXT1(ushort start, ushort end, uint permutation, int xr result[bid].y = indices; } -__device__ void saveBlockCTX1(ushort start, ushort end, uint permutation, int xrefs[16], uint2 * result) -{ - saveBlockDXT1(start, end, permutation, xrefs, result); -} - __device__ void saveSingleColorBlockDXT1(float3 color, uint2 * result) { const int bid = blockIdx.x; @@ -1062,41 +795,6 @@ __device__ void saveSingleColorBlockDXT1(float3 color, uint2 * result) } } -__device__ void saveSingleColorBlockDXT1(float2 color, uint2 * result) -{ - const int bid = blockIdx.x; - - int r = color.x * 255; - int g = color.y * 255; - - ushort color0 = (OMatch5[r][0] << 11) | (OMatch6[g][0] << 5); - ushort color1 = (OMatch5[r][1] << 11) | (OMatch6[g][1] << 5); - - if (color0 < color1) - { - result[bid].x = (color0 << 16) | color1; - result[bid].y = 0xffffffff; - } - else - { - result[bid].x = (color1 << 16) | color0; - result[bid].y = 0xaaaaaaaa; - } -} - -__device__ void saveSingleColorBlockCTX1(float2 color, uint2 * result) -{ - const int bid = blockIdx.x; - - int r = color.x * 255; - int g = color.y * 255; - - ushort color0 = (r << 8) | (g); - - result[bid].x = (color0 << 16) | color0; - result[bid].y = 0x00000000; -} - //////////////////////////////////////////////////////////////////////////////// // Compress color block @@ -1205,75 +903,6 @@ __global__ void compressWeightedDXT1(const uint * permutations, const uint * ima } -__global__ void compressNormalDXT1(const uint * permutations, const uint * image, uint2 * result) -{ - __shared__ float2 colors[16]; - __shared__ float2 sums[16]; - __shared__ int xrefs[16]; - __shared__ int sameColor; - - loadColorBlock(image, colors, sums, xrefs, &sameColor); - - __syncthreads(); - - if (sameColor) - { - if (threadIdx.x == 0) saveSingleColorBlockDXT1(colors[0], result); - return; - } - - ushort bestStart, bestEnd; - uint bestPermutation; - - __shared__ float errors[NUM_THREADS]; - - evalAllPermutations(colors, sums[0], permutations, bestStart, bestEnd, bestPermutation, errors); - - // Use a parallel reduction to find minimum error. - const int minIdx = findMinError(errors); - - // Only write the result of the winner thread. - if (threadIdx.x == minIdx) - { - saveBlockDXT1(bestStart, bestEnd, bestPermutation, xrefs, result); - } -} - -__global__ void compressCTX1(const uint * permutations, const uint * image, uint2 * result) -{ - __shared__ float2 colors[16]; - __shared__ float2 sums[16]; - __shared__ int xrefs[16]; - __shared__ int sameColor; - - loadColorBlock(image, colors, sums, xrefs, &sameColor); - - __syncthreads(); - - if (sameColor) - { - if (threadIdx.x == 0) saveSingleColorBlockCTX1(colors[0], result); - return; - } - - ushort bestStart, bestEnd; - uint bestPermutation; - - __shared__ float errors[NUM_THREADS]; - - evalAllPermutationsCTX(colors, sums[0], permutations, bestStart, bestEnd, bestPermutation, errors); - - // Use a parallel reduction to find minimum error. - const int minIdx = findMinError(errors); - - // Only write the result of the winner thread. - if (threadIdx.x == minIdx) - { - saveBlockCTX1(bestStart, bestEnd, bestPermutation, xrefs, result); - } -} - - /* __device__ float computeError(const float weights[16], uchar a0, uchar a1) { @@ -1488,13 +1117,3 @@ extern "C" void compressWeightedKernelDXT1(uint blockNum, uint * d_data, uint * { compressWeightedDXT1<<>>(d_bitmaps, d_data, (uint2 *)d_result); } - -extern "C" void compressNormalKernelDXT1(uint blockNum, uint * d_data, uint * d_result, uint * d_bitmaps) -{ - compressNormalDXT1<<>>(d_bitmaps, d_data, (uint2 *)d_result); -} - -extern "C" void compressKernelCTX1(uint blockNum, uint * d_data, uint * d_result, uint * d_bitmaps) -{ - compressCTX1<<>>(d_bitmaps, d_data, (uint2 *)d_result); -} diff --git a/src/nvtt/cuda/CudaCompressDXT.cpp b/src/nvtt/cuda/CudaCompressDXT.cpp index dfd9084..687df26 100644 --- a/src/nvtt/cuda/CudaCompressDXT.cpp +++ b/src/nvtt/cuda/CudaCompressDXT.cpp @@ -1,620 +1,380 @@ -// Copyright NVIDIA Corporation 2007 -- Ignacio Castano -// -// 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. - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "CudaCompressDXT.h" -#include "CudaUtils.h" - - -#if defined HAVE_CUDA -#include -#endif - -#include -#include - -using namespace nv; -using namespace nvtt; - -#if defined HAVE_CUDA - -#define MAX_BLOCKS 8192U // 32768, 65535 - - -extern "C" void setupCompressKernel(const float weights[3]); -extern "C" void compressKernelDXT1(uint blockNum, uint * d_data, uint * d_result, uint * d_bitmaps); -extern "C" void compressKernelDXT1_Level4(uint blockNum, uint * d_data, uint * d_result, uint * d_bitmaps); -extern "C" void compressWeightedKernelDXT1(uint blockNum, uint * d_data, uint * d_result, uint * d_bitmaps); -extern "C" void compressNormalKernelDXT1(uint blockNum, uint * d_data, uint * d_result, uint * d_bitmaps); -extern "C" void compressKernelCTX1(uint blockNum, uint * d_data, uint * d_result, uint * d_bitmaps); - - -#include "Bitmaps.h" // @@ Rename to BitmapTable.h - -// Convert linear image to block linear. -static void convertToBlockLinear(const Image * image, uint * blockLinearImage) -{ - const uint w = (image->width() + 3) / 4; - const uint h = (image->height() + 3) / 4; - - for(uint by = 0; by < h; by++) { - for(uint bx = 0; bx < w; bx++) { - const uint bw = min(image->width() - bx * 4, 4U); - const uint bh = min(image->height() - by * 4, 4U); - - for (uint i = 0; i < 16; i++) { - const int x = (i % 4) % bw; - const int y = (i / 4) % bh; - blockLinearImage[(by * w + bx) * 16 + i] = image->pixel(bx * 4 + x, by * 4 + y).u; - } - } - } -} - -#endif - - -CudaCompressor::CudaCompressor() : m_bitmapTable(NULL), m_bitmapTableCTX(NULL), m_data(NULL), m_result(NULL) -{ -#if defined HAVE_CUDA - // Allocate and upload bitmaps. - cudaMalloc((void**) &m_bitmapTable, 992 * sizeof(uint)); - if (m_bitmapTable != NULL) - { - cudaMemcpy(m_bitmapTable, s_bitmapTable, 992 * sizeof(uint), cudaMemcpyHostToDevice); - } - - cudaMalloc((void**) &m_bitmapTableCTX, 704 * sizeof(uint)); - if (m_bitmapTableCTX != NULL) - { - cudaMemcpy(m_bitmapTableCTX, s_bitmapTableCTX, 704 * sizeof(uint), cudaMemcpyHostToDevice); - } - - // Allocate scratch buffers. - cudaMalloc((void**) &m_data, MAX_BLOCKS * 64U); - cudaMalloc((void**) &m_result, MAX_BLOCKS * 8U); -#endif -} - -CudaCompressor::~CudaCompressor() -{ -#if defined HAVE_CUDA - // Free device mem allocations. - cudaFree(m_data); - cudaFree(m_result); - cudaFree(m_bitmapTable); -#endif -} - -bool CudaCompressor::isValid() const -{ -#if defined HAVE_CUDA - if (cudaGetLastError() != cudaSuccess) - { - return false; - } -#endif - return m_data != NULL && m_result != NULL && m_bitmapTable != NULL; -} - -// @@ This code is very repetitive and needs to be cleaned up. - -#if 0 - -struct CudaCompressionKernel -{ - virtual void setup(const CompressionOptions::Private & compressionOptions) - { - setupCompressKernel(compressionOptions.colorWeight.ptr()); - } - - virtual void setBitmapTable(); - - virtual void runDeviceCode(int count); - - virtual void runHostCode(int count); - -}; - -void CudaCompressor::compressKernel(CudaCompressionKernel * kernel) -{ - nvDebugCheck(cuda::isHardwarePresent()); -#if defined HAVE_CUDA - - // Image size in blocks. - const uint w = (image->width() + 3) / 4; - const uint h = (image->height() + 3) / 4; - - uint imageSize = w * h * 16 * sizeof(Color32); - uint * blockLinearImage = (uint *) malloc(imageSize); - convertToBlockLinear(image, blockLinearImage); // @@ Do this in parallel with the GPU, or in the GPU! - - const uint blockNum = w * h; - const uint compressedSize = blockNum * 8; - - clock_t start = clock(); - - kernel->setup(compressionOptions); - kernel->setBitmapTable(m_bitmapTable); - - // TODO: Add support for multiple GPUs. - uint bn = 0; - while(bn != blockNum) - { - uint count = min(blockNum - bn, MAX_BLOCKS); - - cudaMemcpy(m_data, blockLinearImage + bn * 16, count * 64, cudaMemcpyHostToDevice); - - kernel->runDeviceCode(count, m_data, m_result); - - kernel->runHostCode(count); - - // Check for errors. - cudaError_t err = cudaGetLastError(); - if (err != cudaSuccess) - { - nvDebug("CUDA Error: %s\n", cudaGetErrorString(err)); - - if (outputOptions.errorHandler != NULL) - { - outputOptions.errorHandler->error(Error_CudaError); - } - } - - // Copy result to host, overwrite swizzled image. - cudaMemcpy(blockLinearImage, m_result, count * 8, cudaMemcpyDeviceToHost); - - // Output result. - kernel->outputResult(outputOptions.outputHandler); - - if (outputOptions.outputHandler != NULL) - { - outputOptions.outputHandler->writeData(blockLinearImage, count * 8); - } - - bn += count; - } - - clock_t end = clock(); - //printf("\rCUDA time taken: %.3f seconds\n", float(end-start) / CLOCKS_PER_SEC); - - free(blockLinearImage); - -#else - if (outputOptions.errorHandler != NULL) - { - outputOptions.errorHandler->error(Error_CudaError); - } -#endif -} - -#endif // 0 - - -void CudaCompressor::setImage(const Image * image, nvtt::AlphaMode alphaMode) -{ - m_image = image; - m_alphaMode = alphaMode; -} - - - -/// Compress image using CUDA. -void CudaCompressor::compressDXT1(const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) -{ - nvDebugCheck(cuda::isHardwarePresent()); -#if defined HAVE_CUDA - - // Image size in blocks. - const uint w = (m_image->width() + 3) / 4; - const uint h = (m_image->height() + 3) / 4; - - uint imageSize = w * h * 16 * sizeof(Color32); - uint * blockLinearImage = (uint *) malloc(imageSize); - convertToBlockLinear(m_image, blockLinearImage); // @@ Do this in parallel with the GPU, or in the GPU! - - const uint blockNum = w * h; - const uint compressedSize = blockNum * 8; - - clock_t start = clock(); - - setupCompressKernel(compressionOptions.colorWeight.ptr()); - - // TODO: Add support for multiple GPUs. - uint bn = 0; - while(bn != blockNum) - { - uint count = min(blockNum - bn, MAX_BLOCKS); - - cudaMemcpy(m_data, blockLinearImage + bn * 16, count * 64, cudaMemcpyHostToDevice); - - // Launch kernel. - compressKernelDXT1(count, m_data, m_result, m_bitmapTable); - - // Check for errors. - cudaError_t err = cudaGetLastError(); - if (err != cudaSuccess) - { - nvDebug("CUDA Error: %s\n", cudaGetErrorString(err)); - - if (outputOptions.errorHandler != NULL) - { - outputOptions.errorHandler->error(Error_CudaError); - } - } - - // Copy result to host, overwrite swizzled image. - cudaMemcpy(blockLinearImage, m_result, count * 8, cudaMemcpyDeviceToHost); - - // Output result. - if (outputOptions.outputHandler != NULL) - { - outputOptions.outputHandler->writeData(blockLinearImage, count * 8); - } - - bn += count; - } - - clock_t end = clock(); - //printf("\rCUDA time taken: %.3f seconds\n", float(end-start) / CLOCKS_PER_SEC); - - free(blockLinearImage); - -#else - if (outputOptions.errorHandler != NULL) - { - outputOptions.errorHandler->error(Error_CudaError); - } -#endif -} - - -/// Compress image using CUDA. -void CudaCompressor::compressDXT3(const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) -{ - nvDebugCheck(cuda::isHardwarePresent()); -#if defined HAVE_CUDA - - // Image size in blocks. - const uint w = (m_image->width() + 3) / 4; - const uint h = (m_image->height() + 3) / 4; - - uint imageSize = w * h * 16 * sizeof(Color32); - uint * blockLinearImage = (uint *) malloc(imageSize); - convertToBlockLinear(m_image, blockLinearImage); - - const uint blockNum = w * h; - const uint compressedSize = blockNum * 8; - - AlphaBlockDXT3 * alphaBlocks = NULL; - alphaBlocks = (AlphaBlockDXT3 *)malloc(min(compressedSize, MAX_BLOCKS * 8U)); - - setupCompressKernel(compressionOptions.colorWeight.ptr()); - - clock_t start = clock(); - - uint bn = 0; - while(bn != blockNum) - { - uint count = min(blockNum - bn, MAX_BLOCKS); - - cudaMemcpy(m_data, blockLinearImage + bn * 16, count * 64, cudaMemcpyHostToDevice); - - // Launch kernel. - if (m_alphaMode == AlphaMode_Transparency) - { - compressWeightedKernelDXT1(count, m_data, m_result, m_bitmapTable); - } - else - { - compressKernelDXT1_Level4(count, m_data, m_result, m_bitmapTable); - } - - // Compress alpha in parallel with the GPU. - for (uint i = 0; i < count; i++) - { - ColorBlock rgba(blockLinearImage + (bn + i) * 16); - OptimalCompress::compressDXT3A(rgba, alphaBlocks + i); - } - - // Check for errors. - cudaError_t err = cudaGetLastError(); - if (err != cudaSuccess) - { - nvDebug("CUDA Error: %s\n", cudaGetErrorString(err)); - - if (outputOptions.errorHandler != NULL) - { - outputOptions.errorHandler->error(Error_CudaError); - } - } - - // Copy result to host, overwrite swizzled image. - cudaMemcpy(blockLinearImage, m_result, count * 8, cudaMemcpyDeviceToHost); - - // Output result. - if (outputOptions.outputHandler != NULL) - { - for (uint i = 0; i < count; i++) - { - outputOptions.outputHandler->writeData(alphaBlocks + i, 8); - outputOptions.outputHandler->writeData(blockLinearImage + i * 2, 8); - } - } - - bn += count; - } - - clock_t end = clock(); - //printf("\rCUDA time taken: %.3f seconds\n", float(end-start) / CLOCKS_PER_SEC); - - free(alphaBlocks); - free(blockLinearImage); - -#else - if (outputOptions.errorHandler != NULL) - { - outputOptions.errorHandler->error(Error_CudaError); - } -#endif -} - - -/// Compress image using CUDA. -void CudaCompressor::compressDXT5(const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) -{ - nvDebugCheck(cuda::isHardwarePresent()); -#if defined HAVE_CUDA - - // Image size in blocks. - const uint w = (m_image->width() + 3) / 4; - const uint h = (m_image->height() + 3) / 4; - - uint imageSize = w * h * 16 * sizeof(Color32); - uint * blockLinearImage = (uint *) malloc(imageSize); - convertToBlockLinear(m_image, blockLinearImage); - - const uint blockNum = w * h; - const uint compressedSize = blockNum * 8; - - AlphaBlockDXT5 * alphaBlocks = NULL; - alphaBlocks = (AlphaBlockDXT5 *)malloc(min(compressedSize, MAX_BLOCKS * 8U)); - - setupCompressKernel(compressionOptions.colorWeight.ptr()); - - clock_t start = clock(); - - uint bn = 0; - while(bn != blockNum) - { - uint count = min(blockNum - bn, MAX_BLOCKS); - - cudaMemcpy(m_data, blockLinearImage + bn * 16, count * 64, cudaMemcpyHostToDevice); - - // Launch kernel. - if (m_alphaMode == AlphaMode_Transparency) - { - compressWeightedKernelDXT1(count, m_data, m_result, m_bitmapTable); - } - else - { - compressKernelDXT1_Level4(count, m_data, m_result, m_bitmapTable); - } - - // Compress alpha in parallel with the GPU. - for (uint i = 0; i < count; i++) - { - ColorBlock rgba(blockLinearImage + (bn + i) * 16); - QuickCompress::compressDXT5A(rgba, alphaBlocks + i); - } - - // Check for errors. - cudaError_t err = cudaGetLastError(); - if (err != cudaSuccess) - { - nvDebug("CUDA Error: %s\n", cudaGetErrorString(err)); - - if (outputOptions.errorHandler != NULL) - { - outputOptions.errorHandler->error(Error_CudaError); - } - } - - // Copy result to host, overwrite swizzled image. - cudaMemcpy(blockLinearImage, m_result, count * 8, cudaMemcpyDeviceToHost); - - // Output result. - if (outputOptions.outputHandler != NULL) - { - for (uint i = 0; i < count; i++) - { - outputOptions.outputHandler->writeData(alphaBlocks + i, 8); - outputOptions.outputHandler->writeData(blockLinearImage + i * 2, 8); - } - } - - bn += count; - } - - clock_t end = clock(); - //printf("\rCUDA time taken: %.3f seconds\n", float(end-start) / CLOCKS_PER_SEC); - - free(alphaBlocks); - free(blockLinearImage); - -#else - if (outputOptions.errorHandler != NULL) - { - outputOptions.errorHandler->error(Error_CudaError); - } -#endif -} - - -void CudaCompressor::compressDXT1n(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions) -{ - nvDebugCheck(cuda::isHardwarePresent()); -#if defined HAVE_CUDA - - // Image size in blocks. - const uint w = (m_image->width() + 3) / 4; - const uint h = (m_image->height() + 3) / 4; - - uint imageSize = w * h * 16 * sizeof(Color32); - uint * blockLinearImage = (uint *) malloc(imageSize); - convertToBlockLinear(m_image, blockLinearImage); // @@ Do this in parallel with the GPU, or in the GPU! - - const uint blockNum = w * h; - const uint compressedSize = blockNum * 8; - - clock_t start = clock(); - - setupCompressKernel(compressionOptions.colorWeight.ptr()); - - // TODO: Add support for multiple GPUs. - uint bn = 0; - while(bn != blockNum) - { - uint count = min(blockNum - bn, MAX_BLOCKS); - - cudaMemcpy(m_data, blockLinearImage + bn * 16, count * 64, cudaMemcpyHostToDevice); - - // Launch kernel. - compressNormalKernelDXT1(count, m_data, m_result, m_bitmapTable); - - // Check for errors. - cudaError_t err = cudaGetLastError(); - if (err != cudaSuccess) - { - nvDebug("CUDA Error: %s\n", cudaGetErrorString(err)); - - if (outputOptions.errorHandler != NULL) - { - outputOptions.errorHandler->error(Error_CudaError); - } - } - - // Copy result to host, overwrite swizzled image. - cudaMemcpy(blockLinearImage, m_result, count * 8, cudaMemcpyDeviceToHost); - - // Output result. - if (outputOptions.outputHandler != NULL) - { - outputOptions.outputHandler->writeData(blockLinearImage, count * 8); - } - - bn += count; - } - - clock_t end = clock(); - //printf("\rCUDA time taken: %.3f seconds\n", float(end-start) / CLOCKS_PER_SEC); - - free(blockLinearImage); - -#else - if (outputOptions.errorHandler != NULL) - { - outputOptions.errorHandler->error(Error_CudaError); - } -#endif -} - - -void CudaCompressor::compressCTX1(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions) -{ - nvDebugCheck(cuda::isHardwarePresent()); -#if defined HAVE_CUDA - - // Image size in blocks. - const uint w = (m_image->width() + 3) / 4; - const uint h = (m_image->height() + 3) / 4; - - uint imageSize = w * h * 16 * sizeof(Color32); - uint * blockLinearImage = (uint *) malloc(imageSize); - convertToBlockLinear(m_image, blockLinearImage); // @@ Do this in parallel with the GPU, or in the GPU! - - const uint blockNum = w * h; - const uint compressedSize = blockNum * 8; - - clock_t start = clock(); - - setupCompressKernel(compressionOptions.colorWeight.ptr()); - - // TODO: Add support for multiple GPUs. - uint bn = 0; - while(bn != blockNum) - { - uint count = min(blockNum - bn, MAX_BLOCKS); - - cudaMemcpy(m_data, blockLinearImage + bn * 16, count * 64, cudaMemcpyHostToDevice); - - // Launch kernel. - compressKernelCTX1(count, m_data, m_result, m_bitmapTableCTX); - - // Check for errors. - cudaError_t err = cudaGetLastError(); - if (err != cudaSuccess) - { - nvDebug("CUDA Error: %s\n", cudaGetErrorString(err)); - - if (outputOptions.errorHandler != NULL) - { - outputOptions.errorHandler->error(Error_CudaError); - } - } - - // Copy result to host, overwrite swizzled image. - cudaMemcpy(blockLinearImage, m_result, count * 8, cudaMemcpyDeviceToHost); - - // Output result. - if (outputOptions.outputHandler != NULL) - { - outputOptions.outputHandler->writeData(blockLinearImage, count * 8); - } - - bn += count; - } - - clock_t end = clock(); - //printf("\rCUDA time taken: %.3f seconds\n", float(end-start) / CLOCKS_PER_SEC); - - free(blockLinearImage); - -#else - if (outputOptions.errorHandler != NULL) - { - outputOptions.errorHandler->error(Error_CudaError); - } -#endif -} - +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// 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. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "CudaCompressDXT.h" +#include "CudaUtils.h" + + +#if defined HAVE_CUDA +#include +#endif + +#include +#include + +using namespace nv; +using namespace nvtt; + +#if defined HAVE_CUDA + +#define MAX_BLOCKS 8192U // 32768, 65535 + + +extern "C" void setupCompressKernel(const float weights[3]); +extern "C" void compressKernelDXT1(uint blockNum, uint * d_data, uint * d_result, uint * d_bitmaps); +extern "C" void compressKernelDXT1_Level4(uint blockNum, uint * d_data, uint * d_result, uint * d_bitmaps); +extern "C" void compressWeightedKernelDXT1(uint blockNum, uint * d_data, uint * d_result, uint * d_bitmaps); + +#include "Bitmaps.h" // @@ Rename to BitmapTable.h + +// Convert linear image to block linear. +static void convertToBlockLinear(const Image * image, uint * blockLinearImage) +{ + const uint w = (image->width() + 3) / 4; + const uint h = (image->height() + 3) / 4; + + for(uint by = 0; by < h; by++) { + for(uint bx = 0; bx < w; bx++) { + const uint bw = min(image->width() - bx * 4, 4U); + const uint bh = min(image->height() - by * 4, 4U); + + for (uint i = 0; i < 16; i++) { + const int x = (i % 4) % bw; + const int y = (i / 4) % bh; + blockLinearImage[(by * w + bx) * 16 + i] = image->pixel(bx * 4 + x, by * 4 + y).u; + } + } + } +} + +#endif + + +CudaCompressor::CudaCompressor() : m_bitmapTable(NULL), m_data(NULL), m_result(NULL) +{ +#if defined HAVE_CUDA + // Allocate and upload bitmaps. + cudaMalloc((void**) &m_bitmapTable, 992 * sizeof(uint)); + if (m_bitmapTable != NULL) + { + cudaMemcpy(m_bitmapTable, s_bitmapTable, 992 * sizeof(uint), cudaMemcpyHostToDevice); + } + + // Allocate scratch buffers. + cudaMalloc((void**) &m_data, MAX_BLOCKS * 64U); + cudaMalloc((void**) &m_result, MAX_BLOCKS * 8U); +#endif +} + +CudaCompressor::~CudaCompressor() +{ +#if defined HAVE_CUDA + // Free device mem allocations. + cudaFree(m_data); + cudaFree(m_result); + cudaFree(m_bitmapTable); +#endif +} + +bool CudaCompressor::isValid() const +{ +#if defined HAVE_CUDA + if (cudaGetLastError() != cudaSuccess) + { + return false; + } +#endif + return m_data != NULL && m_result != NULL && m_bitmapTable != NULL; +} + +// @@ This code is very repetitive and needs to be cleaned up. + +void CudaCompressor::setImage(const Image * image, nvtt::AlphaMode alphaMode) +{ + m_image = image; + m_alphaMode = alphaMode; +} + +/// Compress image using CUDA. +void CudaCompressor::compressDXT1(const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) +{ + nvDebugCheck(cuda::isHardwarePresent()); +#if defined HAVE_CUDA + + // Image size in blocks. + const uint w = (m_image->width() + 3) / 4; + const uint h = (m_image->height() + 3) / 4; + + uint imageSize = w * h * 16 * sizeof(Color32); + uint * blockLinearImage = (uint *) malloc(imageSize); + convertToBlockLinear(m_image, blockLinearImage); // @@ Do this in parallel with the GPU, or in the GPU! + + const uint blockNum = w * h; + const uint compressedSize = blockNum * 8; + + clock_t start = clock(); + + setupCompressKernel(compressionOptions.colorWeight.ptr()); + + // TODO: Add support for multiple GPUs. + uint bn = 0; + while(bn != blockNum) + { + uint count = min(blockNum - bn, MAX_BLOCKS); + + cudaMemcpy(m_data, blockLinearImage + bn * 16, count * 64, cudaMemcpyHostToDevice); + + // Launch kernel. + compressKernelDXT1(count, m_data, m_result, m_bitmapTable); + + // Check for errors. + cudaError_t err = cudaGetLastError(); + if (err != cudaSuccess) + { + nvDebug("CUDA Error: %s\n", cudaGetErrorString(err)); + + if (outputOptions.errorHandler != NULL) + { + outputOptions.errorHandler->error(Error_CudaError); + } + } + + // Copy result to host, overwrite swizzled image. + cudaMemcpy(blockLinearImage, m_result, count * 8, cudaMemcpyDeviceToHost); + + // Output result. + if (outputOptions.outputHandler != NULL) + { + outputOptions.outputHandler->writeData(blockLinearImage, count * 8); + } + + bn += count; + } + + clock_t end = clock(); + //printf("\rCUDA time taken: %.3f seconds\n", float(end-start) / CLOCKS_PER_SEC); + + free(blockLinearImage); + +#else + if (outputOptions.errorHandler != NULL) + { + outputOptions.errorHandler->error(Error_CudaError); + } +#endif +} + + +/// Compress image using CUDA. +void CudaCompressor::compressDXT3(const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) +{ + nvDebugCheck(cuda::isHardwarePresent()); +#if defined HAVE_CUDA + + // Image size in blocks. + const uint w = (m_image->width() + 3) / 4; + const uint h = (m_image->height() + 3) / 4; + + uint imageSize = w * h * 16 * sizeof(Color32); + uint * blockLinearImage = (uint *) malloc(imageSize); + convertToBlockLinear(m_image, blockLinearImage); + + const uint blockNum = w * h; + const uint compressedSize = blockNum * 8; + + AlphaBlockDXT3 * alphaBlocks = NULL; + alphaBlocks = (AlphaBlockDXT3 *)malloc(min(compressedSize, MAX_BLOCKS * 8U)); + + setupCompressKernel(compressionOptions.colorWeight.ptr()); + + clock_t start = clock(); + + uint bn = 0; + while(bn != blockNum) + { + uint count = min(blockNum - bn, MAX_BLOCKS); + + cudaMemcpy(m_data, blockLinearImage + bn * 16, count * 64, cudaMemcpyHostToDevice); + + // Launch kernel. + if (m_alphaMode == AlphaMode_Transparency) + { + compressWeightedKernelDXT1(count, m_data, m_result, m_bitmapTable); + } + else + { + compressKernelDXT1_Level4(count, m_data, m_result, m_bitmapTable); + } + + // Compress alpha in parallel with the GPU. + for (uint i = 0; i < count; i++) + { + ColorBlock rgba(blockLinearImage + (bn + i) * 16); + OptimalCompress::compressDXT3A(rgba, alphaBlocks + i); + } + + // Check for errors. + cudaError_t err = cudaGetLastError(); + if (err != cudaSuccess) + { + nvDebug("CUDA Error: %s\n", cudaGetErrorString(err)); + + if (outputOptions.errorHandler != NULL) + { + outputOptions.errorHandler->error(Error_CudaError); + } + } + + // Copy result to host, overwrite swizzled image. + cudaMemcpy(blockLinearImage, m_result, count * 8, cudaMemcpyDeviceToHost); + + // Output result. + if (outputOptions.outputHandler != NULL) + { + for (uint i = 0; i < count; i++) + { + outputOptions.outputHandler->writeData(alphaBlocks + i, 8); + outputOptions.outputHandler->writeData(blockLinearImage + i * 2, 8); + } + } + + bn += count; + } + + clock_t end = clock(); + //printf("\rCUDA time taken: %.3f seconds\n", float(end-start) / CLOCKS_PER_SEC); + + free(alphaBlocks); + free(blockLinearImage); + +#else + if (outputOptions.errorHandler != NULL) + { + outputOptions.errorHandler->error(Error_CudaError); + } +#endif +} + + +/// Compress image using CUDA. +void CudaCompressor::compressDXT5(const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) +{ + nvDebugCheck(cuda::isHardwarePresent()); +#if defined HAVE_CUDA + + // Image size in blocks. + const uint w = (m_image->width() + 3) / 4; + const uint h = (m_image->height() + 3) / 4; + + uint imageSize = w * h * 16 * sizeof(Color32); + uint * blockLinearImage = (uint *) malloc(imageSize); + convertToBlockLinear(m_image, blockLinearImage); + + const uint blockNum = w * h; + const uint compressedSize = blockNum * 8; + + AlphaBlockDXT5 * alphaBlocks = NULL; + alphaBlocks = (AlphaBlockDXT5 *)malloc(min(compressedSize, MAX_BLOCKS * 8U)); + + setupCompressKernel(compressionOptions.colorWeight.ptr()); + + clock_t start = clock(); + + uint bn = 0; + while(bn != blockNum) + { + uint count = min(blockNum - bn, MAX_BLOCKS); + + cudaMemcpy(m_data, blockLinearImage + bn * 16, count * 64, cudaMemcpyHostToDevice); + + // Launch kernel. + if (m_alphaMode == AlphaMode_Transparency) + { + compressWeightedKernelDXT1(count, m_data, m_result, m_bitmapTable); + } + else + { + compressKernelDXT1_Level4(count, m_data, m_result, m_bitmapTable); + } + + // Compress alpha in parallel with the GPU. + for (uint i = 0; i < count; i++) + { + ColorBlock rgba(blockLinearImage + (bn + i) * 16); + QuickCompress::compressDXT5A(rgba, alphaBlocks + i); + } + + // Check for errors. + cudaError_t err = cudaGetLastError(); + if (err != cudaSuccess) + { + nvDebug("CUDA Error: %s\n", cudaGetErrorString(err)); + + if (outputOptions.errorHandler != NULL) + { + outputOptions.errorHandler->error(Error_CudaError); + } + } + + // Copy result to host, overwrite swizzled image. + cudaMemcpy(blockLinearImage, m_result, count * 8, cudaMemcpyDeviceToHost); + + // Output result. + if (outputOptions.outputHandler != NULL) + { + for (uint i = 0; i < count; i++) + { + outputOptions.outputHandler->writeData(alphaBlocks + i, 8); + outputOptions.outputHandler->writeData(blockLinearImage + i * 2, 8); + } + } + + bn += count; + } + + clock_t end = clock(); + //printf("\rCUDA time taken: %.3f seconds\n", float(end-start) / CLOCKS_PER_SEC); + + free(alphaBlocks); + free(blockLinearImage); + +#else + if (outputOptions.errorHandler != NULL) + { + outputOptions.errorHandler->error(Error_CudaError); + } +#endif +} + + diff --git a/src/nvtt/cuda/CudaCompressDXT.h b/src/nvtt/cuda/CudaCompressDXT.h index 7567943..f72bacc 100644 --- a/src/nvtt/cuda/CudaCompressDXT.h +++ b/src/nvtt/cuda/CudaCompressDXT.h @@ -44,13 +44,10 @@ namespace nv void compressDXT1(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions); void compressDXT3(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions); void compressDXT5(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions); - void compressDXT1n(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions); - void compressCTX1(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions); private: uint * m_bitmapTable; - uint * m_bitmapTableCTX; uint * m_data; uint * m_result; diff --git a/src/nvtt/cuda/CudaMath.h b/src/nvtt/cuda/CudaMath.h index 88cd233..f2ed009 100644 --- a/src/nvtt/cuda/CudaMath.h +++ b/src/nvtt/cuda/CudaMath.h @@ -87,69 +87,6 @@ inline __device__ __host__ bool operator ==(float3 a, float3 b) return a.x == b.x && a.y == b.y && a.z == b.z; } - -// float2 operators -inline __device__ __host__ float2 operator *(float2 a, float2 b) -{ - return make_float2(a.x*b.x, a.y*b.y); -} - -inline __device__ __host__ float2 operator *(float f, float2 v) -{ - return make_float2(v.x*f, v.y*f); -} - -inline __device__ __host__ float2 operator *(float2 v, float f) -{ - return make_float2(v.x*f, v.y*f); -} - -inline __device__ __host__ float2 operator +(float2 a, float2 b) -{ - return make_float2(a.x+b.x, a.y+b.y); -} - -inline __device__ __host__ void operator +=(float2 & b, float2 a) -{ - b.x += a.x; - b.y += a.y; -} - -inline __device__ __host__ float2 operator -(float2 a, float2 b) -{ - return make_float2(a.x-b.x, a.y-b.y); -} - -inline __device__ __host__ void operator -=(float2 & b, float2 a) -{ - b.x -= a.x; - b.y -= a.y; -} - -inline __device__ __host__ float2 operator /(float2 v, float f) -{ - float inv = 1.0f / f; - return v * inv; -} - -inline __device__ __host__ void operator /=(float2 & b, float f) -{ - float inv = 1.0f / f; - b.x *= inv; - b.y *= inv; -} - -inline __device__ __host__ bool operator ==(float2 a, float2 b) -{ - return a.x == b.x && a.y == b.y; -} - - -inline __device__ __host__ float dot(float2 a, float2 b) -{ - return a.x * b.x + a.y * b.y; -} - inline __device__ __host__ float dot(float3 a, float3 b) { return a.x * b.x + a.y * b.y + a.z * b.z; @@ -306,89 +243,5 @@ inline __device__ float3 bestFitLine(const float3 * colors, float3 color_sum, fl return firstEigenVector(covariance); } -// @@ For 2D this may not be the most efficient method. It's a quadratic equation, right? -inline __device__ __host__ float2 firstEigenVector2D( float matrix[3] ) -{ - // @@ 8 iterations is probably more than enough. - - float2 v = make_float2(1.0f, 1.0f); - for(int i = 0; i < 8; i++) { - float x = v.x * matrix[0] + v.y * matrix[1]; - float y = v.x * matrix[1] + v.y * matrix[2]; - float m = max(x, y); - float iv = 1.0f / m; - if (m == 0.0f) iv = 0.0f; - v = make_float2(x*iv, y*iv); - } - - return v; -} - -inline __device__ void colorSums(const float2 * colors, float2 * sums) -{ -#if __DEVICE_EMULATION__ - float2 color_sum = make_float2(0.0f, 0.0f, 0.0f); - for (int i = 0; i < 16; i++) - { - color_sum += colors[i]; - } - - for (int i = 0; i < 16; i++) - { - sums[i] = color_sum; - } -#else - - const int idx = threadIdx.x; - - sums[idx] = colors[idx]; - sums[idx] += sums[idx^8]; - sums[idx] += sums[idx^4]; - sums[idx] += sums[idx^2]; - sums[idx] += sums[idx^1]; - -#endif -} - -inline __device__ float2 bestFitLine(const float2 * colors, float2 color_sum) -{ - // Compute covariance matrix of the given colors. -#if __DEVICE_EMULATION__ - float covariance[3] = {0, 0, 0}; - for (int i = 0; i < 16; i++) - { - float2 a = (colors[i] - color_sum * (1.0f / 16.0f)); - covariance[0] += a.x * a.x; - covariance[1] += a.x * a.y; - covariance[3] += a.y * a.y; - } -#else - - const int idx = threadIdx.x; - - float2 diff = (colors[idx] - color_sum * (1.0f / 16.0f)); - - __shared__ float covariance[16*3]; - - covariance[3 * idx + 0] = diff.x * diff.x; - covariance[3 * idx + 1] = diff.x * diff.y; - covariance[3 * idx + 2] = diff.y * diff.y; - - for(int d = 8; d > 0; d >>= 1) - { - if (idx < d) - { - covariance[3 * idx + 0] += covariance[3 * (idx+d) + 0]; - covariance[3 * idx + 1] += covariance[3 * (idx+d) + 1]; - covariance[3 * idx + 2] += covariance[3 * (idx+d) + 2]; - } - } - -#endif - - // Compute first eigen vector. - return firstEigenVector2D(covariance); -} - #endif // CUDAMATH_H diff --git a/src/nvtt/experimental/nvtt_experimental.cpp b/src/nvtt/experimental/nvtt_experimental.cpp deleted file mode 100644 index 2291459..0000000 --- a/src/nvtt/experimental/nvtt_experimental.cpp +++ /dev/null @@ -1,60 +0,0 @@ - -#include "nvtt_experimental.h" - -struct NvttImage -{ - NvttImage() : - m_constant(false), - m_image(NULL), - m_floatImage(NULL) - { - } - - ~NvttImage() - { - if (m_constant && m_image) m_image->unwrap(); - delete m_image; - delete m_floatImage; - } - - bool m_constant; - Image * m_image; - FloatImage * m_floatImage; -}; - -NvttImage * nvttCreateImage() -{ - return new NvttImage(); -} - -void nvttDestroyImage(NvttImage * img) -{ - delete img; -} - -void nvttSetImageData(NvttImage * img, NvttInputFormat format, uint w, uint h, void * data) -{ - nvCheck(img != NULL); - - if (format == NVTT_InputFormat_BGRA_8UB) - { - img->m_constant = false; - img->m_image->allocate(w, h); - memcpy(img->m_image->pixels(), data, w * h * 4); - } - else - { - nvCheck(false); - } -} - -void nvttCompressImage(NvttImage * img, NvttFormat format) -{ - nvCheck(img != NULL); - - // @@ Invoke appropriate compressor. -} - - - -#endif // NVTT_EXPERIMENTAL_H diff --git a/src/nvtt/experimental/nvtt_experimental.h b/src/nvtt/experimental/nvtt_experimental.h deleted file mode 100644 index 58ab1cb..0000000 --- a/src/nvtt/experimental/nvtt_experimental.h +++ /dev/null @@ -1,55 +0,0 @@ - -#ifndef NVTT_EXPERIMENTAL_H -#define NVTT_EXPERIMENTAL_H - -#include - -typedef struct NvttImage NvttImage; - -NvttImage * nvttCreateImage(); -void nvttDestroyImage(NvttImage * img); - -void nvttSetImageData(NvttImage * img, NvttInputFormat format, uint w, uint h, void * data); - -void nvttCompressImage(NvttImage * img, NvttFormat format); - -// How to control the compression parameters? - -// Using many arguments: -// void nvttCompressImage(img, format, quality, r, g, b, a, ...); - -// Using existing compression option class: -// compressionOptions = nvttCreateCompressionOptions(); -// nvttSetCompressionOptionsFormat(compressionOptions, format); -// nvttSetCompressionOptionsQuality(compressionOptions, quality); -// nvttSetCompressionOptionsQuality(compressionOptions, quality); -// nvttSetCompressionOptionsColorWeights(compressionOptions, r, g, b, a); -// ... -// nvttCompressImage(img, compressionOptions); - -// Using thread local context state: -// void nvttSetCompressionFormat(format); -// void nvttSetCompressionQuality(quality); -// void nvttSetCompressionColorWeights(r, g, b, a); -// ... -// nvttCompressImage(img); - -// Using thread local context state, but with GL style function arguments: -// nvttCompressorParameteri(NVTT_FORMAT, format); -// nvttCompressorParameteri(NVTT_QUALITY, quality); -// nvttCompressorParameterf(NVTT_COLOR_WEIGHT_RED, r); -// nvttCompressorParameterf(NVTT_COLOR_WEIGHT_GREEN, g); -// nvttCompressorParameterf(NVTT_COLOR_WEIGHT_BLUE, b); -// nvttCompressorParameterf(NVTT_COLOR_WEIGHT_ALPHA, a); -// or nvttCompressorParameter4f(NVTT_COLOR_WEIGHTS, r, g, b, a); -// ... -// nvttCompressImage(img); - -// How do we get the compressed output? -// - Using callbacks. (via new entrypoints, or through outputOptions) -// - Return it explicitely from nvttCompressImage. -// - Store it along the image, retrieve later explicitely with 'nvttGetCompressedData(img, ...)' - - - -#endif // NVTT_EXPERIMENTAL_H diff --git a/src/nvtt/nvtt.h b/src/nvtt/nvtt.h index 7363a24..2b691f2 100644 --- a/src/nvtt/nvtt.h +++ b/src/nvtt/nvtt.h @@ -47,7 +47,7 @@ # define NVTT_API #endif -#define NVTT_VERSION 201 +#define NVTT_VERSION 200 #define NVTT_DECLARE_PIMPL(Class) \ private: \ @@ -83,9 +83,6 @@ namespace nvtt Format_BC3n = Format_DXT5n, Format_BC4, // ATI1 Format_BC5, // 3DC, ATI2 - - Format_DXT1n, - Format_CTX1, }; /// Quality modes. @@ -140,7 +137,8 @@ namespace nvtt enum InputFormat { InputFormat_BGRA_8UB, - InputFormat_RGBA_32F, + // InputFormat_RGBE_8UB, + // InputFormat_BGRA_32F, }; /// Mipmap downsampling filters. @@ -155,10 +153,7 @@ namespace nvtt enum ColorTransform { ColorTransform_None, - ColorTransform_Linear, ///< Not implemented. - ColorTransform_Swizzle, ///< Not implemented. - ColorTransform_YCoCg, ///< Transform into r=Co, g=Cg, b=0, a=Y - ColorTransform_ScaledYCoCg, ///< Not implemented. + ColorTransform_Linear, }; /// Extents rounding mode. @@ -223,14 +218,10 @@ namespace nvtt // Set color transforms. @@ Not implemented! NVTT_API void setColorTransform(ColorTransform t); NVTT_API void setLinearTransform(int channel, float w0, float w1, float w2, float w3); - NVTT_API void setSwizzleTransform(int x, int y, int z, int w); // Set resizing options. NVTT_API void setMaxExtents(int d); NVTT_API void setRoundMode(RoundMode mode); - - // Set whether or not to premultiply color by alpha - NVTT_API void setPremultiplyAlpha(bool b); }; diff --git a/src/nvtt/nvtt_wrapper.h b/src/nvtt/nvtt_wrapper.h index b51a96a..100a4a3 100644 --- a/src/nvtt/nvtt_wrapper.h +++ b/src/nvtt/nvtt_wrapper.h @@ -47,7 +47,7 @@ # define NVTT_API #endif -#define NVTT_VERSION 201 +#define NVTT_VERSION 200 #ifdef __cplusplus typedef struct nvtt::InputOptions NvttInputOptions; diff --git a/src/nvtt/squish/extra/squishgen2.cpp b/src/nvtt/squish/extra/squishgen2.cpp deleted file mode 100644 index f613d0c..0000000 --- a/src/nvtt/squish/extra/squishgen2.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* ----------------------------------------------------------------------------- - - Copyright (c) 2006 Simon Brown si@sjbrown.co.uk - Copyright (c) 2008 Ignacio Castano castano@gmail.com - - 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. - - -------------------------------------------------------------------------- */ - -#include -#include -#include - -struct Precomp { - float alpha2_sum; - float beta2_sum; - float alphabeta_sum; - float factor; -}; - - -int main() -{ - int i = 0; - - printf("struct Precomp {\n"); - printf("\tfloat alpha2_sum;\n"); - printf("\tfloat beta2_sum;\n"); - printf("\tfloat alphabeta_sum;\n"); - printf("\tfloat factor;\n"); - printf("};\n\n"); - - printf("static const SQUISH_ALIGN_16 Precomp s_threeElement[153] = {\n"); - - // Three element clusters: - for( int c0 = 0; c0 <= 16; c0++) // At least two clusters. - { - for( int c1 = 0; c1 <= 16-c0; c1++) - { - int c2 = 16 - c0 - c1; - - Precomp p; - p.alpha2_sum = c0 + c1 * 0.25f; - p.beta2_sum = c2 + c1 * 0.25f; - p.alphabeta_sum = c1 * 0.25f; - p.factor = 1.0f / (p.alpha2_sum * p.beta2_sum - p.alphabeta_sum * p.alphabeta_sum); - - if (isfinite(p.factor)) - { - printf("\t{ %ff, %ff, %ff, %ff }, // %d (%d %d %d)\n", p.alpha2_sum, p.beta2_sum, p.alphabeta_sum, p.factor, i, c0, c1, c2); - } - else - { - printf("\t{ %ff, %ff, %ff, FLT_MAX }, // %d (%d %d %d)\n", p.alpha2_sum, p.beta2_sum, p.alphabeta_sum, i, c0, c1, c2); - } - - i++; - } - } - printf("}; // %d three cluster elements\n\n", i); - - printf("static const SQUISH_ALIGN_16 Precomp s_fourElement[969] = {\n"); - - // Four element clusters: - i = 0; - for( int c0 = 0; c0 <= 16; c0++) - { - for( int c1 = 0; c1 <= 16-c0; c1++) - { - for( int c2 = 0; c2 <= 16-c0-c1; c2++) - { - int c3 = 16 - c0 - c1 - c2; - - Precomp p; - p.alpha2_sum = c0 + c1 * (4.0f/9.0f) + c2 * (1.0f/9.0f); - p.beta2_sum = c3 + c2 * (4.0f/9.0f) + c1 * (1.0f/9.0f); - p.alphabeta_sum = (c1 + c2) * (2.0f/9.0f); - p.factor = 1.0f / (p.alpha2_sum * p.beta2_sum - p.alphabeta_sum * p.alphabeta_sum); - - if (isfinite(p.factor)) - { - printf("\t{ %ff, %ff, %ff, %ff }, // %d (%d %d %d %d)\n", p.alpha2_sum, p.beta2_sum, p.alphabeta_sum, p.factor, i, c0, c1, c2, c3); - } - else - { - printf("\t{ %ff, %ff, %ff, FLT_MAX }, // %d (%d %d %d %d)\n", p.alpha2_sum, p.beta2_sum, p.alphabeta_sum, i, c0, c1, c2, c3); - } - - i++; - } - } - } - printf("}; // %d four cluster elements\n\n", i); - - return 0; -} diff --git a/src/nvtt/squish/simd_ve.h b/src/nvtt/squish/simd_ve.h index 0f90a44..56ed95e 100644 --- a/src/nvtt/squish/simd_ve.h +++ b/src/nvtt/squish/simd_ve.h @@ -26,10 +26,8 @@ #ifndef SQUISH_SIMD_VE_H #define SQUISH_SIMD_VE_H -#ifndef __APPLE_ALTIVEC__ #include #undef bool -#endif namespace squish { diff --git a/src/nvtt/tests/stress.cpp b/src/nvtt/tests/stress.cpp deleted file mode 100644 index cdfd6a6..0000000 --- a/src/nvtt/tests/stress.cpp +++ /dev/null @@ -1,225 +0,0 @@ -// Copyright NVIDIA Corporation 2007 -- Ignacio Castano -// -// 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. - -#include - -#include // printf -#include // rand -#include // clock -#include // memcpy, memcmp -#include - -#define FRAME_COUNT 1000 - -#define WIDTH 2048 -#define HEIGHT 2048 -#define INPUT_SIZE (WIDTH*HEIGHT) -#define OUTPUT_SIZE (WIDTH*HEIGHT/16*4) - -static int s_input[INPUT_SIZE]; -static int s_reference[OUTPUT_SIZE]; -static int s_output[OUTPUT_SIZE]; -static int s_frame = 0; - -struct MyOutputHandler : public nvtt::OutputHandler -{ - MyOutputHandler() : m_ptr(NULL) {} - - virtual void beginImage(int size, int width, int height, int depth, int face, int miplevel) - { - assert(size == sizeof(int) * OUTPUT_SIZE); - assert(width == WIDTH); - assert(height == HEIGHT); - assert(depth == 1); - assert(face == 0); - assert(miplevel == 0); - - m_ptr = (unsigned char *)s_output; - - if (s_frame == 1) - { - // Save first result as reference. - memcpy(s_reference, s_output, sizeof(int) * OUTPUT_SIZE); - } - else if (s_frame > 1) - { - // Compare against reference. - if (memcmp(s_output, s_reference, sizeof(int) * OUTPUT_SIZE) != 0) - { - printf("Compressed image different to original.\n"); - exit(EXIT_FAILURE); - } - } - } - - virtual bool writeData(const void * data, int size) - { - memcpy(m_ptr, data, size); - m_ptr += size; - return true; - } - - unsigned char * m_ptr; - -}; - -void precomp() -{ - unsigned int bitmaps[1024]; - - int num = 0; - - printf("const static uint s_bitmapTableCTX[704] =\n{\n"); - - for (int a = 1; a <= 15; a++) - { - for (int b = a; b <= 15; b++) - { - for (int c = b; c <= 15; c++) - { - int indices[16]; - - int i = 0; - for(; i < a; i++) { - indices[i] = 0; - } - for(; i < a+b; i++) { - indices[i] = 2; - } - for(; i < a+b+c; i++) { - indices[i] = 3; - } - for(; i < 16; i++) { - indices[i] = 1; - } - - unsigned int bm = 0; - for(i = 0; i < 16; i++) { - bm |= indices[i] << (i * 2); - } - - printf("\t0x%8X, // %d %d %d %d\n", bm, a-0, b-a, c-b, 16-c); - - bitmaps[num] = bm; - num++; - } - } - } - - // Align to 32: 680 -> 704 - while (num < 704) - { - printf("\t0x80000000,\n"); - - bitmaps[num] = 0x80000000; // 15 0 0 1; - num++; - } - - printf("}; // num = %d\n", num); - -/* - for( int i = imax; i >= 0; --i ) - { - // second cluster [i,j) is one third along - for( int m = i; m < 16; ++m ) - { - indices[m] = 2; - } - const int jmax = ( i == 0 ) ? 15 : 16; - for( int j = jmax; j >= i; --j ) - { - // third cluster [j,k) is two thirds along - for( int m = j; m < 16; ++m ) - { - indices[m] = 3; - } - - int kmax = ( j == 0 ) ? 15 : 16; - for( int k = kmax; k >= j; --k ) - { - // last cluster [k,n) is at the end - if( k < 16 ) - { - indices[k] = 1; - } - - uint bitmap = 0; - - bool hasThree = false; - for(int p = 0; p < 16; p++) { - bitmap |= indices[p] << (p * 2); - } - - bitmaps[num] = bitmap; - num++; - } - } - } -*/ -} - -int main(int argc, char *argv[]) -{ -// precomp(); - - nvtt::InputOptions inputOptions; - inputOptions.setTextureLayout(nvtt::TextureType_2D, WIDTH, HEIGHT); - - for (int i = 0; i < INPUT_SIZE; i++) - { - s_input[i] = rand(); - } - - inputOptions.setMipmapData(s_input, WIDTH, HEIGHT); - inputOptions.setMipmapGeneration(false); - - nvtt::CompressionOptions compressionOptions; -// compressionOptions.setFormat(nvtt::Format_DXT3); -// compressionOptions.setFormat(nvtt::Format_DXT1n); -// compressionOptions.setFormat(nvtt::Format_CTX1); - - nvtt::OutputOptions outputOptions; - outputOptions.setOutputHeader(false); - - MyOutputHandler outputHandler; - outputOptions.setOutputHandler(&outputHandler); - - - nvtt::Compressor compressor; -// compressor.enableCudaAcceleration(false); - - for (s_frame = 0; s_frame < FRAME_COUNT; s_frame++) - { - clock_t start = clock(); - - printf("compressing frame %d:\n", s_frame); - - compressor.process(inputOptions, compressionOptions, outputOptions); - - clock_t end = clock(); - printf("time taken: %.3f seconds\n", float(end-start) / CLOCKS_PER_SEC); - } - - return EXIT_SUCCESS; -} - diff --git a/src/nvtt/tools/compress.cpp b/src/nvtt/tools/compress.cpp index 17bd65a..4141249 100644 --- a/src/nvtt/tools/compress.cpp +++ b/src/nvtt/tools/compress.cpp @@ -140,8 +140,6 @@ int main(int argc, char *argv[]) bool silent = false; bool bc1n = false; nvtt::Format format = nvtt::Format_BC1; - bool premultiplyAlpha = false; - nvtt::MipmapFilter mipmapFilter = nvtt::MipmapFilter_Box; const char * externalCompressor = NULL; @@ -175,19 +173,6 @@ int main(int argc, char *argv[]) { noMipmaps = true; } - else if (strcmp("-premula", argv[i]) == 0) - { - premultiplyAlpha = true; - } - else if (strcmp("-mipfilter", argv[i]) == 0) - { - if (i+1 == argc) break; - i++; - - if (strcmp("box", argv[i]) == 0) mipmapFilter = nvtt::MipmapFilter_Box; - else if (strcmp("triangle", argv[i]) == 0) mipmapFilter = nvtt::MipmapFilter_Triangle; - else if (strcmp("kaiser", argv[i]) == 0) mipmapFilter = nvtt::MipmapFilter_Kaiser; - } // Compression options. else if (strcmp("-fast", argv[i]) == 0) @@ -269,12 +254,7 @@ int main(int argc, char *argv[]) } } - const uint version = nvtt::version(); - const uint major = version / 100; - const uint minor = version % 100; - - - printf("NVIDIA Texture Tools %u.%u - Copyright NVIDIA Corporation 2007\n\n", major, minor); + printf("NVIDIA Texture Tools - Copyright NVIDIA Corporation 2007\n\n"); if (input.isNull()) { @@ -286,9 +266,7 @@ int main(int argc, char *argv[]) printf(" -tonormal\tConvert input to normal map.\n"); printf(" -clamp \tClamp wrapping mode (default).\n"); printf(" -repeat \tRepeat wrapping mode.\n"); - printf(" -nomips \tDisable mipmap generation.\n"); - printf(" -premula \tPremultiply alpha into color channel.\n"); - printf(" -mipfilter \tMipmap filter. One of the following: box, triangle, kaiser.\n\n"); + printf(" -nomips \tDisable mipmap generation.\n\n"); printf("Compression options:\n"); printf(" -fast \tFast compression.\n"); @@ -395,13 +373,6 @@ int main(int argc, char *argv[]) inputOptions.setMipmapGeneration(false); } - if (premultiplyAlpha) - { - inputOptions.setPremultiplyAlpha(true); - inputOptions.setAlphaMode(nvtt::AlphaMode_Premultiplied); - } - - inputOptions.setMipmapFilter(mipmapFilter); nvtt::CompressionOptions compressionOptions; compressionOptions.setFormat(format); diff --git a/src/nvtt/tools/decompress.cpp b/src/nvtt/tools/decompress.cpp index 8589e23..ffb2ceb 100644 --- a/src/nvtt/tools/decompress.cpp +++ b/src/nvtt/tools/decompress.cpp @@ -31,145 +31,41 @@ #include "cmdline.h" -#include // clock - int main(int argc, char *argv[]) { MyAssertHandler assertHandler; MyMessageHandler messageHandler; - bool forcenormal = false; - bool mipmaps = false; - bool faces = false; - - nv::Path input; - nv::Path output; - - // Parse arguments. - for (int i = 1; i < argc; i++) - { - if (strcmp("-forcenormal", argv[i]) == 0) - { - forcenormal = true; - } - else if (strcmp("-mipmaps", argv[i]) == 0) - { - mipmaps = true; - } - else if (strcmp("-faces", argv[i]) == 0) - { - faces = true; - } - else if (argv[i][0] != '-') - { - input = argv[i]; - - if (i+1 < argc && argv[i+1][0] != '-') - { - output = argv[i+1]; - } - else - { - output.copy(input.str()); - output.stripExtension(); - output.append(".tga"); - } - - break; - } - } - - printf("NVIDIA Texture Tools - Copyright NVIDIA Corporation 2007\n\n"); - - if (input.isNull()) + if (argc != 2) { - printf("usage: nvdecompress [options] infile [outfile]\n\n"); - - printf("Note: the .tga extension is forced on outfile\n\n"); - - printf("Input options:\n"); - printf(" -forcenormal \tThe input image is a normal map.\n"); - printf(" -mipmaps \tDecompress all mipmaps.\n"); - printf(" -faces \tDecompress all faces.\n"); - - return 1; - } - - // Load surface. - nv::DirectDrawSurface dds(input); - if (!dds.isValid()) - { - fprintf(stderr, "The file '%s' is not a valid DDS file.\n", input.str()); + printf("NVIDIA Texture Tools - Copyright NVIDIA Corporation 2007\n\n"); + printf("usage: nvdecompress 'ddsfile'\n\n"); return 1; } - if (!dds.isSupported() || dds.isTexture3D()) + // Load surface. + nv::DirectDrawSurface dds(argv[1]); + if (!dds.isValid()) { - fprintf(stderr, "The file '%s' is not a supported DDS file.\n", input.str()); + printf("The file '%s' is not a valid DDS file.\n", argv[1]); return 1; } - uint faceCount; - if (dds.isTexture2D()) - { - faceCount = 1; - } - else - { - nvCheck(dds.isTextureCube()); - faceCount = 6; - } - - uint mipmapCount = dds.mipmapCount(); + nv::Path name(argv[1]); + name.stripExtension(); + name.append(".tga"); - clock_t start = clock(); - - // apply arguments - if (forcenormal) - { - dds.setNormalFlag(true); - } - if (!faces) - { - faceCount = 1; - } - if (!mipmaps) - { - mipmapCount = 1; + nv::StdOutputStream stream(name.str()); + if (stream.isError()) { + printf("Error opening '%s' for writting\n", name.str()); + return 1; } - - nv::Image mipmap; - nv::Path name; - - // strip extension, we force the tga extension - output.stripExtension(); - - // extract faces and mipmaps - for (uint f = 0; f < faceCount; f++) - { - for (uint m = 0; m < mipmapCount; m++) - { - dds.mipmap(&mipmap, f, m); - // set output filename, if we are doing faces and/or mipmaps - name.copy(output); - if (faces) name.appendFormat("_face%d", f); - if (mipmaps) name.appendFormat("_mipmap%d", m); - name.append(".tga"); - - nv::StdOutputStream stream(name.str()); - if (stream.isError()) { - fprintf(stderr, "Error opening '%s' for writting\n", name.str()); - return 1; - } - - nv::ImageIO::saveTGA(stream, &mipmap); - } - } + // @@ TODO: Add command line options to output mipmaps, cubemap faces, etc. + nv::Image img; + dds.mipmap(&img, 0, 0); // get first image + nv::ImageIO::saveTGA(stream, &img); - clock_t end = clock(); - printf("\rtime taken: %.3f seconds\n", float(end-start) / CLOCKS_PER_SEC); - return 0; }