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_hevc_vdenc_roi_arb.h
24 //! \brief    Defines of the ROI adaptive region boost
25 //!
26 
27 #ifndef __ENCODE_HEVC_VDENC_ROI_ARB_H__
28 #define __ENCODE_HEVC_VDENC_ROI_ARB_H__
29 
30 #include "encode_hevc_vdenc_roi_strategy.h"
31 
32 namespace encode
33 {
34 class ArbROI : public RoiStrategy
35 {
36 public:
ArbROI(EncodeAllocator * allocator,MediaFeatureManager * featureManager,PMOS_INTERFACE osInterface)37     ArbROI(EncodeAllocator *allocator, MediaFeatureManager *featureManager, PMOS_INTERFACE osInterface) :
38         RoiStrategy(allocator, featureManager, osInterface) { }
39 
40     virtual ~ArbROI() = default;
41 
42     MOS_STATUS PrepareParams(
43         SeqParams *hevcSeqParams,
44         PicParams *hevcPicParams,
45         SlcParams *hevcSlcParams) override;
46 
47 protected:
48     void SetRoiCtrlMode(
49         uint32_t        lcuIndex,
50         uint32_t        regionIndex,
51         StreamInParams &streaminParams) override;
52 
53     void SetQpRoiCtrlPerLcu(
54         StreamInParams *        streaminParams,
55         HevcVdencStreamInState *data) override;
56 
57     void SetStreaminParamByTU(
58         bool            cu64Align,
59         StreamInParams &streaminDataParams) override;
60 
61 protected:
62     size_t  m_boostCycle = 0;
63     size_t  m_boostIdx   = 0;
64     uint8_t m_roiCtrl    = 0;
65     uint8_t m_maxCuSize  = 0;
66 
67 MEDIA_CLASS_DEFINE_END(encode__ArbROI)
68 };
69 }  // namespace encode
70 
71 #endif  // __ENCODE_HEVC_VDENC_ROI_ARB_H__
72