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

[All] Using const reference optimization if possible for object size > 16 bytes #1868

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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 @@ -251,7 +251,7 @@ namespace encode
auto brcFeature = dynamic_cast<Av1Brc *>(m_featureManager->GetFeature(Av1FeatureIDs::av1BrcFeature));
ENCODE_CHK_NULL_RETURN(brcFeature);
auto vdenc2ndLevelBatchBuffer = brcFeature->GetVdenc2ndLevelBatchBuffer(m_pipeline->m_currRecycledBufIdx);
auto slbbData = brcFeature->GetSLBData();
const auto &slbbData = brcFeature->GetSLBData();

//AV1 Tile Commands
//set up VD_CONTROL_STATE command
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ MOS_STATUS Av1VdencPktXe2_Lpm::AddOneTileCommands(
auto brcFeature = dynamic_cast<Av1Brc *>(m_featureManager->GetFeature(Av1FeatureIDs::av1BrcFeature));
ENCODE_CHK_NULL_RETURN(brcFeature);
auto vdenc2ndLevelBatchBuffer = brcFeature->GetVdenc2ndLevelBatchBuffer(m_pipeline->m_currRecycledBufIdx);
auto slbbData = brcFeature->GetSLBData();
const auto &slbbData = brcFeature->GetSLBData();

ENCODE_CHK_STATUS_RETURN(AddAllCmds_AVP_PIPE_MODE_SELECT(tempCmdBuffer));
ENCODE_CHK_STATUS_RETURN(AddAllCmds_AVP_SURFACE_STATE(tempCmdBuffer));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ MOS_STATUS Av1VdencPktXe2_Hpm::AddOneTileCommands(
auto brcFeature = dynamic_cast<Av1Brc *>(m_featureManager->GetFeature(Av1FeatureIDs::av1BrcFeature));
ENCODE_CHK_NULL_RETURN(brcFeature);
auto vdenc2ndLevelBatchBuffer = brcFeature->GetVdenc2ndLevelBatchBuffer(m_pipeline->m_currRecycledBufIdx);
auto slbbData = brcFeature->GetSLBData();
const auto &slbbData = brcFeature->GetSLBData();

ENCODE_CHK_STATUS_RETURN(AddAllCmds_AVP_PIPE_MODE_SELECT(tempCmdBuffer));
ENCODE_CHK_STATUS_RETURN(AddAllCmds_AVP_SURFACE_STATE(tempCmdBuffer));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ MOS_STATUS Av1VdencPktXe_Lpm_Plus_Base::AddOneTileCommands(
auto brcFeature = dynamic_cast<Av1Brc *>(m_featureManager->GetFeature(Av1FeatureIDs::av1BrcFeature));
ENCODE_CHK_NULL_RETURN(brcFeature);
auto vdenc2ndLevelBatchBuffer = brcFeature->GetVdenc2ndLevelBatchBuffer(m_pipeline->m_currRecycledBufIdx);
auto slbbData = brcFeature->GetSLBData();
const auto &slbbData = brcFeature->GetSLBData();

ENCODE_CHK_STATUS_RETURN(AddAllCmds_AVP_PIPE_MODE_SELECT(tempCmdBuffer));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1409,7 +1409,7 @@ namespace encode{
ENCODE_CHK_NULL_RETURN(pakInsertOutputBatchBuffer);
// send pak insert obj cmds after back annotation
ENCODE_CHK_STATUS_RETURN(m_miItf->MHW_ADDCMD_F(MI_BATCH_BUFFER_START)(cmdBuffer, pakInsertOutputBatchBuffer));
auto slbbData = brcFeature->GetSLBData();
const auto &slbbData = brcFeature->GetSLBData();
HalOcaInterfaceNext::OnSubLevelBBStart(
*cmdBuffer,
m_osInterface->pOsContext,
Expand Down Expand Up @@ -1923,7 +1923,7 @@ namespace encode{
auto brcFeature = dynamic_cast<Av1Brc *>(m_featureManager->GetFeature(Av1FeatureIDs::av1BrcFeature));
ENCODE_CHK_NULL_RETURN(brcFeature);
auto vdenc2ndLevelBatchBuffer = brcFeature->GetVdenc2ndLevelBatchBuffer(m_pipeline->m_currRecycledBufIdx);
auto slbbData = brcFeature->GetSLBData();
const auto &slbbData = brcFeature->GetSLBData();

//qp
uint32_t qpOffset = resourceOffset.dwMetaDataSize + tileNum * resourceOffset.dwMetaDataSubRegionSize + resourceOffset.dwTilePartitionSize + AV1ResourceOffset.dwQuantization + AV1ResourceOffset.dwBaseQIndex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ MHW_SETPAR_DECL_SRC(HCP_TILE_CODING, Vp9EncodeTile)
{
ENCODE_FUNC_CALL();

auto tileCodingParams = m_curTileCodingParams;
const auto &tileCodingParams = m_curTileCodingParams;

params.numberOfActiveBePipes = tileCodingParams.NumberOfActiveBePipes;
params.numOfTileColumnsInFrame = tileCodingParams.NumOfTileColumnsInFrame;
Expand Down Expand Up @@ -660,7 +660,7 @@ MHW_SETPAR_DECL_SRC(VDENC_HEVC_VP9_TILE_SLICE_STATE, Vp9EncodeTile)
ENCODE_CHK_NULL_RETURN(vp9BasicFeature);
auto picParams = vp9BasicFeature->m_vp9PicParams;
ENCODE_CHK_NULL_RETURN(picParams);
auto tileCodingParams = m_curTileCodingParams;
const auto &tileCodingParams = m_curTileCodingParams;
params.ctbSize = CODEC_VP9_SUPER_BLOCK_WIDTH;

if (!m_enabled)
Expand Down Expand Up @@ -706,7 +706,7 @@ MHW_SETPAR_DECL_SRC(VDENC_WALKER_STATE, Vp9EncodeTile)
ENCODE_CHK_NULL_RETURN(vp9BasicFeature);
auto picParams = vp9BasicFeature->m_vp9PicParams;
ENCODE_CHK_NULL_RETURN(picParams);
auto tileCodingParams = m_curTileCodingParams;
const auto &tileCodingParams = m_curTileCodingParams;

if (!m_enabled)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ MOS_STATUS Vp9HpuPkt::PatchHucProbCommands(MOS_COMMAND_BUFFER *commandBuffer, ui
params.resBitstreamByteCountPerFrame = osResource;
params.bitstreamByteCountPerFrameOffset = offset;

auto virtualAddrParams = m_hucItf->MHW_GETPAR_F(HUC_VIRTUAL_ADDR_STATE)();
const auto &virtualAddrParams = m_hucItf->MHW_GETPAR_F(HUC_VIRTUAL_ADDR_STATE)();
auto &copyMemMemParams = m_miItf->MHW_GETPAR_F(MI_COPY_MEM_MEM)();
copyMemMemParams = {};
copyMemMemParams.presSrc = virtualAddrParams.regionParams[11].presRegion;
Expand Down
2 changes: 1 addition & 1 deletion media_softlet/agnostic/common/os/mos_utilities_next.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ void PerfUtility::getPerfInfo(std::vector<Tick>& record, PerfInfo* info)

info->count = (uint32_t)record.size();
double sum = 0, max = 0, min = 10000000.0;
for (auto t : record)
for (const auto &t : record)
{
sum += t.time;
max = (max < t.time) ? t.time : max;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ MOS_STATUS CmdTask::CalculateCmdBufferSizeFromActivePackets()

m_cmdBufSize = 0;
m_patchListSize = 0;
for (auto prop : m_packets)
for (const auto &prop : m_packets)
{
// Calculate total size based on pipe 0
if (prop.stateProperty.currentPipe == 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ MOS_STATUS VpRenderHdr3DLutKernelCM::GetCurbeState(void *&curbe, uint32_t &curbe
{
VP_FUNC_CALL();
curbeLength = 0;
for (auto arg : m_kernelArgs)
for (const auto &arg : m_kernelArgs)
{
curbeLength += arg.uSize;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ MOS_STATUS VpRenderHVSKernel::GetCurbeState(void *&curbe, uint32_t &curbeLength)
{
VP_FUNC_CALL();
curbeLength = 0;
for (auto arg : m_kernelArgs)
for (const auto &arg : m_kernelArgs)
{
curbeLength += arg.uSize;
}
Expand Down Expand Up @@ -307,7 +307,7 @@ MOS_STATUS VpRenderHVSKernel::SetupSurfaceState()
PMOS_INTERFACE osInterface = m_hwInterface->m_osInterface;
m_surfaceBindingIndex.clear();
m_surfaceState.clear();
for (auto arg : m_kernelArgs)
for (const auto &arg : m_kernelArgs)
{
VP_RENDER_CHK_NULL_RETURN(arg.pData);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ VAStatus MediaCapsTableSpecific::CreateConfig(
DDI_UNUSED(configId);

VAStatus ret = VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
for (auto configItem : m_configList)
for (const auto &configItem : m_configList)
{
// check profile, entrypoint here
if (configItem.profile == profile)
Expand Down