History

lavc/qsvdec: fix keyframes

MFX_FRAMETYPE_IDR is ORed to the frame type for AVC and HEVC keyframes, and MFX_FRAMETYPE_I is taken as keyframe flag for other codecs when getting the output surface from the SDK, hence we may mark the output frame as keyframe accordingly.

Haihao Xiang committed 2 years ago

Commit dbdd9cc1 parent a11122f1 file · +8 −2Browse files

Unified · Split

libavcodec/qsvdec.c+8−2
@@ -931,12 +931,18 @@ static int qsv_decode(AVCodecContext *avctx, QSVContext *q, · 930 unmodified lines
931 frame->flags |= AV_FRAME_FLAG_INTERLACED *931 frame->flags |= AV_FRAME_FLAG_INTERLACED *
932 !(outsurf->Info.PicStruct & MFX_PICSTRUCT_PROGRESSIVE);932 !(outsurf->Info.PicStruct & MFX_PICSTRUCT_PROGRESSIVE);
933 frame->pict_type = ff_qsv_map_pictype(aframe.frame->dec_info.FrameType);933 frame->pict_type = ff_qsv_map_pictype(aframe.frame->dec_info.FrameType);
934 //Key frame is IDR frame is only suitable for H264. For HEVC, IRAPs are key frames.934
935 if (avctx->codec_id == AV_CODEC_ID_H264) {935 if (avctx->codec_id == AV_CODEC_ID_H264 ||
936 avctx->codec_id == AV_CODEC_ID_HEVC) {
936 if (aframe.frame->dec_info.FrameType & MFX_FRAMETYPE_IDR)937 if (aframe.frame->dec_info.FrameType & MFX_FRAMETYPE_IDR)
937 frame->flags |= AV_FRAME_FLAG_KEY;938 frame->flags |= AV_FRAME_FLAG_KEY;
938 else939 else
939 frame->flags &= ~AV_FRAME_FLAG_KEY;940 frame->flags &= ~AV_FRAME_FLAG_KEY;
941 } else {
942 if (aframe.frame->dec_info.FrameType & MFX_FRAMETYPE_I)
943 frame->flags |= AV_FRAME_FLAG_KEY;
944 else
945 frame->flags &= ~AV_FRAME_FLAG_KEY;
940 }946 }
941 frame->crop_left = outsurf->Info.CropX;947 frame->crop_left = outsurf->Info.CropX;
942 frame->crop_top = outsurf->Info.CropY;948 frame->crop_top = outsurf->Info.CropY;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t