1 /*
2 * Copyright (c) 2022, 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_hevc_packet_back_end.h
24 //! \brief    Defines the implementation of hevc back end decode packet
25 //!
26 
27 #ifndef __DECODE_HEVC_PACKET_BACK_END_H__
28 #define __DECODE_HEVC_PACKET_BACK_END_H__
29 
30 #include "decode_hevc_packet.h"
31 
32 namespace decode
33 {
34 
35 class HevcDecodeBackEndPkt : public HevcDecodePkt
36 {
37 public:
HevcDecodeBackEndPkt(MediaPipeline * pipeline,MediaTask * task,CodechalHwInterfaceNext * hwInterface)38     HevcDecodeBackEndPkt(MediaPipeline *pipeline, MediaTask *task, CodechalHwInterfaceNext*hwInterface)
39         : HevcDecodePkt(pipeline, task, hwInterface)
40     {
41     }
42     virtual ~HevcDecodeBackEndPkt();
43 
44     //!
45     //! \brief  Initialize the media packet, allocate required resources
46     //! \return MOS_STATUS
47     //!         MOS_STATUS_SUCCESS if success, else fail reason
48     //!
49     virtual MOS_STATUS Init() override;
50 
51     //!
52     //! \brief  Destroy the media packet and release the resources
53     //! \return MOS_STATUS
54     //!         MOS_STATUS_SUCCESS if success, else fail reason
55     //!
56     virtual MOS_STATUS Destroy() override;
57 
58     //!
59     //! \brief  Calculate Command Size
60     //!
61     //! \param  [in, out] commandBufferSize
62     //!         requested size
63     //! \param  [in, out] requestedPatchListSize
64     //!         requested size
65     //! \return MOS_STATUS
66     //!         status
67     //!
68     MOS_STATUS CalculateCommandSize(uint32_t &commandBufferSize, uint32_t &requestedPatchListSize) override;
69 
70     //!
71     //! \brief  Get Packet Name
72     //! \return std::string
73     //!
GetPacketName()74     virtual std::string GetPacketName() override
75     {
76         return "HEVC_DECODE_BACK_END_PASS" + std::to_string(static_cast<uint32_t>(m_hevcPipeline->GetCurrentPass()));
77     }
78 
79 protected:
80     //!
81     //! \brief  Calculate Command Buffer Size
82     //! \param  [out] commandBufferSize
83     //!         requested size
84     //! \return uint32_t
85     //!         Command buffer size calculated
86     //!
87     virtual MOS_STATUS CalculateCommandBufferSize(uint32_t &commandBufferSize);
88 
89     //!
90     //! \brief  Calculate Patch List Size
91     //! \param  [out] requestedPatchListSize
92     //!         requested size
93     //! \return uint32_t
94     //!         Patchlist size calculated
95     //!
96     virtual MOS_STATUS CalculatePatchListSize(uint32_t &requestedPatchListSize);
97 
98     //!
99     //! \brief  Check if prolog required
100     //!
101     //! \return bool
102     //!         True if prolog required
103     //!
104     bool IsPrologRequired();
105 
106     HevcDecodePicPkt *       m_picturePkt = nullptr;
107 
108 MEDIA_CLASS_DEFINE_END(decode__HevcDecodeBackEndPkt)
109 };
110 
111 }  // namespace decode
112 #endif
113