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 }
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) } } }