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

Function ParseSignificantMapCabac

codec/decoder/core/src/parse_mb_syn_cabac.cpp:1319–1362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1317}
1318
1319int32_t ParseSignificantMapCabac (int32_t* pSignificantMap, int32_t iResProperty, PWelsDecoderContext pCtx,
1320 uint32_t& uiCoeffNum) {
1321 uint32_t uiCode;
1322
1323 PWelsCabacCtx pMapCtx = pCtx->pCabacCtx + (iResProperty == LUMA_DC_AC_8 ? NEW_CTX_OFFSET_MAP_8x8 : NEW_CTX_OFFSET_MAP)
1324 + g_kBlockCat2CtxOffsetMap [iResProperty];
1325 PWelsCabacCtx pLastCtx = pCtx->pCabacCtx + (iResProperty == LUMA_DC_AC_8 ? NEW_CTX_OFFSET_LAST_8x8 :
1326 NEW_CTX_OFFSET_LAST) + g_kBlockCat2CtxOffsetLast[iResProperty];
1327
1328
1329 int32_t i;
1330 uiCoeffNum = 0;
1331 int32_t i0 = 0;
1332 int32_t i1 = g_kMaxPos[iResProperty];
1333
1334 int32_t iCtx;
1335
1336 for (i = i0; i < i1; ++i) {
1337 iCtx = (iResProperty == LUMA_DC_AC_8 ? g_kuiIdx2CtxSignificantCoeffFlag8x8[i] : i);
1338 //read significant
1339 WELS_READ_VERIFY (DecodeBinCabac (pCtx->pCabacDecEngine, pMapCtx + iCtx, uiCode));
1340 if (uiCode) {
1341 * (pSignificantMap++) = 1;
1342 ++ uiCoeffNum;
1343 //read last significant
1344 iCtx = (iResProperty == LUMA_DC_AC_8 ? g_kuiIdx2CtxLastSignificantCoeffFlag8x8[i] : i);
1345 WELS_READ_VERIFY (DecodeBinCabac (pCtx->pCabacDecEngine, pLastCtx + iCtx, uiCode));
1346 if (uiCode) {
1347 memset (pSignificantMap, 0, (i1 - i) * sizeof (int32_t));
1348 return ERR_NONE;
1349 }
1350 } else
1351 * (pSignificantMap++) = 0;
1352 }
1353
1354 //deal with last pSignificantMap if no data
1355 //if(i < i1+1)
1356 {
1357 *pSignificantMap = 1;
1358 ++uiCoeffNum;
1359 }
1360
1361 return ERR_NONE;
1362}
1363
1364int32_t ParseSignificantCoeffCabac (int32_t* pSignificant, int32_t iResProperty, PWelsDecoderContext pCtx) {
1365 uint32_t uiCode;

Callers 2

ParseResidualBlockCabacFunction · 0.85

Calls 1

DecodeBinCabacFunction · 0.85

Tested by

no test coverage detected