[x265] [PATCH] Added command line options to generate a VUI and add it to the coded bitstream

Steve Borho steve at borho.org
Thu Feb 20 21:44:57 CET 2014


On Wed, Feb 19, 2014 at 12:01 PM, <dtyx265 at gmail.com> wrote:

> # HG changeset patch
> # User David T Yuen <dtyx265 at gmail.com>
> # Date 1392832822 28800
> # Node ID 8ef0c14054879a7a0ba7720ecb3a640e6b3767d1
> # Parent  1c78bd13a14f3d5227c4b961664af97f86a8810d
> Added command line options to generate a VUI and add it to the coded
> bitstream
>

Hello,  Thanks for working through these details.

I had some review comments for this patch but unfortunately didn't get
around to responding to this patch yesterday.


> diff -r 1c78bd13a14f -r 8ef0c1405487 source/Lib/TLibCommon/TComSlice.h
> --- a/source/Lib/TLibCommon/TComSlice.h Wed Feb 19 09:46:46 2014 -0800
> +++ b/source/Lib/TLibCommon/TComSlice.h Wed Feb 19 10:00:22 2014 -0800
> @@ -604,6 +604,7 @@
>      bool m_frameFieldInfoPresentFlag;
>      bool m_hrdParametersPresentFlag;
>      bool m_bitstreamRestrictionFlag;
> +    bool m_tilesFixedStructureFlag;
>      bool m_motionVectorsOverPicBoundariesFlag;
>      bool m_restrictedRefPicListsFlag;
>      int  m_minSpatialSegmentationIdc;
> @@ -638,6 +639,7 @@
>          , m_frameFieldInfoPresentFlag(false)
>          , m_hrdParametersPresentFlag(false)
>          , m_bitstreamRestrictionFlag(false)
> +        , m_tilesFixedStructureFlag(false)
>

We don't support tiles, so it is ok to leave this hard-coded to zero


>          , m_motionVectorsOverPicBoundariesFlag(true)
>          , m_restrictedRefPicListsFlag(1)
>          , m_minSpatialSegmentationIdc(0)
> @@ -737,6 +739,10 @@
>
>      void setBitstreamRestrictionFlag(bool i) { m_bitstreamRestrictionFlag
> = i; }
>
> +    bool getTilesFixedStructureFlag() { return m_tilesFixedStructureFlag;
> }
> +
> +    void setTilesFixedStructureFlag(bool i) { m_tilesFixedStructureFlag =
> i; }
>


We're trying to remove these C++ style get/set methods.  Just set/get these
variables directly.



>      bool getMotionVectorsOverPicBoundariesFlag() { return
> m_motionVectorsOverPicBoundariesFlag; }
>
>      void setMotionVectorsOverPicBoundariesFlag(bool i) {
> m_motionVectorsOverPicBoundariesFlag = i; }
> diff -r 1c78bd13a14f -r 8ef0c1405487 source/Lib/TLibEncoder/TEncCfg.h
> --- a/source/Lib/TLibEncoder/TEncCfg.h  Wed Feb 19 09:46:46 2014 -0800
> +++ b/source/Lib/TLibEncoder/TEncCfg.h  Wed Feb 19 10:00:22 2014 -0800
> @@ -151,6 +151,14 @@
>      int       m_maxBitsPerMinCuDenom;                         ///<
> Indicates an upper bound for the number of bits of coding_unit() data
>      int       m_log2MaxMvLengthHorizontal;                    ///<
> Indicate the maximum absolute value of a decoded horizontal MV component in
> quarter-pel luma units
>      int       m_log2MaxMvLengthVertical;                      ///<
> Indicate the maximum absolute value of a decoded vertical MV component in
> quarter-pel luma units
>


there's no need to add these flags to TEncCfg since TEncCfg itself has an
x265_param structure built into it.  These are redundant.


> +    bool      m_fieldSeqFlag;                                 ///<
> Indicates that each picture is a field and has its own SEI timing message
> +    bool      m_vuiTimingInfoPresentFlag;                     ///<
> Indicates that timing info is added to the VUI
> +    int       m_vuiNumUnitsInTick;                            ///< The
> number of system ticks in an h265 tick where an h265 tick is in units of
> system ticks per frame
> +    int       m_vuiTimeScale;                                 ///< The
> number of system ticks per second
> +    bool      m_vuiHrdParametersPresentFlag;                  ///<
> Indicates HRD parameters are to be added to the VUI
> +    bool      m_subPicHrdParamsPresentFlag;                   ///<
> Indicates that sub pic parameters should be added to the HRD
> +    bool      m_restrictedRefPicListsFlag;                    ///<
> Indicates all P and B slices have the same reference pic list 0 and all B
> slices have the same reference pic list 1
> +    bool      m_tilesFixedStructureFlag;                      ///<
> Indicates each PPS in the CVS have the same tile structure fields
>
>  public:
>
> @@ -305,6 +313,22 @@
>      bool getNonPackedConstraintFlag() const { return
> m_nonPackedConstraintFlag; }
>
>      bool getFrameOnlyConstraintFlag() const { return
> m_frameOnlyConstraintFlag; }
>

