{-# 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.Deinterlacer
-- 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.Deinterlacer where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConvert.Types.DeinterlaceAlgorithm
import Amazonka.MediaConvert.Types.DeinterlacerControl
import Amazonka.MediaConvert.Types.DeinterlacerMode
import qualified Amazonka.Prelude as Prelude

-- | Settings for deinterlacer
--
-- /See:/ 'newDeinterlacer' smart constructor.
data Deinterlacer = Deinterlacer'
  { -- | - When set to NORMAL (default), the deinterlacer does not convert frames
    -- that are tagged in metadata as progressive. It will only convert those
    -- that are tagged as some other type. - When set to FORCE_ALL_FRAMES, the
    -- deinterlacer converts every frame to progressive - even those that are
    -- already tagged as progressive. Turn Force mode on only if there is a
    -- good chance that the metadata has tagged frames as progressive when they
    -- are not progressive. Do not turn on otherwise; processing frames that
    -- are already progressive into progressive will probably result in lower
    -- quality video.
    Deinterlacer -> Maybe DeinterlacerControl
control :: Prelude.Maybe DeinterlacerControl,
    -- | Use Deinterlacer (DeinterlaceMode) to choose how the service will do
    -- deinterlacing. Default is Deinterlace. - Deinterlace converts interlaced
    -- to progressive. - Inverse telecine converts Hard Telecine 29.97i to
    -- progressive 23.976p. - Adaptive auto-detects and converts to
    -- progressive.
    Deinterlacer -> Maybe DeinterlacerMode
mode :: Prelude.Maybe DeinterlacerMode,
    -- | Only applies when you set Deinterlacer (DeinterlaceMode) to Deinterlace
    -- (DEINTERLACE) or Adaptive (ADAPTIVE). Motion adaptive interpolate
    -- (INTERPOLATE) produces sharper pictures, while blend (BLEND) produces
    -- smoother motion. Use (INTERPOLATE_TICKER) OR (BLEND_TICKER) if your
    -- source file includes a ticker, such as a scrolling headline at the
    -- bottom of the frame.
    Deinterlacer -> Maybe DeinterlaceAlgorithm
algorithm :: Prelude.Maybe DeinterlaceAlgorithm
  }
  deriving (Deinterlacer -> Deinterlacer -> Bool
(Deinterlacer -> Deinterlacer -> Bool)
-> (Deinterlacer -> Deinterlacer -> Bool) -> Eq Deinterlacer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Deinterlacer -> Deinterlacer -> Bool
$c/= :: Deinterlacer -> Deinterlacer -> Bool
== :: Deinterlacer -> Deinterlacer -> Bool
$c== :: Deinterlacer -> Deinterlacer -> Bool
Prelude.Eq, ReadPrec [Deinterlacer]
ReadPrec Deinterlacer
Int -> ReadS Deinterlacer
ReadS [Deinterlacer]
(Int -> ReadS Deinterlacer)
-> ReadS [Deinterlacer]
-> ReadPrec Deinterlacer
-> ReadPrec [Deinterlacer]
-> Read Deinterlacer
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Deinterlacer]
$creadListPrec :: ReadPrec [Deinterlacer]
readPrec :: ReadPrec Deinterlacer
$creadPrec :: ReadPrec Deinterlacer
readList :: ReadS [Deinterlacer]
$creadList :: ReadS [Deinterlacer]
readsPrec :: Int -> ReadS Deinterlacer
$creadsPrec :: Int -> ReadS Deinterlacer
Prelude.Read, Int -> Deinterlacer -> ShowS
[Deinterlacer] -> ShowS
Deinterlacer -> String
(Int -> Deinterlacer -> ShowS)
-> (Deinterlacer -> String)
-> ([Deinterlacer] -> ShowS)
-> Show Deinterlacer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Deinterlacer] -> ShowS
$cshowList :: [Deinterlacer] -> ShowS
show :: Deinterlacer -> String
$cshow :: Deinterlacer -> String
showsPrec :: Int -> Deinterlacer -> ShowS
$cshowsPrec :: Int -> Deinterlacer -> ShowS
Prelude.Show, (forall x. Deinterlacer -> Rep Deinterlacer x)
-> (forall x. Rep Deinterlacer x -> Deinterlacer)
-> Generic Deinterlacer
forall x. Rep Deinterlacer x -> Deinterlacer
forall x. Deinterlacer -> Rep Deinterlacer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Deinterlacer x -> Deinterlacer
$cfrom :: forall x. Deinterlacer -> Rep Deinterlacer x
Prelude.Generic)

