mirror of
https://github.com/yuzu-emu/FasTC
synced 2024-11-23 16:13:51 +00:00
- Add flag to specify whether or not we'd like to collect stats
- Fix amount of interpolation points to use during shape estimation
This commit is contained in:
parent
1bd1a79065
commit
20c504056f
2 changed files with 28 additions and 9 deletions
|
@ -37,7 +37,7 @@
|
||||||
#define ALIGN_SSE __attribute__((aligned(16)))
|
#define ALIGN_SSE __attribute__((aligned(16)))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define USE_PCA_FOR_SHAPE_ESTIMATION
|
// #define USE_PCA_FOR_SHAPE_ESTIMATION
|
||||||
|
|
||||||
enum EBlockStats {
|
enum EBlockStats {
|
||||||
eBlockStat_Path,
|
eBlockStat_Path,
|
||||||
|
@ -1710,7 +1710,7 @@ namespace BC7C
|
||||||
error += 1.0;
|
error += 1.0;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
error += c.QuantizedError(Min, Max, 4, 0xFFFFFFFF, RGBAVector(w[0], w[1], w[2], w[3]));
|
error += c.QuantizedError(Min, Max, 8, 0xFFFFFFFF, RGBAVector(w[0], w[1], w[2], w[3]));
|
||||||
#endif
|
#endif
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
@ -1730,7 +1730,6 @@ namespace BC7C
|
||||||
double eigOne = c.GetPrincipalEigenvalue();
|
double eigOne = c.GetPrincipalEigenvalue();
|
||||||
double eigTwo = c.GetSecondEigenvalue();
|
double eigTwo = c.GetSecondEigenvalue();
|
||||||
|
|
||||||
// printf("EigOne: %08.3f\tEigTwo: %08.3f\n", eigOne, eigTwo);
|
|
||||||
if(eigOne != 0.0) {
|
if(eigOne != 0.0) {
|
||||||
error += eigTwo / eigOne;
|
error += eigTwo / eigOne;
|
||||||
}
|
}
|
||||||
|
@ -1738,7 +1737,7 @@ namespace BC7C
|
||||||
error += 1.0;
|
error += 1.0;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
error += c.QuantizedError(Min, Max, 4, 0xFFFFFFFF, RGBAVector(w[0], w[1], w[2], w[3]));
|
error += c.QuantizedError(Min, Max, 2, 0xFFFFFFFF, RGBAVector(w[0], w[1], w[2], w[3]));
|
||||||
#endif
|
#endif
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include "Image.h"
|
#include "Image.h"
|
||||||
|
|
||||||
void PrintUsage() {
|
void PrintUsage() {
|
||||||
fprintf(stderr, "Usage: tc [-s|-t <num>] <imagefile>\n");
|
fprintf(stderr, "Usage: tc [-l] [-q <quality>] [-n <num>] [-simd] [-t <threads> [-j <jobs>]] <imagefile>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
@ -24,6 +24,7 @@ int main(int argc, char **argv) {
|
||||||
int numThreads = 1;
|
int numThreads = 1;
|
||||||
int numCompressions = 1;
|
int numCompressions = 1;
|
||||||
bool bUseSIMD = false;
|
bool bUseSIMD = false;
|
||||||
|
bool bSaveLog = false;
|
||||||
|
|
||||||
bool knowArg = false;
|
bool knowArg = false;
|
||||||
do {
|
do {
|
||||||
|
@ -42,7 +43,14 @@ int main(int argc, char **argv) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strcmp(argv[fileArg], "-s") == 0) {
|
if(strcmp(argv[fileArg], "-l") == 0) {
|
||||||
|
fileArg++;
|
||||||
|
bSaveLog = true;
|
||||||
|
knowArg = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(strcmp(argv[fileArg], "-simd") == 0) {
|
||||||
fileArg++;
|
fileArg++;
|
||||||
bUseSIMD = true;
|
bUseSIMD = true;
|
||||||
knowArg = true;
|
knowArg = true;
|
||||||
|
@ -90,6 +98,12 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
} while(knowArg && fileArg < argc);
|
} while(knowArg && fileArg < argc);
|
||||||
|
|
||||||
|
if(numThreads > 1 && bSaveLog) {
|
||||||
|
bSaveLog = false;
|
||||||
|
fprintf(stderr, "WARNING: Will not save log because implementation is not thread safe.\n"
|
||||||
|
"If you'd like, send a complaint to pavel@cs.unc.edu to get this done faster.\n");
|
||||||
|
}
|
||||||
|
|
||||||
if(fileArg == argc) {
|
if(fileArg == argc) {
|
||||||
PrintUsage();
|
PrintUsage();
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -105,7 +119,10 @@ int main(int argc, char **argv) {
|
||||||
const Image *img = file.GetImage();
|
const Image *img = file.GetImage();
|
||||||
|
|
||||||
int numBlocks = (img->GetWidth() * img->GetHeight())/16;
|
int numBlocks = (img->GetWidth() * img->GetHeight())/16;
|
||||||
BlockStatManager *statManager = new BlockStatManager(numBlocks);
|
BlockStatManager *statManager = NULL;
|
||||||
|
if(bSaveLog) {
|
||||||
|
statManager = new BlockStatManager(numBlocks);
|
||||||
|
}
|
||||||
|
|
||||||
SCompressionSettings settings;
|
SCompressionSettings settings;
|
||||||
settings.bUseSIMD = bUseSIMD;
|
settings.bUseSIMD = bUseSIMD;
|
||||||
|
@ -129,11 +146,14 @@ int main(int argc, char **argv) {
|
||||||
fprintf(stderr, "Error computing PSNR\n");
|
fprintf(stderr, "Error computing PSNR\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
statManager->ToFile(strcat(argv[fileArg], "-log.txt"));
|
if(bSaveLog) {
|
||||||
|
statManager->ToFile(strcat(argv[fileArg], ".log"));
|
||||||
|
}
|
||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
delete ci;
|
delete ci;
|
||||||
delete statManager;
|
if(statManager)
|
||||||
|
delete statManager;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue