kleopatra999 / webm

Automatically exported from code.google.com/p/webm
0 stars 0 forks source link

Unaligned access on ARM in vp8_sixtap_predict4x4_neon #817

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What is the expected behavior? What do you see instead?

When running libvpx master on iOS with NEON support, I occasionally get an 
unaligned access in vp8_sixtap_predict4x4_neon.

What version are you using? On what operating system?

Commit 1fc2b0fd00d4ba17bec8c89aa6eab503d77a3eed on iOS. libvpx was compiled 
with the following flags: 

--enable-pic --enable-postproc --enable-realtime-only --enable-vp9 
--enable-multi-res-encoding --enable-temporal-denoising 
--enable-error-concealment --disable-install-srcs --disable-unit-tests 
--disable-install-docs --disable-examples

Can you reproduce using the vpxdec or vpxenc tools? What command line are
you using?

I have not tried the commandline tools on device.

Please provide any additional information below.

 I've created a simple test case that reproduces the issue, and I'm attaching the iOS project. The project includes a statically built libvpx, so it should run as-is.

Original issue reported on code.google.com by tomtheen...@gmail.com on 23 Jun 2014 at 8:57

Attachments:

GoogleCodeExporter commented 9 years ago
Tom - you've been doing some ios things. Can you repro?

Original comment by johannko...@google.com on 17 Jul 2014 at 6:49

GoogleCodeExporter commented 9 years ago
My test app is decode only (for now, anyway). This is encoding, isn't it?

Anyway, @tomtheengineer: I'm unable to run this project because I don't have an 
armv7 iOS device (I have only armv7s and arm64). Would you mind updating your 
test case to use VPX.framework?

To create VPX.framework:

1. Clone a recent libvpx
2. Make a directory somewhere
3. /path/to/libvpx/build/make/iosbuild.sh
-- This will produce VPX.framework, which includes all libvpx targets necessary 
for currently existing iDevices and the simulators

The only departure from typical libvpx usage is the include paths. Instead of 
including "vpx/vpxinclude.h", you include "VPX/vpx/vpxinclude.h".

Original comment by tomfine...@google.com on 17 Jul 2014 at 9:07

GoogleCodeExporter commented 9 years ago
The armv7 instruction set should be supported on the 3GS through 5s: 
http://en.wikipedia.org/wiki/List_of_iOS_devices

The entirety of the code is in vp8_arm_alignment_bug in AppDelegate.m and it 
only calls vp8 decode functions.

Original comment by tomtheen...@gmail.com on 17 Jul 2014 at 9:31

GoogleCodeExporter commented 9 years ago
Perhaps this is a situation that's occurring because I'm working with 
non-jailbroken iDevices and running directly from xcode:

At any rate, I'm not able to build your test project (and I also have the 
selfish ulterior motive of wanting someone else to try VPX.framework). Error 
output:

iphone 5s/arm64:
ld: warning: ignoring file /Users/tomfinegan/Downloads/vp8 arm alignment 
bug/libvpx/lib/libvpx.a, file was built for archive which is not the 
architecture being linked (arm64): /Users/tomfinegan/Downloads/vp8 arm 
alignment bug/libvpx/lib/libvpx.a
Undefined symbols for architecture arm64:
  "_vpx_codec_vp8_dx", referenced from:
      -[AppDelegate vp8_arm_alignment_bug] in AppDelegate.o
  "_vpx_codec_dec_init_ver", referenced from:
      -[AppDelegate vp8_arm_alignment_bug] in AppDelegate.o
  "_vpx_codec_decode", referenced from:
      -[AppDelegate vp8_arm_alignment_bug] in AppDelegate.o
  "_vpx_codec_get_frame", referenced from:
      -[AppDelegate vp8_arm_alignment_bug] in AppDelegate.o
  "_vpx_codec_destroy", referenced from:
      -[AppDelegate vp8_arm_alignment_bug] in AppDelegate.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

iphone 5c/armv7s:
ld: warning: ignoring file /Users/tomfinegan/Downloads/vp8 arm alignment 
bug/libvpx/lib/libvpx.a, file was built for archive which is not the 
architecture being linked (armv7s): /Users/tomfinegan/Downloads/vp8 arm 
alignment bug/libvpx/lib/libvpx.a
Undefined symbols for architecture armv7s:
  "_vpx_codec_vp8_dx", referenced from:
      -[AppDelegate vp8_arm_alignment_bug] in AppDelegate.o
  "_vpx_codec_dec_init_ver", referenced from:
      -[AppDelegate vp8_arm_alignment_bug] in AppDelegate.o
  "_vpx_codec_decode", referenced from:
      -[AppDelegate vp8_arm_alignment_bug] in AppDelegate.o
  "_vpx_codec_get_frame", referenced from:
      -[AppDelegate vp8_arm_alignment_bug] in AppDelegate.o
  "_vpx_codec_destroy", referenced from:
      -[AppDelegate vp8_arm_alignment_bug] in AppDelegate.o
