Skip to content

Commit c636d44

Browse files
committed
Regression fix: Don't bias range reduction
This gives far more consistent results now that quantization has improved
1 parent b7a4079 commit c636d44

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

Qualetize.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,11 @@ struct BGRAf_t Qualetize(
4747
TilesData_QuantizePalettes(TilesData, Palette, MaxTilePals, MaxPalSize, PalUnused);
4848

4949
//! Reduce palette range
50-
//! NOTE: Adding a bias here seems to help
51-
{
52-
struct BGRAf_t Bias = BGRAf_FromBGRA(&(const struct BGRA8_t){1,1,1,0}, BitRange);
53-
Bias = BGRAf_Muli(&Bias, 0.25f);
54-
for(i=0;i<MaxTilePals*MaxPalSize;i++) {
55-
struct BGRAf_t p = BGRAf_FromYCoCg(&Palette[i]);
56-
p = BGRAf_Add(&p, &Bias);
57-
58-
struct BGRA8_t p2 = BGRA_FromBGRAf(&p, BitRange);
59-
p = BGRAf_FromBGRA(&p2, BitRange);
60-
Palette[i] = BGRAf_AsYCoCg(&p);
61-
}
50+
for(i=0;i<MaxTilePals*MaxPalSize;i++) {
51+
struct BGRAf_t p = BGRAf_FromYCoCg(&Palette[i]);
52+
struct BGRA8_t p2 = BGRA_FromBGRAf(&p, BitRange);
53+
p = BGRAf_FromBGRA(&p2, BitRange);
54+
Palette[i] = BGRAf_AsYCoCg(&p);
6255
}
6356

6457
//! Get parameters, pointers, etc.

0 commit comments

Comments
 (0)