




"""simple docstring"""





class    __lowercase							:


				'''simple docstring'''


				class    __lowercase							:


								'''simple docstring'''


								_lowerCAmelCase						      ="_prev", "_data", "_next"

								def __init__( self :  Tuple   ,SCREAMING_SNAKE_CASE_ :  Dict   ,SCREAMING_SNAKE_CASE_ :  int   ,SCREAMING_SNAKE_CASE_ :  str   ):
														snake_case__							:       Union[str, Any]				      =       link_p
														snake_case__							:       List[Any]				      =       element
														snake_case__							:       Any				      =       link_n





								def    _lowerCamelCase       ( self :  Optional[Any]   ):
														return (
														    F''' Prev -> {self._prev is not None}, Next -> {self._next is not None}'''
														)







				def __init__( self :  str   ):
										snake_case__							:       Optional[Any]				      =       self._Node(SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   )
										snake_case__							:       Optional[int]				      =       self._Node(SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   )
										snake_case__							:       Union[str, Any]				      =       self._trailer
										snake_case__							:       Optional[Any]				      =       self._header
										snake_case__							:       Dict				      =       0

				def __len__( self :  Tuple   ):
										return self._size

				def    _lowerCamelCase       ( self :  Optional[int]   ):
										return self.__len__() == 0

				def    _lowerCamelCase       ( self :  Any   ,SCREAMING_SNAKE_CASE_ :  Union[str, Any]   ,SCREAMING_SNAKE_CASE_ :  Optional[int]   ,SCREAMING_SNAKE_CASE_ :  Dict   ):
										# Create new_node by setting it's prev.link -> header
										# setting it's next.link -> trailer
										snake_case__							:       Union[str, Any]				      =       self._Node(SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   )
										snake_case__							:       Union[str, Any]				      =       new_node
										snake_case__							:       Union[str, Any]				      =       new_node
										self._size += 1
										return self





				def    _lowerCamelCase       ( self :  int   ,SCREAMING_SNAKE_CASE_ :  Union[str, Any]   ):
										snake_case__							:       List[str]				      =       node._prev
										snake_case__							:       List[str]				      =       node._next

										snake_case__							:       List[str]				      =       successor
										snake_case__							:       Tuple				      =       predecessor
										self._size -= 1
										snake_case__							:       Any				      =       node._data
										snake_case__							:       List[str]				      =       None
										del node
										return temp







class    __lowercase							(      _DoublyLinkedBase						):


				'''simple docstring'''


				def    _lowerCamelCase       ( self :  Optional[int]   ):
										if self.is_empty():
																raise Exception('''List is empty'''   )
										return self._header._next._data

				def    _lowerCamelCase       ( self :  Optional[int]   ):
										if self.is_empty():
																raise Exception('''List is empty'''   )
										return self._trailer._prev._data

				def    _lowerCamelCase       ( self :  int   ,SCREAMING_SNAKE_CASE_ :  str   ):
										return self._insert(self._header   ,SCREAMING_SNAKE_CASE_   ,self._header._next   )

				def    _lowerCamelCase       ( self :  List[str]   ,SCREAMING_SNAKE_CASE_ :  Tuple   ):
										return self._insert(self._trailer._prev   ,SCREAMING_SNAKE_CASE_   ,self._trailer   )

				def    _lowerCamelCase       ( self :  Optional[Any]   ):
										if self.is_empty():
																raise IndexError('''remove_first from empty list'''   )
										return self._delete(self._header._next   )





				def    _lowerCamelCase       ( self :  Optional[Any]   ):
										if self.is_empty():
																raise IndexError('''remove_first from empty list'''   )
										return self._delete(self._trailer._prev   )








"""simple docstring"""





import math
import os

import cva
import numpy as np

_lowercase						   =     2_55.0

def 		lowerCAmelCase				(			lowerCamelCase   ,      lowerCamelCase		):
						'''simple docstring'''


						snake_case__							:       Tuple				      =       np.mean((original - contrast) ** 2		)
						if mse == 0:
												return 100

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

def 		lowerCAmelCase				(			):
						'''simple docstring'''


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

						snake_case__							:       Optional[Any]				      =       cva.imread(os.path.join(lowerCamelCase   ,      '''image_data/PSNR-example-base.png'''		)		)
						snake_case__							:       Tuple				      =       cva.imread(
						    os.path.join(lowerCamelCase   ,      '''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(lowerCamelCase   ,      lowerCamelCase		)} dB'''		)

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


if __name__ == "__main__":
							main()


