From 9ee860c6d90ea059878c907584821f0410e1ec84 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 26 Jun 2015 19:15:17 +0200 Subject: [PATCH] Some more C89 fixes --- audio/drivers_resampler/cc_resampler.c | 11 ++++++----- libretro-common/gfx/scaler/scaler_int.c | 15 ++++++++------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/audio/drivers_resampler/cc_resampler.c b/audio/drivers_resampler/cc_resampler.c index 7509aad70b..10e72e149c 100644 --- a/audio/drivers_resampler/cc_resampler.c +++ b/audio/drivers_resampler/cc_resampler.c @@ -324,9 +324,10 @@ static void resampler_CC_upsample(void *re_, struct resampler_data *data) while (re->distance < 1.0) { - __m128 vec_w_previous; - __m128 vec_w_current; - __m128 vec_out; + __m128 vec_w_previous, vec_w_current, vec_out; +#if (CC_RESAMPLER_PRECISION > 0) + __m128 vec_ww1, vec_ww2; +#endif __m128 vec_w = _mm_add_ps(_mm_set_ps1(re->distance), _mm_set_ps(-2.0, -1.0, 0.0, 1.0)); @@ -338,8 +339,8 @@ static void resampler_CC_upsample(void *re_, struct resampler_data *data) vec_w2 = _mm_mul_ps(vec_w2, vec_b); #if (CC_RESAMPLER_PRECISION > 0) - __m128 vec_ww1 = _mm_mul_ps(vec_w1, vec_w1); - __m128 vec_ww2 = _mm_mul_ps(vec_w2, vec_w2); + vec_ww1 = _mm_mul_ps(vec_w1, vec_w1); + vec_ww2 = _mm_mul_ps(vec_w2, vec_w2); vec_ww1 = _mm_mul_ps(vec_ww1,_mm_sub_ps(_mm_set_ps1(3.0),vec_ww1)); diff --git a/libretro-common/gfx/scaler/scaler_int.c b/libretro-common/gfx/scaler/scaler_int.c index 73e9fe8943..32e9e39594 100644 --- a/libretro-common/gfx/scaler/scaler_int.c +++ b/libretro-common/gfx/scaler/scaler_int.c @@ -57,7 +57,7 @@ void scaler_argb8888_vert(const struct scaler_ctx *ctx, void *output_, int strid { int h, w, y; const uint64_t *input = ctx->scaled.frame; - uint32_t *output = (uint32_t*)output_; + uint32_t *output = (uint32_t*)output_; const int16_t *filter_vert = ctx->vert.filter; @@ -67,6 +67,7 @@ void scaler_argb8888_vert(const struct scaler_ctx *ctx, void *output_, int strid for (w = 0; w < ctx->out_width; w++) { + __m128i final; __m128i res = _mm_setzero_si128(); const uint64_t *input_base_y = input_base + w; @@ -87,10 +88,10 @@ void scaler_argb8888_vert(const struct scaler_ctx *ctx, void *output_, int strid res = _mm_adds_epi16(_mm_mulhi_epi16(col, coeff), res); } - res = _mm_adds_epi16(_mm_srli_si128(res, 8), res); - res = _mm_srai_epi16(res, (7 - 2 - 2)); + res = _mm_adds_epi16(_mm_srli_si128(res, 8), res); + res = _mm_srai_epi16(res, (7 - 2 - 2)); - __m128i final = _mm_packus_epi16(res, res); + final = _mm_packus_epi16(res, res); output[w] = _mm_cvtsi128_si32(final); } @@ -100,8 +101,8 @@ void scaler_argb8888_vert(const struct scaler_ctx *ctx, void *output_, int strid void scaler_argb8888_vert(const struct scaler_ctx *ctx, void *output_, int stride) { int h, w, y; - const uint64_t *input = ctx->scaled.frame; - uint32_t *output = (uint32_t*)output_; + const uint64_t *input = ctx->scaled.frame; + uint32_t *output = (uint32_t*)output_; const int16_t *filter_vert = ctx->vert.filter; @@ -253,9 +254,9 @@ void scaler_argb8888_point_special(const struct scaler_ctx *ctx, int in_width, int in_height, int out_stride, int in_stride) { + int h, w; const uint32_t *input = NULL; uint32_t *output = NULL; - int h, w; int x_pos = (1 << 15) * in_width / out_width - (1 << 15); int x_step = (1 << 16) * in_width / out_width; int y_pos = (1 << 15) * in_height / out_height - (1 << 15);