{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.MediaConvert.Types.NoiseReducer
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MediaConvert.Types.NoiseReducer where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConvert.Types.NoiseReducerFilter
import Amazonka.MediaConvert.Types.NoiseReducerFilterSettings
import Amazonka.MediaConvert.Types.NoiseReducerSpatialFilterSettings
import Amazonka.MediaConvert.Types.NoiseReducerTemporalFilterSettings
import qualified Amazonka.Prelude as Prelude

-- | Enable the Noise reducer (NoiseReducer) feature to remove noise from
-- your video output if necessary. Enable or disable this feature for each
-- output individually. This setting is disabled by default. When you
-- enable Noise reducer (NoiseReducer), you must also select a value for
-- Noise reducer filter (NoiseReducerFilter).
--
-- /See:/ 'newNoiseReducer' smart constructor.
data NoiseReducer = NoiseReducer'
  { -- | Noise reducer filter settings for temporal filter.
    NoiseReducer -> Maybe NoiseReducerTemporalFilterSettings
temporalFilterSettings :: Prelude.Maybe NoiseReducerTemporalFilterSettings,
    -- | Noise reducer filter settings for spatial filter.
    NoiseReducer -> Maybe NoiseReducerSpatialFilterSettings
spatialFilterSettings :: Prelude.Maybe NoiseReducerSpatialFilterSettings,
    -- | Settings for a noise reducer filter
    NoiseReducer -> Maybe NoiseReducerFilterSettings
filterSettings :: Prelude.Maybe NoiseReducerFilterSettings,
    -- | Use Noise reducer filter (NoiseReducerFilter) to select one of the
    -- following spatial image filtering functions. To use this setting, you
    -- must also enable Noise reducer (NoiseReducer). * Bilateral preserves
    -- edges while reducing noise. * Mean (softest), Gaussian, Lanczos, and
    -- Sharpen (sharpest) do convolution filtering. * Conserve does min\/max
    -- noise reduction. * Spatial does frequency-domain filtering based on JND
    -- principles. * Temporal optimizes video quality for complex motion.
    NoiseReducer -> Maybe NoiseReducerFilter
filter' :: Prelude.Maybe NoiseReducerFilter
  }
  deriving (NoiseReducer -> NoiseReducer -> Bool
(NoiseReducer -> NoiseReducer -> Bool)
-> (NoiseReducer -> NoiseReducer -> Bool) -> Eq NoiseReducer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NoiseReducer -> NoiseReducer -> Bool
$c/= :: NoiseReducer -> NoiseReducer -> Bool
== :: NoiseReducer -> NoiseReducer -> Bool
$c== :: NoiseReducer -> NoiseReducer -> Bool
Prelude.Eq, ReadPrec [NoiseReducer]
ReadPrec NoiseReducer
Int -> ReadS NoiseReducer
ReadS [NoiseReducer]
(Int -> ReadS NoiseReducer)
-> ReadS [NoiseReducer]
-> ReadPrec NoiseReducer
-> ReadPrec [NoiseReducer]
-> Read NoiseReducer
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NoiseReducer]
$creadListPrec :: ReadPrec [NoiseReducer]
readPrec :: ReadPrec NoiseReducer
$creadPrec :: ReadPrec NoiseReducer
readList :: ReadS [NoiseReducer]
$creadList :: ReadS [NoiseReducer]
readsPrec :: Int -> ReadS NoiseReducer
$creadsPrec :: Int -> ReadS NoiseReducer
Prelude.Read, Int -> NoiseReducer -> ShowS
[NoiseReducer] -> ShowS
NoiseReducer -> String
(Int -> NoiseReducer -> ShowS)
-> (NoiseReducer -> String)
-> ([NoiseReducer] -> ShowS)
-> Show NoiseReducer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NoiseReducer] -> ShowS
$cshowList :: [NoiseReducer] -> ShowS
show :: NoiseReducer -> String
$cshow :: NoiseReducer -> String
showsPrec :: Int -> NoiseReducer -> ShowS
$cshowsPrec :: Int -> NoiseReducer -> ShowS
Prelude.Show, (forall x. NoiseReducer -> Rep NoiseReducer x)
-> (forall x. Rep NoiseReducer x -> NoiseReducer)
-> Generic NoiseReducer
forall x. Rep NoiseReducer x -> NoiseReducer
forall x. NoiseReducer -> Rep NoiseReducer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NoiseReducer x -> NoiseReducer
$cfrom :: forall x. NoiseReducer -> Rep NoiseReducer x
Prelude.Generic)

