Newer
Older
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
\end{tabular}
\\
\end{OptionTableNoShorthand}
\begin{OptionTableNoShorthand}{Structure of pictures information SEI message encoder parameters}{tab:sei-sop-info}
\Option{SEISOPDescription} &
\Default{0} &
Enables or disables the insertion of the Structure of pictures information SEI messages.
\\
\end{OptionTableNoShorthand}
\begin{OptionTableNoShorthand}{Active parameter sets SEI message encoder parameters}{tab:sei-active-parameter-sets}
\Option{SEIActiveParameterSets} &
\Default{0} &
Enables or disables the insertion of the Active parameter sets
SEI messages.
\\
\end{OptionTableNoShorthand}
\begin{OptionTableNoShorthand}{Decoding unit information SEI message encoder parameters}{tab:sei-decoding-unit-info}
\Option{SEIDecodingUnitInfo} &
\Default{0} &
Enables or disables the insertion of the Decoding unit information
SEI messages. This option has no effect if VuiParametersPresent is disabled.
\\
\end{OptionTableNoShorthand}
\begin{OptionTableNoShorthand}{Temporal sub-layer zero index SEI message encoder parameters}{tab:sei-temporal-level-0}
\Option{SEITemporalLevel0Index} &
\Default{0} &
Enables or disables the insertion of the Temporal level zero index
SEI messages.
\\
\end{OptionTableNoShorthand}
\begin{OptionTableNoShorthand}{Decoded picture hash SEI message encoder parameters}{tab:sei-decoded-picture-hash}
\Option{SEIDecodedPictureHash} &
\Default{0} &
Enables or disables the calculation and insertion of the Decoded picture hash
SEI messages.
\par
\begin{tabular}{cp{0.35\textwidth}}
0 & Disabled \\
1 & Transmits MD5 in SEI message and writes the value to the encoder
log \\
2 & Transmits CRC in SEI message and writes the value to the encoder
log \\
3 & Transmits checksum in SEI message and writes the value to the encoder
log \\
\end{tabular}
\\
\end{OptionTableNoShorthand}
\begin{OptionTableNoShorthand}{Scalable nesting SEI message encoder parameters}{tab:sei-scalable-nesting}
\Option{SEIScalableNesting} &
\Default{0} &
Enables or disables the use of the scalable nesting SEI messages.
\\
\end{OptionTableNoShorthand}
\begin{OptionTableNoShorthand}{Region refresh information SEI message encoder parameters}{tab:sei-region-refresh-info}
\Option{SEIGradualDecodingRefreshInfo} &
\Default{0} &
Enables or disables the insertion of the Gradual decoding refresh information
SEI messages.
\\
\end{OptionTableNoShorthand}
\begin{OptionTableNoShorthand}{No display SEI message encoder parameters}{tab:sei-no-display}
\Option{SEINoDisplay} &
\Default{0} &
When non-zero, generate no-display SEI message for temporal layer N or higher.
\\
\end{OptionTableNoShorthand}
\begin{OptionTableNoShorthand}{Time code SEI message encoder parameters}{tab:sei-time-code}
\Option{SEITimeCodeEnabled} &
\Default{false} &
When true (non-zero), generate Time code SEI messages.
\\
\Option{SEITimeCodeNumClockTs} &
\Default{0} &
Number of clock time sets, in the range of 0 to 3 (inclusive).
\\
\Option{SEITimeCodeTimeStampFlag} &
\Default{\None} &
Time stamp flag associated to each time set (comma or space separated list of entries).
\\
\Option{SEITimeCodeFieldBasedFlag} &
\Default{\None} &
Field based flag associated to each time set (comma or space separated list of entries).
\\
\Option{SEITimeCodeCountingType} &
\Default{\None} &
Counting type associated to each time set (comma or space separated list of entries).
\\
\Option{SEITimeCodeFullTsFlag} &
\Default{\None} &
Full time stamp flag associated to each time set (comma or space separated list of entries).
\\
\Option{SEITimeCodeDiscontinuityFlag} &
\Default{\None} &
Discontinuity flag associated to each time set (comma or space separated list of entries).
\\
\Option{SEITimeCodeCntDroppedFlag} &
\Default{\None} &
Counter dropped flag associated to each time set (comma or space separated list of entries).
\\
\Option{SEITimeCodeNumFrames} &
\Default{\None} &
Number of frames associated to each time set (comma or space separated list of entries).
\\
\Option{SEITimeCodeSecondsFlag} &
\Default{\None} &
Flag to signal seconds value presence in each time set (comma or space separated list of entries).
\\
\Option{SEITimeCodeMinutesFlag} &
\Default{\None} &
Flag to signal minutes value presence in each time set (comma or space separated list of entries).
\\
\Option{SEITimeCodeHoursFlag} &
\Default{\None} &
Flag to signal hours value presence in each time set (comma or space separated list of entries).
\\
\Option{SEITimeCodeSecondsValue} &
\Default{\None} &
Seconds value for each time set (comma or space separated list of entries).
\\
\Option{SEITimeCodeMinutesValue} &
\Default{\None} &
Minutes value for each time set (comma or space separated list of entries).
\\
\Option{SEITimeCodeHoursValue} &
\Default{\None} &
Hours value for each time set (comma or space separated list of entries).
\\
\Option{SEITimeCodeOffsetLength} &
\Default{\None} &
Time offset length associated to each time set (comma or space separated list of entries).
\\
\Option{SEITimeCodeTimeOffset} &
\Default{\None} &
Time offset associated to each time set (comma or space separated list of entries).
\\
\end{OptionTableNoShorthand}
\begin{OptionTableNoShorthand}{Mastering display colour volume SEI message encoder parameters}{tab:sei-mastering-display-colour-volume}
\Option{SEIMasteringDisplayColourVolume} &
\Default{false} &
When true (non-zero), generate Mastering display colour volume SEI message.
\\
\Option{SEIMasteringDisplayMaxLuminance} &
\Default{10000} &
Specifies the mastering display maximum luminance value in units of 1/10000 candela per square metre.
\\
\Option{SEIMasteringDisplayMinLuminance} &
\Default{0} &
Specifies the mastering display minimum luminance value in units of 1/10000 candela per square metre.
\\
\Option{SEIMasteringDisplayPrimaries} &
\Default{0,50000, 0,0, 50000,0} &
Mastering display primaries for all three colour planes in CIE xy coordinates in increments of 1/50000 (results in the ranges 0 to 50000 inclusive).
\\
\Option{SEIMasteringDisplayWhitePoint} &
\Default{16667, 16667} &
Mastering display white point CIE xy coordinates in normalized increments of 1/50000 (e.g. 0.333 = 16667).
\\
\end{OptionTableNoShorthand}
\begin{OptionTableNoShorthand}{Segmented rectangular frame packing arrangement SEI message encoder parameters}{tab:sei-seg-rect-fpa}
\Option{SEISegmentedRectFramePacking} &
\Default{0} &
Controls generation of segmented rectangular frame packing SEI messages.
\\
\Option{SEISegmentedRectFramePackingCancel} &
\Default{false} &
If true, cancels the persistence of any previous SRFPA SEI message.
\\
\Option{SEISegmentedRectFramePackingType} &
\Default{0} &
Specifies the arrangement of the frames in the reconstructed picture.
\\
\Option{SEISegmentedRectFramePackingPersistence} &
\Default{false} &
If false the SEI applies to the current frame only.
\\
\end{OptionTableNoShorthand}
\begin{OptionTableNoShorthand}{Temporal motion-constrained tile sets SEI message encoder parameters}{tab:sei-tmcts}
\Option{SEITempMotionConstrainedTileSets} &
\Default{false} &
When true (non-zero), generates example temporal motion constrained tile sets SEI messages.
\\
\end{OptionTableNoShorthand}
\begin{OptionTableNoShorthand}{Chroma resampling filter hint SEI message encoder parameters}{tab:chroma-resampling-filter-hint}
\Option{SEIChromaResamplingFilterHint} &
\Default{false} &
When true (non-zero), generates example chroma sampling filter hint SEI messages.
\\
\Option{SEIChromaResamplingHorizontalFilterType} &
\Default{2} &
Defines the index of the chroma sampling horizontal filter:
\par
\begin{tabular}{cp{0.35\textwidth}}
0 & Unspecified \\
1 & Filters signalled within the SEI message \\
2 & Filters as described by SMPTE RP 2050-1:2012\\
\end{tabular}
\\
\Option{SEIChromaResamplingVerticalFilterType} &
\Default{2} &
Defines the index of the chroma sampling vertical filter:
\par
\begin{tabular}{cp{0.35\textwidth}}
0 & Unspecified \\
1 & Filters signalled within the SEI message \\
2 & Filters as described in the 5/3 filter description of ITU-T Rec. T.800 | ISO/IEC 15444-1\\
\end{tabular}
\\
\end{OptionTableNoShorthand}
\begin{OptionTableNoShorthand}{Knee function SEI message encoder parameters}{tab:sei-knee-function}
\Option{SEIKneeFunctionInfo} &
\Default{false} &
Enables (true) or disables (false) the insertion of the Knee function SEI messages.
\\
\Option{SEIKneeFunctionId} &
\Default{0} &
Specifies Id of Knee function SEI message for a given session.
\\
\Option{SEIKneeFunctionCancelFlag} &
\Default{false} &
Indicates that Knee function SEI message cancels the persistance (true) or follows (false).
\\
\Option{SEIKneeFunctionPersistenceFlag} &
\Default{true} &
Specifies the persistence of the Knee function SEI message.
\\
\Option{SEIKneeFunctionInputDrange} &
\Default{1000} &
Specifies the peak luminance level for the input picture of Knee function SEI messages.
\\
\Option{SEIKneeFunctionInputDispLuminance} &
\Default{100} &
Specifies the expected display brightness for the input picture of Knee function SEI messages.
\\
\Option{SEIKneeFunctionOutputDrange} &
\Default{4000} &
Specifies the peak luminance level for the output picture of Knee function SEI messages.
\\
\Option{SEIKneeFunctionOutputDispLuminance} &
\Default{800} &
Specifies the expected display brightness for the output picture of Knee function SEI messages.
\\
\Option{SEIKneeFunctionNumKneePointsMinus1} &
\Default{2} &
Specifies the number of knee points - 1.
\\
\Option{SEIKneeFunctionInputKneePointValue} &
\Default{} &
Array of input knee point. Default table can be set to the following:
\par
\begin{tabular}{cp{0.45\textwidth}}
600 800 900
\end{tabular}
\\
\Option{SEIKneeFunctionOutputKneePointValue} &
\Default{} &
Array of output knee point. Default table can be set to the following:
\par
\begin{tabular}{cp{0.45\textwidth}}
100 250 450
\end{tabular}
\\
\end{OptionTableNoShorthand}
\begin{OptionTableNoShorthand}{Colour remapping SEI message encoder parameters}{tab:sei-colour-remapping}
\Option{SEIColourRemappingInfoFileRoot (-cri)} &
\Default{\NotSet} &
Specifies the prefix of input Colour Remapping Information file. Prefix is completed by ``_x.txt'' where x is the POC number.
The contents of the file are a list of the SEI message's syntax element names (in decoding order) immediately followed by a `:' and then the associated value.
An example file can be found in cfg/misc/example_colour_remapping_sei_encoder_0.txt.
\\
\end{OptionTableNoShorthand}
%\Option{SEITimeCode} &
%\Default{false} &
%When true, generate time code SEI messages.
%\\
%%
%%
%%
\subsection{Hardcoded encoder parameters}
\begin{MacroTable}{CommonDef.h constants}
ADAPT_SR_SCALE &
1 &
Defines a scaling factor used to derive the motion search range is
adaptive (see ASR configuration parameter). Default value is 1.
\\
MAX_GOP &
64 &
maximum size of value of hierarchical GOP.
\\
MAX_NUM_REF &
4 &
maximum number of multiple reference frames
\\
MAX_NUM_REF_LC &
8 &
maximum number of combined reference frames
\\
AMVP_MAX_NUM_CANDS &
2 &
maximum number of final candidates
\\
AMVP_MAX_NUM_CANDS_MEM &
3 &
\\
MRG_MAX_NUM_CANDS &
5 &
\\
DYN_REF_FREE &
off &
dynamic free of reference memories
\\
MAX_TLAYER &
8 &
maximum number of temporal layers
\\
ADAPT_SR_SCALE &
on &
division factor for adaptive search range
\\
EARLY_SKIP_THRES &
1.5 &
early skip if RD < EARLY_SKIP_THRES*avg[BestSkipRD]
\\
MAX_NUM_REF_PICS &
16 &
\\
MAX_CHROMA_FORMAT_IDC &
3 &
\\
\end{MacroTable}
\subsubsection*{TypeDef.h}
Numerous constants that guard individual adoptions are defined within
\url{source/Lib/TLibCommon/TypeDef.h}.
%%
%%
%%
\clearpage
\section{Using the decoder}
\subsection{General}
\begin{minted}{bash}
TAppDecoder -b str.bin -o dec.yuv [options]
\end{minted}
\begin{OptionTableNoShorthand}{Decoder options}{tab:decoder-options}
\Option{(--help)} &
%\ShortOption{\None} &
\Default{\None} &
Prints usage information.
\\
\Option{BitStreamFile (-b)} &
%\ShortOption{-b} &
\Default{\NotSet} &
Defines the input bit stream file name.
\\
\Option{ReconFile (-o)} &
%\ShortOption{-o} &
\Default{\NotSet} &
Defines reconstructed YUV file name. If empty, no file is generated.
\\
\Option{SkipFrames (-s)} &
%\ShortOption{-s} &
\Default{0} &
Defines the number of pictures in decoding order to skip.
\\
\Option{MaxTemporalLayer (-t)} &
%\ShortOption{-t} &
\Default{-1} &
Defines the maximum temporal layer to be decoded. If -1, then all layers are decoded.
\\
\Option{TarDecLayerIdSetFile (-l)} &
%\ShortOption{-t} &
\Default{\NotSet} &
Specifies the targetDecLayerIdSet file name. The file would contain white-space separated LayerId values of the layers that are to be decoded.
Omitting the parameter, or using a value of -1 in the file decodes all layers.
\\
\Option{OutputBitDepth (-d)} &
%\ShortOption{-d} &
\Default{0 \\ (Native)} &
Specifies the luma bit-depth of the reconstructed YUV file (the value 0 indicates
that the native bit-depth is used)
\\
\Option{OutputBitDepthC} &
%\ShortOption{\None} &
\Default{0 \\ (Native)} &
Defines the chroma bit-depth of the reconstructed YUV file (the value 0 indicates
that the native bit-depth is used)
\\
\Option{TargetLayer (-p)} &
%\ShortOption{-p} &
\Default{-1 \\ (Native)} &
Specifies the target bitstream Layer to be decoded. (the value -1 indicates
that decoding the whole bitstream )
\\
\Option{SEIDecodedPictureHash} &
%\ShortOption{\None} &
\Default{1} &
Enable or disable verification of any Picture hash SEI messages. When
this parameter is set to 0, the feature is disabled and all messages are
ignored. When set to 1 (default), the feature is enabled and the decoder
has the following behaviour:
\begin{itemize}
\item
If Picture hash SEI messages are included in the bit stream, the same type
of hash is calculated for each decoded picture and written to the
log together with an indication whether the calculted value matches
the value in the SEI message.
Decoding will continue even if there is a mismatch.
\item
After decoding is complete, if any MD5sum comparison failed, a warning
is printed and the decoder exits with the status EXIT_FAILURE
\item
The per-picture MD5 log message has the following formats:
[MD5:d41d8cd98f00b204e9800998ecf8427e,(OK)],
[MD5:d41d8cd98f00b204e9800998ecf8427e,(unk)],
[MD5:d41d8cd98f00b204e9800998ecf8427e,(***ERROR***)] [rxMD5:b9e1...]
where, "(unk)" implies that no MD5 was signalled for this picture,
"(OK)" implies that the decoder agrees with the signalled MD5,
"(***ERROR***)" implies that the decoder disagrees with the signalled
MD5. "[rxMD5:...]" is the signalled MD5 if different.
\end{itemize}
\\
\Option{OutputDecodedSEIMessagesFilename} &
%\ShortOption{\None} &
\Default{\NotSet} &
When a non-empty file name is specified, information regarding any decoded SEI messages will be output to the indicated file. If the file name is '-', then stdout is used instead.
\\
\Option{SEIColourRemappingInfoFilename} &
%\ShortOption{\None} &
\Default{\NotSet} &
Specifies that the colour remapping SEI message should be applied to the output video, with the output written to this file.
If no value is specified, the SEI message is ignored and no mapping is applied.
\\
\Option{RespectDefDispWindow (-w)} &
%\ShortOption{-w} &
\Default{0} &
Video region to be output by the decoder.
\par
\begin{tabular}{cp{0.45\textwidth}}
0 & Output content inside the conformance window. \\
1 & Output content inside the default window. \\
\end{tabular}
\\
\Option{OutputColourSpaceConvert} &
\Default{\NotSet} &
Specifies the colour space conversion to apply to 444 video. Permitted values are:
\par
\begin{tabular}{lp{0.45\textwidth}}
UNCHANGED & No colour space conversion is applied \\
YCrCbToYCbCr & Swap the second and third components \\
GBRtoRGB & Reorder the three components \\
\end{tabular}
If no value is specified, no colour space conversion is applied. The list may eventually also include RGB to YCbCr or YCgCo conversions.\\
\\

