| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
#ifndef __ENCODE_PIPELINE_H__ |
| 29 |
#define __ENCODE_PIPELINE_H__ |
| 30 |
|
| 31 |
#include "media_pipeline.h" |
| 32 |
|
| 33 |
#include "codec_hw_next.h" |
| 34 |
#include "codec_def_encode.h" |
| 35 |
#include "media_scalability.h" |
| 36 |
#include "encode_allocator.h" |
| 37 |
#include "encode_basic_feature.h" |
| 38 |
#include "encode_tracked_buffer.h" |
| 39 |
#include "encode_recycle_resource.h" |
| 40 |
#include "encode_mem_compression.h" |
| 41 |
#include "encodecp.h" |
| 42 |
#include "encode_packet_utilities.h" |
| 43 |
#include "encode_scalability_defs.h" |
| 44 |
|
| 45 |
#define CONSTRUCTPACKETID(_componentId, _subComponentId, _packetId) \ |
| 46 |
(_componentId << 24 | _subComponentId << 16 | _packetId) |
| 47 |
|
| 48 |
namespace encode |
| 49 |
{ |
| 50 |
class EncodePipeline : public MediaPipeline |
| 51 |
{ |
| 52 |
public: |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
EncodePipeline( |
| 61 |
CodechalHwInterfaceNext *hwInterface, |
| 62 |
CodechalDebugInterface *debugInterface); |
| 63 |
|
| 64 |
virtual ~EncodePipeline() {} |
| 65 |
|
| 66 |
virtual MOS_STATUS Prepare(void *params) override; |
| 67 |
|
| 68 |
MOS_STATUS ContextSwitchBack(); |
| 69 |
|
| 70 |
EncodeAllocator * GetEncodeAllocator() { return m_allocator; }; |
| 71 |
CodechalHwInterfaceNext *GetHWInterface() { return m_hwInterface; }; |
| 72 |
PacketUtilities * GetPacketUtilities() { return m_packetUtilities; }; |
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
bool IsSingleTaskPhaseSupported() { return m_singleTaskPhaseSupported; }; |
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
bool IsSingleTaskPhaseSupportedInPak() { return m_singleTaskPhaseSupportedInPak; }; |
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
CodechalDebugInterface *GetDebugInterface() const { return m_debugInterface; } |
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
CodechalDebugInterface *GetStatusReportDebugInterface() const { return m_statusReportDebugInterface; } |
| 101 |
EncodeCp * GetEncodeCp() { return m_encodecp; } |
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
void SetFrameTrackingForMultiTaskPhase(); |
| 108 |
|
| 109 |
enum ComponentPacketIds |
| 110 |
{ |
| 111 |
PACKET_COMPONENT_COMMON = 0, |
| 112 |
PACKET_COMPONENT_ENCODE, |
| 113 |
PACKET_COMPONENT_DECODE, |
| 114 |
PACKET_COMPONENT_VP, |
| 115 |
}; |
| 116 |
|
| 117 |
enum SubComponentPacketIds |
| 118 |
{ |
| 119 |
PACKET_SUBCOMPONENT_COMMON = 0, |
| 120 |
PACKET_SUBCOMPONENT_HEVC, |
| 121 |
PACKET_SUBCOMPONENT_VP9, |
| 122 |
PACKET_SUBCOMPONENT_AVC, |
| 123 |
PACKET_SUBCOMPONENT_AV1, |
| 124 |
PACKET_SUBCOMPONENT_JPEG |
| 125 |
}; |
| 126 |
|
| 127 |
enum CommonPacketIds |
| 128 |
{ |
| 129 |
basicPacket = CONSTRUCTPACKETID(PACKET_COMPONENT_ENCODE, PACKET_SUBCOMPONENT_COMMON, 0), |
| 130 |
encodePreEncPacket, |
| 131 |
#if _MEDIA_RESERVED |
| 132 |
#define ENCODE_PACKET_IDS_EXT |
| 133 |
#include "encode_pipeline_ext.h" |
| 134 |
#undef ENCODE_PACKET_IDS_EXT |
| 135 |
#endif |
| 136 |
}; |
| 137 |
|
| 138 |
protected: |
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
virtual MOS_STATUS Initialize(void *settings); |
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
virtual MOS_STATUS Uninitialize(); |
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
virtual MOS_STATUS UserFeatureReport() override; |
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
virtual MOS_STATUS CreateBufferTracker() = 0; |
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
virtual MOS_STATUS CreateStatusReport() = 0; |
| 176 |
|
| 177 |
virtual MOS_STATUS GetSystemVdboxNumber(); |
| 178 |
|
| 179 |
MOS_STATUS WaitForBatchBufferComplete(); |
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
MOS_STATUS ExecuteActivePackets() override; |
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
MOS_STATUS CalculateCmdBufferSizeFromActivePackets( |
| 198 |
uint32_t &commandBufferSize, |
| 199 |
uint32_t &requestedPatchListSize); |
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
virtual MOS_STATUS InitUserSetting(MediaUserSettingSharedPtr userSettingPtr) override; |
| 206 |
|
| 207 |
public: |
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
virtual uint8_t GetCurrentPipe() |
| 214 |
{ |
| 215 |
return m_scalability->GetCurrentPipe(); |
| 216 |
} |
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
|
| 223 |
virtual uint16_t GetCurrentPass() |
| 224 |
{ |
| 225 |
return m_scalability->GetCurrentPass(); |
| 226 |
} |
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
virtual bool IsFirstPipe() |
| 243 |
{ |
| 244 |
return GetCurrentPipe() == 0 ? true : false; |
| 245 |
} |
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
virtual bool IsLastPipe() |
| 253 |
{ |
| 254 |
return GetCurrentPipe() == GetPipeNum() - 1 ? true : false; |
| 255 |
} |
| 256 |
|
| 257 |
|
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
|
| 262 |
virtual bool IsFirstPass() |
| 263 |
{ |
| 264 |
return GetCurrentPass() == 0 ? true : false; |
| 265 |
} |
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
virtual bool IsLastPass() |
| 273 |
{ |
| 274 |
return GetCurrentPass() == GetPassNum() - 1 ? true : false; |
| 275 |
} |
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
virtual uint8_t GetPipeNum() |
| 283 |
{ |
| 284 |
return m_scalability->GetPipeNumber(); |
| 285 |
} |
| 286 |
|
| 287 |
|
| 288 |
|
| 289 |
|
| 290 |
|
| 291 |
|
| 292 |
virtual uint8_t GetDDITU() |
| 293 |
{ |
| 294 |
return m_featureManager->GetDDITargetUsage(); |
| 295 |
} |
| 296 |
|
| 297 |
|
| 298 |
|
| 299 |
|
| 300 |
|
| 301 |
|
| 302 |
virtual uint16_t GetPassNum() |
| 303 |
{ |
| 304 |
return m_scalability->GetPassNumber(); |
| 305 |
} |
| 306 |
|
| 307 |
virtual uint8_t GetCurrentRow() |
| 308 |
{ |
| 309 |
return m_scalability->GetCurrentRow(); |
| 310 |
} |
| 311 |
|
| 312 |
virtual uint8_t GetCurrentSubPass() |
| 313 |
{ |
| 314 |
return m_scalability->GetCurrentSubPass(); |
| 315 |
} |
| 316 |
|
| 317 |
EncodeMemComp *GetMmcState() { return m_mmcState; } |
| 318 |
|
| 319 |
MOS_STATUS ExecuteResolveMetaData(PMOS_RESOURCE pInput, PMOS_RESOURCE pOutput); |
| 320 |
|
| 321 |
MOS_STATUS ReportErrorFlag(PMOS_RESOURCE pMetadataBuffer, |
| 322 |
uint32_t size, uint32_t offset, uint32_t flag); |
| 323 |
|
| 324 |
#define CODECHAL_ENCODE_RECYCLED_BUFFER_NUM 6 |
| 325 |
#define VDENC_BRC_NUM_OF_PASSES 2 |
| 326 |
|
| 327 |
uint8_t m_currRecycledBufIdx = 0; |
| 328 |
protected: |
| 329 |
uint32_t m_standard = 0; |
| 330 |
uint32_t m_mode = 0; |
| 331 |
CODECHAL_FUNCTION m_codecFunction = CODECHAL_FUNCTION_INVALID; |
| 332 |
|
| 333 |
CodechalHwInterfaceNext *m_hwInterface = nullptr; |
| 334 |
MOS_INTERFACE * m_osInterface = nullptr; |
| 335 |
EncodeAllocator * m_allocator = nullptr; |
| 336 |
TrackedBuffer * m_trackedBuf = nullptr; |
| 337 |
RecycleResource * m_recycleBuf = nullptr; |
| 338 |
EncodeMemComp * m_mmcState = nullptr; |
| 339 |
EncodeCp * m_encodecp = nullptr; |
| 340 |
PacketUtilities * m_packetUtilities = nullptr; |
| 341 |
|
| 342 |
CodechalDebugInterface *m_statusReportDebugInterface = nullptr; |
| 343 |
|
| 344 |
uint8_t m_numVdbox = 0; |
| 345 |
|
| 346 |
bool m_singleTaskPhaseSupported = true; |
| 347 |
bool m_singleTaskPhaseSupportedInPak = false; |
| 348 |
|
| 349 |
uint32_t m_recycledBufStatusNum[CODECHAL_ENCODE_RECYCLED_BUFFER_NUM] = {0}; |
| 350 |
|
| 351 |
std::shared_ptr<EncodeScalabilityPars> m_scalPars = nullptr; |
| 352 |
|
| 353 |
MEDIA_CLASS_DEFINE_END(encode__EncodePipeline) |
| 354 |
}; |
| 355 |
|
| 356 |
} |
| 357 |
|
| 358 |
#endif |