Search code examples
videovideo-processinghevch.265

HEVC: NAL unit trace file for each NUL unit produced by the encoder


I'm using HM 14.0 as a reference. Is there a way to get some specific information about NAL units like

(a) type
(b) num_bytes
(c) frame_no
(d) decode_time
(e) priority
(f) timestamp

The first two I can have it through annexBbytecount, but what about the rest?


Solution

  • The reference codec comes with a built in tracer which is quite powerful!

    Enable it like this:

    diff --git a/source/Lib/TLibCommon/TComRom.h b/source/Lib/TLibCommon/TComRom.h
    index 5a59809..1930809 100644
    --- a/source/Lib/TLibCommon/TComRom.h
    +++ b/source/Lib/TLibCommon/TComRom.h
    @@ -158,7 +158,7 @@ extern const UChar g_aucDCTDSTMode_Hor[NUM_INTRA_MODE];
     extern       Char   g_aucConvertToBit  [ MAX_CU_SIZE+1 ];   // from width to log2(width)-2
    
     #ifndef ENC_DEC_TRACE
    -# define ENC_DEC_TRACE 0
    +# define ENC_DEC_TRACE 1
     #endif
    

    As an example, I encoded and decoded the first 20 frames of BQMall_832x480_60.yuv with trace enabled.

    After encoding/decoding using:

    ./TAppEncoderStatic -c ../cfg/encoder_intra_main.cfg  -c ../cfg/per-sequence/BQMall.cfg
    ./TAppDecoderStatic -b str.bin 
    

    trace-files are produced (rather huge ones!)

    $ ll -rt 
    total 247100
    drwxrwxr-x 12 xx xx      4096 jun 27 10:01 ../ 
    -rwxrwxr-x  1 xx xx   2912618 jun 27 10:06 TAppDecoderStaticd*
    -rwxrwxr-x  1 xx xx    627714 jun 27 10:06 TAppDecoderStatic*
    -rwxrwxr-x  1 xx xx   4036611 jun 27 10:06 TAppEncoderStaticd*
    -rwxrwxr-x  1 xx xx   1133295 jun 27 10:06 TAppEncoderStatic*
    -rwxrwxr-x  1 xx xx     87319 jun 27 10:06 annexBbytecountStaticd*
    -rwxrwxr-x  1 xx xx     29963 jun 27 10:06 annexBbytecountStatic*
    -rwxrwxr-x  1 xx xx    369365 jun 27 10:06 convert_NtoMbit_YCbCrStaticd*
    -rwxrwxr-x  1 xx xx    113252 jun 27 10:06 convert_NtoMbit_YCbCrStatic*
    -rw-rw-r--  1 xx xx    442122 jun 28 21:29 str.bin
    -rw-rw-r--  1 xx xx  11980800 jun 28 21:29 rec.yuv
    -rw-rw-r--  1 xx xx 168288021 jun 28 21:29 TraceEnc.txt    <----
    drwxrwxr-x  2 xx xx      4096 jun 28 21:31 ./
    -rw-rw-r--  1 xx xx  62975377 jun 28 21:31 TraceDec.txt    <----
    

    Have a look at TraceEnc.txt and TraceDec.txt they contain everything you need to know!