1 /*
2 * Copyright (c) 2021, 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_mpeg2_pipeline_adapter_m12.cpp
24 //! \brief Defines the interface to adapt to mpeg2 decode pipeline
25 //!
26
27 #include "decode_mpeg2_pipeline_adapter_m12.h"
28 #include "decode_utils.h"
29
DecodeMpeg2PipelineAdapterM12(CodechalHwInterface * hwInterface,CodechalDebugInterface * debugInterface)30 DecodeMpeg2PipelineAdapterM12::DecodeMpeg2PipelineAdapterM12(
31 CodechalHwInterface * hwInterface,
32 CodechalDebugInterface *debugInterface)
33 : DecodePipelineAdapter(hwInterface, debugInterface)
34 {
35 DECODE_ASSERT(m_osInterface != nullptr);
36 Mos_CheckVirtualEngineSupported(m_osInterface, true, true);
37 Mos_SetVirtualEngineSupported(m_osInterface, true);
38 }
39
BeginFrame()40 MOS_STATUS DecodeMpeg2PipelineAdapterM12::BeginFrame()
41 {
42 DECODE_FUNC_CALL();
43
44 decode::DecodePipelineParams decodeParams;
45 decodeParams.m_pipeMode = decode::decodePipeModeBegin;
46 DECODE_CHK_STATUS(m_decoder->Prepare(&decodeParams));
47 return m_decoder->Execute();
48 }
49
EndFrame()50 MOS_STATUS DecodeMpeg2PipelineAdapterM12::EndFrame()
51 {
52 DECODE_FUNC_CALL();
53
54 decode::DecodePipelineParams decodeParams;
55 decodeParams.m_pipeMode = decode::decodePipeModeEnd;
56 DECODE_CHK_STATUS(m_decoder->Prepare(&decodeParams));
57 return m_decoder->Execute();
58 }
59
Allocate(CodechalSetting * codecHalSettings)60 MOS_STATUS DecodeMpeg2PipelineAdapterM12::Allocate(CodechalSetting *codecHalSettings)
61 {
62 DECODE_FUNC_CALL();
63
64 m_decoder = std::make_shared<decode::Mpeg2PipelineM12>(m_hwInterface, m_debugInterface);
65 DECODE_CHK_NULL(m_decoder);
66
67 return m_decoder->Init(codecHalSettings);
68 }
69
Execute(void * params)70 MOS_STATUS DecodeMpeg2PipelineAdapterM12::Execute(void *params)
71 {
72 DECODE_FUNC_CALL();
73
74 decode::DecodePipelineParams decodeParams;
75 decodeParams.m_params = (CodechalDecodeParams*)params;
76 decodeParams.m_pipeMode = decode::decodePipeModeProcess;
77 DECODE_CHK_STATUS(m_decoder->Prepare(&decodeParams));
78 return m_decoder->Execute();
79 }
80
GetStatusReport(void * status,uint16_t numStatus)81 MOS_STATUS DecodeMpeg2PipelineAdapterM12::GetStatusReport(
82 void *status,
83 uint16_t numStatus)
84 {
85 DECODE_FUNC_CALL();
86
87 return m_decoder->GetStatusReport(status, numStatus);
88 }
89
IsIncompletePicture()90 bool DecodeMpeg2PipelineAdapterM12::IsIncompletePicture()
91 {
92 return (!m_decoder->IsCompleteBitstream());
93 }
94
GetDummyReference()95 MOS_SURFACE *DecodeMpeg2PipelineAdapterM12::GetDummyReference()
96 {
97 DECODE_FUNC_CALL();
98 return m_decoder->GetDummyReference();
99 }
100
GetDummyReferenceStatus()101 CODECHAL_DUMMY_REFERENCE_STATUS DecodeMpeg2PipelineAdapterM12::GetDummyReferenceStatus()
102 {
103 DECODE_FUNC_CALL();
104 return m_decoder->GetDummyReferenceStatus();
105 }
106
SetDummyReferenceStatus(CODECHAL_DUMMY_REFERENCE_STATUS status)107 void DecodeMpeg2PipelineAdapterM12::SetDummyReferenceStatus(CODECHAL_DUMMY_REFERENCE_STATUS status)
108 {
109 DECODE_FUNC_CALL();
110 m_decoder->SetDummyReferenceStatus(status);
111 }
112
GetCompletedReport()113 uint32_t DecodeMpeg2PipelineAdapterM12::GetCompletedReport()
114 {
115 return m_decoder->GetCompletedReport();
116 }
117
Destroy()118 void DecodeMpeg2PipelineAdapterM12::Destroy()
119 {
120 DECODE_FUNC_CALL();
121
122 m_decoder->Destroy();
123 }
124
GetDecodeContext()125 MOS_GPU_CONTEXT DecodeMpeg2PipelineAdapterM12::GetDecodeContext()
126 {
127 DECODE_FUNC_CALL();
128
129 return m_decoder->GetDecodeContext();
130 }
131
132 #ifdef _DECODE_PROCESSING_SUPPORTED
IsDownSamplingSupported()133 bool DecodeMpeg2PipelineAdapterM12::IsDownSamplingSupported()
134 {
135 return false;
136 }
137 #endif
138
139