View Full Version : SSIM 0.24, an objective video quality metric


Lefungus
10th September 2003, 00:57
This filter has been created following the ideas of Zhou Wang (http://www.cns.nyu.edu/~zwang/).
It has been coded with the great help of Mfa, who worked on the core functions.

For a given reference video and a given compressed video, it is meant to compute a quality metric, based on perceived visual distortion. Unlike the well-known PSNR measure, it's not purely mathematical, and should correlate much better with human vision.
Some examples here (http://www.cns.nyu.edu/~zwang/files/research/quality_index/demo_lena.html)
A higher MSE (and so lower PSNR) should mean that the compressed clip is a worse image but MSE and PSNR are flawed in this respect as numerous tests have shown. However with SSIM, according to tests carried out on the VQEG dataset, a higher Q (SSIM value) has a much better relation to the visual quality of the compressed clip. Despite this, bear in mind the SSIM metric still isn't perfect.

This filter is designed to compute an SSIM value by two methods, the original one, and a "enhanced" one that weight these results by lumimasking. On the todo list is to include the motion weighting.

This filter has five parameters:
ssim(clip1,clip2,"results.csv","averageSSIM.txt",lumimask=true)
clip1 and clip2 are the reference clip and the compressed clip.
results.csv is the file where obtained SSIM values will be written (this can be easily read in excel or notepad for those unfamiliar with the comma separated variables format)
lumimasking switch between the two methods.

When the video is closed, the filter will write a file named "averageSSIM.txt" that will contain the global SSIM value.

An SSIM value is between 0 and 1, 1 meaning perfect quality.

To analyse locally the results, you could use the csv files, and manipulate data in any excel-clone. Examples:
codec A vs codec B (http://perso.wanadoo.fr/reservoir/dl/ssim.png)
codec A with lumi option (http://perso.wanadoo.fr/reservoir/dl/ssimlumi.png)

In the csv file, when lumimasking is activated, both SSIM values and its weigth is written.

Nota:
-If you use B frames under xvid, trim the first dummy frame of the xvid clip, and the last frame of the original clip
-For those who used ssim 0.1, this version is also faster !

SSIM 0.24 Dll (http://perso.wanadoo.fr/reservoir/dl/SSIM-0.24.rar)
SSIM 0.24 Sources (http://perso.wanadoo.fr/reservoir/dl/SSIMSrc-0.24.rar)
This filter is released under the condition of the gpl license.

[EDIT]
version updated to 0.21:
-flag for globalSSIM added
-some checks added

0.22:
-added "scaled" parameter

0.23:
-minor memory leak removed

0.24:
-various bugfixes

Lefungus
10th September 2003, 13:50
Some script examples:

a=mpeg2source("C:\Vobs\pacte.d2v").crop(14,92,692,416).lanczosresize(640,256)
b=AVISource("C:\Vobs\xvid.avi").trim(1,0)
return ssim(a,b,"results.csv","averageSSIM.txt",lumimask=true)
In this example, i compare the dvd source to the xvid compressed version. As bframes are used, i have to trim the first frame of the xvid version.

a=mpeg2source("C:\Vobs\pacte.d2v").crop(14,92,692,416).lanczosresize(640,256)
b=AVISource("C:\Vobs\divx.avi")
return ssim(a,b,"results.csv","averageSSIM.txt",lumimask=true)
There, i compare the same source to a divx compressed version. No need to cut any frames there.


In the two examples, i compare the dvd to mpeg-4 codecs. But the SSIM metric should works as better on any codec, video source.

Nota:
-Compared clips must have same width/height/length
-SSIM is computed in yv12 colorspace

[EDIT]
Updated scripts

Selur
10th September 2003, 13:55
seems to work fine,..

Thanks for this nice tool ;)

It's especially cool if you do somethign like this:

A = Avisource("d:\Original.avs")
B = Avisource("d:\encode1.avi")
c = Avisource("d:\encode2.avi")

StackVertical(ssim(A,B,"Encode1results.csv",lumimask=false),ssim(A,C,"Encode2results.csv",lumimask=false))
since it allows you to see which frame get's what rating on which clip ;)


Cu Selur

Ps.: would be cool to also have an alternative flag, to set the output for the average SSIM, so the script I used would produce two average SSIM values. ;)

DDogg
10th September 2003, 16:27
Lefungus, this is an answer to a prayer as a few of us have been trying to compare the effects of matrices and filter combos on low bitrate mpg produced by CCE 2.67 and other mpeg2 encoders. If you have time, I have a few questions, some of which are fairly basic, so be patient with me :).

1> Could you give a short overview of the Y, U, V, SSIM, WEIGHT figures shown during the comparison. This may be a waste of your time as I realize that data is available later for comparison via the results.csv and averageSSIM.txt. I guess I am asking how I can "get a feel" for what is happening during the comparison pass. I am afraid this question may seem ambiguous to you. If so, no worry :)

2> Your method of seeking clip2. For clip2 I am presently using a d2v generated by dvd2avi which works great. However I was thinking of trying Nic's mpegsource as it automatically creates the d2v and would eliminate that step, but if I remember correctly it has trouble with multiple seeks. Are you doing an end to end on clip2 or multiple seeks?

/ADD
3> I was interested in comparing different encoded sample clips. To test that I used clip1 = "clip1.d2v" and clip2= "Copy of clip1.d2v" and indeed got an Average SSIM= 1.0. So far so good.

Next test was clip1=knowngood.d2v clip2=known_inferior.d2v and again it showed a lower Average SSIM= Average SSIM= 0.666261. Still looking good.

Next, and here is either the problem or my confusion showing, I reversed the order of the test above to clip1=known_inferior.d2v clip2=knowngood.d2v and this time got an Average SSIM= 0.657958 which was about the same value as the reverse test above. I guess I expected the result to be an "out of range" or >=1, yet it was not.

What are your thoughts? Is this type of encoded clip comparison practical?

Because most of the information was specific to DVD2SVCD, I placed a post here in the DVD2SVCD. I hope you do not mind. http://forum.doom9.org/showthread.php?s=&threadid=61172

Lefungus
10th September 2003, 18:44
Originally posted by DDogg
I have a few questions, some of which are fairly basic, so be patient with me :).
Do i look so rude ? :D

1)
Y, U, V values are SSIM values for each plane for the current frame. Later they are weighted and averaged. Y is luminance, and U,V colors. Human vision is much more sensible to luminance so this plane has much more influence than the color planes.
SSIM is the current quality index, scaled from 0 to 1.
Weight is the coefficient that will be applied to the current SSIM value when the global SSIM value will be computed.

2)
To use this filter i suggest you load the script into vdub, play it from beginning to end without skipping frames or seeking specific frames. Nic mpegsource behaviour is unknown when you seek into the video, so if you do it this way, no problem should arise. I don't use any special trick, if you call frame 1, i'll ask frame 1 from clip 1 and frame 1 from clip 2.


@Selur: it'll be added in next version :)

Lefungus
10th September 2003, 18:55
Theorically ssim(a,b) = ssim(b,a)

