Skip to content
This repository was archived by the owner on May 17, 2023. It is now read-only.

Commit 6ae1339

Browse files
committed
Add 3DLUT filter in VPP.
1. Add 3DLUT interface and Linux implementation. 2. Add tutorials for 3DLUT VPP and transcode. Signed-off-by: Furong Zhang <furong.zhang@intel.com>
1 parent 510d19d commit 6ae1339

33 files changed

+2631
-45
lines changed

_studio/mfx_lib/vpp/src/mfx_vpp_hw.cpp

+54-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2008-2020 Intel Corporation
1+
// Copyright (c) 2008-2021 Intel Corporation
22
//
33
// Permission is hereby granted, free of charge, to any person obtaining a copy
44
// of this software and associated documentation files (the "Software"), to deal
@@ -148,6 +148,7 @@ static void MemSetZero4mfxExecuteParams (mfxExecuteParams *pMfxExecuteParams )
148148
#endif
149149
pMfxExecuteParams->bEOS = false;
150150
pMfxExecuteParams->scene = VPP_NO_SCENE_CHANGE;
151+
pMfxExecuteParams->lut3DInfo = {};
151152
} /*void MemSetZero4mfxExecuteParams (mfxExecuteParams *pMfxExecuteParams )*/
152153

153154

@@ -2036,6 +2037,19 @@ mfxStatus VideoVPPHW::GetVideoParams(mfxVideoParam *par) const
20362037
bufSc->InterpolationMethod = m_executeParams.interpolationMethod;
20372038
#endif
20382039
}
2040+
else if (MFX_EXTBUFF_VPP_3DLUT == bufferId)
2041+
{
2042+
mfxExtVPP3DLut *bufSc = reinterpret_cast<mfxExtVPP3DLut *>(par->ExtParam[i]);
2043+
MFX_CHECK_NULL_PTR1(bufSc);
2044+
bufSc->ChannelMapping = m_executeParams.lut3DInfo.ChannelMapping;
2045+
bufSc->BufferType = m_executeParams.lut3DInfo.BufferType;
2046+
if (bufSc->BufferType == MFX_RESOURCE_VA_SURFACE)
2047+
{
2048+
bufSc->VideoBuffer.DataType = m_executeParams.lut3DInfo.DataType;
2049+
bufSc->VideoBuffer.MemLayout = m_executeParams.lut3DInfo.MemLayout;
2050+
bufSc->VideoBuffer.MemId = m_executeParams.lut3DInfo.MemId;
2051+
}
2052+
}
20392053
#if (MFX_VERSION >= 1025)
20402054
else if (MFX_EXTBUFF_VPP_COLOR_CONVERSION == bufferId)
20412055
{
@@ -5664,6 +5678,41 @@ mfxStatus ConfigureExecuteParams(
56645678
bIsFilterSkipped = true;
56655679
}
56665680

5681+
break;
5682+
}
5683+
case MFX_EXTBUFF_VPP_3DLUT:
5684+
{
5685+
if (caps.u3DLut)
5686+
{
5687+
for (mfxU32 i = 0; i < videoParam.NumExtParam; i++)
5688+
{
5689+
if (videoParam.ExtParam[i]->BufferId == MFX_EXTBUFF_VPP_3DLUT)
5690+
{
5691+
mfxExtVPP3DLut *ext3DLUT = (mfxExtVPP3DLut*) videoParam.ExtParam[i];
5692+
if (ext3DLUT)
5693+
{
5694+
executeParams.lut3DInfo.Enabled = true;
5695+
executeParams.lut3DInfo.ChannelMapping = ext3DLUT->ChannelMapping;
5696+
executeParams.lut3DInfo.BufferType = ext3DLUT->BufferType;
5697+
if (ext3DLUT->BufferType == MFX_RESOURCE_VA_SURFACE)
5698+
{
5699+
executeParams.lut3DInfo.DataType = ext3DLUT->VideoBuffer.DataType;
5700+
executeParams.lut3DInfo.MemLayout = ext3DLUT->VideoBuffer.MemLayout;
5701+
executeParams.lut3DInfo.MemId = ext3DLUT->VideoBuffer.MemId;
5702+
}
5703+
else
5704+
{
5705+
return MFX_ERR_UNSUPPORTED;
5706+
}
5707+
}
5708+
}
5709+
}
5710+
}
5711+
else
5712+
{
5713+
bIsFilterSkipped = true;
5714+
}
5715+
56675716
break;
56685717
}
56695718
#if (MFX_VERSION >= 1025)
@@ -6252,6 +6301,10 @@ mfxStatus ConfigureExecuteParams(
62526301
{
62536302
executeParams.scalingMode = MFX_SCALING_MODE_DEFAULT;
62546303
}
6304+
else if (MFX_EXTBUFF_VPP_3DLUT == bufferId)
6305+
{
6306+
executeParams.lut3DInfo.Enabled = false;
6307+
}
62556308
#if (MFX_VERSION >= 1025)
62566309
else if (MFX_EXTBUFF_VPP_COLOR_CONVERSION == bufferId)
62576310
{

_studio/mfx_lib/vpp/src/mfx_vpp_sw_internal.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2018-2020 Intel Corporation
1+
// Copyright (c) 2018-2021 Intel Corporation
22
//
33
// Permission is hereby granted, free of charge, to any person obtaining a copy
44
// of this software and associated documentation files (the "Software"), to deal
@@ -151,6 +151,11 @@ mfxStatus GetExternalFramesCount(VideoCORE* core,
151151
break;
152152
}
153153

154+
case (mfxU32)MFX_EXTBUFF_VPP_3DLUT:
155+
{
156+
break;
157+
}
158+
154159
case (mfxU32)MFX_EXTBUFF_VPP_DEINTERLACING:
155160
{
156161
break;

_studio/mfx_lib/vpp/src/mfx_vpp_utils.cpp

+41-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2018-2020 Intel Corporation
1+
// Copyright (c) 2018-2021 Intel Corporation
22
//
33
// Permission is hereby granted, free of charge, to any person obtaining a copy
44
// of this software and associated documentation files (the "Software"), to deal
@@ -45,7 +45,8 @@ const mfxU32 g_TABLE_DO_NOT_USE [] =
4545
#endif
4646
MFX_EXTBUFF_VPP_VIDEO_SIGNAL_INFO,
4747
MFX_EXTBUFF_VPP_FIELD_PROCESSING,
48-
MFX_EXTBUFF_VPP_MIRRORING
48+
MFX_EXTBUFF_VPP_MIRRORING,
49+
MFX_EXTBUFF_VPP_3DLUT
4950
};
5051

5152

@@ -69,7 +70,8 @@ const mfxU32 g_TABLE_DO_USE [] =
6970
MFX_EXTBUFF_VPP_DEINTERLACING,
7071
MFX_EXTBUFF_VPP_VIDEO_SIGNAL_INFO,
7172
MFX_EXTBUFF_VPP_FIELD_PROCESSING,
72-
MFX_EXTBUFF_VPP_MIRRORING
73+
MFX_EXTBUFF_VPP_MIRRORING,
74+
MFX_EXTBUFF_VPP_3DLUT
7375
};
7476

7577

@@ -94,7 +96,8 @@ const mfxU32 g_TABLE_CONFIG [] =
9496
#if (MFX_VERSION >= 1025)
9597
MFX_EXTBUFF_VPP_COLOR_CONVERSION,
9698
#endif
97-
MFX_EXTBUFF_VPP_MIRRORING
99+
MFX_EXTBUFF_VPP_MIRRORING,
100+
MFX_EXTBUFF_VPP_3DLUT
98101
};
99102

