Skip to content

Commit

Permalink
[Decode][Coverity] Clean some coverity issues
Browse files Browse the repository at this point in the history
1. Uninitialized issues
2. not check return value issues
3. constant expression issues
  • Loading branch information
pengxin99 authored and intel-mediadev committed Aug 15, 2023
1 parent b9b424d commit d52278b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2820,6 +2820,7 @@ CodechalDecodeHevc::CodechalDecodeHevc(
MOS_ZeroMemory(&m_hevcIqMatrixParams,sizeof(m_hevcIqMatrixParams));
MOS_ZeroMemory(&m_destSurface,sizeof(m_destSurface));
MOS_ZeroMemory(&m_currPic,sizeof(m_currPic));
MOS_ZeroMemory(&m_hevcMvList, CODEC_NUM_HEVC_MV_BUFFERS * sizeof(CODECHAL_DECODE_HEVC_MV_LIST));

m_hcpInUse = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ MOS_STATUS CodechalDecodeNV12ToP010::Execute(
m_cmDevice->CreateSurface2D(srcResource, srcCmSurface2D);
CODECHAL_DECODE_CHK_NULL_RETURN(srcCmSurface2D);
CmSurface2D *dstCmSurface2D = nullptr;
m_cmDevice->CreateSurface2D(dstResource, dstCmSurface2D);
CODECHAL_DECODE_CHK_STATUS_RETURN(m_cmDevice->CreateSurface2D(dstResource, dstCmSurface2D));
CODECHAL_DECODE_CHK_NULL_RETURN(dstCmSurface2D);

uint32_t surfaceWidth, surfaceHeight;
Expand All @@ -108,13 +108,13 @@ MOS_STATUS CodechalDecodeNV12ToP010::Execute(
threadHeight,
m_cmThreadSpace));

m_cmKernel->SetThreadCount(threadWidth * threadHeight);
m_cmKernel->AssociateThreadSpace(m_cmThreadSpace);
m_cmKernel->SetKernelArg(0, sizeof(SurfaceIndex), srcSurfaceIndex);
m_cmKernel->SetKernelArg(1, sizeof(SurfaceIndex), dstSurfaceIndex);
CODECHAL_DECODE_CHK_STATUS_RETURN(m_cmKernel->SetThreadCount(threadWidth * threadHeight));
CODECHAL_DECODE_CHK_STATUS_RETURN(m_cmKernel->AssociateThreadSpace(m_cmThreadSpace));
CODECHAL_DECODE_CHK_STATUS_RETURN(m_cmKernel->SetKernelArg(0, sizeof(SurfaceIndex), srcSurfaceIndex));
CODECHAL_DECODE_CHK_STATUS_RETURN(m_cmKernel->SetKernelArg(1, sizeof(SurfaceIndex), dstSurfaceIndex));

m_cmTask->AddSync();
m_cmTask->AddKernel(m_cmKernel);
CODECHAL_DECODE_CHK_STATUS_RETURN(m_cmTask->AddSync());
CODECHAL_DECODE_CHK_STATUS_RETURN(m_cmTask->AddKernel(m_cmKernel));

CmEvent *eventKernel;
CODECHAL_DECODE_CHK_STATUS_RETURN(m_cmQueue->Enqueue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4850,6 +4850,7 @@ CodechalDecodeVc1::CodechalDecodeVc1(
MOS_ZeroMemory(&m_resBitplaneBuffer, sizeof(m_resBitplaneBuffer));
MOS_ZeroMemory(&m_resSyncObjectWaContextInUse, sizeof(m_resSyncObjectWaContextInUse));
MOS_ZeroMemory(&m_resSyncObjectVideoContextInUse, sizeof(m_resSyncObjectVideoContextInUse));
MOS_ZeroMemory(m_presReferences, (sizeof(PMOS_RESOURCE) * CODEC_MAX_NUM_REF_FRAME_NON_AVC));
#if (_DEBUG || _RELEASE_INTERNAL)
m_reportFrameCrc = true;
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ MOS_STATUS Av1DecodePkt::StartStatusReport(uint32_t srType, MOS_COMMAND_BUFFER*
{
DECODE_FUNC_CALL();

MediaPacket::StartStatusReportNext(srType, cmdBuffer);
DECODE_CHK_STATUS(MediaPacket::StartStatusReportNext(srType, cmdBuffer));

SetPerfTag(CODECHAL_DECODE_MODE_AV1VLD, m_av1BasicFeature->m_pictureCodingType);
MediaPerfProfiler *perfProfiler = MediaPerfProfiler::Instance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ bool DecodeScalabilityOption::IsScalabilityOptionMatched(ScalabilityPars *params
DecodeScalabilityPars *decPars = (DecodeScalabilityPars *)params;

DecodeScalabilityOption newOption;
newOption.SetScalabilityOption(params);
if(MOS_STATUS_SUCCESS != newOption.SetScalabilityOption(params))
{
return false;
}

if (m_numPipe != newOption.GetNumPipe() ||
m_usingSFC != newOption.IsUsingSFC() ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ namespace decode
PMOS_BUFFER m_resCABACSyntaxStreamOutBuffer = nullptr; //!< Handle of CABAC syntax stream out buffer
PMOS_BUFFER m_resCABACStreamOutSizeBuffer = nullptr; //!< Handle of CABAC stream out size buffer

mutable uint8_t m_curHcpSurfStateId = 0;
PMOS_SURFACE psSurface; // 2D surface parameters
mutable uint8_t m_curHcpSurfStateId = 0;
PMOS_SURFACE psSurface = nullptr;; // 2D surface parameters
static const uint32_t m_vp9ScalingFactor = (1 << 14);
static const uint32_t m_rawUVPlaneAlignment = 4; //! starting Gen9 the alignment is relaxed to 4x instead of 16x
static const uint32_t m_reconUVPlaneAlignment = 8;
Expand Down

0 comments on commit d52278b

Please sign in to comment.