Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. CPU usage is too high with update()
Forum Updated to NodeBB v4.3 + New Features

CPU usage is too high with update()

Scheduled Pinned Locked Moved Mobile and Embedded
11 Posts 2 Posters 5.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    URPradhan
    wrote on last edited by
    #1

    Hi Friends

    I'm working on an embedded linux QT 4.7.3 video application.

    I have a video widget which is nothing but a pixmap holder and it paints the continuous feed of images which looks like a video widget to user. I'm painting my video widget @30 fps (in approx 33 msec) with a call to QWidget::update() method.

    Everything is working fine as I want. But the CPU usage is tooooo high for my QT application. I ran the 'very sleepy' tool and "here is the output of a sample" [http://i44.tinypic.com/2n8v2b5.jpg]

    !http://i44.tinypic.com/2n8v2b5.jpg(very sleepy sample)!

    From the sample its obvious that Qt4 libraries uses 80% of CPU time.

    Can you please suggest me to reduce the CPU usage ?

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kqt-mr-nv6
      wrote on last edited by
      #2

      what images are you painting
      what is the format and pixel density

      1 Reply Last reply
      0
      • U Offline
        U Offline
        URPradhan
        wrote on last edited by
        #3

        Thank you for your reply.

        I'm creating a QImage->QPixmap from the image data I got from my cam
        I'm not sure about the image format and density but I get the feed from the camera using the h263/h264 codec

        And from the very sleepy data I'm not sure why QGraphicsView::QGraphicsView:() and QFutureInterfaceBase::isRunning() is taking so much time, where I'm not calling them explicitly.

        1 Reply Last reply
        0
        • K Offline
          K Offline
          kqt-mr-nv6
          wrote on last edited by
          #4

          JPEG is a compressed image format
          if you are handling conversion of high pixel density to/from raw
          processor load is implicit

          1 Reply Last reply
          0
          • U Offline
            U Offline
            URPradhan
            wrote on last edited by
            #5

            ^I have updated the previous post with image format. And note that the image creation and processing it from the camera feed does not take too much CPU but the paint takes huge chunk of it.

            If I only comment the line with [QWidget::]update(), the CPU usage drops drastically. So its the paint only taking too much CPu cycles.

            1 Reply Last reply
            0
            • K Offline
              K Offline
              kqt-mr-nv6
              wrote on last edited by
              #6

              do you have a GPU on board

              1 Reply Last reply
              0
              • U Offline
                U Offline
                URPradhan
                wrote on last edited by
                #7

                No GPU on board on my device, but the USB camera has which captures the feed and broadcast it.

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  kqt-mr-nv6
                  wrote on last edited by
                  #8

                  OpenCV libraries are optimized to do such tasks
                  you have direct support to capture and show videos
                  you can integrate OpenCV with QT

                  1 Reply Last reply
                  0
                  • U Offline
                    U Offline
                    URPradhan
                    wrote on last edited by
                    #9

                    I really appreciate your suggestion.
                    But I'm not able to understand, how OpenCV will solve my problem ?

                    My problem is not in CPU cycles consumed for image capturing/creating rather the problem is in painting the captured images with QT and QtGui libraries takes huge amount of CPU cycles to paint the images.

                    1 Reply Last reply
                    0
                    • K Offline
                      K Offline
                      kqt-mr-nv6
                      wrote on last edited by
                      #10

                      On devices with no hardware acceleration, Qt will use QRasterPaintEngine, which handles the acceleration using software. On devices supporting OpenGL ES, OpenVG or DirectFB(not supported by Windows CE), Qt will use the respective paint engines to accelerate painting. However, hardware configurations that only support a limited set of hardware acceleration features, might slow the application graphics down rather than speeding it up when using unsupported operations that must fall back to the raster engine.

                      check this for more info
                      "http://harmattan-dev.nokia.com/docs/library/html/qt4/qt-embeddedlinux-accel.html":http://harmattan-dev.nokia.com/docs/library/html/qt4/qt-embeddedlinux-accel.html

                      1 Reply Last reply
                      0
                      • U Offline
                        U Offline
                        URPradhan
                        wrote on last edited by
                        #11

                        Thank you for the link.

                        But unfortunately my target h/w does not have an dedicated GPU and I can't use other paint engines.

                        I'm still not convinced why the QtGui library takes so much time to paint. Is there any other way around to reduce the CPU usage for continuously painting the images for a video widget ?

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved