当前位置: 首页>>代码示例>>Golang>>正文


Golang TComDataCU.GetPartitionSize1方法代码示例

本文整理汇总了Golang中gohm/TLibCommon.TComDataCU.GetPartitionSize1方法的典型用法代码示例。如果您正苦于以下问题:Golang TComDataCU.GetPartitionSize1方法的具体用法?Golang TComDataCU.GetPartitionSize1怎么用?Golang TComDataCU.GetPartitionSize1使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gohm/TLibCommon.TComDataCU的用法示例。


在下文中一共展示了TComDataCU.GetPartitionSize1方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: DecodeMVPIdxPU

func (this *TDecEntropy) DecodeMVPIdxPU(pcSubCU *TLibCommon.TComDataCU, uiPartAddr, uiDepth, uiPartIdx uint, eRefList TLibCommon.RefPicList) {
	iMVPIdx := -1

	cZeroMv := TLibCommon.NewTComMv(0, 0)
	cMv := cZeroMv
	iRefIdx := -1

	pcSubCUMvField := pcSubCU.GetCUMvField(eRefList)
	pAMVPInfo := pcSubCUMvField.GetAMVPInfo()

	iRefIdx = int(pcSubCUMvField.GetRefIdx(int(uiPartAddr)))
	cMv = cZeroMv

	if (pcSubCU.GetInterDir1(uiPartAddr) & (1 << eRefList)) != 0 {
		this.m_pcEntropyDecoderIf.ParseMVPIdx(&iMVPIdx)
	}
	pcSubCU.FillMvpCand(uiPartIdx, uiPartAddr, eRefList, iRefIdx, pAMVPInfo)
	pcSubCU.SetMVPNumSubParts(pAMVPInfo.IN, eRefList, uiPartAddr, uiPartIdx, uiDepth)
	pcSubCU.SetMVPIdxSubParts(iMVPIdx, eRefList, uiPartAddr, uiPartIdx, uiDepth)
	if iRefIdx >= 0 {
		cMv = this.m_pcPrediction.GetMvPredAMVP(pcSubCU, uiPartIdx, uiPartAddr, eRefList)
		cMvd := pcSubCUMvField.GetMvd(int(uiPartAddr))
		//fmt.Printf("%d=(%d,%d)=(%d,%d)\n", iRefIdx, cMv.GetHor(), cMv.GetVer(), cMvd.GetHor(), cMvd.GetVer());
		cMv.Set(cMv.GetHor()+cMvd.GetHor(), cMv.GetVer()+cMvd.GetVer())
	}

	ePartSize := pcSubCU.GetPartitionSize1(uiPartAddr)
	pcSubCU.GetCUMvField(eRefList).SetAllMv(*cMv, ePartSize, int(uiPartAddr), 0, int(uiPartIdx))
	//fmt.Printf("%d(%d,%d)=%d,%d,%d",eRefList,cMv.GetHor(), cMv.GetVer(),ePartSize, uiPartAddr, uiPartIdx);
}
开发者ID:hanjinze,项目名称:GoHM,代码行数:30,代码来源:TDecEntropy.go

示例2: DecodeCoeff

func (this *TDecEntropy) DecodeCoeff(pcCU *TLibCommon.TComDataCU, uiAbsPartIdx, uiDepth, uiWidth, uiHeight uint, bCodeDQP *bool) {
	uiMinCoeffSize := pcCU.GetPic().GetMinCUWidth() * pcCU.GetPic().GetMinCUHeight()
	uiLumaOffset := uiMinCoeffSize * uiAbsPartIdx
	uiChromaOffset := uiLumaOffset >> 2

	if !pcCU.IsIntra(uiAbsPartIdx) {
		uiQtRootCbf := uint(1)
		if !(pcCU.GetPartitionSize1(uiAbsPartIdx) == TLibCommon.SIZE_2Nx2N && pcCU.GetMergeFlag1(uiAbsPartIdx)) {
			this.m_pcEntropyDecoderIf.ParseQtRootCbf(uiAbsPartIdx, &uiQtRootCbf)
		}
		if uiQtRootCbf == 0 {
			pcCU.SetCbfSubParts(0, 0, 0, uiAbsPartIdx, uiDepth)
			pcCU.SetTrIdxSubParts(0, uiAbsPartIdx, uiDepth)
			return
		}

	}
	this.xDecodeTransform(pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, bCodeDQP)
}
开发者ID:hanjinze,项目名称:GoHM,代码行数:19,代码来源:TDecEntropy.go

