📄 umc_h264_dec_decode_reconstruct.cpp
字号:
edge_type); } else { switch (special_MBAFF_case) { default: /* sts = ippiReconstructLumaIntraHalfMB_H264_16s8u_C1R( &m_pCoeffBlocksRead, pYPlane + offsetY, rec_pitch, (IppIntra4x4PredMode_H264 *) pMBIntraTypes, m_cur_mb.LocalMacroblockInfo->cbp4x4>>1, m_cur_mb.LocalMacroblockInfo->QP, edge_type_2t); sts = ippiReconstructLumaIntraHalfMB_H264_16s8u_C1R( &m_pCoeffBlocksRead, pYPlane + offsetY+8*rec_pitch, rec_pitch, (IppIntra4x4PredMode_H264 *) pMBIntraTypes+8, m_cur_mb.LocalMacroblockInfo->cbp4x4>>9, m_cur_mb.LocalMacroblockInfo->QP, edge_type_2b);*/ // todo: uncomment the block above as soon as new function will be added break; case 0: sts = ippiReconstructLumaIntraMB_H264_16s8u_C1R( &m_pCoeffBlocksRead, pYPlane + offsetY, rec_pitch, (IppIntra4x4PredMode_H264 *) pMBIntraTypes, m_cur_mb.LocalMacroblockInfo->cbp4x4, m_cur_mb.LocalMacroblockInfo->QP, edge_type); break; } } VM_ASSERT(sts >= ippStsNoErr); // reconstruct chroma block(s) switch (special_MBAFF_case) { default: /* sts = ippiReconstructChromaIntraHalfsMB_H264_16s8u_P2R ( &m_pCoeffBlocksRead, pUPlane + offsetC, pVPlane + offsetC, rec_pitch, (IppIntraChromaPredMode_H264) m_cur_mb.LocalMacroblockInfo->intra_chroma_mode, m_cur_mb.LocalMacroblockInfo->cbp4x4, QPChroma, edge_type_2t, edge_type_2b);*/ // todo: uncomment the block above as soon as new function will be added break; case 0: sts = ippiReconstructChromaIntraMB_H264_16s8u_P2R ( &m_pCoeffBlocksRead, pUPlane + offsetC, pVPlane + offsetC, rec_pitch, (IppIntraChromaPredMode_H264) m_cur_mb.LocalMacroblockInfo->intra_chroma_mode, m_cur_mb.LocalMacroblockInfo->cbp4x4, QPChroma, edge_type); break; } VM_ASSERT(sts >= ippStsNoErr); } else { // reconstruct PCM block(s) ReconstructPCMMB(offsetY,1); } } else { /* Ipp32s RefF_pic_cnt = 0, RefB_pic_cnt = 0;*/ //Ipp8s *pRefIndex = m_cur_mb.RefIdxs[0]->RefIdxs; //Ipp8s *pRefIndexBack = m_cur_mb.RefIdxs[1]->RefIdxs; if (mbaff) { if ((m_cur_mb.GlobalMacroblockInfo->mb_aux_fields&3)==3) { offsetY -= 15 * uPitch; offsetC -= 7 * uPitch; } ReconstructMacroblockMBAFF(pYPlane + offsetY, pVPlane + offsetC, pUPlane + offsetC, mbXOffset, mbYOffset, bUseDirect8x8Inference, pRefPicList0, pRefPicList1,1); } else { ReconstructMacroblock(pYPlane + offsetY, pVPlane + offsetC, pUPlane + offsetC, mbXOffset, mbYOffset, bUseDirect8x8Inference, pRefPicList0, pRefPicList1,1); } if ((m_cur_mb.LocalMacroblockInfo->cbp4x4 & D_CBP_LUMA_AC) != 0) { sts = ippiReconstructLumaInterMB_H264_16s8u_C1R(&m_pCoeffBlocksRead, pYPlane + offsetY, uPitch << pGetMBFieldDecodingFlag(m_cur_mb.GlobalMacroblockInfo), m_cur_mb.LocalMacroblockInfo->cbp4x4, m_cur_mb.LocalMacroblockInfo->QP); VM_ASSERT(sts >= ippStsNoErr); } if ((m_cur_mb.LocalMacroblockInfo->cbp4x4 & (D_CBP_CHROMA_AC | D_CBP_CHROMA_DC)) != 0) { sts = ippiReconstructChromaInterMB_H264_16s8u_P2R(&m_pCoeffBlocksRead, pUPlane + offsetC, pVPlane + offsetC, uPitch << pGetMBFieldDecodingFlag(m_cur_mb.GlobalMacroblockInfo), m_cur_mb.LocalMacroblockInfo->cbp4x4, QPChroma); VM_ASSERT(sts >= ippStsNoErr); } } if ((MBSkipCount <= 0) && (mbcount < (unumMBs-1))) { // Check for new slice header, which can change the next MB // to be decodedstart_slice_header: bool bReadingSliceHeader = true; status = UMC_OK; while (bReadingSliceHeader && status == UMC_OK) { Ipp32s scp=m_pBitStream->GetSCP(); if (scp) { if (scp<0) { if (uNumSliceGroups==1) { DeblockSlice(m_CurSliceHeader.first_mb_in_slice,DBCount+1); } else { // update slice info UpdateLimitedSliceInfo(&m_CurSliceHeader); } m_broken_buffer_start_mb = mbcount; m_broken_buffer_start_slice = SliceNum; m_broken_buffer = 1; return UMC_NOT_ENOUGH_DATA; } // new slice header NAL_Unit_Type NALUType; Ipp8u nal_ref_idc; H264SliceHeader& SHdr=m_CurSliceHeader; RefPicListReorderInfo ReorderInfoL0; RefPicListReorderInfo ReorderInfoL1; // Locals for additional slice data to be read into, the data // was read and saved from the first slice header of the picture, // is not supposed to change within the picture, so can be // discarded when read again here. AdaptiveMarkingInfo AdaptiveMarkingInfoTemp; bool bIsIDRPic = false; status = m_pBitStream->GetNALUnitType(NALUType, nal_ref_idc); if (status != UMC_OK) break; if (NALUType != NAL_UT_SLICE && NALUType != NAL_UT_IDR_SLICE) { // unexpected NAL unit, error status = UMC_BAD_STREAM; break; } bIsIDRPic = (NALUType == NAL_UT_IDR_SLICE); if (!m_broken_buffer) { if (uNumSliceGroups==1) { DBCount++; DeblockSlice(m_CurSliceHeader.first_mb_in_slice,DBCount); DBCount=-1; } // when some slice group are present else { // update slice info UpdateLimitedSliceInfo(&m_CurSliceHeader); } } m_broken_buffer = 0; // Read first part of slice header to get pic param set used status = m_pBitStream->GetSliceHeaderPart1(&SHdr, false); if (status != UMC_OK) break; // pic param set can't change within a picture VM_ASSERT(m_CurSliceHeader.pic_parameter_set_id == SHdr.pic_parameter_set_id); status = m_pBitStream->GetSliceHeaderPart2( &SHdr, &m_pPredWeight_L0[(SliceNum+1)*MAX_NUM_REF_FRAMES], &m_pPredWeight_L1[(SliceNum+1)*MAX_NUM_REF_FRAMES], &ReorderInfoL0, &ReorderInfoL1, &AdaptiveMarkingInfoTemp, &m_PicParamSet[SHdr.pic_parameter_set_id], bIsIDRPic, &m_SeqParamSet[m_PicParamSet[SHdr.pic_parameter_set_id].seq_parameter_set_id], nal_ref_idc, false // not search for next picture ); if (status != UMC_OK) break; if((IS_SKIP_DEBLOCKING_MODE) && (m_NALRefIDC[m_field_index])) { //m_iNeedToSkip--; m_CurSliceHeader.disable_deblocking_filter_idc = DEBLOCK_FILTER_OFF; } if (SHdr.redundant_pic_cnt) { // redundant slice, discard status = m_pBitStream->AdvanceToNextSCP(); continue; } // Set next MB. if (SHdr.first_mb_in_slice >= (mb_width*mb_height)) { status = UMC_BAD_STREAM; break; } NextMB = SHdr.first_mb_in_slice; iSQUANT = m_PicParamSet[m_CurrentPicParamSet].pic_init_qp + SHdr.slice_qp_delta; if (iSQUANT < QP_MIN || iSQUANT > QP_MAX) { status = UMC_BAD_STREAM; break; } quant_prev = (Ipp8u)iSQUANT; MBSkipCount = 0; // needed for case when previous slice ended with a // skip MB, to tell DecodeMacroBlockType to read a skip // run code from the bitstream // update slice data SliceNum++; bIsBSlice = (m_CurSliceHeader.slice_type == BPREDSLICE); m_bUseSpatialDirectMode = SHdr.direct_spatial_mv_pred_flag != 0; // Reference picture list mgmt pRefPicList0 = m_pCurrentFrame->GetRefPicList(SliceNum, 0)->m_RefPicList; pRefPicList1 = m_pCurrentFrame->GetRefPicList(SliceNum, 1)->m_RefPicList; status = UpdateRefPicList(SHdr, &ReorderInfoL0, &ReorderInfoL1, SliceNum); bReadingSliceHeader = false; m_bNeedToCheckMBSliceEdges = true; } // slice header else bReadingSliceHeader = false; } // while bReadingSliceHeader } // check for new slice header if (status != UMC_OK) break; // Next MB m_CurMBAddr = NextMB; // set QP and slice ID for next MB if any // Needs to be done here, before return if exiting loop, so these are // correctly set when mbcount < number of MBs in picture and VLDPicSegment // will be called again to decode more MBs in this picture. // Need to check for done to avoid invalid store for last MB of picture. // Due to supporting out of order slices, the last decoded MB in the // bitstream is not necessarily the MB with highest MB address. } // for mbcount, VLC loop if (UMC_OK == status) { if (uNumSliceGroups==1) { DeblockSlice(m_CurSliceHeader.first_mb_in_slice,DBCount, true); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -