Skip to content
Myr

Merge branch 'rg-matchcolors' of https://github.com/castano/stb into working

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sean Barrett · committed by Sean Barrett · parents 5a87025, c7cf85f · Browse files · 1 file+8 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−7 removed

  • other:+8 added−7 removed

1 file+8 added−7 removed

modified:stb_dxt.h+8 added-7 removed
22 unmodified lines
23// v1.01 - (stb) fix bug converting to RGB that messed up quality, thanks ryg & cbloom24// v1.00 - (stb) first release25//26// contributors:27// Rich Geldreich (more accurate index selection)28// Kevin Schmidt (#defines for "freestanding" compilation)29// github:ppiastucki (BC4 support)30// Ignacio Castano - improve DXT endpoint quantization31//
208 unmodified lines
240 // relying on this 1d approximation isn't always optimal in terms of euclidean distance,241 // but it's very close and a lot faster.242 // http://cbloomrants.blogspot.com/2008/12/12-08-08-dxtc-summary.html243243 c0Point = (stops[1] + stops[3]) >> 1;244 halfPoint = (stops[3] + stops[2]) >> 1;245 c3Point = (stops[2] + stops[0]) >> 1;244 c0Point = (stops[1] + stops[3]);245 halfPoint = (stops[3] + stops[2]);246 c3Point = (stops[2] + stops[0]);247248 if(!dither) {249 // the version without dithering is straightforward250 for (i=15;i>=0;i--) {250 int dot = dots[i];251 int dot = dots[i]*2;252 mask <<= 2;253254 if(dot < halfPoint)255 mask |= (dot < c0Point) ? 1 : 3;
4 unmodified lines
260 // with floyd-steinberg dithering261 int err[8],*ep1 = err,*ep2 = err+4;262 int *dp = dots, y;263263 c0Point <<= 4;264 halfPoint <<= 4;265 c3Point <<= 4;264 c0Point <<= 3;265 halfPoint <<= 3;266 c3Point <<= 3;267 for(i=0;i<8;i++)268 err[i] = 0;269270 for(y=0;y<4;y++)
482 unmodified lines