{-# 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.Av1QvbrSettings
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MediaConvert.Types.Av1QvbrSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Settings for quality-defined variable bitrate encoding with the AV1
-- codec. Use these settings only when you set QVBR for Rate control mode
-- (RateControlMode).
--
-- /See:/ 'newAv1QvbrSettings' smart constructor.
data Av1QvbrSettings = Av1QvbrSettings'
  { -- | Use this setting only when you set Rate control mode (RateControlMode)
    -- to QVBR. Specify the target quality level for this output. MediaConvert
    -- determines the right number of bits to use for each part of the video to
    -- maintain the video quality that you specify. When you keep the default
    -- value, AUTO, MediaConvert picks a quality level for you, based on
    -- characteristics of your input video. If you prefer to specify a quality
    -- level, specify a number from 1 through 10. Use higher numbers for
    -- greater quality. Level 10 results in nearly lossless compression. The
    -- quality level for most broadcast-quality transcodes is between 6 and 9.
    -- Optionally, to specify a value between whole numbers, also provide a
    -- value for the setting qvbrQualityLevelFineTune. For example, if you want
    -- your QVBR quality level to be 7.33, set qvbrQualityLevel to 7 and set
    -- qvbrQualityLevelFineTune to .33.
    Av1QvbrSettings -> Maybe Natural
qvbrQualityLevel :: Prelude.Maybe Prelude.Natural,
    -- | Optional. Specify a value here to set the QVBR quality to a level that
    -- is between whole numbers. For example, if you want your QVBR quality
    -- level to be 7.33, set qvbrQualityLevel to 7 and set
    -- qvbrQualityLevelFineTune to .33. MediaConvert rounds your QVBR quality
    -- level to the nearest third of a whole number. For example, if you set
    -- qvbrQualityLevel to 7 and you set qvbrQualityLevelFineTune to .25, your
    -- actual QVBR quality level is 7.33.
    Av1QvbrSettings -> Maybe Double
qvbrQualityLevelFineTune :: Prelude.Maybe Prelude.Double
  }
  deriving (Av1QvbrSettings -> Av1QvbrSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Av1QvbrSettings -> Av1QvbrSettings -> Bool
$c/= :: Av1QvbrSettings -> Av1QvbrSettings -> Bool
== :: Av1QvbrSettings -> Av1QvbrSettings -> Bool
$c== :: Av1QvbrSettings -> Av1QvbrSettings -> Bool
Prelude.Eq, ReadPrec [Av1QvbrSettings]
ReadPrec Av1QvbrSettings
Int -> ReadS Av1QvbrSettings
ReadS [Av1QvbrSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Av1QvbrSettings]
$creadListPrec :: ReadPrec [Av1QvbrSettings]
readPrec :: ReadPrec Av1QvbrSettings
$creadPrec :: ReadPrec Av1QvbrSettings
readList :: ReadS [Av1QvbrSettings]
$creadList :: ReadS [Av1QvbrSettings]
readsPrec :: Int -> ReadS Av1QvbrSettings
$creadsPrec :: Int -> ReadS Av1QvbrSettings
Prelude.Read, Int -> Av1QvbrSettings -> ShowS
[Av1QvbrSettings] -> ShowS
Av1QvbrSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Av1QvbrSettings] -> ShowS
$cshowList :: [Av1QvbrSettings] -> ShowS
show :: Av1QvbrSettings -> String
$cshow :: Av1QvbrSettings -> String
showsPrec :: Int -> Av1QvbrSettings -> ShowS
$cshowsPrec :: Int -> Av1QvbrSettings -> ShowS
Prelude.Show, forall x. Rep Av1QvbrSettings x -> Av1QvbrSettings
forall x. Av1QvbrSettings -> Rep Av1QvbrSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Av1QvbrSettings x -> Av1QvbrSettings
$cfrom :: forall x. Av1QvbrSettings -> Rep Av1QvbrSettings x
Prelude.Generic)

