File tree 4 files changed +28
-0
lines changed
media_driver/linux/common/codec/ddi
media_softlet/linux/common/codec/ddi/enc
4 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,16 @@ VAStatus DdiEncodeVp9::EncodeInCodecHal(uint32_t numSlices)
93
93
CODEC_VP9_ENCODE_SEQUENCE_PARAMS *seqParams = (PCODEC_VP9_ENCODE_SEQUENCE_PARAMS)(m_encodeCtx->pSeqParams );
94
94
CODEC_VP9_ENCODE_PIC_PARAMS *vp9PicParam = (PCODEC_VP9_ENCODE_PIC_PARAMS)(m_encodeCtx->pPicParams );
95
95
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
+
96
106
EncoderParams encodeParams;
97
107
MOS_ZeroMemory (&encodeParams, sizeof (EncoderParams));
98
108
encodeParams.ExecCodecFunction = m_encodeCtx->codecFunction ;
@@ -393,6 +403,8 @@ VAStatus DdiEncodeVp9::ContextInitialize(CodechalSetting *codecHalSettings)
393
403
/* RT is used as the default target usage */
394
404
vp9TargetUsage = TARGETUSAGE_RT_SPEED;
395
405
406
+ m_isPreviousFrameKey = false ;
407
+
396
408
return vaStatus;
397
409
}
398
410
Original file line number Diff line number Diff line change @@ -325,4 +325,6 @@ class DdiEncodeVp9 : public DdiEncodeBase
325
325
uint8_t vp9TargetUsage = 0 ;
326
326
327
327
bool isSegParamsChanged = false ;
328
+
329
+ bool m_isPreviousFrameKey = false ;
328
330
};
Original file line number Diff line number Diff line change @@ -92,6 +92,16 @@ VAStatus DdiEncodeVp9::EncodeInCodecHal(uint32_t numSlices)
92
92
CODEC_VP9_ENCODE_SEQUENCE_PARAMS *seqParams = (PCODEC_VP9_ENCODE_SEQUENCE_PARAMS)(m_encodeCtx->pSeqParams );
93
93
CODEC_VP9_ENCODE_PIC_PARAMS *vp9PicParam = (PCODEC_VP9_ENCODE_PIC_PARAMS)(m_encodeCtx->pPicParams );
94
94
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
+
95
105
EncoderParams encodeParams;
96
106
MOS_ZeroMemory (&encodeParams, sizeof (EncoderParams));
97
107
encodeParams.ExecCodecFunction = m_encodeCtx->codecFunction ;
@@ -404,6 +414,8 @@ VAStatus DdiEncodeVp9::ContextInitialize(CodechalSetting *codecHalSettings)
404
414
/* RT is used as the default target usage */
405
415
vp9TargetUsage = TARGETUSAGE_RT_SPEED;
406
416
417
+ m_isPreviousFrameKey = false ;
418
+
407
419
return vaStatus;
408
420
}
409
421
Original file line number Diff line number Diff line change @@ -357,6 +357,8 @@ class DdiEncodeVp9 : public encode::DdiEncodeBase
357
357
358
358
bool isSegParamsChanged = false ;
359
359
360
+ bool m_isPreviousFrameKey = false ;
361
+
360
362
MEDIA_CLASS_DEFINE_END (encode__DdiEncodeVp9)
361
363
};
362
364
You can’t perform that action at this time.
0 commit comments