


"""simple docstring"""


import math
import os

import cva
import numpy as np

a_											=     2_55.0






def   a__			(					__lowercase  ,      __lowercase )						->						float:
				_A       	=      np.mean((original - contrast) ** 2 )
				if mse == 0:
								return 100

				return 20 * math.logaa(PIXEL_MAX / math.sqrt(__lowercase ) )






def   a__			(					)						->						None:
				_A       	=      os.path.dirname(os.path.realpath(__lowercase ) )
				# Loading images (original image and compressed image)
				_A       	=      cva.imread(os.path.join(__lowercase  ,      "image_data/original_image.png" ) )
				_A       	=      cva.imread(os.path.join(__lowercase  ,      "image_data/compressed_image.png" )  ,      1 )

				_A       	=      cva.imread(os.path.join(__lowercase  ,      "image_data/PSNR-example-base.png" ) )
				_A       	=      cva.imread(
				    os.path.join(__lowercase  ,      "image_data/PSNR-example-comp-10.jpg" )  ,      1 )

				# Value expected: 29.73dB
				print("-- First Test --" )
				print(f"""PSNR value is {peak_signal_to_noise_ratio(__lowercase  ,      __lowercase )} dB""" )

				# # Value expected: 31.53dB (Wikipedia Example)
				print("\n-- Second Test --" )
				print(f"""PSNR value is {peak_signal_to_noise_ratio(__lowercase  ,      __lowercase )} dB""" )


if __name__ == "__main__":
		main()



"""simple docstring"""


def   a__			(					__lowercase  ,      __lowercase )						->						Tuple:
				_A       	=      1
				while b > 0:
								if b & 1:
												res *= a

								a *= a
								b >>= 1

				return res






def   a__			(					__lowercase  ,      __lowercase  ,      __lowercase )						->						Optional[Any]:
				_A       	=      1
				while b > 0:
								if b & 1:
												_A       	=      ((res % c) * (a % c)) % c

								a *= a
								b >>= 1

				return res