1// Copyright (c) 2018-2021 Intel Corporation
2//
3// Permission is hereby granted, free of charge, to any person obtaining a copy
4// of this software and associated documentation files (the "Software"), to deal
5// in the Software without restriction, including without limitation the rights
6// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7// copies of the Software, and to permit persons to whom the Software is
8// furnished to do so, subject to the following conditions:
9//
10// The above copyright notice and this permission notice shall be included in all
11// copies or substantial portions of the Software.
12//
13// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19// SOFTWARE.
20
21#include "mfx_common.h"
22#include "mfxcamera.h"
23
24#if defined (MFX_ENABLE_VPP)
25
26#ifndef __MFX_VPP_DDI_H
27#define __MFX_VPP_DDI_H
28
29#include <vector>
30#include <memory>
31#include "mfxdefs.h"
32#include "libmfx_core.h"
33#include "mfx_platform_headers.h"
34
35 typedef unsigned int UINT;
36
37 typedef struct tagVPreP_StatusParams_V1_0
38 {
39 UINT StatusReportID;
40 UINT Reserved1;
41
42 } VPreP_StatusParams_V1_0;
43
44 typedef struct tagFASTCOMP_QUERY_STATUS
45 {
46 UINT QueryStatusID;
47 UINT Status;
48
49 UINT Reserved0;
50 UINT Reserved1;
51 UINT Reserved2;
52 UINT Reserved3;
53 UINT Reserved4;
54
55 } FASTCOMP_QUERY_STATUS;
56
57 typedef enum _VPREP_ISTAB_MODE
58 {
59 ISTAB_MODE_NONE,
60 ISTAB_MODE_BLACKEN,
61 ISTAB_MODE_UPSCALE
62 } VPREP_ISTAB_MODE;
63
64namespace MfxHwVideoProcessing
65{
66 const mfxU32 g_TABLE_SUPPORTED_FOURCC [] =
67 {
68 MFX_FOURCC_NV12 ,
69 MFX_FOURCC_YV12 ,
70 MFX_FOURCC_NV16 ,
71 MFX_FOURCC_YUY2 ,
72 MFX_FOURCC_RGB3 ,
73 MFX_FOURCC_RGB4 ,
74 MFX_FOURCC_BGR4 ,
75#if defined (MFX_ENABLE_FOURCC_RGB565)
76 MFX_FOURCC_RGB565 ,
77#endif
78#ifdef MFX_ENABLE_RGBP
79 MFX_FOURCC_RGBP ,
80#endif
81 MFX_FOURCC_P8 ,
82 MFX_FOURCC_P8_TEXTURE,
83 MFX_FOURCC_P010 ,
84 MFX_FOURCC_P210 ,
85 MFX_FOURCC_A2RGB10 ,
86 MFX_FOURCC_ARGB16 ,
87 MFX_FOURCC_R16 ,
88 MFX_FOURCC_AYUV ,
89 MFX_FOURCC_AYUV_RGB4 ,
90 MFX_FOURCC_UYVY ,
91 MFX_FOURCC_Y210 ,
92 MFX_FOURCC_Y410 ,
93 MFX_FOURCC_P016 ,
94 MFX_FOURCC_Y216 ,
95 MFX_FOURCC_Y416 ,
96 MFX_FOURCC_BGRP ,
97 MFX_FOURCC_ABGR16F ,
98 MFX_FOURCC_I420 ,
99 };
100
101 typedef enum mfxFormatSupport {
102 MFX_FORMAT_SUPPORT_INPUT = 1,
103 MFX_FORMAT_SUPPORT_OUTPUT = 2
104 } mfxFormatSupport;
105
106 struct RateRational
107 {
108 mfxU32 FrameRateExtN;
109 mfxU32 FrameRateExtD;
110 };
111
112 struct CustomRateData
113 {
114 RateRational customRate;
115 mfxU32 inputFramesOrFieldPerCycle;
116 mfxU32 outputIndexCountPerCycle;
117 mfxU32 bkwdRefCount;
118 mfxU32 fwdRefCount;
119
120 mfxU32 indexRateConversion;
121 };
122
123 struct FrcCaps
124 {
125 std::vector<CustomRateData> customRateData;
126 };
127
128 struct DstRect
129 {
130 mfxU32 DstX;
131 mfxU32 DstY;
132 mfxU32 DstW;
133 mfxU32 DstH;
134 mfxU16 LumaKeyEnable;
135 mfxU16 LumaKeyMin;
136 mfxU16 LumaKeyMax;
137 mfxU16 GlobalAlphaEnable;
138 mfxU16 GlobalAlpha;
139 mfxU16 PixelAlphaEnable;
140 mfxU16 IOPattern; //sys/video/opaque memory
141 mfxU16 ChromaFormat;
142 mfxU32 FourCC;
143 mfxU32 TileId;
144 };
145
146 typedef struct _CameraCaps
147 {
148 mfxU32 uBlackLevelCorrection;
149 mfxU32 uHotPixelCheck;
150 mfxU32 uWhiteBalance;
151 mfxU32 uColorCorrectionMatrix;
152 mfxU32 uGammaCorrection;
153 mfxU32 uVignetteCorrection;
154 mfxU32 u3DLUT;
155 mfxU32 uCscYuvRgb;
156 mfxU32 uTotalColorControl;
157 mfxU32 uLensGeomDistCorrection;
158 mfxU32 uPadding;
159 mfxU32 uBayerDenoise;
160 } CameraCaps;
161
162 struct mfxVppCaps
163 {
164 mfxU32 uAdvancedDI;
165 mfxU32 uSimpleDI;
166 mfxU32 uInverseTC;
167 mfxU32 uDenoiseFilter;
168#ifdef MFX_ENABLE_MCTF
169 mfxU32 uMCTF;
170#endif
171 mfxU32 uDetailFilter;
172 mfxU32 uProcampFilter;
173 mfxU32 uSceneChangeDetection;
174
175 CameraCaps cameraCaps;
176
177 mfxU32 uFrameRateConversion;
178 mfxU32 uDeinterlacing;
179
180 mfxU32 uVideoSignalInfoInOut;
181
182 mfxU32 uHdr10ToneMapping;
183
184 mfxU32 uVideoSignalInfo;
185 FrcCaps frcCaps;
186
187 mfxU32 uIStabFilter;
188 mfxU32 uVariance;
189
190 mfxI32 iNumBackwardSamples;
191 mfxI32 iNumForwardSamples;
192
193 mfxU32 uMaxWidth;
194 mfxU32 uMaxHeight;
195 mfxU32 uMinWidth;
196 mfxU32 uMinHeight;
197
198 mfxU32 uFieldWeavingControl;
199
200 mfxU32 uRotation;
201
202 mfxU32 uScaling;
203
204 mfxU32 uChromaSiting;
205
206 std::map <mfxU32, mfxU32> mFormatSupport;
207
208 mfxU32 uMirroring;
209
210 mfxU32 uFieldProcessing;
211
212 mfxU32 u3DLut;
213 mfxU32 uDenoise2Filter; // mfxExtVPPDenoise2
214
215 mfxU32 uSuperResolution;
216 mfxU32 uSrMaxInWidth;
217 mfxU32 uSrMaxInHeight;
218
219 mfxVppCaps()
220 : uAdvancedDI(0)
221 , uSimpleDI(0)
222 , uInverseTC(0)
223 , uDenoiseFilter(0)
224#ifdef MFX_ENABLE_MCTF
225 , uMCTF(0)
226#endif
227 , uDetailFilter(0)
228 , uProcampFilter(0)
229 , uSceneChangeDetection(0)
230 , uFrameRateConversion(0)
231 , uDeinterlacing(0)
232
233 , uVideoSignalInfoInOut(0)
234 , uHdr10ToneMapping(0)
235 , uVideoSignalInfo(0)
236 , frcCaps()
237 , uIStabFilter(0)
238 , uVariance(0)
239 , iNumBackwardSamples(0)
240 , iNumForwardSamples(0)
241 , uMaxWidth(0)
242 , uMaxHeight(0)
243 , uMinWidth(0)
244 , uMinHeight(0)
245 , uFieldWeavingControl(0)
246 , uRotation(0)
247 , uScaling(0)
248 , uChromaSiting(0)
249 , mFormatSupport()
250 , uMirroring(0)
251 , uFieldProcessing(0)
252 , u3DLut(0)
253 , uDenoise2Filter(0)
254 , uSuperResolution(0)
255 , uSrMaxInWidth(0)
256 , uSrMaxInHeight(0)
257 {
258 memset(&cameraCaps, 0, sizeof(CameraCaps));
259 };
260 };
261
262
263 typedef struct _mfxDrvSurface
264 {
265 mfxFrameInfo frameInfo;
266 mfxHDLPair hdl;
267
268 mfxMemId memId;
269 bool bExternal;
270
271 mfxU64 startTimeStamp;
272 mfxU64 endTimeStamp;
273
274 } mfxDrvSurface;
275
276 // Scene change detection
277 typedef enum {
278 VPP_NO_SCENE_CHANGE = 0,
279 VPP_SCENE_NEW = 1, // BOB display current field to generate output
280 VPP_MORE_SCENE_CHANGE_DETECTED = 2 // BOB display only first field to avoid out of frame order
281 } vppScene;
282
283 // mfxVideoSignalInfo is for MFX_EXTBUFF_VIDEO_SIGNAL_INFO which supports the video signal info
284 // in the video spec theoretically. See the mfxExtVideoSignalInfo structure for details.
285 struct mfxVideoSignalInfo {
286 bool enabled;
287 mfxU16 VideoFormat;
288 mfxU16 VideoFullRange;
289 mfxU16 ColourDescriptionPresent;
290 mfxU16 ColourPrimaries;
291 mfxU16 TransferCharacteristics;
292 mfxU16 MatrixCoefficients;
293
294 bool operator!=(const mfxVideoSignalInfo & other) const
295 {
296 return enabled != other.enabled
297 || VideoFormat != other.VideoFormat
298 || VideoFullRange != other.VideoFullRange
299 || ColourPrimaries != other.ColourPrimaries
300 || TransferCharacteristics != other.TransferCharacteristics
301 || MatrixCoefficients != other.MatrixCoefficients;
302 }
303 };
304
305 class mfxExecuteParams
306 {
307 // SignalInfo is for MFX_EXTBUFF_VPP_VIDEO_SIGNAL_INFO which only
308 // supports the signal info of SDR
309 struct SignalInfo {
310 bool enabled;
311 mfxU16 TransferMatrix;
312 mfxU16 NominalRange;
313
314 bool operator!=(const SignalInfo & other) const
315 {
316 return enabled != other.enabled
317 || TransferMatrix != other.TransferMatrix
318 || NominalRange != other.NominalRange;
319 }
320 };
321
322 struct Lut3DInfo {
323 bool Enabled;
324 mfxMemId MemId;
325 mfxDataType DataType;
326 mfxResourceType BufferType;
327 mfx3DLutMemoryLayout MemLayout;
328 mfx3DLutChannelMapping ChannelMapping;
329 mfxChannel Channel[3];
330#ifdef ONEVPL_EXPERIMENTAL
331 mfx3DLutInterpolationMethod InterpolationMethod;
332#endif
333 };
334
335 struct SRInfo {
336 bool Enabled;
337 mfxAISuperResolutionMode Mode;
338 mfxAISuperResolutionAlgorithm Algorithm;
339
340 bool operator!=(const SRInfo& other) const
341 {
342 return Enabled != other.Enabled
343 || Mode != other.Mode
344 || Algorithm != other.Algorithm;
345 }
346 };
347
348 public:
349 mfxExecuteParams():
350 targetSurface()
351 ,targetTimeStamp()
352 ,pRefSurfaces(0)
353 ,refCount(0)
354 ,bkwdRefCount(0)
355 ,fwdRefCount(0)
356 ,iDeinterlacingAlgorithm(0)
357 ,bFMDEnable(false)
358 ,bDenoiseAutoAdjust(false)
359 ,denoiseFactor(0)
360 ,denoiseFactorOriginal(0)
361 ,denoiseMode(MFX_DENOISE_MODE_DEFAULT)
362 ,bdenoiseAdvanced(false)
363 ,bDetailAutoAdjust(false)
364 ,detailFactor(0)
365 ,detailFactorOriginal(0)
366 ,iTargetInterlacingMode(0)
367 ,bEnableProcAmp(false)
368 ,Brightness(0)
369 ,Contrast(0)
370 ,Hue(0)
371 ,Saturation(0)
372 ,bVarianceEnable(false)
373 ,bImgStabilizationEnable(false)
374 ,istabMode(0)
375 ,bFRCEnable(false)
376 ,frcModeOrig(0)
377 ,bComposite(false)
378 ,dstRects(0)
379 ,bBackgroundRequired(true)
380 ,iBackgroundColor(0)
381 ,iTilesNum4Comp(0)
382 ,execIdx(NO_INDEX)
383 ,initialStreamNum(0)
384 ,statusReportID(0)
385 ,bFieldWeaving(false)
386 ,bFieldWeavingExt(false)
387 ,bFieldSplittingExt(false)
388 ,iFieldProcessingMode(0)
389 ,bCameraPipeEnabled(false)
390 ,bCameraPipeControl(0)
391 ,CameraPipeControl()
392 ,bCameraBlackLevelCorrection(false)
393 ,CameraBlackLevel()
394 ,bCameraWhiteBalaceCorrection(false)
395 ,CameraWhiteBalance()
396 ,bCameraHotPixelRemoval(false)
397 ,CameraHotPixel()
398 ,bCCM(false)
399 ,CCMParams()
400 ,bCameraTCC(false)
401 ,CameraTCC()
402 ,bCameraRGBtoYUV(false)
403 ,CameraRGBToYUV()
404 ,bCameraGammaCorrection(false)
405 ,CameraForwardGammaCorrection()
406 ,bCameraVignetteCorrection(false)
407 ,CameraVignetteCorrection()
408 ,bCameraLensCorrection(false)
409 ,CameraLensCorrection()
410 ,bCamera3DLUT(false)
411 ,Camera3DLUT()
412 ,bCameraPadding(false)
413 ,CameraPadding()
414 ,bCameraBayerDenoise(false)
415 ,CameraBayerDenoise()
416 ,rotation(0)
417 ,scalingMode(MFX_SCALING_MODE_DEFAULT)
418 ,interpolationMethod(MFX_INTERPOLATION_DEFAULT)
419 ,chromaSiting(MFX_CHROMA_SITING_UNKNOWN)
420 ,bEOS(false)
421 ,mirroring(0)
422 ,mirroringPosition(0)
423 ,mirroringExt(false)
424 ,scene(VPP_NO_SCENE_CHANGE)
425 ,bDeinterlace30i60p(false)
426 ,bAiVfi(false)
427 ,m_aiFiMode(MFX_AI_FRAME_INTERPOLATION_MODE_DISABLE)
428#if defined (MFX_EXTBUFF_GPU_HANG_ENABLE)
429 ,gpuHangTrigger(false)
430#endif
431#ifdef MFX_ENABLE_MCTF
432 , bEnableMctf(false)
433 , MctfFilterStrength(0)
434#endif
435#if defined (ONEVPL_EXPERIMENTAL)
436 , bEnablePercEncFilter(false)
437#endif
438 , reset(0)
439 {
440 memset(&targetSurface, 0, sizeof(mfxDrvSurface));
441 dstRects.clear();
442 memset(&customRateData, 0, sizeof(CustomRateData));
443 VideoSignalInfoIn.enabled = false;
444 VideoSignalInfoIn.NominalRange = MFX_NOMINALRANGE_16_235;
445 VideoSignalInfoIn.TransferMatrix = MFX_TRANSFERMATRIX_BT601;
446 VideoSignalInfoOut.enabled = false;
447 VideoSignalInfoOut.NominalRange = MFX_NOMINALRANGE_16_235;
448 VideoSignalInfoOut.TransferMatrix = MFX_TRANSFERMATRIX_BT601;
449
450 VideoSignalInfo.clear();
451 VideoSignalInfo.assign(1, VideoSignalInfoIn);
452 lut3DInfo= {};
453
454 m_inVideoSignalInfo = {};
455 m_outVideoSignalInfo = {};
456
457 inHDR10MetaData = {};
458 outHDR10MetaData = {};
459 denoiseStrength = 0;
460
461 srSetParams.Enabled = false;
462 srSetParams.Mode = MFX_AI_SUPER_RESOLUTION_MODE_DISABLED;
463 srSetParams.Algorithm = MFX_AI_SUPER_RESOLUTION_ALGORITHM_DEFAULT;
464 srGetParams = srSetParams;
465 };
466
467 bool IsDoNothing()
468 {
469 CustomRateData refCustomRateData;
470 memset(&refCustomRateData, 0, sizeof(CustomRateData));
471 if (memcmp(&refCustomRateData, &customRateData, sizeof(CustomRateData)))
472 return false;
473 if (iDeinterlacingAlgorithm != 0 ||
474 bFMDEnable != 0 ||
475 bDenoiseAutoAdjust != 0 ||
476 bDetailAutoAdjust != 0 ||
477 denoiseFactor != 0 ||
478 bdenoiseAdvanced != false ||
479 detailFactor != 0 ||
480 iTargetInterlacingMode != 0 ||
481 bEnableProcAmp != false ||
482 bVarianceEnable != false ||
483 bImgStabilizationEnable != false ||
484 bFRCEnable != false ||
485 bComposite != false ||
486 bFieldWeaving != false ||
487 bFieldSplittingExt != false ||
488 iFieldProcessingMode != 0 ||
489 bCameraPipeEnabled != false ||
490 bCameraBlackLevelCorrection != false ||
491 bCameraGammaCorrection != false ||
492 bCameraHotPixelRemoval != false ||
493 bCameraWhiteBalaceCorrection != false ||
494 bCCM != false ||
495 bCameraLensCorrection != false ||
496 rotation != 0 ||
497 scalingMode != MFX_SCALING_MODE_DEFAULT ||
498 mirroring != 0 ||
499 mirroringExt != false ||
500 scene != VPP_NO_SCENE_CHANGE ||
501 bDeinterlace30i60p != false ||
502 chromaSiting != MFX_CHROMA_SITING_UNKNOWN
503#ifdef MFX_ENABLE_MCTF
504 || bEnableMctf != false
505#endif
506#if defined (ONEVPL_EXPERIMENTAL)
507 || bEnablePercEncFilter
508#endif
509 || lut3DInfo.Enabled != false
510 )
511 return false;
512 if (VideoSignalInfoIn != VideoSignalInfoOut)
513 return false;
514 if (m_inVideoSignalInfo != m_outVideoSignalInfo)
515 return false;
516 return true;
517 };
518
519 //surfaces
520 mfxDrvSurface targetSurface;
521 mfxU64 targetTimeStamp;
522
523 mfxDrvSurface* pRefSurfaces;
524 int refCount; // refCount == bkwdRefCount + 1 + fwdRefCount
525
526 int bkwdRefCount; // filled from DdiTask
527 int fwdRefCount; //
528
529 // params
530 mfxI32 iDeinterlacingAlgorithm; //0 - none, 1 - BOB, 2 - advanced (means reference need)
531 bool bFMDEnable;
532
533 bool bDenoiseAutoAdjust; // MFX_EXTBUFF_VPP_DENOISE
534 mfxU16 denoiseFactor; // MFX_EXTBUFF_VPP_DENOISE
535 mfxU16 denoiseFactorOriginal; // MFX_EXTBUFF_VPP_DENOISE, Original denoise factor or strength provided by app.
536 mfxDenoiseMode denoiseMode; // MFX_EXTBUFF_VPP_DENOISE2 Denoise mode
537 mfxU16 denoiseStrength; // MFX_EXTBUFF_VPP_DENOISE2 denoiseStrength
538 bool bdenoiseAdvanced; // Indicate MFX_EXTBUFF_VPP_DENOISE2
539 bool bDetailAutoAdjust;
540 mfxU16 detailFactor;
541 mfxU16 detailFactorOriginal; // Original detail factor provided by app.
542
543 mfxU32 iTargetInterlacingMode;
544
545 bool bEnableProcAmp;
546 mfxF64 Brightness;
547 mfxF64 Contrast;
548 mfxF64 Hue;
549 mfxF64 Saturation;
550
551 bool bVarianceEnable;
552 bool bImgStabilizationEnable;
553 mfxU32 istabMode;
554
555 bool bFRCEnable;
556 CustomRateData customRateData;
557 mfxU16 frcModeOrig; // Original mode provided by app
558
559 bool bComposite;
560 std::vector<DstRect> dstRects;
561 bool bBackgroundRequired;
562 mfxU64 iBackgroundColor;
563 mfxU32 iTilesNum4Comp;
564 mfxU32 execIdx; //index call of execute for current frame, actual for composition
565 mfxU32 initialStreamNum;
566
567 mfxU32 statusReportID;
568
569 bool bFieldWeaving;
570 bool bFieldWeavingExt;
571 bool bFieldSplittingExt;
572
573 mfxU32 iFieldProcessingMode;
574
575 // Camera Pipe specific params
576 bool bCameraPipeEnabled;
577 bool bCameraPipeControl;
578 mfxExtCamPipeControl CameraPipeControl;
579 bool bCameraBlackLevelCorrection;
580 mfxExtCamBlackLevelCorrection CameraBlackLevel;
581 bool bCameraWhiteBalaceCorrection;
582 mfxExtCamWhiteBalance CameraWhiteBalance;
583 bool bCameraHotPixelRemoval;
584 mfxExtCamHotPixelRemoval CameraHotPixel;
585 bool bCCM;
586 mfxExtCamColorCorrection3x3 CCMParams;
587 bool bCameraTCC;
588 mfxExtCamTotalColorControl CameraTCC;
589 bool bCameraRGBtoYUV;
590 mfxExtCamCscYuvRgb CameraRGBToYUV;
591 bool bCameraGammaCorrection;
592 mfxExtCamFwdGamma CameraForwardGammaCorrection;
593 bool bCameraVignetteCorrection;
594 mfxExtCamVignetteCorrection CameraVignetteCorrection;
595 bool bCameraLensCorrection;
596 mfxExtCamLensGeomDistCorrection CameraLensCorrection;
597 bool bCamera3DLUT;
598 mfxExtCam3DLut Camera3DLUT;
599 bool bCameraPadding;
600 mfxExtCamPadding CameraPadding;
601 bool bCameraBayerDenoise;
602 mfxExtCamBayerDenoise CameraBayerDenoise;
603
604 int rotation;
605
606 mfxU16 scalingMode;
607
608 mfxU16 interpolationMethod;
609
610 mfxU16 chromaSiting;
611
612 bool bEOS;
613
614 SignalInfo VideoSignalInfoIn; // Common video signal info set on Init
615 SignalInfo VideoSignalInfoOut; // Video signal info for output
616
617 std::vector<SignalInfo> VideoSignalInfo; // Video signal info for each frame in a single run
618
619 int mirroring;
620 int mirroringPosition;
621 bool mirroringExt;
622
623 vppScene scene; // Keep information about scene change
624 bool bDeinterlace30i60p;
625
626 SRInfo srSetParams;
627 SRInfo srGetParams;
628
629 bool bAiVfi;
630 mfxAIFrameInterpolationMode m_aiFiMode;
631
632#if defined (MFX_EXTBUFF_GPU_HANG_ENABLE)
633 bool gpuHangTrigger;
634#endif
635
636#ifdef MFX_ENABLE_MCTF
637 bool bEnableMctf;
638 mfxU16 MctfFilterStrength;
639#endif
640#if defined (ONEVPL_EXPERIMENTAL)
641 bool bEnablePercEncFilter;
642#endif
643
644 bool reset;
645 Lut3DInfo lut3DInfo;
646
647 mfxVideoSignalInfo m_inVideoSignalInfo;
648 mfxVideoSignalInfo m_outVideoSignalInfo;
649
650 struct HDR10MetaData
651 {
652 bool enabled;
653 mfxU16 displayPrimariesX[3];
654 mfxU16 displayPrimariesY[3];
655 mfxU16 whitePoint[2];
656 mfxU32 maxMasteringLuminance;
657 mfxU32 minMasteringLuminance;
658 mfxU16 maxContentLightLevel;
659 mfxU16 maxFrameAverageLightLevel;
660 };
661 HDR10MetaData inHDR10MetaData;
662 HDR10MetaData outHDR10MetaData;
663 };
664
665 class DriverVideoProcessing
666 {
667 public:
668
669 virtual ~DriverVideoProcessing(void){}
670
671 virtual mfxStatus CreateDevice(VideoCORE * core, mfxVideoParam* par, bool isTemporal = false) = 0;
672
673 virtual mfxStatus ReconfigDevice(mfxU32 indx) = 0;
674
675 virtual mfxStatus DestroyDevice( void ) = 0;
676
677 virtual mfxStatus Register(mfxHDLPair* pSurfaces, mfxU32 num, BOOL bRegister) = 0;
678
679 virtual mfxStatus QueryTaskStatus(SynchronizedTask* pSyncTask) = 0;
680
681 virtual mfxStatus Execute(mfxExecuteParams *pParams) = 0;
682
683 virtual mfxStatus QueryCapabilities( mfxVppCaps& caps ) = 0;
684
685 virtual mfxStatus QueryVariance(
686 mfxU32 frameIndex,
687 std::vector<UINT> &variance) = 0;
688 }; // DriverVideoProcessing
689
690 DriverVideoProcessing* CreateVideoProcessing( VideoCORE* core );
691
692}; // namespace
693
694
695/*
696 * Simple proxy for VPP device/caps create. It simplifies having a single
697 * cached vpp processing device accessible thru VideoCORE
698 */
699class VPPHWResMng
700{
701public:
702 VPPHWResMng(): m_ddi(nullptr), m_caps() {};
703
704 ~VPPHWResMng() { Close(); };
705
706 mfxStatus Close(void){
707 m_ddi.reset(0);
708 return MFX_ERR_NONE;
709 }
710
711 MfxHwVideoProcessing::DriverVideoProcessing *GetDevice(void) const {
712 return m_ddi.get();
713 };
714
715 mfxStatus SetDevice(MfxHwVideoProcessing::DriverVideoProcessing *ddi){
716 MFX_CHECK_NULL_PTR1(ddi);
717 MFX_CHECK_STS(Close());
718 m_ddi.reset(ddi);
719 return MFX_ERR_NONE;
720 }
721
722 MfxHwVideoProcessing::mfxVppCaps GetCaps(void) const {
723 return m_caps;
724 }
725
726 mfxStatus SetCaps(const MfxHwVideoProcessing::mfxVppCaps &caps){
727 m_caps = caps;
728 return MFX_ERR_NONE;
729 }
730
731 mfxStatus CreateDevice(VideoCORE * core);
732
733 // Just to make ResMang easier to use with existing code of DriverVideoProcessing
734 MfxHwVideoProcessing::DriverVideoProcessing *operator->() const {
735 return m_ddi.get();
736 }
737
738private:
739 VPPHWResMng(const VPPHWResMng &);
740 VPPHWResMng &operator=(const VPPHWResMng &);
741
742 std::unique_ptr<MfxHwVideoProcessing::DriverVideoProcessing> m_ddi;
743 MfxHwVideoProcessing::mfxVppCaps m_caps;
744};
745
746
747#endif // __MFX_VPP_BASE_DDI_H
748#endif // MFX_ENABLE_VPP
749/* EOF */
750