In your case it looks like it isn't

About comparisons:
a is a video clip
b is a compressed version of a
c is another compressed version a

You could use ssim(a,b) and ssim(a,c) and compare these results but i don't think you could get any information from doing ssim(b,c).

[EDIT]

On all my tests, ssim was perfectly symmetrical, so i can't reproduce your result DDogg :/

Prettz
11th September 2003, 02:17
Originally posted by DDogg
Next, and here is either the problem or my confusion showing, I reversed the order of the test above to clip1=known_inferior.d2v clip2=knowngood.d2v and this time got an Average SSIM= 0.657958 which was about the same value as the reverse test above. I guess I expected the result to be an "out of range" or >=1, yet it was not.


It sounds like the filter is set up assuming that the first clip is the "original", so putting the inferior clip as the original and comparing a better-looking clip to it doesn't mean anything in that context, and to me it seems sensible that doing that could produce any kind of wacky result.

DDogg
11th September 2003, 03:16
and to me it seems sensible that doing that could produce any kind of wacky result. Yes, it does, however it got stranger after that. Actually, when I took great care and exactly replicated the test B-C and C-B the csv yield *identical* results to six decimal places, which I thought was odd as I expected a whacky result of some kind, but not identical, although I guess you could say that was symetrical in a way :). Anyway, we have been PMing all day and I sent up a set of files to help Lefungus work with mpeg2 as he mentioned most of his work had been with XVID and DIVX. I hope this tool ends up working with mpeg2 as it would be very useful.

MfA
11th September 2003, 04:28
SSIM simply doesnt care on which input the reference is because it is entirely symmetrical, just like MSE/PSNR.

DDogg
11th September 2003, 17:16
Well it is symmetrical if you don't screw up and get a framecount unbalance like I did :o

One thing for mpg2 users to be careful of is the the two samples must be the exact same frame count (obviously), however, when using a mpv of a verified 5001 framecount, I noticed when using dvd2avi to create the d2v used in mpeg2source("b.d2v") that the framecount became 4998. So it is best to use the trim statement of a slightly smaller value to actually insure the exact frame count and double check it in VDub using file/information. I used mpeg2source("b.d2v").trim(0,4499) to give me an exact 4500 frames.

I noticed lafungus has updated ssim to catch this framecount unbalance in the newer version he posted so maybe it will not slip past others like it did for me using the first version.

Sidenote:I was gently pointed to the heavy thread in the dvd2avi forum dealing with this very subject where DG is putting in an enormous amount of effort dealing with framecount errors between dvd2avi and mpeg2dec. I don't read that forum much so I was unaware. Thanks!

Lefungus
11th September 2003, 21:48
In version 0.22, the global score is scaled from 0 to 100 instead of 0 to 1. it's just a simple conversion: newValue = 100 * pow( oldValue, 8)
With this, different values between two clips may be more visible.

example on a small xvid sample:

high bitrate clip: 82
low bitrate clip: 66

If you prefer it non-scaled, just add "scaled=false" as parameter.
For the same sample, it'll give:

high bitrate: 0.975
low bitrate: 0.949

DDogg
11th September 2003, 23:15
With this, different values between two clips may be more visible. Very much so, with the new values it is a snap to quickly get an idea of the quality of the encode. Thanks very much for this new feature, it makes using SSIM much easier and straightforward.

KpeX
11th September 2003, 23:27
Great tool, Lefungus. I've also needed to adjust some framecounts to get the right frames when comparing D2V to AVI. I usually test the script first with a StackVertical and scan through it frame by frame in VDub to make sure the correct frames are corresponding.

deXtoRious
13th September 2003, 21:17
The tool is great, however it's approx. 5-6 times slower than PSNR or VQM. Is that just a lack of optimisation or is it inherent in the very nature of the algorithm?

MfA
13th September 2003, 21:41
Could probably be sped up 2 times with assembly, more with subsampling ... but I prefer it slow over subsampled. Removing the memory leak I introduced might also help a bit.

PSNR sucks period, and VQM is poor in weighing blocking artifacts.

Lefungus
28th September 2003, 17:13
Sh0dan has added conditionnal functions, so the ssim metric could be used in conditionnal scripts.

For example:
a=avisource("c:\blah.avi")
b=a.filter()
return conditionalfilter(a,b,a,"SSIM_AVG(a,b)","<","0.98",true)
will return b, if ssim(a,b)>0.98, or a if b is bad ssim-wise (meaning it may filter too much). 0.98 is an arbitrary value, and should be replaced by your own adequate value.

It may also be used in a 3-pass encoding scenario, when you filter more encoded frames, that have a too low ssim value.

a=avisource("c:\blah.avi")
b=a.filter()
c=avisource("c:\blah-2pass-encoded.avi")
return conditionalfilter(a,b,b,"SSIM_AVG(a,c)","<","0.94",true)

I have no idea if it'll give good results, but the concept is interesting :)

Get the dll here (http://perso.wanadoo.fr/reservoir/dl/SSIM.dll)

sh0dan
28th September 2003, 18:06
I had a few concepts in mind for "extreme" compression optimizitation:

Case 1:
Do an ordinary two-pass encode. Compare the output to the source. If SSIM difference is big, do additional filtering on these frames for a third/fourth pass.

Case 2:
Compare original frame to a blurred version. This should give a fairly good idea on the amount of high-frequency (spatial) detail level. This value could be used for setting threshold for a filter.



PS: There is also conditional functions for retrieving Y,U & V-plane only SSIM difference.

SSIM_Y(clip a, clip b)
SSIM_U(clip a, clip b)
SSIM_V(clip a, clip b)
SSIM_AVG(clip a, clip b) = 0.8 * SSIM_Y(a,b) + 0.1 * SSIM_U(a,b) + 0.1 * SSIM_V(a,b)

Lefungus
28th September 2003, 18:14
Actually, i've followed the ssim way for average, so it's :

ssim_avg=0.8*ssim_y + 0.1*ssim_u +0.1*ssim_v

as Y plane has much more visual impact than UV planes

sh0dan
28th September 2003, 18:16
Didn't I write that? :D

(ok - I edited the post above to avoid misunderstandings) ;)

DDogg
30th September 2003, 01:04
Wow...This sounds like a potential nugget of gold hidden away in this thread. I'm getting all excited. I think you are saying one could compare each frame back to the source and then apply filters to each frame based upon the quality index returned by ssim. Is this correct? I do have a difficult time understanding this stuff.

I wonder if one or both of you could flesh it out a little more and maybe post a more complete example of a test script so folks like me could do some testing. I can't quite get there by myself and could use the help.

In my case I would like to try it with CCE 1-pass vbr with two to three filter combos like none, deen, and heavy (maybe deen with light blurring?)

In re-reading the above I realize I may be confused as you both mention multipass as if this may be "pass based" conditional versus frame based. Any help you can give me towards understanding the above more fully and getting a working test script would be appreciated. I can do alright with this stuff once someone kickstarts me.

Btw, your "get the dll here" above is a new version or is it 0.23? Might be better to just point people to the top of the thread?

sh0dan
30th September 2003, 20:18
A "simple" script that chooses between three resizers.

mpeg2source("c:\temp\twinpeaks\pilot\pilot.d2v",idct=6)
crop(18,4,-10,-4)
pre_resize = last
lanczosresize(352,288)
# return last #use this for first encode

v_org=last
v_comp=avisource("uncompressed.avi").converttoyv12()

soft = bilinearresize(pre_resize, 352, 288).subtitle("soft")
medium = bicubicresize(pre_resize, 352, 288).subtitle("medium")
sharp = lanczosresize(pre_resize, 352, 288).subtitle("sharp")

medium = conditionalfilter(medium, sharp, medium, "sim_diff", ">", "0.97")
conditionalfilter(medium, soft, medium, "sim_diff", "<", "0.96", false)
frameevaluate("sim_diff = ssim_avg(v_org, v_comp)")

First I encoded the file to MPEG1, using the return statement at the top .I didn't have any MPEG2 encoder on this machine, so I had to use MPEG1 and decompress the MPEG 1 -> AVI. MPEG2 is much easier, and doesn't require colorspace conversions.

Then the filter chooses between three different resizers based on the quality measurement. The numbers I've entered seemed to fit my source, but they will most likely have to be adjusted.

DDogg
30th September 2003, 22:53
hmmm, thanks, sometime I just think you just like to mess with my head and make me feel completely dumb. I'll have you know I am only partially dumb! :)

Let's assume we have a progressive source DVD and we have created our original.d2v. I was thinking v_comp=Avisource("original.d2v+Crop&resizingfilters.avs") would be the comparison part very much like a standard ssim comparison. I can't reconcile that with the example you gave (much to my shame). I don't even have a clue what you are doing with v_org=last

In reviewing the above posts on this topic from you and LaFungus it seems you are speaking of two different methods. One uses a comparison source which is an uncompressed AVI that I assume would have only had resizing applied. The other with an example by lafungus uses the original source.

The second one using original source from the d2v is where I am trying to get. I think it is obvious this stuff is a little above my skill set, however if I can understand it I think I could help some other partially dumb folks to do so also. More help would be appreciated. :o

sh0dan
1st October 2003, 08:23
Originally posted by DDogg
Let's assume we have a progressive source DVD and we have created our original.d2v. I was thinking v_comp=Avisource("original.d2v+Crop&resizingfilters.avs") would be the comparison part very much like a standard ssim comparison. I can't reconcile that with the example you gave (much to my shame). I don't even have a clue what you are doing with v_org=last

"pilot.d2v" is the original source. "uncompressed.avi" is the compressed result that has been decompressed to a huffyuv. Exchange the avisource with your compressed d2v. As I wrote I did this for a workaround since I didn't have an MPEG2 encoder.

For creating the first compressed result uncomment the "return last" and encode the result. You might want to adjust the script if you are doing SVCD/DVDR. If you need deinterlacing/ivtc insert it before "pre_resize = last".

The resize filters are just as an example - you can put additional filters inthere.

"v_org = last" just assigns the current video (after the lanczosresize) to v_org, as this has to be used for the SSIM comparison later.

mf
1st October 2003, 12:43
Your Subtitle()s are impairing your SSIM result :D.

sh0dan
1st October 2003, 15:28
No - because neither of these three sources are used for the compare (v_org is compared to v_comp).

ronnylov
2nd October 2003, 16:09
I have following idea:

1) Encode without filter.

2) Encode the same source with a filter

3) Use SSIM and compare 1) with original and then compare 2) with original on each frame

4) Make a final third encoding and select filter or not filter on each frame of the original depending on if ssim on 2) was better than ssim on 1) or not.

I think this could be useful when making VCD (or any other CBR encoding format) where the bitrate is fixed and cannot vary with the quality of the input. If it's applied on a VBR encoding then the bitrate distribution makes the final result more unpredictable I think.

Do you think this could be a good method to improve the quality and can it be done with ssim and avisynth? Could it also be done with more than two encodings with serveral levels of filtering, always choosing the best filter combination on each frame depending on which encoded clip that had best ssim value?

I got the idea after reading shodan's rezising selecting script. But his script does not check the results after encoding when another resizer is applied and I want to select the best one on each frame based on results after encoding. But I don't exactly know how to code it in avisynth.

It would require several encoding passes (at least 3, two to compare with the original and one final) and is a little bit time consuming but if quality is very important maybe this does not matter.

slk001
2nd October 2003, 16:21
How about attaching a "README.TXT" with the proper usage/syntax to the .DLL download?

w2e3r4
16th January 2004, 06:54
I have 3 questions:

1. What is the reason for scaling the result in the new version?
newValue=pow(oldValue,8)

2. How do I use ssim filter without actually doing the encoding and saving the avi file in VurtualDub? Is there an option to discard the output?

3. What colorspace should I use for the comparison?

Thanks,

Manao
16th January 2004, 07:34
Originally posted by w2e3r4
1. What is the reason for scaling the result in the new version?
newValue=pow(oldValue,8)It's just to make the range of variation of the value larger. For example, if oldValue was varying between 0.94 and 0.96, newValue will vary between 0.61 and 0.72. It's just easier to read the value that way, because with the previous version, values were ranging roughly from 0.92 to 0.99.2. How do I use ssim filter without actually doing the encoding and saving the avi file in VurtualDub? Is there an option to discard the output?Open your script in VDub, and hit the 'play' button ( or space key ). When the processing of the clip is finished, close the clip ( ctrl - w )3. What colorspace should I use for the comparison?YV12

HLW
19th March 2004, 15:29
Lefungus, this seems to be a great tool! I am using it for my master thesis where I compare different codecs. But I need to document what is happening in the algoritm. Is it possible to get information of what weighing values you use in the algorithm? I`ve read the "Video Quality Assessment Based on Structural Distortion Measurment" by Zang, Lu and Bovik. Have you used the values suggested by them?

By the way, any plans of implement support for more colorspaces, for instance 4:2:2?

Best regards

Haakon

MfA
19th March 2004, 15:56
As they say ... the code is it's own documentation ;)

But it uses the .8 .1 .1 weighting for the planes, luminance based weighting is implemented as suggested in the article (note that the SSIM results are the weighted average of SSIM values for blocks/frames though, so dark frames might have a low SSIM value anyway ... you have to look at the frame weight to see that that is not considered important). Motion based weighting is not performed at all.

4:2:2 would be easy to add, why dont you do it? :) (Be carefull though, this metric is really not designed for interlaced content ... although it will do in a pinch, but you should use seperatefields before applying it.)

Marco

HLW
22nd March 2004, 20:38
I`m afraid thats outside my knowledge:), but if anyone is capable of it and wants to do it, I would be happy!:D . However, I have another comment: I've tested SSIM with the same clip both as target and reference. And the strange thing is that I don't get SSIM value 100 as I would expect, but only something close (96-98, depending on the clip). Does anyone have comments on that?

