Changeset 466 in SHVCSoftware for branches


Ignore:
Timestamp:
13 Nov 2013, 23:25:47 (11 years ago)
Author:
nokia
Message:

Integration of O0194: Support different bit-depth values for different layers, enable weighted prediction for ILR for color gamut scalability.

Location:
branches/SHM-4.0-dev
Files:
59 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-4.0-dev/cfg/encoder_intra_he10.cfg

    r2 r466  
    4343
    4444#=========== Misc. ============
    45 InternalBitDepth              : 10          # internal bit-depth = BitDepth + BitIncrement
     45#InternalBitDepth             : 10          # codec operating bit-depth
     46InternalBitDepth0             : 10          # codec operating bit-depth for layer 0
     47InternalBitDepth1             : 10          # codec operating bit-depth for layer 1
    4648
    4749#=========== Coding Tools =================
  • branches/SHM-4.0-dev/cfg/encoder_intra_main.cfg

    r310 r466  
    4848
    4949#=========== Misc. ============
    50 InternalBitDepth              : 8           # codec operating bit-depth
     50#InternalBitDepth             : 8           # codec operating bit-depth
     51InternalBitDepth0             : 8           # codec operating bit-depth for layer 0
     52InternalBitDepth1             : 8           # codec operating bit-depth for layer 1
    5153
    5254#=========== Coding Tools =================
  • branches/SHM-4.0-dev/cfg/encoder_intra_main10.cfg

    r310 r466  
    4848
    4949#=========== Misc. ============
    50 InternalBitDepth              : 10          # codec operating bit-depth
     50#InternalBitDepth             : 10          # codec operating bit-depth
     51InternalBitDepth0             : 10          # codec operating bit-depth for layer 0
     52InternalBitDepth1             : 10          # codec operating bit-depth for layer 1
    5153
    5254#=========== Coding Tools =================
  • branches/SHM-4.0-dev/cfg/encoder_lowdelay_P_he10.cfg

    r310 r466  
    5050
    5151#=========== Misc. ============
    52 InternalBitDepth              : 10          # internal bit-depth = BitDepth + BitIncrement
     52#InternalBitDepth             : 10          # internal bit-depth = BitDepth + BitIncrement
     53InternalBitDepth0             : 10          # codec operating bit-depth for layer 0
     54InternalBitDepth1             : 10          # codec operating bit-depth for layer 1
    5355
    5456#=========== Coding Tools =================
  • branches/SHM-4.0-dev/cfg/encoder_lowdelay_P_main.cfg

    r442 r466  
    5353
    5454#=========== Misc. ============
    55 InternalBitDepth              : 8           # codec operating bit-depth
     55#InternalBitDepth             : 8           # codec operating bit-depth
     56InternalBitDepth0             : 8           # codec operating bit-depth for layer 0
     57InternalBitDepth1             : 8           # codec operating bit-depth for layer 1
    5658
    5759#=========== Coding Tools =================
  • branches/SHM-4.0-dev/cfg/encoder_lowdelay_P_main10.cfg

    r442 r466  
    5555
    5656#=========== Misc. ============
    57 InternalBitDepth              : 10          # codec operating bit-depth
     57#InternalBitDepth             : 10          # codec operating bit-depth
     58InternalBitDepth0             : 10          # codec operating bit-depth for layer 0
     59InternalBitDepth1             : 10          # codec operating bit-depth for layer 1
    5860
    5961#=========== Coding Tools =================
  • branches/SHM-4.0-dev/cfg/encoder_lowdelay_he10.cfg

    r310 r466  
    4848
    4949#=========== Misc. ============
    50 InternalBitDepth              : 10          # internal bit-depth = BitDepth + BitIncrement
     50#InternalBitDepth             : 10          # codec operating bit-depth
     51InternalBitDepth0             : 10          # codec operating bit-depth for layer 0
     52InternalBitDepth1             : 10          # codec operating bit-depth for layer 1
    5153
    5254#=========== Coding Tools =================
  • branches/SHM-4.0-dev/cfg/encoder_lowdelay_main.cfg

    r442 r466  
    5353
    5454#=========== Misc. ============
    55 InternalBitDepth              : 8           # codec operating bit-depth
     55#InternalBitDepth             : 8           # codec operating bit-depth
     56InternalBitDepth0             : 8           # codec operating bit-depth for layer 0
     57InternalBitDepth1             : 8           # codec operating bit-depth for layer 1
    5658
    5759#=========== Coding Tools =================
  • branches/SHM-4.0-dev/cfg/encoder_lowdelay_main10.cfg

    r442 r466  
    5353
    5454#=========== Misc. ============
    55 InternalBitDepth              : 10          # codec operating bit-depth
     55#InternalBitDepth             : 10          # codec operating bit-depth
     56InternalBitDepth0             : 10          # codec operating bit-depth for layer 0
     57InternalBitDepth1             : 10          # codec operating bit-depth for layer 1
    5658
    5759#=========== Coding Tools =================
  • branches/SHM-4.0-dev/cfg/encoder_randomaccess_he10.cfg

    r345 r466  
    6262
    6363#=========== Misc. ============
    64 InternalBitDepth              : 10          # internal bit-depth = BitDepth + BitIncrement
     64#InternalBitDepth             : 10          # codec operating bit-depth
     65InternalBitDepth0             : 10          # codec operating bit-depth for layer 0
     66InternalBitDepth1             : 10          # codec operating bit-depth for layer 1
    6567
    6668#=========== Coding Tools =================
  • branches/SHM-4.0-dev/cfg/encoder_randomaccess_main.cfg

    r442 r466  
    6565
    6666#=========== Misc. ============
    67 InternalBitDepth              : 8           # codec operating bit-depth
     67#InternalBitDepth             : 8           # codec operating bit-depth
     68InternalBitDepth0             : 8           # codec operating bit-depth for layer 0
     69InternalBitDepth1             : 8           # codec operating bit-depth for layer 1
    6870
    6971#=========== Coding Tools =================
  • branches/SHM-4.0-dev/cfg/encoder_randomaccess_main10.cfg

    r442 r466  
    6565
    6666#=========== Misc. ============
    67 InternalBitDepth              : 10          # codec operating bit-depth
     67#InternalBitDepth             : 10           # codec operating bit-depth
     68InternalBitDepth0             : 10           # codec operating bit-depth for layer 0
     69InternalBitDepth1             : 10           # codec operating bit-depth for layer 1
    6870
    6971#=========== Coding Tools =================
  • branches/SHM-4.0-dev/cfg/per-sequence-svc/BQTerrace-1.5x.cfg

    r464 r466  
    1 InputBitDepth                 : 8           # Input bitdepth
     1#InputBitDepth                : 8           # Input bitdepth
     2InputBitDepth0                : 8           # Input bitdepth for layer 0
     3InputBitDepth1                : 8           # Input bitdepth for layer 1
    24FrameSkip                     : 0           # Number of frames to be skipped in input
    35FramesToBeEncoded             : 600         # Number of frames to be coded
  • branches/SHM-4.0-dev/cfg/per-sequence-svc/BQTerrace-2x.cfg

    r464 r466  
    1 InputBitDepth                 : 8           # Input bitdepth
     1#InputBitDepth                : 8           # Input bitdepth
     2InputBitDepth0                : 8           # Input bitdepth for layer 0
     3InputBitDepth1                : 8           # Input bitdepth for layer 1
    24FrameSkip                     : 0           # Number of frames to be skipped in input
    35FramesToBeEncoded             : 600         # Number of frames to be coded
  • branches/SHM-4.0-dev/cfg/per-sequence-svc/BQTerrace-SNR.cfg

    r464 r466  
    1 InputBitDepth                 : 8           # Input bitdepth
     1#InputBitDepth                : 8           # Input bitdepth
     2InputBitDepth0                : 8           # Input bitdepth for layer 0
     3InputBitDepth1                : 8           # Input bitdepth for layer 1
    24FrameSkip                     : 0           # Number of frames to be skipped in input
    35FramesToBeEncoded             : 600         # Number of frames to be coded
  • branches/SHM-4.0-dev/cfg/per-sequence-svc/BasketballDrive-1.5x.cfg

    r464 r466  
    1 InputBitDepth                 : 8           # Input bitdepth
     1#InputBitDepth                : 8           # Input bitdepth
     2InputBitDepth0                : 8           # Input bitdepth for layer 0
     3InputBitDepth1                : 8           # Input bitdepth for layer 1
    24FrameSkip                     : 0           # Number of frames to be skipped in input
    35FramesToBeEncoded             : 500         # Number of frames to be coded
  • branches/SHM-4.0-dev/cfg/per-sequence-svc/BasketballDrive-2x.cfg

    r464 r466  
    1 InputBitDepth                 : 8           # Input bitdepth
     1#InputBitDepth                : 8           # Input bitdepth
     2InputBitDepth0                : 8           # Input bitdepth for layer 0
     3InputBitDepth1                : 8           # Input bitdepth for layer 1
    24FrameSkip                     : 0           # Number of frames to be skipped in input
    35FramesToBeEncoded             : 500         # Number of frames to be coded
  • branches/SHM-4.0-dev/cfg/per-sequence-svc/BasketballDrive-SNR.cfg

    r464 r466  
    1 InputBitDepth                 : 8           # Input bitdepth
     1#InputBitDepth                : 8           # Input bitdepth
     2InputBitDepth0                : 8           # Input bitdepth for layer 0
     3InputBitDepth1                : 8           # Input bitdepth for layer 1
    24FrameSkip                     : 0           # Number of frames to be skipped in input
    35FramesToBeEncoded             : 500         # Number of frames to be coded
  • branches/SHM-4.0-dev/cfg/per-sequence-svc/Cactus-1.5x.cfg

    r464 r466  
    1 InputBitDepth                 : 8           # Input bitdepth
     1#InputBitDepth                : 8           # Input bitdepth
     2InputBitDepth0                : 8           # Input bitdepth for layer 0
     3InputBitDepth1                : 8           # Input bitdepth for layer 1
    24FrameSkip                     : 0           # Number of frames to be skipped in input
    35FramesToBeEncoded             : 500         # Number of frames to be coded
  • branches/SHM-4.0-dev/cfg/per-sequence-svc/Cactus-2x.cfg

    r464 r466  
    1 InputBitDepth                 : 8           # Input bitdepth
     1#InputBitDepth                : 8           # Input bitdepth
     2InputBitDepth0                : 8           # Input bitdepth for layer 0
     3InputBitDepth1                : 8           # Input bitdepth for layer 1
    24FrameSkip                     : 0           # Number of frames to be skipped in input
    35FramesToBeEncoded             : 500         # Number of frames to be coded
  • branches/SHM-4.0-dev/cfg/per-sequence-svc/Cactus-SNR.cfg

    r464 r466  
    1 InputBitDepth                 : 8           # Input bitdepth
     1#InputBitDepth                : 8           # Input bitdepth
     2InputBitDepth0                : 8           # Input bitdepth for layer 0
     3InputBitDepth1                : 8           # Input bitdepth for layer 1
    24FrameSkip                     : 0           # Number of frames to be skipped in input
    35FramesToBeEncoded             : 500         # Number of frames to be coded
  • branches/SHM-4.0-dev/cfg/per-sequence-svc/Kimono-1.5x.cfg

    r464 r466  
    1 InputBitDepth                 : 8           # Input bitdepth
     1#InputBitDepth                : 8           # Input bitdepth
     2InputBitDepth0                : 8           # Input bitdepth for layer 0
     3InputBitDepth1                : 8           # Input bitdepth for layer 1
    24FrameSkip                     : 0           # Number of frames to be skipped in input
    35FramesToBeEncoded             : 240         # Number of frames to be coded
  • branches/SHM-4.0-dev/cfg/per-sequence-svc/Kimono-2x.cfg

    r464 r466  
    1 InputBitDepth                 : 8           # Input bitdepth
     1#InputBitDepth                : 8           # Input bitdepth
     2InputBitDepth0                : 8           # Input bitdepth for layer 0
     3InputBitDepth1                : 8           # Input bitdepth for layer 1
    24FrameSkip                     : 0           # Number of frames to be skipped in input
    35FramesToBeEncoded             : 240         # Number of frames to be coded
  • branches/SHM-4.0-dev/cfg/per-sequence-svc/Kimono-SNR.cfg

    r464 r466  
    1 InputBitDepth                 : 8           # Input bitdepth
     1#InputBitDepth                : 8           # Input bitdepth
     2InputBitDepth0                : 8           # Input bitdepth for layer 0
     3InputBitDepth1                : 8           # Input bitdepth for layer 1
    24FrameSkip                     : 0           # Number of frames to be skipped in input
    35FramesToBeEncoded             : 240         # Number of frames to be coded
  • branches/SHM-4.0-dev/cfg/per-sequence-svc/ParkScene-1.5x.cfg

    r464 r466  
    1 InputBitDepth                 : 8           # Input bitdepth
     1#InputBitDepth                : 8           # Input bitdepth
     2InputBitDepth0                : 8           # Input bitdepth for layer 0
     3InputBitDepth1                : 8           # Input bitdepth for layer 1
    24FrameSkip                     : 0           # Number of frames to be skipped in input
    35FramesToBeEncoded             : 240         # Number of frames to be coded
  • branches/SHM-4.0-dev/cfg/per-sequence-svc/ParkScene-2x.cfg

    r464 r466  
    1 InputBitDepth                 : 8           # Input bitdepth
     1#InputBitDepth                : 8           # Input bitdepth
     2InputBitDepth0                : 8           # Input bitdepth for layer 0
     3InputBitDepth1                : 8           # Input bitdepth for layer 1
    24FrameSkip                     : 0           # Number of frames to be skipped in input
    35FramesToBeEncoded             : 240         # Number of frames to be coded
  • branches/SHM-4.0-dev/cfg/per-sequence-svc/ParkScene-SNR.cfg

    r464 r466  
    1 InputBitDepth                 : 8           # Input bitdepth
     1#InputBitDepth                : 8           # Input bitdepth
     2InputBitDepth0                : 8           # Input bitdepth for layer 0
     3InputBitDepth1                : 8           # Input bitdepth for layer 1
    24FrameSkip                     : 0           # Number of frames to be skipped in input
    35FramesToBeEncoded             : 240         # Number of frames to be coded
  • branches/SHM-4.0-dev/cfg/per-sequence-svc/PeopleOnStreet-2x.cfg

    r464 r466  
    1 InputBitDepth                 : 8           # Input bitdepth
     1#InputBitDepth                : 8           # Input bitdepth
     2InputBitDepth0                : 8           # Input bitdepth for layer 0
     3InputBitDepth1                : 8           # Input bitdepth for layer 1
    24FrameSkip                     : 0           # Number of frames to be skipped in input
    35FramesToBeEncoded             : 150         # Number of frames to be coded
  • branches/SHM-4.0-dev/cfg/per-sequence-svc/PeopleOnStreet-SNR.cfg

    r464 r466  
    1 InputBitDepth                 : 8           # Input bitdepth
     1#InputBitDepth                : 8           # Input bitdepth
     2InputBitDepth0                : 8           # Input bitdepth for layer 0
     3InputBitDepth1                : 8           # Input bitdepth for layer 1
    24FrameSkip                     : 0           # Number of frames to be skipped in input
    35FramesToBeEncoded             : 150         # Number of frames to be coded
  • branches/SHM-4.0-dev/cfg/per-sequence-svc/Traffic-2x.cfg

    r464 r466  
    1 InputBitDepth                 : 8           # Input bitdepth
     1#InputBitDepth                : 8           # Input bitdepth
     2InputBitDepth0                : 8           # Input bitdepth for layer 0
     3InputBitDepth1                : 8           # Input bitdepth for layer 1
    24FrameSkip                     : 0           # Number of frames to be skipped in input
    35FramesToBeEncoded             : 150         # Number of frames to be coded
  • branches/SHM-4.0-dev/cfg/per-sequence-svc/Traffic-SNR.cfg

    r464 r466  
    1 InputBitDepth                 : 8           # Input bitdepth
     1#InputBitDepth                : 8           # Input bitdepth
     2InputBitDepth0                : 8           # Input bitdepth for layer 0
     3InputBitDepth1                : 8           # Input bitdepth for layer 1
    24FrameSkip                     : 0           # Number of frames to be skipped in input
    35FramesToBeEncoded             : 150         # Number of frames to be coded
  • branches/SHM-4.0-dev/source/App/TAppDecoder/TAppDecTop.cpp

    r442 r466  
    225225    if (bNewPicture || !bitstreamFile)
    226226    {
     227#if O0194_DIFFERENT_BITDEPTH_EL_BL
     228      //Bug fix: The bit depth was not set correctly for each layer when doing DBF
     229      g_bitDepthY = g_bitDepthYLayer[curLayerId];
     230      g_bitDepthC = g_bitDepthCLayer[curLayerId];
     231#endif
    227232      m_acTDecTop[curLayerId].executeLoopFilters(poc, pcListPic);
    228233#if EARLY_REF_PIC_MARKING
     
    237242        if (!m_outputBitDepthY) { m_outputBitDepthY = g_bitDepthY; }       
    238243        if (!m_outputBitDepthC) { m_outputBitDepthC = g_bitDepthC; }
    239 
    240244        m_acTVideoIOYuvReconFile[curLayerId].open( m_pchReconFile[curLayerId], true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode
    241245
     
    566570
    567571#else
     572#if O0194_REPN_FORMAT_IN_VPS_BUGFIX
     573          m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     574#else
    568575          m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     576#endif
    569577            conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    570578            conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     
    759767
    760768#else
     769#if O0194_REPN_FORMAT_IN_VPS_BUGFIX
     770          m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     771#else
    761772          m_cTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     773#endif
    762774            conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    763775            conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
  • branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncCfg.cpp

    r464 r466  
    362362  Int*    cfg_IntraPeriod   [MAX_LAYERS];
    363363  Int*    cfg_conformanceMode  [MAX_LAYERS];
    364 #if LAYER_CTB
    365   // coding unit (CU) definition
    366   UInt*      cfg_uiMaxCUWidth[MAX_LAYERS];                                   ///< max. CU width in pixel
    367   UInt*      cfg_uiMaxCUHeight[MAX_LAYERS];                                  ///< max. CU height in pixel
    368   UInt*      cfg_uiMaxCUDepth[MAX_LAYERS];                                   ///< max. CU depth
    369  
    370   // transfom unit (TU) definition
    371   UInt*      cfg_uiQuadtreeTULog2MaxSize[MAX_LAYERS];
    372   UInt*      cfg_uiQuadtreeTULog2MinSize[MAX_LAYERS];
    373  
    374   UInt*      cfg_uiQuadtreeTUMaxDepthInter[MAX_LAYERS];
    375   UInt*      cfg_uiQuadtreeTUMaxDepthIntra[MAX_LAYERS];
    376 #endif
    377364#if VPS_EXTN_DIRECT_REF_LAYERS
    378365#if M0457_PREDICTION_INDICATIONS
     
    392379  string* cfg_predLayerIdsPtr    [MAX_LAYERS];
    393380#endif
     381#if SCALED_REF_LAYER_OFFSETS
    394382  string    cfg_scaledRefLayerLeftOffset [MAX_LAYERS];
    395383  string    cfg_scaledRefLayerTopOffset [MAX_LAYERS];
     
    402390  string*    cfg_scaledRefLayerRightOffsetPtr  [MAX_LAYERS];
    403391  string*    cfg_scaledRefLayerBottomOffsetPtr [MAX_LAYERS];
     392#endif
    404393#if RC_SHVC_HARMONIZATION
    405394  Bool*   cfg_RCEnableRateControl  [MAX_LAYERS];
     
    411400  Bool*   cfg_RCForceIntraQP       [MAX_LAYERS];
    412401#endif
     402#if O0194_DIFFERENT_BITDEPTH_EL_BL
     403  Int*    cfg_InputBitDepthY    [MAX_LAYERS];
     404  Int*    cfg_InternalBitDepthY [MAX_LAYERS];
     405  Int*    cfg_InputBitDepthC    [MAX_LAYERS];
     406  Int*    cfg_InternalBitDepthC [MAX_LAYERS];
     407  Int*    cfg_OutputBitDepthY   [MAX_LAYERS];
     408  Int*    cfg_OutputBitDepthC   [MAX_LAYERS];
     409#endif
    413410#if N0120_MAX_TID_REF_CFG
    414411  Int*    cfg_maxTidIlRefPicsPlus1[MAX_LAYERS];
     
    427424    cfg_IntraPeriod[layer]  = &m_acLayerCfg[layer].m_iIntraPeriod;
    428425    cfg_conformanceMode[layer] = &m_acLayerCfg[layer].m_conformanceMode;
    429 #if LAYER_CTB
    430     // coding unit (CU) definition
    431     cfg_uiMaxCUWidth[layer]  = &m_acLayerCfg[layer].m_uiMaxCUWidth;
    432     cfg_uiMaxCUHeight[layer] = &m_acLayerCfg[layer].m_uiMaxCUHeight;
    433     cfg_uiMaxCUDepth[layer]  = &m_acLayerCfg[layer].m_uiMaxCUDepth;
    434 
    435     // transfom unit (TU) definition.
    436     cfg_uiQuadtreeTULog2MaxSize[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTULog2MaxSize;
    437     cfg_uiQuadtreeTULog2MinSize[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTULog2MinSize;
    438 
    439     cfg_uiQuadtreeTUMaxDepthInter[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthInter;
    440     cfg_uiQuadtreeTUMaxDepthIntra[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthIntra;
    441 #endif
    442426#if VPS_EXTN_DIRECT_REF_LAYERS
    443427#if M0457_PREDICTION_INDICATIONS
     
    453437    cfg_predLayerIdsPtr     [layer]  = &cfg_predLayerIds[layer];
    454438#endif
     439#if SCALED_REF_LAYER_OFFSETS
    455440    cfg_numScaledRefLayerOffsets [layer] = &m_acLayerCfg[layer].m_numScaledRefLayerOffsets;
    456441    for(Int i = 0; i < MAX_LAYERS; i++)
     
    461446      cfg_scaledRefLayerBottomOffsetPtr[layer] = &cfg_scaledRefLayerBottomOffset[layer];
    462447    }
     448#endif
    463449#if RC_SHVC_HARMONIZATION
    464450    cfg_RCEnableRateControl[layer]   = &m_acLayerCfg[layer].m_RCEnableRateControl;
     
    470456    cfg_RCForceIntraQP[layer]        = &m_acLayerCfg[layer].m_RCForceIntraQP;
    471457#endif
     458#if O0194_DIFFERENT_BITDEPTH_EL_BL
     459  cfg_InputBitDepthY   [layer] = &m_acLayerCfg[layer].m_inputBitDepthY;
     460  cfg_InternalBitDepthY[layer] = &m_acLayerCfg[layer].m_internalBitDepthY;
     461  cfg_InputBitDepthC   [layer] = &m_acLayerCfg[layer].m_inputBitDepthC;
     462  cfg_InternalBitDepthC[layer] = &m_acLayerCfg[layer].m_internalBitDepthC;
     463  cfg_OutputBitDepthY  [layer] = &m_acLayerCfg[layer].m_outputBitDepthY;
     464  cfg_OutputBitDepthC  [layer] = &m_acLayerCfg[layer].m_outputBitDepthC;
     465#endif
    472466#if N0120_MAX_TID_REF_CFG
    473467    cfg_maxTidIlRefPicsPlus1[layer] = &m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1;
     
    483477  string  cfg_tileSets;
    484478#endif
    485 #else //SVC_EXTENSION
     479#else
    486480  string cfg_InputFile;
    487481  string cfg_BitstreamFile;
    488482  string cfg_ReconFile;
    489483  string cfg_dQPFile;
    490 #endif //SVC_EXTENSION
     484#endif
    491485  string cfg_ColumnWidth;
    492486  string cfg_RowHeight;
     
    538532#endif
    539533  ("BitstreamFile,b",         cfg_BitstreamFile, string(""), "Bitstream output file name")
     534#if !O0194_DIFFERENT_BITDEPTH_EL_BL
    540535  ("InputBitDepth",           m_inputBitDepthY,    8, "Bit-depth of input file")
    541536  ("OutputBitDepth",          m_outputBitDepthY,   0, "Bit-depth of output file (default:InternalBitDepth)")
     
    545540  ("OutputBitDepthC",         m_outputBitDepthC,   0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
    546541  ("InternalBitDepthC",       m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)")
     542#endif
     543#if SCALED_REF_LAYER_OFFSETS
    547544  ("NumScaledRefLayerOffsets%d",    cfg_numScaledRefLayerOffsets,     0, MAX_LAYERS,  "Number of scaled offset layer sets ")
    548545  ("ScaledRefLayerLeftOffset%d",   cfg_scaledRefLayerLeftOffsetPtr,  string(""), MAX_LAYERS, "Horizontal offset of top-left luma sample of scaled base layer picture with respect to"
     
    554551  ("ScaledRefLayerBottomOffset%d", cfg_scaledRefLayerBottomOffsetPtr,string(""), MAX_LAYERS, "Vertical offset of bottom-right luma sample of scaled base layer picture with respect to"
    555552                                                                 " bottom-right luma sample of the EL picture, in units of two luma samples")
     553#endif
     554#if O0194_DIFFERENT_BITDEPTH_EL_BL
     555  ("InputBitDepth%d",       cfg_InputBitDepthY,    8, MAX_LAYERS, "Bit-depth of input file for layer %d")
     556  ("InternalBitDepth%d",    cfg_InternalBitDepthY, 0, MAX_LAYERS, "Bit-depth the codec operates at. (default:InputBitDepth) for layer %d ")
     557//                                                       "If different to InputBitDepth, source data will be converted")
     558  ("InputBitDepthC%d",      cfg_InputBitDepthC,    0, MAX_LAYERS, "As per InputBitDepth but for chroma component. (default:InputBitDepth) for layer %d")
     559  ("InternalBitDepthC%d",   cfg_InternalBitDepthC, 0, MAX_LAYERS, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth) for layer %d")
     560  ("OutputBitDepth%d",      cfg_OutputBitDepthY,   0, MAX_LAYERS, "Bit-depth of output file (default:InternalBitDepth)")
     561  ("OutputBitDepthC%d",     cfg_OutputBitDepthC,   0, MAX_LAYERS, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
     562#endif
    556563#if N0120_MAX_TID_REF_CFG
    557564  ("MaxTidRefPresentFlag", m_maxTidRefPresentFlag, true, "max_tid_ref_present_flag (0: not present, 1: present(default)) " )
     
    569576  ("IlSampleOnlyPred%d",       m_ilSampleOnlyPred, 0, MAX_LAYERS, "Set inter_layer_sample_pred_only_flag for all slices")
    570577#endif
    571 #else //SVC_EXTENSION
     578#else
    572579  ("InputFile,i",           cfg_InputFile,     string(""), "Original YUV input file name")
    573580  ("BitstreamFile,b",       cfg_BitstreamFile, string(""), "Bitstream output file name")
     
    590597  ("ConfBottom",            m_confBottom,          0, "Bottom offset for window conformance mode 3")
    591598  ("FrameRate,-fr",         m_iFrameRate,          0, "Frame rate")
    592 #endif //SVC_EXTENSION
     599#endif
    593600
    594601  //Field coding parameters
     
    607614  ("FrameOnly",         m_frameOnlyConstraintFlag, false, "Indicate that the bitstream contains only frames")
    608615
    609 #if LAYER_CTB
    610   // Unit definition parameters
    611   ("MaxCUWidth%d",              cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU width")
    612   ("MaxCUHeight%d",             cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU height")
    613   // todo: remove defaults from MaxCUSize
    614   ("MaxCUSize%d,s%d",           cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU size")
    615   ("MaxCUSize%d,s%d",           cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU size")
    616   ("MaxPartitionDepth%d,h%d",   cfg_uiMaxCUDepth,              4u, MAX_LAYERS, "CU depth")
    617  
    618   ("QuadtreeTULog2MaxSize%d",   cfg_uiQuadtreeTULog2MaxSize,   6u, MAX_LAYERS, "Maximum TU size in logarithm base 2")
    619   ("QuadtreeTULog2MinSize%d",   cfg_uiQuadtreeTULog2MinSize,   2u, MAX_LAYERS, "Minimum TU size in logarithm base 2")
    620  
    621   ("QuadtreeTUMaxDepthIntra%d", cfg_uiQuadtreeTUMaxDepthIntra, 1u, MAX_LAYERS, "Depth of TU tree for intra CUs")
    622   ("QuadtreeTUMaxDepthInter%d", cfg_uiQuadtreeTUMaxDepthInter, 2u, MAX_LAYERS, "Depth of TU tree for inter CUs")
    623 
    624 
    625   // set the same CU realted settings across all the layers if config file parameters are not layer specific
    626   ("MaxCUWidth",              cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU width")
    627   ("MaxCUHeight",             cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU height")
    628   // todo: remove defaults from MaxCUSize
    629   ("MaxCUSize,s",             cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU size")
    630   ("MaxCUSize,s",             cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU size")
    631   ("MaxPartitionDepth,h",     cfg_uiMaxCUDepth,              4u, MAX_LAYERS, "CU depth")
    632  
    633   ("QuadtreeTULog2MaxSize",   cfg_uiQuadtreeTULog2MaxSize,   6u, MAX_LAYERS, "Maximum TU size in logarithm base 2")
    634   ("QuadtreeTULog2MinSize",   cfg_uiQuadtreeTULog2MinSize,   2u, MAX_LAYERS, "Minimum TU size in logarithm base 2")
    635  
    636   ("QuadtreeTUMaxDepthIntra", cfg_uiQuadtreeTUMaxDepthIntra, 1u, MAX_LAYERS, "Depth of TU tree for intra CUs")
    637   ("QuadtreeTUMaxDepthInter", cfg_uiQuadtreeTUMaxDepthInter, 2u, MAX_LAYERS, "Depth of TU tree for inter CUs")
    638 #else
    639616  // Unit definition parameters
    640617  ("MaxCUWidth",              m_uiMaxCUWidth,             64u)
     
    650627  ("QuadtreeTUMaxDepthIntra", m_uiQuadtreeTUMaxDepthIntra, 1u, "Depth of TU tree for intra CUs")
    651628  ("QuadtreeTUMaxDepthInter", m_uiQuadtreeTUMaxDepthInter, 2u, "Depth of TU tree for inter CUs")
    652 #endif
    653629 
    654630  // Coding structure paramters
     
    974950  m_BLSyntaxFile = cfg_BLSyntaxFile.empty() ? NULL : strdup(cfg_BLSyntaxFile.c_str());
    975951#endif
    976 #else //SVC_EXTENSION
     952#else
    977953  m_pchInputFile = cfg_InputFile.empty() ? NULL : strdup(cfg_InputFile.c_str());
    978954  m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str());
    979955  m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str());
    980956  m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str());
    981 #endif //SVC_EXTENSION
     957#endif
    982958
    983959  Char* pColumnWidth = cfg_ColumnWidth.empty() ? NULL: strdup(cfg_ColumnWidth.c_str());
     
    10381014    m_pRowHeight = NULL;
    10391015  }
    1040 #if SVC_EXTENSION
     1016#if SCALED_REF_LAYER_OFFSETS
    10411017  for(Int layer = 0; layer < MAX_LAYERS; layer++)
    10421018  {
     
    11081084    }
    11091085  }
     1086#endif
    11101087#if VPS_EXTN_DIRECT_REF_LAYERS
    11111088#if M0457_PREDICTION_INDICATIONS
     
    12371214  }
    12381215#endif
    1239 #endif //SVC_EXTENSION
    12401216  m_scalingListFile = cfg_ScalingListFile.empty() ? NULL : strdup(cfg_ScalingListFile.c_str());
    12411217
    12421218  /* rules for input, output and internal bitdepths as per help text */
     1219#if O0194_DIFFERENT_BITDEPTH_EL_BL
     1220  for(Int layer = 0; layer < MAX_LAYERS; layer++){
     1221    if (!m_acLayerCfg[layer].m_internalBitDepthY) { m_acLayerCfg[layer].m_internalBitDepthY = m_acLayerCfg[layer].m_inputBitDepthY; }
     1222    if (!m_acLayerCfg[layer].m_internalBitDepthC) { m_acLayerCfg[layer].m_internalBitDepthC = m_acLayerCfg[layer].m_internalBitDepthY; }
     1223    if (!m_acLayerCfg[layer].m_inputBitDepthC) { m_acLayerCfg[layer].m_inputBitDepthC = m_acLayerCfg[layer].m_inputBitDepthY; }
     1224    if (!m_acLayerCfg[layer].m_outputBitDepthY) { m_acLayerCfg[layer].m_outputBitDepthY = m_acLayerCfg[layer].m_internalBitDepthY; }
     1225    if (!m_acLayerCfg[layer].m_outputBitDepthC) { m_acLayerCfg[layer].m_outputBitDepthC = m_acLayerCfg[layer].m_internalBitDepthC; }
     1226  }
     1227#else
    12431228  if (!m_internalBitDepthY) { m_internalBitDepthY = m_inputBitDepthY; }
    12441229  if (!m_internalBitDepthC) { m_internalBitDepthC = m_internalBitDepthY; }
     
    12461231  if (!m_outputBitDepthY) { m_outputBitDepthY = m_internalBitDepthY; }
    12471232  if (!m_outputBitDepthC) { m_outputBitDepthC = m_internalBitDepthC; }
     1233#endif
    12481234
    12491235#if !SVC_EXTENSION
     
    14571443 
    14581444  // set global varibles
    1459 #if LAYER_CTB
    1460   for(Int layer = 0; layer < MAX_LAYERS; layer++)
    1461   {
    1462     xSetGlobal(layer);
    1463   }
    1464 #else
    14651445  xSetGlobal();
    1466 #endif
    14671446 
    14681447  // print-out parameters
     
    15031482#define xConfirmPara(a,b) check_failed |= confirmPara(a,b)
    15041483  // check range of parameters
     1484#if O0194_DIFFERENT_BITDEPTH_EL_BL
     1485  for(UInt layer=0; layer<m_numLayers; layer++){
     1486    xConfirmPara( m_acLayerCfg[layer].m_inputBitDepthY < 8,                                                     "InputBitDepth must be at least 8" );
     1487    xConfirmPara( m_acLayerCfg[layer].m_inputBitDepthC < 8,                                                     "InputBitDepthC must be at least 8" );
     1488  }
     1489#else
    15051490  xConfirmPara( m_inputBitDepthY < 8,                                                     "InputBitDepth must be at least 8" );
    15061491  xConfirmPara( m_inputBitDepthC < 8,                                                     "InputBitDepthC must be at least 8" );
     1492#endif
    15071493#if !SVC_EXTENSION 
    15081494  xConfirmPara( m_iFrameRate <= 0,                                                          "Frame rate must be more than 1" );
     
    15241510  xConfirmPara( m_bipredSearchRange < 0 ,                                                   "Search Range must be more than 0" );
    15251511  xConfirmPara( m_iMaxDeltaQP > 7,                                                          "Absolute Delta QP exceeds supported range (0 to 7)" );
    1526 #if LAYER_CTB
    1527   for(UInt layer = 0; layer < MAX_LAYERS; layer++)
    1528   {
    1529     xConfirmPara( m_iMaxCuDQPDepth > m_acLayerCfg[layer].m_uiMaxCUDepth - 1,                "Absolute depth for a minimum CuDQP exceeds maximum coding unit depth" );
    1530   }
    1531 #else
    15321512  xConfirmPara( m_iMaxCuDQPDepth > m_uiMaxCUDepth - 1,                                          "Absolute depth for a minimum CuDQP exceeds maximum coding unit depth" );
    1533 #endif
    15341513
    15351514  xConfirmPara( m_cbQpOffset < -12,   "Min. Chroma Cb QP Offset is -12" );
     
    15451524  }
    15461525#endif
    1547 #if !LAYER_CTB
    15481526  xConfirmPara( (m_uiMaxCUWidth  >> m_uiMaxCUDepth) < 4,                                    "Minimum partition width size should be larger than or equal to 8");
    15491527  xConfirmPara( (m_uiMaxCUHeight >> m_uiMaxCUDepth) < 4,                                    "Minimum partition height size should be larger than or equal to 8");
    15501528  xConfirmPara( m_uiMaxCUWidth < 16,                                                        "Maximum partition width size should be larger than or equal to 16");
    15511529  xConfirmPara( m_uiMaxCUHeight < 16,                                                       "Maximum partition height size should be larger than or equal to 16");
    1552 #endif
    15531530#if !SVC_EXTENSION
    15541531  xConfirmPara( (m_iSourceWidth  % (m_uiMaxCUWidth  >> (m_uiMaxCUDepth-1)))!=0,             "Resulting coded frame width must be a multiple of the minimum CU size");
     
    15561533#endif
    15571534 
    1558 #if !LAYER_CTB
    15591535  xConfirmPara( m_uiQuadtreeTULog2MinSize < 2,                                        "QuadtreeTULog2MinSize must be 2 or greater.");
    15601536  xConfirmPara( m_uiQuadtreeTULog2MaxSize > 5,                                        "QuadtreeTULog2MaxSize must be 5 or smaller.");
     
    15701546  xConfirmPara( m_uiQuadtreeTUMaxDepthIntra < 1,                                                         "QuadtreeTUMaxDepthIntra must be greater than or equal to 1" );
    15711547  xConfirmPara( m_uiMaxCUWidth < ( 1 << (m_uiQuadtreeTULog2MinSize + m_uiQuadtreeTUMaxDepthIntra - 1) ), "QuadtreeTUMaxDepthInter must be less than or equal to the difference between log2(maxCUSize) and QuadtreeTULog2MinSize plus 1" );
    1572 #endif
    15731548 
    15741549  xConfirmPara(  m_maxNumMergeCand < 1,  "MaxNumMergeCand must be 1 or greater.");
     
    16181593#endif
    16191594
    1620 #if !LAYER_CTB
    16211595  // max CU width and height should be power of 2
    16221596  UInt ui = m_uiMaxCUWidth;
     
    16341608      xConfirmPara( ui != 1 , "Height should be 2^n");
    16351609  }
    1636 #endif
     1610
    16371611
    16381612  /* if this is an intra-only sequence, ie IntraPeriod=1, don't verify the GOP structure
     
    20312005    Int m_iSourceWidth = m_acLayerCfg[layer].m_iSourceWidth;
    20322006    Int m_iSourceHeight = m_acLayerCfg[layer].m_iSourceHeight;
    2033 #if LAYER_CTB
    2034     Int m_uiMaxCUWidth = m_acLayerCfg[layer].m_uiMaxCUWidth;
    2035     Int m_uiMaxCUHeight = m_acLayerCfg[layer].m_uiMaxCUHeight;
    2036 #endif
    20372007#endif
    20382008  if(m_vuiParametersPresentFlag && m_bitstreamRestrictionFlag)
     
    22792249/** \todo use of global variables should be removed later
    22802250 */
    2281 #if LAYER_CTB
    2282 Void TAppEncCfg::xSetGlobal(UInt layerId)
    2283 {
    2284   // set max CU width & height
    2285   g_auiLayerMaxCUWidth[layerId]  = m_acLayerCfg[layerId].m_uiMaxCUWidth;
    2286   g_auiLayerMaxCUHeight[layerId] = m_acLayerCfg[layerId].m_uiMaxCUHeight;
    2287  
    2288   // compute actual CU depth with respect to config depth and max transform size
    2289   g_auiLayerAddCUDepth[layerId]  = 0;
    2290   while( (m_acLayerCfg[layerId].m_uiMaxCUWidth>>m_acLayerCfg[layerId].m_uiMaxCUDepth) > ( 1 << ( m_acLayerCfg[layerId].m_uiQuadtreeTULog2MinSize + g_auiLayerAddCUDepth[layerId] )  ) ) g_auiLayerAddCUDepth[layerId]++;
    2291  
    2292   m_acLayerCfg[layerId].m_uiMaxCUDepth += g_auiLayerAddCUDepth[layerId];
    2293   g_auiLayerAddCUDepth[layerId]++;
    2294   g_auiLayerMaxCUDepth[layerId] = m_acLayerCfg[layerId].m_uiMaxCUDepth;
    2295  
    2296   // set internal bit-depth and constants
    2297   g_bitDepthY = m_internalBitDepthY;
    2298   g_bitDepthC = m_internalBitDepthC;
    2299  
    2300   g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_inputBitDepthY : m_internalBitDepthY;
    2301   g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_inputBitDepthC : m_internalBitDepthC;
    2302 }
    2303 #else
    23042251Void TAppEncCfg::xSetGlobal()
    23052252{
     
    23162263  g_uiMaxCUDepth = m_uiMaxCUDepth;
    23172264 
    2318   // set internal bit-depth and constants
     2265#if O0194_DIFFERENT_BITDEPTH_EL_BL
     2266  // set internal bit-depth to constant value to make sure to be updated later
     2267  g_bitDepthY = -1;
     2268  g_bitDepthC = -1;
     2269 
     2270  g_uiPCMBitDepthLuma = -1;
     2271  g_uiPCMBitDepthChroma = -1;
     2272#else
    23192273  g_bitDepthY = m_internalBitDepthY;
    23202274  g_bitDepthC = m_internalBitDepthC;
     
    23222276  g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_inputBitDepthY : m_internalBitDepthY;
    23232277  g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_inputBitDepthC : m_internalBitDepthC;
     2278#endif
    23242279}
    2325 #endif
    23262280
    23272281Void TAppEncCfg::xPrintParameter()
     
    23772331    printf("Frame index                  : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded );
    23782332  }
    2379 #if !LAYER_CTB
    23802333  printf("CU size / depth              : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth );
    23812334  printf("RQT trans. size (min / max)  : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize );
    23822335  printf("Max RQT depth inter          : %d\n", m_uiQuadtreeTUMaxDepthInter);
    23832336  printf("Max RQT depth intra          : %d\n", m_uiQuadtreeTUMaxDepthIntra);
    2384 #endif
    23852337  printf("Min PCM size                 : %d\n", 1 << m_uiPCMLog2MinSize);
    23862338  printf("Motion search range          : %d\n", m_iSearchRange );
     
    23992351  printf("QP adaptation                : %d (range=%d)\n", m_bUseAdaptiveQP, (m_bUseAdaptiveQP ? m_iQPAdaptationRange : 0) );
    24002352  printf("GOP size                     : %d\n", m_iGOPSize );
     2353#if O0194_DIFFERENT_BITDEPTH_EL_BL
     2354  printf("Internal bit depth Layer0    : (Y:%d, C:%d)\n", m_acLayerCfg[0].m_internalBitDepthY, m_acLayerCfg[0].m_internalBitDepthC );
     2355  printf("Internal bit depth Layer1    : (Y:%d, C:%d)\n", m_acLayerCfg[1].m_internalBitDepthY, m_acLayerCfg[1].m_internalBitDepthC );
     2356#else
    24012357  printf("Internal bit depth           : (Y:%d, C:%d)\n", m_internalBitDepthY, m_internalBitDepthC );
     2358#endif
    24022359  printf("PCM sample bit depth         : (Y:%d, C:%d)\n", g_uiPCMBitDepthLuma, g_uiPCMBitDepthChroma );
    24032360#if O0215_PHASE_ALIGNMENT
     
    24292386 
    24302387  printf("TOOL CFG: ");
     2388#if O0194_DIFFERENT_BITDEPTH_EL_BL
     2389  printf("IBD0:%d ", g_bitDepthY > m_acLayerCfg[0].m_inputBitDepthY || g_bitDepthC > m_acLayerCfg[0].m_inputBitDepthC);
     2390  printf("IBD1:%d ", g_bitDepthY > m_acLayerCfg[1].m_inputBitDepthY || g_bitDepthC > m_acLayerCfg[1].m_inputBitDepthC);
     2391#else
    24312392  printf("IBD:%d ", g_bitDepthY > m_inputBitDepthY || g_bitDepthC > m_inputBitDepthC);
     2393#endif
    24322394  printf("HAD:%d ", m_bUseHADME           );
    24332395  printf("SRD:%d ", m_bUseSBACRD          );
     
    24602422  printf("CIP:%d ", m_bUseConstrainedIntraPred);
    24612423  printf("SAO:%d ", (m_bUseSAO)?(1):(0));
    2462 #if !LAYER_CTB
    24632424  printf("PCM:%d ", (m_usePCM && (1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0);
    2464 #endif
    24652425  printf("SAOLcuBasedOptimization:%d ", (m_saoLcuBasedOptimization)?(1):(0));
    24662426
     
    24942454  printf("RecalQP:%d", m_recalculateQPAccordingToLambda ? 1 : 0 );
    24952455#endif
     2456  printf("O0194_DIFFERENT_BITDEPTH_EL_BL: %d ", O0194_DIFFERENT_BITDEPTH_EL_BL);
     2457  printf("O0194_JOINT_US_BITSHIFT: %d ", O0194_JOINT_US_BITSHIFT);
     2458  printf("O0194_WEIGHTED_PREDICTION_CGS: %d ",O0194_WEIGHTED_PREDICTION_CGS);
     2459  printf("O0194_REPN_FORMAT_IN_VPS_BUGFIX: %d ",O0194_REPN_FORMAT_IN_VPS_BUGFIX);
    24962460  printf("\n\n");
    24972461 
     
    25082472}
    25092473
    2510 #if SVC_EXTENSION
     2474#if SCALED_REF_LAYER_OFFSETS
    25112475Void TAppEncCfg::cfgStringToArray(Int **arr, string cfgString, Int numEntries, const char* logString)
    25122476{
     
    25412505  }
    25422506}
     2507#endif
    25432508
    25442509#if FINAL_RPL_CHANGE_N0082
     
    27562721}
    27572722#endif
    2758 #endif //SVC_EXTENSION
    27592723//! \}
  • branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncCfg.h

    r464 r466  
    150150  Int       m_maxTempLayer;                                  ///< Max temporal layer
    151151
    152 #if !LAYER_CTB
    153152  // coding unit (CU) definition
    154153  UInt      m_uiMaxCUWidth;                                   ///< max. CU width in pixel
     
    162161  UInt      m_uiQuadtreeTUMaxDepthInter;
    163162  UInt      m_uiQuadtreeTUMaxDepthIntra;
    164 #endif
    165163 
    166164  // coding tools (bit-depth)
     165#if !O0194_DIFFERENT_BITDEPTH_EL_BL
    167166  Int       m_inputBitDepthY;                               ///< bit-depth of input file (luma component)
    168167  Int       m_inputBitDepthC;                               ///< bit-depth of input file (chroma component)
     
    171170  Int       m_internalBitDepthY;                            ///< bit-depth codec operates at in luma (input/output files will be converted)
    172171  Int       m_internalBitDepthC;                            ///< bit-depth codec operates at in chroma (input/output files will be converted)
    173 
     172#endif
    174173  // coding tools (PCM bit-depth)
    175174  Bool      m_bPCMInputBitDepthFlag;                          ///< 0: PCM bit-depth is internal bit-depth. 1: PCM bit-depth is input bit-depth.
     
    356355#endif
    357356  // internal member functions
    358 #if LAYER_CTB
    359   Void  xSetGlobal      (UInt layerId);                       ///< set global variables
    360 #else
    361357  Void  xSetGlobal      ();                                   ///< set global variables
    362 #endif
    363358  Void  xCheckParameter ();                                   ///< check validity of configuration values
    364359  Void  xPrintParameter ();                                   ///< print configuration values
     
    397392  Int  getNumLayer()               {return m_numLayers;        }
    398393  Int  getGOPSize()                {return m_iGOPSize;          }
     394#if O0194_DIFFERENT_BITDEPTH_EL_BL
     395  UInt getInternalBitDepthY(Int iLayer)      {return m_acLayerCfg[iLayer].m_internalBitDepthY; }
     396  UInt getInternalBitDepthC(Int iLayer)      {return m_acLayerCfg[iLayer].m_internalBitDepthC; }
     397#else
    399398  UInt getInternalBitDepthY()      {return m_internalBitDepthY; }
    400399  UInt getInternalBitDepthC()      {return m_internalBitDepthC; }
    401 #if !LAYER_CTB
     400#endif
    402401  UInt getMaxCUWidth()             {return m_uiMaxCUWidth;      }
    403402  UInt getMaxCUHeight()            {return m_uiMaxCUHeight;     }
    404403  UInt getMaxCUDepth()             {return m_uiMaxCUDepth;      }
    405 #endif
    406404  Int  getDecodingRefreshType()    {return m_iDecodingRefreshType; }
    407405  Int  getWaveFrontSynchro()        { return m_iWaveFrontSynchro; }
     
    410408  Char* getBLSyntaxFile()           { return m_BLSyntaxFile;      }
    411409#endif
     410#if SCALED_REF_LAYER_OFFSETS
    412411  Void cfgStringToArray(Int **arr, string cfgString, Int numEntries, const char* logString);
     412#endif
    413413#if REPN_FORMAT_IN_VPS
    414414  RepFormatCfg* getRepFormatCfg(Int i)  { return &m_repFormatCfg[i]; }
    415415#endif
    416 #if LAYER_CTB
    417   Bool getUsePCM()                  { return m_usePCM;               }
    418   UInt getPCMLog2MinSize  ()        { return  m_uiPCMLog2MinSize;    }
    419 #endif
    420416#endif
    421417};// END CLASS DEFINITION TAppEncCfg
  • branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncLayerCfg.cpp

    r448 r466  
    3838  m_confLeft = m_confRight = m_confTop = m_confBottom = 0;
    3939  m_aiPad[1] = m_aiPad[0] = 0;
     40#if SCALED_REF_LAYER_OFFSETS
    4041  m_numScaledRefLayerOffsets = 0;
    4142  ::memset(m_scaledRefLayerLeftOffset,   0, sizeof(m_scaledRefLayerLeftOffset));
     
    4344  ::memset(m_scaledRefLayerRightOffset,  0, sizeof(m_scaledRefLayerRightOffset));
    4445  ::memset(m_scaledRefLayerBottomOffset, 0, sizeof(m_scaledRefLayerBottomOffset));
     46#endif
    4547}
    4648
     
    140142  printf("Real     Format               : %dx%d %dHz\n", m_iSourceWidth - m_confLeft - m_confRight, m_iSourceHeight - m_confTop - m_confBottom, m_iFrameRate );
    141143  printf("Internal Format               : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate );
    142 #if LAYER_CTB
    143   printf("CU size / depth               : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth );
    144   printf("RQT trans. size (min / max)   : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize );
    145   printf("Max RQT depth inter           : %d\n", m_uiQuadtreeTUMaxDepthInter);
    146   printf("Max RQT depth intra           : %d\n", m_uiQuadtreeTUMaxDepthIntra);
    147 #endif
    148144  printf("QP                            : %5.2f\n", m_fQP );
    149145  printf("Intra period                  : %d\n", m_iIntraPeriod );
     
    161157#endif
    162158  printf("WaveFrontSynchro:%d WaveFrontSubstreams:%d", m_cAppEncCfg->getWaveFrontSynchro(), m_iWaveFrontSubstreams);
    163 #if LAYER_CTB
    164   printf("PCM:%d ", (m_cAppEncCfg->getUsePCM() && (1<<m_cAppEncCfg->getPCMLog2MinSize()) <= m_uiMaxCUWidth)? 1 : 0);
    165 #endif
    166159}
    167160
     
    182175    {
    183176      // automatic padding to minimum CU size
    184 #if LAYER_CTB
    185       Int minCuSize = m_uiMaxCUHeight >> (m_uiMaxCUDepth - 1);
    186 #else
    187177      Int minCuSize = m_cAppEncCfg->getMaxCUHeight() >> (m_cAppEncCfg->getMaxCUDepth() - 1);
    188 #endif
    189178      if (m_iSourceWidth % minCuSize)
    190179      {
     
    251240  }
    252241
    253 #if LAYER_CTB
    254   UInt maxCUWidth = m_uiMaxCUWidth;
    255   UInt maxCUHeight = m_uiMaxCUHeight;
    256   UInt maxCUDepth = m_uiMaxCUDepth;
    257 #else
    258242  UInt maxCUWidth = m_cAppEncCfg->getMaxCUWidth();
    259243  UInt maxCUHeight = m_cAppEncCfg->getMaxCUHeight();
    260244  UInt maxCUDepth = m_cAppEncCfg->getMaxCUDepth();
    261 #endif
    262245  bool check_failed = false; /* abort if there is a fatal configuration problem */
    263246#define xConfirmPara(a,b) check_failed |= confirmPara(a,b)
     
    272255  }
    273256
     257#if O0194_DIFFERENT_BITDEPTH_EL_BL
     258  for(UInt layer = 0; layer < MAX_LAYERS; layer++){
     259    xConfirmPara( m_iQP <  -6 * ((Int)m_cAppEncCfg->getInternalBitDepthY(layer) - 8) || m_iQP > 51,                "QP exceeds supported range (-QpBDOffsety to 51)" );
     260  }
     261#else
    274262  xConfirmPara( m_iQP <  -6 * ((Int)m_cAppEncCfg->getInternalBitDepthY() - 8) || m_iQP > 51,                "QP exceeds supported range (-QpBDOffsety to 51)" );
    275 
    276 
    277   m_iWaveFrontSubstreams = m_cAppEncCfg->getWaveFrontSynchro() ? (m_iSourceHeight + maxCUHeight - 1) / maxCUHeight : 1;
     263#endif
     264
     265
     266  m_iWaveFrontSubstreams = m_cAppEncCfg->getWaveFrontSynchro() ? (m_iSourceHeight + m_cAppEncCfg->getMaxCUHeight() - 1) / m_cAppEncCfg->getMaxCUHeight() : 1;
    278267  xConfirmPara( m_iWaveFrontSubstreams <= 0, "WaveFrontSubstreams must be positive" );
    279268  xConfirmPara( m_iWaveFrontSubstreams > 1 && !m_cAppEncCfg->getWaveFrontSynchro(), "Must have WaveFrontSynchro > 0 in order to have WaveFrontSubstreams > 1" );
     
    290279  xConfirmPara( m_confTop    % TComSPS::getWinUnitY(CHROMA_420) != 0, "Top conformance window offset must be an integer multiple of the specified chroma subsampling");
    291280  xConfirmPara( m_confBottom % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling");
    292 
    293 #if LAYER_CTB 
    294   xConfirmPara( (m_uiMaxCUWidth  >> m_uiMaxCUDepth) < 4,                                    "Minimum partition width size should be larger than or equal to 8");
    295   xConfirmPara( (m_uiMaxCUHeight >> m_uiMaxCUDepth) < 4,                                    "Minimum partition height size should be larger than or equal to 8");
    296   xConfirmPara( m_uiMaxCUWidth < 16,                                                        "Maximum partition width size should be larger than or equal to 16");
    297   xConfirmPara( m_uiMaxCUHeight < 16,                                                       "Maximum partition height size should be larger than or equal to 16");
    298   xConfirmPara( m_uiQuadtreeTULog2MinSize < 2,                                        "QuadtreeTULog2MinSize must be 2 or greater.");
    299   xConfirmPara( m_uiQuadtreeTULog2MaxSize > 5,                                        "QuadtreeTULog2MaxSize must be 5 or smaller.");
    300   xConfirmPara( (1<<m_uiQuadtreeTULog2MaxSize) > m_uiMaxCUWidth,                                        "QuadtreeTULog2MaxSize must be log2(maxCUSize) or smaller.");
    301   xConfirmPara( m_uiQuadtreeTULog2MaxSize < m_uiQuadtreeTULog2MinSize,                "QuadtreeTULog2MaxSize must be greater than or equal to m_uiQuadtreeTULog2MinSize.");
    302   xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUWidth >>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS
    303   xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUHeight>>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS
    304   xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUWidth  >> m_uiMaxCUDepth ), "Minimum CU width must be greater than minimum transform size." );
    305   xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUHeight >> m_uiMaxCUDepth ), "Minimum CU height must be greater than minimum transform size." );
    306   xConfirmPara( m_uiQuadtreeTUMaxDepthInter < 1,                                                         "QuadtreeTUMaxDepthInter must be greater than or equal to 1" );
    307   xConfirmPara( m_uiMaxCUWidth < ( 1 << (m_uiQuadtreeTULog2MinSize + m_uiQuadtreeTUMaxDepthInter - 1) ), "QuadtreeTUMaxDepthInter must be less than or equal to the difference between log2(maxCUSize) and QuadtreeTULog2MinSize plus 1" );
    308   xConfirmPara( m_uiQuadtreeTUMaxDepthIntra < 1,                                                         "QuadtreeTUMaxDepthIntra must be greater than or equal to 1" );
    309   xConfirmPara( m_uiMaxCUWidth < ( 1 << (m_uiQuadtreeTULog2MinSize + m_uiQuadtreeTUMaxDepthIntra - 1) ), "QuadtreeTUMaxDepthInter must be less than or equal to the difference between log2(maxCUSize) and QuadtreeTULog2MinSize plus 1" );
    310 
    311   // max CU width and height should be power of 2
    312   UInt ui = m_uiMaxCUWidth;
    313   while(ui)
    314   {
    315     ui >>= 1;
    316     if( (ui & 1) == 1)
    317       xConfirmPara( ui != 1 , "Width should be 2^n");
    318   }
    319   ui = m_uiMaxCUHeight;
    320   while(ui)
    321   {
    322     ui >>= 1;
    323     if( (ui & 1) == 1)
    324       xConfirmPara( ui != 1 , "Height should be 2^n");
    325   }
    326 #endif
    327 
    328281#undef xConfirmPara
    329282  return check_failed;
    330283}
    331284
    332 #endif //SVC_EXTENSION
     285#endif
    333286
    334287
  • branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncLayerCfg.h

    r448 r466  
    4343  Int       m_iIntraPeriod;                                   ///< period of I-slice (random access period)
    4444  Double    m_fQP;                                            ///< QP value of key-picture (floating point)
    45 #if SVC_EXTENSION
    4645#if VPS_EXTN_DIRECT_REF_LAYERS
    4746#if M0457_PREDICTION_INDICATIONS
     
    5655  Int       *m_predLayerIds;
    5756  Int       m_numActiveRefLayers;
    58 #endif
    59 
    60 #if LAYER_CTB
    61   // coding unit (CU) definition
    62   UInt      m_uiMaxCUWidth;                                   ///< max. CU width in pixel
    63   UInt      m_uiMaxCUHeight;                                  ///< max. CU height in pixel
    64   UInt      m_uiMaxCUDepth;                                   ///< max. CU depth
    65  
    66   // transfom unit (TU) definition
    67   UInt      m_uiQuadtreeTULog2MaxSize;
    68   UInt      m_uiQuadtreeTULog2MinSize;
    69  
    70   UInt      m_uiQuadtreeTUMaxDepthInter;
    71   UInt      m_uiQuadtreeTUMaxDepthIntra;
    7257#endif
    7358
     
    8570  Int       m_maxTidIlRefPicsPlus1;
    8671#endif
     72#if SVC_EXTENSION
    8773  Int       m_iWaveFrontSubstreams; //< If iWaveFrontSynchro, this is the number of substreams per frame (dependent tiles) or per tile (independent tiles).
    88 #endif //SVC_EXTENSION
     74#endif
    8975
    9076  Int       m_iQP;                                            ///< QP value of key-picture (integer)
     
    9278  Int*      m_aidQP;                                          ///< array of slice QP values
    9379  TAppEncCfg* m_cAppEncCfg;                                   ///< pointer to app encoder config
    94 #if SVC_EXTENSION
     80#if SCALED_REF_LAYER_OFFSETS
    9581  Int       m_numScaledRefLayerOffsets  ;
    9682  Int       m_scaledRefLayerLeftOffset  [MAX_LAYERS];
     
    9884  Int       m_scaledRefLayerRightOffset [MAX_LAYERS];
    9985  Int       m_scaledRefLayerBottomOffset[MAX_LAYERS];
     86#endif 
    10087#if FINAL_RPL_CHANGE_N0082
    10188  GOPEntry  m_GOPListLayer[MAX_GOP];                            ///< for layer
     89#endif
     90#if O0194_DIFFERENT_BITDEPTH_EL_BL
     91  Int       m_inputBitDepthY;                               ///< bit-depth of input file (luma component)
     92  Int       m_inputBitDepthC;                               ///< bit-depth of input file (chroma component)
     93  Int       m_internalBitDepthY;                            ///< bit-depth codec operates at in luma (input/output files will be converted)
     94  Int       m_internalBitDepthC;                            ///< bit-depth codec operates at in chroma (input/output files will be converted)
     95  Int       m_outputBitDepthY;                              ///< bit-depth of output file (luma component)
     96  Int       m_outputBitDepthC;                              ///< bit-depth of output file (chroma component)
    10297#endif
    10398#if REPN_FORMAT_IN_VPS
    10499  Int       m_repFormatIdx;
    105100#endif
    106 #endif //SVC_EXTENSION
    107101public:
    108102  TAppEncLayerCfg();
     
    139133  Int     getIntQP()                  {return m_iQP;              }
    140134  Int*    getdQPs()                   {return m_aidQP;            }
    141 #if SVC_EXTENSION
    142135#if VPS_EXTN_DIRECT_REF_LAYERS
    143136#if M0457_PREDICTION_INDICATIONS
     
    178171#if N0120_MAX_TID_REF_CFG
    179172  Int     getMaxTidIlRefPicsPlus1()   { return m_maxTidIlRefPicsPlus1; }
    180 #endif
    181 #if LAYER_CTB
    182   UInt getMaxCUWidth()             {return m_uiMaxCUWidth;      }
    183   UInt getMaxCUHeight()            {return m_uiMaxCUHeight;     }
    184   UInt getMaxCUDepth()             {return m_uiMaxCUDepth;      }
    185 #endif
    186 #endif //SVC_EXTENSION
     173#endif
    187174}; // END CLASS DEFINITION TAppEncLayerCfg
    188175
  • branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncTop.cpp

    r464 r466  
    22 * License, included below. This software may be subject to other third party
    33 * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license. 
     4 * granted under this license.
    55 *
    66 * Copyright (c) 2010-2013, ITU/ISO/IEC
     
    117117    }
    118118
    119     assert( m_acLayerCfg[layer].getRepFormatIdx() != -1 && "RepFormatIdx not assigned for a layer" );   
     119    assert( m_acLayerCfg[layer].getRepFormatIdx() != -1 && "RepFormatIdx not assigned for a layer" );
    120120    vps->setVpsRepFormatIdx( layer, m_acLayerCfg[layer].getRepFormatIdx() );
    121121    maxRepFormatIdx = std::max( m_acLayerCfg[layer].getRepFormatIdx(), maxRepFormatIdx );
     
    141141  for(UInt idx=0; idx < vps->getVpsNumRepFormats(); idx++)
    142142  {
    143     RepFormat *repFormat = vps->getVpsRepFormat( idx );   
     143    RepFormat *repFormat = vps->getVpsRepFormat( idx );
    144144    repFormat->setPicWidthVpsInLumaSamples  ( m_acLayerCfg[mapIdxToLayer[idx]].getSourceWidth()   );
    145145    repFormat->setPicHeightVpsInLumaSamples ( m_acLayerCfg[mapIdxToLayer[idx]].getSourceHeight()  );
    146146    repFormat->setChromaFormatVpsIdc        ( 1                                             );  // Need modification to change for each layer - corresponds to 420
    147147    repFormat->setSeparateColourPlaneVpsFlag( 0                                             );  // Need modification to change for each layer
     148#if O0194_REPN_FORMAT_IN_VPS_BUGFIX
     149    repFormat->setBitDepthVpsLuma           ( getInternalBitDepthY(mapIdxToLayer[idx])      );  // Need modification to change for each layer
     150    repFormat->setBitDepthVpsChroma         ( getInternalBitDepthC(mapIdxToLayer[idx])      );  // Need modification to change for each layer
     151#else
    148152    repFormat->setBitDepthVpsLuma           ( getInternalBitDepthY()                        );  // Need modification to change for each layer
    149153    repFormat->setBitDepthVpsChroma         ( getInternalBitDepthC()                        );  // Need modification to change for each layer
     154#endif
    150155  }
    151156  delete [] mapIdxToLayer;
     
    153158  for(UInt layer=0; layer<m_numLayers; layer++)
    154159  {
     160#if O0194_DIFFERENT_BITDEPTH_EL_BL
     161    //1
     162    g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
     163    g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
     164
     165    g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
     166    g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     167
     168    // Set this to be used in Upsampling filter in function "TComUpsampleFilter::upsampleBasePic"
     169    g_bitDepthYLayer[layer] = g_bitDepthY;
     170    g_bitDepthCLayer[layer] = g_bitDepthC;
     171#endif
    155172    //m_acTEncTop[layer].setVPS(&vps);
    156173    m_acTEncTop[layer].setFrameRate                    ( m_acLayerCfg[layer].getFrameRate() );
     
    187204#endif
    188205#endif
    189     // set layer ID 
    190     m_acTEncTop[layer].setLayerId ( layer ); 
     206    // set layer ID
     207    m_acTEncTop[layer].setLayerId ( layer );
    191208    m_acTEncTop[layer].setNumLayer ( m_numLayers );
    192209    m_acTEncTop[layer].setLayerEnc(m_apcTEncTop);
     
    220237    if (layer<m_numLayers-1)
    221238    {
    222        m_acTEncTop[layer].setMaxTidIlRefPicsPlus1 ( m_acLayerCfg[layer].getMaxTidIlRefPicsPlus1()); 
    223     }
    224 #endif 
     239       m_acTEncTop[layer].setMaxTidIlRefPicsPlus1 ( m_acLayerCfg[layer].getMaxTidIlRefPicsPlus1());
     240    }
     241#endif
    225242#if VPS_EXTN_DIRECT_REF_LAYERS
    226243    if(layer)
     
    241258      else
    242259      {
    243         m_acTEncTop[layer].setNumSamplePredRefLayers   ( m_acLayerCfg[layer].getNumSamplePredRefLayers() );     
     260        m_acTEncTop[layer].setNumSamplePredRefLayers   ( m_acLayerCfg[layer].getNumSamplePredRefLayers() );
    244261        for(Int i = 0; i < m_acTEncTop[layer].getNumSamplePredRefLayers(); i++)
    245262        {
    246263          m_acTEncTop[layer].setSamplePredRefLayerId   ( i, m_acLayerCfg[layer].getSamplePredRefLayerId(i));
    247264          m_acTEncTop[layer].setSamplePredEnabledFlag  (m_acLayerCfg[layer].getSamplePredRefLayerId(i), true);
    248         }       
     265        }
    249266      }
    250267      if(m_acLayerCfg[layer].getNumMotionPredRefLayers() == -1)
     
    257274      else
    258275      {
    259         m_acTEncTop[layer].setNumMotionPredRefLayers   ( m_acLayerCfg[layer].getNumMotionPredRefLayers() );     
     276        m_acTEncTop[layer].setNumMotionPredRefLayers   ( m_acLayerCfg[layer].getNumMotionPredRefLayers() );
    260277        for(Int i = 0; i < m_acTEncTop[layer].getNumMotionPredRefLayers(); i++)
    261278        {
    262279          m_acTEncTop[layer].setMotionPredRefLayerId   ( i, m_acLayerCfg[layer].getMotionPredRefLayerId(i));
    263280          m_acTEncTop[layer].setMotionPredEnabledFlag  (m_acLayerCfg[layer].getMotionPredRefLayerId(i), true);
    264         }       
     281        }
    265282      }
    266283      Int numDirectRefLayers = 0;
     
    283300      else
    284301      {
    285         m_acTEncTop[layer].setNumDirectRefLayers       ( m_acLayerCfg[layer].getNumDirectRefLayers() );     
     302        m_acTEncTop[layer].setNumDirectRefLayers       ( m_acLayerCfg[layer].getNumDirectRefLayers() );
    286303        for(Int i = 0; i < m_acTEncTop[layer].getNumDirectRefLayers(); i++)
    287304        {
     
    304321      else
    305322      {
    306         m_acTEncTop[layer].setNumActiveRefLayers       ( m_acLayerCfg[layer].getNumActiveRefLayers() );     
     323        m_acTEncTop[layer].setNumActiveRefLayers       ( m_acLayerCfg[layer].getNumActiveRefLayers() );
    307324        for(Int i = 0; i < m_acTEncTop[layer].getNumActiveRefLayers(); i++)
    308325        {
     
    358375    m_acTEncTop[layer].setUseRDOQTS                    ( m_useRDOQTS   );
    359376    m_acTEncTop[layer].setRDpenalty                    ( m_rdPenalty );
    360 #if LAYER_CTB
    361     m_acTEncTop[layer].setQuadtreeTULog2MaxSize        ( m_acLayerCfg[layer].m_uiQuadtreeTULog2MaxSize );
    362     m_acTEncTop[layer].setQuadtreeTULog2MinSize        ( m_acLayerCfg[layer].m_uiQuadtreeTULog2MinSize );
    363     m_acTEncTop[layer].setQuadtreeTUMaxDepthInter      ( m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthInter );
    364     m_acTEncTop[layer].setQuadtreeTUMaxDepthIntra      ( m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthIntra );
    365 #else
    366377    m_acTEncTop[layer].setQuadtreeTULog2MaxSize        ( m_uiQuadtreeTULog2MaxSize );
    367378    m_acTEncTop[layer].setQuadtreeTULog2MinSize        ( m_uiQuadtreeTULog2MinSize );
    368379    m_acTEncTop[layer].setQuadtreeTUMaxDepthInter      ( m_uiQuadtreeTUMaxDepthInter );
    369380    m_acTEncTop[layer].setQuadtreeTUMaxDepthIntra      ( m_uiQuadtreeTUMaxDepthIntra );
    370 #endif
    371381    m_acTEncTop[layer].setUseFastEnc                   ( m_bUseFastEnc  );
    372     m_acTEncTop[layer].setUseEarlyCU                   ( m_bUseEarlyCU  ); 
     382    m_acTEncTop[layer].setUseEarlyCU                   ( m_bUseEarlyCU  );
    373383    m_acTEncTop[layer].setUseFastDecisionForMerge      ( m_useFastDecisionForMerge  );
    374384    m_acTEncTop[layer].setUseCbfFastMode               ( m_bUseCbfFastMode  );
     
    390400    m_acTEncTop[layer].setUseWP                   ( m_useWeightedPred      );
    391401    m_acTEncTop[layer].setWPBiPred                ( m_useWeightedBiPred   );
     402#if O0194_WEIGHTED_PREDICTION_CGS
     403    if (layer!=0){
     404      // Enable weighted prediction for enhancement layer
     405      m_acTEncTop[layer].setUseWP                 ( true   );
     406      m_acTEncTop[layer].setWPBiPred              ( true   );
     407    }
     408#endif
    392409    //====== Parallel Merge Estimation ========
    393410    m_acTEncTop[layer].setLog2ParallelMergeLevelMinus2 ( m_log2ParallelMergeLevel - 2 );
     
    400417    m_acTEncTop[layer].setSliceSegmentMode        ( m_sliceSegmentMode         );
    401418    m_acTEncTop[layer].setSliceSegmentArgument    ( m_sliceSegmentArgument     );
    402 #if LAYER_CTB
    403     Int iNumPartInCU = 1<<(m_acLayerCfg[layer].m_uiMaxCUDepth<<1);
    404 #else
    405419    Int iNumPartInCU = 1<<(m_uiMaxCUDepth<<1);
    406 #endif
    407420    if(m_sliceSegmentMode==FIXED_NUMBER_OF_LCU)
    408421    {
     
    428441    m_acTEncTop[layer].setSaoLcuBoundary (m_saoLcuBoundary);
    429442    m_acTEncTop[layer].setSaoLcuBasedOptimization (m_saoLcuBasedOptimization);
    430     m_acTEncTop[layer].setPCMInputBitDepthFlag  ( m_bPCMInputBitDepthFlag); 
    431     m_acTEncTop[layer].setPCMFilterDisableFlag  ( m_bPCMFilterDisableFlag); 
     443    m_acTEncTop[layer].setPCMInputBitDepthFlag  ( m_bPCMInputBitDepthFlag);
     444    m_acTEncTop[layer].setPCMFilterDisableFlag  ( m_bPCMFilterDisableFlag);
    432445
    433446    m_acTEncTop[layer].setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled);
     
    494507    if(uiTilesCount == 1)
    495508    {
    496       m_bLFCrossTileBoundaryFlag = true; 
     509      m_bLFCrossTileBoundaryFlag = true;
    497510    }
    498511    m_acTEncTop[layer].setLFCrossTileBoundaryFlag( m_bLFCrossTileBoundaryFlag );
     
    530543    m_acTEncTop[layer].setUseRecalculateQPAccordingToLambda( m_recalculateQPAccordingToLambda );
    531544    m_acTEncTop[layer].setUseStrongIntraSmoothing( m_useStrongIntraSmoothing );
    532     m_acTEncTop[layer].setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled ); 
     545    m_acTEncTop[layer].setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled );
    533546    m_acTEncTop[layer].setVuiParametersPresentFlag( m_vuiParametersPresentFlag );
    534547    m_acTEncTop[layer].setAspectRatioIdc( m_aspectRatioIdc );
     
    561574    m_acTEncTop[layer].setLog2MaxMvLengthVertical( m_log2MaxMvLengthVertical );
    562575    m_acTEncTop[layer].setElRapSliceTypeB(layer == 0? 0 : m_elRapSliceBEnabled);
     576#if SCALED_REF_LAYER_OFFSETS
    563577    if( layer > 0 )
    564578    {
     
    567581      {
    568582        m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow( 2*m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i],
    569                                                   2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i]); 
    570       }
    571     }
     583                                                  2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i]);
     584      }
     585    }
     586#endif
    572587#if M0040_ADAPTIVE_RESOLUTION_CHANGE
    573588    m_acTEncTop[layer].setAdaptiveResolutionChange( m_adaptiveResolutionChange );
     
    575590  }
    576591}
    577 #else //SVC_EXTENSION
     592#else
    578593Void TAppEncTop::xInitLibCfg()
    579594{
     
    680695  m_cTEncTop.setQuadtreeTUMaxDepthIntra      ( m_uiQuadtreeTUMaxDepthIntra );
    681696  m_cTEncTop.setUseFastEnc                   ( m_bUseFastEnc  );
    682   m_cTEncTop.setUseEarlyCU                   ( m_bUseEarlyCU  ); 
     697  m_cTEncTop.setUseEarlyCU                   ( m_bUseEarlyCU  );
    683698  m_cTEncTop.setUseFastDecisionForMerge      ( m_useFastDecisionForMerge  );
    684699  m_cTEncTop.setUseCbfFastMode            ( m_bUseCbfFastMode  );
     
    734749  m_cTEncTop.setSaoLcuBoundary (m_saoLcuBoundary);
    735750  m_cTEncTop.setSaoLcuBasedOptimization (m_saoLcuBasedOptimization);
    736   m_cTEncTop.setPCMInputBitDepthFlag  ( m_bPCMInputBitDepthFlag); 
    737   m_cTEncTop.setPCMFilterDisableFlag  ( m_bPCMFilterDisableFlag); 
     751  m_cTEncTop.setPCMInputBitDepthFlag  ( m_bPCMInputBitDepthFlag);
     752  m_cTEncTop.setPCMFilterDisableFlag  ( m_bPCMFilterDisableFlag);
    738753
    739754  m_cTEncTop.setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled);
     
    792807  if(uiTilesCount == 1)
    793808  {
    794     m_bLFCrossTileBoundaryFlag = true; 
     809    m_bLFCrossTileBoundaryFlag = true;
    795810  }
    796811  m_cTEncTop.setLFCrossTileBoundaryFlag( m_bLFCrossTileBoundaryFlag );
     
    818833  m_cTEncTop.setUseRecalculateQPAccordingToLambda( m_recalculateQPAccordingToLambda );
    819834  m_cTEncTop.setUseStrongIntraSmoothing( m_useStrongIntraSmoothing );
    820   m_cTEncTop.setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled ); 
     835  m_cTEncTop.setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled );
    821836  m_cTEncTop.setVuiParametersPresentFlag( m_vuiParametersPresentFlag );
    822837  m_cTEncTop.setAspectRatioIdc( m_aspectRatioIdc );
     
    849864  m_cTEncTop.setLog2MaxMvLengthVertical( m_log2MaxMvLengthVertical );
    850865}
    851 #endif //SVC_EXTENSION
     866#endif
    852867
    853868Void TAppEncTop::xCreateLib()
     
    860875  for(UInt layer=0; layer<m_numLayers; layer++)
    861876  {
    862 #if LAYER_CTB
    863     g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
    864     g_uiMaxCUHeight = g_auiLayerMaxCUHeight[layer];
    865     g_uiMaxCUDepth  = g_auiLayerMaxCUDepth[layer];
    866     g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
    867 #endif
     877#if O0194_DIFFERENT_BITDEPTH_EL_BL
     878    //2
     879    g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
     880    g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
     881
     882    g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
     883    g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     884#endif
     885#if O0194_DIFFERENT_BITDEPTH_EL_BL
     886    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
     887#else
    868888    m_acTVideoIOYuvInputFile[layer].open( (Char *)m_acLayerCfg[layer].getInputFile().c_str(),  false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC );  // read  mode
     889#endif
    869890    m_acTVideoIOYuvInputFile[layer].skipFrames(m_FrameSkip, m_acLayerCfg[layer].getSourceWidth() - m_acLayerCfg[layer].getPad()[0], m_acLayerCfg[layer].getSourceHeight() - m_acLayerCfg[layer].getPad()[1]);
    870891
    871892    if (!m_acLayerCfg[layer].getReconFile().empty())
    872893    {
     894#if O0194_DIFFERENT_BITDEPTH_EL_BL
     895      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
     896#else
    873897      m_acTVideoIOYuvReconFile[layer].open((Char *)m_acLayerCfg[layer].getReconFile().c_str(), true, m_outputBitDepthY, m_outputBitDepthC, m_internalBitDepthY, m_internalBitDepthC );  // write mode
     898#endif
    874899    }
    875900
    876901    m_acTEncTop[layer].create();
    877902  }
    878 #else //SVC_EXTENSION
     903#else
    879904  m_cTVideoIOYuvInputFile.open( m_pchInputFile,     false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC );  // read  mode
    880905  m_cTVideoIOYuvInputFile.skipFrames(m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1]);
     
    885910  // Neo Decoder
    886911  m_cTEncTop.create();
    887 #endif //SVC_EXTENSION
     912#endif
    888913}
    889914
     
    897922  for(UInt layer=0; layer<m_numLayers; layer++)
    898923  {
    899 #if LAYER_CTB
    900     g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
    901     g_uiMaxCUHeight = g_auiLayerMaxCUHeight[layer];
    902     g_uiMaxCUDepth  = g_auiLayerMaxCUDepth[layer];
    903     g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
    904 #endif
    905 
    906924    m_acTVideoIOYuvInputFile[layer].close();
    907925    m_acTVideoIOYuvReconFile[layer].close();
     
    909927    m_acTEncTop[layer].destroy();
    910928  }
    911 #else //SVC_EXTENSION
     929#else
    912930  m_cTVideoIOYuvInputFile.close();
    913931  m_cTVideoIOYuvReconFile.close();
     
    915933  // Neo Decoder
    916934  m_cTEncTop.destroy();
    917 #endif //SVC_EXTENSION
     935#endif
    918936}
    919937
     
    923941  for(UInt layer=0; layer<m_numLayers; layer++)
    924942  {
    925 #if LAYER_CTB
    926     g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
    927     g_uiMaxCUHeight = g_auiLayerMaxCUHeight[layer];
    928     g_uiMaxCUDepth  = g_auiLayerMaxCUDepth[layer];
    929     g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
    930        
    931     memcpy( g_auiZscanToRaster, g_auiLayerZscanToRaster[layer], sizeof( g_auiZscanToRaster ) );
    932     memcpy( g_auiRasterToZscan, g_auiLayerRasterToZscan[layer], sizeof( g_auiRasterToZscan ) );
    933     memcpy( g_auiRasterToPelX,  g_auiLayerRasterToPelX[layer],  sizeof( g_auiRasterToPelX ) );
    934     memcpy( g_auiRasterToPelY,  g_auiLayerRasterToPelY[layer],  sizeof( g_auiRasterToPelY ) );
     943#if O0194_DIFFERENT_BITDEPTH_EL_BL
     944    //3
     945    g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
     946    g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
     947
     948    g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
     949    g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
    935950#endif
    936951    m_acTEncTop[layer].init(isFieldCoding);
     
    948963    for(Int layerId = 0; layerId <= vps->getMaxLayerId(); layerId++)
    949964    {
     965#if O0194_DIFFERENT_BITDEPTH_EL_BL
     966      //4
     967      g_bitDepthY = m_acLayerCfg[layerId].m_internalBitDepthY;
     968      g_bitDepthC = m_acLayerCfg[layerId].m_internalBitDepthC;
     969
     970      g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepthY : m_acLayerCfg[layerId].m_internalBitDepthY;
     971      g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepthC : m_acLayerCfg[layerId].m_internalBitDepthC;
     972#endif
    950973      vps->setLayerIdIncludedFlag(true, setId, layerId);
    951974    }
     
    963986    vps->setScalabilityMask(i, false);
    964987  }
    965   if(m_numLayers > 1) 
     988  if(m_numLayers > 1)
    966989  {
    967990    Int scalabilityTypes = 0;
     
    9961019#if N0120_MAX_TID_REF_CFG
    9971020  vps->setMaxTidRefPresentFlag(m_maxTidRefPresentFlag);
    998 #else 
     1021#else
    9991022  vps->setMaxTidRefPresentFlag(true);
    1000 #endif 
     1023#endif
    10011024  if (vps->getMaxTidRefPresentFlag())
    10021025  {
     
    10041027    {
    10051028#if N0120_MAX_TID_REF_CFG
    1006       vps->setMaxTidIlRefPicsPlus1(i, m_acTEncTop[i].getMaxTidIlRefPicsPlus1()); 
    1007 #else 
     1029      vps->setMaxTidIlRefPicsPlus1(i, m_acTEncTop[i].getMaxTidIlRefPicsPlus1());
     1030#else
    10081031      vps->setMaxTidIlRefPicsPlus1(i, vps->getMaxTLayers()+1);
    1009 #endif 
     1032#endif
    10101033    }
    10111034  }
     
    10171040    }
    10181041  }
    1019 #endif 
     1042#endif
    10201043#if ILP_SSH_SIG
    10211044#if ILP_SSH_SIG_FIX
     
    10351058#endif
    10361059  // Target output layer
    1037   vps->setNumOutputLayerSets(vps->getNumLayerSets());   
    1038   vps->setNumProfileTierLevel(vps->getNumLayerSets());   
     1060#if VPS_PROFILE_OUTPUT_LAYERS
     1061  vps->setNumOutputLayerSets(vps->getNumLayerSets());
     1062  vps->setNumProfileTierLevel(vps->getNumLayerSets());
    10391063  vps->setDefaultOneTargetOutputLayerFlag(true);
    10401064  for(i = 1; i < vps->getNumLayerSets(); i++)
    10411065  {
    10421066    vps->setProfileLevelTierIdx(i, i);
    1043     vps->setOutputLayerSetIdx(i, i);
    1044   }
    1045 
     1067    vps->setOutputLayerSetIdx(i, i);
     1068  }
     1069#else
     1070  vps->setNumOutputLayerSets(1);
     1071  Int lsIdx = 1;
     1072  vps->setOutputLayerSetIdx(0, lsIdx); // Because only one layer set
     1073#endif
    10461074  for(Int lsIdx = 1; lsIdx < vps->getNumLayerSets(); lsIdx++)
    10471075  {
    1048     // Include the highest layer as output layer 
     1076    // Include the highest layer as output layer
    10491077    for(UInt layer=0; layer <= vps->getMaxLayerId() ; layer++)
    10501078    {
     
    11051133#endif
    11061134#endif
    1107 #if JCTVC_M0458_INTERLAYER_RPS_SIG       
    1108     vps->setMaxOneActiveRefLayerFlag(maxDirectRefLayers > 1 ? false : true); 
    1109 #endif 
    1110 #if N0147_IRAP_ALIGN_FLAG   
    1111     vps->setCrossLayerIrapAlignFlag(true); 
     1135#if JCTVC_M0458_INTERLAYER_RPS_SIG
     1136    vps->setMaxOneActiveRefLayerFlag(maxDirectRefLayers > 1 ? false : true);
     1137#endif
     1138#if N0147_IRAP_ALIGN_FLAG
     1139    vps->setCrossLayerIrapAlignFlag(true);
    11121140    for(UInt layerCtr = 1;layerCtr <= vps->getMaxLayers() - 1; layerCtr++)
    11131141    {
     
    11151143      {
    11161144        if (vps->getDirectDependencyFlag( layerCtr, refLayerCtr))
    1117         {         
     1145        {
    11181146          if(m_acTEncTop[layerCtr].getIntraPeriod() !=  m_acTEncTop[refLayerCtr].getIntraPeriod())
    11191147          {
     
    11291157      vps->setCrossLayerIrapAlignFlag(false);
    11301158    }
    1131 #endif 
     1159#endif
    11321160#if M0040_ADAPTIVE_RESOLUTION_CHANGE
    11331161  vps->setSingleLayerForNonIrapFlag(m_adaptiveResolutionChange > 0 ? true : false);
     
    11871215  for(UInt layer=0; layer<m_numLayers; layer++)
    11881216  {
     1217#if O0194_DIFFERENT_BITDEPTH_EL_BL
     1218    //5
     1219    g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
     1220    g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
     1221
     1222    g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
     1223    g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     1224#endif
    11891225    // allocate original YUV buffer
    11901226    pcPicYuvOrg[layer] = new TComPicYuv;
     
    11921228    {
    11931229#if SVC_UPSAMPLING
    1194 #if LAYER_CTB
    1195       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 );
    1196 #else
    11971230      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    1198 #endif
    11991231#else
    12001232      pcPicYuvOrg->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     
    12041236    {
    12051237#if SVC_UPSAMPLING
    1206 #if LAYER_CTB
    1207       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 );
    1208 #else
    12091238      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    1210 #endif
    12111239#else
    12121240      pcPicYuvOrg->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     
    12371265  while ( !bEos )
    12381266  {
    1239     // Read enough frames 
     1267    // Read enough frames
    12401268    Bool bFramesReadyToCode = false;
    12411269    while(!bFramesReadyToCode)
     
    12431271      for(UInt layer=0; layer<m_numLayers; layer++)
    12441272      {
    1245 #if LAYER_CTB
    1246         g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
    1247         g_uiMaxCUHeight = g_auiLayerMaxCUHeight[layer];
    1248         g_uiMaxCUDepth  = g_auiLayerMaxCUDepth[layer];
    1249         g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
    1250 #endif
    1251 
     1273#if O0194_DIFFERENT_BITDEPTH_EL_BL
     1274        //6
     1275        g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
     1276        g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
     1277
     1278        g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
     1279        g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     1280#endif
    12521281        // get buffers
    12531282        xGetBuffer(pcPicYuvRec, layer);
     
    13111340#endif
    13121341
    1313     // loop through frames in one GOP 
     1342    // loop through frames in one GOP
    13141343    for ( UInt iPicIdInGOP=0; iPicIdInGOP < (bFirstFrame? 1:m_iGOPSize); iPicIdInGOP++ )
    13151344    {
     
    13171346      for(UInt layer=0; layer<m_numLayers; layer++)
    13181347      {
    1319 #if LAYER_CTB
    1320         g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
    1321         g_uiMaxCUHeight = g_auiLayerMaxCUHeight[layer];
    1322         g_uiMaxCUDepth  = g_auiLayerMaxCUDepth[layer];
    1323         g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
    1324 
    1325         memcpy( g_auiZscanToRaster, g_auiLayerZscanToRaster[layer], sizeof( g_auiZscanToRaster ) );
    1326         memcpy( g_auiRasterToZscan, g_auiLayerRasterToZscan[layer], sizeof( g_auiRasterToZscan ) );
    1327         memcpy( g_auiRasterToPelX,  g_auiLayerRasterToPelX[layer],  sizeof( g_auiRasterToPelX ) );
    1328         memcpy( g_auiRasterToPelY,  g_auiLayerRasterToPelY[layer],  sizeof( g_auiRasterToPelY ) );
     1348#if O0194_DIFFERENT_BITDEPTH_EL_BL
     1349        //7
     1350        g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
     1351        g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
     1352
     1353        g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
     1354        g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
    13291355#endif
    13301356        // call encoding function for one frame
     
    13531379    for(UInt layer=0; layer<m_numLayers; layer++)
    13541380    {
     1381#if O0194_DIFFERENT_BITDEPTH_EL_BL
     1382      //8
     1383      g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
     1384      g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
     1385
     1386      g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
     1387      g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     1388#endif
    13551389      // write bistream to file if necessary
    13561390      iNumEncoded = m_acTEncTop[layer].getNumPicRcvd();
     
    15931627
    15941628#if SVC_UPSAMPLING
    1595 #if LAYER_CTB
    1596     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 );
    1597 #else
    15981629    rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    1599 #endif
    16001630#else
    16011631    rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     
    16201650      delete pcPicYuvRec; pcPicYuvRec = NULL;
    16211651    }
    1622   } 
     1652  }
    16231653}
    16241654
     
    16711701#endif
    16721702      {
    1673         m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getConfLeft(), m_acLayerCfg[layer].getConfRight(), 
     1703        m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getConfLeft(), m_acLayerCfg[layer].getConfRight(),
    16741704          m_acLayerCfg[layer].getConfTop(), m_acLayerCfg[layer].getConfBottom() );
    16751705      }
     
    16911721    for ( i = 0; i < iNumEncoded/2; i++ )
    16921722#endif
    1693     {     
     1723    {
    16941724      const AccessUnit& auTop = *(iterBitstream++);
    16951725      const vector<UInt>& statsTop = writeAnnexB(bitstreamFile, auTop);
  • branches/SHM-4.0-dev/source/Lib/TLibCommon/CommonDef.h

    r442 r466  
    130130extern Int g_bitDepthY;
    131131extern Int g_bitDepthC;
    132 
     132#if O0194_DIFFERENT_BITDEPTH_EL_BL
     133extern Int  g_bitDepthYLayer[MAX_LAYERS];
     134extern Int  g_bitDepthCLayer[MAX_LAYERS];
     135
     136extern UInt g_uiPCMBitDepthLumaDec[MAX_LAYERS];    // PCM bit-depth
     137extern UInt g_uiPCMBitDepthChromaDec[MAX_LAYERS];    // PCM bit-depth
     138#endif
     139#if O0194_WEIGHTED_PREDICTION_CGS
     140extern void* g_refWeightACDCParam; //type:wpACDCParam
     141#endif
    133142/** clip x, such that 0 <= x <= #g_maxLumaVal */
    134143template <typename T> inline T ClipY(T x) { return std::min<T>(T((1 << g_bitDepthY)-1), std::max<T>( T(0), x)); }
  • branches/SHM-4.0-dev/source/Lib/TLibCommon/TComDataCU.cpp

    r448 r466  
    40044004  uiPelY = (UInt)Clip3<UInt>(0, m_pcPic->getPicYuvRec()->getHeight() - 1, uiPelY);
    40054005
    4006 #if !LAYER_CTB
    40074006  UInt uiMinUnitSize = m_pcPic->getMinCUWidth();
    4008 #endif
    4009 
     4007
     4008#if SCALED_REF_LAYER_OFFSETS
    40104009  Int leftStartL = this->getSlice()->getSPS()->getScaledRefLayerWindow(refLayerIdc).getWindowLeftOffset();
    40114010  Int topStartL  = this->getSlice()->getSPS()->getScaledRefLayerWindow(refLayerIdc).getWindowTopOffset();
    40124011  Int iBX = ((uiPelX - leftStartL)*g_posScalingFactor[refLayerIdc][0] + (1<<15)) >> 16;
    40134012  Int iBY = ((uiPelY - topStartL )*g_posScalingFactor[refLayerIdc][1] + (1<<15)) >> 16;
     4013#else
     4014  Int iBX = (uiPelX*g_posScalingFactor[refLayerIdc][0] + (1<<15)) >> 16;
     4015  Int iBY = (uiPelY*g_posScalingFactor[refLayerIdc][1] + (1<<15)) >> 16;
     4016#endif
    40144017
    40154018#if N0139_POSITION_ROUNDING_OFFSET
     
    40214024#endif
    40224025
     4026#if SCALED_REF_LAYER_OFFSETS
    40234027  if ( iBX >= cBaseColPic->getPicYuvRec()->getWidth() || iBY >= cBaseColPic->getPicYuvRec()->getHeight() ||
    40244028       iBX < 0                                        || iBY < 0                                           )
     4029#else
     4030  if ( iBX >= cBaseColPic->getPicYuvRec()->getWidth() || iBY >= cBaseColPic->getPicYuvRec()->getHeight())
     4031#endif
    40254032  {
    40264033    return NULL;
    40274034  }
    40284035
    4029 #if LAYER_CTB
    4030   UInt baseMaxCUHeight = cBaseColPic->getPicSym()->getMaxCUHeight();
    4031   UInt baseMaxCUWidth  = cBaseColPic->getPicSym()->getMaxCUWidth();
    4032   UInt baseMinUnitSize = cBaseColPic->getMinCUWidth();
    4033  
    4034   uiCUAddrBase = ( iBY / cBaseColPic->getPicSym()->getMaxCUHeight() ) * cBaseColPic->getFrameWidthInCU() + ( iBX / cBaseColPic->getPicSym()->getMaxCUWidth() );
    4035 #else
    40364036  uiCUAddrBase = (iBY/g_uiMaxCUHeight)*cBaseColPic->getFrameWidthInCU() + (iBX/g_uiMaxCUWidth);
    4037 #endif
    40384037
    40394038  assert(uiCUAddrBase < cBaseColPic->getNumCUsInFrame());
    40404039
    4041 #if LAYER_CTB
    4042   UInt uiRasterAddrBase = ( iBY - (iBY/baseMaxCUHeight)*baseMaxCUHeight ) / baseMinUnitSize * cBaseColPic->getNumPartInWidth() + ( iBX - (iBX/baseMaxCUWidth)*baseMaxCUWidth ) / baseMinUnitSize;
    4043  
    4044   uiAbsPartIdxBase = g_auiLayerRasterToZscan[cBaseColPic->getLayerId()][uiRasterAddrBase];
    4045 #else
    40464040  UInt uiRasterAddrBase = (iBY - (iBY/g_uiMaxCUHeight)*g_uiMaxCUHeight)/uiMinUnitSize*cBaseColPic->getNumPartInWidth()
    40474041    + (iBX - (iBX/g_uiMaxCUWidth)*g_uiMaxCUWidth)/uiMinUnitSize;
    40484042
    40494043  uiAbsPartIdxBase = g_auiRasterToZscan[uiRasterAddrBase];
    4050 #endif
    40514044
    40524045  return cBaseColPic->getCU(uiCUAddrBase);
  • branches/SHM-4.0-dev/source/Lib/TLibCommon/TComPicSym.h

    r445 r466  
    126126  TComDataCU*&  getCU( UInt uiCUAddr )  { return m_apcTComDataCU[uiCUAddr];     }
    127127 
    128 #if LAYER_CTB
    129   UInt        getMaxCUWidth()           { return m_uiMaxCUWidth;                }
    130   UInt        getMaxCUHeight()          { return m_uiMaxCUHeight;               }
    131 #endif
    132 
    133128#if AVC_SYNTAX
    134129  UInt        getMaxCUWidth()           { return m_uiMaxCUWidth;                }
  • branches/SHM-4.0-dev/source/Lib/TLibCommon/TComPicYuv.cpp

    r445 r466  
    9090  Int numCuInHeight = m_iPicHeight / m_iCuHeight + (m_iPicHeight % m_iCuHeight != 0);
    9191 
    92 #if LAYER_CTB
    93   m_iLumaMarginX    = uiMaxCUWidth  + 16; // for 16-byte alignment
    94   m_iLumaMarginY    = uiMaxCUHeight + 16;  // margin for 8-tap filter and infinite padding
    95 #else
    9692  m_iLumaMarginX    = g_uiMaxCUWidth  + 16; // for 16-byte alignment
    9793  m_iLumaMarginY    = g_uiMaxCUHeight + 16;  // margin for 8-tap filter and infinite padding
    98 #endif
    9994 
    10095  m_iChromaMarginX  = m_iLumaMarginX>>1;
  • branches/SHM-4.0-dev/source/Lib/TLibCommon/TComRdCost.cpp

    r313 r466  
    22 * License, included below. This software may be subject to other third party
    33 * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license. 
     4 * granted under this license.
    55 *
    66 * Copyright (c) 2010-2013, ITU/ISO/IEC
     
    6161  Double dRdCost = 0.0;
    6262  Double dLambda = 0.0;
    63  
     63
    6464  switch ( eDFunc )
    6565  {
     
    8080      break;
    8181  }
    82  
     82
    8383  if (bFlag)
    8484  {
     
    107107    }
    108108  }
    109  
     109
    110110  return dRdCost;
    111111}
     
    115115  Double dRdCost = 0.0;
    116116  Double dLambda = 0.0;
    117  
     117
    118118  switch ( eDFunc )
    119119  {
     
    134134      break;
    135135  }
    136  
     136
    137137  if (bFlag)
    138138  {
     
    161161    }
    162162  }
    163  
     163
    164164  return dRdCost;
    165165}
     
    178178{
    179179  m_afpDistortFunc[0]  = NULL;                  // for DF_DEFAULT
    180  
     180
    181181  m_afpDistortFunc[1]  = TComRdCost::xGetSSE;
    182182  m_afpDistortFunc[2]  = TComRdCost::xGetSSE4;
     
    186186  m_afpDistortFunc[6]  = TComRdCost::xGetSSE64;
    187187  m_afpDistortFunc[7]  = TComRdCost::xGetSSE16N;
    188  
     188
    189189  m_afpDistortFunc[8]  = TComRdCost::xGetSAD;
    190190  m_afpDistortFunc[9]  = TComRdCost::xGetSAD4;
     
    194194  m_afpDistortFunc[13] = TComRdCost::xGetSAD64;
    195195  m_afpDistortFunc[14] = TComRdCost::xGetSAD16N;
    196  
     196
    197197  m_afpDistortFunc[15] = TComRdCost::xGetSAD;
    198198  m_afpDistortFunc[16] = TComRdCost::xGetSAD4;
     
    202202  m_afpDistortFunc[20] = TComRdCost::xGetSAD64;
    203203  m_afpDistortFunc[21] = TComRdCost::xGetSAD16N;
    204  
     204
    205205#if AMP_SAD
    206206  m_afpDistortFunc[43] = TComRdCost::xGetSAD12;
     
    219219  m_afpDistortFunc[27] = TComRdCost::xGetHADs;
    220220  m_afpDistortFunc[28] = TComRdCost::xGetHADs;
    221  
     221
    222222#if !FIX203
    223223  m_puiComponentCostOriginP = NULL;
     
    239239  iSubPelSearchLimit += 4;
    240240  iSubPelSearchLimit *= 8;
    241  
     241
    242242  if( m_iSearchLimit != iSubPelSearchLimit )
    243243  {
    244244    xUninit();
    245    
     245
    246246    m_iSearchLimit = iSubPelSearchLimit;
    247    
     247
    248248    m_puiComponentCostOriginP = new UInt[ 4 * iSubPelSearchLimit ];
    249249    iSubPelSearchLimit *= 2;
    250    
     250
    251251    m_puiComponentCost = m_puiComponentCostOriginP + iSubPelSearchLimit;
    252    
     252
    253253    for( Int n = -iSubPelSearchLimit; n < iSubPelSearchLimit; n++)
    254254    {
     
    272272  UInt uiLength = 1;
    273273  UInt uiTemp   = ( iVal <= 0) ? (-iVal<<1)+1: (iVal<<1);
    274  
     274
    275275  assert ( uiTemp );
    276  
     276
    277277  while ( 1 != uiTemp )
    278278  {
     
    280280    uiLength += 2;
    281281  }
    282  
     282
    283283  return uiLength;
    284284}
     
    290290  rcDistParam.iRows    = uiBlkHeight;
    291291  rcDistParam.DistFunc = m_afpDistortFunc[eDFunc + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ];
    292  
     292
    293293  // initialize
    294294  rcDistParam.iSubShift  = 0;
     
    301301  rcDistParam.pOrg = pcPatternKey->getROIY();
    302302  rcDistParam.pCur = piRefY;
    303  
     303
    304304  rcDistParam.iStrideOrg = pcPatternKey->getPatternLStride();
    305305  rcDistParam.iStrideCur = iRefStride;
    306  
     306
    307307  // set Block Width / Height
    308308  rcDistParam.iCols    = pcPatternKey->getROIYWidth();
    309309  rcDistParam.iRows    = pcPatternKey->getROIYHeight();
    310310  rcDistParam.DistFunc = m_afpDistortFunc[DF_SAD + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ];
    311  
     311
    312312#if AMP_SAD
    313313  if (rcDistParam.iCols == 12)
     
    336336#endif
    337337{
     338#if O0194_WEIGHTED_PREDICTION_CGS
     339  // Bug fix: The correct bit depth has not been used for weighted cost calculation
     340  rcDistParam.bitDepth = g_bitDepthY;
     341#endif
    338342  // set Original & Curr Pointer / Stride
    339343  rcDistParam.pOrg = pcPatternKey->getROIY();
    340344  rcDistParam.pCur = piRefY;
    341  
     345
    342346  rcDistParam.iStrideOrg = pcPatternKey->getPatternLStride();
    343347  rcDistParam.iStrideCur = iRefStride * iStep;
    344  
     348
    345349  // set Step for interpolated buffer
    346350  rcDistParam.iStep = iStep;
    347  
     351
    348352  // set Block Width / Height
    349353  rcDistParam.iCols    = pcPatternKey->getROIYWidth();
     
    352356  rcDistParam.bUseNSHAD = bUseNSHAD;
    353357#endif
    354  
     358
    355359  // set distortion function
    356360  if ( !bHADME )
     
    376380    rcDistParam.DistFunc = m_afpDistortFunc[DF_HADS + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ];
    377381  }
    378  
     382
    379383  // initialize
    380384  rcDistParam.iSubShift  = 0;
     
    407411  UInt uiSum = 0;
    408412  Int x, y;
    409  
     413
    410414  if ( ( (iWidth % 8) == 0 ) && ( (iHeight % 8) == 0 ) )
    411415  {
     
    444448    }
    445449  }
    446  
     450
    447451  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(bitDepth-8);
    448452
     
    523527  Int  iStrideCur = pcDtParam->iStrideCur;
    524528  Int  iStrideOrg = pcDtParam->iStrideOrg;
    525  
    526   UInt uiSum = 0;
    527  
     529
     530  UInt uiSum = 0;
     531
    528532  for( ; iRows != 0; iRows-- )
    529533  {
     
    535539    piCur += iStrideCur;
    536540  }
    537  
     541
    538542  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
    539543}
     
    541545UInt TComRdCost::xGetSAD4( DistParam* pcDtParam )
    542546{
    543   if ( pcDtParam->bApplyWeight ) 
     547  if ( pcDtParam->bApplyWeight )
    544548  {
    545549    return xGetSADw( pcDtParam );
     
    552556  Int  iStrideCur = pcDtParam->iStrideCur*iSubStep;
    553557  Int  iStrideOrg = pcDtParam->iStrideOrg*iSubStep;
    554  
    555   UInt uiSum = 0;
    556  
     558
     559  UInt uiSum = 0;
     560
    557561  for( ; iRows != 0; iRows-=iSubStep )
    558562  {
     
    561565    uiSum += abs( piOrg[2] - piCur[2] );
    562566    uiSum += abs( piOrg[3] - piCur[3] );
    563    
    564     piOrg += iStrideOrg;
    565     piCur += iStrideCur;
    566   }
    567  
     567
     568    piOrg += iStrideOrg;
     569    piCur += iStrideCur;
     570  }
     571
    568572  uiSum <<= iSubShift;
    569573  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     
    583587  Int  iStrideCur = pcDtParam->iStrideCur*iSubStep;
    584588  Int  iStrideOrg = pcDtParam->iStrideOrg*iSubStep;
    585  
    586   UInt uiSum = 0;
    587  
     589
     590  UInt uiSum = 0;
     591
    588592  for( ; iRows != 0; iRows-=iSubStep )
    589593  {
     
    596600    uiSum += abs( piOrg[6] - piCur[6] );
    597601    uiSum += abs( piOrg[7] - piCur[7] );
    598    
    599     piOrg += iStrideOrg;
    600     piCur += iStrideCur;
    601   }
    602  
     602
     603    piOrg += iStrideOrg;
     604    piCur += iStrideCur;
     605  }
     606
    603607  uiSum <<= iSubShift;
    604608  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     
    618622  Int  iStrideCur = pcDtParam->iStrideCur*iSubStep;
    619623  Int  iStrideOrg = pcDtParam->iStrideOrg*iSubStep;
    620  
    621   UInt uiSum = 0;
    622  
     624
     625  UInt uiSum = 0;
     626
    623627  for( ; iRows != 0; iRows-=iSubStep )
    624628  {
     
    639643    uiSum += abs( piOrg[14] - piCur[14] );
    640644    uiSum += abs( piOrg[15] - piCur[15] );
    641    
    642     piOrg += iStrideOrg;
    643     piCur += iStrideCur;
    644   }
    645  
     645
     646    piOrg += iStrideOrg;
     647    piCur += iStrideCur;
     648  }
     649
    646650  uiSum <<= iSubShift;
    647651  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     
    662666  Int  iStrideCur = pcDtParam->iStrideCur*iSubStep;
    663667  Int  iStrideOrg = pcDtParam->iStrideOrg*iSubStep;
    664  
    665   UInt uiSum = 0;
    666  
     668
     669  UInt uiSum = 0;
     670
    667671  for( ; iRows != 0; iRows-=iSubStep )
    668672  {
     
    679683    uiSum += abs( piOrg[10] - piCur[10] );
    680684    uiSum += abs( piOrg[11] - piCur[11] );
    681    
    682     piOrg += iStrideOrg;
    683     piCur += iStrideCur;
    684   }
    685  
     685
     686    piOrg += iStrideOrg;
     687    piCur += iStrideCur;
     688  }
     689
    686690  uiSum <<= iSubShift;
    687691  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     
    699703  Int  iStrideCur = pcDtParam->iStrideCur*iSubStep;
    700704  Int  iStrideOrg = pcDtParam->iStrideOrg*iSubStep;
    701  
    702   UInt uiSum = 0;
    703  
     705
     706  UInt uiSum = 0;
     707
    704708  for( ; iRows != 0; iRows-=iSubStep )
    705709  {
     
    726730    piCur += iStrideCur;
    727731  }
    728  
     732
    729733  uiSum <<= iSubShift;
    730734  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     
    744748  Int  iStrideCur = pcDtParam->iStrideCur*iSubStep;
    745749  Int  iStrideOrg = pcDtParam->iStrideOrg*iSubStep;
    746  
    747   UInt uiSum = 0;
    748  
     750
     751  UInt uiSum = 0;
     752
    749753  for( ; iRows != 0; iRows-=iSubStep )
    750754  {
     
    781785    uiSum += abs( piOrg[30] - piCur[30] );
    782786    uiSum += abs( piOrg[31] - piCur[31] );
    783    
    784     piOrg += iStrideOrg;
    785     piCur += iStrideCur;
    786   }
    787  
     787
     788    piOrg += iStrideOrg;
     789    piCur += iStrideCur;
     790  }
     791
    788792  uiSum <<= iSubShift;
    789793  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     
    804808  Int  iStrideCur = pcDtParam->iStrideCur*iSubStep;
    805809  Int  iStrideOrg = pcDtParam->iStrideOrg*iSubStep;
    806  
    807   UInt uiSum = 0;
    808  
     810
     811  UInt uiSum = 0;
     812
    809813  for( ; iRows != 0; iRows-=iSubStep )
    810814  {
     
    833837    uiSum += abs( piOrg[22] - piCur[22] );
    834838    uiSum += abs( piOrg[23] - piCur[23] );
    835    
    836     piOrg += iStrideOrg;
    837     piCur += iStrideCur;
    838   }
    839  
     839
     840    piOrg += iStrideOrg;
     841    piCur += iStrideCur;
     842  }
     843
    840844  uiSum <<= iSubShift;
    841845  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     
    857861  Int  iStrideCur = pcDtParam->iStrideCur*iSubStep;
    858862  Int  iStrideOrg = pcDtParam->iStrideOrg*iSubStep;
    859  
    860   UInt uiSum = 0;
    861  
     863
     864  UInt uiSum = 0;
     865
    862866  for( ; iRows != 0; iRows-=iSubStep )
    863867  {
     
    926930    uiSum += abs( piOrg[62] - piCur[62] );
    927931    uiSum += abs( piOrg[63] - piCur[63] );
    928    
    929     piOrg += iStrideOrg;
    930     piCur += iStrideCur;
    931   }
    932  
     932
     933    piOrg += iStrideOrg;
     934    piCur += iStrideCur;
     935  }
     936
    933937  uiSum <<= iSubShift;
    934938  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     
    949953  Int  iStrideCur = pcDtParam->iStrideCur*iSubStep;
    950954  Int  iStrideOrg = pcDtParam->iStrideOrg*iSubStep;
    951  
    952   UInt uiSum = 0;
    953  
     955
     956  UInt uiSum = 0;
     957
    954958  for( ; iRows != 0; iRows-=iSubStep )
    955959  {
     
    10021006    uiSum += abs( piOrg[46] - piCur[46] );
    10031007    uiSum += abs( piOrg[47] - piCur[47] );
    1004    
    1005     piOrg += iStrideOrg;
    1006     piCur += iStrideCur;
    1007   }
    1008  
     1008
     1009    piOrg += iStrideOrg;
     1010    piCur += iStrideCur;
     1011  }
     1012
    10091013  uiSum <<= iSubShift;
    10101014  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     
    10281032  Int  iStrideOrg = pcDtParam->iStrideOrg;
    10291033  Int  iStrideCur = pcDtParam->iStrideCur;
    1030  
     1034
    10311035  UInt uiSum = 0;
    10321036  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1);
    1033  
     1037
    10341038  Int iTemp;
    1035  
     1039
    10361040  for( ; iRows != 0; iRows-- )
    10371041  {
     
    10441048    piCur += iStrideCur;
    10451049  }
    1046  
     1050
    10471051  return ( uiSum );
    10481052}
     
    10601064  Int  iStrideOrg = pcDtParam->iStrideOrg;
    10611065  Int  iStrideCur = pcDtParam->iStrideCur;
    1062  
     1066
    10631067  UInt uiSum = 0;
    10641068  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1);
    1065  
     1069
    10661070  Int  iTemp;
    1067  
     1071
    10681072  for( ; iRows != 0; iRows-- )
    10691073  {
    1070    
     1074
    10711075    iTemp = piOrg[0] - piCur[0]; uiSum += ( iTemp * iTemp ) >> uiShift;
    10721076    iTemp = piOrg[1] - piCur[1]; uiSum += ( iTemp * iTemp ) >> uiShift;
    10731077    iTemp = piOrg[2] - piCur[2]; uiSum += ( iTemp * iTemp ) >> uiShift;
    10741078    iTemp = piOrg[3] - piCur[3]; uiSum += ( iTemp * iTemp ) >> uiShift;
    1075    
    1076     piOrg += iStrideOrg;
    1077     piCur += iStrideCur;
    1078   }
    1079  
     1079
     1080    piOrg += iStrideOrg;
     1081    piCur += iStrideCur;
     1082  }
     1083
    10801084  return ( uiSum );
    10811085}
     
    10931097  Int  iStrideOrg = pcDtParam->iStrideOrg;
    10941098  Int  iStrideCur = pcDtParam->iStrideCur;
    1095  
     1099
    10961100  UInt uiSum = 0;
    10971101  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1);
    1098  
     1102
    10991103  Int  iTemp;
    1100  
     1104
    11011105  for( ; iRows != 0; iRows-- )
    11021106  {
     
    11091113    iTemp = piOrg[6] - piCur[6]; uiSum += ( iTemp * iTemp ) >> uiShift;
    11101114    iTemp = piOrg[7] - piCur[7]; uiSum += ( iTemp * iTemp ) >> uiShift;
    1111    
    1112     piOrg += iStrideOrg;
    1113     piCur += iStrideCur;
    1114   }
    1115  
     1115
     1116    piOrg += iStrideOrg;
     1117    piCur += iStrideCur;
     1118  }
     1119
    11161120  return ( uiSum );
    11171121}
     
    11291133  Int  iStrideOrg = pcDtParam->iStrideOrg;
    11301134  Int  iStrideCur = pcDtParam->iStrideCur;
    1131  
     1135
    11321136  UInt uiSum = 0;
    11331137  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1);
    1134  
     1138
    11351139  Int  iTemp;
    1136  
     1140
    11371141  for( ; iRows != 0; iRows-- )
    11381142  {
    1139    
     1143
    11401144    iTemp = piOrg[ 0] - piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift;
    11411145    iTemp = piOrg[ 1] - piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift;
     
    11541158    iTemp = piOrg[14] - piCur[14]; uiSum += ( iTemp * iTemp ) >> uiShift;
    11551159    iTemp = piOrg[15] - piCur[15]; uiSum += ( iTemp * iTemp ) >> uiShift;
    1156    
    1157     piOrg += iStrideOrg;
    1158     piCur += iStrideCur;
    1159   }
    1160  
     1160
     1161    piOrg += iStrideOrg;
     1162    piCur += iStrideCur;
     1163  }
     1164
    11611165  return ( uiSum );
    11621166}
     
    11741178  Int  iStrideOrg = pcDtParam->iStrideOrg;
    11751179  Int  iStrideCur = pcDtParam->iStrideCur;
    1176  
     1180
    11771181  UInt uiSum = 0;
    11781182  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1);
    11791183  Int  iTemp;
    1180  
     1184
    11811185  for( ; iRows != 0; iRows-- )
    11821186  {
    11831187    for (Int n = 0; n < iCols; n+=16 )
    11841188    {
    1185      
     1189
    11861190      iTemp = piOrg[n+ 0] - piCur[n+ 0]; uiSum += ( iTemp * iTemp ) >> uiShift;
    11871191      iTemp = piOrg[n+ 1] - piCur[n+ 1]; uiSum += ( iTemp * iTemp ) >> uiShift;
     
    12001204      iTemp = piOrg[n+14] - piCur[n+14]; uiSum += ( iTemp * iTemp ) >> uiShift;
    12011205      iTemp = piOrg[n+15] - piCur[n+15]; uiSum += ( iTemp * iTemp ) >> uiShift;
    1202      
    1203     }
    1204     piOrg += iStrideOrg;
    1205     piCur += iStrideCur;
    1206   }
    1207  
     1206
     1207    }
     1208    piOrg += iStrideOrg;
     1209    piCur += iStrideCur;
     1210  }
     1211
    12081212  return ( uiSum );
    12091213}
     
    12211225  Int  iStrideOrg = pcDtParam->iStrideOrg;
    12221226  Int  iStrideCur = pcDtParam->iStrideCur;
    1223  
     1227
    12241228  UInt uiSum = 0;
    12251229  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1);
    12261230  Int  iTemp;
    1227  
     1231
    12281232  for( ; iRows != 0; iRows-- )
    12291233  {
    1230    
     1234
    12311235    iTemp = piOrg[ 0] - piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift;
    12321236    iTemp = piOrg[ 1] - piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift;
     
    12611265    iTemp = piOrg[30] - piCur[30]; uiSum += ( iTemp * iTemp ) >> uiShift;
    12621266    iTemp = piOrg[31] - piCur[31]; uiSum += ( iTemp * iTemp ) >> uiShift;
    1263    
    1264     piOrg += iStrideOrg;
    1265     piCur += iStrideCur;
    1266   }
    1267  
     1267
     1268    piOrg += iStrideOrg;
     1269    piCur += iStrideCur;
     1270  }
     1271
    12681272  return ( uiSum );
    12691273}
     
    12811285  Int  iStrideOrg = pcDtParam->iStrideOrg;
    12821286  Int  iStrideCur = pcDtParam->iStrideCur;
    1283  
     1287
    12841288  UInt uiSum = 0;
    12851289  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1);
    12861290  Int  iTemp;
    1287  
     1291
    12881292  for( ; iRows != 0; iRows-- )
    12891293  {
     
    13521356    iTemp = piOrg[62] - piCur[62]; uiSum += ( iTemp * iTemp ) >> uiShift;
    13531357    iTemp = piOrg[63] - piCur[63]; uiSum += ( iTemp * iTemp ) >> uiShift;
    1354    
    1355     piOrg += iStrideOrg;
    1356     piCur += iStrideCur;
    1357   }
    1358  
     1358
     1359    piOrg += iStrideOrg;
     1360    piCur += iStrideCur;
     1361  }
     1362
    13591363  return ( uiSum );
    13601364}
     
    13761380  m[2] = diff[0] - diff[2];
    13771381  m[3] = diff[1] - diff[3];
    1378  
     1382
    13791383  satd += abs(m[0] + m[1]);
    13801384  satd += abs(m[0] - m[1]);
    13811385  satd += abs(m[2] + m[3]);
    13821386  satd += abs(m[2] - m[3]);
    1383  
     1387
    13841388  return satd;
    13851389}
     
    13881392{
    13891393  Int k, satd = 0, diff[16], m[16], d[16];
    1390  
     1394
    13911395  assert( iStep == 1 );
    13921396  for( k = 0; k < 16; k+=4 )
     
    13961400    diff[k+2] = piOrg[2] - piCur[2];
    13971401    diff[k+3] = piOrg[3] - piCur[3];
    1398    
    1399     piCur += iStrideCur;
    1400     piOrg += iStrideOrg;
    1401   }
    1402  
     1402
     1403    piCur += iStrideCur;
     1404    piOrg += iStrideOrg;
     1405  }
     1406
    14031407  /*===== hadamard transform =====*/
    14041408  m[ 0] = diff[ 0] + diff[12];
     
    14181422  m[14] = diff[ 2] - diff[14];
    14191423  m[15] = diff[ 3] - diff[15];
    1420  
     1424
    14211425  d[ 0] = m[ 0] + m[ 4];
    14221426  d[ 1] = m[ 1] + m[ 5];
     
    14351439  d[14] = m[14] - m[10];
    14361440  d[15] = m[15] - m[11];
    1437  
     1441
    14381442  m[ 0] = d[ 0] + d[ 3];
    14391443  m[ 1] = d[ 1] + d[ 2];
     
    14521456  m[14] = d[13] - d[14];
    14531457  m[15] = d[12] - d[15];
    1454  
     1458
    14551459  d[ 0] = m[ 0] + m[ 1];
    14561460  d[ 1] = m[ 0] - m[ 1];
     
    14691473  d[14] = m[14] + m[15];
    14701474  d[15] = m[15] - m[14];
    1471  
     1475
    14721476  for (k=0; k<16; ++k)
    14731477  {
     
    14751479  }
    14761480  satd = ((satd+1)>>1);
    1477  
     1481
    14781482  return satd;
    14791483}
     
    14941498    diff[k+6] = piOrg[6] - piCur[6];
    14951499    diff[k+7] = piOrg[7] - piCur[7];
    1496    
    1497     piCur += iStrideCur;
    1498     piOrg += iStrideOrg;
    1499   }
    1500  
     1500
     1501    piCur += iStrideCur;
     1502    piOrg += iStrideOrg;
     1503  }
     1504
    15011505  //horizontal
    15021506  for (j=0; j < 8; j++)
     
    15111515    m2[j][6] = diff[jj+2] - diff[jj+6];
    15121516    m2[j][7] = diff[jj+3] - diff[jj+7];
    1513    
     1517
    15141518    m1[j][0] = m2[j][0] + m2[j][2];
    15151519    m1[j][1] = m2[j][1] + m2[j][3];
     
    15201524    m1[j][6] = m2[j][4] - m2[j][6];
    15211525    m1[j][7] = m2[j][5] - m2[j][7];
    1522    
     1526
    15231527    m2[j][0] = m1[j][0] + m1[j][1];
    15241528    m2[j][1] = m1[j][0] - m1[j][1];
     
    15301534    m2[j][7] = m1[j][6] - m1[j][7];
    15311535  }
    1532  
     1536
    15331537  //vertical
    15341538  for (i=0; i < 8; i++)
     
    15421546    m3[6][i] = m2[2][i] - m2[6][i];
    15431547    m3[7][i] = m2[3][i] - m2[7][i];
    1544    
     1548
    15451549    m1[0][i] = m3[0][i] + m3[2][i];
    15461550    m1[1][i] = m3[1][i] + m3[3][i];
     
    15511555    m1[6][i] = m3[4][i] - m3[6][i];
    15521556    m1[7][i] = m3[5][i] - m3[7][i];
    1553    
     1557
    15541558    m2[0][i] = m1[0][i] + m1[1][i];
    15551559    m2[1][i] = m1[0][i] - m1[1][i];
     
    15611565    m2[7][i] = m1[6][i] - m1[7][i];
    15621566  }
    1563  
     1567
    15641568  for (i = 0; i < 8; i++)
    15651569  {
     
    15691573    }
    15701574  }
    1571  
     1575
    15721576  sad=((sad+2)>>2);
    1573  
     1577
    15741578  return sad;
    15751579}
     
    16811685  //vertical
    16821686  for (i=0; i < 16; i++)
    1683   {   
     1687  {
    16841688    m2[0][i] = m1[0][i] + m1[2][i];
    16851689    m2[1][i] = m1[1][i] + m1[3][i];
     
    18381842  Int  iOffsetOrg = iStrideOrg<<2;
    18391843  Int  iOffsetCur = iStrideCur<<2;
    1840  
    1841   UInt uiSum = 0;
    1842  
     1844
     1845  UInt uiSum = 0;
     1846
    18431847  for ( y=0; y<iRows; y+= 4 )
    18441848  {
     
    18471851    piCur += iOffsetCur;
    18481852  }
    1849  
     1853
    18501854  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
    18511855}
     
    18641868  Int  iStep  = pcDtParam->iStep;
    18651869  Int  y;
    1866  
    1867   UInt uiSum = 0;
    1868  
     1870
     1871  UInt uiSum = 0;
     1872
    18691873  if ( iRows == 4 )
    18701874  {
     
    18831887    }
    18841888  }
    1885  
     1889
    18861890  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
    18871891}
     
    19001904  Int  iStrideOrg = pcDtParam->iStrideOrg;
    19011905  Int  iStep  = pcDtParam->iStep;
    1902  
     1906
    19031907  Int  x, y;
    1904  
    1905   UInt uiSum = 0;
    1906  
     1908
     1909  UInt uiSum = 0;
     1910
    19071911#if NS_HAD
    19081912  if( ( ( iRows % 8 == 0) && (iCols % 8 == 0) && ( iRows == iCols ) ) || ( ( iRows % 8 == 0 ) && (iCols % 8 == 0) && !pcDtParam->bUseNSHAD ) )
     
    19241928  }
    19251929#if NS_HAD
    1926   else if ( ( iCols > 8 ) && ( iCols > iRows ) && pcDtParam->bUseNSHAD ) 
     1930  else if ( ( iCols > 8 ) && ( iCols > iRows ) && pcDtParam->bUseNSHAD )
    19271931  {
    19281932    Int  iOffsetOrg = iStrideOrg<<2;
     
    19381942    }
    19391943  }
    1940   else if ( ( iRows > 8 ) && ( iCols < iRows ) && pcDtParam->bUseNSHAD ) 
     1944  else if ( ( iRows > 8 ) && ( iCols < iRows ) && pcDtParam->bUseNSHAD )
    19411945  {
    19421946    Int  iOffsetOrg = iStrideOrg<<4;
     
    19571961    Int  iOffsetOrg = iStrideOrg<<2;
    19581962    Int  iOffsetCur = iStrideCur<<2;
    1959    
     1963
    19601964    for ( y=0; y<iRows; y+= 4 )
    19611965    {
     
    19861990    assert(false);
    19871991  }
    1988  
     1992
    19891993  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
    19901994}
  • branches/SHM-4.0-dev/source/Lib/TLibCommon/TComRom.cpp

    r445 r466  
    8686// Data structure related table & variable
    8787// ====================================================================================================================
    88 #if LAYER_CTB
    89 UInt g_auiLayerMaxCUWidth[MAX_LAYERS];
    90 UInt g_auiLayerMaxCUHeight[MAX_LAYERS];
    91 UInt g_auiLayerMaxCUDepth[MAX_LAYERS];
    92 UInt g_auiLayerAddCUDepth[MAX_LAYERS];
    93 UInt g_auiLayerZscanToRaster[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
    94 UInt g_auiLayerRasterToZscan[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
    95 UInt g_auiLayerRasterToPelX[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
    96 UInt g_auiLayerRasterToPelY[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
    97 #endif
     88
    9889UInt g_uiMaxCUWidth  = MAX_CU_SIZE;
    9990UInt g_uiMaxCUHeight = MAX_CU_SIZE;
     
    321312UInt g_uiPCMBitDepthLuma     = 8;    // PCM bit-depth
    322313UInt g_uiPCMBitDepthChroma   = 8;    // PCM bit-depth
    323 
     314#if O0194_DIFFERENT_BITDEPTH_EL_BL
     315Int  g_bitDepthYLayer[MAX_LAYERS];
     316Int  g_bitDepthCLayer[MAX_LAYERS];
     317
     318UInt g_uiPCMBitDepthLumaDec[MAX_LAYERS];    // PCM bit-depth
     319UInt g_uiPCMBitDepthChromaDec[MAX_LAYERS];    // PCM bit-depth
     320#endif
     321#if O0194_WEIGHTED_PREDICTION_CGS
     322void * g_refWeightACDCParam; // type=wpACDCParam
     323#endif
    324324// ====================================================================================================================
    325325// Misc.
  • branches/SHM-4.0-dev/source/Lib/TLibCommon/TComRom.h

    r445 r466  
    8181
    8282// global variable (LCU width/height, max. CU depth)
    83 #if LAYER_CTB
    84 extern       UInt g_auiLayerMaxCUWidth[MAX_LAYERS];
    85 extern       UInt g_auiLayerMaxCUHeight[MAX_LAYERS];
    86 extern       UInt g_auiLayerMaxCUDepth[MAX_LAYERS];
    87 extern       UInt g_auiLayerAddCUDepth[MAX_LAYERS];
    88 extern       UInt g_auiLayerZscanToRaster[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
    89 extern       UInt g_auiLayerRasterToZscan[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
    90 extern       UInt g_auiLayerRasterToPelX[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
    91 extern       UInt g_auiLayerRasterToPelY[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
    92 #endif
    9383extern       UInt g_uiMaxCUWidth;
    9484extern       UInt g_uiMaxCUHeight;
  • branches/SHM-4.0-dev/source/Lib/TLibCommon/TComSlice.h

    r464 r466  
    16021602  Int64 iAC;
    16031603  Int64 iDC;
     1604#if O0194_WEIGHTED_PREDICTION_CGS
     1605  Int iSamples;
     1606#endif
    16041607} wpACDCParam;
    16051608
  • branches/SHM-4.0-dev/source/Lib/TLibCommon/TComUpsampleFilter.cpp

    r464 r466  
    1717  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
    1818  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
    19   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, // 
    20   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
    21 #endif
    22   { -1, 4, -11, 52, 26,  -8,  3, -1}, // <-> actual phase shift 1/3, used for spatial scalability x1.5     
     19  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
     20  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
     21#endif
     22  { -1, 4, -11, 52, 26,  -8,  3, -1}, // <-> actual phase shift 1/3, used for spatial scalability x1.5
    2323#if ARBITRARY_SPATIAL_RATIO
    2424  { -1, 3,  -9, 47, 31, -10,  4, -1},
    2525  { -1, 4, -11, 45, 34, -10,  4, -1},
    2626#else
    27   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //       
    28   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, // 
     27  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
     28  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
    2929#endif
    3030  { -1, 4, -11, 40, 40, -11,  4, -1}, // <-> actual phase shift 1/2, equal to HEVC MC, used for spatial scalability x2
     
    3333  { -1,  4, -10, 31, 47,  -9,  3, -1},
    3434#else
    35   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, // 
    36   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, // 
     35  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
     36  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
    3737#endif
    3838  { -1, 3,  -8, 26, 52, -11, 4, -1}, // <-> actual phase shift 2/3, used for spatial scalability x1.5
     
    4343  { 0,  1,  -2,  4, 63,  -3,  1,  0}
    4444#else
    45   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, // 
    46   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, // 
    47   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, // 
    48   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}  // 
     45  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
     46  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
     47  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
     48  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}  //
    4949#endif
    5050};
     
    6060  {CNU,CNU,CNU,CNU},//
    6161  {CNU,CNU,CNU,CNU},//
    62   {CNU,CNU,CNU,CNU},// 
     62  {CNU,CNU,CNU,CNU},//
    6363#endif
    6464  { -4, 54, 16, -2},// <-> actual phase shift 1/4,equal to HEVC MC, used for spatial scalability x1.5 (only for accurate Chroma alignement)
    65   { -6, 52, 20, -2},// <-> actual phase shift 1/3, used for spatial scalability x1.5   
    66   { -6, 46, 28, -4},// <-> actual phase shift 3/8,equal to HEVC MC, used for spatial scalability x2 (only for accurate Chroma alignement)     
     65  { -6, 52, 20, -2},// <-> actual phase shift 1/3, used for spatial scalability x1.5
     66  { -6, 46, 28, -4},// <-> actual phase shift 3/8,equal to HEVC MC, used for spatial scalability x2 (only for accurate Chroma alignement)
    6767#if ARBITRARY_SPATIAL_RATIO
    6868  { -4, 42, 30, -4},
    6969#else
    70   {CNU,CNU,CNU,CNU},// 
     70  {CNU,CNU,CNU,CNU},//
    7171#endif
    7272  { -4, 36, 36, -4},// <-> actual phase shift 1/2,equal to HEVC MC, used for spatial scalability x2
     
    7575  { -4, 28, 46, -6},
    7676#else
    77   {CNU,CNU,CNU,CNU},// 
     77  {CNU,CNU,CNU,CNU},//
    7878#endif
    7979  { -2, 20, 52, -6},// <-> actual phase shift 2/3, used for spatial scalability x1.5
     
    8282  {-2, 14, 56, -4},
    8383#else
    84   {CNU,CNU,CNU,CNU},// 
    85   {CNU,CNU,CNU,CNU},// 
    86 #endif
    87   { -2, 10, 58, -2},// <-> actual phase shift 7/8,equal to HEVC MC, used for spatial scalability x2 (only for accurate Chroma alignement) 
     84  {CNU,CNU,CNU,CNU},//
     85  {CNU,CNU,CNU,CNU},//
     86#endif
     87  { -2, 10, 58, -2},// <-> actual phase shift 7/8,equal to HEVC MC, used for spatial scalability x2 (only for accurate Chroma alignement)
    8888  {  0,  4, 62, -2} // <-> actual phase shift 11/12, used for spatial scalability x1.5 (only for accurate Chroma alignement)
    8989};
     
    109109
    110110  //========== Y component upsampling ===========
     111#if SCALED_REF_LAYER_OFFSETS
    111112  const Window &scalEL = window;
    112113
     
    118119  Int heightEL  = pcUsPic->getHeight() - scalEL.getWindowTopOffset()  - scalEL.getWindowBottomOffset();
    119120  Int strideEL  = pcUsPic->getStride();
    120 
     121#else
     122  const Window &confBL = pcBasePic->getConformanceWindow();
     123  const Window &confEL = pcUsPic->getConformanceWindow();
     124
     125  Int widthBL   = pcBasePic->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();
     126  Int heightBL  = pcBasePic->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();
     127  Int strideBL  = pcBasePic->getStride();
     128
     129  Int widthEL   = pcUsPic->getWidth () - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset();
     130  Int heightEL  = pcUsPic->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset();
     131  Int strideEL  = pcUsPic->getStride();
     132#endif
    121133  Pel* piTempBufY = pcTempPic->getLumaAddr();
    122134  Pel* piSrcBufY  = pcBasePic->getLumaAddr();
     
    182194    Int refPos16 = 0;
    183195    Int phase    = 0;
    184     Int refPos   = 0; 
     196    Int refPos   = 0;
    185197    Int* coeff = m_chromaFilter[phase];
    186198    for ( i = 0; i < 16; i++)
     
    190202    }
    191203
    192 #if ARBITRARY_SPATIAL_RATIO 
     204#if ARBITRARY_SPATIAL_RATIO
    193205    assert ( widthEL >= widthBL );
    194206    assert ( heightEL >= heightBL );
     
    205217
    206218#if O0215_PHASE_ALIGNMENT //for Luma, if Phase 0, then both PhaseX  and PhaseY should be 0. If symmetric: both PhaseX and PhaseY should be 2
    207     Int   phaseX = 2*phaseAlignFlag; 
    208     Int   phaseY = 2*phaseAlignFlag; 
     219    Int   phaseX = 2*phaseAlignFlag;
     220    Int   phaseY = 2*phaseAlignFlag;
    209221#else
    210222    Int   phaseX = 0;
     
    221233
    222234    Int   deltaX     = 4 * phaseX;
    223     Int   deltaY     = 4 * phaseY; 
     235    Int   deltaY     = 4 * phaseY;
    224236
    225237    Int shiftXM4 = shiftX - 4;
     
    231243    widthBL   = pcBasePic->getWidth ();
    232244    heightBL  = min<Int>( pcBasePic->getHeight(), heightEL );
    233 
     245#if SCALED_REF_LAYER_OFFSETS
    234246    Int leftStartL = scalEL.getWindowLeftOffset();
    235247    Int rightEndL  = pcUsPic->getWidth() - scalEL.getWindowRightOffset();
    236248    Int topStartL  = scalEL.getWindowTopOffset();
    237249    Int bottomEndL = pcUsPic->getHeight() - scalEL.getWindowBottomOffset();
     250#if BUGFIX_RESAMPLE
    238251    Int leftOffset = leftStartL > 0 ? leftStartL : 0;
     252#endif
     253#endif
    239254
    240255#if  N0214_INTERMEDIATE_BUFFER_16BITS
     256#if O0194_JOINT_US_BITSHIFT
     257    // g_bitDepthY was set to EL bit-depth, but shift1 should be calculated using BL bit-depth
     258    Int shift1 = g_bitDepthYLayer[0] - 8;
     259#else
    241260    Int shift1 = g_bitDepthY - 8;
     261#endif
    242262#endif
    243263
     
    245265    for( i = 0; i < widthEL; i++ )
    246266    {
     267#if SCALED_REF_LAYER_OFFSETS
    247268      Int x = Clip3( leftStartL, rightEndL - 1, i );
    248269      refPos16 = (((x - leftStartL)*scaleX + addX) >> shiftXM4) - deltaX;
     270#else
     271      refPos16 = ((i*scaleX + addX) >> shiftXM4) - deltaX;
     272#endif
    249273      phase    = refPos16 & 15;
    250274      refPos   = refPos16 >> 4;
     
    273297
    274298#if  N0214_INTERMEDIATE_BUFFER_16BITS
     299#if O0194_JOINT_US_BITSHIFT
     300  Int nShift = 20 - g_bitDepthYLayer[1];
     301#else
    275302    Int nShift = US_FILTER_PREC*2 - shift1;
     303#endif
    276304#else
    277305    const Int nShift = US_FILTER_PREC*2;
    278306#endif
    279     Int iOffset = 1 << (nShift - 1);
    280 
     307    Int iOffset = 1 << (nShift - 1);
     308
     309#if SCALED_REF_LAYER_OFFSETS
    281310    for( j = 0; j < pcTempPic->getHeight(); j++ )
     311#else
     312    for( j = 0; j < heightEL; j++ )
     313#endif
    282314    {
     315#if SCALED_REF_LAYER_OFFSETS
    283316      Int y = Clip3(topStartL, bottomEndL - 1, j);
    284317      refPos16 = ((( y - topStartL )*scaleY + addY) >> shiftYM4) - deltaY;
     318#else
     319      refPos16 = ((j*scaleY + addY) >> shiftYM4) - deltaY;
     320#endif
    285321      phase    = refPos16 & 15;
    286322      refPos   = refPos16 >> 4;
     
    288324
    289325      piSrcY = piTempBufY + (refPos -((NTAPS_US_LUMA>>1) - 1))*strideEL;
    290       Pel* piDstY0 = piDstBufY + j * strideEL;           
     326#if SCALED_REF_LAYER_OFFSETS
     327#if BUGFIX_RESAMPLE
     328      Pel* piDstY0 = piDstBufY + j * strideEL;
    291329      piDstY = piDstY0 + leftOffset;
    292330      piSrcY += leftOffset;
     
    311349        piDstY++;
    312350      }
    313 
     351#else
     352#if 1 // it should provide identical result
     353      Pel* piDstY0 = piDstBufY + j * strideEL;
     354      piDstY = piDstY0 + ( leftStartL > 0 ? leftStartL : 0 );
     355
     356      for( i = min<Int>(rightEndL, pcTempPic->getWidth()) - max<Int>(0, leftStartL); i > 0; i-- )
     357      {
     358        *piDstY = ClipY( (sumLumaVer(piSrcY, coeff, strideEL) + iOffset) >> (nShift));
     359        piSrcY++;
     360        piDstY++;
     361      }
     362
     363      for( i = rightEndL; i < pcTempPic->getWidth(); i++ )
     364      {
     365        *piDstY = piDstY0[rightEndL-1];
     366        piDstY++;
     367      }
     368
     369      piDstY = piDstY0;
     370      for( i = 0; i < leftStartL; i++ )
     371      {
     372        *piDstY = piDstY0[leftStartL];
     373        piDstY++;
     374      }
     375#else
     376      piDstY = piDstBufY + j * strideEL;
     377
     378      for( i = 0; i < pcTempPic->getWidth(); i++ )
     379      {
     380        *piDstY = ClipY( (sumLumaVer(piSrcY, coeff, strideEL) + iOffset) >> (nShift));
     381
     382        // Only increase the x position of reference upsample picture when within the window
     383        // "-2" to ensure that pointer doesn't go beyond the boundary rightEndL-1
     384        if( (i >= leftStartL) && (i <= rightEndL-2) )
     385        {
     386          piSrcY++;
     387        }
     388        piDstY++;
     389      }
     390#endif
     391#endif
     392#else
     393      piDstY = piDstBufY + j * strideEL;
     394
     395      for( i = 0; i < widthEL; i++ )
     396      {
     397        *piDstY = ClipY( (sumLumaVer(piSrcY, coeff, strideEL) + iOffset) >> (nShift));
     398        piSrcY++;
     399        piDstY++;
     400      }
     401#endif
    314402    }
    315403
     404#if SCALED_REF_LAYER_OFFSETS
    316405    widthBL   = pcBasePic->getWidth ();
    317406    heightBL  = pcBasePic->getHeight();
     
    319408    widthEL   = pcUsPic->getWidth () - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset();
    320409    heightEL  = pcUsPic->getHeight() - scalEL.getWindowTopOffset()  - scalEL.getWindowBottomOffset();
     410#else
     411    widthBL   = pcBasePic->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();
     412    heightBL  = pcBasePic->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();
     413
     414    widthEL   = pcUsPic->getWidth () - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset();
     415    heightEL  = pcUsPic->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset();
     416#endif
    321417
    322418    //========== UV component upsampling ===========
     
    330426    strideBL  = pcBasePic->getCStride();
    331427    strideEL  = pcUsPic->getCStride();
    332 
     428#if SCALED_REF_LAYER_OFFSETS
    333429    Int leftStartC = scalEL.getWindowLeftOffset() >> 1;
    334430    Int rightEndC  = (pcUsPic->getWidth() >> 1) - (scalEL.getWindowRightOffset() >> 1);
    335431    Int topStartC  = scalEL.getWindowTopOffset() >> 1;
    336432    Int bottomEndC = (pcUsPic->getHeight() >> 1) - (scalEL.getWindowBottomOffset() >> 1);
     433#if BUGFIX_RESAMPLE
    337434    leftOffset = leftStartC > 0 ? leftStartC : 0;
     435#endif
     436#endif
    338437
    339438    shiftX = 16;
    340439    shiftY = 16;
    341440
    342 #if O0215_PHASE_ALIGNMENT 
    343     Int phaseXC = 0; 
    344     Int phaseYC = 1; 
     441#if O0215_PHASE_ALIGNMENT
     442    Int phaseXC = 0;
     443    Int phaseYC = 1;
    345444
    346445#if ROUNDING_OFFSET
     
    380479
    381480#if  N0214_INTERMEDIATE_BUFFER_16BITS
     481#if O0194_JOINT_US_BITSHIFT
     482    // g_bitDepthC was set to EL bit-depth, but shift1 should be calculated using BL bit-depth
     483    shift1 = g_bitDepthCLayer[0] - 8;
     484#else
    382485    shift1 = g_bitDepthC - 8;
     486#endif
    383487#endif
    384488
     
    386490    for( i = 0; i < widthEL; i++ )
    387491    {
     492#if SCALED_REF_LAYER_OFFSETS
    388493      Int x = Clip3(leftStartC, rightEndC - 1, i);
    389494      refPos16 = (((x - leftStartC)*scaleX + addX) >> shiftXM4) - deltaX;
     495#else
     496      refPos16 = ((i*scaleX + addX) >> shiftXM4) - deltaX;
     497#endif
    390498      phase    = refPos16 & 15;
    391499      refPos   = refPos16 >> 4;
     
    421529
    422530#if  N0214_INTERMEDIATE_BUFFER_16BITS
     531#if O0194_JOINT_US_BITSHIFT
     532    nShift = 20 - g_bitDepthCLayer[1];
     533#else
    423534    nShift = US_FILTER_PREC*2 - shift1;
    424     iOffset = 1 << (nShift - 1);
    425 #endif
    426 
     535#endif
     536    iOffset = 1 << (nShift - 1);
     537#endif
     538
     539#if SCALED_REF_LAYER_OFFSETS
    427540    for( j = 0; j < pcTempPic->getHeight() >> 1; j++ )
     541#else
     542    for( j = 0; j < heightEL; j++ )
     543#endif
    428544    {
     545#if SCALED_REF_LAYER_OFFSETS
    429546      Int y = Clip3(topStartC, bottomEndC - 1, j);
    430547      refPos16 = (((y - topStartC)*scaleY + addY) >> shiftYM4) - deltaY;
     548#else
     549      refPos16 = ((j*scaleY + addY) >> shiftYM4) - deltaY;
     550#endif
    431551      phase    = refPos16 & 15;
    432       refPos   = refPos16 >> 4; 
     552      refPos   = refPos16 >> 4;
    433553      coeff = m_chromaFilter[phase];
    434554
    435555      piSrcU = piTempBufU  + (refPos -((NTAPS_US_CHROMA>>1) - 1))*strideEL;
    436556      piSrcV = piTempBufV  + (refPos -((NTAPS_US_CHROMA>>1) - 1))*strideEL;
    437 
     557#if SCALED_REF_LAYER_OFFSETS
     558#if BUGFIX_RESAMPLE
    438559      Pel* piDstU0 = piDstBufU + j*strideEL;
    439560      Pel* piDstV0 = piDstBufV + j*strideEL;
     
    447568        *piDstU = ClipC( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift));
    448569        *piDstV = ClipC( (sumChromaVer(piSrcV, coeff, strideEL) + iOffset) >> (nShift));
     570
    449571        piSrcU++;
    450572        piSrcV++;
     
    470592        piDstV++;
    471593      }
    472 
     594#else
     595#if 1 // it should provide identical result
     596      Pel* piDstU0 = piDstBufU + j*strideEL;
     597      Pel* piDstV0 = piDstBufV + j*strideEL;
     598      piDstU = piDstU0 + ( leftStartC > 0 ? leftStartC : 0 );
     599      piDstV = piDstV0 + ( leftStartC > 0 ? leftStartC : 0 );
     600
     601      for( i = min<Int>(rightEndC, pcTempPic->getWidth() >> 1) - max<Int>(0, leftStartC); i > 0; i-- )
     602      {
     603        *piDstU = ClipC( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift));
     604        *piDstV = ClipC( (sumChromaVer(piSrcV, coeff, strideEL) + iOffset) >> (nShift));
     605        piSrcU++;
     606        piSrcV++;
     607        piDstU++;
     608        piDstV++;
     609      }
     610
     611      for( i = rightEndC; i < pcTempPic->getWidth() >> 1; i++ )
     612      {
     613        *piDstU = piDstU0[rightEndC-1];
     614        *piDstV = piDstV0[rightEndC-1];
     615        piDstU++;
     616        piDstV++;
     617      }
     618
     619      piDstU = piDstU0;
     620      piDstV = piDstV0;
     621      for( i = 0; i < leftStartC; i++ )
     622      {
     623        *piDstU = piDstU0[leftStartC];
     624        *piDstV = piDstV0[leftStartC];
     625        piDstU++;
     626        piDstV++;
     627      }
     628#else
     629      piDstU = piDstBufU + j*strideEL;
     630      piDstV = piDstBufV + j*strideEL;
     631
     632      for( i = 0; i < pcTempPic->getWidth() >> 1; i++ )
     633      {
     634        *piDstU = ClipC( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift));
     635        *piDstV = ClipC( (sumChromaVer(piSrcV, coeff, strideEL) + iOffset) >> (nShift));
     636
     637        // Only increase the x position of reference upsample picture when within the window
     638        // "-2" to ensure that pointer doesn't go beyond the boundary rightEndC-1
     639        if( (i >= leftStartC) && (i <= rightEndC-2) )
     640        {
     641          piSrcU++;
     642          piSrcV++;
     643        }
     644
     645        piDstU++;
     646        piDstV++;
     647      }
     648#endif
     649#endif
     650#else
     651      piDstU = piDstBufU + j*strideEL;
     652      piDstV = piDstBufV + j*strideEL;
     653
     654      for( i = 0; i < widthEL; i++ )
     655      {
     656        *piDstU = ClipC( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift));
     657        *piDstV = ClipC( (sumChromaVer(piSrcV, coeff, strideEL) + iOffset) >> (nShift));
     658        piSrcU++;
     659        piSrcV++;
     660        piDstU++;
     661        piDstV++;
     662      }
     663#endif
    473664    }
    474665  }
    475   pcUsPic->setBorderExtension(false);
    476   pcUsPic->extendPicBorder   (); // extend the border.
    477 
    478   //Reset the Border extension flag
    479   pcUsPic->setBorderExtension(false);
    480   pcTempPic->setBorderExtension(false);
    481   pcBasePic->setBorderExtension(false);
     666    pcUsPic->setBorderExtension(false);
     667    pcUsPic->extendPicBorder   (); // extend the border.
     668
     669    //Reset the Border extension flag
     670    pcUsPic->setBorderExtension(false);
     671    pcTempPic->setBorderExtension(false);
     672    pcBasePic->setBorderExtension(false);
    482673}
    483674#endif //SVC_EXTENSION
  • branches/SHM-4.0-dev/source/Lib/TLibCommon/TypeDef.h

    r464 r466  
    4646#if SVC_EXTENSION
    4747#define MFM_ENCCONSTRAINT                1      ///< JCTVC-O0216: Encoder constraint for motion field mapping
     48
     49#define O0194_DIFFERENT_BITDEPTH_EL_BL   1      ///< JCTVC-O0194: Support for different bitdepth values for BL and EL, add required configuration parameters
     50#define O0194_JOINT_US_BITSHIFT          1      ///< JCTVC-O0194: Joint Upsampling and bit-shift
     51#define O0194_WEIGHTED_PREDICTION_CGS    1      ///< JCTVC-O0194: Weighted prediciton for color gamut scalability
     52#define O0194_REPN_FORMAT_IN_VPS_BUGFIX  1      ///< JCTVC-O0194: Some bugfixes when REPN_FORMAT_IN_VPS (JCTVC-N0092) is enabled
     53
    4854#define VPS_NUH_LAYER_ID                 1      ///< JCTVC-N0085: Assert that the nuh_layer_id of VPS NAL unit should be 0
    4955#define MAX_LAYERS                       2      ///< max number of layers the codec is supposed to handle
     
    5965#endif
    6066#define IL_SL_SIGNALLING_N0371           0      ///< JCTVC-N0371: inter-layer scaling list
     67#define M0464_TILE_BOUNDARY_ALIGNED_FLAG 0      ///< JCTVC-M0464: VUI flag to indicate tile boundary alignment
    6168#define M0463_VUI_EXT_ILP_REF            0      ///< JCTVC-M0463: VUI extension inter-layer dependency offset signalling
    6269#define SPS_EXTENSION                    1      ///< Define sps_extension() syntax structure
     70#define SCALED_REF_LAYER_OFFSETS         1      ///< JCTVC-M0309: Signal scaled reference layer offsets in SPS
    6371#define VERT_MV_CONSTRAINT               1      ///< Vertical MV component constraint flag
    6472#define SCALABILITY_MASK_E0104           1      ///< JCT3V-E0104: scalability mask for depth
    65 #define LAYER_CTB                        0      ///< enable layer-specific CTB structure
    6673
    6774#define ILP_SSH_SIG                      1      ///< JCTVC-N0195 proposal 2, JCTVC-N0118: add presence flag in VPS ext to condition inter-layer prediction signaling in slice segment header
     
    7986#define VPS_EXTN_PROFILE_INFO            1      ///< Include profile information for layer sets in VPS extension
    8087#define VPS_EXTN_DIRECT_REF_LAYERS       1      ///< Include indication of direct dependency of layers in VPS extension
     88#define VPS_OUTPUT_LAYER_SET_IDX         1      ///< JCTVC-M0268: Signal output_layer_set_idx[i] as output_layer_set_idx_minus1[i]
     89#define VPS_MOVE_DIR_DEPENDENCY_FLAG     1      ///< JCTVC-M0268: Move the syntax element direct_dependency_flag to follow the syntax element dimension_id
     90#define VPS_PROFILE_OUTPUT_LAYERS        1      ///< JCTVC-M0268: Signal profile information and output layer information as in Sec. 3 of M0268v2
     91#define SPS_SUB_LAYER_INFO               1      ///< JCTVC-M0268: Do not signal sps_max_sub_layers_minus1 and sps_temporal_id_nesting_flag for nuh_layer_id greater than 0
     92#define VPS_SPLIT_FLAG                   1      ///< JCTVC-M0163: Do not signal dimension_id and the last dimension_id_len_minus1, when splitting_flag is equal to 1.
    8193#define M0457_PREDICTION_INDICATIONS     1
    8294#define M0040_ADAPTIVE_RESOLUTION_CHANGE 1
     
    8799#define N0160_VUI_EXT_ILP_REF            1      ///< VUI extension inter-layer dependency offset signalling
    88100#define VPS_VUI_BITRATE_PICRATE          1      ///< JCTVC-N0085: Signal bit rate and picture in VPS VUI
     101#else
     102#define M0464_TILE_BOUNDARY_ALIGNED_FLAG 0      ///< VUI flag to indicate tile boundary alignment
    89103#endif //VPS_VUI
    90104
     
    94108#define VPS_EXTN_OFFSET_CALC             1      ///< Calculation of VPS extension offset
    95109#define SPS_PTL_FIX                      1      ///< remove profile_tier_level from enhancement layer SPS
     110#define SH_DISCARDABLE_FLAG              1      ///< JCTVC-M0152: Use one reserved flag in the slice header for discardable flag
    96111
    97112#define DERIVE_LAYER_ID_LIST_VARIABLES   1      ///< Derived variables based on the variables in VPS - for use in syntax table parsing
     
    101116#define N0214_INTERMEDIATE_BUFFER_16BITS 1      ///< JCTVC-N0214: support base layer input more than 8 bits
    102117#define ARBITRARY_SPATIAL_RATIO          1      ///< JCTVC-N0219, JCTVC-N0273: Support arbitrary spatial ratio
     118#define BUGFIX_RESAMPLE                  1      ///< JCTVC-N0055: resampling bug fix for positive left scalled offset
    103119
    104120#define JCTVC_M0259_LAMBDAREFINEMENT     1      ///< JCTVC-M0259: lambda refinement (encoder only optimization)
     
    121137#define JCTVC_M0203_INTERLAYER_PRED_IDC  1      ///< JCTVC-M0203: implementation of Inter-layer Prediction Indication
    122138#if JCTVC_M0203_INTERLAYER_PRED_IDC
     139#define ILR_RESTR                        1      ///< JCTVC-M0209: Inter-layer RPS and RPL
     140#define ILR_RESTR_FIX                    1      ///< Fix encoder crash when temporal layers are used with scalable coding
    123141#define EARLY_REF_PIC_MARKING            1      ///< Decoded picture marking of sub-layer non-reference pictures
    124142#define N0120_MAX_TID_REF_PRESENT_FLAG   1      ///< JCTVC-N0120: max_tid_ref_pics_plus1_present_flag
  • branches/SHM-4.0-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r464 r466  
    187187  assert(uiCode <= 63);
    188188  pcPPS->setPPSId (uiCode);
    189  
     189
    190190  READ_UVLC( uiCode, "pps_seq_parameter_set_id");
    191191  assert(uiCode <= 15);
    192192  pcPPS->setSPSId (uiCode);
    193  
     193
    194194  READ_FLAG( uiCode, "dependent_slice_segments_enabled_flag"    );    pcPPS->setDependentSliceSegmentsEnabledFlag   ( uiCode == 1 );
    195195  READ_FLAG( uiCode, "output_flag_present_flag" );                    pcPPS->setOutputFlagPresentFlag( uiCode==1 );
     
    293293
    294294#if IL_SL_SIGNALLING_N0371
    295   pcPPS->setPPS( pcPPS->getLayerId(), pcPPS ); 
     295  pcPPS->setPPS( pcPPS->getLayerId(), pcPPS );
    296296#endif
    297297
     
    301301    pcPPS->getScalingList()->setLayerId( pcPPS->getLayerId() );
    302302
    303     if( pcPPS->getLayerId() > 0 ) 
     303    if( pcPPS->getLayerId() > 0 )
    304304    {
    305305      READ_FLAG( uiCode, "pps_pred_scaling_list_flag" );           pcPPS->setPredScalingListFlag( uiCode ? true : false );
    306306      pcPPS->getScalingList()->setPredScalingListFlag( pcPPS->getPredScalingListFlag() );
    307      
     307
    308308      if( pcPPS->getPredScalingListFlag() )
    309309      {
     
    319319        }
    320320
    321         // It is a requirement of bitstream conformance that, when a PPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB and 
     321        // It is a requirement of bitstream conformance that, when a PPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB and
    322322        // pps_infer_scaling_list_flag in the PPS is equal to 1, pps_infer_scaling_list_flag shall be equal to 0 for the PPS that is active for the layer with nuh_layer_id equal to pps_scaling_list_ref_layer_id
    323323        assert( pcPPS->getPPS( pcPPS->getScalingListRefLayerId() )->getPredScalingListFlag() == false );
    324324
    325         // It is a requirement of bitstream conformance that, when a PPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB, 
     325        // It is a requirement of bitstream conformance that, when a PPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB,
    326326        // the layer with nuh_layer_id equal to pps_scaling_list_ref_layer_id shall be a direct or indirect reference layer of the layer with nuh_layer_id equal to nuhLayerIdB
    327327        assert( pcPPS->getSPS()->getVPS()->getScalingListLayerDependency( pcPPS->getLayerId(), pcPPS->getScalingListRefLayerId() ) == true );
     
    450450  {
    451451    READ_FLAG(   uiCode, "tiles_fixed_structure_flag");               pcVUI->setTilesFixedStructureFlag(uiCode);
     452#if M0464_TILE_BOUNDARY_ALIGNED_FLAG
     453    if ( pcSPS->getLayerId() > 0 )
     454    {
     455      READ_FLAG( uiCode, "tile_boundaries_aligned_flag" ); pcVUI->setTileBoundariesAlignedFlag( uiCode == 1 );
     456    }
     457#endif
    452458    READ_FLAG(   uiCode, "motion_vectors_over_pic_boundaries_flag");  pcVUI->setMotionVectorsOverPicBoundariesFlag(uiCode);
    453459    READ_FLAG(   uiCode, "restricted_ref_pic_lists_flag");            pcVUI->setRestrictedRefPicListsFlag(uiCode);
     
    536542}
    537543
    538 #if SVC_EXTENSION
     544#if SPS_SUB_LAYER_INFO
    539545Void TDecCavlc::parseSPS(TComSPS* pcSPS, ParameterSetManagerDecoder *parameterSetManager)
    540546#else
     
    548554  UInt  uiCode;
    549555  READ_CODE( 4,  uiCode, "sps_video_parameter_set_id");          pcSPS->setVPSId        ( uiCode );
    550 #if SVC_EXTENSION
     556#if SPS_SUB_LAYER_INFO
    551557  if(pcSPS->getLayerId() == 0)
    552558  {
     
    554560    READ_CODE( 3,  uiCode, "sps_max_sub_layers_minus1" );          pcSPS->setMaxTLayers   ( uiCode+1 );
    555561    assert(uiCode <= 6);
    556  
     562
    557563    READ_FLAG( uiCode, "sps_temporal_id_nesting_flag" );               pcSPS->setTemporalIdNestingFlag ( uiCode > 0 ? true : false );
    558 #if SVC_EXTENSION
     564#if SPS_SUB_LAYER_INFO
    559565  }
    560566  else
     
    563569    pcSPS->setTemporalIdNestingFlag( parameterSetManager->getPrefetchedVPS(pcSPS->getVPSId())->getTemporalNestingFlag() );
    564570  }
     571#endif
    565572#if IL_SL_SIGNALLING_N0371
    566573  pcSPS->setVPS( parameterSetManager->getPrefetchedVPS(pcSPS->getVPSId()) );
    567574  pcSPS->setSPS( pcSPS->getLayerId(), pcSPS );
    568575#endif
    569 #endif
    570576  if ( pcSPS->getMaxTLayers() == 1 )
    571577  {
    572578    // sps_temporal_id_nesting_flag must be 1 when sps_max_sub_layers_minus1 is 0
    573 #if SVC_EXTENSION
     579#if SPS_SUB_LAYER_INFO
    574580    assert( pcSPS->getTemporalIdNestingFlag() == true );
    575581#else
     
    592598  if( pcSPS->getLayerId() > 0 )
    593599  {
    594     READ_FLAG( uiCode, "update_rep_format_flag" );                 
     600    READ_FLAG( uiCode, "update_rep_format_flag" );
    595601    pcSPS->setUpdateRepFormatFlag( uiCode ? true : false );
    596602  }
     
    599605    pcSPS->setUpdateRepFormatFlag( true );
    600606  }
    601   if( pcSPS->getLayerId() == 0 || pcSPS->getUpdateRepFormatFlag() ) 
     607  if( pcSPS->getLayerId() == 0 || pcSPS->getUpdateRepFormatFlag() )
    602608  {
    603609#endif
     
    633639  }
    634640#if REPN_FORMAT_IN_VPS
    635   if(  pcSPS->getLayerId() == 0 || pcSPS->getUpdateRepFormatFlag() ) 
     641  if(  pcSPS->getLayerId() == 0 || pcSPS->getUpdateRepFormatFlag() )
    636642  {
    637643#endif
     
    653659  UInt subLayerOrderingInfoPresentFlag;
    654660  READ_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag");
    655  
     661
    656662  for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++)
    657663  {
     
    722728          }
    723729
    724           // It is a requirement of bitstream conformance that, when an SPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB and 
     730          // It is a requirement of bitstream conformance that, when an SPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB and
    725731          // sps_infer_scaling_list_flag in the SPS is equal to 1, sps_infer_scaling_list_flag shall be equal to 0 for the SPS that is active for the layer with nuh_layer_id equal to sps_scaling_list_ref_layer_id
    726732          assert( pcSPS->getSPS( pcSPS->getScalingListRefLayerId() )->getPredScalingListFlag() == false );
    727733
    728           // It is a requirement of bitstream conformance that, when an SPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB, 
     734          // It is a requirement of bitstream conformance that, when an SPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB,
    729735          // the layer with nuh_layer_id equal to sps_scaling_list_ref_layer_id shall be a direct or indirect reference layer of the layer with nuh_layer_id equal to nuhLayerIdB
    730736          assert( pcSPS->getVPS()->getScalingListLayerDependency( pcSPS->getLayerId(), pcSPS->getScalingListRefLayerId() ) == true );
     
    835841  assert( uiCode == 0 );
    836842#endif
     843#if SCALED_REF_LAYER_OFFSETS
    837844  if( pcSPS->getLayerId() > 0 )
    838845  {
    839     Int iCode; 
     846    Int iCode;
    840847    READ_UVLC( uiCode,      "num_scaled_ref_layer_offsets" ); pcSPS->setNumScaledRefLayerOffsets(uiCode);
    841848    for(Int i = 0; i < pcSPS->getNumScaledRefLayerOffsets(); i++)
     
    848855    }
    849856  }
     857#endif
    850858#if M0463_VUI_EXT_ILP_REF
    851859  ////   sps_extension_vui_parameters( )
    852860  if( pcSPS->getVuiParameters()->getBitstreamRestrictionFlag() )
    853   { 
    854     READ_UVLC( uiCode, "num_ilp_restricted_ref_layers" ); pcSPS->setNumIlpRestrictedRefLayers( uiCode ); 
    855     for( Int i = 0; i < pcSPS->getNumIlpRestrictedRefLayers( ); i++ ) 
    856     { 
    857       READ_UVLC( uiCode, "min_spatial_segment_offset_plus1" ); pcSPS->setMinSpatialSegmentOffsetPlus1( i, uiCode ); 
    858       if( pcSPS->getMinSpatialSegmentOffsetPlus1( i ) > 0 ) 
    859       { 
    860         READ_FLAG( uiCode, "ctu_based_offset_enabled_flag[ i ]"); pcSPS->setCtuBasedOffsetEnabledFlag(i, uiCode == 1 ); 
    861         if( pcSPS->getCtuBasedOffsetEnabledFlag( i ) ) 
    862         {
    863           READ_UVLC( uiCode, "min_horizontal_ctu_offset_plus1[ i ]"); pcSPS->setMinHorizontalCtuOffsetPlus1( i, uiCode ); 
    864         }
    865       } 
    866     } 
    867   } 
     861  {
     862    READ_UVLC( uiCode, "num_ilp_restricted_ref_layers" ); pcSPS->setNumIlpRestrictedRefLayers( uiCode );
     863    for( Int i = 0; i < pcSPS->getNumIlpRestrictedRefLayers( ); i++ )
     864    {
     865      READ_UVLC( uiCode, "min_spatial_segment_offset_plus1" ); pcSPS->setMinSpatialSegmentOffsetPlus1( i, uiCode );
     866      if( pcSPS->getMinSpatialSegmentOffsetPlus1( i ) > 0 )
     867      {
     868        READ_FLAG( uiCode, "ctu_based_offset_enabled_flag[ i ]"); pcSPS->setCtuBasedOffsetEnabledFlag(i, uiCode == 1 );
     869        if( pcSPS->getCtuBasedOffsetEnabledFlag( i ) )
     870        {
     871          READ_UVLC( uiCode, "min_horizontal_ctu_offset_plus1[ i ]"); pcSPS->setMinHorizontalCtuOffsetPlus1( i, uiCode );
     872        }
     873      }
     874    }
     875  }
    868876  ////   sps_extension_vui_parameters( ) END
    869877#endif
     
    9921000}
    9931001
    994 #if SVC_EXTENSION
    9951002#if VPS_EXTNS
    9961003Void TDecCavlc::parseVPSExtension(TComVPS *vps)
     
    10111018  vps->setNumScalabilityTypes(numScalabilityTypes);
    10121019
     1020#if VPS_SPLIT_FLAG
    10131021  for(j = 0; j < numScalabilityTypes - vps->getSplittingFlag(); j++)
     1022#else
     1023  for(j = 0; j < numScalabilityTypes; j++)
     1024#endif
    10141025  {
    10151026    READ_CODE( 3, uiCode, "dimension_id_len_minus1[j]" ); vps->setDimensionIdLen(j, uiCode + 1);
    10161027  }
    1017 
     1028#if VPS_SPLIT_FLAG
    10181029  if(vps->getSplittingFlag())
    10191030  {
     
    10271038    numBits = 6;
    10281039  }
     1040#else
     1041  if(vps->getSplittingFlag())
     1042  {
     1043    UInt numBits = 0;
     1044    for(j = 0; j < numScalabilityTypes; j++)
     1045    {
     1046      numBits += vps->getDimensionIdLen(j);
     1047    }
     1048    assert( numBits <= 6 );
     1049  }
     1050#endif
    10291051
    10301052  READ_FLAG( uiCode, "vps_nuh_layer_id_present_flag" ); vps->setNuhLayerIdPresentFlag(uiCode ? true : false);
     
    10441066    vps->setLayerIdInVps(vps->getLayerIdInNuh(i), i);
    10451067
    1046     if( !vps->getSplittingFlag() )
    1047     {
    1048       for(j = 0; j < numScalabilityTypes; j++)
    1049       {
    1050         READ_CODE( vps->getDimensionIdLen(j), uiCode, "dimension_id[i][j]" ); vps->setDimensionId(i, j, uiCode);
    1051         assert( uiCode <= vps->getMaxLayerId() );
    1052       }
    1053     }
    1054   }
    1055 #endif
    1056 #if VIEW_ID_RELATED_SIGNALING 
    1057   // if ( pcVPS->getNumViews() > 1 ) 
    1058   //   However, this is a bug in the text since, view_id_len_minus1 is needed to parse view_id_val. 
     1068#if VPS_SPLIT_FLAG
     1069    if(!vps->getSplittingFlag())
     1070#endif
     1071    for(j = 0; j < numScalabilityTypes; j++)
     1072    {
     1073      READ_CODE( vps->getDimensionIdLen(j), uiCode, "dimension_id[i][j]" ); vps->setDimensionId(i, j, uiCode);
     1074      assert( uiCode <= vps->getMaxLayerId() );
     1075    }
     1076  }
     1077#endif
     1078#if VIEW_ID_RELATED_SIGNALING
     1079  // if ( pcVPS->getNumViews() > 1 )
     1080  //   However, this is a bug in the text since, view_id_len_minus1 is needed to parse view_id_val.
    10591081  {
    10601082    READ_CODE( 4, uiCode, "view_id_len_minus1" ); vps->setViewIdLenMinus1( uiCode );
     
    10661088  }
    10671089#endif
     1090#if VPS_MOVE_DIR_DEPENDENCY_FLAG
    10681091#if VPS_EXTN_DIRECT_REF_LAYERS
    10691092  // For layer 0
     
    10851108  }
    10861109#endif
     1110#endif
    10871111#if JCTVC_M0203_INTERLAYER_PRED_IDC
    10881112#if N0120_MAX_TID_REF_PRESENT_FLAG
     
    10951119#if N0120_MAX_TID_REF_CFG
    10961120      assert( uiCode <= vps->getMaxTLayers());
    1097 #else 
     1121#else
    10981122      assert( uiCode <= vps->getMaxTLayers()+ 1 );
    1099 #endif 
    1100     }
    1101   }
    1102   else 
     1123#endif
     1124    }
     1125  }
     1126  else
    11031127  {
    11041128    for(i = 0; i < vps->getMaxLayers() - 1; i++)
     
    11201144#if VPS_EXTN_PROFILE_INFO
    11211145  // Profile-tier-level signalling
     1146#if VPS_PROFILE_OUTPUT_LAYERS
    11221147  READ_CODE( 10, uiCode, "vps_number_layer_sets_minus1" );     assert( uiCode == (vps->getNumLayerSets() - 1) );
    11231148  READ_CODE(  6, uiCode, "vps_num_profile_tier_level_minus1"); vps->setNumProfileTierLevel( uiCode + 1 );
    11241149  vps->getPTLForExtnPtr()->resize(vps->getNumProfileTierLevel());
    11251150  for(Int idx = 1; idx <= vps->getNumProfileTierLevel() - 1; idx++)
     1151#else
     1152  vps->getPTLForExtnPtr()->resize(vps->getNumLayerSets());
     1153  for(Int idx = 1; idx <= vps->getNumLayerSets() - 1; idx++)
     1154#endif
    11261155  {
    11271156    READ_FLAG( uiCode, "vps_profile_present_flag[i]" ); vps->setProfilePresentFlag(idx, uiCode ? true : false);
    11281157    if( !vps->getProfilePresentFlag(idx) )
    11291158    {
     1159#if VPS_PROFILE_OUTPUT_LAYERS
    11301160      READ_CODE( 6, uiCode, "profile_ref_minus1[i]" ); vps->setProfileLayerSetRef(idx, uiCode + 1);
     1161#else
     1162      READ_UVLC( uiCode, "vps_profile_layer_set_ref_minus1[i]" ); vps->setProfileLayerSetRef(idx, uiCode + 1);
     1163#endif
    11311164      assert( vps->getProfileLayerSetRef(idx) < idx );
    1132 
    11331165      // Copy profile information as indicated
    11341166      vps->getPTLForExtn(idx)->copyProfileInfo( vps->getPTLForExtn( vps->getProfileLayerSetRef(idx) ) );
     
    11381170#endif
    11391171
     1172#if VPS_PROFILE_OUTPUT_LAYERS
    11401173  READ_FLAG( uiCode, "more_output_layer_sets_than_default_flag" ); vps->setMoreOutputLayerSetsThanDefaultFlag( uiCode ? true : false );
    11411174  Int numOutputLayerSets = 0;
     
    11981231    READ_CODE( numBits, uiCode, "profile_level_tier_idx[i]" );     vps->setProfileLevelTierIdx(i, uiCode);
    11991232  }
    1200 
     1233#else
     1234#if VPS_EXTN_OP_LAYER_SETS
     1235  // Target output layer signalling
     1236  READ_UVLC( uiCode,            "vps_num_output_layer_sets"); vps->setNumOutputLayerSets(uiCode);
     1237  for(i = 0; i < vps->getNumOutputLayerSets(); i++)
     1238  {
     1239#if VPS_OUTPUT_LAYER_SET_IDX
     1240    READ_UVLC( uiCode,           "vps_output_layer_set_idx_minus1[i]"); vps->setOutputLayerSetIdx(i, uiCode + 1);
     1241#else
     1242    READ_UVLC( uiCode,           "vps_output_layer_set_idx[i]"); vps->setOutputLayerSetIdx(i, uiCode);
     1243#endif
     1244    Int lsIdx = vps->getOutputLayerSetIdx(i);
     1245    for(j = 0; j <= vps->getMaxLayerId(); j++)
     1246    {
     1247      if(vps->getLayerIdIncludedFlag(lsIdx, j))
     1248      {
     1249        READ_FLAG( uiCode, "vps_output_layer_flag[lsIdx][j]"); vps->setOutputLayerFlag(lsIdx, j, uiCode);
     1250      }
     1251    }
     1252  }
     1253#endif
     1254#endif
    12011255#if REPN_FORMAT_IN_VPS
    1202   READ_FLAG( uiCode, "rep_format_idx_present_flag"); 
     1256  READ_FLAG( uiCode, "rep_format_idx_present_flag");
    12031257  vps->setRepFormatIdxPresentFlag( uiCode ? true : false );
    12041258
     
    12191273    parseRepFormat( vps->getVpsRepFormat(i) );
    12201274  }
    1221  
     1275
    12221276  // Default assignment for layer 0
    12231277  vps->setVpsRepFormatIdx( 0, 0 );
     
    12581312  READ_FLAG(uiCode, "cross_layer_irap_aligned_flag" );
    12591313  vps->setCrossLayerIrapAlignFlag(uiCode);
    1260 #endif
    1261 
     1314#endif
     1315
     1316#if !VPS_MOVE_DIR_DEPENDENCY_FLAG
     1317#if VPS_EXTN_DIRECT_REF_LAYERS
     1318  // For layer 0
     1319  vps->setNumDirectRefLayers(0, 0);
     1320  // For other layers
     1321  for( Int layerCtr = 1; layerCtr <= vps->getMaxLayers() - 1; layerCtr++)
     1322  {
     1323    UInt numDirectRefLayers = 0;
     1324    for( Int refLayerCtr = 0; refLayerCtr < layerCtr; refLayerCtr++)
     1325    {
     1326      READ_FLAG(uiCode, "direct_dependency_flag[i][j]" ); vps->setDirectDependencyFlag(layerCtr, refLayerCtr, uiCode? true : false);
     1327      if(uiCode)
     1328      {
     1329        vps->setRefLayerId(layerCtr, numDirectRefLayers, refLayerCtr);
     1330        numDirectRefLayers++;
     1331      }
     1332    }
     1333    vps->setNumDirectRefLayers(layerCtr, numDirectRefLayers);
     1334  }
     1335#endif
     1336#endif
    12621337#if VPS_EXTN_DIRECT_REF_LAYERS && M0457_PREDICTION_INDICATIONS
    12631338  READ_UVLC( uiCode,           "direct_dep_type_len_minus2"); vps->setDirectDepTypeLen(uiCode+2);
     
    12791354    {
    12801355      for(j = 0; j < i; j++)
    1281         {     
     1356        {
    12821357          vps->setScalingListLayerDependency( i, j, vps->checkLayerDependency( i,j ) );
    12831358        }
     
    12981373    }
    12991374    parseVPSVUI(vps);
    1300 #endif 
     1375#endif
    13011376  }
    13021377}
     
    13071382  UInt uiCode;
    13081383  READ_CODE( 2, uiCode, "chroma_format_idc" );               repFormat->setChromaFormatVpsIdc( uiCode );
    1309  
     1384
    13101385  if( repFormat->getChromaFormatVpsIdc() == 3 )
    13111386  {
     
    13151390  READ_CODE ( 16, uiCode, "pic_width_in_luma_samples" );     repFormat->setPicWidthVpsInLumaSamples ( uiCode );
    13161391  READ_CODE ( 16, uiCode, "pic_height_in_luma_samples" );    repFormat->setPicHeightVpsInLumaSamples( uiCode );
    1317  
     1392
    13181393  READ_CODE( 4, uiCode, "bit_depth_luma_minus8" );           repFormat->setBitDepthVpsLuma  ( uiCode + 8 );
    13191394  READ_CODE( 4, uiCode, "bit_depth_chroma_minus8" );         repFormat->setBitDepthVpsChroma( uiCode + 8 );
     
    13811456    for(j = 0; j < vps->getNumDirectRefLayers(vps->getLayerIdInNuh(i)); j++)
    13821457    {
    1383       READ_FLAG( uiCode, "tile_boundaries_aligned_flag[i][j]" ); vps->setTileBoundariesAlignedFlag(i,j,(uiCode == 1));     
    1384     }
    1385   } 
    1386 #endif 
     1458      READ_FLAG( uiCode, "tile_boundaries_aligned_flag[i][j]" ); vps->setTileBoundariesAlignedFlag(i,j,(uiCode == 1));
     1459    }
     1460  }
     1461#endif
    13871462#if N0160_VUI_EXT_ILP_REF
    1388     READ_FLAG( uiCode, "num_ilp_restricted_ref_layers" ); vps->setNumIlpRestrictedRefLayers( uiCode == 1 ); 
     1463    READ_FLAG( uiCode, "num_ilp_restricted_ref_layers" ); vps->setNumIlpRestrictedRefLayers( uiCode == 1 );
    13891464  if( vps->getNumIlpRestrictedRefLayers())
    13901465  {
     
    13931468      for(j = 0; j < vps->getNumDirectRefLayers(vps->getLayerIdInNuh(i)); j++)
    13941469      {
    1395         READ_UVLC( uiCode, "min_spatial_segment_offset_plus1[i][j]" ); vps->setMinSpatialSegmentOffsetPlus1( i, j, uiCode ); 
    1396         if( vps->getMinSpatialSegmentOffsetPlus1(i,j ) > 0 ) 
    1397         { 
    1398           READ_FLAG( uiCode, "ctu_based_offset_enabled_flag[i][j]"); vps->setCtuBasedOffsetEnabledFlag(i, j, uiCode == 1 ); 
    1399           if(vps->getCtuBasedOffsetEnabledFlag(i,j)) 
     1470        READ_UVLC( uiCode, "min_spatial_segment_offset_plus1[i][j]" ); vps->setMinSpatialSegmentOffsetPlus1( i, j, uiCode );
     1471        if( vps->getMinSpatialSegmentOffsetPlus1(i,j ) > 0 )
     1472        {
     1473          READ_FLAG( uiCode, "ctu_based_offset_enabled_flag[i][j]"); vps->setCtuBasedOffsetEnabledFlag(i, j, uiCode == 1 );
     1474          if(vps->getCtuBasedOffsetEnabledFlag(i,j))
    14001475          {
    1401             READ_UVLC( uiCode, "min_horizontal_ctu_offset_plus1[i][j]"); vps->setMinHorizontalCtuOffsetPlus1( i,j, uiCode ); 
     1476            READ_UVLC( uiCode, "min_horizontal_ctu_offset_plus1[i][j]"); vps->setMinHorizontalCtuOffsetPlus1( i,j, uiCode );
    14021477          }
    1403         } 
    1404       } 
    1405     }
    1406   }
    1407 #endif
    1408 }
    1409 #endif
    1410 #endif //SVC_EXTENSION
    1411 
     1478        }
     1479      }
     1480    }
     1481  }
     1482#endif
     1483}
     1484#endif
    14121485Void TDecCavlc::parseSliceHeader (TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager)
    14131486{
     
    14821555  if(!rpcSlice->getDependentSliceSegmentFlag())
    14831556  {
    1484 #if SVC_EXTENSION
    14851557#if POC_RESET_FLAG
    1486     Int iBits = 0; 
     1558    Int iBits = 0;
    14871559    if(rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > iBits)
    14881560    {
     
    15001572    }
    15011573#else
     1574#if SH_DISCARDABLE_FLAG
    15021575    if(rpcSlice->getPPS()->getNumExtraSliceHeaderBits()>0)
    15031576    {
     
    15081581      READ_FLAG(uiCode, "slice_reserved_undetermined_flag[]"); // ignored
    15091582    }
    1510 #endif
    1511 #else //SVC_EXTENSION
     1583#else
    15121584    for (Int i = 0; i < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++)
    15131585    {
    15141586      READ_FLAG(uiCode, "slice_reserved_undetermined_flag[]"); // ignored
    15151587    }
    1516 #endif //SVC_EXTENSION
     1588#endif
     1589#endif
    15171590
    15181591    READ_UVLC (    uiCode, "slice_type" );            rpcSlice->setSliceType((SliceType)uiCode);
     
    16761749            rps->setDeltaPOC(j, - rpcSlice->getPOC() + pocLsbLt);
    16771750            rps->setCheckLTMSBPresent(j,false);
    1678            
     1751
    16791752            // reset deltaPocMSBCycleLT for first LTRP from slice header if MSB not present
    16801753            if( j == offset+(numOfLtrp-numLtrpInSPS)-1 )
     
    17791852#else
    17801853    else if( rpcSlice->getVPS()->getIlpSshSignalingEnabledFlag() == false )
    1781 #endif 
     1854#endif
    17821855    {
    17831856      rpcSlice->setInterLayerPredEnabledFlag(true);
     
    20072080
    20082081#if REPN_FORMAT_IN_VPS
     2082#if O0194_REPN_FORMAT_IN_VPS_BUGFIX
     2083    g_bitDepthYLayer[rpcSlice->getLayerId()]     = rpcSlice->getBitDepthY();
     2084    g_bitDepthCLayer[rpcSlice->getLayerId()]     = rpcSlice->getBitDepthC();
     2085#endif
    20092086    assert( rpcSlice->getSliceQp() >= -rpcSlice->getQpBDOffsetY() );
    20102087#else
     
    21172194  {
    21182195    Int endOfSliceHeaderLocation = m_pcBitstream->getByteLocation();
    2119    
     2196
    21202197    // Adjust endOfSliceHeaderLocation to account for emulation prevention bytes in the slice segment header
    21212198    for ( UInt curByteIdx  = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ )
     
    25232600#if IL_SL_SIGNALLING_N0371
    25242601      if ( scalingList->getLayerId() > 0 && scalingList->getPredScalingListFlag() )
    2525       { 
     2602      {
    25262603        READ_FLAG( code, "scaling_list_pred_mode_flag");
    25272604        scalingListPredModeFlag = (code) ? true : false;
  • branches/SHM-4.0-dev/source/Lib/TLibDecoder/TDecCAVLC.h

    r452 r466  
    7272  Void  parseQtRootCbf      ( UInt uiAbsPartIdx, UInt& uiQtRootCbf );
    7373  Void  parseVPS            ( TComVPS* pcVPS );
    74 #if SPS_EXTENSION
    7574#if VPS_EXTNS
    7675  Void  parseVPSExtension   ( TComVPS* pcVPS );
     
    8382  Void  parseRepFormat      ( RepFormat *repFormat );
    8483#endif
     84#if SPS_SUB_LAYER_INFO
    8585  Void  parseSPS            ( TComSPS* pcSPS, ParameterSetManagerDecoder *parameterSetManager );
    86   Void  parseSPSExtension    ( TComSPS* pcSPS );
    87 #else //SVC_EXTENSION
     86#else
    8887  Void  parseSPS            ( TComSPS* pcSPS );
    89 #endif //SVC_EXTENSION
     88#endif
     89#if SPS_EXTENSION
     90  Void parseSPSExtension    ( TComSPS* pcSPS );
     91#endif
    9092  Void  parsePPS            ( TComPPS* pcPPS);
    9193  Void  parseVUI            ( TComVUI* pcVUI, TComSPS* pcSPS );
  • branches/SHM-4.0-dev/source/Lib/TLibDecoder/TDecCu.cpp

    r442 r466  
    616616    curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCrQpOffset() + pcCU->getSlice()->getSliceQpDeltaCr();
    617617  }
     618#if O0194_REPN_FORMAT_IN_VPS_BUGFIX
     619#if REPN_FORMAT_IN_VPS
     620  m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), eText, pcCU->getSlice()->getQpBDOffsetC(), curChromaQpOffset );
     621#else
    618622  m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
     623#endif
     624#else
     625  m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
     626#endif
    619627
    620628  Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)eText];
     
    768776  // Cb and Cr
    769777  Int curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCbQpOffset() + pcCU->getSlice()->getSliceQpDeltaCb();
     778#if O0194_REPN_FORMAT_IN_VPS_BUGFIX
     779#if REPN_FORMAT_IN_VPS
     780  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_CHROMA, pcCU->getSlice()->getQpBDOffsetC(), curChromaQpOffset );
     781#else
    770782  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
     783#endif
     784#else
     785  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
     786#endif
    771787
    772788  uiWidth  >>= 1;
     
    776792
    777793  curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCrQpOffset() + pcCU->getSlice()->getSliceQpDeltaCr();
     794#if O0194_REPN_FORMAT_IN_VPS_BUGFIX
     795#if REPN_FORMAT_IN_VPS
     796  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_CHROMA, pcCU->getSlice()->getQpBDOffsetC(), curChromaQpOffset );
     797#else
    778798  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
     799#endif
     800#else
     801  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
     802#endif
    779803
    780804  piCoeff = pcCU->getCoeffCr(); pResi = m_ppcYuvResi[uiDepth]->getCrAddr();
  • branches/SHM-4.0-dev/source/Lib/TLibDecoder/TDecEntropy.h

    r452 r466  
    6666
    6767  virtual Void  parseVPS                  ( TComVPS* pcVPS )                       = 0;
    68 #if SVC_EXTENSION
     68#if SPS_SUB_LAYER_INFO
    6969  virtual Void  parseSPS                  ( TComSPS* pcSPS, ParameterSetManagerDecoder *parameterSetManager )           = 0;
    7070#else
     
    134134  Void    resetEntropy                ( TComSlice* p)           { m_pcEntropyDecoderIf->resetEntropy(p);                    }
    135135  Void    decodeVPS                   ( TComVPS* pcVPS ) { m_pcEntropyDecoderIf->parseVPS(pcVPS); }
    136 #if SVC_EXTENSION
     136#if SPS_SUB_LAYER_INFO
    137137  Void    decodeSPS                   ( TComSPS* pcSPS, ParameterSetManagerDecoder *parameterSetManager )    { m_pcEntropyDecoderIf->parseSPS(pcSPS, parameterSetManager);                    }
    138138#else
  • branches/SHM-4.0-dev/source/Lib/TLibDecoder/TDecSbac.h

    r452 r466  
    7676  Void  setBitstream              ( TComInputBitstream* p  ) { m_pcBitstream = p; m_pcTDecBinIf->init( p ); }
    7777  Void  parseVPS                  ( TComVPS* /*pcVPS*/ ) {}
    78 #if SVC_EXTENSION
     78#if SPS_SUB_LAYER_INFO
    7979  Void  parseSPS                  ( TComSPS* /*pcSPS*/, ParameterSetManagerDecoder * /*parameterSetManager*/ ) {}
    8080#else
  • branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncCavlc.cpp

    r464 r466  
    359359  {
    360360    WRITE_FLAG(pcVUI->getTilesFixedStructureFlag(),             "tiles_fixed_structure_flag");
     361#if M0464_TILE_BOUNDARY_ALIGNED_FLAG
     362    if ( pcSPS->getLayerId() > 0 )
     363    {
     364      WRITE_FLAG( pcVUI->getTileBoundariesAlignedFlag( ) ? 1 : 0 , "tile_boundaries_aligned_flag" );
     365    }
     366#endif
    361367    WRITE_FLAG(pcVUI->getMotionVectorsOverPicBoundariesFlag(),  "motion_vectors_over_pic_boundaries_flag");
    362368    WRITE_FLAG(pcVUI->getRestrictedRefPicListsFlag(),           "restricted_ref_pic_lists_flag");
     
    448454#endif
    449455  WRITE_CODE( pcSPS->getVPSId (),          4,       "sps_video_parameter_set_id" );
    450 #if SVC_EXTENSION
     456#if SPS_SUB_LAYER_INFO
    451457  if(pcSPS->getLayerId() == 0)
    452458  {
     
    454460    WRITE_CODE( pcSPS->getMaxTLayers() - 1,  3,       "sps_max_sub_layers_minus1" );
    455461    WRITE_FLAG( pcSPS->getTemporalIdNestingFlag() ? 1 : 0,                             "sps_temporal_id_nesting_flag" );
    456 #if SVC_EXTENSION
     462#if SPS_SUB_LAYER_INFO
    457463  }
    458464#endif
     
    664670  WRITE_FLAG( 0, "inter_view_mv_vert_constraint_flag" );
    665671#endif
     672#if SCALED_REF_LAYER_OFFSETS
    666673  if( pcSPS->getLayerId() > 0 )
    667674  {
     
    676683    }
    677684  }
     685#endif
    678686#if M0463_VUI_EXT_ILP_REF
    679687  ////   sps_extension_vui_parameters( )
     
    820828}
    821829
    822 #if SVC_EXTENSION
    823830#if VPS_EXTNS
    824831Void TEncCavlc::codeVPSExtension (TComVPS *vps)
     
    836843  }
    837844
     845#if VPS_SPLIT_FLAG
    838846  for(j = 0; j < vps->getNumScalabilityTypes() - vps->getSplittingFlag(); j++)
     847#else
     848  for(j = 0; j < vps->getNumScalabilityTypes(); j++)
     849#endif
    839850  {
    840851    WRITE_CODE( vps->getDimensionIdLen(j) - 1, 3,      "dimension_id_len_minus1[j]" );
     
    860871      WRITE_CODE( vps->getLayerIdInNuh(i),     6,      "layer_id_in_nuh[i]" );
    861872    }
    862 
    863     if( !vps->getSplittingFlag() )
    864     {
    865       for(j = 0; j < vps->getNumScalabilityTypes(); j++)
    866       {
    867         UInt bits = vps->getDimensionIdLen(j);
    868         WRITE_CODE( vps->getDimensionId(i, j),   bits,   "dimension_id[i][j]" );
    869       }
     873#if VPS_SPLIT_FLAG
     874    if(!vps->getSplittingFlag())
     875#endif
     876    for(j = 0; j < vps->getNumScalabilityTypes(); j++)
     877    {
     878      UInt bits = vps->getDimensionIdLen(j);
     879      WRITE_CODE( vps->getDimensionId(i, j),   bits,   "dimension_id[i][j]" );
    870880    }
    871881  }
     
    883893  }
    884894#endif
     895#if VPS_MOVE_DIR_DEPENDENCY_FLAG
    885896#if VPS_EXTN_DIRECT_REF_LAYERS
    886897  for( Int layerCtr = 1; layerCtr <= vps->getMaxLayers() - 1; layerCtr++)
     
    891902    }
    892903  }
     904#endif
    893905#endif
    894906#if JCTVC_M0203_INTERLAYER_PRED_IDC
     
    914926#if VPS_EXTN_PROFILE_INFO
    915927  // Profile-tier-level signalling
     928#if VPS_PROFILE_OUTPUT_LAYERS
    916929  WRITE_CODE( vps->getNumLayerSets() - 1   , 10, "vps_number_layer_sets_minus1" );     
    917930  WRITE_CODE( vps->getNumProfileTierLevel() - 1,  6, "vps_num_profile_tier_level_minus1");
    918931  for(Int idx = 1; idx <= vps->getNumProfileTierLevel() - 1; idx++)
     932#else
     933  for(Int idx = 1; idx <= vps->getNumLayerSets() - 1; idx++)
     934#endif
    919935  {
    920936    WRITE_FLAG( vps->getProfilePresentFlag(idx),       "vps_profile_present_flag[i]" );
    921937    if( !vps->getProfilePresentFlag(idx) )
    922938    {
     939#if VPS_PROFILE_OUTPUT_LAYERS
    923940      WRITE_CODE( vps->getProfileLayerSetRef(idx) - 1, 6, "profile_ref_minus1[i]" );
     941#else
     942      WRITE_UVLC( vps->getProfileLayerSetRef(idx) - 1, "vps_profile_layer_set_ref_minus1[i]" );
     943#endif
    924944    }
    925945    codePTL( vps->getPTLForExtn(idx), vps->getProfilePresentFlag(idx), vps->getMaxTLayers() - 1 );
     
    927947#endif
    928948
     949#if VPS_PROFILE_OUTPUT_LAYERS
    929950  Int numOutputLayerSets = vps->getNumOutputLayerSets() ;
    930951  WRITE_FLAG(  (numOutputLayerSets > vps->getNumLayerSets()), "more_output_layer_sets_than_default_flag" );
     
    961982    WRITE_CODE( vps->getProfileLevelTierIdx(i), numBits, "profile_level_tier_idx[i]" );     
    962983  }
    963  
     984#else
     985#if VPS_EXTN_OP_LAYER_SETS
     986  // Target output layer signalling
     987  WRITE_UVLC( vps->getNumOutputLayerSets(),            "vps_num_output_layer_sets");
     988  for(i = 0; i < vps->getNumOutputLayerSets(); i++)
     989  {
     990#if VPS_OUTPUT_LAYER_SET_IDX
     991    assert(vps->getOutputLayerSetIdx(i) > 0);
     992    WRITE_UVLC( vps->getOutputLayerSetIdx(i) - 1,           "vps_output_layer_set_idx_minus1[i]");
     993#else
     994    WRITE_UVLC( vps->getOutputLayerSetIdx(i),           "vps_output_layer_set_idx[i]");
     995#endif
     996    Int lsIdx = vps->getOutputLayerSetIdx(i);
     997    for(j = 0; j <= vps->getMaxLayerId(); j++)
     998    {
     999      if(vps->getLayerIdIncludedFlag(lsIdx, j))
     1000      {
     1001        WRITE_FLAG( vps->getOutputLayerFlag(lsIdx, j), "vps_output_layer_flag[lsIdx][j]");
     1002      }
     1003    }
     1004  }
     1005#endif
     1006#endif
     1007
    9641008#if REPN_FORMAT_IN_VPS
    9651009  WRITE_FLAG( vps->getRepFormatIdxPresentFlag(), "rep_format_idx_present_flag");
     
    9881032
    9891033#if JCTVC_M0458_INTERLAYER_RPS_SIG
    990   WRITE_FLAG(vps->getMaxOneActiveRefLayerFlag(), "max_one_active_ref_layer_flag");
     1034      WRITE_FLAG(vps->getMaxOneActiveRefLayerFlag(), "max_one_active_ref_layer_flag");
    9911035#endif
    9921036#if O0215_PHASE_ALIGNMENT
     
    9941038#endif
    9951039#if N0147_IRAP_ALIGN_FLAG
    996   WRITE_FLAG(vps->getCrossLayerIrapAlignFlag(), "cross_layer_irap_aligned_flag");
     1040      WRITE_FLAG(vps->getCrossLayerIrapAlignFlag(), "cross_layer_irap_aligned_flag");
    9971041#endif
     1042#if !VPS_MOVE_DIR_DEPENDENCY_FLAG
     1043#if VPS_EXTN_DIRECT_REF_LAYERS
     1044  for( Int layerCtr = 1; layerCtr <= vps->getMaxLayers() - 1; layerCtr++)
     1045  {
     1046    for( Int refLayerCtr = 0; refLayerCtr < layerCtr; refLayerCtr++)
     1047    {
     1048      WRITE_FLAG(vps->getDirectDependencyFlag(layerCtr, refLayerCtr), "direct_dependency_flag[i][j]" );
     1049    }
     1050  }
     1051#endif
     1052#endif
    9981053#if VPS_EXTN_DIRECT_REF_LAYERS && M0457_PREDICTION_INDICATIONS
    9991054  WRITE_UVLC( vps->getDirectDepTypeLen()-2,                           "direct_dep_type_len_minus2");
     
    11291184}
    11301185#endif
    1131 #endif //SVC_EXTENSION
    11321186
    11331187Void TEncCavlc::codeSliceHeader         ( TComSlice* pcSlice )
     
    11751229  if ( !pcSlice->getDependentSliceSegmentFlag() )
    11761230  {
    1177 #if SVC_EXTENSION
     1231
    11781232#if POC_RESET_FLAG
    11791233    Int iBits = 0;
     
    11951249    }
    11961250#else
     1251#if SH_DISCARDABLE_FLAG
    11971252    if (pcSlice->getPPS()->getNumExtraSliceHeaderBits()>0)
    11981253    {
     
    12051260      WRITE_FLAG(0, "slice_reserved_undetermined_flag[]");
    12061261    }
    1207 #endif
    1208 #else //SVC_EXTENSION
     1262#else
    12091263    for (Int i = 0; i < pcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++)
    12101264    {
     
    12121266      WRITE_FLAG(0, "slice_reserved_undetermined_flag[]");
    12131267    }
    1214 #endif //SVC_EXTENSION
     1268#endif
     1269#endif
    12151270
    12161271    WRITE_UVLC( pcSlice->getSliceType(),       "slice_type" );
  • branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r464 r466  
    753753    pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR));
    754754#if SVC_EXTENSION
     755#if ILR_RESTR && ILR_RESTR_FIX
     756    Int interLayerPredLayerIdcTmp[MAX_VPS_LAYER_ID_PLUS1];
     757    Int activeNumILRRefIdxTmp = 0;
     758#endif
    755759    if (m_layerId > 0)
    756760    {
    757       Int interLayerPredLayerIdcTmp[MAX_VPS_LAYER_ID_PLUS1];
    758       Int activeNumILRRefIdxTmp = 0;
    759 
    760761      for( Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ )
    761762      {
     
    768769        pcSlice->setBaseColPic( *cListPic, refLayerIdc );
    769770
     771#if ILR_RESTR && ILR_RESTR_FIX
    770772        // Apply temporal layer restriction to inter-layer prediction
    771773        Int maxTidIlRefPicsPlus1 = m_pcEncTop->getVPS()->getMaxTidIlRefPicsPlus1(pcSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getLayerId());
     
    778780          continue; // ILP is not valid due to temporal layer restriction
    779781        }
    780 
     782#endif
     783
     784#if SCALED_REF_LAYER_OFFSETS
    781785        const Window &scalEL = m_pcEncTop->getScaledRefLayerWindow(refLayerIdc);
    782786
     
    786790        Int widthEL   = pcPic->getPicYuvRec()->getWidth()  - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset();
    787791        Int heightEL  = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset()  - scalEL.getWindowBottomOffset();
    788 
     792#else
     793        const Window &confBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getConformanceWindow();
     794        const Window &confEL = pcPic->getPicYuvRec()->getConformanceWindow();
     795
     796        Int widthBL   = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();
     797        Int heightBL  = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();
     798
     799        Int widthEL   = pcPic->getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset();
     800        Int heightEL  = pcPic->getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset();
     801#endif
    789802        g_mvScalingFactor[refLayerIdc][0] = widthEL  == widthBL  ? 4096 : Clip3(-4096, 4095, ((widthEL  << 8) + (widthBL  >> 1)) / widthBL);
    790803        g_mvScalingFactor[refLayerIdc][1] = heightEL == heightBL ? 4096 : Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL);
     
    810823      }
    811824
     825#if ILR_RESTR && ILR_RESTR_FIX
    812826      // Update the list of active inter-layer pictures
    813827      for ( Int i = 0; i < activeNumILRRefIdxTmp; i++)
     
    821835        pcSlice->setInterLayerPredEnabledFlag(false);
    822836      }
     837#endif
    823838     
    824839      if( pocCurr % m_pcCfg->getIntraPeriod() == 0 )
     
    16011616          pcSlice->setSliceSegmentCurStartCUAddr  ( startCUAddrSlice      );
    16021617          pcSlice->setSliceBits(0);
    1603 #if SVC_EXTENSION
    1604           // copy reference list modification info from the first slice, assuming that this information is the same across all slices in the picture
    1605           memcpy( pcSlice->getRefPicListModification(), pcPic->getSlice(0)->getRefPicListModification(), sizeof(TComRefPicListModification) );
    1606 #endif
    16071618          uiNumSlices ++;
    16081619        }
  • branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncSearch.cpp

    r442 r466  
    41194119
    41204120  // prediction pattern
     4121#if O0194_WEIGHTED_PREDICTION_CGS
     4122  // Bug Fix (It did not check WP for BSlices)
     4123  if ( pcCU->getSlice()->getPPS()->getUseWP())
     4124#else
    41214125  if ( pcCU->getSlice()->getPPS()->getUseWP() && pcCU->getSlice()->getSliceType()==P_SLICE )
     4126#endif
    41224127  {
    41234128    xPredInterLumaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, true );
     
    41284133  }
    41294134
     4135#if O0194_WEIGHTED_PREDICTION_CGS
     4136  if ( pcCU->getSlice()->getPPS()->getUseWP())
     4137  ///< Bug Fix (It did not check WP for BSlices)
     4138#else
    41304139  if ( pcCU->getSlice()->getPPS()->getUseWP() && pcCU->getSlice()->getSliceType()==P_SLICE )
     4140#endif
    41314141  {
    41324142    xWeightedPredictionUni( pcCU, pcTemplateCand, uiPartAddr, iSizeX, iSizeY, eRefPicList, pcTemplateCand, iRefIdx );
  • branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncSlice.cpp

    r442 r466  
    22 * License, included below. This software may be subject to other third party
    33 * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license. 
     4 * granted under this license.
    55 *
    66 * Copyright (c) 2010-2013, ITU/ISO/IEC
     
    5151  m_apcPicYuvPred = NULL;
    5252  m_apcPicYuvResi = NULL;
    53  
     53
    5454  m_pdRdPicLambda = NULL;
    5555  m_pdRdPicQp     = NULL;
     
    6969}
    7070
    71 Void TEncSlice::initCtxMem(  UInt i )               
    72 {   
     71Void TEncSlice::initCtxMem(  UInt i )
     72{
    7373  for (std::vector<TEncSbac*>::iterator j = CTXMem.begin(); j != CTXMem.end(); j++)
    7474  {
    7575    delete (*j);
    7676  }
    77   CTXMem.clear(); 
    78   CTXMem.resize(i); 
     77  CTXMem.clear();
     78  CTXMem.resize(i);
    7979}
    8080
     
    8787    m_apcPicYuvPred->create( iWidth, iHeight, iMaxCUWidth, iMaxCUHeight, uhTotalDepth );
    8888  }
    89  
     89
    9090  // create residual picture
    9191  if( m_apcPicYuvResi == NULL )
     
    105105    m_apcPicYuvPred  = NULL;
    106106  }
    107  
     107
    108108  // destroy residual picture
    109109  if ( m_apcPicYuvResi )
     
    113113    m_apcPicYuvResi  = NULL;
    114114  }
    115  
     115
    116116  // free lambda and QP arrays
    117117  if ( m_pdRdPicLambda ) { xFree( m_pdRdPicLambda ); m_pdRdPicLambda = NULL; }
     
    139139#if SVC_EXTENSION
    140140  m_ppcTEncTop        = pcEncTop->getLayerEnc();
    141 #endif 
     141#endif
    142142  m_pcGOPEncoder      = pcEncTop->getGOPEncoder();
    143143  m_pcCuEncoder       = pcEncTop->getCuEncoder();
    144144  m_pcPredSearch      = pcEncTop->getPredSearch();
    145  
     145
    146146  m_pcEntropyCoder    = pcEncTop->getEntropyCoder();
    147147  m_pcCavlcCoder      = pcEncTop->getCavlcCoder();
     
    149149  m_pcBinCABAC        = pcEncTop->getBinCABAC();
    150150  m_pcTrQuant         = pcEncTop->getTrQuant();
    151  
     151
    152152  m_pcBitCounter      = pcEncTop->getBitCounter();
    153153  m_pcRdCost          = pcEncTop->getRdCost();
    154154  m_pppcRDSbacCoder   = pcEncTop->getRDSbacCoder();
    155155  m_pcRDGoOnSbacCoder = pcEncTop->getRDGoOnSbacCoder();
    156  
     156
    157157  // create lambda and QP arrays
    158158  m_pdRdPicLambda     = (Double*)xMalloc( Double, m_pcCfg->getDeltaQpRD() * 2 + 1 );
     
    187187  Double dQP;
    188188  Double dLambda;
    189  
     189
    190190  rpcSlice = pcPic->getSlice(0);
    191191  rpcSlice->setSPS( pSPS );
     
    202202  rpcSlice->setPicOutputFlag( true );
    203203  rpcSlice->setPOC( pocCurr );
    204  
     204
    205205  // depth computation based on GOP size
    206206  Int depth;
     
    230230    }
    231231  }
    232  
     232
    233233  // slice type
    234234  SliceType eSliceType;
    235  
     235
    236236  eSliceType=B_SLICE;
    237237  eSliceType = (pocLast == 0 || pocCurr % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType;
    238  
     238
    239239  rpcSlice->setSliceType    ( eSliceType );
    240  
     240
    241241  // ------------------------------------------------------------------------------------------------------------------
    242242  // Non-referenced frame marking
    243243  // ------------------------------------------------------------------------------------------------------------------
    244  
     244
    245245  if(pocLast == 0)
    246246  {
     
    252252  }
    253253  rpcSlice->setReferenced(true);
    254  
     254
    255255  // ------------------------------------------------------------------------------------------------------------------
    256256  // QP setting
    257257  // ------------------------------------------------------------------------------------------------------------------
    258  
     258
    259259  dQP = m_pcCfg->getQP();
    260260  if(eSliceType!=I_SLICE)
    261261  {
    262262#if REPN_FORMAT_IN_VPS
    263     if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless()))) 
    264 #else
    265     if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getSPS()->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless()))) 
     263    if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless())))
     264#else
     265    if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getSPS()->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless())))
    266266#endif
    267267    {
     
    269269    }
    270270  }
    271  
     271
    272272  // modify QP
    273273  Int* pdQPs = m_pcCfg->getdQPs();
     
    285285  // Lambda computation
    286286  // ------------------------------------------------------------------------------------------------------------------
    287  
     287
    288288  Int iQP;
    289289  Double dOrigQP = dQP;
     
    294294    // compute QP value
    295295    dQP = dOrigQP + ((iDQpIdx+1)>>1)*(iDQpIdx%2 ? -1 : 1);
    296    
     296
    297297    // compute lambda value
    298298    Int    NumberBFrames = ( m_pcCfg->getGOPSize() - 1 );
     
    326326#endif
    327327    }
    328    
     328
    329329    // if hadamard is used in ME process
    330330    if ( !m_pcCfg->getUseHADME() && rpcSlice->getSliceType( ) != I_SLICE )
     
    332332      dLambda *= 0.95;
    333333    }
    334    
     334
    335335#if REPN_FORMAT_IN_VPS
    336336    iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
     
    343343    m_piRdPicQp    [iDQpIdx] = iQP;
    344344  }
    345  
     345
    346346  // obtain dQP = 0 case
    347347  dLambda = m_pdRdPicLambda[0];
    348348  dQP     = m_pdRdPicQp    [0];
    349349  iQP     = m_piRdPicQp    [0];
    350  
     350
    351351  if( rpcSlice->getSliceType( ) != I_SLICE )
    352352  {
     
    359359    Int nCurLayer = rpcSlice->getLayerId();
    360360    Double gamma = xCalEnhLambdaFactor( m_ppcTEncTop[nCurLayer-1]->getQP() - m_ppcTEncTop[nCurLayer]->getQP() ,
    361       1.0 * m_ppcTEncTop[nCurLayer]->getSourceWidth() * m_ppcTEncTop[nCurLayer]->getSourceHeight() 
     361      1.0 * m_ppcTEncTop[nCurLayer]->getSourceWidth() * m_ppcTEncTop[nCurLayer]->getSourceHeight()
    362362      / m_ppcTEncTop[nCurLayer-1]->getSourceWidth() / m_ppcTEncTop[nCurLayer-1]->getSourceHeight() );
    363363    dLambda *= gamma;
     
    392392#endif
    393393
    394 #if RDOQ_CHROMA_LAMBDA 
     394#if RDOQ_CHROMA_LAMBDA
    395395// for RDOQ
    396   m_pcTrQuant->setLambda( dLambda, dLambda / weight );   
     396  m_pcTrQuant->setLambda( dLambda, dLambda / weight );
    397397#else
    398398  m_pcTrQuant->setLambda( dLambda );
     
    401401#if SAO_CHROMA_LAMBDA
    402402// For SAO
    403   rpcSlice   ->setLambda( dLambda, dLambda / weight ); 
     403  rpcSlice   ->setLambda( dLambda, dLambda / weight );
    404404#else
    405405  rpcSlice   ->setLambda( dLambda );
    406406#endif
    407  
     407
    408408#if HB_LAMBDA_FOR_LDC
    409409  // restore original slice type
    410410  eSliceType = (pocLast == 0 || pocCurr % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType;
    411  
     411
    412412#if SVC_EXTENSION
    413413  if(m_pcCfg->getLayerId() > 0)
     
    418418  rpcSlice->setSliceType        ( eSliceType );
    419419#endif
    420  
     420
    421421  if (m_pcCfg->getUseRecalculateQPAccordingToLambda())
    422422  {
    423423    dQP = xGetQPValueAccordingToLambda( dLambda );
    424424#if REPN_FORMAT_IN_VPS
    425     iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );   
    426 #else
    427     iQP = max( -pSPS->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );   
     425    iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
     426#else
     427    iQP = max( -pSPS->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
    428428#endif
    429429  }
     
    438438  rpcSlice->setNumRefIdx(REF_PIC_LIST_0,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive);
    439439  rpcSlice->setNumRefIdx(REF_PIC_LIST_1,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive);
    440  
     440
    441441  if ( m_pcCfg->getDeblockingFilterMetric() )
    442442  {
     
    479479
    480480  rpcSlice->setDepth            ( depth );
    481  
     481
    482482  pcPic->setTLayer( m_pcCfg->getGOPEntry(iGOPid).m_temporalId );
    483483#if TEMP_SCALABILITY_FIX
     
    493493  assert( m_apcPicYuvPred );
    494494  assert( m_apcPicYuvResi );
    495  
     495
    496496  pcPic->setPicYuvPred( m_apcPicYuvPred );
    497497  pcPic->setPicYuvResi( m_apcPicYuvResi );
     
    557557#endif
    558558
    559 #if RDOQ_CHROMA_LAMBDA 
     559#if RDOQ_CHROMA_LAMBDA
    560560  // for RDOQ
    561561  m_pcTrQuant->setLambda( lambda, lambda / weight );
     
    665665#endif
    666666
    667 #if RDOQ_CHROMA_LAMBDA 
     667#if RDOQ_CHROMA_LAMBDA
    668668  // for RDOQ
    669   m_pcTrQuant->setLambda( lambda, lambda / weight );   
     669  m_pcTrQuant->setLambda( lambda, lambda / weight );
    670670#else
    671671  m_pcTrQuant->setLambda( lambda );
     
    674674#if SAO_CHROMA_LAMBDA
    675675  // For SAO
    676   pcSlice   ->setLambda( lambda, lambda / weight ); 
     676  pcSlice   ->setLambda( lambda, lambda / weight );
    677677#else
    678678  pcSlice   ->setLambda( lambda );
     
    692692  Int iMaxSR = m_pcCfg->getSearchRange();
    693693  Int iNumPredDir = pcSlice->isInterP() ? 1 : 2;
    694  
     694
    695695  for (Int iDir = 0; iDir <= iNumPredDir; iDir++)
    696696  {
     
    726726  }
    727727#endif
    728  
     728
    729729  TComSlice* pcSlice        = rpcPic->getSlice(getSliceIdx());
    730730  Double     dPicRdCostBest = MAX_DOUBLE;
    731731  UInt       uiQpIdxBest = 0;
    732  
     732
    733733  Double dFrameLambda;
    734734#if FULL_NBIT
     
    737737  Int    SHIFT_QP = 12;
    738738#endif
    739  
     739
    740740  // set frame lambda
    741741  if (m_pcCfg->getGOPSize() > 1)
     
    748748  }
    749749  m_pcRdCost      ->setFrameLambda(dFrameLambda);
    750  
     750
    751751  // for each QP candidate
    752752  for ( UInt uiQpIdx = 0; uiQpIdx < 2 * m_pcCfg->getDeltaQpRD() + 1; uiQpIdx++ )
     
    776776#endif
    777777
    778 #if RDOQ_CHROMA_LAMBDA 
     778#if RDOQ_CHROMA_LAMBDA
    779779    // for RDOQ
    780780    m_pcTrQuant   ->setLambda( m_pdRdPicLambda[uiQpIdx], m_pdRdPicLambda[uiQpIdx] / weight );
     
    784784#if SAO_CHROMA_LAMBDA
    785785    // For SAO
    786     pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdx], m_pdRdPicLambda[uiQpIdx] / weight ); 
     786    pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdx], m_pdRdPicLambda[uiQpIdx] / weight );
    787787#else
    788788    pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdx] );
    789789#endif
    790    
     790
    791791    // try compress
    792792    compressSlice   ( rpcPic );
    793    
     793
    794794    Double dPicRdCost;
    795795    UInt64 uiPicDist        = m_uiPicDist;
    796796    UInt64 uiALFBits        = 0;
    797    
     797
    798798    m_pcGOPEncoder->preLoopFilterPicAll( rpcPic, uiPicDist, uiALFBits );
    799    
     799
    800800    // compute RD cost and choose the best
    801801    dPicRdCost = m_pcRdCost->calcRdCost64( m_uiPicTotalBits + uiALFBits, uiPicDist, true, DF_SSE_FRAME);
    802    
     802
    803803    if ( dPicRdCost < dPicRdCostBest )
    804804    {
     
    807807    }
    808808  }
    809  
     809
    810810  // set best values
    811811  pcSlice       ->setSliceQp             ( m_piRdPicQp    [uiQpIdxBest] );
     
    832832#endif
    833833
    834 #if RDOQ_CHROMA_LAMBDA 
    835   // for RDOQ 
    836   m_pcTrQuant   ->setLambda( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight ); 
     834#if RDOQ_CHROMA_LAMBDA
     835  // for RDOQ
     836  m_pcTrQuant   ->setLambda( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight );
    837837#else
    838838  m_pcTrQuant   ->setLambda              ( m_pdRdPicLambda[uiQpIdxBest] );
     
    840840#if SAO_CHROMA_LAMBDA
    841841  // For SAO
    842   pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight ); 
     842  pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight );
    843843#else
    844844  pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdxBest] );
     
    862862
    863863  UInt uiEncCUOrder;
    864   uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 
     864  uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU());
    865865  for( uiEncCUOrder = uiStartCUAddr/rpcPic->getNumPartInCU();
    866866       uiEncCUOrder < (uiBoundingCUAddr+(rpcPic->getNumPartInCU()-1))/rpcPic->getNumPartInCU();
     
    898898  TComSlice* pcSlice            = rpcPic->getSlice(getSliceIdx());
    899899  xDetermineStartAndBoundingCUAddr ( uiStartCUAddr, uiBoundingCUAddr, rpcPic, false );
    900  
     900
    901901  // initialize cost values
    902902  m_uiPicTotalBits  = 0;
    903903  m_dPicRdCost      = 0;
    904904  m_uiPicDist       = 0;
    905  
     905
    906906  // set entropy coder
    907907  if( m_pcCfg->getUseSBACRD() )
     
    921921    m_pcEntropyCoder->setBitstream    ( m_pcBitCounter );
    922922  }
    923  
     923
    924924  //------------------------------------------------------------------------------
    925925  //  Weighted Prediction parameters estimation.
     
    930930    xCalcACDCParamSlice(pcSlice);
    931931  }
     932#if O0194_WEIGHTED_PREDICTION_CGS
     933  else{
     934    // Calculate for the base layer to be used in EL as Inter layer reference
     935    xCalcACDCParamSlice(pcSlice);
     936    wpACDCParam * temp_weightACDCParam;
     937
     938    pcSlice->getWpAcDcParam(temp_weightACDCParam);
     939    g_refWeightACDCParam = (void *) temp_weightACDCParam;
     940  }
     941#endif
    932942
    933943  Bool bWp_explicit = (pcSlice->getSliceType()==P_SLICE && pcSlice->getPPS()->getUseWP()) || (pcSlice->getSliceType()==B_SLICE && pcSlice->getPPS()->getWPBiPred());
     
    10211031        m_pcBufferSbacCoders[uiTileCol].loadContexts( CTXMem[1] );
    10221032        Int iNumSubstreamsPerTile = iNumSubstreams/rpcPic->getPicSym()->getNumTiles();
    1023         uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 
     1033        uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU());
    10241034        uiLin     = uiCUAddr / uiWidthInLCUs;
    10251035        uiSubStrm = rpcPic->getPicSym()->getTileIdxMap(rpcPic->getPicSym()->getCUOrderMap(uiCUAddr))*iNumSubstreamsPerTile
     
    10981108          pcCUTR = rpcPic->getCU( uiCUAddr - uiWidthInCU + 1 );
    10991109        }
    1100         if ( ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) || 
     1110        if ( ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) ||
    11011111             (pcCUTR->getSCUAddr()+uiMaxParts-1 < pcSlice->getSliceCurStartCUAddr()) ||
    11021112             ((rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(uiCUAddr)))
     
    11371147      m_pcEntropyCoder->setEntropyCoder ( m_pcRDGoOnSbacCoder, pcSlice );
    11381148      m_pcEntropyCoder->setBitstream( &pcBitCounters[uiSubStrm] );
    1139      
     1149
    11401150      ((TEncBinCABAC*)m_pcRDGoOnSbacCoder->getEncBinIf())->setBinCountingEnableFlag(true);
    11411151
     
    12421252        m_pcRdCost->setLambda(oldLambda);
    12431253#if RATE_CONTROL_INTRA
    1244         m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 
     1254        m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda,
    12451255          pcCU->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() );
    12461256#else
     
    12501260#endif
    12511261#endif
    1252      
     1262
    12531263      // restore entropy coder to an initial stage
    12541264      m_pcEntropyCoder->setEntropyCoder ( m_pppcRDSbacCoder[0][CI_CURR_BEST], pcSlice );
     
    12751285      {
    12761286         ppppcRDSbacCoders[uiSubStrm][0][CI_CURR_BEST]->load( m_pppcRDSbacCoder[0][CI_CURR_BEST] );
    1277        
     1287
    12781288         //Store probabilties of second LCU in line into buffer
    12791289         if ( ( uiCol == uiTileLCUX+1) && (depSliceSegmentsEnabled || (pcSlice->getPPS()->getNumSubstreams() > 1)) && m_pcCfg->getWaveFrontsynchro())
     
    13251335
    13261336#if RATE_CONTROL_INTRA
    1327         m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 
     1337        m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda,
    13281338          pcCU->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() );
    13291339#else
     
    13501360      }
    13511361    }
    1352    
     1362
    13531363    m_uiPicTotalBits += pcCU->getTotalBits();
    13541364    m_dPicRdCost     += pcCU->getTotalCost();
     
    14011411    m_pcEntropyCoder->setEntropyCoder ( m_pcSbacCoder, pcSlice );
    14021412  }
    1403  
     1413
    14041414  m_pcCuEncoder->setBitCounter( NULL );
    14051415  m_pcBitCounter = NULL;
     
    14271437      m_pcBufferSbacCoders[ui].load(m_pcSbacCoder); //init. state
    14281438    }
    1429    
     1439
    14301440    for (Int iSubstrmIdx=0; iSubstrmIdx < iNumSubstreams; iSubstrmIdx++)
    14311441    {
     
    15241534        }
    15251535        if ( (true/*bEnforceSliceRestriction*/ &&
    1526              ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) || 
     1536             ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) ||
    15271537             (pcCUTR->getSCUAddr()+uiMaxParts-1 < pcSlice->getSliceCurStartCUAddr()) ||
    15281538             ((rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(uiCUAddr)))
     
    15791589    }
    15801590
    1581     TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr );   
     1591    TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr );
    15821592    if ( pcSlice->getSPS()->getUseSAO() && (pcSlice->getSaoEnabledFlag()||pcSlice->getSaoEnabledFlagChroma()) )
    15831593    {
     
    16131623        if (allowMergeLeft)
    16141624        {
    1615           m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoMerge(mergeLeft); 
     1625          m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoMerge(mergeLeft);
    16161626        }
    16171627        else
     
    16761686#if ENC_DEC_TRACE
    16771687    g_bJustDoIt = g_bEncDecTraceDisable;
    1678 #endif   
     1688#endif
    16791689    if( m_pcCfg->getUseSBACRD() )
    16801690    {
    16811691       pcSbacCoders[uiSubStrm].load(m_pcSbacCoder);   //load back status of the entropy coder after encoding the LCU into relevant bitstream entropy coder
    1682        
     1692
    16831693
    16841694       //Store probabilties of second LCU in line into buffer
     
    17331743  UInt uiNumberOfCUsInFrame = rpcPic->getNumCUsInFrame();
    17341744  uiBoundingCUAddrSlice     = uiNumberOfCUsInFrame;
    1735   if (bEncodeSlice) 
     1745  if (bEncodeSlice)
    17361746  {
    17371747    UInt uiCUAddrIncrement;
     
    17691779      uiBoundingCUAddrSlice    = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU();
    17701780      break;
    1771     } 
     1781    }
    17721782    // WPP: if a slice does not start at the beginning of a CTB row, it must end within the same CTB row
    17731783    if (pcSlice->getPPS()->getNumSubstreams() > 1 && (uiStartCUAddrSlice % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0))
     
    18091819      uiBoundingCUAddrSlice    = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU();
    18101820      break;
    1811     } 
     1821    }
    18121822    // WPP: if a slice does not start at the beginning of a CTB row, it must end within the same CTB row
    18131823    if (pcSlice->getPPS()->getNumSubstreams() > 1 && (uiStartCUAddrSlice % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0))
     
    18191829
    18201830  Bool tileBoundary = false;
    1821   if ((m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_BYTES) && 
     1831  if ((m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_BYTES) &&
    18221832      (m_pcCfg->getNumRowsMinus1() > 0 || m_pcCfg->getNumColumnsMinus1() > 0))
    18231833  {
     
    18321842    }
    18331843    tileBoundingCUAddrSlice = lcuEncAddr*rpcPic->getNumPartInCU();
    1834    
     1844
    18351845    if (tileBoundingCUAddrSlice < uiBoundingCUAddrSlice)
    18361846    {
     
    18451855  startCUAddrSliceSegment    = pcSlice->getSliceSegmentCurStartCUAddr();
    18461856  boundingCUAddrSliceSegment = uiNumberOfCUsInFrame;
    1847   if (bEncodeSlice) 
     1857  if (bEncodeSlice)
    18481858  {
    18491859    UInt uiCUAddrIncrement;
     
    18801890      boundingCUAddrSliceSegment    = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU();
    18811891      break;
    1882     } 
     1892    }
    18831893    // WPP: if a slice segment does not start at the beginning of a CTB row, it must end within the same CTB row
    18841894    if (pcSlice->getPPS()->getNumSubstreams() > 1 && (startCUAddrSliceSegment % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0))
     
    19191929      boundingCUAddrSliceSegment    = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU();
    19201930      break;
    1921     } 
     1931    }
    19221932    // WPP: if a slice segment does not start at the beginning of a CTB row, it must end within the same CTB row
    19231933    if (pcSlice->getPPS()->getNumSubstreams() > 1 && (startCUAddrSliceSegment % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0))
     
    19271937    pcSlice->setSliceSegmentCurEndCUAddr( boundingCUAddrSliceSegment );
    19281938  }
    1929   if ((m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_BYTES) && 
     1939  if ((m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_BYTES) &&
    19301940    (m_pcCfg->getNumRowsMinus1() > 0 || m_pcCfg->getNumColumnsMinus1() > 0))
    19311941  {
     
    19791989  }
    19801990  UInt uiRealStartAddress = rpcPic->getPicSym()->getPicSCUEncOrder(uiExternalAddress*rpcPic->getNumPartInCU()+uiInternalAddress);
    1981  
     1991
    19821992  pcSlice->setSliceSegmentCurStartCUAddr(uiRealStartAddress);
    19831993  startCUAddrSliceSegment=uiRealStartAddress;
    1984  
     1994
    19851995  //calculate real slice start address
    19861996  uiInternalAddress = rpcPic->getPicSym()->getPicSCUAddr(pcSlice->getSliceCurStartCUAddr()) % rpcPic->getNumPartInCU();
     
    20072017  }
    20082018  uiRealStartAddress = rpcPic->getPicSym()->getPicSCUEncOrder(uiExternalAddress*rpcPic->getNumPartInCU()+uiInternalAddress);
    2009  
     2019
    20102020  pcSlice->setSliceCurStartCUAddr(uiRealStartAddress);
    20112021  uiStartCUAddrSlice=uiRealStartAddress;
    2012  
     2022
    20132023  // Make a joint decision based on reconstruction and dependent slice bounds
    20142024  startCUAddr    = max(uiStartCUAddrSlice   , startCUAddrSliceSegment   );
     
    20222032    if ( (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU)
    20232033      || (m_pcCfg->getSliceMode()==0 && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU)
    2024       || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==0) 
     2034      || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==0)
    20252035      || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU)
    2026       || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceSegmentMode()==0) 
     2036      || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceSegmentMode()==0)
    20272037      || (m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceMode()==0)
    20282038      || tileBoundary
  • branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncTop.cpp

    r460 r466  
    8888  m_bMFMEnabledFlag = false;
    8989#endif
     90#if SCALED_REF_LAYER_OFFSETS
    9091  m_numScaledRefLayerOffsets = 0;
     92#endif
     93#endif
    9194#if POC_RESET_FLAG
    9295  m_pocAdjustmentValue     = 0;
    9396#endif
    94 #endif //SVC_EXTENSION
    9597}
    9698
     
    173175    }
    174176  }
    175 
    176 #if LAYER_CTB
    177   memcpy(g_auiLayerZscanToRaster[m_layerId], g_auiZscanToRaster, sizeof( g_auiZscanToRaster ) );
    178   memcpy(g_auiLayerRasterToZscan[m_layerId], g_auiRasterToZscan, sizeof( g_auiRasterToZscan ) );
    179   memcpy(g_auiLayerRasterToPelX[m_layerId],  g_auiRasterToPelX,  sizeof( g_auiRasterToPelX ) );
    180   memcpy(g_auiLayerRasterToPelY[m_layerId],  g_auiRasterToPelY,  sizeof( g_auiRasterToPelY ) );
    181 #endif
    182177}
    183178
     
    876871#if SVC_EXTENSION
    877872  m_cSPS.setLayerId(m_layerId);
     873#endif
    878874#if REF_IDX_MFM
    879875#if !M0457_COL_PICTURE_SIGNALING
     
    881877#endif
    882878#endif
     879#if SCALED_REF_LAYER_OFFSETS
    883880  m_cSPS.setNumScaledRefLayerOffsets(m_numScaledRefLayerOffsets);
    884881  for(Int i = 0; i < m_cSPS.getNumScaledRefLayerOffsets(); i++)
     
    886883    m_cSPS.getScaledRefLayerWindow(i) = m_scaledRefLayerWindow[i];
    887884  }
    888 #endif //SVC_EXTENSION
     885#endif
    889886  ProfileTierLevel& profileTierLevel = *m_cSPS.getPTL()->getGeneralPTL();
    890887  profileTierLevel.setLevelIdc(m_level);
  • branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncTop.h

    r460 r466  
    140140  Int                     m_ilSampleOnlyPred;
    141141#endif
     142#if SCALED_REF_LAYER_OFFSETS
    142143  UInt                    m_numScaledRefLayerOffsets;
    143144  Window                  m_scaledRefLayerWindow[MAX_LAYERS];
     145#endif
    144146#if POC_RESET_FLAG
    145147  Int                     m_pocAdjustmentValue;
    146148#endif
    147 #endif //SVC_EXTENSION
     149#endif
    148150protected:
    149151  Void  xGetNewPicBuffer  ( TComPic*& rpcPic );           ///< get picture buffer which will be processed
     
    207209  Int                     getNumPicRcvd         () { return m_iNumPicRcvd;            }
    208210  Void                    setNumPicRcvd         ( Int num ) { m_iNumPicRcvd = num;      }
     211#if SCALED_REF_LAYER_OFFSETS
    209212  Void                    setNumScaledRefLayerOffsets(Int x) { m_numScaledRefLayerOffsets = x; }
    210213  UInt                    getNumScaledRefLayerOffsets() { return m_numScaledRefLayerOffsets; }
    211214  Window&  getScaledRefLayerWindow(Int x)            { return m_scaledRefLayerWindow[x]; }
    212 #endif //SVC_EXTENSION
     215#endif
     216#endif
    213217
    214218  // -------------------------------------------------------------------------------------------------------------------
  • branches/SHM-4.0-dev/source/Lib/TLibEncoder/WeightPredAnalysis.cpp

    r313 r466  
    22 * License, included below. This software may be subject to other third party
    33 * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license. 
     4 * granted under this license.
    55 *
    66 * Copyright (c) 2010-2013, ITU/ISO/IEC
     
    5151  for ( Int iList =0 ; iList<2 ; iList++ )
    5252  {
    53     for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) 
     53    for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ )
    5454    {
    5555      for ( Int comp=0 ; comp<3 ;comp++ )
     
    7474  TComPicYuv*   pPic = slice->getPic()->getPicYuvOrg();
    7575  Int   iSample  = 0;
     76#if O0194_WEIGHTED_PREDICTION_CGS
     77  // Define here to assign the parameter of "iSample"
     78  wpACDCParam weightACDCParam[3];
     79#endif
    7680
    7781  // calculate DC/AC value for Y
     
    8185  pOrg = pPic->getLumaAddr();
    8286  Int64  iOrgACY  = xCalcACValueSlice(slice, pOrg, iOrgNormDCY);
     87#if O0194_WEIGHTED_PREDICTION_CGS
     88  weightACDCParam[0].iSamples = iSample;
     89#endif
    8390
    8491  // calculate DC/AC value for Cb
     
    8895  pOrg = pPic->getCbAddr();
    8996  Int64  iOrgACCb  = xCalcACValueUVSlice(slice, pOrg, iOrgNormDCCb);
     97#if O0194_WEIGHTED_PREDICTION_CGS
     98  weightACDCParam[1].iSamples = iSample;
     99#endif
    90100
    91101  // calculate DC/AC value for Cr
     
    95105  pOrg = pPic->getCrAddr();
    96106  Int64  iOrgACCr  = xCalcACValueUVSlice(slice, pOrg, iOrgNormDCCr);
    97 
     107#if O0194_WEIGHTED_PREDICTION_CGS
     108  weightACDCParam[2].iSamples = iSample;
     109#endif
     110
     111#if !O0194_WEIGHTED_PREDICTION_CGS
    98112  wpACDCParam weightACDCParam[3];
     113#endif
    99114  weightACDCParam[0].iAC = iOrgACY;
    100115  weightACDCParam[0].iDC = iOrgNormDCY;
     
    138153  for ( Int iList=0 ; iList<2 ; iList++ )
    139154  {
    140     for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) 
    141     {
    142       for ( Int iComp=0 ; iComp<3 ;iComp++ ) 
     155    for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ )
     156    {
     157      for ( Int iComp=0 ; iComp<3 ;iComp++ )
    143158      {
    144159        wpScalingParam  *pwp = &(m_wp[iList][iRefIdx][iComp]);
     
    154169    for ( Int iList=0 ; iList<2 ; iList++ )
    155170    {
    156       for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) 
     171      for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ )
    157172      {
    158         for ( Int iComp=0 ; iComp<3 ;iComp++ ) 
     173        for ( Int iComp=0 ; iComp<3 ;iComp++ )
    159174        {
    160175          wpScalingParam  *pwp = &(m_wp[iList][iRefIdx][iComp]);
     
    195210  // selecting whether WP is used, or not
    196211  xSelectWP(slice, m_wp, iDenom);
    197  
     212
    198213  slice->setWpScaling( m_wp );
    199214
     
    216231      slice->getWpAcDcParam(currWeightACDCParam);
    217232      slice->getRefPic(eRefPicList, refIdxTemp)->getSlice(0)->getWpAcDcParam(refWeightACDCParam);
     233#if O0194_WEIGHTED_PREDICTION_CGS
     234      if (slice->getRefPic(eRefPicList, refIdxTemp)->isILR(1)){
     235        refWeightACDCParam = (wpACDCParam *)g_refWeightACDCParam;
     236      }
     237#endif
    218238
    219239      for ( Int comp = 0; comp < 3; comp++ )
     
    229249        Int64 refDC = refWeightACDCParam[comp].iDC;
    230250        Int64 refAC = refWeightACDCParam[comp].iAC;
     251#if O0194_WEIGHTED_PREDICTION_CGS
     252        if (slice->getRefPic(eRefPicList, refIdxTemp)->isILR(1)){
     253          refAC *= (double)currWeightACDCParam[comp].iSamples/refWeightACDCParam[comp].iSamples;
     254#if O0194_JOINT_US_BITSHIFT
     255          refAC *= (1<<(g_bitDepthYLayer[1]-g_bitDepthYLayer[0]));
     256          refDC *= (1<<(g_bitDepthYLayer[1]-g_bitDepthYLayer[0]));
     257#endif
     258         }
     259#endif
    231260
    232261        // calculating iWeight and iOffset params
     
    234263        Int weight = (Int)( 0.5 + dWeight * (Double)(1<<log2Denom) );
    235264        Int offset = (Int)( ((currDC<<log2Denom) - ((Int64)weight * refDC) + (Int64)realOffset) >> realLog2Denom );
     265#if O0194_WEIGHTED_PREDICTION_CGS
     266        if (slice->getRefPic(eRefPicList, refIdxTemp)->isILR(1)){
     267        }
     268        else{
     269          dWeight = 1;
     270          offset  = 0;
     271        }
     272        weight = (Int)( 0.5 + dWeight * (Double)(1<<log2Denom) );
     273#endif
    236274
    237275        // Chroma offset range limitation
     
    253291        if(deltaWeight > 127 || deltaWeight < -128)
    254292          return (false);
     293#if O0194_WEIGHTED_PREDICTION_CGS
     294        // make sure the reference frames other than ILR are not using weighted prediction
     295        if (!(slice->getRefPic(eRefPicList, refIdxTemp)->isILR(1))){
     296          continue;
     297        }
     298#endif
    255299
    256300        m_wp[refList][refIdxTemp][comp].bPresentFlag = true;
     
    264308}
    265309
    266 /** select whether weighted pred enables or not. 
     310/** select whether weighted pred enables or not.
    267311 * \param TComSlice *slice
    268312 * \param wpScalingParam
     
    325369}
    326370
    327 /** calculate DC value of original image for luma. 
     371/** calculate DC value of original image for luma.
    328372 * \param TComSlice *slice
    329373 * \param Pel *pPel
     
    345389}
    346390
    347 /** calculate AC value of original image for luma. 
     391/** calculate AC value of original image for luma.
    348392 * \param TComSlice *slice
    349393 * \param Pel *pPel
     
    363407}
    364408
    365 /** calculate DC value of original image for chroma. 
     409/** calculate DC value of original image for chroma.
    366410 * \param TComSlice *slice
    367411 * \param Pel *pPel
     
    383427}
    384428
    385 /** calculate AC value of original image for chroma. 
     429/** calculate AC value of original image for chroma.
    386430 * \param TComSlice *slice
    387431 * \param Pel *pPel
     
    401445}
    402446
    403 /** calculate DC value. 
     447/** calculate DC value.
    404448 * \param Pel *pPel
    405449 * \param Int iWidth
     
    423467}
    424468
    425 /** calculate AC value. 
     469/** calculate AC value.
    426470 * \param Pel *pPel
    427471 * \param Int iWidth
     
    446490}
    447491
    448 /** calculate SAD values for both WP version and non-WP version. 
     492/** calculate SAD values for both WP version and non-WP version.
    449493 * \param Pel *pOrgPel
    450494 * \param Pel *pRefPel
Note: See TracChangeset for help on using the changeset viewer.