added psnr in main oprimization loop