“Sometimes a loss is the best thing that can happen.” – Snoop Dogg
Audiophiles claim to hear which way their speaker wire is braided. Oenophiles (aka wine snobs) say they can taste the type of soil the grapes were grown in. Car buffs can recite make, model, and year based on a glimpse of a taillight lens.
And graphics professionals can detect subtle differences in compression algorithms. All you pixel whisperers out there, look away now. We’re about to do some lossy compression.
It’s no secret that today’s consumer electronics handle a USDA boatload of image data. Photos and videos consume a lot of memory, a lot of transmission bandwidth, a lot of GPU energy, and a lot of people’s time. So, for the good of the industry, why not reduce three out of four?
That’s just what Imagination Technologies says it’s done with its new video-compression IP, dubbed PVRIC4. If you’re a lifetime member of the PowerVR fan club, you’ll know that PVRIC4 follows PVRIC versions 3, 2, and 1. Yes, it’s the fourth generation of the PVRIC (which stands for PowerVR Image Compression) compression hardware.
What separates Number Four from its three older siblings is lossy compression. Whereas the other versions all did lossless compression, PVRIC4 does both lossless and lossy. Why both? Because your customers probably can’t see the difference.
The whole point behind image compression – of either kind – is to save you money on memory, computing power, bandwidth, and possibly energy. There are well-known ways to compress still images without compromising their image quality one bit – literally. In fact, it’s hard to find photo images that aren’t compressed, even in high-end digital cameras. Lossless compression is common, and lossy compression (e.g., JPEG or GIF) even more so.
Same goes for video: you can compress the heck out of a video stream without affecting the image quality at all. More often, though, we accept a certain amount of image degradation in return for big reductions in bandwidth or memory footprint. Every TV station and video-streaming website in the world uses lossy compression, and the subscribers don’t seem to mind (or even know it’s happening).
Imagination’s PVRIC blocks – all four generations of them – include hardware to do lossless compression on-the-fly. These IP blocks sit between your video engine and its video buffer. Their operation is invisible to the GPU; think of it as an unusually intelligent memory controller. They handle read, write, or read-modify-write cycles to any arbitrary address, compressing data during writes and decompressing it during reads. Because all four do lossless compression, the images are unchanged but the memory they require to store can vary widely.
Some images compress very well; some not so much. Your memory savings is therefore variable and highly dependent on the images. There’s no way to tell how much good the compression will do. In the pathological worst-case scenario of an image of random static noise, you get exactly zero compression. That’s unlikely, but at least you’re no worse off than before.
What PVRIC4 adds is an alternate path. In addition to its lossless compression pipeline, it adds a newly designed lossy pipeline. The latter pipe absolutely guarantees 2:1 compression, if not better. That means you’ll save on memory, no matter what. The tradeoff? You may or may not notice the difference in image quality.
Imagination is betting you won’t, and it calls its PVRIC4 “visually lossless.” If you take the time to compare the same image compressed via both pipelines, you’ll see that some pixels are different. But in real life, at video frame rates, you won’t.
That 2:1 compression ratio is something of a magic number. At anything less than 50% compression, you can’t guarantee that you’ll save enough space to cut your memory BOM. But if the PVRIC4 can cut images in half, all day long and under any circumstances, you can whack your buffer in half with confidence.
How do you know which pipeline to use? You don’t have to decide – the hardware does it for you. All images pass through both the lossy and the lossless pipelines simultaneously, and the PVRIC4 decides later which version to use. If the lossless (image-perfect) pipeline managed to produce a 2:1 shrink, then it gets routed to the output. But, if the compression ratio is anything less than 2:1, the lossy version takes its place. (You can disable the lossy pipeline at any time and force lossless compression only.)
The decision happens on a block-by-block basis, not over the whole image, so some portions of a video frame may get compressed one way and some the other. In fact, that’s nearly always the case. The image on the left shows how a typical patchwork of 16×4 blocks have passed through the lossless pipeline (in black) versus the lossy pipeline (in purple) to produce the final image on the right.
In a dozen or so benchmarks that the company shared, the difference in compression ratios between the two pipelines was pretty small. The new lossy pipeline didn’t squeeze images down much smaller than the older, lossless, pipeline could do. That’s either good news or bad news, depending on your perspective. The good news is, the existing lossless pipeline was already efficient and achieved impressive compression rates with no loss of image quality. The bad news is, it didn’t always achieve that magic 2:1 ratio that allows you to cut your frame buffer in half. The new lossy pipeline is what permits that. The PVRIC4 will always pass under the 2:1 bar, one way or another.
Imagination says its PVRIC4 is better than competing image-compression engines because (a) it works at the memory interface, handling random-access buffer reads and writes instead of just continuous display streams, and (b) it’s “perceptually lossless,” meaning, uh, better. Sure, you can find alternatives that compress by more than 2:1, but the visual difference will make your eyes hurt.
Cost might be an issue, too. If you’re using Imagination’s PowerVR GPU, the company will be happy to throw in the PVRIC4 for free. If you’re using an arch-rival’s IP such as (ahem) Mali, then you’ll have to pay a licensing fee. That’s only fair, and it’s good to know that PVRIC4 can work with competing GPUs. That should be music to an SoC designer’s ears.