Changeset 414 in SHVCSoftware for branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
- Timestamp:
- 8 Oct 2013, 11:25:37 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
r411 r414 221 221 } 222 222 WRITE_FLAG( pcPPS->getScalingListPresentFlag() ? 1 : 0, "pps_scaling_list_data_present_flag" ); 223 224 #if IL_SL_SIGNALLING_N0371 225 pcPPS->setPPS( pcPPS->getLayerId(), pcPPS ); 226 #endif 227 223 228 if( pcPPS->getScalingListPresentFlag() ) 224 229 { … … 226 231 printf("PPS\n"); 227 232 #endif 233 234 #if IL_SL_SIGNALLING_N0371 235 m_pcSlice->getScalingList()->setLayerId( pcPPS->getLayerId() ); 236 237 if( pcPPS->getLayerId() > 0 ) 238 { 239 WRITE_FLAG( pcPPS->getPredScalingListFlag() ? 1 : 0, "pps_pred_scaling_list_flag" ); 240 m_pcSlice->getScalingList()->setPredScalingListFlag( pcPPS->getPredScalingListFlag() ); 241 242 if( pcPPS->getPredScalingListFlag() ) 243 { 244 // The value of pps_scaling_list_ref_layer_id shall be in the range of 0 to 62, inclusive 245 assert( pcPPS->getScalingListRefLayerId() >= 0 && pcPPS->getScalingListRefLayerId() <= 62 ); 246 247 // When avc_base_layer_flag is equal to 1, it is a requirement of bitstream conformance that the value of pps_scaling_list_ref_layer_id shall be greater than 0 248 if( pcPPS->getSPS()->getVPS()->getAvcBaseLayerFlag() ) 249 { 250 assert( pcPPS->getScalingListRefLayerId() > 0 ); 251 } 252 253 // It is a requirement of bitstream conformance that, when a PPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB and 254 // pps_infer_scaling_list_flag in the PPS is equal to 1, pps_infer_scaling_list_flag shall be equal to 0 for the PPS that is active for the layer with nuh_layer_id equal to pps_scaling_list_ref_layer_id 255 assert( pcPPS->getPPS( pcPPS->getScalingListRefLayerId() )->getPredScalingListFlag() == false ); 256 257 // It is a requirement of bitstream conformance that, when a PPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB, 258 // the layer with nuh_layer_id equal to pps_scaling_list_ref_layer_id shall be a direct or indirect reference layer of the layer with nuh_layer_id equal to nuhLayerIdB 259 assert( pcPPS->getSPS()->getVPS()->getScalingListLayerDependency( pcPPS->getLayerId(), pcPPS->getScalingListRefLayerId() ) == true ); 260 261 WRITE_UVLC( pcPPS->getScalingListRefLayerId(), "scaling_list_pps_ref_layer_id" ); 262 m_pcSlice->getScalingList()->setScalingListRefLayerId( pcPPS->getScalingListRefLayerId() ); 263 codeScalingList( m_pcSlice->getScalingList() ); 264 } 265 else 266 { 267 codeScalingList( m_pcSlice->getScalingList() ); 268 } 269 } 270 else 271 { 272 codeScalingList( m_pcSlice->getScalingList() ); 273 } 274 #else 228 275 codeScalingList( m_pcSlice->getScalingList() ); 276 #endif 277 229 278 } 230 279 WRITE_FLAG( pcPPS->getListsModificationPresentFlag(), "lists_modification_present_flag"); … … 489 538 WRITE_UVLC( pcSPS->getQuadtreeTUMaxDepthIntra() - 1, "max_transform_hierarchy_depth_intra" ); 490 539 WRITE_FLAG( pcSPS->getScalingListFlag() ? 1 : 0, "scaling_list_enabled_flag" ); 540 541 #if IL_SL_SIGNALLING_N0371 542 pcSPS->setSPS( pcSPS->getLayerId(), pcSPS ); 543 #endif 544 491 545 if(pcSPS->getScalingListFlag()) 492 546 { … … 497 551 printf("SPS\n"); 498 552 #endif 553 554 #if IL_SL_SIGNALLING_N0371 555 m_pcSlice->getScalingList()->setLayerId( pcSPS->getLayerId() ); 556 557 if( pcSPS->getLayerId() > 0 ) 558 { 559 WRITE_FLAG( pcSPS->getPredScalingListFlag() ? 1 : 0, "sps_pred_scaling_list_flag" ); 560 m_pcSlice->getScalingList()->setPredScalingListFlag( pcSPS->getPredScalingListFlag() ); 561 562 if( pcSPS->getPredScalingListFlag() ) 563 { 564 565 // The value of sps_scaling_list_ref_layer_id shall be in the range of 0 to 62, inclusive 566 assert( pcSPS->getScalingListRefLayerId() >= 0 && pcSPS->getScalingListRefLayerId() <= 62 ); 567 568 // When avc_base_layer_flag is equal to 1, it is a requirement of bitstream conformance that the value of sps_scaling_list_ref_layer_id shall be greater than 0 569 if( pcSPS->getVPS()->getAvcBaseLayerFlag() ) 570 { 571 assert( pcSPS->getScalingListRefLayerId() > 0 ); 572 } 573 574 // It is a requirement of bitstream conformance that, when an SPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB and 575 // sps_infer_scaling_list_flag in the SPS is equal to 1, sps_infer_scaling_list_flag shall be equal to 0 for the SPS that is active for the layer with nuh_layer_id equal to sps_scaling_list_ref_layer_id 576 assert( pcSPS->getSPS( pcSPS->getScalingListRefLayerId() )->getPredScalingListFlag() == false ); 577 578 // It is a requirement of bitstream conformance that, when an SPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB, 579 // the layer with nuh_layer_id equal to sps_scaling_list_ref_layer_id shall be a direct or indirect reference layer of the layer with nuh_layer_id equal to nuhLayerIdB 580 assert( pcSPS->getVPS()->getScalingListLayerDependency( pcSPS->getLayerId(), pcSPS->getScalingListRefLayerId() ) == true ); 581 582 WRITE_UVLC( pcSPS->getScalingListRefLayerId(), "scaling_list_sps_ref_layer_id" ); 583 m_pcSlice->getScalingList()->setScalingListRefLayerId( pcSPS->getScalingListRefLayerId() ); 584 codeScalingList( m_pcSlice->getScalingList() ); 585 } 586 else 587 { 588 codeScalingList( m_pcSlice->getScalingList() ); 589 } 590 } 591 else 592 { 499 593 codeScalingList( m_pcSlice->getScalingList() ); 594 } 595 #else 596 codeScalingList( m_pcSlice->getScalingList() ); 597 #endif 598 500 599 } 501 600 } … … 517 616 TComRPSList* rpsList = pcSPS->getRPSList(); 518 617 TComReferencePictureSet* rps; 519 618 520 619 WRITE_UVLC(rpsList->getNumberOfReferencePictureSets(), "num_short_term_ref_pic_sets" ); 521 620 for(Int i=0; i < rpsList->getNumberOfReferencePictureSets(); i++) … … 949 1048 } 950 1049 } 1050 1051 #if IL_SL_SIGNALLING_N0371 1052 for(i = 1; i < vps->getMaxLayers(); i++) 1053 { 1054 for(j = 0; j < i; j++) 1055 { 1056 vps->setScalingListLayerDependency( i, j, vps->checkLayerDependency( i,j ) ); 1057 } 1058 } 1059 #endif 1060 951 1061 #endif 952 1062 #if M0040_ADAPTIVE_RESOLUTION_CHANGE … … 1901 2011 startBit = m_pcBitIf->getNumberOfWrittenBits(); 1902 2012 #endif 2013 2014 #if IL_SL_SIGNALLING_N0371 2015 if( scalingList->getLayerId() > 0 && scalingList->getPredScalingListFlag() ) 2016 { 2017 scalingListPredModeFlag = scalingList->checkPredMode( sizeId, listId ); 2018 WRITE_FLAG( scalingListPredModeFlag, "scaling_list_pred_mode_flag" ); 2019 if(!scalingListPredModeFlag)// Copy Mode 2020 { 2021 WRITE_UVLC( (Int)listId - (Int)scalingList->getRefMatrixId (sizeId,listId), "scaling_list_pred_matrix_id_delta"); 2022 } 2023 else// DPCM Mode 2024 { 2025 xCodeScalingList(scalingList, sizeId, listId); 2026 } 2027 } 2028 else 2029 { 2030 scalingListPredModeFlag = scalingList->checkPredMode( sizeId, listId ); 2031 WRITE_FLAG( scalingListPredModeFlag, "scaling_list_pred_mode_flag" ); 2032 if(!scalingListPredModeFlag)// Copy Mode 2033 { 2034 WRITE_UVLC( (Int)listId - (Int)scalingList->getRefMatrixId (sizeId,listId), "scaling_list_pred_matrix_id_delta"); 2035 } 2036 else// DPCM Mode 2037 { 2038 xCodeScalingList(scalingList, sizeId, listId); 2039 } 2040 } 2041 #else 1903 2042 scalingListPredModeFlag = scalingList->checkPredMode( sizeId, listId ); 1904 2043 WRITE_FLAG( scalingListPredModeFlag, "scaling_list_pred_mode_flag" ); … … 1911 2050 xCodeScalingList(scalingList, sizeId, listId); 1912 2051 } 2052 #endif 2053 1913 2054 #if SCALING_LIST_OUTPUT_RESULT 1914 2055 printf("Matrix [%d][%d] Bit %d\n",sizeId,listId,m_pcBitIf->getNumberOfWrittenBits() - startBit); 1915 2056 #endif 2057 1916 2058 } 1917 2059 } … … 1933 2075 Int data; 1934 2076 Int *src = scalingList->getScalingListAddress(sizeId, listId); 2077 1935 2078 if( sizeId > SCALING_LIST_8x8 ) 1936 2079 { 2080 #if IL_SL_SIGNALLING_N0371 2081 if( scalingList->getLayerId() > 0 && scalingList->getPredScalingListFlag() ) 2082 { 2083 ref_scalingListDC[scalingList->getLayerId()][sizeId][listId] = scalingList->getScalingListDC(sizeId,listId); 2084 scalingList->setScalingListDC(sizeId,listId,ref_scalingListDC[scalingList->getScalingListRefLayerId()][sizeId][listId]); 2085 } 2086 else 2087 { 2088 WRITE_SVLC( scalingList->getScalingListDC(sizeId,listId) - 8, "scaling_list_dc_coef_minus8"); 2089 nextCoef = scalingList->getScalingListDC(sizeId,listId); 2090 ref_scalingListDC[scalingList->getLayerId()][sizeId][listId] = scalingList->getScalingListDC(sizeId,listId); 2091 } 2092 #else 1937 2093 WRITE_SVLC( scalingList->getScalingListDC(sizeId,listId) - 8, "scaling_list_dc_coef_minus8"); 1938 2094 nextCoef = scalingList->getScalingListDC(sizeId,listId); 2095 #endif 1939 2096 } 1940 2097 for(Int i=0;i<coefNum;i++) 1941 2098 { 2099 #if IL_SL_SIGNALLING_N0371 2100 if( scalingList->getLayerId() > 0 && scalingList->getPredScalingListFlag() ) 2101 { 2102 ref_scalingListCoef[scalingList->getLayerId()][sizeId][listId][i] = src[scan[i]]; 2103 src[scan[i]] = ref_scalingListCoef[scalingList->getScalingListRefLayerId()][sizeId][listId][i]; 2104 } 2105 else 2106 { 2107 data = src[scan[i]] - nextCoef; 2108 ref_scalingListCoef[scalingList->getLayerId()][sizeId][listId][i] = src[scan[i]]; 2109 nextCoef = src[scan[i]]; 2110 if(data > 127) 2111 { 2112 data = data - 256; 2113 } 2114 if(data < -128) 2115 { 2116 data = data + 256; 2117 } 2118 2119 WRITE_SVLC( data, "scaling_list_delta_coef"); 2120 } 2121 #else 1942 2122 data = src[scan[i]] - nextCoef; 1943 2123 nextCoef = src[scan[i]]; … … 1952 2132 1953 2133 WRITE_SVLC( data, "scaling_list_delta_coef"); 2134 #endif 1954 2135 } 1955 2136 }
Note: See TracChangeset for help on using the changeset viewer.