-- |
-- Create a value of 'Av1QvbrSettings' 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:
--
-- 'qvbrQualityLevel', 'av1QvbrSettings_qvbrQualityLevel' - Use this setting only when you set Rate control mode (RateControlMode)
-- to QVBR. Specify the target quality level for this output. MediaConvert
-- determines the right number of bits to use for each part of the video to
-- maintain the video quality that you specify. When you keep the default
-- value, AUTO, MediaConvert picks a quality level for you, based on
-- characteristics of your input video. If you prefer to specify a quality
-- level, specify a number from 1 through 10. Use higher numbers for
-- greater quality. Level 10 results in nearly lossless compression. The
-- quality level for most broadcast-quality transcodes is between 6 and 9.
-- Optionally, to specify a value between whole numbers, also provide a
-- value for the setting qvbrQualityLevelFineTune. For example, if you want
-- your QVBR quality level to be 7.33, set qvbrQualityLevel to 7 and set
-- qvbrQualityLevelFineTune to .33.
--
-- 'qvbrQualityLevelFineTune', 'av1QvbrSettings_qvbrQualityLevelFineTune' - Optional. Specify a value here to set the QVBR quality to a level that
-- is between whole numbers. For example, if you want your QVBR quality
-- level to be 7.33, set qvbrQualityLevel to 7 and set
-- qvbrQualityLevelFineTune to .33. MediaConvert rounds your QVBR quality
-- level to the nearest third of a whole number. For example, if you set
-- qvbrQualityLevel to 7 and you set qvbrQualityLevelFineTune to .25, your
-- actual QVBR quality level is 7.33.
newAv1QvbrSettings ::
  Av1QvbrSettings
newAv1QvbrSettings :: Av1QvbrSettings
newAv1QvbrSettings =
  Av1QvbrSettings'
    { $sel:qvbrQualityLevel:Av1QvbrSettings' :: Maybe Natural
qvbrQualityLevel =
        forall a. Maybe a
Prelude.Nothing,
      $sel:qvbrQualityLevelFineTune:Av1QvbrSettings' :: Maybe Double
qvbrQualityLevelFineTune = forall a. Maybe a
Prelude.Nothing
    }

-- | Use this setting only when you set Rate control mode (RateControlMode)
-- to QVBR. Specify the target quality level for this output. MediaConvert
-- determines the right number of bits to use for each part of the video to
-- maintain the video quality that you specify. When you keep the default
-- value, AUTO, MediaConvert picks a quality level for you, based on
-- characteristics of your input video. If you prefer to specify a quality
-- level, specify a number from 1 through 10. Use higher numbers for
-- greater quality. Level 10 results in nearly lossless compression. The
-- quality level for most broadcast-quality transcodes is between 6 and 9.
-- Optionally, to specify a value between whole numbers, also provide a
-- value for the setting qvbrQualityLevelFineTune. For example, if you want
-- your QVBR quality level to be 7.33, set qvbrQualityLevel to 7 and set
-- qvbrQualityLevelFineTune to .33.
av1QvbrSettings_qvbrQualityLevel :: Lens.Lens' Av1QvbrSettings (Prelude.Maybe Prelude.Natural)
av1QvbrSettings_qvbrQualityLevel :: Lens' Av1QvbrSettings (Maybe Natural)
av1QvbrSettings_qvbrQualityLevel = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Av1QvbrSettings' {Maybe Natural
qvbrQualityLevel :: Maybe Natural
$sel:qvbrQualityLevel:Av1QvbrSettings' :: Av1QvbrSettings -> Maybe Natural
qvbrQualityLevel} -> Maybe Natural
qvbrQualityLevel) (\s :: Av1QvbrSettings
s@Av1QvbrSettings' {} Maybe Natural
a -> Av1QvbrSettings
s {$sel:qvbrQualityLevel:Av1QvbrSettings' :: Maybe Natural
qvbrQualityLevel = Maybe Natural
a} :: Av1QvbrSettings)