示例3: DecodeRefFrmIdxPU

func (this *TDecEntropy) DecodeRefFrmIdxPU(pcCU *TLibCommon.TComDataCU, uiAbsPartIdx, uiDepth, uiPartIdx uint, eRefList TLibCommon.RefPicList) {
	iRefFrmIdx := 0
	iParseRefFrmIdx := pcCU.GetInterDir1(uiAbsPartIdx) & (1 << uint(eRefList))
	//fmt.Printf("iParseRefFrmIdx=%d\n", iParseRefFrmIdx);

	if pcCU.GetSlice().GetNumRefIdx(eRefList) > 1 && iParseRefFrmIdx != 0 {
		this.m_pcEntropyDecoderIf.ParseRefFrmIdx(pcCU, &iRefFrmIdx, eRefList)
		//fmt.Printf("0iRefFrmIdx=%d\n", iRefFrmIdx);
	} else if iParseRefFrmIdx == 0 {
		iRefFrmIdx = TLibCommon.NOT_VALID
		//fmt.Printf("1iRefFrmIdx=%d\n", iRefFrmIdx);
	} else {
		iRefFrmIdx = 0
		//fmt.Printf("2iRefFrmIdx=%d\n", iRefFrmIdx);
	}

	ePartSize := pcCU.GetPartitionSize1(uiAbsPartIdx)
	pcCU.GetCUMvField(eRefList).SetAllRefIdx(int8(iRefFrmIdx), ePartSize, int(uiAbsPartIdx), uiDepth, int(uiPartIdx))
}
开发者ID:hanjinze,项目名称:GoHM,代码行数:19,代码来源:TDecEntropy.go

示例4: encodeCoeff

func (this *TEncEntropy) encodeCoeff(pcCU *TLibCommon.TComDataCU, uiAbsPartIdx, uiDepth, uiWidth, uiHeight uint, bCodeDQP *bool) {
	uiMinCoeffSize := pcCU.GetPic().GetMinCUWidth() * pcCU.GetPic().GetMinCUHeight()
	uiLumaOffset := uiMinCoeffSize * uiAbsPartIdx
	uiChromaOffset := uiLumaOffset >> 2

	if pcCU.IsIntra(uiAbsPartIdx) {
		/*DTRACE_CABAC_VL( g_nSymbolCounter++ )*/
		this.m_pcEntropyCoderIf.DTRACE_CABAC_T("\tdecodeTransformIdx()\tCUDepth=")
		this.m_pcEntropyCoderIf.DTRACE_CABAC_V(uiDepth)
		this.m_pcEntropyCoderIf.DTRACE_CABAC_T("\n")
	} else {
		if !(pcCU.GetMergeFlag1(uiAbsPartIdx) && pcCU.GetPartitionSize1(uiAbsPartIdx) == TLibCommon.SIZE_2Nx2N) {
			this.m_pcEntropyCoderIf.codeQtRootCbf(pcCU, uiAbsPartIdx)
		}
		if !pcCU.GetQtRootCbf(uiAbsPartIdx) {
			return
		}
	}

	this.xEncodeTransform(pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, bCodeDQP)
}
开发者ID:hanjinze,项目名称:GoHM,代码行数:21,代码来源:TEncEntropy.go

示例5: encodePUWise

