Vorbis ov_read causes floating point corruption on Intel?

Discuss macOS Audio in general and anything that doesn't fit elsewhere.
Post Reply
auday
Posts: 2
Joined: Mon Oct 10, 2011 10:08 pm

Vorbis ov_read causes floating point corruption on Intel?

Post by auday » Mon Oct 10, 2011 11:00 pm

Hi,

I'm implementing an OGG reader using the Vorbis lib. It works well on ARM processor (iOS) but causes problem on Intel (Mac OSX and iOS Simulator).

I'm not an Intel expert (my experience is PPC and ARM) but from some low level debugging, I found that after ov_read is called, the next time FLD instruction is used, anything it reads from memory (for example this value 0.458650142) it pushes it on the floating register stack as (nan). The next FLD instruction called works fine, it's just the first one after calling ov_read.


I also noticed that this is caused by ov_read using vorbis_fpu_setround and vorbis_fpu_restore, which seems to mess with the way the CPU is rounding from smaller precision floats to 80bit floats, and that's in line with what I see.

I was wondering if you've noticed anything like that?

Thanks,

Auday

auday
Posts: 2
Joined: Mon Oct 10, 2011 10:08 pm

Re: Vorbis ov_read causes floating point corruption on Intel

Post by auday » Tue Oct 11, 2011 3:35 am

Found the problem, it's a bug in Intel LLVM compiler/assembler on OSX, I posted my finds on stack overflow:

http://stackoverflow.com/questions/7721 ... r-to-crash

User avatar
sbooth
Site Admin
Posts: 2445
Joined: Fri Dec 23, 2005 7:45 am
Location: USA
Contact:

Re: Vorbis ov_read causes floating point corruption on Intel

Post by sbooth » Fri Oct 14, 2011 12:34 am

Well done! I hadn't even started looking at this yet, but it seems that your debugging-fu might be stronger than mine.

albertodegama
Posts: 1
Joined: Wed Dec 14, 2011 7:52 am
Contact:

Re: Vorbis ov_read causes floating point corruption on Intel

Post by albertodegama » Wed Dec 14, 2011 7:54 am

This reverts commit 0f6f2525f7b19c7de18bafe464b5ced1c714430a.
---

diff --git a/Android.mk b/Android.mk
deleted file mode 100644
index 637b949..0000000
--- a/Android.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES = \
- Tremolo/bitwise.c \
- Tremolo/codebook.c \
- Tremolo/dsp.c \
- Tremolo/floor0.c \
- Tremolo/floor1.c \
- Tremolo/floor_lookup.c \
- Tremolo/framing.c \
- Tremolo/mapping0.c \
- Tremolo/mdct.c \
- Tremolo/misc.c \
- Tremolo/res012.c \
- Tremolo/treminfo.c \
- Tremolo/vorbisfile.c \
- Tremolo/bitwiseARM.s \
- Tremolo/dpen.s \
- Tremolo/floor1ARM.s \
- Tremolo/mdctARM.s
-
-LOCAL_CFLAGS+= -O2
-
-ifeq ($(TARGET_ARCH),arm)
-LOCAL_CFLAGS+= -D_ARM_ASSEM_
-endif
-
-LOCAL_C_INCLUDES:= \
- $(LOCAL_PATH)/Tremolo
-
-LOCAL_ARM_MODE := arm
-
-LOCAL_MODULE := libvorbisidec
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/MODULE_LICENSE_BSD_LIKE b/MODULE_LICENSE_BSD_LIKE
deleted file mode 100644
index e69de29..0000000
diff --git a/NOTICE b/NOTICE
deleted file mode 100644
index 4a470cf..0000000
--- a/NOTICE
+++ /dev/null
@@ -1,372 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot] and 1 guest