Browse Source

Added workarounds for an internal compiler error bug on armeabi Android

tags/2021-05-28
hogliux 8 years ago
parent
commit
80a226204a
2 changed files with 15 additions and 0 deletions
  1. +7
    -0
      modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.2/lib/vorbisfile.c
  2. +8
    -0
      modules/juce_audio_utils/gui/juce_AudioThumbnail.cpp

+ 7
- 0
modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.2/lib/vorbisfile.c 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);


+ 8
- 0
modules/juce_audio_utils/gui/juce_AudioThumbnail.cpp 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])
{


Loading…
Cancel
Save