1
0
Fork 0
forked from len0rd/rockbox

duke3d: further optimize audio mixing

Rather than holding intermediate results as fixed-point, this converts them
directly to normal integers (in the range of the PCM sample) while mixing,
instead of waiting till the end to perform a separate shifting step. Also,
this precalculates some constants in the reverb code.

Change-Id: Ie04e444d145bc28ce67eef9ae0ead6d328acf28a
This commit is contained in:
Franklin Wei 2018-01-05 17:25:03 -05:00
parent 69ff35ac49
commit cf07bb328d
5 changed files with 65 additions and 52 deletions

View file

@ -1368,9 +1368,13 @@ int VBE_setPalette(uint8_t *palettebuffer)
memcpy(lastPalette, palettebuffer, 768);
for (i = 0; i < 256; i++){
sdlp->b = (Uint8) ((((float) *p++) / 63.0) * 255.0);
sdlp->g = (Uint8) ((((float) *p++) / 63.0) * 255.0);
sdlp->r = (Uint8) ((((float) *p++) / 63.0) * 255.0);
/* doesn't map perfectly */
sdlp->b = (Uint8) (*p << 2) | (*p >> 4);
p++;
sdlp->g = (Uint8) (*p << 2) | (*p >> 4);
p++;
sdlp->r = (Uint8) (*p << 2) | (*p >> 4);
p++;
sdlp->unused = *p++; /* This byte is unused in BUILD, too. */
sdlp++;
}