Video compression algorithms exploit the fact that high-frequency components are not effectively perceived by the human eye. By allocating bits differentially to various spatial frequency components, video compression reduces the image size with “barely” noticeable visual artifacts. This is achieved by dividing a picture into small blocks and coding their transform coefficients both differentially and efficiently. However if the video encoder compresses the input aggressively, these blocks can introduce artifacts which are visible to the human eye.
PSNR is one of the tools used to check the fidelity of the encoded video from the original input. The video encoders we are focusing here are lossy and computing PSNR does not highlight visually relevant mismatches. Despite these shortcomings PSNR is still a great filtering tool, to highlight areas in the reconstructed output for further investigation. At Pathpartner, we have developed a “PSNR HeatMap” tool, “to visualize block based PSNR”.
How PSNR HeatMap works:
PSNR HeatMap tool takes the reconstructed stream and original stream as input. It will compute block wise PSNR (block size is configurable). This blockwise PSNR is mapped to a color table, which has a progressive color gradient from green to red. Mapped color value will be assigned to Chroma Cr, while Chroma Cb is forced to zero for every output pixel. Forcing both Cb and Cr components to zero would give a green tinge to the rendered picture. As we change the Cr values from 0 to 0xFF, overlay tinge would range from green to red. Keeping Cb component zero would ensure no other colors get overlayed on the rendered picture. PSNR color mapping is such that, if PSNR value is greater than 52 would give a green tinge while PSNR less than 25 will give it a red tinge.
Below is the color scale that we use:
Code is available at https://github.com/pphevc/freetools/tree/master/psnrheatmap under apache license