What is a "Hampel Filter" and how does it work?
The documentation clearly describes its function: "For each sample of x, the function computes the median of a window composed of the sample and its six surrounding samples, three per side. It also estimates the standard deviation of each sample about its window median using the median absolute deviation. If a sample differs from the median by more than three standard deviations, it is replaced with the median."

The $3\sigma$ rule is enforced via the estimator $\sigma \approx 1.4826\ \operatorname{MAD}$.

The most costly operation must be the median of seven elements, possibly achieved by sorting, which can be performed efficiently in a sliding window.

Possibly relevant reference: "Hampel F. R., ”The influence curve and its role in robust estimation,” Journal
of the American Statistical Association, 69, 382–393, 1974."