100103

@@ -125,7 +128,8 @@ const mfxU32 g_TABLE_EXT_PARAM [] =
125128
#if (MFX_VERSION >= 1025)
126129
MFX_EXTBUFF_VPP_COLOR_CONVERSION,
127130
#endif
128-
MFX_EXTBUFF_VPP_MIRRORING
131+
MFX_EXTBUFF_VPP_MIRRORING,
132+
MFX_EXTBUFF_VPP_3DLUT
129133
};
130134

131135
PicStructMode GetPicStructMode(mfxU16 inPicStruct, mfxU16 outPicStruct)
@@ -674,6 +678,11 @@ void ShowPipeline( std::vector<mfxU32> pipelineList )
674678
break;
675679
}
676680
#endif
681+
case (mfxU32)MFX_EXTBUFF_VPP_3DLUT:
682+
{
683+
fprintf(stderr, "MFX_EXTBUFF_VPP_3DLUT\n");
684+
break;
685+
}
677686
default:
678687
{
679688
fprintf(stderr, "UNKNOWN Filter ID!!! \n");
@@ -793,6 +802,12 @@ void ReorderPipelineListForQuality( std::vector<mfxU32> & pipelineList )
793802
index++;
794803
}
795804

805+
if( IsFilterFound( &pipelineList[0], (mfxU32)pipelineList.size(), MFX_EXTBUFF_VPP_3DLUT ) )
806+
{
807+
newList[index] = MFX_EXTBUFF_VPP_3DLUT;
808+
index++;
809+
}
810+
796811
if( IsFilterFound( &pipelineList[0], (mfxU32)pipelineList.size(), MFX_EXTBUFF_VPP_SCENE_ANALYSIS ) )
797812
{
798813
newList[index] = MFX_EXTBUFF_VPP_SCENE_ANALYSIS;
@@ -1253,6 +1268,14 @@ mfxStatus GetPipelineList(
12531268
}
12541269
}
12551270

1271+
if( IsFilterFound( &configList[0], configCount, MFX_EXTBUFF_VPP_3DLUT ) && !IsFilterFound(&pipelineList[0], (mfxU32)pipelineList.size(), MFX_EXTBUFF_VPP_3DLUT) )
1272+
{
1273+
if( !IsFilterFound( &pipelineList[0], (mfxU32)pipelineList.size(), MFX_EXTBUFF_VPP_3DLUT ) )
1274+
{
1275+
pipelineList.push_back( MFX_EXTBUFF_VPP_3DLUT );
1276+
}
1277+
}
1278+
12561279
searchCount = sizeof(g_TABLE_CONFIG) / sizeof(*g_TABLE_CONFIG);
12571280
fCount = configCount;
12581281
for(fIdx = 0; fIdx < fCount; fIdx++)
@@ -1404,8 +1427,14 @@ mfxStatus CheckFrameInfo(mfxFrameInfo* info, mfxU32 request, eMFXHWType platform
14041427
}
14051428

