1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Added workarounds for an internal compiler error bug on armeabi Android

This commit is contained in:
hogliux 2017-03-08 10:23:13 +00:00
parent 279c4bc4db
commit 80a226204a
2 changed files with 15 additions and 0 deletions

View file

@ -1922,9 +1922,16 @@ long ov_read_filter(OggVorbis_File *vf,char *buffer,int length,
vorbis_fpu_setround(&fpu);
for(j=0;j<samples;j++)
for(i=0;i<channels;i++){
// Workaround for an ndk armeabi compiler bug which crashes on signed saturation
#ifdef ANDROID
float f = pcm[i][j];
f = (f <= 1.0f ? (f >= -1.0f ? f : -1.0f) : 1.0f);
val = vorbis_ftoi(f * 128.f);
#else
val=vorbis_ftoi(pcm[i][j]*128.f);
if(val>127)val=127;
else if(val<-128)val=-128;
#endif
*buffer++=val+off;
}
vorbis_fpu_restore(fpu);

View file

@ -41,8 +41,16 @@ struct AudioThumbnail::MinMaxValue
inline void setFloat (Range<float> newRange) noexcept
{
// Workaround for an ndk armeabi compiler bug which crashes on signed saturation
#if JUCE_ANDROID
Range<float> limitedRange (jlimit (-1.0f, 1.0f, newRange.getStart()),
jlimit (-1.0f, 1.0f, newRange.getEnd()));
values[0] = (int8) (limitedRange.getStart() * 127.0f);
values[1] = (int8) (limitedRange.getEnd() * 127.0f);
#else
values[0] = (int8) jlimit (-128, 127, roundFloatToInt (newRange.getStart() * 127.0f));
values[1] = (int8) jlimit (-128, 127, roundFloatToInt (newRange.getEnd() * 127.0f));
#endif
if (values[0] == values[1])
{