MfA
22nd March 2004, 22:10
A comment ... hmmm, I should test my code better? :(

It is a bug, Ill take a look.

Manao
22nd March 2004, 22:41
if(lumimask)
{
if (luminance)
{
frameSummedWeights = 0;
for (y = 0; y < height / 2; y++)
for (x = 0; x < width / 2; x++)
*(weights + y * strideUV + x) = 0.0f;
}
}
else
frameSummedWeights = (height - 7) * (width - 7);
If lumimask = true, and you're treating the chroma, you're not initializing properly the weights.

MfA
23rd March 2004, 00:04
That's part of it, I just forgot for a moment that there are only (height-7)*(width-7) SSIM values in a luminance plane. So the divide coordinates by 2 trick will not map 4 weights in the luminance plane to 1 weight in the chroma plane.

MfA
23rd March 2004, 02:04
Okay there is a slightly updated version here :

http://home.student.utwente.nl/m.f.al/ssim/

Ill verify if it gives the same results as the old one without lumimasking tomorrow ... and proof read it again. If anyone else wants to take a look Ill be glad for any help :)

TorgoGuy
24th March 2004, 05:50
Originally posted by MfA
Okay there is a slightly updated version here :

http://home.student.utwente.nl/m.f.al/ssim/

Ill verify if it gives the same results as the old one without lumimasking tomorrow ... and proof read it again. If anyone else wants to take a look Ill be glad for any help :)
I have only tried this test version and not the 0.23 version, but I think I have a bug to report.

AVS File:
=========
LoadPlugin("m:\proj\_plugins\ssimtest.dll")
a=AviSource("lotr1.avs")
b=AVISource("def.avi")
c=AviSource("GMCVHQ4.avi")
StackVertical(ssim(a,c,"ls_GMCVHQ4.csv","ls_GMCVHQ4.txt",lumimask=true),ssim(b,c,"ld_GMCVHQ4.csv","ld_GMCVHQ4.txt",lumimask=true))
Problem:
========
In the .csv files most lines look normal (with SSIM values and weight), but there are many blocks where the lines are just:
0.000000,0.000000
0.000000,0.000000
0.000000,0.000000
0.000000,0.000000
(that could be normal--not sure). The bigger problem seems to be that there are also many lines that look like this:
-1.#IND00,0.000009
-1.#IND00,0.000173
-1.#IND00,0.000559
where the SSIM column is always the same and the weight column varies somewhat.

Also, looking in the average SSIM file, it looks like this:
SSIM: Structural Similarity Index Metric 0.23
Average SSIM= -1.#J

Am I doing something wrong?

MfA
24th March 2004, 21:58
No, more bugs ... not dealing correctly with frames with near 0 weight on my part.

One more try, lets see if it works this time :

http://home.student.utwente.nl/m.f.al/ssim/

TorgoGuy
25th March 2004, 05:50
Thanks for the update. I'm rerunning the problem files. So far it looks like that bug is gone. All of the "0.000000" and "-1.#IND00" lines have been fixed so far.

I have a question regarding how the average value is calculated when using lumimasking. You explained that without lumimasking it is simply 100 * Pow(AvgSSIM, 8). With lumimasking, in place of "AvgSSIM" in the equation above do you use: ((the sum of (FrameSSIM * FrameWeight))/(the sum of the weights))?

Thanks a lot. To my eyes this (SSIM) does seem to be a very good quality measurement. Excellent work!

TorgoGuy
25th March 2004, 19:17
Originally posted by TorgoGuy
Thanks for the update. I'm rerunning the problem files. So far it looks like that bug is gone. All of the "0.000000" and "-1.#IND00" lines have been fixed so far.
Just a note to tell you that the problem files have been completed and the new version worked perfectly.

Gannjunior
19th July 2004, 15:42
Hi Lefungus,
thanks for your very useful dll.;)
I always used it without any problem.
Now I'm preparing a comparison between codecs and i'm testing neo divx 5.2: but i can't obtain logical values when i set Multiple adaptive bframes (with single adaptive there's no problem).I obtain, in each bitrate condition, a value of 3.71 %...As first thing, i've checked the synchrony of video in Vdub between source and encoded file and it's ok.
Only a strange thing: when i start vdub 4 comparison i can observe SSIM luminance component has big fluctuations... any idea to solve the problem?
Ah, I've also checked a little part inside the encoded file using trim, to avoid any (possibles) problems at the begin or at the end of encoded file caused by "strange" disposition of GOP in presence of multi adaptive bf (only a supposition...).

TIA

Ciao!:)

Dams
20th July 2004, 18:23
U should use .trim(1,0) on the source, because first frame of AVI files with B-frames are not readable.

Gannjunior
22nd July 2004, 16:26
@Dams
I know the question about the cut of first frame, underlined by the same Lefungus in the first page of 3d, but the problem is about Xvid and its bframes...Divx hasn't got this problem.However, as i told in my message above, first, i'm speaking about divx, and, in particular, about 5.20.Second, as i underlined in my previous message, I've done differents attempts to calculate SSIM in presence of multiple bframes: from the cut of first frame to take a trim inside the encoded avi (for example: the avi is 1700 frames; i've tried to calculate SSIM on trim(10,1690), but I get a SSIM value with any significance...).

Does anybody want to try to calculate SSIM in divx 5.2, in presence of multiple bf?
Lefuuu!!! where r u?!?:(

ciaoo!:)

Manao
22nd July 2004, 17:12
Gannjunior : it has nothing to do with SSIM. I made a PSNR test with DivX 5.2 without any problem at all, using trim(1,0), so try that solution again, you'll see that it's working correctly.

Dams
22nd July 2004, 20:03
Same as Manao! :cool:

Gannjunior
22nd July 2004, 22:12
Ok friends, It would been enough to tell me (from the begin) that SSIM is not compatible with divx 5.2 's multiple bf, stop. Obviously I've seen PSNR is perfectly calculable with divx 5.2 Multi bf, but i'm sure you know PSNR's limits...SSIM is not perfect, but, without any doubts, it takes into account better the images's strucutal similarity than PSNR, so obtained values are better agree to visual perceptions than PSNR. And it's what I need to value a particular setting as multiple bf...

ciao :)

Lefungus
22nd July 2004, 22:18
SSIM is quite "dumb", it just compare frames that avisynth output.
If your frame order is broken, it'll give corrupted results.
I advise using stackvertical and vdub to manually check if frames between the two videos are actually correctly synchronized. If they're not, you just need to play with trim until it's correct.

Gannjunior
22nd July 2004, 23:30
Hi Lefungus,
as I told in the first message, synchrony's check is first thing i've done.I 've tested 2 differents sources, and the problem is always the same.I've checked frame after frame the sync, but it was ok.
I've also noticed a thing in my last little test: at the moment i'm working on 7th chapter of blade runner and i've done differents tests on the first 1701 frames.I've obtained a complete encoding of all 1701 frames on a Q=2 test with muliple bf on.But I've obtained a 1700 frames encoding doing a 2pass encoding at low bitrate with multiple bf on.In the first case (saturation) the synchrony is perfect and i've checked frame after frame with my eyes.In second case (2pass low bitrate) it's been enough to trim(1,0) to obtain syncronization.And I've checked the SSIM in both cases obtaining values (half more ore less) too much low, compared to the same ecncoding wiht single bf.
I'm sure if you do a little attempt you can confirm my problem.

