PDA

View Full Version : Differences between PSNR calculations


challanger
22nd December 2011, 19:16
What is the differences between PSNR calculation methods depend on like yyuv,uyuv,rrgb ..etc.
http://s5.postimage.org/4dc097c7b/image.png

There is only one PSNR formula so How can I put this different color compenets in this formula?

http://s5.postimage.org/tr04t67if/asdd.png
:thanks:

LoRd_MuldeR
22nd December 2011, 20:54
The difference is for what you calculate the MSE/PSNR.

In the RGB colorspace there are three planes: R(ed), G(reen) and B(lue). Similarly in YUV colorspace the planes are: Y, U and V.

Obviously, from how PSNR is defined, you would calculate it separately for each plane, or only for a single plane.

See also:
http://software.intel.com/sites/products/documentation/hpc/ipp/ippi/ippi_ch6/ch6_color_models.html

challanger
23rd December 2011, 13:16
thanks
Obviously, from how PSNR is defined, you would calculate it separately for each plane, or only for a single plane
When we look PSNR formula which parametre will change and how ,for each color compenets?
For ex I think, for yyuv ,uyuv, vyuv MAXı must be 235 because of yuv interval,but how can I calculate MSE for each compenents?

Wilbert
23rd December 2011, 14:48
Suppose you want to calculate it for the luma plane (the other planes are similar):

Ya = [Ya11, Ya12; Ya21; Ya22] (so 2x2 pixels)
Yb = [Yb11, Yb12; Yb21; Yb22] (so 2x2 pixels)

thus m=height=2, n=width=2

MSE = 1/(2*2) * [ (Ya11-Yb11)^2 + (Ya12-Yb12)^2 + (Ya21-Yb21)^2 + (Ya22-Yb22)^2]
MAX_I = max(Ya11, Ya12, Ya21, Ya22) (so it doesn't need to be 235)
etc ....

challanger
23rd December 2011, 15:23
Thanks..
Suppose you want to calculate it for the luma plane (the other planes are similar):

Ya = [Ya11, Ya12; Ya21; Ya22] (so 2x2 pixels)
Yb = [Yb11, Yb12; Yb21; Yb22] (so 2x2 pixels)

thus m=height=2, n=width=2

MSE = 1/(2*2) * [ (Ya11-Yb11)^2 + (Ya12-Yb12)^2 + (Ya21-Yb21)^2 + (Ya22-Yb22)^2]
That was what I want..:sly:

But,
MAX_I = max(Ya11, Ya12, Ya21, Ya22) (so it doesn't need to be 235)
I 'm not sure about this.
It's wiki words >MAXI is the maximum possible pixel value of the image. When the pixels are represented using 8 bits per sample, this is 255.

Blue expression verifies your formula but Red says it's allways 255 :)
I've seen 255 value many times so I'm not sure here, can u make me sure Pleasee :/

Wilbert
23rd December 2011, 16:49
I 'm not sure about this.
It's wiki words >MAXI is the maximum possible pixel value of the image. When the pixels are represented using 8 bits per sample, this is 255.

Yes you are right, otherwise it could get negative.

The problem with using 235/240 is that even for a TV-scale source not all pixels are located between [16,235]. Think about noise, quantization errors. Also black is usually 'centered' around 16.

challanger
24th December 2011, 14:35
Yes you are right
Okay :) but what is the value 255,235 or what?

And Do you know -> Which standart is been used by Avisynth for rgb2yuv conversion?
ITU-R BT.601 or ITU-R BT.709

Wilbert
24th December 2011, 17:45
Okay but what is the value 255,235 or what?
255. For the reasons i said.

And Do you know -> Which standart is been used by Avisynth for rgb2yuv conversion?
ITU-R BT.601 or ITU-R BT.709
You can choose both of them (see documentation). By default it's neither of them, since that's Rec.601.

challanger
24th December 2011, 19:39
ok.thanks for help