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

UMC::H264VideoDecoder decoding consumes 30 - 40% CPU usage

scorpuva
Beginner
1,700 Views

Hi,

I am using intel IPP libraries for decoding H264 video stream. Video streams in 30 FPS with 1280 x 780 resolution.
For decoding one H264 video channel, the decoderprogramtakes around 30 - 40 % of CPU usage.
Even after calling the

ippStaticInit();

and below is the code snippet which i used for decoding H264 video stream data. Please let me know if i am missing anything in my code which consumes more CPU.

Ipp8u *cVideoData; // Contains the pointer to compressed video frame
Ipp8u *cRGBData; // Buffer allocated for decompressed RGB image
int RGBimgWidth = 1280;
int RGBimgHeight = 780;
int VideoDataSize; // datasize of compressed image

UMC::Status status = UMC::UMC_OK;
UMC::MediaData DataIn;
UMC::VideoDecoderParams Params;
DataIn.SetBufferPointer(cVideoData,VideoDataSize);
DataIn.SetDataSize(VideoDataSize);

Params.m_pData = &DataIn;
Params.lFlags=0;
Params.numThreads=1;

if(!m_bdecInit && status = pH264Decoder->Init(&Params)!=UMC::UMC_OK)
{
return false;
}
m_bdecInit = true;
DataOut.Init(RGBimgWidth,RGBimgHeight,UMC::RGB24,8);
DataOut.SetBufferPointer(cRGBData,RGBimgWidth*RGBimgHeight*3);
status = pH264Decoder->GetFrame(&DataIn, &DataOut);
if (status == UMC::UMC_OK)
{
pH264Decoder->GetInfo(&Params);
RGBimgWidth = Params.info.clip_info.width;
RGBimgHeight = Params.info.clip_info.height;
}
else
{
status = pH264Decoder->GetFrame(NULL, &DataOut);
if (status != UMC::UMC_OK)
{
return false;
}
}

0 Kudos
12 Replies
Emmanuel_W_
New Contributor I
1,700 Views
What processor are you using ?
0 Kudos
PaulF_IntelCorp
Employee
1,700 Views
Please note that processor usage is not always a good indicator of work being done. The OpenMP runtime consumes CPU cycles when managing threaded functions and can give false indications of the actual processor usage. What you really need to measure is how many cycles does it take to perform the required work. Compare your throughput with the system configured for single-processor versus multi-processor versus no-IPP versus... How you measure it depends on what is important to you, but CPU cycles consumed does not give youa full picture.
0 Kudos
scorpuva
Beginner
1,700 Views
My machine has core 2 duo processor.
I have given the specification about the processor below,
Intel Core2 duo CPU P8400 @ 2.26GHZ

0 Kudos
Chao_Y_Intel
Moderator
1,700 Views

The code specify to use only one threading:
...
Params.numThreads=1;
...

It is better set the threading number to phsical CPU core number.

Thanks,
Chao
0 Kudos
scorpuva
Beginner
1,700 Views
Even i tried setting Params.numThreads=2;
Still same problem with CPU consumption. Please let me know if you require more details.
Correctme if i am setting any wrong values or if i am using anything wrong.
0 Kudos
Chao_Y_Intel
Moderator
1,700 Views


Which compiler are you using to compile the sample application? H.264 is threaded with OpenMP. It requires the compiler to support OpenMP ( Intel C++, Visual C++ 2008, etc).

If this also looks fine, you can attach a bitstream, so we can have a check.

Thanks,
Chao

0 Kudos
scorpuva
Beginner
1,700 Views
Hi,

I am using the visual studio 8 for developing my VC++ decompress module.
OpenMp support was not enable initially. Still i am facing the performace issue even after enabling the /openmp.

I have attached the sample h264 video stream. Please review and let me know.
0 Kudos
Emmanuel_W_
New Contributor I
1,700 Views
Agree but it is better than no info at all ;).
Note that in term of comparison, with multi thread support disabled I can decode 720p/30fps/1.5mbps baseline using a small fraction <30% (depending of the complexity of the stream) of one core of an I7 2.66Ghz system.
I think 30%-40% of a core 2 duo 2.44 might be what you get.

(note that color conversion to RGB24 is enabled which consume a little extra CPU).

Emmanuel
0 Kudos
Chao_Y_Intel
Moderator
1,700 Views

Hi Emmanuel and scorpuva,

This has two questions here:

1) If the decoder tries to decode as faster as possible, what is CPU usage here, what is the max frame rate it can get?

I just tried the attached SampleVideo.264 file with UMC umc_h264_dec_con sample application. It almost reached the 100% CPU usage. I test at my laptop with Core 2 Duo T7300, 2.0G, and the frame rate is about 90fps.

2)If application code only wants to maintain about 30fps, what is CPU usage will be enough.

I agree with Emmanuel. 30%-40% usage of a core 2 duo 2.44 might be enough for decoding the attached video file.

Thanks,
Chao

0 Kudos
scorpuva
Beginner
1,700 Views

The video streams in the frame rate of 30 FPS from the h264 encoder with the bitrate of 3mbps. Currently it takes around 30 - 40 percent.
I tested the same video stream withVLC player which takes around 15 - 20 percent. Both the VLC and My decompression module are using the RTSP connection with the h264 encoder. How does VLC can decode the same video stream with cpu usage of 15- 20 %?. How to make the IPP decoder to consume cpu below
20 %?

regards,
uva

0 Kudos
Emmanuel_W_
New Contributor I
1,700 Views
Are you sure VLC is not using any hardware acceleration ?
0 Kudos
scorpuva
Beginner
1,700 Views
yes i triedwith disabling "Accelerated video output" in VLC.
0 Kudos
Reply