Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Kz_Liao
Beginner
135 Views

Relationship about MaxDecFrameBuffering and NumRefFrame

Hi,

I'm using MSDK 2014 R2 for my test. By running the video conference sample and analyzing the bitstream, I got something confusing.

In the sample, to set low delay encoding and decoding, the following code is illustrated:

    /*Initializing Extcoding options with msxdecframebuffering = 1 to reduce decode latency*/
    m_extCO.MaxDecFrameBuffering               = 1;
    //turn on reference picture marking repetition SEI
    m_extCO.RefPicMarkRep = (mfxU16)(m_initParams.bRPMRS ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF);

    m_extBuffers.push_back(reinterpret_cast<mfxExtBuffer*>(&m_extCO));

    //num ref frames doesn't affect latency
    //while ref lists management feature (for recovery from broken frames) needs at least several frames to be in the ref list, 5 is good enough
    m_mfxEncParams.mfx.NumRefFrame             = 5;

In my opinion, the MaxDecFrameBuffering would determine the DPB size, and the NumRefFrame should be lesser than the DPB size. So how can we use a NumRefPic greater than DPB size? Also, I found a limitation mentioned by Nina Kurina in the thread https://software.intel.com/en-us/forums/topic/312103 seems reasonable:

NumRefFrames <= MaxDecFrameBuffering <= Min(Floor(MaxDpbMbs / (PicWidthInMbs * FrameHeightInMbs)), 16)

So I examined the bitstream to found out that by running the code above, the sps->vui_parameters->max_dec_frame_buffering=5, just as the same value as the sps->num_ref_frames. Which means the MaxDecFrameBuffering value was ignored!

But if I set the MaxDecFrameBuffering = 5 and NumRefFrame = 3, then it will result the correct value in the bitstream. So is it a mistake?

0 Kudos
3 Replies
135 Views

Hi,

From mediaSDK manual: MaxDecFrameBuffering specifies the maximum number of frames buffered into a DPB. Also during the encoding initialization it is recommended to set the value of MaxDecFrameBuffering value equal to num_ref_frames to improve decoding latency. " Which means the MaxDecFrameBuffering value was (Not) ignored. Let me know if this helps.

Thanks,

Kz_Liao
Beginner
135 Views

Just got confused by the sample code in Video Conferencing Sample 5.0.461.91752. As I illustrated above, in the method VideoConfPipeline::InitMfxEncParamsLowLatency(), it set the m_extCO.MaxDecFrameBuffering to 1, that was conflict with the value of m_mfxEncParams.mfx.NumRefFrame which was set to 5 later.

In the case when m_extCO.MaxDecFrameBuffering is less than m_mfxEncParams.mfx.NumRefFrame, how large would the PDB size be?

By my testing, it seems the PDB size is determined by MAX(m_extCO.MaxDecFrameBuffering, m_mfxEncParams.mfx.NumRefFrame) within the limitation of the chosen profile/level. Is that correct?

135 Views

Hi,

Can you please let me know in which .cpp file of the Video conferencing sample you are trying to make these changes. I also see the Video conferencing sample you are using is a old one. We have new samples and can be downloaded from here.

Increasing the number of reference frames donot have high affect on Latency in this case. We suggest to set them equal for optimization and improvement in decoding latency.  DPB size is dependent on the number of reference frames you are using, more reference frames more bits are written into the buffer. Let me know if I got your question right? 

Also when u determined DPB size can you let me know which profile/level you used? This will help us understand the scenario better. 

Thanks,

Reply