Some of us know that JPEG uses the Discrete Cosine Transform (DCT) to do lossy compression. A few people have more than the vaguest idea of what that means, and I don’t claim to be one of them. Today, though, I found a video on YouTube which gets me closer, even though I’m not very inclined toward advanced mathematics. It’s included in my file formats playlist on YouTube.
Obviously the speaker is leaving a lot out. If you just take an average of cosines with different frequencies, the resulting function will always have a maximum at x = 0, which usually won’t fit the pixel block being represented. Digging into more detailed accounts, I see that the cosine function is offset from 0, avoiding the problem.