×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Sep 2010
    Posts
    10

    Nokia N8 main camera/memory issues in QT app

    Hi there, we have encountered some problems with application which should take and modify photos on Nokia N8.

    General information:

    Development environment:
    - Carbide C++ 2.6,
    - S60 5th Edition SDK v1.0 (tested on Nokia Symbian3 SDK v0.9 too),
    - QT 4.6.3,
    - QT Mobility 1.0.1

    Application requirements:
    - Taking and modifying photos form main camera (low resolution 640x480 pix) with GUI over Camera Viewer,
    - Reading and using photo taken by standard camera application (up to 12mbp – 4000x3000 pix)

    Status device by device:
    - Whole application works fine on S60r5 devices tested on (Nokia 5230, Nokia N97Mini, Nokia X6, Nokia 5530)
    - We have problems with using main camera and full screen images on Nokia N8.

    Problem description, steps to reproduce:
    1. We load big images (4000x3000px) found in image folders on N8 into memory, and resize them down to 100x100 thumbnails – and save the thumbnails in a temp folder on N8.
    2. We remove big images from the memory.
    3. We display the whole gallery of thumbnails on one scrollable screen.
    4. We exit this gallery, clear the memory.
    5. We enter the camera view and try to initialize the camera.
    6. We get error type 0, number -21.

    “Error -21” has been officially reported and acknowledged by Nokia as occasionally occurring on Nokia N8. If the user enters camera view directly after launching the app, error -21 occurs occasionally, but if the user follows all above mentioned steps, error -21 is returned always.
    Moreover, if there are no images over 2000x2000px displayed in the gallery, the camera launches in steps 5-6.

    Question: is there any way to performs steps 1-6 and have the camera running? Any ideas?

  2. #2
    Nokia Developer Moderator
    Join Date
    Oct 2009
    Location
    Finland
    Posts
    327

    Re: Nokia N8 main camera/memory issues in QT app

    Just wondering, on the desktop you usually want to do the image scaling using the image reader library, instead of loading the whole thing in and resizing. See http://doc.qt.nokia.com/latest/qimag...#setScaledSize

  3. #3
    Registered User
    Join Date
    Sep 2010
    Posts
    10

    Re: Nokia N8 main camera/memory issues in QT app

    Ok, some further explanation is required I guess. Actually the problem is not with the resizing, but... with displaying the thumbnails. We have made an experiment and omitted point 3 - we resized all images (including 4000x3000 ones) and saved thumbnails to temporary folder during application launch, and then launched the camera - it has initialized properly.

    So the problem seems to be not with resizing process, but with displaying the thumbnails...

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

    Re: Nokia N8 main camera/memory issues in QT app

    Since you don't have an official complete answer yet I'll guess from your description and some knowledge of the N8 hardware...

    I expect you're running out of "graphics memory". It's generally referred to as graphics memory but it's really the dedicated memory for the Broadcom mulitmedia accelerator, completely separate from the main memory. I'm guessing that resizing the images is using up the "graphics memory" and when the camera starts up it needs to reserve a lot of "graphics memory" for compressing the images that are captured. When it finds there isn't enough available you get the error -21. This will also trigger some GOOM (Graphics Out Of Memory) code to free up memory so if you do a short wait and try to start the camera again it should work.

    This is just a guess but logically the problem can't be with displaying the thumbnails if it works fine when none of the original images are over 2000x2000px. Since you aren't keeping the original images in main memory it should make no difference what size they were originally unless something is still using up resources based on image size!

    Hope that helps,
    Mark

  5. #5
    Registered User
    Join Date
    Sep 2010
    Posts
    10

    Re: Nokia N8 main camera/memory issues in QT app

    Hello
    That was my assumption too, but this problem is is some kind bounded to camera not to memory. We start camera after resizing images (even using QimageReader – achipa thx for a tip – not solve this problem). Images are scaled and stored as a thumbnails at app start, if we start camera as a first option mainly we have no problem taking photo. Some time even in this situation camera respond with -21 error, but after viewing gallery camera wont initialize at all (-21 error). Checking overall memory and heap size with Hal.h lib don't show any problems (all memory reserved for reading, sizing and displaying images are correctly released). Because we wait some time (in tests even 1s) between trying to initialize camera, as I suppose it is not a “time problem” for GOOM.

  6. #6
    Regular Contributor
    Join Date
    Oct 2008
    Location
    Oslo, Norway
    Posts
    329

    Re: Nokia N8 main camera/memory issues in QT app

    Hi,

    This certainly sounds like a GOOM issue - Qt in N8 by default uses OpenVG paint engine to do hw-accelerated rendering onto a composition surface that takes a chunk from the 32MB of total graphics memory. And so does each one of your thumbnails (how many do you have loaded at once?). And, finally, reserving the camera requires a lot of graphics mem (typically, over half of what's available).

    To restrict the graphics memory consumption, maybe try implementing a pooling mechanism for the thumbnails - i.e, only use as many QPixmap instances as there are images visible on the screen and reload them on-the-go. Should be relative easy as they're all the same size.

    You can easily test if GOOM is the culprit - try switching to pure software rendering:

    Code:
        QApplication::setGraphicsSystem("raster");
        QApplication a(argc, argv);
        ...
    And see if it helps. Note that sw rendering obviously carries a performance hit. Note that currently you can only select the graphics system at application startup, switching to raster paint engine cannot be used as a fallback when encountering GOOM.

  7. #7
    Registered User
    Join Date
    Sep 2010
    Posts
    10

    Re: Nokia N8 main camera/memory issues in QT app

    Hi Treini

    I have to deal with QStackedWidgets, so pool solution may be not that easy, but thx very much for a trace, look like after switching to raster mode app is form time to time able to start camera after visiting gallery.
    Hope we will find way to solve problem permanently. Thx again.

  8. #8
    Regular Contributor
    Join Date
    Aug 2008
    Posts
    95

    Re: Nokia N8 main camera/memory issues in QT app

    I have the same problem with C7 and an application that use web browser with dynamic data (openstreetmaps on QWebView).

    If i don't navigate on QWebView, all works fine. But when i pan on maps, next time that i open camera, this give me error -21.

    Last solutions i have found is open camera from symbian system.

Similar Threads

  1. Launch Ovi Store from within a QT app (N8)
    By KevinD in forum [Closed] Publishing to Nokia Store
    Replies: 8
    Last Post: 2011-01-31, 16:12
  2. Deploy Qt Creator App to N8 from Mac SDK? Frustrated.
    By franklovecchio in forum [Archived] Qt SDKs and Tools
    Replies: 1
    Last Post: 2010-12-27, 18:49

Posting Permissions

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