View Full Version : How to compute SAD and SSD

26th August 2007, 18:15
I need to compute PSNR, SSIM, SAD and SSD for a lot of images. For SSIM it's Ok. How to do it for SAD and SSD? I am using wmplayer but I have to close each time each file. Is there a simple way=?

I have created a batch file "run.bat"

echo LoadPlugin("rawsource.dll") > file.avs
echo LoadPlugin("CompareYV12.dll") >> file.avs
echo LoadPlugin("SSIM.dll") >> file.avs

echo img1 = rawsource("source.yuv",width=352,height=288,pixel_type="I420").trim(0,297) >> file.avs
echo img2 = rawsource("%1",width=352,height=288,pixel_type="I420") >> file.avs
echo c1=SSIM(img1,img2,"%1.ssim.txt","%1.ssim.txt",lumimask=2) >> file.avs

echo stackhorizontal(source,c1) >> file.avs
echo return

"C:\Program Files\Windows Media Player\wmplayer.exe" "file.avs"

I then use a cmd and type

for %f in (*.yuv) do run %f


26th August 2007, 18:23
and I forget to compute PSNR

echo Compare(img1,img2,"","%1.psnr.log") >> file.avs


26th August 2007, 19:18
CompareYV12 solves my problem. Regarding the batch help with be most apreciated.

27th August 2007, 11:56
CompareYV doesn't work properly (writes only header). Is there a FAQ?

27th August 2007, 12:15
Regarding the executing of the script, you can use vdub or avsutil, both without rendering, see here when I was doing the same thing: http://forum.doom9.org/showthread.php?t=128418&

27th August 2007, 12:16
Thanks! I will try it.