LCU单元分割(续)

来源:互联网 发布:迅捷网络登录密码 编辑:程序博客网 时间:2024/05/17 04:59

原文地址:http://blog.csdn.net/yangxiao_xiang/article/details/8275181

上一篇文章对每个LCU进行遍历所有的CU分支,只是显示LCU的分割过程,但是并不能确定一个LCU分割结果,经过zhuix7788指出,意识到自己的误区了,后来通过一天的折腾,终于找到了真正的分割输出的结果。因为一个LCU的最终分割是要经过预测和熵编码后才能通过率失真代价确定。

所以,可以在m_pcCuEncoder->compressCU( pcCU );后查看pcCU->m_puhDepth对应的数组。这是一个大小为256的数组, 表示LCU的256个4X4到底如何分割的!

详情可以参考 http://blog.csdn.net/feixiang_john/article/details/7876227#comments的评论部分。)

实现代码如下:

      // run CU encoder      m_pcCuEncoder->compressCU( pcCU );      //==LCU分割单元深度信息输出==//      fprintf( g_hTrace,"=======LCU=========\n");      for(Int i=0;i<256;i++)      fprintf( g_hTrace, "%d\t",pcCU->getDepth(i));

输出结果前先要进行TraceEnc开启设定,在TComRom.h文件下设置#define  ENC_DEC_TRACE  1即可。

输出结果在HM-9.0-dev\cfg文件夹下的TraceEnc文件中。

打印输出结果如下:

=======LCU=========

2 2  22

2 2  22

2 2  22

2 2  22

2 2  22

2 2  22

2 2  22

2 2  22

2 2  22

2 2  22

2 2  22

2 2  22

2 2  22

2 2  22

2 2  22

2 2  22

2 2  22

2 2  22

2 2  22

2 2  22

2 2  22

2 2  22

2 2  22

2 2  22

1 1  11

1 1  11

1 1  11

1 1  11

1 1  11

1 1  11

1 1  11

1 1  11

1 1  11

1 1  11

1 1  11

1 1  11

1 1  11

1 1  11

1 1  11

1 1  11

2 2  22

2 2  22

2 2  22

2 2  22

2 2  22

2 2  22

2 2  22

2 2  22

3 3  33

3 3  33

3 3  33

3 3  33

3 3  33

3 3  33

3 3  33

3 3  3 3

LCU的基本存储单元为4x4的块,这个可以在HM平台的HM-9.0-dev\doc文件夹下找到一个README_data-structure文件,上面有介绍。以下就是一个LCU的存储结构示意图:


下面是根据输出结果重构的一个LCU(64x64)的分割示意图:


其中红色数字代表当前块的分割深度。

或者采用下面的方法也可以查看: 

 // analysis of CU  xCompressCU( m_ppcBestCU[0], m_ppcTempCU[0], 0 );UInt LCUDepth[256] ;for (Int i=0;i<256;i++){LCUDepth[i]=  m_ppcBestCU[0]->getDepth(i);cout<<"CurTempCUDepth: "<<LCUDepth[i]<<endl;}


0 0