VideoCommon: rewrite frame skipping code