示例#1
0
func (this *TEncEntropy) encodeSliceHeader(pcSlice *TLibCommon.TComSlice) {
	if pcSlice.GetSPS().GetUseSAO() {
		saoParam := pcSlice.GetPic().GetPicSym().GetSaoParam()
		pcSlice.SetSaoEnabledFlag(saoParam.SaoFlag[0])
		pcSlice.SetSaoEnabledFlagChroma(saoParam.SaoFlag[1])
	}

	this.m_pcEntropyCoderIf.codeSliceHeader(pcSlice)
	return
}
示例#2
0
文件: TEncTop.go 项目: nacore/GoHM
func (this *TEncTop) selectReferencePictureSet(slice *TLibCommon.TComSlice, POCCurr, GOPid int) {
	slice.SetRPSidx(GOPid)

	for extraNum := this.GetEncCfg().m_iGOPSize; extraNum < this.GetEncCfg().m_extraRPSs+this.GetEncCfg().m_iGOPSize; extraNum++ {
		if this.GetEncCfg().m_uiIntraPeriod > 0 && this.GetEncCfg().GetDecodingRefreshType() > 0 {
			POCIndex := POCCurr % int(this.GetEncCfg().m_uiIntraPeriod)
			if POCIndex == 0 {
				POCIndex = int(this.GetEncCfg().m_uiIntraPeriod)
			}
			if POCIndex == this.GetEncCfg().m_GOPList[extraNum].m_POC {
				slice.SetRPSidx(extraNum)
			}
		} else {
			if POCCurr == this.GetEncCfg().m_GOPList[extraNum].m_POC {
				slice.SetRPSidx(extraNum)
			}
		}
	}

	slice.SetRPS(this.m_cSPS.GetRPSList().GetReferencePictureSet(slice.GetRPSidx()))
	slice.GetRPS().SetNumberOfPictures(slice.GetRPS().GetNumberOfNegativePictures() + slice.GetRPS().GetNumberOfPositivePictures())
}
示例#3
0
文件: TDecTop.go 项目: hanjinze/GoHM
//protected:
func (this *TDecTop) xGetNewPicBuffer(pcSlice *TLibCommon.TComSlice) (rpcPic *TLibCommon.TComPic) {
	var numReorderPics [TLibCommon.MAX_TLAYER]int
	conformanceWindow := pcSlice.GetSPS().GetConformanceWindow()
	var defaultDisplayWindow *TLibCommon.Window
	if pcSlice.GetSPS().GetVuiParametersPresentFlag() {
		defaultDisplayWindow = pcSlice.GetSPS().GetVuiParameters().GetDefaultDisplayWindow()
	} else {
		defaultDisplayWindow = TLibCommon.NewWindow()
	}

	for temporalLayer := uint(0); temporalLayer < TLibCommon.MAX_TLAYER; temporalLayer++ {
		numReorderPics[temporalLayer] = pcSlice.GetSPS().GetNumReorderPics(temporalLayer)
		//fmt.Printf("numReorderPics[temporalLayer]=%d\n",numReorderPics[temporalLayer]);
	}

	this.m_iMaxRefPicNum = int(pcSlice.GetSPS().GetMaxDecPicBuffering(pcSlice.GetTLayer())) + pcSlice.GetSPS().GetNumReorderPics(pcSlice.GetTLayer()) + 1 // +1 to have space for the picture currently being decoded
	if this.m_pcListPic.Len() < this.m_iMaxRefPicNum {
		rpcPic = TLibCommon.NewTComPic()

		rpcPic.Create(int(pcSlice.GetSPS().GetPicWidthInLumaSamples()), int(pcSlice.GetSPS().GetPicHeightInLumaSamples()),
			pcSlice.GetSPS().GetMaxCUWidth(), pcSlice.GetSPS().GetMaxCUHeight(), pcSlice.GetSPS().GetMaxCUDepth(), 0,
			conformanceWindow, defaultDisplayWindow, numReorderPics[:], true)
		rpcPic.GetPicSym().AllocSaoParam(this.m_cSAO)
		this.m_pcListPic.PushBack(rpcPic)

		return rpcPic
	}

	bBufferIsAvailable := false
	for e := this.m_pcListPic.Front(); e != nil; e = e.Next() {
		rpcPic = e.Value.(*TLibCommon.TComPic)
		if rpcPic.GetReconMark() == false && rpcPic.GetOutputMark() == false {
			rpcPic.SetOutputMark(false)
			bBufferIsAvailable = true
			break
		}

		if rpcPic.GetSlice(0).IsReferenced() == false && rpcPic.GetOutputMark() == false {
			rpcPic.SetOutputMark(false)
			rpcPic.SetReconMark(false)
			rpcPic.GetPicYuvRec().SetBorderExtension(false)
			bBufferIsAvailable = true
			break
		}
	}

	if !bBufferIsAvailable {
		//There is no room for this picture, either because of faulty encoder or dropped NAL. Extend the buffer.
		this.m_iMaxRefPicNum++
		rpcPic = TLibCommon.NewTComPic()
		this.m_pcListPic.PushBack(rpcPic)
	}

	rpcPic.Destroy()
	rpcPic.Create(int(pcSlice.GetSPS().GetPicWidthInLumaSamples()), int(pcSlice.GetSPS().GetPicHeightInLumaSamples()),
		pcSlice.GetSPS().GetMaxCUWidth(), pcSlice.GetSPS().GetMaxCUHeight(), pcSlice.GetSPS().GetMaxCUDepth(), 0,
		conformanceWindow, defaultDisplayWindow, numReorderPics[:], true)
	rpcPic.GetPicSym().AllocSaoParam(this.m_cSAO)

	return rpcPic
}