Interpretation of jm8.6 (peak signal-to-noise ratio) and IMG-> quad

Source: Internet
Author: User

Interpretation of IMG-> quad in jm8.6 on the peak SNR:

In JMCodeI have encountered the IMG-> quad many times, but only one explanation is provided in the official code:


I did not understand it after reading it several times. Then I can see that there is SNR later. So I think it should be related to SNR.

Then look for SNR in the Code and find that there is a function in the JM code. Then let's look down and suddenly find out

In old Bi's book


We can compare the formula above and find that, with n = 8, we can get the code 65025 = (2 ^ 8-1) = 255 ^ 2, so it is mainly the calculation of MSE, mse is mean square error, so it can be inferred that diff_y should be the square of the error,

Let's look at the calculation of diff_y,


After contacting quad, I suddenly felt a little clear about the meaning of "array containing square values" in the original code comment. Then let's take a look at the assignment of Quad:


Look at the number 511. What a good number does it appear like 512, 256x2 = 512.

Therefore, we can know that the quad array is allocated 511 int space sizes:-255 ~ 0 ~ 255, exactly 511,

Look at the second red box. This sentence moves the pointer quad to the 255 position. You can see


The position indicated by the arrow is the current position of the pointer. let's look at the inside of the for loop. Before that, I couldn't understand why the subscript of the array uses a negative number. What does it mean now. therefore, in the for loop, the corresponding subscript location is stored as its square, and the square actually calculates the square of the error required by the MSE in advance. When the square of the error is calculated, you only need to check the table to improve the speed.

The value in the red box is actually an integer, because this is the difference between the original image pixel and the reconstruction image pixel, so the value can be negative or positive, in this way, the square of the corresponding residual is obtained. so far, I have finally understood the intention of the quad array and the implementation of SNR in the code.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.