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

H264 CPU Usage

david_jacksonipfx_co
672 Views
I am currently trying to use IPP to implement a h246 rtp video stream, the encoding and decoding all seem to work fine, but what is troubling is the amount of CPU consumed by the encoding process.

These are my current encoder settings...

UMC::H264EncoderParams encoder_params;

encoder_params.key_frame_controls.method = 1;
encoder_params.key_frame_controls.interval = 100;
encoder_params.key_frame_controls.idr_interval = 100;

encoder_params.info.clip_info.height = 320;
encoder_params.info.clip_info.width = 240;
encoder_params.info.bitrate = 1000000;
encoder_params.info.framerate = 20;
encoder_params.num_slices = 40;
encoder_params.numThreads = 0;
encoder_params.numFramesToEncode = INT_MAX;

With these settings I get >50% CPU usage on a Pentuim D 2.80Ghz, is this to be expected?
Are other people using the IPP audio-video codecs for realtime streams, if so how? (I am using IPP 6.1).
Thanks in advance,
David.
0 Kudos
9 Replies
Emmanuel_W_
New Contributor I
672 Views
I am currently trying to use IPP to implement a h246 rtp video stream, the encoding and decoding all seem to work fine, but what is troubling is the amount of CPU consumed by the encoding process.

These are my current encoder settings...

UMC::H264EncoderParams encoder_params;

encoder_params.key_frame_controls.method = 1;
encoder_params.key_frame_controls.interval = 100;
encoder_params.key_frame_controls.idr_interval = 100;

encoder_params.info.clip_info.height = 320;
encoder_params.info.clip_info.width = 240;
encoder_params.info.bitrate = 1000000;
encoder_params.info.framerate = 20;
encoder_params.num_slices = 40;
encoder_params.numThreads = 0;
encoder_params.numFramesToEncode = INT_MAX;

With these settings I get >50% CPU usage on a Pentuim D 2.80Ghz, is this to be expected?
Are other people using the IPP audio-video codecs for realtime streams, if so how? (I am using IPP 6.1).
Thanks in advance,
David.

How much cpu are you using if you only specify 1 slice?
0 Kudos
david_jacksonipfx_co
672 Views
Quoting - eweber

How much cpu are you using if you only specify 1 slice?


If I speicify 1 slice, I get a reduction of maybe 1-2% CPU, just to be specific I'm trying to send 640x480 @ 30 frames per second and using about 90% CPU.
0 Kudos
oxydius
New Contributor I
672 Views
Try the following :

encoder_params.profile_idc = H264_BASE_PROFILE;
encoder_params.m_QualitySpeed = 0; // max speed
encoder_params.entropy_coding_mode = 0; // CAVLC
encoder_params.transform_8x8_mode_flag = false;
encoder_params.mv_search_method = 2;
encoder_params.me_split_mode = 0; // 16x16 only
encoder_params.me_search_x = 8;
encoder_params.me_search_y = 8;

That should be a good start, but your output quality may decrease. Perhaps someome from Intel can comment on params which have the biggest speed impact without noticeable quality decrease.
0 Kudos
david_jacksonipfx_co
672 Views
Quoting - oxydius
Try the following :

encoder_params.profile_idc = H264_BASE_PROFILE;
encoder_params.m_QualitySpeed = 0; // max speed
encoder_params.entropy_coding_mode = 0; // CAVLC
encoder_params.transform_8x8_mode_flag = false;
encoder_params.mv_search_method = 2;
encoder_params.me_split_mode = 0; // 16x16 only
encoder_params.me_search_x = 8;
encoder_params.me_search_y = 8;

That should be a good start, but your output quality may decrease. Perhaps someome from Intel can comment on params which have the biggest speed impact without noticeable quality decrease.

Hi,

Thank you for the answers so far, now I'm getting ~60% for 640x480 @ 10fps, whist this is an improvement it is still obvously an unaceptable amount of CPU to be using on a client PC.
Any further insite is welcome.
0 Kudos
oxydius
New Contributor I
672 Views
Open audio-video-codecsdocumc-manual.pdf and search for "UMC::H264EncoderParams class members".
Use all parameters between parentheses; they seem geared towards maximum speed.
0 Kudos
david_jacksonipfx_co
672 Views
Quoting - oxydius
Open audio-video-codecsdocumc-manual.pdf and search for "UMC::H264EncoderParams class members".
Use all parameters between parentheses; they seem geared towards maximum speed.

I gave that I try, I get variations of a couple of % but nothing hudge.
Still at the point where 160x120 @ 30 fps is using ~25% CPU.
0 Kudos
Chao_Y_Intel
Moderator
672 Views


If I speicify 1 slice, I get a reduction of maybe 1-2% CPU, just to be specific I'm trying to send 640x480 @ 30 frames per second and using about 90% CPU.

David,

I did a quick test on a T7300 processor@ 2.0 with sample code application umc_video_enc_con.exe.

The parameter I used from here (the high speed one):
http://software.intel.com/en-us/articles/setting-h264-encoding-parameters-in-intel-ipp-media-processing-samples/
I changed the slice number to 2.

Please find the performance here:
when set threading =2:

Num frames encoded = 150
Encoding Time = 2.95 sec, 50.84 fps
Average CPU usage = 99.07%

When set threading =1

Num frames encoded = 150
Encoding Time = 4.28 sec, 35.03 fps
Average CPU usage = 50.08%

This performance look much better at my laptop system. Of course, the test bitstream will also impact performance result.
Could you check how the attached par file work for you?

Thanks,
Chao
0 Kudos
david_jacksonipfx_co
672 Views
Quoting - Chao Yu (Intel)

David,

I did a quick test on a T7300 processor@ 2.0 with sample code application umc_video_enc_con.exe.

The parameter I used from here (the high speed one):
http://software.intel.com/en-us/articles/setting-h264-encoding-parameters-in-intel-ipp-media-processing-samples/
I changed the slice number to 2.

Please find the performance here:
when set threading =2:

Num frames encoded = 150
Encoding Time = 2.95 sec, 50.84 fps
Average CPU usage = 99.07%

When set threading =1

Num frames encoded = 150
Encoding Time = 4.28 sec, 35.03 fps
Average CPU usage = 50.08%

This performance look much better at my laptop system. Of course, the test bitstream will also impact performance result.
Could you check how the attached par file work for you?

Thanks,
Chao

This helped a little bit, the more I play with the params, the more that it seems to be a matter of balancing things.
I can get the CPU down to about 10% for 160x120 @ 10fps, which is acceptable.
Thank you for your help.
Cheers
David.
0 Kudos
Venkat_R_1
Beginner
672 Views

David,

Would you please post the parameters you are using to increase the encoding process? Thank you.

Regards,

Venkat.

0 Kudos
Reply