// ------------------------------------------------------------------------------------------------------------------- // member access functions // ------------------------------------------------------------------------------------------------------------------- func (this *TEncTop) xGetNewPicBuffer() *TLibCommon.TComPic { ///< get picture buffer which will be processed var rpcPic *TLibCommon.TComPic TLibCommon.SortPicList(this.m_cListPic) if this.m_cListPic.Len() >= (this.GetEncCfg().m_iGOPSize + this.GetEncCfg().GetMaxDecPicBuffering(TLibCommon.MAX_TLAYER-1) + 2) { //Int iSize = Int( this.m_cListPic.size() ); for iterPic := this.m_cListPic.Front(); iterPic != nil; iterPic = iterPic.Next() { rpcPic = iterPic.Value.(*TLibCommon.TComPic) if rpcPic.GetSlice(0).IsReferenced() == false { break } } } else { if this.GetEncCfg().GetUseAdaptiveQP() { pcEPic := TLibCommon.NewTComPic() pcEPic.Create(this.GetEncCfg().m_iSourceWidth, this.GetEncCfg().m_iSourceHeight, TLibCommon.G_uiMaxCUWidth, TLibCommon.G_uiMaxCUHeight, TLibCommon.G_uiMaxCUDepth, this.m_cPPS.GetMaxCuDQPDepth()+1, this.GetEncCfg().m_conformanceWindow, this.GetEncCfg().m_defaultDisplayWindow, this.GetEncCfg().m_numReorderPics[:], false) rpcPic = pcEPic } else { rpcPic = TLibCommon.NewTComPic() rpcPic.Create(this.GetEncCfg().m_iSourceWidth, this.GetEncCfg().m_iSourceHeight, TLibCommon.G_uiMaxCUWidth, TLibCommon.G_uiMaxCUHeight, TLibCommon.G_uiMaxCUDepth, 0, this.GetEncCfg().m_conformanceWindow, this.GetEncCfg().m_defaultDisplayWindow, this.GetEncCfg().m_numReorderPics[:], false) } if this.GetEncCfg().GetUseSAO() { fmt.Printf("not support SAO\n") //rpcPic.GetPicSym().AllocSaoParam(this.m_cEncSAO); } this.m_cListPic.PushBack(rpcPic) } rpcPic.SetReconMark(false) this.m_iPOCLast++ this.m_iNumPicRcvd++ rpcPic.GetSlice(0).SetPOC(this.m_iPOCLast) // mark it should be extended rpcPic.GetPicYuvRec().SetBorderExtension(false) return rpcPic }
func (this *TDecGop) FilterPicture(rpcPic *TLibCommon.TComPic) { pcSlice := rpcPic.GetSlice(rpcPic.GetCurrSliceIdx()) //-- For time output for each slice iBeforeTime := time.Now() // deblocking filter bLFCrossTileBoundary := pcSlice.GetPPS().GetLoopFilterAcrossTilesEnabledFlag() this.m_pcLoopFilter.SetCfg(bLFCrossTileBoundary) this.m_pcLoopFilter.LoopFilterPic(rpcPic) if pcSlice.GetSPS().GetUseSAO() { l := len(this.m_sliceStartCUAddress) this.m_sliceStartCUAddress[l] = int(rpcPic.GetNumCUsInFrame() * rpcPic.GetNumPartInCU()) ///this.m_sliceStartCUAddress.PushBack(rpcPic.GetNumCUsInFrame()* rpcPic.GetNumPartInCU()); rpcPic.CreateNonDBFilterInfo(this.m_sliceStartCUAddress, 0, this.m_LFCrossSliceBoundaryFlag, rpcPic.GetPicSym().GetNumTiles(), bLFCrossTileBoundary) } if pcSlice.GetSPS().GetUseSAO() { saoParam := rpcPic.GetPicSym().GetSaoParam() saoParam.SaoFlag[0] = pcSlice.GetSaoEnabledFlag() saoParam.SaoFlag[1] = pcSlice.GetSaoEnabledFlagChroma() this.m_pcSAO.SetSaoLcuBasedOptimization(true) this.m_pcSAO.CreatePicSaoInfo(rpcPic) //, len(this.m_sliceStartCUAddress)-1) this.m_pcSAO.SAOProcess(saoParam) this.m_pcSAO.PCMLFDisableProcess(rpcPic) this.m_pcSAO.DestroyPicSaoInfo() } if pcSlice.GetSPS().GetUseSAO() { rpcPic.DestroyNonDBFilterInfo() } rpcPic.CompressMotion() //this.DumpMotionField(rpcPic); var c string if pcSlice.IsIntra() { c = "I" } else if pcSlice.IsInterP() { if pcSlice.IsReferenced() { c = "P" } else { c = "p" } } else { if pcSlice.IsReferenced() { c = "B" } else { c = "b" } } //-- For time output for each slice fmt.Printf("\nPOC %4d TId: %1d ( %s-SLICE, QP%3d ) ", pcSlice.GetPOC(), pcSlice.GetTLayer(), c, pcSlice.GetSliceQp()) this.m_dDecTime += time.Now().Sub(iBeforeTime) fmt.Printf("[DT %10v] ", this.m_dDecTime) this.m_dDecTime = 0 for iRefList := 0; iRefList < 2; iRefList++ { fmt.Printf("[L%d ", iRefList) for iRefIndex := 0; iRefIndex < pcSlice.GetNumRefIdx(TLibCommon.RefPicList(iRefList)); iRefIndex++ { fmt.Printf("%d ", pcSlice.GetRefPOC(TLibCommon.RefPicList(iRefList), iRefIndex)) } fmt.Printf("] ") } if this.m_decodedPictureHashSEIEnabled > 0 { this.CalcAndPrintHashStatus(rpcPic.GetPicYuvRec(), rpcPic.GetSEIs()) } rpcPic.SetOutputMark(true) rpcPic.SetReconMark(true) //this.m_sliceStartCUAddress.Init(); //this.m_LFCrossSliceBoundaryFlag.Init(); slicesize := len(this.m_sliceStartCUAddress) for i := 0; i < slicesize; i++ { delete(this.m_sliceStartCUAddress, i) } if len(this.m_sliceStartCUAddress) != 0 { fmt.Printf("clear this.m_sliceStartCUAddress error\n") } lfsize := len(this.m_LFCrossSliceBoundaryFlag) for i := 0; i < lfsize; i++ { delete(this.m_LFCrossSliceBoundaryFlag, i) } if len(this.m_LFCrossSliceBoundaryFlag) != 0 { fmt.Printf("clear this.m_LFCrossSliceBoundaryFlag error\n") } }