Jpeg Encoder: YCC Clipping error



Hello,

I'm a student and I have to write a Jpeg encoder using matlab.
I wrote it, for me it looks all good but the generated JPEG files are
wrong.

For instance, this is what I get: www.gvidal.fr/misc/out.jpg

The middle of the image seems good though...

I have used a tool called "JPEGsnoof" for analyzing my jpg file, and I
get some:
ERROR: YCC clipped

Can somebody see my Jpeg file and tell me, if possible, what is wrong
in my encoder code ?
This would be great.

Thank you for your help,

G. Vidal

.