【问题标题】:High performance QImage output to display高性能 QImage 输出显示
【发布时间】:2012-06-27 00:28:08
【问题描述】:

我正在尝试将视频输出(帧序列)到任何 qt 可见小部件。一开始我认为 QLabel 就足够了……但我错了。转换为像素图对于处理大图像(例如 1080p)来说过于过载。

还有其他解决方案吗? (不是 QLabel?)

一帧代码示例:

QImage m_outputFrameImage(width, height, QImage::Format_RGB888);
memcpy(m_outputFrameImage.bits(), m_frameRGB->data[0], height * width * 3);
QPixmap pixmap = QPixmap::fromImage(m_outputFrameImage); // BAD, slow and high load
/* Bad too (Same code?)
    QPainter painter;
    painter.begin(&pixmap);
    painter.drawImage(0, 0, m_outputFrameImage);
    painter.end();
*/
labelVideo->setPixmap(pixmap);

【问题讨论】:

    标签: c++ qt qimage qpixmap


    【解决方案1】:

    是的,将帧渲染到QGLWidget 并让显卡处理。这就是 Qt MultimediaKit、Phonon 和其他公司的做法。

    前段时间我分享了一些代码来演示如何完成这个任务:Image scaling (KeepAspectRatioByExpanding) through OpenGL

    【讨论】:

      猜你喜欢
      • 2011-05-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多