function PSNR = GetPSNR(orig, pred, rowbound, colbound, timebound)

rb1 = rowbound(1);
rb2 = rowbound(2);
cb1 = colbound(1);
cb2 = colbound(2);
N = (rb2-rb1+1)*(cb2-cb1+1);

distortion = 0;
for t=timebound(1):timebound(2)
   origframe = orig{1,t};
   predframe = pred{1,t};
   distortion = distortion + sum(sum((origframe(rb1:rb2,cb1:cb2)-predframe(rb1:rb2,cb1:cb2)).^2))/N;
end

distortion = distortion/(timebound(2)-timebound(1)+1);

peak = 255;
PSNR = 10*log10(255^2/distortion);