Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add refresh_frame_context wa #1854

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions media_driver/linux/common/codec/ddi/media_ddi_encode_vp9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,16 @@ VAStatus DdiEncodeVp9::EncodeInCodecHal(uint32_t numSlices)
CODEC_VP9_ENCODE_SEQUENCE_PARAMS *seqParams = (PCODEC_VP9_ENCODE_SEQUENCE_PARAMS)(m_encodeCtx->pSeqParams);
CODEC_VP9_ENCODE_PIC_PARAMS *vp9PicParam = (PCODEC_VP9_ENCODE_PIC_PARAMS)(m_encodeCtx->pPicParams);

if (!headerInsertFlag &&
vp9PicParam->PicFlags.fields.frame_type == CODEC_VP9_KEY_FRAME &&
m_isPreviousFrameKey)
{
vp9PicParam->PicFlags.fields.refresh_frame_context = 0;
}

// Update the flag for the next frame
m_isPreviousFrameKey = (vp9PicParam->PicFlags.fields.frame_type == CODEC_VP9_KEY_FRAME);

EncoderParams encodeParams;
MOS_ZeroMemory(&encodeParams, sizeof(EncoderParams));
encodeParams.ExecCodecFunction = m_encodeCtx->codecFunction;
Expand Down Expand Up @@ -393,6 +403,8 @@ VAStatus DdiEncodeVp9::ContextInitialize(CodechalSetting *codecHalSettings)
/* RT is used as the default target usage */
vp9TargetUsage = TARGETUSAGE_RT_SPEED;

m_isPreviousFrameKey = false;

return vaStatus;
}

Expand Down
2 changes: 2 additions & 0 deletions media_driver/linux/common/codec/ddi/media_ddi_encode_vp9.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,4 +325,6 @@ class DdiEncodeVp9 : public DdiEncodeBase
uint8_t vp9TargetUsage = 0;

bool isSegParamsChanged = false;

bool m_isPreviousFrameKey = false;
};
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,16 @@ VAStatus DdiEncodeVp9::EncodeInCodecHal(uint32_t numSlices)
CODEC_VP9_ENCODE_SEQUENCE_PARAMS *seqParams = (PCODEC_VP9_ENCODE_SEQUENCE_PARAMS)(m_encodeCtx->pSeqParams);
CODEC_VP9_ENCODE_PIC_PARAMS *vp9PicParam = (PCODEC_VP9_ENCODE_PIC_PARAMS)(m_encodeCtx->pPicParams);

if (!headerInsertFlag &&
vp9PicParam->PicFlags.fields.frame_type == CODEC_VP9_KEY_FRAME &&
m_isPreviousFrameKey)
{
vp9PicParam->PicFlags.fields.refresh_frame_context = 0;
}

// Update the flag for the next frame
m_isPreviousFrameKey = (vp9PicParam->PicFlags.fields.frame_type == CODEC_VP9_KEY_FRAME);

EncoderParams encodeParams;
MOS_ZeroMemory(&encodeParams, sizeof(EncoderParams));
encodeParams.ExecCodecFunction = m_encodeCtx->codecFunction;
Expand Down Expand Up @@ -404,6 +414,8 @@ VAStatus DdiEncodeVp9::ContextInitialize(CodechalSetting *codecHalSettings)
/* RT is used as the default target usage */
vp9TargetUsage = TARGETUSAGE_RT_SPEED;

m_isPreviousFrameKey = false;

return vaStatus;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,8 @@ class DdiEncodeVp9 : public encode::DdiEncodeBase

bool isSegParamsChanged = false;

bool m_isPreviousFrameKey = false;

MEDIA_CLASS_DEFINE_END(encode__DdiEncodeVp9)
};

Expand Down