From 5dcd880b7ce278c1fc53982a57fce16400c7b3a6 Mon Sep 17 00:00:00 2001 From: Dave Schmenk Date: Wed, 13 May 2020 19:28:08 -0700 Subject: [PATCH] replace y with l in luv2rgb to make more sense --- ntsc-140.py | 12 ++++++------ ntsc-160.py | 10 +++++----- ntsc-640.py | 12 ++++++------ 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/ntsc-140.py b/ntsc-140.py index e3a72c2..ccd7795 100644 --- a/ntsc-140.py +++ b/ntsc-140.py @@ -23,12 +23,12 @@ def yuv2rgb(y, u, v): b = max(0.0, y + 2.033 * u) return (r, g, b) -def luv2rgb(y, u, v): - r = max(0.0, y + v) - g = max(0.0, y - 0.707 * u - 0.707 * v) - b = max(0.0, y + u) +def luv2rgb(l, u, v): + r = max(0.0, l + v) + g = max(0.0, l - 0.707 * u - 0.707 * v) + b = max(0.0, l + u) return (r, g, b) - + def ntscInitRGB(angle): YScale = [0.0, 0.25, 0.50, 1.0]#[0.0, 0.3334, 0.6667, 1.0] redSum = 0.0 @@ -96,7 +96,7 @@ def ntscInitPixels(): def ntscMapRGB(rgb, x): global shrPixels - + nearest = 195075 nBest = 0 errRed = 0 diff --git a/ntsc-160.py b/ntsc-160.py index 41a8045..072844d 100644 --- a/ntsc-160.py +++ b/ntsc-160.py @@ -22,10 +22,10 @@ def yuv2rgb(y, u, v): b = max(0.0, y + 2.033 * u) return (r, g, b) -def luv2rgb(y, u, v): - r = max(0.0, y + v) - g = max(0.0, y - 0.707 * u - 0.707 * v) - b = max(0.0, y + u) +def luv2rgb(l, u, v): + r = max(0.0, l + v) + g = max(0.0, l - 0.707 * u - 0.707 * v) + b = max(0.0, l + u) return (r, g, b) def ntscInitRGB(angle): @@ -96,7 +96,7 @@ def ntscInitPixels(): def ntscMapRGB(rgb, x): global shrPixels global ntscPrev - + pix8 = x % 8 if pix8 == 0: shrPixels = [0 for n in xrange(32)] diff --git a/ntsc-640.py b/ntsc-640.py index 951e1bb..98fe747 100644 --- a/ntsc-640.py +++ b/ntsc-640.py @@ -21,10 +21,10 @@ def yuv2rgb(y, u, v): b = max(0.0, y + 2.033 * u) return r, g, b -def luv2rgb(y, u, v): - r = max(0.0, y + v) - g = max(0.0, y - 0.707 * u - 0.707 * v) - b = max(0.0, y + u) +def luv2rgb(l, u, v): + r = max(0.0, l + v) + g = max(0.0, l - 0.707 * u - 0.707 * v) + b = max(0.0, l + u) return r, g, b def ntscInitRGB(angle): @@ -82,7 +82,7 @@ def ntscPrev(): grn += ntscOutput[p][1] blu += ntscOutput[p][2] return (min(255,red), min(255,grn), min(255,blu)) - + def ntscBest(ntsc, rgb): nearest = 195075 lumBest = 0 @@ -110,7 +110,7 @@ def ntscMapRGB(rgb): blu = max(0, rgb[p][2] - prev[2]) shr.append(ntscBest(ntscRGB[p], (red, grn, blu))) return shr - + def displayBars(): for l in xrange(4): for bar in xrange(len(ntscRGB)):