ciao!

MfA
23rd July 2004, 03:16
A ridiculously low SSIM value will mean a low PSNR too, they dont correspond but they do correlate. If you want to post some clips it would be helpfull.

Manao
23rd July 2004, 07:44
gannjunior : post your encoding script, and your script in which you compute the SSIM please.

Junior73Italy
23rd July 2004, 11:01
@GannJunior
Hello Gann is Junior73 of doom9.it The problem interests also me
because is creating with to Robot1 an utility called AUTOSSIM that
automates the calculation of the SSIm working with DGindex, Virtual
dub mod and avisynth.The program we must still publish .The first version will be beta1,I hope. Here the link of the Italian forum for greater info.:

http://forum.doom9.it/viewtopic.php?t=8484

We will add to the program new features in the future. I have one
question to make to Lefungus on the direct comparison of two field between two interlaced clip.But my English is not very well.

Can you help me?

The Avisynth script I use :

LoadPlugin("C:\Programmi\AviSynth 2.5\plugins\SSIM.dll")
LoadPlugin("C:\Programmi\AviSynth 2.5\plugins\DGdecode.dll")
A=DirectShowSource("G:\CCE Prove\Clip dv.avi",25,audio=false,video=true).SeparateFields().SelectEven().ConvertToYV12()
B=DirectShowSource("G:\CCE Prove\Clip dv.avi",25,audio=false,video=true).SeparateFields().Selectodd().ConvertToYV12()
C=mpeg2source("G:\CCe Prove\Tmpegdv 5000.d2v").SeparateFields().SelectEven().ConvertToYV12()
D=mpeg2source("G:\CCe Prove\Tmpegdv 5000.d2v").SeparateFields().Selectodd().ConvertToYV12()
Semiquadro1=SSIM(a,c,"semiquadro1.csv","semiquadro1average.txt",lumimask=true,scaled=false)
Semiquadro2=SSIM(a,d,"semiquadro2.csv","semiquadro2average.txt",lumimask=true,scaled=false)
StackVertical(semiquadro1,semiquadro2)

GoodBye

@Wilbert

Sorry....

Wilbert
23rd July 2004, 11:55
@Junior73Italy,

This is an english forum. I hope you can add an english summary/translation to your post.

Gannjunior
23rd July 2004, 12:56
Hi,
i'm going on the beach now...:D
Manao, tonight I'll post my scripts ;)
Willbert, in previous post Junior73 has asked me to translate his question for Lefungus; i'll do it tonight ;)

[OT mode on]
Ciao Junior, poi vengo a leggere bene il post su doom9italy per comprendere bene il problema:)
[OT mode off]

ciaoo!

Gannjunior
23rd July 2004, 23:53
Manao, this is the simple encoding script used for all my tests on 7th chapter of blade runner.

LoadPlugin("C:\AVS\Plugin\AviSynthPlugins\dgdecode.dll")
#
mpeg2source("F:\Burner_Temp\Blade Runner\c7.d2v")
crop(30,86,656,410)
trim(0,1700)
LanczosResize(640,272)


and this is the SSIM script.

SetWorkingDir("D:\Test\ExtraPlugins\AviSynthPlugins\")
LoadPlugin("DGDecode.dll")
LoadPlugin("ssim.dll")

source=mpeg2source("F:\Burner_Temp\Blade Runner\c7.d2v").crop(30,86,656,410).LanczosResize(640,272).trim(0,1700)
encoded=aviSource("D:\Test\5.20\207.avi")
return ssim(source,encoded,"D:\Test\res.csv","D:\Test\avgSSIM.txt",lumimask=true)


Obviously, every time I needed, i modified it to work correctly for xvid + bf etc...I haven't any problem, except to calculate SSIM in divx 5.2 + multi bf test where I obtain illogical values...
Ans I'm sure to compare exactly the same frames between source and encoded file, 'cause I've checked them frames after frames...

http://gannjunior.altervista.org/immagini/doom9/test.GIF


In another test i'm doing on a different source (4th vob of pearl harbor), in presence of multi bf, i can't achieve values different from 3.71 or 3.78%, even if i change bitrate...(with resulting changement of size...).
So, what i've explained, is my problem with divx 5.2... (besides to the fact mpeg2 matrix give me saturation size by far smaller than h263...:mad: ...bug?!)

@Wilbert
Later I'll get all informations from Junior73 about his question for Lefungus and i'll post it for him.

ciauzz!:)

bgpop
24th July 2004, 10:44
hi, gannjunior... your script seem correct...
They are something of strange on the b-frames implementation of divx 5.2 (also assuming that Xvid's multipls b-frames don't cause any trouble).
I think i will do some tests to verify ur problem...


ciao bello ;)

Manao
24th July 2004, 11:33
http://home.student.utwente.nl/m.f.al/ssim/

Since you posted on that thread, you should have got the latest version. BTW, thank you, it allowed me to see that my SSIM version wasn't up to date ( I was having the same issue as you were ).

MfA
24th July 2004, 14:58
Buffer overflows do funky things ...

HLW
27th July 2004, 10:02
Hi!

I wonder, is it possible in any way to run several ssim-analyses in a row on different targets (for instance with different bit rates) without having to run the script over and over again, and then make the ssim-results be written into different files?

- Haakon

redfordxx
9th March 2005, 16:28
When I have the .csv file with SSIM and weight for each frame, how can i calculate SSIM average for some part of video?

On2Tech
17th March 2005, 23:25
I am trying to understand the ssim code as it stands now.

I am particularly interested, in the usage of the luma mask.

I think the concept behind luma mask option is that when there are mixed brightness pixels in the same image bright pixels are more important than dark pixels. I think that there is some merit to this point, and even some research to back it up.

However the way the code is written ssim extends that concept beyond images to entire frames. In affect in this test dark frames are weighted far lower than light frames.

Imagine a video clip in which the first half of the clip includes a dark frame with white text in one small section of the screen, and the second half of the clip involves the exact opposite black text on a mostly bright frame.

The second half of the clip could be given a weighting nearly 100 times the first half of the clip.

I don't think most people would find a compression of these clips that threw 100 times as many bits on the second half than the first half more appealing than one that gave both halves of the clip roughly the same number of bits.

As such I suggest a slight alteration to the code.

I propose a change from:

d = (0.8f*a)+(0.1*(b+c));
summedWeights += frameWeight;
summedQuality += d * frameWeight;

to

d = (0.8f*a)+(0.1*(b+c));
summedWeights += 1;
summedQuality += d;

this avoids the issue by using luma masking to determine quality of each given frame, but then just averages this value across the wide spectrum of frames.

