Skip to content

Commit

Permalink
[Encode] Fix Coverity issue
Browse files Browse the repository at this point in the history
Refactor to avoid (1) unused value; (2) unchecked retrun value;
  • Loading branch information
perrchen authored and intel-mediadev committed Oct 19, 2023
1 parent c5a8a94 commit f7e19d4
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 10 deletions.
2 changes: 0 additions & 2 deletions media_driver/agnostic/gen8/codec/hal/codechal_fei_avc_g8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6196,7 +6196,6 @@ MOS_STATUS CodechalEncodeAvcEncFeiG8::SendAvcMbEncSurfaces(PMOS_COMMAND_BUFFER c
// FEI distortion surface
if (feiPicParams->DistortionEnable)
{
size = params->dwFrameWidthInMb * params->dwFrameFieldHeightInMb * 48;
MOS_ZeroMemory(&surfaceCodecParams, sizeof(CODECHAL_SURFACE_CODEC_PARAMS));
surfaceCodecParams.presBuffer = &(feiPicParams->resDistortion);
surfaceCodecParams.dwOffset = 0;
Expand Down Expand Up @@ -6225,7 +6224,6 @@ MOS_STATUS CodechalEncodeAvcEncFeiG8::SendAvcMbEncSurfaces(PMOS_COMMAND_BUFFER c
&surfaceCodecParams,
kernelState));

size = params->dwFrameWidthInMb * params->dwFrameFieldHeightInMb + 3;
MOS_ZeroMemory(&surfaceCodecParams, sizeof(CODECHAL_SURFACE_CODEC_PARAMS));
surfaceCodecParams.presBuffer = &(feiPicParams->resMBQp);
surfaceCodecParams.dwOffset = 0;
Expand Down
2 changes: 0 additions & 2 deletions media_driver/agnostic/gen9/codec/hal/codechal_fei_avc_g9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6198,7 +6198,6 @@ MOS_STATUS CodechalEncodeAvcEncFeiG9::SendAvcMbEncSurfaces(PMOS_COMMAND_BUFFER c
// FEI distortion surface
if (feiPicParams->DistortionEnable)
{
size = params->dwFrameWidthInMb * params->dwFrameFieldHeightInMb * 48;
MOS_ZeroMemory(&surfaceCodecParams, sizeof(CODECHAL_SURFACE_CODEC_PARAMS));
surfaceCodecParams.presBuffer = &(feiPicParams->resDistortion);
surfaceCodecParams.dwOffset = 0;
Expand Down Expand Up @@ -6227,7 +6226,6 @@ MOS_STATUS CodechalEncodeAvcEncFeiG9::SendAvcMbEncSurfaces(PMOS_COMMAND_BUFFER c
&surfaceCodecParams,
kernelState));

size = params->dwFrameWidthInMb * params->dwFrameFieldHeightInMb + 3;
MOS_ZeroMemory(&surfaceCodecParams, sizeof(CODECHAL_SURFACE_CODEC_PARAMS));
surfaceCodecParams.presBuffer = &(feiPicParams->resMBQp);
surfaceCodecParams.dwOffset = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,6 @@ MHW_SETPAR_DECL_SRC(HEVC_VP9_RDOQ_STATE, HevcBasicFeature)
lambdaDouble *= MOS_MAX(1.00, MOS_MIN(1.6, 1.0 + 0.6 / 12.0 * (qpTemp - 10.0)));
lambdaDouble = lambdaDouble * 16 + 0.5;
lambda = (uint32_t)floor(lambdaDouble);
lambdaDouble = (lambdaDouble > 65535) ? 65535 : lambdaDouble;
lambda = CodecHal_Clip3(0, 0xffff, lambda);
params.lambdaTab[1][0][qp] = (uint16_t)lambda;
}
Expand All @@ -1332,7 +1331,6 @@ MHW_SETPAR_DECL_SRC(HEVC_VP9_RDOQ_STATE, HevcBasicFeature)
lambdaDouble *= MOS_MAX(0.95, MOS_MIN(1.20, 0.25 / 12.0 * (qpTemp - 10.0) + 0.95));
lambdaDouble = lambdaDouble * 16 + 0.5;
lambda = (uint32_t)floor(lambdaDouble);
lambdaDouble = (lambdaDouble > 65535) ? 65535 : lambdaDouble;
lambda = CodecHal_Clip3(0, 0xffff, lambda);
params.lambdaTab[1][1][qp] = (uint16_t)lambda;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,6 @@ MHW_SETPAR_DECL_SRC(HEVC_VP9_RDOQ_STATE, PreEncBasicFeature)
lambdaDouble *= MOS_MAX(1.00, MOS_MIN(1.6, 1.0 + 0.6 / 12.0 * (qpTemp - 10.0)));
lambdaDouble = lambdaDouble * 16 + 0.5;
lambda = (uint32_t)floor(lambdaDouble);
lambdaDouble = (lambdaDouble > 65535) ? 65535 : lambdaDouble;
lambda = CodecHal_Clip3(0, 0xffff, lambda);
params.lambdaTab[1][0][qp] = (uint16_t)lambda;
}
Expand All @@ -1054,7 +1053,6 @@ MHW_SETPAR_DECL_SRC(HEVC_VP9_RDOQ_STATE, PreEncBasicFeature)
lambdaDouble *= MOS_MAX(0.95, MOS_MIN(1.20, 0.25 / 12.0 * (qpTemp - 10.0) + 0.95));
lambdaDouble = lambdaDouble * 16 + 0.5;
lambda = (uint32_t)floor(lambdaDouble);
lambdaDouble = (lambdaDouble > 65535) ? 65535 : lambdaDouble;
lambda = CodecHal_Clip3(0, 0xffff, lambda);
params.lambdaTab[1][1][qp] = (uint16_t)lambda;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ namespace encode {
params.dwResourceOffset = 0; //sizeof(uint64_t);
params.postSyncOperation = MHW_FLUSH_WRITE_TIMESTAMP_REG;
params.bQWordEnable = 1;
m_miItf->MHW_ADDCMD_F(MI_FLUSH_DW)(cmdBuffer);
ENCODE_CHK_STATUS_RETURN(m_miItf->MHW_ADDCMD_F(MI_FLUSH_DW)(cmdBuffer));

return MOS_STATUS_SUCCESS;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,6 @@ MOS_STATUS Vp9EncodeTile::SetTileData(void *params)

cuLevelStreamoutOffset += (m_tileData[idx].tileWidthInMinCbMinus1 + 1) * (m_tileData[idx].tileHeightInMinCbMinus1 + 1);
sliceSizeStreamoutOffset += (m_tileData[idx].tileWidthInMinCbMinus1 + 1) * (m_tileData[idx].tileHeightInMinCbMinus1 + 1);
sseRowstoreOffset += (numLcuInTile * basicFeature->m_sizeOfSseSrcPixelRowStoreBufferPerLcu) / CODECHAL_CACHELINE_SIZE;
bitstreamByteOffset += bitstreamSizePerTile;
numLcusInTiles += numLcuInTile;

Expand Down

0 comments on commit f7e19d4

Please sign in to comment.