Skip to content

Commit

Permalink
Add -dec command line argument to test.
Browse files Browse the repository at this point in the history
  • Loading branch information
castano committed Jul 6, 2020
1 parent 09a38c9 commit 8b0fc7f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
8 changes: 4 additions & 4 deletions icbc.h
Original file line number Diff line number Diff line change
Expand Up @@ -3282,10 +3282,10 @@ static void PrepareOptTable5(uint8 * table, Decoder decoder)
int nv_err = abs(nv_r - i);

if (decoder == Decoder_D3D10) {
// DX10 spec says that interpolation must be within 3% of "correct" result,
// add this as error term. (normally we'd expect a random distribution of
// +-1.5% error, but nowhere in the spec does it say that the error has to be
// unbiased - better safe than sorry).
// DX10 spec says that interpolation must be within 3% of "correct" result,
// add this as error term. (normally we'd expect a random distribution of
// +-1.5% error, but nowhere in the spec does it say that the error has to be
// unbiased - better safe than sorry).
int r = (maxe * 2 + mine) / 3;
err = abs(r - i) * 100 + abs(mx - mn) * 3;

Expand Down
25 changes: 17 additions & 8 deletions icbc_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@
// $ g++ icbc_test.cpp -O3 -mavx2 -lpthread -std=c+=11
// > cl icbc_test.cpp /O2 /arch:AVX2

// Enable one of these:
// Enable one of these to override the default selection:
//#define ICBC_SIMD 0 // FLOAT
//#define ICBC_SIMD 1 // SSE2
//#define ICBC_SIMD 2 // SSE4.1
//#define ICBC_SIMD 3 // AVX
#define ICBC_SIMD 4 // AVX2
//#define ICBC_SIMD 4 // AVX2
//#define ICBC_SIMD 5 // AVX512
//#define ICBC_SIMD -1 // NEON
//#define ICBC_SIMD -2 // VMX
//#define ICBC_SIMD -3 // WASM
//#define ICBC_SIMD 6 // NEON
//#define ICBC_SIMD 7 // VMX

#define ICBC_IMPLEMENTATION
#include "icbc.h"
Expand All @@ -23,8 +22,6 @@
#define IC_PFOR_IMPLEMENTATION
#include "ic_pfor.h"



#include <stdio.h>
#include <stdint.h>

Expand Down Expand Up @@ -302,6 +299,7 @@ bool output_dds = false;
bool output_ktx = false;
bool output_png = false;
int repeat_count = 1;
icbc::Decoder decoder = icbc::Decoder_D3D10;
icbc::Quality quality_level = icbc::Quality_Default;

// Output stats:
Expand Down Expand Up @@ -459,12 +457,23 @@ int main(int argc, char * argv[]) {
if (quality_level > icbc::Quality_Max) quality_level = icbc::Quality_Max;
}
}
else if (strcmp(argv[i], "-dec") == 0) {
if (i+1 < argc) {
if (strcmp(argv[i+1], "nv") == 0) decoder = icbc::Decoder_NVIDIA;
else if (strcmp(argv[i+1], "amd") == 0) decoder = icbc::Decoder_AMD;
else if (strcmp(argv[i+1], "d3d10") == 0) decoder = icbc::Decoder_D3D10;
else {
printf("Unrecognized decoder argument: %s\n", argv[i+1]);
}
i += 1;
}
}
else if (atoi(argv[i])) {
repeat_count = atoi(argv[i]);
}
}

icbc::init_dxt1();
icbc::init_dxt1(decoder);
int thread_count = ic::init_pfor();
printf("Using %d threads.\n", thread_count);

Expand Down

0 comments on commit 8b0fc7f

Please sign in to comment.