Skip to content

Commit

Permalink
[Encode] Correct maxBRCLevel
Browse files Browse the repository at this point in the history
Correct maxBRCLevel value set due to frame type.
  • Loading branch information
sujun96 authored and intel-mediadev committed Jul 6, 2023
1 parent 7e19d7f commit c9166d3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
12 changes: 0 additions & 12 deletions media_common/agnostic/common/codec/shared/codec_def_encode_hevc.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,6 @@ enum HEVC_BRC_FRAME_TYPE
HEVC_BRC_FRAME_TYPE_INVALID
};

//!
//! \enum HEVC_PYRAMID_LAYER_NUM
//!
enum HEVC_PYRAMID_LAYER_NUM
{
HEVC_PYRAMID_LAYER_NUM_0 = 0,
HEVC_PYRAMID_LAYER_NUM_1 = 1,
HEVC_PYRAMID_LAYER_NUM_2 = 2,
HEVC_PYRAMID_LAYER_NUM_3 = 3,
HEVC_PYRAMID_LAYER_NUM_4 = 4
};

typedef enum
{
ENCODE_HEVC_BIT_DEPTH_8 = 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,13 @@ namespace encode {
bool bAllowedPyramid = m_basicFeature->m_hevcSeqParams->GopRefDist != 3;
uint16_t intraPeriod = m_basicFeature->m_hevcSeqParams->GopPicSize > 4001 ? 4000 : m_basicFeature->m_hevcSeqParams->GopPicSize - 1;
intraPeriod = ((intraPeriod + m_basicFeature->m_hevcSeqParams->GopRefDist - 1) / m_basicFeature->m_hevcSeqParams->GopRefDist) * m_basicFeature->m_hevcSeqParams->GopRefDist;
if (m_basicFeature->m_hevcSeqParams->HierarchicalFlag && bAllowedPyramid)
if (m_basicFeature->m_hevcSeqParams->HierarchicalFlag && bAllowedPyramid)
{
hucVdencBrcInitDmem->GopP_U16 = intraPeriod/m_basicFeature->m_hevcSeqParams->GopRefDist;
hucVdencBrcInitDmem->GopB_U16 = (hucVdencBrcInitDmem->GopP_U16)*(m_basicFeature->m_hevcSeqParams->GopRefDist>1);
hucVdencBrcInitDmem->GopB1_U16 = hucVdencBrcInitDmem->GopP_U16 * ((m_basicFeature->m_hevcSeqParams->GopRefDist > 2) + (m_basicFeature->m_hevcSeqParams->GopRefDist == 4 || m_basicFeature->m_hevcSeqParams->GopRefDist > 5));
hucVdencBrcInitDmem->GopB2_U16 = (intraPeriod - hucVdencBrcInitDmem->GopP_U16 - hucVdencBrcInitDmem->GopB_U16 - hucVdencBrcInitDmem->GopB1_U16) * (m_basicFeature->m_hevcSeqParams->GopRefDist > 3);
hucVdencBrcInitDmem->MaxBRCLevel_U8 = hucVdencBrcInitDmem->GopB1_U16 == 0 ? HEVC_PYRAMID_LAYER_NUM_2 : (hucVdencBrcInitDmem->GopB2_U16 == 0 ? HEVC_PYRAMID_LAYER_NUM_3 : HEVC_PYRAMID_LAYER_NUM_4);
hucVdencBrcInitDmem->MaxBRCLevel_U8 = hucVdencBrcInitDmem->GopB1_U16 == 0 ? HEVC_BRC_FRAME_TYPE_B : (hucVdencBrcInitDmem->GopB2_U16 == 0 ? HEVC_BRC_FRAME_TYPE_B1 : HEVC_BRC_FRAME_TYPE_B2);
hucVdencBrcInitDmem->BRCPyramidEnable_U8 = 1;
}
else //FlatB or LDB
Expand Down

0 comments on commit c9166d3

Please sign in to comment.