从HEVC参考软件获取一些信息 [英] Get some information from HEVC reference software

查看:220
本文介绍了从HEVC参考软件获取一些信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是HEVC的新手,现在我正在了解参考软件(现在正在查看帧内预测).

I am new to HEVC and I am understanding the reference software now (looking at intra prediction right now).

编码后,我需要获取以下信息.

I need to get information as below after encoding.

  • 给定CTU的CU结构
  • 在计算过程中,每个CU的信息(例如QP值,Luma的选定模式,色度的选定模式,CU是否处于CTU拆分决策的最终CU结构中等)

我知道在TEncSlice.cpp中调用m_pcCuEncoder->compressCtu( pCtu )时会做出CTU决定.但是我到底从哪里可以得到这些具体信息呢?有人可以帮我弄这个吗?

I know CTU decision are made when m_pcCuEncoder->compressCtu( pCtu ) is called in TEncSlice.cpp. But where exactly I can get these specific information? Can someone help me with this?

p.s.我也在学习C ++(我有Java背景).

p.s. I am learning C++ too (I have a Java background).

推荐答案

这篇文章是编码器方面的解决方案.但是,解码器端的解决方案要复杂得多.

This post is a solution for the encoder side. However, the decoder side solution is far less complex.

如果您不熟悉代码,则在编码器上获取CTU信息(分区等)会有些棘手.但我会尽力帮助您. 我要告诉您的所有内容都是基于JEM代码而不是HM,但是我很确定您也可以将它们应用于HM.

Getting CTU information (partitioning etc.) is a bit tricky at encoder if you are new to the code. But I try to help you with it. Everything that I am going to tell you is based on the JEM code and not HM, but I am pretty sure that you can apply them to HM too.

您可能已经注意到,每个CTU的压缩/编码有两个完全独立的阶段:

As you might have noticed, there are two completely separate phases for compression/encoding of each CTU:

  1. RDO阶段:首先是速率失真优化"循环以做出决定".在这个阶段,实际上测试了所有可能的参数组合(例如,差分分区,帧内模式,过滤器等).在此阶段结束时,RDO确定最佳组合,然后将其传递到第二阶段.
  2. 编码阶段:在这里,编码器执行实际的最终编码步骤.这包括根据RDO阶段确定的参数将所有bin写入比特流.

在CTU级别,这两个阶段分别由m_pcCuEncoder->compressCtu( pCtu )m_pcCuEncoder->encodeCtu( pCtu )函数执行,都在TEncSlice.cpp文件的compressSlice()函数中.

In the CTU level, these two phases are performed by the m_pcCuEncoder->compressCtu( pCtu ) and the m_pcCuEncoder->encodeCtu( pCtu ) functions, respectively, both in the compressSlice() function of the TEncSlice.cpp file.

鉴于以上信息,您必须在第二阶段中而不是在第一阶段中寻找所需的内容(您可能已经知道这些,但是我怀疑您可能正在研究第一阶段.

Given the above information, you must look for what you are looking for, in the second phase and not the first phase (you may already know these things, but I suspected that you might be looking at the first phase).

所以,现在这是我的建议,以获取您的信息.这不是最好的方法,但是在这里更容易解释. 您首先要在HM代码中转到这一点:

So, now this is my suggestion for getting your information. It's not the best way to do it, but is easier to explain here. You first go to this point in your HM code:

compressGOP() -> encodeSlice() -> encodeCtu() -> xEncodeCU()

然后您找到预测模式(帧内/帧间)编码的行:

Then you find the line where the prediction mode (intra/inter) is encoded:

m_pcEntropyCoder->encodePredMode()

这时,您可以访问pcCU对象,该对象包含在第一阶段做出的所有最终决定,包括您要查找的信息.在代码的这一点上,您正在处理单个CU,而不是整个CTU.但是,如果您希望获得整个CTU的信息,则可以返回

At this point, you have access to the pcCU object which contains all the final decisions, including the information you look for, that are made during the first phase. At this point of the code, you are dealing with a single CU and not the entire CTU. But if you want your information for the entire CTU, you may go back to

compressGOP() -> encodeSlice() -> encodeCtu()

并找到第一次调用xEncodeCU()函数的行.在那里,您可以访问pCtu对象.

and find the line where the xEncodeCU() function is called for the first time. There, you will have access to the pCtu object.

提醒:大小为WxH的每个TComDataCU对象(如果处于CU级别,则为pcCU;如果处于CTU级别,为pCtu),则被拆分为NumPartition=(W/4)x(H/4)个大小为4x4的分区.每个分区均可通过索引(uiAbsPartIdx)进行访问,该索引指示其Z扫描顺序.例如,位于<x=8,y=0>的分区的uiAbsPartIdx是4.

Reminder: each TComDataCU object (pcCU if you are in the CU level, or pCtu if you are in the CTU level) of size WxH is split to NumPartition=(W/4)x(H/4) partitions of size 4x4. Each partition is accessible by an index (uiAbsPartIdx) which indicates its Z-scan order. For example, the uiAbsPartIdx for the partition at <x=8,y=0> is 4.

现在,您执行以下步骤:

Now, you do the following steps:

  1. 通过调用pCtu->getTotalNumPart()获取pCtu中的分区数(NumPartition).

  1. Get the number of partitions (NumPartition) within your pCtu by calling pCtu->getTotalNumPart().

遍历所有NumPartition分区,并调用函数pCtu->getWidth(idx)pCtu->getHeight(idx)pCtu->getCUPelX(idx)pCtu->getCUPelY(),其中idx是循环迭代器.这些函数为每个CUidx4x4分区重合的每个对象返回以下信息:宽度,高度,positionX和positionY. [两个位置都相对于帧的像素<0,0>]

Loop over all NumPartition partitions and call the functions pCtu->getWidth(idx), pCtu->getHeight(idx), pCtu->getCUPelX(idx) and pCtu->getCUPelY(), where idx is your loop iterator. These functions return the following information for each CU coincided with the 4x4 partition at idx: width, height, positionX, positionY. [both positions are relative to the pixel <0,0> of the frame]

以上信息足以推导当前pCtu的CTU分区!因此,最后一步是编写一段代码来做到这一点.

The above information is enough for deriving the CTU partitioning of the current pCtu! So the last step is to write a piece of code to do that.

这是在第二阶段(即编码阶段)如何提取CTU分区信息的示例.但是,您可以调用一些适当的函数来获取第二个问题中的其他信息.例如,要获得选定的亮度帧内模式,可以调用pCtu->getIntraDir(CHANNEL_TYPE_LUMA, idx)而不是getWidth()/getHeight()函数.或pCtu->getQP(CHANNEL_TYPE_LUMA, idx)获取QP值.

This was an example of how to extract CTU partitioning information during the second phase (i.e. encoding phase). However, you may call some proper functions to get the other information in your second question. For example, to get selected luma intra mode, you may call pCtu->getIntraDir(CHANNEL_TYPE_LUMA, idx), instead of getWidth()/getHeight() functions. Or pCtu->getQP(CHANNEL_TYPE_LUMA, idx) to get the QP value.

您总是可以在TComDataCU类(TComDataCU.cpp)中找到在pCtu级别提供有用信息的函数列表.

You can always find a list of functions that provide useful information at the pCtu level, in the TComDataCU class (TComDataCU.cpp).

希望这对您有所帮助.如果没有,让我知道!

I hope this helps you. If not, let me know!

祝你好运

这篇关于从HEVC参考软件获取一些信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