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_packet_back_end.cpp
24 //! \brief Defines the interface for vp9 back end decode packet
25 //!
26 #include "decode_vp9_packet_back_end.h"
27 #include "decode_status_report_defs.h"
28 #include "decode_predication_packet.h"
29 #include "decode_marker_packet.h"
30
31 namespace decode
32 {
~Vp9DecodeBackEndPkt()33 Vp9DecodeBackEndPkt::~Vp9DecodeBackEndPkt()
34 {
35 }
36
Init()37 MOS_STATUS Vp9DecodeBackEndPkt::Init()
38 {
39 DECODE_FUNC_CALL();
40 DECODE_CHK_STATUS(Vp9DecodePkt::Init());
41
42 DECODE_CHK_STATUS(m_statusReport->RegistObserver(this));
43
44 DecodeSubPacket *subPacket = m_vp9Pipeline->GetSubPacket(DecodePacketId(m_vp9Pipeline, vp9PictureSubPacketId));
45 m_picturePkt = dynamic_cast<Vp9DecodePicPkt *>(subPacket);
46 DECODE_CHK_NULL(m_picturePkt);
47
48 return MOS_STATUS_SUCCESS;
49 }
50
IsPrologRequired()51 bool Vp9DecodeBackEndPkt::IsPrologRequired()
52 {
53 DECODE_FUNC_CALL();
54
55 return true;
56 }
57
CalculateCommandSize(uint32_t & commandBufferSize,uint32_t & requestedPatchListSize)58 MOS_STATUS Vp9DecodeBackEndPkt::CalculateCommandSize(uint32_t &commandBufferSize, uint32_t &requestedPatchListSize)
59 {
60 DECODE_FUNC_CALL();
61
62 DECODE_CHK_STATUS(CalculateCommandBufferSize(commandBufferSize));
63 DECODE_CHK_STATUS(CalculatePatchListSize(requestedPatchListSize));
64 return MOS_STATUS_SUCCESS;
65 }
66
CalculateCommandBufferSize(uint32_t & commandBufferSize)67 MOS_STATUS Vp9DecodeBackEndPkt::CalculateCommandBufferSize(uint32_t &commandBufferSize)
68 {
69 DECODE_FUNC_CALL();
70
71 DECODE_CHK_STATUS(m_picturePkt->CalculateCommandSize(m_pictureStatesSize, m_picturePatchListSize));
72 commandBufferSize = m_pictureStatesSize + COMMAND_BUFFER_RESERVED_SPACE;
73 return MOS_STATUS_SUCCESS;
74 }
75
CalculatePatchListSize(uint32_t & requestedPatchListSize)76 MOS_STATUS Vp9DecodeBackEndPkt::CalculatePatchListSize(uint32_t &requestedPatchListSize)
77 {
78 DECODE_FUNC_CALL();
79
80 if (!m_osInterface->bUsesPatchList)
81 {
82 requestedPatchListSize = 0;
83 }
84 else
85 {
86 requestedPatchListSize = m_picturePatchListSize;
87 }
88
89 return MOS_STATUS_SUCCESS;
90 }
91
92 }
93