the attached utility is a work I ve submitted to the university
It shows what a JPEg compression is all about.
the function implements the DCT transform, using a matrix operator.
note that matlab has a function for the DCT and iDCT transforms
that might be more efficient.