aboutsummaryrefslogtreecommitdiff
path: root/fmdsp/fmdsp-vramlookup-c.c
diff options
context:
space:
mode:
authorTakamichi Horikawa <takamichiho@gmail.com>2017-04-01 14:53:59 +0900
committerTakamichi Horikawa <takamichiho@gmail.com>2017-04-01 14:53:59 +0900
commit24225349831278c23c6dfc4515e071f4b27b2c41 (patch)
tree35a853f7f35a53560a5b1bcfd5eda3213990b872 /fmdsp/fmdsp-vramlookup-c.c
parent5460067b61f86843a0435ebb06a6ebb8223c3dca (diff)
add sse2/ssse3 simd optimization
Diffstat (limited to 'fmdsp/fmdsp-vramlookup-c.c')
-rw-r--r--fmdsp/fmdsp-vramlookup-c.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/fmdsp/fmdsp-vramlookup-c.c b/fmdsp/fmdsp-vramlookup-c.c
index f900c8d..3d06f71 100644
--- a/fmdsp/fmdsp-vramlookup-c.c
+++ b/fmdsp/fmdsp-vramlookup-c.c
@@ -1,14 +1,17 @@
#include "fmdsp/fmdsp.h"
void fmdsp_vramlookup_c(uint8_t *vram32, const uint8_t *vram, const uint8_t *palette, int stride) {
+ uint32_t palette32[FMDSP_PALETTE_COLORS];
+ for (int i = 0; i < FMDSP_PALETTE_COLORS; i++) {
+ uint8_t r = palette[i*3+0];
+ uint8_t g = palette[i*3+1];
+ uint8_t b = palette[i*3+2];
+ palette32[i] = (((uint32_t)r)<<16) | (((uint32_t)g)<<8) | ((uint32_t)b);
+ }
for (int y = 0; y < PC98_H; y++) {
for (int x = 0; x < PC98_W; x++) {
- uint8_t r = palette[vram[y*PC98_W+x]*3+0];
- uint8_t g = palette[vram[y*PC98_W+x]*3+1];
- uint8_t b = palette[vram[y*PC98_W+x]*3+2];
- uint32_t data = (((uint32_t)r)<<16) | (((uint32_t)g)<<8) | ((uint32_t)b);
uint32_t *row = (uint32_t *)(vram32 + y*stride);
- row[x] = data;
+ row[x] = palette32[vram[y*PC98_W+x]];
}
}
}