Adding Crunch at r319.
This commit is contained in:
357
third_party/crunch/crunch/corpus_gen.cpp
vendored
Normal file
357
third_party/crunch/crunch/corpus_gen.cpp
vendored
Normal file
@@ -0,0 +1,357 @@
|
||||
// File: corpus_gen.cpp - Block compression corpus generator.
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
//
|
||||
// Example command line:
|
||||
// -gentest [-deep] [-blockpercentage .035] [-width 4096] [-height 4096] -in c:\temp\*.jpg [-in c:\temp\*.jpeg] [-in @blah.txt]
|
||||
#include "crn_core.h"
|
||||
#include "corpus_gen.h"
|
||||
#include "crn_console.h"
|
||||
|
||||
#include "crn_find_files.h"
|
||||
#include "crn_file_utils.h"
|
||||
#include "crn_command_line_params.h"
|
||||
|
||||
#include "crn_dxt.h"
|
||||
#include "crn_cfile_stream.h"
|
||||
#include "crn_texture_conversion.h"
|
||||
#include "crn_radix_sort.h"
|
||||
|
||||
#define CRND_HEADER_FILE_ONLY
|
||||
#include "crn_decomp.h"
|
||||
|
||||
namespace crnlib
|
||||
{
|
||||
struct block
|
||||
{
|
||||
color_quad_u8 m_c[4*4];
|
||||
|
||||
inline operator size_t() const { return fast_hash(this, sizeof(*this)); }
|
||||
|
||||
inline bool operator== (const block& rhs) const
|
||||
{
|
||||
return memcmp(this, &rhs, sizeof(*this)) == 0;
|
||||
}
|
||||
};
|
||||
|
||||
typedef crnlib::hash_map<block, empty_type> block_hash_map;
|
||||
|
||||
corpus_gen::corpus_gen()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
void corpus_gen::sort_blocks(image_u8& img)
|
||||
{
|
||||
const uint num_blocks_x = img.get_width() / 4;
|
||||
const uint num_blocks_y = img.get_height() / 4;
|
||||
const uint total_blocks = num_blocks_x * num_blocks_y;
|
||||
|
||||
console::printf("Sorting %u blocks...", total_blocks);
|
||||
|
||||
crnlib::vector<float> block_std_dev(total_blocks);
|
||||
|
||||
for (uint by = 0; by < num_blocks_y; by++)
|
||||
{
|
||||
for (uint bx = 0; bx < num_blocks_x; bx++)
|
||||
{
|
||||
color_quad_u8 c[4 * 4];
|
||||
|
||||
for (uint y = 0; y < 4; y++)
|
||||
for (uint x = 0; x < 4; x++)
|
||||
c[x+y*4] = img(bx*4+x, by*4+y);
|
||||
|
||||
double std_dev = 0.0f;
|
||||
for (uint i = 0; i < 3; i++)
|
||||
std_dev += image_utils::compute_std_dev(16, c, i, 1);
|
||||
|
||||
block_std_dev[bx + by * num_blocks_x] = (float)std_dev;
|
||||
}
|
||||
}
|
||||
|
||||
crnlib::vector<uint> block_indices0(total_blocks);
|
||||
crnlib::vector<uint> block_indices1(total_blocks);
|
||||
|
||||
const uint* pIndices = indirect_radix_sort(total_blocks, &block_indices0[0], &block_indices1[0], &block_std_dev[0], 0, sizeof(float), true);
|
||||
|
||||
image_u8 new_img(img.get_width(), img.get_height());
|
||||
|
||||
uint dst_block_index = 0;
|
||||
|
||||
//float prev_std_dev = -999;
|
||||
for (uint i = 0; i < total_blocks; i++)
|
||||
{
|
||||
uint src_block_index = pIndices[i];
|
||||
|
||||
//float std_dev = block_std_dev[src_block_index];
|
||||
//crnlib_ASSERT(std_dev >= prev_std_dev);
|
||||
//prev_std_dev = std_dev;
|
||||
|
||||
uint src_block_x = src_block_index % num_blocks_x;
|
||||
uint src_block_y = src_block_index / num_blocks_x;
|
||||
|
||||
uint dst_block_x = dst_block_index % num_blocks_x;
|
||||
uint dst_block_y = dst_block_index / num_blocks_x;
|
||||
|
||||
new_img.unclipped_blit(src_block_x * 4, src_block_y * 4, 4, 4, dst_block_x * 4, dst_block_y * 4, img);
|
||||
|
||||
dst_block_index++;
|
||||
}
|
||||
|
||||
#if 0
|
||||
//new_img.swap(img);
|
||||
#else
|
||||
crnlib::vector<uint> remaining_blocks(num_blocks_x);
|
||||
|
||||
console::printf("Arranging %u blocks...", total_blocks);
|
||||
|
||||
for (uint by = 0; by < num_blocks_y; by++)
|
||||
{
|
||||
console::printf("%u of %u", by, num_blocks_y);
|
||||
|
||||
remaining_blocks.resize(num_blocks_x);
|
||||
for (uint i = 0; i < num_blocks_x; i++)
|
||||
remaining_blocks[i] = i;
|
||||
|
||||
color_quad_u8 match_block[16];
|
||||
utils::zero_object(match_block);
|
||||
for (uint bx = 0; bx < num_blocks_x; bx++)
|
||||
{
|
||||
uint best_index = 0;
|
||||
|
||||
uint64 best_error = cUINT64_MAX;
|
||||
|
||||
for (uint i = 0; i < remaining_blocks.size(); i++)
|
||||
{
|
||||
uint src_block_index = remaining_blocks[i];
|
||||
|
||||
uint64 error = 0;
|
||||
for (uint y = 0; y < 4; y++)
|
||||
{
|
||||
for (uint x = 0; x < 4; x++)
|
||||
{
|
||||
const color_quad_u8& c = new_img(src_block_index*4+x, by*4+y);
|
||||
error += color::elucidian_distance(c, match_block[x+y*4], false);
|
||||
}
|
||||
}
|
||||
|
||||
if (error < best_error)
|
||||
{
|
||||
best_error = error;
|
||||
best_index = i;
|
||||
}
|
||||
}
|
||||
|
||||
uint src_block_index = remaining_blocks[best_index];
|
||||
|
||||
for (uint y = 0; y < 4; y++)
|
||||
{
|
||||
for (uint x = 0; x < 4; x++)
|
||||
{
|
||||
const color_quad_u8& c = new_img(src_block_index*4+x, by*4+y);
|
||||
match_block[x+y*4] = c;
|
||||
|
||||
img(bx * 4 + x, by * 4 + y) = c;
|
||||
}
|
||||
}
|
||||
|
||||
remaining_blocks.erase_unordered(best_index);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool corpus_gen::generate(const char* pCmd_line)
|
||||
{
|
||||
static const command_line_params::param_desc param_desc_array[] =
|
||||
{
|
||||
{ "corpus_gen", 0, false },
|
||||
{ "in", 1, true },
|
||||
{ "deep", 0, false },
|
||||
{ "blockpercentage", 1, false },
|
||||
{ "width", 1, false },
|
||||
{ "height", 1, false },
|
||||
{ "alpha", 0, false },
|
||||
};
|
||||
|
||||
command_line_params params;
|
||||
if (!params.parse(pCmd_line, CRNLIB_ARRAY_SIZE(param_desc_array), param_desc_array, true))
|
||||
return false;
|
||||
|
||||
if (!params.has_key("in"))
|
||||
{
|
||||
console::error("Must specify one or more input files using the /in option!");
|
||||
return false;
|
||||
}
|
||||
|
||||
uint num_dst_blocks_x = params.get_value_as_int("width", 0, 4096, 128, 4096);
|
||||
num_dst_blocks_x = (num_dst_blocks_x + 3) / 4;
|
||||
uint num_dst_blocks_y = params.get_value_as_int("height", 0, 4096, 128, 4096);
|
||||
num_dst_blocks_y = (num_dst_blocks_y + 3) / 4;
|
||||
|
||||
const uint total_dst_blocks = num_dst_blocks_x * num_dst_blocks_y;
|
||||
image_u8 dst_img(num_dst_blocks_x * 4, num_dst_blocks_y * 4);
|
||||
uint next_dst_block = 0;
|
||||
uint total_dst_images = 0;
|
||||
|
||||
random rm;
|
||||
|
||||
block_hash_map block_hash;
|
||||
block_hash.reserve(total_dst_blocks);
|
||||
|
||||
uint total_images_loaded = 0;
|
||||
uint total_blocks_written = 0;
|
||||
|
||||
command_line_params::param_map_const_iterator it = params.begin();
|
||||
for ( ; it != params.end(); ++it)
|
||||
{
|
||||
if (it->first != "in")
|
||||
continue;
|
||||
if (it->second.m_values.empty())
|
||||
{
|
||||
console::error("Must follow /in parameter with a filename!\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
for (uint in_value_index = 0; in_value_index < it->second.m_values.size(); in_value_index++)
|
||||
{
|
||||
const dynamic_string& filespec = it->second.m_values[in_value_index];
|
||||
|
||||
find_files file_finder;
|
||||
if (!file_finder.find(filespec.get_ptr(), find_files::cFlagAllowFiles | (params.has_key("deep") ? find_files::cFlagRecursive : 0)))
|
||||
{
|
||||
console::warning("Failed finding files: %s", filespec.get_ptr());
|
||||
continue;
|
||||
}
|
||||
|
||||
if (file_finder.get_files().empty())
|
||||
{
|
||||
console::warning("No files found: %s", filespec.get_ptr());
|
||||
return false;
|
||||
}
|
||||
|
||||
const find_files::file_desc_vec& files = file_finder.get_files();
|
||||
|
||||
for (uint file_index = 0; file_index < files.size(); file_index++)
|
||||
{
|
||||
const find_files::file_desc& file_desc = files[file_index];
|
||||
|
||||
console::printf("Loading image: %s", file_desc.m_fullname.get_ptr());
|
||||
|
||||
image_u8 img;
|
||||
if (!image_utils::read_from_file(img, file_desc.m_fullname.get_ptr(), 0))
|
||||
{
|
||||
console::warning("Failed loading image file: %s", file_desc.m_fullname.get_ptr());
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!params.has_key("alpha"))
|
||||
{
|
||||
for (uint y = 0; y < img.get_height(); y++)
|
||||
for (uint x = 0; x < img.get_width(); x++)
|
||||
img(x, y).a = 255;
|
||||
}
|
||||
|
||||
total_images_loaded++;
|
||||
|
||||
uint width = img.get_width();
|
||||
uint height = img.get_height();
|
||||
|
||||
uint num_blocks_x = (width + 3) / 4;
|
||||
uint num_blocks_y = (height + 3) / 4;
|
||||
uint total_blocks = num_blocks_x * num_blocks_y;
|
||||
|
||||
float percentage = params.get_value_as_float("blockpercentage", 0, .1f, .001f, 1.0f);
|
||||
uint total_rand_blocks = math::maximum<uint>(1U, (uint)(total_blocks * percentage));
|
||||
|
||||
crnlib::vector<uint> remaining_blocks(total_blocks);
|
||||
for (uint i = 0; i < total_blocks; i++)
|
||||
remaining_blocks[i] = i;
|
||||
|
||||
uint num_blocks_remaining = total_rand_blocks;
|
||||
while (num_blocks_remaining)
|
||||
{
|
||||
if (remaining_blocks.empty())
|
||||
break;
|
||||
|
||||
uint rand_block_index = rm.irand(0, remaining_blocks.size());
|
||||
uint block_index = remaining_blocks[rand_block_index];
|
||||
remaining_blocks.erase_unordered(rand_block_index);
|
||||
|
||||
uint block_y = block_index / num_blocks_x;
|
||||
uint block_x = block_index % num_blocks_x;
|
||||
|
||||
block b;
|
||||
|
||||
for (uint y = 0; y < 4; y++)
|
||||
{
|
||||
for (uint x = 0; x < 4; x++)
|
||||
{
|
||||
b.m_c[x+y*4] = img.get_clamped(block_x*4+x, block_y*4+y);
|
||||
}
|
||||
}
|
||||
|
||||
if (!block_hash.insert(b).second)
|
||||
continue;
|
||||
if (block_hash.size() == total_dst_blocks)
|
||||
{
|
||||
block_hash.clear();
|
||||
block_hash.reserve(total_dst_blocks);
|
||||
}
|
||||
|
||||
uint dst_block_x = next_dst_block % num_dst_blocks_x;
|
||||
uint dst_block_y = next_dst_block / num_dst_blocks_x;
|
||||
for (uint y = 0; y < 4; y++)
|
||||
{
|
||||
for (uint x = 0; x < 4; x++)
|
||||
{
|
||||
dst_img(dst_block_x * 4 + x, dst_block_y * 4 + y) = b.m_c[x + y*4];
|
||||
}
|
||||
}
|
||||
|
||||
next_dst_block++;
|
||||
if (total_dst_blocks == next_dst_block)
|
||||
{
|
||||
sort_blocks(dst_img);
|
||||
|
||||
dynamic_string dst_filename(cVarArg, "test_%u.tga", total_dst_images);
|
||||
console::printf("Writing image: %s", dst_filename.get_ptr());
|
||||
image_utils::write_to_file(dst_filename.get_ptr(), dst_img, 0);
|
||||
|
||||
dst_img.set_all(color_quad_u8::make_black());
|
||||
|
||||
next_dst_block = 0;
|
||||
|
||||
total_dst_images++;
|
||||
}
|
||||
|
||||
total_blocks_written++;
|
||||
|
||||
num_blocks_remaining--;
|
||||
}
|
||||
|
||||
} // file_index
|
||||
|
||||
} // in_value_index
|
||||
|
||||
}
|
||||
|
||||
if (next_dst_block)
|
||||
{
|
||||
sort_blocks(dst_img);
|
||||
|
||||
dynamic_string dst_filename(cVarArg, "test_%u.tga", total_dst_images);
|
||||
console::printf("Writing image: %s", dst_filename.get_ptr());
|
||||
image_utils::write_to_file(dst_filename.get_ptr(), dst_img, 0);
|
||||
|
||||
next_dst_block = 0;
|
||||
|
||||
total_dst_images++;
|
||||
}
|
||||
|
||||
console::printf("Found %u input images, %u output images, %u total blocks", total_images_loaded, total_dst_images, total_blocks_written);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace crnlib
|
||||
20
third_party/crunch/crunch/corpus_gen.h
vendored
Normal file
20
third_party/crunch/crunch/corpus_gen.h
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
// File: corpus_gen.h
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "crn_command_line_params.h"
|
||||
#include "crn_image.h"
|
||||
|
||||
namespace crnlib
|
||||
{
|
||||
class corpus_gen
|
||||
{
|
||||
public:
|
||||
corpus_gen();
|
||||
|
||||
bool generate(const char* pCmd_line);
|
||||
|
||||
private:
|
||||
void sort_blocks(image_u8& img);
|
||||
};
|
||||
|
||||
} // namespace crnlib
|
||||
404
third_party/crunch/crunch/corpus_test.cpp
vendored
Normal file
404
third_party/crunch/crunch/corpus_test.cpp
vendored
Normal file
@@ -0,0 +1,404 @@
|
||||
// File: corpus_test.cpp
|
||||
#include "crn_core.h"
|
||||
#include "corpus_test.h"
|
||||
#include "crn_find_files.h"
|
||||
#include "crn_console.h"
|
||||
#include "crn_image_utils.h"
|
||||
#include "crn_hash.h"
|
||||
#include "crn_hash_map.h"
|
||||
#include "crn_radix_sort.h"
|
||||
#include "crn_mipmapped_texture.h"
|
||||
|
||||
namespace crnlib
|
||||
{
|
||||
corpus_tester::corpus_tester()
|
||||
{
|
||||
m_bad_block_img.resize(256, 256);
|
||||
m_next_bad_block_index = 0;
|
||||
m_total_bad_block_files = 0;
|
||||
}
|
||||
|
||||
void corpus_tester::print_comparative_metric_stats(const command_line_params& cmd_line_params, const crnlib::vector<image_utils::error_metrics>& stats1, const crnlib::vector<image_utils::error_metrics>& stats2, uint num_blocks_x, uint num_blocks_y)
|
||||
{
|
||||
num_blocks_y;
|
||||
|
||||
crnlib::vector<uint> better_blocks;
|
||||
crnlib::vector<uint> equal_blocks;
|
||||
crnlib::vector<uint> worse_blocks;
|
||||
crnlib::vector<float> delta_psnr;
|
||||
|
||||
for (uint i = 0; i < stats1.size(); i++)
|
||||
{
|
||||
//uint bx = i % num_blocks_x;
|
||||
//uint by = i / num_blocks_x;
|
||||
|
||||
const image_utils::error_metrics& em1 = stats1[i];
|
||||
const image_utils::error_metrics& em2 = stats2[i];
|
||||
|
||||
if (em1.mPeakSNR < em2.mPeakSNR)
|
||||
{
|
||||
worse_blocks.push_back(i);
|
||||
delta_psnr.push_back((float)(em2.mPeakSNR - em1.mPeakSNR));
|
||||
}
|
||||
else if (fabs(em1.mPeakSNR - em2.mPeakSNR) < .001f)
|
||||
equal_blocks.push_back(i);
|
||||
else
|
||||
better_blocks.push_back(i);
|
||||
}
|
||||
|
||||
console::printf("Num worse blocks: %u, %3.3f%%", worse_blocks.size(), worse_blocks.size() * 100.0f / stats1.size());
|
||||
console::printf("Num equal blocks: %u, %3.3f%%", equal_blocks.size(), equal_blocks.size() * 100.0f / stats1.size());
|
||||
console::printf("Num better blocks: %u, %3.3f%%", better_blocks.size(), better_blocks.size() * 100.0f / stats1.size());
|
||||
console::printf("Num equal+better blocks: %u, %3.3f%%", equal_blocks.size()+better_blocks.size(), (equal_blocks.size()+better_blocks.size()) * 100.0f / stats1.size());
|
||||
|
||||
if (!cmd_line_params.has_key("nobadblocks"))
|
||||
{
|
||||
crnlib::vector<uint> indices[2];
|
||||
indices[0].resize(worse_blocks.size());
|
||||
indices[1].resize(worse_blocks.size());
|
||||
|
||||
uint* pSorted_indices = NULL;
|
||||
if (worse_blocks.size())
|
||||
{
|
||||
pSorted_indices = indirect_radix_sort(worse_blocks.size(), &indices[0][0], &indices[1][0], &delta_psnr[0], 0, sizeof(float), true);
|
||||
|
||||
console::printf("List of worse blocks sorted by delta PSNR:");
|
||||
for (uint i = 0; i < worse_blocks.size(); i++)
|
||||
{
|
||||
uint block_index = worse_blocks[pSorted_indices[i]];
|
||||
uint bx = block_index % num_blocks_x;
|
||||
uint by = block_index / num_blocks_x;
|
||||
|
||||
console::printf("%u. [%u,%u] %3.3f %3.3f %3.3f",
|
||||
i,
|
||||
bx, by,
|
||||
stats1[block_index].mPeakSNR,
|
||||
stats2[block_index].mPeakSNR,
|
||||
stats2[block_index].mPeakSNR - stats1[block_index].mPeakSNR);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void corpus_tester::print_metric_stats(const crnlib::vector<image_utils::error_metrics>& stats, uint num_blocks_x, uint num_blocks_y)
|
||||
{
|
||||
num_blocks_y;
|
||||
|
||||
image_utils::error_metrics best_metrics;
|
||||
image_utils::error_metrics worst_metrics;
|
||||
worst_metrics.mPeakSNR = 1e+6f;
|
||||
|
||||
vec2I best_loc;
|
||||
vec2I worst_loc;
|
||||
utils::zero_object(best_loc);
|
||||
utils::zero_object(worst_loc);
|
||||
|
||||
double psnr_total = 0.0f;
|
||||
double psnr2_total = 0.0f;
|
||||
uint num_non_inf = 0;
|
||||
uint num_inf = 0;
|
||||
|
||||
for (uint i = 0; i < stats.size(); i++)
|
||||
{
|
||||
uint bx = i % num_blocks_x;
|
||||
uint by = i / num_blocks_x;
|
||||
|
||||
const image_utils::error_metrics& em = stats[i];
|
||||
|
||||
if ((em.mPeakSNR < 200.0f) && (em > best_metrics)) { best_metrics = em; best_loc.set(bx, by); }
|
||||
if (em < worst_metrics) { worst_metrics = em; worst_loc.set(bx, by); }
|
||||
|
||||
if (em.mPeakSNR < 200.0f)
|
||||
{
|
||||
psnr_total += em.mPeakSNR;
|
||||
psnr2_total += em.mPeakSNR*em.mPeakSNR;
|
||||
num_non_inf++;
|
||||
}
|
||||
else
|
||||
{
|
||||
num_inf++;
|
||||
}
|
||||
}
|
||||
|
||||
console::printf("Number of infinite PSNR blocks: %u", num_inf);
|
||||
console::printf("Number of non-infinite PSNR blocks: %u", num_non_inf);
|
||||
if (num_non_inf)
|
||||
{
|
||||
psnr_total /= num_non_inf;
|
||||
psnr2_total /= num_non_inf;
|
||||
|
||||
double psnr_std_dev = sqrt(psnr2_total - psnr_total * psnr_total);
|
||||
|
||||
console::printf("Average Non-Inf PSNR: %3.3f, Std dev: %3.3f", psnr_total, psnr_std_dev);
|
||||
console::printf("Worst PSNR: %3.3f, Block Location: %i,%i", worst_metrics.mPeakSNR, worst_loc[0], worst_loc[1]);
|
||||
console::printf("Best Non-Inf PSNR: %3.3f, Block Location: %i,%i", best_metrics.mPeakSNR, best_loc[0], best_loc[1]);
|
||||
}
|
||||
}
|
||||
|
||||
void corpus_tester::flush_bad_blocks()
|
||||
{
|
||||
if (!m_next_bad_block_index)
|
||||
return;
|
||||
|
||||
dynamic_string filename(cVarArg, "badblocks_%u.tga", m_total_bad_block_files);
|
||||
console::printf("Writing bad block image: %s", filename.get_ptr());
|
||||
image_utils::write_to_file(filename.get_ptr(), m_bad_block_img, image_utils::cWriteFlagIgnoreAlpha);
|
||||
|
||||
m_bad_block_img.set_all(color_quad_u8::make_black());
|
||||
|
||||
m_total_bad_block_files++;
|
||||
|
||||
m_next_bad_block_index = 0;
|
||||
}
|
||||
|
||||
void corpus_tester::add_bad_block(image_u8& block)
|
||||
{
|
||||
uint num_blocks_x = m_bad_block_img.get_block_width(4);
|
||||
uint num_blocks_y = m_bad_block_img.get_block_height(4);
|
||||
uint total_blocks = num_blocks_x * num_blocks_y;
|
||||
|
||||
m_bad_block_img.blit((m_next_bad_block_index % num_blocks_x) * 4, (m_next_bad_block_index / num_blocks_x) * 4, block);
|
||||
m_next_bad_block_index++;
|
||||
|
||||
if (m_next_bad_block_index == total_blocks)
|
||||
flush_bad_blocks();
|
||||
}
|
||||
|
||||
static bool progress_callback(uint percentage_complete, void* pUser_data_ptr)
|
||||
{
|
||||
static int s_prev_percentage_complete = -1;
|
||||
pUser_data_ptr;
|
||||
if (s_prev_percentage_complete != static_cast<int>(percentage_complete))
|
||||
{
|
||||
console::progress("%u%%", percentage_complete);
|
||||
s_prev_percentage_complete = percentage_complete;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool corpus_tester::test(const char* pCmd_line)
|
||||
{
|
||||
console::printf("Command line:\n\"%s\"", pCmd_line);
|
||||
|
||||
static const command_line_params::param_desc param_desc_array[] =
|
||||
{
|
||||
{ "corpus_test", 0, false },
|
||||
{ "in", 1, true },
|
||||
{ "deep", 0, false },
|
||||
{ "alpha", 0, false },
|
||||
{ "nomips", 0, false },
|
||||
{ "perceptual", 0, false },
|
||||
{ "endpointcaching", 0, false },
|
||||
{ "multithreaded", 0, false },
|
||||
{ "writehybrid", 0, false },
|
||||
{ "nobadblocks", 0, false },
|
||||
};
|
||||
|
||||
command_line_params cmd_line_params;
|
||||
if (!cmd_line_params.parse(pCmd_line, CRNLIB_ARRAY_SIZE(param_desc_array), param_desc_array, true))
|
||||
return false;
|
||||
|
||||
double total_time1 = 0, total_time2 = 0;
|
||||
|
||||
command_line_params::param_map_const_iterator it = cmd_line_params.begin();
|
||||
for ( ; it != cmd_line_params.end(); ++it)
|
||||
{
|
||||
if (it->first != "in")
|
||||
continue;
|
||||
if (it->second.m_values.empty())
|
||||
{
|
||||
console::error("Must follow /in parameter with a filename!\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
for (uint in_value_index = 0; in_value_index < it->second.m_values.size(); in_value_index++)
|
||||
{
|
||||
const dynamic_string& filespec = it->second.m_values[in_value_index];
|
||||
|
||||
find_files file_finder;
|
||||
if (!file_finder.find(filespec.get_ptr(), find_files::cFlagAllowFiles | (cmd_line_params.has_key("deep") ? find_files::cFlagRecursive : 0)))
|
||||
{
|
||||
console::warning("Failed finding files: %s", filespec.get_ptr());
|
||||
continue;
|
||||
}
|
||||
|
||||
if (file_finder.get_files().empty())
|
||||
{
|
||||
console::warning("No files found: %s", filespec.get_ptr());
|
||||
return false;
|
||||
}
|
||||
|
||||
const find_files::file_desc_vec& files = file_finder.get_files();
|
||||
|
||||
image_u8 o(4, 4), a(4, 4), b(4, 4);
|
||||
|
||||
uint first_channel = 0;
|
||||
uint num_channels = 3;
|
||||
bool perceptual = cmd_line_params.get_value_as_bool("perceptual", false);
|
||||
if (perceptual)
|
||||
{
|
||||
first_channel = 0;
|
||||
num_channels = 0;
|
||||
}
|
||||
console::printf("Perceptual mode: %u", perceptual);
|
||||
|
||||
for (uint file_index = 0; file_index < files.size(); file_index++)
|
||||
{
|
||||
const find_files::file_desc& file_desc = files[file_index];
|
||||
|
||||
console::printf("-------- Loading image: %s", file_desc.m_fullname.get_ptr());
|
||||
|
||||
image_u8 img;
|
||||
if (!image_utils::read_from_file(img, file_desc.m_fullname.get_ptr(), 0))
|
||||
{
|
||||
console::warning("Failed loading image file: %s", file_desc.m_fullname.get_ptr());
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((!cmd_line_params.has_key("alpha")) && img.is_component_valid(3))
|
||||
{
|
||||
for (uint y = 0; y < img.get_height(); y++)
|
||||
for (uint x = 0; x < img.get_width(); x++)
|
||||
img(x, y).a = 255;
|
||||
|
||||
img.set_component_valid(3, false);
|
||||
}
|
||||
|
||||
mipmapped_texture orig_tex;
|
||||
orig_tex.assign(crnlib_new<image_u8>(img));
|
||||
|
||||
if (!cmd_line_params.has_key("nomips"))
|
||||
{
|
||||
mipmapped_texture::generate_mipmap_params genmip_params;
|
||||
genmip_params.m_srgb = true;
|
||||
|
||||
console::printf("Generating mipmaps");
|
||||
|
||||
if (!orig_tex.generate_mipmaps(genmip_params, false))
|
||||
{
|
||||
console::error("Mipmap generation failed!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
console::printf("Compress 1");
|
||||
|
||||
mipmapped_texture tex1(orig_tex);
|
||||
dxt_image::pack_params convert_params;
|
||||
convert_params.m_endpoint_caching = cmd_line_params.get_value_as_bool("endpointcaching", 0, false);
|
||||
convert_params.m_compressor = cCRNDXTCompressorCRN;
|
||||
convert_params.m_quality = cCRNDXTQualityNormal;
|
||||
convert_params.m_perceptual = perceptual;
|
||||
convert_params.m_num_helper_threads = cmd_line_params.get_value_as_bool("multithreaded", 0, true) ? (g_number_of_processors - 1) : 0;
|
||||
convert_params.m_pProgress_callback = progress_callback;
|
||||
timer t;
|
||||
t.start();
|
||||
if (!tex1.convert(PIXEL_FMT_ETC1, false, convert_params))
|
||||
{
|
||||
console::error("Texture conversion failed!");
|
||||
return false;
|
||||
}
|
||||
double time1 = t.get_elapsed_secs();
|
||||
total_time1 += time1;
|
||||
console::printf("Elapsed time: %3.3f", time1);
|
||||
|
||||
console::printf("Compress 2");
|
||||
|
||||
mipmapped_texture tex2(orig_tex);
|
||||
convert_params.m_endpoint_caching = false;
|
||||
convert_params.m_compressor = cCRNDXTCompressorCRN;
|
||||
convert_params.m_quality = cCRNDXTQualitySuperFast;
|
||||
t.start();
|
||||
if (!tex2.convert(PIXEL_FMT_ETC1, false, convert_params))
|
||||
{
|
||||
console::error("Texture conversion failed!");
|
||||
return false;
|
||||
}
|
||||
double time2 = t.get_elapsed_secs();
|
||||
total_time2 += time2;
|
||||
console::printf("Elapsed time: %3.3f", time2);
|
||||
|
||||
image_u8 hybrid_img(img.get_width(), img.get_height());
|
||||
|
||||
for (uint l = 0; l < orig_tex.get_num_levels(); l++)
|
||||
{
|
||||
image_u8 orig_img, img1, img2;
|
||||
|
||||
image_u8* pOrig = orig_tex.get_level(0, l)->get_unpacked_image(orig_img, cUnpackFlagUncook | cUnpackFlagUnflip);
|
||||
image_u8* pImg1 = tex1.get_level(0, l)->get_unpacked_image(img1, cUnpackFlagUncook | cUnpackFlagUnflip);
|
||||
image_u8* pImg2 = tex2.get_level(0, l)->get_unpacked_image(img2, cUnpackFlagUncook | cUnpackFlagUnflip);
|
||||
|
||||
const uint num_blocks_x = pOrig->get_block_width(4);
|
||||
const uint num_blocks_y = pOrig->get_block_height(4);
|
||||
|
||||
crnlib::vector<image_utils::error_metrics> metrics[2];
|
||||
|
||||
for (uint by = 0; by < num_blocks_y; by++)
|
||||
{
|
||||
for (uint bx = 0; bx < num_blocks_x; bx++)
|
||||
{
|
||||
pOrig->extract_block(o.get_ptr(), bx * 4, by * 4, 4, 4);
|
||||
pImg1->extract_block(a.get_ptr(), bx * 4, by * 4, 4, 4);
|
||||
pImg2->extract_block(b.get_ptr(), bx * 4, by * 4, 4, 4);
|
||||
|
||||
image_utils::error_metrics em1;
|
||||
em1.compute(o, a, first_channel, num_channels);
|
||||
|
||||
image_utils::error_metrics em2;
|
||||
em2.compute(o, b, first_channel, num_channels);
|
||||
|
||||
metrics[0].push_back(em1);
|
||||
metrics[1].push_back(em2);
|
||||
|
||||
if (em1.mPeakSNR < em2.mPeakSNR)
|
||||
{
|
||||
add_bad_block(o);
|
||||
|
||||
hybrid_img.blit(bx * 4, by * 4, b);
|
||||
}
|
||||
else
|
||||
{
|
||||
hybrid_img.blit(bx * 4, by * 4, a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cmd_line_params.has_key("writehybrid"))
|
||||
image_utils::write_to_file("hybrid.tga", hybrid_img, image_utils::cWriteFlagIgnoreAlpha);
|
||||
|
||||
console::printf("---- Mip level: %u, Total blocks: %ux%u, %u", l, num_blocks_x, num_blocks_y, num_blocks_x * num_blocks_y);
|
||||
|
||||
console::printf("Compressor 1:");
|
||||
print_metric_stats(metrics[0], num_blocks_x, num_blocks_y);
|
||||
|
||||
console::printf("Compressor 2:");
|
||||
print_metric_stats(metrics[1], num_blocks_x, num_blocks_y);
|
||||
|
||||
console::printf("Compressor 1 vs. 2:");
|
||||
print_comparative_metric_stats(cmd_line_params, metrics[0], metrics[1], num_blocks_x, num_blocks_y);
|
||||
|
||||
image_utils::error_metrics em;
|
||||
|
||||
em.compute(*pOrig, *pImg1, 0, perceptual ? 0 : 3);
|
||||
em.print("Compressor 1: ");
|
||||
|
||||
em.compute(*pOrig, *pImg2, 0, perceptual ? 0 : 3);
|
||||
em.print("Compressor 2: ");
|
||||
|
||||
em.compute(*pOrig, hybrid_img, 0, perceptual ? 0 : 3);
|
||||
em.print("Best of Both: ");
|
||||
}
|
||||
}
|
||||
|
||||
} // file_index
|
||||
}
|
||||
|
||||
flush_bad_blocks();
|
||||
|
||||
console::printf("Total times: %4.3f vs. %4.3f", total_time1, total_time2);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace crnlib
|
||||
|
||||
28
third_party/crunch/crunch/corpus_test.h
vendored
Normal file
28
third_party/crunch/crunch/corpus_test.h
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
// File: corpus_test.h
|
||||
// See Copyright Notice and license at the end of inc/crnlib.h
|
||||
#pragma once
|
||||
#include "crn_command_line_params.h"
|
||||
#include "crn_image_utils.h"
|
||||
|
||||
namespace crnlib
|
||||
{
|
||||
class corpus_tester
|
||||
{
|
||||
public:
|
||||
corpus_tester();
|
||||
|
||||
bool test(const char* pCmd_line);
|
||||
|
||||
private:
|
||||
void print_comparative_metric_stats(const command_line_params& params, const crnlib::vector<image_utils::error_metrics>& stats1, const crnlib::vector<image_utils::error_metrics>& stats2, uint num_blocks_x, uint num_blocks_y);
|
||||
void print_metric_stats(const crnlib::vector<image_utils::error_metrics>& stats, uint num_blocks_x, uint num_blocks_y);
|
||||
|
||||
image_u8 m_bad_block_img;
|
||||
uint m_next_bad_block_index;
|
||||
uint m_total_bad_block_files;
|
||||
|
||||
void flush_bad_blocks();
|
||||
void add_bad_block(image_u8& block);
|
||||
};
|
||||
|
||||
} // namespace crnlib
|
||||
389
third_party/crunch/crunch/crunch.2008.vcproj
vendored
Normal file
389
third_party/crunch/crunch/crunch.2008.vcproj
vendored
Normal file
@@ -0,0 +1,389 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="crunch"
|
||||
ProjectGUID="{8F645BA1-B996-49EB-859B-970A671DE05D}"
|
||||
RootNamespace="comp"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="..\bin"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\crnlib;..\inc"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="false"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\$(ProjectName)D.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="..\bin"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\crnlib;..\inc"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="false"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\$(ProjectName)D_x64.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(TargetDir)$(TargetName).pdb"
|
||||
SubSystem="1"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="..\bin"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
InlineFunctionExpansion="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories="..\crnlib;..\inc"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="..\bin"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
InlineFunctionExpansion="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories="..\crnlib;..\inc"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
FloatingPointModel="2"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\$(ProjectName)_x64.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(TargetDir)$(TargetName).pdb"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\corpus_gen.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\corpus_gen.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\corpus_test.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\corpus_test.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\crunch.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
58
third_party/crunch/crunch/crunch.cbp
vendored
Normal file
58
third_party/crunch/crunch/crunch.cbp
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="6" />
|
||||
<Project>
|
||||
<Option title="crunch" />
|
||||
<Option pch_mode="2" />
|
||||
<Option compiler="gcc" />
|
||||
<Build>
|
||||
<Target title="Debug">
|
||||
<Option output="..\bin_mingw\crunchD" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj\Debug\" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-g" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add library="..\crnlib\libcrnlibD.a" />
|
||||
</Linker>
|
||||
</Target>
|
||||
<Target title="Release">
|
||||
<Option output="..\bin_mingw\crunch" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj\Release\" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-march=core2" />
|
||||
<Add option="-fomit-frame-pointer" />
|
||||
<Add option="-fexpensive-optimizations" />
|
||||
<Add option="-O3" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-s" />
|
||||
<Add library="..\crnlib\libcrnlib.a" />
|
||||
</Linker>
|
||||
</Target>
|
||||
</Build>
|
||||
<Compiler>
|
||||
<Add option="-Wextra" />
|
||||
<Add option="-Wall" />
|
||||
<Add option="-fexceptions" />
|
||||
<Add option="-Wno-unused-value" />
|
||||
<Add option="-Wno-unused" />
|
||||
<Add option="-fno-strict-aliasing" />
|
||||
<Add directory="..\inc" />
|
||||
<Add directory="..\crnlib" />
|
||||
</Compiler>
|
||||
<Unit filename="corpus_gen.cpp" />
|
||||
<Unit filename="corpus_gen.h" />
|
||||
<Unit filename="corpus_test.cpp" />
|
||||
<Unit filename="corpus_test.h" />
|
||||
<Unit filename="crunch.cpp" />
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
<debugger />
|
||||
</Extensions>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
||||
1352
third_party/crunch/crunch/crunch.cpp
vendored
Normal file
1352
third_party/crunch/crunch/crunch.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
83
third_party/crunch/crunch/crunch_linux.cbp
vendored
Normal file
83
third_party/crunch/crunch/crunch_linux.cbp
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="6" />
|
||||
<Project>
|
||||
<Option title="crunch" />
|
||||
<Option pch_mode="2" />
|
||||
<Option compiler="gcc" />
|
||||
<Build>
|
||||
<Target title="Debug">
|
||||
<Option output="../bin_linux/crunchD" prefix_auto="1" extension_auto="1" />
|
||||
<Option working_dir="/home/richg/crunch_work/bin_linux" />
|
||||
<Option object_output="obj/Debug/" />
|
||||
<Option external_deps="../crnlib/libcrnlibD.a;" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Option parameters="-file orig/*.png -fileformat crn -bitrate 1.33 " />
|
||||
<Compiler>
|
||||
<Add option="-Wextra" />
|
||||
<Add option="-Wall" />
|
||||
<Add option="-D_DEBUG" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add library="../crnlib/libcrnlibD.a" />
|
||||
<Add library="pthread" />
|
||||
</Linker>
|
||||
</Target>
|
||||
<Target title="Release">
|
||||
<Option output="../bin_linux/crunch" prefix_auto="1" extension_auto="1" />
|
||||
<Option working_dir="/home/richg/crunch_work/bin_linux" />
|
||||
<Option object_output="obj/Release/" />
|
||||
<Option external_deps="../crnlib/libcrnlib.a;" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Option parameters="-file orig/*.png -fileformat crn -bitrate 1.33 -imagestats -lzmastats -logfile log3.txt -fileformat crn -bitrate 1.33 -imagestats -lzmastats -logfile log3.txt -bitrate 1.5" />
|
||||
<Compiler>
|
||||
<Add option="-march=core2" />
|
||||
<Add option="-fomit-frame-pointer" />
|
||||
<Add option="-fexpensive-optimizations" />
|
||||
<Add option="-O3" />
|
||||
<Add option="-Wextra" />
|
||||
<Add option="-Wall" />
|
||||
<Add option="-DNDEBUG" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add library="../crnlib/libcrnlib.a" />
|
||||
<Add library="pthread" />
|
||||
</Linker>
|
||||
</Target>
|
||||
</Build>
|
||||
<Compiler>
|
||||
<Add option="-Wextra" />
|
||||
<Add option="-Wall" />
|
||||
<Add option="-g" />
|
||||
<Add option="-fexceptions" />
|
||||
<Add option="-Wno-unused-value" />
|
||||
<Add option="-Wno-unused" />
|
||||
<Add option="-fno-strict-aliasing" />
|
||||
<Add option="-ffast-math" />
|
||||
<Add option="-fno-math-errno" />
|
||||
<Add directory="../inc" />
|
||||
<Add directory="../crnlib" />
|
||||
</Compiler>
|
||||
<Unit filename="corpus_gen.cpp" />
|
||||
<Unit filename="corpus_gen.h" />
|
||||
<Unit filename="corpus_test.cpp" />
|
||||
<Unit filename="corpus_test.h" />
|
||||
<Unit filename="crunch.cpp" />
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
<debugger />
|
||||
<DoxyBlocks>
|
||||
<comment_style block="0" line="0" />
|
||||
<doxyfile_project />
|
||||
<doxyfile_build />
|
||||
<doxyfile_warnings />
|
||||
<doxyfile_output />
|
||||
<doxyfile_dot />
|
||||
<general />
|
||||
</DoxyBlocks>
|
||||
<envvars />
|
||||
</Extensions>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
||||
Reference in New Issue
Block a user