Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 9th November 2007, 01:40   #101  |  Link
Unearthly
Encoder in Training
 
Unearthly's Avatar
 
Join Date: Mar 2007
Location: Massachusetts
Posts: 37
Quote:
Originally Posted by avdw View Post
But how to trim the last frame of the original clip ?
I didn't find any solution in the Avisynth "Trim" explanations.
Assuming your clip is b:

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

frameCount is a clip property.
Unearthly is offline   Reply With Quote
Old 9th November 2007, 01:46   #102  |  Link
avdw
Banned
 
Join Date: Sep 2007
Posts: 71
Quote:
Originally Posted by Unearthly View Post
Assuming your clip is b:

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

frameCount is a clip property.
Thanks a lot Unearthly, I'm constantly learning
So, my .d2v file is a , my .avi file is b
Code:
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 ?

Last edited by avdw; 9th November 2007 at 02:52.
avdw is offline   Reply With Quote
Old 9th November 2007, 03:17   #103  |  Link
Unearthly
Encoder in Training
 
Unearthly's Avatar
 
Join Date: Mar 2007
Location: Massachusetts
Posts: 37
Quote:
Originally Posted by avdw View Post
Thanks a lot Unearthly, I'm constantly learning
So, my .d2v file is a , my .avi file is b
Code:
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'.
Unearthly is offline   Reply With Quote
Old 9th November 2007, 03:38   #104  |  Link
avdw
Banned
 
Join Date: Sep 2007
Posts: 71
Well, I have :
Code:
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"
avdw is offline   Reply With Quote
Old 9th November 2007, 03:45   #105  |  Link
Unearthly
Encoder in Training
 
Unearthly's Avatar
 
Join Date: Mar 2007
Location: Massachusetts
Posts: 37
Quote:
Originally Posted by avdw View Post
Well, I have :
Code:
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)
Unearthly is offline   Reply With Quote
Old 9th November 2007, 09:04   #106  |  Link
zambelli
Doom9ing since 2001
 
zambelli's Avatar
 
Join Date: Oct 2001
Location: Seattle, WA, USA
Posts: 2,002
You can use this function to always make sure your source and encoded clips are the same length:
Code:
fc = (a.Framecount > b.Framecount) ? b.Framecount : a.Framecount
a = a.Trim(0,-fc)
b = b.Trim(0,-fc)
zambelli is offline   Reply With Quote
Old 9th November 2007, 09:57   #107  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,558
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?
foxyshadis is offline   Reply With Quote
Old 9th November 2007, 10:14   #108  |  Link
zambelli
Doom9ing since 2001
 
zambelli's Avatar
 
Join Date: Oct 2001
Location: Seattle, WA, USA
Posts: 2,002
Quote:
Originally Posted by foxyshadis View Post
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.
zambelli is offline   Reply With Quote
Old 27th March 2008, 23:50   #109  |  Link
Gannjunior
Registered User
 
Gannjunior's Avatar
 
Join Date: Jul 2002
Location: Italy, Genova
Posts: 206
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!
__________________
P6T| 12Gb DDR3| i7-920 D0@3.8Ghz@1.168v+NOCTUA NH-U12P| Liberty 620| Stacker|2xRAID0 (4x500gb) Seag.72k.11| Seag. 500gb 72k.12| Seag. 1.5Tb 72k.11| GTX470@668/1843| U2410 24"| Se7en x64 on VRapt 300gb

Last edited by Gannjunior; 28th March 2008 at 02:06.
Gannjunior is offline   Reply With Quote
Old 10th July 2011, 21:59   #110  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 999
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.
tritical is offline   Reply With Quote
Old 11th July 2011, 04:06   #111  |  Link
Revgen
Registered User
 
Join Date: Sep 2004
Location: Near LA, California, USA
Posts: 1,545
^The people at MSU made their own SSIM app. They may be able to give you an idea.

http://compression.ru/video/quality_...t_tool_en.html
__________________
Pirate: Now how would you like to die? Would you like to have your head chopped off or be burned at the stake?

Curly: Burned at the stake!

Moe: Why?

Curly: A hot steak is always better than a cold chop.
Revgen is offline   Reply With Quote
Old 11th July 2011, 07:36   #112  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 999
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.
tritical is offline   Reply With Quote
Old 21st November 2011, 17:12   #113  |  Link
samuraibrian
Registered User
 
Join Date: Jan 2010
Location: Southampton, UK
Posts: 1
Quote:
Originally Posted by tritical View Post
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?
samuraibrian is offline   Reply With Quote
Old 2nd January 2012, 21:22   #114  |  Link
Pix
Registered User
 
Join Date: Jun 2011
Posts: 8
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?

Last edited by Pix; 2nd January 2012 at 21:25.
Pix is offline   Reply With Quote
Old 7th February 2012, 23:54   #115  |  Link
cjplay
Registered User
 
Join Date: Sep 2007
Posts: 17
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
cjplay is offline   Reply With Quote
Old 16th April 2012, 07:18   #116  |  Link
m3sh
Registered User
 
Join Date: Apr 2012
Location: Edmonton
Posts: 9
Quote:
Originally Posted by Pix View Post
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



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?

Last edited by m3sh; 16th April 2012 at 07:27.
m3sh is offline   Reply With Quote
Old 30th January 2013, 22:23   #117  |  Link
unihumi
Registered User
 
Join Date: Sep 2012
Location: Germany
Posts: 2
Is the new SSIM plugin (with On2tech's improvement suggestions) still up somewhere? The one that Wilbert put up.
unihumi is offline   Reply With Quote
Old 31st January 2013, 22:03   #118  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
Quote:
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 and ssim-0.24a.

I'm not sure what the difference between the two versions are, or if the fixes in 0.24a are included in 0.25.
Wilbert is offline   Reply With Quote
Old 15th December 2015, 21:25   #119  |  Link
Solon8
Registered User
 
Join Date: Mar 2013
Posts: 35
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.

Last edited by Solon8; 15th December 2015 at 22:02.
Solon8 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:52.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.