{-# 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.H265QvbrSettings
-- 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.H265QvbrSettings 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 H.265
-- codec. Use these settings only when you set QVBR for Rate control mode
-- (RateControlMode).
--
-- /See:/ 'newH265QvbrSettings' smart constructor.
data H265QvbrSettings = H265QvbrSettings'
  { -- | Use this setting only when Rate control mode is QVBR and Quality tuning
    -- level is Multi-pass HQ. For Max average bitrate values suited to the
    -- complexity of your input video, the service limits the average bitrate
    -- of the video part of this output to the value that you choose. That is,
    -- the total size of the video element is less than or equal to the value
    -- you set multiplied by the number of seconds of encoded output.
    H265QvbrSettings -> Maybe Natural
maxAverageBitrate :: Prelude.Maybe Prelude.Natural,
    -- | 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.
    H265QvbrSettings -> 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.
    H265QvbrSettings -> Maybe Double
qvbrQualityLevelFineTune :: Prelude.Maybe Prelude.Double
  }
  deriving (H265QvbrSettings -> H265QvbrSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: H265QvbrSettings -> H265QvbrSettings -> Bool
$c/= :: H265QvbrSettings -> H265QvbrSettings -> Bool
== :: H265QvbrSettings -> H265QvbrSettings -> Bool
$c== :: H265QvbrSettings -> H265QvbrSettings -> Bool
Prelude.Eq, ReadPrec [H265QvbrSettings]
ReadPrec H265QvbrSettings
Int -> ReadS H265QvbrSettings
ReadS [H265QvbrSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [H265QvbrSettings]
$creadListPrec :: ReadPrec [H265QvbrSettings]
readPrec :: ReadPrec H265QvbrSettings
$creadPrec :: ReadPrec H265QvbrSettings
readList :: ReadS [H265QvbrSettings]
$creadList :: ReadS [H265QvbrSettings]
readsPrec :: Int -> ReadS H265QvbrSettings
$creadsPrec :: Int -> ReadS H265QvbrSettings
Prelude.Read, Int -> H265QvbrSettings -> ShowS
[H265QvbrSettings] -> ShowS
H265QvbrSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [H265QvbrSettings] -> ShowS
$cshowList :: [H265QvbrSettings] -> ShowS
show :: H265QvbrSettings -> String
$cshow :: H265QvbrSettings -> String
showsPrec :: Int -> H265QvbrSettings -> ShowS
$cshowsPrec :: Int -> H265QvbrSettings -> ShowS
Prelude.Show, forall x. Rep H265QvbrSettings x -> H265QvbrSettings
forall x. H265QvbrSettings -> Rep H265QvbrSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep H265QvbrSettings x -> H265QvbrSettings
$cfrom :: forall x. H265QvbrSettings -> Rep H265QvbrSettings x
Prelude.Generic)

-- |
-- Create a value of 'H265QvbrSettings' 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:
--
-- 'maxAverageBitrate', 'h265QvbrSettings_maxAverageBitrate' - Use this setting only when Rate control mode is QVBR and Quality tuning
-- level is Multi-pass HQ. For Max average bitrate values suited to the
-- complexity of your input video, the service limits the average bitrate
-- of the video part of this output to the value that you choose. That is,
-- the total size of the video element is less than or equal to the value
-- you set multiplied by the number of seconds of encoded output.
--
-- 'qvbrQualityLevel', 'h265QvbrSettings_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', 'h265QvbrSettings_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.
newH265QvbrSettings ::
  H265QvbrSettings
newH265QvbrSettings :: H265QvbrSettings
newH265QvbrSettings =
  H265QvbrSettings'
    { $sel:maxAverageBitrate:H265QvbrSettings' :: Maybe Natural
maxAverageBitrate =
        forall a. Maybe a
Prelude.Nothing,
      $sel:qvbrQualityLevel:H265QvbrSettings' :: Maybe Natural
qvbrQualityLevel = forall a. Maybe a
Prelude.Nothing,
      $sel:qvbrQualityLevelFineTune:H265QvbrSettings' :: Maybe Double
qvbrQualityLevelFineTune = forall a. Maybe a
Prelude.Nothing
    }

-- | Use this setting only when Rate control mode is QVBR and Quality tuning
-- level is Multi-pass HQ. For Max average bitrate values suited to the
-- complexity of your input video, the service limits the average bitrate
-- of the video part of this output to the value that you choose. That is,
-- the total size of the video element is less than or equal to the value
-- you set multiplied by the number of seconds of encoded output.
h265QvbrSettings_maxAverageBitrate :: Lens.Lens' H265QvbrSettings (Prelude.Maybe Prelude.Natural)
h265QvbrSettings_maxAverageBitrate :: Lens' H265QvbrSettings (Maybe Natural)
h265QvbrSettings_maxAverageBitrate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\H265QvbrSettings' {Maybe Natural
maxAverageBitrate :: Maybe Natural
$sel:maxAverageBitrate:H265QvbrSettings' :: H265QvbrSettings -> Maybe Natural
maxAverageBitrate} -> Maybe Natural
maxAverageBitrate) (\s :: H265QvbrSettings
s@H265QvbrSettings' {} Maybe Natural
a -> H265QvbrSettings
s {$sel:maxAverageBitrate:H265QvbrSettings' :: Maybe Natural
maxAverageBitrate = Maybe Natural
a} :: H265QvbrSettings)

