[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NTSC's Three Dots Per One Pixel



Bryan Parkoff wrote:

>"Michael J. Mahon" <mjmahon@aol.com> wrote in message
>20040626202439.12238.00000767@mb-m01.aol.com">news:20040626202439.12238.00000767@mb-m01.aol.com...

<snip>

>> I didn't bother to invert the RGB-to-YIQ matrix an earlier respondent
>> supplied, but I did happen to come across an YCrCb-to-RGB matrix.
>> There are various such matrices dependent on exact color models,
>> but this is one typical of TV (with all components from 0..256):
>>
>> R = 1.164*(Y-16) + 1.596*(Cr-128)
>> G = 1.164*(Y-16) - 0.813*(Cr-128)-0.392*(Cb-128)
>> B = 1.164*(Y-16) +2.017*(Cb-128)
>>
>> Note that the Cr and Cb values are excess-128 signed, while the
>> Y values are absolute.  Also note that in TV signals, there is a
>> luminance "setup" of 16 units to provide margin for the blanking
>> signals to be "blacker than black".
>
>    I agree with you that one pixel is stretched to cover mask holes on
>Apple NTSC Monitor.  I have no idea why stretching pixel is done that it
>looks like 5 dots (mask hole) for violet and green color and 6 dots (mask
>hole) for white color.

For one thing, white is only produced in Apple II video by the
illumination of two _adjacent_ pixels, each having "complementary"
colors in the IQ colorspace--that is with 180 degree phase
difference, such as green-violet, or blue-orange.

>    I have put violet color and green color into YIQ.
>
>    Look at my example.
>
>Y = 0.299(221) + 0.587(0) + 0.114(221) --> 91
>I = 0.596(221) - 0.274(0) - 0.322(221) --> 61
>Q = 0.211(221) - 0.523(0) + 0.312(221) --> 116
>Violet
>
>Y = 0.299(0) + 0.587(221) + 0.114(0) --> 130
>I = 0.596(0) - 0.274(221) - 0.322(0) --> 61
>Q = 0.211(0) - 0.523(221) + 0.312(0) --> 116
>Green

There is something wrong here.  Violet and green are complementary,
but your conversion has them differing only in luminance--like dark green
and light green.  (Also, you are converting _into_ YIQ space from RGB,
when I thought you wanted to convert in the other direction.)

>    The problem is that SVGA has RGB 24 Bits per pixel.  Red is 8 Bit, Green
>is 8 Bit, and Blue is 8 Bit.  Each pixel contains four bytes into video
>memory before it can display in SVGA screen.  I can't figure that Y should
>be in Red byte, I should be in Green byte, and Q should be in Blue byte.  It
>does not work that way.
>    It is why I have to create color palette for YIQ so color palette for
>YIQ is always in RGB 24 Bits.  Do you know what I mean?

You are doing it backwards.  You need to convert from the YIQ space to
the RGB space if you want RGB pixels.  The usual formulas work with
8-bit representations of the components, so they naturally produce
24-bit pixel values.

If you want to "emulate" Apple NTSC video on a high resolution screen,
I'd suggest using DSP techniques to filter the chroma signal from the
Apple video signal (a signal which is either 0 or 255), with appropriate
bandpass filtering, quadrature demodulation, and subsequent matrixing
into RGB.  Perhaps this is what you are intending.

If you don't understand digital filtering, demodulation, etc., then you
will need to read up on this.  (Perhaps MAME has already done the
job, but I haven't looked at it.)

-michael

Check out amazing quality sound for 8-bit Apples on my
Home page:  http://members.aol.com/MJMahon/