func (this *TEncEntropy) encodePUWise(pcCU *TLibCommon.TComDataCU, uiAbsPartIdx uint, bRD bool) { //= false );
	if bRD {
		uiAbsPartIdx = 0
	}

	ePartSize := pcCU.GetPartitionSize1(uiAbsPartIdx)
	var uiNumPU uint
	if ePartSize == TLibCommon.SIZE_2Nx2N {
		uiNumPU = 1
	} else if ePartSize == TLibCommon.SIZE_NxN {
		uiNumPU = 4
	} else {
		uiNumPU = 2
	}
	uiDepth := uint(pcCU.GetDepth1(uiAbsPartIdx))
	//fmt.Printf("ePartSize=%d\n",ePartSize);
	uiPUOffset := (TLibCommon.G_auiPUOffset[uint(ePartSize)] << ((pcCU.GetSlice().GetSPS().GetMaxCUDepth() - uiDepth) << 1)) >> 4

	uiSubPartIdx := uiAbsPartIdx
	for uiPartIdx := uint(0); uiPartIdx < uiNumPU; uiPartIdx++ {
		this.encodeMergeFlag(pcCU, uiSubPartIdx)
		if pcCU.GetMergeFlag1(uiSubPartIdx) {
			this.encodeMergeIndex(pcCU, uiSubPartIdx, false)
		} else {
			this.encodeInterDirPU(pcCU, uiSubPartIdx)
			for uiRefListIdx := 0; uiRefListIdx < 2; uiRefListIdx++ {
				if pcCU.GetSlice().GetNumRefIdx(TLibCommon.RefPicList(uiRefListIdx)) > 0 {
					this.encodeRefFrmIdxPU(pcCU, uiSubPartIdx, TLibCommon.RefPicList(uiRefListIdx))
					this.encodeMvdPU(pcCU, uiSubPartIdx, TLibCommon.RefPicList(uiRefListIdx))
					this.encodeMVPIdxPU(pcCU, uiSubPartIdx, TLibCommon.RefPicList(uiRefListIdx))
				}
			}
		}
		uiSubPartIdx += uiPUOffset
	}

	return
}
开发者ID:hanjinze,项目名称:GoHM,代码行数:38,代码来源:TEncEntropy.go

示例6: xDecodeTransform