14061429
/* checking Height based on PicStruct filed */
1407-
if (MFX_PICSTRUCT_PROGRESSIVE & info->PicStruct ||
1408-
MFX_PICSTRUCT_FIELD_SINGLE & info->PicStruct)
1430+
if (MFX_PICSTRUCT_PROGRESSIVE & info->PicStruct)
1431+
{
1432+
if ((info->Height & 4) !=0)
1433+
{
1434+
return MFX_ERR_INVALID_VIDEO_PARAM;
1435+
}
1436+
}
1437+
else if (MFX_PICSTRUCT_FIELD_SINGLE & info->PicStruct)
14091438
{
14101439
if ((info->Height & 15) !=0)
14111440
{
@@ -2288,6 +2317,11 @@ void ConvertCaps2ListDoUse(MfxHwVideoProcessing::mfxVppCaps& caps, std::vector<m
22882317
list.push_back(MFX_EXTBUFF_VPP_SCALING);
22892318
}
22902319

2320+
if(caps.u3DLut)
2321+
{
2322+
list.push_back(MFX_EXTBUFF_VPP_3DLUT);
2323+
}
2324+
22912325
#if (MFX_VERSION >= 1025)
22922326
if (caps.uChromaSiting)
22932327
{

_studio/shared/include/mfx_utils_defs.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include <vector>
2626
#include <memory>
2727
#include <assert.h>
28-
28+
#define MFX_DEBUG_TRACE
2929
#ifndef MFX_DEBUG_TRACE
3030
#define MFX_STS_TRACE(sts) sts
3131
#else

_studio/shared/include/mfx_vpp_interface.h

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2018-2020 Intel Corporation
1+
// Copyright (c) 2018-2021 Intel Corporation
22
//
33
// Permission is hereby granted, free of charge, to any person obtaining a copy
44
// of this software and associated documentation files (the "Software"), to deal
@@ -186,6 +186,8 @@ namespace MfxHwVideoProcessing
186186

187187
mfxU32 uMirroring;
188188

189+
mfxU32 u3DLut;
190+
189191
mfxVppCaps()
190192
: uAdvancedDI(0)
191193
, uSimpleDI(0)
@@ -213,6 +215,7 @@ namespace MfxHwVideoProcessing
213215
, uChromaSiting(0)
214216
, mFormatSupport()
215217
, uMirroring(0)
218+
, u3DLut(0)
216219
{
217220
};
218221
};
@@ -253,6 +256,15 @@ namespace MfxHwVideoProcessing
253256
}
254257
};
255258

259+
struct Lut3DInfo {
260+
bool Enabled;
261+
mfxMemId MemId;
262+
mfxDataType DataType;
263+
mfxResourceType BufferType;
264+
mfx3DLutMemoryLayout MemLayout;
265+
mfx3DLutChannelMapping ChannelMapping;
266+
};
267+
256268
public:
257269
mfxExecuteParams():
258270
targetSurface()
@@ -328,6 +340,7 @@ namespace MfxHwVideoProcessing
328340

329341
VideoSignalInfo.clear();
330342
VideoSignalInfo.assign(1, VideoSignalInfoIn);
343+
lut3DInfo= {};
331344
};
332345

333346
bool IsDoNothing()
@@ -362,6 +375,7 @@ namespace MfxHwVideoProcessing
362375
#ifdef MFX_ENABLE_MCTF
363376
|| bEnableMctf != false
364377
#endif
378+
|| lut3DInfo.Enabled != false
365379
)
366380
return false;
367381
if (VideoSignalInfoIn != VideoSignalInfoOut)
@@ -457,6 +471,8 @@ namespace MfxHwVideoProcessing
457471
#endif
458472
#endif
459473
bool reset;
474+
475+
Lut3DInfo lut3DInfo;
460476
};
461477

462478
class DriverVideoProcessing

_studio/shared/include/mfx_vpp_vaapi.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2017-2020 Intel Corporation
1+
// Copyright (c) 2017-2021 Intel Corporation
22
//
33
// Permission is hereby granted, free of charge, to any person obtaining a copy
44
// of this software and associated documentation files (the "Software"), to deal
@@ -161,6 +161,9 @@ namespace MfxHwVideoProcessing
161161

162162
UMC::Mutex m_guard;
163163

164+
VAProcFilterCap3DLUT *m_3dlutCaps;
165+
VABufferID m_3dlutFilterID;
166+
164167
mfxStatus Init( _mfxPlatformAccelerationService* pVADisplay, mfxVideoParam *pParams);
165168

166169
mfxStatus Close( void );

0 commit comments

Comments
 (0)