Changeset 1235 in SHVCSoftware for branches/SHM-dev/source/Lib/TLibEncoder


Ignore:
Timestamp:
13 Jul 2015, 20:38:11 (10 years ago)
Author:
seregin
Message:

port rev 4219 and rev 4246

Location:
branches/SHM-dev/source/Lib/TLibEncoder
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/Lib/TLibEncoder/SEIwrite.cpp

    r1185 r1235  
    5555
    5656#if O0164_MULTI_LAYER_HRD
    57 Void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting* nestingSeiPtr, const SEIBspNesting* bspNestingSeiPtr)
     57Void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, const TComVPS *vps, const TComSPS *sps, const SEIScalableNesting* nestingSeiPtr, const SEIBspNesting* bspNestingSeiPtr)
    5858#else
    59 Void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps)
     59Void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, const TComSPS *sps)
    6060#endif
    6161{
     
    215215 */
    216216#if O0164_MULTI_LAYER_HRD
    217 Void SEIWriter::writeSEImessage(TComBitIf& bs, const SEI& sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei)
     217Void SEIWriter::writeSEImessage(TComBitIf& bs, const SEI& sei, const TComVPS *vps, const TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei)
    218218#else
    219 Void SEIWriter::writeSEImessage(TComBitIf& bs, const SEI& sei, TComSPS *sps)
     219Void SEIWriter::writeSEImessage(TComBitIf& bs, const SEI& sei, const TComSPS *sps)
    220220#endif
    221221{
     
    341341
    342342#if SVC_EXTENSION
    343 Void SEIWriter::xWriteSEIDecodingUnitInfo(const SEIDecodingUnitInfo& sei, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps)
    344 {
    345   TComHRD *hrd;
     343Void SEIWriter::xWriteSEIDecodingUnitInfo(const SEIDecodingUnitInfo& sei, const TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, const TComVPS *vps)
     344{
     345  const TComHRD *hrd;
    346346  if( bspNestingSei )   // If DU info SEI contained inside a BSP nesting SEI message
    347347  {
     
    352352    Int maxValues = vps->getNumBspSchedulesMinus1(seiOlsIdx, psIdx, maxTemporalId) + 1;
    353353    std::vector<Int> hrdIdx(maxValues, 0);
    354     std::vector<TComHRD *> hrdVec;
     354    std::vector<const TComHRD*> hrdVec;
    355355    std::vector<Int> syntaxElemLen(maxValues, 0);
    356356    for(Int i = 0; i < maxValues; i++)
     
    376376  else
    377377  {
    378     TComVUI *vui = sps->getVuiParameters();
     378    const TComVUI *vui = sps->getVuiParameters();
    379379    hrd = vui->getHrdParameters();
    380380  }
     
    392392}
    393393#else
    394 Void SEIWriter::xWriteSEIDecodingUnitInfo(const SEIDecodingUnitInfo& sei, TComSPS *sps)
    395 {
    396   TComVUI *vui = sps->getVuiParameters();
     394Void SEIWriter::xWriteSEIDecodingUnitInfo(const SEIDecodingUnitInfo& sei, const TComSPS *sps)
     395{
     396  const TComVUI *vui = sps->getVuiParameters();
    397397  WRITE_UVLC(sei.m_decodingUnitIdx, "decoding_unit_idx");
    398398  if(vui->getHrdParameters()->getSubPicCpbParamsInPicTimingSEIFlag())
     
    409409
    410410#if SVC_EXTENSION
    411 Void SEIWriter::xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps)
     411Void SEIWriter::xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei, const TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, const TComVPS *vps)
    412412#else
    413 Void SEIWriter::xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei, TComSPS *sps)
     413Void SEIWriter::xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei, const TComSPS *sps)
    414414#endif
    415415{
    416416  Int i, nalOrVcl;
    417417#if SVC_EXTENSION
    418   TComHRD *hrd;
     418  const TComHRD *hrd;
    419419  if( bspNestingSei )   // If BP SEI contained inside a BSP nesting SEI message
    420420  {
     
    425425    Int maxValues = vps->getNumBspSchedulesMinus1(seiOlsIdx, psIdx, maxTemporalId) + 1;
    426426    std::vector<Int> hrdIdx(maxValues, 0);
    427     std::vector<TComHRD *> hrdVec;
     427    std::vector<const TComHRD*> hrdVec;
    428428    std::vector<Int> syntaxElemLen(maxValues, 0);
    429429    for(i = 0; i < maxValues; i++)
     
    448448  else
    449449  {
    450     TComVUI *vui = sps->getVuiParameters();
     450    const TComVUI *vui = sps->getVuiParameters();
    451451    hrd = vui->getHrdParameters();
    452452  }
    453453  // To be done: When contained in an BSP HRD SEI message, the hrd structure is to be chosen differently.
    454454#else
    455   TComVUI *vui = sps->getVuiParameters();
    456   TComHRD *hrd = vui->getHrdParameters();
     455  const TComVUI *vui = sps->getVuiParameters();
     456  const TComHRD *hrd = vui->getHrdParameters();
    457457#endif
    458458
     
    495495
    496496#if SVC_EXTENSION
    497 Void SEIWriter::xWriteSEIPictureTiming(const SEIPictureTiming& sei,  TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps)
     497Void SEIWriter::xWriteSEIPictureTiming(const SEIPictureTiming& sei, const TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, const TComVPS *vps)
    498498#else
    499 Void SEIWriter::xWriteSEIPictureTiming(const SEIPictureTiming& sei, TComSPS *sps)
     499Void SEIWriter::xWriteSEIPictureTiming(const SEIPictureTiming& sei, const TComSPS *sps)
    500500#endif
    501501{
    502502  Int i;
    503503#if SVC_EXTENSION
    504   TComHRD *hrd;   
    505   TComVUI *vui = sps->getVuiParameters();
     504  const TComHRD *hrd;   
     505  const TComVUI *vui = sps->getVuiParameters();
    506506  if( bspNestingSei )   // If BP SEI contained inside a BSP nesting SEI message
    507507  {
     
    512512    Int maxValues = vps->getNumBspSchedulesMinus1(seiOlsIdx, psIdx, maxTemporalId) + 1;
    513513    std::vector<Int> hrdIdx(maxValues, 0);
    514     std::vector<TComHRD *> hrdVec;
     514    std::vector<const TComHRD*> hrdVec;
    515515    std::vector<Int> syntaxElemLen(maxValues, 0);
    516516    for(i = 0; i < maxValues; i++)
     
    543543  // To be done: When contained in an BSP HRD SEI message, the hrd structure is to be chosen differently.
    544544#else
    545   TComVUI *vui = sps->getVuiParameters();
    546   TComHRD *hrd = vui->getHrdParameters();
     545  const TComVUI *vui = sps->getVuiParameters();
     546  const TComHRD *hrd = vui->getHrdParameters();
    547547#endif
    548548
     
    752752
    753753#if O0164_MULTI_LAYER_HRD
    754 Void SEIWriter::xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComVPS *vps, TComSPS *sps)
     754Void SEIWriter::xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, const TComVPS *vps, const TComSPS *sps)
    755755#else
    756 Void SEIWriter::xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComSPS *sps)
     756Void SEIWriter::xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, const TComSPS *sps)
    757757#endif
    758758{
     
    11301130
    11311131#if O0164_MULTI_LAYER_HRD
    1132 Void SEIWriter::xWriteSEIBspNesting(TComBitIf& bs, const SEIBspNesting &sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei)
     1132Void SEIWriter::xWriteSEIBspNesting(TComBitIf& bs, const SEIBspNesting &sei, const TComVPS *vps, const TComSPS *sps, const SEIScalableNesting &nestingSei)
    11331133{
    11341134  WRITE_UVLC( sei.m_bspIdx, "bsp_idx" );
     
    11491149}
    11501150
    1151 Void SEIWriter::xWriteSEIBspInitialArrivalTime(const SEIBspInitialArrivalTime &sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei, const SEIBspNesting &bspNestingSei)
     1151Void SEIWriter::xWriteSEIBspInitialArrivalTime(const SEIBspInitialArrivalTime &sei, const TComVPS *vps, const TComSPS *sps, const SEIScalableNesting &nestingSei, const SEIBspNesting &bspNestingSei)
    11521152{
    11531153  assert(vps->getVpsVuiPresentFlag());
    11541154
    1155 #if SVC_EXTENSION
    11561155  Int psIdx = bspNestingSei.m_seiPartitioningSchemeIdx;
    11571156  Int seiOlsIdx = bspNestingSei.m_seiOlsIdx;
     
    11591158  Int maxValues = vps->getNumBspSchedulesMinus1(seiOlsIdx, psIdx, maxTemporalId) + 1;
    11601159  std::vector<Int> hrdIdx(maxValues, 0);
    1161   std::vector<TComHRD *> hrdVec;
     1160  std::vector<const TComHRD*> hrdVec;
    11621161  std::vector<Int> syntaxElemLen(maxValues, 0);
    11631162  for(Int i = 0; i < maxValues; i++)
     
    11911190    }
    11921191  }
    1193 #else
    1194   UInt schedCombCnt = vps->getNumBspSchedCombinations(nestingSei.m_nestingOpIdx[0]);
    1195   UInt len;
    1196   UInt hrdIdx;
    1197 
    1198   if (schedCombCnt > 0)
    1199   {
    1200     hrdIdx = vps->getBspCombHrdIdx(nestingSei.m_nestingOpIdx[0], 0, bspNestingSei.m_bspIdx);
    1201   }
    1202   else
    1203   {
    1204     hrdIdx = 0;
    1205   }
    1206 
    1207   TComHRD *hrd = vps->getBspHrd(hrdIdx);
    1208 
    1209   if (hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag())
    1210   {
    1211     len = hrd->getInitialCpbRemovalDelayLengthMinus1() + 1;
    1212   }
    1213   else
    1214   {
    1215     len = 23 + 1;
    1216   }
    1217 
    1218   if (hrd->getNalHrdParametersPresentFlag())
    1219   {
    1220     for(UInt i = 0; i < schedCombCnt; i++)
    1221     {
    1222       WRITE_CODE( sei.m_nalInitialArrivalDelay[i], len, "nal_initial_arrival_delay" );
    1223     }
    1224   }
    1225 #if BSP_INIT_ARRIVAL_SEI
    1226   if( hrd->getVclHrdParametersPresentFlag() )
    1227 #else
    1228   else
    1229 #endif
    1230   {
    1231     for(UInt i = 0; i < schedCombCnt; i++)
    1232     {
    1233       WRITE_CODE( sei.m_vclInitialArrivalDelay[i], len, "vcl_initial_arrival_delay" );
    1234     }
    1235   }
    1236 #endif
    12371192}
    12381193
  • branches/SHM-dev/source/Lib/TLibEncoder/SEIwrite.h

    r1185 r1235  
    5151
    5252#if O0164_MULTI_LAYER_HRD
    53   Void writeSEImessage(TComBitIf& bs, const SEI& sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting* nestingSei=NULL, const SEIBspNesting* bspNestingSei=NULL);
     53  Void writeSEImessage(TComBitIf& bs, const SEI& sei, const TComVPS *vps, const TComSPS *sps, const SEIScalableNesting* nestingSei=NULL, const SEIBspNesting* bspNestingSei=NULL);
    5454#else
    55   Void writeSEImessage(TComBitIf& bs, const SEI& sei, TComSPS *sps);
     55  Void writeSEImessage(TComBitIf& bs, const SEI& sei, const TComSPS *sps);
    5656#endif
    5757
    5858protected:
    5959#if O0164_MULTI_LAYER_HRD
    60   Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei);
     60  Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, const TComVPS *vps, const TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei);
    6161#else
    62   Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps);
     62  Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, const TComSPS *sps);
    6363#endif
    6464  Void xWriteSEIuserDataUnregistered(const SEIuserDataUnregistered &sei);
     
    6666  Void xWriteSEIDecodedPictureHash(const SEIDecodedPictureHash& sei);
    6767#if SVC_EXTENSION
    68   Void xWriteSEIDecodingUnitInfo(const SEIDecodingUnitInfo& sei, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps);
    69   Void xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps);
    70   Void xWriteSEIPictureTiming(const SEIPictureTiming& sei, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps);
     68  Void xWriteSEIDecodingUnitInfo(const SEIDecodingUnitInfo& sei, const TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, const TComVPS *vps);
     69  Void xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei, const TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, const TComVPS *vps);
     70  Void xWriteSEIPictureTiming(const SEIPictureTiming& sei, const TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, const TComVPS *vps);
    7171#else
    72   Void xWriteSEIDecodingUnitInfo(const SEIDecodingUnitInfo& sei, TComSPS *sps);
    73   Void xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei, TComSPS *sps);
    74   Void xWriteSEIPictureTiming(const SEIPictureTiming& sei, TComSPS *sps);
     72  Void xWriteSEIDecodingUnitInfo(const SEIDecodingUnitInfo& sei, const TComSPS *sps);
     73  Void xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei, const TComSPS *sps);
     74  Void xWriteSEIPictureTiming(const SEIPictureTiming& sei, const TComSPS *sps);
    7575#endif
    7676  TComSPS *m_pSPS;
     
    8585  Void xWriteSEISOPDescription(const SEISOPDescription& sei);
    8686#if O0164_MULTI_LAYER_HRD
    87   Void xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComVPS *vps, TComSPS *sps);
     87  Void xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, const TComVPS *vps, const TComSPS *sps);
    8888#else
    89   Void xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComSPS *sps);
     89  Void xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, const TComSPS *sps);
    9090#endif
    9191  Void xWriteSEITempMotionConstrainedTileSets(TComBitIf& bs, const SEITempMotionConstrainedTileSets& sei);
     
    110110#endif
    111111#if Q0189_TMVP_CONSTRAINTS
    112 Void xWriteSEITMVPConstraints (const SEITMVPConstrains &sei);
     112Void xWriteSEITMVPConstraints(const SEITMVPConstrains &sei);
    113113#endif
    114114#if Q0247_FRAME_FIELD_INFO
    115   Void xWriteSEIFrameFieldInfo  (const SEIFrameFieldInfo &sei);
     115  Void xWriteSEIFrameFieldInfo(const SEIFrameFieldInfo &sei);
    116116#endif
    117117#if O0164_MULTI_LAYER_HRD
    118   Void xWriteSEIBspNesting(TComBitIf& bs, const SEIBspNesting &sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei);
    119   Void xWriteSEIBspInitialArrivalTime(const SEIBspInitialArrivalTime &sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei, const SEIBspNesting &bspNestingSei);
     118  Void xWriteSEIBspNesting(TComBitIf& bs, const SEIBspNesting &sei, const TComVPS *vps, const TComSPS *sps, const SEIScalableNesting &nestingSei);
     119  Void xWriteSEIBspInitialArrivalTime(const SEIBspInitialArrivalTime &sei, const TComVPS *vps, const TComSPS *sps, const SEIScalableNesting &nestingSei, const SEIBspNesting &bspNestingSei);
    120120  Void xCodeHrdParameters( TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1 );
    121121#endif
  • branches/SHM-dev/source/Lib/TLibEncoder/TEnc3DAsymLUT.cpp

    r1214 r1235  
    509509  TComSlice * pSlice = pCurPic->getSlice(pCurPic->getCurrSliceIdx());
    510510  UInt refLayerId = pSlice->getVPS()->getRefLayerId(pSlice->getLayerId(), refLayerIdc);
    511   const Window &scalEL = pSlice->getPPS()->getScaledRefLayerWindowForLayer(refLayerId);
     511  Window scalEL = pSlice->getPPS()->getScaledRefLayerWindowForLayer(refLayerId);
    512512  TComPicYuv *pcRecPicBL = pSlice->getBaseColPic(refLayerIdc)->getPicYuvRec();
    513513  // borders of down-sampled picture
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp

    r1231 r1235  
    9696}
    9797
    98 Void TEncCavlc::codeShortTermRefPicSet( TComSPS* pcSPS, TComReferencePictureSet* rps, Bool calledFromSliceHeader, Int idx)
     98Void TEncCavlc::codeShortTermRefPicSet( const TComReferencePictureSet* rps, Bool calledFromSliceHeader, Int idx)
    9999{
    100100#if PRINT_RPS_INFO
     
    153153
    154154
    155 Void TEncCavlc::codePPS( TComPPS* pcPPS
    156155#if CGS_3D_ASYMLUT
    157   , TEnc3DAsymLUT * pc3DAsymLUT
    158 #endif
    159   )
     156Void TEncCavlc::codePPS( const TComPPS* pcPPS, TEnc3DAsymLUT * pc3DAsymLUT )
     157#else
     158Void TEncCavlc::codePPS( const TComPPS* pcPPS )
     159#endif
    160160{
    161161#if ENC_DEC_TRACE
    162162  xTracePPSHeader (pcPPS);
    163163#endif
    164 
    165   const UInt numberValidComponents = getNumberValidComponents(pcPPS->getSPS()->getChromaFormatIdc());
    166164
    167165  WRITE_UVLC( pcPPS->getPPSId(),                             "pps_pic_parameter_set_id" );
     
    184182  }
    185183
    186   WRITE_SVLC( COMPONENT_Cb<numberValidComponents ?  (pcPPS->getQpOffset(COMPONENT_Cb)) : 0, "pps_cb_qp_offset" );
    187   WRITE_SVLC( COMPONENT_Cr<numberValidComponents ?  (pcPPS->getQpOffset(COMPONENT_Cr)) : 0, "pps_cr_qp_offset" );
    188 
    189   assert(numberValidComponents <= 3); // if more than 3 components (eg 4:4:4:4), then additional offsets will have to go in extension area...
     184  WRITE_SVLC( pcPPS->getQpOffset(COMPONENT_Cb), "pps_cb_qp_offset" );
     185  WRITE_SVLC( pcPPS->getQpOffset(COMPONENT_Cr), "pps_cr_qp_offset" );
    190186
    191187  WRITE_FLAG( pcPPS->getSliceChromaQpFlag() ? 1 : 0,          "pps_slice_chroma_qp_offsets_present_flag" );
     
    232228  if( pcPPS->getScalingListPresentFlag() )
    233229  {
    234     codeScalingList( m_pcSlice->getScalingList() );
     230    codeScalingList( pcPPS->getScalingList() );
    235231  }
    236232  WRITE_FLAG( pcPPS->getListsModificationPresentFlag(), "lists_modification_present_flag");
     
    320316              WRITE_CODE( pcPPS->getRefLocationOffsetLayerId(k), 6, "ref_loc_offset_layer_id" );
    321317              WRITE_FLAG( pcPPS->getScaledRefLayerOffsetPresentFlag(k) ? 1 : 0, "scaled_ref_layer_offset_prsent_flag" );
    322               if (pcPPS->getScaledRefLayerOffsetPresentFlag(k))
     318              if( pcPPS->getScaledRefLayerOffsetPresentFlag(k) )
    323319              {
    324320                Window scaledWindow = pcPPS->getScaledRefLayerWindow(k);
     
    328324                WRITE_SVLC( scaledWindow.getWindowBottomOffset() >> 1, "scaled_ref_layer_bottom_offset" );
    329325              }
     326
    330327              WRITE_FLAG( pcPPS->getRefRegionOffsetPresentFlag(k) ? 1 : 0, "ref_region_offset_prsent_flag" );
    331               if (pcPPS->getRefRegionOffsetPresentFlag(k))
     328
     329              if( pcPPS->getRefRegionOffsetPresentFlag(k) )
    332330              {
    333                 Window refWindow = pcPPS->getRefLayerWindow(k);
     331                const Window refWindow = pcPPS->getRefLayerWindow(k);
    334332                WRITE_SVLC( refWindow.getWindowLeftOffset()   >> 1, "ref_region_left_offset" );
    335333                WRITE_SVLC( refWindow.getWindowTopOffset()    >> 1, "ref_region_top_offset" );
     
    337335                WRITE_SVLC( refWindow.getWindowBottomOffset() >> 1, "ref_region_bottom_offset" );
    338336              }
     337
    339338              WRITE_FLAG( pcPPS->getResamplePhaseSetPresentFlag(k) ? 1 : 0, "resample_phase_set_present_flag" );
    340               if (pcPPS->getResamplePhaseSetPresentFlag(k))
     339
     340              if( pcPPS->getResamplePhaseSetPresentFlag(k) )
    341341              {
    342342                WRITE_UVLC( pcPPS->getPhaseHorLuma(k), "phase_hor_luma" );
     
    367367}
    368368
    369 Void TEncCavlc::codeVUI( TComVUI *pcVUI, TComSPS* pcSPS )
     369Void TEncCavlc::codeVUI( const TComVUI *pcVUI, const TComSPS* pcSPS )
    370370{
    371371#if ENC_DEC_TRACE
     
    421421    WRITE_UVLC(defaultDisplayWindow.getWindowBottomOffset()/ TComSPS::getWinUnitY(pcSPS->getChromaFormatIdc()), "def_disp_win_bottom_offset");
    422422  }
    423   TimingInfo *timingInfo = pcVUI->getTimingInfo();
     423  const TimingInfo *timingInfo = pcVUI->getTimingInfo();
    424424  WRITE_FLAG(timingInfo->getTimingInfoPresentFlag(),          "vui_timing_info_present_flag");
    425425  if(timingInfo->getTimingInfoPresentFlag())
     
    453453}
    454454
    455 Void TEncCavlc::codeHrdParameters( TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1 )
     455Void TEncCavlc::codeHrdParameters( const TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1 )
    456456{
    457457  if( commonInfPresentFlag )
     
    484484  {
    485485    WRITE_FLAG( hrd->getFixedPicRateFlag( i ) ? 1 : 0,          "fixed_pic_rate_general_flag");
     486    Bool fixedPixRateWithinCvsFlag = true;
    486487    if( !hrd->getFixedPicRateFlag( i ) )
    487488    {
     489      fixedPixRateWithinCvsFlag = hrd->getFixedPicRateWithinCvsFlag( i );
    488490      WRITE_FLAG( hrd->getFixedPicRateWithinCvsFlag( i ) ? 1 : 0, "fixed_pic_rate_within_cvs_flag");
    489491    }
    490     else
    491     {
    492       hrd->setFixedPicRateWithinCvsFlag( i, true );
    493     }
    494     if( hrd->getFixedPicRateWithinCvsFlag( i ) )
     492    if( fixedPixRateWithinCvsFlag )
    495493    {
    496494      WRITE_UVLC( hrd->getPicDurationInTcMinus1( i ),           "elemental_duration_in_tc_minus1");
     
    526524}
    527525
    528 Void TEncCavlc::codeSPS( TComSPS* pcSPS )
     526Void TEncCavlc::codeSPS( const TComSPS* pcSPS )
    529527{
    530528#if SVC_EXTENSION
     
    662660    if(pcSPS->getScalingListPresentFlag())
    663661    {
    664       codeScalingList( m_pcSlice->getScalingList() );
     662      codeScalingList( pcSPS->getScalingList() );
    665663    }
    666664#if SVC_EXTENSION
     
    683681  assert( pcSPS->getMaxTLayers() > 0 );
    684682
    685   TComRPSList* rpsList = pcSPS->getRPSList();
    686   TComReferencePictureSet*      rps;
     683  const TComRPSList* rpsList = pcSPS->getRPSList();
    687684
    688685  WRITE_UVLC(rpsList->getNumberOfReferencePictureSets(), "num_short_term_ref_pic_sets" );
    689686  for(Int i=0; i < rpsList->getNumberOfReferencePictureSets(); i++)
    690687  {
    691     rps = rpsList->getReferencePictureSet(i);
    692     codeShortTermRefPicSet(pcSPS,rps,false, i);
     688    const TComReferencePictureSet*rps = rpsList->getReferencePictureSet(i);
     689    codeShortTermRefPicSet( rps,false, i);
    693690  }
    694691  WRITE_FLAG( pcSPS->getLongTermRefsPresent() ? 1 : 0,         "long_term_ref_pics_present_flag" );
     
    778775}
    779776
    780 Void TEncCavlc::codeVPS( TComVPS* pcVPS )
     777Void TEncCavlc::codeVPS( const TComVPS* pcVPS )
    781778{
    782779  WRITE_CODE( pcVPS->getVPSId(),                    4,        "vps_video_parameter_set_id" );
     
    824821  assert( pcVPS->getMaxNuhReservedZeroLayerId() < MAX_VPS_NUH_RESERVED_ZERO_LAYER_ID_PLUS1 );
    825822  WRITE_CODE( pcVPS->getMaxNuhReservedZeroLayerId(), 6,     "vps_max_nuh_reserved_zero_layer_id" );
    826   pcVPS->setMaxOpSets(1);
    827823  WRITE_UVLC( pcVPS->getMaxOpSets() - 1,                    "vps_max_op_sets_minus1" );
    828824  for( UInt opsIdx = 1; opsIdx <= ( pcVPS->getMaxOpSets() - 1 ); opsIdx ++ )
     
    832828    {
    833829      // Only applicable for version 1
    834       pcVPS->setLayerIdIncludedFlag( true, opsIdx, i );
     830      // pcVPS->setLayerIdIncludedFlag( true, opsIdx, i );
    835831#endif
    836832      WRITE_FLAG( pcVPS->getLayerIdIncludedFlag( opsIdx, i ) ? 1 : 0, "layer_id_included_flag[opsIdx][i]" );
     
    838834  }
    839835
    840   TimingInfo *timingInfo = pcVPS->getTimingInfo();
     836  const TimingInfo *timingInfo = pcVPS->getTimingInfo();
    841837  WRITE_FLAG(timingInfo->getTimingInfoPresentFlag(),          "vps_timing_info_present_flag");
    842838  if(timingInfo->getTimingInfoPresentFlag())
     
    849845      WRITE_UVLC(timingInfo->getNumTicksPocDiffOneMinus1(),   "vps_num_ticks_poc_diff_one_minus1");
    850846    }
    851     pcVPS->setNumHrdParameters( 0 );
    852847    WRITE_UVLC( pcVPS->getNumHrdParameters(),                 "vps_num_hrd_parameters" );
    853848
    854849    if( pcVPS->getNumHrdParameters() > 0 )
    855850    {
    856       pcVPS->createHrdParamBuffer();
    857     }
    858     for( UInt i = 0; i < pcVPS->getNumHrdParameters(); i ++ )
    859     {
    860       // Only applicable for version 1
    861       pcVPS->setHrdOpSetIdx( 0, i );
    862       WRITE_UVLC( pcVPS->getHrdOpSetIdx( i ),                "hrd_op_set_idx" );
    863       if( i > 0 )
    864       {
    865         WRITE_FLAG( pcVPS->getCprmsPresentFlag( i ) ? 1 : 0, "cprms_present_flag[i]" );
    866       }
    867       codeHrdParameters(pcVPS->getHrdParameters(i), pcVPS->getCprmsPresentFlag( i ), pcVPS->getMaxTLayers() - 1);
     851      for( UInt i = 0; i < pcVPS->getNumHrdParameters(); i ++ )
     852      {
     853        // Only applicable for version 1
     854        WRITE_UVLC( pcVPS->getHrdOpSetIdx( i ),                "hrd_op_set_idx" );
     855        if( i > 0 )
     856        {
     857          WRITE_FLAG( pcVPS->getCprmsPresentFlag( i ) ? 1 : 0, "cprms_present_flag[i]" );
     858        }
     859        codeHrdParameters(pcVPS->getHrdParameters(i), pcVPS->getCprmsPresentFlag( i ), pcVPS->getMaxTLayers() - 1);
     860      }
    868861    }
    869862  }
     
    1004997    {
    1005998#endif
    1006       TComReferencePictureSet* rps = pcSlice->getRPS();
     999      const TComReferencePictureSet* rps = pcSlice->getRPS();
    10071000
    10081001      // check for bitstream restriction stating that:
     
    10231016      {
    10241017        WRITE_FLAG( 0, "short_term_ref_pic_set_sps_flag");
    1025         codeShortTermRefPicSet(pcSlice->getSPS(), rps, true, pcSlice->getSPS()->getRPSList()->getNumberOfReferencePictureSets());
     1018        codeShortTermRefPicSet( rps, true, pcSlice->getSPS()->getRPSList()->getNumberOfReferencePictureSets());
    10261019      }
    10271020      else
     
    12471240      {
    12481241        SliceType sliceType   = pcSlice->getSliceType();
    1249         Int  encCABACTableIdx = pcSlice->getPPS()->getEncCABACTableIdx();
     1242        SliceType  encCABACTableIdx = pcSlice->getEncCABACTableIdx();
    12501243        Bool encCabacInitFlag = (sliceType!=encCABACTableIdx && encCABACTableIdx!=I_SLICE) ? true : false;
    12511244        pcSlice->setCabacInitFlag( encCabacInitFlag );
     
    13181311}
    13191312
    1320 Void TEncCavlc::codePTL( TComPTL* pcPTL, Bool profilePresentFlag, Int maxNumSubLayersMinus1)
     1313Void TEncCavlc::codePTL( const TComPTL* pcPTL, Bool profilePresentFlag, Int maxNumSubLayersMinus1)
    13211314{
    13221315  if(profilePresentFlag)
     
    13641357  }
    13651358}
    1366 Void TEncCavlc::codeProfileTier( ProfileTierLevel* ptl )
     1359Void TEncCavlc::codeProfileTier( const ProfileTierLevel* ptl )
    13671360{
    13681361  WRITE_CODE( ptl->getProfileSpace(), 2 ,     "XXX_profile_space[]");
     
    17341727 *  \param scalingList quantization matrix information
    17351728 */
    1736 Void TEncCavlc::codeScalingList( TComScalingList* scalingList )
    1737 {
    1738   UInt listId,sizeId;
    1739   Bool scalingListPredModeFlag;
    1740 
     1729Void TEncCavlc::codeScalingList( const TComScalingList &scalingList )
     1730{
    17411731  //for each size
    1742   for(sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++)
    1743   {
    1744     Int predListStep = (sizeId == SCALING_LIST_32x32? (SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES) : 1); // if 32x32, skip over chroma entries.
    1745 
    1746     for(listId = 0; listId < SCALING_LIST_NUM; listId+=predListStep)
    1747     {
    1748       scalingListPredModeFlag = scalingList->checkPredMode( sizeId, listId );
     1732  for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++)
     1733  {
     1734    const Int predListStep = (sizeId == SCALING_LIST_32x32? (SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES) : 1); // if 32x32, skip over chroma entries.
     1735
     1736    for(UInt listId = 0; listId < SCALING_LIST_NUM; listId+=predListStep)
     1737    {
     1738      Bool scalingListPredModeFlag = scalingList.getScalingListPredModeFlag(sizeId, listId);
    17491739      WRITE_FLAG( scalingListPredModeFlag, "scaling_list_pred_mode_flag" );
    17501740      if(!scalingListPredModeFlag)// Copy Mode
     
    17531743        {
    17541744          // adjust the code, to cope with the missing chroma entries
    1755           WRITE_UVLC( ((Int)listId - (Int)scalingList->getRefMatrixId (sizeId,listId)) / (SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES), "scaling_list_pred_matrix_id_delta");
     1745          WRITE_UVLC( ((Int)listId - (Int)scalingList.getRefMatrixId (sizeId,listId)) / (SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES), "scaling_list_pred_matrix_id_delta");
    17561746        }
    17571747        else
    17581748        {
    1759           WRITE_UVLC( (Int)listId - (Int)scalingList->getRefMatrixId (sizeId,listId), "scaling_list_pred_matrix_id_delta");
     1749          WRITE_UVLC( (Int)listId - (Int)scalingList.getRefMatrixId (sizeId,listId), "scaling_list_pred_matrix_id_delta");
    17601750        }
    17611751      }
    17621752      else// DPCM Mode
    17631753      {
    1764         xCodeScalingList(scalingList, sizeId, listId);
     1754        xCodeScalingList(&scalingList, sizeId, listId);
    17651755      }
    17661756    }
     
    17731763 * \param listIdc list index
    17741764 */
    1775 Void TEncCavlc::xCodeScalingList(TComScalingList* scalingList, UInt sizeId, UInt listId)
     1765Void TEncCavlc::xCodeScalingList(const TComScalingList* scalingList, UInt sizeId, UInt listId)
    17761766{
    17771767  Int coefNum = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId]);
     
    17791769  Int nextCoef = SCALING_LIST_START_VALUE;
    17801770  Int data;
    1781   Int *src = scalingList->getScalingListAddress(sizeId, listId);
     1771  const Int *src = scalingList->getScalingListAddress(sizeId, listId);
    17821772    if( sizeId > SCALING_LIST_8x8 )
    17831773    {
     
    18141804  }
    18151805  return false;
    1816 }
    1817 Bool TComScalingList::checkPredMode(UInt sizeId, UInt listId)
    1818 {
    1819   Int predListStep = (sizeId == SCALING_LIST_32x32? (SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES) : 1); // if 32x32, skip over chroma entries.
    1820 
    1821   for(Int predListIdx = (Int)listId ; predListIdx >= 0; predListIdx-=predListStep)
    1822   {
    1823     if( !memcmp(getScalingListAddress(sizeId,listId),((listId == predListIdx) ?
    1824       getScalingListDefaultAddress(sizeId, predListIdx): getScalingListAddress(sizeId, predListIdx)),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])) // check value of matrix
    1825      && ((sizeId < SCALING_LIST_16x16) || (getScalingListDC(sizeId,listId) == getScalingListDC(sizeId,predListIdx)))) // check DC value
    1826     {
    1827       setRefMatrixId(sizeId, listId, predListIdx);
    1828       return false;
    1829     }
    1830   }
    1831   return true;
    18321806}
    18331807
     
    19471921}
    19481922
    1949 Void TEncCavlc::codeVPSExtension (TComVPS *vps)
     1923Void TEncCavlc::codeVPSExtension( const TComVPS *vps )
    19501924{
    19511925  Int NumOutputLayersInOutputLayerSet[MAX_VPS_LAYER_SETS_PLUS1];
     
    20712045  for( Int idx = vps->getBaseLayerInternalFlag() ? 2 : 1; idx < vps->getNumProfileTierLevel(); idx++ )
    20722046  {
    2073     vps->setProfilePresentFlag(idx, true);
    2074 
    20752047    WRITE_FLAG( vps->getProfilePresentFlag(idx),       "vps_profile_present_flag[i]" );
    20762048
     
    22162188    WRITE_CODE(1, 8, "vps_non_vui_extension_data_byte");
    22172189  }
    2218 
    2219   vps->setVpsVuiPresentFlag(true);
     2190   
    22202191  WRITE_FLAG( vps->getVpsVuiPresentFlag() ? 1 : 0,                     "vps_vui_present_flag" );
    22212192
     
    22312202}
    22322203
    2233 Void  TEncCavlc::codeRepFormat( RepFormat *repFormat )
     2204Void  TEncCavlc::codeRepFormat( const RepFormat *repFormat )
    22342205{
    22352206  WRITE_CODE( repFormat->getPicWidthVpsInLumaSamples (), 16, "pic_width_vps_in_luma_samples" );   
     
    22642235}
    22652236
    2266 Void TEncCavlc::codeVpsDpbSizeTable(TComVPS *vps)
     2237Void TEncCavlc::codeVpsDpbSizeTable( const TComVPS *vps )
    22672238{
    22682239  for( Int i = 1; i < vps->getNumOutputLayerSets(); i++ )
     
    22972268}
    22982269
    2299 Void TEncCavlc::codeVPSVUI (TComVPS *vps)
     2270Void TEncCavlc::codeVPSVUI( const TComVPS *vps )
    23002271{
    23012272  Int i,j;
    23022273  WRITE_FLAG(vps->getCrossLayerPictureTypeAlignFlag(), "cross_layer_pic_type_aligned_flag");
    2303   if (!vps->getCrossLayerPictureTypeAlignFlag())
     2274
     2275  if( !vps->getCrossLayerPictureTypeAlignFlag() )
    23042276  {
    23052277    WRITE_FLAG(vps->getCrossLayerIrapAlignFlag(), "cross_layer_irap_aligned_flag");
     
    23082280  {
    23092281    // When not present, the value of cross_layer_irap_aligned_flag is inferred to be equal to vps_vui_present_flag,
    2310     // i.e. it is true in this function
    2311     vps->setCrossLayerIrapAlignFlag( true );
     2282    assert( vps->getCrossLayerIrapAlignFlag() == true );
    23122283  }
    23132284
     
    24652436}
    24662437
    2467 Void TEncCavlc::codeSPSExtension( TComSPS* pcSPS )
     2438Void TEncCavlc::codeSPSExtension( const TComSPS* pcSPS )
    24682439{
    24692440  // more syntax elements to be written here
     
    24732444}
    24742445
    2475 Void TEncCavlc::codeVpsVuiBspHrdParams(TComVPS * const vps)
     2446Void TEncCavlc::codeVpsVuiBspHrdParams( const TComVPS* vps )
    24762447{
    24772448  WRITE_UVLC( vps->getVpsNumAddHrdParams(), "vps_num_add_hrd_params" );
     
    25282499                }
    25292500
    2530                 WRITE_CODE(vps->getBspHrdIdx(h, i, t, j, k), numBits, "bsp_comb_hrd_idx[h][i][t][j][k]");
     2501                WRITE_CODE(vps->getBspHrdIdx(h, i, t, j, k), numBits, "bsp_hrd_idx[h][i][t][j][k]");
    25312502              }
    25322503
    2533               WRITE_UVLC( vps->getBspSchedIdx(h, i, t, j, k), "bsp_comb_sched_idx[h][i][t][j][k]");
     2504              WRITE_UVLC( vps->getBspSchedIdx(h, i, t, j, k), "bsp_sched_idx[h][i][t][j][k]");
    25342505            }
    25352506          }
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.h

    r1224 r1235  
    7575  TComSlice*    m_pcSlice;
    7676
    77   Void codeShortTermRefPicSet              ( TComSPS* pcSPS, TComReferencePictureSet* pcRPS, Bool calledFromSliceHeader, Int idx );
     77  Void codeShortTermRefPicSet              ( const TComReferencePictureSet* pcRPS, Bool calledFromSliceHeader, Int idx );
    7878  Bool findMatchingLTRP ( TComSlice* pcSlice, UInt *ltrpsIndex, Int ltrpPOC, Bool usedFlag );
    7979
     
    8181
    8282  Void  resetEntropy          ();
    83   Void  determineCabacInitIdx  () {};
     83  SliceType determineCabacInitIdx  () { assert(0); return I_SLICE; };
    8484
    8585  Void  setBitstream          ( TComBitIf* p )  { m_pcBitIf = p;  }
     
    8787  Void  resetBits             ()                { m_pcBitIf->resetBits(); }
    8888  UInt  getNumberOfWrittenBits()                { return  m_pcBitIf->getNumberOfWrittenBits();  }
    89   Void  codeVPS                 ( TComVPS* pcVPS );
    90   Void  codeVUI                 ( TComVUI *pcVUI, TComSPS* pcSPS );
    91   Void  codeSPS                 ( TComSPS* pcSPS );
    92   Void  codePPS                 ( TComPPS* pcPPS
     89  Void  codeVPS                 ( const TComVPS* pcVPS );
     90  Void  codeVUI                 ( const TComVUI *pcVUI, const TComSPS* pcSPS );
     91  Void  codeSPS                 ( const TComSPS* pcSPS );
    9392#if CGS_3D_ASYMLUT
    94     , TEnc3DAsymLUT * pc3DAsymLUT
     93  Void  codePPS                 ( const TComPPS* pcPPS, TEnc3DAsymLUT * pc3DAsymLUT );
     94#else
     95  Void  codePPS                 ( const TComPPS* pcPPS );
    9596#endif
    96     );
    9797  Void  codeSliceHeader         ( TComSlice* pcSlice );
    98   Void  codePTL                 ( TComPTL* pcPTL, Bool profilePresentFlag, Int maxNumSubLayersMinus1);
    99   Void  codeProfileTier         ( ProfileTierLevel* ptl );
    100   Void  codeHrdParameters       ( TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1 );
     98  Void  codePTL                 ( const TComPTL* pcPTL, Bool profilePresentFlag, Int maxNumSubLayersMinus1);
     99  Void  codeProfileTier         ( const ProfileTierLevel* ptl );
     100  Void  codeHrdParameters       ( const TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1 );
    101101  Void  codeTilesWPPEntryPoint( TComSlice* pSlice );
    102102  Void  codeTerminatingBit      ( UInt uilsLast );
     
    146146  Void xCodePredWeightTable          ( TComSlice* pcSlice );
    147147
    148   Void codeScalingList  ( TComScalingList* scalingList );
    149   Void xCodeScalingList ( TComScalingList* scalingList, UInt sizeId, UInt listId);
     148  Void codeScalingList  ( const TComScalingList &scalingList );
     149  Void xCodeScalingList ( const TComScalingList* scalingList, UInt sizeId, UInt listId);
    150150  Void codeDFFlag       ( UInt uiCode, const Char *pSymbolName );
    151151  Void codeDFSvlc       ( Int   iCode, const Char *pSymbolName );
     
    154154
    155155#if SVC_EXTENSION
    156   Void  codeSliceHeaderExtn  ( TComSlice* slice, Int shBitsWrittenTillNow );
    157   Void codeSPSExtension      ( TComSPS* pcSPS );
    158   Void codeVPSExtension      ( TComVPS* pcVPS );
    159   Void codeVPSVUI            ( TComVPS *vps  );
    160   Void codeRepFormat         ( RepFormat *repFormat );
    161   Void codeVpsDpbSizeTable   ( TComVPS *vps );
    162   Void codeVpsVuiBspHrdParams( TComVPS * const );
     156  Void codeSliceHeaderExtn   ( TComSlice* slice, Int shBitsWrittenTillNow );
     157  Void codeSPSExtension      ( const TComSPS* sps );
     158  Void codeVPSExtension      ( const TComVPS* vps );
     159  Void codeVPSVUI            ( const TComVPS* vps );
     160  Void codeRepFormat         ( const RepFormat *repFormat );
     161  Void codeVpsDpbSizeTable   ( const TComVPS *vps );
     162  Void codeVpsVuiBspHrdParams( const TComVPS * const );
    163163
    164164#if CGS_3D_ASYMLUT
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h

    r1230 r1235  
    702702  Void  setWaveFrontSynchro(Int iWaveFrontSynchro)                   { m_iWaveFrontSynchro = iWaveFrontSynchro; }
    703703  Int   getWaveFrontsynchro()                                        { return m_iWaveFrontSynchro; }
    704   Void  setWaveFrontSubstreams(Int iWaveFrontSubstreams)             { m_iWaveFrontSubstreams = iWaveFrontSubstreams; }
    705   Int   getWaveFrontSubstreams()                                     { return m_iWaveFrontSubstreams; }
    706704  Void  setDecodedPictureHashSEIEnabled(Int b)                       { m_decodedPictureHashSEIEnabled = b; }
    707705  Int   getDecodedPictureHashSEIEnabled()                            { return m_decodedPictureHashSEIEnabled; }
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncCu.cpp

    r1203 r1235  
    407407  const UInt numberValidComponents = rpcBestCU->getPic()->getNumberValidComponents();
    408408
    409   if( (g_uiMaxCUWidth>>uiDepth) >= rpcTempCU->getSlice()->getPPS()->getMinCuDQPSize() )
     409  if( (g_uiMaxCUWidth>>uiDepth) >= (g_uiMaxCUWidth >> ( rpcTempCU->getSlice()->getPPS()->getMaxCuDQPDepth())) )
    410410  {
    411411    Int idQP = m_pcEncCfg->getMaxDeltaQP();
     
    601601
    602602          //! Try AMP (SIZE_2NxnU, SIZE_2NxnD, SIZE_nLx2N, SIZE_nRx2N)
    603           if( pcPic->getSlice(0)->getSPS()->getAMPAcc(uiDepth) )
     603          if(pcSlice->getSPS()->getUseAMP() && uiDepth < g_uiMaxCUDepth-g_uiAddCUDepth )
    604604          {
    605605#if AMP_ENC_SPEEDUP
     
    805805  }
    806806
    807   if( (g_uiMaxCUWidth>>uiDepth) == rpcTempCU->getSlice()->getPPS()->getMinCuDQPSize() )
     807  if( (g_uiMaxCUWidth>>uiDepth) == (g_uiMaxCUWidth >> ( rpcTempCU->getSlice()->getPPS()->getMaxCuDQPDepth())) )
    808808  {
    809809    Int idQP = m_pcEncCfg->getMaxDeltaQP();
     
    816816#endif   
    817817  }
    818   else if( (g_uiMaxCUWidth>>uiDepth) > rpcTempCU->getSlice()->getPPS()->getMinCuDQPSize() )
     818  else if( (g_uiMaxCUWidth>>uiDepth) > (g_uiMaxCUWidth >> ( rpcTempCU->getSlice()->getPPS()->getMaxCuDQPDepth())) )
    819819  {
    820820    iMinQP = iBaseQP;
     
    909909      rpcTempCU->getTotalCost()  = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
    910910
    911       if( (g_uiMaxCUWidth>>uiDepth) == rpcTempCU->getSlice()->getPPS()->getMinCuDQPSize() && rpcTempCU->getSlice()->getPPS()->getUseDQP())
     911      if( (g_uiMaxCUWidth>>uiDepth) == (g_uiMaxCUWidth >> ( rpcTempCU->getSlice()->getPPS()->getMaxCuDQPDepth())) && rpcTempCU->getSlice()->getPPS()->getUseDQP())
    912912      {
    913913        Bool hasResidual = false;
     
    10791079  {
    10801080    UInt uiQNumParts = ( pcPic->getNumPartitionsInCtu() >> (uiDepth<<1) )>>2;
    1081     if( (g_uiMaxCUWidth>>uiDepth) == pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP())
     1081    if( (g_uiMaxCUWidth>>uiDepth) == (g_uiMaxCUWidth >> ( pcCU->getSlice()->getPPS()->getMaxCuDQPDepth())) && pcCU->getSlice()->getPPS()->getUseDQP())
    10821082    {
    10831083      setdQPFlag(true);
    10841084    }
    10851085
    1086     if( (g_uiMaxCUWidth>>uiDepth) == pcCU->getSlice()->getPPS()->getMinCuChromaQpAdjSize() && pcCU->getSlice()->getUseChromaQpAdj())
     1086    if( (g_uiMaxCUWidth>>uiDepth) == (g_uiMaxCUWidth >> ( pcCU->getSlice()->getPPS()->getMaxCuChromaQpAdjDepth())) && pcCU->getSlice()->getUseChromaQpAdj())
    10871087    {
    10881088      setCodeChromaQpAdjFlag(true);
     
    11061106  }
    11071107
    1108   if( (g_uiMaxCUWidth>>uiDepth) >= pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP())
     1108  if( (g_uiMaxCUWidth>>uiDepth) >= (g_uiMaxCUWidth >> ( pcCU->getSlice()->getPPS()->getMaxCuDQPDepth())) && pcCU->getSlice()->getPPS()->getUseDQP())
    11091109  {
    11101110    setdQPFlag(true);
    11111111  }
    11121112
    1113   if( (g_uiMaxCUWidth>>uiDepth) >= pcCU->getSlice()->getPPS()->getMinCuChromaQpAdjSize() && pcCU->getSlice()->getUseChromaQpAdj())
     1113  if( (g_uiMaxCUWidth>>uiDepth) >= (g_uiMaxCUWidth >> ( pcCU->getSlice()->getPPS()->getMaxCuChromaQpAdjDepth())) && pcCU->getSlice()->getUseChromaQpAdj())
    11141114  {
    11151115    setCodeChromaQpAdjFlag(true);
     
    16591659  UInt uiDepth = pcCU->getDepth( 0 );
    16601660
    1661   if( pcCU->getSlice()->getPPS()->getUseDQP() && (g_uiMaxCUWidth>>uiDepth) >= pcCU->getSlice()->getPPS()->getMinCuDQPSize() )
     1661  if( pcCU->getSlice()->getPPS()->getUseDQP() && (g_uiMaxCUWidth>>uiDepth) >= (g_uiMaxCUWidth >> ( pcCU->getSlice()->getPPS()->getMaxCuDQPDepth())) )
    16621662  {
    16631663    if ( pcCU->getQtRootCbf( 0) )
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncEntropy.cpp

    r1212 r1235  
    7979
    8080#if CGS_3D_ASYMLUT
    81 Void TEncEntropy::encodePPS( TComPPS* pcPPS, TEnc3DAsymLUT * pc3DAsymLUT  )
     81Void TEncEntropy::encodePPS( const TComPPS* pcPPS, TEnc3DAsymLUT * pc3DAsymLUT  )
    8282{
    8383  m_pcEntropyCoderIf->codePPS( pcPPS, pc3DAsymLUT );
     
    8585}
    8686#else
    87 Void TEncEntropy::encodePPS( TComPPS* pcPPS )
     87Void TEncEntropy::encodePPS( const TComPPS* pcPPS )
    8888{
    8989  m_pcEntropyCoderIf->codePPS( pcPPS );
     
    9292#endif
    9393
    94 Void TEncEntropy::encodeSPS( TComSPS* pcSPS )
     94Void TEncEntropy::encodeSPS( const TComSPS* pcSPS )
    9595{
    9696  m_pcEntropyCoderIf->codeSPS( pcSPS );
     
    107107}
    108108
    109 Void TEncEntropy::encodeVPS( TComVPS* pcVPS )
     109Void TEncEntropy::encodeVPS( const TComVPS* pcVPS )
    110110{
    111111  m_pcEntropyCoderIf->codeVPS( pcVPS );
     
    739739}
    740740
    741 /** encode quantization matrix
    742  * \param scalingList quantization matrix information
    743  */
    744 Void TEncEntropy::encodeScalingList( TComScalingList* scalingList )
    745 {
    746   m_pcEntropyCoderIf->codeScalingList( scalingList );
    747 }
    748 
    749741#if SVC_EXTENSION
    750742Void TEncEntropy::encodeSliceHeaderExtn( TComSlice* pSlice, Int shBitsWrittenTillNow )
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncEntropy.h

    r1212 r1235  
    6464public:
    6565  virtual Void  resetEntropy          ()                = 0;
    66   virtual Void determineCabacInitIdx ()                = 0;
     66  virtual SliceType determineCabacInitIdx ()                = 0;
    6767  virtual Void  setBitstream          ( TComBitIf* p )  = 0;
    6868  virtual Void  setSlice              ( TComSlice* p )  = 0;
     
    7070  virtual UInt  getNumberOfWrittenBits()                = 0;
    7171
    72   virtual Void  codeVPS                 ( TComVPS* pcVPS )                                      = 0;
    73   virtual Void  codeSPS                 ( TComSPS* pcSPS )                                      = 0;
    74   virtual Void  codePPS                 ( TComPPS* pcPPS
     72  virtual Void  codeVPS                 ( const TComVPS* pcVPS )                                      = 0;
     73  virtual Void  codeSPS                 ( const TComSPS* pcSPS )                                      = 0;
    7574#if CGS_3D_ASYMLUT
    76     , TEnc3DAsymLUT * pc3DAsymLUT
    77 #endif
    78     )                                      = 0;
     75  virtual Void  codePPS                 ( const TComPPS* pcPPS, TEnc3DAsymLUT * pc3DAsymLUT )         = 0;
     76#else
     77  virtual Void  codePPS                 ( const TComPPS* pcPPS )                                      = 0;
     78#endif
    7979  virtual Void  codeSliceHeader         ( TComSlice* pcSlice )                                  = 0;
    8080
     
    8282  virtual Void  codeTerminatingBit      ( UInt uilsLast )                                       = 0;
    8383  virtual Void  codeSliceFinish         ()                                                      = 0;
    84   virtual Void codeMVPIdx ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList ) = 0;
    85   virtual Void codeScalingList   ( TComScalingList* scalingList )      = 0;
     84  virtual Void  codeMVPIdx ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList ) = 0;
    8685
    8786public:
     
    140139  UInt    getNumberOfWrittenBits    ()                        { return m_pcEntropyCoderIf->getNumberOfWrittenBits(); }
    141140  Void    resetEntropy              ()                        { m_pcEntropyCoderIf->resetEntropy();  }
    142   Void    determineCabacInitIdx     ()                        { m_pcEntropyCoderIf->determineCabacInitIdx(); }
     141  SliceType determineCabacInitIdx   ()                        { return m_pcEntropyCoderIf->determineCabacInitIdx(); }
    143142
    144143  Void    encodeSliceHeader         ( TComSlice* pcSlice );
     
    149148
    150149public:
    151   Void encodeVPS               ( TComVPS* pcVPS);
     150  Void encodeVPS               ( const TComVPS* pcVPS);
    152151  // SPS
    153   Void encodeSPS               ( TComSPS* pcSPS );
    154   Void encodePPS               ( TComPPS* pcPPS
     152  Void encodeSPS               ( const TComSPS* pcSPS );
    155153#if CGS_3D_ASYMLUT
    156     , TEnc3DAsymLUT * pc3DAsymLUT
    157 #endif
    158     );
     154  Void encodePPS               ( const TComPPS* pcPPS, TEnc3DAsymLUT * pc3DAsymLUT );
     155#else
     156  Void encodePPS               ( const TComPPS* pcPPS );
     157#endif
    159158  Void encodeSplitFlag         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool bRD = false );
    160159  Void encodeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
     
    184183  Void encodeChromaQpAdjustment ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
    185184
    186   Void encodeScalingList       ( TComScalingList* scalingList );
    187 
    188185  Void encodeCrossComponentPrediction( TComTU &rTu, ComponentID compID );
    189186
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r1232 r1235  
    216216}
    217217
    218 SEIActiveParameterSets* TEncGOP::xCreateSEIActiveParameterSets (TComSPS *sps)
     218SEIActiveParameterSets* TEncGOP::xCreateSEIActiveParameterSets (const TComSPS *sps)
    219219{
    220220  SEIActiveParameterSets *seiActiveParameterSets = new SEIActiveParameterSets();
     
    374374}
    375375
    376 SEITempMotionConstrainedTileSets* TEncGOP::xCreateSEITempMotionConstrainedTileSets ()
     376SEITempMotionConstrainedTileSets* TEncGOP::xCreateSEITempMotionConstrainedTileSets (const TComPPS *pps)
    377377{
    378   TComPPS *pps = m_pcEncTop->getPPS();
    379378  SEITempMotionConstrainedTileSets *sei = new SEITempMotionConstrainedTileSets();
    380379  if(pps->getTilesEnabledFlag())
     
    490489}
    491490
    492 Void TEncGOP::xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps)
     491Void TEncGOP::xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, const TComSPS *sps, const TComPPS *pps)
    493492{
    494493  OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI);
     
    579578  if(m_pcCfg->getTMCTSSEIEnabled())
    580579  {
    581     SEITempMotionConstrainedTileSets *sei_tmcts = xCreateSEITempMotionConstrainedTileSets ();
     580    SEITempMotionConstrainedTileSets *sei_tmcts = xCreateSEITempMotionConstrainedTileSets (pps);
    582581
    583582    nalu = NALUnit(NAL_UNIT_PREFIX_SEI);
     
    11231122    //  Slice data initialization
    11241123    pcPic->clearSliceBuffer();
    1125     assert(pcPic->getNumAllocatedSlice() == 1);
     1124    pcPic->allocateNewSlice();
    11261125    m_pcSliceEncoder->setSliceIdx(0);
    11271126    pcPic->setCurrSliceIdx(0);
    11281127#if SVC_EXTENSION
    11291128    pcPic->setLayerId( m_layerId );
    1130     m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, m_pcEncTop->getSPS(), m_pcEncTop->getPPS(), m_pcEncTop->getVPS(), isField );
    1131 #else
    1132     m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, m_pcEncTop->getSPS(), m_pcEncTop->getPPS(), isField );
     1129    m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, isField );
     1130#else
     1131    m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, &(pcPic->getPicSym()->getSPS()), &(pcPic->getPicSym()->getPPS()), isField );
    11331132#endif
    11341133
     
    12521251    //set default slice level flag to the same as SPS level flag
    12531252    pcSlice->setLFCrossSliceBoundaryFlag(  pcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag()  );
    1254     pcSlice->setScalingList ( m_pcEncTop->getScalingList()  );
    1255     if(m_pcEncTop->getUseScalingListId() == SCALING_LIST_OFF)
    1256     {
    1257       m_pcEncTop->getTrQuant()->setFlatScalingList(pcSlice->getSPS()->getChromaFormatIdc());
    1258       m_pcEncTop->getTrQuant()->setUseScalingList(false);
    1259       m_pcEncTop->getSPS()->setScalingListPresentFlag(false);
    1260       m_pcEncTop->getPPS()->setScalingListPresentFlag(false);
    1261     }
    1262     else if(m_pcEncTop->getUseScalingListId() == SCALING_LIST_DEFAULT)
    1263     {
    1264 #if SVC_EXTENSION
    1265       // inferring of the scaling list can be moved to the config file
    1266       UInt refLayerId = 0;
    1267       if( m_layerId > 0 && !m_pcEncTop->getVPS()->getNonHEVCBaseLayerFlag() && m_pcEncTop->getVPS()->getRecursiveRefLayerFlag( m_layerId, refLayerId ) )
    1268       {
    1269         m_pcEncTop->getSPS()->setInferScalingListFlag( true );
    1270         m_pcEncTop->getSPS()->setScalingListRefLayerId( refLayerId );
    1271         m_pcEncTop->getSPS()->setScalingListPresentFlag( false );
    1272         m_pcEncTop->getPPS()->setInferScalingListFlag( false );
    1273         m_pcEncTop->getPPS()->setScalingListPresentFlag( false );
    1274 
    1275         // infer the scaling list from the reference layer
    1276         pcSlice->setScalingList ( m_ppcTEncTop[pcSlice->getVPS()->getLayerIdxInVps(refLayerId)]->getScalingList() );
    1277       }
    1278       else
    1279       {
    1280 #endif
    1281       pcSlice->setDefaultScalingList ();
    1282       m_pcEncTop->getSPS()->setScalingListPresentFlag(false);
    1283       m_pcEncTop->getPPS()->setScalingListPresentFlag(false);
    1284 
    1285 #if SVC_EXTENSION
    1286       }
    1287 #endif
    1288 
    1289       m_pcEncTop->getTrQuant()->setScalingList(pcSlice->getScalingList(), pcSlice->getSPS()->getChromaFormatIdc());
    1290       m_pcEncTop->getTrQuant()->setUseScalingList(true);
    1291     }
    1292     else if(m_pcEncTop->getUseScalingListId() == SCALING_LIST_FILE_READ)
    1293     {
    1294 #if SVC_EXTENSION
    1295       // inferring of the scaling list can be moved to the config file
    1296       UInt refLayerId = 0;
    1297       if( m_layerId > 0 && !m_pcEncTop->getVPS()->getNonHEVCBaseLayerFlag() && m_pcEncTop->getVPS()->getRecursiveRefLayerFlag( m_layerId, refLayerId ) )
    1298       {
    1299         m_pcEncTop->getSPS()->setInferScalingListFlag( true );
    1300         m_pcEncTop->getSPS()->setScalingListRefLayerId( refLayerId );
    1301         m_pcEncTop->getSPS()->setScalingListPresentFlag( false );
    1302         m_pcEncTop->getPPS()->setInferScalingListFlag( false );
    1303         m_pcEncTop->getPPS()->setScalingListPresentFlag( false );
    1304 
    1305         // infer the scaling list from the reference layer
    1306         pcSlice->setScalingList ( m_ppcTEncTop[pcSlice->getVPS()->getLayerIdxInVps(refLayerId)]->getScalingList() );
    1307       }
    1308       else
    1309       {
    1310 #endif
    1311       pcSlice->setDefaultScalingList ();
    1312       if(pcSlice->getScalingList()->xParseScalingList(m_pcCfg->getScalingListFile()))
    1313       {
    1314         Bool bParsedScalingList=false; // Use of boolean so that assertion outputs useful string
    1315         assert(bParsedScalingList);
    1316         exit(1);
    1317       }
    1318       pcSlice->getScalingList()->checkDcOfMatrix();
    1319       m_pcEncTop->getSPS()->setScalingListPresentFlag(pcSlice->checkDefaultScalingList());
    1320       m_pcEncTop->getPPS()->setScalingListPresentFlag(false);
    1321 
    1322 #if SVC_EXTENSION
    1323     }
    1324 #endif
    1325 
    1326       m_pcEncTop->getTrQuant()->setScalingList(pcSlice->getScalingList(), pcSlice->getSPS()->getChromaFormatIdc());
    1327       m_pcEncTop->getTrQuant()->setUseScalingList(true);
    1328     }
    1329     else
    1330     {
    1331       printf("error : ScalingList == %d no support\n",m_pcEncTop->getUseScalingListId());
    1332       assert(0);
    1333     }
    13341253
    13351254    if(pcSlice->getSliceType()==B_SLICE&&m_pcCfg->getGOPEntry(iGOPid).m_sliceType=='P')
     
    13811300
    13821301        // conformance check: when ScaledRefRegionWidthInSamplesY is equal to RefLayerRegionWidthInSamplesY, PhaseHorY shall be equal to 0, when ScaledRefRegionWidthInSamplesC is equal to RefLayerRegionWidthInSamplesC, PhaseHorC shall be equal to 0, when ScaledRefRegionHeightInSamplesY is equal to RefLayerRegionHeightInSamplesY, PhaseVerY shall be equal to 0, and when ScaledRefRegionHeightInSamplesC is equal to RefLayerRegionHeightInSamplesC, PhaseVerC shall be equal to 0.
    1383         Bool phaseSetPresentFlag;
    1384         Int phaseHorLuma, phaseVerLuma, phaseHorChroma, phaseVerChroma;
    1385         pcSlice->getPPS()->getResamplingPhase( refLayerId, phaseSetPresentFlag, phaseHorLuma, phaseVerLuma, phaseHorChroma, phaseVerChroma );
    1386 
    1387         assert( ( (widthEL  != widthBL)  || (phaseHorLuma == 0 && phaseHorChroma == 0) )
    1388              && ( (heightEL != heightBL) || (phaseVerLuma == 0 && phaseVerChroma == 0) ) );
     1302        const ResamplingPhase &resamplingPhase = pcSlice->getPPS()->getResamplingPhase( refLayerId );
     1303
     1304        assert( ( (widthEL  != widthBL)  || (resamplingPhase.phaseHorLuma == 0 && resamplingPhase.phaseHorChroma == 0) )
     1305             && ( (heightEL != heightBL) || (resamplingPhase.phaseVerLuma == 0 && resamplingPhase.phaseVerChroma == 0) ) );
    13891306
    13901307        g_mvScalingFactor[refLayerIdc][0] = widthEL  == widthBL  ? 4096 : Clip3(-4096, 4095, ((widthEL  << 8) + (widthBL  >> 1)) / widthBL);
     
    14181335          Bool bSignalPPS = m_bSeqFirst;
    14191336          bSignalPPS |= m_pcCfg->getGOPSize() > 1 ? pocCurr % m_pcCfg->getIntraPeriod() == 0 : pocCurr % m_pcCfg->getFrameRate() == 0;
    1420           xDetermin3DAsymLUT( pcSlice , pcPic , refLayerIdc , m_pcCfg , bSignalPPS );
     1337          xDetermin3DAsymLUT( pcSlice, pcPic, refLayerIdc, m_pcCfg, bSignalPPS );
     1338
     1339          // update PPS in TEncTop and TComPicSym classes
     1340          m_pcEncTop->getPPS()->setCGSOutputBitDepthY( m_Enc3DAsymLUTPPS.getOutputBitDepthY() );
     1341          m_pcEncTop->getPPS()->setCGSOutputBitDepthC( m_Enc3DAsymLUTPPS.getOutputBitDepthC() );
     1342          pcPic->getPicSym()->getPPSToUpdate()->setCGSOutputBitDepthY( m_Enc3DAsymLUTPPS.getOutputBitDepthY() );
     1343          pcPic->getPicSym()->getPPSToUpdate()->setCGSOutputBitDepthC( m_Enc3DAsymLUTPPS.getOutputBitDepthC() );
     1344
    14211345          m_Enc3DAsymLUTPPS.colorMapping( pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(),  m_pColorMappedPic );
    14221346          pBaseColRec = m_pColorMappedPic;
     
    16081532          if(lTid==pcSlice->getTLayer())
    16091533          {
    1610             TComReferencePictureSet* nRPS = pcSlice->getSPS()->getRPSList()->getReferencePictureSet(ii);
     1534            const TComReferencePictureSet* nRPS = pcSlice->getSPS()->getRPSList()->getReferencePictureSet(ii);
    16111535            for(Int jj=0;jj<nRPS->getNumberOfPictures();jj++)
    16121536            {
     
    17251649          if(lTid==pcSlice->getTLayer())
    17261650          {
    1727             TComReferencePictureSet* nRPS = pcSlice->getSPS()->getRPSList()->getReferencePictureSet(ii);
     1651            const TComReferencePictureSet* nRPS = pcSlice->getSPS()->getRPSList()->getReferencePictureSet(ii);
    17281652            for(Int jj=0; jj<nRPS->getNumberOfPictures(); jj++)
    17291653            {
     
    18441768      pcSlice->setSliceType ( P_SLICE );
    18451769    }
     1770    pcSlice->setEncCABACTableIdx(m_pcSliceEncoder->getEncCABACTableIdx());
    18461771
    18471772    if (pcSlice->getSliceType() == B_SLICE)
     
    18941819        pcSlice->setEnableTMVPFlag(1);
    18951820      }
    1896       pcSlice->getSPS()->setTMVPFlagsPresent(1);
    18971821    }
    18981822    else if (m_pcEncTop->getTMVPModeId() == 1)
    18991823    {
    1900       pcSlice->getSPS()->setTMVPFlagsPresent(1);
    19011824#if SVC_EXTENSION
    19021825      if( pcSlice->getIdrPicFlag() )
     
    19101833    else
    19111834    {
    1912       pcSlice->getSPS()->setTMVPFlagsPresent(0);
    19131835      pcSlice->setEnableTMVPFlag(0);
    19141836    }
     
    20261948    pcPic->getSlice(pcSlice->getSliceIdx())->setMvdL1ZeroFlag(pcSlice->getMvdL1ZeroFlag());
    20271949
    2028     pcPic->getPicSym()->initTiles(pcSlice->getPPS());
    2029     pcPic->getPicSym()->initCtuTsRsAddrMaps();
    2030 
    20311950    Double lambda            = 0.0;
    20321951    Int actualHeadBits       = 0;
     
    21142033
    21152034    // Allocate some coders, now the number of tiles are known.
    2116     const Int numSubstreams = pcSlice->getPPS()->getNumSubstreams();
     2035    const Int numSubstreamsColumns = (pcSlice->getPPS()->getNumTileColumnsMinus1() + 1);
     2036    const Int numSubstreamRows     = pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag() ? pcPic->getFrameHeightInCtus() : (pcSlice->getPPS()->getNumTileRowsMinus1() + 1);
     2037    const Int numSubstreams        = numSubstreamRows * numSubstreamsColumns;
    21172038    std::vector<TComOutputBitstream> substreamsOut(numSubstreams);
    21182039
     
    21382059          m_pcSliceEncoder->setSliceIdx             ( uiNumSliceSegments   );
    21392060          pcSlice = pcPic->getSlice                 ( uiNumSliceSegments   );
     2061          assert(pcSlice->getPPS()!=0);
    21402062          pcSlice->copySliceInfo                    ( pcPic->getSlice(uiNumSliceSegments-1)  );
    21412063          pcSlice->setSliceIdx                      ( uiNumSliceSegments   );
     
    21512073          pcSlice->setDependentSliceSegmentFlag(bNextSegmentIsDependentSlice);
    21522074          pcSlice->setSliceSegmentCurStartCtuTsAddr ( curSliceSegmentEnd );
     2075          // TODO: optimise cabac_init during compress slice to improve multi-slice operation
     2076          // pcSlice->setEncCABACTableIdx(m_pcSliceEncoder->getEncCABACTableIdx());
    21532077          uiNumSliceSegments ++;
    21542078        }
     
    21772101    if ( m_pcCfg->getDeblockingFilterMetric() )
    21782102    {
    2179       dblMetric(pcPic, uiNumSliceSegments);
     2103      applyDeblockingFilterMetric(pcPic, uiNumSliceSegments);
    21802104    }
    21812105    m_pcLoopFilter->loopFilterPic( pcPic );
     
    21852109    m_pcEntropyCoder->setEntropyCoder   ( m_pcCavlcCoder, pcSlice );
    21862110
    2187     /* write various header sets. */
     2111    // write various header sets.
    21882112    if ( m_bSeqFirst )
    21892113    {
     
    22222146
    22232147      m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
    2224       if (m_bSeqFirst)
    2225       {
    2226         pcSlice->getSPS()->setNumLongTermRefPicSPS(m_numLongTermRefPicSPS);
    2227         assert (m_numLongTermRefPicSPS <= MAX_NUM_LONG_TERM_REF_PICS);
    2228         for (Int k = 0; k < m_numLongTermRefPicSPS; k++)
    2229         {
    2230           pcSlice->getSPS()->setLtRefPicPocLsbSps(k, m_ltRefPicPocLsbSps[k]);
    2231           pcSlice->getSPS()->setUsedByCurrPicLtSPSFlag(k, m_ltRefPicUsedByCurrPicFlag[k]);
    2232         }
    2233       }
    2234       if( m_pcCfg->getPictureTimingSEIEnabled() || m_pcCfg->getDecodingUnitInfoSEIEnabled() )
    2235       {
    2236         UInt maxCU = m_pcCfg->getSliceArgument();
    2237         UInt numDU = ( m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_CTU ) ? ( pcPic->getNumberOfCtusInFrame() / maxCU ) : ( 0 );
    2238         if( pcPic->getNumberOfCtusInFrame() % maxCU != 0 || numDU == 0 )
    2239         {
    2240           numDU ++;
    2241         }
    2242         pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->setNumDU( numDU );
    2243         pcSlice->getSPS()->setHrdParameters( m_pcCfg->getFrameRate(), numDU, m_pcCfg->getTargetBitrate(), ( m_pcCfg->getIntraPeriod() > 0 ) );
    2244       }
    2245       if( m_pcCfg->getBufferingPeriodSEIEnabled() || m_pcCfg->getPictureTimingSEIEnabled() || m_pcCfg->getDecodingUnitInfoSEIEnabled() )
    2246       {
    2247         pcSlice->getSPS()->getVuiParameters()->setHrdParametersPresentFlag( true );
    2248       }
    2249 
     2148     
    22502149#if SVC_EXTENSION
    22512150      // dependency constraint
     
    22852184      actualTotalBits += UInt(accessUnit.back()->m_nalUnitData.str().size()) * 8;
    22862185
    2287       xCreateLeadingSEIMessages(accessUnit, pcSlice->getSPS());
     2186      xCreateLeadingSEIMessages(accessUnit, pcSlice->getSPS(), pcSlice->getPPS());
    22882187
    22892188#if O0164_MULTI_LAYER_HRD
     
    27762675      }
    27772676#endif
     2677
     2678      pcSlice->setEncCABACTableIdx(m_pcSliceEncoder->getEncCABACTableIdx());
    27782679
    27792680      tmpBitsBeforeWriting = m_pcEntropyCoder->getNumberOfWrittenBits();
     
    30892990        || ( pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getVclHrdParametersPresentFlag() ) ) )
    30902991    {
    3091       TComVUI *vui = pcSlice->getSPS()->getVuiParameters();
    3092       TComHRD *hrd = vui->getHrdParameters();
     2992      const TComVUI *vui = pcSlice->getSPS()->getVuiParameters();
     2993      const TComHRD *hrd = vui->getHrdParameters();
    30932994
    30942995      if( hrd->getSubPicCpbParamsPresentFlag() )
     
    40943995}
    40953996
    4096 Void TEncGOP::dblMetric( TComPic* pcPic, UInt uiNumSlices )
     3997Void TEncGOP::applyDeblockingFilterMetric( TComPic* pcPic, UInt uiNumSlices )
    40973998{
    40983999  TComPicYuv* pcPicYuvRec = pcPic->getPicYuvRec();
     
    48194720
    48204721#if CGS_3D_ASYMLUT
    4821 Void TEncGOP::xDetermin3DAsymLUT( TComSlice * pSlice , TComPic * pCurPic , UInt refLayerIdc , TEncCfg * pCfg , Bool bSignalPPS )
     4722Void TEncGOP::xDetermin3DAsymLUT( TComSlice * pSlice, TComPic * pCurPic, UInt refLayerIdc, TEncCfg * pCfg, Bool bSignalPPS )
    48224723{
    48234724  Int nCGSFlag = pSlice->getPPS()->getCGSFlag();
     
    48844785    }
    48854786  }
    4886   pSlice->getPPS()->setCGSOutputBitDepthY( m_Enc3DAsymLUTPPS.getOutputBitDepthY() );
    4887   pSlice->getPPS()->setCGSOutputBitDepthC( m_Enc3DAsymLUTPPS.getOutputBitDepthC() );
    48884787}
    48894788
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.h

    r1212 r1235  
    236236  Double xCalculateRVM();
    237237
    238   SEIActiveParameterSets*           xCreateSEIActiveParameterSets (TComSPS *sps);
     238  SEIActiveParameterSets*           xCreateSEIActiveParameterSets (const TComSPS *sps);
    239239  SEIFramePacking*                  xCreateSEIFramePacking();
    240240  SEISegmentedRectFramePacking*     xCreateSEISegmentedRectFramePacking();
    241241  SEIDisplayOrientation*            xCreateSEIDisplayOrientation();
    242242  SEIToneMappingInfo*               xCreateSEIToneMappingInfo();
    243   SEITempMotionConstrainedTileSets* xCreateSEITempMotionConstrainedTileSets ();
     243  SEITempMotionConstrainedTileSets* xCreateSEITempMotionConstrainedTileSets (const TComPPS *pps);
    244244  SEIKneeFunctionInfo*              xCreateSEIKneeFunctionInfo();
    245245  SEIChromaSamplingFilterHint*      xCreateSEIChromaSamplingFilterHint(Bool bChromaLocInfoPresent, Int iHorFilterIndex, Int iVerFilterIdc);
    246246
    247   Void xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps);
     247  Void xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, const TComSPS *sps, const TComPPS *pps);
    248248  Int xGetFirstSeiLocation (AccessUnit &accessUnit);
    249249  Void xResetNonNestedSEIPresentFlags()
     
    258258    m_nestedPictureTimingSEIPresentInAU      = false;
    259259  }
    260   Void dblMetric( TComPic* pcPic, UInt uiNumSlices );
     260  Void applyDeblockingFilterMetric( TComPic* pcPic, UInt uiNumSlices );
    261261
    262262#if Q0074_COLOUR_REMAPPING_SEI
     
    290290  Void downScalePic( TComPicYuv* pcYuvSrc, TComPicYuv* pcYuvDest);
    291291  Void downScaleComponent2x2( const Pel* pSrc, Pel* pDest, const Int iSrcStride, const Int iDestStride, const Int iSrcWidth, const Int iSrcHeight, const Int inputBitDepth, const Int outputBitDepth );
    292   inline Short  xClip( Short x , Int bitdepth );
     292  inline Short xClip( Short x , Int bitdepth );
    293293  Void initDs(Int iWidth, Int iHeight, Int iType);
    294   Void filterImg(
    295     Pel           *src,
    296     Int           iSrcStride,
    297     Pel           *dst,
    298     Int           iDstStride,
    299     Int           height1, 
    300     Int           width1, 
    301     Int           shift,
    302     Int           plane);
     294  Void filterImg( Pel *src, Int iSrcStride, Pel *dst, Int iDstStride, Int height1, Int width1, Int shift, Int plane);
    303295
    304296  Int get_mem2DintWithPad(Int ***array2D, Int dim0, Int dim1, Int iPadY, Int iPadX);
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncPic.cpp

    r1029 r1235  
    128128
    129129#if SVC_EXTENSION
    130 Void TEncPic::create( Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth, 
    131                       Window &conformanceWindow, Window &defaultDisplayWindow, Int *numReorderPics, TComSPS* pcSps, Bool bIsVirtual )
     130Void TEncPic::create( const TComVPS& vps, const TComSPS &sps, const TComPPS &pps, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth, Bool bIsVirtual, const UInt layerId )
    132131{
    133   TComPic::create( iWidth, iHeight, chromaFormat, uiMaxWidth, uiMaxHeight, uiMaxDepth, 
    134                    conformanceWindow, defaultDisplayWindow, numReorderPics, pcSps, bIsVirtual );
     132  TComPic::create( vps, sps, pps, uiMaxWidth, uiMaxHeight, uiMaxDepth, bIsVirtual, layerId );
     133
     134  const Int iWidth  = vps.getPicWidthInLumaSamples(&sps, layerId);
     135  const Int iHeight = vps.getPicHeightInLumaSamples(&sps, layerId);
    135136#else
    136 Void TEncPic::create( Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth,
    137                       Window &conformanceWindow, Window &defaultDisplayWindow, Int *numReorderPics, Bool bIsVirtual )
     137Void TEncPic::create( const TComSPS &sps, const TComPPS &pps, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth, Bool bIsVirtual )
    138138{
    139   TComPic::create( iWidth, iHeight, chromaFormat, uiMaxWidth, uiMaxHeight, uiMaxDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, bIsVirtual );
     139  TComPic::create( sps, pps, uiMaxWidth, uiMaxHeight, uiMaxDepth, bIsVirtual );
     140
     141  const Int iWidth  = sps.getPicWidthInLumaSamples();
     142  const Int iHeight = sps.getPicHeightInLumaSamples();
    140143#endif
    141144  m_uiMaxAQDepth = uiMaxAQDepth;
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncPic.h

    r1029 r1235  
    106106
    107107#if SVC_EXTENSION
    108   Void          create( Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth, 
    109                       Window &conformanceWindow, Window &defaultDisplayWindow, Int *numReorderPics, TComSPS* pcSps, Bool bIsVirtual=false );
     108  Void          create( const TComVPS &vps, const TComSPS &sps, const TComPPS &pps, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth, Bool bIsVirtual /* = false*/, const UInt layerId );
    110109#else  //SVC_EXTENSION
    111   Void          create( Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth,
    112                           Window &conformanceWindow, Window &defaultDisplayWindow, Int *numReorderPics, Bool bIsVirtual = false );
     110  Void          create( const TComSPS &sps, const TComPPS &pps, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth, Bool bIsVirtual /* = false*/ );
    113111#endif //SVC_EXTENSION
    114112
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncSbac.cpp

    r1230 r1235  
    109109  SliceType eSliceType  = m_pcSlice->getSliceType();
    110110
    111   Int  encCABACTableIdx = m_pcSlice->getPPS()->getEncCABACTableIdx();
     111  SliceType encCABACTableIdx = m_pcSlice->getEncCABACTableIdx();;
    112112  if (!m_pcSlice->isIntra() && (encCABACTableIdx==B_SLICE || encCABACTableIdx==P_SLICE) && m_pcSlice->getPPS()->getCabacInitPresentFlag())
    113113  {
    114     eSliceType = (SliceType) encCABACTableIdx;
     114    eSliceType = encCABACTableIdx;
    115115  }
    116116
     
    161161 * stores the index of the closest table.  This index is used for the next P/B slice when cabac_init_present_flag is true.
    162162 */
    163 Void TEncSbac::determineCabacInitIdx()
     163SliceType TEncSbac::determineCabacInitIdx()
    164164{
    165165  Int  qp              = m_pcSlice->getSliceQp();
     
    214214      }
    215215    }
    216     m_pcSlice->getPPS()->setEncCABACTableIdx( bestSliceType );
     216    return bestSliceType;
    217217  }
    218218  else
    219219  {
    220     m_pcSlice->getPPS()->setEncCABACTableIdx( I_SLICE );
    221   }
    222 }
    223 
    224 Void TEncSbac::codeVPS( TComVPS* pcVPS )
     220    return I_SLICE;
     221  }
     222}
     223
     224Void TEncSbac::codeVPS( const TComVPS* pcVPS )
    225225{
    226226  assert (0);
     
    228228}
    229229
    230 Void TEncSbac::codeSPS( TComSPS* pcSPS )
     230Void TEncSbac::codeSPS( const TComSPS* pcSPS )
    231231{
    232232  assert (0);
     
    234234}
    235235
    236 Void TEncSbac::codePPS( TComPPS* pcPPS
    237236#if CGS_3D_ASYMLUT
    238   , TEnc3DAsymLUT * pc3DAsymLUT
     237Void TEncSbac::codePPS( const TComPPS* pcPPS, TEnc3DAsymLUT * pc3DAsymLUT )
     238#else
     239Void TEncSbac::codePPS( const TComPPS* pcPPS )
    239240#endif
    240   )
    241241{
    242242  assert (0);
     
    459459      m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );
    460460      m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 1) );
    461       if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) )
     461      if ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < g_uiMaxCUDepth-g_uiAddCUDepth )
    462462      {
    463463        if (eSize == SIZE_2NxN)
     
    485485      }
    486486
    487       if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) )
     487      if ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < g_uiMaxCUDepth-g_uiAddCUDepth )
    488488      {
    489489        if (eSize == SIZE_Nx2N)
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncSbac.h

    r1212 r1235  
    7575  //  Virtual list
    7676  Void  resetEntropy           ();
    77   Void determineCabacInitIdx  ();
     77  SliceType determineCabacInitIdx  ();
    7878  Void  setBitstream           ( TComBitIf* p )  { m_pcBitIf = p; m_pcBinIf->init( p ); }
    7979  Void  setSlice               ( TComSlice* p )  { m_pcSlice = p;                       }
     
    8787  //--SBAC RD
    8888
    89   Void  codeVPS                ( TComVPS* pcVPS );
    90   Void  codeSPS                ( TComSPS* pcSPS     );
    91   Void  codePPS                ( TComPPS* pcPPS     
     89  Void  codeVPS                ( const TComVPS* pcVPS );
     90  Void  codeSPS                ( const TComSPS* pcSPS     );
    9291#if CGS_3D_ASYMLUT
    93     , TEnc3DAsymLUT * pc3DAsymLUT
     92  Void  codePPS                ( const TComPPS* pcPPS, TEnc3DAsymLUT * pc3DAsymLUT     );
     93#else
     94  Void  codePPS                ( const TComPPS* pcPPS     );
    9495#endif
    95     );
    9696  Void  codeSliceHeader        ( TComSlice* pcSlice );
    9797  Void  codeTilesWPPEntryPoint ( TComSlice* pSlice );
     
    103103  Void  codeSaoUflc          ( UInt uiLength, UInt  uiCode );
    104104  Void  codeSAOSign          ( UInt  uiCode);  //<! code SAO offset sign
    105   Void  codeScalingList      ( TComScalingList* /*scalingList*/     ){ assert (0);  return;};
    106105
    107106#if SVC_EXTENSION
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp

    r1234 r1235  
    39453945#if SVC_EXTENSION
    39463946  // Check WP for B-slices
    3947   if ( pcCU->getSlice()->getPPS()->getUseWP())
     3947  if( pcCU->getSlice()->testWeightPred() )
    39483948#else
    3949   if ( pcCU->getSlice()->getPPS()->getUseWP() && pcCU->getSlice()->getSliceType()==P_SLICE )
     3949  if ( pcCU->getSlice()->testWeightPred() && pcCU->getSlice()->getSliceType()==P_SLICE )
    39503950#endif
    39513951  {
     
    39593959#if SVC_EXTENSION
    39603960  // Check WP for B-slices
    3961   if( pcCU->getSlice()->getPPS()->getUseWP())
     3961  if ( pcCU->getSlice()->testWeightPred() )
    39623962#else
    3963   if ( pcCU->getSlice()->getPPS()->getUseWP() && pcCU->getSlice()->getSliceType()==P_SLICE )
     3963  if ( pcCU->getSlice()->testWeightPred() && pcCU->getSlice()->getSliceType()==P_SLICE )
    39643964#endif
    39653965  {
     
    55845584  assert( pcCU->getDepth( 0 ) == pcCU->getDepth( uiAbsPartIdx ) );
    55855585  const UInt uiTrMode = pcCU->getTransformIdx( uiAbsPartIdx );
    5586   TComSPS *sps=pcCU->getSlice()->getSPS();
     5586  const TComSPS *sps=pcCU->getSlice()->getSPS();
    55875587
    55885588  if( uiCurrTrMode == uiTrMode )
     
    59735973
    59745974  TComSlice       *pcSlice  = pcCU->getSlice();
    5975   TComPPS         *pps      = pcCU->getSlice()->getPPS();
    59765975  WPScalingParam  *wp0 , *wp1;
    59775976
    5978   m_cDistParam.bApplyWeight = ( pcSlice->getSliceType()==P_SLICE && pps->getUseWP() ) || ( pcSlice->getSliceType()==B_SLICE && pps->getWPBiPred() ) ;
     5977  m_cDistParam.bApplyWeight = ( pcSlice->getSliceType()==P_SLICE && pcSlice->testWeightPred() ) || ( pcSlice->getSliceType()==B_SLICE && pcSlice->testWeightBiPred() ) ;
    59795978
    59805979  if ( !m_cDistParam.bApplyWeight ) return;
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncSlice.cpp

    r1203 r1235  
    4848
    4949TEncSlice::TEncSlice()
     50: m_encCABACTableIdx(I_SLICE)
    5051{
    5152  m_apcPicYuvPred = NULL;
     
    220221#if SVC_EXTENSION
    221222//\param vps          VPS associated with the slice
    222 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS, TComVPS *vps, Bool isField )
    223 #else
    224 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS, Bool isField )
     223Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, Bool isField )
     224#else
     225Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, const TComSPS* pSPS, const TComPPS *pPPS, Bool isField )
    225226#endif
    226227{
     
    229230
    230231  rpcSlice = pcPic->getSlice(0);
    231   rpcSlice->setSPS( pSPS );
    232   rpcSlice->setPPS( pPPS );
    233232  rpcSlice->setSliceBits(0);
    234233  rpcSlice->setPic( pcPic );
    235234#if SVC_EXTENSION
     235  const TComPPS* pPPS = &pcPic->getPicSym()->getPPS();
     236
    236237  UInt layerId = pcPic->getLayerId();
    237   rpcSlice->setVPS( vps );
    238238  rpcSlice->initSlice( layerId );
    239239#else
     
    501501  else if (rpcSlice->getPPS()->getDeblockingFilterControlPresentFlag())
    502502  {
    503     rpcSlice->getPPS()->setDeblockingFilterOverrideEnabledFlag( !m_pcCfg->getLoopFilterOffsetInPPS() );
    504     rpcSlice->setDeblockingFilterOverrideFlag( !m_pcCfg->getLoopFilterOffsetInPPS() );
    505     rpcSlice->getPPS()->setPicDisableDeblockingFilterFlag( m_pcCfg->getLoopFilterDisable() );
    506     rpcSlice->setDeblockingFilterDisable( m_pcCfg->getLoopFilterDisable() );
     503    rpcSlice->setDeblockingFilterOverrideFlag( rpcSlice->getPPS()->getDeblockingFilterOverrideEnabledFlag() );
     504    rpcSlice->setDeblockingFilterDisable( rpcSlice->getPPS()->getPicDisableDeblockingFilterFlag() );
    507505    if ( !rpcSlice->getDeblockingFilterDisable())
    508506    {
    509       if ( !m_pcCfg->getLoopFilterOffsetInPPS() && eSliceType!=I_SLICE)
    510       {
    511         rpcSlice->getPPS()->setDeblockingFilterBetaOffsetDiv2( m_pcCfg->getGOPEntry(iGOPid).m_betaOffsetDiv2 + m_pcCfg->getLoopFilterBetaOffset() );
    512         rpcSlice->getPPS()->setDeblockingFilterTcOffsetDiv2( m_pcCfg->getGOPEntry(iGOPid).m_tcOffsetDiv2 + m_pcCfg->getLoopFilterTcOffset() );
     507      if ( rpcSlice->getDeblockingFilterOverrideFlag() && eSliceType!=I_SLICE)
     508      {
    513509        rpcSlice->setDeblockingFilterBetaOffsetDiv2( m_pcCfg->getGOPEntry(iGOPid).m_betaOffsetDiv2 + m_pcCfg->getLoopFilterBetaOffset()  );
    514510        rpcSlice->setDeblockingFilterTcOffsetDiv2( m_pcCfg->getGOPEntry(iGOPid).m_tcOffsetDiv2 + m_pcCfg->getLoopFilterTcOffset() );
     
    516512      else
    517513      {
    518         rpcSlice->getPPS()->setDeblockingFilterBetaOffsetDiv2( m_pcCfg->getLoopFilterBetaOffset() );
    519         rpcSlice->getPPS()->setDeblockingFilterTcOffsetDiv2( m_pcCfg->getLoopFilterTcOffset() );
    520514        rpcSlice->setDeblockingFilterBetaOffsetDiv2( m_pcCfg->getLoopFilterBetaOffset() );
    521515        rpcSlice->setDeblockingFilterTcOffsetDiv2( m_pcCfg->getLoopFilterTcOffset() );
     
    558552#endif
    559553
    560   xStoreWPparam( pPPS->getUseWP(), pPPS->getWPBiPred() );
    561 
    562554#if SVC_EXTENSION
    563555  if( layerId > 0 )
     
    792784
    793785    xEstimateWPParamSlice( pcSlice );
    794     pcSlice->initWpScaling();
     786    pcSlice->initWpScaling(pcSlice->getSPS());
    795787
    796788    // check WP on/off
     
    10101002    m_lastSliceSegmentEndContextState.loadContexts( m_pppcRDSbacCoder[0][CI_CURR_BEST] );//ctx end of dep.slice
    10111003  }
    1012   xRestoreWPparam( pcSlice );
    10131004
    10141005  // stop use of temporary bit counter object.
    10151006  m_pppcRDSbacCoder[0][CI_CURR_BEST]->setBitstream(NULL);
    10161007  m_pcRDGoOnSbacCoder->setBitstream(NULL); // stop use of tempBitCounter.
     1008
     1009  // TODO: optimise cabac_init during compress slice to improve multi-slice operation
     1010  //if (pcSlice->getPPS()->getCabacInitPresentFlag() && !pcSlice->getPPS()->getDependentSliceSegmentsEnabledFlag())
     1011  //{
     1012  //  m_encCABACTableIdx = m_pcEntropyCoder->determineCabacInitIdx();
     1013  //}
     1014  //else
     1015  //{
     1016  //  m_encCABACTableIdx = pcSlice->getSliceType();
     1017  //}
    10171018}
    10181019
     
    11981199#endif
    11991200
    1200   if (pcSlice->getPPS()->getCabacInitPresentFlag())
    1201   {
    1202     if (pcSlice->getPPS()->getDependentSliceSegmentsEnabledFlag())
    1203     {
    1204       pcSlice->getPPS()->setEncCABACTableIdx( pcSlice->getSliceType() );
    1205     }
    1206     else
    1207     {
    1208       m_pcEntropyCoder->determineCabacInitIdx();
    1209     }
    1210   }
     1201  if (pcSlice->getPPS()->getCabacInitPresentFlag() && !pcSlice->getPPS()->getDependentSliceSegmentsEnabledFlag())
     1202  {
     1203    m_encCABACTableIdx = m_pcEntropyCoder->determineCabacInitIdx();
     1204  }
     1205  else
     1206  {
     1207    m_encCABACTableIdx = pcSlice->getSliceType();
     1208  }
     1209 
    12111210  numBinsCoded = m_pcBinCABAC->getBinsCoded();
    12121211}
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncSlice.h

    r1201 r1235  
    9898  TEncSbac                m_lastSliceSegmentEndContextState;    ///< context storage for state at the end of the previous slice-segment (used for dependent slices only).
    9999  TEncSbac                m_entropyCodingSyncContextState;      ///< context storate for state of contexts at the wavefront/WPP/entropy-coding-sync second CTU of tile-row
     100  SliceType               m_encCABACTableIdx;
    100101
    101102#if SVC_EXTENSION && JCTVC_M0259_LAMBDAREFINEMENT
     
    120121  /// preparation of slice encoding (reference marking, QP and lambda)
    121122#if SVC_EXTENSION
    122   Void    initEncSlice        ( TComPic*  pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd,
    123                                 Int iGOPid,   TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS, TComVPS *vps, Bool isField );
     123  Void    initEncSlice        ( TComPic*  pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, Bool isField );
    124124  Void    estimateILWpParam   ( TComSlice* pcSlice );
    125125#else
    126126  Void    initEncSlice        ( TComPic*  pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd,
    127                                 Int iGOPid,   TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS, Bool isField );
     127                                Int iGOPid,   TComSlice*& rpcSlice, const TComSPS* pSPS, const TComPPS *pPPS, Bool isField );
    128128#endif
    129129
     
    143143  Void    setSliceIdx(UInt i)   { m_uiSliceIdx = i;                       }
    144144
     145  SliceType getEncCABACTableIdx() const           { return m_encCABACTableIdx;        }
     146
    145147private:
    146148  Double  xGetQPValueAccordingToLambda ( Double lambda );
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.cpp

    r1226 r1235  
    185185  m_cSliceEncoder.      destroy();
    186186  m_cCuEncoder.         destroy();
    187   if (m_cSPS.getUseSAO())
    188   {
    189     m_cEncSAO.destroyEncData();
    190     m_cEncSAO.destroy();
    191   }
     187  m_cEncSAO.            destroyEncData();
     188  m_cEncSAO.            destroy();
    192189  m_cLoopFilter.        destroy();
    193190  m_cRateCtrl.          destroy();
     
    232229  // initialize SPS
    233230  xInitSPS();
    234 
    235   // set the VPS profile information
    236 #if SVC_EXTENSION
    237   m_cVPS.getTimingInfo()->setTimingInfoPresentFlag       ( true );
    238 #else
    239   *m_cVPS.getPTL() = *m_cSPS.getPTL();
    240   m_cVPS.getTimingInfo()->setTimingInfoPresentFlag       ( false );
    241 #endif
     231  xInitVPS();
     232
    242233  m_cRdCost.setCostMode(m_costMode);
    243234
    244235  // initialize PPS
    245   m_cPPS.setSPS(&m_cSPS);
    246236  xInitPPS();
    247237  xInitRPS(isFieldCoding);
     
    271261
    272262  m_iMaxRefPicNum = 0;
     263
     264  xInitScalingLists();
     265
    273266#if SVC_EXTENSION
    274267  m_iSPSIdCnt ++;
     
    276269  xInitILRP();
    277270#endif
     271}
     272
     273Void TEncTop::xInitScalingLists()
     274{
     275  // Initialise scaling lists
     276  // The encoder will only use the SPS scaling lists. The PPS will never be marked present.
     277
     278  if(getUseScalingListId() == SCALING_LIST_OFF)
     279  {
     280#if SVC_EXTENSION
     281    getTrQuant()->setFlatScalingList(m_cVPS.getChromaFormatIdc(&m_cSPS, m_layerId));
     282#else
     283    getTrQuant()->setFlatScalingList(m_cSPS.getChromaFormatIdc());
     284#endif
     285    getTrQuant()->setUseScalingList(false);
     286    m_cSPS.setScalingListPresentFlag(false);
     287    m_cPPS.setScalingListPresentFlag(false);
     288  }
     289  else if(getUseScalingListId() == SCALING_LIST_DEFAULT)
     290  {
     291#if SVC_EXTENSION
     292    // inferring of the scaling list can be moved to the config file
     293    UInt refLayerId = 0;
     294    if( m_layerId > 0 && !m_cVPS.getNonHEVCBaseLayerFlag() && m_cVPS.getRecursiveRefLayerFlag( m_layerId, refLayerId ) )
     295    {
     296      m_cSPS.setInferScalingListFlag( true );
     297      m_cSPS.setScalingListRefLayerId( refLayerId );
     298      m_cSPS.setScalingListPresentFlag( false );
     299      m_cPPS.setInferScalingListFlag( false );
     300      m_cPPS.setScalingListPresentFlag( false );
     301
     302      // infer the scaling list from the reference layer
     303      getTrQuant()->setScalingList( &m_ppcTEncTop[m_cVPS.getLayerIdxInVps(refLayerId)]->getSPS()->getScalingList(), m_cSPS.getChromaFormatIdc() );
     304    }
     305    else
     306    {
     307#endif
     308    m_cSPS.getScalingList().setDefaultScalingList ();
     309    m_cSPS.setScalingListPresentFlag(false);
     310    m_cPPS.setScalingListPresentFlag(false);
     311    getTrQuant()->setScalingList(&(m_cSPS.getScalingList()), m_cSPS.getChromaFormatIdc());
     312#if SVC_EXTENSION
     313    }
     314#endif
     315    getTrQuant()->setUseScalingList(true);
     316  }
     317  else if(getUseScalingListId() == SCALING_LIST_FILE_READ)
     318  {
     319#if SVC_EXTENSION
     320    // inferring of the scaling list can be moved to the config file
     321    UInt refLayerId = 0;
     322    if( m_layerId > 0 && !m_cVPS.getNonHEVCBaseLayerFlag() && m_cVPS.getRecursiveRefLayerFlag( m_layerId, refLayerId ) )
     323    {
     324      m_cSPS.setInferScalingListFlag( true );
     325      m_cSPS.setScalingListRefLayerId( refLayerId );
     326      m_cSPS.setScalingListPresentFlag( false );
     327      m_cPPS.setInferScalingListFlag( false );
     328      m_cPPS.setScalingListPresentFlag( false );
     329
     330      // infer the scaling list from the reference layer
     331      getTrQuant()->setScalingList( &m_ppcTEncTop[m_cVPS.getLayerIdxInVps(refLayerId)]->getSPS()->getScalingList(), m_cSPS.getChromaFormatIdc() );
     332    }
     333    else
     334    {
     335#endif
     336    m_cSPS.getScalingList().setDefaultScalingList ();
     337    if(m_cSPS.getScalingList().xParseScalingList(getScalingListFile()))
     338    {
     339      Bool bParsedScalingList=false; // Use of boolean so that assertion outputs useful string
     340      assert(bParsedScalingList);
     341      exit(1);
     342    }
     343    m_cSPS.getScalingList().checkDcOfMatrix();
     344    m_cSPS.setScalingListPresentFlag(m_cSPS.getScalingList().checkDefaultScalingList());
     345    m_cPPS.setScalingListPresentFlag(false);
     346    getTrQuant()->setScalingList(&(m_cSPS.getScalingList()), m_cSPS.getChromaFormatIdc());
     347#if SVC_EXTENSION
     348    }
     349#endif
     350    getTrQuant()->setUseScalingList(true);
     351  }
     352  else
     353  {
     354    printf("error : ScalingList == %d not supported\n",getUseScalingListId());
     355    assert(0);
     356  }
     357
     358  // Prepare delta's:
     359  for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++)
     360  {
     361    const Int predListStep = (sizeId == SCALING_LIST_32x32? (SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES) : 1); // if 32x32, skip over chroma entries.
     362
     363    for(UInt listId = 0; listId < SCALING_LIST_NUM; listId+=predListStep)
     364    {
     365      m_cSPS.getScalingList().checkPredMode( sizeId, listId );
     366    }
     367  }
     368
    278369}
    279370
     
    585676Void TEncTop::xGetNewPicBuffer ( TComPic*& rpcPic )
    586677{
     678  // At this point, the SPS and PPS can be considered activated - they are copied to the new TComPic.
     679
    587680  TComSlice::sortPicList(m_cListPic);
    588681
     
    611704        for( UInt i = 0; i < m_cVPS.getNumDirectRefLayers( m_layerId ); i++ )
    612705        {
    613           const Window scalEL = getPPS()->getScaledRefLayerWindowForLayer(m_cVPS.getRefLayerId(m_layerId, i));
    614           const Window altRL = getPPS()->getRefLayerWindowForLayer(m_cVPS.getRefLayerId(m_layerId, i));
     706          const Window scalEL = m_cPPS.getScaledRefLayerWindowForLayer(m_cVPS.getRefLayerId(m_layerId, i));
     707          const Window altRL = m_cPPS.getRefLayerWindowForLayer(m_cVPS.getRefLayerId(m_layerId, i));
    615708          Bool equalOffsets = scalEL.hasEqualOffset(altRL);
    616           Bool zeroPhase = getPPS()->hasZeroResamplingPhase(m_cVPS.getRefLayerId(m_layerId, i));
     709          Bool zeroPhase = m_cPPS.hasZeroResamplingPhase(m_cVPS.getRefLayerId(m_layerId, i));
    617710
    618711          TEncTop *pcEncTopBase = (TEncTop *)getRefLayerEnc( i );
     
    643736      }
    644737
    645       pcEPic->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_cPPS.getMaxCuDQPDepth()+1 ,
    646                       m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics, &m_cSPS);
     738      pcEPic->create( m_cVPS, m_cSPS, m_cPPS, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_cPPS.getMaxCuDQPDepth()+1, false, m_layerId);
    647739#else  //SVC_EXTENSION
    648       pcEPic->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_cPPS.getMaxCuDQPDepth()+1, m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics);
     740      pcEPic->create( m_cSPS, m_cPPS, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_cPPS.getMaxCuDQPDepth()+1, false);
    649741#endif //SVC_EXTENSION
    650742      rpcPic = pcEPic;
     
    659751        for( UInt i = 0; i < m_cVPS.getNumDirectRefLayers( m_layerId ); i++ )
    660752        {
    661           const Window scalEL = getPPS()->getScaledRefLayerWindowForLayer(m_cVPS.getRefLayerId(m_layerId, i));
    662           const Window altRL = getPPS()->getRefLayerWindowForLayer(m_cVPS.getRefLayerId(m_layerId, i));
     753          const Window scalEL = m_cPPS.getScaledRefLayerWindowForLayer(m_cVPS.getRefLayerId(m_layerId, i));
     754          const Window altRL = m_cPPS.getRefLayerWindowForLayer(m_cVPS.getRefLayerId(m_layerId, i));
    663755          Bool equalOffsets = scalEL.hasEqualOffset(altRL);
    664           Bool zeroPhase = getPPS()->hasZeroResamplingPhase(m_cVPS.getRefLayerId(m_layerId, i));
     756          Bool zeroPhase = m_cPPS.hasZeroResamplingPhase(m_cVPS.getRefLayerId(m_layerId, i));
    665757
    666758          TEncTop *pcEncTopBase = (TEncTop *)getRefLayerEnc( i );
     
    688780      }
    689781
    690       rpcPic->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics, &m_cSPS);
     782      rpcPic->create( m_cVPS, m_cSPS, m_cPPS, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, false, m_layerId );
    691783#else  //SVC_EXTENSION
    692       rpcPic->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics, false );
     784      rpcPic->create( m_cSPS, m_cPPS, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, false );
    693785#endif //SVC_EXTENSION
    694786    }
     
    705797  rpcPic->getPicYuvRec()->setBorderExtension(false);
    706798}
     799
     800Void TEncTop::xInitVPS()
     801{
     802  // The SPS must have already been set up.
     803  // set the VPS profile information.
     804#if SVC_EXTENSION
     805  m_cVPS.setVpsVuiPresentFlag( true );
     806#else
     807  *m_cVPS.getPTL() = *m_cSPS.getPTL();
     808  m_cVPS.setMaxOpSets(1);
     809#endif
     810  m_cVPS.getTimingInfo()->setTimingInfoPresentFlag       ( false );
     811  m_cVPS.setNumHrdParameters( 0 );
     812
     813  m_cVPS.createHrdParamBuffer();
     814  for( UInt i = 0; i < m_cVPS.getNumHrdParameters(); i ++ )
     815  {
     816    m_cVPS.setHrdOpSetIdx( 0, i );
     817    m_cVPS.setCprmsPresentFlag( false, i );
     818    // Set up HrdParameters here.
     819  }
     820}
     821
    707822
    708823Void TEncTop::xInitSPS()
     
    781896  m_cSPS.setQuadtreeTUMaxDepthIntra( m_uiQuadtreeTUMaxDepthIntra    );
    782897
     898  m_cSPS.setTMVPFlagsPresent((getTMVPModeId() == 2 || getTMVPModeId() == 1));
     899
    783900  m_cSPS.setTMVPFlagsPresent(false);
    784901
    785902  m_cSPS.setMaxTrSize   ( 1 << m_uiQuadtreeTULog2MaxSize );
    786 
    787   Int i;
    788 
    789   for (i = 0; i < g_uiMaxCUDepth-g_uiAddCUDepth; i++ )
    790   {
    791     m_cSPS.setAMPAcc( i, m_useAMP );
    792     //m_cSPS.setAMPAcc( i, 1 );
    793   }
    794 
     903 
    795904  m_cSPS.setUseAMP ( m_useAMP );
    796 
    797   for (i = g_uiMaxCUDepth-g_uiAddCUDepth; i < g_uiMaxCUDepth; i++ )
    798   {
    799     m_cSPS.setAMPAcc(i, 0);
    800   }
    801 
    802905
    803906  for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
     
    830933  m_cSPS.setTemporalIdNestingFlag( ( m_maxTempLayer == 1 ) ? true : false );
    831934
    832   for ( i = 0; i < min(m_cSPS.getMaxTLayers(),(UInt) MAX_TLAYER); i++ )
     935  for ( Int i = 0; i < min(m_cSPS.getMaxTLayers(),(UInt) MAX_TLAYER); i++ )
    833936  {
    834937#if SVC_EXTENSION
     
    841944  m_cSPS.setPCMFilterDisableFlag  ( m_bPCMFilterDisableFlag );
    842945  m_cSPS.setDisableIntraReferenceSmoothing( m_disableIntraReferenceSmoothing );
    843   m_cSPS.setScalingListFlag ( (m_useScalingListId == 0) ? 0 : 1 );
     946  m_cSPS.setScalingListFlag ( (m_useScalingListId == SCALING_LIST_OFF) ? 0 : 1 );
    844947  m_cSPS.setUseStrongIntraSmoothing( m_useStrongIntraSmoothing );
    845948  m_cSPS.setVuiParametersPresentFlag(getVuiParametersPresentFlag());
     
    880983    pcVUI->setLog2MaxMvLengthVertical(getLog2MaxMvLengthVertical());
    881984  }
     985  m_cSPS.setNumLongTermRefPicSPS(NUM_LONG_TERM_REF_PIC_SPS);
     986  assert (NUM_LONG_TERM_REF_PIC_SPS <= MAX_NUM_LONG_TERM_REF_PICS);
     987  for (Int k = 0; k < NUM_LONG_TERM_REF_PIC_SPS; k++)
     988  {
     989    m_cSPS.setLtRefPicPocLsbSps(k, 0);
     990    m_cSPS.setUsedByCurrPicLtSPSFlag(k, 0);
     991  }
     992  if( getPictureTimingSEIEnabled() || getDecodingUnitInfoSEIEnabled() )
     993  {
     994#if SVC_EXTENSION
     995    const UInt picWidth = m_cVPS.getPicWidthInLumaSamples(&m_cSPS, m_layerId);
     996    const UInt picHeight= m_cVPS.getPicWidthInLumaSamples(&m_cSPS, m_layerId);
     997#else
     998    const UInt picWidth = m_cSPS.getPicWidthInLumaSamples();
     999    const UInt picHeight= m_cSPS.getPicWidthInLumaSamples();
     1000#endif
     1001
     1002    const UInt frameWidthInCtus   = ( picWidth + g_uiMaxCUWidth -1 ) / g_uiMaxCUWidth;
     1003    const UInt frameHeightInCtus  = ( picHeight + g_uiMaxCUHeight - 1 ) / g_uiMaxCUHeight;
     1004    const UInt numCtusInFrame = frameWidthInCtus * frameHeightInCtus;
     1005
     1006    UInt maxCU = getSliceArgument();
     1007    UInt numDU = ( getSliceMode() == FIXED_NUMBER_OF_CTU ) ? ( numCtusInFrame / maxCU ) : ( 0 );
     1008    if( numCtusInFrame % maxCU != 0 || numDU == 0 )
     1009    {
     1010      numDU ++;
     1011    }
     1012    m_cSPS.getVuiParameters()->getHrdParameters()->setNumDU( numDU );
     1013    m_cSPS.setHrdParameters( getFrameRate(), numDU, getTargetBitrate(), ( getIntraPeriod() > 0 ) );
     1014  }
     1015  if( getBufferingPeriodSEIEnabled() || getPictureTimingSEIEnabled() || getDecodingUnitInfoSEIEnabled() )
     1016  {
     1017    m_cSPS.getVuiParameters()->setHrdParametersPresentFlag( true );
     1018  }
     1019
    8821020}
    8831021
     
    8921030  }
    8931031
    894   if (m_costMode==COST_SEQUENCE_LEVEL_LOSSLESS || m_costMode==COST_LOSSLESS_CODING) bUseDQP=false;
    895 
    896   if(bUseDQP)
     1032  if (m_costMode==COST_SEQUENCE_LEVEL_LOSSLESS || m_costMode==COST_LOSSLESS_CODING)
     1033  {
     1034    bUseDQP=false;
     1035  }
     1036
     1037
     1038  if ( m_RCEnableRateControl )
     1039  {
     1040    m_cPPS.setUseDQP(true);
     1041    m_cPPS.setMaxCuDQPDepth( 0 );
     1042  }
     1043  else if(bUseDQP)
    8971044  {
    8981045    m_cPPS.setUseDQP(true);
    8991046    m_cPPS.setMaxCuDQPDepth( m_iMaxCuDQPDepth );
    900     m_cPPS.setMinCuDQPSize( m_cPPS.getSPS()->getMaxCUWidth() >> ( m_cPPS.getMaxCuDQPDepth()) );
    9011047  }
    9021048  else
     
    9041050    m_cPPS.setUseDQP(false);
    9051051    m_cPPS.setMaxCuDQPDepth( 0 );
    906     m_cPPS.setMinCuDQPSize( m_cPPS.getSPS()->getMaxCUWidth() >> ( m_cPPS.getMaxCuDQPDepth()) );
    9071052  }
    9081053
     
    9191064  }
    9201065
    921   if ( m_RCEnableRateControl )
    922   {
    923     m_cPPS.setUseDQP(true);
    924     m_cPPS.setMaxCuDQPDepth( 0 );
    925     m_cPPS.setMinCuDQPSize( m_cPPS.getSPS()->getMaxCUWidth() >> ( m_cPPS.getMaxCuDQPDepth()) );
    926   }
    927 
    928   m_cPPS.setMinCuChromaQpAdjSize( m_cPPS.getSPS()->getMaxCUWidth() >> ( m_cPPS.getMaxCuChromaQpAdjDepth()) );
    929 
    9301066  m_cPPS.setQpOffset(COMPONENT_Cb, m_chromaCbQpOffset );
    9311067  m_cPPS.setQpOffset(COMPONENT_Cr, m_chromaCrQpOffset );
    9321068
    933   m_cPPS.setNumSubstreams(m_iWaveFrontSubstreams);
    9341069  m_cPPS.setEntropyCodingSyncEnabledFlag( m_iWaveFrontSynchro > 0 );
    9351070  m_cPPS.setTilesEnabledFlag( (m_iNumColumnsMinus1 > 0 || m_iNumRowsMinus1 > 0) );
     
    9521087  {
    9531088    m_cPPS.setDeblockingFilterControlPresentFlag (m_DeblockingFilterControlPresent );
     1089
     1090    if (m_cPPS.getDeblockingFilterControlPresentFlag())
     1091    {
     1092      m_cPPS.setDeblockingFilterOverrideEnabledFlag( !getLoopFilterOffsetInPPS() );
     1093      m_cPPS.setPicDisableDeblockingFilterFlag( getLoopFilterDisable() );
     1094    }
     1095  }
     1096
     1097  if (m_cPPS.getDeblockingFilterControlPresentFlag() && ! m_cPPS.getPicDisableDeblockingFilterFlag())
     1098  {
     1099    m_cPPS.setDeblockingFilterBetaOffsetDiv2( getLoopFilterBetaOffset() );
     1100    m_cPPS.setDeblockingFilterTcOffsetDiv2( getLoopFilterTcOffset() );
    9541101  }
    9551102  m_cPPS.setLog2ParallelMergeLevelMinus2   (m_log2ParallelMergeLevelMinus2 );
     
    10761223    rps->setInterRPSPrediction(ge.m_interRPSPrediction > 0);  // not very clean, converting anything > 0 to true.
    10771224    rps->setDeltaRIdxMinus1(0);                               // index to the Reference RPS is always the previous one.
    1078     TComReferencePictureSet*     RPSRef = rpsList->getReferencePictureSet(i-1);  // get the reference RPS
     1225    TComReferencePictureSet*     RPSRef = i>0 ? rpsList->getReferencePictureSet(i-1): NULL;  // get the reference RPS
    10791226
    10801227    if (ge.m_interRPSPrediction == 2)  // Automatic generation of the inter RPS idc based on the RIdx provided.
    10811228    {
     1229      assert (RPSRef!=NULL);
    10821230      Int deltaRPS = getGOPEntry(i-1).m_POC - ge.m_POC;  // the ref POC - current POC
    10831231      Int numRefDeltaPOC = RPSRef->getNumberOfPictures();
     
    11081256    else if (ge.m_interRPSPrediction == 1)  // inter RPS idc based on the RefIdc values provided in config file.
    11091257    {
     1258      assert (RPSRef!=NULL);
    11101259      rps->setDeltaRPS(ge.m_deltaRPS);
    11111260      rps->setNumRefIdc(ge.m_numRefIdc);
     
    12661415  }
    12671416
    1268   slice->setRPS(getSPS()->getRPSList()->getReferencePictureSet(slice->getRPSidx()));
     1417  TComReferencePictureSet *rps=slice->getLocalRPS();
     1418  (*rps) = *(slice->getSPS()->getRPSList()->getReferencePictureSet(slice->getRPSidx()));
     1419  slice->setRPS(rps);
    12691420  slice->getRPS()->setNumberOfPictures(slice->getRPS()->getNumberOfNegativePictures()+slice->getRPS()->getNumberOfPositivePictures());
    12701421}
     
    13131464
    13141465  // # substreams is "per tile" when tiles are independent.
    1315   if (m_iWaveFrontSynchro )
    1316   {
    1317     m_cPPS.setNumSubstreams(m_iWaveFrontSubstreams * (m_iNumColumnsMinus1+1));
    1318   }
    1319   else
    1320   {
    1321     m_cPPS.setNumSubstreams((m_iNumRowsMinus1+1) * (m_iNumColumnsMinus1+1));
    1322   }
    13231466}
    13241467
     
    14041547  picHeight   = repFormat->getPicHeightVpsInLumaSamples();
    14051548 
    1406   if(m_layerId > 0)
     1549  if( m_layerId > 0 )
    14071550  {
    14081551    g_bitDepth[CHANNEL_TYPE_LUMA]   = bitDepthY;
     
    14131556    g_uiAddCUDepth  = max (0, m_cSPS.getLog2MinCodingBlockSize() - (Int)m_cSPS.getQuadtreeTULog2MinSize() );
    14141557
    1415     Int  numReorderPics[MAX_TLAYER];
    1416     Window &conformanceWindow = repFormat->getConformanceWindowVps();
    1417     Window defaultDisplayWindow = m_cSPS.getVuiParametersPresentFlag() ? m_cSPS.getVuiParameters()->getDefaultDisplayWindow() : Window();
    1418 
    14191558    if (m_cIlpPic[0] == NULL)
    14201559    {
     
    14221561      {
    14231562        m_cIlpPic[j] = new TComPic;
    1424 #if AUXILIARY_PICTURES
    1425         m_cIlpPic[j]->create(picWidth, picHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, &m_cSPS, true);
    1426 #else
    1427         m_cIlpPic[j]->create(picWidth, picHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, &m_cSPS, true);
    1428 #endif
     1563        m_cIlpPic[j]->create(m_cVPS, m_cSPS, m_cPPS, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, true, m_layerId);
    14291564        for (Int i=0; i<m_cIlpPic[j]->getPicSym()->getNumberOfCtusInFrame(); i++)
    14301565        {
     
    14621597}
    14631598
    1464 Window& TEncTop::getScaledRefLayerWindowForLayer(Int layerId)
    1465 {
    1466   static Window win;
    1467 
     1599Window TEncTop::getScaledRefLayerWindowForLayer(Int layerId)
     1600{
    14681601  for (Int i = 0; i < m_numRefLayerLocationOffsets; i++)
    14691602  {
     
    14741607  }
    14751608
    1476   win.resetWindow();  // scaled reference layer offsets are inferred to be zero when not present
    1477   return win;
    1478 }
    1479 
    1480 Window& TEncTop::getRefLayerWindowForLayer(Int layerId)
    1481 {
    1482   static Window win;
    1483 
     1609  return Window();
     1610}
     1611
     1612Window TEncTop::getRefLayerWindowForLayer(Int layerId)
     1613{
    14841614  for (Int i = 0; i < m_numRefLayerLocationOffsets; i++)
    14851615  {
     
    14901620  }
    14911621
    1492   win.resetWindow();  // reference offsets are inferred to be zero when not present
    1493   return win;
     1622  return Window();
    14941623}
    14951624#endif //SVC_EXTENSION
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.h

    r1226 r1235  
    9393  TEncCu                  m_cCuEncoder;                   ///< CU encoder
    9494  // SPS
    95   TComSPS                 m_cSPS;                         ///< SPS
    96   TComPPS                 m_cPPS;                         ///< PPS
     95  TComSPS                 m_cSPS;                         ///< SPS. This is the base value. This is copied to TComPicSym
     96  TComPPS                 m_cPPS;                         ///< PPS. This is the base value. This is copied to TComPicSym
    9797  // RD cost computation
    9898  TComRdCost              m_cRdCost;                      ///< RD cost computation class
     
    110110  TEncPreanalyzer         m_cPreanalyzer;                 ///< image characteristics analyzer for TM5-step3-like adaptive QP
    111111
    112   TComScalingList         m_scalingList;                 ///< quantization matrix information
    113112  TEncRateCtrl            m_cRateCtrl;                    ///< Rate control class
    114113 
     
    148147protected:
    149148  Void  xGetNewPicBuffer  ( TComPic*& rpcPic );           ///< get picture buffer which will be processed
     149  Void  xInitVPS          ();                             ///< initialize VPS from encoder options
    150150  Void  xInitSPS          ();                             ///< initialize SPS from encoder options
    151151  Void  xInitPPS          ();                             ///< initialize PPS from encoder options
     152  Void  xInitScalingLists();                              ///< initialize scaling lists
    152153
    153154  Void  xInitPPSforTiles  ();
     
    187188  TEncSbac*               getRDGoOnSbacCoder    () { return  &m_cRDGoOnSbacCoder;     }
    188189  TEncRateCtrl*           getRateCtrl           () { return &m_cRateCtrl;             }
    189   TComSPS*                getSPS                () { return  &m_cSPS;                 }
    190   TComPPS*                getPPS                () { return  &m_cPPS;                 }
    191190  Void selectReferencePictureSet(TComSlice* slice, Int POCCurr, Int GOPid );
    192191  Int getReferencePictureSetIdxForSOP(TComSlice* slice, Int POCCurr, Int GOPid );
    193   TComScalingList*        getScalingList        () { return  &m_scalingList;         }
    194192  // -------------------------------------------------------------------------------------------------------------------
    195193  // encoder function
     
    198196  /// encode several number of pictures until end-of-sequence
    199197#if SVC_EXTENSION
     198  TComSPS*  getSPS()                                          { return &m_cSPS;                    }
     199#if CGS_3D_ASYMLUT
     200  TComPPS*  getPPS()                                          { return &m_cPPS;                    }
     201#endif
    200202  Void      setLayerEnc(TEncTop** p)                          { m_ppcTEncTop = p;                  }
    201203  TEncTop** getLayerEnc()                                     { return m_ppcTEncTop;               }
     
    203205  Int       getNumPicRcvd()                                   { return m_iNumPicRcvd;              }
    204206  Void      setNumPicRcvd( Int num )                          { m_iNumPicRcvd = num;               }
    205   Void      setNumRefLayerLocationOffsets(Int x)              { m_numRefLayerLocationOffsets = x;    }
    206   UInt      getNumRefLayerLocationOffsets()                   { return m_numRefLayerLocationOffsets; }
     207  Void      setNumRefLayerLocationOffsets(Int x)              { m_numRefLayerLocationOffsets = x;     }
     208  UInt      getNumRefLayerLocationOffsets()                   { return m_numRefLayerLocationOffsets;  }
    207209  Void      setRefLocationOffsetLayerId(Int x, UInt id)       { m_refLocationOffsetLayerId[x] = id;   }
    208210  UInt      getRefLocationOffsetLayerId(Int x)                { return m_refLocationOffsetLayerId[x]; }
    209   Window&   getScaledRefLayerWindowForLayer(Int layerId);
     211  Window    getScaledRefLayerWindowForLayer(Int layerId);
    210212  Window&   getScaledRefLayerWindow(Int x)                    { return m_scaledRefLayerWindow[x];  }
    211213  Void      setNumRefLayerOffsets(Int x)                      { m_numRefLayerOffsets = x;          }
     
    213215  Void      setRefLayerId(Int layerIdx, UInt layerId)         { m_refLayerId[layerIdx] = layerId;  }
    214216  UInt      getRefLayerId(Int layerIdx)                       { return m_refLayerId[layerIdx];     }
    215   Window&   getRefLayerWindowForLayer(Int layerId);
    216   Window&   getRefLayerWindow(Int x)                          { return m_refLayerWindow[x]; }
     217  Window    getRefLayerWindowForLayer(Int layerId);
     218  Window&   getRefLayerWindow(Int x)                          { return m_refLayerWindow[x];                  }
    217219  Bool      getScaledRefLayerOffsetPresentFlag(Int x)         { return m_scaledRefLayerOffsetPresentFlag[x]; }
    218   Void      setScaledRefLayerOffsetPresentFlag(Int x, Bool b) { m_scaledRefLayerOffsetPresentFlag[x] = b; }
    219   Bool      getRefRegionOffsetPresentFlag(Int x)              { return m_refRegionOffsetPresentFlag[x]; }
    220   Void      setRefRegionOffsetPresentFlag(Int x, Bool b)      { m_refRegionOffsetPresentFlag[x] = b; }
    221   Int       getPhaseHorLuma(Int x)                            { return m_phaseHorLuma[x]; }
    222   Int       getPhaseVerLuma(Int x)                            { return m_phaseVerLuma[x]; }
    223   Int       getPhaseHorChroma(Int x)                          { return m_phaseHorChroma[x]; }
    224   Int       getPhaseVerChroma(Int x)                          { return m_phaseVerChroma[x]; }
    225   Void      setPhaseHorLuma(Int x, Int val)                   { m_phaseHorLuma[x] = val; }
    226   Void      setPhaseVerLuma(Int x, Int val)                   { m_phaseVerLuma[x] = val; }
    227   Void      setPhaseHorChroma(Int x, Int val)                 { m_phaseHorChroma[x] = val; }
    228   Void      setPhaseVerChroma(Int x, Int val)                 { m_phaseVerChroma[x] = val; }
     220  Void      setScaledRefLayerOffsetPresentFlag(Int x, Bool b) { m_scaledRefLayerOffsetPresentFlag[x] = b;    }
     221  Bool      getRefRegionOffsetPresentFlag(Int x)              { return m_refRegionOffsetPresentFlag[x];      }
     222  Void      setRefRegionOffsetPresentFlag(Int x, Bool b)      { m_refRegionOffsetPresentFlag[x] = b;         }
     223  Int       getPhaseHorLuma(Int x)                            { return m_phaseHorLuma[x];           }
     224  Int       getPhaseVerLuma(Int x)                            { return m_phaseVerLuma[x];           }
     225  Int       getPhaseHorChroma(Int x)                          { return m_phaseHorChroma[x];         }
     226  Int       getPhaseVerChroma(Int x)                          { return m_phaseVerChroma[x];         }
     227  Void      setPhaseHorLuma(Int x, Int val)                   { m_phaseHorLuma[x] = val;            }
     228  Void      setPhaseVerLuma(Int x, Int val)                   { m_phaseVerLuma[x] = val;            }
     229  Void      setPhaseHorChroma(Int x, Int val)                 { m_phaseHorChroma[x] = val;          }
     230  Void      setPhaseVerChroma(Int x, Int val)                 { m_phaseVerChroma[x] = val;          }
    229231  Bool      getResamplePhaseSetPresentFlag(Int x)             { return m_resamplePhaseSetPresentFlag[x]; }
    230   Void      setResamplePhaseSetPresentFlag(Int x, Bool b)     { m_resamplePhaseSetPresentFlag[x] = b; }
    231 
    232   TComPic** getIlpList()                                      { return m_cIlpPic; }
    233   Void      setMFMEnabledFlag(Bool flag)                      { m_bMFMEnabledFlag = flag; }
    234   Bool      getMFMEnabledFlag()                               { return m_bMFMEnabledFlag; }   
     232  Void      setResamplePhaseSetPresentFlag(Int x, Bool b)     { m_resamplePhaseSetPresentFlag[x] = b;    }
     233
     234  TComPic** getIlpList()                                      { return m_cIlpPic;                    }
     235  Void      setMFMEnabledFlag(Bool flag)                      { m_bMFMEnabledFlag = flag;            }
     236  Bool      getMFMEnabledFlag()                               { return m_bMFMEnabledFlag;            }   
    235237  Void      setInterLayerWeightedPredFlag(Bool flag)          { m_interLayerWeightedPredFlag = flag; }
    236238  Bool      getInterLayerWeightedPredFlag()                   { return m_interLayerWeightedPredFlag; }
  • branches/SHM-dev/source/Lib/TLibEncoder/WeightPredAnalysis.cpp

    r1202 r1235  
    4747WeightPredAnalysis::WeightPredAnalysis()
    4848{
    49   m_weighted_pred_flag = false;
    50   m_weighted_bipred_flag = false;
    51 
    5249  for ( UInt lst =0 ; lst<NUM_REF_PIC_LIST_01 ; lst++ )
    5350  {
     
    121118}
    122119
    123 
    124 /** store weighted_pred_flag and weighted_bipred_idc values
    125  * \param weighted_pred_flag
    126  * \param weighted_bipred_idc
    127  * \returns Void
    128  */
    129 Void  WeightPredAnalysis::xStoreWPparam(const Bool weighted_pred_flag, const Bool weighted_bipred_flag)
    130 {
    131   m_weighted_pred_flag   = weighted_pred_flag;
    132   m_weighted_bipred_flag = weighted_bipred_flag;
    133 }
    134 
    135 
    136 /** restore weighted_pred_flag and weighted_bipred_idc values
    137  * \param TComSlice *slice
    138  * \returns Void
    139  */
    140 Void  WeightPredAnalysis::xRestoreWPparam(TComSlice *const slice)
    141 {
    142   slice->getPPS()->setUseWP   (m_weighted_pred_flag);
    143   slice->getPPS()->setWPBiPred(m_weighted_bipred_flag);
    144 }
    145 
    146 
    147120/** check weighted pred or non-weighted pred
    148121 * \param TComSlice *slice
     
    168141  if(iPresentCnt==0)
    169142  {
    170     slice->getPPS()->setUseWP(false);
    171     slice->getPPS()->setWPBiPred(false);
     143    slice->setTestWeightPred(false);
     144    slice->setTestWeightBiPred(false);
    172145
    173146    for ( UInt lst=0 ; lst<NUM_REF_PIC_LIST_01 ; lst++ )
     
    188161    slice->setWpScaling( m_wp );
    189162  }
     163  else
     164  {
     165    slice->setTestWeightPred(slice->getPPS()->getUseWP());
     166    slice->setTestWeightBiPred(slice->getPPS()->getWPBiPred());
     167  }
    190168}
    191169
     
    213191  } while (validRangeFlag == false);
    214192
    215   // selecting whether WP is used, or not
     193  // selecting whether WP is used, or not (fast search)
     194  // NOTE: This is not operating on a slice, but the entire picture.
    216195  xSelectWP(slice, iDenom);
    217196
  • branches/SHM-dev/source/Lib/TLibEncoder/WeightPredAnalysis.h

    r1029 r1235  
    4646private:
    4747
    48   // member variables
    49   Bool            m_weighted_pred_flag;
    50   Bool            m_weighted_bipred_flag;
     48  // member variables 
    5149  WPScalingParam  m_wp[NUM_REF_PIC_LIST_01][MAX_NUM_REF][MAX_NUM_COMPONENT];
    5250
     
    7573  Void  xCalcACDCParamSlice  (TComSlice *const slice);
    7674  Void  xEstimateWPParamSlice(TComSlice *const slice);
    77   Void  xStoreWPparam        (const Bool weighted_pred_flag, const Bool weighted_bipred_flag);
    78   Void  xRestoreWPparam      (TComSlice *const slice);
    7975  Void  xCheckWPEnable       (TComSlice *const slice);
    8076};
Note: See TracChangeset for help on using the changeset viewer.