| 1275 | } |
| 1276 | |
| 1277 | int32_t ParseCbfInfoCabac (PWelsNeighAvail pNeighAvail, uint8_t* pNzcCache, int32_t iZIndex, int32_t iResProperty, |
| 1278 | PWelsDecoderContext pCtx, uint32_t& uiCbfBit) { |
| 1279 | int8_t nA, nB/*, zigzag_idx = 0*/; |
| 1280 | int32_t iCurrBlkXy = pCtx->pCurDqLayer->iMbXyIndex; |
| 1281 | int32_t iTopBlkXy = iCurrBlkXy - pCtx->pCurDqLayer->iMbWidth; //default value: MB neighboring |
| 1282 | int32_t iLeftBlkXy = iCurrBlkXy - 1; //default value: MB neighboring |
| 1283 | uint16_t* pCbfDc = pCtx->pCurDqLayer->pCbfDc; |
| 1284 | uint32_t* pMbType = pCtx->pCurDqLayer->pDec->pMbType; |
| 1285 | int32_t iCtxInc; |
| 1286 | uiCbfBit = 0; |
| 1287 | nA = nB = (int8_t)!!IS_INTRA (pMbType[iCurrBlkXy]); |
| 1288 | |
| 1289 | if (iResProperty == I16_LUMA_DC || iResProperty == CHROMA_DC_U || iResProperty == CHROMA_DC_V) { //DC |
| 1290 | if (pNeighAvail->iTopAvail) |
| 1291 | nB = (pMbType[iTopBlkXy] == MB_TYPE_INTRA_PCM) || ((pCbfDc[iTopBlkXy] >> iResProperty) & 1); |
| 1292 | if (pNeighAvail->iLeftAvail) |
| 1293 | nA = (pMbType[iLeftBlkXy] == MB_TYPE_INTRA_PCM) || ((pCbfDc[iLeftBlkXy] >> iResProperty) & 1); |
| 1294 | iCtxInc = nA + (nB << 1); |
| 1295 | WELS_READ_VERIFY (DecodeBinCabac (pCtx->pCabacDecEngine, |
| 1296 | pCtx->pCabacCtx + NEW_CTX_OFFSET_CBF + g_kBlockCat2CtxOffsetCBF[iResProperty] + iCtxInc, uiCbfBit)); |
| 1297 | if (uiCbfBit) |
| 1298 | pCbfDc[iCurrBlkXy] |= (1 << iResProperty); |
| 1299 | } else { //AC |
| 1300 | //for 4x4 blk, make sure blk-idx is correct |
| 1301 | if (pNzcCache[g_kCacheNzcScanIdx[iZIndex] - 8] != 0xff) { //top blk available |
| 1302 | if (g_kTopBlkInsideMb[iZIndex]) |
| 1303 | iTopBlkXy = iCurrBlkXy; |
| 1304 | nB = pNzcCache[g_kCacheNzcScanIdx[iZIndex] - 8] || pMbType[iTopBlkXy] == MB_TYPE_INTRA_PCM; |
| 1305 | } |
| 1306 | if (pNzcCache[g_kCacheNzcScanIdx[iZIndex] - 1] != 0xff) { //left blk available |
| 1307 | if (g_kLeftBlkInsideMb[iZIndex]) |
| 1308 | iLeftBlkXy = iCurrBlkXy; |
| 1309 | nA = pNzcCache[g_kCacheNzcScanIdx[iZIndex] - 1] || pMbType[iLeftBlkXy] == MB_TYPE_INTRA_PCM; |
| 1310 | } |
| 1311 | |
| 1312 | iCtxInc = nA + (nB << 1); |
| 1313 | WELS_READ_VERIFY (DecodeBinCabac (pCtx->pCabacDecEngine, |
| 1314 | pCtx->pCabacCtx + NEW_CTX_OFFSET_CBF + g_kBlockCat2CtxOffsetCBF[iResProperty] + iCtxInc, uiCbfBit)); |
| 1315 | } |
| 1316 | return ERR_NONE; |
| 1317 | } |
| 1318 | |
| 1319 | int32_t ParseSignificantMapCabac (int32_t* pSignificantMap, int32_t iResProperty, PWelsDecoderContext pCtx, |
| 1320 | uint32_t& uiCoeffNum) { |
no test coverage detected