ld: symbol(s) not found for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Not bothering with ipad air output since it's the same as the iphone 5s.

Original comment by tomfine...@google.com on 17 Jul 2014 at 9:40

GoogleCodeExporter commented 9 years ago
I can reproduce the problem after updating your project to use the framework.

Updated project and framework attached in case anyone wants them.

Original comment by tomfine...@google.com on 17 Jul 2014 at 9:45

Attachments:

GoogleCodeExporter commented 9 years ago
I'm also using non-jailbroken devices. ;)

It looks like my project was configured to build the following architectures: 
"arm64 armv7 armv7s", but the static libvpx I included was only armv7. You can 
change the target architectures under "Build Settings" in the project.

Original comment by tomtheen...@gmail.com on 17 Jul 2014 at 9:48

GoogleCodeExporter commented 9 years ago
Ok, I lied: I cannot reproduce this.

I've modified your project to call vp8_arm_alignment_bug() 10000 times in a 
loop, and I cannot reproduce an error. 

Regarding this:

> I can reproduce the problem after updating your project to use the framework.

I was thrown off by test target output in the xcode console. Sorry.

Original comment by tomfine...@google.com on 17 Jul 2014 at 9:58

GoogleCodeExporter commented 9 years ago
Can you try it with the static libvpx that I included in the original project? 
(You can modify the target architectures in the project to only build for armv7 
as I described in #5)

Original comment by tomtheen...@gmail.com on 17 Jul 2014 at 10:04

GoogleCodeExporter commented 9 years ago
In addition to removing armv7s and arm64 ONLY_ACTIVE_ARCH must not be set to 
YES.

Now I can reproduce: with your lib and using the armv7 lib that would have been 
within the framework.

Thread 1, Queue : com.apple.main-thread
#0  0x0003dd46 in vp8_sixtap_predict4x4_neon ()
#1  0x0003b358 in build_inter_predictors_b ()
#2  0x0003ae32 in vp8_build_inter_predictors_mb ()
#3  0x000447bc in vp8_decode_frame ()
#4  0x0004590a in vp8dx_receive_compressed_data ()
#5  0x0003fbb2 in vp8_decode ()
#6  0x00039a9e in vpx_codec_decode ()
#7  0x00038c74 in -[AppDelegate vp8_arm_alignment_bug] at 
/Users/tomfinegan/Downloads/vp8 arm alignment bug/vp8 arm alignment 
bug/AppDelegate.mm:372
#8  0x00038d9e in -[AppDelegate application:didFinishLaunchingWithOptions:] at 
/Users/tomfinegan/Downloads/vp8 arm alignment bug/vp8 arm alignment 
bug/AppDelegate.mm:383
#9  0x321a3ca0 in -[UIApplication 
_handleDelegateCallbacksWithOptions:isSuspended:restoreState:] ()
#10 0x321a35f2 in -[UIApplication 
_callInitializationDelegatesForURL:payload:suspended:] ()
#11 0x3219dca8 in -[UIApplication 
_runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] ()
#12 0x32139c76 in -[UIApplication handleEvent:withNewEvent:] ()
#13 0x32138dd8 in -[UIApplication sendEvent:] ()
#14 0x3219d3e4 in _UIApplicationHandleEvent ()
#15 0x347a6b54 in _PurpleEventCallback ()
#16 0x347a673e in PurpleEventCallback ()
#17 0x2f8cd806 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#18 0x2f8cd7a2 in __CFRunLoopDoSource1 ()
#19 0x2f8cbf6e in __CFRunLoopRun ()
#20 0x2f836728 in CFRunLoopRunSpecific ()
#21 0x2f83650a in CFRunLoopRunInMode ()
#22 0x3219c60a in -[UIApplication _run] ()
#23 0x32197870 in UIApplicationMain ()
#24 0x00039980 in main at /Users/tomfinegan/Downloads/vp8 arm alignment bug/vp8 
arm alignment bug/main.m:16

Original comment by tomfine...@google.com on 17 Jul 2014 at 10:28

GoogleCodeExporter commented 9 years ago
Thanks for setting up the repro. I'll look into this next week.

Original comment by johannko...@google.com on 17 Jul 2014 at 10:48

GoogleCodeExporter commented 9 years ago

Original comment by johannko...@google.com on 17 Jul 2014 at 10:48

GoogleCodeExporter commented 9 years ago
you probably want to disable this function for the time being while you 
investigate. it'd be great if we could get a repro case on non-iOS hardware too

Original comment by jz...@google.com on 18 Jul 2014 at 1:31

GoogleCodeExporter commented 9 years ago

Original comment by johannko...@google.com on 6 Nov 2014 at 12:58

GoogleCodeExporter commented 9 years ago

Original comment by fgalli...@google.com on 30 Jan 2015 at 8:40