| 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.h |
| 24 |
//! \brief Defines the implementation of hevc decode packet |
| 25 |
//! |
| 26 |
|
| 27 |
#ifndef __DECODE_HEVC_PACKET_H__ |
| 28 |
#define __DECODE_HEVC_PACKET_H__ |
| 29 |
|
| 30 |
#include "media_cmd_packet.h" |
| 31 |
#include "decode_hevc_pipeline.h" |
| 32 |
#include "decode_utils.h" |
| 33 |
#include "decode_hevc_basic_feature.h" |
| 34 |
#include "decode_status_report.h" |
| 35 |
#include "decode_hevc_picture_packet.h" |
| 36 |
#include "decode_hevc_slice_packet.h" |
| 37 |
|
| 38 |
namespace decode |
| 39 |
{ |
| 40 |
|
| 41 |
class HevcDecodeDebugPkt; |
| 42 |
|
| 43 |
class HevcDecodePkt : public CmdPacket, public MediaStatusReportObserver |
| 44 |
{ |
| 45 |
public: |
| 46 |
HevcDecodePkt(MediaPipeline *pipeline, MediaTask *task, CodechalHwInterfaceNext*hwInterface) |
| 47 |
: CmdPacket(task) |
| 48 |
{ |
| 49 |
if (pipeline != nullptr) |
| 50 |
{ |
| 51 |
m_statusReport = pipeline->GetStatusReportInstance(); |
| 52 |
m_featureManager = pipeline->GetFeatureManager(); |
| 53 |
m_hevcPipeline = dynamic_cast<HevcPipeline *>(pipeline); |
| 54 |
} |
| 55 |
if (hwInterface != nullptr) |
| 56 |
{ |
| 57 |
m_hwInterface = hwInterface; |
| 58 |
m_miItf = hwInterface->GetMiInterfaceNext(); |
| 59 |
m_osInterface = hwInterface->GetOsInterface(); |
| 60 |
} |
| 61 |
} |
| 62 |
virtual ~HevcDecodePkt() {} |
| 63 |
|
| 64 |
//! |
| 65 |
//! \brief Initialize the media packet, allocate required resources |
| 66 |
//! \return MOS_STATUS |
| 67 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 68 |
//! |
| 69 |
virtual MOS_STATUS Init() override; |
| 70 |
|
| 71 |
//! |
| 72 |
//! \brief Prepare interal parameters, should be invoked for each frame |
| 73 |
//! \return MOS_STATUS |
| 74 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 75 |
//! |
| 76 |
virtual MOS_STATUS Prepare() override; |
| 77 |
|
| 78 |
//! |
| 79 |
//! \brief One frame is completed |
| 80 |
//! \param [in] mfxStatus |
| 81 |
//! pointer to status buffer which for MFX |
| 82 |
//! \param [in] rcsStatus |
| 83 |
//! pointer to status buffer which for RCS |
| 84 |
//! \param [in, out] statusReport |
| 85 |
//! pointer of DecodeStatusReport |
| 86 |
//! \return MOS_STATUS |
| 87 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 88 |
//! |
| 89 |
virtual MOS_STATUS Completed(void *mfxStatus, void *rcsStatus, void *statusReport) override; |
| 90 |
|
| 91 |
virtual MOS_STATUS Destroy() override; |
| 92 |
|
| 93 |
protected: |
| 94 |
void SetPerfTag(CODECHAL_MODE mode, uint16_t picCodingType); |
| 95 |
|
| 96 |
MOS_STATUS SendPrologWithFrameTracking(MOS_COMMAND_BUFFER &cmdBuffer, bool frameTrackingRequested); |
| 97 |
|
| 98 |
MOS_STATUS MiFlush(MOS_COMMAND_BUFFER & cmdBuffer); |
| 99 |
MOS_STATUS AddForceWakeup(MOS_COMMAND_BUFFER &cmdBuffer); |
| 100 |
|
| 101 |
MOS_STATUS ReadVdboxId(MOS_COMMAND_BUFFER &cmdBuffer); |
| 102 |
|
| 103 |
MOS_STATUS ReadHcpStatus(MediaStatusReport* statusReport, MOS_COMMAND_BUFFER& cmdBuffer); |
| 104 |
virtual MOS_STATUS StartStatusReport(uint32_t srType, MOS_COMMAND_BUFFER* cmdBuffer) override; |
| 105 |
virtual MOS_STATUS EndStatusReport(uint32_t srType, MOS_COMMAND_BUFFER* cmdBuffer) override; |
| 106 |
MOS_STATUS EnsureAllCommandsExecuted(MOS_COMMAND_BUFFER &cmdBuffer); |
| 107 |
|
| 108 |
#if USE_CODECHAL_DEBUG_TOOL |
| 109 |
MOS_STATUS DumpSecondaryCommandBuffer(MOS_COMMAND_BUFFER &cmdBuffer); |
| 110 |
#endif |
| 111 |
|
| 112 |
MediaFeatureManager * m_featureManager = nullptr; |
| 113 |
HevcPipeline * m_hevcPipeline = nullptr; |
| 114 |
DecodeAllocator * m_allocator = nullptr; |
| 115 |
HevcBasicFeature * m_hevcBasicFeature = nullptr; |
| 116 |
CodechalHwInterfaceNext *m_hwInterface = nullptr; |
| 117 |
|
| 118 |
std::shared_ptr<mhw::vdbox::vdenc::Itf> m_vdencItf = nullptr; |
| 119 |
|
| 120 |
// Parameters passed from application |
| 121 |
const CODEC_HEVC_PIC_PARAMS *m_hevcPicParams = nullptr; //!< Pointer to picture parameter |
| 122 |
|
| 123 |
DecodePhase *m_phase = nullptr; //!< Phase for current packet |
| 124 |
|
| 125 |
uint32_t m_pictureStatesSize = 0; |
| 126 |
uint32_t m_picturePatchListSize = 0; |
| 127 |
uint32_t m_sliceStatesSize = 0; |
| 128 |
uint32_t m_slicePatchListSize = 0; |
| 129 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 130 |
HevcDecodeDebugPkt* m_debugPkt = nullptr; |
| 131 |
#endif |
| 132 |
MEDIA_CLASS_DEFINE_END(decode__HevcDecodePkt) |
| 133 |
}; |
| 134 |
|
| 135 |
} // namespace decode |
| 136 |
#endif |