Changeset 494 in SHVCSoftware for trunk/source/Lib/TLibEncoder/TEncCavlc.cpp


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

reintegrate branch SHM-4.0-dev

Location:
trunk
Files:
3 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  {
Note: See TracChangeset for help on using the changeset viewer.