Skip to content

Commit

Permalink
(PS3) Hack around vec_mul not being supported for PS3 VMX/Altivec
Browse files Browse the repository at this point in the history
for now
  • Loading branch information
twinaphex committed Nov 6, 2012
1 parent fcf7539 commit 876bf69
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions audio/utils.c
Expand Up @@ -26,7 +26,11 @@ void audio_convert_s16_to_float_C(float *out,
{
gain = gain / 0x8000;
for (size_t i = 0; i < samples; i++)
#ifdef __CELLOS_LV2__
out[i] = (float)in[i] / 0x8000;
#else
out[i] = (float)in[i] * gain;
#endif
}

void audio_convert_float_to_s16_C(int16_t *out,
Expand Down Expand Up @@ -98,8 +102,14 @@ void audio_convert_s16_to_float_altivec(float *out,
vector signed short input = vec_ld(0, in);
vector signed int hi = vec_unpackh(input);
vector signed int lo = vec_unpackl(input);
#ifdef __CELLOS_LV2__
/* vec_mul not supported */
vector float out_hi = vec_ctf(hi, 15);
vector float out_lo = vec_ctf(lo, 15);
#else
vector float out_hi = vec_mul(vec_ctf(hi, 15), gain_vec);
vector float out_lo = vec_mul(vec_ctf(lo, 15), gain_vec);
#endif

vec_st(out_hi, 0, out);
vec_st(out_lo, 16, out);
Expand Down
4 changes: 2 additions & 2 deletions console/griffin/griffin.c
Expand Up @@ -229,11 +229,9 @@ RSOUND
/*============================================================
AUDIO UTILS
============================================================ */
#ifndef __CELLOS_LV2__
/* PS3 right now doesn't compile with the Altivec intrinsics
* used here */
#include "../../audio/utils.c"
#endif

/*============================================================
AUDIO
Expand Down Expand Up @@ -331,8 +329,10 @@ THREAD
============================================================ */
#ifdef HAVE_THREAD
#include "../../thread.c"
#ifdef ANDROID
#include "../../autosave.c"
#endif
#endif

/*============================================================
NETPLAY
Expand Down

0 comments on commit 876bf69

Please sign in to comment.