Пример #1
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)
}