From 1a6d6fd4480294e427603fad6a25431bb226910e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Semenov=20Herman=20=28=D0=A1=D0=B5=D0=BC=D0=B5=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=20=D0=93=D0=B5=D1=80=D0=BC=D0=B0=D0=BD=29?= Date: Wed, 6 Nov 2024 22:26:27 +0300 Subject: [PATCH] [All] Using code lower scope micro-optimization --- .../agnostic/common/codec/hal/codechal_hw.cpp | 3 +- .../codec/hal/codechal_encode_hevc_g12.cpp | 22 +++---- media_driver/agnostic/gen9/cm/cm_hal_g9.cpp | 4 +- .../hevc/packet/decode_hevc_slice_packet.cpp | 2 +- .../pipeline/encode_av1_reference_frames.cpp | 4 +- .../hevc/packet/encode_hevc_vdenc_packet.cpp | 11 ++-- .../shared/packet/encode_preenc_packet.cpp | 11 ++-- .../hal/enc/vp9/features/encode_vp9_tile.cpp | 4 +- .../common/hw/vdbox/mhw_vdbox_vdenc_impl.h | 60 +++++++++---------- .../media_user_setting_configure.cpp | 6 +- .../vp/hal/bufferMgr/vp_resource_manager.cpp | 2 +- .../hal/pipeline/vp_pipeline_adapter_base.cpp | 6 +- .../common/os/mos_context_specific_next.cpp | 3 +- 13 files changed, 65 insertions(+), 73 deletions(-) diff --git a/media_driver/agnostic/common/codec/hal/codechal_hw.cpp b/media_driver/agnostic/common/codec/hal/codechal_hw.cpp index 71c84382857..6c1259f6b63 100644 --- a/media_driver/agnostic/common/codec/hal/codechal_hw.cpp +++ b/media_driver/agnostic/common/codec/hal/codechal_hw.cpp @@ -888,10 +888,9 @@ uint32_t CodechalHwInterface::ComposeSurfaceCacheabilityControl( { CODECHAL_HW_FUNCTION_ENTER; - MHW_MEMORY_OBJECT_CONTROL_PARAMS cacheSetting = m_cacheabilitySettings[cacheabiltySettingIdx]; - if (m_noSeparateL3LlcCacheabilitySettings) { + MHW_MEMORY_OBJECT_CONTROL_PARAMS cacheSetting = m_cacheabilitySettings[cacheabiltySettingIdx]; if (cacheabilityTypeRequested == codechalUncacheableWa) { if (cacheSetting.Gen8.TargetCache == CODECHAL_MO_TARGET_CACHE_ELLC) diff --git a/media_driver/agnostic/gen12/codec/hal/codechal_encode_hevc_g12.cpp b/media_driver/agnostic/gen12/codec/hal/codechal_encode_hevc_g12.cpp index 38ac70eddac..4d12d3552e2 100644 --- a/media_driver/agnostic/gen12/codec/hal/codechal_encode_hevc_g12.cpp +++ b/media_driver/agnostic/gen12/codec/hal/codechal_encode_hevc_g12.cpp @@ -1811,25 +1811,19 @@ MOS_STATUS CodechalEncHevcStateG12::GetFrameBrcLevel() //if L0/L1 both points to previous frame, then its LBD otherwise its is level 1 RA B. auto B_or_LDB_brclevel = m_lowDelay ? HEVC_BRC_FRAME_TYPE_P_OR_LB : HEVC_BRC_FRAME_TYPE_B; - std::map codingtype_to_brclevel{ - {I_TYPE, HEVC_BRC_FRAME_TYPE_I}, - {P_TYPE, HEVC_BRC_FRAME_TYPE_P_OR_LB}, - {B_TYPE, B_or_LDB_brclevel}, - {B1_TYPE, HEVC_BRC_FRAME_TYPE_B1}, - {B2_TYPE, HEVC_BRC_FRAME_TYPE_B2}}; //Both I or P/LDB type at same HierarchLevelPlus1 auto intra_LDBFrame_to_Brclevel = (m_pictureCodingType == I_TYPE) ? HEVC_BRC_FRAME_TYPE_I : HEVC_BRC_FRAME_TYPE_P_OR_LB; - std::map hierchLevelPlus1_to_brclevel{ - {1, intra_LDBFrame_to_Brclevel}, - {2, HEVC_BRC_FRAME_TYPE_B}, - {3, HEVC_BRC_FRAME_TYPE_B1}, - {4, HEVC_BRC_FRAME_TYPE_B2}}; if (m_hevcSeqParams->HierarchicalFlag && m_hevcSeqParams->GopRefDist > 1 && m_hevcSeqParams->GopRefDist <= 8) { if (m_hevcPicParams->HierarchLevelPlus1 > 0) // LDB or RAB { + std::map hierchLevelPlus1_to_brclevel{ + {1, intra_LDBFrame_to_Brclevel}, + {2, HEVC_BRC_FRAME_TYPE_B}, + {3, HEVC_BRC_FRAME_TYPE_B1}, + {4, HEVC_BRC_FRAME_TYPE_B2}}; m_currFrameBrcLevel = hierchLevelPlus1_to_brclevel.count(m_hevcPicParams->HierarchLevelPlus1) ? hierchLevelPlus1_to_brclevel[m_hevcPicParams->HierarchLevelPlus1] : HEVC_BRC_FRAME_TYPE_INVALID; //Invalid HierarchLevelPlus1 or LBD frames at level 3 eror check. if ((m_currFrameBrcLevel == HEVC_BRC_FRAME_TYPE_INVALID) || @@ -1843,6 +1837,12 @@ MOS_STATUS CodechalEncHevcStateG12::GetFrameBrcLevel() { if (!m_hevcSeqParams->LowDelayMode) // RA B { + std::map codingtype_to_brclevel{ + {I_TYPE, HEVC_BRC_FRAME_TYPE_I}, + {P_TYPE, HEVC_BRC_FRAME_TYPE_P_OR_LB}, + {B_TYPE, B_or_LDB_brclevel}, + {B1_TYPE, HEVC_BRC_FRAME_TYPE_B1}, + {B2_TYPE, HEVC_BRC_FRAME_TYPE_B2}}; m_currFrameBrcLevel = codingtype_to_brclevel.count(m_pictureCodingType) ? codingtype_to_brclevel[m_pictureCodingType] : HEVC_BRC_FRAME_TYPE_INVALID; //Invalid CodingType. if (m_currFrameBrcLevel == HEVC_BRC_FRAME_TYPE_INVALID) diff --git a/media_driver/agnostic/gen9/cm/cm_hal_g9.cpp b/media_driver/agnostic/gen9/cm/cm_hal_g9.cpp index b460b6375b1..f495f6d84c4 100644 --- a/media_driver/agnostic/gen9/cm/cm_hal_g9.cpp +++ b/media_driver/agnostic/gen9/cm/cm_hal_g9.cpp @@ -1304,8 +1304,6 @@ MOS_STATUS CM_HAL_G9_X::AllocateSIPCSRResource() MOS_STATUS CM_HAL_G9_X::GetGenStepInfo(char*& stepInfoStr) { - const char *cmSteppingInfo[] = { "A", "B", "C", "D", "E", "F", - "G", "H", "I", "J" }; uint32_t genStepId = m_cmState->platform.usRevId; if (m_steppingTable.size() != 0) //check if the stepping table been overwritten @@ -1321,6 +1319,8 @@ MOS_STATUS CM_HAL_G9_X::GetGenStepInfo(char*& stepInfoStr) } else { + const char *cmSteppingInfo[] = { "A", "B", "C", "D", "E", "F", + "G", "H", "I", "J" }; if (genStepId < sizeof(cmSteppingInfo)/sizeof(const char *)) { stepInfoStr = (char *)cmSteppingInfo[genStepId]; diff --git a/media_softlet/agnostic/common/codec/hal/dec/hevc/packet/decode_hevc_slice_packet.cpp b/media_softlet/agnostic/common/codec/hal/dec/hevc/packet/decode_hevc_slice_packet.cpp index d039a5be6e5..74932173165 100644 --- a/media_softlet/agnostic/common/codec/hal/dec/hevc/packet/decode_hevc_slice_packet.cpp +++ b/media_softlet/agnostic/common/codec/hal/dec/hevc/packet/decode_hevc_slice_packet.cpp @@ -377,13 +377,13 @@ namespace decode CODEC_HEVC_SLICE_PARAMS *sliceParams = m_hevcSliceParams + sliceIdx; int8_t *pRefIdxMapping = 0; int pocCurrPic = 0; - int32_t pocList[CODEC_MAX_NUM_REF_FRAME_HEVC] = {}; uint16_t refFieldPicFlag = 0; uint16_t refBottomFieldFlag = 0; CODEC_PICTURE refPicList[2][CODEC_MAX_NUM_REF_FRAME_HEVC] = {}; if (!m_hcpItf->IsHevcISlice(sliceParams->LongSliceFlags.fields.slice_type)) { + int32_t pocList[CODEC_MAX_NUM_REF_FRAME_HEVC] = {}; HevcReferenceFrames &refFrames = m_hevcBasicFeature->m_refFrames; DECODE_CHK_STATUS(refFrames.FixSliceRefList(*m_hevcPicParams, *sliceParams)); diff --git a/media_softlet/agnostic/common/codec/hal/enc/av1/pipeline/encode_av1_reference_frames.cpp b/media_softlet/agnostic/common/codec/hal/enc/av1/pipeline/encode_av1_reference_frames.cpp index d693abdfff6..301d1227900 100644 --- a/media_softlet/agnostic/common/codec/hal/enc/av1/pipeline/encode_av1_reference_frames.cpp +++ b/media_softlet/agnostic/common/codec/hal/enc/av1/pipeline/encode_av1_reference_frames.cpp @@ -910,10 +910,10 @@ MHW_SETPAR_DECL_SRC(VDENC_CMD2, Av1ReferenceFrames) } } - CODEC_Ref_Frame_Ctrl_AV1 refCtrlL0 = m_basicFeature->m_av1PicParams->ref_frame_ctrl_l0; - CODEC_Ref_Frame_Ctrl_AV1 refCtrlL1 = m_basicFeature->m_av1PicParams->ref_frame_ctrl_l1; if (m_basicFeature->m_enableNonDefaultMapping) { + CODEC_Ref_Frame_Ctrl_AV1 refCtrlL0 = m_basicFeature->m_av1PicParams->ref_frame_ctrl_l0; + CODEC_Ref_Frame_Ctrl_AV1 refCtrlL1 = m_basicFeature->m_av1PicParams->ref_frame_ctrl_l1; params.av1RefId[0][0] = refCtrlL0.RefFrameCtrl.fields.search_idx0; params.av1RefId[0][1] = refCtrlL0.RefFrameCtrl.fields.search_idx1; params.av1RefId[0][2] = refCtrlL0.RefFrameCtrl.fields.search_idx2; diff --git a/media_softlet/agnostic/common/codec/hal/enc/hevc/packet/encode_hevc_vdenc_packet.cpp b/media_softlet/agnostic/common/codec/hal/enc/hevc/packet/encode_hevc_vdenc_packet.cpp index 957f4d168d3..c6c8c938cc8 100644 --- a/media_softlet/agnostic/common/codec/hal/enc/hevc/packet/encode_hevc_vdenc_packet.cpp +++ b/media_softlet/agnostic/common/codec/hal/enc/hevc/packet/encode_hevc_vdenc_packet.cpp @@ -3219,19 +3219,18 @@ MOS_STATUS HevcVdencPkt::AddAllCmds_HCP_PAK_INSERT_OBJECT_BRC(PMOS_COMMAND_BUFFE PCODEC_HEVC_ENCODE_PICTURE_PARAMS hevcPicParams = (CODEC_HEVC_ENCODE_PICTURE_PARAMS *)m_hevcPicParams; PCODEC_HEVC_ENCODE_SLICE_PARAMS hevcSlcParams = (CODEC_HEVC_ENCODE_SLICE_PARAMS *)&m_hevcSliceParams[currSlcIdx]; - CODEC_PICTURE currPic = {}; CODEC_PICTURE refPicList[2][CODEC_MAX_NUM_REF_FRAME_HEVC] = {}; void ** hevcRefList = nullptr; int32_t pocCurrPic = 0; int8_t * pRefIdxMapping = nullptr; - int32_t pocList[CODEC_MAX_NUM_REF_FRAME_HEVC] = {}; if (hevcSlcParams->slice_type != encodeHevcISlice) { - currPic = hevcPicParams->CurrReconstructedPic; - params.ucList = LIST_0; - params.numRefIdxLRefpiclistnumActiveMinus1 = hevcSlcParams->num_ref_idx_l0_active_minus1; - eStatus = MOS_SecureMemcpy(&refPicList, sizeof(refPicList), &hevcSlcParams->RefPicList, sizeof(hevcSlcParams->RefPicList)); + int32_t pocList[CODEC_MAX_NUM_REF_FRAME_HEVC] = {}; + CODEC_PICTURE currPic = hevcPicParams->CurrReconstructedPic; + params.ucList = LIST_0; + params.numRefIdxLRefpiclistnumActiveMinus1 = hevcSlcParams->num_ref_idx_l0_active_minus1; + eStatus = MOS_SecureMemcpy(&refPicList, sizeof(refPicList), &hevcSlcParams->RefPicList, sizeof(hevcSlcParams->RefPicList)); if (eStatus != MOS_STATUS_SUCCESS) { ENCODE_ASSERTMESSAGE("Failed to copy memory."); diff --git a/media_softlet/agnostic/common/codec/hal/enc/shared/packet/encode_preenc_packet.cpp b/media_softlet/agnostic/common/codec/hal/enc/shared/packet/encode_preenc_packet.cpp index 4610a372665..045ff140427 100644 --- a/media_softlet/agnostic/common/codec/hal/enc/shared/packet/encode_preenc_packet.cpp +++ b/media_softlet/agnostic/common/codec/hal/enc/shared/packet/encode_preenc_packet.cpp @@ -1283,19 +1283,18 @@ namespace encode auto ¶ms = m_hcpItf->MHW_GETPAR_F(HCP_REF_IDX_STATE)(); params = {}; - CODEC_PICTURE currPic = {}; CODEC_PICTURE refPicList[2][CODEC_MAX_NUM_REF_FRAME_HEVC] = {}; void ** hevcRefList = nullptr; int32_t pocCurrPic = 0; int8_t * pRefIdxMapping = nullptr; - int32_t pocList[CODEC_MAX_NUM_REF_FRAME_HEVC] = {}; if (m_basicFeature->m_preEncConfig.SliceType != encodeHevcISlice) { - currPic = m_basicFeature->m_preEncConfig.CurrReconstructedPic; - params.ucList = LIST_0; - params.numRefIdxLRefpiclistnumActiveMinus1 = 0; - eStatus = MOS_SecureMemcpy(&refPicList, sizeof(refPicList), &m_basicFeature->m_preEncConfig.RefPicList, sizeof(m_basicFeature->m_preEncConfig.RefPicList)); + int32_t pocList[CODEC_MAX_NUM_REF_FRAME_HEVC] = {}; + CODEC_PICTURE currPic = m_basicFeature->m_preEncConfig.CurrReconstructedPic; + params.ucList = LIST_0; + params.numRefIdxLRefpiclistnumActiveMinus1 = 0; + eStatus = MOS_SecureMemcpy(&refPicList, sizeof(refPicList), &m_basicFeature->m_preEncConfig.RefPicList, sizeof(m_basicFeature->m_preEncConfig.RefPicList)); if (eStatus != MOS_STATUS_SUCCESS) { ENCODE_ASSERTMESSAGE("Failed to copy memory."); diff --git a/media_softlet/agnostic/common/codec/hal/enc/vp9/features/encode_vp9_tile.cpp b/media_softlet/agnostic/common/codec/hal/enc/vp9/features/encode_vp9_tile.cpp index 7fc271cb027..d5fa4a37c5f 100644 --- a/media_softlet/agnostic/common/codec/hal/enc/vp9/features/encode_vp9_tile.cpp +++ b/media_softlet/agnostic/common/codec/hal/enc/vp9/features/encode_vp9_tile.cpp @@ -660,7 +660,6 @@ 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; params.ctbSize = CODEC_VP9_SUPER_BLOCK_WIDTH; if (!m_enabled) @@ -670,6 +669,7 @@ MHW_SETPAR_DECL_SRC(VDENC_HEVC_VP9_TILE_SLICE_STATE, Vp9EncodeTile) } else { + auto tileCodingParams = m_curTileCodingParams; params.tileWidth = ((tileCodingParams.TileWidthInMinCbMinus1 + 1) * CODEC_VP9_MIN_BLOCK_WIDTH); params.tileHeight = ((tileCodingParams.TileHeightInMinCbMinus1 + 1) * CODEC_VP9_MIN_BLOCK_HEIGHT); @@ -706,7 +706,6 @@ 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; if (!m_enabled) { @@ -716,6 +715,7 @@ MHW_SETPAR_DECL_SRC(VDENC_WALKER_STATE, Vp9EncodeTile) } else { + auto tileCodingParams = m_curTileCodingParams; params.tileSliceStartLcuMbX = tileCodingParams.TileStartLCUX; params.tileSliceStartLcuMbY = tileCodingParams.TileStartLCUY; diff --git a/media_softlet/agnostic/common/hw/vdbox/mhw_vdbox_vdenc_impl.h b/media_softlet/agnostic/common/hw/vdbox/mhw_vdbox_vdenc_impl.h index e0ad7d2eb01..3e8f9aa0b8c 100644 --- a/media_softlet/agnostic/common/hw/vdbox/mhw_vdbox_vdenc_impl.h +++ b/media_softlet/agnostic/common/hw/vdbox/mhw_vdbox_vdenc_impl.h @@ -168,22 +168,6 @@ class Impl : public Itf, public mhw::Impl } case RowStorePar::HEVC: { - constexpr bool enable[16][5] = - { - {1, 1, 1, 0, 1}, {1, 1, 1, 1, 1}, {1, 1, 0, 0, 0}, {1, 1, 0, 1, 0}, - {1, 1, 1, 1, 1}, {1, 1, 0, 0, 1}, {1, 1, 1, 0, 0}, {1, 0, 1, 0, 1}, - {1, 1, 1, 0, 0}, {1, 0, 1, 0, 1}, {1, 1, 1, 1, 1}, {1, 1, 0, 1, 1}, - {1, 1, 1, 1, 1}, {1, 0, 1, 1, 1}, {1, 1, 1, 1, 1}, {1, 0, 1, 1, 1} - }; - - constexpr uint32_t address[16][5] = - { - {0, 256, 1280, 0, 2048}, {0, 256, 1280, 1824, 1792}, {0, 512, 0, 0, 0}, {0, 256, 0, 2304, 0}, - {0, 256, 1024, 0, 1792}, {0, 512, 0, 0, 2048}, {0, 256, 1792, 0, 0}, {0, 0, 512, 0, 2048}, - {0, 256, 1792, 0, 0}, {0, 0, 256, 0, 1792}, {0, 256, 1024, 1568, 1536}, {0, 512, 0, 2112, 2048}, - {0, 256, 1792, 2336, 2304}, {0, 0, 512, 1600, 1536}, {0, 128, 1664, 2336, 2304}, {0, 0, 256, 1600, 1536} - }; - bool isLcu32or64 = par.lcuSize == RowStorePar::SIZE_32 || par.lcuSize == RowStorePar::SIZE_64; bool isGt4k = par.frameWidth > 4096; bool isGt8k = par.frameWidth > 8192; @@ -201,9 +185,23 @@ class Impl : public Itf, public mhw::Impl if (!isGt8k && this->m_rowStoreCache.vdenc.supported) { + constexpr bool enable[16][5] = + { + {1, 1, 1, 0, 1}, {1, 1, 1, 1, 1}, {1, 1, 0, 0, 0}, {1, 1, 0, 1, 0}, + {1, 1, 1, 1, 1}, {1, 1, 0, 0, 1}, {1, 1, 1, 0, 0}, {1, 0, 1, 0, 1}, + {1, 1, 1, 0, 0}, {1, 0, 1, 0, 1}, {1, 1, 1, 1, 1}, {1, 1, 0, 1, 1}, + {1, 1, 1, 1, 1}, {1, 0, 1, 1, 1}, {1, 1, 1, 1, 1}, {1, 0, 1, 1, 1} + }; this->m_rowStoreCache.vdenc.enabled = enable[index][3]; if (this->m_rowStoreCache.vdenc.enabled) { + constexpr uint32_t address[16][5] = + { + {0, 256, 1280, 0, 2048}, {0, 256, 1280, 1824, 1792}, {0, 512, 0, 0, 0}, {0, 256, 0, 2304, 0}, + {0, 256, 1024, 0, 1792}, {0, 512, 0, 0, 2048}, {0, 256, 1792, 0, 0}, {0, 0, 512, 0, 2048}, + {0, 256, 1792, 0, 0}, {0, 0, 256, 0, 1792}, {0, 256, 1024, 1568, 1536}, {0, 512, 0, 2112, 2048}, + {0, 256, 1792, 2336, 2304}, {0, 0, 512, 1600, 1536}, {0, 128, 1664, 2336, 2304}, {0, 0, 256, 1600, 1536} + }; this->m_rowStoreCache.vdenc.dwAddress = address[index][3]; } } @@ -228,22 +226,6 @@ class Impl : public Itf, public mhw::Impl case RowStorePar::VP9: { // HVD, Meta/MV, DeBlock, VDEnc - const bool enableVP9[13][4] = - { - { 1, 1, 1, 1 }, { 0, 0, 1, 1 }, { 1, 0, 1, 1 }, { 1, 1, 0, 1 }, - { 1, 1, 1, 1 }, { 0, 0, 1, 1 }, { 0, 0, 1, 0 }, { 1, 1, 0, 1 }, - { 1, 1, 1, 1 }, { 1, 1, 0, 1 }, { 1, 1, 1, 1 }, { 1, 1, 0, 1 }, - { 1, 1, 0, 1 } - }; - - const uint32_t addressVP9[13][4] = - { - { 0, 64, 384, 1536, }, { 0, 0, 0, 2304, }, { 0, 0, 64, 2368, }, { 0, 128, 0, 768, }, - { 0, 64, 384, 1536, }, { 0, 0, 0, 2304, }, { 0, 0, 0, 0, }, { 0, 128, 0, 768, }, - { 0, 64, 384, 2112, }, { 0, 128, 0, 768, }, { 0, 32, 192, 1920, }, { 0, 128, 0, 768, }, - { 0, 128, 0, 768, } - }; - if(this->m_rowStoreCache.vdenc.supported) { bool is8bit = par.bitDepth == RowStorePar::DEPTH_8; @@ -268,9 +250,23 @@ class Impl : public Itf, public mhw::Impl if(!isGt8k) { + constexpr bool enableVP9[13][4] = + { + { 1, 1, 1, 1 }, { 0, 0, 1, 1 }, { 1, 0, 1, 1 }, { 1, 1, 0, 1 }, + { 1, 1, 1, 1 }, { 0, 0, 1, 1 }, { 0, 0, 1, 0 }, { 1, 1, 0, 1 }, + { 1, 1, 1, 1 }, { 1, 1, 0, 1 }, { 1, 1, 1, 1 }, { 1, 1, 0, 1 }, + { 1, 1, 0, 1 } + }; this->m_rowStoreCache.vdenc.enabled = enableVP9[index][3]; if(this->m_rowStoreCache.vdenc.enabled) { + const uint32_t addressVP9[13][4] = + { + { 0, 64, 384, 1536, }, { 0, 0, 0, 2304, }, { 0, 0, 64, 2368, }, { 0, 128, 0, 768, }, + { 0, 64, 384, 1536, }, { 0, 0, 0, 2304, }, { 0, 0, 0, 0, }, { 0, 128, 0, 768, }, + { 0, 64, 384, 2112, }, { 0, 128, 0, 768, }, { 0, 32, 192, 1920, }, { 0, 128, 0, 768, }, + { 0, 128, 0, 768, } + }; this->m_rowStoreCache.vdenc.dwAddress = addressVP9[index][3]; } } diff --git a/media_softlet/agnostic/common/os/user_setting/media_user_setting_configure.cpp b/media_softlet/agnostic/common/os/user_setting/media_user_setting_configure.cpp index df14f3960af..fdaa5986cf8 100644 --- a/media_softlet/agnostic/common/os/user_setting/media_user_setting_configure.cpp +++ b/media_softlet/agnostic/common/os/user_setting/media_user_setting_configure.cpp @@ -279,9 +279,9 @@ std::string Configure::GetReadPath( std::shared_ptr def, uint32_t option) { - std::string path = ""; if (def == nullptr) { + std::string path = ""; return path; } @@ -303,9 +303,9 @@ std::string Configure::GetReportPath( std::shared_ptr def, uint32_t option) { - std::string path = ""; if (def == nullptr) { + std::string path = ""; return path; } if (option == MEDIA_USER_SETTING_INTERNAL) @@ -320,10 +320,10 @@ std::string Configure::GetReportPath( std::string Configure::GetExternalPath(uint32_t option) { - std::string path = ""; auto it = m_pathOption.find(option); if (it != m_pathOption.end()) { + std::string path = ""; if (it->second.bStated && m_keyPathInfo != nullptr && m_keyPathInfo->Path != nullptr) { path = m_keyPathInfo->Path; diff --git a/media_softlet/agnostic/common/vp/hal/bufferMgr/vp_resource_manager.cpp b/media_softlet/agnostic/common/vp/hal/bufferMgr/vp_resource_manager.cpp index 3b62e1292b9..e864152e56d 100644 --- a/media_softlet/agnostic/common/vp/hal/bufferMgr/vp_resource_manager.cpp +++ b/media_softlet/agnostic/common/vp/hal/bufferMgr/vp_resource_manager.cpp @@ -921,7 +921,6 @@ MOS_STATUS VpResourceManager::AssignIntermediaSurface(VP_EXECUTE_CAPS& caps, SwF VP_SURFACE *outputSurface = executedFilters.GetSurface(false, 0); VP_SURFACE *intermediaSurface = nullptr; - VP_SURFACE_PARAMS params = {}; if (outputSurface) { // No need intermedia surface. @@ -940,6 +939,7 @@ MOS_STATUS VpResourceManager::AssignIntermediaSurface(VP_EXECUTE_CAPS& caps, SwF } bool allocated = false; // Get surface parameter. + VP_SURFACE_PARAMS params = {}; GetIntermediaOutputSurfaceParams(caps, params, executedFilters); VP_PUBLIC_CHK_STATUS_RETURN(m_allocator.ReAllocateSurface( diff --git a/media_softlet/agnostic/common/vp/hal/pipeline/vp_pipeline_adapter_base.cpp b/media_softlet/agnostic/common/vp/hal/pipeline/vp_pipeline_adapter_base.cpp index 68f577a754d..b6bfb9c4568 100644 --- a/media_softlet/agnostic/common/vp/hal/pipeline/vp_pipeline_adapter_base.cpp +++ b/media_softlet/agnostic/common/vp/hal/pipeline/vp_pipeline_adapter_base.cpp @@ -57,9 +57,6 @@ MOS_STATUS VpPipelineAdapterBase::GetVpMhwInterface( MOS_STATUS eStatus = MOS_STATUS_SUCCESS; bool sfcNeeded = false; bool veboxNeeded = false; - std::shared_ptr veboxItf = nullptr; - std::shared_ptr sfcItf = nullptr; - std::shared_ptr miItf = nullptr; m_osInterface = m_vpPlatformInterface.GetOsInterface(); if (m_osInterface == nullptr) { @@ -96,6 +93,9 @@ MOS_STATUS VpPipelineAdapterBase::GetVpMhwInterface( SetMhwMiItf(m_vprenderHal->pRenderHalPltInterface->GetMhwMiItf()); if ((veboxNeeded || sfcNeeded) && !m_clearVideoViewMode) { + std::shared_ptr veboxItf = nullptr; + std::shared_ptr sfcItf = nullptr; + std::shared_ptr miItf = nullptr; eStatus = VphalDevice::CreateVPMhwInterfaces(sfcNeeded, veboxNeeded, veboxItf, sfcItf, miItf, m_osInterface); if (eStatus == MOS_STATUS_SUCCESS) { diff --git a/media_softlet/linux/common/os/mos_context_specific_next.cpp b/media_softlet/linux/common/os/mos_context_specific_next.cpp index 15a255e583d..afe1c01dbf7 100644 --- a/media_softlet/linux/common/os/mos_context_specific_next.cpp +++ b/media_softlet/linux/common/os/mos_context_specific_next.cpp @@ -66,7 +66,6 @@ MOS_STATUS OsContextSpecificNext::Init(DDI_DEVICE_CONTEXT ddiDriverContext) MOS_STATUS eStatus = MOS_STATUS_SUCCESS; uint32_t value = 0; uint32_t mode = 0; - MediaUserSettingSharedPtr userSettingPtr = nullptr; MOS_OS_FUNCTION_ENTER; @@ -90,7 +89,7 @@ MOS_STATUS OsContextSpecificNext::Init(DDI_DEVICE_CONTEXT ddiDriverContext) } m_fd = osDriverContext->fd; - userSettingPtr = MosInterface::MosGetUserSettingInstance(osDriverContext); + MediaUserSettingSharedPtr userSettingPtr = MosInterface::MosGetUserSettingInstance(osDriverContext); m_bufmgr = mos_bufmgr_gem_init(m_fd, BATCH_BUFFER_SIZE, &m_deviceType); if (nullptr == m_bufmgr)