diff --git a/src/dhgr.tk/utils/dhgrrgb.pla b/src/dhgr.tk/utils/dhgrrgb.pla index cc45789..9e54b0f 100644 --- a/src/dhgr.tk/utils/dhgrrgb.pla +++ b/src/dhgr.tk/utils/dhgrrgb.pla @@ -118,34 +118,35 @@ def rgbPix(rgbptr, errptr, cx)#1 dist(r0, g0, b0, r1, g1, b1) if isgti16(rgbThreshold) d1:[0], d1:[1] = pd:[0], pd:[1] + d2:[0], d2:[1] = pd:[0], pd:[1] else // Calc match if next pixel is one d1:[0], d1:[1] = dist(r1, g1, b1, lr1, lg1, lb1) - fin - if lookahead > 1 - // Look ahead in chroma cycle for possible better match for after next RGB pixel - i = ((cx + 2) & 3) * 3 - lr2 = pr1 + ntscChroma[i+RED] - lg2 = pg1 + ntscChroma[i+GRN] - lb2 = pb1 + ntscChroma[i+BLU] - r2 = gamma[rgbptr->[6+RED]] - g2 = gamma[rgbptr->[6+GRN]] - b2 = gamma[rgbptr->[6+BLU]] - if errDiv - r2 = r2 + (errptr=>[6+RED] + r1 - lr2) / errDiv - g2 = g2 + (errptr=>[6+GRN] + g1 - lg2) / errDiv - b2 = b2 + (errptr=>[6+BLU] + b1 - lb2) / errDiv - fin - // Check for hi frequency transition - dist(r0, g0, b0, r2, g2, b2) - if isgti16(rgbThreshold) - d2:[0], d2:[1] = pd:[0], pd:[1] + if lookahead > 1 + // Look ahead in chroma cycle for possible better match for after next RGB pixel + i = ((cx + 2) & 3) * 3 + lr2 = pr1 + ntscChroma[i+RED] + lg2 = pg1 + ntscChroma[i+GRN] + lb2 = pb1 + ntscChroma[i+BLU] + r2 = gamma[rgbptr->[6+RED]] + g2 = gamma[rgbptr->[6+GRN]] + b2 = gamma[rgbptr->[6+BLU]] + if errDiv + r2 = r2 + (errptr=>[6+RED] + r1 - lr2) / errDiv + g2 = g2 + (errptr=>[6+GRN] + g1 - lg2) / errDiv + b2 = b2 + (errptr=>[6+BLU] + b1 - lb2) / errDiv + fin + // Check for hi frequency transition + dist(r0, g0, b0, r2, g2, b2) + if isgti16(rgbThreshold) + d2:[0], d2:[1] = pd:[0], pd:[1] + else + // Calc match if after next pixel is one + d2:[0], d2:[1] = dist(r2, g2, b2, lr2, lg2, lb2) + fin else - // Calc match if after next pixel is one - d2:[0], d2:[1] = dist(r2, g2, b2, lr2, lg2, lb2) + d2:[0], d2:[1] = pd:[0], pd:[1] fin - else - d2:[0], d2:[1] = pd:[0], pd:[1] fin else d1:[0], d1:[1] = pd:[0], pd:[1]