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 Coding > Calculating Interlaced Colors
2006-01-11 14:34
MRT
Account closed

Registered: Sep 2005
Posts: 149
Calculating Interlaced Colors

Maybe this should be in the pixeling forum, but it occurred to me that there might be some other coder who has done some image cross-converter and had the same problem...

How does one calculate the outcomming interlace colors, when mixing two (or more) native VIC colors

What I've done so far is adding the RGB values of color A to the RGB values of color B and then deviding the results by 2... but, when I display the interlaced colors on the C64 the outcome is not as I predicted...

So, simply adding all values and deviding them by 2 isn't the sollution.

Also, capturing an interlaced image and then sampling the result is also a no-no because there is no accurate way of capturing an interlaced image (as far as I know)

Anyone got some smart ideas for this?


2006-01-11 14:43
Graham
Account closed

Registered: Dec 2002
Posts: 990
There are multiple problems with that. For example there is a nonlinearity on display. An RGB value of $C0C0C0 is not twice as bright as $606060.
2006-01-11 14:50
MRT
Account closed

Registered: Sep 2005
Posts: 149
True... I found that out the hard way... :-)

For example...
The colors MedGray (12) and LightGray (15) are LESS bright then the mixed colors Black (0) and White (1)
2006-01-11 17:20
Twoflower

Registered: Jan 2002
Posts: 434
There's really only one way to find this out - by testing out the interlaced colors in practice, on both old and newer VIC's. A good way to see how it works is to do it on the real thing and make 2x2 chars squares with different interlaced colors and place them besides eachother. The good old eye will spot the differences in a flash. Since colors works so differently on the real thing with an oldfashioned TV or monitor, this is one of the things which are essential to check out on the real machine.

The colors will also differ depending on the technique of the interlacing. Often you'll find that the colors will be percieved different. I guess this have something to do with how PAL works or sth. Better ask Graham about it. :-)

I'm quite sure that this isn't of much help for you, but my point is that interlaced colors on the C64 are quite hard to "calculate". Just experience the mixes and make tables out of visual luminosity/color and use these. A good trick to use is the "make everything green" button, which atleast I have on my Philips monitor.
2006-01-11 19:09
MRT
Account closed

Registered: Sep 2005
Posts: 149
:-)

What if I told you I was color-blind... :-)

But still... If I could see all colors, then I would still need the RGB values if I want to use it for a cross-platform image converter.

Is the Project 1 tool also able to create interlaced images?
2006-01-11 20:09
Oswald

Registered: Apr 2002
Posts: 5094
P1 doesnt cares of lace colors. laced pics are handled as straight 320x200.
2006-01-11 23:28
A Life in Hell
Account closed

Registered: May 2002
Posts: 204
Quote: Maybe this should be in the pixeling forum, but it occurred to me that there might be some other coder who has done some image cross-converter and had the same problem...

How does one calculate the outcomming interlace colors, when mixing two (or more) native VIC colors

What I've done so far is adding the RGB values of color A to the RGB values of color B and then deviding the results by 2... but, when I display the interlaced colors on the C64 the outcome is not as I predicted...

So, simply adding all values and deviding them by 2 isn't the sollution.

Also, capturing an interlaced image and then sampling the result is also a no-no because there is no accurate way of capturing an interlaced image (as far as I know)

Anyone got some smart ideas for this?




The key is that one needs to do the colour mixing calculation in gamma-1.0 space, not the gamma 2.2 that a pal tv has (or is it 2.4... whatever). This is actually true of dithering as well, btw.

A quick paste from my conversion tool (note that you can do this in integer space, but you will lose quality!)

double palGamma=2.2;
double srcGamma=2.2;
#define dstGamma 1.0f

#define gamma(in) (pow(((in)/256.0), dstGamma/srcGamma)*256.0)
#define igamma(in) (pow(((in)/256.0), srcGamma/dstGamma)*256.0)


How I handle this in my conversion tool is by converting all RGB colours incoming from their appropriate gamma (I'm assuming 2.2, though i've heard 2.4 and 2.8 from other people) and doing all comparisons in that space - and it gives quite good results (look at http://dspaudio.com/~jaymz/miho-1.prg and http://dspaudio.com/~jaymz/miho-1a.prg for an example... eci mode, tho, which has odd colour limits, heh).

I probably should slap a UI on it and release it, but laziness, you know :)

One other note: You should do _all_ of your comparisons in the YUV space, not the RGB space - you will end up with much more accurate colour representation. This also allows you to have a luma:chroma tradeoff variable, which can assist on making some pictures come out as not grey blobs of mess :)
2006-01-12 08:53
Oswald

Registered: Apr 2002
Posts: 5094
hm never heard of gamma space, do you have still color information there ?
2006-01-12 10:35
chatGPZ

Registered: Dec 2001
Posts: 11386
another problem is that RGB is a different colorspace than what the C64 (or PAL for that matter) works in, so transforming the colors to YUV helps aswell. check http://hitmen.c02.at/html/yuvcolorspace.html for some basic info. also if you are writing a converter, using YUV for finding the closest C64 color gives a LOT better results than doing the same in RGB (find closest luminance, then choose one of two colors).

uhm. alih wrote the same. whatever :=D
2006-01-12 11:01
spinal
Account closed

Registered: Jan 2005
Posts: 47
Iv done some color mixing in the past (not with c64 though)

what i did, was minus color two's RGB from color one's RGB.
Hals the values, then add them to color one. This should give you the mixed version of those two colors.
2006-01-12 11:03
Graham
Account closed

Registered: Dec 2002
Posts: 990
PAL has a gamma of 2.8 (though in practice often ~2.5 is used)
NTSC has a gamma of 2.2
VGA has a gamma of 1.8
other displays often don't have any defined gamma value.

http://people.ee.ethz.ch/~buc/brechbuehler/mirror/color/GammaFA..
 
... 6 posts hidden. Click here to view all posts....
 
Previous - 1 | 2 - Next
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
Andy/AEG
csabanw
rambo/Therapy/ Resou..
Alakran_64
RetroGL
psenough
slimeysmine
Guests online: 112
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 The Demo Coder  (9.6)
6 Edge of Disgrace  (9.6)
7 What Is The Matrix 2  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.7)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 X-Mas Demo 2024  (9.5)
7 Dawnfall V1.1  (9.5)
8 Rainbow Connection  (9.5)
9 Onscreen 5k  (9.5)
10 Morph  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.3)
Top Swappers
1 Derbyshire Ram  (10)
2 Jerry  (9.8)
3 Violator  (9.7)
4 Acidchild  (9.7)
5 Cash  (9.6)

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