Commit Graph

26 Commits

Author SHA1 Message Date
Adrian Perez
aa980682e6 Remove using std::string (#356) 2018-10-09 10:34:12 -07:00
Philip Rideout
5ac2c96cb5 Fix typo in ETC compression string. 2018-10-05 15:25:06 -07:00
Philip Rideout
da698f2e36 Add high level compression API to prep for cmgen integration. 2018-10-05 10:11:48 -07:00
Philip Rideout
eed2f72466 Implement TODO items for ASTC encoding.
These presets are copied over from the ARM standalone tool. I have not
tested them but they seem reasonable.
2018-10-04 14:29:18 -07:00
Philip Rideout
37a42ee854 Enable ETC for Suzanne normal map.
Due to an assertion in etc2comp, this unfortunately uses RGB8 instead of
RG11 but it still helps quite a bit (3.3 MB savings in the unzipped KTX
size).
2018-10-03 12:35:34 -07:00
Philip Rideout
cc61e4649b Add ETC support to mipgen / imageio / suzanne.
This shrinks file size as follows, although it seems to darken the
rendered result.

```
  1398209 Oct  2 16:22 ao.ktx
   699172 Oct  2 16:20 ao_etc.ktx
  1398209 Oct  2 16:22 metallic.ktx
   699172 Oct  2 16:19 metallic_etc.ktx
  1398209 Oct  2 16:22 roughness.ktx
   699172 Oct  2 16:20 roughness_etc.ktx
```
2018-10-02 21:57:22 -07:00
Philip Rideout
70a4c4f887 Add etc2comp to third_party. 2018-10-02 12:32:23 -07:00
Philip Rideout
3185d0f237 Add S3TC support to imageio and Suzanne.
At build time, mipgen now creates several compressed and non-compressed
variants for albedo.

For ASTC we use the ARM encoder, for S3TC we use the STB encoder. The
latter is somewhat limited so we may wish to investigate other libraries
in the future (e.g., AMD Compressenator).

At run time, we detect which of these variants to download, based on
available WebGL extensions. In practice, this means that desktop
browsers will use the S3TC variant and mobile browsers will use the ASTC
variant.

The makes unzipped albedo go from ~4 MB to 682 KB using S3TC.

Mobile support (ASTC and ETC2) is coming in a future PR, stay tuned.
2018-10-01 14:34:21 -07:00
Philip Rideout
6ed331d74c Add compression to mipgen and change bitrate to block size.
The compression API now takes block size instead of bit rate. Otherwise
it is quite possible for the encoder to generate a block size that is
not one of the valid block sizes that graphics API's can actually
consume.
2018-09-28 16:33:41 -07:00
Philip Rideout
17cfd55d3c Introduce compression API to imageio.
This wraps ARM's open source encoder with a reasonable interface.
2018-09-28 09:42:09 -07:00
Philip Rideout
ec31a55094 Add astcenc from ARM to third_party.
This was designed as a standalone tool rather than a library, so we are
renaming their "main" function to "standalone_main", which is described
in the tnt README.

We'll also be adding a wrapper to our imageio library.
2018-09-28 09:42:09 -07:00
prideout
3f751f3850 cmgen and mipgen should return an error code upon failure.
These tools can be used in an asset pipeline; build scripts should not
be required to parse stdout in order to determine success.
2018-09-17 14:51:29 -07:00
Philip Rideout
4665805d81 Minor improvements to EXR decoding. (#177)
See also #176.

This closes #166.
2018-08-28 14:38:54 -07:00
Philip Rideout
aa518369b4 Move deprecated Image out of libs. (#125)
This moves the old Image class into cmgen because it is the only client
that still uses it. We can migrate cmgen to LinearImage in the future.
2018-08-23 10:19:02 -07:00
Philip Rideout
07e4db795f Remove lots of reinterpret_cast. (#112)
* Remove lots of reinterpret_cast.

* Improve terseness with auto.
2018-08-17 12:01:32 -07:00
Philip Rideout
044387308a Migrate imageio to LinearImage. (#111) 2018-08-17 11:22:05 -07:00
Philip Rideout
6d9668ccf6 Add unit test for cross cube images. (#101) 2018-08-15 15:36:17 -07:00
Philip Rideout
5a027ca5a2 Replace deprecated color xform funcs. (#96) 2018-08-14 15:19:40 -07:00
Philip Rideout
b5b90b83f8 Add test_cmgen and promote the "updateOrCompare" function. (#95) 2018-08-14 13:47:31 -07:00
shartte
e6d5a85ec8 clang-cl warning fixes (#83)
* Disable certain MSVC-specific deprecation warnings

* clang-cl.exe warning fixes
2018-08-14 12:55:04 -07:00
Philip Rideout
07c34ee833 Simplify Image by flipping RADIANCE images. (#63)
* Simplify Image by flipping RADIANCE images.

Unit test for the new flip() method is forthcoming.

* Optimize image flipping.
2018-08-09 17:30:17 -07:00
Philip Rideout
69b65d9e2d Rename ColorSpace header to ColorTransform. (#61) 2018-08-09 15:54:18 -07:00
Philip Rideout
9ed20705ec Refactor color space utilities. (#58)
* Refactor color space utilities.

* Repair Android build.
2018-08-09 13:58:58 -07:00
Mathias Agopian
a6877d5baa Fix cmgen cross cubmap input
Fixes bug #45
2018-08-08 16:50:02 -07:00
emmcbd
de1743c572 Fix huge memory allocation when decoding PNG, which can end up with std::bad_alloc (#43) 2018-08-08 07:45:57 -07:00
Philip Rideout
f8a8098e0f Split off imageio lib from image. (#36)
* Split off imageio lib from image.

* Remove duplicated math funcs.
2018-08-07 16:38:04 -07:00