MCPcopy Create free account
hub / github.com/cisco/openh264 / WelsCheckLevelLimitation

Function WelsCheckLevelLimitation

codec/encoder/core/src/au_set.cpp:51–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49namespace WelsEnc {
50
51static inline int32_t WelsCheckLevelLimitation (const SWelsSPS* kpSps, const SLevelLimits* kpLevelLimit,
52 float fFrameRate, int32_t iTargetBitRate) {
53 uint32_t uiPicWidthInMBs = kpSps->iMbWidth;
54 uint32_t uiPicHeightInMBs = kpSps->iMbHeight;
55 uint32_t uiPicInMBs = uiPicWidthInMBs * uiPicHeightInMBs;
56 uint32_t uiNumRefFrames = kpSps->iNumRefFrames;
57
58 if (kpLevelLimit->uiMaxMBPS < (uint32_t) (uiPicInMBs * fFrameRate))
59 return 0;
60 if (kpLevelLimit->uiMaxFS < uiPicInMBs)
61 return 0;
62 if ((kpLevelLimit->uiMaxFS << 3) < (uiPicWidthInMBs * uiPicWidthInMBs))
63 return 0;
64 if ((kpLevelLimit->uiMaxFS << 3) < (uiPicHeightInMBs * uiPicHeightInMBs))
65 return 0;
66 if (kpLevelLimit->uiMaxDPBMbs < uiNumRefFrames * uiPicInMBs)
67 return 0;
68 if ((iTargetBitRate != UNSPECIFIED_BIT_RATE)
69 && ((int32_t) kpLevelLimit->uiMaxBR * 1200) < iTargetBitRate) //RC enabled, considering bitrate constraint
70 return 0;
71 //add more checks here if needed in future
72
73 return 1;
74
75}
76int32_t WelsAdjustLevel (SSpatialLayerConfig* pSpatialLayer, const SLevelLimits* pCurLevel) {
77 int32_t iMaxBitrate = pSpatialLayer->iMaxSpatialBitrate;
78 do {

Callers 1

WelsGetLevelIdcFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected