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.

Decoding on-the-fly AVC stream resolution changes

Mamil_A_
Beginner
242 Views

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 

0 Kudos
2 Replies
Petter_L_Intel
Employee
242 Views

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 

0 Kudos
Petter_L_Intel
Employee
242 Views

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 

0 Kudos
Reply