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_huc_la_init_packet.h
24 //! \brief    Defines the interface of Huc Lookahead init packet
25 //!
26 
27 #include "media_cmd_packet.h"
28 #include "encode_huc.h"
29 #include "encode_hevc_vdenc_pipeline.h"
30 
31 #ifndef __CODECHAL_HUC_LA_INIT_PACKET_H__
32 #define __CODECHAL_HUC_LA_INIT_PACKET_H__
33 
34 namespace encode
35 {
36 class HucLaInitPkt : public EncodeHucPkt
37 {
38 public:
HucLaInitPkt(MediaPipeline * pipeline,MediaTask * task,CodechalHwInterfaceNext * hwInterface)39     HucLaInitPkt(MediaPipeline *pipeline, MediaTask *task, CodechalHwInterfaceNext *hwInterface) : EncodeHucPkt(pipeline, task, hwInterface)
40     {
41     }
42 
~HucLaInitPkt()43     virtual ~HucLaInitPkt() {}
44 
45     virtual MOS_STATUS Init() override;
46 
47     MOS_STATUS         Submit(MOS_COMMAND_BUFFER *commandBuffer, uint8_t packetPhase = otherPacket) override;
48 
49     //!
50     //! \brief  Calculate Command Size
51     //!
52     //! \param  [in, out] commandBufferSize
53     //!         requested size
54     //! \param  [in, out] requestedPatchListSize
55     //!         requested size
56     //! \return MOS_STATUS
57     //!         status
58     //!
59     MOS_STATUS CalculateCommandSize(
60         uint32_t &commandBufferSize,
61         uint32_t &requestedPatchListSize) override;
62 
63     //!
64     //! \brief  Get Packet Name
65     //! \return std::string
66     //!
GetPacketName()67     virtual std::string GetPacketName() override
68     {
69         return "LAINIT";
70     }
71 
72 protected:
73     virtual MOS_STATUS AllocateResources() override;
74     MHW_SETPAR_DECL_HDR(HUC_IMEM_STATE);
75     MHW_SETPAR_DECL_HDR(HUC_DMEM_STATE);
76     MHW_SETPAR_DECL_HDR(HUC_VIRTUAL_ADDR_STATE);
77 
78     HevcBasicFeature *m_basicFeature = nullptr;  //!< Hevc Basic Feature used in each frame
79 
80 MEDIA_CLASS_DEFINE_END(encode__HucLaInitPkt)
81 };
82 } //encode
83 
84 #endif
85