Ignore:
Timestamp:
26 Feb 2015, 00:21:54 (10 years ago)
Author:
seregin
Message:

merge with SHM-upgrade branch

Location:
branches/SHM-dev
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev

  • branches/SHM-dev/source

  • branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp

    r1011 r1029  
    4242#include <fcntl.h>
    4343#include <assert.h>
     44#if !SVC_EXTENSION
     45#include <iomanip>
     46#endif
    4447
    4548#include "TAppEncTop.h"
     
    8083  vps->setVpsPocLsbAlignedFlag(false);
    8184#endif
    82   vps->setMaxTLayers                       ( m_maxTempLayer );
     85  vps->setMaxTLayers                                                      ( m_maxTempLayer );
    8386  if (m_maxTempLayer == 1)
    8487  {
     
    8790  for(Int i = 0; i < MAX_TLAYER; i++)
    8891  {
    89     vps->setNumReorderPics                 ( m_numReorderPics[i], i );
    90     vps->setMaxDecPicBuffering             ( m_maxDecPicBuffering[i], i );
     92    vps->setNumReorderPics                                                ( m_numReorderPics[i], i );
     93    vps->setMaxDecPicBuffering                                            ( m_maxDecPicBuffering[i], i );
    9194  }
    9295
     
    107110#endif
    108111#if O0194_DIFFERENT_BITDEPTH_EL_BL
    109           && m_acLayerCfg[layer].m_internalBitDepthY == m_acLayerCfg[idx].m_internalBitDepthY && m_acLayerCfg[layer].m_internalBitDepthC == m_acLayerCfg[idx].m_internalBitDepthC
     112          && m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA] == m_acLayerCfg[idx].m_internalBitDepth[CHANNEL_TYPE_LUMA] && m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA] == m_acLayerCfg[idx].m_internalBitDepth[CHANNEL_TYPE_CHROMA]
    110113#endif
    111114          )
     
    150153  }
    151154
    152   vps->setVpsNumRepFormats( maxRepFormatIdx + 1 );
     155  vps->setVpsNumRepFormats                                                ( maxRepFormatIdx + 1 );
    153156
    154157#if Q0195_REP_FORMAT_CLEANUP
    155158  // When not present, the value of rep_format_idx_present_flag is inferred to be equal to 0
    156   vps->setRepFormatIdxPresentFlag( vps->getVpsNumRepFormats() > 1 ? true : false );
    157 #else
    158   vps->setRepFormatIdxPresentFlag( true );
     159  vps->setRepFormatIdxPresentFlag                                         ( vps->getVpsNumRepFormats() > 1 ? true : false );
     160#else
     161  vps->setRepFormatIdxPresentFlag                                         ( true );
    159162#endif
    160163
     
    163166    RepFormat *repFormat = vps->getVpsRepFormat( idx );
    164167#if REPN_FORMAT_CONTROL_FLAG
    165     repFormat->setChromaAndBitDepthVpsPresentFlag( true );
     168    repFormat->setChromaAndBitDepthVpsPresentFlag                         ( true );
    166169    if (idx==0)
    167170    {
     
    169172    }
    170173#endif
    171     repFormat->setPicWidthVpsInLumaSamples  ( m_acLayerCfg[mapIdxToLayer[idx]].getSourceWidth()   );
    172     repFormat->setPicHeightVpsInLumaSamples ( m_acLayerCfg[mapIdxToLayer[idx]].getSourceHeight()  );
     174    repFormat->setPicWidthVpsInLumaSamples                                ( m_acLayerCfg[mapIdxToLayer[idx]].getSourceWidth()   );
     175    repFormat->setPicHeightVpsInLumaSamples                               ( m_acLayerCfg[mapIdxToLayer[idx]].getSourceHeight()  );
    173176#if AUXILIARY_PICTURES
    174     repFormat->setChromaFormatVpsIdc        ( m_acLayerCfg[mapIdxToLayer[idx]].getChromaFormatIDC() );
    175 #else
    176     repFormat->setChromaFormatVpsIdc        ( 1                                            );  // Need modification to change for each layer - corresponds to 420
    177 #endif
    178     repFormat->setSeparateColourPlaneVpsFlag( 0                                            );  // Need modification to change for each layer
     177    repFormat->setChromaFormatVpsIdc                                      ( m_acLayerCfg[mapIdxToLayer[idx]].getChromaFormatIDC() );
     178#else
     179    repFormat->setChromaFormatVpsIdc                                      ( 1 );  // Need modification to change for each layer - corresponds to 420
     180#endif
     181    repFormat->setSeparateColourPlaneVpsFlag                              ( 0 );  // Need modification to change for each layer
    179182#if O0194_DIFFERENT_BITDEPTH_EL_BL
    180     repFormat->setBitDepthVpsLuma           ( getInternalBitDepthY(mapIdxToLayer[idx])      );  // Need modification to change for each layer
    181     repFormat->setBitDepthVpsChroma         ( getInternalBitDepthC(mapIdxToLayer[idx])      );  // Need modification to change for each layer
    182 #else
    183     repFormat->setBitDepthVpsLuma           ( getInternalBitDepthY()                        );  // Need modification to change for each layer
    184     repFormat->setBitDepthVpsChroma         ( getInternalBitDepthC()                        );  // Need modification to change for each layer
     183    repFormat->setBitDepthVpsLuma                                         ( getInternalBitDepth(mapIdxToLayer[idx], CHANNEL_TYPE_LUMA)      );  // Need modification to change for each layer
     184    repFormat->setBitDepthVpsChroma                                       ( getInternalBitDepth(mapIdxToLayer[idx], CHANNEL_TYPE_CHROMA)    );  // Need modification to change for each layer
     185#else
     186    repFormat->setBitDepthVpsLuma                                         ( getInternalBitDepth(CHANNEL_TYPE_LUMA)                        );  // Need modification to change for each layer
     187    repFormat->setBitDepthVpsChroma                                       ( getInternalBitDepth(CHANNEL_TYPE_CHROMA)                      );  // Need modification to change for each layer
    185188#endif
    186189
    187190#if R0156_CONF_WINDOW_IN_REP_FORMAT
    188     repFormat->getConformanceWindowVps().setWindow(
    189       m_acLayerCfg[mapIdxToLayer[idx]].m_confWinLeft,
    190       m_acLayerCfg[mapIdxToLayer[idx]].m_confWinRight,
    191       m_acLayerCfg[mapIdxToLayer[idx]].m_confWinTop,
    192       m_acLayerCfg[mapIdxToLayer[idx]].m_confWinBottom );
     191    repFormat->getConformanceWindowVps().setWindow                        ( m_acLayerCfg[mapIdxToLayer[idx]].m_confWinLeft,                                                                             
     192                                                                            m_acLayerCfg[mapIdxToLayer[idx]].m_confWinRight,
     193                                                                            m_acLayerCfg[mapIdxToLayer[idx]].m_confWinTop,
     194                                                                            m_acLayerCfg[mapIdxToLayer[idx]].m_confWinBottom );
    193195#endif
    194196
    195197#if HIGHER_LAYER_IRAP_SKIP_FLAG
    196     m_acTEncTop[mapIdxToLayer[idx]].setSkipPictureAtArcSwitch( m_skipPictureAtArcSwitch );
     198    m_acTEncTop[mapIdxToLayer[idx]].setSkipPictureAtArcSwitch             ( m_skipPictureAtArcSwitch );
    197199#endif
    198200  }
     
    203205  //Populate PTL in VPS
    204206  TComVPS *pVPS = m_acTEncTop[0].getVPS();
    205   for (int ii = 0; ii < m_numPTLInfo; ii++)
     207  for( Int ii = 0; ii < m_numPTLInfo; ii++ )
    206208  {
    207209    pVPS->getPTL(ii)->getGeneralPTL()->setLevelIdc(m_levelList[ii]);
     
    221223  {
    222224    myvector =  m_listOfLayerPTLofOlss[ii];
     225
    223226    for (std::vector<int>::iterator it = myvector.begin() ; it != myvector.end(); ++it)
    224227    {
     
    226229    }
    227230  }
    228 
    229   //pVPS->setProfileLevelTierIdx(
    230231#endif
    231232
     
    236237#if O0194_DIFFERENT_BITDEPTH_EL_BL
    237238    //1
    238     g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
    239     g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
    240 
    241     g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
    242     g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     239    g_bitDepth[CHANNEL_TYPE_LUMA]   = m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA];
     240    g_bitDepth[CHANNEL_TYPE_CHROMA] = m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA];
     241
     242    g_PCMBitDepth[CHANNEL_TYPE_LUMA]   = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepth[CHANNEL_TYPE_LUMA]   : m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA];
     243    g_PCMBitDepth[CHANNEL_TYPE_CHROMA] = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepth[CHANNEL_TYPE_CHROMA] : m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA];
    243244
    244245    // Set this to be used in Upsampling filter in function "TComUpsampleFilter::upsampleBasePic"
    245     g_bitDepthYLayer[layer] = g_bitDepthY;
    246     g_bitDepthCLayer[layer] = g_bitDepthC;
     246    g_bitDepthLayer[CHANNEL_TYPE_LUMA][layer]   = g_bitDepth[CHANNEL_TYPE_LUMA];
     247    g_bitDepthLayer[CHANNEL_TYPE_CHROMA][layer] = g_bitDepth[CHANNEL_TYPE_CHROMA];
    247248
    248249#if O0194_WEIGHTED_PREDICTION_CGS
    249     m_acTEncTop[layer].setInterLayerWeightedPredFlag( m_useInterLayerWeightedPred );
    250 #endif
    251 #endif
    252     //m_acTEncTop[layer].setVPS(&vps);
    253     m_acTEncTop[layer].setFrameRate                    ( m_acLayerCfg[layer].getFrameRate() );
    254     m_acTEncTop[layer].setFrameSkip                    ( m_FrameSkip );
    255     m_acTEncTop[layer].setSourceWidth                  ( m_acLayerCfg[layer].getSourceWidth() );
    256     m_acTEncTop[layer].setSourceHeight                 ( m_acLayerCfg[layer].getSourceHeight() );
    257     m_acTEncTop[layer].setConformanceWindow            ( m_acLayerCfg[layer].m_confWinLeft, m_acLayerCfg[layer].m_confWinRight, m_acLayerCfg[layer].m_confWinTop, m_acLayerCfg[layer].m_confWinBottom );
    258     m_acTEncTop[layer].setFramesToBeEncoded            ( m_framesToBeEncoded );
    259 
    260 #if SVC_EXTENSION && MULTIPLE_PTL_SUPPORT
    261     m_acTEncTop[layer].setProfile(m_profileList[m_layerPTLIdx[layer]]);
    262     m_acTEncTop[layer].setLevel(m_levelTierList[m_layerPTLIdx[layer]], m_levelList[m_layerPTLIdx[layer]]);
    263     m_acTEncTop[layer].setProgressiveSourceFlag(m_progressiveSourceFlagList[m_layerPTLIdx[layer]]);
    264     m_acTEncTop[layer].setInterlacedSourceFlag(m_interlacedSourceFlagList[m_layerPTLIdx[layer]]);
    265     m_acTEncTop[layer].setNonPackedConstraintFlag(m_nonPackedConstraintFlagList[m_layerPTLIdx[layer]]);
    266     m_acTEncTop[layer].setFrameOnlyConstraintFlag(m_frameOnlyConstraintFlagList[m_layerPTLIdx[layer]]);
    267 #else
    268     m_acTEncTop[layer].setProfile(m_profile);
    269     m_acTEncTop[layer].setLevel(m_levelTier, m_level);
    270     m_acTEncTop[layer].setProgressiveSourceFlag(m_progressiveSourceFlag);
    271     m_acTEncTop[layer].setInterlacedSourceFlag(m_interlacedSourceFlag);
    272     m_acTEncTop[layer].setNonPackedConstraintFlag(m_nonPackedConstraintFlag);
    273     m_acTEncTop[layer].setFrameOnlyConstraintFlag(m_frameOnlyConstraintFlag);
    274 #endif
     250    m_acTEncTop[layer].setInterLayerWeightedPredFlag                      ( m_useInterLayerWeightedPred );
     251#endif
     252#endif
     253   
     254#if MULTIPLE_PTL_SUPPORT
     255    Int layerPTLIdx = m_acLayerCfg[layer].m_layerPTLIdx;
     256    m_acTEncTop[layer].setProfile                                         ( m_profileList[layerPTLIdx] );
     257    m_acTEncTop[layer].setLevel                                           ( m_levelTierList[layerPTLIdx], m_levelList[layerPTLIdx] );
     258    m_acTEncTop[layer].setProgressiveSourceFlag                           ( m_progressiveSourceFlagList[layerPTLIdx] );
     259    m_acTEncTop[layer].setInterlacedSourceFlag                            ( m_interlacedSourceFlagList[layerPTLIdx] );
     260    m_acTEncTop[layer].setNonPackedConstraintFlag                         ( m_nonPackedConstraintFlagList[layerPTLIdx] );
     261    m_acTEncTop[layer].setFrameOnlyConstraintFlag                         ( m_frameOnlyConstraintFlagList[layerPTLIdx] );
     262    m_acTEncTop[layer].setBitDepthConstraintValue                         ( m_acLayerCfg[layer].m_bitDepthConstraint );
     263    m_acTEncTop[layer].setChromaFormatConstraintValue                     ( m_acLayerCfg[layer].m_chromaFormatConstraint );
     264    m_acTEncTop[layer].setIntraConstraintFlag                             ( m_acLayerCfg[layer].m_intraConstraintFlag );
     265    m_acTEncTop[layer].setLowerBitRateConstraintFlag                      ( m_acLayerCfg[layer].m_lowerBitRateConstraintFlag );
     266#else
     267    m_acTEncTop[layer].setProfile                                         ( m_profile );
     268    m_acTEncTop[layer].setLevel                                           ( m_levelTier, m_level );
     269    m_acTEncTop[layer].setProgressiveSourceFlag                           ( m_progressiveSourceFlag );
     270    m_acTEncTop[layer].setInterlacedSourceFlag                            ( m_interlacedSourceFlag );
     271    m_acTEncTop[layer].setNonPackedConstraintFlag                         ( m_nonPackedConstraintFlag );
     272    m_acTEncTop[layer].setFrameOnlyConstraintFlag                         ( m_frameOnlyConstraintFlag );
     273    m_acTEncTop[layer].setBitDepthConstraintValue                         ( m_bitDepthConstraint );
     274    m_acTEncTop[layer].setChromaFormatConstraintValue                     ( m_acLayerCfg[layer].m_chromaFormatConstraint );
     275    m_acTEncTop[layer].setIntraConstraintFlag                             ( m_intraConstraintFlag );
     276    m_acTEncTop[layer].setLowerBitRateConstraintFlag                      ( m_lowerBitRateConstraintFlag );
     277#endif
     278
     279    m_acTEncTop[layer].setPrintMSEBasedSequencePSNR                       ( m_printMSEBasedSequencePSNR);
     280    m_acTEncTop[layer].setPrintFrameMSE                                   ( m_printFrameMSE);
     281    m_acTEncTop[layer].setPrintSequenceMSE                                ( m_printSequenceMSE);
     282    m_acTEncTop[layer].setCabacZeroWordPaddingEnabled                     ( m_cabacZeroWordPaddingEnabled );
     283
     284    m_acTEncTop[layer].setFrameRate                                       ( m_acLayerCfg[layer].getFrameRate() );
     285    m_acTEncTop[layer].setFrameSkip                                       ( m_FrameSkip );
     286    m_acTEncTop[layer].setSourceWidth                                     ( m_acLayerCfg[layer].getSourceWidth() );
     287    m_acTEncTop[layer].setSourceHeight                                    ( m_acLayerCfg[layer].getSourceHeight() );
     288    m_acTEncTop[layer].setConformanceWindow                               ( m_acLayerCfg[layer].m_confWinLeft, m_acLayerCfg[layer].m_confWinRight, m_acLayerCfg[layer].m_confWinTop, m_acLayerCfg[layer].m_confWinBottom );
     289    m_acTEncTop[layer].setFramesToBeEncoded                               ( m_framesToBeEncoded );
    275290
    276291#if REF_IDX_MFM
    277292#if AVC_BASE
    278293#if VPS_AVC_BL_FLAG_REMOVAL
    279     m_acTEncTop[layer].setMFMEnabledFlag(layer == 0 ? false : ( m_nonHEVCBaseLayerFlag ? false : true ) && m_acLayerCfg[layer].getNumMotionPredRefLayers());
    280 #else
    281     m_acTEncTop[layer].setMFMEnabledFlag(layer == 0 ? false : ( m_avcBaseLayerFlag ? false : true ) && m_acLayerCfg[layer].getNumMotionPredRefLayers());
    282 #endif
    283 #else
    284     m_acTEncTop[layer].setMFMEnabledFlag(layer == 0 ? false : ( m_acLayerCfg[layer].getNumMotionPredRefLayers() > 0 ) );
     294    m_acTEncTop[layer].setMFMEnabledFlag                                  (layer == 0 ? false : ( m_nonHEVCBaseLayerFlag ? false : true ) && m_acLayerCfg[layer].getNumMotionPredRefLayers());
     295#else
     296    m_acTEncTop[layer].setMFMEnabledFlag                                  (layer == 0 ? false : ( m_avcBaseLayerFlag ? false : true ) && m_acLayerCfg[layer].getNumMotionPredRefLayers());
     297#endif
     298#else
     299    m_acTEncTop[layer].setMFMEnabledFlag                                  (layer == 0 ? false : ( m_acLayerCfg[layer].getNumMotionPredRefLayers() > 0 ) );
    285300#endif
    286301#endif
     
    291306
    292307    //====== Coding Structure ========
    293     m_acTEncTop[layer].setIntraPeriod                  ( m_acLayerCfg[layer].m_iIntraPeriod );
    294     m_acTEncTop[layer].setDecodingRefreshType          ( m_iDecodingRefreshType );
    295     m_acTEncTop[layer].setGOPSize                      ( m_iGOPSize );
     308    m_acTEncTop[layer].setIntraPeriod                                     ( m_acLayerCfg[layer].m_iIntraPeriod );
     309    m_acTEncTop[layer].setDecodingRefreshType                             ( m_iDecodingRefreshType );
     310    m_acTEncTop[layer].setGOPSize                                         ( m_iGOPSize );
    296311#if Q0108_TSA_STSA
    297     m_acTEncTop[layer].setGopList                      ( layer ? m_EhGOPList[layer] : m_GOPList );
    298 #else
    299     m_acTEncTop[layer].setGopList                      ( m_GOPList );
     312    m_acTEncTop[layer].setGopList                                         ( layer ? m_EhGOPList[layer] : m_GOPList );
     313#else
     314    m_acTEncTop[layer].setGopList                                         ( m_GOPList );
    300315#endif
    301316
    302317#if !Q0108_TSA_STSA
    303     m_acTEncTop[layer].setExtraRPSs                    ( m_extraRPSs );
    304 #else
    305     m_acTEncTop[layer].setExtraRPSs                    ( m_extraRPSs[layer] );
     318    m_acTEncTop[layer].setExtraRPSs                                       ( m_extraRPSs );
     319#else
     320    m_acTEncTop[layer].setExtraRPSs                                       ( m_extraRPSs[layer] );
    306321#endif
    307322    for(Int i = 0; i < MAX_TLAYER; i++)
    308323    {
    309       m_acTEncTop[layer].setNumReorderPics             ( m_numReorderPics[i], i );
    310       m_acTEncTop[layer].setMaxDecPicBuffering         ( m_maxDecPicBuffering[i], i );
     324      m_acTEncTop[layer].setNumReorderPics                                ( m_numReorderPics[i], i );
     325      m_acTEncTop[layer].setMaxDecPicBuffering                            ( m_maxDecPicBuffering[i], i );
    311326    }
    312327    for( UInt uiLoop = 0; uiLoop < MAX_TLAYER; ++uiLoop )
    313328    {
    314       m_acTEncTop[layer].setLambdaModifier( uiLoop, m_adLambdaModifier[ uiLoop ] );
    315     }
    316     m_acTEncTop[layer].setQP                           ( m_acLayerCfg[layer].getIntQP() );
    317 
    318     m_acTEncTop[layer].setPad                          ( m_acLayerCfg[layer].getPad() );
     329      m_acTEncTop[layer].setLambdaModifier                                ( uiLoop, m_adLambdaModifier[ uiLoop ] );
     330    }
     331    m_acTEncTop[layer].setQP                                              ( m_acLayerCfg[layer].getIntQP() );
     332
     333    m_acTEncTop[layer].setPad                                             ( m_acLayerCfg[layer].getPad() );
    319334#if !Q0108_TSA_STSA
    320     m_acTEncTop[layer].setMaxTempLayer                 ( m_maxTempLayer );
     335    m_acTEncTop[layer].setMaxTempLayer                                    ( m_maxTempLayer );
    321336#else
    322337    if (layer== 0)
    323338    {
    324       m_acTEncTop[layer].setMaxTempLayer                 ( m_maxTempLayer );
     339      m_acTEncTop[layer].setMaxTempLayer                                  ( m_maxTempLayer );
    325340    }
    326341    else
    327342    {
    328       m_acTEncTop[layer].setMaxTempLayer                 ( m_EhMaxTempLayer[layer] );
     343      m_acTEncTop[layer].setMaxTempLayer                                  ( m_EhMaxTempLayer[layer] );
    329344    }
    330345#endif
     
    333348    if( layer < m_numLayers - 1 )
    334349    {
    335        m_acTEncTop[layer].setMaxTidIlRefPicsPlus1 ( m_acLayerCfg[layer].getMaxTidIlRefPicsPlus1());
     350       m_acTEncTop[layer].setMaxTidIlRefPicsPlus1                         ( m_acLayerCfg[layer].getMaxTidIlRefPicsPlus1());
    336351    }
    337352
     
    341356      for(Int i = 0; i < MAX_VPS_LAYER_ID_PLUS1; i++)
    342357      {
    343         m_acTEncTop[layer].setSamplePredEnabledFlag(i, false);
    344         m_acTEncTop[layer].setMotionPredEnabledFlag(i, false);
     358        m_acTEncTop[layer].setSamplePredEnabledFlag                       (i, false);
     359        m_acTEncTop[layer].setMotionPredEnabledFlag                       (i, false);
    345360      }
    346361      if(m_acLayerCfg[layer].getNumSamplePredRefLayers() == -1)
    347362      {
    348363        // Not included in the configuration file; assume that each layer depends on previous layer
    349         m_acTEncTop[layer].setNumSamplePredRefLayers   (1);      // One sample pred ref. layer
    350         m_acTEncTop[layer].setSamplePredRefLayerId     (0, layer - 1);   // Previous layer
    351         m_acTEncTop[layer].setSamplePredEnabledFlag    (layer - 1, true);
     364        m_acTEncTop[layer].setNumSamplePredRefLayers                      (1);      // One sample pred ref. layer
     365        m_acTEncTop[layer].setSamplePredRefLayerId                        (0, layer - 1);   // Previous layer
     366        m_acTEncTop[layer].setSamplePredEnabledFlag                       (layer - 1, true);
    352367      }
    353368      else
    354369      {
    355         m_acTEncTop[layer].setNumSamplePredRefLayers   ( m_acLayerCfg[layer].getNumSamplePredRefLayers() );
     370        m_acTEncTop[layer].setNumSamplePredRefLayers                      ( m_acLayerCfg[layer].getNumSamplePredRefLayers() );
    356371        for(Int i = 0; i < m_acTEncTop[layer].getNumSamplePredRefLayers(); i++)
    357372        {
    358           m_acTEncTop[layer].setSamplePredRefLayerId   ( i, m_acLayerCfg[layer].getSamplePredRefLayerId(i));
    359           m_acTEncTop[layer].setSamplePredEnabledFlag  (m_acLayerCfg[layer].getSamplePredRefLayerId(i), true);
     373          m_acTEncTop[layer].setSamplePredRefLayerId                      ( i, m_acLayerCfg[layer].getSamplePredRefLayerId(i));
     374          m_acTEncTop[layer].setSamplePredEnabledFlag                     (m_acLayerCfg[layer].getSamplePredRefLayerId(i), true);
    360375        }
    361376      }
     
    363378      {
    364379        // Not included in the configuration file; assume that each layer depends on previous layer
    365         m_acTEncTop[layer].setNumMotionPredRefLayers   (1);      // One motion pred ref. layer
    366         m_acTEncTop[layer].setMotionPredRefLayerId     (0, layer - 1);   // Previous layer
    367         m_acTEncTop[layer].setMotionPredEnabledFlag    (layer - 1, true);
     380        m_acTEncTop[layer].setNumMotionPredRefLayers                      (1);      // One motion pred ref. layer
     381        m_acTEncTop[layer].setMotionPredRefLayerId                        (0, layer - 1);   // Previous layer
     382        m_acTEncTop[layer].setMotionPredEnabledFlag                       (layer - 1, true);
    368383      }
    369384      else
    370385      {
    371         m_acTEncTop[layer].setNumMotionPredRefLayers   ( m_acLayerCfg[layer].getNumMotionPredRefLayers() );
     386        m_acTEncTop[layer].setNumMotionPredRefLayers                      ( m_acLayerCfg[layer].getNumMotionPredRefLayers() );
    372387        for(Int i = 0; i < m_acTEncTop[layer].getNumMotionPredRefLayers(); i++)
    373388        {
    374           m_acTEncTop[layer].setMotionPredRefLayerId   ( i, m_acLayerCfg[layer].getMotionPredRefLayerId(i));
    375           m_acTEncTop[layer].setMotionPredEnabledFlag  (m_acLayerCfg[layer].getMotionPredRefLayerId(i), true);
     389          m_acTEncTop[layer].setMotionPredRefLayerId                      ( i, m_acLayerCfg[layer].getMotionPredRefLayerId(i));
     390          m_acTEncTop[layer].setMotionPredEnabledFlag                     (m_acLayerCfg[layer].getMotionPredRefLayerId(i), true);
    376391        }
    377392      }
     
    384399        if (m_acTEncTop[layer].getSamplePredEnabledFlag(i) || m_acTEncTop[layer].getMotionPredEnabledFlag(i))
    385400        {
    386           m_acTEncTop[layer].setRefLayerId(numDirectRefLayers, i);
     401          m_acTEncTop[layer].setRefLayerId                                (numDirectRefLayers, i);
    387402          numDirectRefLayers++;
    388403        }
    389404      }
    390       m_acTEncTop[layer].setNumDirectRefLayers(numDirectRefLayers);
     405      m_acTEncTop[layer].setNumDirectRefLayers                            (numDirectRefLayers);
    391406
    392407      if(m_acLayerCfg[layer].getNumActiveRefLayers() == -1)
    393408      {
    394         m_acTEncTop[layer].setNumActiveRefLayers( m_acTEncTop[layer].getNumDirectRefLayers() );
     409        m_acTEncTop[layer].setNumActiveRefLayers                          ( m_acTEncTop[layer].getNumDirectRefLayers() );
    395410        for( Int i = 0; i < m_acTEncTop[layer].getNumActiveRefLayers(); i++ )
    396411        {
     
    400415      else
    401416      {
    402         m_acTEncTop[layer].setNumActiveRefLayers       ( m_acLayerCfg[layer].getNumActiveRefLayers() );
     417        m_acTEncTop[layer].setNumActiveRefLayers                          ( m_acLayerCfg[layer].getNumActiveRefLayers() );
    403418        for(Int i = 0; i < m_acTEncTop[layer].getNumActiveRefLayers(); i++)
    404419        {
    405           m_acTEncTop[layer].setPredLayerId             ( i, m_acLayerCfg[layer].getPredLayerId(i));
     420          m_acTEncTop[layer].setPredLayerId                               ( i, m_acLayerCfg[layer].getPredLayerId(i));
    406421        }
    407422      }
     
    417432        Int rlSubHeightC = 2;
    418433#endif
    419         m_acTEncTop[layer].setRefRegionOffsetPresentFlag( i, m_acLayerCfg[layer].m_refRegionOffsetPresentFlag[i] );
    420         m_acTEncTop[layer].getRefLayerWindow(i).setWindow( rlSubWidthC  * m_acLayerCfg[layer].m_refRegionLeftOffset[i], rlSubWidthC  * m_acLayerCfg[layer].m_refRegionRightOffset[i],
    421                                                            rlSubHeightC * m_acLayerCfg[layer].m_refRegionTopOffset[i],  rlSubHeightC * m_acLayerCfg[layer].m_refRegionBottomOffset[i]);
     434        m_acTEncTop[layer].setRefRegionOffsetPresentFlag                  ( i, m_acLayerCfg[layer].m_refRegionOffsetPresentFlag[i] );
     435        m_acTEncTop[layer].getRefLayerWindow(i).setWindow                 ( rlSubWidthC  * m_acLayerCfg[layer].m_refRegionLeftOffset[i], rlSubWidthC  * m_acLayerCfg[layer].m_refRegionRightOffset[i],
     436                                                                            rlSubHeightC * m_acLayerCfg[layer].m_refRegionTopOffset[i],  rlSubHeightC * m_acLayerCfg[layer].m_refRegionBottomOffset[i]);
    422437      }
    423438#endif
     
    432447
    433448    //====== Loop/Deblock Filter ========
    434     m_acTEncTop[layer].setLoopFilterDisable            ( m_bLoopFilterDisable       );
    435     m_acTEncTop[layer].setLoopFilterOffsetInPPS        ( m_loopFilterOffsetInPPS );
    436     m_acTEncTop[layer].setLoopFilterBetaOffset         ( m_loopFilterBetaOffsetDiv2  );
    437     m_acTEncTop[layer].setLoopFilterTcOffset           ( m_loopFilterTcOffsetDiv2    );
    438     m_acTEncTop[layer].setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent);
    439     m_acTEncTop[layer].setDeblockingFilterMetric       ( m_DeblockingFilterMetric );
     449    m_acTEncTop[layer].setLoopFilterDisable                                ( m_bLoopFilterDisable       );
     450    m_acTEncTop[layer].setLoopFilterOffsetInPPS                            ( m_loopFilterOffsetInPPS );
     451    m_acTEncTop[layer].setLoopFilterBetaOffset                             ( m_loopFilterBetaOffsetDiv2  );
     452    m_acTEncTop[layer].setLoopFilterTcOffset                               ( m_loopFilterTcOffsetDiv2    );
     453    m_acTEncTop[layer].setDeblockingFilterControlPresent                   ( m_DeblockingFilterControlPresent);
     454    m_acTEncTop[layer].setDeblockingFilterMetric                           ( m_DeblockingFilterMetric );
    440455
    441456    //====== Motion search ========
    442     m_acTEncTop[layer].setFastSearch                   ( m_iFastSearch  );
    443     m_acTEncTop[layer].setSearchRange                  ( m_iSearchRange );
    444     m_acTEncTop[layer].setBipredSearchRange            ( m_bipredSearchRange );
     457    m_acTEncTop[layer].setFastSearch                                       ( m_iFastSearch  );
     458    m_acTEncTop[layer].setSearchRange                                      ( m_iSearchRange );
     459    m_acTEncTop[layer].setBipredSearchRange                                ( m_bipredSearchRange );
    445460
    446461    //====== Quality control ========
    447     m_acTEncTop[layer].setMaxDeltaQP                   ( m_iMaxDeltaQP  );
    448     m_acTEncTop[layer].setMaxCuDQPDepth                ( m_iMaxCuDQPDepth  );
    449 
    450     m_acTEncTop[layer].setChromaCbQpOffset             ( m_cbQpOffset     );
    451     m_acTEncTop[layer].setChromaCrQpOffset             ( m_crQpOffset  );
     462    m_acTEncTop[layer].setMaxDeltaQP                                       ( m_iMaxDeltaQP  );
     463    m_acTEncTop[layer].setMaxCuDQPDepth                                    ( m_iMaxCuDQPDepth  );
     464    m_acTEncTop[layer].setMaxCUChromaQpAdjustmentDepth                     ( m_maxCUChromaQpAdjustmentDepth );
     465    m_acTEncTop[layer].setChromaCbQpOffset                                 ( m_cbQpOffset     );
     466    m_acTEncTop[layer].setChromaCrQpOffset                                 ( m_crQpOffset  );
     467
     468    m_acTEncTop[layer].setChromaFormatIdc                                  ( m_acLayerCfg[layer].m_chromaFormatIDC  );
    452469
    453470#if ADAPTIVE_QP_SELECTION
    454     m_acTEncTop[layer].setUseAdaptQpSelect             ( m_bUseAdaptQpSelect   );
     471    m_acTEncTop[layer].setUseAdaptQpSelect                                 ( m_bUseAdaptQpSelect   );
    455472#endif
    456473   
    457     m_acTEncTop[layer].setUseAdaptiveQP                ( m_bUseAdaptiveQP  );
    458     m_acTEncTop[layer].setQPAdaptationRange            ( m_iQPAdaptationRange );
     474    m_acTEncTop[layer].setUseAdaptiveQP                                    ( m_bUseAdaptiveQP  );
     475    m_acTEncTop[layer].setQPAdaptationRange                                ( m_iQPAdaptationRange );
     476    m_acTEncTop[layer].setUseExtendedPrecision                             ( m_acLayerCfg[layer].m_useExtendedPrecision );
     477    m_acTEncTop[layer].setUseHighPrecisionPredictionWeighting              ( m_acLayerCfg[layer].m_useHighPrecisionPredictionWeighting );
    459478
    460479    //====== Tool list ========   
    461     m_acTEncTop[layer].setDeltaQpRD                    ( m_uiDeltaQpRD  );
    462     m_acTEncTop[layer].setUseASR                       ( m_bUseASR      );
    463     m_acTEncTop[layer].setUseHADME                     ( m_bUseHADME    );   
    464     m_acTEncTop[layer].setdQPs                         ( m_acLayerCfg[layer].getdQPs() );
    465     m_acTEncTop[layer].setUseRDOQ                      ( m_useRDOQ     );
    466     m_acTEncTop[layer].setUseRDOQTS                    ( m_useRDOQTS   );
    467     m_acTEncTop[layer].setRDpenalty                    ( m_rdPenalty );
     480    m_acTEncTop[layer].setDeltaQpRD                                        ( m_uiDeltaQpRD  );
     481    m_acTEncTop[layer].setUseASR                                           ( m_bUseASR      );
     482    m_acTEncTop[layer].setUseHADME                                         ( m_bUseHADME    );   
     483    m_acTEncTop[layer].setdQPs                                             ( m_acLayerCfg[layer].getdQPs() );
     484    m_acTEncTop[layer].setUseRDOQ                                          ( m_useRDOQ     );
     485    m_acTEncTop[layer].setUseRDOQTS                                        ( m_useRDOQTS   );
     486    m_acTEncTop[layer].setRDpenalty                                        ( m_rdPenalty );
    468487#if LAYER_CTB
    469     m_acTEncTop[layer].setQuadtreeTULog2MaxSize        ( m_acLayerCfg[layer].m_uiQuadtreeTULog2MaxSize );
    470     m_acTEncTop[layer].setQuadtreeTULog2MinSize        ( m_acLayerCfg[layer].m_uiQuadtreeTULog2MinSize );
    471     m_acTEncTop[layer].setQuadtreeTUMaxDepthInter      ( m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthInter );
    472     m_acTEncTop[layer].setQuadtreeTUMaxDepthIntra      ( m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthIntra );
    473 #else
    474     m_acTEncTop[layer].setQuadtreeTULog2MaxSize        ( m_uiQuadtreeTULog2MaxSize );
    475     m_acTEncTop[layer].setQuadtreeTULog2MinSize        ( m_uiQuadtreeTULog2MinSize );
    476     m_acTEncTop[layer].setQuadtreeTUMaxDepthInter      ( m_uiQuadtreeTUMaxDepthInter );
    477     m_acTEncTop[layer].setQuadtreeTUMaxDepthIntra      ( m_uiQuadtreeTUMaxDepthIntra );
    478 #endif
    479     m_acTEncTop[layer].setUseFastEnc                   ( m_bUseFastEnc  );
    480     m_acTEncTop[layer].setUseEarlyCU                   ( m_bUseEarlyCU  );
    481     m_acTEncTop[layer].setUseFastDecisionForMerge      ( m_useFastDecisionForMerge  );
    482     m_acTEncTop[layer].setUseCbfFastMode               ( m_bUseCbfFastMode  );
    483     m_acTEncTop[layer].setUseEarlySkipDetection        ( m_useEarlySkipDetection );
     488    m_acTEncTop[layer].setQuadtreeTULog2MaxSize                            ( m_acLayerCfg[layer].m_uiQuadtreeTULog2MaxSize );
     489    m_acTEncTop[layer].setQuadtreeTULog2MinSize                            ( m_acLayerCfg[layer].m_uiQuadtreeTULog2MinSize );
     490    m_acTEncTop[layer].setQuadtreeTUMaxDepthInter                          ( m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthInter );
     491    m_acTEncTop[layer].setQuadtreeTUMaxDepthIntra                          ( m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthIntra );
     492#else
     493    m_acTEncTop[layer].setQuadtreeTULog2MaxSize                            ( m_uiQuadtreeTULog2MaxSize );
     494    m_acTEncTop[layer].setQuadtreeTULog2MinSize                            ( m_uiQuadtreeTULog2MinSize );
     495    m_acTEncTop[layer].setQuadtreeTUMaxDepthInter                          ( m_uiQuadtreeTUMaxDepthInter );
     496    m_acTEncTop[layer].setQuadtreeTUMaxDepthIntra                          ( m_uiQuadtreeTUMaxDepthIntra );
     497#endif
     498    m_acTEncTop[layer].setUseFastEnc                                       ( m_bUseFastEnc  );
     499    m_acTEncTop[layer].setUseEarlyCU                                       ( m_bUseEarlyCU  );
     500    m_acTEncTop[layer].setUseFastDecisionForMerge                          ( m_useFastDecisionForMerge  );
     501    m_acTEncTop[layer].setUseCbfFastMode                                   ( m_bUseCbfFastMode  );
     502    m_acTEncTop[layer].setUseEarlySkipDetection                            ( m_useEarlySkipDetection );
     503    m_acTEncTop[layer].setUseCrossComponentPrediction                      ( m_useCrossComponentPrediction );
     504    m_acTEncTop[layer].setUseReconBasedCrossCPredictionEstimate            ( m_reconBasedCrossCPredictionEstimate );
     505    m_acTEncTop[layer].setSaoOffsetBitShift                                ( CHANNEL_TYPE_LUMA  , m_saoOffsetBitShift[CHANNEL_TYPE_LUMA]   );
     506    m_acTEncTop[layer].setSaoOffsetBitShift                                ( CHANNEL_TYPE_CHROMA, m_saoOffsetBitShift[CHANNEL_TYPE_CHROMA] );
     507    m_acTEncTop[layer].setUseTransformSkip                                 ( m_useTransformSkip      );
     508    m_acTEncTop[layer].setUseTransformSkipFast                             ( m_useTransformSkipFast  );
     509    m_acTEncTop[layer].setUseResidualRotation                              ( m_useResidualRotation   );
     510    m_acTEncTop[layer].setUseSingleSignificanceMapContext                  ( m_useSingleSignificanceMapContext   );
     511    m_acTEncTop[layer].setUseGolombRiceParameterAdaptation                 ( m_useGolombRiceParameterAdaptation );
     512    m_acTEncTop[layer].setAlignCABACBeforeBypass                           ( m_alignCABACBeforeBypass );
     513    m_acTEncTop[layer].setTransformSkipLog2MaxSize                         ( m_transformSkipLog2MaxSize  );
     514    for (UInt signallingModeIndex = 0; signallingModeIndex < NUMBER_OF_RDPCM_SIGNALLING_MODES; signallingModeIndex++)
     515    {
     516      m_acTEncTop[layer].setUseResidualDPCM                                ( RDPCMSignallingMode(signallingModeIndex), m_useResidualDPCM[signallingModeIndex]);
     517    }
     518    m_acTEncTop[layer].setUseConstrainedIntraPred                          ( m_bUseConstrainedIntraPred );
     519    m_acTEncTop[layer].setPCMLog2MinSize                                   ( m_uiPCMLog2MinSize);
     520    m_acTEncTop[layer].setUsePCM                                           ( m_usePCM );
     521    m_acTEncTop[layer].setPCMLog2MaxSize                                   ( m_pcmLog2MaxSize);
     522    m_acTEncTop[layer].setMaxNumMergeCand                                  ( m_maxNumMergeCand );
     523
     524
     525    //====== Weighted Prediction ========
     526    m_acTEncTop[layer].setUseWP                                            ( m_useWeightedPred      );
     527    m_acTEncTop[layer].setWPBiPred                                         ( m_useWeightedBiPred   );
    484528#if FAST_INTRA_SHVC
    485     m_acTEncTop[layer].setUseFastIntraScalable         ( m_useFastIntraScalable );
    486 #endif
    487 
    488     m_acTEncTop[layer].setUseTransformSkip             ( m_useTransformSkip      );
    489     m_acTEncTop[layer].setUseTransformSkipFast         ( m_useTransformSkipFast  );
    490     m_acTEncTop[layer].setUseConstrainedIntraPred      ( m_bUseConstrainedIntraPred );
    491     m_acTEncTop[layer].setPCMLog2MinSize               ( m_uiPCMLog2MinSize);
    492     m_acTEncTop[layer].setUsePCM                       ( m_usePCM );
    493     m_acTEncTop[layer].setPCMLog2MaxSize               ( m_pcmLog2MaxSize);
    494     m_acTEncTop[layer].setMaxNumMergeCand              ( m_maxNumMergeCand );
    495 
    496 
    497     //====== Weighted Prediction ========
    498     m_acTEncTop[layer].setUseWP                   ( m_useWeightedPred      );
    499     m_acTEncTop[layer].setWPBiPred                ( m_useWeightedBiPred   );
     529    m_acTEncTop[layer].setUseFastIntraScalable                             ( m_useFastIntraScalable );
     530#endif
    500531#if O0194_WEIGHTED_PREDICTION_CGS
    501532    if( layer != 0 && m_useInterLayerWeightedPred )
    502533    {
    503534      // Enable weighted prediction for enhancement layer
    504       m_acTEncTop[layer].setUseWP                 ( true   );
    505       m_acTEncTop[layer].setWPBiPred              ( true   );
     535      m_acTEncTop[layer].setUseWP                                           ( true   );
     536      m_acTEncTop[layer].setWPBiPred                                        ( true   );
    506537    }
    507538#endif
    508539    //====== Parallel Merge Estimation ========
    509     m_acTEncTop[layer].setLog2ParallelMergeLevelMinus2 ( m_log2ParallelMergeLevel - 2 );
     540    m_acTEncTop[layer].setLog2ParallelMergeLevelMinus2                      ( m_log2ParallelMergeLevel - 2 );
    510541
    511542    //====== Slice ========
    512     m_acTEncTop[layer].setSliceMode               ( m_sliceMode                );
    513     m_acTEncTop[layer].setSliceArgument           ( m_sliceArgument            );
     543    m_acTEncTop[layer].setSliceMode                                         ( (SliceConstraint) m_sliceMode );
     544    m_acTEncTop[layer].setSliceArgument                                     ( m_sliceArgument            );
    514545
    515546    //====== Dependent Slice ========
    516     m_acTEncTop[layer].setSliceSegmentMode        ( m_sliceSegmentMode         );
    517     m_acTEncTop[layer].setSliceSegmentArgument    ( m_sliceSegmentArgument     );
    518 #if LAYER_CTB
    519     Int iNumPartInCU = 1<<(m_acLayerCfg[layer].m_uiMaxCUDepth<<1);
    520 #else
    521     Int iNumPartInCU = 1<<(m_uiMaxCUDepth<<1);
    522 #endif
    523     if(m_sliceSegmentMode==FIXED_NUMBER_OF_LCU)
    524     {
    525       m_acTEncTop[layer].setSliceSegmentArgument ( m_sliceSegmentArgument * iNumPartInCU );
    526     }
    527     if(m_sliceMode==FIXED_NUMBER_OF_LCU)
    528     {
    529       m_acTEncTop[layer].setSliceArgument ( m_sliceArgument * iNumPartInCU );
    530     }
    531     if(m_sliceMode==FIXED_NUMBER_OF_TILES)
    532     {
    533       m_acTEncTop[layer].setSliceArgument ( m_sliceArgument );
    534     }
    535 
    536     if(m_sliceMode == 0 )
     547    m_acTEncTop[layer].setSliceSegmentMode                                  ( (SliceConstraint) m_sliceSegmentMode );
     548    m_acTEncTop[layer].setSliceSegmentArgument                              ( m_sliceSegmentArgument     );
     549
     550    if(m_sliceMode == NO_SLICES )
    537551    {
    538552      m_bLFCrossSliceBoundaryFlag = true;
    539553    }
    540     m_acTEncTop[layer].setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag );
    541     m_acTEncTop[layer].setUseSAO ( m_bUseSAO );
    542     m_acTEncTop[layer].setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic);
    543 
    544     m_acTEncTop[layer].setSaoLcuBoundary (m_saoLcuBoundary);
    545     m_acTEncTop[layer].setPCMInputBitDepthFlag  ( m_bPCMInputBitDepthFlag);
    546     m_acTEncTop[layer].setPCMFilterDisableFlag  ( m_bPCMFilterDisableFlag);
    547 
    548     m_acTEncTop[layer].setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled);
    549     m_acTEncTop[layer].setRecoveryPointSEIEnabled( m_recoveryPointSEIEnabled );
    550     m_acTEncTop[layer].setBufferingPeriodSEIEnabled( m_bufferingPeriodSEIEnabled );
    551     m_acTEncTop[layer].setPictureTimingSEIEnabled( m_pictureTimingSEIEnabled );
    552     m_acTEncTop[layer].setToneMappingInfoSEIEnabled                 ( m_toneMappingInfoSEIEnabled );
    553     m_acTEncTop[layer].setTMISEIToneMapId                           ( m_toneMapId );
    554     m_acTEncTop[layer].setTMISEIToneMapCancelFlag                   ( m_toneMapCancelFlag );
    555     m_acTEncTop[layer].setTMISEIToneMapPersistenceFlag              ( m_toneMapPersistenceFlag );
    556     m_acTEncTop[layer].setTMISEICodedDataBitDepth                   ( m_toneMapCodedDataBitDepth );
    557     m_acTEncTop[layer].setTMISEITargetBitDepth                      ( m_toneMapTargetBitDepth );
    558     m_acTEncTop[layer].setTMISEIModelID                             ( m_toneMapModelId );
    559     m_acTEncTop[layer].setTMISEIMinValue                            ( m_toneMapMinValue );
    560     m_acTEncTop[layer].setTMISEIMaxValue                            ( m_toneMapMaxValue );
    561     m_acTEncTop[layer].setTMISEISigmoidMidpoint                     ( m_sigmoidMidpoint );
    562     m_acTEncTop[layer].setTMISEISigmoidWidth                        ( m_sigmoidWidth );
    563     m_acTEncTop[layer].setTMISEIStartOfCodedInterva                 ( m_startOfCodedInterval );
    564     m_acTEncTop[layer].setTMISEINumPivots                           ( m_numPivots );
    565     m_acTEncTop[layer].setTMISEICodedPivotValue                     ( m_codedPivotValue );
    566     m_acTEncTop[layer].setTMISEITargetPivotValue                    ( m_targetPivotValue );
    567     m_acTEncTop[layer].setTMISEICameraIsoSpeedIdc                   ( m_cameraIsoSpeedIdc );
    568     m_acTEncTop[layer].setTMISEICameraIsoSpeedValue                 ( m_cameraIsoSpeedValue );
    569     m_acTEncTop[layer].setTMISEIExposureCompensationValueSignFlag   ( m_exposureCompensationValueSignFlag );
    570     m_acTEncTop[layer].setTMISEIExposureCompensationValueNumerator  ( m_exposureCompensationValueNumerator );
    571     m_acTEncTop[layer].setTMISEIExposureCompensationValueDenomIdc   ( m_exposureCompensationValueDenomIdc );
    572     m_acTEncTop[layer].setTMISEIRefScreenLuminanceWhite             ( m_refScreenLuminanceWhite );
    573     m_acTEncTop[layer].setTMISEIExtendedRangeWhiteLevel             ( m_extendedRangeWhiteLevel );
    574     m_acTEncTop[layer].setTMISEINominalBlackLevelLumaCodeValue      ( m_nominalBlackLevelLumaCodeValue );
    575     m_acTEncTop[layer].setTMISEINominalWhiteLevelLumaCodeValue      ( m_nominalWhiteLevelLumaCodeValue );
    576     m_acTEncTop[layer].setTMISEIExtendedWhiteLevelLumaCodeValue     ( m_extendedWhiteLevelLumaCodeValue );
    577 #if P0050_KNEE_FUNCTION_SEI
    578     m_acTEncTop[layer].setKneeSEIEnabled                            ( m_kneeSEIEnabled );
    579     m_acTEncTop[layer].setKneeSEIId                                 ( m_kneeSEIId );
    580     m_acTEncTop[layer].setKneeSEICancelFlag                         ( m_kneeSEICancelFlag );
    581     m_acTEncTop[layer].setKneeSEIPersistenceFlag                    ( m_kneeSEIPersistenceFlag );
    582     m_acTEncTop[layer].setKneeSEIMappingFlag                        ( m_kneeSEIMappingFlag );
    583     m_acTEncTop[layer].setKneeSEIInputDrange                        ( m_kneeSEIInputDrange );
    584     m_acTEncTop[layer].setKneeSEIInputDispLuminance                 ( m_kneeSEIInputDispLuminance );
    585     m_acTEncTop[layer].setKneeSEIOutputDrange                       ( m_kneeSEIOutputDrange );
    586     m_acTEncTop[layer].setKneeSEIOutputDispLuminance                ( m_kneeSEIOutputDispLuminance );
    587     m_acTEncTop[layer].setKneeSEINumKneePointsMinus1                ( m_kneeSEINumKneePointsMinus1 );
    588     m_acTEncTop[layer].setKneeSEIInputKneePoint                     ( m_kneeSEIInputKneePoint );
    589     m_acTEncTop[layer].setKneeSEIOutputKneePoint                    ( m_kneeSEIOutputKneePoint );
    590 #endif
     554
     555    m_acTEncTop[layer].setLFCrossSliceBoundaryFlag                          ( m_bLFCrossSliceBoundaryFlag );
     556    m_acTEncTop[layer].setUseSAO                                            ( m_bUseSAO );
     557    m_acTEncTop[layer].setMaxNumOffsetsPerPic                               ( m_maxNumOffsetsPerPic );
     558
     559    m_acTEncTop[layer].setSaoCtuBoundary                                    ( m_saoCtuBoundary );
     560    m_acTEncTop[layer].setPCMInputBitDepthFlag                              ( m_bPCMInputBitDepthFlag);
     561    m_acTEncTop[layer].setPCMFilterDisableFlag                              ( m_bPCMFilterDisableFlag);
     562
     563    m_acTEncTop[layer].setDisableIntraReferenceSmoothing                    (!m_enableIntraReferenceSmoothing );
     564    m_acTEncTop[layer].setDecodedPictureHashSEIEnabled                      ( m_decodedPictureHashSEIEnabled );
     565    m_acTEncTop[layer].setRecoveryPointSEIEnabled                           ( m_recoveryPointSEIEnabled );
     566    m_acTEncTop[layer].setBufferingPeriodSEIEnabled                         ( m_bufferingPeriodSEIEnabled );
     567    m_acTEncTop[layer].setPictureTimingSEIEnabled                           ( m_pictureTimingSEIEnabled );
     568    m_acTEncTop[layer].setToneMappingInfoSEIEnabled                         ( m_toneMappingInfoSEIEnabled );
     569    m_acTEncTop[layer].setTMISEIToneMapId                                   ( m_toneMapId );
     570    m_acTEncTop[layer].setTMISEIToneMapCancelFlag                           ( m_toneMapCancelFlag );
     571    m_acTEncTop[layer].setTMISEIToneMapPersistenceFlag                      ( m_toneMapPersistenceFlag );
     572    m_acTEncTop[layer].setTMISEICodedDataBitDepth                           ( m_toneMapCodedDataBitDepth );
     573    m_acTEncTop[layer].setTMISEITargetBitDepth                              ( m_toneMapTargetBitDepth );
     574    m_acTEncTop[layer].setTMISEIModelID                                     ( m_toneMapModelId );
     575    m_acTEncTop[layer].setTMISEIMinValue                                    ( m_toneMapMinValue );
     576    m_acTEncTop[layer].setTMISEIMaxValue                                    ( m_toneMapMaxValue );
     577    m_acTEncTop[layer].setTMISEISigmoidMidpoint                             ( m_sigmoidMidpoint );
     578    m_acTEncTop[layer].setTMISEISigmoidWidth                                ( m_sigmoidWidth );
     579    m_acTEncTop[layer].setTMISEIStartOfCodedInterva                         ( m_startOfCodedInterval );
     580    m_acTEncTop[layer].setTMISEINumPivots                                   ( m_numPivots );
     581    m_acTEncTop[layer].setTMISEICodedPivotValue                             ( m_codedPivotValue );
     582    m_acTEncTop[layer].setTMISEITargetPivotValue                            ( m_targetPivotValue );
     583    m_acTEncTop[layer].setTMISEICameraIsoSpeedIdc                           ( m_cameraIsoSpeedIdc );
     584    m_acTEncTop[layer].setTMISEICameraIsoSpeedValue                         ( m_cameraIsoSpeedValue );
     585    m_acTEncTop[layer].setTMISEIExposureIndexIdc                            ( m_exposureIndexIdc );
     586    m_acTEncTop[layer].setTMISEIExposureIndexValue                          ( m_exposureIndexValue );
     587    m_acTEncTop[layer].setTMISEIExposureCompensationValueSignFlag           ( m_exposureCompensationValueSignFlag );
     588    m_acTEncTop[layer].setTMISEIExposureCompensationValueNumerator          ( m_exposureCompensationValueNumerator );
     589    m_acTEncTop[layer].setTMISEIExposureCompensationValueDenomIdc           ( m_exposureCompensationValueDenomIdc );
     590    m_acTEncTop[layer].setTMISEIRefScreenLuminanceWhite                     ( m_refScreenLuminanceWhite );
     591    m_acTEncTop[layer].setTMISEIExtendedRangeWhiteLevel                     ( m_extendedRangeWhiteLevel );
     592    m_acTEncTop[layer].setTMISEINominalBlackLevelLumaCodeValue              ( m_nominalBlackLevelLumaCodeValue );
     593    m_acTEncTop[layer].setTMISEINominalWhiteLevelLumaCodeValue              ( m_nominalWhiteLevelLumaCodeValue );
     594    m_acTEncTop[layer].setTMISEIExtendedWhiteLevelLumaCodeValue             ( m_extendedWhiteLevelLumaCodeValue );
     595    m_acTEncTop[layer].setChromaSamplingFilterHintEnabled                   ( m_chromaSamplingFilterSEIenabled );
     596    m_acTEncTop[layer].setChromaSamplingHorFilterIdc                        ( m_chromaSamplingHorFilterIdc );
     597    m_acTEncTop[layer].setChromaSamplingVerFilterIdc                        ( m_chromaSamplingVerFilterIdc );
     598    m_acTEncTop[layer].setFramePackingArrangementSEIEnabled                 ( m_framePackingSEIEnabled );
     599    m_acTEncTop[layer].setFramePackingArrangementSEIType                    ( m_framePackingSEIType );
     600    m_acTEncTop[layer].setFramePackingArrangementSEIId                      ( m_framePackingSEIId );
     601    m_acTEncTop[layer].setFramePackingArrangementSEIQuincunx                ( m_framePackingSEIQuincunx );
     602    m_acTEncTop[layer].setFramePackingArrangementSEIInterpretation          ( m_framePackingSEIInterpretation );
     603    m_acTEncTop[layer].setSegmentedRectFramePackingArrangementSEIEnabled    ( m_segmentedRectFramePackingSEIEnabled );
     604    m_acTEncTop[layer].setSegmentedRectFramePackingArrangementSEICancel     ( m_segmentedRectFramePackingSEICancel );
     605    m_acTEncTop[layer].setSegmentedRectFramePackingArrangementSEIType       ( m_segmentedRectFramePackingSEIType );
     606    m_acTEncTop[layer].setSegmentedRectFramePackingArrangementSEIPersistence( m_segmentedRectFramePackingSEIPersistence );
     607    m_acTEncTop[layer].setDisplayOrientationSEIAngle                        ( m_displayOrientationSEIAngle );
     608    m_acTEncTop[layer].setTemporalLevel0IndexSEIEnabled                     ( m_temporalLevel0IndexSEIEnabled );
     609    m_acTEncTop[layer].setGradualDecodingRefreshInfoEnabled                 ( m_gradualDecodingRefreshInfoEnabled );
     610    m_acTEncTop[layer].setNoDisplaySEITLayer                                ( m_noDisplaySEITLayer );
     611    m_acTEncTop[layer].setDecodingUnitInfoSEIEnabled                        ( m_decodingUnitInfoSEIEnabled );
     612    m_acTEncTop[layer].setSOPDescriptionSEIEnabled                          ( m_SOPDescriptionSEIEnabled );
     613    m_acTEncTop[layer].setScalableNestingSEIEnabled                         ( m_scalableNestingSEIEnabled );
     614    m_acTEncTop[layer].setTMCTSSEIEnabled                                   ( m_tmctsSEIEnabled );
     615    m_acTEncTop[layer].setTimeCodeSEIEnabled                                ( m_timeCodeSEIEnabled );
     616    m_acTEncTop[layer].setNumberOfTimeSets                                  ( m_timeCodeSEINumTs );
     617    for(Int i = 0; i < m_timeCodeSEINumTs; i++) { m_acTEncTop[layer].setTimeSet(m_timeSetArray[i], i); }
     618    m_acTEncTop[layer].setKneeSEIEnabled                                    ( m_kneeSEIEnabled );
     619    m_acTEncTop[layer].setKneeSEIId                                         ( m_kneeSEIId );
     620    m_acTEncTop[layer].setKneeSEICancelFlag                                 ( m_kneeSEICancelFlag );
     621    m_acTEncTop[layer].setKneeSEIPersistenceFlag                            ( m_kneeSEIPersistenceFlag );   
     622    m_acTEncTop[layer].setKneeSEIInputDrange                                ( m_kneeSEIInputDrange );
     623    m_acTEncTop[layer].setKneeSEIInputDispLuminance                         ( m_kneeSEIInputDispLuminance );
     624    m_acTEncTop[layer].setKneeSEIOutputDrange                               ( m_kneeSEIOutputDrange );
     625    m_acTEncTop[layer].setKneeSEIOutputDispLuminance                        ( m_kneeSEIOutputDispLuminance );
     626    m_acTEncTop[layer].setKneeSEINumKneePointsMinus1                        ( m_kneeSEINumKneePointsMinus1 );
     627    m_acTEncTop[layer].setKneeSEIInputKneePoint                             ( m_kneeSEIInputKneePoint );
     628    m_acTEncTop[layer].setKneeSEIOutputKneePoint                            ( m_kneeSEIOutputKneePoint );
     629    m_acTEncTop[layer].setMasteringDisplaySEI                               ( m_masteringDisplay );
    591630#if Q0096_OVERLAY_SEI
    592     m_acTEncTop[layer].setOverlaySEIEnabled                         ( m_overlaySEIEnabled );
    593     m_acTEncTop[layer].setOverlaySEICancelFlag                      ( m_overlayInfoCancelFlag );
    594     m_acTEncTop[layer].setOverlaySEIContentAuxIdMinus128            ( m_overlayContentAuxIdMinus128 );
    595     m_acTEncTop[layer].setOverlaySEILabelAuxIdMinus128              ( m_overlayLabelAuxIdMinus128 );
    596     m_acTEncTop[layer].setOverlaySEIAlphaAuxIdMinus128              ( m_overlayAlphaAuxIdMinus128 );
    597     m_acTEncTop[layer].setOverlaySEIElementLabelValueLengthMinus8   ( m_overlayElementLabelValueLengthMinus8 );
    598     m_acTEncTop[layer].setOverlaySEINumOverlaysMinus1               ( m_numOverlaysMinus1 );
    599     m_acTEncTop[layer].setOverlaySEIIdx                             ( m_overlayIdx );
    600     m_acTEncTop[layer].setOverlaySEILanguagePresentFlag             ( m_overlayLanguagePresentFlag );
    601     m_acTEncTop[layer].setOverlaySEIContentLayerId                  ( m_overlayContentLayerId );
    602     m_acTEncTop[layer].setOverlaySEILabelPresentFlag                ( m_overlayLabelPresentFlag );
    603     m_acTEncTop[layer].setOverlaySEILabelLayerId                    ( m_overlayLabelLayerId );
    604     m_acTEncTop[layer].setOverlaySEIAlphaPresentFlag                ( m_overlayAlphaPresentFlag );
    605     m_acTEncTop[layer].setOverlaySEIAlphaLayerId                    ( m_overlayAlphaLayerId );
    606     m_acTEncTop[layer].setOverlaySEINumElementsMinus1               ( m_numOverlayElementsMinus1 );
    607     m_acTEncTop[layer].setOverlaySEIElementLabelMin                 ( m_overlayElementLabelMin );
    608     m_acTEncTop[layer].setOverlaySEIElementLabelMax                 ( m_overlayElementLabelMax );
    609     m_acTEncTop[layer].setOverlaySEILanguage                        ( m_overlayLanguage );
    610     m_acTEncTop[layer].setOverlaySEIName                            ( m_overlayName );
    611     m_acTEncTop[layer].setOverlaySEIElementName                     ( m_overlayElementName );
    612     m_acTEncTop[layer].setOverlaySEIPersistenceFlag                 ( m_overlayInfoPersistenceFlag );
     631    m_acTEncTop[layer].setOverlaySEIEnabled                                 ( m_overlaySEIEnabled );
     632    m_acTEncTop[layer].setOverlaySEICancelFlag                              ( m_overlayInfoCancelFlag );
     633    m_acTEncTop[layer].setOverlaySEIContentAuxIdMinus128                    ( m_overlayContentAuxIdMinus128 );
     634    m_acTEncTop[layer].setOverlaySEILabelAuxIdMinus128                      ( m_overlayLabelAuxIdMinus128 );
     635    m_acTEncTop[layer].setOverlaySEIAlphaAuxIdMinus128                      ( m_overlayAlphaAuxIdMinus128 );
     636    m_acTEncTop[layer].setOverlaySEIElementLabelValueLengthMinus8           ( m_overlayElementLabelValueLengthMinus8 );
     637    m_acTEncTop[layer].setOverlaySEINumOverlaysMinus1                       ( m_numOverlaysMinus1 );
     638    m_acTEncTop[layer].setOverlaySEIIdx                                     ( m_overlayIdx );
     639    m_acTEncTop[layer].setOverlaySEILanguagePresentFlag                     ( m_overlayLanguagePresentFlag );
     640    m_acTEncTop[layer].setOverlaySEIContentLayerId                          ( m_overlayContentLayerId );
     641    m_acTEncTop[layer].setOverlaySEILabelPresentFlag                        ( m_overlayLabelPresentFlag );
     642    m_acTEncTop[layer].setOverlaySEILabelLayerId                            ( m_overlayLabelLayerId );
     643    m_acTEncTop[layer].setOverlaySEIAlphaPresentFlag                        ( m_overlayAlphaPresentFlag );
     644    m_acTEncTop[layer].setOverlaySEIAlphaLayerId                            ( m_overlayAlphaLayerId );
     645    m_acTEncTop[layer].setOverlaySEINumElementsMinus1                       ( m_numOverlayElementsMinus1 );
     646    m_acTEncTop[layer].setOverlaySEIElementLabelMin                         ( m_overlayElementLabelMin );
     647    m_acTEncTop[layer].setOverlaySEIElementLabelMax                         ( m_overlayElementLabelMax );
     648    m_acTEncTop[layer].setOverlaySEILanguage                                ( m_overlayLanguage );
     649    m_acTEncTop[layer].setOverlaySEIName                                    ( m_overlayName );
     650    m_acTEncTop[layer].setOverlaySEIElementName                             ( m_overlayElementName );
     651    m_acTEncTop[layer].setOverlaySEIPersistenceFlag                         ( m_overlayInfoPersistenceFlag );
    613652#endif
    614653#if Q0074_COLOUR_REMAPPING_SEI
    615     m_acTEncTop[layer].setCRISEIFile                                ( const_cast<Char*>(m_acLayerCfg[layer].m_colourRemapSEIFile.c_str()) );
    616     m_acTEncTop[layer].setCRISEIId                                  ( m_acLayerCfg[layer].m_colourRemapSEIId );
    617     m_acTEncTop[layer].setCRISEICancelFlag                          ( m_acLayerCfg[layer].m_colourRemapSEICancelFlag );
    618     m_acTEncTop[layer].setCRISEIPersistenceFlag                     ( m_acLayerCfg[layer].m_colourRemapSEIPersistenceFlag );
    619     m_acTEncTop[layer].setCRISEIVideoSignalInfoPresentFlag          ( m_acLayerCfg[layer].m_colourRemapSEIVideoSignalInfoPresentFlag );
    620     m_acTEncTop[layer].setCRISEIFullRangeFlag                       ( m_acLayerCfg[layer].m_colourRemapSEIFullRangeFlag );
    621     m_acTEncTop[layer].setCRISEIPrimaries                           ( m_acLayerCfg[layer].m_colourRemapSEIPrimaries );
    622     m_acTEncTop[layer].setCRISEITransferFunction                    ( m_acLayerCfg[layer].m_colourRemapSEITransferFunction );
    623     m_acTEncTop[layer].setCRISEIMatrixCoefficients                  ( m_acLayerCfg[layer].m_colourRemapSEIMatrixCoefficients );
    624     m_acTEncTop[layer].setCRISEIInputBitDepth                       ( m_acLayerCfg[layer].m_colourRemapSEIInputBitDepth );
    625     m_acTEncTop[layer].setCRISEIBitDepth                            ( m_acLayerCfg[layer].m_colourRemapSEIBitDepth );
    626     m_acTEncTop[layer].setCRISEIPreLutNumValMinus1                  ( m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1 );
    627     m_acTEncTop[layer].setCRISEIPreLutCodedValue                    ( m_acLayerCfg[layer].m_colourRemapSEIPreLutCodedValue );
    628     m_acTEncTop[layer].setCRISEIPreLutTargetValue                   ( m_acLayerCfg[layer].m_colourRemapSEIPreLutTargetValue );
    629     m_acTEncTop[layer].setCRISEIMatrixPresentFlag                   ( m_acLayerCfg[layer].m_colourRemapSEIMatrixPresentFlag );
    630     m_acTEncTop[layer].setCRISEILog2MatrixDenom                     ( m_acLayerCfg[layer].m_colourRemapSEILog2MatrixDenom );
    631     m_acTEncTop[layer].setCRISEICoeffs                              ( m_acLayerCfg[layer].m_colourRemapSEICoeffs );
    632     m_acTEncTop[layer].setCRISEIPostLutNumValMinus1                 ( m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1 );
    633     m_acTEncTop[layer].setCRISEIPostLutCodedValue                   ( m_acLayerCfg[layer]. m_colourRemapSEIPostLutCodedValue );
    634     m_acTEncTop[layer].setCRISEIPostLutTargetValue                  ( m_acLayerCfg[layer].m_colourRemapSEIPostLutTargetValue );
    635 #endif
    636     m_acTEncTop[layer].setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled );
    637     m_acTEncTop[layer].setFramePackingArrangementSEIType( m_framePackingSEIType );
    638     m_acTEncTop[layer].setFramePackingArrangementSEIId( m_framePackingSEIId );
    639     m_acTEncTop[layer].setFramePackingArrangementSEIQuincunx( m_framePackingSEIQuincunx );
    640     m_acTEncTop[layer].setFramePackingArrangementSEIInterpretation( m_framePackingSEIInterpretation );
    641     m_acTEncTop[layer].setDisplayOrientationSEIAngle( m_displayOrientationSEIAngle );
    642     m_acTEncTop[layer].setTemporalLevel0IndexSEIEnabled( m_temporalLevel0IndexSEIEnabled );
    643     m_acTEncTop[layer].setGradualDecodingRefreshInfoEnabled( m_gradualDecodingRefreshInfoEnabled );
    644     m_acTEncTop[layer].setDecodingUnitInfoSEIEnabled( m_decodingUnitInfoSEIEnabled );
     654    m_acTEncTop[layer].setCRISEIFile                            ( const_cast<Char*>(m_acLayerCfg[layer].m_colourRemapSEIFile.c_str()) );
     655    m_acTEncTop[layer].setCRISEIId                              ( m_acLayerCfg[layer].m_colourRemapSEIId );
     656    m_acTEncTop[layer].setCRISEICancelFlag                      ( m_acLayerCfg[layer].m_colourRemapSEICancelFlag );
     657    m_acTEncTop[layer].setCRISEIPersistenceFlag                 ( m_acLayerCfg[layer].m_colourRemapSEIPersistenceFlag );
     658    m_acTEncTop[layer].setCRISEIVideoSignalInfoPresentFlag      ( m_acLayerCfg[layer].m_colourRemapSEIVideoSignalInfoPresentFlag );
     659    m_acTEncTop[layer].setCRISEIFullRangeFlag                   ( m_acLayerCfg[layer].m_colourRemapSEIFullRangeFlag );
     660    m_acTEncTop[layer].setCRISEIPrimaries                       ( m_acLayerCfg[layer].m_colourRemapSEIPrimaries );
     661    m_acTEncTop[layer].setCRISEITransferFunction                ( m_acLayerCfg[layer].m_colourRemapSEITransferFunction );
     662    m_acTEncTop[layer].setCRISEIMatrixCoefficients              ( m_acLayerCfg[layer].m_colourRemapSEIMatrixCoefficients );
     663    m_acTEncTop[layer].setCRISEIInputBitDepth                   ( m_acLayerCfg[layer].m_colourRemapSEIInputBitDepth );
     664    m_acTEncTop[layer].setCRISEIBitDepth                        ( m_acLayerCfg[layer].m_colourRemapSEIBitDepth );
     665    m_acTEncTop[layer].setCRISEIPreLutNumValMinus1              ( m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1 );
     666    m_acTEncTop[layer].setCRISEIPreLutCodedValue                ( m_acLayerCfg[layer].m_colourRemapSEIPreLutCodedValue );
     667    m_acTEncTop[layer].setCRISEIPreLutTargetValue               ( m_acLayerCfg[layer].m_colourRemapSEIPreLutTargetValue );
     668    m_acTEncTop[layer].setCRISEIMatrixPresentFlag               ( m_acLayerCfg[layer].m_colourRemapSEIMatrixPresentFlag );
     669    m_acTEncTop[layer].setCRISEILog2MatrixDenom                 ( m_acLayerCfg[layer].m_colourRemapSEILog2MatrixDenom );
     670    m_acTEncTop[layer].setCRISEICoeffs                          ( m_acLayerCfg[layer].m_colourRemapSEICoeffs );
     671    m_acTEncTop[layer].setCRISEIPostLutNumValMinus1             ( m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1 );
     672    m_acTEncTop[layer].setCRISEIPostLutCodedValue               ( m_acLayerCfg[layer]. m_colourRemapSEIPostLutCodedValue );
     673    m_acTEncTop[layer].setCRISEIPostLutTargetValue              ( m_acLayerCfg[layer].m_colourRemapSEIPostLutTargetValue );
     674#endif   
    645675#if LAYERS_NOT_PRESENT_SEI
    646     m_acTEncTop[layer].setLayersNotPresentSEIEnabled( m_layersNotPresentSEIEnabled );
    647 #endif
    648     m_acTEncTop[layer].setSOPDescriptionSEIEnabled( m_SOPDescriptionSEIEnabled );
    649     m_acTEncTop[layer].setScalableNestingSEIEnabled( m_scalableNestingSEIEnabled );
     676    m_acTEncTop[layer].setLayersNotPresentSEIEnabled            ( m_layersNotPresentSEIEnabled );
     677#endif   
    650678#if Q0189_TMVP_CONSTRAINTS
    651     m_acTEncTop[layer].setTMVPConstraintsSEIEnabled( m_TMVPConstraintsSEIEnabled);           
     679    m_acTEncTop[layer].setTMVPConstraintsSEIEnabled             ( m_TMVPConstraintsSEIEnabled);           
    652680#endif
    653681#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
    654682    m_acTEncTop[layer].setInterLayerConstrainedTileSetsSEIEnabled( m_interLayerConstrainedTileSetsSEIEnabled );
    655     m_acTEncTop[layer].setIlNumSetsInMessage( m_ilNumSetsInMessage );
    656     m_acTEncTop[layer].setSkippedTileSetPresentFlag( m_skippedTileSetPresentFlag );
    657     m_acTEncTop[layer].setTopLeftTileIndex( m_topLeftTileIndex );
    658     m_acTEncTop[layer].setBottomRightTileIndex( m_bottomRightTileIndex );
    659     m_acTEncTop[layer].setIlcIdc( m_ilcIdc );
    660 #endif
    661     m_acTEncTop[layer].setTileUniformSpacingFlag     ( m_tileUniformSpacingFlag );
    662     m_acTEncTop[layer].setNumColumnsMinus1           ( m_numTileColumnsMinus1 );
    663     m_acTEncTop[layer].setNumRowsMinus1              ( m_numTileRowsMinus1 );
     683    m_acTEncTop[layer].setIlNumSetsInMessage                    ( m_ilNumSetsInMessage );
     684    m_acTEncTop[layer].setSkippedTileSetPresentFlag             ( m_skippedTileSetPresentFlag );
     685    m_acTEncTop[layer].setTopLeftTileIndex                      ( m_topLeftTileIndex );
     686    m_acTEncTop[layer].setBottomRightTileIndex                  ( m_bottomRightTileIndex );
     687    m_acTEncTop[layer].setIlcIdc                                ( m_ilcIdc );
     688#endif
     689    m_acTEncTop[layer].setTileUniformSpacingFlag                ( m_tileUniformSpacingFlag );
     690    m_acTEncTop[layer].setNumColumnsMinus1                      ( m_numTileColumnsMinus1 );
     691    m_acTEncTop[layer].setNumRowsMinus1                         ( m_numTileRowsMinus1 );
    664692    if(!m_tileUniformSpacingFlag)
    665693    {
    666       m_acTEncTop[layer].setColumnWidth              ( m_tileColumnWidth );
    667       m_acTEncTop[layer].setRowHeight                ( m_tileRowHeight );
     694      m_acTEncTop[layer].setColumnWidth                         ( m_tileColumnWidth );
     695      m_acTEncTop[layer].setRowHeight                           ( m_tileRowHeight );
    668696    }
    669697    m_acTEncTop[layer].xCheckGSParameters();
     
    673701      m_bLFCrossTileBoundaryFlag = true;
    674702    }
    675     m_acTEncTop[layer].setLFCrossTileBoundaryFlag( m_bLFCrossTileBoundaryFlag );
    676     m_acTEncTop[layer].setWaveFrontSynchro           ( m_acLayerCfg[layer].m_waveFrontSynchro );
    677     m_acTEncTop[layer].setWaveFrontSubstreams        ( m_acLayerCfg[layer].m_iWaveFrontSubstreams );
    678     m_acTEncTop[layer].setTMVPModeId ( m_TMVPModeId );
    679     m_acTEncTop[layer].setUseScalingListId           ( m_useScalingListId  );
    680     m_acTEncTop[layer].setScalingListFile            ( m_scalingListFile   );
    681     m_acTEncTop[layer].setSignHideFlag(m_signHideFlag);
     703    m_acTEncTop[layer].setLFCrossTileBoundaryFlag               ( m_bLFCrossTileBoundaryFlag );
     704    m_acTEncTop[layer].setWaveFrontSynchro                      ( m_acLayerCfg[layer].m_waveFrontSynchro );
     705    m_acTEncTop[layer].setWaveFrontSubstreams                   ( m_acLayerCfg[layer].m_iWaveFrontSubstreams );
     706    m_acTEncTop[layer].setTMVPModeId                            ( m_TMVPModeId );
     707    m_acTEncTop[layer].setUseScalingListId                      ( m_useScalingListId  );
     708    m_acTEncTop[layer].setScalingListFile                       ( m_scalingListFile   );
     709    m_acTEncTop[layer].setSignHideFlag                          ( m_signHideFlag );
    682710#if RC_SHVC_HARMONIZATION
    683     m_acTEncTop[layer].setUseRateCtrl     (m_acLayerCfg[layer].getRCEnableRateControl());
    684     m_acTEncTop[layer].setTargetBitrate   (m_acLayerCfg[layer].getRCTargetBitrate());
    685     m_acTEncTop[layer].setKeepHierBit     (m_acLayerCfg[layer].getRCKeepHierarchicalBit());
    686     m_acTEncTop[layer].setLCULevelRC      (m_acLayerCfg[layer].getRCLCULevelRC());
    687     m_acTEncTop[layer].setUseLCUSeparateModel (m_acLayerCfg[layer].getRCUseLCUSeparateModel());
    688     m_acTEncTop[layer].setInitialQP           (m_acLayerCfg[layer].getRCInitialQP());
    689     m_acTEncTop[layer].setForceIntraQP        (m_acLayerCfg[layer].getRCForceIntraQP());
    690 #else
    691     m_acTEncTop[layer].setUseRateCtrl         ( m_RCEnableRateControl );
    692     m_acTEncTop[layer].setTargetBitrate       ( m_RCTargetBitrate );
    693     m_acTEncTop[layer].setKeepHierBit         ( m_RCKeepHierarchicalBit );
    694     m_acTEncTop[layer].setLCULevelRC          ( m_RCLCULevelRC );
    695     m_acTEncTop[layer].setUseLCUSeparateModel ( m_RCUseLCUSeparateModel );
    696     m_acTEncTop[layer].setInitialQP           ( m_RCInitialQP );
    697     m_acTEncTop[layer].setForceIntraQP        ( m_RCForceIntraQP );
    698 #endif
    699     m_acTEncTop[layer].setTransquantBypassEnableFlag(m_TransquantBypassEnableFlag);
    700     m_acTEncTop[layer].setCUTransquantBypassFlagForceValue(m_CUTransquantBypassFlagForce);
    701     m_acTEncTop[layer].setUseRecalculateQPAccordingToLambda( m_recalculateQPAccordingToLambda );
    702     m_acTEncTop[layer].setUseStrongIntraSmoothing( m_useStrongIntraSmoothing );
    703     m_acTEncTop[layer].setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled );
    704     m_acTEncTop[layer].setVuiParametersPresentFlag( m_vuiParametersPresentFlag );
    705     m_acTEncTop[layer].setAspectRatioInfoPresentFlag( m_aspectRatioInfoPresentFlag);
    706     m_acTEncTop[layer].setAspectRatioIdc( m_aspectRatioIdc );
    707     m_acTEncTop[layer].setSarWidth( m_sarWidth );
    708     m_acTEncTop[layer].setSarHeight( m_sarHeight );
    709     m_acTEncTop[layer].setOverscanInfoPresentFlag( m_overscanInfoPresentFlag );
    710     m_acTEncTop[layer].setOverscanAppropriateFlag( m_overscanAppropriateFlag );
    711     m_acTEncTop[layer].setVideoSignalTypePresentFlag( m_videoSignalTypePresentFlag );
    712     m_acTEncTop[layer].setVideoFormat( m_videoFormat );
    713     m_acTEncTop[layer].setVideoFullRangeFlag( m_videoFullRangeFlag );
    714     m_acTEncTop[layer].setColourDescriptionPresentFlag( m_colourDescriptionPresentFlag );
    715     m_acTEncTop[layer].setColourPrimaries( m_colourPrimaries );
    716     m_acTEncTop[layer].setTransferCharacteristics( m_transferCharacteristics );
    717     m_acTEncTop[layer].setMatrixCoefficients( m_matrixCoefficients );
    718     m_acTEncTop[layer].setChromaLocInfoPresentFlag( m_chromaLocInfoPresentFlag );
    719     m_acTEncTop[layer].setChromaSampleLocTypeTopField( m_chromaSampleLocTypeTopField );
    720     m_acTEncTop[layer].setChromaSampleLocTypeBottomField( m_chromaSampleLocTypeBottomField );
    721     m_acTEncTop[layer].setNeutralChromaIndicationFlag( m_neutralChromaIndicationFlag );
    722     m_acTEncTop[layer].setDefaultDisplayWindow( m_defDispWinLeftOffset, m_defDispWinRightOffset, m_defDispWinTopOffset, m_defDispWinBottomOffset );
    723     m_acTEncTop[layer].setFrameFieldInfoPresentFlag( m_frameFieldInfoPresentFlag );
    724     m_acTEncTop[layer].setPocProportionalToTimingFlag( m_pocProportionalToTimingFlag );
    725     m_acTEncTop[layer].setNumTicksPocDiffOneMinus1   ( m_numTicksPocDiffOneMinus1    );
    726     m_acTEncTop[layer].setBitstreamRestrictionFlag( m_bitstreamRestrictionFlag );
    727     m_acTEncTop[layer].setTilesFixedStructureFlag( m_tilesFixedStructureFlag );
    728     m_acTEncTop[layer].setMotionVectorsOverPicBoundariesFlag( m_motionVectorsOverPicBoundariesFlag );
    729     m_acTEncTop[layer].setMinSpatialSegmentationIdc( m_minSpatialSegmentationIdc );
    730     m_acTEncTop[layer].setMaxBytesPerPicDenom( m_maxBytesPerPicDenom );
    731     m_acTEncTop[layer].setMaxBitsPerMinCuDenom( m_maxBitsPerMinCuDenom );
    732     m_acTEncTop[layer].setLog2MaxMvLengthHorizontal( m_log2MaxMvLengthHorizontal );
    733     m_acTEncTop[layer].setLog2MaxMvLengthVertical( m_log2MaxMvLengthVertical );
    734     m_acTEncTop[layer].setElRapSliceTypeB(layer == 0? 0 : m_elRapSliceBEnabled);
     711    m_acTEncTop[layer].setUseRateCtrl                           ( m_acLayerCfg[layer].getRCEnableRateControl() );
     712    m_acTEncTop[layer].setTargetBitrate                         ( m_acLayerCfg[layer].getRCTargetBitrate() );
     713    m_acTEncTop[layer].setKeepHierBit                           ( m_acLayerCfg[layer].getRCKeepHierarchicalBit() );
     714    m_acTEncTop[layer].setLCULevelRC                            ( m_acLayerCfg[layer].getRCLCULevelRC() );
     715    m_acTEncTop[layer].setUseLCUSeparateModel                   ( m_acLayerCfg[layer].getRCUseLCUSeparateModel() );
     716    m_acTEncTop[layer].setInitialQP                             ( m_acLayerCfg[layer].getRCInitialQP() );
     717    m_acTEncTop[layer].setForceIntraQP                          ( m_acLayerCfg[layer].getRCForceIntraQP() );
     718#else
     719    m_acTEncTop[layer].setUseRateCtrl                           ( m_RCEnableRateControl );
     720    m_acTEncTop[layer].setTargetBitrate                         ( m_RCTargetBitrate );
     721    m_acTEncTop[layer].setKeepHierBit                           ( m_RCKeepHierarchicalBit );
     722    m_acTEncTop[layer].setLCULevelRC                            ( m_RCLCULevelRC );
     723    m_acTEncTop[layer].setUseLCUSeparateModel                   ( m_RCUseLCUSeparateModel );
     724    m_acTEncTop[layer].setInitialQP                             ( m_RCInitialQP );
     725    m_acTEncTop[layer].setForceIntraQP                          ( m_RCForceIntraQP );
     726#endif
     727    m_acTEncTop[layer].setTransquantBypassEnableFlag            ( m_TransquantBypassEnableFlag );
     728    m_acTEncTop[layer].setCUTransquantBypassFlagForceValue      ( m_CUTransquantBypassFlagForce );
     729    m_acTEncTop[layer].setCostMode                              ( m_costMode );
     730    m_acTEncTop[layer].setUseRecalculateQPAccordingToLambda     ( m_recalculateQPAccordingToLambda );
     731    m_acTEncTop[layer].setUseStrongIntraSmoothing               ( m_useStrongIntraSmoothing );
     732    m_acTEncTop[layer].setActiveParameterSetsSEIEnabled         ( m_activeParameterSetsSEIEnabled );
     733    m_acTEncTop[layer].setVuiParametersPresentFlag              ( m_vuiParametersPresentFlag );
     734    m_acTEncTop[layer].setAspectRatioInfoPresentFlag            ( m_aspectRatioInfoPresentFlag);
     735    m_acTEncTop[layer].setAspectRatioIdc                        ( m_aspectRatioIdc );
     736    m_acTEncTop[layer].setSarWidth                              ( m_sarWidth );
     737    m_acTEncTop[layer].setSarHeight                             ( m_sarHeight );
     738    m_acTEncTop[layer].setOverscanInfoPresentFlag               ( m_overscanInfoPresentFlag );
     739    m_acTEncTop[layer].setOverscanAppropriateFlag               ( m_overscanAppropriateFlag );
     740    m_acTEncTop[layer].setVideoSignalTypePresentFlag            ( m_videoSignalTypePresentFlag );
     741    m_acTEncTop[layer].setVideoFormat                           ( m_videoFormat );
     742    m_acTEncTop[layer].setVideoFullRangeFlag                    ( m_videoFullRangeFlag );
     743    m_acTEncTop[layer].setColourDescriptionPresentFlag          ( m_colourDescriptionPresentFlag );
     744    m_acTEncTop[layer].setColourPrimaries                       ( m_colourPrimaries );
     745    m_acTEncTop[layer].setTransferCharacteristics               ( m_transferCharacteristics );
     746    m_acTEncTop[layer].setMatrixCoefficients                    ( m_matrixCoefficients );
     747    m_acTEncTop[layer].setChromaLocInfoPresentFlag              ( m_chromaLocInfoPresentFlag );
     748    m_acTEncTop[layer].setChromaSampleLocTypeTopField           ( m_chromaSampleLocTypeTopField );
     749    m_acTEncTop[layer].setChromaSampleLocTypeBottomField        ( m_chromaSampleLocTypeBottomField );
     750    m_acTEncTop[layer].setNeutralChromaIndicationFlag           ( m_neutralChromaIndicationFlag );
     751    m_acTEncTop[layer].setDefaultDisplayWindow                  ( m_defDispWinLeftOffset, m_defDispWinRightOffset, m_defDispWinTopOffset, m_defDispWinBottomOffset );
     752    m_acTEncTop[layer].setFrameFieldInfoPresentFlag             ( m_frameFieldInfoPresentFlag );
     753    m_acTEncTop[layer].setPocProportionalToTimingFlag           ( m_pocProportionalToTimingFlag );
     754    m_acTEncTop[layer].setNumTicksPocDiffOneMinus1              ( m_numTicksPocDiffOneMinus1    );
     755    m_acTEncTop[layer].setBitstreamRestrictionFlag              ( m_bitstreamRestrictionFlag );
     756    m_acTEncTop[layer].setTilesFixedStructureFlag               ( m_tilesFixedStructureFlag );
     757    m_acTEncTop[layer].setMotionVectorsOverPicBoundariesFlag    ( m_motionVectorsOverPicBoundariesFlag );
     758    m_acTEncTop[layer].setMinSpatialSegmentationIdc             ( m_minSpatialSegmentationIdc );
     759    m_acTEncTop[layer].setMaxBytesPerPicDenom                   ( m_maxBytesPerPicDenom );
     760    m_acTEncTop[layer].setMaxBitsPerMinCuDenom                  ( m_maxBitsPerMinCuDenom );
     761    m_acTEncTop[layer].setLog2MaxMvLengthHorizontal             ( m_log2MaxMvLengthHorizontal );
     762    m_acTEncTop[layer].setLog2MaxMvLengthVertical               ( m_log2MaxMvLengthVertical );
     763    m_acTEncTop[layer].setElRapSliceTypeB                       (layer == 0? 0 : m_elRapSliceBEnabled);
    735764    if( layer > 0 )
    736765    {
     
    745774#endif
    746775#endif
    747       m_acTEncTop[layer].setNumScaledRefLayerOffsets( m_acLayerCfg[layer].m_numScaledRefLayerOffsets );
     776      m_acTEncTop[layer].setNumScaledRefLayerOffsets            ( m_acLayerCfg[layer].m_numScaledRefLayerOffsets );
    748777      for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++)
    749778      {
    750779#if O0098_SCALED_REF_LAYER_ID
    751         m_acTEncTop[layer].setScaledRefLayerId(i, m_acLayerCfg[layer].m_scaledRefLayerId[i]);
     780        m_acTEncTop[layer].setScaledRefLayerId                  (i, m_acLayerCfg[layer].m_scaledRefLayerId[i]);
    752781#endif
    753782#if REF_REGION_OFFSET
    754         m_acTEncTop[layer].setScaledRefLayerOffsetPresentFlag( i, m_acLayerCfg[layer].m_scaledRefLayerOffsetPresentFlag[i] );
    755         m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow( subWidthC  * m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], subWidthC  * m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i],
    756                                                                  subHeightC * m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i],  subHeightC * m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i]);
     783        m_acTEncTop[layer].setScaledRefLayerOffsetPresentFlag   ( i, m_acLayerCfg[layer].m_scaledRefLayerOffsetPresentFlag[i] );
     784        m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow ( subWidthC  * m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], subWidthC  * m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i],
     785                                                                  subHeightC * m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i],  subHeightC * m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i]);
    757786#else
    758787#if P0312_VERT_PHASE_ADJ
    759         m_acTEncTop[layer].setVertPhasePositionEnableFlag( i, m_acLayerCfg[layer].m_vertPhasePositionEnableFlag[i] );
    760         m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow( 2*m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i],
    761                                                   2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i], m_acLayerCfg[layer].m_vertPhasePositionEnableFlag[i] );
    762 #else
    763         m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow( 2*m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i],
    764                                                   2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i]);
     788        m_acTEncTop[layer].setVertPhasePositionEnableFlag       ( i, m_acLayerCfg[layer].m_vertPhasePositionEnableFlag[i] );
     789        m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow ( 2*m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i],
     790                                                                  2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i], m_acLayerCfg[layer].m_vertPhasePositionEnableFlag[i] );
     791#else
     792        m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow ( 2*m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i],
     793                                                                  2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i]);
    765794#endif
    766795#endif
    767796#if R0209_GENERIC_PHASE
    768         m_acTEncTop[layer].setResamplePhaseSetPresentFlag( i, m_acLayerCfg[layer].m_resamplePhaseSetPresentFlag[i] );
    769         m_acTEncTop[layer].setPhaseHorLuma( i, m_acLayerCfg[layer].m_phaseHorLuma[i] );
    770         m_acTEncTop[layer].setPhaseVerLuma( i, m_acLayerCfg[layer].m_phaseVerLuma[i] );
    771         m_acTEncTop[layer].setPhaseHorChroma( i, m_acLayerCfg[layer].m_phaseHorChroma[i] );
    772         m_acTEncTop[layer].setPhaseVerChroma( i, m_acLayerCfg[layer].m_phaseVerChroma[i] );
     797        m_acTEncTop[layer].setResamplePhaseSetPresentFlag       ( i, m_acLayerCfg[layer].m_resamplePhaseSetPresentFlag[i] );
     798        m_acTEncTop[layer].setPhaseHorLuma                      ( i, m_acLayerCfg[layer].m_phaseHorLuma[i] );
     799        m_acTEncTop[layer].setPhaseVerLuma                      ( i, m_acLayerCfg[layer].m_phaseVerLuma[i] );
     800        m_acTEncTop[layer].setPhaseHorChroma                    ( i, m_acLayerCfg[layer].m_phaseHorChroma[i] );
     801        m_acTEncTop[layer].setPhaseVerChroma                    ( i, m_acLayerCfg[layer].m_phaseVerChroma[i] );
    773802#endif
    774803      }
    775804    }
    776805#if M0040_ADAPTIVE_RESOLUTION_CHANGE
    777     m_acTEncTop[layer].setAdaptiveResolutionChange( m_adaptiveResolutionChange );
     806    m_acTEncTop[layer].setAdaptiveResolutionChange               ( m_adaptiveResolutionChange );
    778807#endif
    779808#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
    780     m_acTEncTop[layer].setLayerSwitchOffBegin(m_acLayerCfg[layer].m_layerSwitchOffBegin);
    781     m_acTEncTop[layer].setLayerSwitchOffEnd(m_acLayerCfg[layer].m_layerSwitchOffEnd);
     809    m_acTEncTop[layer].setLayerSwitchOffBegin                    (m_acLayerCfg[layer].m_layerSwitchOffBegin);
     810    m_acTEncTop[layer].setLayerSwitchOffEnd                      (m_acLayerCfg[layer].m_layerSwitchOffEnd);
    782811#endif
    783812#if AUXILIARY_PICTURES
    784     m_acTEncTop[layer].setChromaFormatIDC( m_acLayerCfg[layer].m_chromaFormatIDC );
     813    m_acTEncTop[layer].setChromaFormatIDC                        ( m_acLayerCfg[layer].m_chromaFormatIDC );
    785814#endif
    786815#if O0153_ALT_OUTPUT_LAYER_FLAG
    787     m_acTEncTop[layer].setAltOuputLayerFlag( m_altOutputLayerFlag );
     816    m_acTEncTop[layer].setAltOuputLayerFlag                      ( m_altOutputLayerFlag );
    788817#endif
    789818#if O0149_CROSS_LAYER_BLA_FLAG
    790     m_acTEncTop[layer].setCrossLayerBLAFlag( m_crossLayerBLAFlag );
     819    m_acTEncTop[layer].setCrossLayerBLAFlag                      ( m_crossLayerBLAFlag );
    791820#endif
    792821#if Q0048_CGS_3D_ASYMLUT
    793     m_acTEncTop[layer].setCGSFlag( layer == 0 ? 0 : m_nCGSFlag );
    794     m_acTEncTop[layer].setCGSMaxOctantDepth( m_nCGSMaxOctantDepth );
    795     m_acTEncTop[layer].setCGSMaxYPartNumLog2( m_nCGSMaxYPartNumLog2 );
    796     m_acTEncTop[layer].setCGSLUTBit( m_nCGSLUTBit );
     822    m_acTEncTop[layer].setCGSFlag                                ( layer == 0 ? 0 : m_nCGSFlag );
     823    m_acTEncTop[layer].setCGSMaxOctantDepth                      ( m_nCGSMaxOctantDepth );
     824    m_acTEncTop[layer].setCGSMaxYPartNumLog2                     ( m_nCGSMaxYPartNumLog2 );
     825    m_acTEncTop[layer].setCGSLUTBit                              ( m_nCGSLUTBit );
    797826#if R0151_CGS_3D_ASYMLUT_IMPROVE
    798     m_acTEncTop[layer].setCGSAdaptChroma( m_nCGSAdaptiveChroma );
     827    m_acTEncTop[layer].setCGSAdaptChroma                         ( m_nCGSAdaptiveChroma );
    799828#endif
    800829#if R0179_ENC_OPT_3DLUT_SIZE
    801     m_acTEncTop[layer].setCGSLutSizeRDO( m_nCGSLutSizeRDO );
     830    m_acTEncTop[layer].setCGSLutSizeRDO                          ( m_nCGSLutSizeRDO );
    802831#endif
    803832#endif
    804833#if Q0078_ADD_LAYER_SETS
    805     m_acTEncTop[layer].setNumAddLayerSets( m_numAddLayerSets );
     834    m_acTEncTop[layer].setNumAddLayerSets                        ( m_numAddLayerSets );
    806835#endif
    807836  }
     
    812841  TComVPS vps;
    813842
    814   vps.setMaxTLayers                       ( m_maxTempLayer );
     843  vps.setMaxTLayers                                               ( m_maxTempLayer );
    815844  if (m_maxTempLayer == 1)
    816845  {
    817846    vps.setTemporalNestingFlag(true);
    818847  }
    819   vps.setMaxLayers                        ( 1 );
     848  vps.setMaxLayers                                                ( 1 );
    820849  for(Int i = 0; i < MAX_TLAYER; i++)
    821850  {
    822     vps.setNumReorderPics                 ( m_numReorderPics[i], i );
    823     vps.setMaxDecPicBuffering             ( m_maxDecPicBuffering[i], i );
     851    vps.setNumReorderPics                                         ( m_numReorderPics[i], i );
     852    vps.setMaxDecPicBuffering                                     ( m_maxDecPicBuffering[i], i );
    824853  }
    825854  m_cTEncTop.setVPS(&vps);
    826855
    827   m_cTEncTop.setProfile(m_profile);
    828   m_cTEncTop.setLevel(m_levelTier, m_level);
    829   m_cTEncTop.setProgressiveSourceFlag(m_progressiveSourceFlag);
    830   m_cTEncTop.setInterlacedSourceFlag(m_interlacedSourceFlag);
    831   m_cTEncTop.setNonPackedConstraintFlag(m_nonPackedConstraintFlag);
    832   m_cTEncTop.setFrameOnlyConstraintFlag(m_frameOnlyConstraintFlag);
    833 
    834   m_cTEncTop.setFrameRate                    ( m_iFrameRate );
    835   m_cTEncTop.setFrameSkip                    ( m_FrameSkip );
    836   m_cTEncTop.setSourceWidth                  ( m_iSourceWidth );
    837   m_cTEncTop.setSourceHeight                 ( m_iSourceHeight );
    838   m_cTEncTop.setConformanceWindow            ( m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom );
    839   m_cTEncTop.setFramesToBeEncoded            ( m_framesToBeEncoded );
     856  m_cTEncTop.setProfile                                           ( m_profile);
     857  m_cTEncTop.setLevel                                             ( m_levelTier, m_level);
     858  m_cTEncTop.setProgressiveSourceFlag                             ( m_progressiveSourceFlag);
     859  m_cTEncTop.setInterlacedSourceFlag                              ( m_interlacedSourceFlag);
     860  m_cTEncTop.setNonPackedConstraintFlag                           ( m_nonPackedConstraintFlag);
     861  m_cTEncTop.setFrameOnlyConstraintFlag                           ( m_frameOnlyConstraintFlag);
     862  m_cTEncTop.setBitDepthConstraintValue                           ( m_bitDepthConstraint );
     863  m_cTEncTop.setChromaFormatConstraintValue                       ( m_chromaFormatConstraint );
     864  m_cTEncTop.setIntraConstraintFlag                               ( m_intraConstraintFlag );
     865  m_cTEncTop.setLowerBitRateConstraintFlag                        ( m_lowerBitRateConstraintFlag );
     866
     867  m_cTEncTop.setPrintMSEBasedSequencePSNR                         ( m_printMSEBasedSequencePSNR);
     868  m_cTEncTop.setPrintFrameMSE                                     ( m_printFrameMSE);
     869  m_cTEncTop.setPrintSequenceMSE                                  ( m_printSequenceMSE);
     870  m_cTEncTop.setCabacZeroWordPaddingEnabled                       ( m_cabacZeroWordPaddingEnabled );
     871
     872  m_cTEncTop.setFrameRate                                         ( m_iFrameRate );
     873  m_cTEncTop.setFrameSkip                                         ( m_FrameSkip );
     874  m_cTEncTop.setSourceWidth                                       ( m_iSourceWidth );
     875  m_cTEncTop.setSourceHeight                                      ( m_iSourceHeight );
     876  m_cTEncTop.setConformanceWindow                                 ( m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom );
     877  m_cTEncTop.setFramesToBeEncoded                                 ( m_framesToBeEncoded );
    840878
    841879  //====== Coding Structure ========
    842   m_cTEncTop.setIntraPeriod                  ( m_iIntraPeriod );
    843   m_cTEncTop.setDecodingRefreshType          ( m_iDecodingRefreshType );
    844   m_cTEncTop.setGOPSize                      ( m_iGOPSize );
    845   m_cTEncTop.setGopList                      ( m_GOPList );
    846   m_cTEncTop.setExtraRPSs                    ( m_extraRPSs );
     880  m_cTEncTop.setIntraPeriod                                       ( m_iIntraPeriod );
     881  m_cTEncTop.setDecodingRefreshType                               ( m_iDecodingRefreshType );
     882  m_cTEncTop.setGOPSize                                           ( m_iGOPSize );
     883  m_cTEncTop.setGopList                                           ( m_GOPList );
     884  m_cTEncTop.setExtraRPSs                                         ( m_extraRPSs );
    847885  for(Int i = 0; i < MAX_TLAYER; i++)
    848886  {
    849     m_cTEncTop.setNumReorderPics             ( m_numReorderPics[i], i );
    850     m_cTEncTop.setMaxDecPicBuffering         ( m_maxDecPicBuffering[i], i );
     887    m_cTEncTop.setNumReorderPics                                  ( m_numReorderPics[i], i );
     888    m_cTEncTop.setMaxDecPicBuffering                              ( m_maxDecPicBuffering[i], i );
    851889  }
    852890  for( UInt uiLoop = 0; uiLoop < MAX_TLAYER; ++uiLoop )
    853891  {
    854     m_cTEncTop.setLambdaModifier( uiLoop, m_adLambdaModifier[ uiLoop ] );
    855   }
    856   m_cTEncTop.setQP                           ( m_iQP );
    857 
    858   m_cTEncTop.setPad                          ( m_aiPad );
    859 
    860   m_cTEncTop.setMaxTempLayer                 ( m_maxTempLayer );
     892    m_cTEncTop.setLambdaModifier                                  ( uiLoop, m_adLambdaModifier[ uiLoop ] );
     893  }
     894  m_cTEncTop.setQP                                                ( m_iQP );
     895
     896  m_cTEncTop.setPad                                               ( m_aiPad );
     897
     898  m_cTEncTop.setMaxTempLayer                                      ( m_maxTempLayer );
    861899  m_cTEncTop.setUseAMP( m_enableAMP );
    862900
     
    864902
    865903  //====== Loop/Deblock Filter ========
    866   m_cTEncTop.setLoopFilterDisable            ( m_bLoopFilterDisable       );
    867   m_cTEncTop.setLoopFilterOffsetInPPS        ( m_loopFilterOffsetInPPS );
    868   m_cTEncTop.setLoopFilterBetaOffset         ( m_loopFilterBetaOffsetDiv2  );
    869   m_cTEncTop.setLoopFilterTcOffset           ( m_loopFilterTcOffsetDiv2    );
    870   m_cTEncTop.setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent);
    871   m_cTEncTop.setDeblockingFilterMetric       ( m_DeblockingFilterMetric );
     904  m_cTEncTop.setLoopFilterDisable                                 ( m_bLoopFilterDisable       );
     905  m_cTEncTop.setLoopFilterOffsetInPPS                             ( m_loopFilterOffsetInPPS );
     906  m_cTEncTop.setLoopFilterBetaOffset                              ( m_loopFilterBetaOffsetDiv2  );
     907  m_cTEncTop.setLoopFilterTcOffset                                ( m_loopFilterTcOffsetDiv2    );
     908  m_cTEncTop.setDeblockingFilterControlPresent                    ( m_DeblockingFilterControlPresent);
     909  m_cTEncTop.setDeblockingFilterMetric                            ( m_DeblockingFilterMetric );
    872910
    873911  //====== Motion search ========
    874   m_cTEncTop.setFastSearch                   ( m_iFastSearch  );
    875   m_cTEncTop.setSearchRange                  ( m_iSearchRange );
    876   m_cTEncTop.setBipredSearchRange            ( m_bipredSearchRange );
     912  m_cTEncTop.setFastSearch                                        ( m_iFastSearch  );
     913  m_cTEncTop.setSearchRange                                       ( m_iSearchRange );
     914  m_cTEncTop.setBipredSearchRange                                 ( m_bipredSearchRange );
    877915
    878916  //====== Quality control ========
    879   m_cTEncTop.setMaxDeltaQP                   ( m_iMaxDeltaQP  );
    880   m_cTEncTop.setMaxCuDQPDepth                ( m_iMaxCuDQPDepth  );
    881 
    882   m_cTEncTop.setChromaCbQpOffset               ( m_cbQpOffset     );
    883   m_cTEncTop.setChromaCrQpOffset            ( m_crQpOffset  );
     917  m_cTEncTop.setMaxDeltaQP                                        ( m_iMaxDeltaQP  );
     918  m_cTEncTop.setMaxCuDQPDepth                                     ( m_iMaxCuDQPDepth  );
     919  m_cTEncTop.setMaxCUChromaQpAdjustmentDepth                      ( m_maxCUChromaQpAdjustmentDepth );
     920  m_cTEncTop.setChromaCbQpOffset                                  ( m_cbQpOffset     );
     921  m_cTEncTop.setChromaCrQpOffset                                  ( m_crQpOffset  );
     922
     923  m_cTEncTop.setChromaFormatIdc                                   ( m_chromaFormatIDC  );
    884924
    885925#if ADAPTIVE_QP_SELECTION
    886   m_cTEncTop.setUseAdaptQpSelect             ( m_bUseAdaptQpSelect   );
    887 #endif
    888 
    889   m_cTEncTop.setUseAdaptiveQP                ( m_bUseAdaptiveQP  );
    890   m_cTEncTop.setQPAdaptationRange            ( m_iQPAdaptationRange );
    891 
     926  m_cTEncTop.setUseAdaptQpSelect                                  ( m_bUseAdaptQpSelect   );
     927#endif
     928
     929  m_cTEncTop.setUseAdaptiveQP                                     ( m_bUseAdaptiveQP  );
     930  m_cTEncTop.setQPAdaptationRange                                 ( m_iQPAdaptationRange );
     931  m_cTEncTop.setUseExtendedPrecision                              ( m_useExtendedPrecision );
     932  m_cTEncTop.setUseHighPrecisionPredictionWeighting               ( m_useHighPrecisionPredictionWeighting );
    892933  //====== Tool list ========
    893   m_cTEncTop.setDeltaQpRD                    ( m_uiDeltaQpRD  );
    894   m_cTEncTop.setUseASR                       ( m_bUseASR      );
    895   m_cTEncTop.setUseHADME                     ( m_bUseHADME    );
    896   m_cTEncTop.setdQPs                         ( m_aidQP        );
    897   m_cTEncTop.setUseRDOQ                      ( m_useRDOQ     );
    898   m_cTEncTop.setUseRDOQTS                    ( m_useRDOQTS   );
    899   m_cTEncTop.setRDpenalty                 ( m_rdPenalty );
    900   m_cTEncTop.setQuadtreeTULog2MaxSize        ( m_uiQuadtreeTULog2MaxSize );
    901   m_cTEncTop.setQuadtreeTULog2MinSize        ( m_uiQuadtreeTULog2MinSize );
    902   m_cTEncTop.setQuadtreeTUMaxDepthInter      ( m_uiQuadtreeTUMaxDepthInter );
    903   m_cTEncTop.setQuadtreeTUMaxDepthIntra      ( m_uiQuadtreeTUMaxDepthIntra );
    904   m_cTEncTop.setUseFastEnc                   ( m_bUseFastEnc  );
    905   m_cTEncTop.setUseEarlyCU                   ( m_bUseEarlyCU  );
    906   m_cTEncTop.setUseFastDecisionForMerge      ( m_useFastDecisionForMerge  );
    907   m_cTEncTop.setUseCbfFastMode            ( m_bUseCbfFastMode  );
    908   m_cTEncTop.setUseEarlySkipDetection            ( m_useEarlySkipDetection );
     934  m_cTEncTop.setDeltaQpRD                                         ( m_uiDeltaQpRD  );
     935  m_cTEncTop.setUseASR                                            ( m_bUseASR      );
     936  m_cTEncTop.setUseHADME                                          ( m_bUseHADME    );
     937  m_cTEncTop.setdQPs                                              ( m_aidQP        );
     938  m_cTEncTop.setUseRDOQ                                           ( m_useRDOQ     );
     939  m_cTEncTop.setUseRDOQTS                                         ( m_useRDOQTS   );
     940  m_cTEncTop.setRDpenalty                                         ( m_rdPenalty );
     941  m_cTEncTop.setQuadtreeTULog2MaxSize                             ( m_uiQuadtreeTULog2MaxSize );
     942  m_cTEncTop.setQuadtreeTULog2MinSize                             ( m_uiQuadtreeTULog2MinSize );
     943  m_cTEncTop.setQuadtreeTUMaxDepthInter                           ( m_uiQuadtreeTUMaxDepthInter );
     944  m_cTEncTop.setQuadtreeTUMaxDepthIntra                           ( m_uiQuadtreeTUMaxDepthIntra );
     945  m_cTEncTop.setUseFastEnc                                        ( m_bUseFastEnc  );
     946  m_cTEncTop.setUseEarlyCU                                        ( m_bUseEarlyCU  );
     947  m_cTEncTop.setUseFastDecisionForMerge                           ( m_useFastDecisionForMerge  );
     948  m_cTEncTop.setUseCbfFastMode                                    ( m_bUseCbfFastMode  );
     949  m_cTEncTop.setUseEarlySkipDetection                             ( m_useEarlySkipDetection );
    909950#if FAST_INTRA_SHVC
    910   m_cTEncTop.setUseFastIntraScalable            ( m_useFastIntraScalable );
    911 #endif
    912 
    913   m_cTEncTop.setUseTransformSkip             ( m_useTransformSkip      );
    914   m_cTEncTop.setUseTransformSkipFast         ( m_useTransformSkipFast  );
    915   m_cTEncTop.setUseConstrainedIntraPred      ( m_bUseConstrainedIntraPred );
    916   m_cTEncTop.setPCMLog2MinSize          ( m_uiPCMLog2MinSize);
    917   m_cTEncTop.setUsePCM                       ( m_usePCM );
    918   m_cTEncTop.setPCMLog2MaxSize               ( m_pcmLog2MaxSize);
    919   m_cTEncTop.setMaxNumMergeCand              ( m_maxNumMergeCand );
     951  m_cTEncTop.setUseFastIntraScalable                              ( m_useFastIntraScalable );
     952#endif
     953  m_cTEncTop.setUseCrossComponentPrediction                       ( m_useCrossComponentPrediction );
     954  m_cTEncTop.setUseReconBasedCrossCPredictionEstimate             ( m_reconBasedCrossCPredictionEstimate );
     955  m_cTEncTop.setSaoOffsetBitShift                                 ( CHANNEL_TYPE_LUMA  , m_saoOffsetBitShift[CHANNEL_TYPE_LUMA]   );
     956  m_cTEncTop.setSaoOffsetBitShift                                 ( CHANNEL_TYPE_CHROMA, m_saoOffsetBitShift[CHANNEL_TYPE_CHROMA] );
     957  m_cTEncTop.setUseTransformSkip                                  ( m_useTransformSkip      );
     958  m_cTEncTop.setUseTransformSkipFast                              ( m_useTransformSkipFast  );
     959  m_cTEncTop.setUseResidualRotation                               ( m_useResidualRotation   );
     960  m_cTEncTop.setUseSingleSignificanceMapContext                   ( m_useSingleSignificanceMapContext   );
     961  m_cTEncTop.setUseGolombRiceParameterAdaptation                  ( m_useGolombRiceParameterAdaptation );
     962  m_cTEncTop.setAlignCABACBeforeBypass                            ( m_alignCABACBeforeBypass );
     963  m_cTEncTop.setTransformSkipLog2MaxSize                          ( m_transformSkipLog2MaxSize  );
     964  for (UInt signallingModeIndex = 0; signallingModeIndex < NUMBER_OF_RDPCM_SIGNALLING_MODES; signallingModeIndex++)
     965  {
     966    m_cTEncTop.setUseResidualDPCM                                 ( RDPCMSignallingMode(signallingModeIndex), m_useResidualDPCM[signallingModeIndex]);
     967  }
     968  m_cTEncTop.setUseConstrainedIntraPred                           ( m_bUseConstrainedIntraPred );
     969  m_cTEncTop.setPCMLog2MinSize                                    ( m_uiPCMLog2MinSize);
     970  m_cTEncTop.setUsePCM                                            ( m_usePCM );
     971  m_cTEncTop.setPCMLog2MaxSize                                    ( m_pcmLog2MaxSize);
     972  m_cTEncTop.setMaxNumMergeCand                                   ( m_maxNumMergeCand );
    920973
    921974
    922975  //====== Weighted Prediction ========
    923   m_cTEncTop.setUseWP                   ( m_useWeightedPred      );
    924   m_cTEncTop.setWPBiPred                ( m_useWeightedBiPred   );
     976  m_cTEncTop.setUseWP                                             ( m_useWeightedPred      );
     977  m_cTEncTop.setWPBiPred                                          ( m_useWeightedBiPred   );
    925978  //====== Parallel Merge Estimation ========
    926   m_cTEncTop.setLog2ParallelMergeLevelMinus2 ( m_log2ParallelMergeLevel - 2 );
     979  m_cTEncTop.setLog2ParallelMergeLevelMinus2                      ( m_log2ParallelMergeLevel - 2 );
    927980
    928981  //====== Slice ========
    929   m_cTEncTop.setSliceMode               ( m_sliceMode                );
    930   m_cTEncTop.setSliceArgument           ( m_sliceArgument            );
     982  m_cTEncTop.setSliceMode                                         ( (SliceConstraint) m_sliceMode );
     983  m_cTEncTop.setSliceArgument                                     ( m_sliceArgument            );
    931984
    932985  //====== Dependent Slice ========
    933   m_cTEncTop.setSliceSegmentMode        ( m_sliceSegmentMode         );
    934   m_cTEncTop.setSliceSegmentArgument    ( m_sliceSegmentArgument     );
    935   Int iNumPartInCU = 1<<(m_uiMaxCUDepth<<1);
    936   if(m_sliceSegmentMode==FIXED_NUMBER_OF_LCU)
    937   {
    938     m_cTEncTop.setSliceSegmentArgument ( m_sliceSegmentArgument * iNumPartInCU );
    939   }
    940   if(m_sliceMode==FIXED_NUMBER_OF_LCU)
    941   {
    942     m_cTEncTop.setSliceArgument ( m_sliceArgument * iNumPartInCU );
    943   }
    944   if(m_sliceMode==FIXED_NUMBER_OF_TILES)
    945   {
    946     m_cTEncTop.setSliceArgument ( m_sliceArgument );
    947   }
    948 
    949   if(m_sliceMode == 0 )
     986  m_cTEncTop.setSliceSegmentMode                                  (  (SliceConstraint) m_sliceSegmentMode );
     987  m_cTEncTop.setSliceSegmentArgument                              ( m_sliceSegmentArgument     );
     988
     989  if(m_sliceMode == NO_SLICES )
    950990  {
    951991    m_bLFCrossSliceBoundaryFlag = true;
    952992  }
    953   m_cTEncTop.setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag );
    954   m_cTEncTop.setUseSAO ( m_bUseSAO );
    955   m_cTEncTop.setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic);
    956 
    957   m_cTEncTop.setSaoLcuBoundary (m_saoLcuBoundary);
    958   m_cTEncTop.setPCMInputBitDepthFlag  ( m_bPCMInputBitDepthFlag);
    959   m_cTEncTop.setPCMFilterDisableFlag  ( m_bPCMFilterDisableFlag);
    960 
    961   m_cTEncTop.setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled);
    962   m_cTEncTop.setRecoveryPointSEIEnabled( m_recoveryPointSEIEnabled );
    963   m_cTEncTop.setBufferingPeriodSEIEnabled( m_bufferingPeriodSEIEnabled );
    964   m_cTEncTop.setPictureTimingSEIEnabled( m_pictureTimingSEIEnabled );
    965   m_cTEncTop.setToneMappingInfoSEIEnabled                 ( m_toneMappingInfoSEIEnabled );
    966   m_cTEncTop.setTMISEIToneMapId                           ( m_toneMapId );
    967   m_cTEncTop.setTMISEIToneMapCancelFlag                   ( m_toneMapCancelFlag );
    968   m_cTEncTop.setTMISEIToneMapPersistenceFlag              ( m_toneMapPersistenceFlag );
    969   m_cTEncTop.setTMISEICodedDataBitDepth                   ( m_toneMapCodedDataBitDepth );
    970   m_cTEncTop.setTMISEITargetBitDepth                      ( m_toneMapTargetBitDepth );
    971   m_cTEncTop.setTMISEIModelID                             ( m_toneMapModelId );
    972   m_cTEncTop.setTMISEIMinValue                            ( m_toneMapMinValue );
    973   m_cTEncTop.setTMISEIMaxValue                            ( m_toneMapMaxValue );
    974   m_cTEncTop.setTMISEISigmoidMidpoint                     ( m_sigmoidMidpoint );
    975   m_cTEncTop.setTMISEISigmoidWidth                        ( m_sigmoidWidth );
    976   m_cTEncTop.setTMISEIStartOfCodedInterva                 ( m_startOfCodedInterval );
    977   m_cTEncTop.setTMISEINumPivots                           ( m_numPivots );
    978   m_cTEncTop.setTMISEICodedPivotValue                     ( m_codedPivotValue );
    979   m_cTEncTop.setTMISEITargetPivotValue                    ( m_targetPivotValue );
    980   m_cTEncTop.setTMISEICameraIsoSpeedIdc                   ( m_cameraIsoSpeedIdc );
    981   m_cTEncTop.setTMISEICameraIsoSpeedValue                 ( m_cameraIsoSpeedValue );
    982   m_cTEncTop.setTMISEIExposureIndexIdc                    ( m_exposureIndexIdc );
    983   m_cTEncTop.setTMISEIExposureIndexValue                  ( m_exposureIndexValue );
    984   m_cTEncTop.setTMISEIExposureCompensationValueSignFlag   ( m_exposureCompensationValueSignFlag );
    985   m_cTEncTop.setTMISEIExposureCompensationValueNumerator  ( m_exposureCompensationValueNumerator );
    986   m_cTEncTop.setTMISEIExposureCompensationValueDenomIdc   ( m_exposureCompensationValueDenomIdc );
    987   m_cTEncTop.setTMISEIRefScreenLuminanceWhite             ( m_refScreenLuminanceWhite );
    988   m_cTEncTop.setTMISEIExtendedRangeWhiteLevel             ( m_extendedRangeWhiteLevel );
    989   m_cTEncTop.setTMISEINominalBlackLevelLumaCodeValue      ( m_nominalBlackLevelLumaCodeValue );
    990   m_cTEncTop.setTMISEINominalWhiteLevelLumaCodeValue      ( m_nominalWhiteLevelLumaCodeValue );
    991   m_cTEncTop.setTMISEIExtendedWhiteLevelLumaCodeValue     ( m_extendedWhiteLevelLumaCodeValue );
    992 #if P0050_KNEE_FUNCTION_SEI
    993   m_cTEncTop.setKneeSEIEnabled              ( m_kneeSEIEnabled );
    994   m_cTEncTop.setKneeSEIId                   ( m_kneeSEIId );
    995   m_cTEncTop.setKneeSEICancelFlag           ( m_kneeSEICancelFlag );
    996   m_cTEncTop.setKneeSEIPersistenceFlag      ( m_kneeSEIPersistenceFlag );
    997   m_cTEncTop.setKneeSEIMappingFlag          ( m_kneeSEIMappingFlag );
    998   m_cTEncTop.setKneeSEIInputDrange          ( m_kneeSEIInputDrange );
    999   m_cTEncTop.setKneeSEIInputDispLuminance   ( m_kneeSEIInputDispLuminance );
    1000   m_cTEncTop.setKneeSEIOutputDrange         ( m_kneeSEIOutputDrange );
    1001   m_cTEncTop.setKneeSEIOutputDispLuminance  ( m_kneeSEIOutputDispLuminance );
    1002   m_cTEncTop.setKneeSEINumKneePointsMinus1  ( m_kneeSEINumKneePointsMinus1 );
    1003   m_cTEncTop.setKneeSEIInputKneePoint       ( m_kneeSEIInputKneePoint );
    1004   m_cTEncTop.setKneeSEIOutputKneePoint      ( m_kneeSEIOutputKneePoint );
    1005 #endif
     993  m_cTEncTop.setLFCrossSliceBoundaryFlag                          ( m_bLFCrossSliceBoundaryFlag );
     994  m_cTEncTop.setUseSAO                                            ( m_bUseSAO );
     995  m_cTEncTop.setMaxNumOffsetsPerPic                               ( m_maxNumOffsetsPerPic);
     996
     997  m_cTEncTop.setSaoCtuBoundary                                    ( m_saoCtuBoundary);
     998  m_cTEncTop.setPCMInputBitDepthFlag                              ( m_bPCMInputBitDepthFlag);
     999  m_cTEncTop.setPCMFilterDisableFlag                              ( m_bPCMFilterDisableFlag);
     1000
     1001  m_cTEncTop.setDisableIntraReferenceSmoothing                    (!m_enableIntraReferenceSmoothing );
     1002  m_cTEncTop.setDecodedPictureHashSEIEnabled                      ( m_decodedPictureHashSEIEnabled );
     1003  m_cTEncTop.setRecoveryPointSEIEnabled                           ( m_recoveryPointSEIEnabled );
     1004  m_cTEncTop.setBufferingPeriodSEIEnabled                         ( m_bufferingPeriodSEIEnabled );
     1005  m_cTEncTop.setPictureTimingSEIEnabled                           ( m_pictureTimingSEIEnabled );
     1006  m_cTEncTop.setToneMappingInfoSEIEnabled                         ( m_toneMappingInfoSEIEnabled );
     1007  m_cTEncTop.setTMISEIToneMapId                                   ( m_toneMapId );
     1008  m_cTEncTop.setTMISEIToneMapCancelFlag                           ( m_toneMapCancelFlag );
     1009  m_cTEncTop.setTMISEIToneMapPersistenceFlag                      ( m_toneMapPersistenceFlag );
     1010  m_cTEncTop.setTMISEICodedDataBitDepth                           ( m_toneMapCodedDataBitDepth );
     1011  m_cTEncTop.setTMISEITargetBitDepth                              ( m_toneMapTargetBitDepth );
     1012  m_cTEncTop.setTMISEIModelID                                     ( m_toneMapModelId );
     1013  m_cTEncTop.setTMISEIMinValue                                    ( m_toneMapMinValue );
     1014  m_cTEncTop.setTMISEIMaxValue                                    ( m_toneMapMaxValue );
     1015  m_cTEncTop.setTMISEISigmoidMidpoint                             ( m_sigmoidMidpoint );
     1016  m_cTEncTop.setTMISEISigmoidWidth                                ( m_sigmoidWidth );
     1017  m_cTEncTop.setTMISEIStartOfCodedInterva                         ( m_startOfCodedInterval );
     1018  m_cTEncTop.setTMISEINumPivots                                   ( m_numPivots );
     1019  m_cTEncTop.setTMISEICodedPivotValue                             ( m_codedPivotValue );
     1020  m_cTEncTop.setTMISEITargetPivotValue                            ( m_targetPivotValue );
     1021  m_cTEncTop.setTMISEICameraIsoSpeedIdc                           ( m_cameraIsoSpeedIdc );
     1022  m_cTEncTop.setTMISEICameraIsoSpeedValue                         ( m_cameraIsoSpeedValue );
     1023  m_cTEncTop.setTMISEIExposureIndexIdc                            ( m_exposureIndexIdc );
     1024  m_cTEncTop.setTMISEIExposureIndexValue                          ( m_exposureIndexValue );
     1025  m_cTEncTop.setTMISEIExposureCompensationValueSignFlag           ( m_exposureCompensationValueSignFlag );
     1026  m_cTEncTop.setTMISEIExposureCompensationValueNumerator          ( m_exposureCompensationValueNumerator );
     1027  m_cTEncTop.setTMISEIExposureCompensationValueDenomIdc           ( m_exposureCompensationValueDenomIdc );
     1028  m_cTEncTop.setTMISEIRefScreenLuminanceWhite                     ( m_refScreenLuminanceWhite );
     1029  m_cTEncTop.setTMISEIExtendedRangeWhiteLevel                     ( m_extendedRangeWhiteLevel );
     1030  m_cTEncTop.setTMISEINominalBlackLevelLumaCodeValue              ( m_nominalBlackLevelLumaCodeValue );
     1031  m_cTEncTop.setTMISEINominalWhiteLevelLumaCodeValue              ( m_nominalWhiteLevelLumaCodeValue );
     1032  m_cTEncTop.setTMISEIExtendedWhiteLevelLumaCodeValue             ( m_extendedWhiteLevelLumaCodeValue );
     1033  m_cTEncTop.setChromaSamplingFilterHintEnabled                   ( m_chromaSamplingFilterSEIenabled );
     1034  m_cTEncTop.setChromaSamplingHorFilterIdc                        ( m_chromaSamplingHorFilterIdc );
     1035  m_cTEncTop.setChromaSamplingVerFilterIdc                        ( m_chromaSamplingVerFilterIdc );
     1036  m_cTEncTop.setFramePackingArrangementSEIEnabled                 ( m_framePackingSEIEnabled );
     1037  m_cTEncTop.setFramePackingArrangementSEIType                    ( m_framePackingSEIType );
     1038  m_cTEncTop.setFramePackingArrangementSEIId                      ( m_framePackingSEIId );
     1039  m_cTEncTop.setFramePackingArrangementSEIQuincunx                ( m_framePackingSEIQuincunx );
     1040  m_cTEncTop.setFramePackingArrangementSEIInterpretation          ( m_framePackingSEIInterpretation );
     1041  m_cTEncTop.setSegmentedRectFramePackingArrangementSEIEnabled    ( m_segmentedRectFramePackingSEIEnabled );
     1042  m_cTEncTop.setSegmentedRectFramePackingArrangementSEICancel     ( m_segmentedRectFramePackingSEICancel );
     1043  m_cTEncTop.setSegmentedRectFramePackingArrangementSEIType       ( m_segmentedRectFramePackingSEIType );
     1044  m_cTEncTop.setSegmentedRectFramePackingArrangementSEIPersistence( m_segmentedRectFramePackingSEIPersistence );
     1045  m_cTEncTop.setDisplayOrientationSEIAngle                        ( m_displayOrientationSEIAngle );
     1046  m_cTEncTop.setTemporalLevel0IndexSEIEnabled                     ( m_temporalLevel0IndexSEIEnabled );
     1047  m_cTEncTop.setGradualDecodingRefreshInfoEnabled                 ( m_gradualDecodingRefreshInfoEnabled );
     1048  m_cTEncTop.setNoDisplaySEITLayer                                ( m_noDisplaySEITLayer );
     1049  m_cTEncTop.setDecodingUnitInfoSEIEnabled                        ( m_decodingUnitInfoSEIEnabled );
     1050  m_cTEncTop.setSOPDescriptionSEIEnabled                          ( m_SOPDescriptionSEIEnabled );
     1051  m_cTEncTop.setScalableNestingSEIEnabled                         ( m_scalableNestingSEIEnabled );
     1052  m_cTEncTop.setTMCTSSEIEnabled                                   ( m_tmctsSEIEnabled );
     1053  m_cTEncTop.setTimeCodeSEIEnabled                                ( m_timeCodeSEIEnabled );
     1054  m_cTEncTop.setNumberOfTimeSets                                  ( m_timeCodeSEINumTs );
     1055  for(Int i = 0; i < m_timeCodeSEINumTs; i++) { m_cTEncTop.setTimeSet(m_timeSetArray[i], i); }
     1056  m_cTEncTop.setKneeSEIEnabled                                    ( m_kneeSEIEnabled );
     1057  m_cTEncTop.setKneeSEIId                                         ( m_kneeSEIId );
     1058  m_cTEncTop.setKneeSEICancelFlag                                 ( m_kneeSEICancelFlag );
     1059  m_cTEncTop.setKneeSEIPersistenceFlag                            ( m_kneeSEIPersistenceFlag );
     1060  m_cTEncTop.setKneeSEIInputDrange                                ( m_kneeSEIInputDrange );
     1061  m_cTEncTop.setKneeSEIInputDispLuminance                         ( m_kneeSEIInputDispLuminance );
     1062  m_cTEncTop.setKneeSEIOutputDrange                               ( m_kneeSEIOutputDrange );
     1063  m_cTEncTop.setKneeSEIOutputDispLuminance                        ( m_kneeSEIOutputDispLuminance );
     1064  m_cTEncTop.setKneeSEINumKneePointsMinus1                        ( m_kneeSEINumKneePointsMinus1 );
     1065  m_cTEncTop.setKneeSEIInputKneePoint                             ( m_kneeSEIInputKneePoint );
     1066  m_cTEncTop.setKneeSEIOutputKneePoint                            ( m_kneeSEIOutputKneePoint );
     1067  m_cTEncTop.setMasteringDisplaySEI                               ( m_masteringDisplay );
    10061068#if Q0074_COLOUR_REMAPPING_SEI
    1007   m_cTEncTop.setCRISEIFile                       ( const_cast<Char*>(m_colourRemapSEIFile.c_str()) );
     1069  m_cTEncTop.setCRISEIFile                       ( m_colourRemapSEIFile );
    10081070  m_cTEncTop.setCRISEIId                         ( m_colourRemapSEIId );
    10091071  m_cTEncTop.setCRISEICancelFlag                 ( m_colourRemapSEICancelFlag );
     
    10261088  m_cTEncTop.setCRISEIPostLutTargetValue         ( m_colourRemapSEIPostLutTargetValue );
    10271089#endif
    1028   m_cTEncTop.setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled );
    1029   m_cTEncTop.setFramePackingArrangementSEIType( m_framePackingSEIType );
    1030   m_cTEncTop.setFramePackingArrangementSEIId( m_framePackingSEIId );
    1031   m_cTEncTop.setFramePackingArrangementSEIQuincunx( m_framePackingSEIQuincunx );
    1032   m_cTEncTop.setFramePackingArrangementSEIInterpretation( m_framePackingSEIInterpretation );
    1033   m_cTEncTop.setDisplayOrientationSEIAngle( m_displayOrientationSEIAngle );
    1034   m_cTEncTop.setTemporalLevel0IndexSEIEnabled( m_temporalLevel0IndexSEIEnabled );
    1035   m_cTEncTop.setGradualDecodingRefreshInfoEnabled( m_gradualDecodingRefreshInfoEnabled );
    1036   m_cTEncTop.setDecodingUnitInfoSEIEnabled( m_decodingUnitInfoSEIEnabled );
    10371090#if LAYERS_NOT_PRESENT_SEI
    10381091  m_cTEncTop.setLayersNotPresentSEIEnabled( m_layersNotPresentSEIEnabled );
    10391092#endif
    1040   m_cTEncTop.setSOPDescriptionSEIEnabled( m_SOPDescriptionSEIEnabled );
    1041   m_cTEncTop.setScalableNestingSEIEnabled( m_scalableNestingSEIEnabled );
    1042   m_cTEncTop.setTileUniformSpacingFlag     ( m_tileUniformSpacingFlag );
    1043   m_cTEncTop.setNumColumnsMinus1           ( m_numTileColumnsMinus1 );
    1044   m_cTEncTop.setNumRowsMinus1              ( m_numTileRowsMinus1 );
     1093  m_cTEncTop.setTileUniformSpacingFlag                            ( m_tileUniformSpacingFlag );
     1094  m_cTEncTop.setNumColumnsMinus1                                  ( m_numTileColumnsMinus1 );
     1095  m_cTEncTop.setNumRowsMinus1                                     ( m_numTileRowsMinus1 );
    10451096  if(!m_tileUniformSpacingFlag)
    10461097  {
    1047     m_cTEncTop.setColumnWidth              ( m_tileColumnWidth );
    1048     m_cTEncTop.setRowHeight                ( m_tileRowHeight );
     1098    m_cTEncTop.setColumnWidth                                     ( m_tileColumnWidth );
     1099    m_cTEncTop.setRowHeight                                       ( m_tileRowHeight );
    10491100  }
    10501101  m_cTEncTop.xCheckGSParameters();
    1051   Int uiTilesCount          = (m_numTileRowsMinus1+1) * (m_numTileColumnsMinus1+1);
     1102  Int uiTilesCount = (m_numTileRowsMinus1+1) * (m_numTileColumnsMinus1+1);
    10521103  if(uiTilesCount == 1)
    10531104  {
    10541105    m_bLFCrossTileBoundaryFlag = true;
    10551106  }
    1056   m_cTEncTop.setLFCrossTileBoundaryFlag( m_bLFCrossTileBoundaryFlag );
    1057   m_cTEncTop.setWaveFrontSynchro           ( m_iWaveFrontSynchro );
    1058   m_cTEncTop.setWaveFrontSubstreams        ( m_iWaveFrontSubstreams );
    1059   m_cTEncTop.setTMVPModeId ( m_TMVPModeId );
    1060   m_cTEncTop.setUseScalingListId           ( m_useScalingListId  );
    1061   m_cTEncTop.setScalingListFile            ( m_scalingListFile   );
    1062   m_cTEncTop.setSignHideFlag(m_signHideFlag);
    1063   m_cTEncTop.setUseRateCtrl         ( m_RCEnableRateControl );
    1064   m_cTEncTop.setTargetBitrate       ( m_RCTargetBitrate );
    1065   m_cTEncTop.setKeepHierBit         ( m_RCKeepHierarchicalBit );
    1066   m_cTEncTop.setLCULevelRC          ( m_RCLCULevelRC );
    1067   m_cTEncTop.setUseLCUSeparateModel ( m_RCUseLCUSeparateModel );
    1068   m_cTEncTop.setInitialQP           ( m_RCInitialQP );
    1069   m_cTEncTop.setForceIntraQP        ( m_RCForceIntraQP );
    1070   m_cTEncTop.setTransquantBypassEnableFlag(m_TransquantBypassEnableFlag);
    1071   m_cTEncTop.setCUTransquantBypassFlagForceValue(m_CUTransquantBypassFlagForce);
    1072   m_cTEncTop.setUseRecalculateQPAccordingToLambda( m_recalculateQPAccordingToLambda );
    1073   m_cTEncTop.setUseStrongIntraSmoothing( m_useStrongIntraSmoothing );
    1074   m_cTEncTop.setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled );
    1075   m_cTEncTop.setVuiParametersPresentFlag( m_vuiParametersPresentFlag );
    1076   m_cTEncTop.setAspectRatioInfoPresentFlag( m_aspectRatioInfoPresentFlag);
    1077   m_cTEncTop.setAspectRatioIdc( m_aspectRatioIdc );
    1078   m_cTEncTop.setSarWidth( m_sarWidth );
    1079   m_cTEncTop.setSarHeight( m_sarHeight );
    1080   m_cTEncTop.setOverscanInfoPresentFlag( m_overscanInfoPresentFlag );
    1081   m_cTEncTop.setOverscanAppropriateFlag( m_overscanAppropriateFlag );
    1082   m_cTEncTop.setVideoSignalTypePresentFlag( m_videoSignalTypePresentFlag );
    1083   m_cTEncTop.setVideoFormat( m_videoFormat );
    1084   m_cTEncTop.setVideoFullRangeFlag( m_videoFullRangeFlag );
    1085   m_cTEncTop.setColourDescriptionPresentFlag( m_colourDescriptionPresentFlag );
    1086   m_cTEncTop.setColourPrimaries( m_colourPrimaries );
    1087   m_cTEncTop.setTransferCharacteristics( m_transferCharacteristics );
    1088   m_cTEncTop.setMatrixCoefficients( m_matrixCoefficients );
    1089   m_cTEncTop.setChromaLocInfoPresentFlag( m_chromaLocInfoPresentFlag );
    1090   m_cTEncTop.setChromaSampleLocTypeTopField( m_chromaSampleLocTypeTopField );
    1091   m_cTEncTop.setChromaSampleLocTypeBottomField( m_chromaSampleLocTypeBottomField );
    1092   m_cTEncTop.setNeutralChromaIndicationFlag( m_neutralChromaIndicationFlag );
    1093   m_cTEncTop.setDefaultDisplayWindow( m_defDispWinLeftOffset, m_defDispWinRightOffset, m_defDispWinTopOffset, m_defDispWinBottomOffset );
    1094   m_cTEncTop.setFrameFieldInfoPresentFlag( m_frameFieldInfoPresentFlag );
    1095   m_cTEncTop.setPocProportionalToTimingFlag( m_pocProportionalToTimingFlag );
    1096   m_cTEncTop.setNumTicksPocDiffOneMinus1   ( m_numTicksPocDiffOneMinus1    );
    1097   m_cTEncTop.setBitstreamRestrictionFlag( m_bitstreamRestrictionFlag );
    1098   m_cTEncTop.setTilesFixedStructureFlag( m_tilesFixedStructureFlag );
    1099   m_cTEncTop.setMotionVectorsOverPicBoundariesFlag( m_motionVectorsOverPicBoundariesFlag );
    1100   m_cTEncTop.setMinSpatialSegmentationIdc( m_minSpatialSegmentationIdc );
    1101   m_cTEncTop.setMaxBytesPerPicDenom( m_maxBytesPerPicDenom );
    1102   m_cTEncTop.setMaxBitsPerMinCuDenom( m_maxBitsPerMinCuDenom );
    1103   m_cTEncTop.setLog2MaxMvLengthHorizontal( m_log2MaxMvLengthHorizontal );
    1104   m_cTEncTop.setLog2MaxMvLengthVertical( m_log2MaxMvLengthVertical );
     1107  m_cTEncTop.setLFCrossTileBoundaryFlag                           ( m_bLFCrossTileBoundaryFlag );
     1108  m_cTEncTop.setWaveFrontSynchro                                  ( m_iWaveFrontSynchro );
     1109  m_cTEncTop.setWaveFrontSubstreams                               ( m_iWaveFrontSubstreams );
     1110  m_cTEncTop.setTMVPModeId                                        ( m_TMVPModeId );
     1111  m_cTEncTop.setUseScalingListId                                  ( m_useScalingListId  );
     1112  m_cTEncTop.setScalingListFile                                   ( m_scalingListFile   );
     1113  m_cTEncTop.setSignHideFlag                                      ( m_signHideFlag);
     1114  m_cTEncTop.setUseRateCtrl                                       ( m_RCEnableRateControl );
     1115  m_cTEncTop.setTargetBitrate                                     ( m_RCTargetBitrate );
     1116  m_cTEncTop.setKeepHierBit                                       ( m_RCKeepHierarchicalBit );
     1117  m_cTEncTop.setLCULevelRC                                        ( m_RCLCULevelRC );
     1118  m_cTEncTop.setUseLCUSeparateModel                               ( m_RCUseLCUSeparateModel );
     1119  m_cTEncTop.setInitialQP                                         ( m_RCInitialQP );
     1120  m_cTEncTop.setForceIntraQP                                      ( m_RCForceIntraQP );
     1121  m_cTEncTop.setTransquantBypassEnableFlag                        ( m_TransquantBypassEnableFlag );
     1122  m_cTEncTop.setCUTransquantBypassFlagForceValue                  ( m_CUTransquantBypassFlagForce );
     1123  m_cTEncTop.setCostMode                                          ( m_costMode );
     1124  m_cTEncTop.setUseRecalculateQPAccordingToLambda                 ( m_recalculateQPAccordingToLambda );
     1125  m_cTEncTop.setUseStrongIntraSmoothing                           ( m_useStrongIntraSmoothing );
     1126  m_cTEncTop.setActiveParameterSetsSEIEnabled                     ( m_activeParameterSetsSEIEnabled );
     1127  m_cTEncTop.setVuiParametersPresentFlag                          ( m_vuiParametersPresentFlag );
     1128  m_cTEncTop.setAspectRatioInfoPresentFlag                        ( m_aspectRatioInfoPresentFlag);
     1129  m_cTEncTop.setAspectRatioIdc                                    ( m_aspectRatioIdc );
     1130  m_cTEncTop.setSarWidth                                          ( m_sarWidth );
     1131  m_cTEncTop.setSarHeight                                         ( m_sarHeight );
     1132  m_cTEncTop.setOverscanInfoPresentFlag                           ( m_overscanInfoPresentFlag );
     1133  m_cTEncTop.setOverscanAppropriateFlag                           ( m_overscanAppropriateFlag );
     1134  m_cTEncTop.setVideoSignalTypePresentFlag                        ( m_videoSignalTypePresentFlag );
     1135  m_cTEncTop.setVideoFormat                                       ( m_videoFormat );
     1136  m_cTEncTop.setVideoFullRangeFlag                                ( m_videoFullRangeFlag );
     1137  m_cTEncTop.setColourDescriptionPresentFlag                      ( m_colourDescriptionPresentFlag );
     1138  m_cTEncTop.setColourPrimaries                                   ( m_colourPrimaries );
     1139  m_cTEncTop.setTransferCharacteristics                           ( m_transferCharacteristics );
     1140  m_cTEncTop.setMatrixCoefficients                                ( m_matrixCoefficients );
     1141  m_cTEncTop.setChromaLocInfoPresentFlag                          ( m_chromaLocInfoPresentFlag );
     1142  m_cTEncTop.setChromaSampleLocTypeTopField                       ( m_chromaSampleLocTypeTopField );
     1143  m_cTEncTop.setChromaSampleLocTypeBottomField                    ( m_chromaSampleLocTypeBottomField );
     1144  m_cTEncTop.setNeutralChromaIndicationFlag                       ( m_neutralChromaIndicationFlag );
     1145  m_cTEncTop.setDefaultDisplayWindow                              ( m_defDispWinLeftOffset, m_defDispWinRightOffset, m_defDispWinTopOffset, m_defDispWinBottomOffset );
     1146  m_cTEncTop.setFrameFieldInfoPresentFlag                         ( m_frameFieldInfoPresentFlag );
     1147  m_cTEncTop.setPocProportionalToTimingFlag                       ( m_pocProportionalToTimingFlag );
     1148  m_cTEncTop.setNumTicksPocDiffOneMinus1                          ( m_numTicksPocDiffOneMinus1    );
     1149  m_cTEncTop.setBitstreamRestrictionFlag                          ( m_bitstreamRestrictionFlag );
     1150  m_cTEncTop.setTilesFixedStructureFlag                           ( m_tilesFixedStructureFlag );
     1151  m_cTEncTop.setMotionVectorsOverPicBoundariesFlag                ( m_motionVectorsOverPicBoundariesFlag );
     1152  m_cTEncTop.setMinSpatialSegmentationIdc                         ( m_minSpatialSegmentationIdc );
     1153  m_cTEncTop.setMaxBytesPerPicDenom                               ( m_maxBytesPerPicDenom );
     1154  m_cTEncTop.setMaxBitsPerMinCuDenom                              ( m_maxBitsPerMinCuDenom );
     1155  m_cTEncTop.setLog2MaxMvLengthHorizontal                         ( m_log2MaxMvLengthHorizontal );
     1156  m_cTEncTop.setLog2MaxMvLengthVertical                           ( m_log2MaxMvLengthVertical );
    11051157}
    11061158#endif //SVC_EXTENSION
     
    11171169#if O0194_DIFFERENT_BITDEPTH_EL_BL
    11181170    //2
    1119     g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
    1120     g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
    1121 
    1122     g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
    1123     g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     1171    for( UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)
     1172    {
     1173      g_bitDepth[channelTypeIndex]    = m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
     1174      g_PCMBitDepth[channelTypeIndex] = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepth[channelTypeIndex] : m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
     1175    }
    11241176#endif
    11251177#if LAYER_CTB
     
    11291181    g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
    11301182#endif
     1183    // Video I/O
    11311184#if O0194_DIFFERENT_BITDEPTH_EL_BL
    1132     m_acTVideoIOYuvInputFile[layer].open( (Char *)m_acLayerCfg[layer].getInputFile().c_str(),  false, m_acLayerCfg[layer].m_inputBitDepthY, m_acLayerCfg[layer].m_inputBitDepthC, m_acLayerCfg[layer].m_internalBitDepthY, m_acLayerCfg[layer].m_internalBitDepthC );  // read  mode
    1133 #else
    1134     m_acTVideoIOYuvInputFile[layer].open( (Char *)m_acLayerCfg[layer].getInputFile().c_str(),  false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC );  // read  mode
    1135 #endif
    1136     m_acTVideoIOYuvInputFile[layer].skipFrames(m_FrameSkip, m_acLayerCfg[layer].getSourceWidth() - m_acLayerCfg[layer].getPad()[0], m_acLayerCfg[layer].getSourceHeight() - m_acLayerCfg[layer].getPad()[1]);
     1185    m_acTVideoIOYuvInputFile[layer].open( (Char *)m_acLayerCfg[layer].getInputFile().c_str(),  false, m_acLayerCfg[layer].m_inputBitDepth, m_acLayerCfg[layer].m_MSBExtendedBitDepth, m_acLayerCfg[layer].m_internalBitDepth );  // read  mode
     1186#else
     1187    m_acTVideoIOYuvInputFile[layer].open( (Char *)m_acLayerCfg[layer].getInputFile().c_str(),  false, m_inputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth );  // read  mode
     1188#endif
     1189    m_acTVideoIOYuvInputFile[layer].skipFrames(m_FrameSkip, m_acLayerCfg[layer].getSourceWidth() - m_acLayerCfg[layer].getPad()[0], m_acLayerCfg[layer].getSourceHeight() - m_acLayerCfg[layer].getPad()[1], m_acLayerCfg[layer].m_InputChromaFormatIDC);
    11371190
    11381191    if (!m_acLayerCfg[layer].getReconFile().empty())
    11391192    {
    11401193#if O0194_DIFFERENT_BITDEPTH_EL_BL
    1141       m_acTVideoIOYuvReconFile[layer].open((Char *)m_acLayerCfg[layer].getReconFile().c_str(), true, m_acLayerCfg[layer].m_outputBitDepthY, m_acLayerCfg[layer].m_outputBitDepthC, m_acLayerCfg[layer].m_internalBitDepthY, m_acLayerCfg[layer].m_internalBitDepthC );  // write mode
    1142 #else
    1143       m_acTVideoIOYuvReconFile[layer].open((Char *)m_acLayerCfg[layer].getReconFile().c_str(), true, m_outputBitDepthY, m_outputBitDepthC, m_internalBitDepthY, m_internalBitDepthC );  // write mode
    1144 #endif
    1145     }
    1146 
     1194      m_acTVideoIOYuvReconFile[layer].open((Char *)m_acLayerCfg[layer].getReconFile().c_str(), true, m_acLayerCfg[layer].m_outputBitDepth, m_acLayerCfg[layer].m_MSBExtendedBitDepth, m_acLayerCfg[layer].m_internalBitDepth );  // write mode
     1195#else
     1196      m_acTVideoIOYuvReconFile[layer].open((Char *)m_acLayerCfg[layer].getReconFile().c_str(), true, m_outputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth );  // write mode
     1197#endif
     1198    }
     1199
     1200    // Neo Decoder
    11471201    m_acTEncTop[layer].create();
    11481202  }
    11491203#else //SVC_EXTENSION
    1150   m_cTVideoIOYuvInputFile.open( m_pchInputFile,     false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC );  // read  mode
    1151   m_cTVideoIOYuvInputFile.skipFrames(m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1]);
     1204  // Video I/O
     1205  m_cTVideoIOYuvInputFile.open( m_pchInputFile,     false, m_inputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth );  // read  mode
     1206  m_cTVideoIOYuvInputFile.skipFrames(m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1], m_InputChromaFormatIDC);
    11521207
    11531208  if (m_pchReconFile)
    1154     m_cTVideoIOYuvReconFile.open(m_pchReconFile, true, m_outputBitDepthY, m_outputBitDepthC, m_internalBitDepthY, m_internalBitDepthC);  // write mode
     1209  {
     1210    m_cTVideoIOYuvReconFile.open(m_pchReconFile, true, m_outputBitDepth, m_outputBitDepth, m_internalBitDepth);  // write mode
     1211  }
    11551212
    11561213  // Neo Decoder
     
    12161273#if O0194_DIFFERENT_BITDEPTH_EL_BL
    12171274    //3
    1218     g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
    1219     g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
    1220 
    1221     g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
    1222     g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     1275    for (UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)
     1276    {
     1277      g_bitDepth[channelTypeIndex]    = m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
     1278      g_PCMBitDepth[channelTypeIndex] = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepth[channelTypeIndex] : m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
     1279    }
    12231280#endif
    12241281#if LAYER_CTB
     
    12581315      }
    12591316    }
    1260     for( Int setId = 1; setId < vps->getNumLayerSets(); setId++ )
     1317    for (Int setId = 1; setId < vps->getNumLayerSets(); setId++)
    12611318    {
    12621319#if OUTPUT_LAYER_SETS_CONFIG
     
    12711328#if O0194_DIFFERENT_BITDEPTH_EL_BL
    12721329        //4
    1273         g_bitDepthY = m_acLayerCfg[layerId].m_internalBitDepthY;
    1274         g_bitDepthC = m_acLayerCfg[layerId].m_internalBitDepthC;
    1275 
    1276         g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepthY : m_acLayerCfg[layerId].m_internalBitDepthY;
    1277         g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepthC : m_acLayerCfg[layerId].m_internalBitDepthC;
     1330        g_bitDepth[CHANNEL_TYPE_LUMA]   = m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_LUMA];
     1331        g_bitDepth[CHANNEL_TYPE_CHROMA] = m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_CHROMA];
     1332
     1333        g_PCMBitDepth[CHANNEL_TYPE_LUMA]   = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepth[CHANNEL_TYPE_LUMA]   : m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_LUMA];
     1334        g_PCMBitDepth[CHANNEL_TYPE_CHROMA] = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepth[CHANNEL_TYPE_CHROMA] : m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_CHROMA];
    12781335#endif
    12791336
     
    12931350#if O0194_DIFFERENT_BITDEPTH_EL_BL
    12941351        //4
    1295         g_bitDepthY = m_acLayerCfg[layerId].m_internalBitDepthY;
    1296         g_bitDepthC = m_acLayerCfg[layerId].m_internalBitDepthC;
    1297 
    1298         g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepthY : m_acLayerCfg[layerId].m_internalBitDepthY;
    1299         g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepthC : m_acLayerCfg[layerId].m_internalBitDepthC;
     1352        g_bitDepth[CHANNEL_TYPE_LUMA]   = m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_LUMA];
     1353        g_bitDepth[CHANNEL_TYPE_CHROMA] = m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_CHROMA];
     1354
     1355        g_PCMBitDepth[CHANNEL_TYPE_LUMA]   = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepth[CHANNEL_TYPE_LUMA]   : m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_LUMA];
     1356        g_PCMBitDepth[CHANNEL_TYPE_CHROMA] = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepth[CHANNEL_TYPE_CHROMA] : m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_CHROMA];
    13001357#endif
    13011358        if (layerId <= setId)
     
    16111668#endif
    16121669  vps->setOutputLayerFlag( 0, 0, 1 );
     1670
    16131671  // derive OutputLayerFlag[i][j]
    16141672#if !OUTPUT_LAYER_SETS_CONFIG
     
    20162074  Bool  bEos = false;
    20172075
     2076  const InputColourSpaceConversion ipCSC  =  m_inputColourSpaceConvert;
     2077  const InputColourSpaceConversion snrCSC = (!m_snrInternalColourSpace) ? m_inputColourSpaceConvert : IPCOLOURSPACE_UNCHANGED;
     2078
    20182079  list<AccessUnit> outputAccessUnits; ///< list of access units to write out.  is populated by the encoding process
     2080
     2081  TComPicYuv acPicYuvTrueOrg[MAX_LAYERS];
    20192082
    20202083  for(UInt layer=0; layer<m_numLayers; layer++)
     
    20222085#if O0194_DIFFERENT_BITDEPTH_EL_BL
    20232086    //5
    2024     g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
    2025     g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
    2026 
    2027     g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
    2028     g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     2087    g_bitDepth[CHANNEL_TYPE_LUMA]   = m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA];
     2088    g_bitDepth[CHANNEL_TYPE_CHROMA] = m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA];
     2089
     2090    g_PCMBitDepth[CHANNEL_TYPE_LUMA]   = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepth[CHANNEL_TYPE_LUMA] : m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA];
     2091    g_PCMBitDepth[CHANNEL_TYPE_CHROMA] = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepth[CHANNEL_TYPE_CHROMA] : m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA];
    20292092#endif
    20302093    // allocate original YUV buffer
     
    20322095    if( m_isField )
    20332096    {
    2034 #if SVC_EXTENSION
    20352097#if LAYER_CTB
    2036 #if AUXILIARY_PICTURES
    20372098      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_acLayerCfg[layer].getChromaFormatIDC(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
    2038 #else
    2039       pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
    2040 #endif
    2041 #else
    2042 #if AUXILIARY_PICTURES
     2099      acPicYuvTrueOrg[layer].create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_acLayerCfg[layer].getChromaFormatIDC(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
     2100#else
    20432101      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_acLayerCfg[layer].getChromaFormatIDC(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    2044 #else
    2045       pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    2046 #endif
    2047 #endif
    2048 #else
    2049       pcPicYuvOrg->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     2102      acPicYuvTrueOrg[layer].create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_acLayerCfg[layer].getChromaFormatIDC(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    20502103#endif
    20512104    }
    20522105    else
    20532106    {
    2054 #if SVC_EXTENSION
    20552107#if LAYER_CTB
    2056 #if AUXILIARY_PICTURES
    20572108      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
    2058 #else
    2059       pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
    2060 #endif
    2061 #else
    2062 #if AUXILIARY_PICTURES
     2109      acPicYuvTrueOrg[layer].create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
     2110#else
    20632111      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    2064 #else
    2065       pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    2066 #endif
    2067 #endif
    2068 #else
    2069       pcPicYuvOrg->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     2112      acPicYuvTrueOrg[layer].create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    20702113#endif
    20712114    }
     
    20832126#if O0194_DIFFERENT_BITDEPTH_EL_BL
    20842127        //6
    2085         g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
    2086         g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
    2087 
    2088         g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
    2089         g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     2128        for (UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)
     2129        {
     2130          g_bitDepth[channelTypeIndex]    = m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
     2131          g_PCMBitDepth[channelTypeIndex] = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepth[channelTypeIndex] : m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
     2132        }
    20902133#endif
    20912134#if LAYER_CTB
     
    21002143
    21012144        // read input YUV file
    2102         m_acTVideoIOYuvInputFile[layer].read( pcPicYuvOrg[layer], m_acLayerCfg[layer].getPad() );
     2145        m_acTVideoIOYuvInputFile[layer].read( pcPicYuvOrg[layer], &acPicYuvTrueOrg[layer], ipCSC, m_acLayerCfg[layer].getPad(), m_acLayerCfg[layer].getInputChromaFormat() );
    21032146
    21042147#if AUXILIARY_PICTURES
     
    21242167        if ( m_isField )
    21252168        {
    2126           m_acTEncTop[layer].encodePrep( pcPicYuvOrg[layer], m_isTopFieldFirst );
     2169          m_acTEncTop[layer].encodePrep( pcPicYuvOrg[layer], &acPicYuvTrueOrg[layer], m_isTopFieldFirst );
    21272170        }
    21282171        else
    21292172        {
    2130           m_acTEncTop[layer].encodePrep( pcPicYuvOrg[layer] );
     2173          m_acTEncTop[layer].encodePrep( pcPicYuvOrg[layer], &acPicYuvTrueOrg[layer] );
    21312174        }
    21322175      }
     
    21772220#if O0194_DIFFERENT_BITDEPTH_EL_BL
    21782221        //7
    2179         g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
    2180         g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
    2181 
    2182         g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
    2183         g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     2222        for (UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)
     2223        {
     2224          g_bitDepth[channelTypeIndex]    = m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
     2225          g_PCMBitDepth[channelTypeIndex] = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepth[channelTypeIndex] : m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
     2226        }
    21842227#endif
    21852228#if LAYER_CTB
     
    21952238#endif
    21962239        // call encoding function for one frame
    2197         if ( m_isField )
    2198         {
    2199           m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP, m_isTopFieldFirst );
    2200         }
    2201         else
    2202         {
    2203           m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP );
    2204         }
     2240        if ( m_isField ) m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], snrCSC, m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP, m_isTopFieldFirst );
     2241        else             m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], snrCSC, m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP );
    22052242      }
    22062243    }
     
    22092246    {
    22102247      list<AccessUnit>::iterator first_au = outputAccessUnits.begin();
     2248      if( m_nonHEVCBaseLayerFlag )
     2249      {
     2250        first_au++;
     2251      }
    22112252      AccessUnit::iterator it_sps;
    22122253      for (it_sps = first_au->begin(); it_sps != first_au->end(); it_sps++)
     
    22482289#if O0194_DIFFERENT_BITDEPTH_EL_BL
    22492290      //8
    2250       g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
    2251       g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
    2252 
    2253       g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
    2254       g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     2291      for (UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)
     2292      {
     2293        g_bitDepth[channelTypeIndex]    = m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
     2294        g_PCMBitDepth[channelTypeIndex] = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepth[channelTypeIndex] : m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
     2295      }
    22552296#endif
    22562297      // write bistream to file if necessary
     
    22892330    if (bEos)
    22902331    {
    2291       printOutSummary(m_isTopFieldFirst);
     2332      printOutSummary(m_isTopFieldFirst, m_printMSEBasedSequencePSNR, m_printSequenceMSE);
    22922333    }
    22932334
     
    23032344    // delete used buffers in encoder class
    23042345    m_acTEncTop[layer].deletePicBuffer();
     2346    acPicYuvTrueOrg[layer].destroy();
    23052347  }
    23062348
     
    23142356}
    23152357
    2316 Void TAppEncTop::printOutSummary(Bool isField)
     2358Void TAppEncTop::printOutSummary(Bool isField, const Bool printMSEBasedSNR, const Bool printSequenceMSE)
    23172359{
    23182360  UInt layer;
     
    23392381  //-- all
    23402382  printf( "\n\nSUMMARY --------------------------------------------------------\n" );
    2341   printf( "\tTotal Frames |  "   "Bitrate    "  "Y-PSNR    "  "U-PSNR    "  "V-PSNR \n" );
    23422383  for(layer = 0; layer < m_numLayers; layer++)
    23432384  {
    2344     m_gcAnalyzeAll[layer].printOut('a', layer);
     2385    m_gcAnalyzeAll[layer].printOut('a', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, layer);
    23452386  }
    23462387
    23472388  printf( "\n\nI Slices--------------------------------------------------------\n" );
    2348   printf( "\tTotal Frames |  "   "Bitrate    "  "Y-PSNR    "  "U-PSNR    "  "V-PSNR \n" );
    23492389  for(layer = 0; layer < m_numLayers; layer++)
    23502390  {
    2351     m_gcAnalyzeI[layer].printOut('i', layer);
     2391    m_gcAnalyzeI[layer].printOut('i', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, layer);
    23522392  }
    23532393
    23542394  printf( "\n\nP Slices--------------------------------------------------------\n" );
    2355   printf( "\tTotal Frames |  "   "Bitrate    "  "Y-PSNR    "  "U-PSNR    "  "V-PSNR \n" );
    23562395  for(layer = 0; layer < m_numLayers; layer++)
    23572396  {
    2358     m_gcAnalyzeP[layer].printOut('p', layer);
     2397    m_gcAnalyzeP[layer].printOut('p', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, layer);
    23592398  }
    23602399
    23612400  printf( "\n\nB Slices--------------------------------------------------------\n" );
    2362   printf( "\tTotal Frames |  "   "Bitrate    "  "Y-PSNR    "  "U-PSNR    "  "V-PSNR \n" );
    23632401  for(layer = 0; layer < m_numLayers; layer++)
    23642402  {
    2365     m_gcAnalyzeB[layer].printOut('b', layer);
     2403    m_gcAnalyzeB[layer].printOut('b', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, layer);
    23662404  }
    23672405
     
    23722410      //-- interlaced summary
    23732411      m_gcAnalyzeAll_in.setFrmRate( m_acLayerCfg[layer].getFrameRate());
     2412      m_gcAnalyzeAll_in.setBits(m_gcAnalyzeB[layer].getBits());
     2413      // prior to the above statement, the interlace analyser does not contain the correct total number of bits.
     2414
    23742415      printf( "\n\nSUMMARY INTERLACED ---------------------------------------------\n" );
    2375       m_gcAnalyzeAll_in.printOutInterlaced('a',  m_gcAnalyzeAll[layer].getBits());
     2416      m_gcAnalyzeAll_in.printOut('a', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, layer);
    23762417
    23772418#if _SUMMARY_OUT_
     
    23802421    }
    23812422  }
     2423
     2424  printf("\n");
     2425  //printf("\nRVM: %.3lf\n" , xCalculateRVM());
    23822426}
    23832427
    23842428#else
     2429// ====================================================================================================================
     2430// Public member functions
     2431// ====================================================================================================================
     2432
     2433/**
     2434 - create internal class
     2435 - initialize internal variable
     2436 - until the end of input YUV file, call encoding function in TEncTop class
     2437 - delete allocated buffers
     2438 - destroy internal class
     2439 .
     2440 */
    23852441Void TAppEncTop::encode()
    23862442{
     
    24002456  xInitLib(m_isField);
    24012457
     2458  printChromaFormat();
     2459
    24022460  // main encoder loop
    24032461  Int   iNumEncoded = 0;
    24042462  Bool  bEos = false;
    24052463
     2464  const InputColourSpaceConversion ipCSC  =  m_inputColourSpaceConvert;
     2465  const InputColourSpaceConversion snrCSC = (!m_snrInternalColourSpace) ? m_inputColourSpaceConvert : IPCOLOURSPACE_UNCHANGED;
     2466
    24062467  list<AccessUnit> outputAccessUnits; ///< list of access units to write out.  is populated by the encoding process
     2468
     2469  TComPicYuv cPicYuvTrueOrg;
    24072470
    24082471  // allocate original YUV buffer
    24092472  if( m_isField )
    24102473  {
    2411     pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeightOrg, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     2474    pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeightOrg, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     2475  cPicYuvTrueOrg.create(m_iSourceWidth, m_iSourceHeightOrg, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth);
    24122476  }
    24132477  else
    24142478  {
    2415     pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     2479    pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     2480  cPicYuvTrueOrg.create(m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth);
    24162481  }
    24172482
     
    24222487
    24232488    // read input YUV file
    2424     m_cTVideoIOYuvInputFile.read( pcPicYuvOrg, m_aiPad );
     2489    m_cTVideoIOYuvInputFile.read( pcPicYuvOrg, &cPicYuvTrueOrg, ipCSC, m_aiPad, m_InputChromaFormatIDC );
    24252490
    24262491    // increase number of received frames
     
    24282493
    24292494    bEos = (m_isField && (m_iFrameRcvd == (m_framesToBeEncoded >> 1) )) || ( !m_isField && (m_iFrameRcvd == m_framesToBeEncoded) );
     2495
    24302496    Bool flush = 0;
    24312497    // if end of file (which is only detected on a read failure) flush the encoder of any queued pictures
     
    24392505
    24402506    // call encoding function for one frame
    2441     if ( m_isField )
    2442     {
    2443       m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, m_cListPicYuvRec, outputAccessUnits, iNumEncoded, m_isTopFieldFirst);
    2444     }
    2445     else
    2446     {
    2447     m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, m_cListPicYuvRec, outputAccessUnits, iNumEncoded );
    2448     }
     2507    if ( m_isField ) m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, flush ? 0 : &cPicYuvTrueOrg, snrCSC, m_cListPicYuvRec, outputAccessUnits, iNumEncoded, m_isTopFieldFirst );
     2508    else             m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, flush ? 0 : &cPicYuvTrueOrg, snrCSC, m_cListPicYuvRec, outputAccessUnits, iNumEncoded );
    24492509
    24502510    // write bistream to file if necessary
     
    24652525  // delete used buffers in encoder class
    24662526  m_cTEncTop.deletePicBuffer();
     2527  cPicYuvTrueOrg.destroy();
    24672528
    24682529  // delete buffers & classes
     
    24922553
    24932554  // org. buffer
    2494   if ( m_acListPicYuvRec[layer].size() == (UInt)m_iGOPSize )
     2555  if ( m_acListPicYuvRec[layer].size() >= (UInt)m_iGOPSize ) // buffer will be 1 element longer when using field coding, to maintain first field whilst processing second.
    24952556  {
    24962557    rpcPicYuvRec = m_acListPicYuvRec[layer].popFront();
     
    25022563
    25032564#if LAYER_CTB
    2504 #if AUXILIARY_PICTURES
    25052565    rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
    25062566#else
    2507     rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
    2508 #endif
    2509 #else
    2510 #if AUXILIARY_PICTURES
    25112567    rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    2512 #else
    2513     rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    2514 #endif
    25152568#endif
    25162569
     
    25442597#endif
    25452598
     2599  const InputColourSpaceConversion ipCSC = (!m_outputInternalColourSpace) ? m_inputColourSpaceConvert : IPCOLOURSPACE_UNCHANGED;
     2600
    25462601  if (m_isField)
    25472602  {
     
    25672622      {
    25682623#if REPN_FORMAT_IN_VPS
    2569         m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRecTop, pcPicYuvRecBottom, m_acLayerCfg[layer].getConfWinLeft() * xScal, m_acLayerCfg[layer].getConfWinRight() * xScal,
    2570           m_acLayerCfg[layer].getConfWinTop() * yScal, m_acLayerCfg[layer].getConfWinBottom() * yScal, m_isTopFieldFirst );
    2571 #else
    2572         m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRecTop, pcPicYuvRecBottom, m_acLayerCfg[layer].getConfWinLeft(), m_acLayerCfg[layer].getConfWinRight(), m_acLayerCfg[layer].getConfWinTop(), m_acLayerCfg[layer].getConfWinBottom(), m_isTopFieldFirst );
     2624        m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRecTop, pcPicYuvRecBottom, ipCSC, m_acLayerCfg[layer].getConfWinLeft() * xScal, m_acLayerCfg[layer].getConfWinRight() * xScal,
     2625          m_acLayerCfg[layer].getConfWinTop() * yScal, m_acLayerCfg[layer].getConfWinBottom() * yScal, NUM_CHROMA_FORMAT, m_isTopFieldFirst );
     2626#else
     2627        m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRecTop, pcPicYuvRecBottom, ipCSC, m_acLayerCfg[layer].getConfWinLeft(), m_acLayerCfg[layer].getConfWinRight(), m_acLayerCfg[layer].getConfWinTop(), m_acLayerCfg[layer].getConfWinBottom(), NUM_CHROMA_FORMAT, m_isTopFieldFirst );
    25732628#endif
    25742629      }
     
    25962651      {
    25972652#if REPN_FORMAT_IN_VPS
    2598         m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getConfWinLeft() * xScal, m_acLayerCfg[layer].getConfWinRight() * xScal,
     2653        m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, ipCSC, m_acLayerCfg[layer].getConfWinLeft() * xScal, m_acLayerCfg[layer].getConfWinRight() * xScal,
    25992654          m_acLayerCfg[layer].getConfWinTop() * yScal, m_acLayerCfg[layer].getConfWinBottom() * yScal );
    26002655#else
    2601         m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getConfWinLeft(), m_acLayerCfg[layer].getConfWinRight(),
     2656        m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, ipCSC, m_acLayerCfg[layer].getConfWinLeft(), m_acLayerCfg[layer].getConfWinRight(),
    26022657          m_acLayerCfg[layer].getConfWinTop(), m_acLayerCfg[layer].getConfWinBottom() );
    26032658#endif
     
    26552710
    26562711  // org. buffer
    2657   if ( m_cListPicYuvRec.size() == (UInt)m_iGOPSize )
     2712  if ( m_cListPicYuvRec.size() >= (UInt)m_iGOPSize ) // buffer will be 1 element longer when using field coding, to maintain first field whilst processing second.
    26582713  {
    26592714    rpcPicYuvRec = m_cListPicYuvRec.popFront();
     
    26642719    rpcPicYuvRec = new TComPicYuv;
    26652720
    2666     rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     2721    rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
    26672722
    26682723  }
     
    26892744Void TAppEncTop::xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, const std::list<AccessUnit>& accessUnits)
    26902745{
     2746  const InputColourSpaceConversion ipCSC = (!m_outputInternalColourSpace) ? m_inputColourSpaceConvert : IPCOLOURSPACE_UNCHANGED;
     2747
    26912748  if (m_isField)
    26922749  {
     
    27082765      if (m_pchReconFile)
    27092766      {
    2710         m_cTVideoIOYuvReconFile.write( pcPicYuvRecTop, pcPicYuvRecBottom, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, m_isTopFieldFirst );
     2767        m_cTVideoIOYuvReconFile.write( pcPicYuvRecTop, pcPicYuvRecBottom, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, NUM_CHROMA_FORMAT, m_isTopFieldFirst );
    27112768      }
    27122769
     
    27232780  {
    27242781    Int i;
     2782
    27252783    TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.end();
    27262784    list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin();
     
    27362794      if (m_pchReconFile)
    27372795      {
    2738         m_cTVideoIOYuvReconFile.write( pcPicYuvRec, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom );
     2796        m_cTVideoIOYuvReconFile.write( pcPicYuvRec, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom );
    27392797      }
    27402798
     
    27502808 *
    27512809 */
    2752 void TAppEncTop::rateStatsAccum(const AccessUnit& au, const std::vector<UInt>& annexBsizes)
     2810Void TAppEncTop::rateStatsAccum(const AccessUnit& au, const std::vector<UInt>& annexBsizes)
    27532811{
    27542812  AccessUnit::const_iterator it_au = au.begin();
     
    27882846}
    27892847
    2790 void TAppEncTop::printRateSummary()
     2848Void TAppEncTop::printRateSummary()
    27912849{
    27922850#if SVC_EXTENSION
     
    28012859}
    28022860
     2861#if !SVC_EXTENSION
     2862Void TAppEncTop::printChromaFormat()
     2863{
     2864  std::cout << std::setw(43) << "Input ChromaFormatIDC = ";
     2865  switch (m_InputChromaFormatIDC)
     2866  {
     2867  case CHROMA_400:  std::cout << "  4:0:0"; break;
     2868  case CHROMA_420:  std::cout << "  4:2:0"; break;
     2869  case CHROMA_422:  std::cout << "  4:2:2"; break;
     2870  case CHROMA_444:  std::cout << "  4:4:4"; break;
     2871  default:
     2872    std::cerr << "Invalid";
     2873    exit(1);
     2874  }
     2875  std::cout << std::endl;
     2876
     2877  std::cout << std::setw(43) << "Output (internal) ChromaFormatIDC = ";
     2878  switch (m_cTEncTop.getChromaFormatIdc())
     2879  {
     2880  case CHROMA_400:  std::cout << "  4:0:0"; break;
     2881  case CHROMA_420:  std::cout << "  4:2:0"; break;
     2882  case CHROMA_422:  std::cout << "  4:2:2"; break;
     2883  case CHROMA_444:  std::cout << "  4:4:4"; break;
     2884  default:
     2885    std::cerr << "Invalid";
     2886    exit(1);
     2887  }
     2888  std::cout << "\n" << std::endl;
     2889}
     2890#endif
     2891
    28032892//! \}
Note: See TracChangeset for help on using the changeset viewer.