-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_snesify.txt
40 lines (26 loc) · 2.02 KB
/
_snesify.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
These are just my notes to myself. Pay no mind.
Defaults
--------
I'm thinking these might be sensible defaults:
* 2bit: vanilla unseeded k-means
* 4bit: mini-batch unseeded k-means
* scan16: vanilla unseeded k-means
* 8bit: median-cut
In particular, seeding doesn't seem to speed up processing with mini-batch except for scan16.
Gamma
-----
NB: the Lenna test image may not be gamma-corrected. It should have an input gamma of 1.0.
There are two different gamma issues:
* The SNES/TV has a higher gamma; using the raw RGB values may result in an image that's too dark.
* Gamma affects dithering. Dithering should be applied to a linear RGB image (or equivalent).
What we should do is specify an input gamma (defaulting to 2.2) and an output gamma (defaulting to whatever is appropriate for the SNES). Our conversion program first converts the image to linear RGB (i.e. applying gamma correction of 0.45 if the input gamma was 2.2), then when we're done, the output gamma is applied to the palette's RGB values.
Taking a screenshot from BSNES and adjusting the gamma in GIMP by 1.5 seems to reproduce the original gamma. The proper adjustment value might be anywhere from 1.5 to 1.8. Assuming the proper adjustment value is 1.5, then the SNES's gamma is 2.2 * 1.5 = 3.3. (I've tried using the higan sources to find the proper gamma value, but the gamma ramp I found starts out exponential and then goes strangely linear.)
Dithering
---------
http://bisqwit.iki.fi/story/howto/dither/jy/ (Knoll-Yliluoma)
Color space
-----------
Using the Lab color space during the conversion may yield better results than using RGB, since Euclidean distance is supposed to line up better with human perception in that color space.
A crazy idea for a scan16 variant
---------------------------------
16 colors per scanline, but using 2bpp with 4 palettes. This halves the size of the chr data, though the namedata (1.75 KB) has to be transferred for every frame. This would allow larger animations or higher frame rates than standard scan16 at the expense of image quality.