if ENABLE_LIB
lib_LTLIBRARIES = libtxc_dxtn.la
libtxc_dxtn_la_SOURCES = s2tc_algorithm.cpp s2tc_libtxc_dxtn.cpp s2tc_common.h s2tc_algorithm.h txc_dxtn.h s2tc_license.h
-libtxc_dxtn_la_LDFLAGS = -versioninfo 0:0:0
+libtxc_dxtn_la_LDFLAGS = -versioninfo 0:0:0 -nodefaultlibs
libtxc_dxtn_la_LIBADD = -lm
libtxc_dxtn_la_CFLAGS = -fvisibility=hidden -Wold-style-definition -Wstrict-prototypes -Wsign-compare -Wdeclaration-after-statement
library_includedir = $(includedir)
have_CXXFLAGS=${CXXFLAGS+set}
AC_PROG_CXX
+AM_PROG_AR
# better default optimization flags for g++, please
if test "$have_CXXFLAGS" != set; then
if test "$GXX" = yes; then
AC_PROG_LIBTOOL
+# Disable dependency on libstdc++ for the .so library.
+postdeps_CXX=`echo " $postdeps_CXX " | sed 's, -lstdc++ , ,g'`
+
AC_ARG_ENABLE(runtime-linking, AS_HELP_STRING([--disable-runtime-linking], [Do not load the library at runtime (faster startup, more dependencies)]), [enable_runtime_linking=$enableval], [enable_runtime_linking=yes])
AC_ARG_ENABLE(tools, AS_HELP_STRING([--disable-tools], [Do not build the s2tc_compress and s2_decompress tools]), [enable_tools=$enableval], [enable_tools=yes])
AC_ARG_ENABLE(lib, AS_HELP_STRING([--disable-lib], [Do not build the included libtxc_dxtn library for S2TC]), [enable_lib=$enableval], [enable_lib=yes])
#include <string.h>
#include <stdio.h>
#include <stdint.h>
-#include <algorithm>
-#include <iostream>
#include "s2tc_algorithm.h"
#include "s2tc_common.h"
namespace
{
+ template<class T> void swap(T& a, T& b)
+ {
+ T h = a;
+ a = b;
+ b = h;
+ }
template<class T> struct color_type_info
{
};
}
};
- std::ostream &operator<<(std::ostream &ost, const color_t &c)
- {
- return ost << "make_color_t(" << int(c.r) << ", " << int(c.g) << ", " << int(c.b) << ")";
- }
-
- std::ostream &operator<<(std::ostream &ost, const bigcolor_t &c)
- {
- return ost << "bigcolor_t(" << c.r << ", " << c.g << ", " << c.b << ")";
- }
-
// 16 differences must fit in int
// i.e. a difference must be lower than 2^27
if(a1 < a0)
{
- std::swap(a0, a1);
+ swap(a0, a1);
for(int i = 0; i < 16; ++i) switch(out.get(i))
{
case 0:
if(a1 < a0)
{
- std::swap(a0, a1);
+ swap(a0, a1);
for(int i = 0; i < 16; ++i) switch(out.get(i))
{
case 0:
inline void s2tc_dxt5_encode_alpha_refine_never(bitarray<uint64_t, 16, 3> &out, const unsigned char *in, int iw, int w, int h, unsigned char &a0, unsigned char &a1)
{
if(a1 < a0)
- std::swap(a0, a1);
+ swap(a0, a1);
unsigned char ramp[6] = {
a0,
a1
if(have_trans ? c1 < c0 : c0 < c1)
{
- std::swap(c0, c1);
+ swap(c0, c1);
for(int i = 0; i < 16; ++i)
if(!(out.get(i) & 2))
out.do_xor(i, 1);
if(have_trans ? c1 < c0 : c0 < c1)
{
- std::swap(c0, c1);
+ swap(c0, c1);
for(int i = 0; i < 16; ++i)
if(!(out.get(i) & 2))
out.do_xor(i, 1);
inline void s2tc_dxt1_encode_color_refine_never(bitarray<uint32_t, 16, 2> &out, const unsigned char *in, int iw, int w, int h, color_t &c0, color_t &c1)
{
if(have_trans ? c1 < c0 : c0 < c1)
- std::swap(c0, c1);
+ swap(c0, c1);
color_t ramp[2] = {
c0,
c1