| |
Carrion
Registered: Feb 2009 Posts: 317 |
PAL emulation algorithm
I'm working on a small tool (I'll unveil details soon) which I plan will have PAL preview option.
Right now I do "PAL preview" as follows:
- image set to 640x400 px
- blending two exactly same layers where second one is scrolled one pixel to left and opacity set to 50%
+ third layer with black lines and opacity set to 50%
well it more or less gives kind of PAL emulation but I came with that by experimenting.
I just wonder how to do "real PAL emulated" preview. How vice does? How timanthes does it? any ideas/teories? |
|
| |
chatGPZ
Registered: Dec 2001 Posts: 11111 |
this is completely wrong :) its not that trivial by far. (you can verify that your "pal emulation" doesnt work by eg trying the "play with colors" demos from wrath designs)
this is what vice does:
- generate a 16 colors vic palette in YUV colorspace (refer to peptos article)
the pal "encoding" process:
- convert the picture to YUV using that palette. in the process, limit the bandwidth of Y and UV. (apply some horizontal blur, about 1.5 pixels for Y, about 3 to 4 pixels for UV)
- in odd lines, the sign of the U component is inverted (phase shifted by 180 degress)
the pal "decoding" process:
- the color (UV) component is mixed with that of the previous line
- since the U component is phase shifted every other line, this must be undone. at this point an error is introduced, which as a result causes different alternating lines resulting in different mix colors (696969 vs 969696 - look at the "play with colors" demos)
the last step is applying the "scanline" effect, which has nothing to do with pal emulation at all, its just black lines (or slightly darker lines, linearly interpolated between the line above and under it)
and at the very end, convert to RGB, and apply gamma correction.
that said, i am just right now working on a more accurate pal emulation for vice, see some first results here: http://hitmen.c02.at/temp/palstuff/
|
| |
Ed
Registered: May 2004 Posts: 173 |
@Groepaz: Your results looks very promising! |
| |
Oswald
Registered: Apr 2002 Posts: 5017 |
wow, awesome job there groppie, especially the 3x screens :) |
| |
Mirage
Registered: Jan 2003 Posts: 113 |
Timanthes pal emulation code
This should show you what i'm doing to render the preview window in timanthes (rgb->yuv->rgb/double size/double scan/pal emu) |
| |
chatGPZ
Registered: Dec 2001 Posts: 11111 |
btw, i will post the code for this in some days (needs cleanup and all the boring stuff...), right now its pretty much a standalone filter that should be useable for all kinds of "preview" things (its too slow for realtime use in emulation, because its not optimized at all right now)
also, if you can think of an effect not described on the page yet, or if you can point me to some picture that doesnt look right in the current pal emulation in vice.... speak up :) i am still looking for one that shows/demonstrates "dot creep" (i dont even yet fully understand what gfx people mean by that =P).
Quote:especially the 3x screens
hehe. i was surprised how well my theory worked out on these myself. it almost resembles *exactly* what my monitor displays :) the only thing left to simulate would be *really* computing intense stuff like blooming and white smear. maybe something for 2020 =)
|
| |
Sasq
Registered: Apr 2004 Posts: 155 |
Why not build a small device with a video out and a video grabber connected to each other, so an emulator could just write the image to it and get back a distorted version for display - It could have controls for how much interference to add etc...
;)
|