Debian Codegraph @

media_softlet/agnostic/common/codec/hal/dec/vp8/packet/decode_vp8_packet.h

raw
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_vp8_packet.h
24 //! \brief Defines the implementation of vp8 decode packet
25 //!
26
27 #ifndef __DECODE_VP8_PACKET_H__
28 #define __DECODE_VP8_PACKET_H__
29
30 #include "media_cmd_packet.h"
31 #include "decode_vp8_pipeline.h"
32 #include "decode_utils.h"
33 #include "decode_vp8_basic_feature.h"
34 #include "decode_status_report.h"
35 #include "decode_vp8_picture_packet.h"
36 #include "decode_vp8_slice_packet.h"
37
38 namespace decode
39 {
40
41 class Vp8DecodePkt : public CmdPacket, public MediaStatusReportObserver
42 {
43 public:
44 Vp8DecodePkt(MediaPipeline *pipeline, MediaTask *task, CodechalHwInterfaceNext *hwInterface);
45
46 virtual ~Vp8DecodePkt(){};
47
48 //!
49 //! \brief Initialize the media packet, allocate required resources
50 //! \return MOS_STATUS
51 //! MOS_STATUS_SUCCESS if success, else fail reason
52 //!
53 virtual MOS_STATUS Init() override;
54
55 //!
56 //! \brief Prepare interal parameters, should be invoked for each frame
57 //! \return MOS_STATUS
58 //! MOS_STATUS_SUCCESS if success, else fail reason
59 //!
60 virtual MOS_STATUS Prepare() override;
61
62 //!
63 //! \brief Destroy the media packet and release the resources
64 //! \return MOS_STATUS
65 //! MOS_STATUS_SUCCESS if success, else fail reason
66 //!
67 virtual MOS_STATUS Destroy() override;
68
69 //!
70 //! \brief One frame is completed
71 //! \param [in] mfxStatus
72 //! pointer to status buffer which for mfx
73 //! \param [in] rcsStatus
74 //! pointer to status buffer which for RCS
75 //! \param [in, out] statusReport
76 //! pointer of DecoderStatusReport
77 //! \return MOS_STATUS
78 //! MOS_STATUS_SUCCESS if success, else fail reason
79 //!
80 virtual MOS_STATUS Completed(void *mfxStatus, void *rcsStatus, void *statusReport) override;
81
82 //!
83 //! \brief Calculate Command Size
84 //!
85 //! \param [in, out] commandBufferSize
86 //! requested size
87 //! \param [in, out] requestedPatchListSize
88 //! requested size
89 //! \return MOS_STATUS
90 //! status
91 //!
92 MOS_STATUS CalculateCommandSize(uint32_t &commandBufferSize, uint32_t &requestedPatchListSize) override;
93
94 //!
95 //! \brief Get Packet Name
96 //! \return std::string
97 //!
98 virtual std::string GetPacketName() override
99 {
100 return "VP8_DECODE";
101 }
102
103 protected:
104 //!
105 //! \brief Calculate Command Buffer Size
106 //!
107 //! \return uint32_t
108 //! Command buffer size calculated
109 //!
110 virtual uint32_t CalculateCommandBufferSize();
111
112 //!
113 //! \brief Calculate Patch List Size
114 //!
115 //! \return uint32_t
116 //! Patchlist size calculated
117 //!
118 virtual uint32_t CalculatePatchListSize();
119
120 void SetPerfTag(CODECHAL_MODE mode, uint16_t picCodingType);
121
122 MOS_STATUS SendPrologWithFrameTracking(MOS_COMMAND_BUFFER &cmdBuffer, bool frameTrackingRequested);
123 MOS_STATUS ReadMfxStatus(MediaStatusReport* statusReport, MOS_COMMAND_BUFFER& cmdBuffer);
124
125 MOS_STATUS MiFlush(MOS_COMMAND_BUFFER &cmdBuffer);
126 MOS_STATUS AddForceWakeup(MOS_COMMAND_BUFFER &cmdBuffer);
127 bool IsPrologRequired();
128
129 virtual MOS_STATUS StartStatusReport(uint32_t srType, MOS_COMMAND_BUFFER* cmdBuffer) override;
130 virtual MOS_STATUS EndStatusReport(uint32_t srType, MOS_COMMAND_BUFFER* cmdBuffer) override;
131
132 MediaFeatureManager *m_featureManager = nullptr;
133 Vp8Pipeline *m_vp8Pipeline = nullptr;
134 DecodeAllocator *m_allocator = nullptr;
135 Vp8BasicFeature *m_vp8BasicFeature = nullptr;
136 CodechalHwInterfaceNext *m_hwInterface = nullptr;
137 Vp8DecodePicPkt *m_picturePkt = nullptr;
138 Vp8DecodeSlcPkt *m_slicePkt = nullptr;
139 // Parameters passed from application
140 const CODEC_VP8_PIC_PARAMS *m_vp8PicParams = nullptr; //!< Pointer to picture parameter
141
142 DecodePhase *m_phase = nullptr; //!< Phase for current packet
143 DecodeMemComp *m_mmcState = nullptr;
144
145
146 uint32_t m_pictureStatesSize = 0;
147 uint32_t m_picturePatchListSize = 0;
148 uint32_t m_sliceStatesSize = 0;
149 uint32_t m_slicePatchListSize = 0;
150
151 MEDIA_CLASS_DEFINE_END(decode__Vp8DecodePkt)
152 };
153
154 } // namespace decode
155 #endif // !__DECODE_VP8_PACKET_H__
156