1 /*
2 * Copyright (c) 2020, 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_hevc_vdenc_roi_qpmap.h
24 //! \brief    Defines of the qpmap ROI by software
25 //!
26 
27 #ifndef __CODECHAL_HEVC_VDENC_ROI_QPMAP_H__
28 #define __CODECHAL_HEVC_VDENC_ROI_QPMAP_H__
29 
30 #include "encode_hevc_vdenc_roi_strategy.h"
31 
32 namespace encode
33 {
34 
35     class QPMapROI : public RoiStrategy
36     {
37     public:
QPMapROI(EncodeAllocator * allocator,MediaFeatureManager * featureManager,PMOS_INTERFACE osInterface)38         QPMapROI(EncodeAllocator* allocator,
39             MediaFeatureManager* featureManager,
40             PMOS_INTERFACE osInterface) :
41             RoiStrategy(allocator, featureManager, osInterface)
42         {
43 
44         }
45 
~QPMapROI()46         virtual ~QPMapROI() {}
47 
48     protected:
49         //!
50         //! \brief    Set the ROI ctrol mode(Native/ForceQP/MBQPMap)
51         //!
52         //! \param    [in] lcuIndex
53         //!           Index of LCU
54         //! \param    [in] w_in16
55         //!           width of frame in 16x16 block
56         //! \param    [in] h_in16
57         //!           hight of frame in 16x16 block
58         //! \param    [in] Pitch
59         //!           Pitch of QpDataSurface
60         //! \param    [in] QpData
61         //!           Raw data buffer of QpDataSurface
62         //! \param    [out] streaminDataParams
63         //!           Streamin data parameters
64         //!
65         //! \return   void
66         //!
67         virtual void SetRoiCtrlMode(
68             uint32_t        lcuIndex,
69             StreamInParams &streaminParams,
70             uint32_t        w_in16,
71             uint32_t        h_in16,
72             uint32_t        Pitch,
73             uint8_t *       QpData);
74         //!
75         //! \brief    Set ROI Control/Force QP Data per LCU
76         //!
77         //! \param    [in] streaminDataParams
78         //!           Streamin data parameters
79         //! \param    [out] data
80         //!           Streamin data
81         //!
82         //! \return   void
83         //!
84         virtual void SetQpRoiCtrlPerLcu(
85             StreamInParams* streaminParams,
86             HevcVdencStreamInState* data) override;
87 
88         //!
89         //! \brief    Write the Streamin data according to marker.
90         //! \param    [in] lcuIndex
91         //!           Index of LCU
92         //! \param    [in] marker
93         //!           overlap marker
94         //! \param    [in] roiRegionIndex
95         //!           Index of ROI region
96         //! \param    [out] streamInBuffer
97         //!           Streamin buffer
98         //! \return   MOS_STATUS
99         //!           MOS_STATUS_SUCCESS if success, else fail reason
100         //!
101         virtual MOS_STATUS WriteStreaminData(
102             uint32_t                  lcuIndex,
103             RoiOverlap::OverlapMarker marker,
104             uint32_t                  roiRegionIndex,
105             uint8_t *                 rawStreamIn) override;
106 
107     private:
108 
109 
110     MEDIA_CLASS_DEFINE_END(encode__QPMapROI)
111     };
112 
113 }  // namespace encode
114 #endif  //<! __CODECHAL_HEVC_VDENC_ROI_QPMAP_H__