Skip to content

Commit

Permalink
Remove All SW EncTools/Linux ACQM Code from Non-Enctools (#5788)
Browse files Browse the repository at this point in the history
Co-authored-by: Chandler Brown <[email protected]>
  • Loading branch information
gfxVPLsdm and chandler-brown authored Sep 11, 2023
1 parent b8316ff commit 240eb35
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 25 deletions.
2 changes: 2 additions & 0 deletions _studio/mfx_lib/encode_hw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ if (MFX_ENABLE_H265_VIDEO_ENCODE)
hevc/linux/base/hevcehw_base_roi_lin.h
hevc/linux/base/hevcehw_base_va_lin.h
hevc/linux/base/hevcehw_base_va_packer_lin.h
hevc/linux/base/hevcehw_base_enctools_qmatrix_lin.h
hevc/linux/base/hevcehw_base_weighted_prediction_lin.h
hevc/linux/base/hevcehw_base_max_frame_size_lin.h
hevc/linux/base/hevcehw_base_dirty_rect_lin.h
Expand Down Expand Up @@ -134,6 +135,7 @@ if (MFX_ENABLE_H265_VIDEO_ENCODE)
hevc/linux/base/hevcehw_base_va_lin.cpp
hevc/linux/base/hevcehw_base_va_packer_lin.cpp
hevc/linux/base/hevcehw_base_weighted_prediction_lin.cpp
hevc/linux/base/hevcehw_base_enctools_qmatrix_lin.cpp
hevc/linux/base/hevcehw_base_max_frame_size_lin.cpp
hevc/linux/base/hevcehw_base_dirty_rect_lin.cpp
hevc/linux/base/hevcehw_base_rext_lin.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ void Legacy::SetSupported(ParamSupport& blocks)
MFX_COPY_FIELD(LowDelayBRC);
MFX_COPY_FIELD(BRCPanicMode);
MFX_COPY_FIELD(ScenarioInfo);
MFX_COPY_FIELD(ContentInfo);
MFX_COPY_FIELD(AdaptiveCQM);
});
blocks.m_ebCopyPtrs[MFX_EXTBUFF_CODING_OPTION_SPSPPS].emplace_back(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1984,12 +1984,14 @@ mfxStatus Packer::Reset(
sts = PackHeader(rbsp, pESBegin, pESEnd, ph.PPS);
MFX_CHECK_STS(sts);
pESBegin += ph.PPS.BitLen / 8;
bool bPackedCqmPPS = false;

// Pack cqm PPS header for adaptive cqm.
if (m_pGlob->Contains(CC::Key) &&
if (!bPackedCqmPPS && m_pGlob->Contains(CC::Key) &&
CC::Get(*m_pGlob).PackAdaptiveCqmHeader &&
CC::Get(*m_pGlob).PackAdaptiveCqmHeader(m_pGlob))
{
bPackedCqmPPS = true;
ph.CqmPPS.resize(CQM_HINT_NUM_CUST_MATRIX);
for (mfxU8 idx = 0; idx < CQM_HINT_NUM_CUST_MATRIX && idx < cqmpps.size(); idx++)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) 2019-2022 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_H265_VIDEO_ENCODE)
#endif // defined(MFX_ENABLE_H265_VIDEO_ENCODE)
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright (c) 2019-2022 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.

#pragma once

#include "mfx_common.h"
#include <deque>

#include "hevcehw_base.h"
#include "hevcehw_base_data.h"

#if defined(MFX_ENABLE_H265_VIDEO_ENCODE)
#endif // defined(MFX_ENABLE_H265_VIDEO_ENCODE)
11 changes: 0 additions & 11 deletions _studio/mfx_lib/encode_hw/hevc/linux/base/hevcehw_base_lin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@
#if defined(MFX_ENABLE_HEVCE_WEIGHTED_PREDICTION)
#include "hevcehw_base_weighted_prediction_lin.h"
#endif
#if defined (MFX_ENABLE_HEVC_CUSTOM_QMATRIX)
#include "hevcehw_base_qmatrix_lin.h"
#endif
#if defined(MFX_ENABLE_HEVCE_ROI)
#include "hevcehw_base_roi_lin.h"
#endif
Expand Down Expand Up @@ -92,9 +89,6 @@ Linux::Base::MFXVideoENCODEH265_HW::MFXVideoENCODEH265_HW(
#if defined(MFX_ENABLE_HEVCE_WEIGHTED_PREDICTION)
m_features.emplace_back(new WeightPred(FEATURE_WEIGHTPRED));
#endif //defined(MFX_ENABLE_HEVCE_WEIGHTED_PREDICTION)
#if defined (MFX_ENABLE_HEVC_CUSTOM_QMATRIX)
m_features.emplace_back(new QMatrix(FEATURE_QMATRIX));
#endif
#if defined(MFX_ENABLE_HEVCE_ROI)
m_features.emplace_back(new ROI(FEATURE_ROI));
#endif
Expand Down Expand Up @@ -137,11 +131,6 @@ mfxStatus Linux::Base::MFXVideoENCODEH265_HW::Init(mfxVideoParam *par)
}
{
auto& queue = BQ<BQ_SubmitTask>::Get(*this);
#if defined (MFX_ENABLE_HEVC_CUSTOM_QMATRIX)
Reorder(queue
, { FEATURE_DDI, IDDI::BLK_SubmitTask }
, { FEATURE_QMATRIX, QMatrix::BLK_PatchDDITask });
#endif //defined(MFX_ENABLE_HEVC_CUSTOM_QMATRIX)
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -910,14 +910,6 @@ void VAPacker::SubmitTask(const FeatureBlocks& /*blocks*/, TPushST Push)
AddPackedHeaderIf(!!(task.InsertHeaders & INSERT_PPS)
, ph.PPS, par, VAEncPackedHeaderHEVC_PPS);

if (cc.PackAdaptiveCqmPPS && cc.PackAdaptiveCqmPPS(global, s_task))
{
for (mfxU32 i = 0; i < CQM_HINT_NUM_CUST_MATRIX; ++i)
{
AddPackedHeaderIf(true, ph.CqmPPS.at(i), par, VAEncPackedHeaderHEVC_PPS);
}
}

AddPackedHeaderIf((!!(task.InsertHeaders & INSERT_SEI) || task.ctrl.NumPayload) && ph.PrefixSEI.BitLen
, ph.PrefixSEI, par/*, VAEncPackedHeaderHEVC_SEI*/);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,6 @@ class VAPacker
, const VACodedBufferSegment&>;
TUpdateCqmHint UpdateCqmHint;

using TPackAdaptiveCqmPPS = CallChain<bool
, const StorageR& //global
, const StorageR&>; //task
TPackAdaptiveCqmPPS PackAdaptiveCqmPPS;

using TUpdateEncQP = CallChain<void
, const StorageR&
, TaskCommonPar&
Expand Down

0 comments on commit 240eb35

Please sign in to comment.