Ejemplo n.º 1
0
func (this *TEncTop) CreateWPPCoders(iNumSubstreams int) {
	if this.m_pcSbacCoders != nil {
		return // already generated.
	}

	this.m_iNumSubstreams = iNumSubstreams
	this.m_pcSbacCoders = make([]*TEncSbac, iNumSubstreams)
	this.m_pcBinCoderCABACs = make([]*TEncBinCABAC, iNumSubstreams)
	this.m_pcRDGoOnSbacCoders = make([]*TEncSbac, iNumSubstreams)
	this.m_pcRDGoOnBinCodersCABAC = make([]*TEncBinCABAC, iNumSubstreams)
	this.m_pcBitCounters = make([]*TLibCommon.TComBitCounter, iNumSubstreams)
	this.m_pcRdCosts = make([]*TEncRdCost, iNumSubstreams)

	for ui := 0; ui < iNumSubstreams; ui++ {
		this.m_pcSbacCoders[ui] = NewTEncSbac()
		this.m_pcBinCoderCABACs[ui] = NewTEncBinCABAC()
		this.m_pcRDGoOnSbacCoders[ui] = NewTEncSbac()
		this.m_pcRDGoOnBinCodersCABAC[ui] = NewTEncBinCABAC()
		this.m_pcBitCounters[ui] = TLibCommon.NewTComBitCounter()
		this.m_pcRdCosts[ui] = NewTEncRdCost()

		this.m_pcRDGoOnSbacCoders[ui].init(this.m_pcRDGoOnBinCodersCABAC[ui])
		this.m_pcSbacCoders[ui].init(this.m_pcBinCoderCABACs[ui])
	}
	if this.GetEncCfg().m_bUseSBACRD {
		this.m_ppppcRDSbacCoders = make([][][]*TEncSbac, iNumSubstreams)
		this.m_ppppcBinCodersCABAC = make([][][]*TEncBinCABAC, iNumSubstreams)
		for ui := 0; ui < iNumSubstreams; ui++ {
			this.m_ppppcRDSbacCoders[ui] = make([][]*TEncSbac, TLibCommon.G_uiMaxCUDepth+1)
			this.m_ppppcBinCodersCABAC[ui] = make([][]*TEncBinCABAC, TLibCommon.G_uiMaxCUDepth+1)

			for iDepth := 0; iDepth < int(TLibCommon.G_uiMaxCUDepth+1); iDepth++ {
				this.m_ppppcRDSbacCoders[ui][iDepth] = make([]*TEncSbac, TLibCommon.CI_NUM)
				this.m_ppppcBinCodersCABAC[ui][iDepth] = make([]*TEncBinCABAC, TLibCommon.CI_NUM)

				for iCIIdx := 0; iCIIdx < TLibCommon.CI_NUM; iCIIdx++ {
					this.m_ppppcRDSbacCoders[ui][iDepth][iCIIdx] = NewTEncSbac()
					this.m_ppppcBinCodersCABAC[ui][iDepth][iCIIdx] = NewTEncBinCABAC()
					this.m_ppppcRDSbacCoders[ui][iDepth][iCIIdx].init(this.m_ppppcBinCodersCABAC[ui][iDepth][iCIIdx])
				}
			}
		}
	}
}
Ejemplo n.º 2
0
func NewTEncTop() *TEncTop {
	return &TEncTop{m_iPOCLast: -1,
		m_cListPic:             list.New(),
		m_cSearch:              NewTEncSearch(),
		m_cTrQuant:             TLibCommon.NewTComTrQuant(),
		m_cLoopFilter:          TLibCommon.NewTComLoopFilter(),
		m_cEncSAO:              NewTEncSampleAdaptiveOffset(),
		m_cEntropyCoder:        NewTEncEntropy(),
		m_cCavlcCoder:          NewTEncCavlc(),
		m_cSbacCoder:           NewTEncSbac(),
		m_cBinCoderCABAC:       NewTEncBinCABAC(),
		m_cGOPEncoder:          NewTEncGOP(),
		m_cSliceEncoder:        NewTEncSlice(),
		m_cCuEncoder:           NewTEncCu(),
		m_cSPS:                 TLibCommon.NewTComSPS(),
		m_cPPS:                 TLibCommon.NewTComPPS(),
		m_cRDGoOnBinCoderCABAC: NewTEncBinCABACCounter(),
		m_cBitCounter:          TLibCommon.NewTComBitCounter(),
		m_cRdCost:              NewTEncRdCost(),
		m_cRDGoOnSbacCoder:     NewTEncSbac(),
		m_scalingList:          TLibCommon.NewTComScalingList(),
		m_cRateCtrl:            NewTEncRateCtrl(),
	}
}