h264bitstream icon indicating copy to clipboard operation
h264bitstream copied to clipboard

reading and writing slice data

Open serhan-gul opened this issue 9 years ago • 3 comments

h264_slice_data.c file provides some functions for extracting slice and macroblock information but it is not implemented in h264_analyze. Is there going to be a patch for this anytime soon? Would it be straightforward to modify slice data functions or is there still a lot of work to do? It is regarded as a "large project" in the readme file, that's why I'm asking.

serhan-gul avatar Nov 09 '15 15:11 serhan-gul

Serhan,

The code in h264_slice_data.c needs work before it would be usable. The following missing functions need to be implemented:

  • [ ] bs_read_ce - for CAVLC
  • [ ] NextMbAddress
  • [ ] MbPartPredMode
  • [ ] NumMbPart
  • [ ] NumSubMbPart
  • [ ] SubMbPredMode
  • [ ] TotalCoeff
  • [ ] TrailingOnes

They are just stubs right now. Most are relatively easy.

There would also need to be a data structure to store macroblocks - the macroblock_t struct describes what is in one macroblock, but there would have to be an array of them for a whole slice (with some way to index it - scan order, and convert scan order to row/column, plus utility functions to find neighbors of a given mb).

That's all I can think of at the moment. The code that is there now does cover a whole lot of what the standard does, it just needs the stubs to be filled in, and a bunch of testing.

aizvorski avatar Nov 13 '15 04:11 aizvorski

Alex,

Thanks for the list of functions and detailed explanation. I will definitely try to implement them sometime. Although (open-source) parsers do exist for HEVC, I couldn't find any parser other than yours for H.264. It is definitely interesting.

serhan-gul avatar Nov 25 '15 16:11 serhan-gul

Has anyone done any work on this? I'm trying to write some code that will parse (but not decode) an h264 stream, so that I can extract the motion vectors quickly for analysis.

nathankopp avatar Dec 05 '18 00:12 nathankopp