From d2b5836d5d7b9d096601f3218f2e041e3bb82f9e Mon Sep 17 00:00:00 2001 From: Miller Cy Chan Date: Fri, 12 Jul 2024 12:32:15 +0800 Subject: [PATCH] Add files via upload --- nQuantCpp/GilbertCurve.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nQuantCpp/GilbertCurve.cpp b/nQuantCpp/GilbertCurve.cpp index 2e49f3c..62d6428 100644 --- a/nQuantCpp/GilbertCurve.cpp +++ b/nQuantCpp/GilbertCurve.cpp @@ -254,7 +254,8 @@ namespace Peano sortedByYDiff = !m_hasAlpha && m_saliencies && m_nMaxColor >= 128 && weight >= .042; DITHER_MAX = weight < .01 ? (weight > .0025) ? (BYTE)25 : 16 : 9; auto edge = m_hasAlpha ? 1 : exp(weight) + .25; - ditherMax = (m_hasAlpha || DITHER_MAX > 9) ? (BYTE)sqr(_sqrt(DITHER_MAX) + edge) : DITHER_MAX; + auto deviation = weight > .002 ? .25 : 1; + ditherMax = (m_hasAlpha || DITHER_MAX > 9) ? (BYTE)sqr(_sqrt(DITHER_MAX) + edge * deviation) : DITHER_MAX; int density = m_nMaxColor > 16 ? 3200 : 1500; if (m_nMaxColor / weight > 5000 && (weight > .045 || (weight > .01 && m_nMaxColor <= 64))) ditherMax = (BYTE)sqr(5 + edge);