Fixes issue 204.
This commit is contained in:
parent
57298c71c8
commit
7e74261f92
@ -39,8 +39,6 @@
|
|||||||
|
|
||||||
#define NV_NOINLINE __attribute__((noinline))
|
#define NV_NOINLINE __attribute__((noinline))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Define __FUNC__ properly.
|
// Define __FUNC__ properly.
|
||||||
#if __STDC_VERSION__ < 199901L
|
#if __STDC_VERSION__ < 199901L
|
||||||
# if __GNUC__ >= 2
|
# if __GNUC__ >= 2
|
||||||
@ -53,21 +51,3 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define restrict __restrict__
|
#define restrict __restrict__
|
||||||
|
|
||||||
/*
|
|
||||||
// Type definitions
|
|
||||||
typedef uint8_t uint8;
|
|
||||||
typedef int8_t int8;
|
|
||||||
|
|
||||||
typedef uint16_t uint16;
|
|
||||||
typedef int16_t int16;
|
|
||||||
|
|
||||||
typedef uint32_t uint32;
|
|
||||||
typedef int32_t int32;
|
|
||||||
|
|
||||||
typedef uint64_t uint64;
|
|
||||||
typedef int64_t int64;
|
|
||||||
|
|
||||||
// Aliases
|
|
||||||
typedef uint32 uint;
|
|
||||||
*/
|
|
||||||
|
@ -3,12 +3,12 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdint.h> // uint8_t, int8_t, ... uintptr_t
|
#include <stdint.h> // uint8_t, int8_t, ... uintptr_t
|
||||||
#include <cstddef> // operator new, size_t, NULL
|
#include <stddef.h> // operator new, size_t, NULL
|
||||||
|
|
||||||
// Function linkage
|
// Function linkage
|
||||||
#define DLL_IMPORT
|
#define DLL_IMPORT
|
||||||
#if __GNUC__ >= 4
|
#if __GNUC__ >= 4
|
||||||
# define DLL_EXPORT __attribute__((visibility("default")))
|
# define DLL_EXPORT __attribute__((visibility("default")))
|
||||||
# define DLL_EXPORT_CLASS DLL_EXPORT
|
# define DLL_EXPORT_CLASS DLL_EXPORT
|
||||||
#else
|
#else
|
||||||
# define DLL_EXPORT
|
# define DLL_EXPORT
|
||||||
@ -25,11 +25,10 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NV_FASTCALL __attribute__((fastcall))
|
#define NV_FASTCALL __attribute__((fastcall))
|
||||||
#define NV_FORCEINLINE __attribute__((always_inline))
|
#define NV_FORCEINLINE __attribute__((always_inline)) inline
|
||||||
#define NV_DEPRECATED __attribute__((deprecated))
|
#define NV_DEPRECATED __attribute__((deprecated))
|
||||||
#define NV_THREAD_LOCAL __thread
|
#define NV_THREAD_LOCAL __thread
|
||||||
|
|
||||||
|
|
||||||
#if __GNUC__ > 2
|
#if __GNUC__ > 2
|
||||||
#define NV_PURE __attribute__((pure))
|
#define NV_PURE __attribute__((pure))
|
||||||
#define NV_CONST __attribute__((const))
|
#define NV_CONST __attribute__((const))
|
||||||
@ -52,22 +51,3 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define restrict __restrict__
|
#define restrict __restrict__
|
||||||
|
|
||||||
/*
|
|
||||||
// Type definitions
|
|
||||||
typedef unsigned char uint8;
|
|
||||||
typedef signed char int8;
|
|
||||||
|
|
||||||
typedef unsigned short uint16;
|
|
||||||
typedef signed short int16;
|
|
||||||
|
|
||||||
typedef unsigned int uint32;
|
|
||||||
typedef signed int int32;
|
|
||||||
|
|
||||||
typedef unsigned long long uint64;
|
|
||||||
typedef signed long long int64;
|
|
||||||
|
|
||||||
// Aliases
|
|
||||||
typedef uint32 uint;
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "nvcore/Debug.h"
|
#include "nvcore/Debug.h"
|
||||||
#include "nvcore/Utils.h" // max
|
#include "nvcore/Utils.h" // max
|
||||||
#include "nvcore/StdStream.h"
|
#include "nvcore/StdStream.h"
|
||||||
|
#include "nvmath/Vector.inl"
|
||||||
|
|
||||||
#include <string.h> // memset
|
#include <string.h> // memset
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include <float.h> // FLT_MAX
|
#include <float.h> // FLT_MAX
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
using namespace nv;
|
using namespace nv;
|
||||||
|
|
||||||
@ -498,7 +499,7 @@ static void EigenSolver3_Tridiagonal(float mat[3][3], float * diag, float * subd
|
|||||||
|
|
||||||
diag[0] = a;
|
diag[0] = a;
|
||||||
subd[2] = 0.f;
|
subd[2] = 0.f;
|
||||||
if ( fabs(c) >= epsilon )
|
if (fabsf(c) >= epsilon)
|
||||||
{
|
{
|
||||||
const float ell = sqrtf(b*b+c*c);
|
const float ell = sqrtf(b*b+c*c);
|
||||||
b /= ell;
|
b /= ell;
|
||||||
@ -538,8 +539,8 @@ static bool EigenSolver3_QLAlgorithm(float mat[3][3], float * diag, float * subd
|
|||||||
int m;
|
int m;
|
||||||
for (m = ell; m <= 1; m++)
|
for (m = ell; m <= 1; m++)
|
||||||
{
|
{
|
||||||
float dd = fabs(diag[m]) + fabs(diag[m+1]);
|
float dd = fabsf(diag[m]) + fabsf(diag[m+1]);
|
||||||
if ( fabs(subd[m]) + dd == dd )
|
if ( fabsf(subd[m]) + dd == dd )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ( m == ell )
|
if ( m == ell )
|
||||||
@ -555,7 +556,7 @@ static bool EigenSolver3_QLAlgorithm(float mat[3][3], float * diag, float * subd
|
|||||||
for (int i = m-1; i >= ell; i--)
|
for (int i = m-1; i >= ell; i--)
|
||||||
{
|
{
|
||||||
float f = s*subd[i], b = c*subd[i];
|
float f = s*subd[i], b = c*subd[i];
|
||||||
if ( fabs(f) >= fabs(g) )
|
if ( fabsf(f) >= fabsf(g) )
|
||||||
{
|
{
|
||||||
c = g/f;
|
c = g/f;
|
||||||
r = sqrtf(c*c+1);
|
r = sqrtf(c*c+1);
|
||||||
@ -690,7 +691,7 @@ static void EigenSolver4_Tridiagonal(float mat[4][4], float * diag, float * subd
|
|||||||
float maxElement = FLT_MAX;
|
float maxElement = FLT_MAX;
|
||||||
for (int i = 0; i < n; ++i)
|
for (int i = 0; i < n; ++i)
|
||||||
for (int j = 0; j < n; ++j)
|
for (int j = 0; j < n; ++j)
|
||||||
maxElement = max(maxElement, fabs(mat[i][j]));
|
maxElement = max(maxElement, fabsf(mat[i][j]));
|
||||||
float epsilon = relEpsilon * maxElement;
|
float epsilon = relEpsilon * maxElement;
|
||||||
|
|
||||||
// Iterative algorithm, works for any size of matrix but might be slower than
|
// Iterative algorithm, works for any size of matrix but might be slower than
|
||||||
@ -711,7 +712,7 @@ static void EigenSolver4_Tridiagonal(float mat[4][4], float * diag, float * subd
|
|||||||
float r = sqrtf(0.5f * (alpha*alpha - A(k+1,k)*alpha));
|
float r = sqrtf(0.5f * (alpha*alpha - A(k+1,k)*alpha));
|
||||||
|
|
||||||
// If r is zero, skip this column - already in tridiagonal form
|
// If r is zero, skip this column - already in tridiagonal form
|
||||||
if (fabs(r) < epsilon)
|
if (fabsf(r) < epsilon)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
float v[n] = {};
|
float v[n] = {};
|
||||||
@ -728,12 +729,12 @@ static void EigenSolver4_Tridiagonal(float mat[4][4], float * diag, float * subd
|
|||||||
Q = mul(Q, P);
|
Q = mul(Q, P);
|
||||||
}
|
}
|
||||||
|
|
||||||
nvDebugCheck(fabs(A(2,0)) < epsilon);
|
nvDebugCheck(fabsf(A(2,0)) < epsilon);
|
||||||
nvDebugCheck(fabs(A(0,2)) < epsilon);
|
nvDebugCheck(fabsf(A(0,2)) < epsilon);
|
||||||
nvDebugCheck(fabs(A(3,0)) < epsilon);
|
nvDebugCheck(fabsf(A(3,0)) < epsilon);
|
||||||
nvDebugCheck(fabs(A(0,3)) < epsilon);
|
nvDebugCheck(fabsf(A(0,3)) < epsilon);
|
||||||
nvDebugCheck(fabs(A(3,1)) < epsilon);
|
nvDebugCheck(fabsf(A(3,1)) < epsilon);
|
||||||
nvDebugCheck(fabs(A(1,3)) < epsilon);
|
nvDebugCheck(fabsf(A(1,3)) < epsilon);
|
||||||
|
|
||||||
for (int i = 0; i < n; ++i)
|
for (int i = 0; i < n; ++i)
|
||||||
diag[i] = A(i,i);
|
diag[i] = A(i,i);
|
||||||
@ -758,8 +759,8 @@ static bool EigenSolver4_QLAlgorithm(float mat[4][4], float * diag, float * subd
|
|||||||
int m;
|
int m;
|
||||||
for (m = ell; m < 3; m++)
|
for (m = ell; m < 3; m++)
|
||||||
{
|
{
|
||||||
float dd = fabs(diag[m]) + fabs(diag[m+1]);
|
float dd = fabsf(diag[m]) + fabsf(diag[m+1]);
|
||||||
if ( fabs(subd[m]) + dd == dd )
|
if ( fabsf(subd[m]) + dd == dd )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ( m == ell )
|
if ( m == ell )
|
||||||
@ -775,7 +776,7 @@ static bool EigenSolver4_QLAlgorithm(float mat[4][4], float * diag, float * subd
|
|||||||
for (int i = m-1; i >= ell; i--)
|
for (int i = m-1; i >= ell; i--)
|
||||||
{
|
{
|
||||||
float f = s*subd[i], b = c*subd[i];
|
float f = s*subd[i], b = c*subd[i];
|
||||||
if ( fabs(f) >= fabs(g) )
|
if ( fabsf(f) >= fabsf(g) )
|
||||||
{
|
{
|
||||||
c = g/f;
|
c = g/f;
|
||||||
r = sqrtf(c*c+1);
|
r = sqrtf(c*c+1);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
PROJECT(nvtt)
|
PROJECT(nvtt)
|
||||||
|
|
||||||
ADD_SUBDIRECTORY(squish)
|
ADD_SUBDIRECTORY(squish)
|
||||||
#ADD_SUBDIRECTORY(bc6h)
|
ADD_SUBDIRECTORY(bc6h)
|
||||||
#ADD_SUBDIRECTORY(bc7)
|
ADD_SUBDIRECTORY(bc7)
|
||||||
|
|
||||||
SET(NVTT_SRCS
|
SET(NVTT_SRCS
|
||||||
nvtt.h nvtt.cpp
|
nvtt.h nvtt.cpp
|
||||||
@ -12,7 +12,7 @@ SET(NVTT_SRCS
|
|||||||
BlockCompressor.h BlockCompressor.cpp
|
BlockCompressor.h BlockCompressor.cpp
|
||||||
CompressorDX9.h CompressorDX9.cpp
|
CompressorDX9.h CompressorDX9.cpp
|
||||||
CompressorDX10.h CompressorDX10.cpp
|
CompressorDX10.h CompressorDX10.cpp
|
||||||
# CompressorDX11.h CompressorDX11.cpp
|
CompressorDX11.h CompressorDX11.cpp
|
||||||
CompressorRGB.h CompressorRGB.cpp
|
CompressorRGB.h CompressorRGB.cpp
|
||||||
Context.h Context.cpp
|
Context.h Context.cpp
|
||||||
QuickCompressDXT.h QuickCompressDXT.cpp
|
QuickCompressDXT.h QuickCompressDXT.cpp
|
||||||
@ -47,7 +47,7 @@ ELSE(NVTT_SHARED)
|
|||||||
ADD_LIBRARY(nvtt ${NVTT_SRCS})
|
ADD_LIBRARY(nvtt ${NVTT_SRCS})
|
||||||
ENDIF(NVTT_SHARED)
|
ENDIF(NVTT_SHARED)
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(nvtt ${LIBS} nvcore nvmath nvimage nvthread squish)
|
TARGET_LINK_LIBRARIES(nvtt ${LIBS} nvcore nvmath nvimage nvthread squish bc6h bc7)
|
||||||
|
|
||||||
INSTALL(TARGETS nvtt
|
INSTALL(TARGETS nvtt
|
||||||
RUNTIME DESTINATION bin
|
RUNTIME DESTINATION bin
|
||||||
|
@ -17,6 +17,7 @@ See the License for the specific language governing permissions and limitations
|
|||||||
#include "nvcore/Debug.h"
|
#include "nvcore/Debug.h"
|
||||||
#include "nvmath/Vector.inl"
|
#include "nvmath/Vector.inl"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <float.h>
|
||||||
|
|
||||||
using namespace nv;
|
using namespace nv;
|
||||||
using namespace AVPCL;
|
using namespace AVPCL;
|
||||||
|
@ -24,6 +24,7 @@ See the License for the specific language governing permissions and limitations
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "endpts.h"
|
#include "endpts.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <float.h>
|
||||||
|
|
||||||
#include "shapes_three.h"
|
#include "shapes_three.h"
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ See the License for the specific language governing permissions and limitations
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "endpts.h"
|
#include "endpts.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <float.h>
|
||||||
|
|
||||||
#include "shapes_two.h"
|
#include "shapes_two.h"
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ See the License for the specific language governing permissions and limitations
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "endpts.h"
|
#include "endpts.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <float.h>
|
||||||
|
|
||||||
#include "shapes_three.h"
|
#include "shapes_three.h"
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ See the License for the specific language governing permissions and limitations
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "endpts.h"
|
#include "endpts.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <float.h>
|
||||||
|
|
||||||
#include "shapes_two.h"
|
#include "shapes_two.h"
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ See the License for the specific language governing permissions and limitations
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "endpts.h"
|
#include "endpts.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <float.h>
|
||||||
|
|
||||||
using namespace nv;
|
using namespace nv;
|
||||||
using namespace AVPCL;
|
using namespace AVPCL;
|
||||||
|
@ -24,6 +24,7 @@ See the License for the specific language governing permissions and limitations
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "endpts.h"
|
#include "endpts.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <float.h>
|
||||||
|
|
||||||
using namespace nv;
|
using namespace nv;
|
||||||
using namespace AVPCL;
|
using namespace AVPCL;
|
||||||
|
@ -24,7 +24,7 @@ See the License for the specific language governing permissions and limitations
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "endpts.h"
|
#include "endpts.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <float.h>
|
||||||
|
|
||||||
using namespace nv;
|
using namespace nv;
|
||||||
using namespace AVPCL;
|
using namespace AVPCL;
|
||||||
|
@ -24,6 +24,7 @@ See the License for the specific language governing permissions and limitations
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "endpts.h"
|
#include "endpts.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <float.h>
|
||||||
|
|
||||||
#include "shapes_two.h"
|
#include "shapes_two.h"
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public:
|
|||||||
static float metric3premult_alphain(nv::Vector3::Arg rgb0, nv::Vector3::Arg rgb1, int rotatemode);
|
static float metric3premult_alphain(nv::Vector3::Arg rgb0, nv::Vector3::Arg rgb1, int rotatemode);
|
||||||
static float metric1premult(float rgb0, float a0, float rgb1, float a1, int rotatemode);
|
static float metric1premult(float rgb0, float a0, float rgb1, float a1, int rotatemode);
|
||||||
|
|
||||||
static float Utils::premult(float r, float a);
|
static float premult(float r, float a);
|
||||||
|
|
||||||
// quantization and unquantization
|
// quantization and unquantization
|
||||||
static int unquantize(int q, int prec);
|
static int unquantize(int q, int prec);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
ADD_EXECUTABLE(filtertest filtertest.cpp ../tools/cmdline.h)
|
ADD_EXECUTABLE(filtertest filtertest.cpp ../tools/cmdline.h)
|
||||||
TARGET_LINK_LIBRARIES(filtertest nvcore nvmath nvimage)
|
TARGET_LINK_LIBRARIES(filtertest nvcore nvmath nvimage nvtt)
|
||||||
|
|
||||||
ADD_EXECUTABLE(nvtestsuite testsuite.cpp)
|
ADD_EXECUTABLE(nvtestsuite testsuite.cpp)
|
||||||
TARGET_LINK_LIBRARIES(nvtestsuite nvcore nvmath nvimage nvtt)
|
TARGET_LINK_LIBRARIES(nvtestsuite nvcore nvmath nvimage nvtt)
|
||||||
@ -13,7 +13,7 @@ ADD_TEST(NVTT.TestSuite.Epic.nocuda nvtestsuite -path ${NV_SOURCE_DIR}/data/test
|
|||||||
|
|
||||||
IF (CUDA_FOUND)
|
IF (CUDA_FOUND)
|
||||||
ADD_EXECUTABLE(driverapitest driverapi.cpp)
|
ADD_EXECUTABLE(driverapitest driverapi.cpp)
|
||||||
TARGET_LINK_LIBRARIES(driverapitest nvcore nvmath nvimage)
|
TARGET_LINK_LIBRARIES(driverapitest nvcore nvmath nvimage nvtt)
|
||||||
ENDIF (CUDA_FOUND)
|
ENDIF (CUDA_FOUND)
|
||||||
|
|
||||||
ADD_EXECUTABLE(imperativeapi imperativeapi.cpp)
|
ADD_EXECUTABLE(imperativeapi imperativeapi.cpp)
|
||||||
|
@ -3,19 +3,19 @@ ADD_EXECUTABLE(nvcompress compress.cpp cmdline.h)
|
|||||||
TARGET_LINK_LIBRARIES(nvcompress nvcore nvmath nvimage nvtt)
|
TARGET_LINK_LIBRARIES(nvcompress nvcore nvmath nvimage nvtt)
|
||||||
|
|
||||||
ADD_EXECUTABLE(nvdecompress decompress.cpp cmdline.h)
|
ADD_EXECUTABLE(nvdecompress decompress.cpp cmdline.h)
|
||||||
TARGET_LINK_LIBRARIES(nvdecompress nvcore nvmath nvimage)
|
TARGET_LINK_LIBRARIES(nvdecompress nvcore nvmath nvimage nvtt)
|
||||||
|
|
||||||
ADD_EXECUTABLE(nvddsinfo ddsinfo.cpp cmdline.h)
|
ADD_EXECUTABLE(nvddsinfo ddsinfo.cpp cmdline.h)
|
||||||
TARGET_LINK_LIBRARIES(nvddsinfo nvcore nvmath nvimage)
|
TARGET_LINK_LIBRARIES(nvddsinfo nvcore nvmath nvimage nvtt)
|
||||||
|
|
||||||
ADD_EXECUTABLE(nvimgdiff imgdiff.cpp cmdline.h)
|
ADD_EXECUTABLE(nvimgdiff imgdiff.cpp cmdline.h)
|
||||||
TARGET_LINK_LIBRARIES(nvimgdiff nvcore nvmath nvimage)
|
TARGET_LINK_LIBRARIES(nvimgdiff nvcore nvmath nvimage nvtt)
|
||||||
|
|
||||||
ADD_EXECUTABLE(nvassemble assemble.cpp cmdline.h)
|
ADD_EXECUTABLE(nvassemble assemble.cpp cmdline.h)
|
||||||
TARGET_LINK_LIBRARIES(nvassemble nvcore nvmath nvimage)
|
TARGET_LINK_LIBRARIES(nvassemble nvcore nvmath nvimage nvtt)
|
||||||
|
|
||||||
ADD_EXECUTABLE(nvzoom resize.cpp cmdline.h)
|
ADD_EXECUTABLE(nvzoom resize.cpp cmdline.h)
|
||||||
TARGET_LINK_LIBRARIES(nvzoom nvcore nvmath nvimage)
|
TARGET_LINK_LIBRARIES(nvzoom nvcore nvmath nvimage nvtt)
|
||||||
|
|
||||||
SET(TOOLS nvcompress nvdecompress nvddsinfo nvassemble nvzoom)
|
SET(TOOLS nvcompress nvdecompress nvddsinfo nvassemble nvzoom)
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ ENDIF(GLEW_FOUND AND GLUT_FOUND AND OPENGL_FOUND)
|
|||||||
|
|
||||||
|
|
||||||
ADD_EXECUTABLE(nv-gnome-thumbnailer thumbnailer.cpp cmdline.h)
|
ADD_EXECUTABLE(nv-gnome-thumbnailer thumbnailer.cpp cmdline.h)
|
||||||
TARGET_LINK_LIBRARIES(nv-gnome-thumbnailer nvcore nvmath nvimage)
|
TARGET_LINK_LIBRARIES(nv-gnome-thumbnailer nvcore nvmath nvimage nvtt)
|
||||||
|
|
||||||
SET(TOOLS ${TOOLS} nv-gnome-thumbnailer)
|
SET(TOOLS ${TOOLS} nv-gnome-thumbnailer)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user