Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

JPEG decoding in multithreaded environment

alex78
New Contributor I
457 Views

Hi all,

I have a question regarding optimization of decodingmjpeg based video in multithreaded environment. I use the jpeg decoder provided in the jpegview sample (IPP 5.1), which is significantly faster than ijl. The video streams are coming from the network in separate threads and I pass the data to the decoder. As recommended somewhere on the IPP web, I use a static linkage model with dispatching to be sure the internal threading inside IPP is off (multicore support). Now I am able to produce 25 fps video in two windows(two threads) and the video is very smooth (total fps is now 50). But when I try to open one window with 25 fps and 5 windows with4 fps (6 threads), the 25fps video is not so smooth any more (there is a quality loss) althouth the total amount of frames decoded is 45. I have the same result on a P4, Pentium D andCore Duo platform. It does not seem to me, that the cause is the overhead of managing additional threads in the second example. Testing on the Core Duo platform there is just 30 percent processor occupancy, but the 25fps video is not smooth.

Any suggestions?

Best regards A. Nemec

0 Kudos
3 Replies
Vladimir_Dudnik
Employee
457 Views

Hello,

might be I did not understand you completely, but basically you say that when you lauch additional decoding threads they affect decoding process in the first thread in terms of decoding quality? That should not be a case if you use separate decoders, there is no global static variables in JPEG decoder, so other threads should not affect each other.

Regards,
Vladimir

0 Kudos
alex78
New Contributor I
457 Views

Thank you for your answer.

Exactly, it seems to me (after additonal investigations), that additonal decoding threads affect each other in terms of decoding performance. Adding more decoding threads makes the decoding of one some frames significanlty slower than when decoding the same (even greater) number of frames in one single thread. It really seems like the threads access shared resources locking each other is some moments.

Any advice?

Best Regards Alexandr Nemec

0 Kudos
Vladimir_Dudnik
Employee
457 Views

Hi Alexander,

How did you build IPP JPEG codec? Did you use Intel C/C++ compiler?

If you build IPP JPEG codec with Intel C/C++ compilerit will utilize OpenMP threading inside codec. It seems that the reason of your issue might be in OpenMP threading. I think if your goal is to launch several decoding threads you might want to turn off threading in codec. Could you please try to set OMP_NUM_THREADS=1 environment variable (this will disable OpenMP threading) to check if this help?

Regards,
Vladimir

0 Kudos
Reply