

import math
import os

import cva
import numpy as np

lowerCamelCase     =      255.0




def     UpperCAmelCase__       (    _A   :				float			,   _A   :				float							):





  '''simple docstring'''







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

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




def     UpperCAmelCase__       (    ):





  '''simple docstring'''







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

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

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


if __name__ == "__main__":
  main()



from dataclasses import dataclass
from typing import List, Optional, Union

import numpy as np
import PIL
from PIL import Image

from ...utils import BaseOutput, is_torch_available, is_transformers_available







@dataclass
# Copied from diffusers.pipelines.stable_diffusion.__init__.StableDiffusionPipelineOutput with Stable->Alt
class 		__magic_name__    (							lowerCamelCase__							):

   '''simple docstring'''




   lowerCamelCase__				:			Union[List[PIL.Image.Image], np.ndarray]
   lowerCamelCase__				:			Optional[List[bool]]


if is_transformers_available() and is_torch_available():
       from .modeling_roberta_series import RobertaSeriesModelWithTransformation
       from .pipeline_alt_diffusion import AltDiffusionPipeline
       from .pipeline_alt_diffusion_imgaimg import AltDiffusionImgaImgPipeline
