Decode lossless predictive coding

832 views Asked by At

In MATLAB, I did lossless predictive coding of standard images by predicting the next sample from previous samples, subtracting the predicted value from the actual one, and encoding the error using Huffman coding. I decoded the errors as well, but now I have an array of errors without knowing how to go back to the original image. How do I predict the values of the original image matrix from these errors?

Just in case this helps, my predictor is of different types (to see which one gives the best result), with X being the actual value of a sample: 1) I take three neighboring values of X, find their average, and subtract them from X to obtain the error. 2) I used the predictor (A+B)/2, where A and B are neighboring values of X, and subtract from X.

And others like that. There's a pretty comprehensive list out there.

Any advice on how to predict the original values at the decoder?

1

There are 1 answers

0
Daniel On BEST ANSWER

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