-- |
-- Create a value of 'NoiseReducer' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'temporalFilterSettings', 'noiseReducer_temporalFilterSettings' - Noise reducer filter settings for temporal filter.
--
-- 'spatialFilterSettings', 'noiseReducer_spatialFilterSettings' - Noise reducer filter settings for spatial filter.
--
-- 'filterSettings', 'noiseReducer_filterSettings' - Settings for a noise reducer filter
--
-- 'filter'', 'noiseReducer_filter' - Use Noise reducer filter (NoiseReducerFilter) to select one of the
-- following spatial image filtering functions. To use this setting, you
-- must also enable Noise reducer (NoiseReducer). * Bilateral preserves
-- edges while reducing noise. * Mean (softest), Gaussian, Lanczos, and
-- Sharpen (sharpest) do convolution filtering. * Conserve does min\/max
-- noise reduction. * Spatial does frequency-domain filtering based on JND
-- principles. * Temporal optimizes video quality for complex motion.
newNoiseReducer ::
  NoiseReducer
newNoiseReducer :: NoiseReducer
newNoiseReducer =
  NoiseReducer' :: Maybe NoiseReducerTemporalFilterSettings
-> Maybe NoiseReducerSpatialFilterSettings
-> Maybe NoiseReducerFilterSettings
-> Maybe NoiseReducerFilter
-> NoiseReducer
NoiseReducer'
    { $sel:temporalFilterSettings:NoiseReducer' :: Maybe NoiseReducerTemporalFilterSettings
temporalFilterSettings =
        Maybe NoiseReducerTemporalFilterSettings
forall a. Maybe a
Prelude.Nothing,
      $sel:spatialFilterSettings:NoiseReducer' :: Maybe NoiseReducerSpatialFilterSettings
spatialFilterSettings = Maybe NoiseReducerSpatialFilterSettings
forall a. Maybe a
Prelude.Nothing,
      $sel:filterSettings:NoiseReducer' :: Maybe NoiseReducerFilterSettings
filterSettings = Maybe NoiseReducerFilterSettings
forall a. Maybe a
Prelude.Nothing,
      $sel:filter':NoiseReducer' :: Maybe NoiseReducerFilter
filter' = Maybe NoiseReducerFilter
forall a. Maybe a
Prelude.Nothing
    }

-- | Noise reducer filter settings for temporal filter.
noiseReducer_temporalFilterSettings :: Lens.Lens' NoiseReducer (Prelude.Maybe NoiseReducerTemporalFilterSettings)
noiseReducer_temporalFilterSettings :: (Maybe NoiseReducerTemporalFilterSettings
 -> f (Maybe NoiseReducerTemporalFilterSettings))
-> NoiseReducer -> f NoiseReducer
noiseReducer_temporalFilterSettings = (NoiseReducer -> Maybe NoiseReducerTemporalFilterSettings)
-> (NoiseReducer
    -> Maybe NoiseReducerTemporalFilterSettings -> NoiseReducer)
-> Lens
     NoiseReducer
     NoiseReducer
     (Maybe NoiseReducerTemporalFilterSettings)
     (Maybe NoiseReducerTemporalFilterSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NoiseReducer' {Maybe NoiseReducerTemporalFilterSettings
temporalFilterSettings :: Maybe NoiseReducerTemporalFilterSettings
$sel:temporalFilterSettings:NoiseReducer' :: NoiseReducer -> Maybe NoiseReducerTemporalFilterSettings
temporalFilterSettings} -> Maybe NoiseReducerTemporalFilterSettings
temporalFilterSettings) (\s :: NoiseReducer
s@NoiseReducer' {} Maybe NoiseReducerTemporalFilterSettings
a -> NoiseReducer
s {$sel:temporalFilterSettings:NoiseReducer' :: Maybe NoiseReducerTemporalFilterSettings
temporalFilterSettings = Maybe NoiseReducerTemporalFilterSettings
a} :: NoiseReducer)

-- | Noise reducer filter settings for spatial filter.
noiseReducer_spatialFilterSettings :: Lens.Lens' NoiseReducer (Prelude.Maybe NoiseReducerSpatialFilterSettings)
noiseReducer_spatialFilterSettings :: (Maybe NoiseReducerSpatialFilterSettings
 -> f (Maybe NoiseReducerSpatialFilterSettings))
