Changeset 310 in SHVCSoftware for trunk/source/App/TAppEncoder


Ignore:
Timestamp:
22 Jul 2013, 21:40:00 (12 years ago)
Author:
seregin
Message:

reintegrate SHM-2.1-dev branch

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/source

  • trunk/source/App/TAppEncoder/TAppEncCfg.cpp

    r191 r310  
    7979  {
    8080    m_acLayerCfg[layer].setAppEncCfg(this);
    81   }
     81#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
     82    m_ilSampleOnlyPred[layer] = 0;
     83#endif
     84  }
     85  memset( m_scalabilityMask, 0, sizeof(m_scalabilityMask) );
    8286}
    8387#else
     
    9296{
    9397  m_aidQP = NULL;
    94 #if J0149_TONE_MAPPING_SEI
    9598  m_startOfCodedInterval = NULL;
    9699  m_codedPivotValue = NULL;
    97100  m_targetPivotValue = NULL;
    98 #endif
    99101}
    100102#endif
     
    110112    delete[] m_aidQP;
    111113  }
    112 #if J0149_TONE_MAPPING_SEI
    113114  if ( m_startOfCodedInterval )
    114115  {
     
    126127    m_targetPivotValue = NULL;
    127128  }
    128 #endif
    129129  free(m_pchInputFile);
    130130#endif
     
    145145{
    146146#if VPS_EXTN_DIRECT_REF_LAYERS
     147#if M0457_PREDICTION_INDICATIONS
    147148  for(Int layer = 0; layer < MAX_LAYERS; layer++)
    148149  {
     150    if( m_acLayerCfg[layer].m_numSamplePredRefLayers > 0 )
     151    {
     152      delete [] m_acLayerCfg[layer].m_samplePredRefLayerIds;
     153    }
     154  }
     155  for(Int layer = 0; layer < MAX_LAYERS; layer++)
     156  {
     157    if( m_acLayerCfg[layer].m_numMotionPredRefLayers > 0 )
     158    {
     159      delete [] m_acLayerCfg[layer].m_motionPredRefLayerIds;
     160    }
     161  }
     162#else
     163  for(Int layer = 0; layer < MAX_LAYERS; layer++)
     164  {
    149165    if( m_acLayerCfg[layer].m_numDirectRefLayers > 0 )
    150166    {
    151167      delete [] m_acLayerCfg[layer].m_refLayerIds;
     168    }
     169  }
     170#endif
     171  for(Int layer = 0; layer < MAX_LAYERS; layer++)
     172  {
     173    if( m_acLayerCfg[layer].m_numActiveRefLayers > 0 )
     174    {
     175      delete [] m_acLayerCfg[layer].m_predLayerIds;
    152176    }
    153177  }
     
    298322}
    299323
    300 #if SIGNAL_BITRATE_PICRATE_IN_VPS
    301 Void readBoolString(const string inpString, const Int numEntries, Bool* &memberArray, const char *elementName);
    302 Void readIntString(const string inpString, const Int numEntries, Int* &memberArray, const char *elementName);
    303 #endif
    304324// ====================================================================================================================
    305325// Public member functions
     
    327347  Int*    cfg_conformanceMode  [MAX_LAYERS];
    328348#if VPS_EXTN_DIRECT_REF_LAYERS
     349#if M0457_PREDICTION_INDICATIONS
     350  Int*    cfg_numSamplePredRefLayers  [MAX_LAYERS];
     351  string  cfg_samplePredRefLayerIds   [MAX_LAYERS];
     352  string* cfg_samplePredRefLayerIdsPtr[MAX_LAYERS];
     353  Int*    cfg_numMotionPredRefLayers  [MAX_LAYERS];
     354  string  cfg_motionPredRefLayerIds   [MAX_LAYERS];
     355  string* cfg_motionPredRefLayerIdsPtr[MAX_LAYERS];
     356#else
    329357  Int*    cfg_numDirectRefLayers [MAX_LAYERS];
    330   string cfg_refLayerIds   [MAX_LAYERS];
    331   string* cfg_refLayerIdsPtr   [MAX_LAYERS];
     358  string  cfg_refLayerIds        [MAX_LAYERS];
     359  string* cfg_refLayerIdsPtr     [MAX_LAYERS];
     360#endif
     361  Int*    cfg_numActiveRefLayers [MAX_LAYERS];
     362  string  cfg_predLayerIds       [MAX_LAYERS];
     363  string* cfg_predLayerIdsPtr    [MAX_LAYERS];
    332364#endif
    333365#if SCALED_REF_LAYER_OFFSETS
    334   Int*    cfg_scaledRefLayerLeftOffset [MAX_LAYERS];
    335   Int*    cfg_scaledRefLayerTopOffset [MAX_LAYERS];
    336   Int*    cfg_scaledRefLayerRightOffset [MAX_LAYERS];
    337   Int*    cfg_scaledRefLayerBottomOffset [MAX_LAYERS];
     366  string    cfg_scaledRefLayerLeftOffset [MAX_LAYERS];
     367  string    cfg_scaledRefLayerTopOffset [MAX_LAYERS];
     368  string    cfg_scaledRefLayerRightOffset [MAX_LAYERS];
     369  string    cfg_scaledRefLayerBottomOffset [MAX_LAYERS];
     370  Int*      cfg_numScaledRefLayerOffsets[MAX_LAYERS];
     371
     372  string*    cfg_scaledRefLayerLeftOffsetPtr   [MAX_LAYERS];
     373  string*    cfg_scaledRefLayerTopOffsetPtr    [MAX_LAYERS];
     374  string*    cfg_scaledRefLayerRightOffsetPtr  [MAX_LAYERS];
     375  string*    cfg_scaledRefLayerBottomOffsetPtr [MAX_LAYERS];
     376#endif
     377#if RC_SHVC_HARMONIZATION
     378  Bool*   cfg_RCEnableRateControl  [MAX_LAYERS];
     379  Int*    cfg_RCTargetBitRate      [MAX_LAYERS];
     380  Bool*   cfg_RCKeepHierarchicalBit[MAX_LAYERS];
     381  Bool*   cfg_RCLCULevelRC         [MAX_LAYERS];
     382  Bool*   cfg_RCUseLCUSeparateModel[MAX_LAYERS];
     383  Int*    cfg_RCInitialQP          [MAX_LAYERS];
     384  Bool*   cfg_RCForceIntraQP       [MAX_LAYERS];
    338385#endif
    339386  for(UInt layer = 0; layer < MAX_LAYERS; layer++)
     
    348395    cfg_conformanceMode[layer] = &m_acLayerCfg[layer].m_conformanceMode;
    349396#if VPS_EXTN_DIRECT_REF_LAYERS
     397#if M0457_PREDICTION_INDICATIONS
     398    cfg_numSamplePredRefLayers  [layer] = &m_acLayerCfg[layer].m_numSamplePredRefLayers;
     399    cfg_samplePredRefLayerIdsPtr[layer] = &cfg_samplePredRefLayerIds[layer];
     400    cfg_numMotionPredRefLayers  [layer] = &m_acLayerCfg[layer].m_numMotionPredRefLayers;
     401    cfg_motionPredRefLayerIdsPtr[layer] = &cfg_motionPredRefLayerIds[layer];
     402#else
    350403    cfg_numDirectRefLayers  [layer] = &m_acLayerCfg[layer].m_numDirectRefLayers;
    351404    cfg_refLayerIdsPtr      [layer]  = &cfg_refLayerIds[layer];
    352405#endif
     406    cfg_numActiveRefLayers  [layer] = &m_acLayerCfg[layer].m_numActiveRefLayers;
     407    cfg_predLayerIdsPtr     [layer]  = &cfg_predLayerIds[layer];
     408#endif
    353409#if SCALED_REF_LAYER_OFFSETS
    354     cfg_scaledRefLayerLeftOffset  [layer] = &m_acLayerCfg[layer].m_scaledRefLayerLeftOffset;
    355     cfg_scaledRefLayerTopOffset   [layer] = &m_acLayerCfg[layer].m_scaledRefLayerTopOffset;
    356     cfg_scaledRefLayerRightOffset [layer] = &m_acLayerCfg[layer].m_scaledRefLayerRightOffset;
    357     cfg_scaledRefLayerBottomOffset[layer] = &m_acLayerCfg[layer].m_scaledRefLayerBottomOffset;
     410    cfg_numScaledRefLayerOffsets [layer] = &m_acLayerCfg[layer].m_numScaledRefLayerOffsets;
     411    for(Int i = 0; i < MAX_LAYERS; i++)
     412    {
     413      cfg_scaledRefLayerLeftOffsetPtr  [layer] = &cfg_scaledRefLayerLeftOffset[layer]  ;
     414      cfg_scaledRefLayerTopOffsetPtr   [layer] = &cfg_scaledRefLayerTopOffset[layer]   ;
     415      cfg_scaledRefLayerRightOffsetPtr [layer] = &cfg_scaledRefLayerRightOffset[layer] ;
     416      cfg_scaledRefLayerBottomOffsetPtr[layer] = &cfg_scaledRefLayerBottomOffset[layer];
     417    }
     418#endif
     419#if RC_SHVC_HARMONIZATION
     420    cfg_RCEnableRateControl[layer]   = &m_acLayerCfg[layer].m_RCEnableRateControl;
     421    cfg_RCTargetBitRate[layer]       = &m_acLayerCfg[layer].m_RCTargetBitrate;
     422    cfg_RCKeepHierarchicalBit[layer] = &m_acLayerCfg[layer].m_RCKeepHierarchicalBit;
     423    cfg_RCLCULevelRC[layer]          = &m_acLayerCfg[layer].m_RCLCULevelRC;
     424    cfg_RCUseLCUSeparateModel[layer] = &m_acLayerCfg[layer].m_RCUseLCUSeparateModel;
     425    cfg_RCInitialQP[layer]           = &m_acLayerCfg[layer].m_RCInitialQP;
     426    cfg_RCForceIntraQP[layer]        = &m_acLayerCfg[layer].m_RCForceIntraQP;
    358427#endif
    359428  }
     
    373442  string cfg_RowHeight;
    374443  string cfg_ScalingListFile;
    375 #if J0149_TONE_MAPPING_SEI
    376444  string cfg_startOfCodedInterval;
    377445  string cfg_codedPivotValue;
    378446  string cfg_targetPivotValue;
    379 #endif
    380 #if SIGNAL_BITRATE_PICRATE_IN_VPS
    381   string cfg_bitRateInfoPresentFlag;
    382   string cfg_picRateInfoPresentFlag;
    383   string cfg_avgBitRate;
    384   string cfg_maxBitRate;
    385   string cfg_avgPicRate;
    386   string cfg_constantPicRateIdc;
    387 #endif
    388447  po::Options opts;
    389448  opts.addOptions()
     
    401460  ("LambdaModifier%d,-LM%d",  m_adLambdaModifier, ( double )1.0, MAX_TLAYER, "Lambda modifier for temporal layer %d")
    402461#if VPS_EXTN_DIRECT_REF_LAYERS
     462#if M0457_PREDICTION_INDICATIONS
     463  ("NumSamplePredRefLayers%d",cfg_numSamplePredRefLayers, -1, MAX_LAYERS, "Number of sample prediction reference layers")
     464  ("SamplePredRefLayerIds%d", cfg_samplePredRefLayerIdsPtr, string(""), MAX_LAYERS, "sample pred reference layer IDs")
     465  ("NumMotionPredRefLayers%d",cfg_numMotionPredRefLayers, -1, MAX_LAYERS, "Number of motion prediction reference layers")
     466  ("MotionPredRefLayerIds%d", cfg_motionPredRefLayerIdsPtr, string(""), MAX_LAYERS, "motion pred reference layer IDs")
     467#else
    403468  ("NumDirectRefLayers%d",    cfg_numDirectRefLayers, -1, MAX_LAYERS, "Number of direct reference layers")
    404469  ("RefLayerIds%d",           cfg_refLayerIdsPtr, string(""), MAX_LAYERS, "direct reference layer IDs")
    405470#endif
     471  ("NumActiveRefLayers%d",    cfg_numActiveRefLayers, -1, MAX_LAYERS, "Number of active reference layers")
     472  ("PredLayerIds%d",          cfg_predLayerIdsPtr, string(""), MAX_LAYERS, "inter-layer prediction layer IDs")
     473#endif
    406474  ("NumLayers",               m_numLayers, 1, "Number of layers to code")
    407475  ("ConformanceMode%d",       cfg_conformanceMode,0, MAX_LAYERS, "Window conformance mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping")
    408 
    409   ("BitstreamFile,b",       cfg_BitstreamFile, string(""), "Bitstream output file name")
    410   ("InputBitDepth",         m_inputBitDepthY,    8, "Bit-depth of input file")
    411   ("OutputBitDepth",        m_outputBitDepthY,   0, "Bit-depth of output file (default:InternalBitDepth)")
    412   ("InternalBitDepth",      m_internalBitDepthY, 0, "Bit-depth the codec operates at. (default:InputBitDepth)"
     476  ("ScalabilityMask0",        m_scalabilityMask[0], 0, "scalability_mask[0] (multiview)")
     477  ("ScalabilityMask1",        m_scalabilityMask[1], 1, "scalability_mask[1] (scalable)" )
     478  ("BitstreamFile,b",         cfg_BitstreamFile, string(""), "Bitstream output file name")
     479  ("InputBitDepth",           m_inputBitDepthY,    8, "Bit-depth of input file")
     480  ("OutputBitDepth",          m_outputBitDepthY,   0, "Bit-depth of output file (default:InternalBitDepth)")
     481  ("InternalBitDepth",        m_internalBitDepthY, 0, "Bit-depth the codec operates at. (default:InputBitDepth)"
    413482                                                       "If different to InputBitDepth, source data will be converted")
    414   ("InputBitDepthC",        m_inputBitDepthC,    0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)")
    415   ("OutputBitDepthC",       m_outputBitDepthC,   0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
    416   ("InternalBitDepthC",     m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)")
     483  ("InputBitDepthC",          m_inputBitDepthC,    0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)")
     484  ("OutputBitDepthC",         m_outputBitDepthC,   0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
     485  ("InternalBitDepthC",       m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)")
    417486#if SCALED_REF_LAYER_OFFSETS
    418   ("ScaledRefLayerLeftOffset%d",   cfg_scaledRefLayerLeftOffset,  0, MAX_LAYERS, "Horizontal offset of top-left luma sample of scaled base layer picture with respect to"
     487  ("NumScaledRefLayerOffsets%d",    cfg_numScaledRefLayerOffsets,     0, MAX_LAYERS,  "Number of scaled offset layer sets ")
     488  ("ScaledRefLayerLeftOffset%d",   cfg_scaledRefLayerLeftOffsetPtr,  string(""), MAX_LAYERS, "Horizontal offset of top-left luma sample of scaled base layer picture with respect to"
    419489                                                                 " top-left luma sample of the EL picture, in units of two luma samples")
    420   ("ScaledRefLayerTopOffset%d",    cfg_scaledRefLayerTopOffset,   0, MAX_LAYERS,   "Vertical offset of top-left luma sample of scaled base layer picture with respect to"
     490  ("ScaledRefLayerTopOffset%d",    cfg_scaledRefLayerTopOffsetPtr,   string(""), MAX_LAYERS,   "Vertical offset of top-left luma sample of scaled base layer picture with respect to"
    421491                                                                 " top-left luma sample of the EL picture, in units of two luma samples")
    422   ("ScaledRefLayerRightOffset%d",  cfg_scaledRefLayerRightOffset, 0, MAX_LAYERS, "Horizontal offset of bottom-right luma sample of scaled base layer picture with respect to"
     492  ("ScaledRefLayerRightOffset%d",  cfg_scaledRefLayerRightOffsetPtr, string(""), MAX_LAYERS, "Horizontal offset of bottom-right luma sample of scaled base layer picture with respect to"
    423493                                                                 " bottom-right luma sample of the EL picture, in units of two luma samples")
    424   ("ScaledRefLayerBottomOffset%d", cfg_scaledRefLayerBottomOffset,0, MAX_LAYERS, "Vertical offset of bottom-right luma sample of scaled base layer picture with respect to"
     494  ("ScaledRefLayerBottomOffset%d", cfg_scaledRefLayerBottomOffsetPtr,string(""), MAX_LAYERS, "Vertical offset of bottom-right luma sample of scaled base layer picture with respect to"
    425495                                                                 " bottom-right luma sample of the EL picture, in units of two luma samples")
    426496#endif
     
    435505  ("EnableElRapB,-use-rap-b",  m_elRapSliceBEnabled, 0, "Set ILP over base-layer I picture to B picture (default is P picture)")
    436506#endif 
     507#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
     508  ("IlSampleOnlyPred%d",       m_ilSampleOnlyPred, 0, MAX_LAYERS, "Set inter_layer_sample_pred_only_flag for all slices")
     509#endif
    437510#else 
    438511  ("InputFile,i",           cfg_InputFile,     string(""), "Original YUV input file name")
     
    465538  ("Tier",    m_levelTier, Level::MAIN,   "Tier to use for interpretation of --Level")
    466539
    467 #if L0046_CONSTRAINT_FLAGS
    468540  ("ProgressiveSource", m_progressiveSourceFlag, false, "Indicate that source is progressive")
    469541  ("InterlacedSource",  m_interlacedSourceFlag,  false, "Indicate that source is interlaced")
    470542  ("NonPackedSource",   m_nonPackedConstraintFlag, false, "Indicate that source does not contain frame packing")
    471543  ("FrameOnly",         m_frameOnlyConstraintFlag, false, "Indicate that the bitstream contains only frames")
    472 #endif
    473544
    474545  // Unit definition parameters
     
    494565  ("DecodingRefreshType,-dr", m_iDecodingRefreshType,       0, "Intra refresh type (0:none 1:CRA 2:IDR)")
    495566  ("GOPSize,g",               m_iGOPSize,                   1, "GOP size of temporal structure")
    496 #if !L0034_COMBINED_LIST_CLEANUP
    497   ("ListCombination,-lc",     m_bUseLComb,               true, "Combined reference list for uni-prediction estimation in B-slices")
    498 #endif
    499567  // motion options
    500568  ("FastSearch",              m_iFastSearch,                1, "0:Full search  1:Diamond  2:PMVFAST")
     
    542610  ("RDOQ",                          m_useRDOQ,                  true )
    543611  ("RDOQTS",                        m_useRDOQTS,                true )
    544 #if L0232_RD_PENALTY
    545612  ("RDpenalty",                     m_rdPenalty,                0,  "RD-penalty for 32x32 TU for intra in non-intra slices. 0:disbaled  1:RD-penalty  2:maximum RD-penalty")
    546 #endif
    547613  // Entropy coding parameters
    548614  ("SBACRD",                         m_bUseSBACRD,                      true, "SBAC based RD estimation")
     
    554620  ("LoopFilterTcOffset_div2",        m_loopFilterTcOffsetDiv2,             0 )
    555621  ("DeblockingFilterControlPresent", m_DeblockingFilterControlPresent, false )
    556 #if L0386_DB_METRIC
    557622  ("DeblockingFilterMetric",         m_DeblockingFilterMetric,         false )
    558 #endif
    559623
    560624  // Coding tools
     
    616680  ("CFM", m_bUseCbfFastMode, false, "Cbf fast mode setting")
    617681  ("ESD", m_useEarlySkipDetection, false, "Early SKIP detection setting")
     682#if FAST_INTRA_SHVC
     683  ("FIS", m_useFastIntraScalable, false, "Fast Intra Decision for Scalable HEVC")
     684#endif
    618685#if RATE_CONTROL_LAMBDA_DOMAIN
     686#if RC_SHVC_HARMONIZATION
     687  ("RateControl%d", cfg_RCEnableRateControl, false, MAX_LAYERS, "Rate control: enable rate control for layer %d")
     688  ("TargetBitrate%d", cfg_RCTargetBitRate, 0, MAX_LAYERS, "Rate control: target bitrate for layer %d")
     689  ("KeepHierarchicalBit%d", cfg_RCKeepHierarchicalBit, false, MAX_LAYERS, "Rate control: keep hierarchical bit allocation for layer %d")
     690  ("LCULevelRateControl%d", cfg_RCLCULevelRC, true, MAX_LAYERS, "Rate control: LCU level RC")
     691  ("RCLCUSeparateModel%d", cfg_RCUseLCUSeparateModel, true, MAX_LAYERS, "Rate control: Use LCU level separate R-lambda model")
     692  ("InitialQP%d", cfg_RCInitialQP, 0, MAX_LAYERS, "Rate control: initial QP")
     693  ("RCForceIntraQP%d", cfg_RCForceIntraQP, false, MAX_LAYERS, "Rate control: force intra QP to be equal to initial QP")
     694#else
    619695  ( "RateControl",         m_RCEnableRateControl,   false, "Rate control: enable rate control" )
    620696  ( "TargetBitrate",       m_RCTargetBitrate,           0, "Rate control: target bitrate" )
     697#if M0036_RC_IMPROVEMENT
     698  ( "KeepHierarchicalBit", m_RCKeepHierarchicalBit,     0, "Rate control: 0: equal bit allocation; 1: fixed ratio bit allocation; 2: adaptive ratio bit allocation" )
     699#else
    621700  ( "KeepHierarchicalBit", m_RCKeepHierarchicalBit, false, "Rate control: keep hierarchical bit allocation in rate control algorithm" )
     701#endif
    622702  ( "LCULevelRateControl", m_RCLCULevelRC,           true, "Rate control: true: LCU level RC; false: picture level RC" )
    623703  ( "RCLCUSeparateModel",  m_RCUseLCUSeparateModel,  true, "Rate control: use LCU level separate R-lambda model" )
    624704  ( "InitialQP",           m_RCInitialQP,               0, "Rate control: initial QP" )
    625705  ( "RCForceIntraQP",      m_RCForceIntraQP,        false, "Rate control: force intra QP to be equal to initial QP" )
     706#endif
    626707#else
    627708  ("RateCtrl,-rc", m_enableRateCtrl, false, "Rate control on/off")
     
    671752  ("SEIBufferingPeriod",             m_bufferingPeriodSEIEnabled,              0, "Control generation of buffering period SEI messages")
    672753  ("SEIPictureTiming",               m_pictureTimingSEIEnabled,                0, "Control generation of picture timing SEI messages")
    673 #if J0149_TONE_MAPPING_SEI
    674754  ("SEIToneMappingInfo",                       m_toneMappingInfoSEIEnabled,    false, "Control generation of Tone Mapping SEI messages")
    675755  ("SEIToneMapId",                             m_toneMapId,                        0, "Specifies Id of Tone Mapping SEI message for a given session")
     
    702782  ("SEIToneMapNominalWhiteLevelLumaCodeValue",        m_nominalWhiteLevelLumaCodeValue,         235, "Specifies luma sample value of the nominal white level assigned decoded pictures")
    703783  ("SEIToneMapExtendedWhiteLevelLumaCodeValue",       m_extendedWhiteLevelLumaCodeValue,        300, "Specifies luma sample value of the extended dynamic range assigned decoded pictures")
    704 #endif
    705784  ("SEIFramePacking",                m_framePackingSEIEnabled,                 0, "Control generation of frame packing SEI messages")
    706785  ("SEIFramePackingType",            m_framePackingSEIType,                    0, "Define frame packing arrangement\n"
     
    723802  ("SEIGradualDecodingRefreshInfo",  m_gradualDecodingRefreshInfoEnabled,      0, "Control generation of gradual decoding refresh information SEI message")
    724803  ("SEIDecodingUnitInfo",             m_decodingUnitInfoSEIEnabled,                       0, "Control generation of decoding unit information SEI message.")
    725 #if L0208_SOP_DESCRIPTION_SEI
     804#if M0043_LAYERS_PRESENT_SEI
     805  ("SEILayersPresent",               m_layersPresentSEIEnabled,                0, "Control generation of layers present SEI message")
     806#endif
    726807  ("SEISOPDescription",              m_SOPDescriptionSEIEnabled,              0, "Control generation of SOP description SEI messages")
    727 #endif
    728 #if K0180_SCALABLE_NESTING_SEI
    729808  ("SEIScalableNesting",             m_scalableNestingSEIEnabled,              0, "Control generation of scalable nesting SEI messages")
    730 #endif
    731 #if SIGNAL_BITRATE_PICRATE_IN_VPS
    732   ("BitRatePicRateMaxTLayers",   m_bitRatePicRateMaxTLayers,           0, "Maximum number of sub-layers signalled; can be inferred otherwise; here for easy parsing of config. file")
    733   ("BitRateInfoPresent",         cfg_bitRateInfoPresentFlag,          string(""), "Control signalling of bit rate information of avg. bit rate and max. bit rate in VPS\n"
    734                                                                           "\t0: Do not sent bit rate info\n"
    735                                                                           "\tN (N > 0): Send bit rate info for N sub-layers. N should equal maxTempLayers.")                                                                     
    736   ("PicRateInfoPresent",         cfg_picRateInfoPresentFlag,          string(""), "Control signalling of picture rate information of avg. bit rate and max. bit rate in VPS\n"
    737                                                                           "\t0: Do not sent picture rate info\n"
    738                                                                           "\tN (N > 0): Send picture rate info for N sub-layers. N should equal maxTempLayers.")                                                                     
    739   ("AvgBitRate",                   cfg_avgBitRate,                    string(""), "List of avg. bit rates for the different sub-layers; include non-negative number even if corresponding flag is 0")
    740   ("MaxBitRate",                   cfg_maxBitRate,                    string(""), "List of max. bit rates for the different sub-layers; include non-negative number even if corresponding flag is 0")
    741   ("AvgPicRate",                   cfg_avgPicRate,                    string(""), "List of avg. picture rates for the different sub-layers; include non-negative number even if corresponding flag is 0")
    742   ("ConstantPicRateIdc",           cfg_constantPicRateIdc,            string(""), "List of constant picture rate IDCs; include non-negative number even if corresponding flag is 0")
     809#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     810  ("AdaptiveResolutionChange",     m_adaptiveResolutionChange, 0, "Adaptive resolution change frame number. Should coincide with EL RAP picture. (0: disable)")
    743811#endif
    744812  ;
     
    843911    m_pRowHeight = NULL;
    844912  }
     913#if SCALED_REF_LAYER_OFFSETS
     914  for(Int layer = 0; layer < MAX_LAYERS; layer++)
     915  {
     916    // If number of scaled ref. layer offsets is non-zero, at least one of the offsets should be specified
     917    if(m_acLayerCfg[layer].m_numScaledRefLayerOffsets)
     918    {
     919      assert( strcmp(cfg_scaledRefLayerLeftOffset[layer].c_str(),  "") ||
     920              strcmp(cfg_scaledRefLayerRightOffset[layer].c_str(), "") ||
     921              strcmp(cfg_scaledRefLayerTopOffset[layer].c_str(),   "") ||
     922              strcmp(cfg_scaledRefLayerBottomOffset[layer].c_str(),"")
     923            );
     924    }
     925
     926    Int *tempArray = NULL;   // Contain the value
     927    // Left offset //
     928    if(strcmp(cfg_scaledRefLayerLeftOffset[layer].c_str(),  ""))
     929    {
     930      cfgStringToArray( &tempArray, cfg_scaledRefLayerLeftOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "LeftOffset");
     931      if(tempArray)
     932      {
     933        for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++)
     934        {
     935          m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i] = tempArray[i];
     936        }
     937        delete [] tempArray; tempArray = NULL;
     938      }
     939    }
     940
     941    // Top offset //
     942    if(strcmp(cfg_scaledRefLayerTopOffset[layer].c_str(),  ""))
     943    {
     944      cfgStringToArray( &tempArray, cfg_scaledRefLayerTopOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "TopOffset");
     945      if(tempArray)
     946      {
     947        for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++)
     948        {
     949          m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i] = tempArray[i];
     950        }
     951        delete [] tempArray; tempArray = NULL;
     952      }
     953    }
     954
     955    // Right offset //
     956    if(strcmp(cfg_scaledRefLayerRightOffset[layer].c_str(),  ""))
     957    {
     958      cfgStringToArray( &tempArray, cfg_scaledRefLayerRightOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "RightOffset");
     959      if(tempArray)
     960      {
     961        for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++)
     962        {
     963          m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i] = tempArray[i];
     964        }
     965        delete [] tempArray; tempArray = NULL;
     966      }
     967    }
     968
     969    // Bottom offset //
     970    if(strcmp(cfg_scaledRefLayerBottomOffset[layer].c_str(),  ""))
     971    {
     972      cfgStringToArray( &tempArray, cfg_scaledRefLayerBottomOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "BottomOffset");
     973      if(tempArray)
     974      {
     975        for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++)
     976        {
     977          m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i] = tempArray[i];
     978        }
     979        delete [] tempArray; tempArray = NULL;
     980      }
     981    }
     982  }
     983#endif
    845984#if VPS_EXTN_DIRECT_REF_LAYERS
     985#if M0457_PREDICTION_INDICATIONS
     986  for(Int layer = 0; layer < MAX_LAYERS; layer++)
     987  {
     988    Char* pSamplePredRefLayerIds = cfg_samplePredRefLayerIds[layer].empty() ? NULL: strdup(cfg_samplePredRefLayerIds[layer].c_str());
     989    if( m_acLayerCfg[layer].m_numSamplePredRefLayers > 0 )
     990    {
     991      char *samplePredRefLayerId;
     992      int  i=0;
     993      m_acLayerCfg[layer].m_samplePredRefLayerIds = new Int[m_acLayerCfg[layer].m_numSamplePredRefLayers];
     994      samplePredRefLayerId = strtok(pSamplePredRefLayerIds, " ,-");
     995      while(samplePredRefLayerId != NULL)
     996      {
     997        if( i >= m_acLayerCfg[layer].m_numSamplePredRefLayers )
     998        {
     999          printf( "NumSamplePredRefLayers: The number of columns whose width are defined is larger than the allowed number of columns.\n" );
     1000          exit( EXIT_FAILURE );
     1001        }
     1002        *( m_acLayerCfg[layer].m_samplePredRefLayerIds + i ) = atoi( samplePredRefLayerId );
     1003        samplePredRefLayerId = strtok(NULL, " ,-");
     1004        i++;
     1005      }
     1006      if( i < m_acLayerCfg[layer].m_numSamplePredRefLayers )
     1007      {
     1008        printf( "NumSamplePredRefLayers: The width of some columns is not defined.\n" );
     1009        exit( EXIT_FAILURE );
     1010      }
     1011    }
     1012    else
     1013    {
     1014      m_acLayerCfg[layer].m_samplePredRefLayerIds = NULL;
     1015    }
     1016  }
     1017  for(Int layer = 0; layer < MAX_LAYERS; layer++)
     1018  {
     1019    Char* pMotionPredRefLayerIds = cfg_motionPredRefLayerIds[layer].empty() ? NULL: strdup(cfg_motionPredRefLayerIds[layer].c_str());
     1020    if( m_acLayerCfg[layer].m_numMotionPredRefLayers > 0 )
     1021    {
     1022      char *motionPredRefLayerId;
     1023      int  i=0;
     1024      m_acLayerCfg[layer].m_motionPredRefLayerIds = new Int[m_acLayerCfg[layer].m_numMotionPredRefLayers];
     1025      motionPredRefLayerId = strtok(pMotionPredRefLayerIds, " ,-");
     1026      while(motionPredRefLayerId != NULL)
     1027      {
     1028        if( i >= m_acLayerCfg[layer].m_numMotionPredRefLayers )
     1029        {
     1030          printf( "NumMotionPredRefLayers: The number of columns whose width are defined is larger than the allowed number of columns.\n" );
     1031          exit( EXIT_FAILURE );
     1032        }
     1033        *( m_acLayerCfg[layer].m_motionPredRefLayerIds + i ) = atoi( motionPredRefLayerId );
     1034        motionPredRefLayerId = strtok(NULL, " ,-");
     1035        i++;
     1036      }
     1037      if( i < m_acLayerCfg[layer].m_numMotionPredRefLayers )
     1038      {
     1039        printf( "NumMotionPredRefLayers: The width of some columns is not defined.\n" );
     1040        exit( EXIT_FAILURE );
     1041      }
     1042    }
     1043    else
     1044    {
     1045      m_acLayerCfg[layer].m_motionPredRefLayerIds = NULL;
     1046    }
     1047  }
     1048#else
    8461049  for(Int layer = 0; layer < MAX_LAYERS; layer++)
    8471050  {
     
    8571060        if( i >= m_acLayerCfg[layer].m_numDirectRefLayers )
    8581061        {
    859           printf( "The number of columns whose width are defined is larger than the allowed number of columns.\n" );
     1062          printf( "NumDirectRefLayers: The number of columns whose width are defined is larger than the allowed number of columns.\n" );
    8601063          exit( EXIT_FAILURE );
    8611064        }
     
    8661069      if( i < m_acLayerCfg[layer].m_numDirectRefLayers )
    8671070      {
    868         printf( "The width of some columns is not defined.\n" );
     1071        printf( "NumDirectRefLayers: The width of some columns is not defined.\n" );
    8691072        exit( EXIT_FAILURE );
    8701073      }
     
    8761079  }
    8771080#endif
    878 #if SIGNAL_BITRATE_PICRATE_IN_VPS
    879   readBoolString(cfg_bitRateInfoPresentFlag, m_bitRatePicRateMaxTLayers, m_bitRateInfoPresentFlag, "bit rate info. present flag" );
    880   readIntString (cfg_avgBitRate,             m_bitRatePicRateMaxTLayers, m_avgBitRate,             "avg. bit rate"               );
    881   readIntString (cfg_maxBitRate,             m_bitRatePicRateMaxTLayers, m_maxBitRate,             "max. bit rate"               );
    882   readBoolString(cfg_picRateInfoPresentFlag, m_bitRatePicRateMaxTLayers, m_picRateInfoPresentFlag, "bit rate info. present flag" );
    883   readIntString (cfg_avgPicRate,             m_bitRatePicRateMaxTLayers, m_avgPicRate,             "avg. pic rate"               );
    884   readIntString (cfg_constantPicRateIdc,     m_bitRatePicRateMaxTLayers, m_constantPicRateIdc,     "constant pic rate Idc"       );
     1081  for(Int layer = 0; layer < MAX_LAYERS; layer++)
     1082  {
     1083    Char* pPredLayerIds = cfg_predLayerIds[layer].empty() ? NULL: strdup(cfg_predLayerIds[layer].c_str());
     1084    if( m_acLayerCfg[layer].m_numActiveRefLayers > 0 )
     1085    {
     1086      char *refLayerId;
     1087      int  i=0;
     1088      m_acLayerCfg[layer].m_predLayerIds = new Int[m_acLayerCfg[layer].m_numActiveRefLayers];
     1089      refLayerId = strtok(pPredLayerIds, " ,-");
     1090      while(refLayerId != NULL)
     1091      {
     1092        if( i >= m_acLayerCfg[layer].m_numActiveRefLayers )
     1093        {
     1094          printf( "NumActiveRefLayers: The number of columns whose width are defined is larger than the allowed number of columns.\n" );
     1095          exit( EXIT_FAILURE );
     1096        }
     1097        *( m_acLayerCfg[layer].m_predLayerIds + i ) = atoi( refLayerId );
     1098        refLayerId = strtok(NULL, " ,-");
     1099        i++;
     1100      }
     1101      if( i < m_acLayerCfg[layer].m_numActiveRefLayers )
     1102      {
     1103        printf( "NumActiveRefLayers: The width of some columns is not defined.\n" );
     1104        exit( EXIT_FAILURE );
     1105      }
     1106    }
     1107    else
     1108    {
     1109      m_acLayerCfg[layer].m_predLayerIds = NULL;
     1110    }
     1111  }
    8851112#endif
    8861113  m_scalingListFile = cfg_ScalingListFile.empty() ? NULL : strdup(cfg_ScalingListFile.c_str());
     
    9921219  m_iWaveFrontSubstreams = m_iWaveFrontSynchro ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1;
    9931220#endif
    994 #if J0149_TONE_MAPPING_SEI
    9951221  if( m_toneMappingInfoSEIEnabled && !m_toneMapCancelFlag )
    9961222  {
     
    10511277    }
    10521278  }
    1053 #endif
    10541279  // check validity of input parameters
    10551280  xCheckParameter();
     
    10631288  return true;
    10641289}
    1065 #if SIGNAL_BITRATE_PICRATE_IN_VPS
    1066 Void readBoolString(const string inpString, const Int numEntries, Bool* &memberArray, const char *elementName)
    1067 {
    1068   Char* inpArray = inpString.empty() ? NULL : strdup(inpString.c_str());
    1069   Int i = 0;
    1070   if(numEntries)
    1071   {
    1072     Char* tempArray = strtok(inpArray, " ,-");
    1073     memberArray = new Bool[numEntries];
    1074     while( tempArray != NULL )
    1075     {
    1076       if( i >= numEntries )
    1077       {
    1078         printf( "The number of %s defined is larger than the allowed number\n", elementName );
    1079         exit( EXIT_FAILURE );
    1080       }
    1081       assert( (atoi(tempArray) == 0) || (atoi(tempArray) == 1) );
    1082       *( memberArray + i ) = atoi(tempArray);
    1083       tempArray = strtok(NULL, " ,-");
    1084       i++;
    1085     }
    1086     if( i < numEntries )
    1087     {
    1088       printf( "Some %s are not defined\n", elementName );
    1089       exit( EXIT_FAILURE );
    1090     }
    1091   }
    1092   else
    1093   {
    1094     memberArray = NULL;
    1095   }
    1096 }
    1097 
    1098 Void readIntString(const string inpString, const Int numEntries, Int* &memberArray, const char *elementName)
    1099 {
    1100   Char* inpArray = inpString.empty() ? NULL : strdup(inpString.c_str());
    1101   Int i = 0;
    1102   if(numEntries)
    1103   {
    1104     Char* tempArray = strtok(inpArray, " ,-");
    1105     memberArray = new Int[numEntries];
    1106     while( tempArray != NULL )
    1107     {
    1108       if( i >= numEntries )
    1109       {
    1110         printf( "The number of %s defined is larger than the allowed number\n", elementName );
    1111         exit( EXIT_FAILURE );
    1112       }
    1113       *( memberArray + i ) = atoi(tempArray);
    1114       tempArray = strtok(NULL, " ,-");
    1115       i++;
    1116     }
    1117     if( i < numEntries )
    1118     {
    1119       printf( "Some %s are not defined\n", elementName );
    1120       exit( EXIT_FAILURE );
    1121     }
    1122   }
    1123   else
    1124   {
    1125     memberArray = NULL;
    1126   }
    1127 }
    1128 #endif
    11291290// ====================================================================================================================
    11301291// Private member functions
     
    11421303    fprintf(stderr, "**          decoder requires this option to be enabled.         **\n");
    11431304    fprintf(stderr, "******************************************************************\n");
     1305  }
     1306  if( m_profile==Profile::NONE )
     1307  {
     1308    fprintf(stderr, "***************************************************************************\n");
     1309    fprintf(stderr, "** WARNING: For conforming bitstreams a valid Profile value must be set! **\n");
     1310    fprintf(stderr, "***************************************************************************\n");
     1311  }
     1312  if( m_level==Level::NONE )
     1313  {
     1314    fprintf(stderr, "***************************************************************************\n");
     1315    fprintf(stderr, "** WARNING: For conforming bitstreams a valid Level value must be set!   **\n");
     1316    fprintf(stderr, "***************************************************************************\n");
    11441317  }
    11451318
     
    11621335  xConfirmPara( m_iQP <  -6 * (m_internalBitDepthY - 8) || m_iQP > 51,                    "QP exceeds supported range (-QpBDOffsety to 51)" );
    11631336#endif
    1164   xConfirmPara( m_loopFilterBetaOffsetDiv2 < -13 || m_loopFilterBetaOffsetDiv2 > 13,          "Loop Filter Beta Offset div. 2 exceeds supported range (-13 to 13)");
    1165   xConfirmPara( m_loopFilterTcOffsetDiv2 < -13 || m_loopFilterTcOffsetDiv2 > 13,              "Loop Filter Tc Offset div. 2 exceeds supported range (-13 to 13)");
     1337  xConfirmPara( m_loopFilterBetaOffsetDiv2 < -6 || m_loopFilterBetaOffsetDiv2 > 6,          "Loop Filter Beta Offset div. 2 exceeds supported range (-6 to 6)");
     1338  xConfirmPara( m_loopFilterTcOffsetDiv2 < -6 || m_loopFilterTcOffsetDiv2 > 6,              "Loop Filter Tc Offset div. 2 exceeds supported range (-6 to 6)");
    11661339  xConfirmPara( m_iFastSearch < 0 || m_iFastSearch > 2,                                     "Fast Search Mode is not supported value (0:Full search  1:Diamond  2:PMVFAST)" );
    11671340  xConfirmPara( m_iSearchRange < 0 ,                                                        "Search Range must be more than 0" );
     
    13241497    }
    13251498  }
    1326 #endif 
    1327 
    1328 #if SVC_EXTENSION
     1499
    13291500  // verify layer configuration parameters
    13301501  for(UInt layer=0; layer<m_numLayers; layer++)
     
    15511722  {
    15521723    m_numReorderPics[i] = 0;
    1553 #if L0323_DPB
    15541724    m_maxDecPicBuffering[i] = 1;
    1555 #else
    1556     m_maxDecPicBuffering[i] = 0;
    1557 #endif
    15581725  }
    15591726  for(Int i=0; i<m_iGOPSize; i++)
    15601727  {
    1561 #if L0323_DPB
    15621728    if(m_GOPList[i].m_numRefPics+1 > m_maxDecPicBuffering[m_GOPList[i].m_temporalId])
    1563 #else
    1564     if(m_GOPList[i].m_numRefPics > m_maxDecPicBuffering[m_GOPList[i].m_temporalId])
    1565 #endif
    1566     {
    1567 #if L0323_DPB
     1729    {
    15681730      m_maxDecPicBuffering[m_GOPList[i].m_temporalId] = m_GOPList[i].m_numRefPics + 1;
    1569 #else
    1570       m_maxDecPicBuffering[m_GOPList[i].m_temporalId] = m_GOPList[i].m_numRefPics;
    1571 #endif
    1572     }
     1731    }
     1732
     1733#if SVC_EXTENSION
     1734    m_maxDecPicBuffering[m_GOPList[i].m_temporalId] += 1; // it should be updated if more than 1 resampling picture is used
     1735#endif
     1736
    15731737    Int highestDecodingNumberWithLowerPOC = 0;
    15741738    for(Int j=0; j<m_iGOPSize; j++)
     
    16001764      m_numReorderPics[i+1] = m_numReorderPics[i];
    16011765    }
    1602 #if L0323_DPB
    16031766    // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ] - 1, inclusive
    16041767    if(m_numReorderPics[i] > m_maxDecPicBuffering[i] - 1)
     
    16061769      m_maxDecPicBuffering[i] = m_numReorderPics[i] + 1;
    16071770    }
    1608 #else
    1609     // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ], inclusive
    1610     if(m_numReorderPics[i] > m_maxDecPicBuffering[i])
    1611     {
    1612       m_maxDecPicBuffering[i] = m_numReorderPics[i];
    1613     }
    1614 #endif
    16151771    // a lower layer can not have higher value of m_uiMaxDecPicBuffering than a higher layer
    16161772    if(m_maxDecPicBuffering[i+1] < m_maxDecPicBuffering[i])
     
    16211777
    16221778
    1623 #if L0323_DPB
    16241779  // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ] -  1, inclusive
    16251780  if(m_numReorderPics[MAX_TLAYER-1] > m_maxDecPicBuffering[MAX_TLAYER-1] - 1)
     
    16271782    m_maxDecPicBuffering[MAX_TLAYER-1] = m_numReorderPics[MAX_TLAYER-1] + 1;
    16281783  }
    1629 #else
    1630   // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ], inclusive
    1631   if(m_numReorderPics[MAX_TLAYER-1] > m_maxDecPicBuffering[MAX_TLAYER-1])
    1632   {
    1633     m_maxDecPicBuffering[MAX_TLAYER-1] = m_numReorderPics[MAX_TLAYER-1];
    1634   }
    1635 #endif
    16361784
    16371785#if SVC_EXTENSION // ToDo: it should be checked for the case when parameters are different for the layers
     
    17171865  }
    17181866#endif
    1719 #if !L0034_COMBINED_LIST_CLEANUP
    1720   xConfirmPara( m_bUseLComb==false && m_numReorderPics[MAX_TLAYER-1]!=0, "ListCombination can only be 0 in low delay coding (more precisely when L0 and L1 are identical)" );  // Note however this is not the full necessary condition as ref_pic_list_combination_flag can only be 0 if L0 == L1.
    1721 #endif
    17221867  xConfirmPara( m_iWaveFrontSynchro < 0, "WaveFrontSynchro cannot be negative" );
    17231868#if !SVC_EXTENSION
     
    17281873  xConfirmPara( m_decodedPictureHashSEIEnabled<0 || m_decodedPictureHashSEIEnabled>3, "this hash type is not correct!\n");
    17291874
    1730 #if J0149_TONE_MAPPING_SEI
    17311875  if (m_toneMappingInfoSEIEnabled)
    17321876  {
     
    17391883    xConfirmPara( m_extendedWhiteLevelLumaCodeValue < m_nominalWhiteLevelLumaCodeValue, "SEIToneMapExtendedWhiteLevelLumaCodeValue shall be greater than or equal to SEIToneMapNominalWhiteLevelLumaCodeValue");
    17401884  }
    1741 #endif
    17421885
    17431886#if RATE_CONTROL_LAMBDA_DOMAIN
     1887#if RC_SHVC_HARMONIZATION
     1888  for ( Int layer=0; layer<m_numLayers; layer++ )
     1889  {
     1890    if ( m_acLayerCfg[layer].m_RCEnableRateControl )
     1891    {
     1892      if ( m_acLayerCfg[layer].m_RCForceIntraQP )
     1893      {
     1894        if ( m_acLayerCfg[layer].m_RCInitialQP == 0 )
     1895        {
     1896          printf( "\nInitial QP for rate control is not specified. Reset not to use force intra QP!" );
     1897          m_acLayerCfg[layer].m_RCForceIntraQP = false;
     1898        }
     1899      }
     1900    }
     1901    xConfirmPara( m_uiDeltaQpRD > 0, "Rate control cannot be used together with slice level multiple-QP optimization!\n" );
     1902  }
     1903#else
    17441904  if ( m_RCEnableRateControl )
    17451905  {
     
    17541914    xConfirmPara( m_uiDeltaQpRD > 0, "Rate control cannot be used together with slice level multiple-QP optimization!\n" );
    17551915  }
     1916#endif
    17561917#else
    17571918  if(m_enableRateCtrl)
     
    17711932
    17721933  xConfirmPara(m_log2ParallelMergeLevel < 2, "Log2ParallelMergeLevel should be larger than or equal to 2");
    1773 #if L0444_FPA_TYPE
    17741934  if (m_framePackingSEIEnabled)
    17751935  {
    17761936    xConfirmPara(m_framePackingSEIType < 3 || m_framePackingSEIType > 5 , "SEIFramePackingType must be in rage 3 to 5");
    17771937  }
    1778 #endif
    17791938#if VPS_EXTN_DIRECT_REF_LAYERS
     1939#if M0457_PREDICTION_INDICATIONS
     1940  xConfirmPara( (m_acLayerCfg[0].m_numSamplePredRefLayers != 0) && (m_acLayerCfg[0].m_numSamplePredRefLayers != -1), "Layer 0 cannot have any reference layers" );
     1941  // NOTE: m_numSamplePredRefLayers  (for any layer) could be -1 (not signalled in cfg), in which case only the "previous layer" would be taken for reference
     1942  for(Int layer = 1; layer < MAX_LAYERS; layer++)
     1943  {
     1944    xConfirmPara(m_acLayerCfg[layer].m_numSamplePredRefLayers > layer, "Cannot reference more layers than before current layer");
     1945    for(Int i = 0; i < m_acLayerCfg[layer].m_numSamplePredRefLayers; i++)
     1946    {
     1947      xConfirmPara(m_acLayerCfg[layer].m_samplePredRefLayerIds[i] > layer, "Cannot reference higher layers");
     1948      xConfirmPara(m_acLayerCfg[layer].m_samplePredRefLayerIds[i] == layer, "Cannot reference the current layer itself");
     1949    }
     1950  }
     1951  xConfirmPara( (m_acLayerCfg[0].m_numMotionPredRefLayers != 0) && (m_acLayerCfg[0].m_numMotionPredRefLayers != -1), "Layer 0 cannot have any reference layers" );
     1952  // NOTE: m_numMotionPredRefLayers  (for any layer) could be -1 (not signalled in cfg), in which case only the "previous layer" would be taken for reference
     1953  for(Int layer = 1; layer < MAX_LAYERS; layer++)
     1954  {
     1955    xConfirmPara(m_acLayerCfg[layer].m_numMotionPredRefLayers > layer, "Cannot reference more layers than before current layer");
     1956    for(Int i = 0; i < m_acLayerCfg[layer].m_numMotionPredRefLayers; i++)
     1957    {
     1958      xConfirmPara(m_acLayerCfg[layer].m_motionPredRefLayerIds[i] > layer, "Cannot reference higher layers");
     1959      xConfirmPara(m_acLayerCfg[layer].m_motionPredRefLayerIds[i] == layer, "Cannot reference the current layer itself");
     1960    }
     1961  }
     1962#else
    17801963  xConfirmPara( (m_acLayerCfg[0].m_numDirectRefLayers != 0) && (m_acLayerCfg[0].m_numDirectRefLayers != -1), "Layer 0 cannot have any reference layers" );
    17811964  // NOTE: m_numDirectRefLayers  (for any layer) could be -1 (not signalled in cfg), in which case only the "previous layer" would be taken for reference
     
    17881971      xConfirmPara(m_acLayerCfg[layer].m_refLayerIds[i] == layer, "Cannot reference the current layer itself");
    17891972    }
     1973  }
     1974#endif
     1975  xConfirmPara( (m_acLayerCfg[0].m_numActiveRefLayers != 0) && (m_acLayerCfg[0].m_numActiveRefLayers != -1), "Layer 0 cannot have any active reference layers" );
     1976  // NOTE: m_numActiveRefLayers  (for any layer) could be -1 (not signalled in cfg), in which case only the "previous layer" would be taken for reference
     1977  for(Int layer = 1; layer < MAX_LAYERS; layer++)
     1978  {
     1979#if M0457_PREDICTION_INDICATIONS
     1980    Bool predEnabledFlag[MAX_LAYERS];
     1981    for (Int refLayer = 0; refLayer < layer; refLayer++)
     1982    {
     1983      predEnabledFlag[refLayer] = false;
     1984    }
     1985    for(Int i = 0; i < m_acLayerCfg[layer].m_numSamplePredRefLayers; i++)
     1986    {
     1987      predEnabledFlag[m_acLayerCfg[layer].m_samplePredRefLayerIds[i]] = true;
     1988    }
     1989    for(Int i = 0; i < m_acLayerCfg[layer].m_numMotionPredRefLayers; i++)
     1990    {
     1991      predEnabledFlag[m_acLayerCfg[layer].m_motionPredRefLayerIds[i]] = true;
     1992    }
     1993    Int numDirectRefLayers = 0;
     1994    for (Int refLayer = 0; refLayer < layer; refLayer++)
     1995    {
     1996      if (predEnabledFlag[refLayer] == true) numDirectRefLayers++;
     1997    }
     1998    xConfirmPara(m_acLayerCfg[layer].m_numActiveRefLayers > numDirectRefLayers, "Cannot reference more layers than NumDirectRefLayers");
     1999    for(Int i = 0; i < m_acLayerCfg[layer].m_numActiveRefLayers; i++)
     2000    {
     2001      xConfirmPara(m_acLayerCfg[layer].m_predLayerIds[i] >= numDirectRefLayers, "Cannot reference higher layers");
     2002    }
     2003#else
     2004    xConfirmPara(m_acLayerCfg[layer].m_numActiveRefLayers > m_acLayerCfg[layer].m_numDirectRefLayers, "Cannot reference more layers than NumDirectRefLayers");
     2005    for(Int i = 0; i < m_acLayerCfg[layer].m_numActiveRefLayers; i++)
     2006    {
     2007      xConfirmPara(m_acLayerCfg[layer].m_predLayerIds[i] >= m_acLayerCfg[layer].m_numDirectRefLayers, "Cannot reference higher layers");
     2008    }
     2009#endif
     2010  }
     2011#endif
     2012#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     2013  if (m_adaptiveResolutionChange > 0)
     2014  {
     2015    xConfirmPara(m_numLayers != 2, "Adaptive resolution change works with 2 layers only");
     2016    xConfirmPara(m_acLayerCfg[1].m_iIntraPeriod == 0 || (m_adaptiveResolutionChange % m_acLayerCfg[1].m_iIntraPeriod) != 0, "Adaptive resolution change must happen at enhancement layer RAP picture");
    17902017  }
    17912018#endif
     
    18252052  printf("\n");
    18262053#if SVC_EXTENSION 
    1827   printf("Total number of layers        : %d\n", m_numLayers            );
     2054  printf("Total number of layers        : %d\n", m_numLayers       );
     2055  printf("Multiview                     : %d\n", m_scalabilityMask[0] );
     2056  printf("Scalable                      : %d\n", m_scalabilityMask[1] );
     2057#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     2058  printf("Adaptive Resolution Change    : %d\n", m_adaptiveResolutionChange );
     2059#endif
    18282060  for(UInt layer=0; layer<m_numLayers; layer++)
    18292061  {
     
    18692101  printf("PCM sample bit depth         : (Y:%d, C:%d)\n", g_uiPCMBitDepthLuma, g_uiPCMBitDepthChroma );
    18702102#if RATE_CONTROL_LAMBDA_DOMAIN
     2103#if !RC_SHVC_HARMONIZATION
    18712104  printf("RateControl                  : %d\n", m_RCEnableRateControl );
    18722105  if(m_RCEnableRateControl)
     
    18792112    printf("ForceIntraQP                 : %d\n", m_RCForceIntraQP );
    18802113  }
     2114#endif
    18812115#else
    18822116  printf("RateControl                  : %d\n", m_enableRateCtrl);
     
    18962130  printf("RDQ:%d ", m_useRDOQ            );
    18972131  printf("RDQTS:%d ", m_useRDOQTS        );
    1898 #if L0232_RD_PENALTY
    18992132  printf("RDpenalty:%d ", m_rdPenalty  );
    1900 #endif
    19012133  printf("SQP:%d ", m_uiDeltaQpRD         );
    19022134  printf("ASR:%d ", m_bUseASR             );
    1903 #if !L0034_COMBINED_LIST_CLEANUP
    1904   printf("LComb:%d ", m_bUseLComb         );
    1905 #endif
    19062135  printf("FEN:%d ", m_bUseFastEnc         );
    19072136  printf("ECU:%d ", m_bUseEarlyCU         );
     
    19092138  printf("CFM:%d ", m_bUseCbfFastMode         );
    19102139  printf("ESD:%d ", m_useEarlySkipDetection  );
     2140#if FAST_INTRA_SHVC
     2141  printf("FIS:%d ", m_useFastIntraScalable  );
     2142#endif
    19112143  printf("RQT:%d ", 1     );
    19122144  printf("TransformSkip:%d ",     m_useTransformSkip              );
     
    19792211}
    19802212
     2213#if SCALED_REF_LAYER_OFFSETS
     2214Void TAppEncCfg::cfgStringToArray(Int **arr, string cfgString, Int numEntries, const char* logString)
     2215{
     2216  Char *tempChar = cfgString.empty() ? NULL : strdup(cfgString.c_str());
     2217  if( numEntries > 0 )
     2218  {
     2219    Char *arrayEntry;
     2220    Int i = 0;
     2221    *arr = new Int[numEntries];
     2222
     2223    arrayEntry = strtok( tempChar, " ,");
     2224    while(arrayEntry != NULL)
     2225    {
     2226      if( i >= numEntries )
     2227      {
     2228        printf( "%s: The number of entries specified is larger than the allowed number.\n", logString );
     2229        exit( EXIT_FAILURE );
     2230      }
     2231      *( *arr + i ) = atoi( arrayEntry );
     2232      arrayEntry = strtok(NULL, " ,");
     2233      i++;
     2234    }
     2235    if( i < numEntries )
     2236    {
     2237      printf( "%s: Some entries are not specified.\n", logString );
     2238      exit( EXIT_FAILURE );
     2239    }
     2240  }
     2241  else
     2242  {
     2243    *arr = NULL;
     2244  }
     2245}
     2246#endif
    19812247//! \}
  • trunk/source/App/TAppEncoder/TAppEncCfg.h

    r191 r310  
    6161  TAppEncLayerCfg m_acLayerCfg [MAX_LAYERS];
    6262  Int       m_numLayers;                                      ///< number of layers
    63 
     63  Int       m_scalabilityMask[MAX_VPS_NUM_SCALABILITY_TYPES]; ///< scalability_mask
    6464  Char*     m_pBitstreamFile;                                 ///< output bitstream file
    6565  Double    m_adLambdaModifier[ MAX_TLAYER ];                 ///< Lambda modifier array for each temporal layer
     
    7272#if AVC_SYNTAX
    7373  Char*     m_BLSyntaxFile;                                   ///< input syntax file
     74#endif
     75#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
     76  Int       m_ilSampleOnlyPred[ MAX_LAYERS ];
    7477#endif
    7578#else
     
    9699  Level::Tier   m_levelTier;
    97100  Level::Name   m_level;
    98 #if L0046_CONSTRAINT_FLAGS
    99101  Bool m_progressiveSourceFlag;
    100102  Bool m_interlacedSourceFlag;
    101103  Bool m_nonPackedConstraintFlag;
    102104  Bool m_frameOnlyConstraintFlag;
    103 #endif
    104105 
    105106  // coding structure
     
    112113  GOPEntry  m_GOPList[MAX_GOP];                               ///< the coding structure entries from the config file
    113114  Int       m_numReorderPics[MAX_TLAYER];                     ///< total number of reorder pictures
    114 #if L0323_DPB
    115115  Int       m_maxDecPicBuffering[MAX_TLAYER];                 ///< total number of pictures in the decoded picture buffer
    116 #else
    117   Int       m_maxDecPicBuffering[MAX_TLAYER];                 ///< total number of reference pictures needed for decoding
    118 #endif
    119 #if !L0034_COMBINED_LIST_CLEANUP
    120   Bool      m_bUseLComb;                                      ///< flag for using combined reference list for uni-prediction in B-slices (JCTVC-D421)
    121 #endif
    122116  Bool      m_useTransformSkip;                               ///< flag for enabling intra transform skipping
    123117  Bool      m_useTransformSkipFast;                           ///< flag for enabling fast intra transform skipping
     
    181175  Int       m_loopFilterTcOffsetDiv2;                       ///< tc offset for deblocking filter
    182176  Bool      m_DeblockingFilterControlPresent;                 ///< deblocking filter control present flag in PPS
    183 #if L0386_DB_METRIC
    184177  Bool      m_DeblockingFilterMetric;                         ///< blockiness metric in encoder
    185 #endif
    186178 
    187179  // coding tools (PCM)
     
    197189  Bool      m_useRDOQ;                                       ///< flag for using RD optimized quantization
    198190  Bool      m_useRDOQTS;                                     ///< flag for using RD optimized quantization for transform skip
    199 #if L0232_RD_PENALTY
    200191  Int      m_rdPenalty;                                      ///< RD-penalty for 32x32 TU for intra in non-intra slices (0: no RD-penalty, 1: RD-penalty, 2: maximum RD-penalty)
    201 #endif
    202192  Int       m_iFastSearch;                                    ///< ME mode, 0 = full, 1 = diamond, 2 = PMVFAST
    203193  Int       m_iSearchRange;                                   ///< ME search range
     
    208198  Bool      m_bUseCbfFastMode;                              ///< flag for using Cbf Fast PU Mode Decision
    209199  Bool      m_useEarlySkipDetection;                         ///< flag for using Early SKIP Detection
     200#if FAST_INTRA_SHVC
     201  Bool      m_useFastIntraScalable;                          ///< flag for using Fast Intra Decision for Scalable HEVC
     202#endif
    210203  Int       m_sliceMode;                                     ///< 0: no slice limits, 1 : max number of CTBs per slice, 2: max number of bytes per slice,
    211204                                                             ///< 3: max number of tiles per slice
     
    235228  Int       m_bufferingPeriodSEIEnabled;
    236229  Int       m_pictureTimingSEIEnabled;
    237 #if J0149_TONE_MAPPING_SEI
    238230  Bool      m_toneMappingInfoSEIEnabled;
    239231  Int       m_toneMapId;
     
    261253  Int*      m_codedPivotValue;
    262254  Int*      m_targetPivotValue;
    263 #endif
    264255  Int       m_framePackingSEIEnabled;
    265256  Int       m_framePackingSEIType;
     
    271262  Int       m_gradualDecodingRefreshInfoEnabled;
    272263  Int       m_decodingUnitInfoSEIEnabled;
    273 #if L0208_SOP_DESCRIPTION_SEI
     264#if M0043_LAYERS_PRESENT_SEI
     265  Int       m_layersPresentSEIEnabled;
     266#endif
    274267  Int       m_SOPDescriptionSEIEnabled;
    275 #endif
    276 #if K0180_SCALABLE_NESTING_SEI
    277268  Int       m_scalableNestingSEIEnabled;
    278 #endif
    279269  // weighted prediction
    280270  Bool      m_useWeightedPred;                    ///< Use of weighted prediction in P slices
     
    287277  Int       m_signHideFlag;
    288278#if RATE_CONTROL_LAMBDA_DOMAIN
     279#if !RC_SHVC_HARMONIZATION
    289280  Bool      m_RCEnableRateControl;                ///< enable rate control or not
    290281  Int       m_RCTargetBitrate;                    ///< target bitrate when rate control is enabled
     282#if M0036_RC_IMPROVEMENT
     283  Int       m_RCKeepHierarchicalBit;              ///< 0: equal bit allocation; 1: fixed ratio bit allocation; 2: adaptive ratio bit allocation
     284#else
    291285  Bool      m_RCKeepHierarchicalBit;              ///< whether keeping hierarchical bit allocation structure or not
     286#endif
    292287  Bool      m_RCLCULevelRC;                       ///< true: LCU level rate control; false: picture level rate control
    293288  Bool      m_RCUseLCUSeparateModel;              ///< use separate R-lambda model at LCU level
    294289  Int       m_RCInitialQP;                        ///< inital QP for rate control
    295290  Bool      m_RCForceIntraQP;                     ///< force all intra picture to use initial QP or not
     291#endif
    296292#else
    297293  Bool      m_enableRateCtrl;                                   ///< Flag for using rate control algorithm
     
    352348  Void  xPrintParameter ();                                   ///< print configuration values
    353349  Void  xPrintUsage     ();                                   ///< print usage
    354 #if SIGNAL_BITRATE_PICRATE_IN_VPS
    355   Int       m_bitRatePicRateMaxTLayers;                       ///< Indicates max. number of sub-layers for which bit rate is signalled.
    356   Bool*     m_bitRateInfoPresentFlag;                         ///< Indicates whether bit rate information is signalled
    357   Bool*     m_picRateInfoPresentFlag;                         ///< Indicates whether pic rate information is signalled
    358   Int*      m_avgBitRate;                                     ///< Indicates avg. bit rate information for various sub-layers
    359   Int*      m_maxBitRate;                                     ///< Indicates max. bit rate information for various sub-layers
    360   Int*      m_avgPicRate;                                     ///< Indicates avg. picture rate information for various sub-layers
    361   Int*      m_constantPicRateIdc;                                ///< Indicates constant picture rate idc for various sub-layers
     350#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     351  Int       m_adaptiveResolutionChange;                       ///< Indicate adaptive resolution change frame
    362352#endif
    363353public:
     
    385375  Char* getBLSyntaxFile()           { return m_BLSyntaxFile;      }
    386376#endif
     377#if SCALED_REF_LAYER_OFFSETS
     378  Void cfgStringToArray(Int **arr, string cfgString, Int numEntries, const char* logString);
     379#endif
    387380#endif
    388381};// END CLASS DEFINITION TAppEncCfg
  • trunk/source/App/TAppEncoder/TAppEncLayerCfg.cpp

    r191 r310  
    3535  m_confLeft = m_confRight = m_confTop = m_confBottom = 0;
    3636  m_aiPad[1] = m_aiPad[0] = 0;
     37#if SCALED_REF_LAYER_OFFSETS
     38  m_numScaledRefLayerOffsets = 0;
     39  ::memset(m_scaledRefLayerLeftOffset,   0, sizeof(m_scaledRefLayerLeftOffset));
     40  ::memset(m_scaledRefLayerTopOffset,    0, sizeof(m_scaledRefLayerTopOffset));
     41  ::memset(m_scaledRefLayerRightOffset,  0, sizeof(m_scaledRefLayerRightOffset));
     42  ::memset(m_scaledRefLayerBottomOffset, 0, sizeof(m_scaledRefLayerBottomOffset));
     43#endif
    3744}
    3845
     
    134141  printf("QP                            : %5.2f\n", m_fQP );
    135142  printf("Intra period                  : %d\n", m_iIntraPeriod );
     143#if RC_SHVC_HARMONIZATION
     144  printf("RateControl                   : %d\n", m_RCEnableRateControl );
     145  if(m_RCEnableRateControl)
     146  {
     147    printf("TargetBitrate                 : %d\n", m_RCTargetBitrate );
     148    printf("KeepHierarchicalBit           : %d\n", m_RCKeepHierarchicalBit );
     149    printf("LCULevelRC                    : %d\n", m_RCLCULevelRC );
     150    printf("UseLCUSeparateModel           : %d\n", m_RCUseLCUSeparateModel );
     151    printf("InitialQP                     : %d\n", m_RCInitialQP );
     152    printf("ForceIntraQP                  : %d\n", m_RCForceIntraQP );
     153  }
     154#endif
    136155  printf("WaveFrontSynchro:%d WaveFrontSubstreams:%d", m_cAppEncCfg->getWaveFrontSynchro(), m_iWaveFrontSubstreams);
    137156}
  • trunk/source/App/TAppEncoder/TAppEncLayerCfg.h

    r191 r310  
    4343  Double    m_fQP;                                            ///< QP value of key-picture (floating point)
    4444#if VPS_EXTN_DIRECT_REF_LAYERS
     45#if M0457_PREDICTION_INDICATIONS
     46  Int       *m_samplePredRefLayerIds;
     47  Int       m_numSamplePredRefLayers;
     48  Int       *m_motionPredRefLayerIds;
     49  Int       m_numMotionPredRefLayers;
     50#else
    4551  Int       *m_refLayerIds;
    4652  Int       m_numDirectRefLayers;
    4753#endif
     54  Int       *m_predLayerIds;
     55  Int       m_numActiveRefLayers;
     56#endif
     57
     58#if RC_SHVC_HARMONIZATION
     59  Bool      m_RCEnableRateControl;                ///< enable rate control or not
     60  Int       m_RCTargetBitrate;                    ///< target bitrate when rate control is enabled
     61  Bool      m_RCKeepHierarchicalBit;              ///< whether keeping hierarchical bit allocation structure or not
     62  Bool      m_RCLCULevelRC;                       ///< true: LCU level rate control; false: picture level rate control
     63  Bool      m_RCUseLCUSeparateModel;              ///< use separate R-lambda model at LCU level
     64  Int       m_RCInitialQP;                        ///< inital QP for rate control
     65  Bool      m_RCForceIntraQP;                     ///< force all intra picture to use initial QP or not
     66#endif
     67
    4868#if SVC_EXTENSION
    4969  Int       m_iWaveFrontSubstreams; //< If iWaveFrontSynchro, this is the number of substreams per frame (dependent tiles) or per tile (independent tiles).
     
    5575  TAppEncCfg* m_cAppEncCfg;                                   ///< pointer to app encoder config
    5676#if SCALED_REF_LAYER_OFFSETS
    57   Int       m_scaledRefLayerLeftOffset;
    58   Int       m_scaledRefLayerTopOffset;
    59   Int       m_scaledRefLayerRightOffset;
    60   Int       m_scaledRefLayerBottomOffset;
     77  Int       m_numScaledRefLayerOffsets  ;
     78  Int       m_scaledRefLayerLeftOffset  [MAX_LAYERS];
     79  Int       m_scaledRefLayerTopOffset   [MAX_LAYERS];
     80  Int       m_scaledRefLayerRightOffset [MAX_LAYERS];
     81  Int       m_scaledRefLayerBottomOffset[MAX_LAYERS];
    6182#endif 
    6283public:
     
    94115  Int*    getdQPs()                   {return m_aidQP;            }
    95116#if VPS_EXTN_DIRECT_REF_LAYERS
     117#if M0457_PREDICTION_INDICATIONS
     118  Int     getNumSamplePredRefLayers()    {return m_numSamplePredRefLayers;   }
     119  Int*    getSamplePredRefLayerIds()     {return m_samplePredRefLayerIds;    }
     120  Int     getSamplePredRefLayerId(Int i) {return m_samplePredRefLayerIds[i]; }
     121  Int     getNumMotionPredRefLayers()    {return m_numMotionPredRefLayers;   }
     122  Int*    getMotionPredRefLayerIds()     {return m_motionPredRefLayerIds;    }
     123  Int     getMotionPredRefLayerId(Int i) {return m_motionPredRefLayerIds[i]; }
     124#else
    96125  Int     getNumDirectRefLayers()     {return m_numDirectRefLayers;}
    97126  Int*    getRefLayerIds()            {return m_refLayerIds;      }
    98127  Int     getRefLayerId(Int i)        {return m_refLayerIds[i];   }
     128#endif
     129
     130  Int     getNumActiveRefLayers()     {return m_numActiveRefLayers;}
     131  Int*    getPredLayerIds()           {return m_predLayerIds;     }
     132  Int     getPredLayerId(Int i)       {return m_predLayerIds[i];  }
     133#endif
     134#if RC_SHVC_HARMONIZATION
     135  Bool    getRCEnableRateControl()    {return m_RCEnableRateControl;   }
     136  Int     getRCTargetBitrate()        {return m_RCTargetBitrate;       }
     137  Bool    getRCKeepHierarchicalBit()  {return m_RCKeepHierarchicalBit; }
     138  Bool    getRCLCULevelRC()           {return m_RCLCULevelRC;          }
     139  Bool    getRCUseLCUSeparateModel()  {return m_RCUseLCUSeparateModel; }
     140  Int     getRCInitialQP()            {return m_RCInitialQP;           }
     141  Bool    getRCForceIntraQP()         {return m_RCForceIntraQP;        }
    99142#endif
    100143}; // END CLASS DEFINITION TAppEncLayerCfg
  • trunk/source/App/TAppEncoder/TAppEncTop.cpp

    r191 r310  
    104104    m_acTEncTop[layer].setProfile(m_profile);
    105105    m_acTEncTop[layer].setLevel(m_levelTier, m_level);
    106 #if L0046_CONSTRAINT_FLAGS
    107106    m_acTEncTop[layer].setProgressiveSourceFlag(m_progressiveSourceFlag);
    108107    m_acTEncTop[layer].setInterlacedSourceFlag(m_interlacedSourceFlag);
    109108    m_acTEncTop[layer].setNonPackedConstraintFlag(m_nonPackedConstraintFlag);
    110109    m_acTEncTop[layer].setFrameOnlyConstraintFlag(m_frameOnlyConstraintFlag);
    111 #endif
    112110
    113111#if REF_IDX_MFM
    114112#if AVC_BASE
     113#if M0457_PREDICTION_INDICATIONS
     114    m_acTEncTop[layer].setMFMEnabledFlag(layer == 0 ? false : ( m_avcBaseLayerFlag ? AVC_SYNTAX : true ) && m_acLayerCfg[layer].getNumMotionPredRefLayers());
     115#else
    115116    m_acTEncTop[layer].setMFMEnabledFlag(layer == 0 ? false : ( m_avcBaseLayerFlag ? AVC_SYNTAX : true ));
     117#endif
     118#else
     119#if M0457_PREDICTION_INDICATIONS
     120    m_acTEncTop[layer].setMFMEnabledFlag(layer == 0 ? false : ( m_acLayerCfg[layer].getNumMotionPredRefLayers() > 0 ) );
    116121#else
    117122    m_acTEncTop[layer].setMFMEnabledFlag(layer == 0 ? false : true);
     123#endif
     124#endif
     125#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
     126    m_acTEncTop[layer].setIlSampleOnlyPred( layer == 0 ? 0 : m_ilSampleOnlyPred[layer] );
    118127#endif
    119128#endif
     
    147156    if(layer)
    148157    {
     158#if M0457_PREDICTION_INDICATIONS
     159      for(Int i = 0; i < MAX_VPS_LAYER_ID_PLUS1; i++)
     160      {
     161        m_acTEncTop[layer].setSamplePredEnabledFlag(i, false);
     162        m_acTEncTop[layer].setMotionPredEnabledFlag(i, false);
     163      }
     164      if(m_acLayerCfg[layer].getNumSamplePredRefLayers() == -1)
     165      {
     166        // Not included in the configuration file; assume that each layer depends on previous layer
     167        m_acTEncTop[layer].setNumSamplePredRefLayers   (1);      // One sample pred ref. layer
     168        m_acTEncTop[layer].setSamplePredRefLayerId     (0, layer - 1);   // Previous layer
     169        m_acTEncTop[layer].setSamplePredEnabledFlag    (layer - 1, true);
     170      }
     171      else
     172      {
     173        m_acTEncTop[layer].setNumSamplePredRefLayers   ( m_acLayerCfg[layer].getNumSamplePredRefLayers() );     
     174        for(Int i = 0; i < m_acTEncTop[layer].getNumSamplePredRefLayers(); i++)
     175        {
     176          m_acTEncTop[layer].setSamplePredRefLayerId   ( i, m_acLayerCfg[layer].getSamplePredRefLayerId(i));
     177          m_acTEncTop[layer].setSamplePredEnabledFlag  (m_acLayerCfg[layer].getSamplePredRefLayerId(i), true);
     178        }       
     179      }
     180      if(m_acLayerCfg[layer].getNumMotionPredRefLayers() == -1)
     181      {
     182        // Not included in the configuration file; assume that each layer depends on previous layer
     183        m_acTEncTop[layer].setNumMotionPredRefLayers   (1);      // One motion pred ref. layer
     184        m_acTEncTop[layer].setMotionPredRefLayerId     (0, layer - 1);   // Previous layer
     185        m_acTEncTop[layer].setMotionPredEnabledFlag    (layer - 1, true);
     186      }
     187      else
     188      {
     189        m_acTEncTop[layer].setNumMotionPredRefLayers   ( m_acLayerCfg[layer].getNumMotionPredRefLayers() );     
     190        for(Int i = 0; i < m_acTEncTop[layer].getNumMotionPredRefLayers(); i++)
     191        {
     192          m_acTEncTop[layer].setMotionPredRefLayerId   ( i, m_acLayerCfg[layer].getMotionPredRefLayerId(i));
     193          m_acTEncTop[layer].setMotionPredEnabledFlag  (m_acLayerCfg[layer].getSamplePredRefLayerId(i), true);
     194        }       
     195      }
     196      Int numDirectRefLayers = 0;
     197      for (Int i = 0; i < layer; i++)
     198      {
     199        if (m_acTEncTop[layer].getSamplePredEnabledFlag(i) || m_acTEncTop[layer].getMotionPredEnabledFlag(i))
     200        {
     201          m_acTEncTop[layer].setRefLayerId(numDirectRefLayers, i);
     202          numDirectRefLayers++;
     203        }
     204      }
     205      m_acTEncTop[layer].setNumDirectRefLayers(numDirectRefLayers);
     206#else
    149207      if(m_acLayerCfg[layer].getNumDirectRefLayers() == -1)
    150208      {
     
    159217        {
    160218          m_acTEncTop[layer].setRefLayerId             ( i, m_acLayerCfg[layer].getRefLayerId(i));
    161         }       
     219        }
     220      }
     221#endif
     222      if(m_acLayerCfg[layer].getNumActiveRefLayers() == -1)
     223      {
     224#if M0457_PREDICTION_INDICATIONS
     225        m_acTEncTop[layer].setNumActiveRefLayers( m_acTEncTop[layer].getNumDirectRefLayers() );
     226#else
     227        m_acTEncTop[layer].setNumActiveRefLayers( m_acLayerCfg[layer].getNumDirectRefLayers() );
     228#endif
     229        for( Int i = 0; i < m_acTEncTop[layer].getNumActiveRefLayers(); i++ )
     230        {
     231          m_acTEncTop[layer].setPredLayerId(i, i);
     232        }
     233      }
     234      else
     235      {
     236        m_acTEncTop[layer].setNumActiveRefLayers       ( m_acLayerCfg[layer].getNumActiveRefLayers() );     
     237        for(Int i = 0; i < m_acTEncTop[layer].getNumActiveRefLayers(); i++)
     238        {
     239          m_acTEncTop[layer].setPredLayerId             ( i, m_acLayerCfg[layer].getPredLayerId(i));
     240        }
    162241      }
    163242    }
     
    171250    m_acTEncTop[layer].setLoopFilterTcOffset           ( m_loopFilterTcOffsetDiv2    );
    172251    m_acTEncTop[layer].setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent);
    173 #if L0386_DB_METRIC
    174252    m_acTEncTop[layer].setDeblockingFilterMetric       ( m_DeblockingFilterMetric );
    175 #endif
    176253
    177254    //====== Motion search ========
     
    207284    m_acTEncTop[layer].setUseHADME                     ( m_bUseHADME    );
    208285    m_acTEncTop[layer].setUseLossless                  ( m_useLossless );
    209 #if !L0034_COMBINED_LIST_CLEANUP
    210     m_cTEncTop.setUseLComb                             ( m_bUseLComb    );
    211 #endif
    212286    m_acTEncTop[layer].setdQPs                         ( m_acLayerCfg[layer].getdQPs() );
    213287    m_acTEncTop[layer].setUseRDOQ                      ( m_useRDOQ     );
    214288    m_acTEncTop[layer].setUseRDOQTS                    ( m_useRDOQTS   );
    215 #if L0232_RD_PENALTY
    216289    m_acTEncTop[layer].setRDpenalty                    ( m_rdPenalty );
    217 #endif
    218290    m_acTEncTop[layer].setQuadtreeTULog2MaxSize        ( m_uiQuadtreeTULog2MaxSize );
    219291    m_acTEncTop[layer].setQuadtreeTULog2MinSize        ( m_uiQuadtreeTULog2MinSize );
     
    225297    m_acTEncTop[layer].setUseCbfFastMode               ( m_bUseCbfFastMode  );
    226298    m_acTEncTop[layer].setUseEarlySkipDetection        ( m_useEarlySkipDetection );
     299#if FAST_INTRA_SHVC
     300    m_acTEncTop[layer].setUseFastIntraScalable         ( m_useFastIntraScalable );
     301#endif
    227302
    228303    m_acTEncTop[layer].setUseTransformSkip             ( m_useTransformSkip      );
     
    279354    m_acTEncTop[layer].setBufferingPeriodSEIEnabled( m_bufferingPeriodSEIEnabled );
    280355    m_acTEncTop[layer].setPictureTimingSEIEnabled( m_pictureTimingSEIEnabled );
    281 #if J0149_TONE_MAPPING_SEI
    282356    m_acTEncTop[layer].setToneMappingInfoSEIEnabled                 ( m_toneMappingInfoSEIEnabled );
    283357    m_acTEncTop[layer].setTMISEIToneMapId                           ( m_toneMapId );
     
    305379    m_acTEncTop[layer].setTMISEINominalWhiteLevelLumaCodeValue      ( m_nominalWhiteLevelLumaCodeValue );
    306380    m_acTEncTop[layer].setTMISEIExtendedWhiteLevelLumaCodeValue     ( m_extendedWhiteLevelLumaCodeValue );
    307 #endif
    308381    m_acTEncTop[layer].setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled );
    309382    m_acTEncTop[layer].setFramePackingArrangementSEIType( m_framePackingSEIType );
     
    315388    m_acTEncTop[layer].setGradualDecodingRefreshInfoEnabled( m_gradualDecodingRefreshInfoEnabled );
    316389    m_acTEncTop[layer].setDecodingUnitInfoSEIEnabled( m_decodingUnitInfoSEIEnabled );
    317 #if L0208_SOP_DESCRIPTION_SEI
     390#if M0043_LAYERS_PRESENT_SEI
     391    m_acTEncTop[layer].setLayersPresentSEIEnabled( m_layersPresentSEIEnabled );
     392#endif
    318393    m_acTEncTop[layer].setSOPDescriptionSEIEnabled( m_SOPDescriptionSEIEnabled );
    319 #endif
    320 #if K0180_SCALABLE_NESTING_SEI
    321394    m_acTEncTop[layer].setScalableNestingSEIEnabled( m_scalableNestingSEIEnabled );
    322 #endif
    323395    m_acTEncTop[layer].setUniformSpacingIdr          ( m_iUniformSpacingIdr );
    324396    m_acTEncTop[layer].setNumColumnsMinus1           ( m_iNumColumnsMinus1 );
     
    343415    m_acTEncTop[layer].setSignHideFlag(m_signHideFlag);
    344416#if RATE_CONTROL_LAMBDA_DOMAIN
     417#if RC_SHVC_HARMONIZATION
     418    m_acTEncTop[layer].setUseRateCtrl     (m_acLayerCfg[layer].getRCEnableRateControl());
     419    m_acTEncTop[layer].setTargetBitrate   (m_acLayerCfg[layer].getRCTargetBitrate());
     420    m_acTEncTop[layer].setKeepHierBit     (m_acLayerCfg[layer].getRCKeepHierarchicalBit());
     421    m_acTEncTop[layer].setLCULevelRC      (m_acLayerCfg[layer].getRCLCULevelRC());
     422    m_acTEncTop[layer].setUseLCUSeparateModel (m_acLayerCfg[layer].getRCUseLCUSeparateModel());
     423    m_acTEncTop[layer].setInitialQP           (m_acLayerCfg[layer].getRCInitialQP());
     424    m_acTEncTop[layer].setForceIntraQP        (m_acLayerCfg[layer].getRCForceIntraQP());
     425#else
    345426    m_acTEncTop[layer].setUseRateCtrl         ( m_RCEnableRateControl );
    346427    m_acTEncTop[layer].setTargetBitrate       ( m_RCTargetBitrate );
     
    350431    m_acTEncTop[layer].setInitialQP           ( m_RCInitialQP );
    351432    m_acTEncTop[layer].setForceIntraQP        ( m_RCForceIntraQP );
     433#endif
    352434#else
    353435    m_acTEncTop[layer].setUseRateCtrl     ( m_enableRateCtrl);
     
    389471    m_acTEncTop[layer].setLog2MaxMvLengthHorizontal( m_log2MaxMvLengthHorizontal );
    390472    m_acTEncTop[layer].setLog2MaxMvLengthVertical( m_log2MaxMvLengthVertical );
    391 #if SIGNAL_BITRATE_PICRATE_IN_VPS
    392     TComBitRatePicRateInfo *bitRatePicRateInfo = m_cTEncTop[layer].getVPS()->getBitratePicrateInfo();
    393     // The number of bit rate/pic rate have to equal to number of sub-layers.
    394     if(m_bitRatePicRateMaxTLayers)
    395     {
    396       assert(m_bitRatePicRateMaxTLayers == m_cTEncTop[layer].getVPS()->getMaxTLayers());
    397     }
    398     for(Int i = 0; i < m_bitRatePicRateMaxTLayers; i++)
    399     {
    400       bitRatePicRateInfo->setBitRateInfoPresentFlag( i, m_bitRateInfoPresentFlag[i] );
    401       if( bitRatePicRateInfo->getBitRateInfoPresentFlag(i) )
    402       {
    403         bitRatePicRateInfo->setAvgBitRate(i, m_avgBitRate[i]);
    404         bitRatePicRateInfo->setMaxBitRate(i, m_maxBitRate[i]);
    405       }
    406     }
    407     for(Int i = 0; i < m_bitRatePicRateMaxTLayers; i++)
    408     {
    409       bitRatePicRateInfo->setPicRateInfoPresentFlag( i, m_picRateInfoPresentFlag[i] );
    410       if( bitRatePicRateInfo->getPicRateInfoPresentFlag(i) )
    411       {
    412         bitRatePicRateInfo->setAvgPicRate     (i, m_avgPicRate[i]);
    413         bitRatePicRateInfo->setConstantPicRateIdc(i, m_constantPicRateIdc[i]);
    414       }
    415     }
    416 #endif
    417473#if REF_IDX_FRAMEWORK
    418474    m_acTEncTop[layer].setElRapSliceTypeB(layer == 0? 0 : m_elRapSliceBEnabled);
     
    421477    if( layer > 0 )
    422478    {
    423       m_acTEncTop[layer].getScaledRefLayerWindow().setWindow( 2*m_acLayerCfg[layer].m_scaledRefLayerLeftOffset, 2*m_acLayerCfg[layer].m_scaledRefLayerRightOffset,
    424                                                   2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset, 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset); 
    425     }
     479      m_acTEncTop[layer].setNumScaledRefLayerOffsets( m_acLayerCfg[layer].m_numScaledRefLayerOffsets );
     480      for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++)
     481      {
     482        m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow( 2*m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i],
     483                                                  2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i]); 
     484      }
     485    }
     486#endif
     487#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     488    m_acTEncTop[layer].setAdaptiveResolutionChange( m_adaptiveResolutionChange );
    426489#endif
    427490  }
     
    447510  m_cTEncTop.setProfile(m_profile);
    448511  m_cTEncTop.setLevel(m_levelTier, m_level);
    449 #if L0046_CONSTRAINT_FLAGS
    450512  m_cTEncTop.setProgressiveSourceFlag(m_progressiveSourceFlag);
    451513  m_cTEncTop.setInterlacedSourceFlag(m_interlacedSourceFlag);
    452514  m_cTEncTop.setNonPackedConstraintFlag(m_nonPackedConstraintFlag);
    453515  m_cTEncTop.setFrameOnlyConstraintFlag(m_frameOnlyConstraintFlag);
    454 #endif
    455516
    456517  m_cTEncTop.setFrameRate                    ( m_iFrameRate );
     
    491552  m_cTEncTop.setLoopFilterTcOffset           ( m_loopFilterTcOffsetDiv2    );
    492553  m_cTEncTop.setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent);
    493 #if L0386_DB_METRIC
    494554  m_cTEncTop.setDeblockingFilterMetric       ( m_DeblockingFilterMetric );
    495 #endif
    496555
    497556  //====== Motion search ========
     
    527586  m_cTEncTop.setUseHADME                     ( m_bUseHADME    );
    528587  m_cTEncTop.setUseLossless                  ( m_useLossless );
    529 #if !L0034_COMBINED_LIST_CLEANUP
    530   m_cTEncTop.setUseLComb                     ( m_bUseLComb    );
    531 #endif
    532588  m_cTEncTop.setdQPs                         ( m_aidQP        );
    533589  m_cTEncTop.setUseRDOQ                      ( m_useRDOQ     );
    534590  m_cTEncTop.setUseRDOQTS                    ( m_useRDOQTS   );
    535 #if L0232_RD_PENALTY
    536591  m_cTEncTop.setRDpenalty                 ( m_rdPenalty );
    537 #endif
    538592  m_cTEncTop.setQuadtreeTULog2MaxSize        ( m_uiQuadtreeTULog2MaxSize );
    539593  m_cTEncTop.setQuadtreeTULog2MinSize        ( m_uiQuadtreeTULog2MinSize );
     
    545599  m_cTEncTop.setUseCbfFastMode            ( m_bUseCbfFastMode  );
    546600  m_cTEncTop.setUseEarlySkipDetection            ( m_useEarlySkipDetection );
     601#if FAST_INTRA_SHVC
     602  m_cTEncTop.setUseFastIntraScalable            ( m_useFastIntraScalable );
     603#endif
    547604
    548605  m_cTEncTop.setUseTransformSkip             ( m_useTransformSkip      );
     
    599656  m_cTEncTop.setBufferingPeriodSEIEnabled( m_bufferingPeriodSEIEnabled );
    600657  m_cTEncTop.setPictureTimingSEIEnabled( m_pictureTimingSEIEnabled );
    601 #if J0149_TONE_MAPPING_SEI
    602658  m_cTEncTop.setToneMappingInfoSEIEnabled                 ( m_toneMappingInfoSEIEnabled );
    603659  m_cTEncTop.setTMISEIToneMapId                           ( m_toneMapId );
     
    625681  m_cTEncTop.setTMISEINominalWhiteLevelLumaCodeValue      ( m_nominalWhiteLevelLumaCodeValue );
    626682  m_cTEncTop.setTMISEIExtendedWhiteLevelLumaCodeValue     ( m_extendedWhiteLevelLumaCodeValue );
    627 #endif
    628683  m_cTEncTop.setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled );
    629684  m_cTEncTop.setFramePackingArrangementSEIType( m_framePackingSEIType );
     
    635690  m_cTEncTop.setGradualDecodingRefreshInfoEnabled( m_gradualDecodingRefreshInfoEnabled );
    636691  m_cTEncTop.setDecodingUnitInfoSEIEnabled( m_decodingUnitInfoSEIEnabled );
    637 #if L0208_SOP_DESCRIPTION_SEI
     692#if M0043_LAYERS_PRESENT_SEI
     693  m_cTEncTop.setLayersPresentSEIEnabled( m_layersPresentSEIEnabled );
     694#endif
    638695  m_cTEncTop.setSOPDescriptionSEIEnabled( m_SOPDescriptionSEIEnabled );
    639 #endif
    640 #if K0180_SCALABLE_NESTING_SEI
    641696  m_cTEncTop.setScalableNestingSEIEnabled( m_scalableNestingSEIEnabled );
    642 #endif
    643697  m_cTEncTop.setUniformSpacingIdr          ( m_iUniformSpacingIdr );
    644698  m_cTEncTop.setNumColumnsMinus1           ( m_iNumColumnsMinus1 );
     
    709763  m_cTEncTop.setLog2MaxMvLengthHorizontal( m_log2MaxMvLengthHorizontal );
    710764  m_cTEncTop.setLog2MaxMvLengthVertical( m_log2MaxMvLengthVertical );
    711 #if SIGNAL_BITRATE_PICRATE_IN_VPS
    712   TComBitRatePicRateInfo *bitRatePicRateInfo = m_cTEncTop.getVPS()->getBitratePicrateInfo();
    713   // The number of bit rate/pic rate have to equal to number of sub-layers.
    714   if(m_bitRatePicRateMaxTLayers)
    715   {
    716     assert(m_bitRatePicRateMaxTLayers == m_cTEncTop.getVPS()->getMaxTLayers());
    717   }
    718   for(Int i = 0; i < m_bitRatePicRateMaxTLayers; i++)
    719   {
    720     bitRatePicRateInfo->setBitRateInfoPresentFlag( i, m_bitRateInfoPresentFlag[i] );
    721     if( bitRatePicRateInfo->getBitRateInfoPresentFlag(i) )
    722     {
    723       bitRatePicRateInfo->setAvgBitRate(i, m_avgBitRate[i]);
    724       bitRatePicRateInfo->setMaxBitRate(i, m_maxBitRate[i]);
    725     }
    726   }
    727   for(Int i = 0; i < m_bitRatePicRateMaxTLayers; i++)
    728   {
    729     bitRatePicRateInfo->setPicRateInfoPresentFlag( i, m_picRateInfoPresentFlag[i] );
    730     if( bitRatePicRateInfo->getPicRateInfoPresentFlag(i) )
    731     {
    732       bitRatePicRateInfo->setAvgPicRate     (i, m_avgPicRate[i]);
    733       bitRatePicRateInfo->setConstantPicRateIdc(i, m_constantPicRateIdc[i]);
    734     }
    735   }
    736 #endif
    737765}
    738766#endif
     
    828856  if(m_numLayers > 1)
    829857  {
    830     vps->setScalabilityMask(1, true); // Only turn on spatial/SNR scalability
    831     vps->setNumScalabilityTypes(1);
     858    Int scalabilityTypes = 0;
     859    for(i = 0; i < MAX_VPS_NUM_SCALABILITY_TYPES; i++)
     860    {
     861      vps->setScalabilityMask(i, m_scalabilityMask[i]);
     862      scalabilityTypes += m_scalabilityMask[i];
     863    }
     864    assert( scalabilityTypes == 1 );
     865    vps->setNumScalabilityTypes(scalabilityTypes);
    832866  }
    833867  else
     
    861895  // Target output layer
    862896#if VPS_PROFILE_OUTPUT_LAYERS
    863   vps->setNumOutputLayerSets(2);    // 2 including the default base-layer set.
    864   vps->setNumProfileTierLevel(2);   // 1 for the enhancement layer
    865   vps->setProfileLevelTierIdx(1, 1);
     897  vps->setNumOutputLayerSets(vps->getNumLayerSets());   
     898  vps->setNumProfileTierLevel(vps->getNumLayerSets());   
    866899  vps->setDefaultOneTargetOutputLayerFlag(true);
    867   Int lsIdx = 1;
    868   vps->setOutputLayerSetIdx(1, lsIdx); // Because only one layer set
     900  for(i = 1; i < vps->getNumLayerSets(); i++)
     901  {
     902    vps->setProfileLevelTierIdx(i, i);
     903    vps->setOutputLayerSetIdx(i, i);
     904  }
    869905#else
    870906  vps->setNumOutputLayerSets(1);
     
    872908  vps->setOutputLayerSetIdx(0, lsIdx); // Because only one layer set
    873909#endif
    874   // Include the highest layer as output layer
    875   for(UInt layer=0; layer <= vps->getMaxLayerId() ; layer++)
    876   {
    877     if(vps->getLayerIdIncludedFlag(lsIdx, layer))
    878     {
    879       vps->setOutputLayerFlag(lsIdx, layer, layer == (vps->getMaxLayerId()));
     910  for(Int lsIdx = 1; lsIdx < vps->getNumLayerSets(); lsIdx++)
     911  {
     912    // Include the highest layer as output layer
     913    for(UInt layer=0; layer <= vps->getMaxLayerId() ; layer++)
     914    {
     915      if(vps->getLayerIdIncludedFlag(lsIdx, layer))
     916      {
     917        vps->setOutputLayerFlag(lsIdx, layer, layer == (vps->getMaxLayerId()));
     918      }
    880919    }
    881920  }
     
    883922#if VPS_EXTN_DIRECT_REF_LAYERS
    884923  // Direct reference layers
     924  UInt maxDirectRefLayers = 0;
    885925  for(UInt layerCtr = 1;layerCtr <= vps->getMaxLayers() - 1; layerCtr++)
    886926  {
    887927    vps->setNumDirectRefLayers( layerCtr, m_acTEncTop[layerCtr].getNumDirectRefLayers() );
     928    maxDirectRefLayers = max<UInt>( maxDirectRefLayers, vps->getNumDirectRefLayers( layerCtr ) );
     929
    888930    for(i = 0; i < vps->getNumDirectRefLayers(layerCtr); i++)
    889931    {
     
    900942      vps->setDirectDependencyFlag( layerCtr, vps->getLayerIdInVps(m_acTEncTop[layerCtr].getRefLayerId(i)), true);
    901943    }
     944#if M0457_PREDICTION_INDICATIONS
     945    vps->setDirectDepTypeLen(2); // sample and motion types are encoded
     946    for(Int refLayerCtr = 0; refLayerCtr < layerCtr; refLayerCtr++)
     947    {
     948      if (vps->getDirectDependencyFlag( layerCtr, refLayerCtr))
     949      {
     950        assert(m_acTEncTop[layerCtr].getSamplePredEnabledFlag(refLayerCtr) || m_acTEncTop[layerCtr].getMotionPredEnabledFlag(refLayerCtr));
     951        vps->setDirectDependencyType( layerCtr, refLayerCtr, ((m_acTEncTop[layerCtr].getSamplePredEnabledFlag(refLayerCtr) ? 1 : 0) |
     952                                                              (m_acTEncTop[layerCtr].getMotionPredEnabledFlag(refLayerCtr) ? 2 : 0)) - 1);
     953      }
     954      else
     955      {
     956        vps->setDirectDependencyType( layerCtr, refLayerCtr, 0 );
     957      }
     958    }
     959#endif
    902960  }
    903961#endif
    904962#if JCTVC_M0458_INTERLAYER_RPS_SIG       
    905     vps->setMaxOneActiveRefLayerFlag(true);
     963    vps->setMaxOneActiveRefLayerFlag(maxDirectRefLayers > 1 ? false : true);
    906964#endif
     965#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     966  vps->setSingleLayerForNonIrapFlag(m_adaptiveResolutionChange > 0 ? true : false);
     967#endif
    907968#else
    908969  m_cTEncTop.init();
     
    10141075    }
    10151076
     1077#if RC_SHVC_HARMONIZATION
     1078    for(UInt layer=0; layer<m_numLayers; layer++)
     1079    {
     1080      if ( m_acTEncTop[layer].getUseRateCtrl() )
     1081      {
     1082        (m_acTEncTop[layer].getRateCtrl())->initRCGOP(m_acTEncTop[layer].getNumPicRcvd());
     1083      }
     1084    }
     1085#endif
     1086
     1087#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     1088    if (m_adaptiveResolutionChange)
     1089    {
     1090      for(UInt layer = 0; layer < m_numLayers; layer++)
     1091      {
     1092        TComList<TComPicYuv*>::iterator iterPicYuvRec;
     1093        for (iterPicYuvRec = m_acListPicYuvRec[layer].begin(); iterPicYuvRec != m_acListPicYuvRec[layer].end(); iterPicYuvRec++)
     1094        {
     1095          TComPicYuv* recPic = *(iterPicYuvRec);
     1096          recPic->setReconstructed(false);
     1097        }
     1098      }
     1099    }
     1100#endif
     1101
    10161102    // loop through frames in one GOP
    10171103    for ( UInt iPicIdInGOP=0; iPicIdInGOP < (bFirstFrame? 1:m_iGOPSize); iPicIdInGOP++ )
     
    10241110      }
    10251111    }
     1112
     1113#if RC_SHVC_HARMONIZATION
     1114    for(UInt layer=0; layer<m_numLayers; layer++)
     1115    {
     1116      if ( m_acTEncTop[layer].getUseRateCtrl() )
     1117      {
     1118        (m_acTEncTop[layer].getRateCtrl())->destroyRCGOP();
     1119      }
     1120    }
     1121#endif
    10261122
    10271123    iTotalNumEncoded = 0;
     
    12701366  {
    12711367    TComPicYuv*  pcPicYuvRec  = *(iterPicYuvRec++);
     1368#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     1369    if (!m_acLayerCfg[layer].getReconFile().empty() && pcPicYuvRec->isReconstructed())
     1370#else
    12721371    if (!m_acLayerCfg[layer].getReconFile().empty())
     1372#endif
    12731373    {
    12741374      m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getConfLeft(), m_acLayerCfg[layer].getConfRight(),
     
    12841384  list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin();
    12851385
     1386#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     1387  for ( i = 0; i < iNumEncoded && iterBitstream != accessUnits.end(); i++ )
     1388#else
    12861389  for ( i = 0; i < iNumEncoded; i++ )
     1390#endif
    12871391  {
    12881392    const AccessUnit& au = *(iterBitstream++);
  • trunk/source/App/TAppEncoder/encmain.cpp

    r191 r310  
    5757  // print information
    5858  fprintf( stdout, "\n" );
     59#if SVC_EXTENSION
    5960  fprintf( stdout, "SHM software: Encoder Version [%s]", NV_VERSION );
     61#else
     62  fprintf( stdout, "HM software: Encoder Version [%s]", NV_VERSION );
     63#endif
    6064  fprintf( stdout, NVM_ONOS );
    6165  fprintf( stdout, NVM_COMPILEDBY );
Note: See TracChangeset for help on using the changeset viewer.