Skip to content

Commit 1f15ae5

Browse files
authored
Add files via upload
1 parent b696674 commit 1f15ae5

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

nQuantCpp/GilbertCurve.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,13 @@ namespace Peano
381381
DITHER_MAX = 25;
382382
}
383383

384-
auto edge = m_hasAlpha ? 1 : exp(weight) + .25;
385-
auto deviation = !m_hasAlpha && weight > .002 ? .25 : 1;
386-
ditherMax = (m_hasAlpha || DITHER_MAX > 9) ? (BYTE)sqr(_sqrt(DITHER_MAX) + edge * deviation) : (BYTE) (DITHER_MAX * 1.5);
384+
auto edge = m_hasAlpha ? 1 : exp(weight) - .25;
385+
if (sortedByYDiff)
386+
ditherMax = (BYTE)(DITHER_MAX / weight);
387+
else {
388+
auto deviation = !m_hasAlpha && weight > .0025 ? -.25 : 1;
389+
ditherMax = (m_hasAlpha || DITHER_MAX > 9) ? (BYTE)sqr(_sqrt(DITHER_MAX) + edge * deviation) : (BYTE)(DITHER_MAX * (saliencies != nullptr ? 2 : M_E));
390+
}
387391
int density = m_nMaxColor > 16 ? 3200 : 1500;
388392
if (m_nMaxColor / weight > 5000 && (weight > .045 || (weight > .01 && m_nMaxColor < 64)))
389393
ditherMax = (BYTE)sqr(5 + edge);

0 commit comments

Comments
 (0)