Skip to content

Commit

Permalink
[Deocde] fix some covierty issues
Browse files Browse the repository at this point in the history
* [Deocde] fix some covierty issues
  • Loading branch information
pengxin99 authored and intel-mediadev committed Nov 13, 2023
1 parent 507fa8c commit e37cccb
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,13 @@ MOS_STATUS CodechalKernelOlpMdf::Execute(PMOS_SURFACE src, uint16_t *srcMemory_o
CODECHAL_DECODE_CHK_STATUS_RETURN(m_cmTask->AddKernel(m_cmKernels[0]));
if (!m_SingleTaskPhase)
{
CODECHAL_DECODE_CHK_STATUS_RETURN(m_cmQueue->EnqueueWithGroup(m_cmTask, event));
auto sts = m_cmQueue->EnqueueWithGroup(m_cmTask, event);
MOS_STATUS stmtStatus = (MOS_STATUS)(sts);
if (stmtStatus != MOS_STATUS_SUCCESS)
{
event = CM_NO_EVENT;
return stmtStatus;
}
CODECHAL_ENCODE_CHK_STATUS_RETURN(m_cmTask->Reset());
}

Expand All @@ -174,7 +180,13 @@ MOS_STATUS CodechalKernelOlpMdf::Execute(PMOS_SURFACE src, uint16_t *srcMemory_o
CODECHAL_DECODE_CHK_STATUS_RETURN(m_cmDevice->CreateThreadGroupSpace(1, 1, threadWidth, threadHeight, m_threadGroupSpaces[1]));
CODECHAL_DECODE_CHK_STATUS_RETURN(m_cmKernels[1]->AssociateThreadGroupSpace(m_threadGroupSpaces[1]));
CODECHAL_DECODE_CHK_STATUS_RETURN(m_cmTask->AddKernel(m_cmKernels[1]));
CODECHAL_DECODE_CHK_STATUS_RETURN(m_cmQueue->EnqueueWithGroup(m_cmTask, event));
auto sts = m_cmQueue->EnqueueWithGroup(m_cmTask, event);
MOS_STATUS stmtStatus = (MOS_STATUS)(sts);
if (stmtStatus != MOS_STATUS_SUCCESS)
{
event = CM_NO_EVENT;
return stmtStatus;
}
CODECHAL_ENCODE_CHK_STATUS_RETURN(m_cmTask->Reset());

return MOS_STATUS_SUCCESS;
Expand Down
12 changes: 4 additions & 8 deletions media_driver/linux/common/codec/ddi/media_libva_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,11 +411,9 @@ VAStatus DdiDecode_StatusReport(PDDI_MEDIA_CONTEXT mediaCtx, CodechalDecode *dec
PDDI_MEDIA_SURFACE_HEAP_ELEMENT mediaSurfaceHeapElmt = (PDDI_MEDIA_SURFACE_HEAP_ELEMENT)mediaCtx->pSurfaceHeap->pHeapBase;

uint32_t j = 0;
for (j = 0; j < mediaCtx->pSurfaceHeap->uiAllocatedHeapElements; j++, mediaSurfaceHeapElmt++)
for (j = 0; j < mediaCtx->pSurfaceHeap->uiAllocatedHeapElements && mediaSurfaceHeapElmt != nullptr; j++, mediaSurfaceHeapElmt++)
{
if (mediaSurfaceHeapElmt != nullptr &&
mediaSurfaceHeapElmt->pSurface != nullptr &&
bo == mediaSurfaceHeapElmt->pSurface->bo)
if (mediaSurfaceHeapElmt->pSurface != nullptr && bo == mediaSurfaceHeapElmt->pSurface->bo)
{
mediaSurfaceHeapElmt->pSurface->curStatusReport.decode.status = (uint32_t)tempNewReport.m_codecStatus;
mediaSurfaceHeapElmt->pSurface->curStatusReport.decode.errMbNum = (uint32_t)tempNewReport.m_numMbsAffected;
Expand Down Expand Up @@ -498,11 +496,9 @@ VAStatus DdiDecode_StatusReport(PDDI_MEDIA_CONTEXT mediaCtx, DecodePipelineAdapt
PDDI_MEDIA_SURFACE_HEAP_ELEMENT mediaSurfaceHeapElmt = (PDDI_MEDIA_SURFACE_HEAP_ELEMENT)mediaCtx->pSurfaceHeap->pHeapBase;

uint32_t j = 0;
for (j = 0; j < mediaCtx->pSurfaceHeap->uiAllocatedHeapElements; j++, mediaSurfaceHeapElmt++)
for (j = 0; j < mediaCtx->pSurfaceHeap->uiAllocatedHeapElements && mediaSurfaceHeapElmt != nullptr; j++, mediaSurfaceHeapElmt++)
{
if (mediaSurfaceHeapElmt != nullptr &&
mediaSurfaceHeapElmt->pSurface != nullptr &&
bo == mediaSurfaceHeapElmt->pSurface->bo)
if (mediaSurfaceHeapElmt->pSurface != nullptr && bo == mediaSurfaceHeapElmt->pSurface->bo)
{
mediaSurfaceHeapElmt->pSurface->curStatusReport.decode.status = (uint32_t)tempNewReport.codecStatus;
mediaSurfaceHeapElmt->pSurface->curStatusReport.decode.errMbNum = (uint32_t)tempNewReport.numMbsAffected;
Expand Down
4 changes: 2 additions & 2 deletions media_driver/linux/common/ddi/media_libva_caps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3428,8 +3428,8 @@ std::string MediaLibvaCaps::GetEncodeCodecKey(VAProfile profile, VAEntrypoint en

bool MediaLibvaCaps::IsDecConfigId(VAConfigID configId)
{
return ((configId >= DDI_CODEC_GEN_CONFIG_ATTRIBUTES_DEC_BASE) &&
(configId < (DDI_CODEC_GEN_CONFIG_ATTRIBUTES_DEC_BASE + m_decConfigs.size())));
// configId >= DDI_CODEC_GEN_CONFIG_ATTRIBUTES_DEC_BASE always be true
return configId < (DDI_CODEC_GEN_CONFIG_ATTRIBUTES_DEC_BASE + m_decConfigs.size());
}

bool MediaLibvaCaps::IsEncConfigId(VAConfigID configId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1068,11 +1068,9 @@ VAStatus DdiDecodeFunctions::StatusReport(
PDDI_MEDIA_SURFACE_HEAP_ELEMENT mediaSurfaceHeapElmt = (PDDI_MEDIA_SURFACE_HEAP_ELEMENT)mediaCtx->pSurfaceHeap->pHeapBase;

uint32_t j = 0;
for (j = 0; j < mediaCtx->pSurfaceHeap->uiAllocatedHeapElements; j++, mediaSurfaceHeapElmt++)
for (j = 0; j < mediaCtx->pSurfaceHeap->uiAllocatedHeapElements && mediaSurfaceHeapElmt != nullptr; j++, mediaSurfaceHeapElmt++)
{
if (mediaSurfaceHeapElmt != nullptr &&
mediaSurfaceHeapElmt->pSurface != nullptr &&
bo == mediaSurfaceHeapElmt->pSurface->bo)
if (mediaSurfaceHeapElmt->pSurface != nullptr && bo == mediaSurfaceHeapElmt->pSurface->bo)
{
mediaSurfaceHeapElmt->pSurface->curStatusReport.decode.status = (uint32_t)tempNewReport.codecStatus;
mediaSurfaceHeapElmt->pSurface->curStatusReport.decode.errMbNum = (uint32_t)tempNewReport.numMbsAffected;
Expand Down

0 comments on commit e37cccb

Please sign in to comment.