dr.Prozac
20th March 2005, 17:12
Hi !
I have just written the following script and it doesn't work at all (MPC and VDMod crash when open the script).
I compare XviD clip to oryginal dvd project. My encoded avi consists of 159845 frames (I used trim during encoding) and this is the reason of trim(...,159845) in my script. I decided to use trim(3,...) because of using XviD with B-frames.


LoadPlugin("C:\PROGRA~1\GORDIA~1\DGMPGDec\DGDecode.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\SSIM.dll")

a=mpeg2source("D:\My documents\My video\Apartament\Apartament.d2v").trim(3,159845).crop(2,12,716,552).lanczosresize(544,288)

b=AVISource("D:\My documents\My video\Apartament\Apartament.avi").trim(3,0)

return ssim(a,b,"d:\results.csv","d:\averageSSIM.txt",lumimask=true)


Could you please suggest me what is wrong with this script (?)

redfordxx
20th March 2005, 17:37
Originally posted by dr.Prozac
Could you please suggest me what is wrong with this script (?)
Try BSPlayer --- craches rarely, sometimes ends with excepion but does the work. (got WinXP SP2)

Lefungus
20th March 2005, 18:08
Originally posted by On2Tech
I am trying to understand the ssim code as it stands now.
[...]
As such I suggest a slight alteration to the code.

I propose a change from:

d = (0.8f*a)+(0.1*(b+c));
summedWeights += frameWeight;
summedQuality += d * frameWeight;

to

d = (0.8f*a)+(0.1*(b+c));
summedWeights += 1;
summedQuality += d;

this avoids the issue by using luma masking to determine quality of each given frame, but then just averages this value across the wide spectrum of frames.

Well, SSIM is just implemented the way it is demonstrated in the white papers and especially in Video Quality Assessment Based on SSIM (http://www.cns.nyu.edu/~zwang/files/papers/vssim.pdf)
It could surely be improved, like adding the motion weight, coupled with the Multi-scale index.
About modifying the overall value calculation, well, I would prefer sticking to the paper since it actually has some testing behind even if it could be seen as inappropriate.

dr.Prozac
20th March 2005, 19:43
Thx redfordxx. Unfortunately BSPlayer also crashes on this script. Something incorrect must be inside it.

redfordxx
20th March 2005, 20:32
Originally posted by dr.Prozac
Thx redfordxx. Unfortunately BSPlayer also crashes on this script. Something incorrect must be inside it. Yeah, I was afraid...

Try another thing:
1. Make source.avs which equals your avi (e.g. checke in VDMod that it starts and ends with same frame --- no bframe lag, same resolution)
2. write script like
a=AVISource(...source.avs).trim(100,200)
b=AVISource(...avi).trim(100,200)
SSIM...
3. If it works, make it longer --- if not, start cropping a and b.
Mostly it crashed, for me helped to crop 8,16 or so borders. Don't know why but helped...

dr.Prozac
21st March 2005, 02:29
You were right redfordxx. Tht was my mistake - I didn't count the number of frames properly. Just one frame missing at the end of the clip. So I think it's a good idea to trim as you've suggested to be safe and protected against the difference of the number of frames.
I just wonder why the value of Average SSIM is > 1 in the txt file.
I got a result Average SSIM= 82.09 (?) It looks like a sum - not average.

redfordxx
21st March 2005, 10:04
Originally posted by dr.Prozac
You were right redfordxx. Tht was my mistake - I didn't count the number of frames properly. Just one frame missing at the end of the clip. So I think it's a good idea to trim as you've suggested to be safe and protected against the difference of the number of frames.
I just wonder why the value of Average SSIM is > 1 in the txt file.
I got a result Average SSIM= 82.09 (?) It looks like a sum - not average.
It's OK. I guess Manao wrote somewhere something about how's that calculated. Whatever, just take it. Full quality=100(%)

dr.Prozac
21st March 2005, 16:30
It's OK. I guess Manao wrote somewhere something about how's that calculated. Whatever, just take it. Full quality=100(%)
I see :)
Thanks for yor posts redfordxx.

Lefungus
21st March 2005, 18:51
Originally posted by redfordxx
It's OK. I guess Manao wrote somewhere something about how's that calculated. Whatever, just take it. Full quality=100(%)

Or you can read the first page of this thread where I explain what those values mean...
It can be disabled if you do prefer "unscaled" results.

On2Tech
22nd March 2005, 20:14
Originally posted by Lefungus
Well, SSIM is just implemented the way it is demonstrated in the white papers and especially in Video Quality Assessment Based on SSIM (http://www.cns.nyu.edu/~zwang/files/papers/vssim.pdf)
It could surely be improved, like adding the motion weight, coupled with the Multi-scale index.
About modifying the overall value calculation, well, I would prefer sticking to the paper since it actually has some testing behind even if it could be seen as inappropriate.

I understand. Thanks for the reply and for the useful plugin. Seemed odd to me but perhaps that's the way it was intentioned.

Poutnik
23rd June 2005, 07:26
Can I get SSIM value of compared 2 frames by any script (user) function ?

Kurosu
14th September 2005, 14:47
I thought some of you might be interested into seeing who is one of the guy behind SSIM, so here is a blurry, unedited picture (http://kurosu.inforezo.org/IMG_1067.JPG) of him almost live from ICIP 2005 (http://www.icip05.org/welcome.htm)

I also discussed with him a bit about this community and how he could find some info about how his algorithm is used. He'd be dearly interested into learning the actual names of the avisynth plugin authors. And maybe, if you play nice, he'll interact with all of us ;-)

Edit:Bold is correction. No time for more comments right now.

Wilbert
14th September 2005, 15:24
Cool! Looking at the number of papers, it must be a very big conference :) What other fun/interesting stuff did you see on that conference?

Dams
18th September 2005, 13:06
up little post!

Kurosu
19th September 2005, 20:35
Cool! Looking at the number of papers, it must be a very big conference :) What other fun/interesting stuff did you see on that conference?
Erm, this is rather off-topic. I'll bring this very discussion into private matters. And I have anyway nothing to add to the SSIM topic otherwise...

Archimedes
13th January 2006, 17:46
When calculating the SSIM index on still images all possible sampling windows (8x8) where selected since the sliding window moves pixel-by-pixel across the whole image.

How many sampling windows per frame are used by the SSIM filter?

Best regards
Josef

MfA
13th January 2006, 18:40
Exactly the same. Is the code that unreadable? :)

mjt
22nd March 2006, 16:22
Hi all,

I would like to use SSIM 0.24 for my project but I need it in Linux environment. Has anybody implemented it in Linux or can anybody help me in making SSIM 0.24 compatiable with Linux ? Thanks a lot.

Best Regards
mjt

MfA
22nd March 2006, 16:59
Change SSIM so it doesn't inherit from GenericVideoFilter. Change the constructor so it doesn't use PCclip and ScriptEnvironment (pass width&height explicitly). Rip out everything from SSIM::GetFrame onward in the cpp file. Make equivalent changes in the h file. Remove all the windows/avisynth specific includes and find the linux replacement for aligned_malloc/free and after that you should have something which should compile.

thuongshoo
7th August 2006, 11:19
Hi ! source file is wmv . I do ssim for 2nd and I have two ssim value . why ? Is that file has "2 quality" ?