Christian Helmrich
committed
\Option{PYUV} &
\Default{false} &
When true, output 10-bit and 12-bit YUV data as 5-byte and 3-byte (respectively) packed YUV data. See doc/pyuv_format.pdf for details. Ignored for interlaced output.
\\
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
\Option{SEINoDisplay} &
\Default{false} &
When true, do not output frames for which there is an SEI NoDisplay message.
\\
\Option{ClipOutputVideoToRec709Range} &
%\ShortOption{\None} &
\Default{0} &
If 1 then clip output video to the Rec. 709 Range on saving when OutputBitDepth is less than InternalBitDepth.
\\
\end{OptionTableNoShorthand}
\subsection{Using the decoder analyser}
If the decoder is compiled with the macro RExt__DECODER_DEBUG_BIT_STATISTICS defined as 1 (either externally, or by editing TypeDef.h), the decoder will gather fractional bit counts associated with the different syntax elements, producing a table of the number of bits per syntax element, and where appropriate, according to block size and colour component/channel.
The Linux makefile will compile both the analyser and standard version when the `all' or `everything' target is used (where the latter will also build high-bit-depth executables).
\section{Block statistics extension}
\label{sec:block-stat-extens}
The block statistics extension enables straightforward visualization and statistical analysis of coding tool
usage in encoded bitstreams. The extension enables the reference
software encoder and decoder to write out statistics files in a configurable
way, which in turn can be loaded into a suitable YUV player for overlay of the
reconstructed YUV sequence, or can be used for statistical analysis at a
selectable scope (e.g. block/picture/sequence level). An example implementation
for such visualization is available with the open-source YUView player
(\url{https://github.com/IENT/YUView}).
\subsection{Usage}
\label{sec:usage}
The software has to be compiled with the macros ENABLE_TRACING and
K0149_BLOCK_STATISTICS defined as 1. The statistics can be written by either
encoder or decoder.
The extension adds additional trace channels to the ``dtrace'' functionality of
the software. The following trace channels were added:
\begin{description}
\item[D_BLOCK_STATISTICS_ALL] All syntax elements are written, no matter whether
they are actually encoded or derived.
\item[D_BLOCK_STATISTICS_CODED] Tries to write only syntax elements, which have
also been encoded.
\end{description}
The following additional encoder options are available (part of ``dtrace''). See
the file dtrace_next.h for more details.
\begin{OptionTableNoShorthand}{Decoder options}{tab:decoder-block-statistics}
\Option{TraceFile} &
%\ShortOption{\None} &
\Default{\None} &
File name of the produced trace file.
\\
\Option{TraceRule} &
%\ShortOption{-b} &
\Default{\NotSet} &
Specifies which traces should be saved, and for which POCs.
\\
\end{OptionTableNoShorthand}
Concrete examples of calls for generating a block statistics file are:
\begin{minted}{bash}
bin/DecoderAppStatic -b str/BasketballDrive_1920x1080_QP37.vvc \
--TraceFile="stats/BasketballDrive_1920x1080_QP37_coded.vtmbmsstats" \
--TraceRule="D_BLOCK_STATISTICS_CODED:poc>=0"
bin/DecoderAppStatic -b str/BasketballDrive_1920x1080_QP37.vvc \
--TraceFile="stats/BasketballDrive_1920x1080_QP37_all.vtmbmsstats" \
--TraceRule="D_BLOCK_STATISTICS_ALL:poc>=0"
\end{minted}
\subsection{Block statistics file formats}
\label{sec:block-stat-file}
The trace file will contain a header listing information of all available block
statistics. For each statistic it lists a type and a scale for vectors or range
for integers if applicable:
\begin{verbatim}
# VTMBMS Block Statistics
# Sequence size: [832x 480]
# Block Statistic Type: PredMode; Flag;
# Block Statistic Type: MergeFlag; Flag;
# Block Statistic Type: MVL0; Vector; Scale: 4
# Block Statistic Type: MVL1; Vector; Scale: 4
# Block Statistic Type: IPCM; Flag;
# Block Statistic Type: Y_IntraMode; Integer; [0, 73]
# Block Statistic Type: Cb_IntraMode; Integer; [0, 73]
\end{verbatim}
Two formats are available for the statistics for each block, a human readable
format and a CSV based format. The header remains the same for both cases.
For both formats each row contains the information for one block statistic. The
order of the data is: picture order count (POC), location of top left corner of
the block, size of the block, name of the statistic, and value of the
statistic.
The macro BLOCK_STATS_AS_CSV is available in order to choose the required format.
The human readable format can also be easily processed with other software, for
example YUView, using regular expressions. The CSV based formats provides the
universal interface required by spreadsheet applications.
The human readable format is based on the format used for the other dtrace
statistics. Some examples for this format are:
\begin{verbatim}
BlockStat: POC 16 @( 112, 0) [ 8x 8] SkipFlag=1
BlockStat: POC 16 @( 112, 0) [ 8x 8] InterDir=1
BlockStat: POC 16 @( 112, 0) [ 8x 8] MergeFlag=1
BlockStat: POC 16 @( 112, 0) [ 8x 8] MergeIdx=0
BlockStat: POC 16 @( 112, 0) [ 8x 8] MergeType=0
BlockStat: POC 16 @( 112, 0) [ 8x 8] MVPIdxL0=255
BlockStat: POC 16 @( 112, 0) [ 8x 8] MVPNumL0=255
BlockStat: POC 16 @( 112, 0) [ 8x 8] RefIdxL0=0
BlockStat: POC 16 @( 112, 0) [ 8x 8] MVDL0={ 0, 0}
BlockStat: POC 16 @( 112, 0) [ 8x 8] MVL0={ -70, 18}
BlockStat: POC 16 @( 112, 8) [ 8x 8] PredMode=0
BlockStat: POC 16 @( 112, 8) [ 8x 8] PartSize=0
\end{verbatim}
Some examples of the CSV based format are:
\begin{verbatim}
BlockStat;16; 112; 0; 8; 8;SkipFlag;1
BlockStat;16; 112; 0; 8; 8;InterDir;1
BlockStat;16; 112; 0; 8; 8;MergeFlag;1
BlockStat;16; 112; 0; 8; 8;MergeIdx;0
BlockStat;16; 112; 0; 8; 8;MergeType;0
BlockStat;16; 112; 0; 8; 8;MVPIdxL0;255
BlockStat;16; 112; 0; 8; 8;MVPNumL0;255
BlockStat;16; 112; 0; 8; 8;RefIdxL0;0
BlockStat;16; 112; 0; 8; 8;MVDL0; 0; 0
BlockStat;16; 112; 0; 8; 8;MVL0; -70; 18
BlockStat;16; 112; 8; 8; 8;PredMode;0
BlockStat;16; 112; 8; 8; 8;PartSize;0
\end{verbatim}
\subsection{Visualization}
\label{sec:visualization}
The block statistics can be viewed with YUView, which is freely available under
GPLv3: \url{https://github.com/IENT/YUView}. The latest releases and the master
branch have the functionality required for viewing the block statistics. YUView
assumes that the file extension of block statistics file is
“.vtmbmsstats”. However, if a file is not recognized you can choose from a list
of supported file formats.
Statistics can be overlaid with YUV sequences. Some example snapshots are:
\begin{figure}[htpb]
\centering
\includegraphics[width=0.8\linewidth]{figures/YUView}
\caption{YUView}
\label{fig:yuview}
\end{figure}
\begin{figure}[htpb]
\centering
\includegraphics[width=0.5\linewidth]{figures/raceHorsesShot2MotionVectors}
\caption{Motion vectors}
\label{fig:motion-vectors}
\end{figure}
\begin{figure}[htpb]
\centering
\includegraphics[width=0.5\linewidth]{figures/raceHorsesShot3SkipFlag}
\caption{Skip flag}
\label{fig:skip-flag}
\end{figure}
\subsection{Adding statistics}
\label{sec:adding-statistics}
In order to add further block statistics, do the following:
\begin{description}
\item[source/Lib/CommonLib/dtrace_blockstatistics.h]
Add your statistic to the BlockStatistic enum:
\begin{minted}{c++}
enum class BlockStatistic {
// general
PredMode,
PartSize,
Depth,
\end{minted}
Further, add your statistic to the map blockstatistic2description:
\begin{minted}{c++}
static const std::map<BlockStatistic,
std::tuple<std::string, BlockStatisticType, std::string>>
blockstatistic2description =
{
{ BlockStatistic::PredMode,
std::tuple<std::string, BlockStatisticType, std::string>
{"PredMode", BlockStatisticType::Flag, ""}},
{ BlockStatistic::MergeFlag,
std::tuple<std::string, BlockStatisticType, std::string>
{"MergeFlag", BlockStatisticType::Flag, ""}},
{ BlockStatistic::MVL0,
std::tuple<std::string, BlockStatisticType, std::string>
{"MVL0", BlockStatisticType::Vector, "Scale: 4"}},
YOURS
\end{minted}
\item[source/Lib/CommonLib/dtrace_blockstatistics.cpp] All code for
writing syntax elements is kept in this file in
getAndStoreBlockStatistics. This function is called once for each
CTU, after it has been en/decoded. The following macros have been
defined to facilitate writing of block statistics:
\begin{minted}{c++}
DTRACE_BLOCK_SCALAR(ctx,channel,cs_cu_pu,stat_type,val)
DTRACE_BLOCK_SCALAR_CHROMA(ctx,channel,cs_cu_pu,stat_type,val)
DTRACE_BLOCK_VECTOR(ctx,channel,cu_pu,stat_type,v_x,v_y)
DTRACE_BLOCK_AFFINETF(ctx,channel,pu,stat_type,v_x0,v_y0,v_x1,v_y1,v_x2,v_y2)
\end{minted}
An example:
\begin{minted}{c++}
DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL,
cu, GetBlockStatisticName(BlockStatistic::PredMode), cu.predMode);
\end{minted}
\item[Block statistics for debugging] The statistics can also be used
to write out other data, not just syntax elements. Add your
statistics to dtrace_blockstatistics.h. Where it should be used the
following headers have to be included:
\begin{minted}{c++}
#include "dtrace_next.h"
#include "dtrace_blockstatistics.h"
\end{minted}
\end{description}
\section{Using the stream merge tool}
\label{sec:stream-merge-tool}
The StreamMergeApp tool takes multiple single-layer (singe nuh_layer_id) bistreams
as inputs and merge them into a multi-layer bistream by interleaving the NALUs
from the input single layer bistreams. During the merge, the tool assigns a new unique
nuh_layer_id for each input bitstream. Then the decoder could specify which layer
bitstream to be decoded through the command line option "-p nuh_layer_id".
\subsection{Usage}
\label{sec:stream-merge-usage}
\begin{minted}{bash}
StreamMergeApp <bitstream1> <bitstream2> [<bitstream3> ...] <outfile>
\end{minted}
The command line options bistreamX specify the file names of the input single-layer
bistreams. At least two input bitstreams need to be specified. The merged multi-layer
bistream will be stored into the outfile.
\end{document}