Decoding on-the-fly AVC stream resolution changes

Decoding on-the-fly AVC stream resolution changes

I have a stream in which the AVC stream resolution changes (width and height). 

What is the best way to reprogram the decoder to adequately react to such stream changes ? 

Do I need to do the full reset and repeat the initialization procedure with new SPS/PPS, or there is a shorter/faster/more efficient way of doing it ?

Thanks,

Mamil 

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi Mamil,

The Media SDK decode sample should handle this case by default without the need to reset the pipeline. But this assumes that the new  resolution is smaller (W and H) so that the new decoded frames fits on the pre-allocated surfaces for decode. If the new resolution is greater than the frames size allocated at pipeline initialization, then the application must restart decoder, free surfaces, and then allocate surfaces that can fit the new frame resolution.

Note that changes such as resolution change results in return value MFX_WRN_VIDEO_PARAM_CHANGED from DecodeFrameAsync. This can be used to detect and act on the event as described above. At this point you can also call GetVideoParam on the decoder to determine the new resolution..

Regards,
Petter 

Hi again,

Correction to my previous description.

For the case of resolution change pipeline reset is always required (regardless of decrease or increase in resolution).

A parameter change requiring decode reset (such as resolution change) is indicated by DecodeFrameAsync returning MFX_ERR_INCOMPATIBLE_VIDEO_PARAM. 

If you look at the Media SDK sample_decode sample you can see one way to handle this scenario, including the following steps after receiving MFX_ERR_INCOMPATIBLE_VIDEO_PARAM:
- loop to retrieve remaining frames from the decoder
- close decoder
- delete allocated frames
- initialize new decoder parameters 
- allocate new frames
- initilize decoder
- restart decoding loop 

Regards,
Petter 

Login to leave a comment.