ditto here, these should go away


> +
> +    bool getFieldSeqFlag() const { return m_fieldSeqFlag; }
> +
> +    bool getVuiTimingInfoPresentFlag() const { return
> m_vuiTimingInfoPresentFlag; }
> +
> +    int getVuiNumUnitsInTick() const { return m_vuiNumUnitsInTick; }
> +
> +    int getVuiTimeScale() const { return m_vuiTimeScale; }
> +
> +    bool getVuiHrdParametersPresentFlag() const { return
> m_vuiHrdParametersPresentFlag; }
> +
> +    bool getSubPicHrdParamsPresentFlag() const { return
> m_subPicHrdParamsPresentFlag; }
> +
> +    bool getRestrictedRefPicListsFlag() const { return
> m_restrictedRefPicListsFlag; }
> +
> +    bool getTilesFixedStructureFlag() const { return
> m_tilesFixedStructureFlag; }
>  };
>  }
>  //! \}
> diff -r 1c78bd13a14f -r 8ef0c1405487 source/Lib/TLibEncoder/TEncSbac.cpp
> --- a/source/Lib/TLibEncoder/TEncSbac.cpp       Wed Feb 19 09:46:46 2014
> -0800
> +++ b/source/Lib/TLibEncoder/TEncSbac.cpp       Wed Feb 19 10:00:22 2014
> -0800
> @@ -665,7 +665,7 @@
>      WRITE_FLAG(vui->getBitstreamRestrictionFlag(),
>  "bitstream_restriction_flag");
>      if (vui->getBitstreamRestrictionFlag())
>      {
> -        WRITE_FLAG(0,
>  "tiles_fixed_structure_flag");
> +        WRITE_FLAG(vui->getTilesFixedStructureFlag(),
> "tiles_fixed_structure_flag");
>

this one can be backed out


>          WRITE_FLAG(vui->getMotionVectorsOverPicBoundariesFlag(),
>  "motion_vectors_over_pic_boundaries_flag");
>          WRITE_FLAG(vui->getRestrictedRefPicListsFlag(),
> "restricted_ref_pic_lists_flag");
>          WRITE_UVLC(vui->getMinSpatialSegmentationIdc(),
> "min_spatial_segmentation_idc");
> diff -r 1c78bd13a14f -r 8ef0c1405487 source/common/common.cpp
> --- a/source/common/common.cpp  Wed Feb 19 09:46:46 2014 -0800
> +++ b/source/common/common.cpp  Wed Feb 19 10:00:22 2014 -0800
> @@ -221,6 +221,35 @@
>      /* Quality Measurement Metrics */
>      param->bEnablePsnr = 0;
>      param->bEnableSsim = 0;
> +
> +    /* Video Usability Information (VUI) */
> +    param->bEnableVuiParametersPresentFlag = 0;
> +    param->bEnableAspectRatioIdc = 0;
> +    param->aspectRatioIdc = 0;
> +    param->sarWidth = 0;
> +    param->sarHeight = 0;
> +    param->bEnableOverscanAppropriateFlag = 0;
> +    param->bEnableVideoSignalTypePresentFlag = 0;
> +    param->videoFormat = 5;
> +    param->bEnableVideoFullRangeFlag = 0;
> +    param->bEnableColorDescriptionPresentFlag = 0;
> +    param->colorPrimaries = 2;
> +    param->transferCharacteristics = 2;
> +    param->matrixCoeffs = 2;
> +    param->bEnableChromaLocInfoPresentFlag = 0;
> +    param->chromaSampleLocTypeTopField = 0;
> +    param->chromaSampleLocTypeBottomField = 0;
> +    param->bEnableFieldSeqFlag = 0;
> +    param->bEnableFrameFieldInfoPresentFlag = 0;
> +    param->bEnableDefaultDisplayWindowFlag = 0;
> +    param->defDispWinLeftOffset = 0;
> +    param->defDispWinRightOffset = 0;
> +    param->defDispWinTopOffset = 0;
> +    param->defDispWinBottomOffset = 0;
> +    param->bEnableVuiTimingInfoPresentFlag = 0;
> +    param->bEnableVuiHrdParametersPresentFlag = 0;
> +    param->bEnableBitstreamRestrictionFlag = 0;
> +    param->bEnableSubPicHrdParamsPresentFlag = 0;
>  }
>
>  extern "C"
> @@ -764,6 +793,200 @@
>      OPT("me")        p->searchMethod = parseName(value,
> x265_motion_est_names, berror);
>      OPT("cutree")    p->rc.cuTree = bvalue;
>      OPT("no-cutree") p->rc.cuTree = bvalue;
> +    OPT("vui")
> +    {
> +        p->bEnableVuiParametersPresentFlag = bvalue;
> +        p->bEnableAspectRatioIdc = bvalue;
> +        p->bEnableOverscanInfoPresentFlag = bvalue;
> +        p->bEnableVideoSignalTypePresentFlag = bvalue;
> +        p->bEnableColorDescriptionPresentFlag = bvalue;
> +        p->bEnableChromaLocInfoPresentFlag = bvalue;
> +        p->bEnableFieldSeqFlag = bvalue;
> +        p->bEnableFrameFieldInfoPresentFlag = bvalue;
> +        p->bEnableDefaultDisplayWindowFlag = bvalue;
> +        p->bEnableVuiTimingInfoPresentFlag = bvalue;
> +        p->bEnableVuiHrdParametersPresentFlag = bvalue;
> +        p->bEnableBitstreamRestrictionFlag = bvalue;
> +        p->bEnableSubPicHrdParamsPresentFlag = bvalue;
> +    }
> +    OPT("sar")
> +    {
> +        p->bEnableVuiParametersPresentFlag = 1;
> +        p->bEnableAspectRatioIdc = bvalue;
> +        p->aspectRatioIdc = atoi(value);
> +    }
> +    OPT("extended-sar")
> +    {
> +        p->bEnableVuiParametersPresentFlag = 1;
> +        p->bEnableAspectRatioIdc = bvalue;
> +        p->aspectRatioIdc = 255;
> +        sscanf(value, "%dx%d", &p->sarWidth, &p->sarHeight);
> +    }
> +    OPT("overscan")
> +    {
> +        p->bEnableVuiParametersPresentFlag = 1;
> +        if (!strcmp(value, "show"))
> +            p->bEnableOverscanInfoPresentFlag = bvalue;
> +        else if (!strcmp(value, "crop"))
> +        {
> +            p->bEnableOverscanInfoPresentFlag = bvalue;
> +            p->bEnableOverscanAppropriateFlag = bvalue;
> +        }
> +    }
> +    OPT("videoformat")
> +    {
> +        p->bEnableVuiParametersPresentFlag = 1;
> +        p->bEnableVideoSignalTypePresentFlag = bvalue;
> +        if (!strcmp(value, "component"))
> +            p->videoFormat = 0;
> +        else if (!strcmp(value, "pal"))
> +            p->videoFormat = 1;
> +        else if (!strcmp(value, "ntsc"))
> +            p->videoFormat = 2;
> +        else if (!strcmp(value, "secam"))
> +            p->videoFormat = 3;
> +        else if (!strcmp(value, "mac"))
> +            p->videoFormat = 4;
> +        else if (!strcmp(value, "undef"))
> +            p->videoFormat = 5;
> +    }
> +    OPT("range")
> +    {
> +        p->bEnableVuiParametersPresentFlag = 1;
> +        p->bEnableVideoSignalTypePresentFlag = bvalue;
> +        p->bEnableVideoFullRangeFlag = bvalue;
> +    }
> +    OPT("colorprim")
> +    {
> +        p->bEnableVuiParametersPresentFlag = 1;
> +        p->bEnableVideoSignalTypePresentFlag = bvalue;
> +        p->bEnableColorDescriptionPresentFlag = bvalue;
> +        if (!strcmp(value, "bt709"))
> +            p->colorPrimaries = 1;
> +        else if (!strcmp(value, "undef"))
> +            p->colorPrimaries = 2;
> +        else if (!strcmp(value, "bt470m"))
> +            p->colorPrimaries = 4;
> +        else if (!strcmp(value, "bt470bg"))
> +            p->colorPrimaries = 5;
> +        else if (!strcmp(value, "smpte170m"))
> +            p->colorPrimaries = 6;
> +        else if (!strcmp(value, "smpte240m"))
> +            p->colorPrimaries = 7;
> +        else if (!strcmp(value, "film"))
> +            p->colorPrimaries = 8;
> +        else if (!strcmp(value, "bt2020"))
> +            p->colorPrimaries = 9;
> +    }
> +    OPT("transfer")
> +    {
> +        p->bEnableVuiParametersPresentFlag = 1;
> +        p->bEnableVideoSignalTypePresentFlag = bvalue;
> +        p->bEnableColorDescriptionPresentFlag = bvalue;
> +        if (!strcmp(value, "bt709"))
> +            p->transferCharacteristics = 1;
> +        else if (!strcmp(value, "undef"))
> +            p->transferCharacteristics = 2;
> +        else if (!strcmp(value, "bt470m"))
> +            p->transferCharacteristics = 4;
> +        else if (!strcmp(value, "bt470bg"))
> +            p->transferCharacteristics = 5;
> +        else if (!strcmp(value, "smpte170m"))
> +            p->transferCharacteristics = 6;
> +        else if (!strcmp(value, "smpte240m"))
> +            p->transferCharacteristics = 7;
> +        else if (!strcmp(value, "linear"))
> +            p->transferCharacteristics = 8;
> +        else if (!strcmp(value, "log100"))
> +            p->transferCharacteristics = 9;
> +        else if (!strcmp(value, "log316"))
> +            p->transferCharacteristics = 10;
> +        else if (!strcmp(value, "iec61966-2-4"))
> +            p->transferCharacteristics = 11;
> +        else if (!strcmp(value, "bt1361e"))
> +            p->transferCharacteristics = 12;
> +        else if (!strcmp(value, "iec61966-2-1"))
> +            p->transferCharacteristics = 13;
> +        else if (!strcmp(value, "bt2020-10"))
> +            p->transferCharacteristics = 14;
> +        else if (!strcmp(value, "bt2020-12"))
> +            p->transferCharacteristics = 15;
> +    }
> +    OPT("colormatrix")
> +    {
> +        p->bEnableVuiParametersPresentFlag = 1;
> +        p->bEnableVideoSignalTypePresentFlag = bvalue;
> +        p->bEnableColorDescriptionPresentFlag = bvalue;
> +        if (!strcmp(value, "GBR"))
> +            p->matrixCoeffs = 0;
> +        else if (!strcmp(value, "bt709"))
> +            p->matrixCoeffs = 1;
> +        else if (!strcmp(value, "undef"))
> +            p->matrixCoeffs = 2;
> +        else if (!strcmp(value, "fcc"))
> +            p->matrixCoeffs = 4;
> +        else if (!strcmp(value, "bt470bg"))
> +            p->matrixCoeffs = 5;
> +        else if (!strcmp(value, "smpte170m"))
> +            p->matrixCoeffs = 6;
> +        else if (!strcmp(value, "smpte240m"))
> +            p->matrixCoeffs = 7;
> +        else if (!strcmp(value, "YCgCo"))
> +            p->matrixCoeffs = 8;
> +        else if (!strcmp(value, "bt2020nc"))
> +            p->matrixCoeffs = 9;
> +        else if (!strcmp(value, "bt2020c"))
> +            p->matrixCoeffs = 10;
> +    }
> +    OPT("chromaloc")
> +    {
> +        p->bEnableVuiParametersPresentFlag = 1;
> +        p->bEnableChromaLocInfoPresentFlag = bvalue;
> +        p->chromaSampleLocTypeTopField = atoi(value);
> +        p->chromaSampleLocTypeBottomField =
> p->chromaSampleLocTypeTopField;
> +    }
> +    OPT("fieldseq")
> +    {
> +        p->bEnableVuiParametersPresentFlag = 1;
> +        p->bEnableFieldSeqFlag = bvalue;
> +    }
> +    OPT("framefieldinfo")
> +    {
> +        p->bEnableVuiParametersPresentFlag = 1;
> +        p->bEnableFrameFieldInfoPresentFlag = bvalue;
> +    }
> +    OPT("crop-rect")
> +    {
> +        p->bEnableVuiParametersPresentFlag = 1;
> +        p->bEnableDefaultDisplayWindowFlag = bvalue;
> +        sscanf(value,"%d,%d,%d,%d",
> +            &p->defDispWinLeftOffset,
> +            &p->defDispWinTopOffset,
> +            &p->defDispWinRightOffset,
> +            &p->defDispWinBottomOffset);
> +    }
> +    OPT("timinginfo")
> +    {
> +        p->bEnableVuiParametersPresentFlag = 1;
> +        p->bEnableVuiTimingInfoPresentFlag = bvalue;
> +    }
> +    OPT("nal-hrd")
> +    {
> +        p->bEnableVuiParametersPresentFlag = 1;
> +        p->bEnableVuiTimingInfoPresentFlag = bvalue;
> +        p->bEnableVuiHrdParametersPresentFlag = bvalue;
> +    }
> +    OPT("bitstreamrestriction")
> +    {
> +        p->bEnableVuiParametersPresentFlag = 1;
> +        p->bEnableBitstreamRestrictionFlag = bvalue;
> +    }
> +    OPT("subpichrd")
> +    {
> +        p->bEnableVuiParametersPresentFlag = 1;
> +        p->bEnableVuiHrdParametersPresentFlag = bvalue;
> +        p->bEnableSubPicHrdParamsPresentFlag = bvalue;
> +    }
>
>      else
>          return X265_PARAM_BAD_NAME;
> diff -r 1c78bd13a14f -r 8ef0c1405487 source/encoder/encoder.cpp
> --- a/source/encoder/encoder.cpp        Wed Feb 19 09:46:46 2014 -0800
> +++ b/source/encoder/encoder.cpp        Wed Feb 19 10:00:22 2014 -0800
> @@ -1043,7 +1043,7 @@
>      if (sps->getVuiParametersPresentFlag())
>      {
>          TComVUI* vui = sps->getVuiParameters();
> -        vui->setAspectRatioInfoPresentFlag(getAspectRatioIdc() != -1);
>

you can use param.* here


> +
>  vui->setAspectRatioInfoPresentFlag(getAspectRatioInfoPresentFlag());
>          vui->setAspectRatioIdc(getAspectRatioIdc());
>          vui->setSarWidth(getSarWidth());
>          vui->setSarHeight(getSarHeight());
> @@ -1062,12 +1062,17 @@
>
>  vui->setNeutralChromaIndicationFlag(getNeutralChromaIndicationFlag());
>          vui->setDefaultDisplayWindow(getDefaultDisplayWindow());
>          vui->setFrameFieldInfoPresentFlag(getFrameFieldInfoPresentFlag());
> -        vui->setFieldSeqFlag(false);
> -        vui->setHrdParametersPresentFlag(false);
> +        vui->setFieldSeqFlag(getFieldSeqFlag());
> +
>  vui->setHrdParametersPresentFlag(getVuiHrdParametersPresentFlag());
> +
>  vui->getTimingInfo()->setTimingInfoPresentFlag(getVuiTimingInfoPresentFlag());
> +        vui->getTimingInfo()->setNumUnitsInTick(getVuiNumUnitsInTick());
> +        vui->getTimingInfo()->setTimeScale(getVuiTimeScale());
>
>  vui->getTimingInfo()->setPocProportionalToTimingFlag(getPocProportionalToTimingFlag());
>
>  vui->getTimingInfo()->setNumTicksPocDiffOneMinus1(getNumTicksPocDiffOneMinus1());
>          vui->setBitstreamRestrictionFlag(getBitstreamRestrictionFlag());
> +        vui->setTilesFixedStructureFlag(getTilesFixedStructureFlag());
>
>  vui->setMotionVectorsOverPicBoundariesFlag(getMotionVectorsOverPicBoundariesFlag());
> +        vui->setRestrictedRefPicListsFlag(getRestrictedRefPicListsFlag());
>          vui->setMinSpatialSegmentationIdc(getMinSpatialSegmentationIdc());
>          vui->setMaxBytesPerPicDenom(getMaxBytesPerPicDenom());
>          vui->setMaxBitsPerMinCuDenom(getMaxBitsPerMinCuDenom());
> @@ -1390,11 +1395,11 @@
>      m_quadtreeTULog2MinSize = tuQTMinLog2Size;
>
>      //========= set default display window
> ==================================
> -    m_defaultDisplayWindow.m_enabledFlag = true;
> -    m_defaultDisplayWindow.m_winRightOffset = 0;
> -    m_defaultDisplayWindow.m_winTopOffset = 0;
> -    m_defaultDisplayWindow.m_winBottomOffset = 0;
> -    m_defaultDisplayWindow.m_winLeftOffset = 0;
> +    m_defaultDisplayWindow.m_enabledFlag =
> _param->bEnableDefaultDisplayWindowFlag;
> +    m_defaultDisplayWindow.m_winRightOffset =
> _param->defDispWinRightOffset;
> +    m_defaultDisplayWindow.m_winTopOffset = _param->defDispWinTopOffset;
> +    m_defaultDisplayWindow.m_winBottomOffset =
> _param->defDispWinBottomOffset;
> +    m_defaultDisplayWindow.m_winLeftOffset = _param->defDispWinLeftOffset;
>      m_pad[0] = m_pad[1] = 0;
>
>      //======== set pad size if width is not multiple of the minimum CU
> size =========
> @@ -1465,25 +1470,26 @@
>      m_decodingUnitInfoSEIEnabled = 0;
>      m_useScalingListId = 0;
>      m_activeParameterSetsSEIEnabled = 0;
>

All the sets to fields redundant with x265_param should go away


> -    m_vuiParametersPresentFlag = false;
> +    m_vuiParametersPresentFlag = _param->bEnableVuiParametersPresentFlag;
>      m_minSpatialSegmentationIdc = 0;
> -    m_aspectRatioIdc = 0;
> -    m_sarWidth = 0;
> -    m_sarHeight = 0;
> -    m_overscanInfoPresentFlag = false;
> -    m_overscanAppropriateFlag = false;
> -    m_videoSignalTypePresentFlag = false;
> -    m_videoFormat = 5;
> -    m_videoFullRangeFlag = false;
> -    m_colourDescriptionPresentFlag = false;
> -    m_colourPrimaries = 2;
> -    m_transferCharacteristics = 2;
> -    m_matrixCoefficients = 2;
> -    m_chromaLocInfoPresentFlag = false;
> -    m_chromaSampleLocTypeTopField = 0;
> -    m_chromaSampleLocTypeBottomField = 0;
> +    m_aspectRatioInfoPresentFlag = _param->bEnableAspectRatioIdc;
> +    m_aspectRatioIdc = _param->aspectRatioIdc;
> +    m_sarWidth = _param->sarWidth;
> +    m_sarHeight = _param->sarHeight;
> +    m_overscanInfoPresentFlag = _param->bEnableOverscanInfoPresentFlag;
> +    m_overscanAppropriateFlag = _param->bEnableOverscanAppropriateFlag;
> +    m_videoSignalTypePresentFlag =
> _param->bEnableVideoSignalTypePresentFlag;
> +    m_videoFormat = _param->videoFormat;
> +    m_videoFullRangeFlag = _param->bEnableVideoFullRangeFlag;
> +    m_colourDescriptionPresentFlag =
> _param->bEnableColorDescriptionPresentFlag;
> +    m_colourPrimaries = _param->colorPrimaries;
> +    m_transferCharacteristics = _param->transferCharacteristics;
> +    m_matrixCoefficients = _param->matrixCoeffs;
> +    m_chromaLocInfoPresentFlag = _param->bEnableChromaLocInfoPresentFlag;
> +    m_chromaSampleLocTypeTopField = _param->chromaSampleLocTypeTopField;
> +    m_chromaSampleLocTypeBottomField =
> _param->chromaSampleLocTypeBottomField;
>      m_neutralChromaIndicationFlag = false;
> -    m_frameFieldInfoPresentFlag = false;
> +    m_frameFieldInfoPresentFlag =
> _param->bEnableFrameFieldInfoPresentFlag;
>      m_pocProportionalToTimingFlag = false;
>      m_numTicksPocDiffOneMinus1 = 0;
>      m_bitstreamRestrictionFlag = false;
> @@ -1501,6 +1507,11 @@
>      m_useLossless = false;  // x264 configures this via --qp=0
>      m_TransquantBypassEnableFlag = false;
>      m_CUTransquantBypassFlagValue = false;
> +    m_fieldSeqFlag = _param->bEnableFieldSeqFlag;
> +    m_vuiTimingInfoPresentFlag = _param->bEnableVuiTimingInfoPresentFlag;
> +    m_vuiHrdParametersPresentFlag =
> _param->bEnableVuiHrdParametersPresentFlag;
> +    m_bitstreamRestrictionFlag = _param->bEnableBitstreamRestrictionFlag;
> +    m_subPicHrdParamsPresentFlag =
> _param->bEnableSubPicHrdParamsPresentFlag;
>  }
>
>  int Encoder::extractNalData(NALUnitEBSP **nalunits)
> diff -r 1c78bd13a14f -r 8ef0c1405487 source/x265.cpp
> --- a/source/x265.cpp   Wed Feb 19 09:46:46 2014 -0800
> +++ b/source/x265.cpp   Wed Feb 19 10:00:22 2014 -0800
> @@ -154,6 +154,26 @@
>      { "strong-intra-smoothing",    no_argument, NULL, 0 },
>      { "no-cutree",                 no_argument, NULL, 0 },
>      { "cutree",                    no_argument, NULL, 0 },
> +    { "vui",                  no_argument, NULL, 0 },
> +    { "sar",            required_argument, NULL, 0 },
> +    { "extended-sar",   required_argument, NULL, 0 },
> +    { "overscan",       required_argument, NULL, 0 },
> +    { "videoformat",    required_argument, NULL, 0 },
> +    { "range",                no_argument, NULL, 0 },
> +    { "no-range",             no_argument, NULL, 0 },
> +    { "colorprim",      required_argument, NULL, 0 },
> +    { "transfer",       required_argument, NULL, 0 },
> +    { "colormatrix",    required_argument, NULL, 0 },
> +    { "chromaloc",      required_argument, NULL, 0 },
> +    { "fieldseq",             no_argument, NULL, 0 },
> +    { "no-fieldseq",          no_argument, NULL, 0 },
> +    { "framefieldinfo",       no_argument, NULL, 0 },
> +    { "no-framefieldinfo",    no_argument, NULL, 0 },
> +    { "crop-rect",      required_argument, NULL, 0 },
> +    { "timinginfo",           no_argument, NULL, 0 },
> +    { "nal-hrd",              no_argument, NULL, 0 },
> +    { "bitstreamrestriction", no_argument, NULL, 0 },
> +    { "subpichrd",            no_argument, NULL, 0 },
>      { 0, 0, 0, 0 }
>  };
>
> @@ -351,6 +371,32 @@
>      H0("   --recon-depth                 Bit-depth of reconstructed raw
> image file. Defaults to input bit depth\n");
>      H0("\nSEI options:\n");
>      H0("   --hash                        Decoded Picture Hash SEI 0:
> disabled, 1: MD5, 2: CRC, 3: Checksum. Default %d\n",
> param->decodedPictureHashSEI);
> +    H0("\nVUI options:\n");
> +    H0("   --vui                         Add Video Useability Information
> with all fields to the SPS. Default %s\n",
> OPT(param->bEnableVuiParametersPresentFlag));
> +    H0("   --sar                         Sample Aspect Ratio, the ratio
> of width to height of an individual pixel.\n");
> +    H0("                                 Choose from 0=Unspecified,
> 1=1:1(\"square\"), 2=12:11, 3=10:11, 4=16:11,\n");
> +    H0("                                 5=40:33, 6=24:11, 7=20:11,
> 8=32:11, 9=80:33, 10=18:11, 11=15:11,\n");
> +    H0("                                 12=64:33, 13=160:99, 14=4:3,
> 15=3:2, 16=2:1. Default %d\n",param->aspectRatioIdc);
> +    H0("   --extended-sar                Use a custom Sample Aspect
> Ratio,[WxH]\n");
> +    H0("   --overscan <string>           Specify crop overscan setting
> from undef, show or crop. Default of undef\n");
> +    H0("   --videoformat <string>        Specify video format from undef,
> component, pal, ntsc, secam, mac. Default of undef\n");
> +    H0("   --[no-]range                       Specify black level and
> range of luma and chroma signals. Default of %s\n",
> OPT(param->bEnableVideoFullRangeFlag));
> +    H0("   --colorprim <string>          Specify color primaries from
> undef, bt709, bt470m, bt470bg, smpte170m,\n");
> +    H0("                                 smpte240m, film, bt2020. Default
> of undef\n");
> +    H0("   --transfer <string>           Specify transfer characteristics
> from undef, bt709, bt470m, bt470bg, smpte170m,\n");
> +    H0("                                 smpte240m, linear, log100,
> log316, iec61966-2-4, bt1361e, iec61966-2-1,\n");
> +    H0("                                 bt2020-10, bt2020-12. Default of
> undef\n");
> +    H0("   --colormatrix <string>        Specify color matrix setting
> from undef, bt709, fcc, bt470bg, smpte170m,\n");
> +    H0("                                 smpte240m, GBR, YCgCo, bt2020nc,
> bt2020c\n");
> +    H0("   --chromaloc <integer>         Specify chroma sample location
> (0 to 5). Default of %d\n",param->chromaSampleLocTypeTopField);
> +    H0("   --[no-]fieldseq               Specify that pictures are fields
> and an SEI timing message\n");
> +    H0("                                 will be added to every access
> unit. Default %s\n", OPT(param->bEnableFieldSeqFlag));
> +    H0("   --[no-]framefieldinfo         Specify that a pic-struct will
> be added to the SEI timing message. Default %s\n",
> OPT(param->bEnableFrameFieldInfoPresentFlag));
> +    H0("   --crop-rect <string>          Add 'left,top,right,bottom' to
> the bitstream-level cropping rectangle\n");
> +    H0("   --timinginfo                  Add timing information to the
> VUI. Defaut %s\n", OPT(param->bEnableVuiTimingInfoPresentFlag));
> +    H0("   --nal-hrd                     Signal HRD information. Default
> %s\n", OPT(param->bEnableVuiHrdParametersPresentFlag));
> +    H0("   --bitstreamrestriction        Add bit stream restriction
> fields to the VUI. Default %s\n",
> OPT(param->bEnableBitstreamRestrictionFlag));
> +    H0("   --subpichrd                   Add sub picture HRD parameters
> to the HRD. Default %s\n", OPT(param->bEnableSubPicHrdParamsPresentFlag));
>

nicely done


>  #undef OPT
>  #undef H0
>      exit(0);
> diff -r 1c78bd13a14f -r 8ef0c1405487 source/x265.h
> --- a/source/x265.h     Wed Feb 19 09:46:46 2014 -0800
> +++ b/source/x265.h     Wed Feb 19 10:00:22 2014 -0800
> @@ -332,6 +332,147 @@
>       * types are MD5(1), CRC(2), Checksum(3).  Default is 0, none */
>      int       decodedPictureHashSEI;
>

I think these parameters should go within a vui sub-struct, similar to the
rc sub-struct.

Excellent job documenting them all.


>
> +    /*== Video Usability Information ==*/
> +
> +    /* Enable the generation of a VUI with all fields in the SPS.  VUI
> fields
> +     * that are not specified on the command line will have default
> values. */
> +    int       bEnableVuiParametersPresentFlag;
> +
> +    /* Enable aspect ratio in VUI.  Causes the aspect_ratio_idc to be
> added
> +     * to the VUI.  The default is false. */
> +    int bEnableAspectRatioIdc;
> +
> +    /* Aspect ratio idc to be added to the VUI.  The default is 0
> indicating
> +     * the apsect ratio is unspecified.  If set to EXTENDED_SAR(255) then
> +     * sarWidth and sarHeight must also be set. */
> +    int       aspectRatioIdc;
> +
> +    /* Sample Aspect Ratio width in arbitrary units to be added to the VUI
> +     * only if aspectRatioIdc is set to EXTENDED_SAR(255).  This is the
> width
> +     * of an individual pixel.  If this is set then sarHeight must also
> be set.
> +     */
> +    int       sarWidth;
> +
> +    /* Sample Aspect Ratio height in arbitrary units to be added to the
> VUI.
> +     * only if aspectRatioIdc is set to EXTENDED_SAR(255).  This is the
> width
> +     * of an individual pixel.  If this is set then sarWidth must also be
> set.
> +     */
> +    int       sarHeight;
> +
> +    /* Enable overscan info present flag in the VUI.  If this is set then
> +     * bEnabledOverscanAppropriateFlag will be added to the VUI. The
> default
> +     * is false. */
> +    int       bEnableOverscanInfoPresentFlag;
> +
> +    /* Enable overscan appropriate flag.  The status of this flag is
> added to
> +     * the VUI only if bEnableOverscanInfoPresentFlag is set.  If this
> flag is
> +     * set then cropped decoded pictures may be output for display. The
> default
> +     * is false. */
> +    int       bEnableOverscanAppropriateFlag;
> +
> +    /* Video signal type present flag of the VUI.  If this is set then
> +     * videoFormat, bEnableVideoFullRangeFlag and
> +     * bEnableColorDescriptionPresentFlag will be added to the VUI.  The
> default
> +     * is false. */
> +    int       bEnableVideoSignalTypePresentFlag;
> +
> +    /* Video format of the source video.  0 = component, 1 = PAL, 2 =
> NTSC,
> +     * 3 = SECAM, 4 = MAC, 5 = unspecified video format is the default. */
> +    int       videoFormat;
> +
> +    /* Video full range flag indicates the black level and range of the
> luma
> +     * and chroma signals as derived from E′Y, E′PB, and E′PR or E′R,
> E′G, and
> +     * E′B real-valued component signals.  False is the default. */
> +    int       bEnableVideoFullRangeFlag;
> +
> +    /* Color description present flag in the VUI.  If this is set then
> +     * color_primaries, transfer_characteristics and matrix_coeffs are to
> be added
> +     * to the VUI.  The default is false. */
> +    int       bEnableColorDescriptionPresentFlag;
> +
> +    /* Color primaries holds the chromacity coordinates of the source
> primaries.
> +     * The default is 2. */
> +    int       colorPrimaries;
> +
> +    /* Transfer characteristics indicates the opto-electronic transfer
> characteristic
> +     * of the source picture.  The default is 2. */
> +    int       transferCharacteristics;
> +
> +    /* Matrix coefficients used to derive the luma and chroma signals
> from the red,
> +     * blue and green primaries.  The default is 2. */
> +    int       matrixCoeffs;
> +
> +    /* Chroma location info present flag adds
> chroma_sample_loc_type_top_field and
> +     * chroma_sample_loc_type_bottom_field to the VUI.  The default is
> false. */
> +    int       bEnableChromaLocInfoPresentFlag;
> +
> +    /* Chroma sample location type top field holds the chroma location in
> the top
> +     * field.  The default is 0. */
> +    int       chromaSampleLocTypeTopField;
> +
> +    /* Chroma sample location type bottom field holds the chroma location
> in the bottom
> +     * field.  The default is 0. */
> +    int       chromaSampleLocTypeBottomField;
> +
> +    /* Field seq flag specifies that the pictures are fields and each one
> has a
> +     * timing SEI message.  The default is false */
> +    int       bEnableFieldSeqFlag;
> +
> +    /* Frame field info present flag indicates that each picture has a
> timing SEI
> +     * message wich includes a pic_struct, source_scan_type and
> duplicate_flag
> +     * elements.  If not set then the pic_struct element is not included.
>  The
> +     * default is false. */
> +    int       bEnableFrameFieldInfoPresentFlag;
> +
> +    /* Default display window flag adds def_disp_win_left_offset ,
> +     * def_disp_win_right_offset, def_disp_win_top_offset and
> +     * def_disp_win_bottom_offset to the VUI.  The default is false. */
> +    int       bEnableDefaultDisplayWindowFlag;
> +
> +    /* Default display window left offset holds the left offset with the
> +     * conformance cropping window to further crop the displayed window.
> */
> +    int       defDispWinLeftOffset;
> +
> +    /* Default display window right offset holds the right offset with the
> +     * conformance cropping window to further crop the displayed window.
> */
> +    int       defDispWinRightOffset;
> +
> +    /* Default display window top offset holds the top offset with the
> +     * conformance cropping window to further crop the displayed window.
> */
> +    int       defDispWinTopOffset;
> +
> +    /* Default display window bottom offset holds the bottom offset with
> the
> +     * conformance cropping window to further crop the displayed window.
> */
> +    int       defDispWinBottomOffset;
> +
> +    /* VUI timing info present flag adds vui_num_units_in_tick,
> vui_time_scale,
> +     * vui_poc_proportional_to_timing_flag and
> vui_hrd_parameters_present_flag
> +     * to the VUI.  vui_num_units_in_tick, vui_time_scale and
> +     * vui_poc_proportional_to_timing_flag are derived from processing
> the input
> +     * video.  The default is false. */
> +    int       bEnableVuiTimingInfoPresentFlag;
> +
> +    /* VUI hrd parameters present flag adds the HRD to the VUI */
> +    int       bEnableVuiHrdParametersPresentFlag;
> +
> +    /* Bitstream restriction flag adds tiles_fixed_structure_flag,
> +     * motion_vectors_over_pic_boundaries_flag,
> restricted_ref_pic_lists_flag,
> +     * min_spatial_segmentation_idc, max_bytes_per_pic_denom,
> +     * max_bit_per_min_cu_denom, log2_max_mv_length_horizontal and
> +     * log2_max_mv_length_vertical to the VUI. All values are derived from
> +     * processing the input video.  The default is false.  */
> +    int       bEnableBitstreamRestrictionFlag;
> +
> +    /*== Hypothetical Reference Decoder Parameters ==*/
> +
> +    /* Sub pic HRD params present flag determines if tic_divisor_minus2,
> +     * du_cpb_removal_delay_increment_length_minus1,
> +     * sub_pic_cpb_params_in_pic_timing_sei_flag,
> +     * dpb_output_delay_du_length_minus1 and cpb_size_du_scale
> +     * are added to the HRD.  All are derived from processing the input
> video.
> +     * The default is false. */
> +    int       bEnableSubPicHrdParamsPresentFlag;
> +
>      /*== Internal Picture Specification ==*/
>
>      /* Internal encoder bit depth. If x265 was compiled to use 8bit pixels
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>



-- 
Steve Borho
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20140220/0c0813fc/attachment-0001.html>


More information about the x265-devel mailing list