Skip to content

Commit

Permalink
[Encode] Add random access B 16 support for ICQ mode
Browse files Browse the repository at this point in the history
Add random access B 16 support to imporve quality for smooth content.
  • Loading branch information
guanjunz authored and intel-mediadev committed Jul 1, 2024
1 parent 80f88cf commit 65fcac0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ namespace encode
dmem->UPD_Asyn = 0;
dmem->UPD_EnableAdaptiveRounding = (m_basicFeature->m_roundingMethod == RoundingMethod::adaptiveRounding);

if (seqParams->GopRefDist == 8)
if (seqParams->GopRefDist == 16 && m_rcMode == RATECONTROL_CQL)
dmem->UPD_MaxBRCLevel = 4;
else if (seqParams->GopRefDist == 8)
dmem->UPD_MaxBRCLevel = 3;
else if (seqParams->GopRefDist == 4)
dmem->UPD_MaxBRCLevel = 2;
Expand All @@ -230,7 +232,8 @@ namespace encode
{1, AV1_BRC_FRAME_TYPE_P_OR_LB},
{2, AV1_BRC_FRAME_TYPE_B},
{3, AV1_BRC_FRAME_TYPE_B1},
{4, AV1_BRC_FRAME_TYPE_B2}};
{4, AV1_BRC_FRAME_TYPE_B2},
{5, AV1_BRC_FRAME_TYPE_B3}};
dmem->UPD_CurrFrameType = hierchLevelPlus1_to_brclevel.count(picParams->HierarchLevelPlus1) ? hierchLevelPlus1_to_brclevel[picParams->HierarchLevelPlus1] : AV1_BRC_FRAME_TYPE_INVALID;
//Invalid HierarchLevelPlus1 or LBD frames at level 3 eror check.
if ((dmem->UPD_CurrFrameType == AV1_BRC_FRAME_TYPE_INVALID) ||
Expand Down Expand Up @@ -504,6 +507,11 @@ namespace encode
dmem->INIT_GopB = intraPeriod / BGOPSize;
dmem->INIT_GopB1 = (dmem->INIT_GopP + dmem->INIT_GopB == intraPeriod)? 0 : dmem->INIT_GopP * 2;
dmem->INIT_GopB2 = intraPeriod - dmem->INIT_GopP - dmem->INIT_GopB - dmem->INIT_GopB1;
if (m_rcMode == RATECONTROL_CQL && seqParams->GopRefDist == 16)
{
dmem->INIT_GopB2 = (dmem->INIT_GopP + dmem->INIT_GopB + dmem->INIT_GopB1 == intraPeriod) ? 0 : dmem->INIT_GopB1 * 2;
dmem->INIT_GopB3 = intraPeriod - dmem->INIT_GopP - dmem->INIT_GopB - dmem->INIT_GopB1 - dmem->INIT_GopB2;
}
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ enum AV1_BRC_FRAME_TYPE
AV1_BRC_FRAME_TYPE_I = 2,
AV1_BRC_FRAME_TYPE_B1 = 3,
AV1_BRC_FRAME_TYPE_B2 = 4,
AV1_BRC_FRAME_TYPE_B3 = 5,
AV1_BRC_FRAME_TYPE_INVALID

};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ namespace encode
uint16_t INIT_OvershootCBR_pct; // default: 115, CBR overshoot percentage
uint16_t INIT_GopB1; // number of B1 frames in the GOP
uint16_t INIT_GopB2; // number of B2 frames in the GOP
uint16_t RSVD16[8]; // mbz
uint16_t INIT_GopB3; // number of B3 frames in the GOP
uint16_t RSVD16[7]; // mbz

int8_t INIT_InstRateThreshP0[4]; // instant rate threshold for P frame, 4 elements
int8_t Reserved2[4]; // mbz
Expand Down

0 comments on commit 65fcac0

Please sign in to comment.