Skip to content
This repository was archived by the owner on May 17, 2023. It is now read-only.

Commit d568f57

Browse files
hongbolvOleg Nabiullin
authored and
Oleg Nabiullin
committed
Fixed the LA sliding window works with BPyramid
1 parent 141badc commit d568f57

File tree

2 files changed

+10
-37
lines changed

2 files changed

+10
-37
lines changed

_studio/mfx_lib/encode_hw/h264/src/mfx_h264_encode_hw_utils_new.cpp

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2018 Intel Corporation
1+
// Copyright (c) 2019 Intel Corporation
22
//
33
// Permission is hereby granted, free of charge, to any person obtaining a copy
44
// of this software and associated documentation files (the "Software"), to deal
@@ -2477,22 +2477,20 @@ mfxStatus MfxHwH264Encode::CodeAsSkipFrame( VideoCORE & core,
24772477
return MFX_ERR_UNDEFINED_BEHAVIOR;
24782478
}
24792479
}
2480-
if (task.GetFrameType() & MFX_FRAMETYPE_P)
2480+
else
24812481
{
2482-
DpbFrame& refFrame = task.m_dpb[0][task.m_list0[0][0] & 127];
2482+
mfxI32 fid = task.m_fid[0];
2483+
MFX_CHECK(task.m_list0[fid].Size(), MFX_ERR_UNDEFINED_BEHAVIOR);
2484+
DpbFrame& refFrame = task.m_dpb[0][task.m_list0[fid][0] & 127];
24832485
mfxFrameData curr = {};
24842486
mfxFrameData ref = {};
24852487
curr.MemId = task.m_midRaw;
24862488
ref.MemId = refFrame.m_midRec;
24872489

24882490
mfxFrameSurface1 surfSrc = { {0,}, video.mfx.FrameInfo, ref };
24892491
mfxFrameSurface1 surfDst = { {0,}, video.mfx.FrameInfo, curr };
2490-
sts = core.DoFastCopyWrapper(&surfDst,MFX_MEMTYPE_INTERNAL_FRAME|MFX_MEMTYPE_DXVA2_DECODER_TARGET|MFX_MEMTYPE_FROM_ENCODE, &surfSrc, MFX_MEMTYPE_INTERNAL_FRAME|MFX_MEMTYPE_DXVA2_DECODER_TARGET|MFX_MEMTYPE_FROM_ENCODE);
2491-
2492-
}
2493-
if (task.GetFrameType() & MFX_FRAMETYPE_B)
2494-
{
2495-
task.m_ctrl.SkipFrame = 1;
2492+
sts = core.DoFastCopyWrapper(&surfDst,MFX_MEMTYPE_INTERNAL_FRAME|MFX_MEMTYPE_DXVA2_DECODER_TARGET|MFX_MEMTYPE_FROM_ENCODE,
2493+
&surfSrc, MFX_MEMTYPE_INTERNAL_FRAME|MFX_MEMTYPE_DXVA2_DECODER_TARGET|MFX_MEMTYPE_FROM_ENCODE);
24962494
}
24972495

24982496
return sts;

_studio/mfx_lib/shared/src/mfx_h264_enc_common_hw.cpp

