|
|
|
@ -427,15 +427,20 @@ static const float midpoints6[64] = { |
|
|
|
|
0.772549f, 0.788235f, 0.803922f, 0.819608f, 0.835294f, 0.850980f, 0.866667f, 0.882353f, 0.898039f, 0.913725f, 0.929412f, 0.945098f, 0.960784f, 0.976471f, 0.992157f, 1.0f |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
static unsigned short stb__Quantize5(float x) { |
|
|
|
|
static unsigned short stb__Quantize5(float x) |
|
|
|
|
{ |
|
|
|
|
unsigned short q; |
|
|
|
|
x = x < 0 ? 0 : x > 1 ? 1 : x; // saturate
|
|
|
|
|
unsigned short q = (unsigned short)(x * 31); |
|
|
|
|
q = (unsigned short)(x * 31); |
|
|
|
|
q += (x > midpoints5[q]); |
|
|
|
|
return q; |
|
|
|
|
} |
|
|
|
|
static unsigned short stb__Quantize6(float x) { |
|
|
|
|
|
|
|
|
|
static unsigned short stb__Quantize6(float x) |
|
|
|
|
{ |
|
|
|
|
unsigned short q; |
|
|
|
|
x = x < 0 ? 0 : x > 1 ? 1 : x; // saturate
|
|
|
|
|
unsigned short q = (unsigned short)(x * 63); |
|
|
|
|
q = (unsigned short)(x * 63); |
|
|
|
|
q += (x > midpoints6[q]); |
|
|
|
|
return q; |
|
|
|
|
} |
|
|
|
|