Skip to content

Commit 9a780eb

Browse files
committed
Add refresh_frame_context wa
1 parent 9049cf7 commit 9a780eb

File tree

5 files changed

+36
-0
lines changed

5 files changed

+36
-0
lines changed

media_driver/linux/common/codec/ddi/media_ddi_encode_vp9.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,16 @@ VAStatus DdiEncodeVp9::EncodeInCodecHal(uint32_t numSlices)
9393
CODEC_VP9_ENCODE_SEQUENCE_PARAMS *seqParams = (PCODEC_VP9_ENCODE_SEQUENCE_PARAMS)(m_encodeCtx->pSeqParams);
9494
CODEC_VP9_ENCODE_PIC_PARAMS *vp9PicParam = (PCODEC_VP9_ENCODE_PIC_PARAMS)(m_encodeCtx->pPicParams);
9595

96+
if (!headerInsertFlag &&
97+
vp9PicParam->PicFlags.fields.frame_type == CODEC_VP9_KEY_FRAME &&
98+
m_isPreviousFrameKey)
99+
{
100+
vp9PicParam->PicFlags.fields.refresh_frame_context = 0;
101+
}
102+
103+
// Update the flag for the next frame
104+
m_isPreviousFrameKey = (vp9PicParam->PicFlags.fields.frame_type == CODEC_VP9_KEY_FRAME);
105+
96106
EncoderParams encodeParams;
97107
MOS_ZeroMemory(&encodeParams, sizeof(EncoderParams));
98108
encodeParams.ExecCodecFunction = m_encodeCtx->codecFunction;
@@ -393,6 +403,8 @@ VAStatus DdiEncodeVp9::ContextInitialize(CodechalSetting *codecHalSettings)
393403
/* RT is used as the default target usage */
394404
vp9TargetUsage = TARGETUSAGE_RT_SPEED;
395405

406+
m_isPreviousFrameKey = false;
407+
396408
return vaStatus;
397409
}
398410

media_driver/linux/common/codec/ddi/media_ddi_encode_vp9.h

+2
Original file line numberDiff line numberDiff line change
@@ -325,4 +325,6 @@ class DdiEncodeVp9 : public DdiEncodeBase
325325
uint8_t vp9TargetUsage = 0;
326326

327327
bool isSegParamsChanged = false;
328+
329+
bool m_isPreviousFrameKey = false;
328330
};

media_softlet/agnostic/common/codec/hal/enc/hevc/packet/encode_hevc_vdenc_packet.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,7 @@ namespace encode
642642
return MOS_STATUS_SUCCESS;
643643
}
644644

645+
//Please check this function and judge whether there is any coverity issue in this function.
645646
MOS_STATUS HevcVdencPkt::AddOneTileCommands(
646647
MOS_COMMAND_BUFFER &cmdBuffer,
647648
uint32_t tileRow,
@@ -694,6 +695,13 @@ namespace encode
694695

695696
SETPAR_AND_ADDCMD(VDENC_PIPE_MODE_SELECT, m_vdencItf, tempCmdBuffer);
696697

698+
return eStatus;
699+
700+
}
701+
702+
703+
704+
697705
// for Gen11+, we need to add MFX wait for both KIN and VRT before and after HCP Pipemode select...
698706
auto &mfxWaitParams = m_miItf->MHW_GETPAR_F(MFX_WAIT)();
699707
mfxWaitParams = {};

media_softlet/linux/common/codec/ddi/enc/ddi_encode_vp9_specific.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,16 @@ VAStatus DdiEncodeVp9::EncodeInCodecHal(uint32_t numSlices)
9292
CODEC_VP9_ENCODE_SEQUENCE_PARAMS *seqParams = (PCODEC_VP9_ENCODE_SEQUENCE_PARAMS)(m_encodeCtx->pSeqParams);
9393
CODEC_VP9_ENCODE_PIC_PARAMS *vp9PicParam = (PCODEC_VP9_ENCODE_PIC_PARAMS)(m_encodeCtx->pPicParams);
9494

95+
if (!headerInsertFlag &&
96+
vp9PicParam->PicFlags.fields.frame_type == CODEC_VP9_KEY_FRAME &&
97+
m_isPreviousFrameKey)
98+
{
99+
vp9PicParam->PicFlags.fields.refresh_frame_context = 0;
100+
}
101+
102+
// Update the flag for the next frame
103+
m_isPreviousFrameKey = (vp9PicParam->PicFlags.fields.frame_type == CODEC_VP9_KEY_FRAME);
104+
95105
EncoderParams encodeParams;
96106
MOS_ZeroMemory(&encodeParams, sizeof(EncoderParams));
97107
encodeParams.ExecCodecFunction = m_encodeCtx->codecFunction;
@@ -404,6 +414,8 @@ VAStatus DdiEncodeVp9::ContextInitialize(CodechalSetting *codecHalSettings)
404414
/* RT is used as the default target usage */
405415
vp9TargetUsage = TARGETUSAGE_RT_SPEED;
406416

417+
m_isPreviousFrameKey = false;
418+
407419
return vaStatus;
408420
}
409421

media_softlet/linux/common/codec/ddi/enc/ddi_encode_vp9_specific.h

+2
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,8 @@ class DdiEncodeVp9 : public encode::DdiEncodeBase
357357

358358
bool isSegParamsChanged = false;
359359

360+
bool m_isPreviousFrameKey = false;
361+
360362
MEDIA_CLASS_DEFINE_END(encode__DdiEncodeVp9)
361363
};
362364

0 commit comments

Comments
 (0)