diff options
author | neonloop | 2021-08-07 20:28:34 +0000 |
---|---|---|
committer | neonloop | 2021-08-07 20:28:34 +0000 |
commit | 8ad26356f5e92bd396e58290217da55858345a4e (patch) | |
tree | 8c08b9e62f36170e36514a4d1f397990e881104e /plat_sdl.c | |
parent | b148bcce05254c7ebe0ad855e5f1e958968a0bb9 (diff) | |
download | picoarch-8ad26356f5e92bd396e58290217da55858345a4e.tar.gz picoarch-8ad26356f5e92bd396e58290217da55858345a4e.tar.bz2 picoarch-8ad26356f5e92bd396e58290217da55858345a4e.zip |
Adds generic nearest and smooth scalers
Smooth is slower (10-15%) than a scaler built for a specific
resolution. Works well for downscaling and for odd screen ratios until
a custom scaler is built.
Replaces the snes smooth scaler (outperforms it) and the gba smooth
scaler (looks better)
Diffstat (limited to 'plat_sdl.c')
-rw-r--r-- | plat_sdl.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -9,9 +9,9 @@ static SDL_Surface* screen; struct audio_state { - int buf_w; - int max_buf_w; - int buf_r; + unsigned buf_w; + unsigned max_buf_w; + unsigned buf_r; size_t buf_len; struct audio_frame *buf; int freq; @@ -37,14 +37,14 @@ static int audio_resample_nearest(struct audio_frame data) { static int diff = 0; int consumed = 0; - if (diff <= 0) { + if (diff < audio.out_sample_rate) { audio.buf[audio.buf_w++] = data; if (audio.buf_w >= audio.buf_len) audio.buf_w = 0; diff += audio.in_sample_rate; } - if (diff > 0) { + if (diff >= audio.out_sample_rate) { consumed++; diff -= audio.out_sample_rate; } |