CruNcher
8th August 2006, 02:14
thuongshoo never trust directshow it's the only tip i can give you :P

Fizick
11th August 2006, 21:54
Where is latest SSIM source (probably with integer lumimasking) ?

Wilbert
11th August 2006, 22:44
http://www.geocities.com/wilbertdijkhof/ssim-0.24a.zip

should include the fixes ...

(More good news :) I received the code of most of Clouded's plugins, and will upload it tomorrow.)

Revgen
11th August 2006, 23:58
http://www.geocities.com/wilbertdijkhof/ssim-0.24a.zip

should include the fixes ...

(More good news :) I received the code of most of Clouded's plugins, and will upload it tomorrow.)

Is Clouded involved in the scene anymore?

Fizick
12th August 2006, 05:18
Wilbert,
thanks for SSIM source..
But included binary is not corresponded to the source, it from older version.
And resource version is still 0.23.

mess,mess,mess.

Wilbert
12th August 2006, 13:27
Wilbert,
thanks for SSIM source..
But included binary is not corresponded to the source, it from older version.
Ok, thx! Could you fix and recompile it and upload the package in this thread?

MfA
12th August 2006, 13:43
You know, if you change the code from Lefungus's site you should really change the name/version number a bit ... call it .24b or something, anything.

Fizick
12th August 2006, 15:50
In this post tritical put a link to archive, which includes new binary.
http://forum.doom9.org/showthread.php?p=861835#post861835

I do not know where it from. Will waiting for tritical. :)
may be it is his modification? (lumimasking=0,1,2)

Wilbert
12th August 2006, 16:48
Well i don't know, i received the modified source from OnTech (modified by himself). Perhaps tritical also fixed it?

MfA
12th August 2006, 17:15
He applied the change they suggested somewhere up in this thread.

thuongshoo
15th August 2006, 10:16
Wilbert ! Can you upload that file to another host ? I can't access geocities.com

MfA
15th August 2006, 15:58
Oops I was wrong, Tritical used a binary from Sagittaire ... kinda nasty to have a binary only release of a branch, Ill priv Sagittaire and ask him to share it with source and link it in here to avoid future confusion.

Really, 9 times out of 10 (including here) it's best to just include source with modified GPLd binaries you distribute. It's not the only way to comply with the license, but it is the best way.

tritical
16th August 2006, 02:38
I never actually saw the source for on2tech's modified version put up anywhere, but it would be nice if someone could post it.

