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 19th July 2004, 15:42   #41  |  Link
Gannjunior
Registered User
 
Gannjunior's Avatar
 
Join Date: Jul 2002
Location: Italy, Genova
Posts: 206
SSIM and Multiple bf of divx 5.2

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!
__________________
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
Gannjunior is offline   Reply With Quote
Old 20th July 2004, 18:23   #42  |  Link
Dams
Registered User
 
Dams's Avatar
 
Join Date: Sep 2002
Location: France
Posts: 190
U should use
Quote:
.trim(1,0)
on the source, because first frame of AVI files with B-frames are not readable.
__________________
Dams
Dams is offline   Reply With Quote
Old 22nd July 2004, 16:26   #43  |  Link
Gannjunior
Registered User
 
Gannjunior's Avatar
 
Join Date: Jul 2002
Location: Italy, Genova
Posts: 206
@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!
__________________
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
Gannjunior is offline   Reply With Quote
Old 22nd July 2004, 17:12   #44  |  Link
Manao
Registered User
 
Join Date: Jan 2002
Location: France
Posts: 2,856
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.
Manao is offline   Reply With Quote
Old 22nd July 2004, 20:03   #45  |  Link
Dams
Registered User
 
Dams's Avatar
 
Join Date: Sep 2002
Location: France
Posts: 190
Same as Manao!
__________________
Dams
Dams is offline   Reply With Quote
Old 22nd July 2004, 22:12   #46  |  Link
Gannjunior
Registered User
 
Gannjunior's Avatar
 
Join Date: Jul 2002
Location: Italy, Genova
Posts: 206
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
__________________
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
Gannjunior is offline   Reply With Quote
Old 22nd July 2004, 22:18   #47  |  Link
Lefungus
Registered User
 
Lefungus's Avatar
 
Join Date: Apr 2002
Location: Bretagne
Posts: 192
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.
__________________

Some old avisynth filters
Lefungus is offline   Reply With Quote
Old 22nd July 2004, 23:30   #48  |  Link
Gannjunior
Registered User
 
Gannjunior's Avatar
 
Join Date: Jul 2002
Location: Italy, Genova
Posts: 206
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!
__________________
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; 22nd July 2004 at 23:35.
Gannjunior is offline   Reply With Quote
Old 23rd July 2004, 03:16   #49  |  Link
MfA
Registered User
 
Join Date: Mar 2002
Posts: 1,075
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.
MfA is offline   Reply With Quote
Old 23rd July 2004, 07:44   #50  |  Link
Manao
Registered User
 
Join Date: Jan 2002
Location: France
Posts: 2,856
gannjunior : post your encoding script, and your script in which you compute the SSIM please.
Manao is offline   Reply With Quote
Old 23rd July 2004, 11:01   #51  |  Link
Junior73Italy
Registered User
 
Join Date: Apr 2004
Posts: 25
@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....

Last edited by Junior73Italy; 24th July 2004 at 12:38.
Junior73Italy is offline   Reply With Quote
Old 23rd July 2004, 11:55   #52  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
@Junior73Italy,

This is an english forum. I hope you can add an english summary/translation to your post.
Wilbert is offline   Reply With Quote
Old 23rd July 2004, 12:56   #53  |  Link
Gannjunior
Registered User
 
Gannjunior's Avatar
 
Join Date: Jul 2002
Location: Italy, Genova
Posts: 206
Hi,
i'm going on the beach now...
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!
__________________
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
Gannjunior is offline   Reply With Quote
Old 23rd July 2004, 23:53   #54  |  Link
Gannjunior
Registered User
 
Gannjunior's Avatar
 
Join Date: Jul 2002
Location: Italy, Genova
Posts: 206
Manao, this is the simple encoding script used for all my tests on 7th chapter of blade runner.
Quote:
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.

Quote:
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...




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... ...bug?!)

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

ciauzz!
__________________
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; 24th July 2004 at 00:18.
Gannjunior is offline   Reply With Quote
Old 24th July 2004, 10:44   #55  |  Link
bgpop
Registered User
 
Join Date: Nov 2003
Posts: 2
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...

[ot]
ciao bello
[/ot]
bgpop is offline   Reply With Quote
Old 24th July 2004, 11:33   #56  |  Link
Manao
Registered User
 
Join Date: Jan 2002
Location: France
Posts: 2,856
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 ).
Manao is offline   Reply With Quote
Old 24th July 2004, 14:58   #57  |  Link
MfA
Registered User
 
Join Date: Mar 2002
Posts: 1,075
Buffer overflows do funky things ...
MfA is offline   Reply With Quote
Old 27th July 2004, 10:02   #58  |  Link
HLW
Registered User
 
Join Date: Mar 2004
Posts: 23
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
HLW is offline   Reply With Quote
Old 9th March 2005, 16:28   #59  |  Link
redfordxx
Registered User
 
Join Date: Jan 2005
Location: Praha (not that one in Texas)
Posts: 863
SSIM calculation

When I have the .csv file with SSIM and weight for each frame, how can i calculate SSIM average for some part of video?
redfordxx is offline   Reply With Quote
Old 17th March 2005, 23:25   #60  |  Link
On2Tech
Registered User
 
Join Date: Nov 2003
Posts: 163
Re: SSIM calculation

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.

Last edited by On2Tech; 17th March 2005 at 23:29.
On2Tech 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 16:31.


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