Ask Your Question
0

"Illegal Instruction" when using "image_view" with theora.

asked 2011-11-09 05:26:23 -0500

Filipe Jesus gravatar image

updated 2011-11-11 01:25:17 -0500

Hi,

I'm using latest ROS electric with Ubuntu 10.10 (kernel 2.6.35-27-generic).

When running:

rosrun image_view image_view image:=/foo/image_raw _image_transport:=theora

It returns nothing but an "Illegal Instruction" message.

This error appears to any subscribed topic with sensor_msgs/Image message type, even from usual nodes like usb_cam and gencam_cu.

Also it works well with compressed and raw transport.

From reading the core of image_view with gdb:

    Program terminated with signal 4, Illegal instruction.
#0  0x00f688a6 in void cv::pyrUp_<cv::FixPtCast<unsigned char, 6>, cv::NoVec<int, unsigned char> >(cv::Mat const&, cv::Mat&) ()
   from /usr/lib/libopencv_imgproc.so.2.3
(gdb) backtrace
#0  0x00f688a6 in void cv::pyrUp_<cv::FixPtCast<unsigned char, 6>, cv::NoVec<int, unsigned char> >(cv::Mat const&, cv::Mat&) ()
   from /usr/lib/libopencv_imgproc.so.2.3
#1  0x00f69c07 in cv::pyrUp(cv::_InputArray const&, cv::_OutputArray const&, cv::Size_<int> const&) () from /usr/lib/libopencv_imgproc.so.2.3
#2  0x09adda98 in theora_image_transport::TheoraSubscriber::internalCallback(const theora_image_transport::PacketConstPtr &, const boost::function<void(const sensor_msgs::ImageConstPtr&)> &) (this=0xb2dd44a0, message=..., callback=...)
    at /tmp/buildd/ros-electric-image-transport-plugins-1.4.2/debian/ros-electric-image-transport-plugins/opt/ros/electric/stacks/image_transport_plugins/theora_image_transport/src/theora_subscriber.cpp:191
#3  0x09adfafc in operator() (function_obj_ptr=..., a0=...)
    at /usr/include/boost/bind/mem_fn_template.hpp:280
#4  operator()<boost::_mfi::mf2<void, image_transport::SimpleSubscriberPlugin<theora_image_transport::Packet_<std::allocator<void> > >, const boost::shared_ptr<const theora_image_transport::Packet_<std::allocator<void> > >&, const boost::function<void(const sensor_msgs::ImageConstPtr&)>&>, boost::_bi::list1<const boost::shared_ptr<const theora_image_transport::Packet_<std::allocator<void> > >&> >
    (function_obj_ptr=..., a0=...) at /usr/include/boost/bind/bind.hpp:392
#5  operator()<boost::shared_ptr<const theora_image_transport::Packet_<std::allocator<void> > > > (function_obj_ptr=..., a0=...)
    at /usr/include/boost/bind/bind_template.hpp:47
#6  boost::detail::function::void_function_obj_invoker1<boost::_bi::bind_t<void,---Type <return> to continue, or q <return> to quit---
 boost::_mfi::mf2<void, image_transport::SimpleSubscriberPlugin<theora_image_transport::Packet_<std::allocator<void> > >, const boost::shared_ptr<const theora_image_transport::Packet_<std::allocator<void> > >&, const boost::function<void(const sensor_msgs::ImageConstPtr&)>&>, boost::_bi::list3<boost::_bi::value<image_transport::SimpleSubscriberPlugin<theora_image_transport::Packet_<std::allocator<void> > >*>, boost::arg<1>, boost::_bi::value<boost::function<void(const sensor_msgs::ImageConstPtr&)> > > >, void, const boost::shared_ptr<const theora_image_transport::Packet_<std::allocator<void> > >&>::invoke(boost::detail::function::function_buffer &, const boost::shared_ptr<theora_image_transport::Packet_<std::allocator<void> > const> &) (function_obj_ptr=..., a0=...)
    at /usr/include/boost/function/function_template.hpp:153
#7  0x09ae16e5 in operator() (function_obj_ptr=..., a0=...)
    at /usr/include/boost/function/function_template.hpp:1013
#8  boost::detail::function::void_function_obj_invoker1<boost::function<void(const boost::shared_ptr<const theora_image_transport::Packet_<std::allocator<void> > >&)>, void, boost::shared_ptr<const theora_image_transport::Packet_<std::allocator<void> > > >::invoke(boost::detail::function::function_buffer &, boost::shared_ptr<theora_image_transport::Packet_<std::allocator<void> > const>) (
    function_obj_ptr=..., a0=...)
    at /usr/include/boost/function/function_template.hpp:153
#9  0x09ae5406 in ros::SubscriptionCallbackHelperT<boost::shared_ptr<theora_image_transport::Packet_<std::allocator<void> > const> const&, void>::call(ros::SubscriptionCallbackHelperCallParams&) ()
---Type <return> to continue, or q <return> to quit---
   from /opt/ros/electric/stacks/image_transport_plugins/theora_image_transport/lib/libtheora_image_transport.so
#10 0x00bedb32 in ros::SubscriptionQueue::call (this=0xb2d22dc8)
    at /tmp/buildd/ros-electric-ros-comm-1.6.4/debian/ros-electric-ros-comm ...
(more)
edit retag flag offensive close merge delete

Comments

Could you append the output of "uname -m" and "cat /proc/cpuinfo"? I am also having trouble with OpenCV in Electric on my laptop, but I don't know the extent of the problem yet.
Patrick Mihelich gravatar image Patrick Mihelich  ( 2011-11-09 10:06:35 -0500 )edit
Okiedokie. I've edited my question with that info added.
Filipe Jesus gravatar image Filipe Jesus  ( 2011-11-11 01:26:21 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2011-11-12 09:31:23 -0500

Patrick Mihelich gravatar image

updated 2011-11-14 07:37:46 -0500

We've confirmed that this is a problem with our OpenCV deb, and released a new version yesterday. Updating (sudo apt-get update; sudo apt-get dist-upgrade) should fix it.

We were building OpenCV with all the way up to SSE4.2. OpenCV has SSE-optimized code paths for many algorithms, and dispatches to the fastest available implementation using runtime CPUID detection. Unfortunately, as far as I can tell, gcc only gives us file-level granularity in choosing the instruction set. So gcc would also optimize generic C code to use SSE4 when possible, resulting in "Illegal instruction" for some random subset of the OpenCV API. Short of a significant (and ugly) refactoring of OpenCV, we apparently lack a safe way to generate debs taking full advantage of runtime CPUID detection.

The new deb compromises on SSE2 (not SSE3/4), which is pretty universal and allows OpenCV to use almost all of its optimized code paths.

edit flag offensive delete link more

Comments

Thanks a lot, it solved my problem! Also thanks for the explanation.
Filipe Jesus gravatar image Filipe Jesus  ( 2011-11-13 05:35:17 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2011-11-09 05:26:23 -0500

Seen: 983 times

Last updated: Nov 14 '11