On another note, who wants to implement cwssim (http://www.cns.nyu.edu/~zwang/files/papers/icassp05.pdf) and wcwssim (http://www.ece.northwestern.edu/~pappas/papers/brooks_hvei06.pdf)? :D

Fizick
16th August 2006, 20:06
The link in Wilbert post is latest ontech's source.
http://forum.doom9.org/showthread.php?p=862104#post862104

Probably it was compiled to "Sagittaire"'s binary.

Wilbert
16th August 2006, 20:07
I never actually saw the source for on2tech's modified version put up anywhere, but it would be nice if someone could post it.
Ding dong: http://forum.doom9.org/showthread.php?p=862104#post862104 :)

zambelli
6th April 2007, 19:05
What is the correct way to plot a SSIM graph using the .csv file? I have Lumimasking=2 enabled.

Is column A the SSIM score, and column B the weight? It seems like multiplying A*B doesn't really give a realistic depiction of the encoded scenes though - the scenes which look nasty don't show up as being much lower than the scenes which look good. The graph examples posted in the first post of this thread don't really explain how one is supposed to interpret the graph.

rbt01
17th July 2007, 04:57
i am puzzled what is ssim.
can anybody tell me what is it?

foxyshadis
17th July 2007, 07:32
Start on wiki (http://en.wikipedia.org/wiki/SSIM), which has links to the home page, which links to the papers if you're interested in the technical details. You might look up CWSSIM and WCWSSIM if you're interested in variants.

rbt01
17th July 2007, 08:47
Start on wiki (http://en.wikipedia.org/wiki/SSIM), which has links to the home page, which links to the papers if you're interested in the technical details. You might look up CWSSIM and WCWSSIM if you're interested in variants.

I got it from your pointer
thanks a lot :)

avdw
9th November 2007, 00:56
Nota:
-If you use B frames under xvid, trim the first dummy frame of the xvid clip, and the last frame of the original clip
-For those who used ssim 0.1, this version is also faster !


I'm not following along, trimming the first frame of the xvid file, I understand :
b=AVISource("C:\Mymovie.avi").trim(1,0)


But how to trim the last frame of the original clip ?
I didn't find any solution in the Avisynth "Trim" explanations. :scared:

Unearthly
9th November 2007, 01:40
But how to trim the last frame of the original clip ?
I didn't find any solution in the Avisynth "Trim" explanations. :scared:

Assuming your clip is b:

b = Trim(0,b.frameCount-2)

frameCount is a clip property (http://avisynth.org/mediawiki/Clip_properties).

avdw
9th November 2007, 01:46
Assuming your clip is b:

b = Trim(0,b.frameCount-2)

frameCount is a clip property (http://avisynth.org/mediawiki/Clip_properties).

Thanks a lot Unearthly, I'm constantly learning :)
So, my .d2v file is a , my .avi file is b
a=MPEG2Source("C:\Original.d2v").crop(16,70,-8,-70).bicubicResize(512,224,0,0.5)
b=AVISource("C:\encoded.avi").trim(1,0)
....
return ssim(a,b,"results.csv","averageSSIM.txt",lumimask=true)

shouldn't it be : a = Trim(0,b.frameCount-2) then ?

Unearthly
9th November 2007, 03:17
Thanks a lot Unearthly, I'm constantly learning :)
So, my .d2v file is a , my .avi file is b
a=MPEG2Source("C:\Original.d2v").crop(16,70,-8,-70).bicubicResize(512,224,0,0.5)
b=AVISource("C:\encoded.avi").trim(1,0)
....
return ssim(a,b,"results.csv","averageSSIM.txt",lumimask=true)

shouldn't it be : a = Trim(0,b.frameCount-2) then ?

No. It would be:
a = Trim(0,a.frameCount-2)

I said 'Assuming your clip is b', meaning if it isn't b, substitute all instances of b for your clip's name, which in this case is 'a'.

avdw
9th November 2007, 03:38
Well, I have :
a = MPEG2Source("N:\My DVDs\Le Gendarme de Saint Tropez\VTS_02_1.d2v").crop(16,70,-8,-70).bicubicResize(512,224,0,0.5)
b = AVISource("N:\My DVDs\Le Gendarme de Saint Tropez\testertje.avi").trim(1,0)
a = Trim(0,a.frameCount-2)
return ssim(a,b,"results.csv","averageSSIM.txt",lumimask=true)


resulting in "Script Error : Invalid arguments to function "Trim" :(

Unearthly
9th November 2007, 03:45
Well, I have :
a = MPEG2Source("N:\My DVDs\Le Gendarme de Saint Tropez\VTS_02_1.d2v").crop(16,70,-8,-70).bicubicResize(512,224,0,0.5)
b = AVISource("N:\My DVDs\Le Gendarme de Saint Tropez\testertje.avi").trim(1,0)
a = Trim(0,a.frameCount-2)
return ssim(a,b,"results.csv","averageSSIM.txt",lumimask=true)


resulting in "Script Error : Invalid arguments to function "Trim" :(

Aha, that was a goof on my part (too used to using last).

a = a.Trim(0,a.frameCount-2)

zambelli
9th November 2007, 09:04
You can use this function to always make sure your source and encoded clips are the same length:
fc = (a.Framecount > b.Framecount) ? b.Framecount : a.Framecount
a = a.Trim(0,-fc)
b = b.Trim(0,-fc)

foxyshadis
9th November 2007, 09:57
Or you can just ignore it, since avisynth will pad an extra frame onto the end of the shorter clip anyway. It might not match up just right, but it's probably going to be a black frame anyway, right?

zambelli
9th November 2007, 10:14
Or you can just ignore it, since avisynth will pad an extra frame onto the end of the shorter clip anyway. It might not match up just right, but it's probably going to be a black frame anyway, right?
Actually, no - SSIM() throws an error if the compared clips aren't exactly the same length.

I've used SSIM A LOT in my days testing WMV9/VC-1 encoders. :)

Gannjunior
27th March 2008, 23:50
i'm doing som tests...for example:

- source 1920,1080
- x264 2pass (Qmedium=22) 1280,720 compression is better without any doubts of x264 QB=11 640,352 compression. (it is an obviousness).

Why do i obtain SSIM result almost completely close? (97.83 for 1280x and 97.90 for 640x...off course i would expected 640x lower...)...i'm (almost, beacuse the source is VC-1 and seeking it correctly is a big problem..) sure to compare exactly the same frames...
maybe the result is normal since both are good encoding and in particular SSIM of 640x is about encoding QB=11 (..."saturated") and SSIM is more affected, in this case, by the 'quality' of quantizers, without evaluates the resolution effect that are very better at a reasonable quantizers value than a "saturated" encode at very lower resolution....

ciao!

tritical
10th July 2011, 21:59
Does anyone have a link to a paper or other source where the idea for the luminance masking in SSIM.dll comes from? If I am reading the source right, it gives all blocks with mean luminance <= 40 0 weight, any blocks with mean luminance >= 50 1.0 weight, and linearly interpolates between 0 and 1 for mean luminance between 40 and 50. To me it seems a little extreme to give 0 weight to any block below 40, and to ramp so quickly to 1. Just wondering where the 40 and 50 values came from.

Revgen
11th July 2011, 04:06
^The people at MSU made their own SSIM app. They may be able to give you an idea.

http://compression.ru/video/quality_measure/video_measurement_tool_en.html

tritical
11th July 2011, 07:36
The MSU implementation does not seem to use any luminance weighting. The main SSIM paper doesn't mention it AFAICT, and the author's MATLAB implementation does not use it. I'm only asking because I'm writing a filter to compute MAD, MSE, SSIM, PSNR-HVS, and PSNR-HVS-M, and was comparing my SSIM implementation to SSIM.dll. The luminance masking just seems strange to me... not the concept necessarily, but how it is implemented (40/50 cut points, etc...). It would be interesting to know where it comes from.

samuraibrian
21st November 2011, 17:12
The MSU implementation does not seem to use any luminance weighting. The main SSIM paper doesn't mention it AFAICT, and the author's MATLAB implementation does not use it. I'm only asking because I'm writing a filter to compute MAD, MSE, SSIM, PSNR-HVS, and PSNR-HVS-M, and was comparing my SSIM implementation to SSIM.dll. The luminance masking just seems strange to me... not the concept necessarily, but how it is implemented (40/50 cut points, etc...). It would be interesting to know where it comes from.

Hi tritical - did you get around to writing your multi-metric filter?

Pix
2nd January 2012, 21:22
Could anyone explain why does the ssim average formula not match with the value in the .txt
I'm comparing only 2 frames.
Getting higher than 0.90 SSIM on both and somehow the average in .txt is 71
I understand this is a scaled value but what does it mean?

That the encode looks 71% as source?
Or, does it look more than 90% as source?

cjplay
7th February 2012, 23:54
All,

Quick heads-up that I tried to use this with Compare and Compare failed to produce results in the Logs. Thanks, Lefungus, for the dll, wherever you are.

-CJ

m3sh
16th April 2012, 07:18
Could anyone explain why does the ssim average formula not match with the value in the .txt
I'm comparing only 2 frames.
Getting higher than 0.90 SSIM on both and somehow the average in .txt is 71
I understand this is a scaled value but what does it mean?

That the encode looks 71% as source?
Or, does it look more than 90% as source?

Pix - The computed average in the .txt file is a scaled value given by the formula:

scaled = 100*(unscaled)^8

:D

This has the effect of exagerating the values in the index (and also, incidentally, would have to do away with any of the negative SSIM index unscaled values, since it's an even power). For example, a 0.925 is a 53.59 scaled, while a 0.935 is 58.41, 0.955 is a 69.19. Conversely, a 0.255 is 0.17 scaled. This scaling makes the higher end values a "useful number". You can disable this scaling by supplying the parameter "scaled=false" to the SSIM call, to get the true unscaled weighted average. This value should relatively agree with the values you'd get from --ssim in x264, or MSU's tool (ssim_fast specifically). So far in my experience they're usually within 0.01 of each other (unscaled). Comments from tritical on the luminance weighting are likely in play here in terms of explaining the discrepancies.

SSIM isn't a linear index, at least I don't think so, so definitely wouldn't view it as a percentage (though I also often have the strong impulse to view it as such).

This all does beg a question for me for the developer which is why the scaling formula it was decided to use a power of 8? Was this purely arbitrary? Why not 10? Or 6? Is there a compelling video reason to choose that power? Very curious...

Edit: Or why not an odd power to preserve negative SSIM indices for that matter?

unihumi
30th January 2013, 22:23
Is the new SSIM plugin (with On2tech's improvement suggestions) still up somewhere? The one that Wilbert put up.

Wilbert
31st January 2013, 22:03
Is the new SSIM plugin (with On2tech's improvement suggestions) still up somewhere? The one that Wilbert put up.
See SSIM 0.25.1.0 (http://www.wilbertdijkhof.com/SSIM0.25.1.0.rar) and ssim-0.24a (http://www.wilbertdijkhof.com/ssim-0.24a.zip).

I'm not sure what the difference between the two versions are, or if the fixes in 0.24a are included in 0.25.

Solon8
15th December 2015, 21:25
Hi,

I'm new to AVS scripting. I'm using this plugin right now, but it's slow!
Running the script with AVSMeter showed me my CPU is used at only 12%. Each time.

How can I make AviSynth use more CPU?

Thanks.

Also, the scaled option doesn't seem to work for me. If I write "scaled=false", it says wrong type. If I write "scaled=0", it works but the value doesn't change.