Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SG2 HEVC VDENC 422 OBSCURATION #1642

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -561,12 +561,6 @@ MOS_STATUS CodechalVdencHevcStateG12::PlatformCapabilityCheck()
CODECHAL_ENCODE_CHK_STATUS_MESSAGE_RETURN(eStatus, "12bit encoding is not supported on VDENC");
}

if (m_hevcSeqParams->chroma_format_idc == 2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file is for TGL, please not touch it.

{
eStatus = MOS_STATUS_INVALID_PARAMETER;
CODECHAL_ENCODE_CHK_STATUS_MESSAGE_RETURN(eStatus, "422 recon format encoding is not supported on HEVC VDENC");
}

// TU configuration for RDOQ
if (m_hevcRdoqEnabled)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ MOS_STATUS CodechalInterfacesXe_Hpm::Initialize(

if (CodecHalIsDecode(CodecFunction))
{
if(osInterface->bHcpDecScalabilityMode = MOS_SCALABILITY_ENABLE_MODE_USER_FORCE)
if(osInterface->bHcpDecScalabilityMode == MOS_SCALABILITY_ENABLE_MODE_USER_FORCE)
{
disableScalability = false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#include "encode_hevc_vdenc_feature_manager_xe_hpm.h"
#include "encode_hevc_vdenc_scc.h"
#include "encode_hevc_basic_feature_rsvd.h"
namespace encode
{
MOS_STATUS EncodeHevcVdencFeatureManagerXe_Hpm::CreateFeatures(void *constSettings)
Expand Down Expand Up @@ -54,19 +55,17 @@ MOS_STATUS EncodeHevcVdencFeatureManagerXe_Hpm::CheckFeatures(void* params)
PCODEC_HEVC_ENCODE_SEQUENCE_PARAMS hevcSeqParams =
static_cast<PCODEC_HEVC_ENCODE_SEQUENCE_PARAMS>(encodeParams->pSeqParams);
ENCODE_CHK_NULL_RETURN(hevcSeqParams);

#ifdef _ENCODE_RESERVED
PCODEC_HEVC_ENCODE_PICTURE_PARAMS hevcPicParams =
static_cast<PCODEC_HEVC_ENCODE_PICTURE_PARAMS>(encodeParams->pPicParams);
ENCODE_CHK_NULL_RETURN(hevcPicParams);
if (m_basicFeature->m_rsvdState)
{
ENCODE_CHK_STATUS_RETURN(m_basicFeature->m_rsvdState->Init(hevcSeqParams));
ENCODE_CHK_STATUS_RETURN(m_basicFeature->m_rsvdState->Init(hevcSeqParams,hevcPicParams));
}
#endif

if (MEDIA_IS_WA(waTable, WaEnableOnlyASteppingFeatures))
{
PCODEC_HEVC_ENCODE_PICTURE_PARAMS hevcPicParams =
static_cast<PCODEC_HEVC_ENCODE_PICTURE_PARAMS>(encodeParams->pPicParams);
ENCODE_CHK_NULL_RETURN(hevcPicParams);

ENCODE_CHK_STATUS_RETURN(ValidateASteppingNotSupportedFeatures(hevcSeqParams, hevcPicParams));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@

media_include_subdirectory(features)
media_include_subdirectory(pipeline)
media_include_subdirectory(packet)
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@
#include "encode_huc_la_init_packet.h"
#include "encode_huc_la_update_packet.h"

#ifdef _ENCODE_RESERVED

#include "encode_hevc_vdenc_packet_rsvd.h"
#include "encode_hevc_vdenc_packet_xe_hpm_ext.h"
#endif

namespace encode {

Expand Down Expand Up @@ -85,10 +83,9 @@ MOS_STATUS HevcVdencPipelineXe_Hpm::Init(void *settings)
return vdencPkt == nullptr ? nullptr : MOS_New(HevcVdencTileRowPkt, task, vdencPkt);
});

#ifdef _ENCODE_RESERVED
RegisterPacket(hevcVdencPacketRsvd, [=]() -> MediaPacket * { return MOS_New(HevcVdencPktRsvd, this, task, m_hwInterface); });
#endif

RegisterPacket(hevcVdencPacketRsvd, [=]() -> MediaPacket * { return MOS_New(HevcVdencPktRsvd, this, task, m_hwInterface); });

return MOS_STATUS_SUCCESS;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,11 @@ namespace encode
{
HevcBasicFeature::~HevcBasicFeature()
{
#ifdef _ENCODE_RESERVED
if (m_rsvdState)
{
MOS_Delete(m_rsvdState);
m_rsvdState = nullptr;
}
#endif
}

MOS_STATUS HevcBasicFeature::Init(void *setting)
Expand Down Expand Up @@ -107,9 +105,9 @@ MOS_STATUS HevcBasicFeature::Init(void *setting)
#endif // _DEBUG || _RELEASE_INTERNAL
m_hevcRDOQPerfDisabled = outValue.Get<bool>();

#ifdef _ENCODE_RESERVED

ENCODE_CHK_STATUS_RETURN(InitRsvdState());
#endif


return MOS_STATUS_SUCCESS;
}
Expand All @@ -125,6 +123,7 @@ MOS_STATUS HevcBasicFeature::Update(void *params)

m_hevcSeqParams = static_cast<PCODEC_HEVC_ENCODE_SEQUENCE_PARAMS>(encodeParams->pSeqParams);
ENCODE_CHK_NULL_RETURN(m_hevcSeqParams);

m_hevcPicParams = static_cast<PCODEC_HEVC_ENCODE_PICTURE_PARAMS>(encodeParams->pPicParams);
ENCODE_CHK_NULL_RETURN(m_hevcPicParams);
m_hevcSliceParams = static_cast<PCODEC_HEVC_ENCODE_SLICE_PARAMS>(encodeParams->pSliceParams);
Expand All @@ -135,12 +134,10 @@ MOS_STATUS HevcBasicFeature::Update(void *params)
ENCODE_CHK_NULL_RETURN(m_nalUnitParams);
m_NumNalUnits = encodeParams->uiNumNalUnits;

#ifdef _ENCODE_RESERVED
if (m_rsvdState && m_rsvdState->GetFeatureRsvdFlag())
{
ENCODE_CHK_STATUS_RETURN(m_rsvdState->UpdateRsvdFormat(m_hevcSeqParams, m_outputChromaFormat, m_reconSurface.Format, m_is10Bit));
}
#endif

if (encodeParams->bAcceleratorHeaderPackingCaps)
{
Expand Down Expand Up @@ -353,12 +350,10 @@ MOS_STATUS HevcBasicFeature::UpdateTrackedBufferParameters()
ENCODE_CHK_STATUS_RETURN(m_trackedBuf->RegisterParam(encode::BufferType::mvTemporalBuffer, allocParams));
}

#ifdef _ENCODE_RESERVED
if (m_rsvdState && m_rsvdState->GetFeatureRsvdFlag())
{
ENCODE_CHK_STATUS_RETURN(m_rsvdState->RegisterMbCodeBuffer(m_trackedBuf, m_isMbCodeRegistered, m_mbCodeSize));
}
#endif

ENCODE_CHK_STATUS_RETURN(EncodeBasicFeature::UpdateTrackedBufferParameters());

Expand Down Expand Up @@ -648,7 +643,6 @@ MOS_STATUS HevcBasicFeature::SetRoundingValues()
return eStatus;
}

#ifdef _ENCODE_RESERVED
MOS_STATUS HevcBasicFeature::InitRsvdState()
{
ENCODE_FUNC_CALL();
Expand All @@ -658,7 +652,6 @@ MOS_STATUS HevcBasicFeature::InitRsvdState()

return MOS_STATUS_SUCCESS;
}
#endif

MOS_STATUS HevcBasicFeature::GetSurfaceMmcInfo(PMOS_SURFACE surface, MOS_MEMCOMP_STATE &mmcState, uint32_t &compressionFormat) const
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@
#include "mhw_vdbox_vdenc_itf.h"
#include "mhw_vdbox_hcp_itf.h"
#include "encode_mem_compression.h"

#ifdef _ENCODE_RESERVED
#include "encode_hevc_basic_feature_rsvd.h"
#endif

namespace encode
{
#define CODECHAL_HEVC_VDENC_LCU_SIZE 64
Expand Down Expand Up @@ -139,10 +135,8 @@ class HevcBasicFeature : public EncodeBasicFeature, public mhw::vdbox::vdenc::It

uint32_t m_picStateCmdStartInBytes = 0; //!< Offset of PIC_STATE cmd in batch buffer

#ifdef _ENCODE_RESERVED
HevcBasicFeatureRsvd *m_rsvdState = nullptr;
MOS_STATUS InitRsvdState();
#endif

std::deque<uint32_t> m_recycleBufferIdxes;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/*
* Copyright (c) 2021, Intel Corporation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please modify copyright 2021 -> 2023. And same for other new files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Yes, ill delete the embargo rsvd files.
  2. Yes, ill rename the file.
    Thanks for you reminder.

*
* 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.
*/
//!
//! \file encode_hevc_basic_feature_rsvd.cpp
//! \brief Defines the common interface for encode hevc basic feature rsvd
//!
#include "encode_hevc_basic_feature_rsvd.h"

namespace encode
{
MOS_STATUS HevcBasicFeatureRsvd::Init(PCODEC_HEVC_ENCODE_SEQUENCE_PARAMS hevcSeqParams, PCODEC_HEVC_ENCODE_PICTURE_PARAMS hevcPicParams)
{
ENCODE_FUNC_CALL();

ENCODE_CHK_NULL_RETURN(hevcSeqParams);
ENCODE_CHK_NULL_RETURN(hevcPicParams);
if (hevcSeqParams->chroma_format_idc == HCP_CHROMA_FORMAT_YUV422)
{
m_is422WA = true;
}

if (m_is422WA && hevcPicParams->tiles_enabled_flag )
{
ENCODE_ASSERTMESSAGE(" 422 with multi tiles is not supported.");
return MOS_STATUS_INVALID_PARAMETER;
}

return MOS_STATUS_SUCCESS;
}

MOS_STATUS HevcBasicFeatureRsvd::RegisterMbCodeBuffer(TrackedBuffer *trackedBuf, bool &isRegistered, uint32_t mbCodeSize)
{
ENCODE_FUNC_CALL();

ENCODE_CHK_NULL_RETURN(trackedBuf);

MOS_ALLOC_GFXRES_PARAMS allocParamsForLinear;
MOS_ZeroMemory(&allocParamsForLinear, sizeof(MOS_ALLOC_GFXRES_PARAMS));
allocParamsForLinear.Type = MOS_GFXRES_BUFFER;
allocParamsForLinear.TileType = MOS_TILE_LINEAR;
allocParamsForLinear.Format = Format_Buffer;
allocParamsForLinear.dwMemType = MOS_MEMPOOL_SYSTEMMEMORY;
allocParamsForLinear.Flags.bCacheable = true;
// set the ResUsageType to enable coherency in gmm
allocParamsForLinear.ResUsageType = MOS_HW_RESOURCE_USAGE_ENCODE_OUTPUT_BITSTREAM;

if (mbCodeSize > 0)
{
allocParamsForLinear.pBufName = "mbCodeBuffer";
allocParamsForLinear.dwBytes = mbCodeSize + 8 * CODECHAL_CACHELINE_SIZE;
ENCODE_CHK_STATUS_RETURN(trackedBuf->RegisterParam(encode::BufferType::mbCodedBuffer, allocParamsForLinear));
isRegistered = true;
}

return MOS_STATUS_SUCCESS;
}

MOS_STATUS HevcBasicFeatureRsvd::UpdateRsvdFormat(PCODEC_HEVC_ENCODE_SEQUENCE_PARAMS hevcSeqParams, uint8_t &outputChromaFormat, MOS_FORMAT &reconFormat, bool is10Bit)
{
ENCODE_FUNC_CALL();

ENCODE_CHK_NULL_RETURN(hevcSeqParams);
hevcSeqParams->chroma_format_idc =
outputChromaFormat = HCP_CHROMA_FORMAT_YUV420;
reconFormat = is10Bit ? Format_P010 : Format_NV12;

return MOS_STATUS_SUCCESS;
}

MOS_STATUS HevcBasicFeatureRsvd::RevertRsvdFormat(PCODEC_HEVC_ENCODE_SEQUENCE_PARAMS hevcSeqParams, uint8_t &outputChromaFormat, MOS_FORMAT &reconFormat, bool is10Bit)
{
ENCODE_FUNC_CALL();

ENCODE_CHK_NULL_RETURN(hevcSeqParams);
hevcSeqParams->chroma_format_idc =
outputChromaFormat = HCP_CHROMA_FORMAT_YUV422;
reconFormat = is10Bit ? Format_Y216 : Format_YUY2;

return MOS_STATUS_SUCCESS;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright (c) 2021, 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.
*/
//!
//! \file encode_hevc_basic_feature_rsvd.h
//! \brief Defines the common interface for encode hevc basic feature rsvd
//!
#ifndef __ENCODE_HEVC_BASIC_FEATURE_RSVD_H__
#define __ENCODE_HEVC_BASIC_FEATURE_RSVD_H__

#include "encode_basic_feature.h"

namespace encode
{
class HevcBasicFeatureRsvd
{
public:
HevcBasicFeatureRsvd() { };

~HevcBasicFeatureRsvd() { };

bool GetFeatureRsvdFlag(){ return m_is422WA; }

MOS_STATUS Init(PCODEC_HEVC_ENCODE_SEQUENCE_PARAMS hevcSeqParams, PCODEC_HEVC_ENCODE_PICTURE_PARAMS hevcPicParams);

MOS_STATUS RegisterMbCodeBuffer(TrackedBuffer *trackedBuf, bool &isRegistered, uint32_t mbCodeSize);

MOS_STATUS UpdateRsvdFormat(PCODEC_HEVC_ENCODE_SEQUENCE_PARAMS hevcSeqParams, uint8_t &outputChromaFormat, MOS_FORMAT &reconFormat, bool is10Bit);

MOS_STATUS RevertRsvdFormat(PCODEC_HEVC_ENCODE_SEQUENCE_PARAMS hevcSeqParams, uint8_t &outputChromaFormat, MOS_FORMAT &reconFormat, bool is10Bit);

protected:
bool m_is422WA = false;

MEDIA_CLASS_DEFINE_END(encode__HevcBasicFeatureRsvd)
};
}

#endif // !__ENCODE_BASIC_FEATURE_RSVD_H__
Original file line number Diff line number Diff line change
Expand Up @@ -280,14 +280,14 @@ MOS_STATUS EncodeHevcVdencFeatureManager::ValidatePassNum(

auto brcFeature = dynamic_cast<HEVCEncodeBRC *>(GetFeature(HevcFeatureIDs::hevcBrcFeature));

#ifdef _ENCODE_RESERVED

auto basicFeature = dynamic_cast<HevcBasicFeature *>(GetFeature(FeatureIDs::basicFeature));
ENCODE_CHK_NULL_RETURN(basicFeature);
if (basicFeature->m_rsvdState && basicFeature->m_rsvdState->GetFeatureRsvdFlag())
{
hevcPicParams->BRCPrecision = 1;
}
#endif


// dynamic slice size control and brc to be added later here
if (((hevcPicParams->weighted_pred_flag ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ set(TMP_SOURCES_
${CMAKE_CURRENT_LIST_DIR}/encode_hevc_vdenc_scc.cpp
${CMAKE_CURRENT_LIST_DIR}/encode_vdenc_lpla_analysis.cpp
${CMAKE_CURRENT_LIST_DIR}/encode_hevc_vdenc_lpla_enc.cpp
${CMAKE_CURRENT_LIST_DIR}/encode_hevc_basic_feature_rsvd.cpp
)

set(TMP_HEADERS_
Expand All @@ -50,6 +51,7 @@ set(TMP_HEADERS_
${CMAKE_CURRENT_LIST_DIR}/encode_hevc_vdenc_scc.h
${CMAKE_CURRENT_LIST_DIR}/encode_vdenc_lpla_analysis.h
${CMAKE_CURRENT_LIST_DIR}/encode_hevc_vdenc_lpla_enc.h
${CMAKE_CURRENT_LIST_DIR}/encode_hevc_basic_feature_rsvd.h
)
endif()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,7 @@ namespace encode
}
}
else if (m_osInterface->bInlineCodecStatusUpdate
#ifdef _ENCODE_RESERVED
&& !(m_basicFeature->m_rsvdState && m_basicFeature->m_rsvdState->GetFeatureRsvdFlag())
#endif
)
{
ENCODE_CHK_STATUS_RETURN(UpdateStatusReport(statusReportGlobalCount, &cmdBuffer));
Expand Down Expand Up @@ -2170,9 +2168,7 @@ namespace encode
// needs to be enabled for 1st pass in multi-pass case
// This bit is ignored if PAK only second pass is enabled.
if ((m_pipeline->GetCurrentPass() == 0) && !m_pipeline->IsLastPass()
#ifdef _ENCODE_RESERVED
|| (m_basicFeature->m_rsvdState && m_basicFeature->m_rsvdState->GetFeatureRsvdFlag())
#endif
)
{
params.pakObjCmdStreamOut = true;
Expand Down
Loading