1 /* 2 * Copyright (c) 2023, 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_hevc_vdenc_422_packet.h 24 //! \brief Defines the interface to adapt to HEVC VDENC pipeline 25 //! 26 27 #ifndef __CODECHAL_HEVC_VDENC_PACKET_422_H__ 28 #define __CODECHAL_HEVC_VDENC_PACKET_422_H__ 29 30 #include "encode_hevc_vdenc_packet.h" 31 32 namespace encode 33 { 34 #define MINFRAMESIZE_OFFSET 18 35 36 struct SubRSVD 37 { 38 uint32_t DW0; 39 uint32_t DW1; 40 }; 41 42 struct StreamoutRSVD1 43 { 44 SubRSVD DW[5]; 45 }; 46 47 struct StreamoutRSVD2 48 { 49 SubRSVD DW[8]; 50 }; 51 52 struct PakRSVD2 53 { 54 uint32_t DW0; 55 uint32_t DW1; 56 uint32_t DW2; 57 uint32_t DW3; 58 uint32_t DW4; 59 uint32_t DW5; 60 uint32_t DW6; 61 uint32_t DW7; 62 }; 63 64 struct PakRSVD1 65 { 66 uint32_t DW0; 67 uint32_t DW1; 68 uint32_t DW2; 69 uint32_t DW3; 70 uint32_t DW4; 71 uint32_t DW5; 72 uint32_t DW6; 73 uint32_t DW7; 74 }; 75 76 class HevcVdencPkt422 : public HevcVdencPkt 77 { 78 public: HevcVdencPkt422(MediaPipeline * pipeline,MediaTask * task,CodechalHwInterfaceNext * hwInterface)79 HevcVdencPkt422(MediaPipeline *pipeline, MediaTask *task, CodechalHwInterfaceNext *hwInterface) : 80 HevcVdencPkt(pipeline, task, hwInterface) {} ~HevcVdencPkt422()81 virtual ~HevcVdencPkt422() {} 82 83 MOS_STATUS AllocateResources() override; 84 85 MOS_STATUS Conversion(); 86 87 MOS_STATUS Prepare() override; 88 MOS_STATUS Completed(void *mfxStatus, void *rcsStatus, void *statusReport) override; 89 90 MOS_STATUS PatchPictureLevelCommands(const uint8_t &packetPhase, MOS_COMMAND_BUFFER &cmdBuffer) override; 91 MOS_STATUS PatchSliceLevelCommands(MOS_COMMAND_BUFFER &cmdBuffer, uint8_t packetPhase) override; 92 MOS_STATUS AddPicStateWithNoTile(MOS_COMMAND_BUFFER &cmdBuffer) override; 93 MOS_STATUS SendHwSliceEncodeCommand(const PCODEC_ENCODER_SLCDATA slcData, const uint32_t currSlcIdx, MOS_COMMAND_BUFFER &cmdBuffer) override; 94 MOS_STATUS AddForceWakeup(MOS_COMMAND_BUFFER &cmdBuffer) override; 95 MOS_STATUS AddHcpPipeModeSelect(MOS_COMMAND_BUFFER &cmdBuffer) override; 96 GetPacketName()97 virtual std::string GetPacketName() override 98 { 99 return "STANDALONE_PAK_PASS" + std::to_string((uint32_t)m_pipeline->GetCurrentPass()); 100 } 101 102 MHW_SETPAR_DECL_HDR(HCP_PIPE_MODE_SELECT); 103 104 MHW_SETPAR_DECL_HDR(HCP_SLICE_STATE); 105 106 MHW_SETPAR_DECL_HDR(HCP_IND_OBJ_BASE_ADDR_STATE); 107 108 MHW_SETPAR_DECL_HDR(HCP_PIC_STATE); 109 110 protected: 111 PMOS_RESOURCE m_res422MbCodeBuffer = nullptr; //!< Pointer to MOS_RESOURCE of MbCode buffer 112 uint32_t m_422mvOffset = 0; //!< MV data offset, in 64 byte 113 uint32_t m_422mbCodeSize = 0; //!< MB code buffer size 114 uint32_t m_422maxNumLCUs = 0; //!< MB code buffer size 115 116 117 MEDIA_CLASS_DEFINE_END(encode__HevcVdencPkt422) 118 }; 119 120 } // namespace encode 121 #endif 122