Changeset 494 in SHVCSoftware for trunk/source/Lib/TLibEncoder


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

reintegrate branch SHM-4.0-dev

Location:
trunk
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/source

  • trunk/source/Lib/TLibEncoder/TEncCavlc.cpp

    r442 r494  
    359359  {
    360360    WRITE_FLAG(pcVUI->getTilesFixedStructureFlag(),             "tiles_fixed_structure_flag");
    361 #if M0464_TILE_BOUNDARY_ALIGNED_FLAG
    362     if ( pcSPS->getLayerId() > 0 )
    363     {
    364       WRITE_FLAG( pcVUI->getTileBoundariesAlignedFlag( ) ? 1 : 0 , "tile_boundaries_aligned_flag" );
    365     }
    366 #endif
    367361    WRITE_FLAG(pcVUI->getMotionVectorsOverPicBoundariesFlag(),  "motion_vectors_over_pic_boundaries_flag");
    368362    WRITE_FLAG(pcVUI->getRestrictedRefPicListsFlag(),           "restricted_ref_pic_lists_flag");
     
    454448#endif
    455449  WRITE_CODE( pcSPS->getVPSId (),          4,       "sps_video_parameter_set_id" );
    456 #if SPS_SUB_LAYER_INFO
     450#if SVC_EXTENSION
    457451  if(pcSPS->getLayerId() == 0)
    458452  {
     
    460454    WRITE_CODE( pcSPS->getMaxTLayers() - 1,  3,       "sps_max_sub_layers_minus1" );
    461455    WRITE_FLAG( pcSPS->getTemporalIdNestingFlag() ? 1 : 0,                             "sps_temporal_id_nesting_flag" );
    462 #if SPS_SUB_LAYER_INFO
     456#if SVC_EXTENSION
    463457  }
    464458#endif
     
    670664  WRITE_FLAG( 0, "inter_view_mv_vert_constraint_flag" );
    671665#endif
    672 #if SCALED_REF_LAYER_OFFSETS
    673666  if( pcSPS->getLayerId() > 0 )
    674667  {
     
    683676    }
    684677  }
    685 #endif
    686678#if M0463_VUI_EXT_ILP_REF
    687679  ////   sps_extension_vui_parameters( )
     
    708700Void TEncCavlc::codeVPS( TComVPS* pcVPS )
    709701{
     702#if VPS_EXTN_OFFSET_CALC
     703  UInt numBytesInVps = this->m_pcBitIf->getNumberOfWrittenBits();
     704#endif
    710705  WRITE_CODE( pcVPS->getVPSId(),                    4,        "vps_video_parameter_set_id" );
    711706  WRITE_CODE( 3,                                    2,        "vps_reserved_three_2bits" );
     
    811806      WRITE_FLAG(1,                  "vps_extension_alignment_bit_equal_to_one");
    812807    }
     808#if VPS_EXTN_OFFSET_CALC
     809    Int vpsExntOffsetValueInBits = this->m_pcBitIf->getNumberOfWrittenBits() - numBytesInVps + 16; // 2 bytes for NUH
     810    assert( vpsExntOffsetValueInBits % 8 == 0 );
     811    pcVPS->setExtensionOffset( vpsExntOffsetValueInBits >> 3 );
     812#endif
    813813    codeVPSExtension(pcVPS);
    814814    WRITE_FLAG( 0,                     "vps_extension2_flag" );   // Flag value of 1 reserved
     
    820820}
    821821
     822#if SVC_EXTENSION
    822823#if VPS_EXTNS
    823824Void TEncCavlc::codeVPSExtension (TComVPS *vps)
     
    835836  }
    836837
    837 #if VPS_SPLIT_FLAG
    838838  for(j = 0; j < vps->getNumScalabilityTypes() - vps->getSplittingFlag(); j++)
    839 #else
    840   for(j = 0; j < vps->getNumScalabilityTypes(); j++)
    841 #endif
    842839  {
    843840    WRITE_CODE( vps->getDimensionIdLen(j) - 1, 3,      "dimension_id_len_minus1[j]" );
     
    863860      WRITE_CODE( vps->getLayerIdInNuh(i),     6,      "layer_id_in_nuh[i]" );
    864861    }
    865 #if VPS_SPLIT_FLAG
    866     if(!vps->getSplittingFlag())
    867 #endif
     862
     863    if( !vps->getSplittingFlag() )
     864    {
    868865    for(j = 0; j < vps->getNumScalabilityTypes(); j++)
    869866    {
     
    871868      WRITE_CODE( vps->getDimensionId(i, j),   bits,   "dimension_id[i][j]" );
    872869    }
     870  }
    873871  }
    874872#endif
     
    885883  }
    886884#endif
    887 #if VPS_MOVE_DIR_DEPENDENCY_FLAG
    888885#if VPS_EXTN_DIRECT_REF_LAYERS
    889886  for( Int layerCtr = 1; layerCtr <= vps->getMaxLayers() - 1; layerCtr++)
     
    894891    }
    895892  }
    896 #endif
    897893#endif
    898894#if JCTVC_M0203_INTERLAYER_PRED_IDC
     
    903899     for( i = 0; i < vps->getMaxLayers() - 1; i++)
    904900     {
     901#if O0225_MAX_TID_FOR_REF_LAYERS
     902       for( j = i+1; j <= vps->getMaxLayers() - 1; j++)
     903       {
     904         if(vps->getDirectDependencyFlag(j, i))
     905         {
     906           WRITE_CODE(vps->getMaxTidIlRefPicsPlus1(i,j), 3, "max_tid_il_ref_pics_plus1[i][j]" );
     907         }
     908       }
     909#else
    905910       WRITE_CODE(vps->getMaxTidIlRefPicsPlus1(i), 3, "max_tid_il_ref_pics_plus1[i]" );
     911#endif
    906912     }
    907913   }
     
    909915  for( i = 0; i < vps->getMaxLayers() - 1; i++)
    910916  {
     917#if O0225_MAX_TID_FOR_REF_LAYERS
     918       for( j = i+1; j <= vps->getMaxLayers() - 1; j++)
     919       {
     920         if(vps->getDirectDependencyFlag(j, i))
     921         {
     922           WRITE_CODE(vps->getMaxTidIlRefPicsPlus1(i,j), 3, "max_tid_il_ref_pics_plus1[i][j]" );
     923         }
     924       }
     925#else
    911926    WRITE_CODE(vps->getMaxTidIlRefPicsPlus1(i), 3, "max_tid_il_ref_pics_plus1[i]" );
     927#endif
    912928  }
    913929#endif
     
    918934#if VPS_EXTN_PROFILE_INFO
    919935  // Profile-tier-level signalling
    920 #if VPS_PROFILE_OUTPUT_LAYERS
    921936  WRITE_CODE( vps->getNumLayerSets() - 1   , 10, "vps_number_layer_sets_minus1" );     
    922937  WRITE_CODE( vps->getNumProfileTierLevel() - 1,  6, "vps_num_profile_tier_level_minus1");
    923938  for(Int idx = 1; idx <= vps->getNumProfileTierLevel() - 1; idx++)
    924 #else
    925   for(Int idx = 1; idx <= vps->getNumLayerSets() - 1; idx++)
    926 #endif
    927939  {
    928940    WRITE_FLAG( vps->getProfilePresentFlag(idx),       "vps_profile_present_flag[i]" );
    929941    if( !vps->getProfilePresentFlag(idx) )
    930942    {
    931 #if VPS_PROFILE_OUTPUT_LAYERS
    932943      WRITE_CODE( vps->getProfileLayerSetRef(idx) - 1, 6, "profile_ref_minus1[i]" );
    933 #else
    934       WRITE_UVLC( vps->getProfileLayerSetRef(idx) - 1, "vps_profile_layer_set_ref_minus1[i]" );
    935 #endif
    936944    }
    937945    codePTL( vps->getPTLForExtn(idx), vps->getProfilePresentFlag(idx), vps->getMaxTLayers() - 1 );
     
    939947#endif
    940948
    941 #if VPS_PROFILE_OUTPUT_LAYERS
    942949  Int numOutputLayerSets = vps->getNumOutputLayerSets() ;
    943950  WRITE_FLAG(  (numOutputLayerSets > vps->getNumLayerSets()), "more_output_layer_sets_than_default_flag" );
     
    974981    WRITE_CODE( vps->getProfileLevelTierIdx(i), numBits, "profile_level_tier_idx[i]" );     
    975982  }
    976 #else
    977 #if VPS_EXTN_OP_LAYER_SETS
    978   // Target output layer signalling
    979   WRITE_UVLC( vps->getNumOutputLayerSets(),            "vps_num_output_layer_sets");
    980   for(i = 0; i < vps->getNumOutputLayerSets(); i++)
    981   {
    982 #if VPS_OUTPUT_LAYER_SET_IDX
    983     assert(vps->getOutputLayerSetIdx(i) > 0);
    984     WRITE_UVLC( vps->getOutputLayerSetIdx(i) - 1,           "vps_output_layer_set_idx_minus1[i]");
    985 #else
    986     WRITE_UVLC( vps->getOutputLayerSetIdx(i),           "vps_output_layer_set_idx[i]");
    987 #endif
    988     Int lsIdx = vps->getOutputLayerSetIdx(i);
    989     for(j = 0; j <= vps->getMaxLayerId(); j++)
    990     {
    991       if(vps->getLayerIdIncludedFlag(lsIdx, j))
    992       {
    993         WRITE_FLAG( vps->getOutputLayerFlag(lsIdx, j), "vps_output_layer_flag[lsIdx][j]");
    994       }
    995     }
    996   }
    997 #endif
    998 #endif
    999983
    1000984#if REPN_FORMAT_IN_VPS
     
    10251009#if JCTVC_M0458_INTERLAYER_RPS_SIG
    10261010      WRITE_FLAG(vps->getMaxOneActiveRefLayerFlag(), "max_one_active_ref_layer_flag");
     1011#endif
     1012#if O0062_POC_LSB_NOT_PRESENT_FLAG
     1013  for(i = 1; i< vps->getMaxLayers(); i++)
     1014  {
     1015    if( vps->getNumDirectRefLayers( vps->getLayerIdInNuh(i) ) == 0  )
     1016    {
     1017      WRITE_FLAG(vps->getPocLsbNotPresentFlag(i), "poc_lsb_not_present_flag[i]");
     1018    }
     1019  }
     1020#endif
     1021#if O0215_PHASE_ALIGNMENT
     1022  WRITE_FLAG(vps->getPhaseAlignFlag(), "cross_layer_phase_alignment_flag" );
     1023#endif
     1024#if N0147_IRAP_ALIGN_FLAG && !IRAP_ALIGN_FLAG_IN_VPS_VUI
     1025  WRITE_FLAG(vps->getCrossLayerIrapAlignFlag(), "cross_layer_irap_aligned_flag");
    10271026#endif
    1028 #if N0147_IRAP_ALIGN_FLAG
    1029       WRITE_FLAG(vps->getCrossLayerIrapAlignFlag(), "cross_layer_irap_aligned_flag");
    1030 #endif
    1031 #if !VPS_MOVE_DIR_DEPENDENCY_FLAG
    1032 #if VPS_EXTN_DIRECT_REF_LAYERS
    1033   for( Int layerCtr = 1; layerCtr <= vps->getMaxLayers() - 1; layerCtr++)
    1034   {
    1035     for( Int refLayerCtr = 0; refLayerCtr < layerCtr; refLayerCtr++)
    1036     {
    1037       WRITE_FLAG(vps->getDirectDependencyFlag(layerCtr, refLayerCtr), "direct_dependency_flag[i][j]" );
    1038     }
    1039   }
    1040 #endif
    1041 #endif
    10421027#if VPS_EXTN_DIRECT_REF_LAYERS && M0457_PREDICTION_INDICATIONS
    10431028  WRITE_UVLC( vps->getDirectDepTypeLen()-2,                           "direct_dep_type_len_minus2");
     
    11071092{
    11081093  Int i,j;
     1094#if IRAP_ALIGN_FLAG_IN_VPS_VUI
     1095      WRITE_FLAG(vps->getCrossLayerIrapAlignFlag(), "cross_layer_irap_aligned_flag");
     1096#endif
    11091097#if VPS_VUI_BITRATE_PICRATE
    11101098  WRITE_FLAG( vps->getBitRatePresentVpsFlag(),        "bit_rate_present_vps_flag" );
     
    11731161}
    11741162#endif
     1163#endif //SVC_EXTENSION
    11751164
    11761165Void TEncCavlc::codeSliceHeader         ( TComSlice* pcSlice )
     
    12181207  if ( !pcSlice->getDependentSliceSegmentFlag() )
    12191208  {
    1220 
     1209#if SVC_EXTENSION
    12211210#if POC_RESET_FLAG
    12221211    Int iBits = 0;
     
    12381227    }
    12391228#else
    1240 #if SH_DISCARDABLE_FLAG
    12411229    if (pcSlice->getPPS()->getNumExtraSliceHeaderBits()>0)
    12421230    {
     
    12491237      WRITE_FLAG(0, "slice_reserved_undetermined_flag[]");
    12501238    }
    1251 #else
     1239#endif
     1240#else //SVC_EXTENSION
    12521241    for (Int i = 0; i < pcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++)
    12531242    {
     
    12551244      WRITE_FLAG(0, "slice_reserved_undetermined_flag[]");
    12561245    }
    1257 #endif
    1258 #endif
     1246#endif //SVC_EXTENSION
    12591247
    12601248    WRITE_UVLC( pcSlice->getSliceType(),       "slice_type" );
     
    12651253    }
    12661254
     1255#if !AUXILIARY_PICTURES
    12671256#if REPN_FORMAT_IN_VPS
    12681257    // in the first version chroma_format_idc is equal to one, thus colour_plane_id will not be present
     
    12721261    assert (pcSlice->getSPS()->getChromaFormatIdc() == 1 );
    12731262#endif
     1263#endif
    12741264    // if( separate_colour_plane_flag  ==  1 )
    12751265    //   colour_plane_id                                      u(2)
    12761266
    12771267#if N0065_LAYER_POC_ALIGNMENT
     1268#if O0062_POC_LSB_NOT_PRESENT_FLAG
     1269    if( (pcSlice->getLayerId() > 0 && !pcSlice->getVPS()->getPocLsbNotPresentFlag( pcSlice->getVPS()->getLayerIdInVps(pcSlice->getLayerId())) ) || !pcSlice->getIdrPicFlag())
     1270#else
    12781271    if( pcSlice->getLayerId() > 0 || !pcSlice->getIdrPicFlag() )
     1272#endif
    12791273#else
    12801274    if( !pcSlice->getIdrPicFlag() )
     
    12971291
    12981292#if N0065_LAYER_POC_ALIGNMENT
     1293#if SHM_FIX7
     1294    }
     1295#endif
    12991296      if( !pcSlice->getIdrPicFlag() )
    13001297      {
     
    14141411        WRITE_FLAG( pcSlice->getEnableTMVPFlag() ? 1 : 0, "slice_temporal_mvp_enable_flag" );
    14151412      }
    1416 #if N0065_LAYER_POC_ALIGNMENT
     1413#if N0065_LAYER_POC_ALIGNMENT && !SHM_FIX7
    14171414      }
    14181415#endif
     
    14211418#if JCTVC_M0458_INTERLAYER_RPS_SIG
    14221419#if ILP_SSH_SIG
     1420#if ILP_SSH_SIG_FIX
     1421    if((pcSlice->getSPS()->getLayerId() > 0) && !(pcSlice->getVPS()->getIlpSshSignalingEnabledFlag()) && (pcSlice->getNumILRRefIdx() > 0) )
     1422#else
    14231423    if((pcSlice->getSPS()->getLayerId() > 0) && pcSlice->getVPS()->getIlpSshSignalingEnabledFlag() && (pcSlice->getNumILRRefIdx() > 0) )
     1424#endif
    14241425#else
    14251426    if((pcSlice->getSPS()->getLayerId() > 0)  &&  (pcSlice->getNumILRRefIdx() > 0) )
     
    14681469         WRITE_FLAG( pcSlice->getSaoEnabledFlag(), "slice_sao_luma_flag" );
    14691470         {
     1471#if AUXILIARY_PICTURES
     1472           if (pcSlice->getChromaFormatIdc() != CHROMA_400)
     1473           {
     1474#endif
    14701475           SAOParam *saoParam = pcSlice->getPic()->getPicSym()->getSaoParam();
    14711476          WRITE_FLAG( saoParam->bSaoFlag[1], "slice_sao_chroma_flag" );
     1477#if AUXILIARY_PICTURES
     1478           }
     1479#endif
    14721480         }
    14731481      }
     
    19341942  UInt            uiMode = 0;
    19351943  UInt            uiTotalSignalledWeightFlags = 0;
     1944#if AUXILIARY_PICTURES
     1945  if (pcSlice->getChromaFormatIdc() == CHROMA_400)
     1946  {
     1947    bChroma = false;
     1948  }
     1949#endif
    19361950  if ( (pcSlice->getSliceType()==P_SLICE && pcSlice->getPPS()->getUseWP()) || (pcSlice->getSliceType()==B_SLICE && pcSlice->getPPS()->getWPBiPred()) )
    19371951  {
  • trunk/source/Lib/TLibEncoder/TEncCfg.h

    r442 r494  
    6969  Int m_numRefIdc;
    7070  Int m_refIdc[MAX_NUM_REF_PICS+1];
    71 #if EXTERNAL_USEDBYCURR_N0082
    72   Int m_UseExtusedByCurrPic;
    73   Int m_ExtusedByCurrPic[MAX_NUM_REF_PICS];
    74 #endif
    7571  GOPEntry()
    7672  : m_POC(-1)
     
    8783  , m_deltaRPS(0)
    8884  , m_numRefIdc(0)
    89 #if EXTERNAL_USEDBYCURR_N0082
    90   , m_UseExtusedByCurrPic(0)
    91 #endif
    9285  {
    9386    ::memset( m_referencePics, 0, sizeof(m_referencePics) );
    9487    ::memset( m_usedByCurrPic, 0, sizeof(m_usedByCurrPic) );
    9588    ::memset( m_refIdc,        0, sizeof(m_refIdc) );
    96 #if EXTERNAL_USEDBYCURR_N0082
    97     ::memset( m_usedByCurrPic, 0, sizeof(m_ExtusedByCurrPic) );
    98 #endif
    9989  }
    10090};
     
    221211  Int       m_chromaCbQpOffset;                 //  Chroma Cb QP Offset (0:default)
    222212  Int       m_chromaCrQpOffset;                 //  Chroma Cr Qp Offset (0:default)
     213#if AUXILIARY_PICTURES
     214  ChromaFormat m_chromaFormatIDC;
     215#endif
    223216
    224217#if ADAPTIVE_QP_SELECTION
     
    941934  Int       getAdaptiveResolutionChange()      { return m_adaptiveResolutionChange; }
    942935#endif
     936#if AUXILIARY_PICTURES
     937  Void         setChromaFormatIDC(ChromaFormat x) { m_chromaFormatIDC = x;    }
     938  ChromaFormat getChromaFormatIDC()               { return m_chromaFormatIDC; }
     939#endif
    943940#endif
    944941};
  • trunk/source/Lib/TLibEncoder/TEncCu.cpp

    r442 r494  
    250250#endif
    251251
     252#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     253  m_disableILP = xCheckTileSetConstraint(rpcCU);
     254  m_pcPredSearch->setDisableILP(m_disableILP);
     255#endif
     256
    252257  // analysis of CU
    253258  xCompressCU( m_ppcBestCU[0], m_ppcTempCU[0], 0 );
     
    261266    }
    262267  }
     268#endif
     269
     270#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     271  xVerifyTileSetConstraint(rpcCU);
    263272#endif
    264273}
     
    731740        }
    732741#if (ENCODER_FAST_MODE)
     742#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     743      if(pcPic->getLayerId() > 0 && !m_disableILP)
     744#else
    733745      if(pcPic->getLayerId() > 0)
     746#endif
    734747      {
    735748        for(Int refLayer = 0; refLayer < pcSlice->getActiveNumILRRefIdx(); refLayer++)
     
    13811394      Bool bZeroMVILR = rpcTempCU->xCheckZeroMVILRMerge(uhInterDirNeighbours[uiMergeCand], cMvFieldNeighbours[0 + 2*uiMergeCand], cMvFieldNeighbours[1 + 2*uiMergeCand]);
    13821395      if(bZeroMVILR)
     1396      {
     1397#endif
     1398#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     1399      if (!(rpcTempCU->isInterLayerReference(uhInterDirNeighbours[uiMergeCand], cMvFieldNeighbours[0 + 2*uiMergeCand], cMvFieldNeighbours[1 + 2*uiMergeCand]) && m_disableILP))
    13831400      {
    13841401#endif
     
    14261443          }
    14271444        }
     1445      }
     1446#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     1447      }
     1448#endif
    14281449#if REF_IDX_ME_ZEROMV
    1429         }
    1430 #endif
    1431       }
     1450      }
     1451#endif
    14321452  }
    14331453
     
    18081828}
    18091829
     1830#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     1831Bool TEncCu::xCheckTileSetConstraint( TComDataCU*& rpcCU )
     1832{
     1833  Bool disableILP = false;
     1834
     1835  if (rpcCU->getLayerId() == (m_pcEncCfg->getNumLayer() - 1)  && m_pcEncCfg->getInterLayerConstrainedTileSetsSEIEnabled() && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(rpcCU->getAddr()) >= 0)
     1836  {
     1837    if (rpcCU->getPic()->getPicSym()->getTileSetType(rpcCU->getAddr()) == 2)
     1838    {
     1839      disableILP = true;
     1840    }
     1841    if (rpcCU->getPic()->getPicSym()->getTileSetType(rpcCU->getAddr()) == 1)
     1842    {
     1843      Int currCUaddr = rpcCU->getAddr();
     1844      Int frameWitdhInCU  = rpcCU->getPic()->getPicSym()->getFrameWidthInCU();
     1845      Int frameHeightInCU = rpcCU->getPic()->getPicSym()->getFrameHeightInCU();
     1846      Bool leftCUExists   = (currCUaddr % frameWitdhInCU) > 0;
     1847      Bool aboveCUExists  = (currCUaddr / frameWitdhInCU) > 0;
     1848      Bool rightCUExists  = (currCUaddr % frameWitdhInCU) < (frameWitdhInCU - 1);
     1849      Bool belowCUExists  = (currCUaddr / frameWitdhInCU) < (frameHeightInCU - 1);
     1850      Int currTileSetIdx  = rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr);
     1851      // Check if CU is at tile set boundary
     1852      if ( (leftCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr-1) != currTileSetIdx) ||
     1853           (leftCUExists && aboveCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr-frameWitdhInCU-1) != currTileSetIdx) ||
     1854           (aboveCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr-frameWitdhInCU) != currTileSetIdx) ||
     1855           (aboveCUExists && rightCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr-frameWitdhInCU+1) != currTileSetIdx) ||
     1856           (rightCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr+1) != currTileSetIdx) ||
     1857           (rightCUExists && belowCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr+frameWitdhInCU+1) != currTileSetIdx) ||
     1858           (belowCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr+frameWitdhInCU) != currTileSetIdx) ||
     1859           (belowCUExists && leftCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr+frameWitdhInCU-1) != currTileSetIdx) )
     1860      {
     1861        disableILP = true;  // Disable ILP in tile set boundary CU
     1862      }
     1863    }
     1864  }
     1865
     1866  return disableILP;
     1867}
     1868
     1869Void TEncCu::xVerifyTileSetConstraint( TComDataCU*& rpcCU )
     1870{
     1871  if (rpcCU->getLayerId() == (m_pcEncCfg->getNumLayer() - 1)  && m_pcEncCfg->getInterLayerConstrainedTileSetsSEIEnabled() && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(rpcCU->getAddr()) >= 0 &&
     1872      m_disableILP)
     1873  {
     1874    UInt numPartitions = rpcCU->getPic()->getNumPartInCU();
     1875    for (UInt i = 0; i < numPartitions; i++)
     1876    {
     1877      if (!rpcCU->isIntra(i))
     1878      {
     1879        for (UInt refList = 0; refList < 2; refList++)
     1880        {
     1881          if (rpcCU->getInterDir(i) & (1<<refList))
     1882          {
     1883            TComCUMvField *mvField = rpcCU->getCUMvField(RefPicList(refList));
     1884            if (mvField->getRefIdx(i) >= 0)
     1885            {
     1886              assert(!(rpcCU->getSlice()->getRefPic(RefPicList(refList), mvField->getRefIdx(i))->isILR(rpcCU->getLayerId())));
     1887            }
     1888          }
     1889        }
     1890      }
     1891    }
     1892  }
     1893}
     1894#endif
     1895
    18101896/** Collect ARL statistics from one LCU
    18111897 * \param pcCU
  • trunk/source/Lib/TLibEncoder/TEncCu.h

    r345 r494  
    108108  Int                     m_temporalSAD;
    109109#endif
     110#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     111  Bool                    m_disableILP;
     112#endif
    110113public:
    111114  /// copy parameters from encoder class
     
    171174#endif
    172175
     176#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     177  Bool xCheckTileSetConstraint( TComDataCU*& rpcCU );
     178  Void xVerifyTileSetConstraint( TComDataCU*& rpcCU );
     179#endif
     180
    173181#if AMP_ENC_SPEEDUP
    174182#if AMP_MRG
  • trunk/source/Lib/TLibEncoder/TEncEntropy.cpp

    r345 r494  
    280280  const UInt uiTrDepthCurr = uiDepth - pcCU->getDepth( uiAbsPartIdx );
    281281  const Bool bFirstCbfOfCU = uiTrDepthCurr == 0;
     282#if AUXILIARY_PICTURES
     283  if (pcCU->getSlice()->getChromaFormatIdc() != CHROMA_400)
     284  {
     285#endif
    282286  if( bFirstCbfOfCU || uiLog2TrafoSize > 2 )
    283287  {
     
    296300    assert( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepthCurr ) == pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepthCurr - 1 ) );
    297301  }
     302#if AUXILIARY_PICTURES
     303  }
     304  else
     305  {
     306    assert( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepthCurr ) == 0 );
     307    assert( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepthCurr ) == 0 );
     308  }
     309#endif
    298310 
    299311  if( uiSubdiv )
     
    402414Void TEncEntropy::encodeIntraDirModeChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
    403415{
     416#if AUXILIARY_PICTURES
     417  if ( pcCU->getSlice()->getChromaFormatIdc() == CHROMA_400 )
     418  {
     419    return;
     420  }
     421#endif
    404422  if( bRD )
    405423  {
  • trunk/source/Lib/TLibEncoder/TEncGOP.cpp

    r442 r494  
    753753    pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR));
    754754#if SVC_EXTENSION
    755 #if ILR_RESTR && ILR_RESTR_FIX
     755    if (m_layerId > 0)
     756    {
    756757    Int interLayerPredLayerIdcTmp[MAX_VPS_LAYER_ID_PLUS1];
    757758    Int activeNumILRRefIdxTmp = 0;
    758 #endif
    759     if (m_layerId > 0)
    760     {
     759
    761760      for( Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ )
    762761      {
     
    769768        pcSlice->setBaseColPic( *cListPic, refLayerIdc );
    770769
    771 #if ILR_RESTR && ILR_RESTR_FIX
    772770        // Apply temporal layer restriction to inter-layer prediction
     771#if O0225_MAX_TID_FOR_REF_LAYERS
     772        Int maxTidIlRefPicsPlus1 = m_pcEncTop->getVPS()->getMaxTidIlRefPicsPlus1(pcSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getLayerId(),m_layerId);
     773#else
    773774        Int maxTidIlRefPicsPlus1 = m_pcEncTop->getVPS()->getMaxTidIlRefPicsPlus1(pcSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getLayerId());
     775#endif
    774776        if( ((Int)(pcSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getTLayer())<=maxTidIlRefPicsPlus1-1) || (maxTidIlRefPicsPlus1==0 && pcSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getRapPicFlag()) )
    775777        {
     
    780782          continue; // ILP is not valid due to temporal layer restriction
    781783        }
    782 #endif
    783 
    784 #if SCALED_REF_LAYER_OFFSETS
     784
    785785        const Window &scalEL = m_pcEncTop->getScaledRefLayerWindow(refLayerIdc);
    786786
     
    790790        Int widthEL   = pcPic->getPicYuvRec()->getWidth()  - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset();
    791791        Int heightEL  = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset()  - scalEL.getWindowBottomOffset();
    792 #else
    793         const Window &confBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getConformanceWindow();
    794         const Window &confEL = pcPic->getPicYuvRec()->getConformanceWindow();
    795 
    796         Int widthBL   = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();
    797         Int heightBL  = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();
    798 
    799         Int widthEL   = pcPic->getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset();
    800         Int heightEL  = pcPic->getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset();
    801 #endif
     792
    802793        g_mvScalingFactor[refLayerIdc][0] = widthEL  == widthBL  ? 4096 : Clip3(-4096, 4095, ((widthEL  << 8) + (widthBL  >> 1)) / widthBL);
    803794        g_mvScalingFactor[refLayerIdc][1] = heightEL == heightBL ? 4096 : Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL);
     
    809800        if( pcPic->isSpatialEnhLayer(refLayerIdc))
    810801        {
    811 #if SCALED_REF_LAYER_OFFSETS
     802#if O0215_PHASE_ALIGNMENT
     803#if O0194_JOINT_US_BITSHIFT
     804          m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc), pcSlice->getVPS()->getPhaseAlignFlag() );
     805#else
     806          m_pcPredSearch->upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc), pcSlice->getVPS()->getPhaseAlignFlag() );
     807#endif
     808#else
     809#if O0194_JOINT_US_BITSHIFT
     810          m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc) );
     811#else
    812812          m_pcPredSearch->upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc) );
    813 #else
    814           m_pcPredSearch->upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec() );
     813#endif
    815814#endif
    816815        }
     
    823822      }
    824823
    825 #if ILR_RESTR && ILR_RESTR_FIX
    826824      // Update the list of active inter-layer pictures
    827825      for ( Int i = 0; i < activeNumILRRefIdxTmp; i++)
     
    835833        pcSlice->setInterLayerPredEnabledFlag(false);
    836834      }
    837 #endif
    838835     
    839836      if( pocCurr % m_pcCfg->getIntraPeriod() == 0 )
     
    11671164    if( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() )
    11681165    {
    1169       m_pcEncTop->setILRPic(pcPic);
     1166      pcSlice->setILRPic( m_pcEncTop->getIlpList() );
    11701167#if REF_IDX_MFM
    11711168#if M0457_COL_PICTURE_SIGNALING
     
    12011198        UInt ColFromL0Flag = pcSlice->getColFromL0Flag();
    12021199        UInt ColRefIdx     = pcSlice->getColRefIdx();
     1200
    12031201        for(Int colIdx = 0; colIdx < pcSlice->getNumRefIdx( RefPicList(1 - ColFromL0Flag) ); colIdx++)
    12041202        {
    1205           if( pcSlice->getRefPic( RefPicList(1 - ColFromL0Flag), colIdx)->isILR(m_layerId) )
     1203          if( pcSlice->getRefPic( RefPicList(1 - ColFromL0Flag), colIdx)->isILR(m_layerId)
     1204#if MFM_ENCCONSTRAINT
     1205            && pcSlice->getBaseColPic( *m_ppcTEncTop[pcSlice->getRefPic( RefPicList(1 - ColFromL0Flag), colIdx)->getLayerId()]->getListPic() )->checkSameRefInfo() == true
     1206#endif
     1207            )
    12061208          {
    12071209            ColRefIdx = colIdx;
     
    12161218          for(Int colIdx = 0; colIdx < pcSlice->getNumRefIdx( RefPicList(1 - ColFromL0Flag) ); colIdx++)
    12171219          {
    1218             if( pcSlice->getRefPic( RefPicList(1 - ColFromL0Flag), colIdx)->isILR(m_layerId) )
     1220            if( pcSlice->getRefPic( RefPicList(1 - ColFromL0Flag), colIdx)->isILR(m_layerId)
     1221#if MFM_ENCCONSTRAINT
     1222              && pcSlice->getBaseColPic( *m_ppcTEncTop[pcSlice->getRefPic( RefPicList(1 - ColFromL0Flag), colIdx)->getLayerId()]->getListPic() )->checkSameRefInfo() == true
     1223#endif
     1224              )
    12191225            {
    12201226              ColRefIdx = colIdx;
     
    15671573    {
    15681574      pcPic->getPicYuvOrg()->copyToPic( pcPic->getPicYuvRec() );
     1575#if O0194_WEIGHTED_PREDICTION_CGS
     1576      // Calculate for the base layer to be used in EL as Inter layer reference
     1577      m_pcSliceEncoder->estimateILWpParam( pcSlice );
     1578#endif
    15691579#if AVC_SYNTAX
    15701580      pcPic->readBLSyntax( m_ppcTEncTop[0]->getBLSyntaxFile(), SYNTAX_BYTES );
     
    16071617          pcSlice->setSliceSegmentCurStartCUAddr  ( startCUAddrSlice      );
    16081618          pcSlice->setSliceBits(0);
     1619#if SVC_EXTENSION
     1620          // copy reference list modification info from the first slice, assuming that this information is the same across all slices in the picture
     1621          memcpy( pcSlice->getRefPicListModification(), pcPic->getSlice(0)->getRefPicListModification(), sizeof(TComRefPicListModification) );
     1622#endif
    16091623          uiNumSlices ++;
    16101624        }
     
    16891703#else
    16901704      OutputNALUnit nalu(NAL_UNIT_VPS);
     1705#endif
     1706#if VPS_EXTN_OFFSET_CALC
     1707      OutputNALUnit tempNalu(NAL_UNIT_VPS, 0, 0        ); // The value of nuh_layer_id of VPS NAL unit shall be equal to 0.
     1708      m_pcEntropyCoder->setBitstream(&tempNalu.m_Bitstream);
     1709      m_pcEntropyCoder->encodeVPS(m_pcEncTop->getVPS());  // Use to calculate the VPS extension offset
    16911710#endif
    16921711      m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     
    31623181 
    31633182  TComPicYuv* pcOrgInterlaced = new TComPicYuv;
     3183#if AUXILIARY_PICTURES
     3184  pcOrgInterlaced->create( iWidth, iHeight << 1, pcPicOrgTop->getChromaFormat(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
     3185#else
    31643186  pcOrgInterlaced->create( iWidth, iHeight << 1, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
     3187#endif
    31653188 
    31663189  TComPicYuv* pcRecInterlaced = new TComPicYuv;
     3190#if AUXILIARY_PICTURES
     3191  pcRecInterlaced->create( iWidth, iHeight << 1, pcPicOrgTop->getChromaFormat(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
     3192#else
    31673193  pcRecInterlaced->create( iWidth, iHeight << 1, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
     3194#endif
    31683195 
    31693196  Pel* pOrgInterlaced = pcOrgInterlaced->getLumaAddr();
  • trunk/source/Lib/TLibEncoder/TEncPic.cpp

    r313 r494  
    126126 * \return Void
    127127 */
     128#if AUXILIARY_PICTURES
     129#if SVC_UPSAMPLING
     130Void 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 )
     132
     133#else
     134
     135Void TEncPic::create( Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth,
     136                      Window &conformanceWindow, Window &defaultDisplayWindow, Int *numReorderPics, Bool bIsVirtual )
     137#endif
     138{
     139#if SVC_UPSAMPLING
     140  TComPic::create( iWidth, iHeight, chromaFormat, uiMaxWidth, uiMaxHeight, uiMaxDepth, 
     141                   conformanceWindow, defaultDisplayWindow, numReorderPics, pcSps, bIsVirtual );
     142#else
     143  TComPic::create( iWidth, iHeight, chromaFormat, uiMaxWidth, uiMaxHeight, uiMaxDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, bIsVirtual );
     144#endif
     145  m_uiMaxAQDepth = uiMaxAQDepth;
     146  if ( uiMaxAQDepth > 0 )
     147  {
     148    m_acAQLayer = new TEncPicQPAdaptationLayer[ m_uiMaxAQDepth ];
     149    for (UInt d = 0; d < m_uiMaxAQDepth; d++)
     150    {
     151      m_acAQLayer[d].create( iWidth, iHeight, uiMaxWidth>>d, uiMaxHeight>>d );
     152    }
     153  }
     154}
     155#else
    128156#if SVC_UPSAMPLING
    129157Void TEncPic::create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth, 
     
    152180  }
    153181}
     182#endif
    154183
    155184/** Clean up
  • trunk/source/Lib/TLibEncoder/TEncPic.h

    r313 r494  
    105105  virtual ~TEncPic();
    106106
     107#if AUXILIARY_PICTURES
     108#if SVC_UPSAMPLING
     109  Void          create( Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth, 
     110                      Window &conformanceWindow, Window &defaultDisplayWindow, Int *numReorderPics, TComSPS* pcSps, Bool bIsVirtual=false );
     111#else
     112  Void          create( Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth,
     113                          Window &conformanceWindow, Window &defaultDisplayWindow, Int *numReorderPics, Bool bIsVirtual = false );
     114
     115#endif
     116#else
    107117#if SVC_UPSAMPLING
    108118  Void          create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth,   
     
    111121  Void          create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth,   
    112122                        Window &conformanceWindow, Window &defaultDisplayWindow, Int *numReorderPics, Bool bIsVirtual = false );
     123#endif
    113124#endif
    114125  virtual Void  destroy();
  • trunk/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp

    r313 r494  
    18711871
    18721872  saoParam->bSaoFlag[0] = true;
     1873#if AUXILIARY_PICTURES
     1874  saoParam->bSaoFlag[1] = m_pcPic->getChromaFormat() == CHROMA_400 ? false : true;
     1875#else
    18731876  saoParam->bSaoFlag[1] = true;
     1877#endif
    18741878  saoParam->oneUnitFlag[0] = false;
    18751879  saoParam->oneUnitFlag[1] = false;
  • trunk/source/Lib/TLibEncoder/TEncSbac.cpp

    r442 r494  
    914914    }
    915915
     916#if AUXILIARY_PICTURES
     917    if (pcCU->getSlice()->getChromaFormatIdc() != CHROMA_400)
     918    {
     919#endif
    916920    piPCMSample = pcCU->getPCMSampleCb() + uiChromaOffset;
    917921    uiWidth = pcCU->getWidth(uiAbsPartIdx)/2;
     
    945949      piPCMSample += uiWidth;
    946950    }
     951#if AUXILIARY_PICTURES
     952    }
     953#endif
    947954    m_pcBinIf->resetBac();
    948955  }
  • trunk/source/Lib/TLibEncoder/TEncSearch.cpp

    r442 r494  
    30923092    {
    30933093#endif
     3094#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     3095    if (!(pcCU->isInterLayerReference(uhInterDirNeighbours[uiMergeCand], cMvFieldNeighbours[0 + 2*uiMergeCand], cMvFieldNeighbours[1 + 2*uiMergeCand]) && m_disableILP))
     3096    {
     3097#endif
    30943098      UInt uiCostCand = MAX_UINT;
    30953099      UInt uiBitsCand = 0;
     
    31153119        uiMergeIndex = uiMergeCand;
    31163120      }
     3121#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     3122    }
     3123#endif
    31173124#if REF_IDX_ME_ZEROMV
    31183125    }
     
    32213228  Int numValidMergeCand = 0 ;
    32223229
    3223 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI
    3224   Bool disableILP = false;
    3225   if (pcCU->getPic()->getLayerId() == (m_pcEncCfg->getNumLayer() - 1)  && m_pcEncCfg->getInterLayerConstrainedTileSetsSEIEnabled() && pcCU->getPic()->getPicSym()->getTileSetIdxMap(pcCU->getAddr()) >= 0)
    3226   {
    3227     if (pcCU->getPic()->getPicSym()->getTileSetType(pcCU->getAddr()) == 2)
    3228     {
    3229       disableILP = true;
    3230     }
    3231     if (pcCU->getPic()->getPicSym()->getTileSetType(pcCU->getAddr()) == 1)
    3232     {
    3233       Int currCUaddr = pcCU->getAddr();
    3234       Int frameWitdhInCU  = pcCU->getPic()->getPicSym()->getFrameWidthInCU();
    3235       Int frameHeightInCU = pcCU->getPic()->getPicSym()->getFrameHeightInCU();
    3236       Bool leftCUExists   = (currCUaddr % frameWitdhInCU) > 0;
    3237       Bool aboveCUExists  = (currCUaddr / frameWitdhInCU) > 0;
    3238       Bool rightCUExists  = (currCUaddr % frameWitdhInCU) < (frameWitdhInCU - 1);
    3239       Bool belowCUExists  = (currCUaddr / frameWitdhInCU) < (frameHeightInCU - 1);
    3240       Int currTileSetIdx  = pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr);
    3241       // Check if CU is at tile set boundary
    3242       if ( (leftCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr-1) != currTileSetIdx) ||
    3243            (leftCUExists && aboveCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr-frameWitdhInCU-1) != currTileSetIdx) ||
    3244            (aboveCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr-frameWitdhInCU) != currTileSetIdx) ||
    3245            (aboveCUExists && rightCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr-frameWitdhInCU+1) != currTileSetIdx) ||
    3246            (rightCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr+1) != currTileSetIdx) ||
    3247            (rightCUExists && belowCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr+frameWitdhInCU+1) != currTileSetIdx) ||
    3248            (belowCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr+frameWitdhInCU) != currTileSetIdx) ||
    3249            (belowCUExists && leftCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr+frameWitdhInCU-1) != currTileSetIdx) )
    3250       {
    3251         disableILP = true;  // Disable ILP in tile set boundary CU
    3252       }
    3253     }
    3254   }
    3255 #endif
    3256 
    32573230  for ( Int iPartIdx = 0; iPartIdx < iNumPart; iPartIdx++ )
    32583231  {
     
    33053278      {
    33063279#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
    3307         if (pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxTemp )->isILR(pcCU->getLayerId()) && disableILP)
     3280        if (pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxTemp )->isILR(pcCU->getLayerId()) && m_disableILP)
    33083281        {
    33093282          continue;
     
    35293502        }
    35303503#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
    3531         if (pcPic->isILR(pcCU->getLayerId()) && disableILP)
     3504        if (pcPic->isILR(pcCU->getLayerId()) && m_disableILP)
    35323505        {
    35333506          testIter = false;
     
    35503523          }
    35513524#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
    3552           if (pcPic->isILR(pcCU->getLayerId()) && disableILP)
     3525          if (pcPic->isILR(pcCU->getLayerId()) && m_disableILP)
    35533526          {
    35543527            testRefIdx = false;
     
    41194092
    41204093  // prediction pattern
     4094#if O0194_WEIGHTED_PREDICTION_CGS
     4095  // Bug Fix (It did not check WP for BSlices)
     4096  if ( pcCU->getSlice()->getPPS()->getUseWP())
     4097#else
    41214098  if ( pcCU->getSlice()->getPPS()->getUseWP() && pcCU->getSlice()->getSliceType()==P_SLICE )
     4099#endif
    41224100  {
    41234101    xPredInterLumaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, true );
     
    41284106  }
    41294107
     4108#if O0194_WEIGHTED_PREDICTION_CGS
     4109  if ( pcCU->getSlice()->getPPS()->getUseWP())
     4110  ///< Bug Fix (It did not check WP for BSlices)
     4111#else
    41304112  if ( pcCU->getSlice()->getPPS()->getUseWP() && pcCU->getSlice()->getSliceType()==P_SLICE )
     4113#endif
    41314114  {
    41324115    xWeightedPredictionUni( pcCU, pcTemplateCand, uiPartAddr, iSizeX, iSizeY, eRefPicList, pcTemplateCand, iRefIdx );
  • trunk/source/Lib/TLibEncoder/TEncSearch.h

    r345 r494  
    129129  // UInt            m_auiMVPIdxCost[AMVP_MAX_NUM_CANDS+1][AMVP_MAX_NUM_CANDS];
    130130  UInt            m_auiMVPIdxCost[AMVP_MAX_NUM_CANDS+1][AMVP_MAX_NUM_CANDS+1]; //th array bounds
    131  
     131
     132#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     133  Bool            m_disableILP;
     134#endif
     135
    132136public:
    133137  TEncSearch();
     
    220224  Void xEncPCM    (TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piOrg, Pel* piPCM, Pel* piPred, Pel* piResi, Pel* piReco, UInt uiStride, UInt uiWidth, UInt uiHeight, TextType eText);
    221225  Void IPCMSearch (TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv );
     226
     227#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     228  Void setDisableILP(Bool a) {m_disableILP = a;}
     229#endif
     230
    222231protected:
    223232 
  • trunk/source/Lib/TLibEncoder/TEncSlice.cpp

    r442 r494  
    22 * License, included below. This software may be subject to other third party
    33 * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license. 
     4 * granted under this license.
    55 *
    66 * Copyright (c) 2010-2013, ITU/ISO/IEC
     
    5151  m_apcPicYuvPred = NULL;
    5252  m_apcPicYuvResi = NULL;
    53  
     53
    5454  m_pdRdPicLambda = NULL;
    5555  m_pdRdPicQp     = NULL;
     
    6969}
    7070
    71 Void TEncSlice::initCtxMem(  UInt i )               
    72 {   
     71Void TEncSlice::initCtxMem(  UInt i )
     72{
    7373  for (std::vector<TEncSbac*>::iterator j = CTXMem.begin(); j != CTXMem.end(); j++)
    7474  {
    7575    delete (*j);
    7676  }
    77   CTXMem.clear(); 
    78   CTXMem.resize(i); 
     77  CTXMem.clear();
     78  CTXMem.resize(i);
    7979}
    8080
     81#if AUXILIARY_PICTURES
     82Void TEncSlice::create( Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt iMaxCUWidth, UInt iMaxCUHeight, UChar uhTotalDepth )
     83{
     84  // create prediction picture
     85  if ( m_apcPicYuvPred == NULL )
     86  {
     87    m_apcPicYuvPred  = new TComPicYuv;
     88    m_apcPicYuvPred->create( iWidth, iHeight, chromaFormat, iMaxCUWidth, iMaxCUHeight, uhTotalDepth );
     89  }
     90
     91  // create residual picture
     92  if( m_apcPicYuvResi == NULL )
     93  {
     94    m_apcPicYuvResi  = new TComPicYuv;
     95    m_apcPicYuvResi->create( iWidth, iHeight, chromaFormat, iMaxCUWidth, iMaxCUHeight, uhTotalDepth );
     96  }
     97}
     98#else
    8199Void TEncSlice::create( Int iWidth, Int iHeight, UInt iMaxCUWidth, UInt iMaxCUHeight, UChar uhTotalDepth )
    82100{
     
    87105    m_apcPicYuvPred->create( iWidth, iHeight, iMaxCUWidth, iMaxCUHeight, uhTotalDepth );
    88106  }
    89  
     107
    90108  // create residual picture
    91109  if( m_apcPicYuvResi == NULL )
     
    95113  }
    96114}
     115#endif
    97116
    98117Void TEncSlice::destroy()
     
    105124    m_apcPicYuvPred  = NULL;
    106125  }
    107  
     126
    108127  // destroy residual picture
    109128  if ( m_apcPicYuvResi )
     
    113132    m_apcPicYuvResi  = NULL;
    114133  }
    115  
     134
    116135  // free lambda and QP arrays
    117136  if ( m_pdRdPicLambda ) { xFree( m_pdRdPicLambda ); m_pdRdPicLambda = NULL; }
     
    139158#if SVC_EXTENSION
    140159  m_ppcTEncTop        = pcEncTop->getLayerEnc();
    141 #endif 
     160#endif
    142161  m_pcGOPEncoder      = pcEncTop->getGOPEncoder();
    143162  m_pcCuEncoder       = pcEncTop->getCuEncoder();
    144163  m_pcPredSearch      = pcEncTop->getPredSearch();
    145  
     164
    146165  m_pcEntropyCoder    = pcEncTop->getEntropyCoder();
    147166  m_pcCavlcCoder      = pcEncTop->getCavlcCoder();
     
    149168  m_pcBinCABAC        = pcEncTop->getBinCABAC();
    150169  m_pcTrQuant         = pcEncTop->getTrQuant();
    151  
     170
    152171  m_pcBitCounter      = pcEncTop->getBitCounter();
    153172  m_pcRdCost          = pcEncTop->getRdCost();
    154173  m_pppcRDSbacCoder   = pcEncTop->getRDSbacCoder();
    155174  m_pcRDGoOnSbacCoder = pcEncTop->getRDGoOnSbacCoder();
    156  
     175
    157176  // create lambda and QP arrays
    158177  m_pdRdPicLambda     = (Double*)xMalloc( Double, m_pcCfg->getDeltaQpRD() * 2 + 1 );
     
    187206  Double dQP;
    188207  Double dLambda;
    189  
     208
    190209  rpcSlice = pcPic->getSlice(0);
    191210  rpcSlice->setSPS( pSPS );
     
    202221  rpcSlice->setPicOutputFlag( true );
    203222  rpcSlice->setPOC( pocCurr );
    204  
     223
    205224  // depth computation based on GOP size
    206225  Int depth;
     
    230249    }
    231250  }
    232  
     251
    233252  // slice type
    234253  SliceType eSliceType;
    235  
     254
    236255  eSliceType=B_SLICE;
    237256  eSliceType = (pocLast == 0 || pocCurr % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType;
    238  
     257
    239258  rpcSlice->setSliceType    ( eSliceType );
    240  
     259
    241260  // ------------------------------------------------------------------------------------------------------------------
    242261  // Non-referenced frame marking
    243262  // ------------------------------------------------------------------------------------------------------------------
    244  
     263
    245264  if(pocLast == 0)
    246265  {
     
    252271  }
    253272  rpcSlice->setReferenced(true);
    254  
     273
    255274  // ------------------------------------------------------------------------------------------------------------------
    256275  // QP setting
    257276  // ------------------------------------------------------------------------------------------------------------------
    258  
     277
    259278  dQP = m_pcCfg->getQP();
    260279  if(eSliceType!=I_SLICE)
    261280  {
    262281#if REPN_FORMAT_IN_VPS
    263     if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless()))) 
    264 #else
    265     if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getSPS()->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless()))) 
     282    if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless())))
     283#else
     284    if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getSPS()->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless())))
    266285#endif
    267286    {
     
    269288    }
    270289  }
    271  
     290
    272291  // modify QP
    273292  Int* pdQPs = m_pcCfg->getdQPs();
     
    285304  // Lambda computation
    286305  // ------------------------------------------------------------------------------------------------------------------
    287  
     306
    288307  Int iQP;
    289308  Double dOrigQP = dQP;
     
    294313    // compute QP value
    295314    dQP = dOrigQP + ((iDQpIdx+1)>>1)*(iDQpIdx%2 ? -1 : 1);
    296    
     315
    297316    // compute lambda value
    298317    Int    NumberBFrames = ( m_pcCfg->getGOPSize() - 1 );
     
    326345#endif
    327346    }
    328    
     347
    329348    // if hadamard is used in ME process
    330349    if ( !m_pcCfg->getUseHADME() && rpcSlice->getSliceType( ) != I_SLICE )
     
    332351      dLambda *= 0.95;
    333352    }
    334    
     353
    335354#if REPN_FORMAT_IN_VPS
    336355    iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
     
    343362    m_piRdPicQp    [iDQpIdx] = iQP;
    344363  }
    345  
     364
    346365  // obtain dQP = 0 case
    347366  dLambda = m_pdRdPicLambda[0];
    348367  dQP     = m_pdRdPicQp    [0];
    349368  iQP     = m_piRdPicQp    [0];
    350  
     369
    351370  if( rpcSlice->getSliceType( ) != I_SLICE )
    352371  {
     
    359378    Int nCurLayer = rpcSlice->getLayerId();
    360379    Double gamma = xCalEnhLambdaFactor( m_ppcTEncTop[nCurLayer-1]->getQP() - m_ppcTEncTop[nCurLayer]->getQP() ,
    361       1.0 * m_ppcTEncTop[nCurLayer]->getSourceWidth() * m_ppcTEncTop[nCurLayer]->getSourceHeight() 
     380      1.0 * m_ppcTEncTop[nCurLayer]->getSourceWidth() * m_ppcTEncTop[nCurLayer]->getSourceHeight()
    362381      / m_ppcTEncTop[nCurLayer-1]->getSourceWidth() / m_ppcTEncTop[nCurLayer-1]->getSourceHeight() );
    363382    dLambda *= gamma;
     
    392411#endif
    393412
    394 #if RDOQ_CHROMA_LAMBDA 
     413#if RDOQ_CHROMA_LAMBDA
    395414// for RDOQ
    396   m_pcTrQuant->setLambda( dLambda, dLambda / weight );   
     415  m_pcTrQuant->setLambda( dLambda, dLambda / weight );
    397416#else
    398417  m_pcTrQuant->setLambda( dLambda );
     
    401420#if SAO_CHROMA_LAMBDA
    402421// For SAO
    403   rpcSlice   ->setLambda( dLambda, dLambda / weight ); 
     422  rpcSlice   ->setLambda( dLambda, dLambda / weight );
    404423#else
    405424  rpcSlice   ->setLambda( dLambda );
    406425#endif
    407  
     426
    408427#if HB_LAMBDA_FOR_LDC
    409428  // restore original slice type
    410429  eSliceType = (pocLast == 0 || pocCurr % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType;
    411  
     430
    412431#if SVC_EXTENSION
    413432  if(m_pcCfg->getLayerId() > 0)
     
    418437  rpcSlice->setSliceType        ( eSliceType );
    419438#endif
    420  
     439
    421440  if (m_pcCfg->getUseRecalculateQPAccordingToLambda())
    422441  {
    423442    dQP = xGetQPValueAccordingToLambda( dLambda );
    424443#if REPN_FORMAT_IN_VPS
    425     iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );   
    426 #else
    427     iQP = max( -pSPS->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );   
     444    iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
     445#else
     446    iQP = max( -pSPS->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
    428447#endif
    429448  }
     
    438457  rpcSlice->setNumRefIdx(REF_PIC_LIST_0,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive);
    439458  rpcSlice->setNumRefIdx(REF_PIC_LIST_1,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive);
    440  
     459
    441460  if ( m_pcCfg->getDeblockingFilterMetric() )
    442461  {
     
    479498
    480499  rpcSlice->setDepth            ( depth );
    481  
     500
    482501  pcPic->setTLayer( m_pcCfg->getGOPEntry(iGOPid).m_temporalId );
    483 #if TEMP_SCALABILITY_FIX
    484   if((eSliceType==I_SLICE) || (rpcSlice->getPOC() == 0))
    485 #else
     502
    486503  if(eSliceType==I_SLICE)
    487 #endif
    488504  {
    489505    pcPic->setTLayer(0);
     
    493509  assert( m_apcPicYuvPred );
    494510  assert( m_apcPicYuvResi );
    495  
     511
    496512  pcPic->setPicYuvPred( m_apcPicYuvPred );
    497513  pcPic->setPicYuvResi( m_apcPicYuvResi );
     
    557573#endif
    558574
    559 #if RDOQ_CHROMA_LAMBDA 
     575#if RDOQ_CHROMA_LAMBDA
    560576  // for RDOQ
    561577  m_pcTrQuant->setLambda( lambda, lambda / weight );
     
    665681#endif
    666682
    667 #if RDOQ_CHROMA_LAMBDA 
     683#if RDOQ_CHROMA_LAMBDA
    668684  // for RDOQ
    669   m_pcTrQuant->setLambda( lambda, lambda / weight );   
     685  m_pcTrQuant->setLambda( lambda, lambda / weight );
    670686#else
    671687  m_pcTrQuant->setLambda( lambda );
     
    674690#if SAO_CHROMA_LAMBDA
    675691  // For SAO
    676   pcSlice   ->setLambda( lambda, lambda / weight ); 
     692  pcSlice   ->setLambda( lambda, lambda / weight );
    677693#else
    678694  pcSlice   ->setLambda( lambda );
     
    692708  Int iMaxSR = m_pcCfg->getSearchRange();
    693709  Int iNumPredDir = pcSlice->isInterP() ? 1 : 2;
    694  
     710
    695711  for (Int iDir = 0; iDir <= iNumPredDir; iDir++)
    696712  {
     
    726742  }
    727743#endif
    728  
     744
    729745  TComSlice* pcSlice        = rpcPic->getSlice(getSliceIdx());
    730746  Double     dPicRdCostBest = MAX_DOUBLE;
    731747  UInt       uiQpIdxBest = 0;
    732  
     748
    733749  Double dFrameLambda;
    734750#if FULL_NBIT
     
    737753  Int    SHIFT_QP = 12;
    738754#endif
    739  
     755
    740756  // set frame lambda
    741757  if (m_pcCfg->getGOPSize() > 1)
     
    748764  }
    749765  m_pcRdCost      ->setFrameLambda(dFrameLambda);
    750  
     766
    751767  // for each QP candidate
    752768  for ( UInt uiQpIdx = 0; uiQpIdx < 2 * m_pcCfg->getDeltaQpRD() + 1; uiQpIdx++ )
     
    776792#endif
    777793
    778 #if RDOQ_CHROMA_LAMBDA 
     794#if RDOQ_CHROMA_LAMBDA
    779795    // for RDOQ
    780796    m_pcTrQuant   ->setLambda( m_pdRdPicLambda[uiQpIdx], m_pdRdPicLambda[uiQpIdx] / weight );
     
    784800#if SAO_CHROMA_LAMBDA
    785801    // For SAO
    786     pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdx], m_pdRdPicLambda[uiQpIdx] / weight ); 
     802    pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdx], m_pdRdPicLambda[uiQpIdx] / weight );
    787803#else
    788804    pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdx] );
    789805#endif
    790    
     806
    791807    // try compress
    792808    compressSlice   ( rpcPic );
    793    
     809
    794810    Double dPicRdCost;
    795811    UInt64 uiPicDist        = m_uiPicDist;
    796812    UInt64 uiALFBits        = 0;
    797    
     813
    798814    m_pcGOPEncoder->preLoopFilterPicAll( rpcPic, uiPicDist, uiALFBits );
    799    
     815
    800816    // compute RD cost and choose the best
    801817    dPicRdCost = m_pcRdCost->calcRdCost64( m_uiPicTotalBits + uiALFBits, uiPicDist, true, DF_SSE_FRAME);
    802    
     818
    803819    if ( dPicRdCost < dPicRdCostBest )
    804820    {
     
    807823    }
    808824  }
    809  
     825
    810826  // set best values
    811827  pcSlice       ->setSliceQp             ( m_piRdPicQp    [uiQpIdxBest] );
     
    832848#endif
    833849
    834 #if RDOQ_CHROMA_LAMBDA 
    835   // for RDOQ 
    836   m_pcTrQuant   ->setLambda( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight ); 
     850#if RDOQ_CHROMA_LAMBDA
     851  // for RDOQ
     852  m_pcTrQuant   ->setLambda( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight );
    837853#else
    838854  m_pcTrQuant   ->setLambda              ( m_pdRdPicLambda[uiQpIdxBest] );
     
    840856#if SAO_CHROMA_LAMBDA
    841857  // For SAO
    842   pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight ); 
     858  pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight );
    843859#else
    844860  pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdxBest] );
     
    862878
    863879  UInt uiEncCUOrder;
    864   uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 
     880  uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU());
    865881  for( uiEncCUOrder = uiStartCUAddr/rpcPic->getNumPartInCU();
    866882       uiEncCUOrder < (uiBoundingCUAddr+(rpcPic->getNumPartInCU()-1))/rpcPic->getNumPartInCU();
     
    898914  TComSlice* pcSlice            = rpcPic->getSlice(getSliceIdx());
    899915  xDetermineStartAndBoundingCUAddr ( uiStartCUAddr, uiBoundingCUAddr, rpcPic, false );
    900  
     916
    901917  // initialize cost values
    902918  m_uiPicTotalBits  = 0;
    903919  m_dPicRdCost      = 0;
    904920  m_uiPicDist       = 0;
    905  
     921
    906922  // set entropy coder
    907923  if( m_pcCfg->getUseSBACRD() )
     
    921937    m_pcEntropyCoder->setBitstream    ( m_pcBitCounter );
    922938  }
    923  
     939
    924940  //------------------------------------------------------------------------------
    925941  //  Weighted Prediction parameters estimation.
     
    930946    xCalcACDCParamSlice(pcSlice);
    931947  }
     948#if O0194_WEIGHTED_PREDICTION_CGS
     949  else
     950  {
     951    // Calculate for the base layer to be used in EL as Inter layer reference
     952    estimateILWpParam( pcSlice );   
     953  }
     954#endif
    932955
    933956  Bool bWp_explicit = (pcSlice->getSliceType()==P_SLICE && pcSlice->getPPS()->getUseWP()) || (pcSlice->getSliceType()==B_SLICE && pcSlice->getPPS()->getWPBiPred());
     
    10211044        m_pcBufferSbacCoders[uiTileCol].loadContexts( CTXMem[1] );
    10221045        Int iNumSubstreamsPerTile = iNumSubstreams/rpcPic->getPicSym()->getNumTiles();
    1023         uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 
     1046        uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU());
    10241047        uiLin     = uiCUAddr / uiWidthInLCUs;
    10251048        uiSubStrm = rpcPic->getPicSym()->getTileIdxMap(rpcPic->getPicSym()->getCUOrderMap(uiCUAddr))*iNumSubstreamsPerTile
     
    10981121          pcCUTR = rpcPic->getCU( uiCUAddr - uiWidthInCU + 1 );
    10991122        }
    1100         if ( ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) || 
     1123        if ( ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) ||
    11011124             (pcCUTR->getSCUAddr()+uiMaxParts-1 < pcSlice->getSliceCurStartCUAddr()) ||
    11021125             ((rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(uiCUAddr)))
     
    11371160      m_pcEntropyCoder->setEntropyCoder ( m_pcRDGoOnSbacCoder, pcSlice );
    11381161      m_pcEntropyCoder->setBitstream( &pcBitCounters[uiSubStrm] );
    1139      
     1162
    11401163      ((TEncBinCABAC*)m_pcRDGoOnSbacCoder->getEncBinIf())->setBinCountingEnableFlag(true);
    11411164
     
    12421265        m_pcRdCost->setLambda(oldLambda);
    12431266#if RATE_CONTROL_INTRA
    1244         m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 
     1267        m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda,
    12451268          pcCU->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() );
    12461269#else
     
    12501273#endif
    12511274#endif
    1252      
     1275
    12531276      // restore entropy coder to an initial stage
    12541277      m_pcEntropyCoder->setEntropyCoder ( m_pppcRDSbacCoder[0][CI_CURR_BEST], pcSlice );
     
    12751298      {
    12761299         ppppcRDSbacCoders[uiSubStrm][0][CI_CURR_BEST]->load( m_pppcRDSbacCoder[0][CI_CURR_BEST] );
    1277        
     1300
    12781301         //Store probabilties of second LCU in line into buffer
    12791302         if ( ( uiCol == uiTileLCUX+1) && (depSliceSegmentsEnabled || (pcSlice->getPPS()->getNumSubstreams() > 1)) && m_pcCfg->getWaveFrontsynchro())
     
    13251348
    13261349#if RATE_CONTROL_INTRA
    1327         m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 
     1350        m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda,
    13281351          pcCU->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() );
    13291352#else
     
    13501373      }
    13511374    }
    1352    
     1375
    13531376    m_uiPicTotalBits += pcCU->getTotalBits();
    13541377    m_dPicRdCost     += pcCU->getTotalCost();
     
    14011424    m_pcEntropyCoder->setEntropyCoder ( m_pcSbacCoder, pcSlice );
    14021425  }
    1403  
     1426
    14041427  m_pcCuEncoder->setBitCounter( NULL );
    14051428  m_pcBitCounter = NULL;
     
    14271450      m_pcBufferSbacCoders[ui].load(m_pcSbacCoder); //init. state
    14281451    }
    1429    
     1452
    14301453    for (Int iSubstrmIdx=0; iSubstrmIdx < iNumSubstreams; iSubstrmIdx++)
    14311454    {
     
    15241547        }
    15251548        if ( (true/*bEnforceSliceRestriction*/ &&
    1526              ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) || 
     1549             ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) ||
    15271550             (pcCUTR->getSCUAddr()+uiMaxParts-1 < pcSlice->getSliceCurStartCUAddr()) ||
    15281551             ((rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(uiCUAddr)))
     
    15791602    }
    15801603
    1581     TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr );   
     1604    TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr );
    15821605    if ( pcSlice->getSPS()->getUseSAO() && (pcSlice->getSaoEnabledFlag()||pcSlice->getSaoEnabledFlagChroma()) )
    15831606    {
     
    16131636        if (allowMergeLeft)
    16141637        {
    1615           m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoMerge(mergeLeft); 
     1638          m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoMerge(mergeLeft);
    16161639        }
    16171640        else
     
    16761699#if ENC_DEC_TRACE
    16771700    g_bJustDoIt = g_bEncDecTraceDisable;
    1678 #endif   
     1701#endif
    16791702    if( m_pcCfg->getUseSBACRD() )
    16801703    {
    16811704       pcSbacCoders[uiSubStrm].load(m_pcSbacCoder);   //load back status of the entropy coder after encoding the LCU into relevant bitstream entropy coder
    1682        
     1705
    16831706
    16841707       //Store probabilties of second LCU in line into buffer
     
    17331756  UInt uiNumberOfCUsInFrame = rpcPic->getNumCUsInFrame();
    17341757  uiBoundingCUAddrSlice     = uiNumberOfCUsInFrame;
    1735   if (bEncodeSlice) 
     1758  if (bEncodeSlice)
    17361759  {
    17371760    UInt uiCUAddrIncrement;
     
    17691792      uiBoundingCUAddrSlice    = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU();
    17701793      break;
    1771     } 
     1794    }
    17721795    // WPP: if a slice does not start at the beginning of a CTB row, it must end within the same CTB row
    17731796    if (pcSlice->getPPS()->getNumSubstreams() > 1 && (uiStartCUAddrSlice % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0))
     
    18091832      uiBoundingCUAddrSlice    = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU();
    18101833      break;
    1811     } 
     1834    }
    18121835    // WPP: if a slice does not start at the beginning of a CTB row, it must end within the same CTB row
    18131836    if (pcSlice->getPPS()->getNumSubstreams() > 1 && (uiStartCUAddrSlice % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0))
     
    18191842
    18201843  Bool tileBoundary = false;
    1821   if ((m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_BYTES) && 
     1844  if ((m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_BYTES) &&
    18221845      (m_pcCfg->getNumRowsMinus1() > 0 || m_pcCfg->getNumColumnsMinus1() > 0))
    18231846  {
     
    18321855    }
    18331856    tileBoundingCUAddrSlice = lcuEncAddr*rpcPic->getNumPartInCU();
    1834    
     1857
    18351858    if (tileBoundingCUAddrSlice < uiBoundingCUAddrSlice)
    18361859    {
     
    18451868  startCUAddrSliceSegment    = pcSlice->getSliceSegmentCurStartCUAddr();
    18461869  boundingCUAddrSliceSegment = uiNumberOfCUsInFrame;
    1847   if (bEncodeSlice) 
     1870  if (bEncodeSlice)
    18481871  {
    18491872    UInt uiCUAddrIncrement;
     
    18801903      boundingCUAddrSliceSegment    = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU();
    18811904      break;
    1882     } 
     1905    }
    18831906    // WPP: if a slice segment does not start at the beginning of a CTB row, it must end within the same CTB row
    18841907    if (pcSlice->getPPS()->getNumSubstreams() > 1 && (startCUAddrSliceSegment % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0))
     
    19191942      boundingCUAddrSliceSegment    = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU();
    19201943      break;
    1921     } 
     1944    }
    19221945    // WPP: if a slice segment does not start at the beginning of a CTB row, it must end within the same CTB row
    19231946    if (pcSlice->getPPS()->getNumSubstreams() > 1 && (startCUAddrSliceSegment % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0))
     
    19271950    pcSlice->setSliceSegmentCurEndCUAddr( boundingCUAddrSliceSegment );
    19281951  }
    1929   if ((m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_BYTES) && 
     1952  if ((m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_BYTES) &&
    19301953    (m_pcCfg->getNumRowsMinus1() > 0 || m_pcCfg->getNumColumnsMinus1() > 0))
    19311954  {
     
    19792002  }
    19802003  UInt uiRealStartAddress = rpcPic->getPicSym()->getPicSCUEncOrder(uiExternalAddress*rpcPic->getNumPartInCU()+uiInternalAddress);
    1981  
     2004
    19822005  pcSlice->setSliceSegmentCurStartCUAddr(uiRealStartAddress);
    19832006  startCUAddrSliceSegment=uiRealStartAddress;
    1984  
     2007
    19852008  //calculate real slice start address
    19862009  uiInternalAddress = rpcPic->getPicSym()->getPicSCUAddr(pcSlice->getSliceCurStartCUAddr()) % rpcPic->getNumPartInCU();
     
    20072030  }
    20082031  uiRealStartAddress = rpcPic->getPicSym()->getPicSCUEncOrder(uiExternalAddress*rpcPic->getNumPartInCU()+uiInternalAddress);
    2009  
     2032
    20102033  pcSlice->setSliceCurStartCUAddr(uiRealStartAddress);
    20112034  uiStartCUAddrSlice=uiRealStartAddress;
    2012  
     2035
    20132036  // Make a joint decision based on reconstruction and dependent slice bounds
    20142037  startCUAddr    = max(uiStartCUAddrSlice   , startCUAddrSliceSegment   );
     
    20222045    if ( (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU)
    20232046      || (m_pcCfg->getSliceMode()==0 && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU)
    2024       || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==0) 
     2047      || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==0)
    20252048      || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU)
    2026       || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceSegmentMode()==0) 
     2049      || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceSegmentMode()==0)
    20272050      || (m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceMode()==0)
    20282051      || tileBoundary
     
    20662089}
    20672090#endif
     2091#if O0194_WEIGHTED_PREDICTION_CGS
     2092Void TEncSlice::estimateILWpParam( TComSlice* pcSlice )
     2093{
     2094  xCalcACDCParamSlice(pcSlice);
     2095  wpACDCParam * temp_weightACDCParam;
     2096
     2097  pcSlice->getWpAcDcParam(temp_weightACDCParam);
     2098  g_refWeightACDCParam = (void *) temp_weightACDCParam;
     2099}
     2100#endif
    20682101//! \}
  • trunk/source/Lib/TLibEncoder/TEncSlice.h

    r442 r494  
    111111  virtual ~TEncSlice();
    112112 
     113#if AUXILIARY_PICTURES
     114  Void    create              ( Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt iMaxCUWidth, UInt iMaxCUHeight, UChar uhTotalDepth );
     115#else
    113116  Void    create              ( Int iWidth, Int iHeight, UInt iMaxCUWidth, UInt iMaxCUHeight, UChar uhTotalDepth );
     117#endif
    114118  Void    destroy             ();
    115119  Void    init                ( TEncTop* pcEncTop );
     
    119123  Void    initEncSlice        ( TComPic*  pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd,
    120124                                Int iGOPid,   TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS, TComVPS *vps, Bool isField );
     125#if O0194_WEIGHTED_PREDICTION_CGS
     126  Void    estimateILWpParam   ( TComSlice* pcSlice );
     127#endif
    121128#else
    122129  Void    initEncSlice        ( TComPic*  pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd,
  • trunk/source/Lib/TLibEncoder/TEncTop.cpp

    r442 r494  
    8888  m_bMFMEnabledFlag = false;
    8989#endif
    90 #if SCALED_REF_LAYER_OFFSETS
    9190  m_numScaledRefLayerOffsets = 0;
    92 #endif
    93 #endif
    9491#if POC_RESET_FLAG
    9592  m_pocAdjustmentValue     = 0;
    9693#endif
     94#endif //SVC_EXTENSION
    9795}
    9896
     
    117115  m_cGOPEncoder.        create();
    118116#endif
     117#if AUXILIARY_PICTURES
     118  m_cSliceEncoder.      create( getSourceWidth(), getSourceHeight(), m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
     119#else
    119120  m_cSliceEncoder.      create( getSourceWidth(), getSourceHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
     121#endif
    120122  m_cCuEncoder.         create( g_uiMaxCUDepth, g_uiMaxCUWidth, g_uiMaxCUHeight );
    121123  if (m_bUseSAO)
     
    175177    }
    176178  }
     179
     180#if LAYER_CTB
     181  memcpy(g_auiLayerZscanToRaster[m_layerId], g_auiZscanToRaster, sizeof( g_auiZscanToRaster ) );
     182  memcpy(g_auiLayerRasterToZscan[m_layerId], g_auiRasterToZscan, sizeof( g_auiRasterToZscan ) );
     183  memcpy(g_auiLayerRasterToPelX[m_layerId],  g_auiRasterToPelX,  sizeof( g_auiRasterToPelX ) );
     184  memcpy(g_auiLayerRasterToPelY[m_layerId],  g_auiRasterToPelY,  sizeof( g_auiRasterToPelY ) );
     185#endif
    177186}
    178187
     
    601610    else
    602611    {
     612#if AUXILIARY_PICTURES
     613      rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
     614#else
    603615      rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
     616#endif
    604617    }
    605618    rcListPicYuvRecOut.pushBack( rpcPicYuvRec );
     
    801814#endif
    802815
     816#if AUXILIARY_PICTURES
     817#if SVC_UPSAMPLING
     818      pcEPic->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_cPPS.getMaxCuDQPDepth()+1 ,
     819                      m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics, &m_cSPS);
     820#else
     821      pcEPic->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_cPPS.getMaxCuDQPDepth()+1 ,
     822                      m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics);
     823#endif
     824#else
    803825#if SVC_UPSAMPLING
    804826      pcEPic->create( m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_cPPS.getMaxCuDQPDepth()+1 ,
     
    807829      pcEPic->create( m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_cPPS.getMaxCuDQPDepth()+1 ,
    808830                      m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics);
     831#endif
    809832#endif
    810833      rpcPic = pcEPic;
     
    842865#endif
    843866
     867#if AUXILIARY_PICTURES
     868#if SVC_UPSAMPLING
     869      rpcPic->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
     870                      m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics, &m_cSPS);
     871#else
     872      rpcPic->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
     873                      m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics);
     874#endif
     875#else
    844876#if SVC_UPSAMPLING
    845877      rpcPic->create( m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
     
    849881                      m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics);
    850882#endif
     883#endif
    851884    }
    852885
     
    871904#if SVC_EXTENSION
    872905  m_cSPS.setLayerId(m_layerId);
    873 #endif
    874906#if REF_IDX_MFM
    875907#if !M0457_COL_PICTURE_SIGNALING
     
    877909#endif
    878910#endif
    879 #if SCALED_REF_LAYER_OFFSETS
    880911  m_cSPS.setNumScaledRefLayerOffsets(m_numScaledRefLayerOffsets);
    881912  for(Int i = 0; i < m_cSPS.getNumScaledRefLayerOffsets(); i++)
     
    883914    m_cSPS.getScaledRefLayerWindow(i) = m_scaledRefLayerWindow[i];
    884915  }
    885 #endif
     916#endif //SVC_EXTENSION
    886917  ProfileTierLevel& profileTierLevel = *m_cSPS.getPTL()->getGeneralPTL();
    887918  profileTierLevel.setLevelIdc(m_level);
     
    914945  m_cSPS.setMaxCUHeight   ( g_uiMaxCUHeight     );
    915946  m_cSPS.setMaxCUDepth    ( g_uiMaxCUDepth      );
     947#if AUXILIARY_PICTURES
     948  m_cSPS.setChromaFormatIdc( m_chromaFormatIDC);
     949#endif
    916950
    917951  Int minCUSize = m_cSPS.getMaxCUWidth() >> ( m_cSPS.getMaxCUDepth()-g_uiAddCUDepth );
     
    11881222  for( Int i = 0; i < getGOPSize()+m_extraRPSs; i++)
    11891223  {
    1190 #if FINAL_RPL_CHANGE_N0082
    1191     GOPEntry ge = m_ppcTEncTop[m_cSPS.getLayerId()]->getGOPEntry(i);
    1192 #else
    11931224    GOPEntry ge = getGOPEntry(i);
    1194 #endif
    11951225    rps = rpsList->getReferencePictureSet(i);
    11961226    rps->setNumberOfPictures(ge.m_numRefPics);
     
    15361566#endif
    15371567
    1538 #if SVC_EXTENSION
    15391568#if !REPN_FORMAT_IN_VPS
    15401569Void TEncTop::xInitILRP()
     
    15591588        m_cIlpPic[j] = new  TComPic;
    15601589#if SVC_UPSAMPLING
     1590#if AUXILIARY_PICTURES
     1591        m_cIlpPic[j]->create(m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, &m_cSPS, true);
     1592#else
    15611593        m_cIlpPic[j]->create(m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, &m_cSPS, true);
     1594#endif
    15621595#else
    15631596        m_cIlpPic[j]->create(m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, true);
     
    16111644        m_cIlpPic[j] = new  TComPic;
    16121645#if SVC_UPSAMPLING
     1646#if AUXILIARY_PICTURES
     1647        m_cIlpPic[j]->create(picWidth, picHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, &m_cSPS, true);
     1648#else
    16131649        m_cIlpPic[j]->create(picWidth, picHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, &m_cSPS, true);
     1650#endif
    16141651#else
    16151652        m_cIlpPic[j]->create(m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, true);
     
    16241661}
    16251662#endif
    1626 Void TEncTop::setILRPic(TComPic *pcPic)
    1627 {
    1628   for( Int i = 0; i < pcPic->getSlice(0)->getActiveNumILRRefIdx(); i++ )
    1629   {
    1630     Int refLayerIdc = pcPic->getSlice(0)->getInterLayerPredLayerIdc(i);
    1631 
    1632     if(m_cIlpPic[refLayerIdc])
    1633     {
    1634       m_cIlpPic[refLayerIdc]->copyUpsampledPictureYuv(pcPic->getFullPelBaseRec(refLayerIdc), m_cIlpPic[refLayerIdc]->getPicYuvRec());
    1635       m_cIlpPic[refLayerIdc]->getSlice(0)->setPOC(pcPic->getPOC());
    1636       m_cIlpPic[refLayerIdc]->setLayerId(pcPic->getSlice(0)->getBaseColPic(refLayerIdc)->getLayerId()); //set reference layerId
    1637       m_cIlpPic[refLayerIdc]->getPicYuvRec()->setBorderExtension(false);
    1638       m_cIlpPic[refLayerIdc]->getPicYuvRec()->extendPicBorder();
    1639       for (Int j=0; j<m_cIlpPic[refLayerIdc]->getPicSym()->getNumberOfCUsInFrame(); j++)    // set reference CU layerId
    1640       {
    1641         m_cIlpPic[refLayerIdc]->getPicSym()->getCU(j)->setLayerId(m_cIlpPic[refLayerIdc]->getLayerId());
    1642       }
    1643     }
    1644   }
    1645 }
    1646 #endif
    1647 #endif
     1663#endif //SVC_EXTENSION
    16481664//! \}
  • trunk/source/Lib/TLibEncoder/TEncTop.h

    r442 r494  
    140140  Int                     m_ilSampleOnlyPred;
    141141#endif
    142 #if SCALED_REF_LAYER_OFFSETS
    143142  UInt                    m_numScaledRefLayerOffsets;
    144143  Window                  m_scaledRefLayerWindow[MAX_LAYERS];
    145 #endif
    146144#if POC_RESET_FLAG
    147145  Int                     m_pocAdjustmentValue;
    148146#endif
    149 #endif
     147#endif //SVC_EXTENSION
    150148protected:
    151149  Void  xGetNewPicBuffer  ( TComPic*& rpcPic );           ///< get picture buffer which will be processed
     
    209207  Int                     getNumPicRcvd         () { return m_iNumPicRcvd;            }
    210208  Void                    setNumPicRcvd         ( Int num ) { m_iNumPicRcvd = num;      }
    211 #if SCALED_REF_LAYER_OFFSETS
    212209  Void                    setNumScaledRefLayerOffsets(Int x) { m_numScaledRefLayerOffsets = x; }
    213210  UInt                    getNumScaledRefLayerOffsets() { return m_numScaledRefLayerOffsets; }
    214211  Window&  getScaledRefLayerWindow(Int x)            { return m_scaledRefLayerWindow[x]; }
    215 #endif
    216 #endif
     212#endif //SVC_EXTENSION
    217213
    218214  // -------------------------------------------------------------------------------------------------------------------
     
    223219#if SVC_EXTENSION
    224220  TComPic** getIlpList() { return m_cIlpPic; }
    225   Void      setILRPic(TComPic *pcPic);
    226221#if REF_IDX_MFM
    227222  Void      setMFMEnabledFlag       (Bool flag)   {m_bMFMEnabledFlag = flag;}
  • trunk/source/Lib/TLibEncoder/WeightPredAnalysis.cpp

    r313 r494  
    22 * License, included below. This software may be subject to other third party
    33 * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license. 
     4 * granted under this license.
    55 *
    66 * Copyright (c) 2010-2013, ITU/ISO/IEC
     
    5151  for ( Int iList =0 ; iList<2 ; iList++ )
    5252  {
    53     for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) 
     53    for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ )
    5454    {
    5555      for ( Int comp=0 ; comp<3 ;comp++ )
     
    7474  TComPicYuv*   pPic = slice->getPic()->getPicYuvOrg();
    7575  Int   iSample  = 0;
     76#if O0194_WEIGHTED_PREDICTION_CGS
     77  // Define here to assign the parameter of "iSample"
     78  wpACDCParam weightACDCParam[3];
     79#endif
    7680
    7781  // calculate DC/AC value for Y
     
    8185  pOrg = pPic->getLumaAddr();
    8286  Int64  iOrgACY  = xCalcACValueSlice(slice, pOrg, iOrgNormDCY);
     87#if O0194_WEIGHTED_PREDICTION_CGS
     88  weightACDCParam[0].iSamples = iSample;
     89#endif
    8390
    8491  // calculate DC/AC value for Cb
     
    8895  pOrg = pPic->getCbAddr();
    8996  Int64  iOrgACCb  = xCalcACValueUVSlice(slice, pOrg, iOrgNormDCCb);
     97#if O0194_WEIGHTED_PREDICTION_CGS
     98  weightACDCParam[1].iSamples = iSample;
     99#endif
    90100
    91101  // calculate DC/AC value for Cr
     
    95105  pOrg = pPic->getCrAddr();
    96106  Int64  iOrgACCr  = xCalcACValueUVSlice(slice, pOrg, iOrgNormDCCr);
    97 
     107#if O0194_WEIGHTED_PREDICTION_CGS
     108  weightACDCParam[2].iSamples = iSample;
     109#endif
     110
     111#if !O0194_WEIGHTED_PREDICTION_CGS
    98112  wpACDCParam weightACDCParam[3];
     113#endif
    99114  weightACDCParam[0].iAC = iOrgACY;
    100115  weightACDCParam[0].iDC = iOrgNormDCY;
     
    138153  for ( Int iList=0 ; iList<2 ; iList++ )
    139154  {
    140     for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) 
    141     {
    142       for ( Int iComp=0 ; iComp<3 ;iComp++ ) 
     155    for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ )
     156    {
     157      for ( Int iComp=0 ; iComp<3 ;iComp++ )
    143158      {
    144159        wpScalingParam  *pwp = &(m_wp[iList][iRefIdx][iComp]);
     
    154169    for ( Int iList=0 ; iList<2 ; iList++ )
    155170    {
    156       for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) 
     171      for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ )
    157172      {
    158         for ( Int iComp=0 ; iComp<3 ;iComp++ ) 
     173        for ( Int iComp=0 ; iComp<3 ;iComp++ )
    159174        {
    160175          wpScalingParam  *pwp = &(m_wp[iList][iRefIdx][iComp]);
     
    195210  // selecting whether WP is used, or not
    196211  xSelectWP(slice, m_wp, iDenom);
    197  
     212
    198213  slice->setWpScaling( m_wp );
    199214
     
    216231      slice->getWpAcDcParam(currWeightACDCParam);
    217232      slice->getRefPic(eRefPicList, refIdxTemp)->getSlice(0)->getWpAcDcParam(refWeightACDCParam);
     233#if O0194_WEIGHTED_PREDICTION_CGS
     234      UInt currLayerId = slice->getLayerId();
     235      UInt refLayerId  = slice->getRefPic(eRefPicList, refIdxTemp)->getLayerId();
     236      Bool validILRPic = slice->getRefPic(eRefPicList, refIdxTemp)->isILR( currLayerId ) && refLayerId == 0;
     237
     238      if( validILRPic )
     239      {
     240        refWeightACDCParam = (wpACDCParam *)g_refWeightACDCParam;
     241      }
     242#endif
    218243
    219244      for ( Int comp = 0; comp < 3; comp++ )
     
    229254        Int64 refDC = refWeightACDCParam[comp].iDC;
    230255        Int64 refAC = refWeightACDCParam[comp].iAC;
     256#if O0194_WEIGHTED_PREDICTION_CGS
     257        if( validILRPic )
     258        {
     259          refAC = ( refAC * currWeightACDCParam[comp].iSamples ) /refWeightACDCParam[comp].iSamples;
     260#if O0194_JOINT_US_BITSHIFT
     261          refAC <<= (g_bitDepthYLayer[currLayerId]-g_bitDepthYLayer[refLayerId]);
     262          refDC <<= (g_bitDepthYLayer[currLayerId]-g_bitDepthYLayer[refLayerId]);
     263#endif
     264        }
     265#endif
    231266
    232267        // calculating iWeight and iOffset params
     
    234269        Int weight = (Int)( 0.5 + dWeight * (Double)(1<<log2Denom) );
    235270        Int offset = (Int)( ((currDC<<log2Denom) - ((Int64)weight * refDC) + (Int64)realOffset) >> realLog2Denom );
     271#if O0194_WEIGHTED_PREDICTION_CGS
     272        if( !validILRPic )
     273        {
     274          dWeight = 1;
     275          offset  = 0;
     276        }
     277        weight = (Int)( 0.5 + dWeight * (Double)(1<<log2Denom) );
     278#endif
    236279
    237280        // Chroma offset range limitation
     
    253296        if(deltaWeight > 127 || deltaWeight < -128)
    254297          return (false);
     298#if O0194_WEIGHTED_PREDICTION_CGS
     299        // make sure the reference frames other than ILR are not using weighted prediction
     300        else
     301        if( !validILRPic )
     302        {
     303          continue;
     304        }
     305#endif
    255306
    256307        m_wp[refList][refIdxTemp][comp].bPresentFlag = true;
     
    264315}
    265316
    266 /** select whether weighted pred enables or not. 
     317/** select whether weighted pred enables or not.
    267318 * \param TComSlice *slice
    268319 * \param wpScalingParam
     
    325376}
    326377
    327 /** calculate DC value of original image for luma. 
     378/** calculate DC value of original image for luma.
    328379 * \param TComSlice *slice
    329380 * \param Pel *pPel
     
    345396}
    346397
    347 /** calculate AC value of original image for luma. 
     398/** calculate AC value of original image for luma.
    348399 * \param TComSlice *slice
    349400 * \param Pel *pPel
     
    363414}
    364415
    365 /** calculate DC value of original image for chroma. 
     416/** calculate DC value of original image for chroma.
    366417 * \param TComSlice *slice
    367418 * \param Pel *pPel
     
    383434}
    384435
    385 /** calculate AC value of original image for chroma. 
     436/** calculate AC value of original image for chroma.
    386437 * \param TComSlice *slice
    387438 * \param Pel *pPel
     
    401452}
    402453
    403 /** calculate DC value. 
     454/** calculate DC value.
    404455 * \param Pel *pPel
    405456 * \param Int iWidth
     
    423474}
    424475
    425 /** calculate AC value. 
     476/** calculate AC value.
    426477 * \param Pel *pPel
    427478 * \param Int iWidth
     
    446497}
    447498
    448 /** calculate SAD values for both WP version and non-WP version. 
     499/** calculate SAD values for both WP version and non-WP version.
    449500 * \param Pel *pOrgPel
    450501 * \param Pel *pRefPel
Note: See TracChangeset for help on using the changeset viewer.