I am using the HEVC reference software, HM Encoder Version [16.15] (including RExt) on a [Mac OS X][GCC 4.2.1][64 bit] and would like to extract at encoder side:
1) the motion vectors for each block
2) the frame partition information, i.e. the size and location of each block in the frame to which a motion vector refers.
Does anybody have hints on what are the variables where this info is stored for each coding unit? Thanks!
All you need is available in the TComDataCU
class.
1) For motion information, there is the function getCUMvField()
which returns the motion vector. It's not easy to work with it though.
Basically, to access almost any of the PU/CU level syntax elements, you need to be able to work with the absolute index of that PU/CU. This unique index tells you where exactly your PU/CU is located in the CTU by pointing to the up-left 4x4 block of that part.
I rememberthat that most of the times this index is stored in the variable uiAbsPartIdx
.
If you get to know how to work with this index, then you will be able to get the block partitioning information in the CTU level. so for 2) my suggestion is that you go to the slice level when you have a loop over CUTs (I think this is done in the compressSlice()
function). And after the compressCtu()
function is called for each CTU (which means that all RDO decisions have been made and the CTU partitioning is decided), you put a loop over all uiAbsPartIdx
s of the CTU and get their width and height. For example if your CTU size is 128, then you will have 32*32=1024 unique 4x4 blocks in your CTU. The function for getting width/height of the CU corresponding to a certain uiAbsPartIdx
is pCtu->getWidth(uiAbsPartIdx)
.
I hope it was clear.