-- | Optional. Specify a value here to set the QVBR quality to a level that
-- is between whole numbers. For example, if you want your QVBR quality
-- level to be 7.33, set qvbrQualityLevel to 7 and set
-- qvbrQualityLevelFineTune to .33. MediaConvert rounds your QVBR quality
-- level to the nearest third of a whole number. For example, if you set
-- qvbrQualityLevel to 7 and you set qvbrQualityLevelFineTune to .25, your
-- actual QVBR quality level is 7.33.
av1QvbrSettings_qvbrQualityLevelFineTune :: Lens.Lens' Av1QvbrSettings (Prelude.Maybe Prelude.Double)
av1QvbrSettings_qvbrQualityLevelFineTune :: Lens' Av1QvbrSettings (Maybe Double)
av1QvbrSettings_qvbrQualityLevelFineTune = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Av1QvbrSettings' {Maybe Double
qvbrQualityLevelFineTune :: Maybe Double
$sel:qvbrQualityLevelFineTune:Av1QvbrSettings' :: Av1QvbrSettings -> Maybe Double
qvbrQualityLevelFineTune} -> Maybe Double
qvbrQualityLevelFineTune) (\s :: Av1QvbrSettings
s@Av1QvbrSettings' {} Maybe Double
a -> Av1QvbrSettings
s {$sel:qvbrQualityLevelFineTune:Av1QvbrSettings' :: Maybe Double
qvbrQualityLevelFineTune = Maybe Double
a} :: Av1QvbrSettings)

instance Data.FromJSON Av1QvbrSettings where
  parseJSON :: Value -> Parser Av1QvbrSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Av1QvbrSettings"
      ( \Object
x ->
          Maybe Natural -> Maybe Double -> Av1QvbrSettings
Av1QvbrSettings'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"qvbrQualityLevel")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"qvbrQualityLevelFineTune")
      )

instance Prelude.Hashable Av1QvbrSettings where
  hashWithSalt :: Int -> Av1QvbrSettings -> Int
hashWithSalt Int
_salt Av1QvbrSettings' {Maybe Double
Maybe Natural
qvbrQualityLevelFineTune :: Maybe Double
qvbrQualityLevel :: Maybe Natural
$sel:qvbrQualityLevelFineTune:Av1QvbrSettings' :: Av1QvbrSettings -> Maybe Double
$sel:qvbrQualityLevel:Av1QvbrSettings' :: Av1QvbrSettings -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
qvbrQualityLevel
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
qvbrQualityLevelFineTune

instance Prelude.NFData Av1QvbrSettings where
  rnf :: Av1QvbrSettings -> ()
rnf Av1QvbrSettings' {Maybe Double
Maybe Natural
qvbrQualityLevelFineTune :: Maybe Double
qvbrQualityLevel :: Maybe Natural
$sel:qvbrQualityLevelFineTune:Av1QvbrSettings' :: Av1QvbrSettings -> Maybe Double
$sel:qvbrQualityLevel:Av1QvbrSettings' :: Av1QvbrSettings -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
qvbrQualityLevel
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
qvbrQualityLevelFineTune

instance Data.ToJSON Av1QvbrSettings where
  toJSON :: Av1QvbrSettings -> Value
toJSON Av1QvbrSettings' {Maybe Double
Maybe Natural
qvbrQualityLevelFineTune :: Maybe Double
qvbrQualityLevel :: Maybe Natural
$sel:qvbrQualityLevelFineTune:Av1QvbrSettings' :: Av1QvbrSettings -> Maybe Double
$sel:qvbrQualityLevel:Av1QvbrSettings' :: Av1QvbrSettings -> Maybe Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"qvbrQualityLevel" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
qvbrQualityLevel,
            (Key
"qvbrQualityLevelFineTune" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
qvbrQualityLevelFineTune
          ]
      )