1 /*
2 * Copyright (c) 2018-2024, 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_pipeline.h
24 //! \brief    Defines the interface for hevc encode pipeline
25 //!
26 #ifndef __ENCODE_HEVC_PIPELINE_H__
27 #define __ENCODE_HEVC_PIPELINE_H__
28 #include "encode_pipeline.h"
29 #include "encode_hevc_dfs.h"
30 #include "encode_hevc_vdenc_feature_manager.h"
31 
32 namespace encode {
33 
34 class HevcPipeline : public EncodePipeline
35 {
36 public:
37     //!
38     //! \brief  EncodePipeline constructor
39     //! \param  [in] hwInterface
40     //!         Pointer to CodechalHwInterface
41     //! \param  [in] debugInterface
42     //!         Pointer to CodechalDebugInterface
43     //!
44     HevcPipeline(
45         CodechalHwInterfaceNext *   hwInterface,
46         CodechalDebugInterface *debugInterface);
47 
~HevcPipeline()48     virtual ~HevcPipeline() {}
49 
50     virtual MOS_STATUS Prepare(void *params) override;
51 
52     enum PacketIds
53     {
54         HucBrcInit = CONSTRUCTPACKETID(PACKET_COMPONENT_ENCODE, PACKET_SUBCOMPONENT_HEVC, 0),
55         HucBrcUpdate,
56         hevcVdencPacket,
57         hevcPakIntegrate,
58         hevcVdencPicPacket,
59         hevcVdencTileRowPacket,
60         HucBrcTileRowUpdate,
61         HucLaInit,
62         HucLaUpdate,
63         hevcVdencPacket422,
64         EncodeCheckHucLoad
65 #if ((_DEBUG || _RELEASE_INTERNAL) && _MEDIA_RESERVED)
66         ,
67         hevcVdencMvdumpPacket
68 #endif
69     };
70 
71 protected:
72     virtual MOS_STATUS Initialize(void *settings) override;
73     virtual MOS_STATUS Uninitialize() override;
74     virtual MOS_STATUS UserFeatureReport() override;
75     virtual MOS_STATUS CreateBufferTracker() override;
76     virtual MOS_STATUS CreateStatusReport() override;
77     virtual MOS_STATUS InitUserSetting(MediaUserSettingSharedPtr userSettingPtr) override;
78 
79 #if USE_CODECHAL_DEBUG_TOOL
80     //! \brief    Dump the Sequense parameters
81     //!
82     //! \param    [in] seqParams
83     //!           Pointer to CODEC_HEVC_ENCODE_SEQUENCE_PARAMS
84     //!
85     //! \return   MOS_STATUS
86     //!           MOS_STATUS_SUCCESS if success, else fail reason
87     //!
88     MOS_STATUS DumpSeqParams(
89         const CODEC_HEVC_ENCODE_SEQUENCE_PARAMS *seqParams);
90 
91     //! \brief    Dump the picture parameters
92     //!
93     //! \param    [in] picParams
94     //!           Pointer to CODEC_HEVC_ENCODE_PICTURE_PARAMS
95     //!
96     //! \return   MOS_STATUS
97     //!           MOS_STATUS_SUCCESS if success, else fail reason
98     //!
99     MOS_STATUS DumpPicParams(
100         const CODEC_HEVC_ENCODE_PICTURE_PARAMS *picParams);
101 
102     //! \brief    Dump the slice parameters
103     //!
104     //! \param    [in] sliceParams
105     //!           Pointer to CODEC_HEVC_ENCODE_SLICE_PARAMS
106     //! \param    [in] picParams
107     //!           Pointer to CODEC_HEVC_ENCODE_PICTURE_PARAMS
108     //!
109     //! \return   MOS_STATUS
110     //!           MOS_STATUS_SUCCESS if success, else fail reason
111     //!
112     MOS_STATUS DumpSliceParams(
113         const CODEC_HEVC_ENCODE_SLICE_PARAMS   *sliceParams,
114         const CODEC_HEVC_ENCODE_PICTURE_PARAMS *picParams);
115 #endif
116 
117 
118 MEDIA_CLASS_DEFINE_END(encode__HevcPipeline)
119 };
120 
121 }
122 #endif // !__ENCODE_HEVC_PIPELINE_H__
123