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_vp9_slice_packet.cpp 24 //! \brief Defines the interface for vp9 decode slice packet 25 //! 26 #include "decode_vp9_slice_packet.h" 27 28 namespace decode 29 { Init()30 MOS_STATUS Vp9DecodeSlcPkt::Init() 31 { 32 DECODE_FUNC_CALL(); 33 34 DECODE_CHK_NULL(m_featureManager); 35 DECODE_CHK_NULL(m_hwInterface); 36 DECODE_CHK_NULL(m_osInterface); 37 DECODE_CHK_NULL(m_miItf); 38 DECODE_CHK_NULL(m_vp9Pipeline); 39 40 m_vp9BasicFeature = dynamic_cast<Vp9BasicFeature*>(m_featureManager->GetFeature(FeatureIDs::basicFeature)); 41 DECODE_CHK_NULL(m_vp9BasicFeature); 42 43 m_allocator = m_pipeline ->GetDecodeAllocator(); 44 DECODE_CHK_NULL(m_allocator); 45 46 m_decodecp = m_pipeline->GetDecodeCp(); 47 48 DECODE_CHK_STATUS(CalculateSliceStateCommandSize()); 49 50 return MOS_STATUS_SUCCESS; 51 } 52 Prepare()53 MOS_STATUS Vp9DecodeSlcPkt::Prepare() 54 { 55 DECODE_FUNC_CALL(); 56 57 DECODE_CHK_NULL(m_vp9BasicFeature->m_vp9PicParams); 58 59 m_vp9PicParams = m_vp9BasicFeature->m_vp9PicParams; 60 m_vp9SliceParams = m_vp9BasicFeature->m_vp9SliceParams; 61 62 return MOS_STATUS_SUCCESS; 63 } 64 MHW_SETPAR_DECL_SRC(HCP_BSD_OBJECT,Vp9DecodeSlcPkt)65 MHW_SETPAR_DECL_SRC(HCP_BSD_OBJECT, Vp9DecodeSlcPkt) 66 { 67 DECODE_FUNC_CALL(); 68 69 params = {}; 70 71 params.bsdDataLength = m_vp9PicParams->BSBytesInBuffer - m_vp9PicParams->UncompressedHeaderLengthInBytes; 72 params.bsdDataStartOffset = m_vp9PicParams->UncompressedHeaderLengthInBytes; 73 74 return MOS_STATUS_SUCCESS; 75 } 76 CalculateCommandSize(uint32_t & commandBufferSize,uint32_t & requestedPatchListSize)77 MOS_STATUS Vp9DecodeSlcPkt::CalculateCommandSize(uint32_t &commandBufferSize, 78 uint32_t &requestedPatchListSize) 79 { 80 DECODE_FUNC_CALL(); 81 82 commandBufferSize = m_sliceStatesSize; 83 requestedPatchListSize = m_slicePatchListSize; 84 85 return MOS_STATUS_SUCCESS; 86 } 87 CalculateSliceStateCommandSize()88 MOS_STATUS Vp9DecodeSlcPkt::CalculateSliceStateCommandSize() 89 { 90 DECODE_FUNC_CALL(); 91 92 // Slice Level Commands 93 DECODE_CHK_STATUS(m_hwInterface->GetHcpPrimitiveCommandSize(m_vp9BasicFeature->m_mode, 94 &m_sliceStatesSize, 95 &m_slicePatchListSize, 96 false)); 97 98 return MOS_STATUS_SUCCESS; 99 } 100 AddHcpCpState(MOS_COMMAND_BUFFER & cmdBuffer,uint32_t sliceIdx,uint32_t subTileIdx)101 MOS_STATUS Vp9DecodeSlcPkt::AddHcpCpState(MOS_COMMAND_BUFFER &cmdBuffer, uint32_t sliceIdx, uint32_t subTileIdx) 102 { 103 DECODE_FUNC_CALL(); 104 105 if (m_decodecp) 106 { 107 DECODE_CHK_STATUS(m_decodecp->AddHcpState(&cmdBuffer, 108 &(m_vp9BasicFeature->m_resDataBuffer.OsResource), 109 m_vp9PicParams->BSBytesInBuffer - m_vp9PicParams->UncompressedHeaderLengthInBytes, 110 m_vp9PicParams->UncompressedHeaderLengthInBytes, 111 sliceIdx)); 112 } 113 return MOS_STATUS_SUCCESS; 114 } 115 116 } 117