Commit Graph

10 Commits

Author SHA1 Message Date
Arseny Kapoulkine b2953ba33b tools: Improve codecbench output
By default we no longer print detailed timing information, unless -v is
specified.

Also fix vertex filling to actually use 16-bit data.
2020-11-30 23:05:10 -08:00
Arseny Kapoulkine ee56078c74 tools: Update codecbench to show best results
This makes it easier to plot this when comparing different
architectures/compilers/etc.
2020-07-25 20:38:07 -07:00
Arseny Kapoulkine 7316da1da8 tools: Add Win32 timers to codecbench
This makes codecbench compile on Windows/MSVC
2020-04-13 22:00:53 -07:00
Arseny Kapoulkine 865c345903 vertexfilter: Implement a floating-point exponent filter
In some cases we can't quantize the floating point data because the
range of the data is unknown. While it's possible to use
meshopt_quantizeFloat to reduce the precision and gain some compression
back, this is often insufficient and suboptimal.

For inputs that represent a vector in 3D space, such as a position or
scale, a good alternative is to use a shared-exponent encoding - it's a
reasonable assumption that we are content with the same (absolute)
precision in all three components.

To be able to encode in shared exp, we use a modified floating point
like format, where we store a 24-bit signed integer mantissa (without
implicit 1) and a 8-bit exponent. This is less precise than a floating
point number - we lose 1 bit - but we gain an ability to individually
select the exponent and mantissa at any level of desired mantissa
precision. Additionally this moves exponent into a single byte, and
stores the mantissa as a two-complement integer - both of these are much
friendlier for vertex codec than a basic float encoding.

While ideally the shared exponent would be stored just once, this
complicates the SIMD decoding and is actually redundant if the output of
the filter is compressed with vertex encoder *and* a general purpose LZ,
because the stream of exponent bytes will be exactly the same between
all three components.

The resulting decoder runs at ~13 GB/s using WASM SIMD and ~2.5 GB/s
using scalar WASM.
2020-03-30 21:54:37 -07:00
Arseny Kapoulkine 019ff78373 tools: Use a larger array for benchmarking
This gives us a bit more stable numbers.
2020-02-21 20:07:05 -08:00
Arseny Kapoulkine d909650a5c vertexfilter: Consolidate Oct8 and Oct12 into a single entrypoint
Since both filters can now handle variable bitrate it no longer makes as
much sense to split them. This change consolidates the two
implementations and uses a single templated scalar implementation as
well. This makes gltfpack code a bit simpler as well.
2020-02-17 15:48:42 -08:00
Arseny Kapoulkine 4cfe27c19d tools: Add filters to codecbench
The filters are branchless so we can just run them repeatedly on the
same data block.
2020-02-16 18:55:01 -08:00
Arseny Kapoulkine ec52f6b228 js: Switch to -msimd128
This change switches to using -msimd128 compile flags instead of
-munimplmemented-simd128.

The reason for the switch is that in general, compiling with
-munimplemented-simd128 is asking for trouble, as it may generate
instructions that Chrome doesn't understand yet.

We've been carefully avoiding the issues so far, but at this point
-msimd128 supports all but one (swizzle) instruction that we need.

This change explicitly marks the function chain in vertex codec as using
unimplemented-simd128 (you need to mark the chain to enable inlining),
which generates more or less the same code.

The benefit is that codecbench-simd.js can now be ran in Chrome/v8!

Also switch to emscripten_get_now to get more precise timer than
clock().
2020-02-16 18:10:03 -08:00
Arseny Kapoulkine 06a1d2b787 tools: Update codecbench to make it easier to run
make codecbench.wasm now builds a standalone .wasm executable. This
change also disables memory growth to make sure that we have the minimum
number of imports.
2020-02-12 21:42:59 -08:00
Arseny Kapoulkine 7d5833ac2a tools: Add codec benchmark
This code can be used to benchmark native vs .js implementations of
vertex codec (and, in the future, vertex filters).

Note: right now the SIMD variant of the JS benchmark doesn't run because
compiler generates some instructions that Chrome doesn't support...
2020-02-11 21:07:42 -08:00