Esempio n. 1
0
/// obtain required buffers
func (this *TAppEncTop) xGetBuffer() *TLibCommon.TComPicYuv {
	//assert( this.m_iGOPSize > 0 );
	var rpcPicYuvRec *TLibCommon.TComPicYuv

	// org. buffer
	if this.m_cListPicYuvRec.Len() == this.m_iGOPSize {
		e := this.m_cListPicYuvRec.Front()
		rpcPicYuvRec = e.Value.(*TLibCommon.TComPicYuv)
		this.m_cListPicYuvRec.Remove(e)
	} else {
		rpcPicYuvRec = TLibCommon.NewTComPicYuv()

		rpcPicYuvRec.Create(this.m_iSourceWidth, this.m_iSourceHeight, this.m_uiMaxCUWidth, this.m_uiMaxCUHeight, this.m_uiMaxCUDepth)
	}
	this.m_cListPicYuvRec.PushBack(rpcPicYuvRec)

	return rpcPicYuvRec
}
Esempio n. 2
0
/// encode several number of pictures until end-of-sequence
func (this *TEncTop) Encode(flush bool, pcPicYuvOrg *TLibCommon.TComPicYuv, rcListPicYuvRecOut *list.List, accessUnitsOut *AccessUnits, iNumEncoded *int) {
	if pcPicYuvOrg != nil {
		// get original YUV
		pcPicCurr := this.xGetNewPicBuffer()
		pcPicYuvOrg.CopyToPic(pcPicCurr.GetPicYuvOrg())

		// compute image characteristics
		if this.GetEncCfg().GetUseAdaptiveQP() {
			pcPicCurr.XPreanalyze()
		}
	}

	if this.m_iNumPicRcvd == 0 || (!flush && this.m_iPOCLast != 0 && this.m_iNumPicRcvd != this.GetEncCfg().m_iGOPSize && this.GetEncCfg().m_iGOPSize != 0) {
		*iNumEncoded = 0
		return
	}

	//#if RATE_CONTROL_LAMBDA_DOMAIN
	if this.GetEncCfg().m_RCEnableRateControl {
		this.m_cRateCtrl.initRCGOP(this.m_iNumPicRcvd)
	}
	//#endif

	// compress GOP
	this.m_cGOPEncoder.compressGOP(this.m_iPOCLast, this.m_iNumPicRcvd, this.m_cListPic, rcListPicYuvRecOut, accessUnitsOut)

	//#if RATE_CONTROL_LAMBDA_DOMAIN
	if this.GetEncCfg().m_RCEnableRateControl {
		this.m_cRateCtrl.destroyRCGOP()
	}
	//#endif

	*iNumEncoded = this.m_iNumPicRcvd
	this.m_iNumPicRcvd = 0
	this.m_uiNumAllPicCoded += uint(*iNumEncoded)
}