-- |
-- Create a value of 'Deinterlacer' 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:
--
-- 'control', 'deinterlacer_control' - - When set to NORMAL (default), the deinterlacer does not convert frames
-- that are tagged in metadata as progressive. It will only convert those
-- that are tagged as some other type. - When set to FORCE_ALL_FRAMES, the
-- deinterlacer converts every frame to progressive - even those that are
-- already tagged as progressive. Turn Force mode on only if there is a
-- good chance that the metadata has tagged frames as progressive when they
-- are not progressive. Do not turn on otherwise; processing frames that
-- are already progressive into progressive will probably result in lower
-- quality video.
--
-- 'mode', 'deinterlacer_mode' - Use Deinterlacer (DeinterlaceMode) to choose how the service will do
-- deinterlacing. Default is Deinterlace. - Deinterlace converts interlaced
-- to progressive. - Inverse telecine converts Hard Telecine 29.97i to
-- progressive 23.976p. - Adaptive auto-detects and converts to
-- progressive.
--
-- 'algorithm', 'deinterlacer_algorithm' - Only applies when you set Deinterlacer (DeinterlaceMode) to Deinterlace
-- (DEINTERLACE) or Adaptive (ADAPTIVE). Motion adaptive interpolate
-- (INTERPOLATE) produces sharper pictures, while blend (BLEND) produces
-- smoother motion. Use (INTERPOLATE_TICKER) OR (BLEND_TICKER) if your
-- source file includes a ticker, such as a scrolling headline at the
-- bottom of the frame.
newDeinterlacer ::
  Deinterlacer
newDeinterlacer :: Deinterlacer
newDeinterlacer =
  Deinterlacer' :: Maybe DeinterlacerControl
-> Maybe DeinterlacerMode
-> Maybe DeinterlaceAlgorithm
-> Deinterlacer
Deinterlacer'
    { $sel:control:Deinterlacer' :: Maybe DeinterlacerControl
control = Maybe DeinterlacerControl
forall a. Maybe a
Prelude.Nothing,
      $sel:mode:Deinterlacer' :: Maybe DeinterlacerMode
mode = Maybe DeinterlacerMode
forall a. Maybe a
Prelude.Nothing,
      $sel:algorithm:Deinterlacer' :: Maybe DeinterlaceAlgorithm
algorithm = Maybe DeinterlaceAlgorithm
forall a. Maybe a
Prelude.Nothing
    }

-- | - When set to NORMAL (default), the deinterlacer does not convert frames
-- that are tagged in metadata as progressive. It will only convert those
-- that are tagged as some other type. - When set to FORCE_ALL_FRAMES, the
-- deinterlacer converts every frame to progressive - even those that are
-- already tagged as progressive. Turn Force mode on only if there is a
-- good chance that the metadata has tagged frames as progressive when they
-- are not progressive. Do not turn on otherwise; processing frames that
-- are already progressive into progressive will probably result in lower
-- quality video.
deinterlacer_control :: Lens.Lens' Deinterlacer (Prelude.Maybe DeinterlacerControl)
deinterlacer_control :: (Maybe DeinterlacerControl -> f (Maybe DeinterlacerControl))
-> Deinterlacer -> f Deinterlacer
deinterlacer_control = (Deinterlacer -> Maybe DeinterlacerControl)
-> (Deinterlacer -> Maybe DeinterlacerControl -> Deinterlacer)
-> Lens
     Deinterlacer
     Deinterlacer
     (Maybe DeinterlacerControl)
     (Maybe DeinterlacerControl)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Deinterlacer' {Maybe DeinterlacerControl
control :: Maybe DeinterlacerControl
$sel:control:Deinterlacer' :: Deinterlacer -> Maybe DeinterlacerControl
control} -> Maybe DeinterlacerControl
control) (\s :: Deinterlacer
s@Deinterlacer' {} Maybe DeinterlacerControl
a -> Deinterlacer
s {$sel:control:Deinterlacer' :: Maybe DeinterlacerControl
control = Maybe DeinterlacerControl
a} :: Deinterlacer)

-- | Use Deinterlacer (DeinterlaceMode) to choose how the service will do
-- deinterlacing. Default is Deinterlace. - Deinterlace converts interlaced
-- to progressive. - Inverse telecine converts Hard Telecine 29.97i to
-- progressive 23.976p. - Adaptive auto-detects and converts to
-- progressive.
deinterlacer_mode :: Lens.Lens' Deinterlacer (Prelude.Maybe DeinterlacerMode)
deinterlacer_mode :: (Maybe DeinterlacerMode -> f (Maybe DeinterlacerMode))
-> Deinterlacer -> f Deinterlacer
deinterlacer_mode = (Deinterlacer -> Maybe DeinterlacerMode)
-> (Deinterlacer -> Maybe DeinterlacerMode -> Deinterlacer)
-> Lens
     Deinterlacer
     Deinterlacer
     (Maybe DeinterlacerMode)
     (Maybe DeinterlacerMode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Deinterlacer' {Maybe DeinterlacerMode
mode :: Maybe DeinterlacerMode
$sel:mode:Deinterlacer' :: Deinterlacer -> Maybe DeinterlacerMode
mode} -> Maybe DeinterlacerMode
mode) (\s :: Deinterlacer
s@Deinterlacer' {} Maybe DeinterlacerMode
a -> Deinterlacer
s {$sel:mode:Deinterlacer' :: Maybe DeinterlacerMode
mode = Maybe DeinterlacerMode
a} :: Deinterlacer)

