Results 1 to 6 of 6

Thread: QPixmap Overhead

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Maui, Hawaii
    Posts
    120
    Thanks
    65
    Thanked 4 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QPixmap Overhead

    My organization has created some software that displays video by reading frames over UDP and converting the uchar* data into a QImage that gets converted into a QPixmap which we display using setPixmap().

    Machines with eight or so cores handle 30 Hz frames nicely, but they tend to get bogged down on conventional CPUs. A single player instance displaying 720x480 frames at 30 Hz ends up occupying 50% of the CPU (this is a dual-core MacBook Pro).

    After learning about the performance overhead in converting QImages to QPixmaps (and with some help from the folks here on QtCenter.org) I was able to drop my uchar* data into a QByteArray and convert to a QPixmap. This ends up using about 56% of the CPU –or about 6% more than the QPixmap->QImage conversion.

    Instead of creating a separate QByteArray for every frame, I added a QByteArray member to the class that I resize to the size of the header + data. This shaved off about 2% of the cpu expense, but it’s still 4% more costly than the QImage->QPixmap conversion. I’m not sure why that would be?
    I’m wondering if there is a way to optimize this process further … could the QByteArray be making a deep copy and slowing things up?
    Any guesses?

    This thread basically details how I did it:
    http://www.qtcentre.org/threads/2799...unsigned-char*
    Last edited by mhoover; 27th July 2010 at 22:24. Reason: formatting

Similar Threads

  1. QObject overhead
    By sriky27 in forum Qt Programming
    Replies: 1
    Last Post: 30th September 2009, 18:12
  2. Replies: 4
    Last Post: 28th August 2008, 13:13
  3. Replies: 1
    Last Post: 21st August 2008, 07:44
  4. Replies: 5
    Last Post: 9th April 2007, 14:26
  5. What's faster: QPixmap-to-QImage or QImage-to-QPixmap
    By forrestfsu in forum Qt Programming
    Replies: 2
    Last Post: 15th December 2006, 17:11

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.