Changeset 628 in SHVCSoftware for branches/SHM-5.1-dev/source/Lib/TLibDecoder
- Timestamp:
- 14 Mar 2014, 15:29:06 (12 years ago)
- Location:
- branches/SHM-5.1-dev/source/Lib/TLibDecoder
- Files:
-
- 3 edited
-
SEIread.cpp (modified) (6 diffs)
-
SEIread.h (modified) (2 diffs)
-
TDecCAVLC.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-5.1-dev/source/Lib/TLibDecoder/SEIread.cpp
r616 r628 111 111 #endif 112 112 #if SUB_BITSTREAM_PROPERTY_SEI 113 case SEI::SUB_BITSTREAM_PROPERTY: 114 fprintf( g_hTrace, "=========== Sub-bitstream property SEI message ===========\n"); 115 break; 113 case SEI::SUB_BITSTREAM_PROPERTY: 114 fprintf( g_hTrace, "=========== Sub-bitstream property SEI message ===========\n"); 115 break; 116 #endif 117 #if O0164_MULTI_LAYER_HRD 118 case SEI::BSP_NESTING: 119 fprintf( g_hTrace, "=========== Bitstream parition nesting SEI message ===========\n"); 120 break; 121 case SEI::BSP_INITIAL_ARRIVAL_TIME: 122 fprintf( g_hTrace, "=========== Bitstream parition initial arrival time SEI message ===========\n"); 123 break; 124 case SEI::BSP_HRD: 125 fprintf( g_hTrace, "=========== Bitstream parition HRD parameters SEI message ===========\n"); 126 break; 116 127 #endif 117 128 #endif //SVC_EXTENSION … … 152 163 } 153 164 165 #if O0164_MULTI_LAYER_HRD 166 #if LAYERS_NOT_PRESENT_SEI 167 Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps, const SEIScalableNesting *nestingSei, const SEIBspNesting *bspNestingSei) 168 #else 169 Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps, const SEIScalableNesting *nestingSei) 170 #endif 171 #else 154 172 #if LAYERS_NOT_PRESENT_SEI 155 173 Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps) 156 174 #else 157 175 Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps) 176 #endif 158 177 #endif 159 178 { … … 272 291 xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, sps); 273 292 #endif 293 break; 274 294 #if SVC_EXTENSION 275 295 #if LAYERS_NOT_PRESENT_SEI … … 296 316 sei = new SEISubBitstreamProperty; 297 317 xParseSEISubBitstreamProperty((SEISubBitstreamProperty&) *sei); 318 break; 319 #endif 320 #if O0164_MULTI_LAYER_HRD 321 case SEI::BSP_NESTING: 322 sei = new SEIBspNesting; 323 #if LAYERS_NOT_PRESENT_SEI 324 xParseSEIBspNesting((SEIBspNesting&) *sei, nalUnitType, vps, sps, *nestingSei); 325 #else 326 xParseSEIBspNesting((SEIBspNesting&) *sei, nalUnitType, sps, *nestingSei); 327 #endif 328 break; 329 case SEI::BSP_INITIAL_ARRIVAL_TIME: 330 sei = new SEIBspInitialArrivalTime; 331 xParseSEIBspInitialArrivalTime((SEIBspInitialArrivalTime&) *sei, vps, sps, *nestingSei, *bspNestingSei); 332 break; 333 case SEI::BSP_HRD: 334 sei = new SEIBspHrd; 335 xParseSEIBspHrd((SEIBspHrd&) *sei, sps, *nestingSei); 298 336 break; 299 337 #endif … … 870 908 // read nested SEI messages 871 909 do { 910 #if O0164_MULTI_LAYER_HRD 911 #if LAYERS_NOT_PRESENT_SEI 912 xReadSEImessage(sei.m_nestedSEIs, nalUnitType, vps, sps, &sei); 913 #else 914 xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps, &sei); 915 #endif 916 #else 872 917 #if LAYERS_NOT_PRESENT_SEI 873 918 xReadSEImessage(sei.m_nestedSEIs, nalUnitType, vps, sps); 874 919 #else 875 920 xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps); 921 #endif 876 922 #endif 877 923 } while (m_pcBitstream->getNumBitsLeft() > 8); … … 974 1020 } 975 1021 #endif 1022 1023 #if O0164_MULTI_LAYER_HRD 1024 #if LAYERS_NOT_PRESENT_SEI 1025 Void SEIReader::xParseSEIBspNesting(SEIBspNesting &sei, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei) 1026 #else 1027 Void SEIReader::xParseSEIBspNesting(SEIBspNesting &sei, const NalUnitType nalUnitType, TComSPS *sps, const SEIScalableNesting &nestingSei) 1028 #endif 1029 { 1030 UInt uiCode; 1031 READ_UVLC( uiCode, "bsp_idx" ); sei.m_bspIdx = uiCode; 1032 1033 // byte alignment 1034 while ( m_pcBitstream->getNumBitsRead() % 8 != 0 ) 1035 { 1036 UInt code; 1037 READ_FLAG( code, "bsp_nesting_zero_bit" ); 1038 } 1039 1040 sei.m_callerOwnsSEIs = false; 1041 1042 // read nested SEI messages 1043 do { 1044 #if LAYERS_NOT_PRESENT_SEI 1045 xReadSEImessage(sei.m_nestedSEIs, nalUnitType, vps, sps, &nestingSei, &sei); 1046 #else 1047 xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps, &nestingSei); 1048 #endif 1049 } while (m_pcBitstream->getNumBitsLeft() > 8); 1050 } 1051 1052 Void SEIReader::xParseSEIBspInitialArrivalTime(SEIBspInitialArrivalTime &sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei, const SEIBspNesting &bspNestingSei) 1053 { 1054 assert(vps->getVpsVuiPresentFlag()); 1055 1056 UInt schedCombCnt = vps->getNumBspSchedCombinations(nestingSei.m_nestingOpIdx[0]); 1057 UInt len; 1058 UInt hrdIdx; 1059 UInt uiCode; 1060 1061 if (schedCombCnt > 0) 1062 { 1063 hrdIdx = vps->getBspCombHrdIdx(nestingSei.m_nestingOpIdx[0], 0, bspNestingSei.m_bspIdx); 1064 } 1065 else 1066 { 1067 hrdIdx = 0; 1068 } 1069 1070 TComHRD *hrd = vps->getBspHrd(hrdIdx); 1071 1072 if (hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag()) 1073 { 1074 len = hrd->getInitialCpbRemovalDelayLengthMinus1() + 1; 1075 } 1076 else 1077 { 1078 len = 23 + 1; 1079 } 1080 1081 if (hrd->getNalHrdParametersPresentFlag()) 1082 { 1083 for(UInt i = 0; i < schedCombCnt; i++) 1084 { 1085 READ_CODE( len, uiCode, "nal_initial_arrival_delay" ); sei.m_nalInitialArrivalDelay[i] = uiCode; 1086 } 1087 } 1088 else 1089 { 1090 for(UInt i = 0; i < schedCombCnt; i++) 1091 { 1092 READ_CODE( len, uiCode, "vcl_initial_arrival_delay" ); sei.m_vclInitialArrivalDelay[i] = uiCode; 1093 } 1094 } 1095 } 1096 1097 Void SEIReader::xParseSEIBspHrd(SEIBspHrd &sei, TComSPS *sps, const SEIScalableNesting &nestingSei) 1098 { 1099 UInt uiCode; 1100 READ_UVLC( uiCode, "sei_num_bsp_hrd_parameters_minus1" ); sei.m_seiNumBspHrdParametersMinus1 = uiCode; 1101 for (UInt i = 0; i <= sei.m_seiNumBspHrdParametersMinus1; i++) 1102 { 1103 if (i > 0) 1104 { 1105 READ_FLAG( uiCode, "sei_bsp_cprms_present_flag" ); sei.m_seiBspCprmsPresentFlag[i] = uiCode; 1106 } 1107 xParseHrdParameters(sei.hrd, i==0 ? 1 : sei.m_seiBspCprmsPresentFlag[i], nestingSei.m_nestingMaxTemporalIdPlus1[0]-1); 1108 } 1109 for (UInt h = 0; h <= nestingSei.m_nestingNumOpsMinus1; h++) 1110 { 1111 UInt lsIdx = nestingSei.m_nestingOpIdx[h]; 1112 READ_UVLC( uiCode, "num_sei_bitstream_partitions_minus1[i]"); sei.m_seiNumBitstreamPartitionsMinus1[lsIdx] = uiCode; 1113 for (UInt i = 0; i <= sei.m_seiNumBitstreamPartitionsMinus1[lsIdx]; i++) 1114 { 1115 for (UInt j = 0; j < sei.m_vpsMaxLayers; j++) 1116 { 1117 if (sei.m_layerIdIncludedFlag[lsIdx][j]) 1118 { 1119 READ_FLAG( uiCode, "sei_layer_in_bsp_flag[lsIdx][i][j]" ); sei.m_seiLayerInBspFlag[lsIdx][i][j] = uiCode; 1120 } 1121 } 1122 } 1123 READ_UVLC( uiCode, "sei_num_bsp_sched_combinations_minus1[i]"); sei.m_seiNumBspSchedCombinationsMinus1[lsIdx] = uiCode; 1124 for (UInt i = 0; i <= sei.m_seiNumBspSchedCombinationsMinus1[lsIdx]; i++) 1125 { 1126 for (UInt j = 0; j <= sei.m_seiNumBitstreamPartitionsMinus1[lsIdx]; j++) 1127 { 1128 READ_UVLC( uiCode, "sei_bsp_comb_hrd_idx[lsIdx][i][j]"); sei.m_seiBspCombHrdIdx[lsIdx][i][j] = uiCode; 1129 READ_UVLC( uiCode, "sei_bsp_comb_sched_idx[lsIdx][i][j]"); sei.m_seiBspCombScheddx[lsIdx][i][j] = uiCode; 1130 } 1131 } 1132 } 1133 } 1134 1135 Void SEIReader::xParseHrdParameters(TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1) 1136 { 1137 UInt uiCode; 1138 if( commonInfPresentFlag ) 1139 { 1140 READ_FLAG( uiCode, "nal_hrd_parameters_present_flag" ); hrd->setNalHrdParametersPresentFlag( uiCode == 1 ? true : false ); 1141 READ_FLAG( uiCode, "vcl_hrd_parameters_present_flag" ); hrd->setVclHrdParametersPresentFlag( uiCode == 1 ? true : false ); 1142 if( hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag() ) 1143 { 1144 READ_FLAG( uiCode, "sub_pic_cpb_params_present_flag" ); hrd->setSubPicCpbParamsPresentFlag( uiCode == 1 ? true : false ); 1145 if( hrd->getSubPicCpbParamsPresentFlag() ) 1146 { 1147 READ_CODE( 8, uiCode, "tick_divisor_minus2" ); hrd->setTickDivisorMinus2( uiCode ); 1148 READ_CODE( 5, uiCode, "du_cpb_removal_delay_length_minus1" ); hrd->setDuCpbRemovalDelayLengthMinus1( uiCode ); 1149 READ_FLAG( uiCode, "sub_pic_cpb_params_in_pic_timing_sei_flag" ); hrd->setSubPicCpbParamsInPicTimingSEIFlag( uiCode == 1 ? true : false ); 1150 READ_CODE( 5, uiCode, "dpb_output_delay_du_length_minus1" ); hrd->setDpbOutputDelayDuLengthMinus1( uiCode ); 1151 } 1152 READ_CODE( 4, uiCode, "bit_rate_scale" ); hrd->setBitRateScale( uiCode ); 1153 READ_CODE( 4, uiCode, "cpb_size_scale" ); hrd->setCpbSizeScale( uiCode ); 1154 if( hrd->getSubPicCpbParamsPresentFlag() ) 1155 { 1156 READ_CODE( 4, uiCode, "cpb_size_du_scale" ); hrd->setDuCpbSizeScale( uiCode ); 1157 } 1158 READ_CODE( 5, uiCode, "initial_cpb_removal_delay_length_minus1" ); hrd->setInitialCpbRemovalDelayLengthMinus1( uiCode ); 1159 READ_CODE( 5, uiCode, "au_cpb_removal_delay_length_minus1" ); hrd->setCpbRemovalDelayLengthMinus1( uiCode ); 1160 READ_CODE( 5, uiCode, "dpb_output_delay_length_minus1" ); hrd->setDpbOutputDelayLengthMinus1( uiCode ); 1161 } 1162 } 1163 Int i, j, nalOrVcl; 1164 for( i = 0; i <= maxNumSubLayersMinus1; i ++ ) 1165 { 1166 READ_FLAG( uiCode, "fixed_pic_rate_general_flag" ); hrd->setFixedPicRateFlag( i, uiCode == 1 ? true : false ); 1167 if( !hrd->getFixedPicRateFlag( i ) ) 1168 { 1169 READ_FLAG( uiCode, "fixed_pic_rate_within_cvs_flag" ); hrd->setFixedPicRateWithinCvsFlag( i, uiCode == 1 ? true : false ); 1170 } 1171 else 1172 { 1173 hrd->setFixedPicRateWithinCvsFlag( i, true ); 1174 } 1175 hrd->setLowDelayHrdFlag( i, 0 ); // Infered to be 0 when not present 1176 hrd->setCpbCntMinus1 ( i, 0 ); // Infered to be 0 when not present 1177 if( hrd->getFixedPicRateWithinCvsFlag( i ) ) 1178 { 1179 READ_UVLC( uiCode, "elemental_duration_in_tc_minus1" ); hrd->setPicDurationInTcMinus1( i, uiCode ); 1180 } 1181 else 1182 { 1183 READ_FLAG( uiCode, "low_delay_hrd_flag" ); hrd->setLowDelayHrdFlag( i, uiCode == 1 ? true : false ); 1184 } 1185 if (!hrd->getLowDelayHrdFlag( i )) 1186 { 1187 READ_UVLC( uiCode, "cpb_cnt_minus1" ); hrd->setCpbCntMinus1( i, uiCode ); 1188 } 1189 for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) 1190 { 1191 if( ( ( nalOrVcl == 0 ) && ( hrd->getNalHrdParametersPresentFlag() ) ) || 1192 ( ( nalOrVcl == 1 ) && ( hrd->getVclHrdParametersPresentFlag() ) ) ) 1193 { 1194 for( j = 0; j <= ( hrd->getCpbCntMinus1( i ) ); j ++ ) 1195 { 1196 READ_UVLC( uiCode, "bit_rate_value_minus1" ); hrd->setBitRateValueMinus1( i, j, nalOrVcl, uiCode ); 1197 READ_UVLC( uiCode, "cpb_size_value_minus1" ); hrd->setCpbSizeValueMinus1( i, j, nalOrVcl, uiCode ); 1198 if( hrd->getSubPicCpbParamsPresentFlag() ) 1199 { 1200 READ_UVLC( uiCode, "cpb_size_du_value_minus1" ); hrd->setDuCpbSizeValueMinus1( i, j, nalOrVcl, uiCode ); 1201 READ_UVLC( uiCode, "bit_rate_du_value_minus1" ); hrd->setDuBitRateValueMinus1( i, j, nalOrVcl, uiCode ); 1202 } 1203 READ_FLAG( uiCode, "cbr_flag" ); hrd->setCbrFlag( i, j, nalOrVcl, uiCode == 1 ? true : false ); 1204 } 1205 } 1206 } 1207 } 1208 } 1209 #endif 1210 976 1211 #endif //SVC_EXTENSION 977 1212 -
branches/SHM-5.1-dev/source/Lib/TLibDecoder/SEIread.h
r616 r628 62 62 #endif 63 63 protected: 64 #if O0164_MULTI_LAYER_HRD 65 #if LAYERS_NOT_PRESENT_SEI 66 Void xReadSEImessage (SEIMessages& seis, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps, const SEIScalableNesting *nestingSei=NULL, const SEIBspNesting *bspNestingSei=NULL); 67 #else 68 Void xReadSEImessage (SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps, const SEIScalableNesting *nestingSei=NULL); 69 #endif 70 #else 64 71 #if LAYERS_NOT_PRESENT_SEI 65 72 Void xReadSEImessage (SEIMessages& seis, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps); 66 73 #else 67 74 Void xReadSEImessage (SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps); 75 #endif 68 76 #endif 69 77 #if P0138_USE_ALT_CPB_PARAMS_FLAG … … 95 103 Void xParseSEIScalableNesting (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComSPS *sps); 96 104 #endif 105 #if O0164_MULTI_LAYER_HRD 106 #if LAYERS_NOT_PRESENT_SEI 107 Void xParseSEIBspNesting(SEIBspNesting &sei, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei); 108 #else 109 Void xParseSEIBspNesting(SEIBspNesting &sei, const NalUnitType nalUnitType, TComSPS *sps, const SEIScalableNesting &nestingSei); 110 #endif 111 Void xParseSEIBspInitialArrivalTime(SEIBspInitialArrivalTime &sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei, const SEIBspNesting &bspNestingSei); 112 Void xParseSEIBspHrd(SEIBspHrd &sei, TComSPS *sps, const SEIScalableNesting &nestingSei); 113 Void xParseHrdParameters(TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1); 114 #endif 97 115 Void xParseByteAlign(); 98 116 }; -
branches/SHM-5.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
r627 r628 2023 2023 #endif 2024 2024 2025 #if O0164_MULTI_LAYER_HRD 2026 READ_FLAG(uiCode, "vps_vui_bsp_hrd_present_flag" ); vps->setVpsVuiBspHrdPresentFlag(uiCode); 2027 if (vps->getVpsVuiBspHrdPresentFlag()) 2028 { 2029 READ_UVLC( uiCode, "vps_num_bsp_hrd_parameters_minus1" ); vps->setVpsNumBspHrdParametersMinus1(uiCode); 2030 vps->createBspHrdParamBuffer(vps->getVpsNumBspHrdParametersMinus1() + 1); 2031 for (UInt i = 0; i <= vps->getVpsNumBspHrdParametersMinus1(); i++) 2032 { 2033 if (i > 0) 2034 { 2035 READ_FLAG( uiCode, "bsp_cprms_present_flag[i]" ); vps->setBspCprmsPresentFlag(i, uiCode); 2036 } 2037 parseHrdParameters(vps->getBspHrd(i), i==0 ? 1 : vps->getBspCprmsPresentFlag(i), vps->getMaxTLayers()-1); 2038 } 2039 for (UInt h = 1; h <= (vps->getNumLayerSets()-1); h++) 2040 { 2041 READ_UVLC( uiCode, "num_bitstream_partitions[i]"); vps->setNumBitstreamPartitions(h, uiCode); 2042 for (UInt i = 0; i < vps->getNumBitstreamPartitions(h); i++) 2043 { 2044 for (UInt j = 0; j <= (vps->getMaxLayers()-1); j++) 2045 { 2046 if (vps->getLayerIdIncludedFlag(h, j)) 2047 { 2048 READ_FLAG( uiCode, "layer_in_bsp_flag[h][i][j]" ); vps->setLayerInBspFlag(h, i, j, uiCode); 2049 } 2050 } 2051 } 2052 if (vps->getNumBitstreamPartitions(h)) 2053 { 2054 READ_UVLC( uiCode, "num_bsp_sched_combinations[h]"); vps->setNumBspSchedCombinations(h, uiCode); 2055 for (UInt i = 0; i < vps->getNumBspSchedCombinations(h); i++) 2056 { 2057 for (UInt j = 0; j < vps->getNumBitstreamPartitions(h); j++) 2058 { 2059 READ_UVLC( uiCode, "bsp_comb_hrd_idx[h][i][j]"); vps->setBspCombHrdIdx(h, i, j, uiCode); 2060 READ_UVLC( uiCode, "bsp_comb_sched_idx[h][i][j]"); vps->setBspCombSchedIdx(h, i, j, uiCode); 2061 } 2062 } 2063 } 2064 } 2065 } 2066 #endif 2067 2025 2068 #if P0182_VPS_VUI_PS_FLAG 2026 2069 for(i = 1; i < vps->getMaxLayers(); i++)
Note: See TracChangeset for help on using the changeset viewer.