From 41d9ec3ce51e0c80a79163352d5549e20dccbbba Mon Sep 17 00:00:00 2001 From: Miller Cy Chan Date: Thu, 6 Feb 2025 14:32:25 +0800 Subject: [PATCH] Update GilbertCurve.cpp --- nQuantCpp/GilbertCurve.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nQuantCpp/GilbertCurve.cpp b/nQuantCpp/GilbertCurve.cpp index 2f91d7c..29e6b13 100644 --- a/nQuantCpp/GilbertCurve.cpp +++ b/nQuantCpp/GilbertCurve.cpp @@ -278,15 +278,15 @@ namespace Peano m_hasAlpha = weight < 0; errorq.clear(); - sortedByYDiff = !m_hasAlpha && m_saliencies && m_nMaxColor >= 128 && weight >= .052; weight = abs(weight); margin = weight < .0025 ? 12 : weight < .004 ? 8 : 6; + sortedByYDiff = !m_hasAlpha && m_saliencies && m_nMaxColor >= 128 && weight >= .052; beta = m_nMaxColor > 8 ? m_nMaxColor > 24 ? .25f : .7f : 1; if (m_nMaxColor > 64 || weight > .02) beta *= .4f; DITHER_MAX = weight < .01 ? (weight > .0025) ? (BYTE)25 : 16 : 9; auto edge = m_hasAlpha ? 1 : exp(weight) + .25; - auto deviation = weight > .002 ? .25 : 1; + auto deviation = !hasAlpha && 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)))