mirror of
https://github.com/libretro/RACE.git
synced 2026-10-18 14:35:00 +00:00
master
The dark-filter palette LUT precompute (palette_init16, dark_filter_level > 0) used a float normalize->darken->rescale roundtrip for what is an integer 4-bit-per-gun color system. The float was confined to this cosmetic, non-hardware filter and never touched a per-pixel path, but it made the generated palette non-reproducible across compilers/ABIs (rounding order, FMA contraction) and pulled FP into a precompute that has no need of it. Replace darken_rgb() with darken_channel(), an exact-rational round-half-up form in Q14 fixed point (BT.601 weights 4899/9617/1868, sum == 1<<14). The [0,1] normalize and *15 rescale cancel algebraically, so the per-channel result is round(c * (1 - (level/100)*lumasum/((1<<14)*15))) with the dark_factor<0 clamp preserved as an early-out to black. Empirically swept against the prior float path over all 100*16*16*16 (level,r,g,b) combinations: 65 of 1,228,800 outputs differ, all by <=1 on a 4-bit gun. Each disagreement is a half-LSB straddle where float32 accumulation lands just under x.5 (e.g. green 14.49995 at level 5, color 4,15,0); the exact-rational form is the more correct result there. All intermediates fit signed 32-bit (max 737,280,000), so MSVC C89 safe with no 64-bit dependency. objdump confirms zero FP instructions in palette_init16.
RACE-NGPC-Emulator-PSP
This is the RACE NGPC emulator modified by "theelf" to run on the PSP. It is likely forked from the Akop Karapetyan PSP version of RACE (http://psp.akop.org/race).
Languages
C
73.1%
Assembly
18.4%
C++
5.9%
Makefile
1.5%
Pawn
1.1%