From e8c7e6e38adc8eb50105d6329008c2ddcbaa72e0 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sun, 6 Jan 2013 15:32:40 +0000 Subject: [PATCH] Efficiency, code cleanup --- wwss.cc | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/wwss.cc b/wwss.cc index ef9793b..2f9cc9c 100644 --- a/wwss.cc +++ b/wwss.cc @@ -62,7 +62,7 @@ void Wwss::setWide(bool twide) void Wwss::draw() { if (format == Video::PAL) drawPAL(); -// else if (format == Video::NTSC) drawNTSC(); + // else if (format == Video::NTSC) drawNTSC(); } void Wwss::drawPAL() @@ -117,24 +117,25 @@ void Wwss::drawPAL() Colour c; UINT value; + Surface* mysurface = getSurface(); for(UINT q = 0; q < Nd; q++) { value = (UINT)(dst[q] * 182); // Apparently this is a better number than 255 for the colour value c.set(value, value, value); - getSurface()->drawPixel(q, 6, c); + mysurface->drawPixel(q, 6, c); } } void Wwss::drawNTSC() { -/* + /* static UCHAR startCode[] = {1,0,0,0,0,0,0}; static UCHAR aspect43[] = {0}; static UCHAR aspect169[] = {1}; static UCHAR theRest[] = {0,0,0,0,0,0,0,0}; static UCHAR crc43[] = {0,0,0,0,0,0}; static UCHAR crc169[] = {0,0,1,1,0,0}; -*/ + */ /* Real NTSC pixel frequency: 13.5 MHz WSS bit frequency: 447.443125 kHz @@ -149,22 +150,22 @@ void Wwss::drawNTSC() const UINT Ns = 22; // Num pix src const UINT Nd = 664; // Num pix dst -// const UINT Nd = 518; // Num pix dst + // const UINT Nd = 518; // Num pix dst UINT Nl = lcm(Ns, Nd); // Num pix in lcm UINT Ss = Nl / Ns; // Source split (how many lcm px = 1 src px) UINT Sd = Nl / Nd; // Dst split -// UCHAR src[Ns]; + // UCHAR src[Ns]; -/* + /* memcpy(&src[0], startCode, 7); if (wide) memcpy(&src[7], aspect169, 1); else memcpy(&src[7], aspect43, 1); memcpy(&src[8], theRest, 8); if (wide) memcpy(&src[16], crc169, 6); else memcpy(&src[16], crc43, 6); -*/ + */ -static UCHAR src[22] = {1,0, 0,0,0,0,1,1, 0,0,0,0, 0,0,0,0, 0,0,1,0,0,1 }; + static UCHAR src[22] = {1,0, 0,0,0,0,1,1, 0,0,0,0, 0,0,0,0, 0,0,1,0,0,1 }; float dst[Nd]; @@ -183,31 +184,30 @@ static UCHAR src[22] = {1,0, 0,0,0,0,1,1, 0,0,0,0, 0,0,0,0, 0,0,1,0,0,1 }; Colour c; UINT value; -// This one is the real one -/* + // This one is the real one + /* + Surface* mysurface = getSurface(); for(UINT q = 0; q < Nd; q++) { value = (UINT)(dst[q] * 182); // Apparently this is a better number than 255 for the colour value c.set(value, value, value); - getSurface()->drawPixel(q, 6, c); + mysurface->drawPixel(q, 6, c); } -*/ + */ -// This one is testing active -for(int yy = 0; yy < 100; yy++) -{ - for(UINT q = 0; q < Nd; q++) + // This one is testing active + Surface* mysurface = getSurface(); + for(int yy = 0; yy < 100; yy++) { - value = (UINT)(dst[q] * 182); // Apparently this is a better number than 255 for the colour value - c.set(value, value, value); - getSurface()->drawPixel(q+0, yy, c); + for(UINT q = 0; q < Nd; q++) + { + value = (UINT)(dst[q] * 182); // Apparently this is a better number than 255 for the colour value + c.set(value, value, value); + mysurface->drawPixel(q+0, yy, c); + } } } - - -} - /* x6 + x + 1 -- 2.39.2