Qt World Summit: Submit your Presentation

Real time renderer with QT sporadic time

  • Hello everyone,

    I'm currently working on a real time renderer, here are some informations :

    • it works at 50p (20ms for each frame)
    • the render loop is not a QThread for technical reasons

    The problem I'm facing is that the encoding library usually encode a frame in less that 10ms, but when I run it with the QT environment each 12 frames the encoding time rise to more than 60ms (roughly every 250 ms). It is a problem because some frames are dropped by the render loop. I tried to add a callback with QApplication::processEvents() in my render loop to see if it could smooth the sporadic time every 12 frames, it didn't work.

    I don't have an extended knowledge of QT, so 2 questions :

    • Do you know what could be the reason of this encoding time increase every 12 frames, QT is responsible but I don't know what it is doing ?
    • Do you know a better approach that could help me smooth the time over the rest of the encoded frame (encoding time is ok) ?

    Thank you


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Might be event handling from your application.

    In any case, you should consider offloading the encoding to a secondary thread even if it's not a QThread.

  • actually the encoding is using 14 threads, it looks like it works better if I don't use them all (like 12)

  • Lifetime Qt Champion

    14 threads ?
    What cpu are you using ?
    often its 4 cores, 8 threads so having 14 would demand a hi end workstation
    class cpu to actually be able to run all of them at same time.
    (which might not be needed but its worth mentioning)

  • Hi,

    yes this is a High end worstation with a Intel(R) Xeon(R) CPU E5-2697 v3 @ 2.60GHz,14 physical cores

  • Lifetime Qt Champion

    That is some sweet hardware :)

    Regarding the raise in encoding time. its very hard to guess at with no code.
    Could be anything.

  • Lifetime Qt Champion

    Also what are you using for encoding ?
    Which size are the frames you want to encode ?

Log in to reply