If your neighbouring pixels are A and B. Your predictor P is P=(A+B)/2. The searched pixel is X=P+E. Do some algebra, solve these equations to X and you will have your formula:
X=(A+B)/2+E
Depending on your definition of the error, it might be X=P-E