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

Commit

Permalink
Update API to 1.26
Browse files Browse the repository at this point in the history
Add MCTF, major refactoring of scene change detector, updated samples.
  • Loading branch information
Nabiullin, Oleg committed Mar 22, 2018
1 parent fcddb6b commit 9b5b240
Show file tree
Hide file tree
Showing 197 changed files with 83,237 additions and 34,378 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,8 @@
# Intel® Media SDK open source
**Whats new**
- Add MCTF support
- API 1.26

# Intel® Media SDK open source release v1.3!
**Whats new**
- Add SCD support
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -6,7 +6,7 @@ Intel® Media SDK provides an API to access hardware-accelerated video decode, e
**Supported video pre-processing filters**: Color Conversion, Deinterlace, Denoise, Resize, Rotate

# Important note
The current version of Intel Media SDK compatible with the open source [Linux* Graphics Driver](https://github.com/intel/media-driver) [commit f7662547ab9cec5b98d144b0943067e2251825e8](https://github.com/intel/media-driver/commit/f7662547ab9cec5b98d144b0943067e2251825e8).
The current version of Intel Media SDK compatible with the open source [Linux* Graphics Driver](https://github.com/intel/media-driver).
Intel Media SDK depends on a special version of [LibVA commit df544cd5a31e54d4cbd33a391795a8747ddaf789](https://github.com/01org/libva/commit/df544cd5a31e54d4cbd33a391795a8747ddaf789).

# FAQ
Expand All @@ -30,7 +30,7 @@ Intel Media SDK is licensed under MIT license. See [LICENSE](./LICENSE) for deta
See [CONTRIBUTING](./CONTRIBUTING.md) for details. Thank you!

# System requirements
**Operating System:** CentOS 7.3, Ubuntu 16.04.
**Operating System:** CentOS 7.4, Ubuntu 16.04.
**Hardware:**
Intel platforms with integrated graphics:
- Intel® Xeon® E3-1200 v4 family with C226 chipset
Expand Down
4 changes: 2 additions & 2 deletions _studio/hevc_fei/CMakeLists.txt
Expand Up @@ -25,8 +25,8 @@ set(MFX_ORIG_LDFLAGS "${MFX_LDFLAGS}" )
set(HEVC_FEI_Encoder_HW_GUID "5418a70666f94d5cb4f7b1caee86339b")

# Plugin version info
set (HEVC_FEI_HW_PRODUCT_NAME "Intel(R) Media Server Studio 2017 - HEVC FEI Encode")
set (HEVC_FEI_HW_DESCRIPTION "Intel(R) Media Server Studio 2017 - HEVC FEI Hardware Encode Plug-in")
set (HEVC_FEI_HW_PRODUCT_NAME "Intel(R) Media Server Studio 2018 - HEVC FEI Encode")
set (HEVC_FEI_HW_DESCRIPTION "Intel(R) Media Server Studio 2018 - HEVC FEI Hardware Encode Plug-in")


if( NOT DEFINED ENV{MFX_HEVC_VERSION} )
Expand Down
8 changes: 3 additions & 5 deletions _studio/hevce_hw/h265/include/mfx_h265_encode_hw_ddi.h
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Intel Corporation
// Copyright (c) 2018 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
Expand Down Expand Up @@ -27,7 +27,6 @@

#include "mfx_h265_encode_hw_utils.h"
#include "mfx_h265_encode_hw_bs.h"

#include <memory>
#include <vector>

Expand All @@ -46,14 +45,13 @@ static const GUID DXVA2_Intel_Encode_HEVC_Main =

GUID GetGUID(MfxVideoParam const & par);


mfxStatus HardcodeCaps(ENCODE_CAPS_HEVC& caps, MFXCoreInterface* pCore);

class DriverEncoder;

typedef enum tagENCODER_TYPE
{
ENCODER_DEFAULT = 0,
ENCODER_DEFAULT = 0
} ENCODER_TYPE;

DriverEncoder* CreatePlatformH265Encoder(MFXCoreInterface* core, ENCODER_TYPE type = ENCODER_DEFAULT);
Expand Down Expand Up @@ -96,7 +94,7 @@ class DriverEncoder
virtual
mfxStatus Execute(
Task const &task,
mfxHDL surface) = 0;
mfxHDLPair pair) = 0;

virtual
mfxStatus QueryCompBufferInfo(
Expand Down
9 changes: 7 additions & 2 deletions _studio/hevce_hw/h265/include/mfx_h265_encode_hw_utils.h
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Intel Corporation
// Copyright (c) 2018 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
Expand Down Expand Up @@ -378,6 +378,7 @@ typedef struct _Task : DpbFrame

mfxU16 m_SkipMode;


}Task;

enum
Expand Down Expand Up @@ -455,6 +456,7 @@ namespace ExtBuffer
#if defined(MFX_ENABLE_HEVCE_WEIGHTED_PREDICTION)
EXTBUF(mfxExtPredWeightTable, MFX_EXTBUFF_PRED_WEIGHT_TABLE);
#endif //defined(MFX_ENABLE_HEVCE_WEIGHTED_PREDICTION)

#undef EXTBUF

#define _CopyPar(dst, src, PAR) dst.PAR = src.PAR;
Expand All @@ -471,6 +473,9 @@ namespace ExtBuffer
{
_CopyPar1(PicWidthInLumaSamples);
_CopyPar1(PicHeightInLumaSamples);
#if (MFX_VERSION >= 1026)
_CopyPar1(LCUSize);
#endif
}

inline void CopySupportedParams(mfxExtHEVCTiles& buf_dst, mfxExtHEVCTiles& buf_src)
Expand Down Expand Up @@ -1062,7 +1067,7 @@ mfxStatus GetNativeHandleToRawSurface(
MFXCoreInterface & core,
MfxVideoParam const & video,
Task const & task,
mfxHDL & handle);
mfxHDLPair & handle);

mfxStatus CopyRawSurfaceToVideoMemory(
MFXCoreInterface & core,
Expand Down
4 changes: 2 additions & 2 deletions _studio/hevce_hw/h265/include/mfx_h265_encode_vaapi.h
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Intel Corporation
// Copyright (c) 2018 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
Expand Down Expand Up @@ -221,7 +221,7 @@ mfxStatus SetSkipFrame(
virtual
mfxStatus Execute(
Task const & task,
mfxHDL surface);
mfxHDLPair pair);

virtual
mfxStatus QueryCompBufferInfo(
Expand Down
14 changes: 9 additions & 5 deletions _studio/hevce_hw/h265/src/mfx_h265_encode_hw.cpp
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Intel Corporation
// Copyright (c) 2018 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
Expand Down Expand Up @@ -221,10 +221,11 @@ mfxStatus Plugin::InitImpl(mfxVideoParam *par)

m_ddi.reset( CreateHWh265Encoder(&m_core, ddiType) );
MFX_CHECK(m_ddi.get(), MFX_ERR_UNSUPPORTED);
GUID encoder_guid = GetGUID(m_vpar);

sts = m_ddi->CreateAuxilliaryDevice(
&m_core,
GetGUID(m_vpar),
encoder_guid,
m_vpar.m_ext.HEVCParam.PicWidthInLumaSamples,
m_vpar.m_ext.HEVCParam.PicHeightInLumaSamples);
MFX_CHECK(MFX_SUCCEEDED(sts), MFX_ERR_DEVICE_FAILED);
Expand Down Expand Up @@ -648,6 +649,8 @@ mfxStatus Plugin::Reset(mfxVideoParam *par)
sts = CheckHeaders(parNew, m_caps);
MFX_CHECK_STS(sts);

MFX_CHECK(m_vpar.LCUSize == parNew.LCUSize, MFX_ERR_INCOMPATIBLE_VIDEO_PARAM); // LCU Size Can't be changed

MFX_CHECK(
parNew.mfx.CodecId == MFX_CODEC_HEVC
&& m_vpar.AsyncDepth == parNew.AsyncDepth
Expand Down Expand Up @@ -750,7 +753,8 @@ mfxStatus Plugin::Reset(mfxVideoParam *par)
}

if (brcReset &&
m_vpar.mfx.RateControlMethod == MFX_RATECONTROL_CBR)
m_vpar.mfx.RateControlMethod == MFX_RATECONTROL_CBR &&
(parNew.HRDConformance || !isIdrRequired))
return MFX_ERR_INCOMPATIBLE_VIDEO_PARAM;

// waiting for submitted in driver tasks
Expand Down Expand Up @@ -1024,7 +1028,7 @@ mfxStatus Plugin::Execute(mfxThreadTask thread_task, mfxU32 /*uid_p*/, mfxU32 /*
sts = CodeAsSkipFrame(m_core,m_vpar,*taskForExecute,m_rawSkip, m_rec);
MFX_CHECK_STS(sts);
}
sts = GetNativeHandleToRawSurface(m_core, m_vpar, *taskForExecute, surfaceHDL.first);
sts = GetNativeHandleToRawSurface(m_core, m_vpar, *taskForExecute, surfaceHDL);
MFX_CHECK_STS(sts);

if (!IsFrameToSkip(*taskForExecute, m_rec, m_vpar.isSWBRC()))
Expand All @@ -1034,7 +1038,7 @@ mfxStatus Plugin::Execute(mfxThreadTask thread_task, mfxU32 /*uid_p*/, mfxU32 /*
}
ExtraTaskPreparation(*taskForExecute);

sts = m_ddi->Execute(*taskForExecute, surfaceHDL.first);
sts = m_ddi->Execute(*taskForExecute, surfaceHDL);
MFX_CHECK_STS(sts);

m_task.SubmitForQuery(taskForExecute);
Expand Down
31 changes: 16 additions & 15 deletions _studio/hevce_hw/h265/src/mfx_h265_encode_hw_par.cpp
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Intel Corporation
// Copyright (c) 2018 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
Expand Down Expand Up @@ -766,7 +766,6 @@ mfxU32 GetDefaultLCUSize(MfxVideoParam const & par,
return LCUSize;
}


#ifdef MFX_ENABLE_HEVCE_ROI
mfxStatus CheckAndFixRoi(MfxVideoParam const & par, ENCODE_CAPS_HEVC const & caps, mfxExtEncoderROI *ROI, bool &bROIViaMBQP)
{
Expand Down Expand Up @@ -1140,7 +1139,7 @@ mfxStatus CheckVideoParam(MfxVideoParam& par, ENCODE_CAPS_HEVC const & caps, boo
changed += CheckTriStateOption(par.mfx.LowPower);

if (!par.LCUSize)
par.LCUSize = GetDefaultLCUSize(par, caps);
par.LCUSize = GetDefaultLCUSize(par, caps); // that a local copy of actual value;

if (caps.BitDepth8Only == 0) // 10-bit supported
{
Expand Down Expand Up @@ -1219,7 +1218,7 @@ mfxStatus CheckVideoParam(MfxVideoParam& par, ENCODE_CAPS_HEVC const & caps, boo
if (par.mfx.TargetUsage && caps.TUSupport)
changed += CheckTU(caps.TUSupport, par.mfx.TargetUsage);

changed += CheckMax(par.mfx.GopRefDist, (caps.SliceIPOnly || IsOn(par.mfx.LowPower)) ? 1 : (par.mfx.GopPicSize ? par.mfx.GopPicSize - 1 : 0xFFFF));
changed += CheckMax(par.mfx.GopRefDist, (caps.SliceIPOnly || IsOn(par.mfx.LowPower)) ? 1 : (par.mfx.GopPicSize ? Max(1, par.mfx.GopPicSize - 1) : 0xFFFF));

invalid += CheckOption(par.Protected
, 0);
Expand Down Expand Up @@ -1274,7 +1273,7 @@ mfxStatus CheckVideoParam(MfxVideoParam& par, ENCODE_CAPS_HEVC const & caps, boo
if (caps.MBBRCSupport == 0 || par.mfx.RateControlMethod == MFX_RATECONTROL_CQP ||par.isSWBRC())
changed += CheckOption(par.m_ext.CO2.MBBRC, (mfxU32)MFX_CODINGOPTION_OFF, 0);
else
changed += CheckOption(par.m_ext.CO2.MBBRC, (mfxU32)MFX_CODINGOPTION_ON, 0);
changed += CheckOption(par.m_ext.CO2.MBBRC, (mfxU32)MFX_CODINGOPTION_ON, (mfxU32)MFX_CODINGOPTION_OFF, 0);


if (IsOn(par.m_ext.CO2.ExtBRC) && par.mfx.RateControlMethod != 0 && par.mfx.RateControlMethod != MFX_RATECONTROL_CBR && par.mfx.RateControlMethod != MFX_RATECONTROL_VBR)
Expand Down Expand Up @@ -1442,7 +1441,8 @@ mfxStatus CheckVideoParam(MfxVideoParam& par, ENCODE_CAPS_HEVC const & caps, boo
mfxU32 nLCU = CeilDiv(par.m_ext.HEVCParam.PicHeightInLumaSamples, par.LCUSize) * CeilDiv(par.m_ext.HEVCParam.PicWidthInLumaSamples, par.LCUSize);
mfxU32 nTile = Max<mfxU32>(par.m_ext.HEVCTiles.NumTileColumns, 1) * Max<mfxU32>(par.m_ext.HEVCTiles.NumTileRows, 1);

changed += CheckRange(par.m_ext.CO2.NumMbPerSlice, 0, nLCU / nTile);
mfxU32 minNumMbPerSlice = CeilDiv(nLCU, MAX_SLICES) / nTile;
changed += CheckRange(par.m_ext.CO2.NumMbPerSlice, minNumMbPerSlice, nLCU / nTile);
}

changed += CheckOption(par.mfx.NumSlice, MakeSlices(par, caps.SliceStructure), 0);
Expand Down Expand Up @@ -1591,11 +1591,13 @@ mfxStatus CheckVideoParam(MfxVideoParam& par, ENCODE_CAPS_HEVC const & caps, boo
}
}

//check Active Reference

{
mfxU16 maxForward = Min<mfxU16>(caps.MaxNum_Reference0, maxDPB);
mfxU16 maxBackward = Min<mfxU16>(caps.MaxNum_Reference1, maxDPB);


changed += CheckMax(par.m_ext.DDI.NumActiveRefP, maxForward);
changed += CheckMax(par.m_ext.DDI.NumActiveRefBL0, maxForward);
changed += CheckMax(par.m_ext.DDI.NumActiveRefBL1, maxBackward);
Expand Down Expand Up @@ -1766,8 +1768,7 @@ void SetDefaults(
mfxExtCodingOption2& CO2 = par.m_ext.CO2;
mfxExtCodingOption3& CO3 = par.m_ext.CO3;

if (!par.LCUSize)
par.LCUSize = GetDefaultLCUSize(par, hwCaps);


if (par.mfx.CodecLevel)
{
Expand Down Expand Up @@ -1917,7 +1918,6 @@ void SetDefaults(




if (!par.mfx.GopRefDist)
{
if (par.isTL() || hwCaps.SliceIPOnly || IsOn(par.mfx.LowPower) || par.mfx.GopPicSize < 3 || par.mfx.NumRefFrame == 1)
Expand All @@ -1934,9 +1934,6 @@ void SetDefaults(
par.m_ext.CO2.BRefType = MFX_B_REF_OFF;
}

if (par.m_ext.CO2.ExtBRC == MFX_CODINGOPTION_UNKNOWN)
par.m_ext.CO2.ExtBRC = MFX_CODINGOPTION_OFF;

{
// calculate ActiveReference

Expand Down Expand Up @@ -1965,8 +1962,9 @@ void SetDefaults(
if (!RefActiveBL1)
RefActiveBL1 = (par.mfx.TargetUsage == 7) ? 1 :
par.mfx.NumRefFrame ? Min<mfxU16>(hwCaps.MaxNum_Reference1, par.mfx.NumRefFrame) : hwCaps.MaxNum_Reference1;

//set ActiveReference


//set ActiveReference

if (!par.m_ext.DDI.NumActiveRefP)
par.m_ext.DDI.NumActiveRefP = RefActiveP;
Expand Down Expand Up @@ -2017,6 +2015,9 @@ void SetDefaults(
par.mfx.NumRefFrame = Min(maxDPB, par.mfx.NumRefFrame);
}
}
if (par.m_ext.CO2.ExtBRC == MFX_CODINGOPTION_UNKNOWN)
par.m_ext.CO2.ExtBRC = MFX_CODINGOPTION_OFF;

if (par.m_ext.CO3.PRefType == MFX_P_REF_DEFAULT)
{
if (par.mfx.GopRefDist == 1 && (par.mfx.RateControlMethod == MFX_RATECONTROL_CQP || par.isSWBRC()))
Expand Down Expand Up @@ -2078,7 +2079,7 @@ void SetDefaults(
if (IsOff(CO3.EnableQPOffset))
Zero(CO3.QPOffset);




if (CO3.EnableMBQP == 0)
Expand Down
19 changes: 11 additions & 8 deletions _studio/hevce_hw/h265/src/mfx_h265_encode_hw_utils.cpp
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Intel Corporation
// Copyright (c) 2018 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
Expand Down Expand Up @@ -109,6 +109,7 @@ mfxU8 GetPFrameLevel(mfxU32 i, mfxU32 num)
}
return (mfxU8)level;
}

mfxU8 PLayer(
mfxU32 order, // (task.m_poc - prevTask.m_lastIPoc)
MfxVideoParam const & par)
Expand Down Expand Up @@ -420,25 +421,26 @@ mfxStatus GetNativeHandleToRawSurface(
MFXCoreInterface & core,
MfxVideoParam const & video,
Task const & task,
mfxHDL & nativeHandle)
mfxHDLPair & handle)
{
mfxStatus sts = MFX_ERR_NONE;
mfxFrameAllocator & fa = core.FrameAllocator();
mfxExtOpaqueSurfaceAlloc const & opaq = video.m_ext.Opaque;
mfxFrameSurface1 * surface = task.m_surf_real;

nativeHandle = 0;
Zero(handle);
mfxHDL * nativeHandle = &handle.first;

if ( video.IOPattern == MFX_IOPATTERN_IN_SYSTEM_MEMORY
|| (video.IOPattern == MFX_IOPATTERN_IN_OPAQUE_MEMORY && (opaq.In.Type & MFX_MEMTYPE_SYSTEM_MEMORY)))
sts = fa.GetHDL(fa.pthis, task.m_midRaw, &nativeHandle);
sts = fa.GetHDL(fa.pthis, task.m_midRaw, nativeHandle);
else if ( video.IOPattern == MFX_IOPATTERN_IN_VIDEO_MEMORY
|| video.IOPattern == MFX_IOPATTERN_IN_OPAQUE_MEMORY)
{
if (task.m_midRaw == NULL)
sts = core.GetFrameHandle(&surface->Data, &nativeHandle);
sts = core.GetFrameHandle(&surface->Data, nativeHandle);
else
sts = fa.GetHDL(fa.pthis, task.m_midRaw, &nativeHandle);
sts = fa.GetHDL(fa.pthis, task.m_midRaw, nativeHandle);
}
else
return (MFX_ERR_UNDEFINED_BEHAVIOR);
Expand Down Expand Up @@ -697,7 +699,6 @@ mfxStatus MfxVideoParam::GetExtBuffers(mfxVideoParam& par, bool query)
ExtBuffer::Set(par, m_ext.CO);
ExtBuffer::Set(par, m_ext.CO2);
ExtBuffer::Set(par, m_ext.CO3);

ExtBuffer::Set(par, m_ext.ResetOpt);

if (ExtBuffer::Set(par, m_ext.DDI))
Expand Down Expand Up @@ -1619,6 +1620,7 @@ void MfxVideoParam::SyncMfxToHeadersParam(mfxU32 numSlicesForSTRPSOpt)
}



Zero(m_pps);
m_pps.seq_parameter_set_id = m_sps.seq_parameter_set_id;

Expand Down Expand Up @@ -1708,6 +1710,7 @@ void MfxVideoParam::SyncMfxToHeadersParam(mfxU32 numSlicesForSTRPSOpt)
m_pps.log2_parallel_merge_level_minus2 = 0;
m_pps.slice_segment_header_extension_present_flag = 0;


}

mfxU16 FrameType2SliceType(mfxU32 ft)
Expand Down Expand Up @@ -2113,7 +2116,7 @@ mfxStatus MfxVideoParam::GetSliceHeader(Task const & task, Task const & prevTask
}
}

s.loop_filter_across_slices_enabled_flag = 0;
s.loop_filter_across_slices_enabled_flag = m_pps.loop_filter_across_slices_enabled_flag;

if (m_pps.tiles_enabled_flag || m_pps.entropy_coding_sync_enabled_flag)
{
Expand Down

0 comments on commit 9b5b240

Please sign in to comment.