[x265] [PATCH] bitstream: Modify API to discard optional VUI params, remove discard SEI API

Pradeep Ramachandran pradeep at multicorewareinc.com
Mon Oct 17 10:43:48 CEST 2016


On Mon, Oct 10, 2016 at 5:35 PM, Mario *LigH* Rohkrämer <contact at ligh.de>
wrote:

> Typos in syntax documentation:
>
> The dash should be part of the optional negation: rather "[no-]..."
> instead of "[no]-..." each time.
>

I have fixed this with a new patch.


>
> In the currently documented form, the result when omitting the "no" would
> be a triple dash.
>
>
>
> Am 03.10.2016, 09:14 Uhr, schrieb Pradeep Ramachandran <
> pradeep at multicorewareinc.com>:
>
> # HG changeset patch
>> # User Pradeep Ramachandran <pradeep at multicorewareinc.com>
>> # Date 1475478199 -19800
>> #      Mon Oct 03 12:33:19 2016 +0530
>> # Node ID 91ed7cb38e66c43116e1d279e94d087d462e71ce
>> # Parent  11bfa0ae971029fed69554e700185a8ef93a289c
>> bitstream: Modify API to discard optional VUI params, remove discard SEI
>> API
>>
>> Cleaner API to remove optional timing & HRD info from VUI.
>> Remove discard SEI API as it can be done through a combo of other API
>> options
>>
>> diff -r 11bfa0ae9710 -r 91ed7cb38e66 doc/reST/cli.rst
>> --- a/doc/reST/cli.rst  Wed Sep 28 15:18:23 2016 +0530
>> +++ b/doc/reST/cli.rst  Mon Oct 03 12:33:19 2016 +0530
>> @@ -1824,7 +1824,7 @@
>>         enhancement layer. A decoder may chose to drop the enhancement
>> layer
>>         and only decode and display the base layer slices.
>>
>> -       If used with a fixed GOP (:option:`b-adapt` 0) and
>> :option:`bframes`
>> +       If used with a fixed GOP (:option:`--b-adapt` 0) and
>> :option:`--bframes`
>>         3 then the two layers evenly split the frame rate, with a cadence
>> of
>>         PbBbP. You probably also want :option:`--no-scenecut` and a
>> keyframe
>>         interval that is a multiple of 4.
>> @@ -1833,15 +1833,15 @@
>>   Maximum of the picture order count. Default 8
>> -.. option:: --discard-sei
>> +.. option:: --[no]-vui-timing-info
>>
>
> Rather:
>  +.. option:: --[no-]vui-timing-info
>
> -  Discard SEI messages generated from the final bitstream. HDR-related SEI
>> -  messages are always dumped, immaterial of this option. Default
>> disabled.
>> -
>> -.. option:: --discard-vui
>> +       Discard optional VUI timing info from bitstream. Default enabled.
>> -       Discard optional VUI information (timing, HRD info) from the
>> -       bitstream. Default disabled.
>> +.. option:: --[no]-vui-hrd-info
>>
>
> Rather:
>  +.. option:: --[no-]vui-timing-info
>
>
> +
>> +       Discard optional VUI HRD info from bitstream. Default enabled when
>> +       :option:`--hrd` is enabled.
>> +
>> Debugging options
>>  =================
>> diff -r 11bfa0ae9710 -r 91ed7cb38e66 source/CMakeLists.txt
>> --- a/source/CMakeLists.txt     Wed Sep 28 15:18:23 2016 +0530
>> +++ b/source/CMakeLists.txt     Mon Oct 03 12:33:19 2016 +0530
>> @@ -30,7 +30,7 @@
>>  mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
>> # X265_BUILD must be incremented each time the public API is changed
>> -set(X265_BUILD 95)
>> +set(X265_BUILD 96)
>>  configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
>>                 "${PROJECT_BINARY_DIR}/x265.def")
>>  configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
>> diff -r 11bfa0ae9710 -r 91ed7cb38e66 source/common/param.cpp
>> --- a/source/common/param.cpp   Wed Sep 28 15:18:23 2016 +0530
>> +++ b/source/common/param.cpp   Mon Oct 03 12:33:19 2016 +0530
>> @@ -229,7 +229,8 @@
>>      param->rc.qpMin = 0;
>>      param->rc.qpMax = QP_MAX_MAX;
>> -    param->bDiscardOptionalVUI = 0;
>> +    param->bEmitVUITimingInfo = 1;
>> +    param->bEmitVUIHRDInfo = 1;
>>     /* Video Usability Information (VUI) */
>>      param->vui.aspectRatioIdc = 0;
>> @@ -256,7 +257,6 @@
>>      param->minLuma = 0;
>>      param->maxLuma = PIXEL_MAX;
>>      param->log2MaxPocLsb = 8;
>> -    param->bDiscardSEI = false;
>>      param->maxSlices = 1;
>>  }
>> @@ -914,8 +914,8 @@
>>          OPT("qpmin") p->rc.qpMin = atoi(value);
>>          OPT("analyze-src-pics") p->bSourceReferenceEstimation =
>> atobool(value);
>>          OPT("log2-max-poc-lsb") p->log2MaxPocLsb = atoi(value);
>> -        OPT("discard-sei") p->bDiscardSEI = atobool(value);
>> -        OPT("discard-vui") p->bDiscardOptionalVUI = atobool(value);
>> +        OPT("vui-timing-info") p->bEmitVUITimingInfo = atobool(value);
>> +        OPT("vui-hrd-info") p->bEmitVUIHRDInfo = atobool(value);
>>          else
>>              return X265_PARAM_BAD_NAME;
>>      }
>> diff -r 11bfa0ae9710 -r 91ed7cb38e66 source/common/slice.h
>> --- a/source/common/slice.h     Wed Sep 28 15:18:23 2016 +0530
>> +++ b/source/common/slice.h     Mon Oct 03 12:33:19 2016 +0530
>> @@ -243,7 +243,8 @@
>>      bool     bUseAMP; // use param
>>      bool     bUseStrongIntraSmoothing; // use param
>>      bool     bTemporalMVPEnabled;
>> -    bool     bDiscardOptionalVUI;
>> +    bool     bEmitVUITimingInfo;
>> +    bool     bEmitVUIHRDInfo;
>>     Window   conformanceWindow;
>>      VUI      vuiParameters;
>> diff -r 11bfa0ae9710 -r 91ed7cb38e66 source/encoder/encoder.cpp
>> --- a/source/encoder/encoder.cpp        Wed Sep 28 15:18:23 2016 +0530
>> +++ b/source/encoder/encoder.cpp        Mon Oct 03 12:33:19 2016 +0530
>> @@ -1491,7 +1491,7 @@
>>          list.serialize(NAL_UNIT_PREFIX_SEI, bs);
>>      }
>> -    if (!m_param->bDiscardSEI && m_param->bEmitInfoSEI)
>> +    if (m_param->bEmitInfoSEI)
>>      {
>>          char *opts = x265_param2string(m_param);
>>          if (opts)
>> @@ -1521,7 +1521,7 @@
>>          }
>>      }
>> -    if (!m_param->bDiscardSEI && (m_param->bEmitHRDSEI ||
>> !!m_param->interlaceMode))
>> +    if ((m_param->bEmitHRDSEI || !!m_param->interlaceMode))
>>      {
>>          /* Picture Timing and Buffering Period SEI require the SPS to be
>> "activated" */
>>          SEIActiveParameterSets sei;
>> @@ -1576,7 +1576,8 @@
>>     sps->bUseStrongIntraSmoothing = m_param->bEnableStrongIntraSmoothing;
>>      sps->bTemporalMVPEnabled = m_param->bEnableTemporalMvp;
>> -    sps->bDiscardOptionalVUI = m_param->bDiscardOptionalVUI;
>> +    sps->bEmitVUITimingInfo = m_param->bEmitVUITimingInfo;
>> +    sps->bEmitVUIHRDInfo = m_param->bEmitVUIHRDInfo;
>>      sps->log2MaxPocLsb = m_param->log2MaxPocLsb;
>>      int maxDeltaPOC = (m_param->bframes + 2) * (!!m_param->bBPyramid +
>> 1) * 2;
>>      while ((1 << sps->log2MaxPocLsb) <= maxDeltaPOC * 2)
>> diff -r 11bfa0ae9710 -r 91ed7cb38e66 source/encoder/entropy.cpp
>> --- a/source/encoder/entropy.cpp        Wed Sep 28 15:18:23 2016 +0530
>> +++ b/source/encoder/entropy.cpp        Mon Oct 03 12:33:19 2016 +0530
>> @@ -319,7 +319,7 @@
>>      WRITE_FLAG(sps.bUseStrongIntraSmoothing,
>> "sps_strong_intra_smoothing_enable_flag");
>>     WRITE_FLAG(1, "vui_parameters_present_flag");
>> -    codeVUI(sps.vuiParameters, sps.maxTempSubLayers,
>> sps.bDiscardOptionalVUI);
>> +    codeVUI(sps.vuiParameters, sps.maxTempSubLayers,
>> sps.bEmitVUITimingInfo, sps.bEmitVUIHRDInfo);
>>     WRITE_FLAG(0, "sps_extension_flag");
>>  }
>> @@ -422,7 +422,7 @@
>>      }
>>  }
>> -void Entropy::codeVUI(const VUI& vui, int maxSubTLayers, bool
>> bDiscardOptionalVUI)
>> +void Entropy::codeVUI(const VUI& vui, int maxSubTLayers, bool
>> bEmitVUITimingInfo, bool bEmitVUIHRDInfo)
>>  {
>>      WRITE_FLAG(vui.aspectRatioInfoPresentFlag,
>> "aspect_ratio_info_present_flag");
>>      if (vui.aspectRatioInfoPresentFlag)
>> @@ -473,7 +473,7 @@
>>          WRITE_UVLC(vui.defaultDisplayWindow.bottomOffset,
>> "def_disp_win_bottom_offset");
>>      }
>> -    if (bDiscardOptionalVUI)
>> +    if (!bEmitVUITimingInfo)
>>          WRITE_FLAG(0, "vui_timing_info_present_flag");
>>      else
>>      {
>> @@ -483,7 +483,7 @@
>>          WRITE_FLAG(0, "vui_poc_proportional_to_timing_flag");
>>      }
>> -    if (bDiscardOptionalVUI)
>> +    if (!bEmitVUIHRDInfo)
>>          WRITE_FLAG(0, "vui_hrd_parameters_present_flag");
>>      else
>>      {
>> diff -r 11bfa0ae9710 -r 91ed7cb38e66 source/encoder/entropy.h
>> --- a/source/encoder/entropy.h  Wed Sep 28 15:18:23 2016 +0530
>> +++ b/source/encoder/entropy.h  Mon Oct 03 12:33:19 2016 +0530
>> @@ -143,7 +143,7 @@
>>      void codeVPS(const VPS& vps);
>>      void codeSPS(const SPS& sps, const ScalingList& scalingList, const
>> ProfileTierLevel& ptl);
>>      void codePPS( const PPS& pps, bool filerAcross, int
>> iPPSInitQpMinus26 );
>> -    void codeVUI(const VUI& vui, int maxSubTLayers, bool
>> discardOptionalVUI);
>> +    void codeVUI(const VUI& vui, int maxSubTLayers, bool
>> bEmitVUITimingInfo, bool bEmitVUIHRDInfo);
>>      void codeAUD(const Slice& slice);
>>      void codeHrdParameters(const HRDInfo& hrd, int maxSubTLayers);
>> diff -r 11bfa0ae9710 -r 91ed7cb38e66 source/encoder/frameencoder.cpp
>> --- a/source/encoder/frameencoder.cpp   Wed Sep 28 15:18:23 2016 +0530
>> +++ b/source/encoder/frameencoder.cpp   Mon Oct 03 12:33:19 2016 +0530
>> @@ -525,7 +525,7 @@
>>     if (m_frame->m_lowres.bKeyframe)
>>      {
>> -        if (!m_param->bDiscardSEI && m_param->bEmitHRDSEI)
>> +        if (m_param->bEmitHRDSEI)
>>          {
>>              SEIBufferingPeriod* bpSei = &m_top->m_rateControl->m_bufPe
>> riodSEI;
>> @@ -547,7 +547,7 @@
>>          }
>>      }
>> -    if (!m_param->bDiscardSEI && (m_param->bEmitHRDSEI ||
>> !!m_param->interlaceMode))
>> +    if ((m_param->bEmitHRDSEI || !!m_param->interlaceMode))
>>      {
>>          SEIPictureTiming *sei = m_rce.picTimingSEI;
>>          const VUI *vui = &slice->m_sps->vuiParameters;
>> @@ -583,22 +583,19 @@
>>      }
>>     /* Write user SEI */
>> -    if (!m_param->bDiscardSEI)
>> +    for (int i = 0; i < m_frame->m_userSEI.numPayloads; i++)
>>      {
>> -        for (int i = 0; i < m_frame->m_userSEI.numPayloads; i++)
>> -        {
>> -            x265_sei_payload *payload = &m_frame->m_userSEI.payloads[i];
>> -            SEIuserDataUnregistered sei;
>> +        x265_sei_payload *payload = &m_frame->m_userSEI.payloads[i];
>> +        SEIuserDataUnregistered sei;
>> -            sei.m_payloadType = payload->payloadType;
>> -            sei.m_userDataLength = payload->payloadSize;
>> -            sei.m_userData = payload->payload;
>> +        sei.m_payloadType = payload->payloadType;
>> +        sei.m_userDataLength = payload->payloadSize;
>> +        sei.m_userData = payload->payload;
>> -            m_bs.resetBits();
>> -            sei.write(m_bs, *slice->m_sps);
>> -            m_bs.writeByteAlignment();
>> -            m_nalList.serialize(NAL_UNIT_PREFIX_SEI, m_bs);
>> -        }
>> +        m_bs.resetBits();
>> +        sei.write(m_bs, *slice->m_sps);
>> +        m_bs.writeByteAlignment();
>> +        m_nalList.serialize(NAL_UNIT_PREFIX_SEI, m_bs);
>>      }
>>     /* CQP and CRF (without capped VBV) doesn't use mid-frame statistics
>> to
>> @@ -895,7 +892,7 @@
>>      }
>> -    if (!m_param->bDiscardSEI && m_param->decodedPictureHashSEI)
>> +    if (m_param->decodedPictureHashSEI)
>>      {
>>          int planes = (m_frame->m_param->internalCsp != X265_CSP_I400) ?
>> 3 : 1;
>>          if (m_param->decodedPictureHashSEI == 1)
>> diff -r 11bfa0ae9710 -r 91ed7cb38e66 source/x265.h
>> --- a/source/x265.h     Wed Sep 28 15:18:23 2016 +0530
>> +++ b/source/x265.h     Mon Oct 03 12:33:19 2016 +0530
>> @@ -1301,11 +1301,11 @@
>>      /* Maximum of the picture order count */
>>      int log2MaxPocLsb;
>> -    /* Dicard SEI messages when printing */
>> -    int bDiscardSEI;
>> -
>> -    /* Control removing optional vui information (timing, HRD info) to
>> get low bitrate */
>> -    int       bDiscardOptionalVUI;
>> +    /* Emit VUI Timing info, an optional VUI field */
>> +    int bEmitVUITimingInfo;
>> +
>> +    /* Emit HRD Timing info */
>> +    int bEmitVUIHRDInfo;
>>     /* Maximum count of Slices of picture, the value range is [1, maximum
>> rows] */
>>      unsigned int maxSlices;
>> diff -r 11bfa0ae9710 -r 91ed7cb38e66 source/x265cli.h
>> --- a/source/x265cli.h  Wed Sep 28 15:18:23 2016 +0530
>> +++ b/source/x265cli.h  Mon Oct 03 12:33:19 2016 +0530
>> @@ -208,8 +208,10 @@
>>      { "min-luma",       required_argument, NULL, 0 },
>>      { "max-luma",       required_argument, NULL, 0 },
>>      { "log2-max-poc-lsb", required_argument, NULL, 8 },
>> -    { "discard-sei",          no_argument, NULL, 0 },
>> -    { "discard-vui",          no_argument, NULL, 0 },
>> +    { "vui-timing-info",      no_argument, NULL, 0 },
>> +    { "no-vui-timing-info",   no_argument, NULL, 0 },
>> +    { "vui-hrd-info",         no_argument, NULL, 0 },
>> +    { "no-vui-hrd-info",      no_argument, NULL, 0 },
>>      { "no-dither",            no_argument, NULL, 0 },
>>      { "dither",               no_argument, NULL, 0 },
>>      { "no-repeat-headers",    no_argument, NULL, 0 },
>> @@ -448,8 +450,8 @@
>>      H0("   --[no-]aud                    Emit access unit delimiters at
>> the start of each access unit. Default %s\n", OPT(param->bEnableAccessUnitDe
>> limiters));
>>      H1("   --hash <integer>              Decoded Picture Hash SEI 0:
>> disabled, 1: MD5, 2: CRC, 3: Checksum. Default %d\n",
>> param->decodedPictureHashSEI);
>>      H0("   --log2-max-poc-lsb <integer>  Maximum of the picture order
>> count\n");
>> -    H0("   --discard-sei                 Discard SEI packets in
>> bitstream. Default %s\n", OPT(param->bDiscardSEI));
>> -    H0("   --discard-vui                 Discard optional VUI
>> information from the bistream. Default %s\n", OPT(param->bDiscardOptionalVUI
>> ));
>> +    H0("   --[no]-vui-timing-info        Discard optional VUI timing
>>
>
> Rather:
>  +    H0("   --[no-]vui-timing-info        Discard optional VUI timing
>
> information from the bistream. Default %s\n",
>> OPT(param->bEmitVUITimingInfo));
>> +    H0("   --[no]-vui-hrd-info           Discard optional HRD timing
>>
>
> Rather:
>  +    H0("   --[no-]vui-hrd-info           Discard optional HRD timing
>
>
>
> information from the bistream. Default %s\n", OPT(param->bEmitVUIHRDInfo));
>>      H1("\nReconstructed video options (debugging):\n");
>>      H1("-r/--recon <filename>            Reconstructed raw image YUV or
>> Y4M output file name\n");
>>      H1("   --recon-depth <integer>       Bit-depth of reconstructed raw
>> image file. Defaults to input bit depth, or 8 if Y4M\n");
>>
>
>
> --
>
> Fun and success!
> Mario *LigH* Rohkrämer
> mailto:contact at ligh.de
>
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20161017/c4ae1aa2/attachment-0001.html>


More information about the x265-devel mailing list