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 20th July 2002, 19:04   #1  |  Link
Marc FD
XviD fan
 
Marc FD's Avatar
 
Join Date: Jun 2002
Location: France
Posts: 907
Psnr.dll :)

Pfuiou !
I never coded a filter so fast (2 hours )
Big thx to gruel (see in the readme)

I always dreamed to calculate the PSNR (it seemed to be a secret and inreachable value because i've never seen a prog/util/filter to calc it !!)

Or maybe you all ignore PSNR and only trust your eyes :
Your're right ! PSNR is not Quality but write "i've got a terrible PSNR : 60 Db !!!" it's better than : "it's the best quality" sentences...

You use it to tune my avs filters chains and compare codecs

I hope you'll enjoy it

Last edited by Marc FD; 20th July 2002 at 19:06.
Marc FD is offline   Reply With Quote
Old 21st July 2002, 03:36   #2  |  Link
dividee
Registered User
 
Join Date: Oct 2001
Location: Brussels
Posts: 358
Arg! bad timing
I just wrote a filter that calculate the PSNR, as well as some other measures, and I'm in the process of making it a bit more flexible to include it in avisynth.
__________________
dividee
dividee is offline   Reply With Quote
Old 21st July 2002, 12:31   #3  |  Link
Marc FD
XviD fan
 
Marc FD's Avatar
 
Join Date: Jun 2002
Location: France
Posts: 907
sorry
but test my filter : i've relly done a good job

(PS : We can work together if you want )
Marc FD is offline   Reply With Quote
Old 21st July 2002, 15:41   #4  |  Link
Koepi
Moderator
 
Koepi's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 4,454
Marc,

you can't compare codecs by PSNR.

It would be like comparing cars by PS numbers.

You can check whether you improved something with that, sure, but in NO way it's possible to comapre e.g. divx and xvid based on PSNR.

Regards,
Koepi
Koepi is offline   Reply With Quote
Old 21st July 2002, 18:49   #5  |  Link
trbarry
Registered User
 
trbarry's Avatar
 
Join Date: Oct 2001
Location: Gainesville FL USA
Posts: 2,092
Quote:
you can't compare codecs by PSNR
Koepi -

Probably true. You can't compare codecs by putting a single number on them.

But from everything I've read, if you did have to settle for one simple fidelity measure the PSNR would be one of better ones.

So I'm going to try it.

- Tom
trbarry is offline   Reply With Quote
Old 22nd July 2002, 08:45   #6  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
Marc FD: This is actually very useful! I do however seem to get some strange artifacts. I guess it's related to a missing call to MakeWriteable() before BitBlt?

The following script shows it:

Code:
LoadPlugin("c:\apps\AviSynth\psnr.dll")
colorbars(512,384)
converttoyuy2()
converttorgb()
converttoyuy2()
Psnr(colorbars(512,384).converttoyuy2())
Could a "Noise Peak" be implemented, so it shows the highest noise value?
Or even better - a noise graph that shows the amount of noise at a given frequency. (frequency on the x-axis and the amount on y-axis). It would help greatly to see the distribution.
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 22nd July 2002, 11:19   #7  |  Link
Marc FD
XviD fan
 
Marc FD's Avatar
 
Join Date: Jun 2002
Location: France
Posts: 907
I'm MMixed i tried my first lines of MMX on the Psnr's SSD (square-sum of distances), because it should be the slower part of the PSNR calculation, but it didn't improve speed because the SSD calc is very fast in fact, and it's only working with 2 source at once who slow down the process (but 10 fps is enough for a tool )

I think psnr.dll could be usefull to compare avisynth chain-filters

@shodan
artifacts ??
you mean the PSNR-graph in black in the bottom of the screen ??
OR it's something else ??
PS : The output image is a BitBlt from clip2, but i didn't optimize it

@Koepi
I agree with you. Since you have read the readme, you' ve seen my warnings on the PSNR.
But i like cars with many PS, like many people

@Dividee
Is your filter very advanced ? If you can compute tons of others interessing values (like Zhou Wang's structural distortion measure ), we can always merge our filters. work would be done faster & better
Marc FD is offline   Reply With Quote
Old 23rd July 2002, 06:56   #8  |  Link
dividee
Registered User
 
Join Date: Oct 2001
Location: Brussels
Posts: 358
Sorry for not answering earlier, I had some hardware problem yesterday. One of my DDR stick died

Actually, the slowest part in your filter (as in mine) is probably the text output. Try it: comment out the font rendering functions and see how fast it goes
That's why you don't see any difference when the SSD calcs are in MMX.
In my filter, I added an option to log the results to a file and disable the on-screen output. That makes it go 10x faster for the C version, and about 30x faster for the Integer SSE version (I don't have an MMX version).

But no, my filter doesn't do a lot more. I don't have a graph, but I also display the mean of differences and the mean of absolute differences. By comparing the two, you can tell if your filter chain has a bias when it shouldn't. Very useful for tracking rounding errors in filters. To end the feature list comparison, it also allows to select only some channels for comparisons (Y,U,V or R,G,B[,A]). By default, it doesn't compare the alpha channel in RGB32, which is probably better.
If people like it, I could add your PSNR graph ?
__________________
dividee
dividee is offline   Reply With Quote
Old 23rd July 2002, 13:47   #9  |  Link
Marc FD
XviD fan
 
Marc FD's Avatar
 
Join Date: Jun 2002
Location: France
Posts: 907
Hi.
the only algo i have is gruel's C psnr (i'm not even sure i did it himself..) so the MMX version was in fact my firsts steps in MMX coding .

PS: I can't see any difference between ISSE and MMX code. i think it's only a few new instructions. Right ??

I'm going to take a look on the "Intel arch instr. set devel ref manual"

And since psnr 1.0 is in GPL v2 you can do whatever you want with the code : just tag my name somewhere and lemme know if you ripp a part of my code
Marc FD is offline   Reply With Quote
Old 23rd July 2002, 14:55   #10  |  Link
trbarry
Registered User
 
trbarry's Avatar
 
Join Date: Oct 2001
Location: Gainesville FL USA
Posts: 2,092
Quote:
I'm going to take a look on the "Intel arch instr. set devel ref manual"
There is also a useful "Intel Architecture Optimization Reference" available on the Intel site that you might want to take a look at.

- Tom
trbarry is offline   Reply With Quote
Old 23rd July 2002, 15:47   #11  |  Link
dividee
Registered User
 
Join Date: Oct 2001
Location: Brussels
Posts: 358
Yep, ISSE is just some additionnal instructions, but they come in handy sometimes. The problem with the "Inst. Set Ref." from Intel is that it doesn't tell explicitely which instructions are for which architecture. The other day I wanted to use PADDQ and didn't realise immediately that it's an SSE2 only instruction. So, while you're at it you might also grab the Volume 1: Basic Architecture; it includes that kind of details.

Well, I found the PSNR formula in Nandub source code, but I guess it can also be found it by googling at bit; it's not a "secret and inreachable value"

Anyway, thanks for your offer. I think i'll rip the graph then
__________________
dividee
dividee is offline   Reply With Quote
Old 23rd July 2002, 17:56   #12  |  Link
Marc FD
XviD fan
 
Marc FD's Avatar
 
Join Date: Jun 2002
Location: France
Posts: 907
And i've a little trick to speedup (by 1,5x) the text overlay
say me if you're interessed (now psnr.dll is 15 fps fast but i don't think it will stand before your filter so i won't make release anymore...)
Marc FD is offline   Reply With Quote
Old 24th July 2002, 21:22   #13  |  Link
dividee
Registered User
 
Join Date: Oct 2001
Location: Brussels
Posts: 358
I commited my filter to the CVS. It's called Compare and has the following syntax (with default values):
Code:
Compare(clip filtered, clip original, string channels="", string logfile="", bool show_graph=true)
It outputs the filtered clip (first arg) with text (Mean Absolute Difference, Mean Difference & PSNR) and Marc's PSNR graph (if show_graph is true). The channels string is a combination of R,G,B[,A] or Y,U,V , depending on the source clips. The empty string (default) means either "YUV" or "RGB". If logfile is not null, the results will be written to a file by this name and not drawn on the clip. It is much faster if you need to compare a lot of frames.
ex:
Compare(clip1,clip2,"UV") will only compare chroma channels of YUY2 clips.

BTW, I also optimized the text renderer a bit. Each time you change the text to be written, it has to recalculate the antialiasing mask, and it takes a huge amount of time. But most of the text bitmap is just black anyway so I optimized for this common case.
__________________
dividee
dividee is offline   Reply With Quote
Old 4th August 2002, 18:37   #14  |  Link
scorchED
Registered User
 
scorchED's Avatar
 
Join Date: May 2002
Location: Germany
Posts: 82
what is a good or worse PSNR value, when copmaring original and encoded material?
I get around 45 and don't know if my filterchain for 1CD makes a good job (but in my eyes it looks perfectly).
__________________
If you like to tweak, you'll love XviD and AVISynth!
--------this combination-is-still-the-best---------
scorchED is offline   Reply With Quote
Old 4th August 2002, 21:13   #15  |  Link
Marc FD
XviD fan
 
Marc FD's Avatar
 
Join Date: Jun 2002
Location: France
Posts: 907
Impossible to say.
45 seems a good value. it can get worser on very blocky scenes ( under 40) and you can get values close from 50 dB when the codec is doing is best... but i don't think higher values can be reached with quant2
Marc FD is offline   Reply With Quote
Old 4th August 2002, 21:23   #16  |  Link
dividee
Registered User
 
Join Date: Oct 2001
Location: Brussels
Posts: 358
What could be interesting is this:
* Create a filter chain using your eyes to tell you if it's good.
* Encode both the filtered and unfiltered video.
* Use PSNR to compare
(a) the unfiltered encoding with the unfiltered original
(b) the filtered encoding with the filtered original

this way you could tell ( if PSNR(b) > PSNR(a) ) if the filtering helped the codec.
It's even possible in some case that PSNR(c) between the filtered encoding and the unfiltered original is even higher than PSNR(a). that's the ideal situation, I think.
__________________
dividee
dividee is offline   Reply With Quote
Old 4th August 2002, 23:46   #17  |  Link
scorchED
Registered User
 
scorchED's Avatar
 
Join Date: May 2002
Location: Germany
Posts: 82
i would like to see an average PSNR in this nice filter.
So we can compare globaly some movie-encodes with different settings.
i like the kind of the result output - very nice
__________________
If you like to tweak, you'll love XviD and AVISynth!
--------this combination-is-still-the-best---------
scorchED is offline   Reply With Quote
Old 4th August 2002, 23:48   #18  |  Link
Marc FD
XviD fan
 
Marc FD's Avatar
 
Join Date: Jun 2002
Location: France
Posts: 907
there is a file-log option.
should give the avg PSNR.
but dividee can explain it better
Marc FD is offline   Reply With Quote
Old 5th August 2002, 00:29   #19  |  Link
scorchED
Registered User
 
scorchED's Avatar
 
Join Date: May 2002
Location: Germany
Posts: 82
is it possible to write the average PSNR directly on the screen, while comparing the two movies?
Maybe:

- Frame - actual PSNR
- average PSNR
- highest PSNR
- lowest PSNR
__________________
If you like to tweak, you'll love XviD and AVISynth!
--------this combination-is-still-the-best---------
scorchED is offline   Reply With Quote
Old 5th August 2002, 01:00   #20  |  Link
dividee
Registered User
 
Join Date: Oct 2001
Location: Brussels
Posts: 358
That would be a lot of text on the screen, especially considering I already added other measurements. But - granted - it could be useful.
__________________
dividee
dividee 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 09:54.


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