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