How can I modify the code so that when decoding an h265 video stream using HM, it captures the number of bits occupied by the transform coefficients of each CTU in the bitstream?
I found that the transform coefficients are decoded in the parseCoeffNxN function in xDecodeTransform. So I added a variable in parseCoeffNxN to record the number of times decodeBin is called, trying to record the number of decoded bits. But the number differs a lot from what I see in HEVCanalyzer.enter image description here
There must be better solutions, but what I once did was to modify the parsing stage at the CTU-level (iirc) of HM, so I could figure out how many bits have been fed to the CABAC decoder since the last flush. It sounds complicated, but it's doable.