func (this *TDecTop) Init() { // initialize ROM TLibCommon.InitROM() this.m_cGopDecoder.Init(this.m_cEntropyDecoder, this.m_cSbacDecoder, this.m_cBinCabac, this.m_cCavlcDecoder, this.m_cSliceDecoder, this.m_cLoopFilter, this.m_cSAO) this.m_cSliceDecoder.Init(this.m_cEntropyDecoder, this.m_cCuDecoder) this.m_cEntropyDecoder.Init(this.m_cPrediction) }
func (this *TEncTop) Create(pchTraceFile string) { if pchTraceFile != "" { this.m_pTraceFile, _ = os.Create(pchTraceFile) } else { this.m_pTraceFile = nil } // initialize global variables TLibCommon.InitROM() this.m_cRDGoOnSbacCoder.init(this.m_cRDGoOnBinCoderCABAC) this.m_cRDGoOnBinCoderCABAC.SetSbac(this.m_cRDGoOnSbacCoder) //#if FAST_BIT_EST TLibCommon.ContextModel_BuildNextStateTable() //#endif // create processing unit classes this.m_cGOPEncoder.create() this.m_cSliceEncoder.create(this.GetEncCfg().GetSourceWidth(), this.GetEncCfg().GetSourceHeight(), TLibCommon.G_uiMaxCUWidth, TLibCommon.G_uiMaxCUHeight, byte(TLibCommon.G_uiMaxCUDepth)) this.m_cCuEncoder.create(byte(TLibCommon.G_uiMaxCUDepth), TLibCommon.G_uiMaxCUWidth, TLibCommon.G_uiMaxCUHeight) if this.GetEncCfg().m_bUseSAO { fmt.Printf("not support SAO\n") /* this.m_cEncSAO.setSaoLcuBoundary(this.GetEncCfg().GetSaoLcuBoundary()); this.m_cEncSAO.setSaoLcuBasedOptimization(this.GetEncCfg().GetSaoLcuBasedOptimization()); this.m_cEncSAO.setMaxNumOffsetsPerPic(this.GetEncCfg().GetMaxNumOffsetsPerPic()); this.m_cEncSAO.create( this.GetEncCfg().GetSourceWidth(), this.GetEncCfg().GetSourceHeight(), TLibCommon.G_uiMaxCUWidth, TLibCommon.G_uiMaxCUHeight ); this.m_cEncSAO.createEncBuffer(); */ } //#if ADAPTIVE_QP_SELECTION if this.GetEncCfg().GetUseAdaptQpSelect() { this.m_cTrQuant.InitSliceQpDelta() } //#endif this.m_cLoopFilter.Create(TLibCommon.G_uiMaxCUDepth) //#if RATE_CONTROL_LAMBDA_DOMAIN if this.GetEncCfg().m_RCEnableRateControl { this.m_cRateCtrl.init(this.GetEncCfg().m_framesToBeEncoded, this.GetEncCfg().m_RCTargetBitrate, this.GetEncCfg().m_iFrameRate, this.GetEncCfg().m_iGOPSize, this.GetEncCfg().m_iSourceWidth, this.GetEncCfg().m_iSourceHeight, int(TLibCommon.G_uiMaxCUWidth), int(TLibCommon.G_uiMaxCUHeight), this.GetEncCfg().m_RCKeepHierarchicalBit, this.GetEncCfg().m_RCUseLCUSeparateModel, this.GetEncCfg().m_GOPList) } //#else // this.m_cRateCtrl.create(this.GetEncCfg().GetIntraPeriod(), this.GetEncCfg().GetGOPSize(), this.GetEncCfg().GetFrameRate(), this.GetEncCfg().GetTarthis.GetEncCfg().GetBitrate(), this.GetEncCfg().GetQP(), this.GetEncCfg().GetNumLCUInUnit(), this.GetEncCfg().GetSourceWidth(), this.GetEncCfg().GetSourceHeight(), TLibCommon.G_uiMaxCUWidth, TLibCommon.G_uiMaxCUHeight); //#endif // if SBAC-based RD optimization is used if this.GetEncCfg().m_bUseSBACRD { this.m_pppcRDSbacCoder = make([][]*TEncSbac, TLibCommon.G_uiMaxCUDepth+1) //#if FAST_BIT_EST this.m_pppcBinCoderCABAC = make([][]*TEncBinCABACCounter, TLibCommon.G_uiMaxCUDepth+1) //#else // this.m_pppcBinCoderCABAC = new TEncBinCABAC** [TLibCommon.G_uiMaxCUDepth+1]; //#endif for iDepth := 0; iDepth < int(TLibCommon.G_uiMaxCUDepth+1); iDepth++ { this.m_pppcRDSbacCoder[iDepth] = make([]*TEncSbac, TLibCommon.CI_NUM) //#if FAST_BIT_EST this.m_pppcBinCoderCABAC[iDepth] = make([]*TEncBinCABACCounter, TLibCommon.CI_NUM) //#else // this.m_pppcBinCoderCABAC[iDepth] = new TEncBinCABAC* [CI_NUM]; //#endif for iCIIdx := 0; iCIIdx < TLibCommon.CI_NUM; iCIIdx++ { this.m_pppcRDSbacCoder[iDepth][iCIIdx] = NewTEncSbac() //#if FAST_BIT_EST this.m_pppcBinCoderCABAC[iDepth][iCIIdx] = NewTEncBinCABACCounter() //#else // this.m_pppcBinCoderCABAC [iDepth][iCIIdx] = new TEncBinCABAC; //#endif this.m_pppcRDSbacCoder[iDepth][iCIIdx].init(this.m_pppcBinCoderCABAC[iDepth][iCIIdx]) this.m_pppcBinCoderCABAC[iDepth][iCIIdx].SetSbac(this.m_pppcRDSbacCoder[iDepth][iCIIdx]) } } } }