Debian Codegraph @

media_softlet/agnostic/common/codec/hal/enc/shared/features/encode_lpla.h

raw
1 /*
2 * Copyright (c) 2021, Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22 //!
23 //! \file encode_lpla.h
24 //! \brief Defines the common interface for LowPower Lookahead encode
25 //!
26
27 #ifndef __ENCODE_LPLA_H__
28 #define __ENCODE_LPLA_H__
29
30 #include "media_feature.h"
31 #include "encode_pipeline.h"
32
33 namespace encode
34 {
35 class EncodeLPLA
36 {
37 public:
38 //!
39 //! \brief Calculate target buffer fullness
40 //! \param [in] targetBufferFulness
41 //! target buffer fullness
42 //! \param [in] prevTargetFrameSize
43 //! Previous target frame size
44 //! \param [in] averageFrameSize
45 //! Average frame size
46 //! \return MOS_STATUS
47 //! MOS_STATUS_SUCCESS if success, else fail reason
48 //!
49 MOS_STATUS CalculateTargetBufferFullness(
50 uint32_t &targetBufferFulness,
51 uint32_t &prevTargetFrameSize,
52 uint32_t &averageFrameSize);
53
54 //!
55 //! \brief Check if frame rate is valid
56 //! \param [in] Numerator
57 //! Numerator in ddi params
58 //! \param [in] Denominator
59 //! Denominator in ddi params
60 //! \param [in] TargetBitRate
61 //! Target bit rate
62 //! \param [in] averageFrameSize
63 //! Average frame size
64 //! \return MOS_STATUS
65 //! MOS_STATUS_SUCCESS if success, else fail reason
66 //!
67 MOS_STATUS CheckFrameRate(
68 uint32_t &Numerator,
69 uint32_t &Denominator,
70 uint32_t &TargetBitRate,
71 uint32_t &averageFrameSize);
72
73 //!
74 //! \brief Check if VBV Buffer is valid
75 //! \param [in] VBVBufferSizeInBit
76 //! VBV buffer size in bit
77 //! \return MOS_STATUS
78 //! MOS_STATUS_SUCCESS if success, else fail reason
79 //!
80 MOS_STATUS CheckVBVBuffer(
81 uint32_t &VBVBufferSizeInBit,
82 uint32_t &InitVBVBufferFullnessInBit);
83
84 //!
85 //! \brief Calculate delta QP
86 //! \param [in] QpModulationStrength
87 //! QpModulation strength
88 //! \param [in] initDeltaQP
89 //! flag to indicate initial delta QP
90 //! \param [in] isLastPass
91 //! flag to indicate the last pass
92 //! \param [in] DeltaQP
93 //! delta qp
94 //! \param [in] prevQpModulationStrength
95 //! previous qp modeulation strength
96 //! \return MOS_STATUS
97 //! MOS_STATUS_SUCCESS if success, else fail reason
98 //!
99 MOS_STATUS CalculateDeltaQP(
100 uint8_t &QpModulationStrength,
101 bool &initDeltaQP,
102 bool isLastPass,
103 uint8_t &DeltaQP,
104 uint32_t &prevQpModulationStrength);
105
106 MEDIA_CLASS_DEFINE_END(encode__EncodeLPLA)
107 };
108 } // encode
109
110 #endif