-> NoiseReducer -> f NoiseReducer
noiseReducer_spatialFilterSettings = (NoiseReducer -> Maybe NoiseReducerSpatialFilterSettings)
-> (NoiseReducer
    -> Maybe NoiseReducerSpatialFilterSettings -> NoiseReducer)
-> Lens
     NoiseReducer
     NoiseReducer
     (Maybe NoiseReducerSpatialFilterSettings)
     (Maybe NoiseReducerSpatialFilterSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NoiseReducer' {Maybe NoiseReducerSpatialFilterSettings
spatialFilterSettings :: Maybe NoiseReducerSpatialFilterSettings
$sel:spatialFilterSettings:NoiseReducer' :: NoiseReducer -> Maybe NoiseReducerSpatialFilterSettings
spatialFilterSettings} -> Maybe NoiseReducerSpatialFilterSettings
spatialFilterSettings) (\s :: NoiseReducer
s@NoiseReducer' {} Maybe NoiseReducerSpatialFilterSettings
a -> NoiseReducer
s {$sel:spatialFilterSettings:NoiseReducer' :: Maybe NoiseReducerSpatialFilterSettings
spatialFilterSettings = Maybe NoiseReducerSpatialFilterSettings
a} :: NoiseReducer)

-- | Settings for a noise reducer filter
noiseReducer_filterSettings :: Lens.Lens' NoiseReducer (Prelude.Maybe NoiseReducerFilterSettings)
noiseReducer_filterSettings :: (Maybe NoiseReducerFilterSettings
 -> f (Maybe NoiseReducerFilterSettings))
-> NoiseReducer -> f NoiseReducer
noiseReducer_filterSettings = (NoiseReducer -> Maybe NoiseReducerFilterSettings)
-> (NoiseReducer
    -> Maybe NoiseReducerFilterSettings -> NoiseReducer)
-> Lens
     NoiseReducer
     NoiseReducer
     (Maybe NoiseReducerFilterSettings)
     (Maybe NoiseReducerFilterSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NoiseReducer' {Maybe NoiseReducerFilterSettings
filterSettings :: Maybe NoiseReducerFilterSettings
$sel:filterSettings:NoiseReducer' :: NoiseReducer -> Maybe NoiseReducerFilterSettings
filterSettings} -> Maybe NoiseReducerFilterSettings
filterSettings) (\s :: NoiseReducer
s@NoiseReducer' {} Maybe NoiseReducerFilterSettings
a -> NoiseReducer
s {$sel:filterSettings:NoiseReducer' :: Maybe NoiseReducerFilterSettings
filterSettings = Maybe NoiseReducerFilterSettings
a} :: NoiseReducer)

-- | Use Noise reducer filter (NoiseReducerFilter) to select one of the
-- following spatial image filtering functions. To use this setting, you
-- must also enable Noise reducer (NoiseReducer). * Bilateral preserves
-- edges while reducing noise. * Mean (softest), Gaussian, Lanczos, and
-- Sharpen (sharpest) do convolution filtering. * Conserve does min\/max
-- noise reduction. * Spatial does frequency-domain filtering based on JND
-- principles. * Temporal optimizes video quality for complex motion.
noiseReducer_filter :: Lens.Lens' NoiseReducer (Prelude.Maybe NoiseReducerFilter)
noiseReducer_filter :: (Maybe NoiseReducerFilter -> f (Maybe NoiseReducerFilter))
-> NoiseReducer -> f NoiseReducer
noiseReducer_filter = (NoiseReducer -> Maybe NoiseReducerFilter)
-> (NoiseReducer -> Maybe NoiseReducerFilter -> NoiseReducer)
-> Lens
     NoiseReducer
     NoiseReducer
     (Maybe NoiseReducerFilter)
     (Maybe NoiseReducerFilter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NoiseReducer' {Maybe NoiseReducerFilter
filter' :: Maybe NoiseReducerFilter
$sel:filter':NoiseReducer' :: NoiseReducer -> Maybe NoiseReducerFilter
filter'} -> Maybe NoiseReducerFilter
filter') (\s :: NoiseReducer
s@NoiseReducer' {} Maybe NoiseReducerFilter
a -> NoiseReducer
s {$sel:filter':NoiseReducer' :: Maybe NoiseReducerFilter
filter' = Maybe NoiseReducerFilter
a} :: NoiseReducer)

