Changeset 1325 in 3DVCSoftware for branches/HTM-15.1-MV-draft-4/source/Lib/TLibEncoder/TEncCavlc.cpp
- Timestamp:
- 7 Sep 2015, 18:40:35 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-15.1-MV-draft-4/source/Lib/TLibEncoder/TEncCavlc.cpp
r1321 r1325 167 167 WRITE_FLAG( pcPPS->getSignHideFlag(), "sign_data_hiding_flag" ); 168 168 WRITE_FLAG( pcPPS->getCabacInitPresentFlag() ? 1 : 0, "cabac_init_present_flag" ); 169 #if PPS_FIX_DEPTH170 if( pcPPS->getSPS()->getVPS()->getDepthId(pcPPS->getSPS()->getLayerId()) )171 {172 WRITE_UVLC( pcPPS->getNumRefIdxL0DefaultActive(), "num_ref_idx_l0_default_active_minus1");173 WRITE_UVLC( pcPPS->getNumRefIdxL1DefaultActive(), "num_ref_idx_l1_default_active_minus1");174 }175 else176 {177 #endif178 169 WRITE_UVLC( pcPPS->getNumRefIdxL0DefaultActive()-1, "num_ref_idx_l0_default_active_minus1"); 179 170 WRITE_UVLC( pcPPS->getNumRefIdxL1DefaultActive()-1, "num_ref_idx_l1_default_active_minus1"); 180 #if PPS_FIX_DEPTH181 }182 #endif183 171 WRITE_SVLC( pcPPS->getPicInitQPMinus26(), "init_qp_minus26"); 184 172 WRITE_FLAG( pcPPS->getConstrainedIntraPred() ? 1 : 0, "constrained_intra_pred_flag" ); … … 238 226 codeScalingList( pcPPS->getScalingList() ); 239 227 } 240 #if PPS_FIX_DEPTH241 if( pcPPS->getSPS()->getVPS()->getDepthId(pcPPS->getSPS()->getLayerId()) )242 {243 WRITE_FLAG( 1, "lists_modification_present_flag" );244 }245 else246 #endif247 228 WRITE_FLAG( pcPPS->getListsModificationPresentFlag(), "lists_modification_present_flag"); 248 229 WRITE_UVLC( pcPPS->getLog2ParallelMergeLevelMinus2(), "log2_parallel_merge_level_minus2"); … … 360 341 } 361 342 362 #if NH_3D363 if( pcPPS->getPps3dExtensionFlag( ) ) // This probably needs to be aligned with Rext and SHVC364 {365 codePps3dExtension( pcPPS );366 }367 #endif368 343 #endif 369 344 xWriteRbspTrailingBits(); 370 345 } 371 346 372 #if NH_3D373 Void TEncCavlc::codePps3dExtension ( const TComPPS* pcPPS )374 {375 #if NH_3D_DLT376 WRITE_FLAG( pcPPS->getDLT()->getDltPresentFlag() ? 1 : 0, "dlts_present_flag" );377 378 if ( pcPPS->getDLT()->getDltPresentFlag() )379 {380 WRITE_CODE(pcPPS->getDLT()->getNumDepthViews() - 1, 6, "pps_depth_layers_minus1");381 WRITE_CODE((pcPPS->getDLT()->getDepthViewBitDepth() - 8), 4, "pps_bit_depth_for_depth_layers_minus8");382 383 for( Int i = 0; i <= pcPPS->getDLT()->getNumDepthViews()-1; i++ )384 {385 Int layerId = pcPPS->getDLT()->getDepthIdxToLayerId(i);386 387 WRITE_FLAG( pcPPS->getDLT()->getUseDLTFlag( layerId ) ? 1 : 0, "dlt_flag[i]" );388 389 if ( pcPPS->getDLT()->getUseDLTFlag( layerId ) )390 {391 std::vector<Int> aiIdx2DepthValue_coded(256, 0);392 UInt uiNumDepthValues_coded = pcPPS->getDLT()->getNumDepthValues(layerId);393 394 // ----------------------------- Actual coding -----------------------------395 WRITE_FLAG( pcPPS->getDLT()->getInterViewDltPredEnableFlag( layerId ) ? 1 : 0, "dlt_pred_flag[i]");396 if ( pcPPS->getDLT()->getInterViewDltPredEnableFlag( layerId ) == false )397 {398 WRITE_FLAG( pcPPS->getDLT()->getUseBitmapRep( layerId ) ? 1 : 0, "dlt_val_flags_present_flag[i]" );399 400 for( UInt ui = 0; ui<uiNumDepthValues_coded; ui++ )401 {402 aiIdx2DepthValue_coded[ui] = pcPPS->getDLT()->idx2DepthValue(layerId, ui);403 }404 }405 else406 {407 AOF( layerId > 1 );408 // assumes ref layer id to be 1409 std::vector<Int> viRefDLT = pcPPS->getDLT()->idx2DepthValue( 1 );410 UInt uiRefNum = pcPPS->getDLT()->getNumDepthValues( 1 );411 pcPPS->getDLT()->getDeltaDLT(layerId, viRefDLT, uiRefNum, aiIdx2DepthValue_coded, uiNumDepthValues_coded);412 }413 414 // bit map coding415 if ( pcPPS->getDLT()->getUseBitmapRep( layerId ) )416 {417 UInt uiDltArrayIndex = 0;418 for (UInt d=0; d < 256; d++)419 {420 if ( d == aiIdx2DepthValue_coded[uiDltArrayIndex] )421 {422 WRITE_FLAG(1, "dlt_value_flag[i][j]");423 uiDltArrayIndex++;424 }425 else426 {427 WRITE_FLAG(0, "dlt_value_flag[i][j]");428 }429 }430 }431 // Diff Coding432 else433 {434 UInt uiMaxDiff = 0;435 UInt uiMinDiff = MAX_INT;436 UInt uiLengthMinDiff = 0;437 UInt uiLengthDltDiffMinusMin = 0;438 439 std::vector<UInt> puiDltDiffValues(uiNumDepthValues_coded, 0);440 441 for (UInt d = 1; d < uiNumDepthValues_coded; d++)442 {443 puiDltDiffValues[d] = aiIdx2DepthValue_coded[d] - aiIdx2DepthValue_coded[d-1];444 445 if ( uiMaxDiff < puiDltDiffValues[d] )446 {447 uiMaxDiff = puiDltDiffValues[d];448 }449 450 if ( uiMinDiff > puiDltDiffValues[d] )451 {452 uiMinDiff = puiDltDiffValues[d];453 }454 }455 456 if ( uiNumDepthValues_coded > 2 )457 {458 uiLengthMinDiff = (UInt) gCeilLog2(uiMaxDiff + 1);459 }460 if (uiMaxDiff > uiMinDiff)461 {462 uiLengthDltDiffMinusMin = (UInt) gCeilLog2(uiMaxDiff - uiMinDiff + 1);463 }464 465 WRITE_CODE(uiNumDepthValues_coded, 8, "num_val_delta_dlt"); // num_entry466 {467 // The condition if( uiNumDepthValues_coded > 0 ) is always true since for Single-view Diff Coding, there is at least one depth value in depth component.468 if ( uiNumDepthValues_coded > 1 )469 {470 WRITE_CODE(uiMaxDiff, 8, "max_diff"); // max_diff471 }472 473 if ( uiNumDepthValues_coded > 2 )474 {475 WRITE_CODE((uiMinDiff - 1), uiLengthMinDiff, "min_diff_minus1"); // min_diff_minus1476 }477 478 WRITE_CODE(aiIdx2DepthValue_coded[0], 8, "delta_dlt_val0"); // entry0479 480 if (uiMaxDiff > uiMinDiff)481 {482 for (UInt d=1; d < uiNumDepthValues_coded; d++)483 {484 WRITE_CODE( (puiDltDiffValues[d] - uiMinDiff), uiLengthDltDiffMinusMin, "delta_val_diff_minus_min[k]"); // entry_value_diff_minus_min[ k ]485 }486 }487 }488 489 }490 }491 }492 }493 #endif494 }495 #endif496 347 497 348 Void TEncCavlc::codeVUI( const TComVUI *pcVUI, const TComSPS* pcSPS ) … … 932 783 } 933 784 934 #if NH_3D935 if ( pcSPS->getSps3dExtensionFlag() )936 {937 codeSPS3dExtension( pcSPS );938 }939 940 #endif941 785 #endif 942 786 xWriteRbspTrailingBits(); … … 965 809 #endif 966 810 967 #if NH_3D968 Void TEncCavlc::codeSPS3dExtension( const TComSPS* pcSPS )969 {970 const TComSps3dExtension* sps3dExt = pcSPS->getSps3dExtension();971 for( Int d = 0; d <= 1; d++ )972 {973 WRITE_FLAG( sps3dExt->getIvMvPredFlag( d ) ? 1 : 0 , "iv_mv_pred_flag" );974 WRITE_FLAG( sps3dExt->getIvMvScalingFlag( d ) ? 1 : 0 , "iv_mv_scaling_flag" );975 if( d == 0 )976 {977 WRITE_UVLC( sps3dExt->getLog2SubPbSizeMinus3( d ), "log2_sub_pb_size_minus3" );978 WRITE_FLAG( sps3dExt->getIvResPredFlag( d ) ? 1 : 0 , "iv_res_pred_flag" );979 WRITE_FLAG( sps3dExt->getDepthRefinementFlag( d ) ? 1 : 0 , "depth_refinement_flag" );980 WRITE_FLAG( sps3dExt->getViewSynthesisPredFlag( d ) ? 1 : 0 , "view_synthesis_pred_flag" );981 WRITE_FLAG( sps3dExt->getDepthBasedBlkPartFlag( d ) ? 1 : 0 , "depth_based_blk_part_flag" );982 }983 else984 {985 WRITE_FLAG( sps3dExt->getMpiFlag( d ) ? 1 : 0 , "mpi_flag" );986 WRITE_UVLC( sps3dExt->getLog2MpiSubPbSizeMinus3( d ), "log2_mpi_sub_pb_size_minus3" );987 WRITE_FLAG( sps3dExt->getIntraContourFlag( d ) ? 1 : 0 , "intra_contour_flag" );988 WRITE_FLAG( sps3dExt->getIntraSdcWedgeFlag( d ) ? 1 : 0 , "intra_sdc_wedge_flag" );989 WRITE_FLAG( sps3dExt->getQtPredFlag( d ) ? 1 : 0 , "qt_pred_flag" );990 WRITE_FLAG( sps3dExt->getInterSdcFlag( d ) ? 1 : 0 , "inter_sdc_flag" );991 WRITE_FLAG( sps3dExt->getDepthIntraSkipFlag( d ) ? 1 : 0 , "intra_skip_flag" );992 }993 }994 }995 #endif996 811 997 812 … … 1092 907 m_pcBitIf->writeAlignOne(); 1093 908 codeVPSExtension( pcVPS ); 1094 #if NH_3D1095 WRITE_FLAG( 1, "vps_extension2_flag" );1096 WRITE_FLAG( 1, "vps_3d_extension_flag" );1097 m_pcBitIf->writeAlignOne();1098 codeVPS3dExtension( pcVPS );1099 WRITE_FLAG( 0, "vps_extension3_flag" );1100 #else1101 909 WRITE_FLAG( 0, "vps_extension2_flag" ); 1102 #endif1103 910 #else 1104 911 WRITE_FLAG( 0, "vps_extension_flag" ); … … 1692 1499 #endif 1693 1500 1694 #if NH_3D1695 Void TEncCavlc::codeVPS3dExtension( const TComVPS* pcVPS )1696 {1697 WRITE_UVLC( pcVPS->getCpPrecision( ), "cp_precision" );1698 for (Int n = 1; n < pcVPS->getNumViews(); n++)1699 {1700 Int i = pcVPS->getViewOIdxList( n );1701 Int iInVps = pcVPS->getVoiInVps( i );1702 WRITE_CODE( pcVPS->getNumCp( iInVps ), 6, "num_cp" );1703 1704 if( pcVPS->getNumCp( iInVps ) > 0 )1705 {1706 WRITE_FLAG( pcVPS->getCpInSliceSegmentHeaderFlag( iInVps ) ? 1 : 0 , "cp_in_slice_segment_header_flag" );1707 for( Int m = 0; m < pcVPS->getNumCp( iInVps ); m++ )1708 {1709 WRITE_UVLC( pcVPS->getCpRefVoi( iInVps, m ), "cp_ref_voi" );1710 if( !pcVPS->getCpInSliceSegmentHeaderFlag( iInVps ) )1711 {1712 Int j = pcVPS->getCpRefVoi( iInVps, m );1713 Int jInVps = pcVPS->getVoiInVps( j );1714 WRITE_SVLC( pcVPS->getVpsCpScale ( iInVps, jInVps ), "vps_cp_scale" );1715 WRITE_SVLC( pcVPS->getVpsCpOff ( iInVps, jInVps ), "vps_cp_off" );1716 WRITE_SVLC( pcVPS->getVpsCpInvScale( iInVps, jInVps ) + pcVPS->getVpsCpScale( iInVps, jInVps ), "vps_cp_inv_scale_plus_scale" );1717 WRITE_SVLC( pcVPS->getVpsCpInvOff ( iInVps, jInVps ) + pcVPS->getVpsCpOff ( iInVps, jInVps ), "vps_cp_inv_off_plus_off" );1718 }1719 }1720 }1721 }1722 }1723 #endif1724 1501 1725 1502 … … 1764 1541 WRITE_FLAG( pcSlice->getNoOutputPriorPicsFlag() ? 1 : 0, "no_output_of_prior_pics_flag" ); 1765 1542 } 1766 #if PPS_FIX_DEPTH1767 if( pcSlice->getIsDepth() )1768 {1769 WRITE_UVLC( 1, "slice_pic_parameter_set_id" );1770 }1771 else1772 #endif1773 1543 WRITE_UVLC( pcSlice->getPPS()->getPPSId(), "slice_pic_parameter_set_id" ); 1774 1544 if ( pcSlice->getPPS()->getDependentSliceSegmentsEnabledFlag() && (sliceSegmentRsAddress!=0) ) … … 1971 1741 Bool interLayerPredLayerIdcPresentFlag = false; 1972 1742 Int layerId = pcSlice->getLayerId(); 1973 #if NH_3D1974 if( pcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumRefListLayers( layerId ) > 0 )1975 #else1976 1743 if( pcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumDirectRefLayers( layerId ) > 0 ) 1977 #endif1978 1744 { 1979 1745 WRITE_FLAG( pcSlice->getInterLayerPredEnabledFlag( ) ? 1 : 0 , "inter_layer_pred_enabled_flag" ); 1980 #if NH_3D1981 if( pcSlice->getInterLayerPredEnabledFlag() && vps->getNumRefListLayers( layerId ) > 1 )1982 #else1983 1746 if( pcSlice->getInterLayerPredEnabledFlag() && vps->getNumDirectRefLayers( layerId ) > 1 ) 1984 #endif1985 1747 { 1986 1748 if( !vps->getMaxOneActiveRefLayerFlag()) … … 1988 1750 WRITE_CODE( pcSlice->getNumInterLayerRefPicsMinus1( ), pcSlice->getNumInterLayerRefPicsMinus1Len( ), "num_inter_layer_ref_pics_minus1" ); 1989 1751 } 1990 #if NH_3D1991 if ( pcSlice->getNumActiveRefLayerPics() != vps->getNumRefListLayers( layerId ) )1992 #else1993 1752 if ( pcSlice->getNumActiveRefLayerPics() != vps->getNumDirectRefLayers( layerId ) ) 1994 #endif1995 1753 { 1996 1754 interLayerPredLayerIdcPresentFlag = true; … … 2011 1769 #endif 2012 1770 2013 #if NH_3D2014 if( getEncTop()->decProcAnnexI() )2015 {2016 if ( pcSlice->getInCmpPredAvailFlag() )2017 {2018 WRITE_FLAG( pcSlice->getInCompPredFlag(), "in_comp_pred_flag" );2019 }2020 }2021 #endif2022 1771 2023 1772 if(pcSlice->getSPS()->getUseSAO()) … … 2035 1784 { 2036 1785 Bool overrideFlag = (pcSlice->getNumRefIdx( REF_PIC_LIST_0 )!=pcSlice->getPPS()->getNumRefIdxL0DefaultActive()||(pcSlice->isInterB()&&pcSlice->getNumRefIdx( REF_PIC_LIST_1 )!=pcSlice->getPPS()->getNumRefIdxL1DefaultActive())); 2037 #if PPS_FIX_DEPTH2038 overrideFlag |= (pcSlice->getIsDepth() && !pcSlice->getViewIndex());2039 #endif2040 1786 WRITE_FLAG( overrideFlag ? 1 : 0, "num_ref_idx_active_override_flag"); 2041 1787 if (overrideFlag) … … 2057 1803 pcSlice->setNumRefIdx(REF_PIC_LIST_1, 0); 2058 1804 } 2059 #if PPS_FIX_DEPTH2060 if( (pcSlice->getPPS()->getListsModificationPresentFlag() || (pcSlice->getIsDepth() && !pcSlice->getViewIndex())) && pcSlice->getNumRpsCurrTempList() > 1)2061 #else2062 1805 if( pcSlice->getPPS()->getListsModificationPresentFlag() && pcSlice->getNumRpsCurrTempList() > 1) 2063 #endif2064 1806 { 2065 1807 TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification(); … … 2143 1885 xCodePredWeightTable( pcSlice ); 2144 1886 } 2145 #if NH_3D_IC2146 else if( pcSlice->getViewIndex() && ( pcSlice->getSliceType() == P_SLICE || pcSlice->getSliceType() == B_SLICE )2147 && !pcSlice->getIsDepth() && vps->getNumRefListLayers( layerId ) > 02148 && getEncTop()->decProcAnnexI()2149 )2150 {2151 WRITE_FLAG( pcSlice->getApplyIC() ? 1 : 0, "slice_ic_enable_flag" );2152 if( pcSlice->getApplyIC() )2153 {2154 WRITE_FLAG( pcSlice->getIcSkipParseFlag() ? 1 : 0, "slice_ic_disabled_merge_zero_idx_flag" );2155 }2156 }2157 #endif2158 #if NH_3D_IV_MERGE2159 assert(pcSlice->getMaxNumMergeCand()<=MRG_MAX_NUM_CANDS_MEM);2160 #else2161 1887 assert(pcSlice->getMaxNumMergeCand()<=MRG_MAX_NUM_CANDS); 2162 #endif2163 1888 if (!pcSlice->isIntra()) 2164 1889 { 2165 #if NH_3D_IV_MERGE2166 WRITE_UVLC( ( ( pcSlice->getMpiFlag( ) || pcSlice->getIvMvPredFlag( ) || pcSlice->getViewSynthesisPredFlag( ) ) ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS ) - pcSlice->getMaxNumMergeCand(), "five_minus_max_num_merge_cand");2167 #else2168 1890 WRITE_UVLC(MRG_MAX_NUM_CANDS - pcSlice->getMaxNumMergeCand(), "five_minus_max_num_merge_cand"); 2169 #endif2170 1891 } 2171 1892 Int iCode = pcSlice->getSliceQp() - ( pcSlice->getPPS()->getPicInitQPMinus26() + 26 ); … … 2213 1934 WRITE_FLAG(pcSlice->getLFCrossSliceBoundaryFlag()?1:0, "slice_loop_filter_across_slices_enabled_flag"); 2214 1935 } 2215 #if NH_3D2216 if (getEncTop()->decProcAnnexI() )2217 {2218 Int voiInVps = vps->getVoiInVps( pcSlice->getViewIndex() );2219 if( vps->getCpInSliceSegmentHeaderFlag( voiInVps ) )2220 {2221 for( Int m = 0; m < vps->getNumCp( voiInVps ); m++ )2222 {2223 Int jInVps = vps->getVoiInVps( vps->getCpRefVoi( voiInVps, m ));2224 WRITE_SVLC( pcSlice->getCpScale ( jInVps ) , "cp_scale" );2225 WRITE_SVLC( pcSlice->getCpOff ( jInVps ) , "cp_off" );2226 WRITE_SVLC( pcSlice->getCpInvScale( jInVps ) + pcSlice->getCpScale( jInVps ) , "cp_inv_scale_plus_scale" );2227 WRITE_SVLC( pcSlice->getCpInvOff ( jInVps ) + pcSlice->getCpOff ( jInVps ) , "cp_inv_off_plus_off" );2228 }2229 }2230 }2231 #endif2232 1936 2233 1937 } … … 2535 2239 } 2536 2240 2537 #if NH_3D_ARP 2538 Void TEncCavlc::codeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx ) 2241 2242 2243 Void TEncCavlc::codeInterModeFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/, UInt /*uiEncMode*/ ) 2539 2244 { 2540 2245 assert(0); 2541 2246 } 2542 #endif 2543 2544 #if NH_3D_IC 2545 Void TEncCavlc::codeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) 2247 2248 Void TEncCavlc::codeCUTransquantBypassFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/ ) 2546 2249 { 2547 2250 assert(0); 2548 2251 } 2549 #endif 2550 2551 Void TEncCavlc::codeInterModeFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/, UInt /*uiEncMode*/ ) 2252 2253 Void TEncCavlc::codeSkipFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/ ) 2552 2254 { 2553 2255 assert(0); 2554 2256 } 2555 2556 Void TEncCavlc::codeCUTransquantBypassFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/ )2557 {2558 assert(0);2559 }2560 2561 Void TEncCavlc::codeSkipFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/ )2562 {2563 assert(0);2564 }2565 #if NH_3D_DIS2566 Void TEncCavlc::codeDIS( TComDataCU* pcCU, UInt uiAbsPartIdx )2567 {2568 assert(0);2569 }2570 #endif2571 2257 2572 2258 Void TEncCavlc::codeSplitFlag ( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) … … 2844 2530 assert(0); 2845 2531 } 2846 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER2847 Void TEncCavlc::codeSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx )2848 {2849 assert(0);2850 }2851 #endif2852 2532 2853 #if NH_3D_DBBP2854 Void TEncCavlc::codeDBBPFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx )2855 {2856 assert(0);2857 }2858 #endif2859 2533 2860 2534
Note: See TracChangeset for help on using the changeset viewer.