It seems to be a short FIR lowpass filter, length = 3
The 3 input values: yp, x, yn.
(yp = "previous", yn = "next")
The 3 coefficients: 0.25; 1; 0.25
Result = 0.25 * yp + 1 * x + 0.25 * yn
The "+ 2" in the SHIFT_RIGHT argument creates rounding to the nearest integer.
(it is an addition of 0.5, then a truncation to integer).
This is probably a very hardware efficient filter, since no multipliers are needed.
It is only an addition of 4 values. The shifting doesn't cost anything.