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 Development

Thread Tools Search this Thread Display Modes
Old 17th July 2003, 12:21   #1  |  Link
Registered User
Join Date: Mar 2002
Posts: 486
Overall PSNR for Compare()

Dear AviSynth developers,

Here is a feature I'd love to see in Compare()'s logfile: Overall PSNR. When the current Compare() takes an average of frame PSNR's for its logfile, it is biased towards frames with high PSNR and will produce a higher average for sequences with very variable quality.

I wrote some more about the problems with taking the arithmetic mean of frame PSNR's here: http://forum.doom9.org/showthread.ph...413#post345413

The "Overall PSNR" treats the video seqeuence as if all video frames were tiled together into one huge image. The PSNR is effectively calculated over this huge image.

Here is a diff for Overall PSNR -- I really hope you will consider adding it as it's only a few more lines of code

PS thanks for a phenomenal tool!

--- avisynth/text-overlay.cpp	7 Jul 2003 09:10:44 -0000	1.9
+++ avisynth/text-overlay.cpp	17 Jul 2003 11:10:30 -0000
@@ -835,6 +835,8 @@
     fprintf(log,"Mean Absolute Deviation: %9.4f %9.4f %9.4f\n", MAD_min, MAD_tot/framecount, MAD_max);
     fprintf(log,"         Mean Deviation: %+9.4f %+9.4f %+9.4f\n", MD_min, MD_tot/framecount, MD_max);
     fprintf(log,"                   PSNR: %9.4f %9.4f %9.4f\n", PSNR_min, PSNR_tot/framecount, PSNR_max);
+    double PSNR_overall = 10.0 * log10(bytecount_overall * 255.0 * 255.0 / SSD_overall);
+    fprintf(log,"           Overall PSNR: %9.4f\n", PSNR_overall);
   delete[] psnrs;
@@ -990,6 +992,8 @@
     MAD_min = MAD_tot = MAD_max = MAD;
     MD_min = MD_tot = MD_max = MD;
     PSNR_min = PSNR_tot = PSNR_max = PSNR;
+    bytecount_overall = double(bytecount);
+    SSD_overall = SSD;
   } else {
     MAD_min = min(MAD_min, MAD);
     MAD_tot += MAD;
@@ -1000,6 +1004,8 @@
     PSNR_min = min(PSNR_min, PSNR);
     PSNR_tot += PSNR;
     PSNR_max = max(PSNR_max, PSNR);
+    bytecount_overall += double(bytecount);
+    SSD_overall += SSD;
   if (log) fprintf(log,"%6u  %8.4f  %+9.4f  %3d    %3d    %8.4f\n", n, MAD, MD, pos_D, neg_D, PSNR);

--- avisynth/text-overlay.h	10 Feb 2003 16:43:01 -0000	1.5
+++ avisynth/text-overlay.h	17 Jul 2003 11:10:30 -0000
@@ -177,6 +177,7 @@
   double PSNR_min, PSNR_tot, PSNR_max;
   double MAD_min, MAD_tot, MAD_max;
   double MD_min, MD_tot, MD_max;
+  double bytecount_overall, SSD_overall;
   int framecount;
temporance is offline   Reply With Quote
Old 17th July 2003, 17:08   #2  |  Link
Retired AviSynth Dev ;)
sh0dan's Avatar
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
Thanks - I'll merge the improvement!
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote

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 22:02.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.