Changeset 494 in SHVCSoftware for trunk/source/App


Ignore:
Timestamp:
16 Nov 2013, 22:09:25 (11 years ago)
Author:
seregin
Message:

reintegrate branch SHM-4.0-dev

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/source

  • trunk/source/App/TAppDecoder/TAppDecTop.cpp

    r442 r494  
    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
     
    8080    m_pchBitstreamFile = NULL;
    8181  }
    82 #if SVC_EXTENSION   
     82#if SVC_EXTENSION
    8383  for( Int i = 0; i < m_tgtLayerId; i++ )
    8484  {
     
    8888      m_pchReconFile[i] = NULL;
    8989    }
    90   } 
     90  }
    9191#if AVC_BASE
    9292  if( m_pchBLReconFile )
     
    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
     
    235240      if ( m_pchReconFile[curLayerId] && !openedReconFile[curLayerId] )
    236241      {
    237         if (!m_outputBitDepthY) { m_outputBitDepthY = g_bitDepthY; }       
     242        if (!m_outputBitDepthY) { m_outputBitDepthY = g_bitDepthY; }
    238243        if (!m_outputBitDepthC) { m_outputBitDepthC = g_bitDepthC; }
    239244
     
    242247        openedReconFile[curLayerId] = true;
    243248      }
    244       if ( bNewPicture && bNewPOC && 
     249      if ( bNewPicture && bNewPOC &&
    245250           (   nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL
    246251            || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP
     
    276281  }
    277282#endif
    278   pcBLPic.destroy(); 
     283  pcBLPic.destroy();
    279284
    280285  for(UInt layer = layerIdmin; layer <= m_tgtLayerId; layer++)
     
    285290    m_acTDecTop[layer].deletePicBuffer();
    286291  }
    287  
     292
    288293  // destroy internal classes
    289294  xDestroyDecLib();
     
    394399        openedReconFile = true;
    395400      }
    396       if ( bNewPicture && 
     401      if ( bNewPicture &&
    397402           (   nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL
    398403            || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP
     
    410415    }
    411416  }
    412  
     417
    413418#if SYNTAX_OUTPUT
    414419  if( streamSyntaxFile.is_open() )
     
    417422  }
    418423#endif
    419  
     424
    420425  xFlushOutput( pcListPic );
    421426  // delete buffers
    422427  m_cTDecTop.deletePicBuffer();
    423  
     428
    424429  // destroy internal classes
    425430  xDestroyDecLib();
     
    435440#if SVC_EXTENSION
    436441  // initialize global variables
    437   initROM(); 
     442  initROM();
    438443
    439444  for(UInt layer = 0; layer <= m_tgtLayerId; layer++)
     
    445450    m_acTDecTop[layer].create();
    446451
    447     m_acTDecTop[layer].setLayerDec(m_apcTDecTop);   
     452    m_acTDecTop[layer].setLayerDec(m_apcTDecTop);
    448453  }
    449454#else
     
    474479    m_cTVideoIOYuvReconFile. close();
    475480  }
    476  
     481
    477482  // destroy decoder class
    478483  m_cTDecTop.destroy();
     
    566571
    567572#else
     573#if O0194_DIFFERENT_BITDEPTH_EL_BL
     574          // Compile time bug-fix
     575          m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     576#else
    568577          m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     578#endif
    569579            conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    570580            conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     
    723733  {
    724734    return;
    725   } 
     735  }
    726736  TComList<TComPic*>::iterator iterPic   = pcListPic->begin();
    727737
     
    759769
    760770#else
     771#if O0194_DIFFERENT_BITDEPTH_EL_BL
     772          // Compile time bug-fix
     773          m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     774#else
    761775          m_cTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     776#endif
    762777            conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    763778            conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     
    913928        pcPic = NULL;
    914929      }
    915 #endif   
     930#endif
    916931#endif
    917932      iterPic++;
  • trunk/source/App/TAppEncoder/TAppEncCfg.cpp

    r442 r494  
    221221  }
    222222#endif
    223 #if EXTERNAL_USEDBYCURR_N0082
    224   if(entry.m_numRefPics>0){
    225     in>>entry.m_UseExtusedByCurrPic;
    226     if(entry.m_UseExtusedByCurrPic)
    227     {
    228       for ( Int i = 0; i < entry.m_numRefPics; i++ )
    229       {
    230         in>>entry.m_ExtusedByCurrPic[i];
    231       }
    232     }
    233   }
    234 #endif
    235223  return in;
    236224}
     225
     226#if AUXILIARY_PICTURES
     227static inline ChromaFormat numberToChromaFormat(const Int val)
     228{
     229  switch (val)
     230  {
     231    case 400: return CHROMA_400; break;
     232    case 420: return CHROMA_420; break;
     233    case 422: return CHROMA_422; break;
     234    case 444: return CHROMA_444; break;
     235    default:  return NUM_CHROMA_FORMAT;
     236  }
     237}
     238#endif
    237239
    238240#if SVC_EXTENSION
     
    362364  Int*    cfg_IntraPeriod   [MAX_LAYERS];
    363365  Int*    cfg_conformanceMode  [MAX_LAYERS];
     366#if LAYER_CTB
     367  // coding unit (CU) definition
     368  UInt*      cfg_uiMaxCUWidth[MAX_LAYERS];                                   ///< max. CU width in pixel
     369  UInt*      cfg_uiMaxCUHeight[MAX_LAYERS];                                  ///< max. CU height in pixel
     370  UInt*      cfg_uiMaxCUDepth[MAX_LAYERS];                                   ///< max. CU depth
     371 
     372  // transfom unit (TU) definition
     373  UInt*      cfg_uiQuadtreeTULog2MaxSize[MAX_LAYERS];
     374  UInt*      cfg_uiQuadtreeTULog2MinSize[MAX_LAYERS];
     375 
     376  UInt*      cfg_uiQuadtreeTUMaxDepthInter[MAX_LAYERS];
     377  UInt*      cfg_uiQuadtreeTUMaxDepthIntra[MAX_LAYERS];
     378#endif
     379#if AUXILIARY_PICTURES
     380  Int      cfg_tmpChromaFormatIDC  [MAX_LAYERS];
     381  Int      cfg_tmpInputChromaFormat[MAX_LAYERS];
     382  Int*     cfg_auxId               [MAX_LAYERS];
     383#endif
    364384#if VPS_EXTN_DIRECT_REF_LAYERS
    365385#if M0457_PREDICTION_INDICATIONS
     
    379399  string* cfg_predLayerIdsPtr    [MAX_LAYERS];
    380400#endif
    381 #if SCALED_REF_LAYER_OFFSETS
    382401  string    cfg_scaledRefLayerLeftOffset [MAX_LAYERS];
    383402  string    cfg_scaledRefLayerTopOffset [MAX_LAYERS];
     
    390409  string*    cfg_scaledRefLayerRightOffsetPtr  [MAX_LAYERS];
    391410  string*    cfg_scaledRefLayerBottomOffsetPtr [MAX_LAYERS];
    392 #endif
    393411#if RC_SHVC_HARMONIZATION
    394412  Bool*   cfg_RCEnableRateControl  [MAX_LAYERS];
     
    400418  Bool*   cfg_RCForceIntraQP       [MAX_LAYERS];
    401419#endif
     420#if O0194_DIFFERENT_BITDEPTH_EL_BL
     421  Int*    cfg_InputBitDepthY    [MAX_LAYERS];
     422  Int*    cfg_InternalBitDepthY [MAX_LAYERS];
     423  Int*    cfg_InputBitDepthC    [MAX_LAYERS];
     424  Int*    cfg_InternalBitDepthC [MAX_LAYERS];
     425  Int*    cfg_OutputBitDepthY   [MAX_LAYERS];
     426  Int*    cfg_OutputBitDepthC   [MAX_LAYERS];
     427#endif
    402428#if N0120_MAX_TID_REF_CFG
    403429  Int*    cfg_maxTidIlRefPicsPlus1[MAX_LAYERS];
     
    416442    cfg_IntraPeriod[layer]  = &m_acLayerCfg[layer].m_iIntraPeriod;
    417443    cfg_conformanceMode[layer] = &m_acLayerCfg[layer].m_conformanceMode;
     444#if LAYER_CTB
     445    // coding unit (CU) definition
     446    cfg_uiMaxCUWidth[layer]  = &m_acLayerCfg[layer].m_uiMaxCUWidth;
     447    cfg_uiMaxCUHeight[layer] = &m_acLayerCfg[layer].m_uiMaxCUHeight;
     448    cfg_uiMaxCUDepth[layer]  = &m_acLayerCfg[layer].m_uiMaxCUDepth;
     449
     450    // transfom unit (TU) definition.
     451    cfg_uiQuadtreeTULog2MaxSize[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTULog2MaxSize;
     452    cfg_uiQuadtreeTULog2MinSize[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTULog2MinSize;
     453
     454    cfg_uiQuadtreeTUMaxDepthInter[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthInter;
     455    cfg_uiQuadtreeTUMaxDepthIntra[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthIntra;
     456#endif
    418457#if VPS_EXTN_DIRECT_REF_LAYERS
    419458#if M0457_PREDICTION_INDICATIONS
     
    429468    cfg_predLayerIdsPtr     [layer]  = &cfg_predLayerIds[layer];
    430469#endif
    431 #if SCALED_REF_LAYER_OFFSETS
    432470    cfg_numScaledRefLayerOffsets [layer] = &m_acLayerCfg[layer].m_numScaledRefLayerOffsets;
    433471    for(Int i = 0; i < MAX_LAYERS; i++)
     
    438476      cfg_scaledRefLayerBottomOffsetPtr[layer] = &cfg_scaledRefLayerBottomOffset[layer];
    439477    }
    440 #endif
    441478#if RC_SHVC_HARMONIZATION
    442479    cfg_RCEnableRateControl[layer]   = &m_acLayerCfg[layer].m_RCEnableRateControl;
     
    448485    cfg_RCForceIntraQP[layer]        = &m_acLayerCfg[layer].m_RCForceIntraQP;
    449486#endif
     487#if O0194_DIFFERENT_BITDEPTH_EL_BL
     488  cfg_InputBitDepthY   [layer] = &m_acLayerCfg[layer].m_inputBitDepthY;
     489  cfg_InternalBitDepthY[layer] = &m_acLayerCfg[layer].m_internalBitDepthY;
     490  cfg_InputBitDepthC   [layer] = &m_acLayerCfg[layer].m_inputBitDepthC;
     491  cfg_InternalBitDepthC[layer] = &m_acLayerCfg[layer].m_internalBitDepthC;
     492  cfg_OutputBitDepthY  [layer] = &m_acLayerCfg[layer].m_outputBitDepthY;
     493  cfg_OutputBitDepthC  [layer] = &m_acLayerCfg[layer].m_outputBitDepthC;
     494#endif
    450495#if N0120_MAX_TID_REF_CFG
    451496    cfg_maxTidIlRefPicsPlus1[layer] = &m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1;
    452497#endif
     498#if AUXILIARY_PICTURES
     499    cfg_auxId[layer]                = &m_acLayerCfg[layer].m_auxId;
     500#endif
    453501  }
    454502#if AVC_BASE
     
    461509  string  cfg_tileSets;
    462510#endif
    463 #else
     511#else //SVC_EXTENSION
    464512  string cfg_InputFile;
    465513  string cfg_BitstreamFile;
    466514  string cfg_ReconFile;
    467515  string cfg_dQPFile;
    468 #endif
     516#endif //SVC_EXTENSION
    469517  string cfg_ColumnWidth;
    470518  string cfg_RowHeight;
     
    487535  ("FrameRate%d,-fr%d",       cfg_FrameRate,  0, MAX_LAYERS, "Frame rate for layer %d")
    488536  ("LambdaModifier%d,-LM%d",  m_adLambdaModifier, ( double )1.0, MAX_TLAYER, "Lambda modifier for temporal layer %d")
     537#if O0215_PHASE_ALIGNMENT
     538  ("PhaseAlignment",          m_phaseAlignFlag, false, "indicate the sample location alignment between layers (0: zero position aligned, 1: central position aligned)")
     539#endif
    489540#if REPN_FORMAT_IN_VPS
    490541  ("RepFormatIdx%d",          cfg_repFormatIdx, -1, MAX_LAYERS, "Index to the representation format structure used from the VPS")
     
    504555#endif
    505556  ("NumLayers",               m_numLayers, 1, "Number of layers to code")
     557#if AUXILIARY_PICTURES
     558  ("InputChromaFormat%d",     cfg_tmpInputChromaFormat,  420, MAX_LAYERS, "InputChromaFormatIDC for layer %d")
     559  ("ChromaFormatIDC%d,-cf",   cfg_tmpChromaFormatIDC,    420, MAX_LAYERS, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat) for layer %d")
     560  ("AuxId%d",                 cfg_auxId,                 0,   MAX_LAYERS, "Auxilary picture ID for layer %d (0: Not aux pic, 1: Alpha plane, 2: Depth picture, 3: Cb enh, 4: Cr enh")
     561#endif
    506562  ("ConformanceMode%d",       cfg_conformanceMode,0, MAX_LAYERS, "Window conformance mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping")
    507563#if SCALABILITY_MASK_E0104
    508564  ("ScalabilityMask1",        m_scalabilityMask[1], 0, "scalability_mask[1] (multiview)")
    509565  ("ScalabilityMask2",        m_scalabilityMask[2], 1, "scalability_mask[2] (scalable)" )
     566#if AUXILIARY_PICTURES
     567  ("ScalabilityMask3",        m_scalabilityMask[3], 0, "scalability_mask[3] (auxiliary pictures)" )
     568#endif
    510569#else
    511570  ("ScalabilityMask0",        m_scalabilityMask[0], 0, "scalability_mask[0] (multiview)")
     
    513572#endif
    514573  ("BitstreamFile,b",         cfg_BitstreamFile, string(""), "Bitstream output file name")
     574#if !O0194_DIFFERENT_BITDEPTH_EL_BL
    515575  ("InputBitDepth",           m_inputBitDepthY,    8, "Bit-depth of input file")
    516576  ("OutputBitDepth",          m_outputBitDepthY,   0, "Bit-depth of output file (default:InternalBitDepth)")
     
    520580  ("OutputBitDepthC",         m_outputBitDepthC,   0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
    521581  ("InternalBitDepthC",       m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)")
    522 #if SCALED_REF_LAYER_OFFSETS
     582#endif
    523583  ("NumScaledRefLayerOffsets%d",    cfg_numScaledRefLayerOffsets,     0, MAX_LAYERS,  "Number of scaled offset layer sets ")
    524584  ("ScaledRefLayerLeftOffset%d",   cfg_scaledRefLayerLeftOffsetPtr,  string(""), MAX_LAYERS, "Horizontal offset of top-left luma sample of scaled base layer picture with respect to"
     
    530590  ("ScaledRefLayerBottomOffset%d", cfg_scaledRefLayerBottomOffsetPtr,string(""), MAX_LAYERS, "Vertical offset of bottom-right luma sample of scaled base layer picture with respect to"
    531591                                                                 " bottom-right luma sample of the EL picture, in units of two luma samples")
     592#if O0194_DIFFERENT_BITDEPTH_EL_BL
     593  ("InputBitDepth%d",       cfg_InputBitDepthY,    8, MAX_LAYERS, "Bit-depth of input file for layer %d")
     594  ("InternalBitDepth%d",    cfg_InternalBitDepthY, 0, MAX_LAYERS, "Bit-depth the codec operates at. (default:InputBitDepth) for layer %d ")
     595//                                                       "If different to InputBitDepth, source data will be converted")
     596  ("InputBitDepthC%d",      cfg_InputBitDepthC,    0, MAX_LAYERS, "As per InputBitDepth but for chroma component. (default:InputBitDepth) for layer %d")
     597  ("InternalBitDepthC%d",   cfg_InternalBitDepthC, 0, MAX_LAYERS, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth) for layer %d")
     598  ("OutputBitDepth%d",      cfg_OutputBitDepthY,   0, MAX_LAYERS, "Bit-depth of output file (default:InternalBitDepth)")
     599  ("OutputBitDepthC%d",     cfg_OutputBitDepthC,   0, MAX_LAYERS, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
    532600#endif
    533601#if N0120_MAX_TID_REF_CFG
     
    546614  ("IlSampleOnlyPred%d",       m_ilSampleOnlyPred, 0, MAX_LAYERS, "Set inter_layer_sample_pred_only_flag for all slices")
    547615#endif
    548 #else
     616#else //SVC_EXTENSION
    549617  ("InputFile,i",           cfg_InputFile,     string(""), "Original YUV input file name")
    550618  ("BitstreamFile,b",       cfg_BitstreamFile, string(""), "Bitstream output file name")
     
    559627  ("OutputBitDepthC",       m_outputBitDepthC,   0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
    560628  ("InternalBitDepthC",     m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)")
     629#if AUXILIARY_PICTURES
     630  ("InputChromaFormat",     tmpInputChromaFormat,                       420, "InputChromaFormatIDC")
     631  ("ChromaFormatIDC,-cf",   tmpChromaFormat,                             0, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat)")
     632#endif
    561633  ("ConformanceMode",       m_conformanceMode,     0, "Window conformance mode (0: no window, 1:automatic padding, 2:padding, 3:conformance")
    562634  ("HorizontalPadding,-pdx",m_aiPad[0],            0, "Horizontal source padding for conformance window mode 2")
     
    567639  ("ConfBottom",            m_confBottom,          0, "Bottom offset for window conformance mode 3")
    568640  ("FrameRate,-fr",         m_iFrameRate,          0, "Frame rate")
    569 #endif
     641#endif //SVC_EXTENSION
    570642
    571643  //Field coding parameters
     
    574646  ("FrameSkip,-fs",         m_FrameSkip,          0u, "Number of frames to skip at start of input YUV")
    575647  ("FramesToBeEncoded,f",   m_framesToBeEncoded,   0, "Number of frames to be encoded (default=all)")
    576  
    577648  // Profile and level
    578649  ("Profile", m_profile,   Profile::NONE, "Profile to be used when encoding (Incomplete)")
     
    585656  ("FrameOnly",         m_frameOnlyConstraintFlag, false, "Indicate that the bitstream contains only frames")
    586657
     658#if LAYER_CTB
     659  // Unit definition parameters
     660  ("MaxCUWidth%d",              cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU width")
     661  ("MaxCUHeight%d",             cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU height")
     662  // todo: remove defaults from MaxCUSize
     663  ("MaxCUSize%d,s%d",           cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU size")
     664  ("MaxCUSize%d,s%d",           cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU size")
     665  ("MaxPartitionDepth%d,h%d",   cfg_uiMaxCUDepth,              4u, MAX_LAYERS, "CU depth")
     666 
     667  ("QuadtreeTULog2MaxSize%d",   cfg_uiQuadtreeTULog2MaxSize,   6u, MAX_LAYERS, "Maximum TU size in logarithm base 2")
     668  ("QuadtreeTULog2MinSize%d",   cfg_uiQuadtreeTULog2MinSize,   2u, MAX_LAYERS, "Minimum TU size in logarithm base 2")
     669 
     670  ("QuadtreeTUMaxDepthIntra%d", cfg_uiQuadtreeTUMaxDepthIntra, 1u, MAX_LAYERS, "Depth of TU tree for intra CUs")
     671  ("QuadtreeTUMaxDepthInter%d", cfg_uiQuadtreeTUMaxDepthInter, 2u, MAX_LAYERS, "Depth of TU tree for inter CUs")
     672
     673
     674  // set the same CU realted settings across all the layers if config file parameters are not layer specific
     675  ("MaxCUWidth",              cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU width")
     676  ("MaxCUHeight",             cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU height")
     677  // todo: remove defaults from MaxCUSize
     678  ("MaxCUSize,s",             cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU size")
     679  ("MaxCUSize,s",             cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU size")
     680  ("MaxPartitionDepth,h",     cfg_uiMaxCUDepth,              4u, MAX_LAYERS, "CU depth")
     681 
     682  ("QuadtreeTULog2MaxSize",   cfg_uiQuadtreeTULog2MaxSize,   6u, MAX_LAYERS, "Maximum TU size in logarithm base 2")
     683  ("QuadtreeTULog2MinSize",   cfg_uiQuadtreeTULog2MinSize,   2u, MAX_LAYERS, "Minimum TU size in logarithm base 2")
     684 
     685  ("QuadtreeTUMaxDepthIntra", cfg_uiQuadtreeTUMaxDepthIntra, 1u, MAX_LAYERS, "Depth of TU tree for intra CUs")
     686  ("QuadtreeTUMaxDepthInter", cfg_uiQuadtreeTUMaxDepthInter, 2u, MAX_LAYERS, "Depth of TU tree for inter CUs")
     687#else
    587688  // Unit definition parameters
    588689  ("MaxCUWidth",              m_uiMaxCUWidth,             64u)
     
    598699  ("QuadtreeTUMaxDepthIntra", m_uiQuadtreeTUMaxDepthIntra, 1u, "Depth of TU tree for intra CUs")
    599700  ("QuadtreeTUMaxDepthInter", m_uiQuadtreeTUMaxDepthInter, 2u, "Depth of TU tree for inter CUs")
     701#endif
    600702 
    601703  // Coding structure paramters
     
    864966    opts.addOptions()(cOSS.str(), m_GOPList[i-1], GOPEntry());
    865967  }
    866 #if FINAL_RPL_CHANGE_N0082
    867   for(Int i=1; i<MAX_GOP+1; i++) {
    868     std::ostringstream cOSS;
    869     cOSS<<"FrameEL"<<i;
    870     opts.addOptions()(cOSS.str(), m_acLayerCfg[1].m_GOPListLayer[i-1], GOPEntry());
    871   }
    872 #endif
    873968  po::setDefaults(opts);
    874969  const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv);
     
    9211016  m_BLSyntaxFile = cfg_BLSyntaxFile.empty() ? NULL : strdup(cfg_BLSyntaxFile.c_str());
    9221017#endif
    923 #else
     1018#else //SVC_EXTENSION
    9241019  m_pchInputFile = cfg_InputFile.empty() ? NULL : strdup(cfg_InputFile.c_str());
    9251020  m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str());
    9261021  m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str());
    9271022  m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str());
    928 #endif
     1023#endif //SVC_EXTENSION
    9291024
    9301025  Char* pColumnWidth = cfg_ColumnWidth.empty() ? NULL: strdup(cfg_ColumnWidth.c_str());
     
    9851080    m_pRowHeight = NULL;
    9861081  }
    987 #if SCALED_REF_LAYER_OFFSETS
     1082#if SVC_EXTENSION
    9881083  for(Int layer = 0; layer < MAX_LAYERS; layer++)
    9891084  {
     
    10551150    }
    10561151  }
    1057 #endif
    10581152#if VPS_EXTN_DIRECT_REF_LAYERS
    10591153#if M0457_PREDICTION_INDICATIONS
     
    11531247  }
    11541248#endif
     1249#if AUXILIARY_PICTURES
     1250  for(UInt layer = 0; layer < MAX_LAYERS; layer++)
     1251  {
     1252    m_acLayerCfg[layer].m_InputChromaFormat =  numberToChromaFormat(cfg_tmpChromaFormatIDC[layer]);
     1253    m_acLayerCfg[layer].m_chromaFormatIDC = ((cfg_tmpChromaFormatIDC[layer] == 0) ? (m_acLayerCfg[layer].m_InputChromaFormat ) : (numberToChromaFormat(cfg_tmpChromaFormatIDC[layer])));
     1254  }
     1255#endif
    11551256  for(Int layer = 0; layer < MAX_LAYERS; layer++)
    11561257  {
     
    11851286  }
    11861287#endif
     1288#endif //SVC_EXTENSION
    11871289  m_scalingListFile = cfg_ScalingListFile.empty() ? NULL : strdup(cfg_ScalingListFile.c_str());
    11881290
    1189 #if REPN_FORMAT_IN_VPS_123
     1291  /* rules for input, output and internal bitdepths as per help text */
     1292#if O0194_DIFFERENT_BITDEPTH_EL_BL
    11901293  for(Int layer = 0; layer < MAX_LAYERS; layer++)
    11911294  {
    1192     m_acLayerCfg[layer].setSourceHeight( m_repFormatCfg[ m_acLayerCfg[layer].getRepFormatIdx() ].m_picHeightInLumaSamples);
    1193     m_acLayerCfg[layer].setSourceWidth ( m_repFormatCfg[ m_acLayerCfg[layer].getRepFormatIdx() ].m_picWidthInLumaSamples );
    1194   }
    1195 #endif
    1196   /* rules for input, output and internal bitdepths as per help text */
     1295    if (!m_acLayerCfg[layer].m_internalBitDepthY) { m_acLayerCfg[layer].m_internalBitDepthY = m_acLayerCfg[layer].m_inputBitDepthY; }
     1296    if (!m_acLayerCfg[layer].m_internalBitDepthC) { m_acLayerCfg[layer].m_internalBitDepthC = m_acLayerCfg[layer].m_internalBitDepthY; }
     1297    if (!m_acLayerCfg[layer].m_inputBitDepthC) { m_acLayerCfg[layer].m_inputBitDepthC = m_acLayerCfg[layer].m_inputBitDepthY; }
     1298    if (!m_acLayerCfg[layer].m_outputBitDepthY) { m_acLayerCfg[layer].m_outputBitDepthY = m_acLayerCfg[layer].m_internalBitDepthY; }
     1299    if (!m_acLayerCfg[layer].m_outputBitDepthC) { m_acLayerCfg[layer].m_outputBitDepthC = m_acLayerCfg[layer].m_internalBitDepthC; }
     1300  }
     1301#else
    11971302  if (!m_internalBitDepthY) { m_internalBitDepthY = m_inputBitDepthY; }
    11981303  if (!m_internalBitDepthC) { m_internalBitDepthC = m_internalBitDepthY; }
     
    12001305  if (!m_outputBitDepthY) { m_outputBitDepthY = m_internalBitDepthY; }
    12011306  if (!m_outputBitDepthC) { m_outputBitDepthC = m_internalBitDepthC; }
     1307#endif
    12021308
    12031309#if !SVC_EXTENSION
     
    14111517 
    14121518  // set global varibles
     1519#if LAYER_CTB
     1520  for(Int layer = 0; layer < MAX_LAYERS; layer++)
     1521  {
     1522    xSetGlobal(layer);
     1523  }
     1524#else
    14131525  xSetGlobal();
     1526#endif
    14141527 
    14151528  // print-out parameters
     
    14501563#define xConfirmPara(a,b) check_failed |= confirmPara(a,b)
    14511564  // check range of parameters
     1565#if O0194_DIFFERENT_BITDEPTH_EL_BL
     1566  for(UInt layer=0; layer<m_numLayers; layer++)
     1567  {
     1568    xConfirmPara( m_acLayerCfg[layer].m_inputBitDepthY < 8,                                                     "InputBitDepth must be at least 8" );
     1569    xConfirmPara( m_acLayerCfg[layer].m_inputBitDepthC < 8,                                                     "InputBitDepthC must be at least 8" );
     1570  }
     1571#else
    14521572  xConfirmPara( m_inputBitDepthY < 8,                                                     "InputBitDepth must be at least 8" );
    14531573  xConfirmPara( m_inputBitDepthC < 8,                                                     "InputBitDepthC must be at least 8" );
     1574#endif
    14541575#if !SVC_EXTENSION 
    14551576  xConfirmPara( m_iFrameRate <= 0,                                                          "Frame rate must be more than 1" );
     
    14711592  xConfirmPara( m_bipredSearchRange < 0 ,                                                   "Search Range must be more than 0" );
    14721593  xConfirmPara( m_iMaxDeltaQP > 7,                                                          "Absolute Delta QP exceeds supported range (0 to 7)" );
     1594#if LAYER_CTB
     1595  for(UInt layer = 0; layer < MAX_LAYERS; layer++)
     1596  {
     1597    xConfirmPara( m_iMaxCuDQPDepth > m_acLayerCfg[layer].m_uiMaxCUDepth - 1,                "Absolute depth for a minimum CuDQP exceeds maximum coding unit depth" );
     1598  }
     1599#else
    14731600  xConfirmPara( m_iMaxCuDQPDepth > m_uiMaxCUDepth - 1,                                          "Absolute depth for a minimum CuDQP exceeds maximum coding unit depth" );
     1601#endif
    14741602
    14751603  xConfirmPara( m_cbQpOffset < -12,   "Min. Chroma Cb QP Offset is -12" );
     
    14851613  }
    14861614#endif
     1615#if !LAYER_CTB
    14871616  xConfirmPara( (m_uiMaxCUWidth  >> m_uiMaxCUDepth) < 4,                                    "Minimum partition width size should be larger than or equal to 8");
    14881617  xConfirmPara( (m_uiMaxCUHeight >> m_uiMaxCUDepth) < 4,                                    "Minimum partition height size should be larger than or equal to 8");
    14891618  xConfirmPara( m_uiMaxCUWidth < 16,                                                        "Maximum partition width size should be larger than or equal to 16");
    14901619  xConfirmPara( m_uiMaxCUHeight < 16,                                                       "Maximum partition height size should be larger than or equal to 16");
     1620#endif
    14911621#if !SVC_EXTENSION
    14921622  xConfirmPara( (m_iSourceWidth  % (m_uiMaxCUWidth  >> (m_uiMaxCUDepth-1)))!=0,             "Resulting coded frame width must be a multiple of the minimum CU size");
     
    14941624#endif
    14951625 
     1626#if !LAYER_CTB
    14961627  xConfirmPara( m_uiQuadtreeTULog2MinSize < 2,                                        "QuadtreeTULog2MinSize must be 2 or greater.");
    14971628  xConfirmPara( m_uiQuadtreeTULog2MaxSize > 5,                                        "QuadtreeTULog2MaxSize must be 5 or smaller.");
     
    15071638  xConfirmPara( m_uiQuadtreeTUMaxDepthIntra < 1,                                                         "QuadtreeTUMaxDepthIntra must be greater than or equal to 1" );
    15081639  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" );
     1640#endif
    15091641 
    15101642  xConfirmPara(  m_maxNumMergeCand < 1,  "MaxNumMergeCand must be 1 or greater.");
     
    15541686#endif
    15551687
     1688#if !LAYER_CTB
    15561689  // max CU width and height should be power of 2
    15571690  UInt ui = m_uiMaxCUWidth;
     
    15691702      xConfirmPara( ui != 1 , "Height should be 2^n");
    15701703  }
    1571 
     1704#endif
    15721705
    15731706  /* if this is an intra-only sequence, ie IntraPeriod=1, don't verify the GOP structure
     
    15901723#endif
    15911724 
    1592 #if EXTERNAL_USEDBYCURR_N0082|| !FINAL_RPL_CHANGE_N0082
     1725
    15931726  Bool verifiedGOP=false;
    1594 #endif
    15951727  Bool errorGOP=false;
    1596 #if  EXTERNAL_USEDBYCURR_N0082|| !FINAL_RPL_CHANGE_N0082
    15971728  Int checkGOP=1;
    15981729  Int numRefs = m_isField ? 2 : 1;
    1599 #endif
    16001730  Int refList[MAX_NUM_REF_PICS+1];
    16011731  refList[0]=0;
     
    16091739    isOK[i]=false;
    16101740  }
    1611 #if  EXTERNAL_USEDBYCURR_N0082|| !FINAL_RPL_CHANGE_N0082
    16121741  Int numOK=0;
    1613 #endif
    16141742#if !SVC_EXTENSION
    16151743  xConfirmPara( m_iIntraPeriod >=0&&(m_iIntraPeriod%m_iGOPSize!=0), "Intra period must be a multiple of GOPSize, or -1" );
     
    16541782  }
    16551783#endif
    1656 #if FINAL_RPL_CHANGE_N0082
    1657   for(UInt layer=0; layer<m_numLayers; layer++)
    1658   {
    1659     if (m_acLayerCfg[layer].m_GOPListLayer[0].m_POC<0)
    1660     {
    1661       memcpy( m_acLayerCfg[layer].m_GOPListLayer, m_GOPList, sizeof(GOPEntry)*MAX_GOP );
    1662     }
    1663     errorGOP = xconfirmExtraGOP( m_acLayerCfg[layer].m_GOPListLayer );
    1664     xConfirmPara(errorGOP,"Invalid GOP structure given");
    1665   }
    1666 #if TEMP_SCALABILITY_FIX
    1667   if( m_acLayerCfg[1].m_GOPListLayer[5].m_POC == 6  && m_acLayerCfg[1].m_GOPListLayer[7].m_POC == 7  &&
    1668     m_acLayerCfg[1].m_GOPListLayer[5].m_temporalId == 0 && m_acLayerCfg[1].m_GOPListLayer[7].m_temporalId == 0)
    1669 #else
    1670   //tentative for encoder
    1671   if( m_acLayerCfg[1].m_GOPListLayer[5].m_POC == 6  && m_acLayerCfg[1].m_GOPListLayer[7].m_POC == 7 )
    1672 #endif
    1673   {
    1674     //RA, POC5
    1675     m_acLayerCfg[1].m_GOPListLayer[5].m_usedByCurrPic[2] = 0;
    1676     m_acLayerCfg[1].m_GOPListLayer[5].m_refIdc[2] = 0;
    1677     //RA, POC7
    1678     m_acLayerCfg[1].m_GOPListLayer[7].m_usedByCurrPic[2] = 0;
    1679     m_acLayerCfg[1].m_GOPListLayer[7].m_refIdc[2] = 0;
    1680   }
    1681 #endif
    1682 #if  EXTERNAL_USEDBYCURR_N0082|| !FINAL_RPL_CHANGE_N0082
     1784
    16831785  m_extraRPSs=0;
    16841786  //start looping through frames in coding order until we can verify that the GOP structure is correct.
     
    18761978  }
    18771979  xConfirmPara(errorGOP,"Invalid GOP structure given");
    1878 #endif
    1879 #if EXTERNAL_USEDBYCURR_N0082
    1880   for(UInt layer=0; layer<m_numLayers; layer++)
    1881   {
    1882     for (Int i=0; i< m_iGOPSize; i++){
    1883       if (m_acLayerCfg[layer].m_GOPListLayer[i].m_UseExtusedByCurrPic == 1 )
    1884       {
    1885         for(Int j=0; j<m_acLayerCfg[layer].m_GOPListLayer[i].m_numRefPics; j++ )
    1886         {
    1887           m_acLayerCfg[layer].m_GOPListLayer[i].m_usedByCurrPic[j] = m_acLayerCfg[layer].m_GOPListLayer[i].m_ExtusedByCurrPic[j];
    1888           m_acLayerCfg[layer].m_GOPListLayer[i].m_refIdc[j] = m_acLayerCfg[layer].m_GOPListLayer[i].m_ExtusedByCurrPic[j];
    1889         }
    1890       }
    1891     }
    1892   }
    1893 #endif
     1980
    18941981  m_maxTempLayer = 1;
    18951982  for(Int i=0; i<m_iGOPSize; i++)
     
    19662053    Int m_iSourceWidth = m_acLayerCfg[layer].m_iSourceWidth;
    19672054    Int m_iSourceHeight = m_acLayerCfg[layer].m_iSourceHeight;
     2055#if LAYER_CTB
     2056    Int m_uiMaxCUWidth = m_acLayerCfg[layer].m_uiMaxCUWidth;
     2057    Int m_uiMaxCUHeight = m_acLayerCfg[layer].m_uiMaxCUHeight;
     2058#endif
    19682059#endif
    19692060  if(m_vuiParametersPresentFlag && m_bitstreamRestrictionFlag)
     
    22012292  }
    22022293#endif
     2294#if AUXILIARY_PICTURES
     2295  for (UInt layer=0; layer < MAX_LAYERS-1; layer++)
     2296  {
     2297    xConfirmPara(m_acLayerCfg[layer].m_auxId < 0 || m_acLayerCfg[layer].m_auxId > 4, "AuxId must be in range 0 to 4");
     2298    xConfirmPara(m_acLayerCfg[layer].m_auxId > 0 && m_acLayerCfg[layer].m_chromaFormatIDC != CHROMA_400, "Auxiliary picture must be monochrome picture");
     2299  }
     2300#endif
    22032301#undef xConfirmPara
    22042302  if (check_failed)
     
    22102308/** \todo use of global variables should be removed later
    22112309 */
     2310#if LAYER_CTB
     2311Void TAppEncCfg::xSetGlobal(UInt layerId)
     2312{
     2313  // set max CU width & height
     2314  g_auiLayerMaxCUWidth[layerId]  = m_acLayerCfg[layerId].m_uiMaxCUWidth;
     2315  g_auiLayerMaxCUHeight[layerId] = m_acLayerCfg[layerId].m_uiMaxCUHeight;
     2316 
     2317  // compute actual CU depth with respect to config depth and max transform size
     2318  g_auiLayerAddCUDepth[layerId]  = 0;
     2319  while( (m_acLayerCfg[layerId].m_uiMaxCUWidth>>m_acLayerCfg[layerId].m_uiMaxCUDepth) > ( 1 << ( m_acLayerCfg[layerId].m_uiQuadtreeTULog2MinSize + g_auiLayerAddCUDepth[layerId] )  ) ) g_auiLayerAddCUDepth[layerId]++;
     2320 
     2321  m_acLayerCfg[layerId].m_uiMaxCUDepth += g_auiLayerAddCUDepth[layerId];
     2322  g_auiLayerAddCUDepth[layerId]++;
     2323  g_auiLayerMaxCUDepth[layerId] = m_acLayerCfg[layerId].m_uiMaxCUDepth;
     2324 
     2325#if O0194_DIFFERENT_BITDEPTH_EL_BL
     2326  // set internal bit-depth to constant value to make sure to be updated later
     2327  g_bitDepthY = -1;
     2328  g_bitDepthC = -1;
     2329 
     2330  g_uiPCMBitDepthLuma = -1;
     2331  g_uiPCMBitDepthChroma = -1;
     2332#else
     2333  // set internal bit-depth and constants
     2334  g_bitDepthY = m_internalBitDepthY;
     2335  g_bitDepthC = m_internalBitDepthC;
     2336 
     2337  g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_inputBitDepthY : m_internalBitDepthY;
     2338  g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_inputBitDepthC : m_internalBitDepthC;
     2339#endif
     2340}
     2341#else
    22122342Void TAppEncCfg::xSetGlobal()
    22132343{
     
    22242354  g_uiMaxCUDepth = m_uiMaxCUDepth;
    22252355 
    2226   // set internal bit-depth and constants
     2356#if O0194_DIFFERENT_BITDEPTH_EL_BL
     2357  // set internal bit-depth to constant value to make sure to be updated later
     2358  g_bitDepthY = -1;
     2359  g_bitDepthC = -1;
     2360 
     2361  g_uiPCMBitDepthLuma = -1;
     2362  g_uiPCMBitDepthChroma = -1;
     2363#else
    22272364  g_bitDepthY = m_internalBitDepthY;
    22282365  g_bitDepthC = m_internalBitDepthC;
     
    22302367  g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_inputBitDepthY : m_internalBitDepthY;
    22312368  g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_inputBitDepthC : m_internalBitDepthC;
     2369#endif
    22322370}
     2371#endif
    22332372
    22342373Void TAppEncCfg::xPrintParameter()
     
    22402379  printf("Multiview                     : %d\n", m_scalabilityMask[1] );
    22412380  printf("Scalable                      : %d\n", m_scalabilityMask[2] );
     2381#if AUXILIARY_PICTURES
     2382  printf("Auxiliary pictures            : %d\n", m_scalabilityMask[3] );
     2383#endif
    22422384#else
    22432385  printf("Multiview                     : %d\n", m_scalabilityMask[0] );
     
    22842426    printf("Frame index                  : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded );
    22852427  }
     2428#if !LAYER_CTB
    22862429  printf("CU size / depth              : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth );
    22872430  printf("RQT trans. size (min / max)  : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize );
    22882431  printf("Max RQT depth inter          : %d\n", m_uiQuadtreeTUMaxDepthInter);
    22892432  printf("Max RQT depth intra          : %d\n", m_uiQuadtreeTUMaxDepthIntra);
     2433#endif
    22902434  printf("Min PCM size                 : %d\n", 1 << m_uiPCMLog2MinSize);
    22912435  printf("Motion search range          : %d\n", m_iSearchRange );
     
    23042448  printf("QP adaptation                : %d (range=%d)\n", m_bUseAdaptiveQP, (m_bUseAdaptiveQP ? m_iQPAdaptationRange : 0) );
    23052449  printf("GOP size                     : %d\n", m_iGOPSize );
     2450#if !O0194_DIFFERENT_BITDEPTH_EL_BL
    23062451  printf("Internal bit depth           : (Y:%d, C:%d)\n", m_internalBitDepthY, m_internalBitDepthC );
    23072452  printf("PCM sample bit depth         : (Y:%d, C:%d)\n", g_uiPCMBitDepthLuma, g_uiPCMBitDepthChroma );
     2453#endif
     2454#if O0215_PHASE_ALIGNMENT
     2455  printf("cross-layer sample alignment : %d\n", m_phaseAlignFlag);
     2456#endif
    23082457#if RATE_CONTROL_LAMBDA_DOMAIN
    23092458#if !RC_SHVC_HARMONIZATION
     
    23312480 
    23322481  printf("TOOL CFG: ");
     2482#if !O0194_DIFFERENT_BITDEPTH_EL_BL
    23332483  printf("IBD:%d ", g_bitDepthY > m_inputBitDepthY || g_bitDepthC > m_inputBitDepthC);
     2484#endif
    23342485  printf("HAD:%d ", m_bUseHADME           );
    23352486  printf("SRD:%d ", m_bUseSBACRD          );
     
    23622513  printf("CIP:%d ", m_bUseConstrainedIntraPred);
    23632514  printf("SAO:%d ", (m_bUseSAO)?(1):(0));
     2515#if !LAYER_CTB
    23642516  printf("PCM:%d ", (m_usePCM && (1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0);
     2517#endif
    23652518  printf("SAOLcuBasedOptimization:%d ", (m_saoLcuBasedOptimization)?(1):(0));
    23662519
     
    23942547  printf("RecalQP:%d", m_recalculateQPAccordingToLambda ? 1 : 0 );
    23952548#endif
     2549  printf("O0194_DIFFERENT_BITDEPTH_EL_BL: %d ", O0194_DIFFERENT_BITDEPTH_EL_BL);
     2550  printf("O0194_JOINT_US_BITSHIFT: %d ", O0194_JOINT_US_BITSHIFT);
     2551  printf("O0194_WEIGHTED_PREDICTION_CGS: %d ",O0194_WEIGHTED_PREDICTION_CGS);
    23962552  printf("\n\n");
    23972553 
     
    24082564}
    24092565
    2410 #if SCALED_REF_LAYER_OFFSETS
     2566#if SVC_EXTENSION
    24112567Void TAppEncCfg::cfgStringToArray(Int **arr, string cfgString, Int numEntries, const char* logString)
    24122568{
     
    24412597  }
    24422598}
    2443 #endif
    2444 
    2445 #if FINAL_RPL_CHANGE_N0082
    2446 Bool  TAppEncCfg::xconfirmExtraGOP (GOPEntry * ge)
    2447 {
    2448   Bool verifiedGOP=false;
    2449   Bool errorGOP=false;
    2450   Int checkGOP=1;
    2451   Int numRefs = 1;
    2452   Int refList[MAX_NUM_REF_PICS+1];
    2453   refList[0]=0;
    2454   Bool isOK[MAX_GOP];
    2455   for(Int i=0; i<MAX_GOP; i++)
    2456   {
    2457     isOK[i]=false;
    2458   }
    2459   Int numOK=0;
    2460 
    2461   m_extraRPSs=0;
    2462   //start looping through frames in coding order until we can verify that the GOP structure is correct.
    2463   while(!verifiedGOP&&!errorGOP)
    2464   {
    2465     Int curGOP = (checkGOP-1)%m_iGOPSize;
    2466     Int curPOC = ((checkGOP-1)/m_iGOPSize)*m_iGOPSize + ge[curGOP].m_POC;   
    2467     if(ge[curGOP].m_POC<0)
    2468     {
    2469       printf("\nError: found fewer Reference Picture Sets than GOPSize\n");
    2470       errorGOP=true;
    2471     }
    2472     else
    2473     {
    2474       //check that all reference pictures are available, or have a POC < 0 meaning they might be available in the next GOP.
    2475       Bool beforeI = false;
    2476       for(Int i = 0; i< ge[curGOP].m_numRefPics; i++)
    2477       {
    2478         Int absPOC = curPOC+ge[curGOP].m_referencePics[i];
    2479         if(absPOC < 0)
    2480         {
    2481           beforeI=true;
    2482         }
    2483         else
    2484         {
    2485           Bool found=false;
    2486           for(Int j=0; j<numRefs; j++)
    2487           {
    2488             if(refList[j]==absPOC)
    2489             {
    2490               found=true;
    2491               for(Int k=0; k<m_iGOPSize; k++)
    2492               {
    2493                 if(absPOC%m_iGOPSize == ge[k].m_POC%m_iGOPSize)
    2494                 {
    2495                   if(ge[k].m_temporalId==ge[curGOP].m_temporalId)
    2496                   {
    2497                     ge[k].m_refPic = true;
    2498                   }
    2499                   ge[curGOP].m_usedByCurrPic[i]=ge[k].m_temporalId<=ge[curGOP].m_temporalId;
    2500                 }
    2501               }
    2502             }
    2503           }
    2504           if(!found)
    2505           {
    2506             printf("\nError: ref pic %d is not available for GOP frame %d\n",ge[curGOP].m_referencePics[i],curGOP+1);
    2507             errorGOP=true;
    2508           }
    2509         }
    2510       }
    2511       if(!beforeI&&!errorGOP)
    2512       {
    2513         //all ref frames were present
    2514         if(!isOK[curGOP])
    2515         {
    2516           numOK++;
    2517           isOK[curGOP]=true;
    2518           if(numOK==m_iGOPSize)
    2519           {
    2520             verifiedGOP=true;
    2521           }
    2522         }
    2523       }
    2524       else
    2525       {
    2526         //create a new GOPEntry for this frame containing all the reference pictures that were available (POC > 0)
    2527         ge[m_iGOPSize+m_extraRPSs]=ge[curGOP];
    2528         Int newRefs=0;
    2529         for(Int i = 0; i< ge[curGOP].m_numRefPics; i++)
    2530         {
    2531           Int absPOC = curPOC+ge[curGOP].m_referencePics[i];
    2532           if(absPOC>=0)
    2533           {
    2534             ge[m_iGOPSize+m_extraRPSs].m_referencePics[newRefs]=ge[curGOP].m_referencePics[i];
    2535             ge[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[newRefs]=ge[curGOP].m_usedByCurrPic[i];
    2536             newRefs++;
    2537           }
    2538         }
    2539         Int numPrefRefs = ge[curGOP].m_numRefPicsActive;
    2540        
    2541         for(Int offset = -1; offset>-checkGOP; offset--)
    2542         {
    2543           //step backwards in coding order and include any extra available pictures we might find useful to replace the ones with POC < 0.
    2544           Int offGOP = (checkGOP-1+offset)%m_iGOPSize;
    2545           Int offPOC = ((checkGOP-1+offset)/m_iGOPSize)*m_iGOPSize + ge[offGOP].m_POC;
    2546           if(offPOC>=0&&ge[offGOP].m_temporalId<=ge[curGOP].m_temporalId)
    2547           {
    2548             Bool newRef=false;
    2549             for(Int i=0; i<numRefs; i++)
    2550             {
    2551               if(refList[i]==offPOC)
    2552               {
    2553                 newRef=true;
    2554               }
    2555             }
    2556             for(Int i=0; i<newRefs; i++)
    2557             {
    2558               if(ge[m_iGOPSize+m_extraRPSs].m_referencePics[i]==offPOC-curPOC)
    2559               {
    2560                 newRef=false;
    2561               }
    2562             }
    2563             if(newRef)
    2564             {
    2565               Int insertPoint=newRefs;
    2566               //this picture can be added, find appropriate place in list and insert it.
    2567               if(ge[offGOP].m_temporalId==ge[curGOP].m_temporalId)
    2568               {
    2569                 ge[offGOP].m_refPic = true;
    2570               }
    2571               for(Int j=0; j<newRefs; j++)
    2572               {
    2573                 if(ge[m_iGOPSize+m_extraRPSs].m_referencePics[j]<offPOC-curPOC||ge[m_iGOPSize+m_extraRPSs].m_referencePics[j]>0)
    2574                 {
    2575                   insertPoint = j;
    2576                   break;
    2577                 }
    2578               }
    2579               Int prev = offPOC-curPOC;
    2580               Int prevUsed = ge[offGOP].m_temporalId<=ge[curGOP].m_temporalId;
    2581               for(Int j=insertPoint; j<newRefs+1; j++)
    2582               {
    2583                 Int newPrev = ge[m_iGOPSize+m_extraRPSs].m_referencePics[j];
    2584                 Int newUsed = ge[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j];
    2585                 ge[m_iGOPSize+m_extraRPSs].m_referencePics[j]=prev;
    2586                 ge[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j]=prevUsed;
    2587                 prevUsed=newUsed;
    2588                 prev=newPrev;
    2589               }
    2590               newRefs++;
    2591             }
    2592           }
    2593           if(newRefs>=numPrefRefs)
    2594           {
    2595             break;
    2596           }
    2597         }
    2598         ge[m_iGOPSize+m_extraRPSs].m_numRefPics=newRefs;
    2599         ge[m_iGOPSize+m_extraRPSs].m_POC = curPOC;
    2600         if (m_extraRPSs == 0)
    2601         {
    2602           ge[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 0;
    2603           ge[m_iGOPSize+m_extraRPSs].m_numRefIdc = 0;
    2604         }
    2605         else
    2606         {
    2607           Int rIdx =  m_iGOPSize + m_extraRPSs - 1;
    2608           Int refPOC = ge[rIdx].m_POC;
    2609           Int refPics = ge[rIdx].m_numRefPics;
    2610           Int newIdc=0;
    2611           for(Int i = 0; i<= refPics; i++)
    2612           {
    2613             Int deltaPOC = ((i != refPics)? ge[rIdx].m_referencePics[i] : 0);  // check if the reference abs POC is >= 0
    2614             Int absPOCref = refPOC+deltaPOC;
    2615             Int refIdc = 0;
    2616             for (Int j = 0; j < ge[m_iGOPSize+m_extraRPSs].m_numRefPics; j++)
    2617             {
    2618               if ( (absPOCref - curPOC) == ge[m_iGOPSize+m_extraRPSs].m_referencePics[j])
    2619               {
    2620                 if (ge[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j])
    2621                 {
    2622                   refIdc = 1;
    2623                 }
    2624                 else
    2625                 {
    2626                   refIdc = 2;
    2627                 }
    2628               }
    2629             }
    2630             ge[m_iGOPSize+m_extraRPSs].m_refIdc[newIdc]=refIdc;
    2631             newIdc++;
    2632           }
    2633           ge[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 1; 
    2634           ge[m_iGOPSize+m_extraRPSs].m_numRefIdc = newIdc;
    2635           ge[m_iGOPSize+m_extraRPSs].m_deltaRPS = refPOC - ge[m_iGOPSize+m_extraRPSs].m_POC;
    2636         }
    2637         curGOP=m_iGOPSize+m_extraRPSs;
    2638         m_extraRPSs++;
    2639       }
    2640       numRefs=0;
    2641       for(Int i = 0; i< ge[curGOP].m_numRefPics; i++)
    2642       {
    2643         Int absPOC = curPOC+ge[curGOP].m_referencePics[i];
    2644         if(absPOC >= 0)
    2645         {
    2646           refList[numRefs]=absPOC;
    2647           numRefs++;
    2648         }
    2649       }
    2650       refList[numRefs]=curPOC;
    2651       numRefs++;
    2652     }
    2653     checkGOP++;
    2654   }
    2655 
    2656   return errorGOP; //update
    2657 }
    2658 #endif
     2599
     2600#endif //SVC_EXTENSION
    26592601//! \}
  • trunk/source/App/TAppEncoder/TAppEncCfg.h

    r442 r494  
    101101  Int       m_aiPad[2];                                       ///< number of padded pixels for width and height
    102102#endif 
    103 
     103#if AUXILIARY_PICTURES
     104  ChromaFormat m_InputChromaFormatIDC;
     105#endif
    104106  Bool      m_isField;                                        ///< enable field coding
    105107  Bool      m_isTopFieldFirst;
     
    150152  Int       m_maxTempLayer;                                  ///< Max temporal layer
    151153
     154#if !LAYER_CTB
    152155  // coding unit (CU) definition
    153156  UInt      m_uiMaxCUWidth;                                   ///< max. CU width in pixel
     
    161164  UInt      m_uiQuadtreeTUMaxDepthInter;
    162165  UInt      m_uiQuadtreeTUMaxDepthIntra;
     166#endif
    163167 
    164168  // coding tools (bit-depth)
     169#if !O0194_DIFFERENT_BITDEPTH_EL_BL
    165170  Int       m_inputBitDepthY;                               ///< bit-depth of input file (luma component)
    166171  Int       m_inputBitDepthC;                               ///< bit-depth of input file (chroma component)
     
    169174  Int       m_internalBitDepthY;                            ///< bit-depth codec operates at in luma (input/output files will be converted)
    170175  Int       m_internalBitDepthC;                            ///< bit-depth codec operates at in chroma (input/output files will be converted)
     176#endif
     177#if AUXILIARY_PICTURES
     178  ChromaFormat m_chromaFormatIDC;
     179#endif
    171180
    172181  // coding tools (PCM bit-depth)
     
    354363#endif
    355364  // internal member functions
     365#if LAYER_CTB
     366  Void  xSetGlobal      (UInt layerId);                       ///< set global variables
     367#else
    356368  Void  xSetGlobal      ();                                   ///< set global variables
     369#endif
    357370  Void  xCheckParameter ();                                   ///< check validity of configuration values
    358371  Void  xPrintParameter ();                                   ///< print configuration values
    359372  Void  xPrintUsage     ();                                   ///< print usage
    360 #if FINAL_RPL_CHANGE_N0082
    361   Bool  xconfirmExtraGOP (GOPEntry * ge);
    362 #endif
    363373#if M0040_ADAPTIVE_RESOLUTION_CHANGE
    364374  Int       m_adaptiveResolutionChange;                       ///< Indicate adaptive resolution change frame
     
    375385  UInt      m_ilcIdc[1024];
    376386#endif
     387#if O0215_PHASE_ALIGNMENT
     388  bool m_phaseAlignFlag;
     389#endif
    377390public:
    378391  TAppEncCfg();
     
    388401  Int  getNumLayer()               {return m_numLayers;        }
    389402  Int  getGOPSize()                {return m_iGOPSize;          }
     403#if O0194_DIFFERENT_BITDEPTH_EL_BL
     404  UInt getInternalBitDepthY(Int iLayer)      {return m_acLayerCfg[iLayer].m_internalBitDepthY; }
     405  UInt getInternalBitDepthC(Int iLayer)      {return m_acLayerCfg[iLayer].m_internalBitDepthC; }
     406  Bool getPCMInputBitDepthFlag()             {return m_bPCMInputBitDepthFlag;                  }
     407#else
    390408  UInt getInternalBitDepthY()      {return m_internalBitDepthY; }
    391409  UInt getInternalBitDepthC()      {return m_internalBitDepthC; }
     410#endif
     411#if !LAYER_CTB
    392412  UInt getMaxCUWidth()             {return m_uiMaxCUWidth;      }
    393413  UInt getMaxCUHeight()            {return m_uiMaxCUHeight;     }
    394414  UInt getMaxCUDepth()             {return m_uiMaxCUDepth;      }
     415#endif
    395416  Int  getDecodingRefreshType()    {return m_iDecodingRefreshType; }
    396417  Int  getWaveFrontSynchro()        { return m_iWaveFrontSynchro; }
     
    399420  Char* getBLSyntaxFile()           { return m_BLSyntaxFile;      }
    400421#endif
    401 #if SCALED_REF_LAYER_OFFSETS
    402422  Void cfgStringToArray(Int **arr, string cfgString, Int numEntries, const char* logString);
    403 #endif
    404423#if REPN_FORMAT_IN_VPS
    405424  RepFormatCfg* getRepFormatCfg(Int i)  { return &m_repFormatCfg[i]; }
    406425#endif
     426#if LAYER_CTB
     427  Bool getUsePCM()                  { return m_usePCM;               }
     428  UInt getPCMLog2MinSize  ()        { return  m_uiPCMLog2MinSize;    }
     429#endif
    407430#endif
    408431};// END CLASS DEFINITION TAppEncCfg
  • trunk/source/App/TAppEncoder/TAppEncLayerCfg.cpp

    r442 r494  
    2222//! \{
    2323
     24
     25#if AUXILIARY_PICTURES
     26static inline ChromaFormat numberToChromaFormat(const Int val)
     27{
     28  switch (val)
     29  {
     30    case 400: return CHROMA_400; break;
     31    case 420: return CHROMA_420; break;
     32    case 422: return CHROMA_422; break;
     33    case 444: return CHROMA_444; break;
     34    default:  return NUM_CHROMA_FORMAT;
     35  }
     36}
     37#endif
    2438
    2539// ====================================================================================================================
     
    3852  m_confLeft = m_confRight = m_confTop = m_confBottom = 0;
    3953  m_aiPad[1] = m_aiPad[0] = 0;
    40 #if SCALED_REF_LAYER_OFFSETS
    4154  m_numScaledRefLayerOffsets = 0;
    4255  ::memset(m_scaledRefLayerLeftOffset,   0, sizeof(m_scaledRefLayerLeftOffset));
     
    4457  ::memset(m_scaledRefLayerRightOffset,  0, sizeof(m_scaledRefLayerRightOffset));
    4558  ::memset(m_scaledRefLayerBottomOffset, 0, sizeof(m_scaledRefLayerBottomOffset));
    46 #endif
    4759}
    4860
     
    7789  string cfg_ReconFile;
    7890  string cfg_dQPFile;
     91#if AUXILIARY_PICTURES
     92  Int tmpInputChromaFormat;
     93  Int tmpChromaFormat;
     94#endif
     95
    7996  po::Options opts;
    8097  opts.addOptions()
     
    87104    ("SourceHeight,-hgt",     m_iSourceHeight, 0, "Source picture height")
    88105    ("CroppingMode",          m_conformanceMode,  0, "Cropping mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping")
     106#if AUXILIARY_PICTURES
     107    ("InputChromaFormat",     tmpInputChromaFormat,  420, "InputChromaFormatIDC")
     108    ("ChromaFormatIDC",       tmpChromaFormat,    420, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat)")
     109#endif
    89110    ("CropLeft",              m_confLeft,      0, "Left cropping/padding for cropping mode 3")
    90111    ("CropRight",             m_confRight,     0, "Right cropping/padding for cropping mode 3")
     
    105126  m_cReconFile = cfg_ReconFile;
    106127  m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str());
     128#if AUXILIARY_PICTURES
     129  m_InputChromaFormat = numberToChromaFormat(tmpInputChromaFormat);
     130  m_chromaFormatIDC   = ((tmpChromaFormat == 0) ? (m_InputChromaFormat) : (numberToChromaFormat(tmpChromaFormat)));
     131#endif
    107132
    108133  // reading external dQP description from file
     
    142167  printf("Real     Format               : %dx%d %dHz\n", m_iSourceWidth - m_confLeft - m_confRight, m_iSourceHeight - m_confTop - m_confBottom, m_iFrameRate );
    143168  printf("Internal Format               : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate );
     169#if O0194_DIFFERENT_BITDEPTH_EL_BL
     170  printf("Input bit depth               : (Y:%d, C:%d)\n", m_inputBitDepthY   , m_inputBitDepthC    );
     171  printf("Internal bit depth            : (Y:%d, C:%d)\n", m_internalBitDepthY, m_internalBitDepthC );
     172  printf("PCM sample bit depth          : (Y:%d, C:%d)\n", m_cAppEncCfg->getPCMInputBitDepthFlag() ? m_inputBitDepthY : m_internalBitDepthY, m_cAppEncCfg->getPCMInputBitDepthFlag() ? m_inputBitDepthC : m_internalBitDepthC );
     173#endif
     174#if LAYER_CTB
     175  printf("CU size / depth               : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth );
     176  printf("RQT trans. size (min / max)   : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize );
     177  printf("Max RQT depth inter           : %d\n", m_uiQuadtreeTUMaxDepthInter);
     178  printf("Max RQT depth intra           : %d\n", m_uiQuadtreeTUMaxDepthIntra);
     179#endif
    144180  printf("QP                            : %5.2f\n", m_fQP );
    145181  printf("Intra period                  : %d\n", m_iIntraPeriod );
     
    157193#endif
    158194  printf("WaveFrontSynchro:%d WaveFrontSubstreams:%d", m_cAppEncCfg->getWaveFrontSynchro(), m_iWaveFrontSubstreams);
     195#if LAYER_CTB
     196  printf("PCM:%d ", (m_cAppEncCfg->getUsePCM() && (1<<m_cAppEncCfg->getPCMLog2MinSize()) <= m_uiMaxCUWidth)? 1 : 0);
     197#endif
    159198}
    160199
     
    175214    {
    176215      // automatic padding to minimum CU size
     216#if LAYER_CTB
     217      Int minCuSize = m_uiMaxCUHeight >> (m_uiMaxCUDepth - 1);
     218#else
    177219      Int minCuSize = m_cAppEncCfg->getMaxCUHeight() >> (m_cAppEncCfg->getMaxCUDepth() - 1);
     220#endif
    178221      if (m_iSourceWidth % minCuSize)
    179222      {
     
    240283  }
    241284
     285#if LAYER_CTB
     286  UInt maxCUWidth = m_uiMaxCUWidth;
     287  UInt maxCUHeight = m_uiMaxCUHeight;
     288  UInt maxCUDepth = m_uiMaxCUDepth;
     289#else
    242290  UInt maxCUWidth = m_cAppEncCfg->getMaxCUWidth();
    243291  UInt maxCUHeight = m_cAppEncCfg->getMaxCUHeight();
    244292  UInt maxCUDepth = m_cAppEncCfg->getMaxCUDepth();
     293#endif
    245294  bool check_failed = false; /* abort if there is a fatal configuration problem */
    246295#define xConfirmPara(a,b) check_failed |= confirmPara(a,b)
     
    255304  }
    256305
     306#if O0194_DIFFERENT_BITDEPTH_EL_BL
     307  for(UInt layer = 0; layer < MAX_LAYERS; layer++)
     308  {
     309    xConfirmPara( m_iQP <  -6 * ((Int)m_cAppEncCfg->getInternalBitDepthY(layer) - 8) || m_iQP > 51,                "QP exceeds supported range (-QpBDOffsety to 51)" );
     310  }
     311#else
    257312  xConfirmPara( m_iQP <  -6 * ((Int)m_cAppEncCfg->getInternalBitDepthY() - 8) || m_iQP > 51,                "QP exceeds supported range (-QpBDOffsety to 51)" );
    258 
    259 
    260   m_iWaveFrontSubstreams = m_cAppEncCfg->getWaveFrontSynchro() ? (m_iSourceHeight + m_cAppEncCfg->getMaxCUHeight() - 1) / m_cAppEncCfg->getMaxCUHeight() : 1;
     313#endif
     314
     315
     316  m_iWaveFrontSubstreams = m_cAppEncCfg->getWaveFrontSynchro() ? (m_iSourceHeight + maxCUHeight - 1) / maxCUHeight : 1;
    261317  xConfirmPara( m_iWaveFrontSubstreams <= 0, "WaveFrontSubstreams must be positive" );
    262318  xConfirmPara( m_iWaveFrontSubstreams > 1 && !m_cAppEncCfg->getWaveFrontSynchro(), "Must have WaveFrontSynchro > 0 in order to have WaveFrontSubstreams > 1" );
     
    273329  xConfirmPara( m_confTop    % TComSPS::getWinUnitY(CHROMA_420) != 0, "Top conformance window offset must be an integer multiple of the specified chroma subsampling");
    274330  xConfirmPara( m_confBottom % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling");
     331
     332#if LAYER_CTB 
     333  xConfirmPara( (m_uiMaxCUWidth  >> m_uiMaxCUDepth) < 4,                                    "Minimum partition width size should be larger than or equal to 8");
     334  xConfirmPara( (m_uiMaxCUHeight >> m_uiMaxCUDepth) < 4,                                    "Minimum partition height size should be larger than or equal to 8");
     335  xConfirmPara( m_uiMaxCUWidth < 16,                                                        "Maximum partition width size should be larger than or equal to 16");
     336  xConfirmPara( m_uiMaxCUHeight < 16,                                                       "Maximum partition height size should be larger than or equal to 16");
     337  xConfirmPara( m_uiQuadtreeTULog2MinSize < 2,                                        "QuadtreeTULog2MinSize must be 2 or greater.");
     338  xConfirmPara( m_uiQuadtreeTULog2MaxSize > 5,                                        "QuadtreeTULog2MaxSize must be 5 or smaller.");
     339  xConfirmPara( (1<<m_uiQuadtreeTULog2MaxSize) > m_uiMaxCUWidth,                                        "QuadtreeTULog2MaxSize must be log2(maxCUSize) or smaller.");
     340  xConfirmPara( m_uiQuadtreeTULog2MaxSize < m_uiQuadtreeTULog2MinSize,                "QuadtreeTULog2MaxSize must be greater than or equal to m_uiQuadtreeTULog2MinSize.");
     341  xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUWidth >>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS
     342  xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUHeight>>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS
     343  xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUWidth  >> m_uiMaxCUDepth ), "Minimum CU width must be greater than minimum transform size." );
     344  xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUHeight >> m_uiMaxCUDepth ), "Minimum CU height must be greater than minimum transform size." );
     345  xConfirmPara( m_uiQuadtreeTUMaxDepthInter < 1,                                                         "QuadtreeTUMaxDepthInter must be greater than or equal to 1" );
     346  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" );
     347  xConfirmPara( m_uiQuadtreeTUMaxDepthIntra < 1,                                                         "QuadtreeTUMaxDepthIntra must be greater than or equal to 1" );
     348  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" );
     349
     350  // max CU width and height should be power of 2
     351  UInt ui = m_uiMaxCUWidth;
     352  while(ui)
     353  {
     354    ui >>= 1;
     355    if( (ui & 1) == 1)
     356      xConfirmPara( ui != 1 , "Width should be 2^n");
     357  }
     358  ui = m_uiMaxCUHeight;
     359  while(ui)
     360  {
     361    ui >>= 1;
     362    if( (ui & 1) == 1)
     363      xConfirmPara( ui != 1 , "Height should be 2^n");
     364  }
     365#endif
     366
    275367#undef xConfirmPara
    276368  return check_failed;
    277369}
    278370
    279 #endif
     371#endif //SVC_EXTENSION
    280372
    281373
  • trunk/source/App/TAppEncoder/TAppEncLayerCfg.h

    r442 r494  
    66#define __TAPPENCLAYERCFG__
    77
     8#if SVC_EXTENSION
    89#include "TLibCommon/CommonDef.h"
    910#include "TLibEncoder/TEncCfg.h"
     
    1112
    1213using namespace std;
    13 #if SVC_EXTENSION
    1414class TAppEncCfg;
    15 #endif
    1615//! \ingroup TAppEncoder
    1716//! \{
     
    4342  Int       m_iIntraPeriod;                                   ///< period of I-slice (random access period)
    4443  Double    m_fQP;                                            ///< QP value of key-picture (floating point)
     44#if AUXILIARY_PICTURES
     45  ChromaFormat m_chromaFormatIDC;
     46  ChromaFormat m_InputChromaFormat;
     47  Int          m_auxId;
     48#endif
    4549#if VPS_EXTN_DIRECT_REF_LAYERS
    4650#if M0457_PREDICTION_INDICATIONS
     
    5559  Int       *m_predLayerIds;
    5660  Int       m_numActiveRefLayers;
     61#endif
     62
     63#if LAYER_CTB
     64  // coding unit (CU) definition
     65  UInt      m_uiMaxCUWidth;                                   ///< max. CU width in pixel
     66  UInt      m_uiMaxCUHeight;                                  ///< max. CU height in pixel
     67  UInt      m_uiMaxCUDepth;                                   ///< max. CU depth
     68 
     69  // transfom unit (TU) definition
     70  UInt      m_uiQuadtreeTULog2MaxSize;
     71  UInt      m_uiQuadtreeTULog2MinSize;
     72 
     73  UInt      m_uiQuadtreeTUMaxDepthInter;
     74  UInt      m_uiQuadtreeTUMaxDepthIntra;
    5775#endif
    5876
     
    7088  Int       m_maxTidIlRefPicsPlus1;
    7189#endif
    72 #if SVC_EXTENSION
    7390  Int       m_iWaveFrontSubstreams; //< If iWaveFrontSynchro, this is the number of substreams per frame (dependent tiles) or per tile (independent tiles).
    74 #endif
    7591
    7692  Int       m_iQP;                                            ///< QP value of key-picture (integer)
     
    7894  Int*      m_aidQP;                                          ///< array of slice QP values
    7995  TAppEncCfg* m_cAppEncCfg;                                   ///< pointer to app encoder config
    80 #if SCALED_REF_LAYER_OFFSETS
    8196  Int       m_numScaledRefLayerOffsets  ;
    8297  Int       m_scaledRefLayerLeftOffset  [MAX_LAYERS];
     
    8499  Int       m_scaledRefLayerRightOffset [MAX_LAYERS];
    85100  Int       m_scaledRefLayerBottomOffset[MAX_LAYERS];
    86 #endif 
    87 #if FINAL_RPL_CHANGE_N0082
    88   GOPEntry  m_GOPListLayer[MAX_GOP];                            ///< for layer
     101#if O0194_DIFFERENT_BITDEPTH_EL_BL
     102  Int       m_inputBitDepthY;                               ///< bit-depth of input file (luma component)
     103  Int       m_inputBitDepthC;                               ///< bit-depth of input file (chroma component)
     104  Int       m_internalBitDepthY;                            ///< bit-depth codec operates at in luma (input/output files will be converted)
     105  Int       m_internalBitDepthC;                            ///< bit-depth codec operates at in chroma (input/output files will be converted)
     106  Int       m_outputBitDepthY;                              ///< bit-depth of output file (luma component)
     107  Int       m_outputBitDepthC;                              ///< bit-depth of output file (chroma component)
    89108#endif
    90109#if REPN_FORMAT_IN_VPS
     
    122141  Int     getConfTop()                {return m_confTop;          }
    123142  Int     getConfBottom()             {return m_confBottom;       }
     143#if AUXILIARY_PICTURES
     144  ChromaFormat getInputChromaFormat()   {return m_InputChromaFormat;}
     145  ChromaFormat getChromaFormatIDC()     {return m_chromaFormatIDC;  }
     146  Int          getAuxId()               {return m_auxId;            }
     147#endif
    124148
    125149  Int     getIntQP()                  {return m_iQP;              }
     
    152176  Bool    getRCForceIntraQP()         {return m_RCForceIntraQP;        }
    153177#endif
    154 #if FINAL_RPL_CHANGE_N0082
    155   GOPEntry getGOPEntry(Int i )        {return m_GOPListLayer[i];  }
    156 #endif
    157178#if REPN_FORMAT_IN_VPS
    158179  Int     getRepFormatIdx()           { return m_repFormatIdx;  }
     
    164185  Int     getMaxTidIlRefPicsPlus1()   { return m_maxTidIlRefPicsPlus1; }
    165186#endif
     187#if LAYER_CTB
     188  UInt    getMaxCUWidth()             {return m_uiMaxCUWidth;      }
     189  UInt    getMaxCUHeight()            {return m_uiMaxCUHeight;     }
     190  UInt    getMaxCUDepth()             {return m_uiMaxCUDepth;      }
     191#endif
    166192}; // END CLASS DEFINITION TAppEncLayerCfg
     193
     194#endif //SVC_EXTENSION
    167195
    168196//! \}
  • trunk/source/App/TAppEncoder/TAppEncTop.cpp

    r442 r494  
    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
     
    9898    // Auto generation of the format index
    9999    if( m_acLayerCfg[layer].getRepFormatIdx() == -1 )
    100     {
    101       // Currently only picture width and height are considred. It has to be updated if different chroma format and bit-depth will are used.
     100    {     
    102101      Bool found = false;
    103102      for( UInt idx = 0; idx < layer; idx++ )
    104103      {
    105         if( m_acLayerCfg[layer].getSourceWidth() == m_acLayerCfg[idx].getSourceWidth() && m_acLayerCfg[layer].getSourceHeight() == m_acLayerCfg[idx].getSourceHeight() )
     104        if( m_acLayerCfg[layer].getSourceWidth() == m_acLayerCfg[idx].getSourceWidth() && m_acLayerCfg[layer].getSourceHeight() == m_acLayerCfg[idx].getSourceHeight()
     105#if AUXILIARY_PICTURES
     106          && m_acLayerCfg[layer].getChromaFormatIDC() == m_acLayerCfg[idx].getChromaFormatIDC()
     107#endif
     108#if O0194_DIFFERENT_BITDEPTH_EL_BL
     109          && m_acLayerCfg[layer].m_internalBitDepthY == m_acLayerCfg[idx].m_internalBitDepthY && m_acLayerCfg[layer].m_internalBitDepthC == m_acLayerCfg[idx].m_internalBitDepthC
     110#endif
     111          )
    106112        {
    107113          found = true;
     
    117123    }
    118124
    119     assert( m_acLayerCfg[layer].getRepFormatIdx() != -1 && "RepFormatIdx not assigned for a layer" );   
     125    assert( m_acLayerCfg[layer].getRepFormatIdx() != -1 && "RepFormatIdx not assigned for a layer" );
    120126    vps->setVpsRepFormatIdx( layer, m_acLayerCfg[layer].getRepFormatIdx() );
    121127    maxRepFormatIdx = std::max( m_acLayerCfg[layer].getRepFormatIdx(), maxRepFormatIdx );
     
    141147  for(UInt idx=0; idx < vps->getVpsNumRepFormats(); idx++)
    142148  {
    143     RepFormat *repFormat = vps->getVpsRepFormat( idx );   
     149    RepFormat *repFormat = vps->getVpsRepFormat( idx );
    144150    repFormat->setPicWidthVpsInLumaSamples  ( m_acLayerCfg[mapIdxToLayer[idx]].getSourceWidth()   );
    145151    repFormat->setPicHeightVpsInLumaSamples ( m_acLayerCfg[mapIdxToLayer[idx]].getSourceHeight()  );
     152#if AUXILIARY_PICTURES
     153    repFormat->setChromaFormatVpsIdc        ( m_acLayerCfg[mapIdxToLayer[idx]].getChromaFormatIDC() );
     154#else
    146155    repFormat->setChromaFormatVpsIdc        ( 1                                             );  // Need modification to change for each layer - corresponds to 420
     156#endif
    147157    repFormat->setSeparateColourPlaneVpsFlag( 0                                             );  // Need modification to change for each layer
     158#if O0194_DIFFERENT_BITDEPTH_EL_BL
     159    repFormat->setBitDepthVpsLuma           ( getInternalBitDepthY(mapIdxToLayer[idx])      );  // Need modification to change for each layer
     160    repFormat->setBitDepthVpsChroma         ( getInternalBitDepthC(mapIdxToLayer[idx])      );  // Need modification to change for each layer
     161#else
    148162    repFormat->setBitDepthVpsLuma           ( getInternalBitDepthY()                        );  // Need modification to change for each layer
    149163    repFormat->setBitDepthVpsChroma         ( getInternalBitDepthC()                        );  // Need modification to change for each layer
     164#endif
    150165  }
    151166  delete [] mapIdxToLayer;
     
    153168  for(UInt layer=0; layer<m_numLayers; layer++)
    154169  {
     170#if O0194_DIFFERENT_BITDEPTH_EL_BL
     171    //1
     172    g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
     173    g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
     174
     175    g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
     176    g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     177
     178    // Set this to be used in Upsampling filter in function "TComUpsampleFilter::upsampleBasePic"
     179    g_bitDepthYLayer[layer] = g_bitDepthY;
     180    g_bitDepthCLayer[layer] = g_bitDepthC;
     181#endif
    155182    //m_acTEncTop[layer].setVPS(&vps);
    156183    m_acTEncTop[layer].setFrameRate                    ( m_acLayerCfg[layer].getFrameRate() );
     
    187214#endif
    188215#endif
    189     // set layer ID 
    190     m_acTEncTop[layer].setLayerId ( layer ); 
     216    // set layer ID
     217    m_acTEncTop[layer].setLayerId ( layer );
    191218    m_acTEncTop[layer].setNumLayer ( m_numLayers );
    192219    m_acTEncTop[layer].setLayerEnc(m_apcTEncTop);
     
    196223    m_acTEncTop[layer].setDecodingRefreshType          ( m_iDecodingRefreshType );
    197224    m_acTEncTop[layer].setGOPSize                      ( m_iGOPSize );
    198 #if FINAL_RPL_CHANGE_N0082
    199     m_acTEncTop[layer].setGopList                      ( m_acLayerCfg[layer].m_GOPListLayer );
    200 #else
    201225    m_acTEncTop[layer].setGopList                      ( m_GOPList );
    202 #endif
     226
    203227    m_acTEncTop[layer].setExtraRPSs                    ( m_extraRPSs );
    204228    for(Int i = 0; i < MAX_TLAYER; i++)
     
    220244    if (layer<m_numLayers-1)
    221245    {
    222        m_acTEncTop[layer].setMaxTidIlRefPicsPlus1 ( m_acLayerCfg[layer].getMaxTidIlRefPicsPlus1()); 
    223     }
    224 #endif 
     246       m_acTEncTop[layer].setMaxTidIlRefPicsPlus1 ( m_acLayerCfg[layer].getMaxTidIlRefPicsPlus1());
     247    }
     248#endif
    225249#if VPS_EXTN_DIRECT_REF_LAYERS
    226250    if(layer)
     
    241265      else
    242266      {
    243         m_acTEncTop[layer].setNumSamplePredRefLayers   ( m_acLayerCfg[layer].getNumSamplePredRefLayers() );     
     267        m_acTEncTop[layer].setNumSamplePredRefLayers   ( m_acLayerCfg[layer].getNumSamplePredRefLayers() );
    244268        for(Int i = 0; i < m_acTEncTop[layer].getNumSamplePredRefLayers(); i++)
    245269        {
    246270          m_acTEncTop[layer].setSamplePredRefLayerId   ( i, m_acLayerCfg[layer].getSamplePredRefLayerId(i));
    247271          m_acTEncTop[layer].setSamplePredEnabledFlag  (m_acLayerCfg[layer].getSamplePredRefLayerId(i), true);
    248         }       
     272        }
    249273      }
    250274      if(m_acLayerCfg[layer].getNumMotionPredRefLayers() == -1)
     
    257281      else
    258282      {
    259         m_acTEncTop[layer].setNumMotionPredRefLayers   ( m_acLayerCfg[layer].getNumMotionPredRefLayers() );     
     283        m_acTEncTop[layer].setNumMotionPredRefLayers   ( m_acLayerCfg[layer].getNumMotionPredRefLayers() );
    260284        for(Int i = 0; i < m_acTEncTop[layer].getNumMotionPredRefLayers(); i++)
    261285        {
    262286          m_acTEncTop[layer].setMotionPredRefLayerId   ( i, m_acLayerCfg[layer].getMotionPredRefLayerId(i));
    263287          m_acTEncTop[layer].setMotionPredEnabledFlag  (m_acLayerCfg[layer].getMotionPredRefLayerId(i), true);
    264         }       
     288        }
    265289      }
    266290      Int numDirectRefLayers = 0;
     
    283307      else
    284308      {
    285         m_acTEncTop[layer].setNumDirectRefLayers       ( m_acLayerCfg[layer].getNumDirectRefLayers() );     
     309        m_acTEncTop[layer].setNumDirectRefLayers       ( m_acLayerCfg[layer].getNumDirectRefLayers() );
    286310        for(Int i = 0; i < m_acTEncTop[layer].getNumDirectRefLayers(); i++)
    287311        {
     
    304328      else
    305329      {
    306         m_acTEncTop[layer].setNumActiveRefLayers       ( m_acLayerCfg[layer].getNumActiveRefLayers() );     
     330        m_acTEncTop[layer].setNumActiveRefLayers       ( m_acLayerCfg[layer].getNumActiveRefLayers() );
    307331        for(Int i = 0; i < m_acTEncTop[layer].getNumActiveRefLayers(); i++)
    308332        {
     
    358382    m_acTEncTop[layer].setUseRDOQTS                    ( m_useRDOQTS   );
    359383    m_acTEncTop[layer].setRDpenalty                    ( m_rdPenalty );
     384#if LAYER_CTB
     385    m_acTEncTop[layer].setQuadtreeTULog2MaxSize        ( m_acLayerCfg[layer].m_uiQuadtreeTULog2MaxSize );
     386    m_acTEncTop[layer].setQuadtreeTULog2MinSize        ( m_acLayerCfg[layer].m_uiQuadtreeTULog2MinSize );
     387    m_acTEncTop[layer].setQuadtreeTUMaxDepthInter      ( m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthInter );
     388    m_acTEncTop[layer].setQuadtreeTUMaxDepthIntra      ( m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthIntra );
     389#else
    360390    m_acTEncTop[layer].setQuadtreeTULog2MaxSize        ( m_uiQuadtreeTULog2MaxSize );
    361391    m_acTEncTop[layer].setQuadtreeTULog2MinSize        ( m_uiQuadtreeTULog2MinSize );
    362392    m_acTEncTop[layer].setQuadtreeTUMaxDepthInter      ( m_uiQuadtreeTUMaxDepthInter );
    363393    m_acTEncTop[layer].setQuadtreeTUMaxDepthIntra      ( m_uiQuadtreeTUMaxDepthIntra );
     394#endif
    364395    m_acTEncTop[layer].setUseFastEnc                   ( m_bUseFastEnc  );
    365     m_acTEncTop[layer].setUseEarlyCU                   ( m_bUseEarlyCU  ); 
     396    m_acTEncTop[layer].setUseEarlyCU                   ( m_bUseEarlyCU  );
    366397    m_acTEncTop[layer].setUseFastDecisionForMerge      ( m_useFastDecisionForMerge  );
    367398    m_acTEncTop[layer].setUseCbfFastMode               ( m_bUseCbfFastMode  );
     
    383414    m_acTEncTop[layer].setUseWP                   ( m_useWeightedPred      );
    384415    m_acTEncTop[layer].setWPBiPred                ( m_useWeightedBiPred   );
     416#if O0194_WEIGHTED_PREDICTION_CGS
     417    if (layer!=0)
     418    {
     419      // Enable weighted prediction for enhancement layer
     420      m_acTEncTop[layer].setUseWP                 ( true   );
     421      m_acTEncTop[layer].setWPBiPred              ( true   );
     422    }
     423#endif
    385424    //====== Parallel Merge Estimation ========
    386425    m_acTEncTop[layer].setLog2ParallelMergeLevelMinus2 ( m_log2ParallelMergeLevel - 2 );
     
    393432    m_acTEncTop[layer].setSliceSegmentMode        ( m_sliceSegmentMode         );
    394433    m_acTEncTop[layer].setSliceSegmentArgument    ( m_sliceSegmentArgument     );
     434#if LAYER_CTB
     435    Int iNumPartInCU = 1<<(m_acLayerCfg[layer].m_uiMaxCUDepth<<1);
     436#else
    395437    Int iNumPartInCU = 1<<(m_uiMaxCUDepth<<1);
     438#endif
    396439    if(m_sliceSegmentMode==FIXED_NUMBER_OF_LCU)
    397440    {
     
    417460    m_acTEncTop[layer].setSaoLcuBoundary (m_saoLcuBoundary);
    418461    m_acTEncTop[layer].setSaoLcuBasedOptimization (m_saoLcuBasedOptimization);
    419     m_acTEncTop[layer].setPCMInputBitDepthFlag  ( m_bPCMInputBitDepthFlag); 
    420     m_acTEncTop[layer].setPCMFilterDisableFlag  ( m_bPCMFilterDisableFlag); 
     462    m_acTEncTop[layer].setPCMInputBitDepthFlag  ( m_bPCMInputBitDepthFlag);
     463    m_acTEncTop[layer].setPCMFilterDisableFlag  ( m_bPCMFilterDisableFlag);
    421464
    422465    m_acTEncTop[layer].setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled);
     
    483526    if(uiTilesCount == 1)
    484527    {
    485       m_bLFCrossTileBoundaryFlag = true; 
     528      m_bLFCrossTileBoundaryFlag = true;
    486529    }
    487530    m_acTEncTop[layer].setLFCrossTileBoundaryFlag( m_bLFCrossTileBoundaryFlag );
     
    519562    m_acTEncTop[layer].setUseRecalculateQPAccordingToLambda( m_recalculateQPAccordingToLambda );
    520563    m_acTEncTop[layer].setUseStrongIntraSmoothing( m_useStrongIntraSmoothing );
    521     m_acTEncTop[layer].setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled ); 
     564    m_acTEncTop[layer].setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled );
    522565    m_acTEncTop[layer].setVuiParametersPresentFlag( m_vuiParametersPresentFlag );
    523566    m_acTEncTop[layer].setAspectRatioIdc( m_aspectRatioIdc );
     
    550593    m_acTEncTop[layer].setLog2MaxMvLengthVertical( m_log2MaxMvLengthVertical );
    551594    m_acTEncTop[layer].setElRapSliceTypeB(layer == 0? 0 : m_elRapSliceBEnabled);
    552 #if SCALED_REF_LAYER_OFFSETS
    553595    if( layer > 0 )
    554596    {
     
    557599      {
    558600        m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow( 2*m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i],
    559                                                   2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i]); 
    560       }
    561     }
    562 #endif
     601                                                  2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i]);
     602      }
     603    }
    563604#if M0040_ADAPTIVE_RESOLUTION_CHANGE
    564605    m_acTEncTop[layer].setAdaptiveResolutionChange( m_adaptiveResolutionChange );
    565606#endif
     607#if AUXILIARY_PICTURES
     608    m_acTEncTop[layer].setChromaFormatIDC( m_acLayerCfg[layer].m_chromaFormatIDC );
     609#endif
    566610  }
    567611}
    568 #else
     612#else //SVC_EXTENSION
    569613Void TAppEncTop::xInitLibCfg()
    570614{
     
    671715  m_cTEncTop.setQuadtreeTUMaxDepthIntra      ( m_uiQuadtreeTUMaxDepthIntra );
    672716  m_cTEncTop.setUseFastEnc                   ( m_bUseFastEnc  );
    673   m_cTEncTop.setUseEarlyCU                   ( m_bUseEarlyCU  ); 
     717  m_cTEncTop.setUseEarlyCU                   ( m_bUseEarlyCU  );
    674718  m_cTEncTop.setUseFastDecisionForMerge      ( m_useFastDecisionForMerge  );
    675719  m_cTEncTop.setUseCbfFastMode            ( m_bUseCbfFastMode  );
     
    725769  m_cTEncTop.setSaoLcuBoundary (m_saoLcuBoundary);
    726770  m_cTEncTop.setSaoLcuBasedOptimization (m_saoLcuBasedOptimization);
    727   m_cTEncTop.setPCMInputBitDepthFlag  ( m_bPCMInputBitDepthFlag); 
    728   m_cTEncTop.setPCMFilterDisableFlag  ( m_bPCMFilterDisableFlag); 
     771  m_cTEncTop.setPCMInputBitDepthFlag  ( m_bPCMInputBitDepthFlag);
     772  m_cTEncTop.setPCMFilterDisableFlag  ( m_bPCMFilterDisableFlag);
    729773
    730774  m_cTEncTop.setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled);
     
    783827  if(uiTilesCount == 1)
    784828  {
    785     m_bLFCrossTileBoundaryFlag = true; 
     829    m_bLFCrossTileBoundaryFlag = true;
    786830  }
    787831  m_cTEncTop.setLFCrossTileBoundaryFlag( m_bLFCrossTileBoundaryFlag );
     
    809853  m_cTEncTop.setUseRecalculateQPAccordingToLambda( m_recalculateQPAccordingToLambda );
    810854  m_cTEncTop.setUseStrongIntraSmoothing( m_useStrongIntraSmoothing );
    811   m_cTEncTop.setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled ); 
     855  m_cTEncTop.setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled );
    812856  m_cTEncTop.setVuiParametersPresentFlag( m_vuiParametersPresentFlag );
    813857  m_cTEncTop.setAspectRatioIdc( m_aspectRatioIdc );
     
    840884  m_cTEncTop.setLog2MaxMvLengthVertical( m_log2MaxMvLengthVertical );
    841885}
    842 #endif
     886#endif //SVC_EXTENSION
    843887
    844888Void TAppEncTop::xCreateLib()
     
    851895  for(UInt layer=0; layer<m_numLayers; layer++)
    852896  {
     897#if O0194_DIFFERENT_BITDEPTH_EL_BL
     898    //2
     899    g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
     900    g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
     901
     902    g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
     903    g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     904#endif
     905#if LAYER_CTB
     906    g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
     907    g_uiMaxCUHeight = g_auiLayerMaxCUHeight[layer];
     908    g_uiMaxCUDepth  = g_auiLayerMaxCUDepth[layer];
     909    g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
     910#endif
     911#if O0194_DIFFERENT_BITDEPTH_EL_BL
     912    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
     913#else
    853914    m_acTVideoIOYuvInputFile[layer].open( (Char *)m_acLayerCfg[layer].getInputFile().c_str(),  false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC );  // read  mode
     915#endif
    854916    m_acTVideoIOYuvInputFile[layer].skipFrames(m_FrameSkip, m_acLayerCfg[layer].getSourceWidth() - m_acLayerCfg[layer].getPad()[0], m_acLayerCfg[layer].getSourceHeight() - m_acLayerCfg[layer].getPad()[1]);
    855917
    856918    if (!m_acLayerCfg[layer].getReconFile().empty())
    857919    {
     920#if O0194_DIFFERENT_BITDEPTH_EL_BL
     921      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
     922#else
    858923      m_acTVideoIOYuvReconFile[layer].open((Char *)m_acLayerCfg[layer].getReconFile().c_str(), true, m_outputBitDepthY, m_outputBitDepthC, m_internalBitDepthY, m_internalBitDepthC );  // write mode
     924#endif
    859925    }
    860926
    861927    m_acTEncTop[layer].create();
    862928  }
    863 #else
     929#else //SVC_EXTENSION
    864930  m_cTVideoIOYuvInputFile.open( m_pchInputFile,     false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC );  // read  mode
    865931  m_cTVideoIOYuvInputFile.skipFrames(m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1]);
     
    870936  // Neo Decoder
    871937  m_cTEncTop.create();
    872 #endif
     938#endif //SVC_EXTENSION
    873939}
    874940
     
    882948  for(UInt layer=0; layer<m_numLayers; layer++)
    883949  {
     950#if LAYER_CTB
     951    g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
     952    g_uiMaxCUHeight = g_auiLayerMaxCUHeight[layer];
     953    g_uiMaxCUDepth  = g_auiLayerMaxCUDepth[layer];
     954    g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
     955#endif
     956
    884957    m_acTVideoIOYuvInputFile[layer].close();
    885958    m_acTVideoIOYuvReconFile[layer].close();
     
    887960    m_acTEncTop[layer].destroy();
    888961  }
    889 #else
     962#else //SVC_EXTENSION
    890963  m_cTVideoIOYuvInputFile.close();
    891964  m_cTVideoIOYuvReconFile.close();
     
    893966  // Neo Decoder
    894967  m_cTEncTop.destroy();
    895 #endif
     968#endif //SVC_EXTENSION
    896969}
    897970
     
    901974  for(UInt layer=0; layer<m_numLayers; layer++)
    902975  {
     976#if O0194_DIFFERENT_BITDEPTH_EL_BL
     977    //3
     978    g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
     979    g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
     980
     981    g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
     982    g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     983#endif
     984#if LAYER_CTB
     985    g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
     986    g_uiMaxCUHeight = g_auiLayerMaxCUHeight[layer];
     987    g_uiMaxCUDepth  = g_auiLayerMaxCUDepth[layer];
     988    g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
     989
     990    memcpy( g_auiZscanToRaster, g_auiLayerZscanToRaster[layer], sizeof( g_auiZscanToRaster ) );
     991    memcpy( g_auiRasterToZscan, g_auiLayerRasterToZscan[layer], sizeof( g_auiRasterToZscan ) );
     992    memcpy( g_auiRasterToPelX,  g_auiLayerRasterToPelX[layer],  sizeof( g_auiRasterToPelX ) );
     993    memcpy( g_auiRasterToPelY,  g_auiLayerRasterToPelY[layer],  sizeof( g_auiRasterToPelY ) );
     994#endif
    903995    m_acTEncTop[layer].init(isFieldCoding);
    904996  }
     
    9151007    for(Int layerId = 0; layerId <= vps->getMaxLayerId(); layerId++)
    9161008    {
     1009#if O0194_DIFFERENT_BITDEPTH_EL_BL
     1010      //4
     1011      g_bitDepthY = m_acLayerCfg[layerId].m_internalBitDepthY;
     1012      g_bitDepthC = m_acLayerCfg[layerId].m_internalBitDepthC;
     1013
     1014      g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepthY : m_acLayerCfg[layerId].m_internalBitDepthY;
     1015      g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepthC : m_acLayerCfg[layerId].m_internalBitDepthC;
     1016#endif
    9171017      vps->setLayerIdIncludedFlag(true, setId, layerId);
    9181018    }
     
    9301030    vps->setScalabilityMask(i, false);
    9311031  }
    932   if(m_numLayers > 1) 
     1032  if(m_numLayers > 1)
    9331033  {
    9341034    Int scalabilityTypes = 0;
     
    9381038      scalabilityTypes += m_scalabilityMask[i];
    9391039    }
     1040#if AUXILIARY_PICTURES
     1041    assert( scalabilityTypes <= 2 );
     1042#else
    9401043    assert( scalabilityTypes == 1 );
     1044#endif
    9411045    vps->setNumScalabilityTypes(scalabilityTypes);
    9421046  }
     
    9591063    vps->setDimensionId(i, 0, i);
    9601064  }
     1065#if AUXILIARY_PICTURES
     1066  if (m_scalabilityMask[3])
     1067  {
     1068    UInt maxAuxId = 0;
     1069    UInt auxDimIdLen = 0;
     1070    for(i = 1; i < vps->getMaxLayers(); i++)
     1071    {
     1072      if (m_acLayerCfg[i].getAuxId() > maxAuxId)
     1073      {
     1074        maxAuxId = m_acLayerCfg[i].getAuxId();
     1075      }
     1076    }
     1077    while((1 << auxDimIdLen) < (maxAuxId + 1))
     1078    {
     1079      auxDimIdLen++;
     1080    }
     1081    vps->setDimensionIdLen(1, auxDimIdLen);
     1082    for(i = 1; i < vps->getMaxLayers(); i++)
     1083    {
     1084      vps->setDimensionId(i, 1, m_acLayerCfg[i].getAuxId());
     1085    }
     1086  }
     1087#endif
    9611088#endif
    9621089#if N0120_MAX_TID_REF_PRESENT_FLAG
    9631090#if N0120_MAX_TID_REF_CFG
    9641091  vps->setMaxTidRefPresentFlag(m_maxTidRefPresentFlag);
    965 #else 
     1092#else
    9661093  vps->setMaxTidRefPresentFlag(true);
     1094#endif
     1095  if (vps->getMaxTidRefPresentFlag())
     1096  {
     1097    for( i = 0; i < MAX_VPS_LAYER_ID_PLUS1 - 1; i++ )
     1098    {
     1099#if N0120_MAX_TID_REF_CFG
     1100#if O0225_MAX_TID_FOR_REF_LAYERS
     1101      for( Int j = i+1; j <= MAX_VPS_LAYER_ID_PLUS1 - 1; j++)
     1102      {
     1103        vps->setMaxTidIlRefPicsPlus1(i, j, m_acTEncTop[i].getMaxTidIlRefPicsPlus1());
     1104      }
     1105#else
     1106      vps->setMaxTidIlRefPicsPlus1(i, m_acTEncTop[i].getMaxTidIlRefPicsPlus1());
    9671107#endif
    968   if (vps->getMaxTidRefPresentFlag())
     1108#else
     1109#if O0225_MAX_TID_FOR_REF_LAYERS
     1110      for( Int j = i+1; j <= MAX_VPS_LAYER_ID_PLUS1 - 1; j++)
     1111      {
     1112        vps->setMaxTidIlRefPicsPlus1(i, j, vps->getMaxTLayers()+1);
     1113      }
     1114#else
     1115      vps->setMaxTidIlRefPicsPlus1(i, vps->getMaxTLayers()+1);
     1116#endif
     1117#endif
     1118    }
     1119  }
     1120  else
    9691121  {
    9701122    for( i = 0; i < MAX_VPS_LAYER_ID_PLUS1 - 1; i++ )
    9711123    {
    972 #if N0120_MAX_TID_REF_CFG
    973       vps->setMaxTidIlRefPicsPlus1(i, m_acTEncTop[i].getMaxTidIlRefPicsPlus1());
    974 #else
    975       vps->setMaxTidIlRefPicsPlus1(i, vps->getMaxTLayers()+1);
     1124#if O0225_MAX_TID_FOR_REF_LAYERS
     1125      for( Int j = i+1; j <= MAX_VPS_LAYER_ID_PLUS1 - 1; j++)
     1126      {
     1127        vps->setMaxTidIlRefPicsPlus1(i, j, 7);
     1128      }
     1129#else
     1130      vps->setMaxTidIlRefPicsPlus1(i, 7);
    9761131#endif
    9771132    }
    9781133  }
    979   else
    980   {
    981     for( i = 0; i < MAX_VPS_LAYER_ID_PLUS1 - 1; i++ )
    982     {
    983       vps->setMaxTidIlRefPicsPlus1(i, 7);
    984     }
    985   }
    986 #endif
     1134#endif
    9871135#if ILP_SSH_SIG
     1136#if ILP_SSH_SIG_FIX
     1137    vps->setIlpSshSignalingEnabledFlag(false);
     1138#else
    9881139    vps->setIlpSshSignalingEnabledFlag(true);
     1140#endif
    9891141#endif
    9901142#if VPS_EXTN_PROFILE_INFO
     
    9981150#endif
    9991151  // Target output layer
    1000 #if VPS_PROFILE_OUTPUT_LAYERS
    1001   vps->setNumOutputLayerSets(vps->getNumLayerSets());   
    1002   vps->setNumProfileTierLevel(vps->getNumLayerSets());   
     1152  vps->setNumOutputLayerSets(vps->getNumLayerSets());
     1153  vps->setNumProfileTierLevel(vps->getNumLayerSets());
    10031154  vps->setDefaultOneTargetOutputLayerFlag(true);
    10041155  for(i = 1; i < vps->getNumLayerSets(); i++)
    10051156  {
    10061157    vps->setProfileLevelTierIdx(i, i);
    1007     vps->setOutputLayerSetIdx(i, i);
    1008   }
    1009 #else
    1010   vps->setNumOutputLayerSets(1);
    1011   Int lsIdx = 1;
    1012   vps->setOutputLayerSetIdx(0, lsIdx); // Because only one layer set
    1013 #endif
     1158    vps->setOutputLayerSetIdx(i, i);
     1159  }
     1160
    10141161  for(Int lsIdx = 1; lsIdx < vps->getNumLayerSets(); lsIdx++)
    10151162  {
    1016     // Include the highest layer as output layer 
     1163    // Include the highest layer as output layer
    10171164    for(UInt layer=0; layer <= vps->getMaxLayerId() ; layer++)
    10181165    {
     
    10731220#endif
    10741221#endif
    1075 #if JCTVC_M0458_INTERLAYER_RPS_SIG       
    1076     vps->setMaxOneActiveRefLayerFlag(maxDirectRefLayers > 1 ? false : true);
    1077 #endif
    1078 #if N0147_IRAP_ALIGN_FLAG   
    1079     vps->setCrossLayerIrapAlignFlag(true);
     1222#if JCTVC_M0458_INTERLAYER_RPS_SIG
     1223    vps->setMaxOneActiveRefLayerFlag(maxDirectRefLayers > 1 ? false : true);
     1224#endif
     1225#if O0062_POC_LSB_NOT_PRESENT_FLAG
     1226    for(i = 1; i< vps->getMaxLayers(); i++)
     1227    {
     1228      if( vps->getNumDirectRefLayers( vps->getLayerIdInNuh(i) ) == 0  )
     1229      {
     1230        vps->setPocLsbNotPresentFlag(i, false);
     1231      }
     1232    }
     1233#endif
     1234#if N0147_IRAP_ALIGN_FLAG
     1235    vps->setCrossLayerIrapAlignFlag(true);
    10801236    for(UInt layerCtr = 1;layerCtr <= vps->getMaxLayers() - 1; layerCtr++)
    10811237    {
     
    10831239      {
    10841240        if (vps->getDirectDependencyFlag( layerCtr, refLayerCtr))
    1085         {         
     1241        {
    10861242          if(m_acTEncTop[layerCtr].getIntraPeriod() !=  m_acTEncTop[refLayerCtr].getIntraPeriod())
    10871243          {
     
    10971253      vps->setCrossLayerIrapAlignFlag(false);
    10981254    }
    1099 #endif 
     1255#endif
    11001256#if M0040_ADAPTIVE_RESOLUTION_CHANGE
    11011257  vps->setSingleLayerForNonIrapFlag(m_adaptiveResolutionChange > 0 ? true : false);
    11021258#endif
     1259#if !VPS_EXTN_OFFSET_CALC
    11031260#if VPS_EXTN_OFFSET
    11041261  // to be updated according to the current semantics
    11051262  vps->setExtensionOffset( 0xffff );
    11061263#endif
     1264#endif
     1265
     1266#if O0215_PHASE_ALIGNMENT
     1267  vps->setPhaseAlignFlag( m_phaseAlignFlag );
     1268#endif
     1269
    11071270#else //SVC_EXTENSION
    11081271  m_cTEncTop.init(isFieldCoding);
     
    11481311  for(UInt layer=0; layer<m_numLayers; layer++)
    11491312  {
     1313#if O0194_DIFFERENT_BITDEPTH_EL_BL
     1314    //5
     1315    g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
     1316    g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
     1317
     1318    g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
     1319    g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     1320#endif
    11501321    // allocate original YUV buffer
    11511322    pcPicYuvOrg[layer] = new TComPicYuv;
     
    11531324    {
    11541325#if SVC_UPSAMPLING
     1326#if LAYER_CTB
     1327#if AUXILIARY_PICTURES
     1328      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_acLayerCfg[layer].getChromaFormatIDC(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
     1329#else
     1330      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 );
     1331#endif
     1332#else
     1333#if AUXILIARY_PICTURES
     1334      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_acLayerCfg[layer].getChromaFormatIDC(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
     1335#else
    11551336      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
     1337#endif
     1338#endif
    11561339#else
    11571340      pcPicYuvOrg->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     
    11611344    {
    11621345#if SVC_UPSAMPLING
     1346#if LAYER_CTB
     1347#if AUXILIARY_PICTURES
     1348      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
     1349#else
     1350      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 );
     1351#endif
     1352#else
     1353#if AUXILIARY_PICTURES
     1354      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
     1355#else
    11631356      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
     1357#endif
     1358#endif
    11641359#else
    11651360      pcPicYuvOrg->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     
    11901385  while ( !bEos )
    11911386  {
    1192     // Read enough frames 
     1387    // Read enough frames
    11931388    Bool bFramesReadyToCode = false;
    11941389    while(!bFramesReadyToCode)
     
    11961391      for(UInt layer=0; layer<m_numLayers; layer++)
    11971392      {
     1393#if O0194_DIFFERENT_BITDEPTH_EL_BL
     1394        //6
     1395        g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
     1396        g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
     1397
     1398        g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
     1399        g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     1400#endif
     1401#if LAYER_CTB
     1402        g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
     1403        g_uiMaxCUHeight = g_auiLayerMaxCUHeight[layer];
     1404        g_uiMaxCUDepth  = g_auiLayerMaxCUDepth[layer];
     1405        g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
     1406#endif
     1407
    11981408        // get buffers
    11991409        xGetBuffer(pcPicYuvRec, layer);
     
    12011411        // read input YUV file
    12021412        m_acTVideoIOYuvInputFile[layer].read( pcPicYuvOrg[layer], m_acLayerCfg[layer].getPad() );
     1413
     1414#if AUXILIARY_PICTURES
     1415        if (m_acLayerCfg[layer].getChromaFormatIDC() == CHROMA_400)
     1416        {
     1417          pcPicYuvOrg[layer]->convertToMonochrome();
     1418        }
     1419#endif
    12031420
    12041421        if(layer == m_numLayers-1)
     
    12571474#endif
    12581475
    1259     // loop through frames in one GOP 
     1476    // loop through frames in one GOP
    12601477    for ( UInt iPicIdInGOP=0; iPicIdInGOP < (bFirstFrame? 1:m_iGOPSize); iPicIdInGOP++ )
    12611478    {
     
    12631480      for(UInt layer=0; layer<m_numLayers; layer++)
    12641481      {
     1482#if O0194_DIFFERENT_BITDEPTH_EL_BL
     1483        //7
     1484        g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
     1485        g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
     1486
     1487        g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
     1488        g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     1489#endif
     1490#if LAYER_CTB
     1491        g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
     1492        g_uiMaxCUHeight = g_auiLayerMaxCUHeight[layer];
     1493        g_uiMaxCUDepth  = g_auiLayerMaxCUDepth[layer];
     1494        g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
     1495
     1496        memcpy( g_auiZscanToRaster, g_auiLayerZscanToRaster[layer], sizeof( g_auiZscanToRaster ) );
     1497        memcpy( g_auiRasterToZscan, g_auiLayerRasterToZscan[layer], sizeof( g_auiRasterToZscan ) );
     1498        memcpy( g_auiRasterToPelX,  g_auiLayerRasterToPelX[layer],  sizeof( g_auiRasterToPelX ) );
     1499        memcpy( g_auiRasterToPelY,  g_auiLayerRasterToPelY[layer],  sizeof( g_auiRasterToPelY ) );
     1500#endif
    12651501        // call encoding function for one frame
    12661502        if ( m_isField )
     
    12881524    for(UInt layer=0; layer<m_numLayers; layer++)
    12891525    {
     1526#if O0194_DIFFERENT_BITDEPTH_EL_BL
     1527      //8
     1528      g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
     1529      g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
     1530
     1531      g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
     1532      g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     1533#endif
    12901534      // write bistream to file if necessary
    12911535      iNumEncoded = m_acTEncTop[layer].getNumPicRcvd();
     
    15281772
    15291773#if SVC_UPSAMPLING
     1774#if LAYER_CTB
     1775#if AUXILIARY_PICTURES
     1776    rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
     1777#else
     1778    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 );
     1779#endif
     1780#else
     1781#if AUXILIARY_PICTURES
     1782    rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
     1783#else
    15301784    rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
     1785#endif
     1786#endif
    15311787#else
    15321788    rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     
    15511807      delete pcPicYuvRec; pcPicYuvRec = NULL;
    15521808    }
    1553   } 
     1809  }
    15541810}
    15551811
     
    16021858#endif
    16031859      {
    1604         m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getConfLeft(), m_acLayerCfg[layer].getConfRight(), 
     1860        m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getConfLeft(), m_acLayerCfg[layer].getConfRight(),
    16051861          m_acLayerCfg[layer].getConfTop(), m_acLayerCfg[layer].getConfBottom() );
    16061862      }
     
    16221878    for ( i = 0; i < iNumEncoded/2; i++ )
    16231879#endif
    1624     {     
     1880    {
    16251881      const AccessUnit& auTop = *(iterBitstream++);
    16261882      const vector<UInt>& statsTop = writeAnnexB(bitstreamFile, auTop);
  • trunk/source/App/utils/convert_NtoMbit_YCbCr.cpp

    r313 r494  
    8282
    8383  TComPicYuv frame;
     84#if AUXILIARY_PICTURES
     85frame.create( width, height, CHROMA_420, 1, 1, 0 );
     86#else
    8487  frame.create( width, height, 1, 1, 0 );
     88#endif
    8589
    8690  int pad[2] = {0, 0};
Note: See TracChangeset for help on using the changeset viewer.