286
TI-Nspire / Re: TI-Nspire GB Emulator
« on: December 08, 2009, 07:49:44 am »
Nice work!
The truly correct way to do grayscaling is more complicated even than that:
Some people forget the gamma operations, which results in saturated colors ending up too dark.
Edit:The translator should work with anything, unless you either repeatedly store to memory that was previously used as code (which will slow it way down, since it wipes all translations on this kind of store - this could be improved), or store to memory that is ahead in the current basic block of code (very perverse thing to do in my opinion, I've seen it fail on real CPUs before ). If anything else broke it, I would like to hear about it...
Actually, I was able to get the Nspire emulator running in translated mode now since I changed a certain part of my code, and it runs... really fast. I don't think there should be any worries
Any reason you are using 16ths and 8ths instead of just 1/6th for all?Because that would require division. Eww.
The truly correct way to do grayscaling is more complicated even than that:
- Perform gamma expansion on all three channels. Gamma expansion is the non-linear relationship from video input signals (R', G', B') to the amount of energy emitted by the display (R, G, B). On a typical CRT monitor, this can be approximated with the power law x = x' ^ 2.2. (The Game Boy Color uses an LCD instead, so I don't know what the equation for it is.)
- Calculate the luminance. This is a weighted average of all three channels, which takes into account that the human eye is more sensitive to green light than red, and more sensitive to red than blue. The traditional formula is Y = 0.299R + 0.587G + 0.114B, but it really depends on the color space used on that particular display. (Not everyone agrees on just what "red", "green", and "blue" are.)
- Perform gamma compression, the inverse of gamma expansion.
Some people forget the gamma operations, which results in saturated colors ending up too dark.