Incorrect computation in AL_sSettings_GetMinLevelHEVC
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 62/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- c
- Domain
- audio-video-rtc
Research direction
Start in Settings.c at AL_sSettings_GetMinLevelHEVC and in HevcLevelLimits.c at AL_HEVC_GetLevelFromDPBSize and AL_HEVC_GetMaxDpbPicBuf. Compare the DPB calculation with ITU H.265 Annex A, equation (A-2), then verify that level selection uses MaxLumaPS rather than the pixel-rate value and that the affected encoder settings behave correctly.
Written by the indexing model from the issue text.
Description
Hi,
I think there is an issue with the function AL_sSettings_GetMinLevelHEVC(). Specifically with AL_HEVC_GetLevelFromDPBSize(). It is using the pixRate parameter and I think it should be using the MaxLumaPS as specified in ITU H.265 Annex A, section 4.2 equation (A-2).
I added comments in the code snippets below where I think the computation is wrong.
Thanks,
Louis
From Settings.c
static uint8_t AL_sSettings_GetMinLevelHEVC(AL_TEncChanParam const* pChParam)
{
uint32_t uMaxSample = pChParam->uWidth * pChParam->uHeight;
int iCpbVclFactor = AL_sSettings_GetCpbVclFactor(pChParam->eProfile);
int iHbrFactor = AL_sSettings_GetHbrFactor(pChParam->eProfile);
int iBrVclFactor = iCpbVclFactor * iHbrFactor;
uint32_t uBitRate = (pChParam->tRCParam.uMaxBitRate + (iBrVclFactor - 1)) / iBrVclFactor;
uint8_t uRequiredDPBSize = AL_DPBConstraint_GetMaxDPBSize(pChParam);
uint8_t uLevel = AL_HEVC_GetLevelFromFrameSize(uMaxSample);
uMaxSample *= pChParam->tRCParam.uFrameRate; // HERE uMaxSample BECOMES pixRate or MaxLumaSR as labeled in ITU H.265 Annex A table A.9
uLevel = Max(AL_HEVC_GetLevelFromPixRate(uMaxSample), uLevel);
uLevel = Max(AL_HEVC_GetLevelFromBitrate(uBitRate, pChParam->uTier), uLevel);
uLevel = Max(AL_HEVC_GetLevelFromDPBSize(uRequiredDPBSize, uMaxSample), uLevel); // The MaxDpbSize uses the MaxLumaPS to do its comparison NOT MaxLumaSR. Ref. ITU H.265 Annex A section 4.2 equation (A-2)
return uLevel;
}
From HevcLevelLimits.c
/****************************************************************************/
static uint8_t AL_HEVC_GetMaxDpbPicBuf(int maxPixRate, int numPixPerFrame) // The MaxDpbSize uses the MaxLumaPS to do its comparison NOT maxPixRate (MaxLumaSR as per the H.265 label). Ref. ITU H.265 Annex A, section 4.2 equation (A-2)
{
// Values computed from HEVC Annex A - with maxDpbPicBuf = 6
if(numPixPerFrame <= (maxPixRate >> 2))
return 16;
else if(numPixPerFrame <= (maxPixRate >> 1))
return 12;
else if(numPixPerFrame <= ((3 * maxPixRate) >> 2))
return 8;
return 6;
}
/****************************************************************************/
uint8_t AL_HEVC_GetLevelFromDPBSize(int dpbSize, int pixRate) // pixRate here should be MaxLumaPS or "pixPerFrame" NOT pixRate (MaxLumaSR as per H.265 label)
{
for(size_t i = 0; i < NUM_LIMIT(AL_HEVC_MAX_PIX_PER_FRAME); i++)
{
uint8_t maxDpbSize = AL_HEVC_GetMaxDpbPicBuf(AL_HEVC_MAX_PIX_PER_FRAME[i].uLimit, pixRate);
if(dpbSize <= maxDpbSize)
return AL_HEVC_MAX_PIX_PER_FRAME[i].uLevel;
}
return 255;
}
- Dominant language
- C
- Stars
- 42
- Forks
- 31
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Xilinx/vcu-ctrl-sw
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Xilinx/vcu-ctrl-sw#16 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Xilinx/vcu-ctrl-sw#14 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
Xilinx/vcu-ctrl-sw#13 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
Xilinx/vcu-ctrl-sw#11 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
Xilinx/vcu-ctrl-sw#10 · 1 reaction ·
All issues in Xilinx/vcu-ctrl-sw
Similar issues
-
[adam] AdamNet network read doesn't cap to MAX_ADAM_PACKET_LEN, overflows client receive buffers Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
FujiNetWIFI/fujinet-firmware#1649 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
HarbourMasters/Shipwright#7229 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
riscv-software-src/riscv-isa-sim#2435 · 1 comment ·
-
bug Self Built Image SNAPSHOT Supported Device target/ramips
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100