From 419b342a9a716426159f7a51ae17390386ecc884 Mon Sep 17 00:00:00 2001 From: "K. S. Ernest (iFire) Lee" Date: Tue, 18 Jan 2022 04:39:55 -0800 Subject: Faster CVTT by reducing quality. Make BC6 and BC7 CVTT faster while still having better quality than DXT5. --- thirdparty/cvtt/etc_notes.txt | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 thirdparty/cvtt/etc_notes.txt (limited to 'thirdparty/cvtt/etc_notes.txt') diff --git a/thirdparty/cvtt/etc_notes.txt b/thirdparty/cvtt/etc_notes.txt new file mode 100644 index 0000000000..bb041a8435 --- /dev/null +++ b/thirdparty/cvtt/etc_notes.txt @@ -0,0 +1,27 @@ +The ETC1 compressor uses modified cluster fit: + +Assume that there exists an ideal base color and set of selectors for a given table. +For a given table and set of selectors, the ideal base color can be determined by subtracting the offsets from each pixel and averaging them. +Doing that is equivalent to subtracting the average offset from the average color. +Because positive and negative selectors of the same magnitude cancel out, the search space of possible average offsets is reduced: 57 unique offsets for the first table and 81 for the others. +Most of the offsets result in the same color as another average offset due to quantization of the base color, so those can be de-duplicated. +So: +- Start with a high-precision average color. +- Apply precomputed luma offsets to it. +- Quantize and de-duplicate the base colors. +- Find the ideal selectors for each base color. + +Differential mode is solved by just finding the best legal combination from those attempts. + +There are several scenarios where this is not ideal: +- Clamping behavior can sometimes be leveraged for a more accurate block. +- Differentials can sometimes be moved slightly closer to become legal. +- This only works when MSE is the error metric (i.e. not normal maps) +- This only works when pixel weights are of equal importance (i.e. not using weight by alpha or edge deblocking) + +T and H mode just work by generating clustering assignments by computing a chrominance line and splitting the block in half by the chrominance midpoint and using those to determine the averages. + +Planar mode is just solved algebraically. + +If you want to emulate etc2comp's default settings, add the flag ETC_UseFakeBT709 to use its modified Rec. 709 error coefficients. +Doing that will significantly slow down encoding because it requires much more complicated quantization math. \ No newline at end of file -- cgit v1.2.3