Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.

How to Use CQP?

lonely_hearts_club
895 Views

I have set the variable m_EncoderParams in CH264EncVideoFilter::SetDefaultParams() to:

 m_EncoderParams.level_idc                      = Params::LL_13;

m_EncoderParams.profile_idc                    = Params::PF_H264_BASELINE;

m_EncoderParams.pc_control                     = Params::PC_FRAME;

m_EncoderParams.ps_control.GopPicSize          = 32;    

 m_EncoderParams.ps_control.GopRefDist          =1;    

 m_EncoderParams.ps_control.NumSlice            = 0; // autoselect

 m_EncoderParams.rc_control.rc_method           = IConfigureVideoEncoder::Params::RCControl::RC_CQP;    

    m_EncoderParams.target_usage                   = MFX_TARGETUSAGE_UNKNOWN; 

 m_EncoderParams.frame_control.width            = 384;    

m_EncoderParams.frame_control.height           = 216;

and in CopyEncoderToMFXParams() function, I set

pMFXInfo->QPI = 25;

pMFXInfo->QPP = 25;

I also removed the "CodecPreset::VParamsFromPreset()" call in this function. 

 

I tried different QPI and QPP values, and I observed that the bitrate went down as the QPI and QPP was set to higher values. However, the video image quality remained poor all the time(moving part is very vague) with different QP values.

Why didn't the image quality  change at all?

0 Kudos
2 Replies
Anthony_P_Intel
Employee
894 Views
Hi, Please ensure that the code involving the pMFXInfo is not using any members that are not used for CQP, as the QPI, QPP, and QPB members are shared (with union) with InitialDelayInKB, Accuracy, TargetKbps, MaxKbps, and Convergence. If there is any code setting these it will overwrite your QP values. If you have an example of your encoded output, it can be anaylyzed to see if it is really the desired QPI or QPP. -Tony
0 Kudos
lonely_hearts_club
894 Views
Tony Pabon (Intel) wrote:

Hi,

Please ensure that the code involving the pMFXInfo is not using any members that are not used for CQP, as the QPI, QPP, and QPB members are shared (with union) with InitialDelayInKB, Accuracy, TargetKbps, MaxKbps, and Convergence. If there is any code setting these it will overwrite your QP values.

If you have an example of your encoded output, it can be anaylyzed to see if it is really the desired QPI or QPP.

-Tony

Hi,Tony! Thank you for your reply. I had analyzed the encoded output stream and found out that the real QPP was always 51--the same value as the target bitrate which showed on the property page. I traced the"m_mfxParamsVideo" variable in the sample code and dicovered that in CheckInputType() function, TargetKbps and MaxKbps was set to the following: if (m_mfxParamsVideo.mfx.TargetKbps < nBitrateMin * nFramerateCoeff || m_mfxParamsVideo.mfx.TargetKbps > nBitrateMax * nFramerateCoeff) { m_mfxParamsVideo.mfx.MaxKbps = (mfxU16)(nBitrateRecommended * nFramerateCoeff); m_mfxParamsVideo.mfx.TargetKbps = m_mfxParamsVideo.mfx.MaxKbps; } According to your hint, this has actually changed the value of QPI and QPP. I had just simply cancelled these two statements and the problem was solved. -Patrick
0 Kudos
Reply