






"""simple docstring"""



import math
import os

import cva
import numpy as np

_UpperCamelCase		:  Dict						=		2_5_5.0
def 						_SCREAMING_SNAKE_CASE			(   __snake_case      :  float		, __snake_case      :  float   ):





     '''simple docstring'''





     lowercase							   =	np.mean((original - contrast) ** 2   )
     if mse == 0:
          return 1_00

     return 20 * math.logaa(PIXEL_MAX / math.sqrt(__snake_case   )   )
def 						_SCREAMING_SNAKE_CASE			(   ):





     '''simple docstring'''





     lowercase							   =	os.path.dirname(os.path.realpath(__snake_case   )   )
     # Loading images (original image and compressed image)
     lowercase							   =	cva.imread(os.path.join(__snake_case		, 'image_data/original_image.png'   )   )
     lowercase							   =	cva.imread(os.path.join(__snake_case		, 'image_data/compressed_image.png'   )		, 1   )

     lowercase							   =	cva.imread(os.path.join(__snake_case		, 'image_data/PSNR-example-base.png'   )   )
     lowercase							   =	cva.imread(
         os.path.join(__snake_case		, '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(__snake_case		, __snake_case   )} dB'   )

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


if __name__ == "__main__":
    main()










"""simple docstring"""



def 						_SCREAMING_SNAKE_CASE			(   __snake_case      :  Dict		, __snake_case      :  str   ):





  '''simple docstring'''





  lowercase							   =	1
  while b > 0:
    if b & 1:
      res *= a

    a *= a
    b >>= 1

  return res
def 						_SCREAMING_SNAKE_CASE			(   __snake_case      :  int		, __snake_case      :  List[str]		, __snake_case      :  str   ):





  '''simple docstring'''





  lowercase							   =	1
  while b > 0:
    if b & 1:
      lowercase							   =	((res % c) * (a % c)) % c

    a *= a
    b >>= 1

  return res


