qsvdec: split off some code that will be shared with the encoder