//private:
func (this *TDecEntropy) xDecodeTransform(pcCU *TLibCommon.TComDataCU, offsetLuma, offsetChroma, uiAbsPartIdx, uiDepth, width, height, uiTrIdx uint, bCodeDQP *bool) {
	var uiSubdiv uint
	uiLog2TrafoSize := uint(TLibCommon.G_aucConvertToBit[pcCU.GetSlice().GetSPS().GetMaxCUWidth()]) + 2 - uiDepth

	if uiTrIdx == 0 {
		this.m_bakAbsPartIdxCU = uiAbsPartIdx
	}
	if uiLog2TrafoSize == 2 {
		partNum := pcCU.GetPic().GetNumPartInCU() >> ((uiDepth - 1) << 1)
		if (uiAbsPartIdx % partNum) == 0 {
			this.m_uiBakAbsPartIdx = uiAbsPartIdx
			this.m_uiBakChromaOffset = offsetChroma
		}
	}
	if pcCU.GetPredictionMode1(uiAbsPartIdx) == TLibCommon.MODE_INTRA && pcCU.GetPartitionSize1(uiAbsPartIdx) == TLibCommon.SIZE_NxN && uiDepth == uint(pcCU.GetDepth1(uiAbsPartIdx)) {
		uiSubdiv = 1
	} else if (pcCU.GetSlice().GetSPS().GetQuadtreeTUMaxDepthInter() == 1) && (pcCU.GetPredictionMode1(uiAbsPartIdx) == TLibCommon.MODE_INTER) && (pcCU.GetPartitionSize1(uiAbsPartIdx) != TLibCommon.SIZE_2Nx2N) && (uiDepth == uint(pcCU.GetDepth1(uiAbsPartIdx))) {
		uiSubdiv = uint(TLibCommon.B2U(uiLog2TrafoSize > pcCU.GetQuadtreeTULog2MinSizeInCU(uiAbsPartIdx)))
	} else if uiLog2TrafoSize > pcCU.GetSlice().GetSPS().GetQuadtreeTULog2MaxSize() {
		uiSubdiv = 1
	} else if uiLog2TrafoSize == pcCU.GetSlice().GetSPS().GetQuadtreeTULog2MinSize() {
		uiSubdiv = 0
	} else if uiLog2TrafoSize == pcCU.GetQuadtreeTULog2MinSizeInCU(uiAbsPartIdx) {
		uiSubdiv = 0
	} else {
		//assert( uiLog2TrafoSize > pcCU.GetQuadtreeTULog2MinSizeInCU(uiAbsPartIdx) );
		this.m_pcEntropyDecoderIf.ParseTransformSubdivFlag(&uiSubdiv, 5-uiLog2TrafoSize)
	}

	uiTrDepth := uiDepth - uint(pcCU.GetDepth1(uiAbsPartIdx))
	{
		bFirstCbfOfCU := uiTrDepth == 0
		if bFirstCbfOfCU {
			pcCU.SetCbfSubParts4(0, TLibCommon.TEXT_CHROMA_U, uiAbsPartIdx, uiDepth)
			pcCU.SetCbfSubParts4(0, TLibCommon.TEXT_CHROMA_V, uiAbsPartIdx, uiDepth)
		}
		if bFirstCbfOfCU || uiLog2TrafoSize > 2 {
			if bFirstCbfOfCU || pcCU.GetCbf3(uiAbsPartIdx, TLibCommon.TEXT_CHROMA_U, uiTrDepth-1) != 0 {
				this.m_pcEntropyDecoderIf.ParseQtCbf(pcCU, uiAbsPartIdx, TLibCommon.TEXT_CHROMA_U, uiTrDepth, uiDepth)
			}
			if bFirstCbfOfCU || pcCU.GetCbf3(uiAbsPartIdx, TLibCommon.TEXT_CHROMA_V, uiTrDepth-1) != 0 {
				this.m_pcEntropyDecoderIf.ParseQtCbf(pcCU, uiAbsPartIdx, TLibCommon.TEXT_CHROMA_V, uiTrDepth, uiDepth)
			}
		} else {
			pcCU.SetCbfSubParts4(byte(pcCU.GetCbf3(uiAbsPartIdx, TLibCommon.TEXT_CHROMA_U, uiTrDepth-1)<<uiTrDepth), TLibCommon.TEXT_CHROMA_U, uiAbsPartIdx, uiDepth)
			pcCU.SetCbfSubParts4(byte(pcCU.GetCbf3(uiAbsPartIdx, TLibCommon.TEXT_CHROMA_V, uiTrDepth-1)<<uiTrDepth), TLibCommon.TEXT_CHROMA_V, uiAbsPartIdx, uiDepth)
		}
	}

	if uiSubdiv != 0 {
		var size uint
		width >>= 1
		height >>= 1
		size = width * height
		uiTrIdx++
		uiDepth++
		uiQPartNum := pcCU.GetPic().GetNumPartInCU() >> (uiDepth << 1)
		uiStartAbsPartIdx := uiAbsPartIdx
		uiYCbf := uint(0)
		uiUCbf := uint(0)
		uiVCbf := uint(0)

		for i := uint(0); i < 4; i++ {
			this.xDecodeTransform(pcCU, offsetLuma, offsetChroma, uiAbsPartIdx, uiDepth, width, height, uiTrIdx, bCodeDQP)
			uiYCbf |= uint(pcCU.GetCbf3(uiAbsPartIdx, TLibCommon.TEXT_LUMA, uiTrDepth+1))
			uiUCbf |= uint(pcCU.GetCbf3(uiAbsPartIdx, TLibCommon.TEXT_CHROMA_U, uiTrDepth+1))
			uiVCbf |= uint(pcCU.GetCbf3(uiAbsPartIdx, TLibCommon.TEXT_CHROMA_V, uiTrDepth+1))
			uiAbsPartIdx += uiQPartNum
			offsetLuma += size
			offsetChroma += (size >> 2)
		}

		for ui := uint(0); ui < 4*uiQPartNum; ui++ {
			pcCU.GetCbf1(TLibCommon.TEXT_LUMA)[uiStartAbsPartIdx+ui] |= byte(uiYCbf << uiTrDepth)
			pcCU.GetCbf1(TLibCommon.TEXT_CHROMA_U)[uiStartAbsPartIdx+ui] |= byte(uiUCbf << uiTrDepth)
			pcCU.GetCbf1(TLibCommon.TEXT_CHROMA_V)[uiStartAbsPartIdx+ui] |= byte(uiVCbf << uiTrDepth)
		}
	} else {
		//assert( uiDepth >= pcCU.GetDepth( uiAbsPartIdx ) );
		pcCU.SetTrIdxSubParts(uiTrDepth, uiAbsPartIdx, uiDepth)

		{
			//DTRACE_CABAC_VL( TLibCommon.G_nSymbolCounter++ );
			/*this.m_pcEntropyDecoderIf.DTRACE_CABAC_T("\tTrIdx: abspart=")
			  this.m_pcEntropyDecoderIf.DTRACE_CABAC_V(uiAbsPartIdx)
			  this.m_pcEntropyDecoderIf.DTRACE_CABAC_T("\tdepth=")
			  this.m_pcEntropyDecoderIf.DTRACE_CABAC_V(uiDepth)
			  this.m_pcEntropyDecoderIf.DTRACE_CABAC_T("\ttrdepth=")
			  this.m_pcEntropyDecoderIf.DTRACE_CABAC_V(uiTrDepth)
			  this.m_pcEntropyDecoderIf.DTRACE_CABAC_T("\n")*/
		}

		pcCU.SetCbfSubParts4(0, TLibCommon.TEXT_LUMA, uiAbsPartIdx, uiDepth)
		if pcCU.GetPredictionMode1(uiAbsPartIdx) != TLibCommon.MODE_INTRA && uiDepth == uint(pcCU.GetDepth1(uiAbsPartIdx)) && pcCU.GetCbf3(uiAbsPartIdx, TLibCommon.TEXT_CHROMA_U, 0) == 0 && pcCU.GetCbf3(uiAbsPartIdx, TLibCommon.TEXT_CHROMA_V, 0) == 0 {
			pcCU.SetCbfSubParts4(1<<uiTrDepth, TLibCommon.TEXT_LUMA, uiAbsPartIdx, uiDepth)
		} else {
			this.m_pcEntropyDecoderIf.ParseQtCbf(pcCU, uiAbsPartIdx, TLibCommon.TEXT_LUMA, uiTrDepth, uiDepth)
		}

//.........这里部分代码省略.........
开发者ID:hanjinze,项目名称:GoHM,代码行数:101,代码来源:TDecEntropy.go

示例7: DecodePUWise

func (this *TDecEntropy) DecodePUWise(pcCU *TLibCommon.TComDataCU, uiAbsPartIdx, uiDepth uint, pcSubCU *TLibCommon.TComDataCU) {
	ePartSize := pcCU.GetPartitionSize1(uiAbsPartIdx)
	var uiNumPU uint
	if ePartSize == TLibCommon.SIZE_2Nx2N {
		uiNumPU = 1
	} else if ePartSize == TLibCommon.SIZE_NxN {
		uiNumPU = 4
	} else {
		uiNumPU = 2
	}

	uiPUOffset := (TLibCommon.G_auiPUOffset[uint(ePartSize)] << ((pcCU.GetSlice().GetSPS().GetMaxCUDepth() - uiDepth) << 1)) >> 4

	var cMvFieldNeighbours [TLibCommon.MRG_MAX_NUM_CANDS << 1]TLibCommon.TComMvField // double length for mv of both lists
	var uhInterDirNeighbours [TLibCommon.MRG_MAX_NUM_CANDS]byte

	for ui := uint(0); ui < pcCU.GetSlice().GetMaxNumMergeCand(); ui++ {
		uhInterDirNeighbours[ui] = 0
	}
	numValidMergeCand := 0
	isMerged := false

	pcSubCU.CopyInterPredInfoFrom(pcCU, uiAbsPartIdx, TLibCommon.REF_PIC_LIST_0)
	pcSubCU.CopyInterPredInfoFrom(pcCU, uiAbsPartIdx, TLibCommon.REF_PIC_LIST_1)
	uiSubPartIdx := uiAbsPartIdx
	for uiPartIdx := uint(0); uiPartIdx < uiNumPU; uiPartIdx++ {
		this.DecodeMergeFlag(pcCU, uiSubPartIdx, uiDepth, uiPartIdx)
		if pcCU.GetMergeFlag1(uiSubPartIdx) {
			this.DecodeMergeIndex(pcCU, uiPartIdx, uiSubPartIdx, uiDepth)
			uiMergeIndex := pcCU.GetMergeIndex1(uiSubPartIdx)
			if pcCU.GetSlice().GetPPS().GetLog2ParallelMergeLevelMinus2() != 0 && ePartSize != TLibCommon.SIZE_2Nx2N && pcSubCU.GetWidth1(0) <= 8 {
				pcSubCU.SetPartSizeSubParts(TLibCommon.SIZE_2Nx2N, 0, uiDepth)
				if !isMerged {
					pcSubCU.GetInterMergeCandidates(0, 0, cMvFieldNeighbours[:], uhInterDirNeighbours[:], &numValidMergeCand, -1)
					isMerged = true
				}
				pcSubCU.SetPartSizeSubParts(ePartSize, 0, uiDepth)
			} else {
				uiMergeIndex = pcCU.GetMergeIndex1(uiSubPartIdx)
				pcSubCU.GetInterMergeCandidates(uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours[:], uhInterDirNeighbours[:], &numValidMergeCand, int(uiMergeIndex))
			}
			pcCU.SetInterDirSubParts(uint(uhInterDirNeighbours[uiMergeIndex]), uiSubPartIdx, uiPartIdx, uiDepth)

			cTmpMv := TLibCommon.NewTComMv(0, 0)
			for uiRefListIdx := 0; uiRefListIdx < 2; uiRefListIdx++ {
				if pcCU.GetSlice().GetNumRefIdx(TLibCommon.RefPicList(uiRefListIdx)) > 0 {
					pcCU.SetMVPIdxSubParts(0, TLibCommon.RefPicList(uiRefListIdx), uiSubPartIdx, uiPartIdx, uiDepth)
					pcCU.SetMVPNumSubParts(0, TLibCommon.RefPicList(uiRefListIdx), uiSubPartIdx, uiPartIdx, uiDepth)
					pcCU.GetCUMvField(TLibCommon.RefPicList(uiRefListIdx)).SetAllMvd(*cTmpMv, ePartSize, int(uiSubPartIdx), uiDepth, int(uiPartIdx))
					pcCU.GetCUMvField(TLibCommon.RefPicList(uiRefListIdx)).SetAllMvField(&cMvFieldNeighbours[2*int(uiMergeIndex)+uiRefListIdx], ePartSize, int(uiSubPartIdx), uiDepth, int(uiPartIdx))
				}
			}
		} else {
			this.DecodeInterDirPU(pcCU, uiSubPartIdx, uiDepth, uiPartIdx)
			for uiRefListIdx := 0; uiRefListIdx < 2; uiRefListIdx++ {
				if pcCU.GetSlice().GetNumRefIdx(TLibCommon.RefPicList(uiRefListIdx)) > 0 {
					//fmt.Printf("%d \n",uiRefListIdx);
					this.DecodeRefFrmIdxPU(pcCU, uiSubPartIdx, uiDepth, uiPartIdx, TLibCommon.RefPicList(uiRefListIdx))
					this.DecodeMvdPU(pcCU, uiSubPartIdx, uiDepth, uiPartIdx, TLibCommon.RefPicList(uiRefListIdx))
					this.DecodeMVPIdxPU(pcSubCU, uiSubPartIdx-uiAbsPartIdx, uiDepth, uiPartIdx, TLibCommon.RefPicList(uiRefListIdx))
				}
			}
		}
		if (pcCU.GetInterDir1(uiSubPartIdx) == 3) && pcSubCU.IsBipredRestriction(uiPartIdx) {
			pcCU.GetCUMvField(TLibCommon.REF_PIC_LIST_1).SetAllMv(*TLibCommon.NewTComMv(0, 0), ePartSize, int(uiSubPartIdx), uiDepth, int(uiPartIdx))
			pcCU.GetCUMvField(TLibCommon.REF_PIC_LIST_1).SetAllRefIdx(-1, ePartSize, int(uiSubPartIdx), uiDepth, int(uiPartIdx))
			pcCU.SetInterDirSubParts(1, uiSubPartIdx, uiPartIdx, uiDepth)
		}

		uiSubPartIdx += uiPUOffset
	}
	return
}
开发者ID:hanjinze,项目名称:GoHM,代码行数:73,代码来源:TDecEntropy.go

示例8: xEncodeTransform

func (this *TEncEntropy) xEncodeTransform(pcCU *TLibCommon.TComDataCU, offsetLuma, offsetChroma, uiAbsPartIdx, uiDepth, width, height, uiTrIdx uint, bCodeDQP *bool) {
	uiSubdiv := uint(TLibCommon.B2U(uint(pcCU.GetTransformIdx1(uiAbsPartIdx)+pcCU.GetDepth1(uiAbsPartIdx)) > uiDepth))
	uiLog2TrafoSize := uint(TLibCommon.G_aucConvertToBit[pcCU.GetSlice().GetSPS().GetMaxCUWidth()]) + 2 - uiDepth
	cbfY := pcCU.GetCbf3(uiAbsPartIdx, TLibCommon.TEXT_LUMA, uiTrIdx)
	cbfU := pcCU.GetCbf3(uiAbsPartIdx, TLibCommon.TEXT_CHROMA_U, uiTrIdx)
	cbfV := pcCU.GetCbf3(uiAbsPartIdx, TLibCommon.TEXT_CHROMA_V, uiTrIdx)

	//fmt.Print("Enter xEncodeTransform\n");// with uiSubdiv=%d, uiAbsPartIdx=%d, uiDepth=%d\n", uiSubdiv, uiAbsPartIdx, uiDepth);

	if uiTrIdx == 0 {
		this.m_bakAbsPartIdxCU = uiAbsPartIdx
	}
	if uiLog2TrafoSize == 2 {
		partNum := pcCU.GetPic().GetNumPartInCU() >> ((uiDepth - 1) << 1)
		if (uiAbsPartIdx % partNum) == 0 {
			this.m_uiBakAbsPartIdx = uiAbsPartIdx
			this.m_uiBakChromaOffset = offsetChroma
		} else if (uiAbsPartIdx % partNum) == (partNum - 1) {
			cbfU = pcCU.GetCbf3(this.m_uiBakAbsPartIdx, TLibCommon.TEXT_CHROMA_U, uiTrIdx)
			cbfV = pcCU.GetCbf3(this.m_uiBakAbsPartIdx, TLibCommon.TEXT_CHROMA_V, uiTrIdx)
		}
	}

	if pcCU.GetPredictionMode1(uiAbsPartIdx) == TLibCommon.MODE_INTRA && pcCU.GetPartitionSize1(uiAbsPartIdx) == TLibCommon.SIZE_NxN && uiDepth == uint(pcCU.GetDepth1(uiAbsPartIdx)) {
		//assert( uiSubdiv );
	} else if pcCU.GetPredictionMode1(uiAbsPartIdx) == TLibCommon.MODE_INTER && (pcCU.GetPartitionSize1(uiAbsPartIdx) != TLibCommon.SIZE_2Nx2N) && uiDepth == uint(pcCU.GetDepth1(uiAbsPartIdx)) && (pcCU.GetSlice().GetSPS().GetQuadtreeTUMaxDepthInter() == 1) {
		if uiLog2TrafoSize > pcCU.GetQuadtreeTULog2MinSizeInCU(uiAbsPartIdx) {
			//assert( uiSubdiv );
		} else {
			//assert(!uiSubdiv );
		}
	} else if uiLog2TrafoSize > pcCU.GetSlice().GetSPS().GetQuadtreeTULog2MaxSize() {
		//assert( uiSubdiv );
	} else if uiLog2TrafoSize == pcCU.GetSlice().GetSPS().GetQuadtreeTULog2MinSize() {
		//assert( !uiSubdiv );
	} else if uiLog2TrafoSize == pcCU.GetQuadtreeTULog2MinSizeInCU(uiAbsPartIdx) {
		//assert( !uiSubdiv );
	} else {
		//assert( uiLog2TrafoSize > pcCU.GetQuadtreeTULog2MinSizeInCU(uiAbsPartIdx) );
		this.m_pcEntropyCoderIf.codeTransformSubdivFlag(uiSubdiv, 5-uiLog2TrafoSize)
	}

	uiTrDepthCurr := uiDepth - uint(pcCU.GetDepth1(uiAbsPartIdx))
	bFirstCbfOfCU := uiTrDepthCurr == 0
	if bFirstCbfOfCU || uiLog2TrafoSize > 2 {
		if bFirstCbfOfCU || pcCU.GetCbf3(uiAbsPartIdx, TLibCommon.TEXT_CHROMA_U, uiTrDepthCurr-1) != 0 {
			this.m_pcEntropyCoderIf.codeQtCbf(pcCU, uiAbsPartIdx, TLibCommon.TEXT_CHROMA_U, uiTrDepthCurr)
		}
		if bFirstCbfOfCU || pcCU.GetCbf3(uiAbsPartIdx, TLibCommon.TEXT_CHROMA_V, uiTrDepthCurr-1) != 0 {
			this.m_pcEntropyCoderIf.codeQtCbf(pcCU, uiAbsPartIdx, TLibCommon.TEXT_CHROMA_V, uiTrDepthCurr)
		}
	} else if uiLog2TrafoSize == 2 {
		//assert( pcCU.GetCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepthCurr ) == pcCU.GetCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepthCurr - 1 ) );
		//assert( pcCU.GetCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepthCurr ) == pcCU.GetCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepthCurr - 1 ) );
	}

	if uiSubdiv != 0 {
		var size uint
		width >>= 1
		height >>= 1
		size = width * height
		uiTrIdx++
		uiDepth++
		partNum := pcCU.GetPic().GetNumPartInCU() >> (uiDepth << 1)

		this.xEncodeTransform(pcCU, offsetLuma, offsetChroma, uiAbsPartIdx, uiDepth, width, height, uiTrIdx, bCodeDQP)

		uiAbsPartIdx += partNum
		offsetLuma += size
		offsetChroma += (size >> 2)
		this.xEncodeTransform(pcCU, offsetLuma, offsetChroma, uiAbsPartIdx, uiDepth, width, height, uiTrIdx, bCodeDQP)

		uiAbsPartIdx += partNum
		offsetLuma += size
		offsetChroma += (size >> 2)
		this.xEncodeTransform(pcCU, offsetLuma, offsetChroma, uiAbsPartIdx, uiDepth, width, height, uiTrIdx, bCodeDQP)

		uiAbsPartIdx += partNum
		offsetLuma += size
		offsetChroma += (size >> 2)
		this.xEncodeTransform(pcCU, offsetLuma, offsetChroma, uiAbsPartIdx, uiDepth, width, height, uiTrIdx, bCodeDQP)
	} else {
		/*DTRACE_CABAC_VL( g_nSymbolCounter++ );*/
		this.m_pcEntropyCoderIf.DTRACE_CABAC_T("\tTrIdx: abspart=")
		this.m_pcEntropyCoderIf.DTRACE_CABAC_V(uiAbsPartIdx)
		this.m_pcEntropyCoderIf.DTRACE_CABAC_T("\tdepth=")
		this.m_pcEntropyCoderIf.DTRACE_CABAC_V(uiDepth)
		this.m_pcEntropyCoderIf.DTRACE_CABAC_T("\ttrdepth=")
		this.m_pcEntropyCoderIf.DTRACE_CABAC_V(uint(pcCU.GetTransformIdx1(uiAbsPartIdx)))
		this.m_pcEntropyCoderIf.DTRACE_CABAC_T("\n")

		if pcCU.GetPredictionMode1(uiAbsPartIdx) != TLibCommon.MODE_INTRA && uiDepth == uint(pcCU.GetDepth1(uiAbsPartIdx)) && pcCU.GetCbf3(uiAbsPartIdx, TLibCommon.TEXT_CHROMA_U, 0) == 0 && pcCU.GetCbf3(uiAbsPartIdx, TLibCommon.TEXT_CHROMA_V, 0) == 0 {
			//assert( pcCU.GetCbf( uiAbsPartIdx, TLibCommon.TEXT_LUMA, 0 ) );
		} else {
			this.m_pcEntropyCoderIf.codeQtCbf(pcCU, uiAbsPartIdx, TLibCommon.TEXT_LUMA, uint(pcCU.GetTransformIdx1(uiAbsPartIdx)))
		}

		if cbfY != 0 || cbfU != 0 || cbfV != 0 {
			// dQP: only for LCU once
			if pcCU.GetSlice().GetPPS().GetUseDQP() {
//.........这里部分代码省略.........
开发者ID:hanjinze,项目名称:GoHM,代码行数:101,代码来源:TEncEntropy.go


注:本文中的gohm/TLibCommon.TComDataCU.GetPartitionSize1方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。