Hello, This patch reduces vRAM usage by cuvid decoder implementation. The number of surfaces used for decoding is updated within the parser sequence decode callback. Also the "surfaces" AVDictionary option specific to cuvid was removed in favor of "extra_hw_surfaces". vRAM consumption was tested on various videos and savings are between 1% for 360p resolution up to 21% for some 1080p H.264 videos. Decoding performance was tested on various H.264 and H.265 videos in different resolutions from 360p and higher, no performance penalty was found.