2

I'm writing a video player where my code decodes the video to raw YCbCr frames. What would be the fastest way to output these through the Qt framework? I want to avoid copying data around too much as the images are in HD format.

I am afraid that software color conversion into a QImage would be slow and that later the QImage will again be copied when drawing into the GUI.

I have had a look at QAbstractVideoSurface and even have running code, but cannot grasp how this is faster, since like in the VideoWidget example (http://idlebox.net/2010/apidocs/qt-everywhere-opensource-4.7.0.zip/multimedia-videowidget.html), rendering is still done by calling QPainter::drawImage with QImage, which has to be in RGB.

The preferred solution seems to me to have access to a hardware surface directly into which I could decode the YCbCr or at least directly do the RGB conversion (with libswscale) into. But I cannot see how I could do this (without using OpenGL, which would give me free scaling too, though).

farindk
  • 260
  • 3
  • 15
  • I am interested in this as well. Here is the best way I have found so far, but I would like to know if there are any better ways. http://stackoverflow.com/questions/1242005/what-is-the-most-efficient-way-to-display-decoded-video-frames-in-qt – Jason B Jul 31 '13 at 19:45
  • What platform? Do you decode in the GPU? – Luca Carlon Aug 01 '13 at 06:33
  • Phonon? - https://qt-project.org/doc/qt-4.8/phonon-overview.html – Dmitry Sazonov Aug 01 '13 at 09:07
  • I hoped to get a cross-platform solution, but Linux is the main target. Decoding is on the CPU (color-space conversion could be a GPU shader, though). @DmitrySazonov: as I understand it, Phonon is a wrapper around graph-based high-level interfaces like gstreamer or DirectShow, not meant for low-level injection of raw images (even though that might be possible). – farindk Aug 01 '13 at 20:11

1 Answers1

0

One common solution is to use QGL Widget with texture mapping. The application allocates a texture buffer on first frame, then call update texture in remaining frames. This is pure GL call, Qt not supporting texture manipulation yet. But QGLwidget can be used as a container.

Decoding was done using SSE2. Hope this helps.

user3195397
  • 226
  • 1
  • 2