1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-01-02 12:33:07 +00:00

Update comments and data types

This commit is contained in:
David Schmenk 2024-12-26 19:24:00 -08:00
parent f6a1dcf256
commit b776452157

View File

@ -33,15 +33,22 @@ sysflags resxtxt1|reshgr1|resxhgr1
const RED = 0
const GRN = 1
const BLU = 2
// According to what I could find out about the NTSC color wheel:
// Red maxes at 103.5 degrees
// Green maxes at 240.7 degrees
// Blue maxes at 347.1 degrees
const RED_PHASE_NTSC = 104
const GREEN_PHASE_NTSC = 241
const BLUE_PHASE_NTSC = 347
// Ideal phase angles for 4 phase
const RED_PHASE_IDEAL = 90
const GREEN_PHASE_IDEAL = 270
const BLUE_PHASE_IDEAL = 360
// Equal 120 deg phase angles
const RED_PHASE_EQUAL = 120
const GREEN_PHASE_EQUAL = 240
const BLUE_PHASE_EQUAL = 360
// Simplified phase angles: 90 deg between R and B, 135 between RG and BG
const RED_PHASE_SIMPLE = 90
const GREEN_PHASE_SIMPLE = 225
const BLUE_PHASE_SIMPLE = 360
@ -182,14 +189,13 @@ def calcChroma(angle)#0
byte i
for i = 0 to 3
// Calculate and NTSC RGB for this DHGR pixel
// According to what I could find out about the NTSC color wheel:
// Red maxes at 103.5 degrees
// Green maxes at 240.7 degrees
// Blue maxes at 347.1 degrees
r = max(0, (saturation + (cos(angle - phase[RED]) >> 7)))
g = max(0, (saturation + (cos(angle - phase[GRN]) >> 7)))
b = max(0, (saturation + (cos(angle - phase[BLU]) >> 7)))
// Calculate RGB for this DHGR pixel
//r = max(0, (saturation + (cos(angle - phase[RED]) >> 7)))
//g = max(0, (saturation + (cos(angle - phase[GRN]) >> 7)))
//b = max(0, (saturation + (cos(angle - phase[BLU]) >> 7)))
r = saturation + (cos(angle - phase[RED]) >> 7)
g = saturation + (cos(angle - phase[GRN]) >> 7)
b = saturation + (cos(angle - phase[BLU]) >> 7)
// Make chroma add up to white
ntscChroma[i*3 + RED] = (r + 2) / 4
ntscChroma[i*3 + GRN] = (g + 2) / 4
@ -254,8 +260,8 @@ def rgbMatch(rgbptr, errptr, cx)#1
match = i
fin
next
match = match & (1 << cx)
i = cx * 3
match = match & (1 << cx)
else
// Previous 1/4 chroma cycle
i = ((cx - 1) & 3) * 3
@ -704,6 +710,7 @@ if ^arg
break
is 'W' // Match whole pixel
flags = flags | MATCH_PIX
tint = tint - 22
break
otherwise
puts("? option:"); putc(^(arg + 2)); putln