Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9bc2ac3e27 | |||
| 1ff067147d | |||
| 0dfba013b1 |
@@ -1,2 +0,0 @@
|
||||
*.o
|
||||
crnlib/crunch
|
||||
@@ -1,17 +0,0 @@
|
||||
# Change Log
|
||||
|
||||
## [0.1.4] - 2012-11-24
|
||||
### Added
|
||||
* KTX file format
|
||||
* Basic ETC1 support
|
||||
* Simple makefile
|
||||
|
||||
### Fixed
|
||||
* Various DDS format fixes
|
||||
|
||||
## [0.1.3] - 2012-04-26
|
||||
### Added
|
||||
* Ported to Linux (tested on Ubuntu x86 w/Codeblocks). Note that a few features of the cmd line tool don't work yet (eg. -timestamp)
|
||||
|
||||
[0.1.4]: https://github.com/BinomialLLC/crunch
|
||||
[0.1.3]: https://github.com/BinomialLLC/crunch
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+10
-3
@@ -1,6 +1,8 @@
|
||||
COMPILE_OPTIONS = -O3 -fomit-frame-pointer -ffast-math -fno-math-errno -g -fno-strict-aliasing -Wall -Wno-unused-value -Wno-unused -march=core2
|
||||
COMPILE_OPTIONS = -O3 -fomit-frame-pointer -ffast-math -fno-math-errno -g -fPIC -fno-strict-aliasing -Wall -Wno-unused-value -Wno-unused -march=core2
|
||||
LINKER_OPTIONS = -lpthread -g
|
||||
|
||||
LIBCRUNCH = libcrunch.a
|
||||
|
||||
OBJECTS = \
|
||||
crn_arealist.o \
|
||||
crn_assert.o \
|
||||
@@ -82,6 +84,9 @@ all: crunch
|
||||
%.o: %.cpp
|
||||
g++ $< -o $@ -c $(COMPILE_OPTIONS)
|
||||
|
||||
$(LIBCRUNCH): $(OBJECTS)
|
||||
ar rcs $(LIBCRUNCH) $(OBJECTS)
|
||||
|
||||
crunch.o: ../crunch/crunch.cpp
|
||||
g++ $< -o $@ -c -I../inc -I../crnlib $(COMPILE_OPTIONS)
|
||||
|
||||
@@ -91,6 +96,8 @@ corpus_gen.o: ../crunch/corpus_gen.cpp
|
||||
corpus_test.o: ../crunch/corpus_test.cpp
|
||||
g++ $< -o $@ -c -I../inc -I../crnlib $(COMPILE_OPTIONS)
|
||||
|
||||
crunch: $(OBJECTS) crunch.o corpus_gen.o corpus_test.o
|
||||
g++ $(OBJECTS) crunch.o corpus_gen.o corpus_test.o -o crunch $(LINKER_OPTIONS)
|
||||
crunch: $(LIBCRUNCH) crunch.o corpus_gen.o corpus_test.o
|
||||
g++ crunch.o corpus_gen.o corpus_test.o -o crunch $(LIBCRUNCH) $(LINKER_OPTIONS)
|
||||
|
||||
clean:
|
||||
rm -rf $(LIBCRUNCH) crunch *.o
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_arealist.cpp - 2D shape algebra (currently unused)
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
// Ported from the PowerView DOS image viewer, a product I wrote back in 1993. Not currently used in the open source release of crnlib.
|
||||
#include "crn_core.h"
|
||||
#include "crn_arealist.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_arealist.h - 2D shape algebra
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
|
||||
namespace crnlib
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_assert.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
#if CRNLIB_USE_WIN32_API
|
||||
#include "crn_winhdr.h"
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// File: crn_assert.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
|
||||
const unsigned int CRNLIB_FAIL_EXCEPTION_CODE = 256U;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_buffer_stream.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "crn_data_stream.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_cfile_stream.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "crn_data_stream.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_clusterizer.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "crn_matrix.h"
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// File: crn_color.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "crn_core.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_colorized_console.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
#include "crn_colorized_console.h"
|
||||
#ifdef CRNLIB_USE_WIN32_API
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_colorized_console.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "crn_console.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_command_line_params.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
#include "crn_command_line_params.h"
|
||||
#include "crn_console.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_command_line_params.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "crn_value.h"
|
||||
#include <map>
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// File: crn_comp.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
#include "crn_console.h"
|
||||
#include "crn_comp.h"
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// File: crn_comp.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
|
||||
#define CRND_HEADER_FILE_ONLY
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_console.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
#include "crn_console.h"
|
||||
#include "crn_data_stream.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_console.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "crn_dynamic_string.h"
|
||||
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
// File: crn_core.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
|
||||
#if CRNLIB_USE_WIN32_API
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace crnlib
|
||||
{
|
||||
const char *g_copyright_str = "This is Public Domain Software, please see license.txt.";
|
||||
const char *g_copyright_str = "Copyright (c) 2010-2012 Rich Geldreich and Tenacious Software LLC";
|
||||
const char *g_sig_str = "C8cfRlaorj0wLtnMSxrBJxTC85rho2L9hUZKHcBL";
|
||||
|
||||
} // namespace crnlib
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// File: crn_core.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
|
||||
#if defined(WIN32) && defined(_MSC_VER)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_data_stream.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
#include "crn_data_stream.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_data_stream.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
|
||||
namespace crnlib
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: data_stream_serializer.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "crn_data_stream.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_dds_comp.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
#include "crn_dds_comp.h"
|
||||
#include "crn_dynamic_stream.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_comp.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "crn_comp.h"
|
||||
#include "crn_mipmapped_texture.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_decomp.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
|
||||
// Include the single-file header library with no defines, which brings in the full CRN decompressor.
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// File: crn_dxt.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
#include "crn_dxt.h"
|
||||
#include "crn_dxt1.h"
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// File: crn_dxt.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "../inc/crnlib.h"
|
||||
#include "crn_color.h"
|
||||
|
||||
+15
-15
@@ -1,5 +1,5 @@
|
||||
// File: crn_dxt1.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
//
|
||||
// Notes:
|
||||
// This class is not optimized for performance on small blocks, unlike typical DXT1 compressors. It's optimized for scalability and quality:
|
||||
@@ -112,9 +112,9 @@ namespace crnlib
|
||||
uint weight = m_unique_colors[i].m_weight;
|
||||
total_weight += weight;
|
||||
|
||||
tot_r += m_unique_colors[i].m_color.r * static_cast<uint64>(weight);
|
||||
tot_g += m_unique_colors[i].m_color.g * static_cast<uint64>(weight);
|
||||
tot_b += m_unique_colors[i].m_color.b * static_cast<uint64>(weight);
|
||||
tot_r += m_unique_colors[i].m_color.r * weight;
|
||||
tot_g += m_unique_colors[i].m_color.g * weight;
|
||||
tot_b += m_unique_colors[i].m_color.b * weight;
|
||||
}
|
||||
|
||||
const uint half_total_weight = total_weight >> 1;
|
||||
@@ -494,7 +494,7 @@ namespace crnlib
|
||||
ll[2] = (ll[0]*2+ll[1])/3;
|
||||
ll[3] = (ll[0]+ll[1]*2)/3;
|
||||
|
||||
uint64 error_to_beat = 0;
|
||||
uint error_to_beat = 0;
|
||||
uint min_color_weight = 0;
|
||||
uint max_color_weight = 0;
|
||||
for (uint i = 0; i < m_unique_colors.size(); i++)
|
||||
@@ -503,7 +503,7 @@ namespace crnlib
|
||||
uint w = m_unique_colors[i].m_weight;
|
||||
|
||||
int delta = ll[m_best_solution.m_selectors[i]] - c;
|
||||
error_to_beat += static_cast<int64>(w) * (delta * delta);
|
||||
error_to_beat += (int)w * (delta * delta);
|
||||
|
||||
if (c == min_color[comp_index])
|
||||
min_color_weight += w;
|
||||
@@ -561,11 +561,11 @@ namespace crnlib
|
||||
tl[2] = (tl[0]*2+tl[1])/3;
|
||||
tl[3] = (tl[0]+tl[1]*2)/3;
|
||||
|
||||
uint64 trial_error = 0;
|
||||
uint trial_error = 0;
|
||||
for (uint i = 0; i < m_unique_colors.size(); i++)
|
||||
{
|
||||
int delta = tl[m_best_solution.m_selectors[i]] - m_unique_colors[i].m_color[comp_index];
|
||||
trial_error += static_cast<int64>(m_unique_colors[i].m_weight) * (delta * delta);
|
||||
trial_error += m_unique_colors[i].m_weight * (delta * delta);
|
||||
if (trial_error >= error_to_beat)
|
||||
break;
|
||||
}
|
||||
@@ -599,7 +599,7 @@ namespace crnlib
|
||||
for (uint i = 0; i < m_unique_colors.size(); i++)
|
||||
{
|
||||
int delta = tl[m_best_solution.m_selectors[i]] - m_unique_colors[i].m_color[comp_index];
|
||||
error_to_beat += static_cast<int64>(m_unique_colors[i].m_weight) * (delta * delta);
|
||||
error_to_beat += m_unique_colors[i].m_weight * (delta * delta);
|
||||
}
|
||||
|
||||
} // better
|
||||
@@ -1582,7 +1582,7 @@ namespace crnlib
|
||||
err = color_distance(true, c, colors[3], false);
|
||||
if (err < best_error) { best_error = err; best_color_index = 3; }
|
||||
|
||||
trial_error += best_error * static_cast<uint64>(m_unique_colors[unique_color_index].m_weight);
|
||||
trial_error += best_error * m_unique_colors[unique_color_index].m_weight;
|
||||
if (trial_error >= solution.m_error)
|
||||
break;
|
||||
|
||||
@@ -1607,7 +1607,7 @@ namespace crnlib
|
||||
err = color_distance(false, c, colors[3], false);
|
||||
if (err < best_error) { best_error = err; best_color_index = 3; }
|
||||
|
||||
trial_error += best_error * static_cast<uint64>(m_unique_colors[unique_color_index].m_weight);
|
||||
trial_error += best_error * m_unique_colors[unique_color_index].m_weight;
|
||||
if (trial_error >= solution.m_error)
|
||||
break;
|
||||
|
||||
@@ -1634,7 +1634,7 @@ namespace crnlib
|
||||
err = color_distance(true, c, colors[2], false);
|
||||
if (err < best_error) { best_error = err; best_color_index = 2; }
|
||||
|
||||
trial_error += best_error * static_cast<uint64>(m_unique_colors[unique_color_index].m_weight);
|
||||
trial_error += best_error * m_unique_colors[unique_color_index].m_weight;
|
||||
if (trial_error >= solution.m_error)
|
||||
break;
|
||||
|
||||
@@ -1656,7 +1656,7 @@ namespace crnlib
|
||||
err = color_distance(false, c, colors[2], false);
|
||||
if (err < best_error) { best_error = err; best_color_index = 2; }
|
||||
|
||||
trial_error += best_error * static_cast<uint64>(m_unique_colors[unique_color_index].m_weight);
|
||||
trial_error += best_error * m_unique_colors[unique_color_index].m_weight;
|
||||
if (trial_error >= solution.m_error)
|
||||
break;
|
||||
|
||||
@@ -1781,7 +1781,7 @@ namespace crnlib
|
||||
|
||||
uint best_error = color_distance(m_perceptual, c, colors[best_color_index], false);
|
||||
|
||||
trial_error += best_error * static_cast<uint64>(m_unique_colors[unique_color_index].m_weight);
|
||||
trial_error += best_error * m_unique_colors[unique_color_index].m_weight;
|
||||
if (trial_error >= solution.m_error)
|
||||
break;
|
||||
|
||||
@@ -1814,7 +1814,7 @@ namespace crnlib
|
||||
|
||||
uint best_error = color_distance(m_perceptual, c, colors[best_color_index], false);
|
||||
|
||||
trial_error += best_error * static_cast<uint64>(m_unique_colors[unique_color_index].m_weight);
|
||||
trial_error += best_error * m_unique_colors[unique_color_index].m_weight;
|
||||
if (trial_error >= solution.m_error)
|
||||
break;
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// File: crn_dxt1.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "crn_dxt.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_dxt5a.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
#include "crn_dxt5a.h"
|
||||
#include "crn_ryg_dxt.hpp"
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// File: crn_dxt5a.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "crn_dxt.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_dxt_endpoint_refiner.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
#include "crn_dxt_endpoint_refiner.h"
|
||||
#include "crn_dxt1.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_dxt_endpoint_refiner.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "crn_dxt.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_dxt_fast.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
// Parts of this module are derived from RYG's excellent public domain DXTx compressor.
|
||||
#include "crn_core.h"
|
||||
#include "crn_dxt_fast.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_dxt_fast.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "crn_color.h"
|
||||
#include "crn_dxt.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_dxt_hc.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
#include "crn_dxt_hc.h"
|
||||
#include "crn_image_utils.h"
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// File: crn_dxt_hc.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "crn_dxt1.h"
|
||||
#include "crn_dxt5a.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_dxt_hc_common.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
#include "crn_dxt_hc_common.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_dxt_hc_common.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
|
||||
namespace crnlib
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_dxt_image.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
#include "crn_dxt_image.h"
|
||||
#if CRNLIB_SUPPORT_SQUISH
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_dxt_image.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "crn_dxt1.h"
|
||||
#include "crn_dxt5a.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_dynamic_stream.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "crn_data_stream.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_dynamic_string.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
#include "crn_strutils.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_dynamic_string.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
|
||||
namespace crnlib
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// File: crn_etc.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
#include "crn_etc.h"
|
||||
#include "crn_radix_sort.h"
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// File: crn_etc.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "../inc/crnlib.h"
|
||||
#include "crn_dxt.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_file_utils.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
#include "crn_file_utils.h"
|
||||
#include "crn_strutils.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_file_utils.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
|
||||
namespace crnlib
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_win32_find_files.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
#include "crn_find_files.h"
|
||||
#include "crn_file_utils.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_win32_find_files.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
|
||||
namespace crnlib
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_freeimage_image_utils.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
// Note: This header file requires FreeImage/FreeImagePlus.
|
||||
|
||||
#include "crn_image_utils.h"
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// File: crn_hash.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
|
||||
namespace crnlib
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_hash_map.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
#include "crn_hash_map.h"
|
||||
#include "crn_rand.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_hash_map.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
//
|
||||
// Notes:
|
||||
// stl-like hash map/hash set, with predictable performance across platforms/compilers/C run times/etc.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_helpers.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
|
||||
#define CRNLIB_NO_COPY_OR_ASSIGNMENT_OP(c) c(const c&); c& operator= (const c&);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_huffman_codes.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
#include "crn_huffman_codes.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_huffman_codes.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
|
||||
namespace crnlib
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// File: crn_image.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "crn_color.h"
|
||||
#include "crn_vec.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_image_utils.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
#include "crn_image_utils.h"
|
||||
#include "crn_console.h"
|
||||
@@ -1305,7 +1305,7 @@ namespace crnlib
|
||||
*pActualComps = 0;
|
||||
|
||||
if ((req_comps < 1) || (req_comps > 4))
|
||||
return NULL;
|
||||
return false;
|
||||
|
||||
mipmapped_texture tex;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_image_utils.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "crn_image.h"
|
||||
#include "crn_data_stream_serializer.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_intersect.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "crn_ray.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_lzma_codec.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
#include "crn_lzma_codec.h"
|
||||
#include "crn_strutils.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_lzma_codec.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "crn_packed_uint.h"
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// File: crn_math.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
|
||||
namespace crnlib
|
||||
|
||||
+11
-2
@@ -1,5 +1,5 @@
|
||||
// File: crn_math.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
|
||||
#if defined(_M_IX86) && defined(_MSC_VER)
|
||||
@@ -56,7 +56,12 @@ namespace crnlib
|
||||
|
||||
template<typename T> inline T square(T value) { return value * value; }
|
||||
|
||||
#ifdef __GNUC__
|
||||
#if CRNLIB_64BIT_POINTERS==0
|
||||
inline bool is_power_of_2(uint32 x) { return x && ((x & (x - 1U)) == 0U); }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
inline bool is_power_of_2(uint64 x) { return x && ((x & (x - 1U)) == 0U); }
|
||||
|
||||
template<typename T> inline T align_up_value(T x, uint alignment)
|
||||
@@ -79,7 +84,9 @@ namespace crnlib
|
||||
{
|
||||
return align_up_value(x, alignment) - x;
|
||||
}
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#if CRNLIB_64BIT_POINTERS==0
|
||||
// From "Hackers Delight"
|
||||
inline uint32 next_pow2(uint32 val)
|
||||
{
|
||||
@@ -91,6 +98,8 @@ namespace crnlib
|
||||
val |= val >> 1;
|
||||
return val + 1;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
inline uint64 next_pow2(uint64 val)
|
||||
{
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// File: crn_matrix.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
|
||||
#include "crn_vec.h"
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// File: crn_mem.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
#include "crn_console.h"
|
||||
#include "../inc/crnlib.h"
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// File: crn_mem.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
|
||||
#ifndef CRNLIB_MIN_ALLOC_ALIGNMENT
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_dds_texture.cpp - Actually supports both .DDS and .KTX. Probably will rename this eventually.
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
#include "crn_mipmapped_texture.h"
|
||||
#include "crn_cfile_stream.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_mipmapped_texture.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "crn_dxt_image.h"
|
||||
#include "../inc/dds_defs.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_packed_uint
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
|
||||
namespace crnlib
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_pixel_format.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
#include "crn_pixel_format.h"
|
||||
#include "crn_image.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_pixel_format.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "crn_dxt.h"
|
||||
#include "../inc/crnlib.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_platform.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
|
||||
#if CRNLIB_USE_WIN32_API
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_platform.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
|
||||
bool crnlib_is_debugger_present(void);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_prefix_coding.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
#include "crn_prefix_coding.h"
|
||||
//#include "rand.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_prefix_coding.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
|
||||
namespace crnlib
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_qdxt.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
#include "crn_qdxt1.h"
|
||||
#include "crn_dxt1.h"
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// File: crn_qdxt1.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "crn_dxt.h"
|
||||
#include "crn_hash_map.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_qdxt5.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
#include "crn_qdxt5.h"
|
||||
#include "crn_dxt5a.h"
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// File: crn_qdxt5.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "crn_hash_map.h"
|
||||
#include "crn_clusterizer.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_radix_sort.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
|
||||
namespace crnlib
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// File: crn_rand.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
// See:
|
||||
// http://www.ciphersbyritter.com/NEWS4/RANDC.HTM
|
||||
// http://burtleburtle.net/bob/rand/smallprng.html
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// File: crn_rand.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
|
||||
namespace crnlib
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// File: crn_ray.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "crn_vec.h"
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// File: crn_rect.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "crn_vec.h"
|
||||
#include "crn_hash.h"
|
||||
|
||||
+27
-1
@@ -1,5 +1,5 @@
|
||||
// File: rg_etc1.h - Fast, high quality ETC1 block packer/unpacker - Rich Geldreich <richgel99@gmail.com>
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// Please see ZLIB license at the end of this file.
|
||||
#pragma once
|
||||
|
||||
namespace crnlib {
|
||||
@@ -52,3 +52,29 @@ namespace rg_etc1
|
||||
|
||||
} // namespace crnlib
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// rg_etc1 uses the ZLIB license:
|
||||
// http://opensource.org/licenses/Zlib
|
||||
//
|
||||
// Copyright (c) 2012 Rich Geldreich
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_sparse_array.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
|
||||
namespace crnlib
|
||||
@@ -355,7 +355,7 @@ namespace crnlib
|
||||
|
||||
inline T* alloc_group(bool nofail = false)
|
||||
{
|
||||
T* p = static_cast<T*>(sparse_array_traits<T, Log2N>::alloc_space(N * sizeof(T)));
|
||||
T* p = static_cast<T*>(alloc_space(N * sizeof(T)));
|
||||
|
||||
if (!p)
|
||||
{
|
||||
@@ -365,7 +365,7 @@ namespace crnlib
|
||||
CRNLIB_FAIL("Out of memory");
|
||||
}
|
||||
|
||||
sparse_array_traits<T, Log2N>::construct_group(p);
|
||||
construct_group(p);
|
||||
|
||||
m_num_active_groups++;
|
||||
|
||||
@@ -379,20 +379,20 @@ namespace crnlib
|
||||
CRNLIB_ASSERT(m_num_active_groups);
|
||||
m_num_active_groups--;
|
||||
|
||||
sparse_array_traits<T, Log2N>::destruct_group(p);
|
||||
destruct_group(p);
|
||||
|
||||
sparse_array_traits<T, Log2N>::free_space(p);
|
||||
free_space(p);
|
||||
}
|
||||
}
|
||||
|
||||
inline void init_default()
|
||||
{
|
||||
sparse_array_traits<T, Log2N>::construct_element(reinterpret_cast<T*>(m_default));
|
||||
construct_element(reinterpret_cast<T*>(m_default));
|
||||
}
|
||||
|
||||
inline void deinit_default()
|
||||
{
|
||||
sparse_array_traits<T, Log2N>::destruct_element(reinterpret_cast<T*>(m_default));
|
||||
destruct_element(reinterpret_cast<T*>(m_default));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_sparse_bit_array.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
#include "crn_sparse_bit_array.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_sparse_bit_array.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
|
||||
namespace crnlib
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_strutils.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
#include "crn_strutils.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_strutils.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_symbol_codec.cpp
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#include "crn_core.h"
|
||||
#include "crn_symbol_codec.h"
|
||||
#include "crn_huffman_codes.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// File: crn_symbol_codec.h
|
||||
// This software is in the public domain. Please see license.txt.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "crn_prefix_coding.h"
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user