-- | Only applies when you set Deinterlacer (DeinterlaceMode) to Deinterlace
-- (DEINTERLACE) or Adaptive (ADAPTIVE). Motion adaptive interpolate
-- (INTERPOLATE) produces sharper pictures, while blend (BLEND) produces
-- smoother motion. Use (INTERPOLATE_TICKER) OR (BLEND_TICKER) if your
-- source file includes a ticker, such as a scrolling headline at the
-- bottom of the frame.
deinterlacer_algorithm :: Lens.Lens' Deinterlacer (Prelude.Maybe DeinterlaceAlgorithm)
deinterlacer_algorithm :: (Maybe DeinterlaceAlgorithm -> f (Maybe DeinterlaceAlgorithm))
-> Deinterlacer -> f Deinterlacer
deinterlacer_algorithm = (Deinterlacer -> Maybe DeinterlaceAlgorithm)
-> (Deinterlacer -> Maybe DeinterlaceAlgorithm -> Deinterlacer)
-> Lens
     Deinterlacer
     Deinterlacer
     (Maybe DeinterlaceAlgorithm)
     (Maybe DeinterlaceAlgorithm)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Deinterlacer' {Maybe DeinterlaceAlgorithm
algorithm :: Maybe DeinterlaceAlgorithm
$sel:algorithm:Deinterlacer' :: Deinterlacer -> Maybe DeinterlaceAlgorithm
algorithm} -> Maybe DeinterlaceAlgorithm
algorithm) (\s :: Deinterlacer
s@Deinterlacer' {} Maybe DeinterlaceAlgorithm
a -> Deinterlacer
s {$sel:algorithm:Deinterlacer' :: Maybe DeinterlaceAlgorithm
algorithm = Maybe DeinterlaceAlgorithm
a} :: Deinterlacer)

instance Core.FromJSON Deinterlacer where
  parseJSON :: Value -> Parser Deinterlacer
parseJSON =
    String
-> (Object -> Parser Deinterlacer) -> Value -> Parser Deinterlacer
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Deinterlacer"
      ( \Object
x ->
          Maybe DeinterlacerControl
-> Maybe DeinterlacerMode
-> Maybe DeinterlaceAlgorithm
-> Deinterlacer
Deinterlacer'
            (Maybe DeinterlacerControl
 -> Maybe DeinterlacerMode
 -> Maybe DeinterlaceAlgorithm
 -> Deinterlacer)
-> Parser (Maybe DeinterlacerControl)
-> Parser
     (Maybe DeinterlacerMode
      -> Maybe DeinterlaceAlgorithm -> Deinterlacer)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe DeinterlacerControl)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"control")
            Parser
  (Maybe DeinterlacerMode
   -> Maybe DeinterlaceAlgorithm -> Deinterlacer)
-> Parser (Maybe DeinterlacerMode)
-> Parser (Maybe DeinterlaceAlgorithm -> Deinterlacer)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DeinterlacerMode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"mode")
            Parser (Maybe DeinterlaceAlgorithm -> Deinterlacer)
-> Parser (Maybe DeinterlaceAlgorithm) -> Parser Deinterlacer
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DeinterlaceAlgorithm)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"algorithm")
      )

instance Prelude.Hashable Deinterlacer

instance Prelude.NFData Deinterlacer

instance Core.ToJSON Deinterlacer where
  toJSON :: Deinterlacer -> Value
toJSON Deinterlacer' {Maybe DeinterlaceAlgorithm
Maybe DeinterlacerControl
Maybe DeinterlacerMode
algorithm :: Maybe DeinterlaceAlgorithm
mode :: Maybe DeinterlacerMode
control :: Maybe DeinterlacerControl
$sel:algorithm:Deinterlacer' :: Deinterlacer -> Maybe DeinterlaceAlgorithm
$sel:mode:Deinterlacer' :: Deinterlacer -> Maybe DeinterlacerMode
$sel:control:Deinterlacer' :: Deinterlacer -> Maybe DeinterlacerControl
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"control" Text -> DeinterlacerControl -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (DeinterlacerControl -> Pair)
-> Maybe DeinterlacerControl -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DeinterlacerControl
control,
            (Text
"mode" Text -> DeinterlacerMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (DeinterlacerMode -> Pair) -> Maybe DeinterlacerMode -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DeinterlacerMode
mode,
            (Text
"algorithm" Text -> DeinterlaceAlgorithm -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (DeinterlaceAlgorithm -> Pair)
-> Maybe DeinterlaceAlgorithm -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DeinterlaceAlgorithm
algorithm
          ]
      )