示例#1
0
文件: TAppDecTop.go 项目: nacore/GoHM
func (this *TAppDecTop) xFlushOutput(pcListPic *list.List) {
	if pcListPic == nil {
		return
	}

	//fmt.Printf("list len=%d\n", pcListPic.Len());

	for e := pcListPic.Front(); e != nil; e = e.Next() {
		pcPic := e.Value.(*TLibCommon.TComPic)
		if pcPic.GetOutputMark() {
			// write to file
			if this.m_pchReconFile != "" {
				conf := pcPic.GetConformanceWindow()
				var defDisp *TLibCommon.Window
				if this.m_respectDefDispWindow != 0 {
					defDisp = pcPic.GetDefDisplayWindow()
				} else {
					defDisp = TLibCommon.NewWindow()
				}

				this.m_cTVideoIOYuvReconFile.Write(pcPic.GetPicYuvRec(),
					conf.GetWindowLeftOffset()+defDisp.GetWindowLeftOffset(),
					conf.GetWindowRightOffset()+defDisp.GetWindowRightOffset(),
					conf.GetWindowTopOffset()+defDisp.GetWindowTopOffset(),
					conf.GetWindowBottomOffset()+defDisp.GetWindowBottomOffset())
			}

			// update POC of display order
			this.m_iPOCLastDisplay = int(pcPic.GetPOC())
			//fmt.Printf("m_iPOCLastDisplay=%d\n",this.m_iPOCLastDisplay);

			// erase non-referenced picture in the reference picture list after display
			if !pcPic.GetSlice(0).IsReferenced() && pcPic.GetReconMark() == true {
				//#if !DYN_REF_FREE
				pcPic.SetReconMark(false)

				// mark it should be extended later
				pcPic.GetPicYuvRec().SetBorderExtension(false)

				//#else
				//        pcPic->destroy();
				//        pcListPic->erase( iterPic );
				//        iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
				//        continue;
				//#endif
			}
			pcPic.SetOutputMark(false)
		}
		//#if !DYN_REF_FREE
		if pcPic != nil {
			pcPic.Destroy()
			//delete pcPic;
			pcPic = nil
		}
		//#endif
	}

	pcListPic.Init()
	this.m_iPOCLastDisplay = -TLibCommon.MAX_INT
}
示例#2
0
文件: TAppDecTop.go 项目: nacore/GoHM
func (this *TAppDecTop) xWriteOutput(pcListPic *list.List, tId uint) {
	not_displayed := 0

	for e := pcListPic.Front(); e != nil; e = e.Next() {
		pcPic := e.Value.(*TLibCommon.TComPic)
		if pcPic.GetOutputMark() && int(pcPic.GetPOC()) > this.m_iPOCLastDisplay {
			not_displayed++
		}
	}

	for e := pcListPic.Front(); e != nil; e = e.Next() {
		pcPic := e.Value.(*TLibCommon.TComPic)
		//fmt.Printf("tId=%d, %v, %d, %d, %d, %d\n", tId, pcPic.GetOutputMark(), not_displayed, pcPic.GetNumReorderPics(tId), int(pcPic.GetPOC()), this.m_iPOCLastDisplay);
		if pcPic.GetOutputMark() && (not_displayed > pcPic.GetNumReorderPics(tId) && int(pcPic.GetPOC()) > this.m_iPOCLastDisplay) {
			// write to file
			not_displayed--
			if this.m_pchReconFile != "" {
				conf := pcPic.GetConformanceWindow()
				var defDisp *TLibCommon.Window
				if this.m_respectDefDispWindow != 0 {
					defDisp = pcPic.GetDefDisplayWindow()
				} else {
					defDisp = TLibCommon.NewWindow()
				}

				this.m_cTVideoIOYuvReconFile.Write(pcPic.GetPicYuvRec(),
					conf.GetWindowLeftOffset()+defDisp.GetWindowLeftOffset(),
					conf.GetWindowRightOffset()+defDisp.GetWindowRightOffset(),
					conf.GetWindowTopOffset()+defDisp.GetWindowTopOffset(),
					conf.GetWindowBottomOffset()+defDisp.GetWindowBottomOffset())
			}

			// update POC of display order
			this.m_iPOCLastDisplay = int(pcPic.GetPOC())
			//fmt.Printf("m_iPOCLastDisplay=%d\n",this.m_iPOCLastDisplay);

			// erase non-referenced picture in the reference picture list after display
			if !pcPic.GetSlice(0).IsReferenced() && pcPic.GetReconMark() == true {
				//#   if !D   YN_REF_FREE
				pcPic.SetReconMark(false)

				// mark it should be extended later
				pcPic.GetPicYuvRec().SetBorderExtension(false)

				//#   else
				//              pcPic->destroy();
				//              pcListPic->erase( iterPic );
				//              iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
				//              continue;
				//#   endif
			}
			pcPic.SetOutputMark(false)
		}
	}

}
示例#3
0
文件: TEncCfg.go 项目: nacore/GoHM
//public:
func NewTEncCfg() *TEncCfg {
	return &TEncCfg{m_conformanceWindow: TLibCommon.NewWindow(),
		m_defaultDisplayWindow: TLibCommon.NewWindow()}
}
示例#4
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
}