Skip to content

Commit

Permalink
Update PnnLABQuantizer.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
mcychan authored Feb 28, 2025
1 parent 48a2628 commit 41ebbc8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nQuant.Master/PnnLABQuantizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,10 @@ internal override void Pnnquan(int[] pixels, ref Color[] palettes, ref int nMaxC
ratio = Math.Min(1.0, weight * Math.Exp(2.44));
else if (proportional > .03)
ratio = Math.Min(1.0, weight * Math.Exp(3.225));
else
ratio = Math.Min(1.0, proportional + weight * Math.Exp(1.947));
else {
var beta = (nMaxColors < 16 && maxbins % 2 == 0) ? 2 : 1;
ratio = Math.Min(1.0, proportional + beta * weight * Math.Exp(1.947));
}
}
else if (nMaxColors > 256)
ratio = Math.Min(1.0, 1 - 1.0 / proportional);
Expand Down

0 comments on commit 41ebbc8

Please sign in to comment.