<div dir="ltr"><div dir="ltr"><div># HG changeset patch</div><div># User Aruna Matheswaran <<a href="mailto:aruna@multicorewareinc.com">aruna@multicorewareinc.com</a>></div><div># Date 1538566253 -19800</div><div>#      Wed Oct 03 17:00:53 2018 +0530</div><div># Node ID 8eb57eb225d51a06b704083bce8089ab4e2877b5</div><div># Parent  e50f803e26fb3926dc695e0aeea39681fe1eacbd</div><div>hrd: Add cli option to set concatenation flag in buffering period SEI</div><div><br></div><div>diff -r e50f803e26fb -r 8eb57eb225d5 doc/reST/cli.rst</div><div>--- a/doc/reST/cli.rst<span style="white-space:pre">      </span>Thu Sep 27 14:16:15 2018 +0530</div><div>+++ b/doc/reST/cli.rst<span style="white-space:pre">  </span>Wed Oct 03 17:00:53 2018 +0530</div><div>@@ -1506,7 +1506,7 @@</div><div> <span style="white-space:pre">  </span>0 - flush the encoder only when all the input pictures are over.</div><div> <span style="white-space:pre">    </span>1 - flush all the frames even when the input is not over. </div><div> <span style="white-space:pre"> </span>    slicetype decision may change with this option.</div><div>-<span style="white-space:pre">        </span>2 - flush the slicetype decided frames only.     </div><div>+<span style="white-space:pre"> </span>2 - flush the slicetype decided frames only.   </div><div> </div><div> Quality, rate control and rate distortion options</div><div> =================================================</div><div>@@ -2195,6 +2195,14 @@</div><div> <span style="white-space:pre"> </span>Picture Timing SEI messages providing timing information to the</div><div> <span style="white-space:pre">     </span>decoder. Default disabled</div><div> </div><div>+    <span style="white-space:pre">     </span></div><div>+.. option:: --hrd-concat, --no-hrd-concat</div><div>+</div><div>+    Set concantenation flag for the first keyframe in the HRD buffering period SEI. This</div><div>+    is to signal the decoder if splicing is performed during bitstream generation. </div><div>+    Recommended to enable this option during chunked encoding, except for the first chunk.</div><div>+    Default disabled.</div><div>+</div><div> .. option:: --dolby-vision-profile <integer|float></div><div> </div><div>     Generate bitstreams confirming to the specified Dolby Vision profile,</div><div>diff -r e50f803e26fb -r 8eb57eb225d5 source/CMakeLists.txt</div><div>--- a/source/CMakeLists.txt<span style="white-space:pre">        </span>Thu Sep 27 14:16:15 2018 +0530</div><div>+++ b/source/CMakeLists.txt<span style="white-space:pre">     </span>Wed Oct 03 17:00:53 2018 +0530</div><div>@@ -29,7 +29,7 @@</div><div> option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)</div><div> mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)</div><div> # X265_BUILD must be incremented each time the public API is changed</div><div>-set(X265_BUILD 167)</div><div>+set(X265_BUILD 168)</div><div> configure_file("${PROJECT_SOURCE_DIR}/<a href="http://x265.def.in">x265.def.in</a>"</div><div>                "${PROJECT_BINARY_DIR}/x265.def")</div><div> configure_file("${PROJECT_SOURCE_DIR}/<a href="http://x265_config.h.in">x265_config.h.in</a>"</div><div>diff -r e50f803e26fb -r 8eb57eb225d5 source/common/param.cpp</div><div>--- a/source/common/param.cpp<span style="white-space:pre">      </span>Thu Sep 27 14:16:15 2018 +0530</div><div>+++ b/source/common/param.cpp<span style="white-space:pre">   </span>Wed Oct 03 17:00:53 2018 +0530</div><div>@@ -158,6 +158,7 @@</div><div>     param->radl = 0;</div><div>     param->chunkStart = 0;</div><div>     param->chunkEnd = 0;</div><div>+    param->bEnableHRDConcatFlag = 0;</div><div> </div><div>     /* Intra Coding Tools */</div><div>     param->bEnableConstrainedIntra = 0;</div><div>@@ -1059,6 +1060,7 @@</div><div>             else</div><div>                 bError = true;</div><div>         }</div><div>+        OPT("hrd-concat") p->bEnableHRDConcatFlag = atobool(value);</div><div>         else</div><div>             return X265_PARAM_BAD_NAME;</div><div>     }</div><div>@@ -1663,6 +1665,7 @@</div><div>     s += sprintf(s, " lookahead-slices=%d", p->lookaheadSlices);</div><div>     s += sprintf(s, " scenecut=%d", p->scenecutThreshold);</div><div>     s += sprintf(s, " radl=%d", p->radl);</div><div>+    BOOL(p->bEnableHRDConcatFlag, "splice");</div><div>     BOOL(p->bIntraRefresh, "intra-refresh");</div><div>     s += sprintf(s, " ctu=%d", p->maxCUSize);</div><div>     s += sprintf(s, " min-cu-size=%d", p->minCUSize);</div><div>diff -r e50f803e26fb -r 8eb57eb225d5 source/encoder/frameencoder.cpp</div><div>--- a/source/encoder/frameencoder.cpp<span style="white-space:pre">     </span>Thu Sep 27 14:16:15 2018 +0530</div><div>+++ b/source/encoder/frameencoder.cpp<span style="white-space:pre">   </span>Wed Oct 03 17:00:53 2018 +0530</div><div>@@ -657,6 +657,8 @@</div><div>             bpSei->m_auCpbRemovalDelayDelta = 1;</div><div>             bpSei->m_cpbDelayOffset = 0;</div><div>             bpSei->m_dpbDelayOffset = 0;</div><div>+            bpSei->m_concatenationFlag = (m_param->bEnableHRDConcatFlag && !m_frame->m_poc) ? true : false;</div><div>+</div><div>             // hrdFullness() calculates the initial CPB removal delay and offset</div><div>             m_top->m_rateControl->hrdFullness(bpSei);</div><div>             bpSei->writeSEImessages(m_bs, *slice->m_sps, NAL_UNIT_PREFIX_SEI, m_nalList, m_param->bSingleSeiNal);</div><div>diff -r e50f803e26fb -r 8eb57eb225d5 source/encoder/sei.h</div><div>--- a/source/encoder/sei.h<span style="white-space:pre">  </span>Thu Sep 27 14:16:15 2018 +0530</div><div>+++ b/source/encoder/sei.h<span style="white-space:pre">      </span>Wed Oct 03 17:00:53 2018 +0530</div><div>@@ -220,6 +220,7 @@</div><div>     SEIBufferingPeriod()</div><div>         : m_cpbDelayOffset(0)</div><div>         , m_dpbDelayOffset(0)</div><div>+        , m_concatenationFlag(0)</div><div>         , m_auCpbRemovalDelayDelta(1)</div><div>     {</div><div>         m_payloadType = BUFFERING_PERIOD;</div><div>@@ -227,6 +228,7 @@</div><div>     }</div><div>     bool     m_cpbDelayOffset;</div><div>     bool     m_dpbDelayOffset;</div><div>+    bool     m_concatenationFlag;</div><div>     uint32_t m_initialCpbRemovalDelay;</div><div>     uint32_t m_initialCpbRemovalDelayOffset;</div><div>     uint32_t m_auCpbRemovalDelayDelta;</div><div>@@ -237,7 +239,7 @@</div><div> </div><div>         WRITE_UVLC(0, "bp_seq_parameter_set_id");</div><div>         WRITE_FLAG(0, "rap_cpb_params_present_flag");</div><div>-        WRITE_FLAG(0, "concatenation_flag");</div><div>+        WRITE_FLAG(m_concatenationFlag, "concatenation_flag");</div><div>         WRITE_CODE(m_auCpbRemovalDelayDelta - 1,   hrd.cpbRemovalDelayLength,       "au_cpb_removal_delay_delta_minus1");</div><div>         WRITE_CODE(m_initialCpbRemovalDelay,       hrd.initialCpbRemovalDelayLength,        "initial_cpb_removal_delay");</div><div>         WRITE_CODE(m_initialCpbRemovalDelayOffset, hrd.initialCpbRemovalDelayLength, "initial_cpb_removal_delay_offset");</div><div>diff -r e50f803e26fb -r 8eb57eb225d5 source/x265.h</div><div>--- a/source/x265.h<span style="white-space:pre">   </span>Thu Sep 27 14:16:15 2018 +0530</div><div>+++ b/source/x265.h<span style="white-space:pre">     </span>Wed Oct 03 17:00:53 2018 +0530</div><div>@@ -1730,6 +1730,9 @@</div><div>      * device as RPU will be ignored. Default 0 (disabled) */</div><div>     int dolbyProfile;</div><div> </div><div>+    /* Set concantenation flag for the first keyframe in the HRD buffering period SEI. */</div><div>+    int bEnableHRDConcatFlag;</div><div>+</div><div> } x265_param;</div><div> /* x265_param_alloc:</div><div>  *  Allocates an x265_param instance. The returned param structure is not</div><div>diff -r e50f803e26fb -r 8eb57eb225d5 source/x265cli.h</div><div>--- a/source/x265cli.h<span style="white-space:pre"> </span>Thu Sep 27 14:16:15 2018 +0530</div><div>+++ b/source/x265cli.h<span style="white-space:pre">  </span>Wed Oct 03 17:00:53 2018 +0530</div><div>@@ -307,6 +307,8 @@</div><div>     { "pic-struct", required_argument, NULL, 0 },</div><div>     { "nalu-file", required_argument, NULL, 0 },</div><div>     { "dolby-vision-rpu", required_argument, NULL, 0 },</div><div>+    { "hrd-concat",          no_argument, NULL, 0},</div><div>+    { "no-hrd-concat",       no_argument, NULL, 0 },</div><div>     { 0, 0, 0, 0 },</div><div>     { 0, 0, 0, 0 },</div><div>     { 0, 0, 0, 0 },</div><div>@@ -463,6 +465,7 @@</div><div>     H1("                                 0 - flush the encoder only when all the input pictures are over.\n");</div><div>     H1("                                 1 - flush all the frames even when the input is not over. Slicetype decision may change with this option.\n");</div><div>     H1("                                 2 - flush the slicetype decided frames only.\n");</div><div>+    H0("   --[no-]-hrd-concat            Set HRD concatenation flag for the first keyframe in the buffering period SEI. Default %s\n", OPT(param->bEnableHRDConcatFlag));</div><div>     H0("\nRate control, Adaptive Quantization:\n");</div><div>     H0("   --bitrate <integer>           Target bitrate (kbps) for ABR (implied). Default %d\n", param->rc.bitrate);</div><div>     H1("-q/--qp <integer>                QP for P slices in CQP mode (implied). --ipratio and --pbration determine other slice QPs\n");</div><div><br></div></div></div>