mirror of
https://github.com/yuzu-emu/FasTC.git
synced 2025-01-08 05:25:33 +00:00
Some formatting and rearrange the BPTC code to be more structured like the others
This commit is contained in:
parent
f2c153feba
commit
f12ee09f7e
|
@ -47,7 +47,7 @@ INCLUDE_DIRECTORIES(${FasTC_BINARY_DIR}/BPTCEncoder/include)
|
||||||
|
|
||||||
IF(NOT "" STREQUAL "${AVPCLLIB_ROOT}")
|
IF(NOT "" STREQUAL "${AVPCLLIB_ROOT}")
|
||||||
INCLUDE_DIRECTORIES(${AVPCLLIB_INCLUDE_DIR})
|
INCLUDE_DIRECTORIES(${AVPCLLIB_INCLUDE_DIR})
|
||||||
SET(FOUND_NVTT_BC7_EXPORT TRUE)
|
SET(FOUND_NVTT_BPTC_EXPORT TRUE)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
INCLUDE(CheckCXXSourceRuns)
|
INCLUDE(CheckCXXSourceRuns)
|
||||||
|
@ -57,9 +57,11 @@ IF( NOT HAS_INLINE_ASSEMBLY AND NOT HAS_INLINE_ASSEMBLY_WITH_FLAGS )
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
# Check to see whether or not our compiler supports atomic operations
|
# Check to see whether or not our compiler supports atomic operations
|
||||||
IF( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" )
|
IF( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR
|
||||||
|
"${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" )
|
||||||
SET( COMPILER_CLANG True )
|
SET( COMPILER_CLANG True )
|
||||||
ELSEIF( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" )
|
ELSEIF( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR
|
||||||
|
"${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" )
|
||||||
SET( COMPILER_GNU True )
|
SET( COMPILER_GNU True )
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
@ -96,19 +98,21 @@ IF( HAS_MSVC_ATOMICS OR HAS_GCC_ATOMICS )
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
CONFIGURE_FILE(
|
CONFIGURE_FILE(
|
||||||
"config/BC7Config.h.in"
|
"config/BPTCConfig.h.in"
|
||||||
"include/BC7Config.h"
|
"include/BPTCConfig.h"
|
||||||
)
|
)
|
||||||
|
|
||||||
SET( HEADERS
|
SET( HEADERS
|
||||||
src/BC7CompressionMode.h
|
config/BPTCConfig.h.in
|
||||||
|
include/BPTCCompressor.h
|
||||||
|
src/CompressionMode.h
|
||||||
src/BitStream.h
|
src/BitStream.h
|
||||||
src/RGBAEndpoints.h
|
src/RGBAEndpoints.h
|
||||||
src/ParallelStage.h
|
src/ParallelStage.h
|
||||||
)
|
)
|
||||||
|
|
||||||
SET( SOURCES
|
SET( SOURCES
|
||||||
src/BC7Compressor.cpp
|
src/Compressor.cpp
|
||||||
src/RGBAEndpoints.cpp
|
src/RGBAEndpoints.cpp
|
||||||
src/ParallelStage.cpp
|
src/ParallelStage.cpp
|
||||||
)
|
)
|
||||||
|
@ -132,12 +136,12 @@ IF( HAS_SSE_41 )
|
||||||
SET( HEADERS
|
SET( HEADERS
|
||||||
${HEADERS}
|
${HEADERS}
|
||||||
src/RGBAEndpointsSIMD.h
|
src/RGBAEndpointsSIMD.h
|
||||||
src/BC7CompressionModeSIMD.h
|
src/CompressionModeSIMD.h
|
||||||
)
|
)
|
||||||
|
|
||||||
SET( SOURCES
|
SET( SOURCES
|
||||||
${SOURCES}
|
${SOURCES}
|
||||||
src/BC7CompressorSIMD.cpp
|
src/CompressorSIMD.cpp
|
||||||
src/RGBAEndpointsSIMD.cpp
|
src/RGBAEndpointsSIMD.cpp
|
||||||
)
|
)
|
||||||
ENDIF( HAS_SSE_41 )
|
ENDIF( HAS_SSE_41 )
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
/* FasTC
|
|
||||||
* Copyright (c) 2012 University of North Carolina at Chapel Hill. All rights reserved.
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, and distribute this software and its documentation for educational,
|
|
||||||
* research, and non-profit purposes, without fee, and without a written agreement is hereby granted,
|
|
||||||
* provided that the above copyright notice, this paragraph, and the following four paragraphs appear
|
|
||||||
* in all copies.
|
|
||||||
*
|
|
||||||
* Permission to incorporate this software into commercial products may be obtained by contacting the
|
|
||||||
* authors or the Office of Technology Development at the University of North Carolina at Chapel Hill <otd@unc.edu>.
|
|
||||||
*
|
|
||||||
* This software program and documentation are copyrighted by the University of North Carolina at Chapel Hill.
|
|
||||||
* The software program and documentation are supplied "as is," without any accompanying services from the
|
|
||||||
* University of North Carolina at Chapel Hill or the authors. The University of North Carolina at Chapel Hill
|
|
||||||
* and the authors do not warrant that the operation of the program will be uninterrupted or error-free. The
|
|
||||||
* end-user understands that the program was developed for research purposes and is advised not to rely
|
|
||||||
* exclusively on the program for any reason.
|
|
||||||
*
|
|
||||||
* IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE AUTHORS BE LIABLE TO ANY PARTY FOR
|
|
||||||
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE
|
|
||||||
* USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE
|
|
||||||
* AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY
|
|
||||||
* STATUTORY WARRANTY OF NON-INFRINGEMENT. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY
|
|
||||||
* OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS HAVE NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
|
|
||||||
* ENHANCEMENTS, OR MODIFICATIONS.
|
|
||||||
*
|
|
||||||
* Please send all BUG REPORTS to <pavel@cs.unc.edu>.
|
|
||||||
*
|
|
||||||
* The authors may be contacted via:
|
|
||||||
*
|
|
||||||
* Pavel Krajcevski
|
|
||||||
* Dept of Computer Science
|
|
||||||
* 201 S Columbia St
|
|
||||||
* Frederick P. Brooks, Jr. Computer Science Bldg
|
|
||||||
* Chapel Hill, NC 27599-3175
|
|
||||||
* USA
|
|
||||||
*
|
|
||||||
* <http://gamma.cs.unc.edu/FasTC/>
|
|
||||||
*/
|
|
||||||
|
|
||||||
// BC7Config.h.in -- This file contains variables that are introduced
|
|
||||||
// explicitly by the CMake build process.
|
|
||||||
|
|
||||||
// Do we have the proper popcnt instruction defined?
|
|
||||||
#cmakedefine NO_INLINE_ASSEMBLY
|
|
||||||
#cmakedefine HAS_SSE_POPCNT
|
|
||||||
#cmakedefine HAS_SSE_41
|
|
||||||
|
|
||||||
#cmakedefine HAS_ATOMICS
|
|
||||||
#cmakedefine HAS_GCC_ATOMICS
|
|
||||||
#cmakedefine HAS_MSVC_ATOMICS
|
|
||||||
|
|
||||||
#cmakedefine FOUND_NVTT_BC7_EXPORT
|
|
65
BPTCEncoder/config/BPTCConfig.h.in
Normal file
65
BPTCEncoder/config/BPTCConfig.h.in
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
/* FasTC
|
||||||
|
* Copyright (c) 2014 University of North Carolina at Chapel Hill.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software and its
|
||||||
|
* documentation for educational, research, and non-profit purposes, without
|
||||||
|
* fee, and without a written agreement is hereby granted, provided that the
|
||||||
|
* above copyright notice, this paragraph, and the following four paragraphs
|
||||||
|
* appear in all copies.
|
||||||
|
*
|
||||||
|
* Permission to incorporate this software into commercial products may be
|
||||||
|
* obtained by contacting the authors or the Office of Technology Development
|
||||||
|
* at the University of North Carolina at Chapel Hill <otd@unc.edu>.
|
||||||
|
*
|
||||||
|
* This software program and documentation are copyrighted by the University of
|
||||||
|
* North Carolina at Chapel Hill. The software program and documentation are
|
||||||
|
* supplied "as is," without any accompanying services from the University of
|
||||||
|
* North Carolina at Chapel Hill or the authors. The University of North
|
||||||
|
* Carolina at Chapel Hill and the authors do not warrant that the operation of
|
||||||
|
* the program will be uninterrupted or error-free. The end-user understands
|
||||||
|
* that the program was developed for research purposes and is advised not to
|
||||||
|
* rely exclusively on the program for any reason.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE
|
||||||
|
* AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL,
|
||||||
|
* OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF
|
||||||
|
* THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF NORTH CAROLINA
|
||||||
|
* AT CHAPEL HILL OR THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS SPECIFICALLY
|
||||||
|
* DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY
|
||||||
|
* STATUTORY WARRANTY OF NON-INFRINGEMENT. THE SOFTWARE PROVIDED HEREUNDER IS ON
|
||||||
|
* AN "AS IS" BASIS, AND THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND
|
||||||
|
* THE AUTHORS HAVE NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
|
||||||
|
* ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*
|
||||||
|
* Please send all BUG REPORTS to <pavel@cs.unc.edu>.
|
||||||
|
*
|
||||||
|
* The authors may be contacted via:
|
||||||
|
*
|
||||||
|
* Pavel Krajcevski
|
||||||
|
* Dept of Computer Science
|
||||||
|
* 201 S Columbia St
|
||||||
|
* Frederick P. Brooks, Jr. Computer Science Bldg
|
||||||
|
* Chapel Hill, NC 27599-3175
|
||||||
|
* USA
|
||||||
|
*
|
||||||
|
* <http://gamma.cs.unc.edu/FasTC/>
|
||||||
|
*/
|
||||||
|
|
||||||
|
// BPTCConfig.h.in -- This file contains variables that are introduced
|
||||||
|
// explicitly by the CMake build process.
|
||||||
|
|
||||||
|
// Do we have the proper popcnt instruction defined?
|
||||||
|
#cmakedefine NO_INLINE_ASSEMBLY
|
||||||
|
#cmakedefine HAS_SSE_POPCNT
|
||||||
|
#cmakedefine HAS_SSE_41
|
||||||
|
|
||||||
|
#cmakedefine HAS_ATOMICS
|
||||||
|
#cmakedefine HAS_GCC_ATOMICS
|
||||||
|
#cmakedefine HAS_MSVC_ATOMICS
|
||||||
|
|
||||||
|
#cmakedefine FOUND_NVTT_BC7_EXPORT
|
|
@ -1,5 +1,5 @@
|
||||||
/* FasTC
|
/* FasTC
|
||||||
* Copyright (c) 2012 University of North Carolina at Chapel Hill.
|
* Copyright (c) 2014 University of North Carolina at Chapel Hill.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software and its
|
* Permission to use, copy, modify, and distribute this software and its
|
||||||
|
@ -73,15 +73,15 @@
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifndef BPTCENCODER_INCLUDE_BC7COMPRESSOR_H_
|
#ifndef BPTCENCODER_INCLUDE_BPTCCOMPRESSOR_H_
|
||||||
#define BPTCENCODER_INCLUDE_BC7COMPRESSOR_H_
|
#define BPTCENCODER_INCLUDE_BPTCCOMPRESSOR_H_
|
||||||
|
|
||||||
#include "BC7Config.h"
|
#include "BPTCConfig.h"
|
||||||
#include "CompressionJob.h"
|
#include "CompressionJob.h"
|
||||||
|
|
||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
|
|
||||||
namespace BC7C {
|
namespace BPTCC {
|
||||||
// This is the error metric that is applied to our error measurement algorithm
|
// This is the error metric that is applied to our error measurement algorithm
|
||||||
// in order to bias calculation towards results that are more in-line with
|
// in order to bias calculation towards results that are more in-line with
|
||||||
// how the Human Visual System works. Uniform error means that each color
|
// how the Human Visual System works. Uniform error means that each color
|
||||||
|
@ -112,7 +112,7 @@ namespace BC7C {
|
||||||
void SetQualityLevel(int q);
|
void SetQualityLevel(int q);
|
||||||
int GetQualityLevel();
|
int GetQualityLevel();
|
||||||
|
|
||||||
// Compress the image given as RGBA data to BC7 format. Width and Height are
|
// Compress the image given as RGBA data to BPTC format. Width and Height are
|
||||||
// the dimensions of the image in pixels.
|
// the dimensions of the image in pixels.
|
||||||
void Compress(const FasTC::CompressionJob &);
|
void Compress(const FasTC::CompressionJob &);
|
||||||
|
|
||||||
|
@ -123,10 +123,10 @@ namespace BC7C {
|
||||||
void CompressWithStats(const FasTC::CompressionJob &, std::ostream *logStream);
|
void CompressWithStats(const FasTC::CompressionJob &, std::ostream *logStream);
|
||||||
|
|
||||||
#ifdef HAS_SSE_41
|
#ifdef HAS_SSE_41
|
||||||
// Compress the image given as RGBA data to BC7 format using an algorithm
|
// Compress the image given as RGBA data to BPTC format using an algorithm
|
||||||
// optimized for SIMD enabled platforms. Width and Height are the dimensions
|
// optimized for SIMD enabled platforms. Width and Height are the dimensions
|
||||||
// of the image in pixels.
|
// of the image in pixels.
|
||||||
void CompressImageBC7SIMD(const unsigned char* inBuf, unsigned char* outBuf,
|
void CompressImageBPTCSIMD(const unsigned char* inBuf, unsigned char* outBuf,
|
||||||
unsigned int width, unsigned int height);
|
unsigned int width, unsigned int height);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ namespace BC7C {
|
||||||
void CompressAtomic(FasTC::CompressionJobList &);
|
void CompressAtomic(FasTC::CompressionJobList &);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FOUND_NVTT_BC7_EXPORT
|
#ifdef FOUND_NVTT_BPTC_EXPORT
|
||||||
// These functions take the same arguments as Compress and CompressWithStats,
|
// These functions take the same arguments as Compress and CompressWithStats,
|
||||||
// but they use the NVTT compressor if it was supplied to CMake.
|
// but they use the NVTT compressor if it was supplied to CMake.
|
||||||
void CompressNVTT(const FasTC::CompressionJob &);
|
void CompressNVTT(const FasTC::CompressionJob &);
|
||||||
|
@ -146,9 +146,9 @@ namespace BC7C {
|
||||||
std::ostream *logStream);
|
std::ostream *logStream);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Decompress the image given as BC7 data to R8G8B8A8 format. Width and Height
|
// Decompress the image given as BPTC data to R8G8B8A8 format. Width and Height
|
||||||
// are the dimensions of the image in pixels.
|
// are the dimensions of the image in pixels.
|
||||||
void Decompress(const FasTC::DecompressionJob &);
|
void Decompress(const FasTC::DecompressionJob &);
|
||||||
} // namespace BC7C
|
} // namespace BPTCC
|
||||||
|
|
||||||
#endif // BPTCENCODER_INCLUDE_BC7COMPRESSOR_H_
|
#endif // BPTCENCODER_INCLUDE_BPTCCOMPRESSOR_H_
|
|
@ -1,5 +1,5 @@
|
||||||
/* FasTC
|
/* FasTC
|
||||||
* Copyright (c) 2012 University of North Carolina at Chapel Hill.
|
* Copyright (c) 2014 University of North Carolina at Chapel Hill.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software and its
|
* Permission to use, copy, modify, and distribute this software and its
|
||||||
|
@ -73,13 +73,16 @@
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifndef BPTCENCODER_SRC_BC7COMPRESSIONMODE_H_
|
#ifndef BPTCENCODER_SRC_BPTCCOMPRESSIONMODE_H_
|
||||||
#define BPTCENCODER_SRC_BC7COMPRESSIONMODE_H_
|
#define BPTCENCODER_SRC_BPTCCOMPRESSIONMODE_H_
|
||||||
|
|
||||||
#include "RGBAEndpoints.h"
|
#include "RGBAEndpoints.h"
|
||||||
|
|
||||||
// Forward Declarations
|
|
||||||
class BitStream;
|
class BitStream;
|
||||||
|
|
||||||
|
namespace BPTCC {
|
||||||
|
|
||||||
|
// Forward Declarations
|
||||||
struct VisitedState;
|
struct VisitedState;
|
||||||
const int kMaxEndpoints = 3;
|
const int kMaxEndpoints = 3;
|
||||||
|
|
||||||
|
@ -90,7 +93,7 @@ static const int kPBits[4][2] = {
|
||||||
{ 1, 1 }
|
{ 1, 1 }
|
||||||
};
|
};
|
||||||
|
|
||||||
class BC7CompressionMode {
|
class CompressionMode {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -100,13 +103,13 @@ class BC7CompressionMode {
|
||||||
// This initializes the compression variables used in order to compress a list
|
// This initializes the compression variables used in order to compress a list
|
||||||
// of clusters. We can increase the speed a tad by specifying whether or not
|
// of clusters. We can increase the speed a tad by specifying whether or not
|
||||||
// the block is opaque or not.
|
// the block is opaque or not.
|
||||||
explicit BC7CompressionMode(int mode, bool opaque = true)
|
explicit CompressionMode(int mode, bool opaque = true)
|
||||||
: m_IsOpaque(opaque)
|
: m_IsOpaque(opaque)
|
||||||
, m_Attributes(&(kModeAttributes[mode]))
|
, m_Attributes(&(kModeAttributes[mode]))
|
||||||
, m_RotateMode(0)
|
, m_RotateMode(0)
|
||||||
, m_IndexMode(0)
|
, m_IndexMode(0)
|
||||||
{ }
|
{ }
|
||||||
~BC7CompressionMode() { }
|
~CompressionMode() { }
|
||||||
|
|
||||||
// This function compresses a group of clusters into the passed bitstream. The
|
// This function compresses a group of clusters into the passed bitstream. The
|
||||||
// size of the clusters array is determined by the BC7 compression mode.
|
// size of the clusters array is determined by the BC7 compression mode.
|
||||||
|
@ -195,7 +198,7 @@ class BC7CompressionMode {
|
||||||
|
|
||||||
// This returns the proper error metric even if we have rotation bits set
|
// This returns the proper error metric even if we have rotation bits set
|
||||||
RGBAVector GetErrorMetric() const {
|
RGBAVector GetErrorMetric() const {
|
||||||
const float *w = BC7C::GetErrorMetric();
|
const float *w = BPTCC::GetErrorMetric();
|
||||||
switch(GetRotationMode()) {
|
switch(GetRotationMode()) {
|
||||||
default:
|
default:
|
||||||
case 0: return RGBAVector(w[0], w[1], w[2], w[3]);
|
case 0: return RGBAVector(w[0], w[1], w[2], w[3]);
|
||||||
|
@ -307,6 +310,7 @@ class BC7CompressionMode {
|
||||||
int &bestPBitCombo) const;
|
int &bestPBitCombo) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const uint32 kBC7InterpolationValues[4][16][2];
|
extern const uint32 kInterpolationValues[4][16][2];
|
||||||
|
|
||||||
#endif // BPTCENCODER_SRC_BC7COMPRESSIONMODE_H_
|
} // namespace BPTCC {
|
||||||
|
#endif // BPTCENCODER_SRC_BPTCCOMPRESSIONMODE_H_
|
File diff suppressed because it is too large
Load diff
|
@ -47,7 +47,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
const BC7ParallelStage stage;
|
const BPTCParallelStage stage;
|
||||||
|
|
||||||
// This is the stream of data that will be used to read the block data.
|
// This is the stream of data that will be used to read the block data.
|
||||||
const unsigned char *const m_InBuf;
|
const unsigned char *const m_InBuf;
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
uint32 m_NumBlocks;
|
uint32 m_NumBlocks;
|
||||||
*/
|
*/
|
||||||
ParallelStage::ParallelStage(
|
ParallelStage::ParallelStage(
|
||||||
BC7ParallelStage stage,
|
BPTCParallelStage stage,
|
||||||
const unsigned char *inbuf,
|
const unsigned char *inbuf,
|
||||||
unsigned char *outbuf,
|
unsigned char *outbuf,
|
||||||
uint32 numBlocks,
|
uint32 numBlocks,
|
||||||
|
|
|
@ -1,30 +1,39 @@
|
||||||
/* FasTC
|
/* FasTC
|
||||||
* Copyright (c) 2012 University of North Carolina at Chapel Hill. All rights reserved.
|
* Copyright (c) 2014 University of North Carolina at Chapel Hill.
|
||||||
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software and its documentation for educational,
|
* Permission to use, copy, modify, and distribute this software and its
|
||||||
* research, and non-profit purposes, without fee, and without a written agreement is hereby granted,
|
* documentation for educational, research, and non-profit purposes, without
|
||||||
* provided that the above copyright notice, this paragraph, and the following four paragraphs appear
|
* fee, and without a written agreement is hereby granted, provided that the
|
||||||
* in all copies.
|
* above copyright notice, this paragraph, and the following four paragraphs
|
||||||
|
* appear in all copies.
|
||||||
*
|
*
|
||||||
* Permission to incorporate this software into commercial products may be obtained by contacting the
|
* Permission to incorporate this software into commercial products may be
|
||||||
* authors or the Office of Technology Development at the University of North Carolina at Chapel Hill <otd@unc.edu>.
|
* obtained by contacting the authors or the Office of Technology Development
|
||||||
|
* at the University of North Carolina at Chapel Hill <otd@unc.edu>.
|
||||||
*
|
*
|
||||||
* This software program and documentation are copyrighted by the University of North Carolina at Chapel Hill.
|
* This software program and documentation are copyrighted by the University of
|
||||||
* The software program and documentation are supplied "as is," without any accompanying services from the
|
* North Carolina at Chapel Hill. The software program and documentation are
|
||||||
* University of North Carolina at Chapel Hill or the authors. The University of North Carolina at Chapel Hill
|
* supplied "as is," without any accompanying services from the University of
|
||||||
* and the authors do not warrant that the operation of the program will be uninterrupted or error-free. The
|
* North Carolina at Chapel Hill or the authors. The University of North
|
||||||
* end-user understands that the program was developed for research purposes and is advised not to rely
|
* Carolina at Chapel Hill and the authors do not warrant that the operation of
|
||||||
* exclusively on the program for any reason.
|
* the program will be uninterrupted or error-free. The end-user understands
|
||||||
|
* that the program was developed for research purposes and is advised not to
|
||||||
|
* rely exclusively on the program for any reason.
|
||||||
*
|
*
|
||||||
* IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE AUTHORS BE LIABLE TO ANY PARTY FOR
|
* IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE
|
||||||
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE
|
* AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL,
|
||||||
* USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE
|
* OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF
|
||||||
* AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF NORTH CAROLINA
|
||||||
|
* AT CHAPEL HILL OR THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
*
|
*
|
||||||
* THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
|
* THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS SPECIFICALLY
|
||||||
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY
|
* DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* STATUTORY WARRANTY OF NON-INFRINGEMENT. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY
|
||||||
* OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS HAVE NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
|
* STATUTORY WARRANTY OF NON-INFRINGEMENT. THE SOFTWARE PROVIDED HEREUNDER IS ON
|
||||||
|
* AN "AS IS" BASIS, AND THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND
|
||||||
|
* THE AUTHORS HAVE NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
|
||||||
* ENHANCEMENTS, OR MODIFICATIONS.
|
* ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
*
|
*
|
||||||
* Please send all BUG REPORTS to <pavel@cs.unc.edu>.
|
* Please send all BUG REPORTS to <pavel@cs.unc.edu>.
|
||||||
|
@ -37,13 +46,13 @@
|
||||||
* Frederick P. Brooks, Jr. Computer Science Bldg
|
* Frederick P. Brooks, Jr. Computer Science Bldg
|
||||||
* Chapel Hill, NC 27599-3175
|
* Chapel Hill, NC 27599-3175
|
||||||
* USA
|
* USA
|
||||||
*
|
*
|
||||||
* <http://gamma.cs.unc.edu/FasTC/>
|
* <http://gamma.cs.unc.edu/FasTC/>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "TexCompTypes.h"
|
#include "TexCompTypes.h"
|
||||||
|
|
||||||
enum BC7ParallelStage {
|
enum BPTCParallelStage {
|
||||||
eParallelStage_Uniform,
|
eParallelStage_Uniform,
|
||||||
eParallelStage_Partitioned,
|
eParallelStage_Partitioned,
|
||||||
eParallelStage_Normal,
|
eParallelStage_Normal,
|
||||||
|
@ -54,7 +63,7 @@ enum BC7ParallelStage {
|
||||||
class ParallelStage {
|
class ParallelStage {
|
||||||
public:
|
public:
|
||||||
ParallelStage(
|
ParallelStage(
|
||||||
BC7ParallelStage stage,
|
BPTCParallelStage stage,
|
||||||
const unsigned char *inbuf,
|
const unsigned char *inbuf,
|
||||||
unsigned char *outbuf,
|
unsigned char *outbuf,
|
||||||
uint32 numBlocks,
|
uint32 numBlocks,
|
||||||
|
@ -66,7 +75,7 @@ class ParallelStage {
|
||||||
|
|
||||||
~ParallelStage();
|
~ParallelStage();
|
||||||
|
|
||||||
const BC7ParallelStage m_Stage;
|
const BPTCParallelStage m_Stage;
|
||||||
|
|
||||||
// Adds the block number to the list of blocks for this parallel stage
|
// Adds the block number to the list of blocks for this parallel stage
|
||||||
void AddBlock(uint32 blockNum);
|
void AddBlock(uint32 blockNum);
|
||||||
|
|
|
@ -1,30 +1,39 @@
|
||||||
/* FasTC
|
/* FasTC
|
||||||
* Copyright (c) 2012 University of North Carolina at Chapel Hill. All rights reserved.
|
* Copyright (c) 2014 University of North Carolina at Chapel Hill.
|
||||||
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software and its documentation for educational,
|
* Permission to use, copy, modify, and distribute this software and its
|
||||||
* research, and non-profit purposes, without fee, and without a written agreement is hereby granted,
|
* documentation for educational, research, and non-profit purposes, without
|
||||||
* provided that the above copyright notice, this paragraph, and the following four paragraphs appear
|
* fee, and without a written agreement is hereby granted, provided that the
|
||||||
* in all copies.
|
* above copyright notice, this paragraph, and the following four paragraphs
|
||||||
|
* appear in all copies.
|
||||||
*
|
*
|
||||||
* Permission to incorporate this software into commercial products may be obtained by contacting the
|
* Permission to incorporate this software into commercial products may be
|
||||||
* authors or the Office of Technology Development at the University of North Carolina at Chapel Hill <otd@unc.edu>.
|
* obtained by contacting the authors or the Office of Technology Development
|
||||||
|
* at the University of North Carolina at Chapel Hill <otd@unc.edu>.
|
||||||
*
|
*
|
||||||
* This software program and documentation are copyrighted by the University of North Carolina at Chapel Hill.
|
* This software program and documentation are copyrighted by the University of
|
||||||
* The software program and documentation are supplied "as is," without any accompanying services from the
|
* North Carolina at Chapel Hill. The software program and documentation are
|
||||||
* University of North Carolina at Chapel Hill or the authors. The University of North Carolina at Chapel Hill
|
* supplied "as is," without any accompanying services from the University of
|
||||||
* and the authors do not warrant that the operation of the program will be uninterrupted or error-free. The
|
* North Carolina at Chapel Hill or the authors. The University of North
|
||||||
* end-user understands that the program was developed for research purposes and is advised not to rely
|
* Carolina at Chapel Hill and the authors do not warrant that the operation of
|
||||||
* exclusively on the program for any reason.
|
* the program will be uninterrupted or error-free. The end-user understands
|
||||||
|
* that the program was developed for research purposes and is advised not to
|
||||||
|
* rely exclusively on the program for any reason.
|
||||||
*
|
*
|
||||||
* IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE AUTHORS BE LIABLE TO ANY PARTY FOR
|
* IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE
|
||||||
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE
|
* AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL,
|
||||||
* USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE
|
* OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF
|
||||||
* AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF NORTH CAROLINA
|
||||||
|
* AT CHAPEL HILL OR THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
*
|
*
|
||||||
* THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
|
* THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS SPECIFICALLY
|
||||||
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY
|
* DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* STATUTORY WARRANTY OF NON-INFRINGEMENT. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY
|
||||||
* OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS HAVE NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
|
* STATUTORY WARRANTY OF NON-INFRINGEMENT. THE SOFTWARE PROVIDED HEREUNDER IS ON
|
||||||
|
* AN "AS IS" BASIS, AND THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND
|
||||||
|
* THE AUTHORS HAVE NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
|
||||||
* ENHANCEMENTS, OR MODIFICATIONS.
|
* ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
*
|
*
|
||||||
* Please send all BUG REPORTS to <pavel@cs.unc.edu>.
|
* Please send all BUG REPORTS to <pavel@cs.unc.edu>.
|
||||||
|
@ -46,27 +55,28 @@
|
||||||
//
|
//
|
||||||
// This code has been modified significantly from the original.
|
// This code has been modified significantly from the original.
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Copyright 2011 Intel Corporation
|
// Copyright 2011 Intel Corporation
|
||||||
// All Rights Reserved
|
// All Rights Reserved
|
||||||
//
|
//
|
||||||
// Permission is granted to use, copy, distribute and prepare derivative works of this
|
// Permission is granted to use, copy, distribute and prepare derivative works
|
||||||
// software for any purpose and without fee, provided, that the above copyright notice
|
// of this software for any purpose and without fee, provided, that the above
|
||||||
// and this statement appear in all copies. Intel makes no representations about the
|
// copyright notice and this statement appear in all copies. Intel makes no
|
||||||
// suitability of this software for any purpose. THIS SOFTWARE IS PROVIDED "AS IS."
|
// representations about the suitability of this software for any purpose. THIS
|
||||||
// INTEL SPECIFICALLY DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, AND ALL LIABILITY,
|
// SOFTWARE IS PROVIDED "AS IS." INTEL SPECIFICALLY DISCLAIMS ALL WARRANTIES,
|
||||||
// INCLUDING CONSEQUENTIAL AND OTHER INDIRECT DAMAGES, FOR THE USE OF THIS SOFTWARE,
|
// EXPRESS OR IMPLIED, AND ALL LIABILITY, INCLUDING CONSEQUENTIAL AND OTHER
|
||||||
// INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PROPRIETARY RIGHTS, AND INCLUDING THE
|
// INDIRECT DAMAGES, FOR THE USE OF THIS SOFTWARE, INCLUDING LIABILITY FOR
|
||||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Intel does not
|
// INFRINGEMENT OF ANY PROPRIETARY RIGHTS, AND INCLUDING THE WARRANTIES OF
|
||||||
// assume any responsibility for any errors which may appear in this software nor any
|
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Intel does not assume
|
||||||
|
// any responsibility for any errors which may appear in this software nor any
|
||||||
// responsibility to update it.
|
// responsibility to update it.
|
||||||
//
|
//
|
||||||
//--------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "BC7Config.h"
|
#include "BPTCConfig.h"
|
||||||
#include "RGBAEndpoints.h"
|
#include "RGBAEndpoints.h"
|
||||||
#include "BC7Compressor.h"
|
#include "BPTCCompressor.h"
|
||||||
#include "BC7CompressionMode.h"
|
#include "CompressionMode.h"
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
@ -406,7 +416,11 @@ uint32 RGBACluster::GetPowerMethodIterations() {
|
||||||
return m_PowerMethodIterations;
|
return m_PowerMethodIterations;
|
||||||
}
|
}
|
||||||
|
|
||||||
double RGBACluster::QuantizedError(const RGBAVector &p1, const RGBAVector &p2, uint8 nBuckets, uint32 bitMask, const RGBAVector &errorMetricVec, const int pbits[2], int *indices) const {
|
double RGBACluster::QuantizedError(
|
||||||
|
const RGBAVector &p1, const RGBAVector &p2,
|
||||||
|
uint8 nBuckets, uint32 bitMask, const RGBAVector &errorMetricVec,
|
||||||
|
const int pbits[2], int *indices
|
||||||
|
) const {
|
||||||
|
|
||||||
// nBuckets should be a power of two.
|
// nBuckets should be a power of two.
|
||||||
assert(nBuckets == 3 || !(nBuckets & (nBuckets - 1)));
|
assert(nBuckets == 3 || !(nBuckets & (nBuckets - 1)));
|
||||||
|
@ -415,7 +429,9 @@ double RGBACluster::QuantizedError(const RGBAVector &p1, const RGBAVector &p2, u
|
||||||
|
|
||||||
typedef uint32 tInterpPair[2];
|
typedef uint32 tInterpPair[2];
|
||||||
typedef tInterpPair tInterpLevel[16];
|
typedef tInterpPair tInterpLevel[16];
|
||||||
const tInterpLevel *interpVals = (nBuckets == 3)? kBC7InterpolationValues : kBC7InterpolationValues + (indexPrec - 1);
|
const tInterpLevel *interpVals =
|
||||||
|
(nBuckets == 3)? BPTCC::kInterpolationValues
|
||||||
|
: BPTCC::kInterpolationValues + (indexPrec - 1);
|
||||||
|
|
||||||
assert(indexPrec >= 2 && indexPrec <= 4);
|
assert(indexPrec >= 2 && indexPrec <= 4);
|
||||||
|
|
||||||
|
|
|
@ -1,30 +1,39 @@
|
||||||
/* FasTC
|
/* FasTC
|
||||||
* Copyright (c) 2012 University of North Carolina at Chapel Hill. All rights reserved.
|
* Copyright (c) 2014 University of North Carolina at Chapel Hill.
|
||||||
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software and its documentation for educational,
|
* Permission to use, copy, modify, and distribute this software and its
|
||||||
* research, and non-profit purposes, without fee, and without a written agreement is hereby granted,
|
* documentation for educational, research, and non-profit purposes, without
|
||||||
* provided that the above copyright notice, this paragraph, and the following four paragraphs appear
|
* fee, and without a written agreement is hereby granted, provided that the
|
||||||
* in all copies.
|
* above copyright notice, this paragraph, and the following four paragraphs
|
||||||
|
* appear in all copies.
|
||||||
*
|
*
|
||||||
* Permission to incorporate this software into commercial products may be obtained by contacting the
|
* Permission to incorporate this software into commercial products may be
|
||||||
* authors or the Office of Technology Development at the University of North Carolina at Chapel Hill <otd@unc.edu>.
|
* obtained by contacting the authors or the Office of Technology Development
|
||||||
|
* at the University of North Carolina at Chapel Hill <otd@unc.edu>.
|
||||||
*
|
*
|
||||||
* This software program and documentation are copyrighted by the University of North Carolina at Chapel Hill.
|
* This software program and documentation are copyrighted by the University of
|
||||||
* The software program and documentation are supplied "as is," without any accompanying services from the
|
* North Carolina at Chapel Hill. The software program and documentation are
|
||||||
* University of North Carolina at Chapel Hill or the authors. The University of North Carolina at Chapel Hill
|
* supplied "as is," without any accompanying services from the University of
|
||||||
* and the authors do not warrant that the operation of the program will be uninterrupted or error-free. The
|
* North Carolina at Chapel Hill or the authors. The University of North
|
||||||
* end-user understands that the program was developed for research purposes and is advised not to rely
|
* Carolina at Chapel Hill and the authors do not warrant that the operation of
|
||||||
* exclusively on the program for any reason.
|
* the program will be uninterrupted or error-free. The end-user understands
|
||||||
|
* that the program was developed for research purposes and is advised not to
|
||||||
|
* rely exclusively on the program for any reason.
|
||||||
*
|
*
|
||||||
* IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE AUTHORS BE LIABLE TO ANY PARTY FOR
|
* IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE
|
||||||
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE
|
* AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL,
|
||||||
* USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE
|
* OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF
|
||||||
* AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF NORTH CAROLINA
|
||||||
|
* AT CHAPEL HILL OR THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
*
|
*
|
||||||
* THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
|
* THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS SPECIFICALLY
|
||||||
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY
|
* DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* STATUTORY WARRANTY OF NON-INFRINGEMENT. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY
|
||||||
* OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS HAVE NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
|
* STATUTORY WARRANTY OF NON-INFRINGEMENT. THE SOFTWARE PROVIDED HEREUNDER IS ON
|
||||||
|
* AN "AS IS" BASIS, AND THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND
|
||||||
|
* THE AUTHORS HAVE NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
|
||||||
* ENHANCEMENTS, OR MODIFICATIONS.
|
* ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
*
|
*
|
||||||
* Please send all BUG REPORTS to <pavel@cs.unc.edu>.
|
* Please send all BUG REPORTS to <pavel@cs.unc.edu>.
|
||||||
|
@ -58,7 +67,7 @@ namespace FasTC {
|
||||||
|
|
||||||
// This structure defines a compression job. Here, width and height are the dimensions
|
// This structure defines a compression job. Here, width and height are the dimensions
|
||||||
// of the image in pixels. inBuf contains the R8G8B8A8 data that is to be compressed, and
|
// of the image in pixels. inBuf contains the R8G8B8A8 data that is to be compressed, and
|
||||||
// outBuf will contain the compressed BC7 data.
|
// outBuf will contain the compressed BPTC data.
|
||||||
//
|
//
|
||||||
// Implicit sizes:
|
// Implicit sizes:
|
||||||
// inBuf - (width * height * 4) bytes
|
// inBuf - (width * height * 4) bytes
|
||||||
|
@ -165,8 +174,8 @@ namespace FasTC {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// This struct mirrors that for a compression job, but is used to decompress a BC7 stream. Here, inBuf
|
// This struct mirrors that for a compression job, but is used to decompress a BPTC stream. Here, inBuf
|
||||||
// is a buffer of BC7 data, and outBuf is the destination where we will copy the decompressed R8G8B8A8 data
|
// is a buffer of BPTC data, and outBuf is the destination where we will copy the decompressed R8G8B8A8 data
|
||||||
class DecompressionJob {
|
class DecompressionJob {
|
||||||
private:
|
private:
|
||||||
const ECompressionFormat m_Format;
|
const ECompressionFormat m_Format;
|
||||||
|
|
|
@ -341,7 +341,7 @@ int main(int argc, char **argv) {
|
||||||
if(decompressedOutput[0] != '\0') {
|
if(decompressedOutput[0] != '\0') {
|
||||||
memcpy(basename, decompressedOutput, 256);
|
memcpy(basename, decompressedOutput, 256);
|
||||||
} else if(format == FasTC::eCompressionFormat_BPTC) {
|
} else if(format == FasTC::eCompressionFormat_BPTC) {
|
||||||
strcat(basename, "-bc7.png");
|
strcat(basename, "-bptc.png");
|
||||||
} else if(format == FasTC::eCompressionFormat_PVRTC) {
|
} else if(format == FasTC::eCompressionFormat_PVRTC) {
|
||||||
strcat(basename, "-pvrtc.png");
|
strcat(basename, "-pvrtc.png");
|
||||||
} else if(format == FasTC::eCompressionFormat_DXT1) {
|
} else if(format == FasTC::eCompressionFormat_DXT1) {
|
||||||
|
|
|
@ -1,30 +1,39 @@
|
||||||
# FasTC
|
# FasTC
|
||||||
# Copyright (c) 2012 University of North Carolina at Chapel Hill. All rights reserved.
|
# Copyright (c) 2014 University of North Carolina at Chapel Hill.
|
||||||
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Permission to use, copy, modify, and distribute this software and its documentation for educational,
|
# Permission to use, copy, modify, and distribute this software and its
|
||||||
# research, and non-profit purposes, without fee, and without a written agreement is hereby granted,
|
# documentation for educational, research, and non-profit purposes, without
|
||||||
# provided that the above copyright notice, this paragraph, and the following four paragraphs appear
|
# fee, and without a written agreement is hereby granted, provided that the
|
||||||
# in all copies.
|
# above copyright notice, this paragraph, and the following four paragraphs
|
||||||
|
# appear in all copies.
|
||||||
#
|
#
|
||||||
# Permission to incorporate this software into commercial products may be obtained by contacting the
|
# Permission to incorporate this software into commercial products may be
|
||||||
# authors or the Office of Technology Development at the University of North Carolina at Chapel Hill <otd@unc.edu>.
|
# obtained by contacting the authors or the Office of Technology Development
|
||||||
|
# at the University of North Carolina at Chapel Hill <otd@unc.edu>.
|
||||||
#
|
#
|
||||||
# This software program and documentation are copyrighted by the University of North Carolina at Chapel Hill.
|
# This software program and documentation are copyrighted by the University of
|
||||||
# The software program and documentation are supplied "as is," without any accompanying services from the
|
# North Carolina at Chapel Hill. The software program and documentation are
|
||||||
# University of North Carolina at Chapel Hill or the authors. The University of North Carolina at Chapel Hill
|
# supplied "as is," without any accompanying services from the University of
|
||||||
# and the authors do not warrant that the operation of the program will be uninterrupted or error-free. The
|
# North Carolina at Chapel Hill or the authors. The University of North
|
||||||
# end-user understands that the program was developed for research purposes and is advised not to rely
|
# Carolina at Chapel Hill and the authors do not warrant that the operation of
|
||||||
# exclusively on the program for any reason.
|
# the program will be uninterrupted or error-free. The end-user understands
|
||||||
|
# that the program was developed for research purposes and is advised not to
|
||||||
|
# rely exclusively on the program for any reason.
|
||||||
#
|
#
|
||||||
# IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE AUTHORS BE LIABLE TO ANY PARTY FOR
|
# IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE
|
||||||
# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE
|
# AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL,
|
||||||
# USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE
|
# OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF
|
||||||
# AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF NORTH CAROLINA
|
||||||
|
# AT CHAPEL HILL OR THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
# DAMAGE.
|
||||||
#
|
#
|
||||||
# THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
|
# THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS SPECIFICALLY
|
||||||
# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY
|
# DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
# STATUTORY WARRANTY OF NON-INFRINGEMENT. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY
|
||||||
# OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS HAVE NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
|
# STATUTORY WARRANTY OF NON-INFRINGEMENT. THE SOFTWARE PROVIDED HEREUNDER IS ON
|
||||||
|
# AN "AS IS" BASIS, AND THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND
|
||||||
|
# THE AUTHORS HAVE NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
|
||||||
# ENHANCEMENTS, OR MODIFICATIONS.
|
# ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
#
|
#
|
||||||
# Please send all BUG REPORTS to <pavel@cs.unc.edu>.
|
# Please send all BUG REPORTS to <pavel@cs.unc.edu>.
|
||||||
|
|
|
@ -1,30 +1,39 @@
|
||||||
/* FasTC
|
/* FasTC
|
||||||
* Copyright (c) 2012 University of North Carolina at Chapel Hill. All rights reserved.
|
* Copyright (c) 2014 University of North Carolina at Chapel Hill.
|
||||||
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software and its documentation for educational,
|
* Permission to use, copy, modify, and distribute this software and its
|
||||||
* research, and non-profit purposes, without fee, and without a written agreement is hereby granted,
|
* documentation for educational, research, and non-profit purposes, without
|
||||||
* provided that the above copyright notice, this paragraph, and the following four paragraphs appear
|
* fee, and without a written agreement is hereby granted, provided that the
|
||||||
* in all copies.
|
* above copyright notice, this paragraph, and the following four paragraphs
|
||||||
|
* appear in all copies.
|
||||||
*
|
*
|
||||||
* Permission to incorporate this software into commercial products may be obtained by contacting the
|
* Permission to incorporate this software into commercial products may be
|
||||||
* authors or the Office of Technology Development at the University of North Carolina at Chapel Hill <otd@unc.edu>.
|
* obtained by contacting the authors or the Office of Technology Development
|
||||||
|
* at the University of North Carolina at Chapel Hill <otd@unc.edu>.
|
||||||
*
|
*
|
||||||
* This software program and documentation are copyrighted by the University of North Carolina at Chapel Hill.
|
* This software program and documentation are copyrighted by the University of
|
||||||
* The software program and documentation are supplied "as is," without any accompanying services from the
|
* North Carolina at Chapel Hill. The software program and documentation are
|
||||||
* University of North Carolina at Chapel Hill or the authors. The University of North Carolina at Chapel Hill
|
* supplied "as is," without any accompanying services from the University of
|
||||||
* and the authors do not warrant that the operation of the program will be uninterrupted or error-free. The
|
* North Carolina at Chapel Hill or the authors. The University of North
|
||||||
* end-user understands that the program was developed for research purposes and is advised not to rely
|
* Carolina at Chapel Hill and the authors do not warrant that the operation of
|
||||||
* exclusively on the program for any reason.
|
* the program will be uninterrupted or error-free. The end-user understands
|
||||||
|
* that the program was developed for research purposes and is advised not to
|
||||||
|
* rely exclusively on the program for any reason.
|
||||||
*
|
*
|
||||||
* IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE AUTHORS BE LIABLE TO ANY PARTY FOR
|
* IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE
|
||||||
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE
|
* AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL,
|
||||||
* USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE
|
* OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF
|
||||||
* AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF NORTH CAROLINA
|
||||||
|
* AT CHAPEL HILL OR THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
*
|
*
|
||||||
* THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
|
* THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS SPECIFICALLY
|
||||||
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY
|
* DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* STATUTORY WARRANTY OF NON-INFRINGEMENT. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY
|
||||||
* OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS HAVE NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
|
* STATUTORY WARRANTY OF NON-INFRINGEMENT. THE SOFTWARE PROVIDED HEREUNDER IS ON
|
||||||
|
* AN "AS IS" BASIS, AND THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND
|
||||||
|
* THE AUTHORS HAVE NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
|
||||||
* ENHANCEMENTS, OR MODIFICATIONS.
|
* ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
*
|
*
|
||||||
* Please send all BUG REPORTS to <pavel@cs.unc.edu>.
|
* Please send all BUG REPORTS to <pavel@cs.unc.edu>.
|
||||||
|
@ -51,7 +60,7 @@
|
||||||
#include "Pixel.h"
|
#include "Pixel.h"
|
||||||
|
|
||||||
#include "TexCompTypes.h"
|
#include "TexCompTypes.h"
|
||||||
#include "BC7Compressor.h"
|
#include "BPTCCompressor.h"
|
||||||
#include "PVRTCCompressor.h"
|
#include "PVRTCCompressor.h"
|
||||||
#include "DXTCompressor.h"
|
#include "DXTCompressor.h"
|
||||||
#include "ETCCompressor.h"
|
#include "ETCCompressor.h"
|
||||||
|
@ -135,7 +144,7 @@ bool CompressedImage::DecompressImage(unsigned char *outBuf, unsigned int outBuf
|
||||||
|
|
||||||
case FasTC::eCompressionFormat_BPTC:
|
case FasTC::eCompressionFormat_BPTC:
|
||||||
{
|
{
|
||||||
BC7C::Decompress(dj);
|
BPTCC::Decompress(dj);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
|
|
||||||
#include "ETCCompressor.h"
|
#include "ETCCompressor.h"
|
||||||
#include "DXTCompressor.h"
|
#include "DXTCompressor.h"
|
||||||
#include "BC7Compressor.h"
|
#include "BPTCCompressor.h"
|
||||||
#include "CompressionFuncs.h"
|
#include "CompressionFuncs.h"
|
||||||
#include "Image.h"
|
#include "Image.h"
|
||||||
#include "ImageFile.h"
|
#include "ImageFile.h"
|
||||||
|
@ -104,12 +104,12 @@ static CompressionFuncWithStats ChooseFuncFromSettingsWithStats(const SCompress
|
||||||
|
|
||||||
case FasTC::eCompressionFormat_BPTC:
|
case FasTC::eCompressionFormat_BPTC:
|
||||||
{
|
{
|
||||||
#ifdef FOUND_NVTT_BC7_EXPORT
|
#ifdef FOUND_NVTT_BPTC_EXPORT
|
||||||
if(s.bUseNVTT)
|
if(s.bUseNVTT)
|
||||||
return BC7C::CompressNVTTWithStats;
|
return BPTCC::CompressNVTTWithStats;
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
return BC7C::CompressWithStats;
|
return BPTCC::CompressWithStats;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -135,19 +135,19 @@ static CompressionFunc ChooseFuncFromSettings(const SCompressionSettings &s) {
|
||||||
switch(s.format) {
|
switch(s.format) {
|
||||||
case FasTC::eCompressionFormat_BPTC:
|
case FasTC::eCompressionFormat_BPTC:
|
||||||
{
|
{
|
||||||
BC7C::SetQualityLevel(s.iQuality);
|
BPTCC::SetQualityLevel(s.iQuality);
|
||||||
#ifdef HAS_SSE_41
|
#ifdef HAS_SSE_41
|
||||||
if(s.bUseSIMD) {
|
if(s.bUseSIMD) {
|
||||||
return BC7C::CompressImageBC7SIMD;
|
return BPTCC::CompressImageBPTCSIMD;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FOUND_NVTT_BC7_EXPORT
|
#ifdef FOUND_NVTT_BPTC_EXPORT
|
||||||
if(s.bUseNVTT)
|
if(s.bUseNVTT)
|
||||||
return BC7C::CompressNVTT;
|
return BPTCC::CompressNVTT;
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
return BC7C::Compress;
|
return BPTCC::Compress;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -232,8 +232,8 @@ class AtomicThreadUnit : public TCCallable {
|
||||||
virtual ~AtomicThreadUnit() { }
|
virtual ~AtomicThreadUnit() { }
|
||||||
virtual void operator()() {
|
virtual void operator()() {
|
||||||
m_Barrier->Wait();
|
m_Barrier->Wait();
|
||||||
if(m_CmpFnc == BC7C::Compress) {
|
if(m_CmpFnc == BPTCC::Compress) {
|
||||||
BC7C::CompressAtomic(m_CompressionJobList);
|
BPTCC::CompressAtomic(m_CompressionJobList);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
assert(!"I don't know what we're compressing...");
|
assert(!"I don't know what we're compressing...");
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ThreadGroup.h"
|
#include "ThreadGroup.h"
|
||||||
#include "BC7Compressor.h"
|
#include "BPTCCompressor.h"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "BC7Compressor.h"
|
#include "BPTCCompressor.h"
|
||||||
|
|
||||||
using FasTC::CompressionJob;
|
using FasTC::CompressionJob;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue