×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Sep 2008
    Posts
    2

    How to speed up bitmap transformations

    Dear all,

    For a master research in my university I am doing some research on the use of accelerometers combined with mobile graphics. I am working with an N95. I use Symbian C++. (S60 3rd FP2 SDK v1.1).

    At the moment I want to transform images as result of accelerometer data changes. I apply some matrices to transform a buffered graphics context. It is based on http://wiki.forum.nokia.com/index.ph...uble_buffering where double buffering is described. I use the normal drawing methods to draw a bitmap, transform it, and draw it to the screen as described in the wiki.

    It works well, but is really slow. For simple transformations (complexity of linear order when looking at #pixels) I have a maximum framerate of 1 fps.

    I would like to know if I could better use something else, instead of the double buffering method.

    And a side question: how slow are the gonio functions from the Math class? Is it better to create LUT's if you make extensive use of them?

    Any help is really appreciated!

    Thanks in advance,

    Corijn Kamerling
    The Netherlands

  2. #2
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: How to speed up bitmap transformations

    Hi,

    Some questions:
    1) When you transform your bitmap, how are you accessing the pixel values? You probably want to manipulate the image data directly via the DataAddress() method (although read the documentation about the need to lock the FBS heap while you do this), anything else is likely to be too slow.

    2) Are you using floating-point numbers for the transformation matrix? If so you will probably want to switch to using fixed-point arithmetic, since the hardware floating-point unit in the N95 is not used by default (it is possible to force the compiler to use it - search the forum) but not really advisable. Moving to fixed-point will probably improve performance by an order of magnitude.

    Hope that helps,
    Sorcery

  3. #3
    Registered User
    Join Date
    Sep 2008
    Posts
    2

    Re: How to speed up bitmap transformations

    Thanks for your reaction!

    Quote Originally Posted by Sorcery-ltd View Post
    Hi,

    Some questions:
    1) When you transform your bitmap, how are you accessing the pixel values? You probably want to manipulate the image data directly via the DataAddress() method (although read the documentation about the need to lock the FBS heap while you do this), anything else is likely to be too slow.
    I am using constructions like:

    Code:
    bitmap4Util->SetPos(TPoint(x, y));
    bitmap4Util->SetPixel(*bitmap1Util);
    where the objects are from type pointer to TBitmapUtil. It seems to be the bottleneck.


    Quote Originally Posted by Sorcery-ltd View Post
    2) Are you using floating-point numbers for the transformation matrix? If so you will probably want to switch to using fixed-point arithmetic, since the hardware floating-point unit in the N95 is not used by default (it is possible to force the compiler to use it - search the forum) but not really advisable. Moving to fixed-point will probably improve performance by an order of magnitude.
    I am indeed using floating-point numbers. I will think about converting to fixed-point arithmetic if that compiler option is not advisable. Is it then still better to use LUTS for angle calculations?

    Thanks again so far!

    Corijn

  4. #4
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: How to speed up bitmap transformations

    Hi,

    Yes, any attempt to do image processing with the setPixel() method at speed is doomed to failure. You really need to access the memory directly.

    Even with the hardware VFP unit, floating-point operations are still significantly slower than fixed-point. For matrix operations though you may be able to use OpenGL ES and get the 3D graphics hardware to help out? There has been some discussion of this before but I'm no expert in this area.

    Look-up tables are generally a good idea if you're using trig or similar repetitive calculations, I'd make the other changes first though.

    Sorcery

Similar Threads

  1. problem when importing from carbide c++ to vs 2003!
    By misfit.physics in forum Symbian Tools & SDKs
    Replies: 12
    Last Post: 2008-02-19, 09:45
  2. How can I reverse the color in the screen?
    By sanmu163 in forum Symbian User Interface
    Replies: 11
    Last Post: 2006-08-18, 08:12
  3. Replies: 2
    Last Post: 2003-08-07, 12:58

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×