Skip to content

Commit

Permalink
Use EncTool + Noisy Content Check to enable ACQM + dblk (#4244)
Browse files Browse the repository at this point in the history
Co-authored-by: Chandler Brown <david.c.brown@intel.com>
  • Loading branch information
gfxVPLsdm and chandler-brown authored Dec 22, 2022
1 parent db1d804 commit 3af64c8
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,6 @@ inline bool IsBRC(const mfxExtEncToolsConfig &config)
IsOn(config.BRC);
}


inline bool IsEncToolsOptSet(const mfxExtEncToolsConfig& config)
{
return
(config.AdaptiveB | config.AdaptiveI | config.AdaptiveLTR | config.AdaptivePyramidQuantB
| config.AdaptivePyramidQuantP | config.AdaptiveQuantMatrices | config.AdaptiveRefB
| config.AdaptiveRefP | config.BRC | config.BRCBufferHints | config.SceneChange);
}

bool HEVCEHW::Base::IsEncToolsOptOn(const mfxExtEncToolsConfig &config, bool bGameStreaming)
{
return
Expand Down Expand Up @@ -312,7 +303,14 @@ static void SetDefaultConfig(const mfxVideoParam &video, mfxExtEncToolsConfig &c
bool lplaAssistedBRC = IsOn(config.BRC) && isSWLACondition(video);
SetDefaultOpt(config.BRCBufferHints, lplaAssistedBRC);
SetDefaultOpt(config.AdaptiveMBQP, bMBQPSupport && lplaAssistedBRC && IsOn(pExtOpt2->MBBRC));
#ifdef ONEVPL_EXPERIMENTAL
if (IsEncToolsOptSet(config) && pExtOpt3->ContentInfo == MFX_CONTENT_NOISY_VIDEO)
SetDefaultOpt(config.AdaptiveQuantMatrices, true);
else
SetDefaultOpt(config.AdaptiveQuantMatrices, false);
#else
SetDefaultOpt(config.AdaptiveQuantMatrices, false);
#endif
}
#ifdef MFX_ENABLE_ENCTOOLS_LPLA
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,24 @@ namespace Base
bool IsEncToolsOptOn(const mfxExtEncToolsConfig &config, bool bGameStreaming);
bool IsLPLAEncToolsOn(const mfxExtEncToolsConfig &config, bool bGameStreaming);

inline bool IsEncToolsOptSet(const mfxExtEncToolsConfig& config)
{
return
(config.AdaptiveB | config.AdaptiveI | config.AdaptiveLTR | config.AdaptivePyramidQuantB
| config.AdaptivePyramidQuantP | config.AdaptiveQuantMatrices | config.AdaptiveRefB
| config.AdaptiveRefP | config.BRC | config.BRCBufferHints | config.SceneChange);
}

inline int EncToolsDeblockingBetaOffset()
{
return 4; // Currently hard coded to best tested value when using enctools
}

inline int EncToolsDeblockingAlphaTcOffset()
{
return 2; // Currently hard coded to best tested value when using enctools
}

} //Base
} //namespace HEVCEHW

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
#include <numeric>
#include <set>

#ifdef MFX_ENABLE_ENCTOOLS
#include "hevcehw_base_enctools.h"
#endif

using namespace HEVCEHW;
using namespace HEVCEHW::Base;

Expand Down Expand Up @@ -2020,6 +2024,19 @@ class GetDefault
pps.deblocking_filter_control_present_flag = 1;
pps.deblocking_filter_disabled_flag = !!CO2.DisableDeblockingIdc;
pps.deblocking_filter_override_enabled_flag = 1; // to disable deblocking per frame

#if defined(MFX_ENABLE_ENCTOOLS)
#if defined(ONEVPL_EXPERIMENTAL)
const mfxExtEncToolsConfig* pConfig = ExtBuffer::Get(par);
bool bEncTools = IsEncToolsOptSet(*pConfig);

if (bEncTools && CO3.ScenarioInfo != MFX_SCENARIO_GAME_STREAMING && CO3.ContentInfo == MFX_CONTENT_NOISY_VIDEO) {
pps.beta_offset_div2 = mfxI8(EncToolsDeblockingBetaOffset() * 0.5 * !pps.deblocking_filter_disabled_flag);
pps.tc_offset_div2 = mfxI8(EncToolsDeblockingAlphaTcOffset() * 0.5 * !pps.deblocking_filter_disabled_flag);
}
#endif
#endif

pps.scaling_list_data_present_flag = 0;
pps.lists_modification_present_flag = 1;
pps.log2_parallel_merge_level_minus2 = 0;
Expand Down

0 comments on commit 3af64c8

Please sign in to comment.