Lua palette quantization#802
Conversation
|
Definitely seeing some improvements by switching away from the green channel rods n' cones biasing thing. When I completely turn off the color caching and run this test script, there is a noticeable performance hit when turboing. I'd say it goes from 25x to 10x speed. As such, I changed the color cache to 5 bits per channel and it seems fine... But I'm still a bit leery, so I might make a Lua API that can turn this on and off just in case 5 bits still makes things weird. Here are some comparison results. Hopefully it's not too hard to see. With the green bias, the ghosts get kind of yellowy when they stack up. 3-bit green bias (the ways things are in master) 3bit-green_bias.mp4no cache euclid (best results, noticeable performance dip when turboing) no_cache-euclid.mp45-bit Euclid 5bit-euclid.mp43 bit euclid 3bit-euclid.mp4no cache green bias no_cache-green_bias.mp4 |
|
Looks like you guys have been busy with the Mac build scripts. I'll go ahead and rebase. |
Just want to see what happens. If the performance sucks, I'll try it with 5 or 6 bits. If the difference is negligible, I'll remove it properly.
I added this for testing purposes; you might find it useful, too. I imagine I'm going to revert this before merging.
64836be to
5fecb6e
Compare
|
@zeromus @bbbradsmith |
|
why does the cache get wacky? I can't imagine why something like that would happen. if there's an explanation for it I might accept it, but otherwise it seems like a bug-in-waiting. that would seem to be the only blemish on here (I don't mind keeping the algorithm picker for old-video compatibility or better blazing performance) |
|
The cache gets wacky because the colorspace regions are too broad. It stores the first color it happened to encounter in any given region, so over time, you end up with some strange mismatches. By changing it to use the upper 5 bits, the regions get tightened up and it's still just as fast. That's what I was trying to convey with those pretty rainbow squares. Since the same problem is technically still here (just less obvious), things might still look a little off. That's why I wanted to make |
|
I don't understand. The goal here is to figure out which palette entries to use when drawing translucent stuff because for some godforsaken reason we're still doing lua drawing in a layer with paletted colorspace? |
|
Right. I wouldn't even know where to start rewriting that... I guess you could pass around an extra 32-bit buffer through How about some shitty paint.net diagrams? But if we happened to encounter A first, then this whole region would be cached to A', which would definitely not look right no matter what matching formula we used. |
|
The presumption is that A' and B' are both "not off by more than 1" good approximations for both A and B. It's implicit in the binning design. This sounds like normal situation, not a defect. If the results aren't visually appealing then the parameters are too coarse. IMO it's an impossible problem so one result or another will always be visually unappealing. This is what dithering is for, though I don't think it's desirable output in this case. I think I would rather see a lua api that sets the coarseness (and hence memory usage and somewhat the performance implications both at runtime and startup) rather than something to rejigger the cache because I just can't see how anyone would use the latter in practice. As I'm sure you know by now, it would be better to fix the junky old code so it doesn't need to mix and output in NES indexed-color space.... I would hazard a guess, the only reason this has never been done is that it wasn't important enough to anyone to have sensibly-colored lua overlays. As long as it was fine as junk then the junky results were fine. If you need something artistically beautiful and smooth, then the time has come to smash the whole presentation pipeline |
I'm with you. I believe I've fixed that by setting it to 5 bits per channel.
Sure. It should probably also have a mode to disable caching entirely and take that performance hit, which is what I was really trying to achieve with
Yeah... No way I could achieve something like that on my own, though. At one point I saw you guys had plans to migrate to DX9; I figure it could be a part of that initiative. |










Don't mind me, just using your appveyor to avoid setting up Visual Studio on my new PC :)