+3-28
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2018 Intel Corporation
1+
// Copyright (c) 2019 Intel Corporation
22
//
33
// Permission is hereby granted, free of charge, to any person obtaining a copy
44
// of this software and associated documentation files (the "Software"), to deal
@@ -4392,7 +4392,7 @@ mfxStatus MfxHwH264Encode::CheckVideoParamQueryLike(
43924392

43934393
if (!CheckRangeDflt(extOpt2->SkipFrame, 0, 3, 0)) changed = true;
43944394

4395-
if ( extOpt2->SkipFrame && hwCaps.SkipFrame == 0 && par.mfx.RateControlMethod != MFX_RATECONTROL_CQP && par.mfx.RateControlMethod != MFX_RATECONTROL_LA_HRD)
4395+
if ( extOpt2->SkipFrame && hwCaps.SkipFrame == 0 && par.mfx.RateControlMethod != MFX_RATECONTROL_CQP)
43964396
{
43974397
extOpt2->SkipFrame = 0;
43984398
changed = true;
@@ -4499,19 +4499,6 @@ mfxStatus MfxHwH264Encode::CheckVideoParamQueryLike(
44994499
if (!CheckRangeDflt(extOpt2->MinQPP, 0, (extOpt2->MaxQPP ? extOpt2->MaxQPP : 51), 0)) changed = true;
45004500
if (!CheckRangeDflt(extOpt2->MinQPB, 0, (extOpt2->MaxQPB ? extOpt2->MaxQPB : 51), 0)) changed = true;
45014501
}
4502-
if ((extOpt3->WinBRCSize > 0 && (par.mfx.RateControlMethod != MFX_RATECONTROL_VBR && par.mfx.RateControlMethod != MFX_RATECONTROL_QVBR)) || (par.mfx.RateControlMethod == MFX_RATECONTROL_LA_HRD))
4503-
{
4504-
if (extOpt2->SkipFrame!=0 && extOpt2->SkipFrame != MFX_SKIPFRAME_INSERT_DUMMY)
4505-
{
4506-
extOpt2->SkipFrame = MFX_SKIPFRAME_INSERT_DUMMY;
4507-
changed = true;
4508-
}
4509-
if (extOpt2->BRefType != MFX_B_REF_OFF && extOpt2->BRefType != 0)
4510-
{
4511-
extOpt2->BRefType = MFX_B_REF_OFF;
4512-
changed = true;
4513-
}
4514-
}
45154502
if (!CheckTriStateOption(extOpt3->BRCPanicMode)) changed = true;
45164503
if (IsOff(extOpt3->BRCPanicMode)
45174504
&& (bRateControlLA(par.mfx.RateControlMethod)
@@ -5215,11 +5202,6 @@ namespace
52155202
return false;
52165203
return true;
52175204
}
5218-
5219-
bool IsPowerOf2(mfxU32 n)
5220-
{
5221-
return (n & (n - 1)) == 0;
5222-
}
52235205
};
52245206

52255207
bool IsHRDBasedBRCMethod(mfxU16 RateControlMethod)
@@ -5426,11 +5408,6 @@ void MfxHwH264Encode::SetDefaults(
54265408
}
54275409
}
54285410

5429-
if ((!extOpt2->SkipFrame) && ((extOpt3->WinBRCSize > 0 && (par.mfx.RateControlMethod != MFX_RATECONTROL_VBR && par.mfx.RateControlMethod != MFX_RATECONTROL_QVBR)) || par.mfx.RateControlMethod == MFX_RATECONTROL_LA_HRD))
5430-
{
5431-
extOpt2->SkipFrame = MFX_SKIPFRAME_INSERT_DUMMY;
5432-
}
5433-
54345411
//WA for MVC quality problem on progressive content.
54355412
if (IsMvcProfile(par.mfx.CodecProfile)) {
54365413
extDdi->NumActiveRefP = extDdi->NumActiveRefBL0 = extDdi->NumActiveRefBL1 = 1;
@@ -5509,9 +5486,7 @@ void MfxHwH264Encode::SetDefaults(
55095486
if (platform >= MFX_HW_HSW && platform != MFX_HW_VLV &&
55105487
IsDyadic(par.calcParam.scale, par.calcParam.numTemporalLayer) &&
55115488
par.mfx.GopRefDist >= 4 &&
5512-
IsPowerOf2(par.mfx.GopRefDist) &&
5513-
par.mfx.GopPicSize % par.mfx.GopRefDist == 0 &&
5514-
!bRateControlLA(par.mfx.RateControlMethod) &&
5489+
par.mfx.RateControlMethod != MFX_RATECONTROL_LA_EXT &&
55155490
(!par.mfx.NumRefFrame || par.mfx.NumRefFrame >= GetMinNumRefFrameForPyramid(par)))
55165491
{
55175492
extOpt2->BRefType = mfxU16(par.mfx.FrameInfo.PicStruct == MFX_PICSTRUCT_PROGRESSIVE ? MFX_B_REF_PYRAMID : MFX_B_REF_OFF);

0 commit comments

Comments
 (0)