Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Pixeling > PAL emulation algorithm
2010-02-22 19:57
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?
2010-02-22 20:25
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/




2010-02-22 21:10
Ed

Registered: May 2004
Posts: 173
@Groepaz: Your results looks very promising!
2010-02-22 21:11
Oswald

Registered: Apr 2002
Posts: 5017
wow, awesome job there groppie, especially the 3x screens :)
2010-02-22 21:12
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)
2010-02-23 01:24
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 =)


2010-02-23 15:12
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...
;)
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Majikeyric
Nordischsound/Hokuto..
Slaxx/Q/HF/MYD!
Menace/Spaceballs
Guests online: 88
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Bromance  (9.6)
10 Memento Mori  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Onscreen 5k  (9.5)
8 Wafer Demo  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Crackers
1 Mr. Z  (9.9)
2 S!R  (9.9)
3 Antitrack  (9.8)
4 Mr Zero Page  (9.8)
5 OTD  (9.8)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.171 sec.