• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     decode_vp9_tile_packet_m12.h
24 //! \brief    Defines the implementation of vp9 decode tile coding packet for M12
25 //!
26 
27 #ifndef __DECODE_VP9_TILE_PACKET_M12_H__
28 #define __DECODE_VP9_TILE_PACKET_M12_H__
29 
30 #include "media_cmd_packet.h"
31 #include "decode_vp9_pipeline.h"
32 #include "decode_utils.h"
33 #include "decode_vp9_basic_feature.h"
34 #include "mhw_vdbox_hcp_g12_X.h"
35 #include "mhw_mi_g12_X.h"
36 
37 namespace decode
38 {
39 
40 class Vp9DecodeTilePktM12 : public DecodeSubPacket
41 {
42 public:
Vp9DecodeTilePktM12(Vp9Pipeline * pipeline,CodechalHwInterface * hwInterface)43     Vp9DecodeTilePktM12(Vp9Pipeline *pipeline, CodechalHwInterface *hwInterface)
44         : DecodeSubPacket(pipeline, *hwInterface), m_vp9Pipeline(pipeline)
45     {
46         m_hwInterface = hwInterface;
47         if (m_hwInterface != nullptr)
48         {
49             m_miInterface  = m_hwInterface->GetMiInterface();
50             m_osInterface  = m_hwInterface->GetOsInterface();
51             m_hcpInterface = dynamic_cast<MhwVdboxHcpInterfaceG12 *>(hwInterface->GetHcpInterface());
52         }
53     }
54     virtual ~Vp9DecodeTilePktM12();
55 
56     //!
57     //! \brief  Initialize the media packet, allocate required resources
58     //! \return MOS_STATUS
59     //!         MOS_STATUS_SUCCESS if success, else fail reason
60     //!
61     virtual MOS_STATUS Init() override;
62 
63     //!
64     //! \brief  Prepare interal parameters, should be invoked for each frame
65     //! \return MOS_STATUS
66     //!         MOS_STATUS_SUCCESS if success, else fail reason
67     //!
68     virtual MOS_STATUS Prepare() override;
69 
70     //!
71     //! \brief  Execute vp9 tile packet for virtual tile
72     //! \param  [in] cmdBuffer
73     //!         Commnd buffer to program
74     //! \param  [in] virtualTileIdx
75     //!         The index of virtual tile
76     //! \return MOS_STATUS
77     //!         MOS_STATUS_SUCCESS if success, else fail reason
78     //!
79     virtual MOS_STATUS Execute(MOS_COMMAND_BUFFER& cmdBuffer, uint8_t virtualTileIdx);
80 
81     //!
82     //! \brief  Calculate Command Size
83     //!
84     //! \param  [in, out] commandBufferSize
85     //!         requested size
86     //! \param  [in, out] requestedPatchListSize
87     //!         requested size
88     //! \return MOS_STATUS
89     //!         status
90     //!
91     MOS_STATUS CalculateCommandSize(
92         uint32_t &commandBufferSize,
93         uint32_t &requestedPatchListSize) override;
94 
95 protected:
96     virtual MOS_STATUS SetHcpTileCodingParams(MHW_VDBOX_HCP_TILE_CODING_PARAMS_G12 &tileCodingParams,
97                                               uint8_t virtualTileIdx);
98 
99     virtual MOS_STATUS AddHcpTileCoding(MOS_COMMAND_BUFFER &cmdBuffer, uint8_t virtualTileIdx);
100 
101     static constexpr uint32_t m_virtualTileMaxNum = 8; //!< The max num of virtual tile
102 
103     Vp9Pipeline             *m_vp9Pipeline     = nullptr; //!< Pointer to vp9 pipeline
104     MhwVdboxHcpInterfaceG12 *m_hcpInterface     = nullptr; //!< Pointer to hcp hw interface
105     Vp9BasicFeature         *m_vp9BasicFeature = nullptr; //!< Pointer to vp9 basic feature
106     PCODEC_VP9_PIC_PARAMS    m_vp9PicParams    = nullptr; //!< Pointer to picture parameter
107     CodechalHwInterface      *m_hwInterface    = nullptr;
108     MhwMiInterface          *m_miInterface      = nullptr;
109 
110 #if (_DEBUG || _RELEASE_INTERNAL)
111     uint32_t                 m_dbgOvrdWidthInMinCb = 0; //!< debug override for picture width in min ctb
112 #endif
113 MEDIA_CLASS_DEFINE_END(decode__Vp9DecodeTilePktM12)
114 };
115 
116 }  // namespace decode
117 #endif
118