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

Function ParseIntra4x4Mode

codec/decoder/core/src/decode_slice.cpp:447–523  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

445}
446
447int32_t ParseIntra4x4Mode (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAvail, int8_t* pIntraPredMode,
448 PBitStringAux pBs,
449 PDqLayer pCurDqLayer) {
450 int32_t iSampleAvail[5 * 6] = { 0 }; //initialize as 0
451 int32_t iMbXy = pCurDqLayer->iMbXyIndex;
452 int32_t iFinalMode, i;
453
454 uint8_t uiNeighAvail = 0;
455 uint32_t uiCode;
456 int32_t iCode;
457 pCtx->pMapNxNNeighToSampleFunc (pNeighAvail, iSampleAvail);
458 uiNeighAvail = (iSampleAvail[6] << 2) | (iSampleAvail[0] << 1) | (iSampleAvail[1]);
459 for (i = 0; i < 16; i++) {
460 int32_t iPrevIntra4x4PredMode = 0;
461 if (pCurDqLayer->sLayerInfo.pPps->bEntropyCodingModeFlag) {
462 WELS_READ_VERIFY (ParseIntraPredModeLumaCabac (pCtx, iCode));
463 iPrevIntra4x4PredMode = iCode;
464 } else {
465 WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode));
466 iPrevIntra4x4PredMode = uiCode;
467 }
468 const int32_t kiPredMode = PredIntra4x4Mode (pIntraPredMode, i);
469
470 int8_t iBestMode;
471 if (pCurDqLayer->sLayerInfo.pPps->bEntropyCodingModeFlag) {
472 if (iPrevIntra4x4PredMode == -1)
473 iBestMode = kiPredMode;
474 else
475 iBestMode = iPrevIntra4x4PredMode + (iPrevIntra4x4PredMode >= kiPredMode);
476 } else {
477 if (iPrevIntra4x4PredMode) {
478 iBestMode = kiPredMode;
479 } else {
480 WELS_READ_VERIFY (BsGetBits (pBs, 3, &uiCode));
481 iBestMode = uiCode + ((int32_t) uiCode >= kiPredMode);
482 }
483 }
484
485 iFinalMode = CheckIntraNxNPredMode (&iSampleAvail[0], &iBestMode, i, false);
486 if (iFinalMode == GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INVALID_INTRA4X4_MODE)) {
487 return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I4x4_PRED_MODE);
488 }
489
490 pCurDqLayer->pIntra4x4FinalMode[iMbXy][g_kuiScan4[i]] = iFinalMode;
491
492 pIntraPredMode[g_kuiScan8[i]] = iBestMode;
493
494 iSampleAvail[g_kuiCache30ScanIdx[i]] = 1;
495 }
496 ST32 (&pCurDqLayer->pIntraPredMode[iMbXy][0], LD32 (&pIntraPredMode[1 + 8 * 4]));
497 pCurDqLayer->pIntraPredMode[iMbXy][4] = pIntraPredMode[4 + 8 * 1];
498 pCurDqLayer->pIntraPredMode[iMbXy][5] = pIntraPredMode[4 + 8 * 2];
499 pCurDqLayer->pIntraPredMode[iMbXy][6] = pIntraPredMode[4 + 8 * 3];
500
501 if (pCtx->pSps->uiChromaFormatIdc == 0)//no need parse chroma
502 return ERR_NONE;
503
504 if (pCurDqLayer->sLayerInfo.pPps->bEntropyCodingModeFlag) {

Calls 8

BsGetOneBitFunction · 0.85
BsGetBitsFunction · 0.85
CheckIntraNxNPredModeFunction · 0.85
BsGetUeFunction · 0.85
CheckIntraChromaPredModeFunction · 0.85
PredIntra4x4ModeFunction · 0.70

Tested by

no test coverage detected