instance Core.FromJSON NoiseReducer where
  parseJSON :: Value -> Parser NoiseReducer
parseJSON =
    String
-> (Object -> Parser NoiseReducer) -> Value -> Parser NoiseReducer
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"NoiseReducer"
      ( \Object
x ->
          Maybe NoiseReducerTemporalFilterSettings
-> Maybe NoiseReducerSpatialFilterSettings
-> Maybe NoiseReducerFilterSettings
-> Maybe NoiseReducerFilter
-> NoiseReducer
NoiseReducer'
            (Maybe NoiseReducerTemporalFilterSettings
 -> Maybe NoiseReducerSpatialFilterSettings
 -> Maybe NoiseReducerFilterSettings
 -> Maybe NoiseReducerFilter
 -> NoiseReducer)
-> Parser (Maybe NoiseReducerTemporalFilterSettings)
-> Parser
     (Maybe NoiseReducerSpatialFilterSettings
      -> Maybe NoiseReducerFilterSettings
      -> Maybe NoiseReducerFilter
      -> NoiseReducer)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe NoiseReducerTemporalFilterSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"temporalFilterSettings")
            Parser
  (Maybe NoiseReducerSpatialFilterSettings
   -> Maybe NoiseReducerFilterSettings
   -> Maybe NoiseReducerFilter
   -> NoiseReducer)
-> Parser (Maybe NoiseReducerSpatialFilterSettings)
-> Parser
     (Maybe NoiseReducerFilterSettings
      -> Maybe NoiseReducerFilter -> NoiseReducer)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe NoiseReducerSpatialFilterSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"spatialFilterSettings")
            Parser
  (Maybe NoiseReducerFilterSettings
   -> Maybe NoiseReducerFilter -> NoiseReducer)
-> Parser (Maybe NoiseReducerFilterSettings)
-> Parser (Maybe NoiseReducerFilter -> NoiseReducer)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe NoiseReducerFilterSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"filterSettings")
            Parser (Maybe NoiseReducerFilter -> NoiseReducer)
-> Parser (Maybe NoiseReducerFilter) -> Parser NoiseReducer
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe NoiseReducerFilter)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"filter")
      )

instance Prelude.Hashable NoiseReducer

instance Prelude.NFData NoiseReducer

instance Core.ToJSON NoiseReducer where
  toJSON :: NoiseReducer -> Value
toJSON NoiseReducer' {Maybe NoiseReducerFilter
Maybe NoiseReducerFilterSettings
Maybe NoiseReducerSpatialFilterSettings
Maybe NoiseReducerTemporalFilterSettings
filter' :: Maybe NoiseReducerFilter
filterSettings :: Maybe NoiseReducerFilterSettings
spatialFilterSettings :: Maybe NoiseReducerSpatialFilterSettings
temporalFilterSettings :: Maybe NoiseReducerTemporalFilterSettings
$sel:filter':NoiseReducer' :: NoiseReducer -> Maybe NoiseReducerFilter
$sel:filterSettings:NoiseReducer' :: NoiseReducer -> Maybe NoiseReducerFilterSettings
$sel:spatialFilterSettings:NoiseReducer' :: NoiseReducer -> Maybe NoiseReducerSpatialFilterSettings
$sel:temporalFilterSettings:NoiseReducer' :: NoiseReducer -> Maybe NoiseReducerTemporalFilterSettings
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"temporalFilterSettings" Text -> NoiseReducerTemporalFilterSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NoiseReducerTemporalFilterSettings -> Pair)
-> Maybe NoiseReducerTemporalFilterSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe NoiseReducerTemporalFilterSettings
temporalFilterSettings,
            (Text
"spatialFilterSettings" Text -> NoiseReducerSpatialFilterSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NoiseReducerSpatialFilterSettings -> Pair)
-> Maybe NoiseReducerSpatialFilterSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe NoiseReducerSpatialFilterSettings
spatialFilterSettings,
            (Text
"filterSettings" Text -> NoiseReducerFilterSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NoiseReducerFilterSettings -> Pair)
-> Maybe NoiseReducerFilterSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe NoiseReducerFilterSettings
filterSettings,
            (Text
"filter" Text -> NoiseReducerFilter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NoiseReducerFilter -> Pair)
-> Maybe NoiseReducerFilter -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe NoiseReducerFilter
filter'
          ]
      )