Skip to content
Snippets Groups Projects
EncAppCfg.cpp 199 KiB
Newer Older
  • Learn to ignore specific revisions
  •   ("SelectiveRDOQ",                                   m_useSelectiveRDOQ,                               false, "Enable selective RDOQ")
    #endif
      ("RDpenalty",                                       m_rdPenalty,                                          0, "RD-penalty for 32x32 TU for intra in non-intra slices. 0:disabled  1:RD-penalty  2:maximum RD-penalty")
    
      // Deblocking filter parameters
      ("LoopFilterDisable",                               m_bLoopFilterDisable,                             false)
      ("LoopFilterOffsetInPPS",                           m_loopFilterOffsetInPPS,                           true)
      ("LoopFilterBetaOffset_div2",                       m_loopFilterBetaOffsetDiv2,                           0)
      ("LoopFilterTcOffset_div2",                         m_loopFilterTcOffsetDiv2,                             0)
    #if W0038_DB_OPT
      ("DeblockingFilterMetric",                          m_deblockingFilterMetric,                             0)
    #else
      ("DeblockingFilterMetric",                          m_DeblockingFilterMetric,                         false)
    #endif
      // Coding tools
      ("CrossComponentPrediction",                        m_crossComponentPredictionEnabledFlag,            false, "Enable the use of cross-component prediction (not valid in V1 profiles)")
      ("ReconBasedCrossCPredictionEstimate",              m_reconBasedCrossCPredictionEstimate,             false, "When determining the alpha value for cross-component prediction, use the decoded residual rather than the pre-transform encoder-side residual")
      ("SaoLumaOffsetBitShift",                           saoOffsetBitShift[CHANNEL_TYPE_LUMA],                 0, "Specify the luma SAO bit-shift. If negative, automatically calculate a suitable value based upon bit depth and initial QP")
      ("SaoChromaOffsetBitShift",                         saoOffsetBitShift[CHANNEL_TYPE_CHROMA],               0, "Specify the chroma SAO bit-shift. If negative, automatically calculate a suitable value based upon bit depth and initial QP")
      ("TransformSkip",                                   m_useTransformSkip,                               false, "Intra transform skipping")
    
    Tung Nguyen's avatar
    Tung Nguyen committed
      ("TransformSkipFast",                               m_useTransformSkipFast,                           false, "Fast encoder search for transform skipping, winner takes it all mode.")
      ("TransformSkipLog2MaxSize",                        m_log2MaxTransformSkipBlockSize,                     5U, "Specify transform-skip maximum size. Minimum 2, Maximum 5. (not valid in V1 profiles)")
    
      ("ISPFast",                                         m_useFastISP,                                     false, "Fast encoder search for ISP")
    
      ("ImplicitResidualDPCM",                            m_rdpcmEnabledFlag[RDPCM_SIGNAL_IMPLICIT],        false, "Enable implicitly signalled residual DPCM for intra (also known as sample-adaptive intra predict) (not valid in V1 profiles)")
      ("ExplicitResidualDPCM",                            m_rdpcmEnabledFlag[RDPCM_SIGNAL_EXPLICIT],        false, "Enable explicitly signalled residual DPCM for inter (not valid in V1 profiles)")
      ("ResidualRotation",                                m_transformSkipRotationEnabledFlag,               false, "Enable rotation of transform-skipped and transquant-bypassed TUs through 180 degrees prior to entropy coding (not valid in V1 profiles)")
      ("SingleSignificanceMapContext",                    m_transformSkipContextEnabledFlag,                false, "Enable, for transform-skipped and transquant-bypassed TUs, the selection of a single significance map context variable for all coefficients (not valid in V1 profiles)")
      ("GolombRiceParameterAdaptation",                   m_persistentRiceAdaptationEnabledFlag,            false, "Enable the adaptation of the Golomb-Rice parameter over the course of each slice")
      ("AlignCABACBeforeBypass",                          m_cabacBypassAlignmentEnabledFlag,                false, "Align the CABAC engine to a defined fraction of a bit prior to coding bypass data. Must be 1 in high bit rate profile, 0 otherwise")
      ("SAO",                                             m_bUseSAO,                                         true, "Enable Sample Adaptive Offset")
      ("TestSAODisableAtPictureLevel",                    m_bTestSAODisableAtPictureLevel,                  false, "Enables the testing of disabling SAO at the picture level after having analysed all blocks")
      ("SaoEncodingRate",                                 m_saoEncodingRate,                                 0.75, "When >0 SAO early picture termination is enabled for luma and chroma")
      ("SaoEncodingRateChroma",                           m_saoEncodingRateChroma,                            0.5, "The SAO early picture termination rate to use for chroma (when m_SaoEncodingRate is >0). If <=0, use results for luma")
      ("MaxNumOffsetsPerPic",                             m_maxNumOffsetsPerPic,                             2048, "Max number of SAO offset per picture (Default: 2048)")
      ("SAOLcuBoundary",                                  m_saoCtuBoundary,                                 false, "0: right/bottom CTU boundary areas skipped from SAO parameter estimation, 1: non-deblocked pixels are used for those areas")
    #if K0238_SAO_GREEDY_MERGE_ENCODING
      ("SAOGreedyEnc",                                    m_saoGreedyMergeEnc,                              false, "SAO greedy merge encoding algorithm")
    #endif
    #if HEVC_TILES_WPP
      ("SliceMode",                                       tmpSliceMode,                            int(NO_SLICES), "0: Disable all Recon slice limits, 1: Enforce max # of CTUs, 2: Enforce max # of bytes, 3:specify tiles per dependent slice")
      ("SliceArgument",                                   m_sliceArgument,                                      0, "Depending on SliceMode being:"
                                                                                                                   "\t1: max number of CTUs per slice"
                                                                                                                   "\t2: max number of bytes per slice"
                                                                                                                   "\t3: max number of tiles per slice")
    #else
      ("SliceMode",                                       tmpSliceMode,                            int(NO_SLICES), "0: Disable all Recon slice limits, 1: Enforce max # of CTUs, 2: Enforce max # of bytes)")
      ("SliceArgument",                                   m_sliceArgument,                                      0, "Depending on SliceMode being:"
                                                                                                                   "\t1: max number of CTUs per slice"
                                                                                                                   "\t2: max number of bytes per slice")
    #endif
    #if HEVC_DEPENDENT_SLICES
      ("SliceSegmentMode",                                tmpSliceSegmentMode,                     int(NO_SLICES), "0: Disable all slice segment limits, 1: Enforce max # of CTUs, 2: Enforce max # of bytes, 3:specify tiles per dependent slice")
      ("SliceSegmentArgument",                            m_sliceSegmentArgument,                               0, "Depending on SliceSegmentMode being:"
                                                                                                                   "\t1: max number of CTUs per slice segment"
                                                                                                                   "\t2: max number of bytes per slice segment"
                                                                                                                   "\t3: max number of tiles per slice segment")
    #endif
      ("LFCrossSliceBoundaryFlag",                        m_bLFCrossSliceBoundaryFlag,                       true)
    
      ("ConstrainedIntraPred",                            m_bUseConstrainedIntraPred,                       false, "Constrained Intra Prediction")
      ("FastUDIUseMPMEnabled",                            m_bFastUDIUseMPMEnabled,                           true, "If enabled, adapt intra direction search, accounting for MPM")
      ("FastMEForGenBLowDelayEnabled",                    m_bFastMEForGenBLowDelayEnabled,                   true, "If enabled use a fast ME for generalised B Low Delay slices")
      ("UseBLambdaForNonKeyLowDelayPictures",             m_bUseBLambdaForNonKeyLowDelayPictures,            true, "Enables use of B-Lambda for non-key low-delay pictures")
      ("PCMEnabledFlag",                                  m_usePCM,                                         false)
      ("PCMLog2MaxSize",                                  m_pcmLog2MaxSize,                                    5u)
      ("PCMLog2MinSize",                                  m_uiPCMLog2MinSize,                                  3u)
    
      ("PCMInputBitDepthFlag",                            m_bPCMInputBitDepthFlag,                           true)
      ("PCMFilterDisableFlag",                            m_bPCMFilterDisableFlag,                          false)
      ("IntraReferenceSmoothing",                         m_enableIntraReferenceSmoothing,                   true, "0: Disable use of intra reference smoothing (not valid in V1 profiles). 1: Enable use of intra reference smoothing (same as V1)")
      ("WeightedPredP,-wpP",                              m_useWeightedPred,                                false, "Use weighted prediction in P slices")
      ("WeightedPredB,-wpB",                              m_useWeightedBiPred,                              false, "Use weighted (bidirectional) prediction in B slices")
      ("WeightedPredMethod,-wpM",                         tmpWeightedPredictionMethod, int(WP_PER_PICTURE_WITH_SIMPLE_DC_COMBINED_COMPONENT), "Weighted prediction method")
      ("Log2ParallelMergeLevel",                          m_log2ParallelMergeLevel,                            2u, "Parallel merge estimation region")
    #if HEVC_TILES_WPP
        //deprecated copies of renamed tile parameters
      ("UniformSpacingIdc",                               m_tileUniformSpacingFlag,                         false,      "deprecated alias of TileUniformSpacing")
      ("ColumnWidthArray",                                cfg_ColumnWidth,                        cfg_ColumnWidth, "deprecated alias of TileColumnWidthArray")
      ("RowHeightArray",                                  cfg_RowHeight,                            cfg_RowHeight, "deprecated alias of TileRowHeightArray")
    
      ("TileUniformSpacing",                              m_tileUniformSpacingFlag,                         false,      "Indicates that tile columns and rows are distributed uniformly")
      ("NumTileColumnsMinus1",                            m_numTileColumnsMinus1,                               0,          "Number of tile columns in a picture minus 1")
      ("NumTileRowsMinus1",                               m_numTileRowsMinus1,                                  0,          "Number of rows in a picture minus 1")
      ("TileColumnWidthArray",                            cfg_ColumnWidth,                        cfg_ColumnWidth, "Array containing tile column width values in units of CTU")
      ("TileRowHeightArray",                              cfg_RowHeight,                            cfg_RowHeight, "Array containing tile row height values in units of CTU")
      ("LFCrossTileBoundaryFlag",                         m_bLFCrossTileBoundaryFlag,                        true, "1: cross-tile-boundary loop filtering. 0:non-cross-tile-boundary loop filtering")
      ("WaveFrontSynchro",                                m_entropyCodingSyncEnabledFlag,                   false, "0: entropy coding sync disabled; 1 entropy coding sync enabled")
    #endif
    #if HEVC_USE_SCALING_LISTS
      ("ScalingList",                                     m_useScalingListId,                    SCALING_LIST_OFF, "0/off: no scaling list, 1/default: default scaling lists, 2/file: scaling lists specified in ScalingListFile")
      ("ScalingListFile",                                 m_scalingListFileName,                       string(""), "Scaling list file name. Use an empty string to produce help.")
    #endif
      ("DepQuant",                                        m_depQuantEnabledFlag,                                          true )
    #if HEVC_USE_SIGN_HIDING
      ("SignHideFlag,-SBH",                               m_signDataHidingEnabledFlag,                                    false )
    #endif
      ("MaxNumMergeCand",                                 m_maxNumMergeCand,                                   5u, "Maximum number of merge candidates")
    
      ("MaxNumAffineMergeCand",                           m_maxNumAffineMergeCand,                             5u, "Maximum number of affine merge candidates")
    
      /* Misc. */
      ("SEIDecodedPictureHash,-dph",                      tmpDecodedPictureHashSEIMappedType,                   0, "Control generation of decode picture hash SEI messages\n"
                                                                                                                   "\t3: checksum\n"
                                                                                                                   "\t2: CRC\n"
                                                                                                                   "\t1: use MD5\n"
                                                                                                                   "\t0: disable")
      ("TMVPMode",                                        m_TMVPModeId,                                         1, "TMVP mode 0: TMVP disable for all slices. 1: TMVP enable for all slices (default) 2: TMVP enable for certain slices only")
      ("FEN",                                             tmpFastInterSearchMode,   int(FASTINTERSEARCH_DISABLED), "fast encoder setting")
      ("ECU",                                             m_bUseEarlyCU,                                    false, "Early CU setting")
      ("FDM",                                             m_useFastDecisionForMerge,                         true, "Fast decision for Merge RD Cost")
      ("CFM",                                             m_bUseCbfFastMode,                                false, "Cbf fast mode setting")
      ("ESD",                                             m_useEarlySkipDetection,                          false, "Early SKIP detection setting")
      ( "RateControl",                                    m_RCEnableRateControl,                            false, "Rate control: enable rate control" )
      ( "TargetBitrate",                                  m_RCTargetBitrate,                                    0, "Rate control: target bit-rate" )
      ( "KeepHierarchicalBit",                            m_RCKeepHierarchicalBit,                              0, "Rate control: 0: equal bit allocation; 1: fixed ratio bit allocation; 2: adaptive ratio bit allocation" )
      ( "LCULevelRateControl",                            m_RCLCULevelRC,                                    true, "Rate control: true: CTU level RC; false: picture level RC" )
      ( "RCLCUSeparateModel",                             m_RCUseLCUSeparateModel,                           true, "Rate control: use CTU level separate R-lambda model" )
      ( "InitialQP",                                      m_RCInitialQP,                                        0, "Rate control: initial QP" )
      ( "RCForceIntraQP",                                 m_RCForceIntraQP,                                 false, "Rate control: force intra QP to be equal to initial QP" )
    #if U0132_TARGET_BITS_SATURATION
      ( "RCCpbSaturation",                                m_RCCpbSaturationEnabled,                         false, "Rate control: enable target bits saturation to avoid CPB overflow and underflow" )
      ( "RCCpbSize",                                      m_RCCpbSize,                                         0u, "Rate control: CPB size" )
      ( "RCInitialCpbFullness",                           m_RCInitialCpbFullness,                             0.9, "Rate control: initial CPB fullness" )
    #endif
      ("TransquantBypassEnable",                          m_TransquantBypassEnabledFlag,                    false, "transquant_bypass_enabled_flag indicator in PPS")
      ("TransquantBypassEnableFlag",                      m_TransquantBypassEnabledFlag,                    false, "deprecated and obsolete, but still needed for compatibility reasons")
      ("CUTransquantBypassFlagForce",                     m_CUTransquantBypassFlagForce,                    false, "Force transquant bypass mode, when transquant_bypass_enabled_flag is enabled")
      ("CostMode",                                        m_costMode,                         COST_STANDARD_LOSSY, "Use alternative cost functions: choose between 'lossy', 'sequence_level_lossless', 'lossless' (which forces QP to " MACRO_TO_STRING(LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP) ") and 'mixed_lossless_lossy' (which used QP'=" MACRO_TO_STRING(LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP_PRIME) " for pre-estimates of transquant-bypass blocks).")
      ("RecalculateQPAccordingToLambda",                  m_recalculateQPAccordingToLambda,                 false, "Recalculate QP values according to lambda values. Do not suggest to be enabled in all intra case")
    #if HEVC_USE_INTRA_SMOOTHING_T32 || HEVC_USE_INTRA_SMOOTHING_T64
      ("StrongIntraSmoothing,-sis",                       m_useStrongIntraSmoothing,                         true, "Enable strong intra smoothing for 32x32 blocks")
    #endif
      ("SEIActiveParameterSets",                          m_activeParameterSetsSEIEnabled,                      0, "Enable generation of active parameter sets SEI messages");
      opts.addOptions()
      ("VuiParametersPresent,-vui",                       m_vuiParametersPresentFlag,                       false, "Enable generation of vui_parameters()")
      ("AspectRatioInfoPresent",                          m_aspectRatioInfoPresentFlag,                     false, "Signals whether aspect_ratio_idc is present")
      ("AspectRatioIdc",                                  m_aspectRatioIdc,                                     0, "aspect_ratio_idc")
      ("SarWidth",                                        m_sarWidth,                                           0, "horizontal size of the sample aspect ratio")
      ("SarHeight",                                       m_sarHeight,                                          0, "vertical size of the sample aspect ratio")
      ("OverscanInfoPresent",                             m_overscanInfoPresentFlag,                        false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n")
      ("OverscanAppropriate",                             m_overscanAppropriateFlag,                        false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n")
      ("VideoSignalTypePresent",                          m_videoSignalTypePresentFlag,                     false, "Signals whether video_format, video_full_range_flag, and colour_description_present_flag are present")
      ("VideoFormat",                                     m_videoFormat,                                        5, "Indicates representation of pictures")
      ("VideoFullRange",                                  m_videoFullRangeFlag,                             false, "Indicates the black level and range of luma and chroma signals")
      ("ColourDescriptionPresent",                        m_colourDescriptionPresentFlag,                   false, "Signals whether colour_primaries, transfer_characteristics and matrix_coefficients are present")
      ("ColourPrimaries",                                 m_colourPrimaries,                                    2, "Indicates chromaticity coordinates of the source primaries")
      ("TransferCharacteristics",                         m_transferCharacteristics,                            2, "Indicates the opto-electronic transfer characteristics of the source")
      ("MatrixCoefficients",                              m_matrixCoefficients,                                 2, "Describes the matrix coefficients used in deriving luma and chroma from RGB primaries")
      ("ChromaLocInfoPresent",                            m_chromaLocInfoPresentFlag,                       false, "Signals whether chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field are present")
      ("ChromaSampleLocTypeTopField",                     m_chromaSampleLocTypeTopField,                        0, "Specifies the location of chroma samples for top field")
      ("ChromaSampleLocTypeBottomField",                  m_chromaSampleLocTypeBottomField,                     0, "Specifies the location of chroma samples for bottom field")
      ("NeutralChromaIndication",                         m_neutralChromaIndicationFlag,                    false, "Indicates that the value of all decoded chroma samples is equal to 1<<(BitDepthCr-1)")
      ("DefaultDisplayWindowFlag",                        m_defaultDisplayWindowFlag,                       false, "Indicates the presence of the Default Window parameters")
      ("DefDispWinLeftOffset",                            m_defDispWinLeftOffset,                               0, "Specifies the left offset of the default display window from the conformance window")
      ("DefDispWinRightOffset",                           m_defDispWinRightOffset,                              0, "Specifies the right offset of the default display window from the conformance window")
      ("DefDispWinTopOffset",                             m_defDispWinTopOffset,                                0, "Specifies the top offset of the default display window from the conformance window")
      ("DefDispWinBottomOffset",                          m_defDispWinBottomOffset,                             0, "Specifies the bottom offset of the default display window from the conformance window")
      ("FrameFieldInfoPresentFlag",                       m_frameFieldInfoPresentFlag,                      false, "Indicates that pic_struct and field coding related values are present in picture timing SEI messages")
      ("PocProportionalToTimingFlag",                     m_pocProportionalToTimingFlag,                    false, "Indicates that the POC value is proportional to the output time w.r.t. first picture in CVS")
      ("NumTicksPocDiffOneMinus1",                        m_numTicksPocDiffOneMinus1,                           0, "Number of ticks minus 1 that for a POC difference of one")
      ("BitstreamRestriction",                            m_bitstreamRestrictionFlag,                       false, "Signals whether bitstream restriction parameters are present")
    #if HEVC_TILES_WPP
      ("TilesFixedStructure",                             m_tilesFixedStructureFlag,                        false, "Indicates that each active picture parameter set has the same values of the syntax elements related to tiles")
    #endif
      ("MotionVectorsOverPicBoundaries",                  m_motionVectorsOverPicBoundariesFlag,             false, "Indicates that no samples outside the picture boundaries are used for inter prediction")
      ("MaxBytesPerPicDenom",                             m_maxBytesPerPicDenom,                                2, "Indicates a number of bytes not exceeded by the sum of the sizes of the VCL NAL units associated with any coded picture")
      ("MaxBitsPerMinCuDenom",                            m_maxBitsPerMinCuDenom,                               1, "Indicates an upper bound for the number of bits of coding_unit() data")
      ("Log2MaxMvLengthHorizontal",                       m_log2MaxMvLengthHorizontal,                         15, "Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units")
      ("Log2MaxMvLengthVertical",                         m_log2MaxMvLengthVertical,                           15, "Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units");
      opts.addOptions()
      ("SEIColourRemappingInfoFileRoot,-cri",             m_colourRemapSEIFileRoot,                    string(""), "Colour Remapping Information SEI parameters root file name (wo num ext)")
      ("SEIRecoveryPoint",                                m_recoveryPointSEIEnabled,                        false, "Control generation of recovery point SEI messages")
      ("SEIBufferingPeriod",                              m_bufferingPeriodSEIEnabled,                      false, "Control generation of buffering period SEI messages")
      ("SEIPictureTiming",                                m_pictureTimingSEIEnabled,                        false, "Control generation of picture timing SEI messages")
      ("SEIToneMappingInfo",                              m_toneMappingInfoSEIEnabled,                      false, "Control generation of Tone Mapping SEI messages")
      ("SEIToneMapId",                                    m_toneMapId,                                          0, "Specifies Id of Tone Mapping SEI message for a given session")
      ("SEIToneMapCancelFlag",                            m_toneMapCancelFlag,                              false, "Indicates that Tone Mapping SEI message cancels the persistence or follows")
      ("SEIToneMapPersistenceFlag",                       m_toneMapPersistenceFlag,                          true, "Specifies the persistence of the Tone Mapping SEI message")
      ("SEIToneMapCodedDataBitDepth",                     m_toneMapCodedDataBitDepth,                           8, "Specifies Coded Data BitDepth of Tone Mapping SEI messages")
      ("SEIToneMapTargetBitDepth",                        m_toneMapTargetBitDepth,                              8, "Specifies Output BitDepth of Tone mapping function")
      ("SEIToneMapModelId",                               m_toneMapModelId,                                     0, "Specifies Model utilized for mapping coded data into target_bit_depth range\n"
                                                                                                                   "\t0:  linear mapping with clipping\n"
                                                                                                                   "\t1:  sigmoidal mapping\n"
                                                                                                                   "\t2:  user-defined table mapping\n"
                                                                                                                   "\t3:  piece-wise linear mapping\n"
                                                                                                                   "\t4:  luminance dynamic range information ")
      ("SEIToneMapMinValue",                              m_toneMapMinValue,                                    0, "Specifies the minimum value in mode 0")
      ("SEIToneMapMaxValue",                              m_toneMapMaxValue,                                 1023, "Specifies the maximum value in mode 0")
      ("SEIToneMapSigmoidMidpoint",                       m_sigmoidMidpoint,                                  512, "Specifies the centre point in mode 1")
      ("SEIToneMapSigmoidWidth",                          m_sigmoidWidth,                                     960, "Specifies the distance between 5% and 95% values of the target_bit_depth in mode 1")
      ("SEIToneMapStartOfCodedInterval",                  cfg_startOfCodedInterval,      cfg_startOfCodedInterval, "Array of user-defined mapping table")
      ("SEIToneMapNumPivots",                             m_numPivots,                                          0, "Specifies the number of pivot points in mode 3")
      ("SEIToneMapCodedPivotValue",                       cfg_codedPivotValue,                cfg_codedPivotValue, "Array of pivot point")
      ("SEIToneMapTargetPivotValue",                      cfg_targetPivotValue,              cfg_targetPivotValue, "Array of pivot point")
      ("SEIToneMapCameraIsoSpeedIdc",                     m_cameraIsoSpeedIdc,                                  0, "Indicates the camera ISO speed for daylight illumination")
      ("SEIToneMapCameraIsoSpeedValue",                   m_cameraIsoSpeedValue,                              400, "Specifies the camera ISO speed for daylight illumination of Extended_ISO")
      ("SEIToneMapExposureIndexIdc",                      m_exposureIndexIdc,                                   0, "Indicates the exposure index setting of the camera")
      ("SEIToneMapExposureIndexValue",                    m_exposureIndexValue,                               400, "Specifies the exposure index setting of the camera of Extended_ISO")
      ("SEIToneMapExposureCompensationValueSignFlag",     m_exposureCompensationValueSignFlag,               false, "Specifies the sign of ExposureCompensationValue")
      ("SEIToneMapExposureCompensationValueNumerator",    m_exposureCompensationValueNumerator,                 0, "Specifies the numerator of ExposureCompensationValue")
      ("SEIToneMapExposureCompensationValueDenomIdc",     m_exposureCompensationValueDenomIdc,                  2, "Specifies the denominator of ExposureCompensationValue")
      ("SEIToneMapRefScreenLuminanceWhite",               m_refScreenLuminanceWhite,                          350, "Specifies reference screen brightness setting in units of candela per square metre")
      ("SEIToneMapExtendedRangeWhiteLevel",               m_extendedRangeWhiteLevel,                          800, "Indicates the luminance dynamic range")
      ("SEIToneMapNominalBlackLevelLumaCodeValue",        m_nominalBlackLevelLumaCodeValue,                    16, "Specifies luma sample value of the nominal black level assigned decoded pictures")
      ("SEIToneMapNominalWhiteLevelLumaCodeValue",        m_nominalWhiteLevelLumaCodeValue,                   235, "Specifies luma sample value of the nominal white level assigned decoded pictures")
      ("SEIToneMapExtendedWhiteLevelLumaCodeValue",       m_extendedWhiteLevelLumaCodeValue,                  300, "Specifies luma sample value of the extended dynamic range assigned decoded pictures")
      ("SEIChromaResamplingFilterHint",                   m_chromaResamplingFilterSEIenabled,               false, "Control generation of the chroma sampling filter hint SEI message")
      ("SEIChromaResamplingHorizontalFilterType",         m_chromaResamplingHorFilterIdc,                       2, "Defines the Index of the chroma sampling horizontal filter\n"
                                                                                                                   "\t0: unspecified  - Chroma filter is unknown or is determined by the application"
                                                                                                                   "\t1: User-defined - Filter coefficients are specified in the chroma sampling filter hint SEI message"
                                                                                                                   "\t2: Standards-defined - ITU-T Rec. T.800 | ISO/IEC15444-1, 5/3 filter")
      ("SEIChromaResamplingVerticalFilterType",           m_chromaResamplingVerFilterIdc,                         2, "Defines the Index of the chroma sampling vertical filter\n"
                                                                                                                   "\t0: unspecified  - Chroma filter is unknown or is determined by the application"
                                                                                                                   "\t1: User-defined - Filter coefficients are specified in the chroma sampling filter hint SEI message"
                                                                                                                   "\t2: Standards-defined - ITU-T Rec. T.800 | ISO/IEC15444-1, 5/3 filter")
      ("SEIFramePacking",                                 m_framePackingSEIEnabled,                         false, "Control generation of frame packing SEI messages")
      ("SEIFramePackingType",                             m_framePackingSEIType,                                0, "Define frame packing arrangement\n"
                                                                                                                   "\t3: side by side - frames are displayed horizontally\n"
                                                                                                                   "\t4: top bottom - frames are displayed vertically\n"
                                                                                                                   "\t5: frame alternation - one frame is alternated with the other")
      ("SEIFramePackingId",                               m_framePackingSEIId,                                  0, "Id of frame packing SEI message for a given session")
      ("SEIFramePackingQuincunx",                         m_framePackingSEIQuincunx,                            0, "Indicate the presence of a Quincunx type video frame")
      ("SEIFramePackingInterpretation",                   m_framePackingSEIInterpretation,                      0, "Indicate the interpretation of the frame pair\n"
                                                                                                                   "\t0: unspecified\n"
                                                                                                                   "\t1: stereo pair, frame0 represents left view\n"
                                                                                                                   "\t2: stereo pair, frame0 represents right view")
      ("SEISegmentedRectFramePacking",                    m_segmentedRectFramePackingSEIEnabled,            false, "Controls generation of segmented rectangular frame packing SEI messages")
      ("SEISegmentedRectFramePackingCancel",              m_segmentedRectFramePackingSEICancel,             false, "If equal to 1, cancels the persistence of any previous SRFPA SEI message")
      ("SEISegmentedRectFramePackingType",                m_segmentedRectFramePackingSEIType,                   0, "Specifies the arrangement of the frames in the reconstructed picture")
      ("SEISegmentedRectFramePackingPersistence",         m_segmentedRectFramePackingSEIPersistence,        false, "If equal to 0, the SEI applies to the current frame only")
      ("SEIDisplayOrientation",                           m_displayOrientationSEIAngle,                         0, "Control generation of display orientation SEI messages\n"
                                                                                                                   "\tN: 0 < N < (2^16 - 1) enable display orientation SEI message with anticlockwise_rotation = N and display_orientation_repetition_period = 1\n"
                                                                                                                   "\t0: disable")
      ("SEITemporalLevel0Index",                          m_temporalLevel0IndexSEIEnabled,                  false, "Control generation of temporal level 0 index SEI messages")
      ("SEIGradualDecodingRefreshInfo",                   m_gradualDecodingRefreshInfoEnabled,              false, "Control generation of gradual decoding refresh information SEI message")
      ("SEINoDisplay",                                    m_noDisplaySEITLayer,                                 0, "Control generation of no display SEI message\n"
                                                                                                                   "\tN: 0 < N enable no display SEI message for temporal layer N or higher\n"
                                                                                                                   "\t0: disable")
      ("SEIDecodingUnitInfo",                             m_decodingUnitInfoSEIEnabled,                     false, "Control generation of decoding unit information SEI message.")
      ("SEISOPDescription",                               m_SOPDescriptionSEIEnabled,                       false, "Control generation of SOP description SEI messages")
      ("SEIScalableNesting",                              m_scalableNestingSEIEnabled,                      false, "Control generation of scalable nesting SEI messages")
    #if HEVC_TILES_WPP
      ("SEITempMotionConstrainedTileSets",                m_tmctsSEIEnabled,                                false, "Control generation of temporal motion constrained tile sets SEI message")
    #endif
      ("SEITimeCodeEnabled",                              m_timeCodeSEIEnabled,                             false, "Control generation of time code information SEI message")
      ("SEITimeCodeNumClockTs",                           m_timeCodeSEINumTs,                                   0, "Number of clock time sets [0..3]")
      ("SEITimeCodeTimeStampFlag",                        cfg_timeCodeSeiTimeStampFlag,          cfg_timeCodeSeiTimeStampFlag,         "Time stamp flag associated to each time set")
      ("SEITimeCodeFieldBasedFlag",                       cfg_timeCodeSeiNumUnitFieldBasedFlag,  cfg_timeCodeSeiNumUnitFieldBasedFlag, "Field based flag associated to each time set")
      ("SEITimeCodeCountingType",                         cfg_timeCodeSeiCountingType,           cfg_timeCodeSeiCountingType,          "Counting type associated to each time set")
      ("SEITimeCodeFullTsFlag",                           cfg_timeCodeSeiFullTimeStampFlag,      cfg_timeCodeSeiFullTimeStampFlag,     "Full time stamp flag associated to each time set")
      ("SEITimeCodeDiscontinuityFlag",                    cfg_timeCodeSeiDiscontinuityFlag,      cfg_timeCodeSeiDiscontinuityFlag,     "Discontinuity flag associated to each time set")
      ("SEITimeCodeCntDroppedFlag",                       cfg_timeCodeSeiCntDroppedFlag,         cfg_timeCodeSeiCntDroppedFlag,        "Counter dropped flag associated to each time set")
      ("SEITimeCodeNumFrames",                            cfg_timeCodeSeiNumberOfFrames,         cfg_timeCodeSeiNumberOfFrames,        "Number of frames associated to each time set")
      ("SEITimeCodeSecondsValue",                         cfg_timeCodeSeiSecondsValue,           cfg_timeCodeSeiSecondsValue,          "Seconds value for each time set")
      ("SEITimeCodeMinutesValue",                         cfg_timeCodeSeiMinutesValue,           cfg_timeCodeSeiMinutesValue,          "Minutes value for each time set")
      ("SEITimeCodeHoursValue",                           cfg_timeCodeSeiHoursValue,             cfg_timeCodeSeiHoursValue,            "Hours value for each time set")
      ("SEITimeCodeSecondsFlag",                          cfg_timeCodeSeiSecondsFlag,            cfg_timeCodeSeiSecondsFlag,           "Flag to signal seconds value presence in each time set")
      ("SEITimeCodeMinutesFlag",                          cfg_timeCodeSeiMinutesFlag,            cfg_timeCodeSeiMinutesFlag,           "Flag to signal minutes value presence in each time set")
      ("SEITimeCodeHoursFlag",                            cfg_timeCodeSeiHoursFlag,              cfg_timeCodeSeiHoursFlag,             "Flag to signal hours value presence in each time set")
      ("SEITimeCodeOffsetLength",                         cfg_timeCodeSeiTimeOffsetLength,       cfg_timeCodeSeiTimeOffsetLength,      "Time offset length associated to each time set")
      ("SEITimeCodeTimeOffset",                           cfg_timeCodeSeiTimeOffsetValue,        cfg_timeCodeSeiTimeOffsetValue,       "Time offset associated to each time set")
      ("SEIKneeFunctionInfo",                             m_kneeSEIEnabled,                                 false, "Control generation of Knee function SEI messages")
      ("SEIKneeFunctionId",                               m_kneeSEIId,                                          0, "Specifies Id of Knee function SEI message for a given session")
      ("SEIKneeFunctionCancelFlag",                       m_kneeSEICancelFlag,                              false, "Indicates that Knee function SEI message cancels the persistence or follows")
      ("SEIKneeFunctionPersistenceFlag",                  m_kneeSEIPersistenceFlag,                          true, "Specifies the persistence of the Knee function SEI message")
      ("SEIKneeFunctionInputDrange",                      m_kneeSEIInputDrange,                              1000, "Specifies the peak luminance level for the input picture of Knee function SEI messages")
      ("SEIKneeFunctionInputDispLuminance",               m_kneeSEIInputDispLuminance,                        100, "Specifies the expected display brightness for the input picture of Knee function SEI messages")
      ("SEIKneeFunctionOutputDrange",                     m_kneeSEIOutputDrange,                             4000, "Specifies the peak luminance level for the output picture of Knee function SEI messages")
      ("SEIKneeFunctionOutputDispLuminance",              m_kneeSEIOutputDispLuminance,                       800, "Specifies the expected display brightness for the output picture of Knee function SEI messages")
      ("SEIKneeFunctionNumKneePointsMinus1",              m_kneeSEINumKneePointsMinus1,                         2, "Specifies the number of knee points - 1")
      ("SEIKneeFunctionInputKneePointValue",              cfg_kneeSEIInputKneePointValue,   cfg_kneeSEIInputKneePointValue, "Array of input knee point")
      ("SEIKneeFunctionOutputKneePointValue",             cfg_kneeSEIOutputKneePointValue, cfg_kneeSEIOutputKneePointValue, "Array of output knee point")
      ("SEIMasteringDisplayColourVolume",                 m_masteringDisplay.colourVolumeSEIEnabled,         false, "Control generation of mastering display colour volume SEI messages")
      ("SEIMasteringDisplayMaxLuminance",                 m_masteringDisplay.maxLuminance,                  10000u, "Specifies the mastering display maximum luminance value in units of 1/10000 candela per square metre (32-bit code value)")
      ("SEIMasteringDisplayMinLuminance",                 m_masteringDisplay.minLuminance,                      0u, "Specifies the mastering display minimum luminance value in units of 1/10000 candela per square metre (32-bit code value)")
      ("SEIMasteringDisplayPrimaries",                    cfg_DisplayPrimariesCode,       cfg_DisplayPrimariesCode, "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)")
      ("SEIMasteringDisplayWhitePoint",                   cfg_DisplayWhitePointCode,     cfg_DisplayWhitePointCode, "Mastering display white point CIE xy coordinates in normalised increments of 1/50000 (e.g. 0.333 = 16667)")
    #if U0033_ALTERNATIVE_TRANSFER_CHARACTERISTICS_SEI
      ("SEIPreferredTransferCharacterisics",              m_preferredTransferCharacteristics,                   -1, "Value for the preferred_transfer_characteristics field of the Alternative transfer characteristics SEI which will override the corresponding entry in the VUI. If negative, do not produce the respective SEI message")
    #endif
      ("SEIGreenMetadataType",                            m_greenMetadataType,                                  0u, "Value for the green_metadata_type specifies the type of metadata that is present in the SEI message. If green_metadata_type is 1, then metadata enabling quality recovery after low-power encoding is present")
      ("SEIXSDMetricType",                                m_xsdMetricType,                                      0u, "Value for the xsd_metric_type indicates the type of the objective quality metric. PSNR is the only type currently supported")
    
    Valeri George's avatar
    Valeri George committed
      ("MCTSEncConstraint",                               m_MCTSEncConstraint,                               false, "For MCTS, constrain motion vectors at tile boundaries")
    
    #if ENABLE_TRACING
      ("TraceChannelsList",                               bTracingChannelsList,                              false, "List all available tracing channels")
      ("TraceRule",                                       sTracingRule,                               string( "" ), "Tracing rule (ex: \"D_CABAC:poc==8\" or \"D_REC_CB_LUMA:poc==8\")")
      ("TraceFile",                                       sTracingFile,                               string( "" ), "Tracing file")
    #endif
    
      ("DebugBitstream",                                  m_decodeBitstreams[0],             string( "" ), "Assume the frames up to POC DebugPOC will be the same as in this bitstream. Load those frames from the bitstream instead of encoding them." )
      ("DebugPOC",                                        m_switchPOC,                                 -1, "If DebugBitstream is present, load frames up to this POC from this bitstream. Starting with DebugPOC, return to normal encoding." )
      ("DecodeBitstream1",                                m_decodeBitstreams[0],             string( "" ), "Assume the frames up to POC DebugPOC will be the same as in this bitstream. Load those frames from the bitstream instead of encoding them." )
      ("DecodeBitstream2",                                m_decodeBitstreams[1],             string( "" ), "Assume the frames up to POC DebugPOC will be the same as in this bitstream. Load those frames from the bitstream instead of encoding them." )
      ("SwitchPOC",                                       m_switchPOC,                                 -1, "If DebugBitstream is present, load frames up to this POC from this bitstream. Starting with DebugPOC, return to normal encoding." )
      ("SwitchDQP",                                       m_switchDQP,                                  0, "delta QP applied to picture with switchPOC and subsequent pictures." )
      ("FastForwardToPOC",                                m_fastForwardToPOC,                          -1, "Get to encoding the specified POC as soon as possible by skipping temporal layers irrelevant for the specified POC." )
      ("StopAfterFFtoPOC",                                m_stopAfterFFtoPOC,                       false, "If using fast forward to POC, after the POC of interest has been hit, stop further encoding.")
      ("ForceDecodeBitstream1",                           m_forceDecodeBitstream1,                  false, "force decoding of bitstream 1 - use this only if you are realy sure about what you are doing ")
      ("DecodeBitstream2ModPOCAndType",                   m_bs2ModPOCAndType,                       false, "Modify POC and NALU-type of second input bitstream, to use second BS as closing I-slice")
      ("NumSplitThreads",                                 m_numSplitThreads,                            1, "Number of threads used to parallelize splitting")
      ("ForceSingleSplitThread",                          m_forceSplitSequential,                   false, "Force single thread execution even if taking the parallelized path")
      ("NumWppThreads",                                   m_numWppThreads,                              1, "Number of threads used to run WPP-style parallelization")
      ("NumWppExtraLines",                                m_numWppExtraLines,                           0, "Number of additional wpp lines to switch when threads are blocked")
    
    Tobias Hinz's avatar
    Tobias Hinz committed
      ("DebugCTU",                                        m_debugCTU,                                  -1, "If DebugBitstream is present, load frames up to this POC from this bitstream. Starting with DebugPOC-frame at CTUline containin debug CTU.")
    
    #if ENABLE_WPP_PARALLELISM
      ("EnsureWppBitEqual",                               m_ensureWppBitEqual,                       true, "Ensure the results are equal to results with WPP-style parallelism, even if WPP is off")
    #else
      ("EnsureWppBitEqual",                               m_ensureWppBitEqual,                      false, "Ensure the results are equal to results with WPP-style parallelism, even if WPP is off")
    #endif
      ( "ALF",                                             m_alf,                                    true, "Adpative Loop Filter\n" )
        ;
    
    #if EXTENSION_360_VIDEO
      TExt360AppEncCfg::TExt360AppEncCfgContext ext360CfgContext;
      m_ext360.addOptions(opts, ext360CfgContext);
    #endif
    
      for(int i=1; i<MAX_GOP+1; i++)
      {
        std::ostringstream cOSS;
        cOSS<<"Frame"<<i;
        opts.addOptions()(cOSS.str(), m_GOPList[i-1], GOPEntry());
      }
      po::setDefaults(opts);
      po::ErrorReporter err;
      const list<const char*>& argv_unhandled = po::scanArgv(opts, argc, (const char**) argv, err);
    
    
      if (m_compositeRefEnabled)
    
        for (int i = 0; i < m_iGOPSize; i++)
    
        {
          m_GOPList[i].m_POC *= 2;
          m_GOPList[i].m_deltaRPS *= 2;
    
          for (int j = 0; j < m_GOPList[i].m_numRefPics; j++)
    
      for (list<const char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++)
      {
        msg( ERROR, "Unhandled argument ignored: `%s'\n", *it);
      }
    
      if (argc == 1 || do_help)
      {
        /* argc == 1: no options have been specified */
        po::doHelp(cout, opts);
        return false;
      }
    
      if (err.is_errored)
      {
        if (!warnUnknowParameter)
        {
          /* error report has already been printed on stderr */
          return false;
        }
      }
    
      g_verbosity = MsgLevel( m_verbosity );
    
    
      /*
       * Set any derived parameters
       */
    #if EXTENSION_360_VIDEO
      m_inputFileWidth = m_iSourceWidth;
      m_inputFileHeight = m_iSourceHeight;
      m_ext360.setMaxCUInfo(m_uiCTUSize, 1 << MIN_CU_LOG2);
    #endif
    
      if (!inputPathPrefix.empty() && inputPathPrefix.back() != '/' && inputPathPrefix.back() != '\\' )
      {
        inputPathPrefix += "/";
      }
      m_inputFileName   = inputPathPrefix + m_inputFileName;
      m_framesToBeEncoded = ( m_framesToBeEncoded + m_temporalSubsampleRatio - 1 ) / m_temporalSubsampleRatio;
      m_adIntraLambdaModifier = cfg_adIntraLambdaModifier.values;
      if(m_isField)
      {
        //Frame height
        m_iSourceHeightOrg = m_iSourceHeight;
        //Field height
        m_iSourceHeight = m_iSourceHeight >> 1;
        //number of fields to encode
        m_framesToBeEncoded *= 2;
      }
    
    #if HEVC_TILES_WPP
      if( !m_tileUniformSpacingFlag && m_numTileColumnsMinus1 > 0 )
      {
        if (cfg_ColumnWidth.values.size() > m_numTileColumnsMinus1)
        {
          EXIT( "Error: The number of columns whose width are defined is larger than the allowed number of columns." );
        }
        else if (cfg_ColumnWidth.values.size() < m_numTileColumnsMinus1)
        {
          EXIT( "Error: The width of some columns is not defined." );
        }
        else
        {
          m_tileColumnWidth.resize(m_numTileColumnsMinus1);
          for(uint32_t i=0; i<cfg_ColumnWidth.values.size(); i++)
          {
            m_tileColumnWidth[i]=cfg_ColumnWidth.values[i];
          }
        }
      }
      else
      {
        m_tileColumnWidth.clear();
      }
    
      if( !m_tileUniformSpacingFlag && m_numTileRowsMinus1 > 0 )
      {
        if (cfg_RowHeight.values.size() > m_numTileRowsMinus1)
        {
          EXIT( "Error: The number of rows whose height are defined is larger than the allowed number of rows." );
        }
        else if (cfg_RowHeight.values.size() < m_numTileRowsMinus1)
        {
          EXIT( "Error: The height of some rows is not defined." );
        }
        else
        {
          m_tileRowHeight.resize(m_numTileRowsMinus1);
          for(uint32_t i=0; i<cfg_RowHeight.values.size(); i++)
          {
            m_tileRowHeight[i]=cfg_RowHeight.values[i];
          }
        }
      }
      else
      {
        m_tileRowHeight.clear();
      }
    #endif
    
      /* rules for input, output and internal bitdepths as per help text */
      if (m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ] == 0)
      {
        m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ] = m_inputBitDepth      [CHANNEL_TYPE_LUMA  ];
      }
      if (m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] == 0)
      {
        m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] = m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ];
      }
      if (m_internalBitDepth   [CHANNEL_TYPE_LUMA  ] == 0)
      {
        m_internalBitDepth   [CHANNEL_TYPE_LUMA  ] = m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ];
      }
      if (m_internalBitDepth   [CHANNEL_TYPE_CHROMA] == 0)
      {
        m_internalBitDepth   [CHANNEL_TYPE_CHROMA] = m_internalBitDepth   [CHANNEL_TYPE_LUMA  ];
      }
      if (m_inputBitDepth      [CHANNEL_TYPE_CHROMA] == 0)
      {
        m_inputBitDepth      [CHANNEL_TYPE_CHROMA] = m_inputBitDepth      [CHANNEL_TYPE_LUMA  ];
      }
      if (m_outputBitDepth     [CHANNEL_TYPE_LUMA  ] == 0)
      {
        m_outputBitDepth     [CHANNEL_TYPE_LUMA  ] = m_internalBitDepth   [CHANNEL_TYPE_LUMA  ];
      }
      if (m_outputBitDepth     [CHANNEL_TYPE_CHROMA] == 0)
      {
        m_outputBitDepth     [CHANNEL_TYPE_CHROMA] = m_outputBitDepth     [CHANNEL_TYPE_LUMA  ];
      }
    
      m_InputChromaFormatIDC = numberToChromaFormat(tmpInputChromaFormat);
      m_chromaFormatIDC      = ((tmpChromaFormat == 0) ? (m_InputChromaFormatIDC) : (numberToChromaFormat(tmpChromaFormat)));
    #if EXTENSION_360_VIDEO
      m_ext360.processOptions(ext360CfgContext);
    #endif
    
      CHECK( !( tmpWeightedPredictionMethod >= 0 && tmpWeightedPredictionMethod <= WP_PER_PICTURE_WITH_HISTOGRAM_AND_PER_COMPONENT_AND_CLIPPING_AND_EXTENSION ), "Error in cfg" );
      m_weightedPredictionMethod = WeightedPredictionMethod(tmpWeightedPredictionMethod);
    
      CHECK( tmpFastInterSearchMode<0 || tmpFastInterSearchMode>FASTINTERSEARCH_MODE3, "Error in cfg" );
      m_fastInterSearchMode = FastInterSearchMode(tmpFastInterSearchMode);
    
      CHECK( tmpMotionEstimationSearchMethod < 0 || tmpMotionEstimationSearchMethod >= MESEARCH_NUMBER_OF_METHODS, "Error in cfg" );
      m_motionEstimationSearchMethod=MESearchMethod(tmpMotionEstimationSearchMethod);
    
      if (extendedProfile >= 1000 && extendedProfile <= 12316)
      {
        m_profile = Profile::MAINREXT;
        if (m_bitDepthConstraint != 0 || tmpConstraintChromaFormat != 0)
        {
          EXIT( "Error: The bit depth and chroma format constraints are not used when an explicit RExt profile is specified");
        }
        m_bitDepthConstraint           = (extendedProfile%100);
        m_intraConstraintFlag          = ((extendedProfile%10000)>=2000);
        m_onePictureOnlyConstraintFlag = (extendedProfile >= 10000);
        switch ((extendedProfile/100)%10)
        {
          case 0:  tmpConstraintChromaFormat=400; break;
          case 1:  tmpConstraintChromaFormat=420; break;
          case 2:  tmpConstraintChromaFormat=422; break;
          default: tmpConstraintChromaFormat=444; break;
        }
      }
      else
      {
        m_profile = Profile::Name(extendedProfile);
      }
    
      if (m_profile == Profile::HIGHTHROUGHPUTREXT )
      {
        if (m_bitDepthConstraint == 0)
        {
          m_bitDepthConstraint = 16;
        }
        m_chromaFormatConstraint = (tmpConstraintChromaFormat == 0) ? CHROMA_444 : numberToChromaFormat(tmpConstraintChromaFormat);
      }
      else if (m_profile == Profile::MAINREXT)
      {
        if (m_bitDepthConstraint == 0 && tmpConstraintChromaFormat == 0)
        {
          // produce a valid combination, if possible.
          const bool bUsingGeneralRExtTools  = m_transformSkipRotationEnabledFlag        ||
                                               m_transformSkipContextEnabledFlag         ||
                                               m_rdpcmEnabledFlag[RDPCM_SIGNAL_IMPLICIT] ||
                                               m_rdpcmEnabledFlag[RDPCM_SIGNAL_EXPLICIT] ||
                                               !m_enableIntraReferenceSmoothing          ||
                                               m_persistentRiceAdaptationEnabledFlag     ||
                                               m_log2MaxTransformSkipBlockSize!=2;
    
          const bool bUsingChromaQPAdjustment= m_cuChromaQpOffsetSubdiv >= 0;
    
          const bool bUsingExtendedPrecision = m_extendedPrecisionProcessingFlag;
          if (m_onePictureOnlyConstraintFlag)
          {
            m_chromaFormatConstraint = CHROMA_444;
            if (m_intraConstraintFlag != true)
            {
              EXIT( "Error: Intra constraint flag must be true when one_picture_only_constraint_flag is true");
            }
            const int maxBitDepth = m_chromaFormatIDC==CHROMA_400 ? m_internalBitDepth[CHANNEL_TYPE_LUMA] : std::max(m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA]);
            m_bitDepthConstraint = maxBitDepth>8 ? 16:8;
          }
          else
          {
            m_chromaFormatConstraint = NUM_CHROMA_FORMAT;
            automaticallySelectRExtProfile(bUsingGeneralRExtTools,
                                           bUsingChromaQPAdjustment,
                                           bUsingExtendedPrecision,
                                           m_intraConstraintFlag,
                                           m_bitDepthConstraint,
                                           m_chromaFormatConstraint,
                                           m_chromaFormatIDC==CHROMA_400 ? m_internalBitDepth[CHANNEL_TYPE_LUMA] : std::max(m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA]),
                                           m_chromaFormatIDC);
          }
        }
        else if (m_bitDepthConstraint == 0 || tmpConstraintChromaFormat == 0)
        {
          EXIT( "Error: The bit depth and chroma format constraints must either both be specified or both be configured automatically");
        }
        else
        {
          m_chromaFormatConstraint = numberToChromaFormat(tmpConstraintChromaFormat);
        }
      }
      else
      {
        m_chromaFormatConstraint = (tmpConstraintChromaFormat == 0) ? m_chromaFormatIDC : numberToChromaFormat(tmpConstraintChromaFormat);
        m_bitDepthConstraint     = ( ( m_profile == Profile::MAIN10 || m_profile == Profile::NEXT ) ? 10 : 8 );
      }
    
    
      m_inputColourSpaceConvert = stringToInputColourSpaceConvert(inputColourSpaceConvert, true);
    
      switch (m_conformanceWindowMode)
      {
      case 0:
        {
          // no conformance or padding
          m_confWinLeft = m_confWinRight = m_confWinTop = m_confWinBottom = 0;
          m_aiPad[1] = m_aiPad[0] = 0;
          break;
        }
      case 1:
        {
          // automatic padding to minimum CU size
          int minCuSize = m_uiMaxCUHeight >> (m_uiMaxCUDepth - 1);
          if (m_iSourceWidth % minCuSize)
          {
            m_aiPad[0] = m_confWinRight  = ((m_iSourceWidth / minCuSize) + 1) * minCuSize - m_iSourceWidth;
            m_iSourceWidth  += m_confWinRight;
          }
          if (m_iSourceHeight % minCuSize)
          {
            m_aiPad[1] = m_confWinBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight;
            m_iSourceHeight += m_confWinBottom;
            if ( m_isField )
            {
              m_iSourceHeightOrg += m_confWinBottom << 1;
              m_aiPad[1] = m_confWinBottom << 1;
            }
          }
          if (m_aiPad[0] % SPS::getWinUnitX(m_chromaFormatIDC) != 0)
          {
            EXIT( "Error: picture width is not an integer multiple of the specified chroma subsampling");
          }
          if (m_aiPad[1] % SPS::getWinUnitY(m_chromaFormatIDC) != 0)
          {
            EXIT( "Error: picture height is not an integer multiple of the specified chroma subsampling");
          }
          break;
        }
      case 2:
        {
          //padding
          m_iSourceWidth  += m_aiPad[0];
          m_iSourceHeight += m_aiPad[1];
          m_confWinRight  = m_aiPad[0];
          m_confWinBottom = m_aiPad[1];
          break;
        }
      case 3:
        {
          // conformance
          if ((m_confWinLeft == 0) && (m_confWinRight == 0) && (m_confWinTop == 0) && (m_confWinBottom == 0))
          {
            msg( ERROR, "Warning: Conformance window enabled, but all conformance window parameters set to zero\n");
          }
          if ((m_aiPad[1] != 0) || (m_aiPad[0]!=0))
          {
            msg( ERROR, "Warning: Conformance window enabled, padding parameters will be ignored\n");
          }
          m_aiPad[1] = m_aiPad[0] = 0;
          break;
        }
      }
    
      if (tmpSliceMode<0 || tmpSliceMode>=int(NUMBER_OF_SLICE_CONSTRAINT_MODES))
      {
        EXIT( "Error: bad slice mode");
      }
      m_sliceMode = SliceConstraint(tmpSliceMode);
    
    #if HEVC_DEPENDENT_SLICES
      if (tmpSliceSegmentMode<0 || tmpSliceSegmentMode>=int(NUMBER_OF_SLICE_CONSTRAINT_MODES))
      {
        EXIT( "Error: bad slice segment mode");
      }
      m_sliceSegmentMode = SliceConstraint(tmpSliceSegmentMode);
    #endif
    
      if (tmpDecodedPictureHashSEIMappedType<0 || tmpDecodedPictureHashSEIMappedType>=int(NUMBER_OF_HASHTYPES))
      {
        EXIT( "Error: bad checksum mode");
      }
      // Need to map values to match those of the SEI message:
      if (tmpDecodedPictureHashSEIMappedType==0)
      {
        m_decodedPictureHashSEIType=HASHTYPE_NONE;
      }
      else
      {
        m_decodedPictureHashSEIType=HashType(tmpDecodedPictureHashSEIMappedType-1);
      }
    
      // allocate slice-based dQP values
      m_aidQP = new int[ m_framesToBeEncoded + m_iGOPSize + 1 ];
      ::memset( m_aidQP, 0, sizeof(int)*( m_framesToBeEncoded + m_iGOPSize + 1 ) );
    
    #if QP_SWITCHING_FOR_PARALLEL
      if (m_qpIncrementAtSourceFrame.bPresent)
      {
        uint32_t switchingPOC = 0;
        if (m_qpIncrementAtSourceFrame.value > m_FrameSkip)
        {
          // if switch source frame (ssf) = 10, and frame skip (fs)=2 and temporal subsample ratio (tsr) =1, then
          //    for this simulation switch at POC 8 (=10-2).
          // if ssf=10, fs=2, tsr=2, then for this simulation, switch at POC 4 (=(10-2)/2): POC0=Src2, POC1=Src4, POC2=Src6, POC3=Src8, POC4=Src10
          switchingPOC = (m_qpIncrementAtSourceFrame.value - m_FrameSkip) / m_temporalSubsampleRatio;
        }
        for (uint32_t i = switchingPOC; i<(m_framesToBeEncoded + m_iGOPSize + 1); i++)
        {
          m_aidQP[i] = 1;
        }
      }
    #else
      // handling of floating-point QP values
      // if QP is not integer, sequence is split into two sections having QP and QP+1
      m_iQP = (int)( m_fQP );
      if ( m_iQP < m_fQP )
      {
        int iSwitchPOC = (int)( m_framesToBeEncoded - (m_fQP - m_iQP)*m_framesToBeEncoded + 0.5 );
    
        iSwitchPOC = (int)( (double)iSwitchPOC / m_iGOPSize + 0.5 )*m_iGOPSize;
        for ( int i=iSwitchPOC; i<m_framesToBeEncoded + m_iGOPSize + 1; i++ )
        {
          m_aidQP[i] = 1;
        }
      }
    #endif
    
      for(uint32_t ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++)
      {
        if (saoOffsetBitShift[ch]<0)
        {
          if (m_internalBitDepth[ch]>10)
          {
            m_log2SaoOffsetScale[ch]=uint32_t(Clip3<int>(0, m_internalBitDepth[ch]-10, int(m_internalBitDepth[ch]-10 + 0.165*m_iQP - 3.22 + 0.5) ) );
          }
          else
          {
            m_log2SaoOffsetScale[ch]=0;
          }
        }
        else
        {
          m_log2SaoOffsetScale[ch]=uint32_t(saoOffsetBitShift[ch]);
        }
      }
    
    #if SHARP_LUMA_DELTA_QP
      CHECK( lumaLevelToDeltaQPMode >= LUMALVL_TO_DQP_NUM_MODES, "Error in cfg" );
    
      m_lumaLevelToDeltaQPMapping.mode=LumaLevelToDQPMode(lumaLevelToDeltaQPMode);
    
      if (m_lumaLevelToDeltaQPMapping.mode)
      {
        CHECK(  cfg_lumaLeveltoDQPMappingLuma.values.size() != cfg_lumaLeveltoDQPMappingQP.values.size(), "Error in cfg" );
        m_lumaLevelToDeltaQPMapping.mapping.resize(cfg_lumaLeveltoDQPMappingLuma.values.size());
        for(uint32_t i=0; i<cfg_lumaLeveltoDQPMappingLuma.values.size(); i++)
        {
          m_lumaLevelToDeltaQPMapping.mapping[i]=std::pair<int,int>(cfg_lumaLeveltoDQPMappingLuma.values[i], cfg_lumaLeveltoDQPMappingQP.values[i]);
        }
      }
    #endif
    
    
    #if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET
      if ( m_LadfEnabed )
      {
        CHECK( m_LadfNumIntervals != cfg_LadfQpOffset.values.size(), "size of LadfQpOffset must be equal to LadfNumIntervals");
        CHECK( m_LadfNumIntervals - 1 != cfg_LadfIntervalLowerBound.values.size(), "size of LadfIntervalLowerBound must be equal to LadfNumIntervals - 1");
        m_LadfQpOffset = cfg_LadfQpOffset.values;
        for (int k = 1; k < m_LadfNumIntervals; k++)
        {
          m_LadfIntervalLowerBound[k] = cfg_LadfIntervalLowerBound.values[k - 1];
        }
      }
    #endif
    
    
      // reading external dQP description from file
      if ( !m_dQPFileName.empty() )
      {
        FILE* fpt=fopen( m_dQPFileName.c_str(), "r" );
        if ( fpt )
        {
          int iValue;
          int iPOC = 0;
          while ( iPOC < m_framesToBeEncoded )
          {
            if ( fscanf(fpt, "%d", &iValue ) == EOF )
            {
              break;
            }
            m_aidQP[ iPOC ] = iValue;
            iPOC++;
          }
          fclose(fpt);
        }
      }
    
      if( m_masteringDisplay.colourVolumeSEIEnabled )
      {
        for(uint32_t idx=0; idx<6; idx++)
        {
          m_masteringDisplay.primaries[idx/2][idx%2] = uint16_t((cfg_DisplayPrimariesCode.values.size() > idx) ? cfg_DisplayPrimariesCode.values[idx] : 0);
        }
        for(uint32_t idx=0; idx<2; idx++)
        {
          m_masteringDisplay.whitePoint[idx] = uint16_t((cfg_DisplayWhitePointCode.values.size() > idx) ? cfg_DisplayWhitePointCode.values[idx] : 0);
        }
      }
    
      if( m_toneMappingInfoSEIEnabled && !m_toneMapCancelFlag )
      {
        if( m_toneMapModelId == 2 && !cfg_startOfCodedInterval.values.empty() )
        {
          const uint32_t num = 1u<< m_toneMapTargetBitDepth;
          m_startOfCodedInterval = new int[num];
          for(uint32_t i=0; i<num; i++)
          {
            m_startOfCodedInterval[i] = cfg_startOfCodedInterval.values.size() > i ? cfg_startOfCodedInterval.values[i] : 0;
          }
        }
        else
        {
          m_startOfCodedInterval = NULL;
        }
        if( ( m_toneMapModelId == 3 ) && ( m_numPivots > 0 ) )
        {
          if( !cfg_codedPivotValue.values.empty() && !cfg_targetPivotValue.values.empty() )
          {
            m_codedPivotValue  = new int[m_numPivots];
            m_targetPivotValue = new int[m_numPivots];
            for(uint32_t i=0; i<m_numPivots; i++)
            {
              m_codedPivotValue[i]  = cfg_codedPivotValue.values.size()  > i ? cfg_codedPivotValue.values [i] : 0;
              m_targetPivotValue[i] = cfg_targetPivotValue.values.size() > i ? cfg_targetPivotValue.values[i] : 0;
            }
          }
        }
        else
        {
          m_codedPivotValue = NULL;
          m_targetPivotValue = NULL;
        }
      }
    
      if( m_kneeSEIEnabled && !m_kneeSEICancelFlag )
      {
        CHECK(!( m_kneeSEINumKneePointsMinus1 >= 0 && m_kneeSEINumKneePointsMinus1 < 999 ), "Inconsistent config");
        m_kneeSEIInputKneePoint  = new int[m_kneeSEINumKneePointsMinus1+1];
        m_kneeSEIOutputKneePoint = new int[m_kneeSEINumKneePointsMinus1+1];
        for(int i=0; i<(m_kneeSEINumKneePointsMinus1+1); i++)
        {
          m_kneeSEIInputKneePoint[i]  = cfg_kneeSEIInputKneePointValue.values.size()  > i ? cfg_kneeSEIInputKneePointValue.values[i]  : 1;
          m_kneeSEIOutputKneePoint[i] = cfg_kneeSEIOutputKneePointValue.values.size() > i ? cfg_kneeSEIOutputKneePointValue.values[i] : 0;
        }
      }
    
      if(m_timeCodeSEIEnabled)
      {
        for(int i = 0; i < m_timeCodeSEINumTs && i < MAX_TIMECODE_SEI_SETS; i++)
        {
          m_timeSetArray[i].clockTimeStampFlag    = cfg_timeCodeSeiTimeStampFlag        .values.size()>i ? cfg_timeCodeSeiTimeStampFlag        .values [i] : false;
          m_timeSetArray[i].numUnitFieldBasedFlag = cfg_timeCodeSeiNumUnitFieldBasedFlag.values.size()>i ? cfg_timeCodeSeiNumUnitFieldBasedFlag.values [i] : 0;
          m_timeSetArray[i].countingType          = cfg_timeCodeSeiCountingType         .values.size()>i ? cfg_timeCodeSeiCountingType         .values [i] : 0;
          m_timeSetArray[i].fullTimeStampFlag     = cfg_timeCodeSeiFullTimeStampFlag    .values.size()>i ? cfg_timeCodeSeiFullTimeStampFlag    .values [i] : 0;
          m_timeSetArray[i].discontinuityFlag     = cfg_timeCodeSeiDiscontinuityFlag    .values.size()>i ? cfg_timeCodeSeiDiscontinuityFlag    .values [i] : 0;
          m_timeSetArray[i].cntDroppedFlag        = cfg_timeCodeSeiCntDroppedFlag       .values.size()>i ? cfg_timeCodeSeiCntDroppedFlag       .values [i] : 0;
          m_timeSetArray[i].numberOfFrames        = cfg_timeCodeSeiNumberOfFrames       .values.size()>i ? cfg_timeCodeSeiNumberOfFrames       .values [i] : 0;
          m_timeSetArray[i].secondsValue          = cfg_timeCodeSeiSecondsValue         .values.size()>i ? cfg_timeCodeSeiSecondsValue         .values [i] : 0;
          m_timeSetArray[i].minutesValue          = cfg_timeCodeSeiMinutesValue         .values.size()>i ? cfg_timeCodeSeiMinutesValue         .values [i] : 0;
          m_timeSetArray[i].hoursValue            = cfg_timeCodeSeiHoursValue           .values.size()>i ? cfg_timeCodeSeiHoursValue           .values [i] : 0;
          m_timeSetArray[i].secondsFlag           = cfg_timeCodeSeiSecondsFlag          .values.size()>i ? cfg_timeCodeSeiSecondsFlag          .values [i] : 0;
          m_timeSetArray[i].minutesFlag           = cfg_timeCodeSeiMinutesFlag          .values.size()>i ? cfg_timeCodeSeiMinutesFlag          .values [i] : 0;
          m_timeSetArray[i].hoursFlag             = cfg_timeCodeSeiHoursFlag            .values.size()>i ? cfg_timeCodeSeiHoursFlag            .values [i] : 0;
          m_timeSetArray[i].timeOffsetLength      = cfg_timeCodeSeiTimeOffsetLength     .values.size()>i ? cfg_timeCodeSeiTimeOffsetLength     .values [i] : 0;
          m_timeSetArray[i].timeOffsetValue       = cfg_timeCodeSeiTimeOffsetValue      .values.size()>i ? cfg_timeCodeSeiTimeOffsetValue      .values [i] : 0;
        }
      }
    
    
    Taoran Lu's avatar
    Taoran Lu committed
      m_reshapeCW.binCW.resize(3);
      m_reshapeCW.rspFps = m_iFrameRate;
      m_reshapeCW.rspIntraPeriod = m_iIntraPeriod;
      m_reshapeCW.rspPicSize = m_iSourceWidth*m_iSourceHeight;
    
    Taoran Lu's avatar
    Taoran Lu committed
      m_reshapeCW.rspFpsToIp = std::max(16, 16 * (int)(round((double)m_iFrameRate /16.0)));
    
    Taoran Lu's avatar
    Taoran Lu committed
      m_reshapeCW.rspBaseQP = m_iQP;
    
    #if ENABLE_TRACING
      g_trace_ctx = tracing_init(sTracingFile, sTracingRule);
      if( bTracingChannelsList && g_trace_ctx )
      {
        std::string sChannelsList;
        g_trace_ctx->getChannelsList( sChannelsList );
        msg( INFO, "\n Using tracing channels:\n\n%s\n", sChannelsList.c_str() );
      }
    #endif
    
    #if ENABLE_QPA
    
      if (m_bUsePerceptQPA && !m_bUseAdaptiveQP && m_dualTree && (m_cbQpOffsetDualTree != 0 || m_crQpOffsetDualTree != 0))
      {
        msg( WARNING, "*************************************************************************\n" );
        msg( WARNING, "* WARNING: chroma QPA on, ignoring nonzero dual-tree chroma QP offsets! *\n" );
        msg( WARNING, "*************************************************************************\n" );
      }
    
    
    #if ENABLE_QPA_SUB_CTU
     #if QP_SWITCHING_FOR_PARALLEL
    
      if ((m_iQP < 38) && m_bUsePerceptQPA && !m_bUseAdaptiveQP && (m_iSourceWidth <= 2048) && (m_iSourceHeight <= 1280)
    
      if (((int)m_fQP < 38) && m_bUsePerceptQPA && !m_bUseAdaptiveQP && (m_iSourceWidth <= 2048) && (m_iSourceHeight <= 1280)
    
    #if MAX_TB_SIZE_SIGNALLING
          && ((1 << (m_log2MaxTbSize + 1)) == m_uiCTUSize) && (m_iSourceWidth > 512 || m_iSourceHeight > 320))
    #else
        && ((1 << (MAX_TB_LOG2_SIZEY + 1)) == m_uiCTUSize) && (m_iSourceWidth > 512 || m_iSourceHeight > 320))
    #endif
    
        m_cuQpDeltaSubdiv = 2;
    
      if( ( m_iQP < 38 ) && ( m_iGOPSize > 4 ) && m_bUsePerceptQPA && !m_bUseAdaptiveQP && ( m_iSourceHeight <= 1280 ) && ( m_iSourceWidth <= 2048 ) )
    
      if( ( ( int ) m_fQP < 38 ) && ( m_iGOPSize > 4 ) && m_bUsePerceptQPA && !m_bUseAdaptiveQP && ( m_iSourceHeight <= 1280 ) && ( m_iSourceWidth <= 2048 ) )
    
        msg( WARNING, "*************************************************************************\n" );
        msg( WARNING, "* WARNING: QPA on with large CTU for <=HD sequences, limiting CTU size! *\n" );
        msg( WARNING, "*************************************************************************\n" );
    
    #if MAX_TB_SIZE_SIGNALLING
        if( ( 1u << m_log2MaxTbSize         ) > m_uiCTUSize ) m_log2MaxTbSize--;
    #endif
    
    Karsten Suehring's avatar
    Karsten Suehring committed
      const int minCuSize = 1 << MIN_CU_LOG2;
      m_uiMaxCodingDepth = 0;
      while( ( m_uiCTUSize >> m_uiMaxCodingDepth ) > minCuSize )
    
    Karsten Suehring's avatar
    Karsten Suehring committed
        m_uiMaxCodingDepth++;
      }
      m_uiLog2DiffMaxMinCodingBlockSize = m_uiMaxCodingDepth;
      m_uiMaxCUWidth = m_uiMaxCUHeight = m_uiCTUSize;
      m_uiMaxCUDepth = m_uiMaxCodingDepth;
    
    
      // check validity of input parameters
      if( xCheckParameter() )
      {
        // return check failed
        return false;
      }
    
      // print-out parameters
      xPrintParameter();
    
      return true;
    }
    
    
    // ====================================================================================================================
    // Private member functions
    // ====================================================================================================================
    
    bool EncAppCfg::xCheckParameter()
    {
      msg( NOTICE, "\n" );
      if (m_decodedPictureHashSEIType==HASHTYPE_NONE)
      {
        msg( DETAILS, "******************************************************************\n");
        msg( DETAILS, "** WARNING: --SEIDecodedPictureHash is now disabled by default. **\n");
        msg( DETAILS, "**          Automatic verification of decoded pictures by a     **\n");
        msg( DETAILS, "**          decoder requires this option to be enabled.         **\n");
        msg( DETAILS, "******************************************************************\n");
      }
      if( m_profile==Profile::NONE )
      {
        msg( DETAILS, "***************************************************************************\n");
        msg( DETAILS, "** WARNING: For conforming bitstreams a valid Profile value must be set! **\n");
        msg( DETAILS, "***************************************************************************\n");
      }
      if( m_level==Level::NONE )
      {
        msg( DETAILS, "***************************************************************************\n");
        msg( DETAILS, "** WARNING: For conforming bitstreams a valid Level value must be set!   **\n");
        msg( DETAILS, "***************************************************************************\n");
      }
    
      bool check_failed = false; /* abort if there is a fatal configuration problem */
    #define xConfirmPara(a,b) check_failed |= confirmPara(a,b)
    
    
      if( m_profile != Profile::NEXT )
      {
        THROW( "Next profile with an alternative partitioner has to be enabled if HEVC_USE_RQT is off!" );
    #if ENABLE_WPP_PARALLELISM
        xConfirmPara( m_numWppThreads > 1, "WPP-style parallelization only supported with NEXT profile" );
    #endif
        xConfirmPara( m_LMChroma, "LMChroma only allowed with NEXT profile" );
        xConfirmPara( m_ImvMode, "IMV is only allowed with NEXT profile" );
    
    Yu Han's avatar
    Yu Han committed
        xConfirmPara(m_IBCMode, "IBC Mode only allowed with NEXT profile");
    
        xConfirmPara( m_HashME, "Hash motion estimation only allowed with NEXT profile" );
    
        xConfirmPara( m_useFastLCTU, "Fast large CTU can only be applied when encoding with NEXT profile" );
    
    Tung Nguyen's avatar
    Tung Nguyen committed
        xConfirmPara( m_MTS, "MTS only allowed with NEXT profile" );
        xConfirmPara( m_MTSIntraMaxCand, "MTS only allowed with NEXT profile" );
        xConfirmPara( m_MTSInterMaxCand, "MTS only allowed with NEXT profile" );
    
        xConfirmPara( m_compositeRefEnabled, "Composite Reference Frame is only allowed with NEXT profile" );
        xConfirmPara( m_GBi, "GBi is only allowed with NEXT profile" );
        xConfirmPara( m_GBiFast, "GBiFast is only allowed with NEXT profile" );
    
        xConfirmPara( m_Triangle, "Triangle is only allowed with NEXT profile" );
    
        xConfirmPara(m_DMVR, "DMVR only allowed with NEXT profile");
    
    #if JVET_N0449_MMVD_SIMP
        xConfirmPara(m_MmvdDisNum, "Number of distance MMVD entry setting only allowed with NEXT profile");
    #endif
    
        // ADD_NEW_TOOL : (parameter check) add a check for next tools here
      }
      else
      {
        if( m_depQuantEnabledFlag )
        {
          xConfirmPara( !m_useRDOQ || !m_useRDOQTS, "RDOQ and RDOQTS must be equal to 1 if dependent quantization is enabled" );
    #if HEVC_USE_SIGN_HIDING
          xConfirmPara( m_signDataHidingEnabledFlag, "SignHideFlag must be equal to 0 if dependent quantization is enabled" );
    #endif
        }
    
    
      if( m_wrapAround )
      {
        xConfirmPara( m_wrapAroundOffset == 0, "Wrap-around offset must be greater than 0" );
        xConfirmPara( m_wrapAroundOffset > m_iSourceWidth, "Wrap-around offset must not be greater than the source picture width" );
    
        int minCUSize =  m_uiCTUSize >> m_uiLog2DiffMaxMinCodingBlockSize;