1 /*
2 * Copyright (c) 2019 - 2023, 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_av1_pipeline.h
24 //! \brief    Defines the interface for av1 encode pipeline
25 //!
26 #ifndef __ENCODE_AV1_PIPELINE_H__
27 #define __ENCODE_AV1_PIPELINE_H__
28 #include "encode_pipeline.h"
29 #include "encode_av1_vdenc_feature_manager.h"
30 
31 namespace encode {
32 class Av1Pipeline : public EncodePipeline
33 {
34 public:
35     //!
36     //! \brief  EncodePipeline constructor
37     //! \param  [in] hwInterface
38     //!         Pointer to CodechalHwInterface
39     //! \param  [in] debugInterface
40     //!         Pointer to CodechalDebugInterface
41     //!
42     Av1Pipeline(
43         CodechalHwInterfaceNext *   hwInterface,
44         CodechalDebugInterface *debugInterface);
45 
~Av1Pipeline()46     virtual ~Av1Pipeline() {}
47 
48     virtual MOS_STATUS Prepare(void *params) override;
49 
IsDualEncEnabled()50     virtual bool IsDualEncEnabled() {return m_dualEncEnable;}
51 
52     enum Av1PacketIds
53     {
54         Av1HucBrcInit = CONSTRUCTPACKETID(PACKET_COMPONENT_ENCODE, PACKET_SUBCOMPONENT_AV1, 0),
55         Av1HucBrcUpdate,
56         Av1VdencPacket,
57         Av1PakIntegrate,
58         Av1BackAnnotation,
59         Av1Superres,
60         EncodeCheckHucLoad,
61     };
62 
63 protected:
64     virtual MOS_STATUS Initialize(void *settings) override;
65     virtual MOS_STATUS Uninitialize() override;
66     virtual MOS_STATUS UserFeatureReport() override;
67     virtual MOS_STATUS CreateBufferTracker() override;
68     virtual MOS_STATUS CreateStatusReport() override;
69     virtual MOS_STATUS InitUserSetting(MediaUserSettingSharedPtr userSettingPtr) override;
70 
71 
72 #if USE_CODECHAL_DEBUG_TOOL
73     //! \brief    Dump the Sequense parameters
74     //!
75     //! \param    [in] seqParams
76     //!           Pointer to CODEC_AV1_ENCODE_SEQUENCE_PARAMS
77     //!
78     //! \return   MOS_STATUS
79     //!           MOS_STATUS_SUCCESS if success, else fail reason
80     //!
81     MOS_STATUS DumpSeqParams(
82         const CODEC_AV1_ENCODE_SEQUENCE_PARAMS *seqParams);
83 
84     //! \brief    Dump the picture parameters
85     //!
86     //! \param    [in] picParams
87     //!           Pointer to CODEC_AV1_ENCODE_PICTURE_PARAMS
88     //!
89     //! \return   MOS_STATUS
90     //!           MOS_STATUS_SUCCESS if success, else fail reason
91     //!
92     MOS_STATUS DumpPicParams(
93         const CODEC_AV1_ENCODE_PICTURE_PARAMS *picParams);
94 
95     //! \brief    Dump the tile group parameters
96     //!
97     //! \param    [in] tilegroupParams
98     //!           Pointer to CODEC_AV1_ENCODE_TILE_GROUP_PARAMS
99     //!
100     //! \return   MOS_STATUS
101     //!           MOS_STATUS_SUCCESS if success, else fail reason
102     //!
103     MOS_STATUS DumpTileGroupParams(
104         const CODEC_AV1_ENCODE_TILE_GROUP_PARAMS *tilegroupParams,
105         uint32_t                                  index);
106 #endif
107 
108     bool m_dualEncEnable = false;
109 
110 MEDIA_CLASS_DEFINE_END(encode__Av1Pipeline)
111 };
112 
113 }
114 #endif // !__ENCODE_AV1_PIPELINE_H__
115