-- | 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.
h265QvbrSettings_qvbrQualityLevel :: Lens.Lens' H265QvbrSettings (Prelude.Maybe Prelude.Natural)
h265QvbrSettings_qvbrQualityLevel :: Lens' H265QvbrSettings (Maybe Natural)
h265QvbrSettings_qvbrQualityLevel = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\H265QvbrSettings' {Maybe Natural
qvbrQualityLevel :: Maybe Natural
$sel:qvbrQualityLevel:H265QvbrSettings' :: H265QvbrSettings -> Maybe Natural
qvbrQualityLevel} -> Maybe Natural
qvbrQualityLevel) (\s :: H265QvbrSettings
s@H265QvbrSettings' {} Maybe Natural
a -> H265QvbrSettings
s {$sel:qvbrQualityLevel:H265QvbrSettings' :: Maybe Natural
qvbrQualityLevel = Maybe Natural
a} :: H265QvbrSettings)

-- | 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.
h265QvbrSettings_qvbrQualityLevelFineTune :: Lens.Lens' H265QvbrSettings (Prelude.Maybe Prelude.Double)
h265QvbrSettings_qvbrQualityLevelFineTune :: Lens' H265QvbrSettings (Maybe Double)
h265QvbrSettings_qvbrQualityLevelFineTune = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\H265QvbrSettings' {Maybe Double
qvbrQualityLevelFineTune :: Maybe Double
$sel:qvbrQualityLevelFineTune:H265QvbrSettings' :: H265QvbrSettings -> Maybe Double
qvbrQualityLevelFineTune} -> Maybe Double
qvbrQualityLevelFineTune) (\s :: H265QvbrSettings
s@H265QvbrSettings' {} Maybe Double
a -> H265QvbrSettings
s {$sel:qvbrQualityLevelFineTune:H265QvbrSettings' :: Maybe Double
qvbrQualityLevelFineTune = Maybe Double
a} :: H265QvbrSettings)

instance Data.FromJSON H265QvbrSettings where
  parseJSON :: Value -> Parser H265QvbrSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"H265QvbrSettings"
      ( \Object
x ->
          Maybe Natural -> Maybe Natural -> Maybe Double -> H265QvbrSettings
H265QvbrSettings'
            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
"maxAverageBitrate")
            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
"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 H265QvbrSettings where
  hashWithSalt :: Int -> H265QvbrSettings -> Int
hashWithSalt Int
_salt H265QvbrSettings' {Maybe Double
Maybe Natural
qvbrQualityLevelFineTune :: Maybe Double
qvbrQualityLevel :: Maybe Natural
maxAverageBitrate :: Maybe Natural
$sel:qvbrQualityLevelFineTune:H265QvbrSettings' :: H265QvbrSettings -> Maybe Double
$sel:qvbrQualityLevel:H265QvbrSettings' :: H265QvbrSettings -> Maybe Natural
$sel:maxAverageBitrate:H265QvbrSettings' :: H265QvbrSettings -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxAverageBitrate
      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 H265QvbrSettings where
  rnf :: H265QvbrSettings -> ()
rnf H265QvbrSettings' {Maybe Double
Maybe Natural
qvbrQualityLevelFineTune :: Maybe Double
qvbrQualityLevel :: Maybe Natural
maxAverageBitrate :: Maybe Natural
$sel:qvbrQualityLevelFineTune:H265QvbrSettings' :: H265QvbrSettings -> Maybe Double
$sel:qvbrQualityLevel:H265QvbrSettings' :: H265QvbrSettings -> Maybe Natural
$sel:maxAverageBitrate:H265QvbrSettings' :: H265QvbrSettings -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxAverageBitrate
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 H265QvbrSettings where
  toJSON :: H265QvbrSettings -> Value
toJSON H265QvbrSettings' {Maybe Double
Maybe Natural
qvbrQualityLevelFineTune :: Maybe Double
qvbrQualityLevel :: Maybe Natural
maxAverageBitrate :: Maybe Natural
$sel:qvbrQualityLevelFineTune:H265QvbrSettings' :: H265QvbrSettings -> Maybe Double
$sel:qvbrQualityLevel:H265QvbrSettings' :: H265QvbrSettings -> Maybe Natural
$sel:maxAverageBitrate:H265QvbrSettings' :: H265QvbrSettings -> Maybe Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"maxAverageBitrate" 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
maxAverageBitrate,
            (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
          ]
      )