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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
|
// Copyright (c) 2017-2020 Intel Corporation
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "mfx_common.h"
#if defined (MFX_ENABLE_VPP)
#if defined (MFX_VA_LINUX)
#ifndef __MFX_VPP_VAAPI
#define __MFX_VPP_VAAPI
#include "umc_va_base.h"
#include "mfx_vpp_interface.h"
#include "mfx_platform_headers.h"
#include <va/va.h>
#include <va/va_vpp.h>
#include <assert.h>
#include <set>
namespace MfxHwVideoProcessing
{
class VAAPIVideoProcessing : public DriverVideoProcessing
{
public:
VAAPIVideoProcessing();
virtual ~VAAPIVideoProcessing();
virtual mfxStatus CreateDevice(VideoCORE * core, mfxVideoParam *pParams, bool isTemporal = false);
virtual mfxStatus ReconfigDevice(mfxU32 /*indx*/) { return MFX_ERR_NONE; }
virtual mfxStatus DestroyDevice( void );
virtual mfxStatus Register(mfxHDLPair* pSurfaces,
mfxU32 num,
BOOL bRegister);
virtual mfxStatus QueryTaskStatus(mfxU32 taskIndex);
virtual mfxStatus QueryCapabilities( mfxVppCaps& caps );
virtual mfxStatus QueryVariance(
mfxU32 /* frameIndex */,
std::vector<mfxU32> & /*variance*/) { return MFX_ERR_UNSUPPORTED; }
virtual BOOL IsRunning() { return m_bRunning; }
virtual mfxStatus Execute(mfxExecuteParams *pParams);
virtual mfxStatus Execute_Composition(mfxExecuteParams *pParams);
virtual mfxStatus Execute_Composition_TiledVideoWall(mfxExecuteParams *pParams);
private:
// VideoSignalInfo contains infor for backward reference, current and forward reference
// frames. Indices in the info array are:
// { <indices for bwd refs>, <current>, <indices for fwd refs> }
// For example, in case of ADI we will have: 1 bwd ref, 1 current, 0 fwd ref; indices will be:
// VideoSignalInfo[0] - for bwd ref
// VideoSignalInfo[1] - for cur reference
inline int GetCurFrameSignalIdx(mfxExecuteParams* pParams)
{
if (!pParams) return -1;
if ((size_t)pParams->bkwdRefCount < pParams->VideoSignalInfo.size()) {
return pParams->bkwdRefCount;
}
return -1;
}
typedef struct _compositionStreamElement
{
mfxU16 index;
BOOL active;
mfxU16 x;
mfxU16 y;
_compositionStreamElement()
: index(0)
, active(false)
, x(0)
, y(0)
{};
} compStreamElem;
typedef struct vppTileVW{
mfxU32 numChannels;
VARectangle targerRect;
mfxU8 channelIds[8];
} m_tiledVideoWallParams;
BOOL isVideoWall(mfxExecuteParams *pParams);
BOOL m_bRunning;
VideoCORE* m_core;
VADisplay m_vaDisplay;
VAConfigID m_vaConfig;
VAContextID m_vaContextVPP;
VAProcFilterCap m_denoiseCaps;
VAProcFilterCap m_detailCaps;
VAProcPipelineCaps m_pipelineCaps;
VAProcFilterCapColorBalance m_procampCaps[VAProcColorBalanceCount];
VAProcFilterCapDeinterlacing m_deinterlacingCaps[VAProcDeinterlacingCount];
#ifdef MFX_ENABLE_VPP_FRC
VAProcFilterCapFrameRateConversion m_frcCaps[2]; /* only two modes, 24p->60p and 30p->60p */
mfxU32 m_frcCyclicCounter;
#endif
VABufferID m_denoiseFilterID;
VABufferID m_detailFilterID;
VABufferID m_deintFilterID;
VABufferID m_procampFilterID;
VABufferID m_frcFilterID;
VABufferID m_gpuPriorityID;
mfxU32 m_deintFrameCount;
VASurfaceID m_refForFRC[5];
VABufferID m_filterBufs[VAProcFilterCount];
mfxU32 m_numFilterBufs;
std::vector<VAProcPipelineParameterBuffer> m_pipelineParam;
std::vector<VABufferID> m_pipelineParamID;
std::set<mfxU32> m_cachedReadyTaskIndex;
mfxU32 m_MaxContextPriority;
typedef struct
{
VASurfaceID surface;
mfxU32 number;
} ExtVASurface;
VASurfaceID* m_primarySurface4Composition ;
std::vector<ExtVASurface> m_feedbackCache;
UMC::Mutex m_guard;
mfxStatus Init( _mfxPlatformAccelerationService* pVADisplay, mfxVideoParam *pParams);
mfxStatus Close( void );
mfxStatus RemoveBufferFromPipe(VABufferID & id);
};
}; // namespace
#endif //__MFX_VPP_VAAPI
#endif // MFX_VA_LINUX
#endif // MFX_ENABLE_VPP
/* EOF */
|