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 //!
24 //! \file decode_vp9_buffer_update_m12.cpp
25 //! \brief Defines the interface for vp9 buffer update
26 //! \details Defines the interface to handle the vp9 buffer update for
27 //! segment id buffer and probability buffer.
28 //!
29 #include "decode_vp9_buffer_update_m12.h"
30 #include "decode_huc_packet_creator_g12.h"
31
32 namespace decode
33 {
DecodeVp9BufferUpdateM12(Vp9Pipeline * pipeline,MediaTask * task,uint8_t numVdbox,CodechalHwInterface * hwInterface)34 DecodeVp9BufferUpdateM12::DecodeVp9BufferUpdateM12(Vp9Pipeline *pipeline, MediaTask *task, uint8_t numVdbox, CodechalHwInterface *hwInterface)
35 : DecodeVp9BufferUpdate(pipeline, task, numVdbox)
36 {
37 m_hwInterface = hwInterface;
38 }
39
Init(CodechalSetting & settings)40 MOS_STATUS DecodeVp9BufferUpdateM12::Init(CodechalSetting &settings)
41 {
42 DECODE_CHK_NULL(m_pipeline);
43
44 CodechalHwInterface *hwInterface = m_hwInterface;
45 DECODE_CHK_NULL(hwInterface);
46 PMOS_INTERFACE osInterface = hwInterface->GetOsInterface();
47 DECODE_CHK_NULL(osInterface);
48 InitScalabilityPars(osInterface);
49
50 m_allocator = m_pipeline->GetDecodeAllocator();
51 DECODE_CHK_NULL(m_allocator);
52
53 MediaFeatureManager *featureManager = m_pipeline->GetFeatureManager();
54 DECODE_CHK_NULL(featureManager);
55 m_basicFeature = dynamic_cast<Vp9BasicFeature *>(featureManager->GetFeature(FeatureIDs::basicFeature));
56 DECODE_CHK_NULL(m_basicFeature);
57
58 HucPacketCreatorG12 *hucPktCreator = dynamic_cast<HucPacketCreatorG12 *>(m_pipeline);
59 DECODE_CHK_NULL(hucPktCreator);
60 m_sgementbufferResetPkt = hucPktCreator->CreateHucCopyPkt(m_pipeline, m_task, hwInterface);
61 DECODE_CHK_NULL(m_sgementbufferResetPkt);
62 MediaPacket *packet = dynamic_cast<MediaPacket *>(m_sgementbufferResetPkt);
63 DECODE_CHK_NULL(packet);
64 DECODE_CHK_STATUS(RegisterPacket(DecodePacketId(m_pipeline, hucCopyPacketId), *packet));
65 DECODE_CHK_STATUS(packet->Init());
66
67 HucPacketCreatorG12 *probUpdateCreator = dynamic_cast<HucPacketCreatorG12 *>(m_pipeline);
68 DECODE_CHK_NULL(probUpdateCreator);
69 auto probUpdatePkt = probUpdateCreator->CreateProbUpdatePkt(m_pipeline, m_task, hwInterface);
70 DECODE_CHK_NULL(probUpdatePkt);
71 DECODE_CHK_STATUS(RegisterPacket(DecodePacketId(this, HucVp9ProbUpdatePktId), *probUpdatePkt));
72 DECODE_CHK_STATUS(probUpdatePkt->Init());
73
74 return MOS_STATUS_SUCCESS;
75 }
76 } // namespace decode
77