2 Copyright 2006 Chris Tallon
\r
4 This file is part of VOMP.
\r
6 VOMP is free software; you can redistribute it and/or modify
\r
7 it under the terms of the GNU General Public License as published by
\r
8 the Free Software Foundation; either version 2 of the License, or
\r
9 (at your option) any later version.
\r
11 VOMP is distributed in the hope that it will be useful,
\r
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 GNU General Public License for more details.
\r
16 You should have received a copy of the GNU General Public License
\r
17 along with VOMP; if not, write to the Free Software
\r
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
\r
31 UINT Wwss::gcd(UINT a, UINT b)
\r
43 UINT Wwss::lcm(UINT a, UINT b)
\r
45 return (a / gcd(a, b)) * b;
\r
48 void Wwss::setWide(bool twide)
\r
55 // The aspect43 and aspect169 codes are not what they should be according to the docs, but these are what work...
\r
56 // (1 = 111000, = 0 000111)
\r
57 static UCHAR runIn[] = {1,1,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1}; // 29 pos 0
\r
58 static UCHAR startCode[] = {0,0,0,1,1,1,1,0,0,0,1,1,1,1,0,0,0,0,0,1,1,1,1,1}; // 24 pos 29
\r
59 static UCHAR aspect43[] = {0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0}; // = 0001 4:3 full frame // 24 pos 53
\r
60 static UCHAR aspect169[] = {1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,1,1,1}; // = 1110 16:9 anamorphic // 24 pos 53
\r
61 static UCHAR theRest[] = {0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1, // 60 pos 77
\r
62 0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,
\r
63 0,0,0,1,1,1,0,0,0,1,1,1};
\r
65 Real PAL pixel frequency: 13.5 MHz
\r
66 WSS element frequency: 5 MHz
\r
67 = 2.7 pal pixels per wss element
\r
68 * 137 wss elements = 369.9 pal pixels (total code width) (round to 370..)
\r
70 There is also a 11us gap at the start of the pal raster, but since I don't really have any
\r
71 idea where our 720 pixels start in the raster I can't calculate an offset.
\r
73 PAL line 23 seems to be MVP line 6.
\r
76 const UINT Ns = 137; // Num pix src
\r
77 const UINT Nd = 370; // Num pix dst 359->395 does something. not the right thing, but something.
\r
78 UINT Nl = lcm(Ns, Nd); // Num pix in lcm
\r
79 UINT Ss = Nl / Ns; // Source split (how many lcm px = 1 src px)
\r
80 UINT Sd = Nl / Nd; // Dst split
\r
83 memcpy(&src[0], runIn, 29);
\r
84 memcpy(&src[29], startCode, 24);
\r
85 if (wide) memcpy(&src[53], aspect169, 24);
\r
86 else memcpy(&src[53], aspect43, 24);
\r
87 memcpy(&src[77], theRest, 60);
\r
92 for(UINT t = 0; t < Nd; t++) // for every destination pixel
\r
95 for(UINT lcmpx = lcmpxbase; lcmpx < (lcmpxbase + Sd); lcmpx++)
\r
97 if (src[lcmpx / Ss]) dst[t] += (float)1/Sd;
\r
104 for(UINT q = 0; q < Nd; q++)
\r
106 value = (UINT)(dst[q] * 182); // Apparently this is a better number than 255 for the colour value
\r
107 c.set(value, value, value);
\r
108 drawPixel(q, 6, c);
\r