From 0183c5304f1f489ba83669270fa0c146f64bfc3c Mon Sep 17 00:00:00 2001 From: Christopher Mosher Date: Mon, 28 Jan 2019 21:10:18 -0500 Subject: [PATCH] refactor: float->double filters; remove obsolete tv code --- src/analogtv.cpp | 104 +------------------------------------------ src/filterchroma.cpp | 2 +- src/filterchroma.h | 6 +-- src/filterluma.cpp | 2 +- src/filterluma.h | 6 +-- 5 files changed, 10 insertions(+), 110 deletions(-) diff --git a/src/analogtv.cpp b/src/analogtv.cpp index 6ce6ef5..5614772 100644 --- a/src/analogtv.cpp +++ b/src/analogtv.cpp @@ -275,21 +275,11 @@ void AnalogTV::drawMonitorColor() delete [] rgb; } -void AnalogTV::drawMonitorWhite() -{ - drawMonitorMonochrome(colors.c()[A2ColorsObserved::WHITE]); -} - void AnalogTV::drawMonitorGreen() { drawMonitorMonochrome(colors.c()[A2ColorsObserved::HIRES_GREEN]); } -void AnalogTV::drawMonitorOrange() -{ - drawMonitorMonochrome(colors.c()[A2ColorsObserved::HIRES_ORANGE]); -} - void AnalogTV::drawMonitorMonochrome(const unsigned int color) { int ip = 0; @@ -315,15 +305,8 @@ void AnalogTV::drawTVOld() for (int row = 0; row < 192; ++row) { IQ iq_factor; - if (this->type == TV_OLD_COLOR) - { - const CB cb = get_cb(row); - iq_factor = get_iq_factor(cb); - } - else - { - iq_factor = BLACK_AND_WHITE; - } + const CB cb = get_cb(row); + iq_factor = get_iq_factor(cb); ntsc_to_yiq(row*AppleNTSC::H+350,AppleNTSC::H-350,iq_factor,yiq); for (int col = 350; col < AppleNTSC::H-2; ++col) { @@ -338,31 +321,6 @@ void AnalogTV::drawTVOld() delete [] yiq; } -void AnalogTV::drawTVNew() -{ - unsigned int *rgb = new unsigned int[AppleNTSC::H]; - int ip = 0; - for (int row = 0; row < 192; ++row) - { - const CB cb = get_cb(row); - const bool removeColor = false; //(this->type == TV_NEW_BW || !cb.isColor()); - ntsc_to_rgb_newtv(row*AppleNTSC::H+350,AppleNTSC::H-350,rgb); - for (int col = 350; col < AppleNTSC::H-2; ++col) - { - int rgbv = rgb[col-350]; - if (removeColor) - { - rgbv = color2bw(rgbv); - } - this->image.setElem(ip,rgbv); - if (bleed_down) - this->image.setElem(ip+D_IP,rgbv); - ++ip; - } - ip += D_IP; - } - delete [] rgb; -} void AnalogTV::drawBlank() { @@ -418,64 +376,6 @@ void AnalogTV::ntsc_to_rgb_monitor(const int isignal, const int siglen, unsigned } } -void AnalogTV::ntsc_to_rgb_newtv(const int isignal, const int siglen, unsigned int rgb[]) -{ - int sp, s0, s1, se; - sp = s0 = s1 = isignal; - se = isignal+siglen; - unsigned int c = 0; - while (s1 < se) - { - // no signal; black... - sp = s0; - while (this->signal[s0] < 50 && s0signal[s1] > 50 && s1= 4) - { - c = 0xFFFFFF; - } - else if (slen == 1) - { - if (this->signal[s0-2] > 50 && this->signal[s0+2] > 50) - c = 0x808080; - else - c = loresdarkcolor[s0 % 4]; - } - else if (slen == 2) - { - c = hirescolor[s0 % 4]; - } - else if (slen == 3) - { - c = loreslightcolor[s0 % 4]; - } - else - { - ++s1; - } - - for (int i = s0; i < s1; ++i) - rgb[i-isignal] = c; - s0 = s1; - } -} diff --git a/src/filterchroma.cpp b/src/filterchroma.cpp index 4f93fc6..0e45703 100644 --- a/src/filterchroma.cpp +++ b/src/filterchroma.cpp @@ -32,7 +32,7 @@ FilterChroma::FilterChroma() { FilterChroma::~FilterChroma() { } -float FilterChroma::next(const float v) { +double FilterChroma::next(const double v) { xv[0] = xv[1]; xv[1] = xv[2]; xv[2] = xv[3]; xv[3] = v / GAIN; yv[0] = yv[1]; yv[1] = yv[2]; yv[2] = yv[3]; diff --git a/src/filterchroma.h b/src/filterchroma.h index b4abe0f..c29858b 100644 --- a/src/filterchroma.h +++ b/src/filterchroma.h @@ -20,13 +20,13 @@ class FilterChroma { private: - float xv[4]; - float yv[4]; + double xv[4]; + double yv[4]; public: FilterChroma(); ~FilterChroma(); - float next(const float v); + double next(const double v); }; #endif diff --git a/src/filterluma.cpp b/src/filterluma.cpp index 102e1e4..de52cdc 100644 --- a/src/filterluma.cpp +++ b/src/filterluma.cpp @@ -33,7 +33,7 @@ FilterLuma::FilterLuma() { FilterLuma::~FilterLuma() { } -float FilterLuma::next(const float v) { +double FilterLuma::next(const double v) { xv[0] = xv[1]; xv[1] = xv[2]; xv[2] = xv[3]; xv[3] = xv[4]; xv[4] = xv[5]; xv[5] = v / GAIN; yv[0] = yv[1]; yv[1] = yv[2]; yv[2] = yv[3]; diff --git a/src/filterluma.h b/src/filterluma.h index 3a89681..30ae653 100644 --- a/src/filterluma.h +++ b/src/filterluma.h @@ -20,13 +20,13 @@ class FilterLuma { private: - float xv[6]; - float yv[4]; + double xv[6]; + double yv[4]; public: FilterLuma(); ~FilterLuma(); - float next(const float v); + double next(const double v); }; #endif