HM 提取PU,CU,TU信息

HM16.20,vs2019

CU最佳分块:

//============== 输出CU深度  ===============

  TComDataCU* DepthCU = m_ppcBestCU[0];

  UInt tempDepth;

  ofstream outfile_cu("Partition_cu.txt", ios::in | ios::app);

  for (UInt iPartitionNum = 0; iPartitionNum < DepthCU->getTotalNumPart(); iPartitionNum++)

  {

      if (iPartitionNum % 16 == 0) {

          outfile_cu << endl;

      }

      tempDepth = DepthCU->getDepth(g_auiRasterToZscan[iPartitionNum]);

      outfile_cu << " " << tempDepth;

  }

  outfile_cu << endl;

  // =============code added end ===============

 

输出CTU编号,在xCompressCU函数之前

//============== 输出CTU编号 ===============

  ofstream outfile("Partition_cu.txt", ios::in | ios::app);

  UInt temp_ctu_addr = pCtu->getCtuRsAddr();

  outfile << "ctu:" << temp_ctu_addr << endl;

  outfile.close();

  // =============code added end here===============

 

输出pu分块(1)

// ============== 输出PU划分 ===============
ofstream PupartionInfo;
TComDataCU* Pupartion = m_ppcBestCU[0];
PupartionInfo.open("Partion_pu.txt", ios::app);
int iCount = 0;
TComSlice* const pcSlice = pCtu->getSlice();
const TComSPS& sps = *(pcSlice->getSPS());
int iWidthInPart = sps.getMaxCUWidth() >> 2;
for (UInt iPartitionNum = 0; iPartitionNum < Pupartion->getTotalNumPart(); iPartitionNum++)
{
if ((iCount & (iWidthInPart - 1)) == 0)
PupartionInfo << "\n";//每16个数据换行
iCount++;

PupartionInfo << Pupartion->getPartitionSize(g_auiRasterToZscan[iPartitionNum]) << " ";//以4x4块为基本单位,导出PU分割模式信息,光栅扫描转换为Z扫描
}
PupartionInfo.close();
// =============code added end ===============

 

输出pu分块(2)
UInt print8CUOrder[64] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60,64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 148, 152, 156, 160, 164, 168, 172, 176, 180, 184, 188, 192, 196, 200, 204, 208, 212, 216, 220, 224, 228, 232, 236, 240, 244, 248, 252 };

int N_LCU = pCtu->getCtuRsAddr();//CTU的Raster地址
fstream outPU("PU_PartitonSize.txt", ios::out | ios::app);
outPU << "the LCU's partitionSize information ,NO." << N_LCU << ":" << endl;
UInt PU_PartitionSize[256] = { 0 };
for (UInt i = 0; i < 256; i++)
{
PU_PartitionSize[i] = m_ppcBestCU[0]->getPartitionSize(i);
}
for (UInt i = 0; i < 64; i++)
{
outPU << PU_PartitionSize[print8CUOrder[i]];
if ((i + 1) == 64)
{
outPU << endl;
}
}
outPU.close();

 

输出TU深度

//============== 输出TU深度 ===============
ofstream Tufile("Partion_tu.txt", ios::in | ios::app);
//FILE* fp;
//fp = fopen("BasketballDrill_spilt_CU.txt", g_uiMaxCUWidth"a");
iCount = 0;
//int iWidthInPart = sps.getMaxCUWidth() >> 2;

for (int i = 0; i < pCtu->getTotalNumPart(); i++)
{
if ((iCount & (iWidthInPart - 1)) == 0)
Tufile << endl;
Tufile<< pCtu->getTransformIdx(g_auiRasterToZscan[i]) + pCtu->getDepth(g_auiRasterToZscan[i])<<" ";
iCount++;
}
Tufile.close();
//=============code added end ===============

 

// ============== 输出PU帧内预测模式划分 ===============
ofstream PupartionModeInfo;
TComDataCU* PupartionMode = m_ppcBestCU[0];
PupartionModeInfo.open("Partion_mode_pu.txt", ios::app);
iCount = 0;
for (UInt iPartitionNum = 0; iPartitionNum < PupartionMode->getTotalNumPart(); iPartitionNum++)
{
if ((iCount & (iWidthInPart - 1)) == 0)
PupartionModeInfo << "\n";//每16个数据换行
iCount++;
PupartionModeInfo << int(PupartionMode->getIntraDir(CHANNEL_TYPE_LUMA, g_auiRasterToZscan[iPartitionNum])) << " "; // 分块IPM
}
PupartionInfo.close();
// =============code added end ===============

 

posted @ 2023-10-30 08:41  师映川  阅读(100)  评论(0)    收藏  举报