Changeset 1339 in 3DVCSoftware for branches/HTM-15.1-dev0-Nokia/source/Lib/TLibCommon/SEI.cpp
- Timestamp:
- 25 Sep 2015, 06:51:14 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-15.1-dev0-Nokia/source/Lib/TLibCommon/SEI.cpp
r1337 r1339 242 242 #endif 243 243 case SEI::THREE_DIMENSIONAL_REFERENCE_DISPLAYS_INFO: return new SEIThreeDimensionalReferenceDisplaysInfo; 244 #if NH_MV_SEI_TBD245 case SEI::DEPTH_REPRESENTATION_INFO : return new SEIDepthRepresentationInfo; 246 #endif 244 #if SEI_DRI_F0169 245 case SEI::DEPTH_REPRESENTATION_INFO : return new SEIDepthRepresentationInfo; 246 #endif 247 247 case SEI::MULTIVIEW_SCENE_INFO : return new SEIMultiviewSceneInfo; 248 248 case SEI::MULTIVIEW_ACQUISITION_INFO : return new SEIMultiviewAcquisitionInfo; … … 1076 1076 }; 1077 1077 1078 #if NH_MV_SEI_TBD1078 #if SEI_DRI_F0169 1079 1079 Void SEIDepthRepresentationInfo::setupFromSlice ( const TComSlice* slice ) 1080 1080 { 1081 sei.m_zNearFlag = TBD ; 1082 sei.m_zFarFlag = TBD ; 1083 sei.m_dMinFlag = TBD ; 1084 sei.m_dMaxFlag = TBD ; 1085 sei.m_depthRepresentationType = TBD ; 1086 if( sei.m_dMinFlag | | sei.m_dMaxFlag ) 1087 { 1088 sei.m_disparityRefViewId = TBD ; 1089 } 1090 if( sei.m_zNearFlag ) 1091 { 1092 DepthRepInfoElement(() ZNearSign, ZNearExp, ZNearMantissa, ZNearManLen ); 1093 } 1094 if( sei.m_zFarFlag ) 1095 { 1096 DepthRepInfoElement(() ZFarSign, ZFarExp, ZFarMantissa, ZFarManLen ); 1097 } 1098 if( sei.m_dMinFlag ) 1099 { 1100 DepthRepInfoElement(() DMinSign, DMinExp, DMinMantissa, DMinManLen ); 1101 } 1102 if( sei.m_dMaxFlag ) 1103 { 1104 DepthRepInfoElement(() DMaxSign, DMaxExp, DMaxMantissa, DMaxManLen ); 1105 } 1106 if( sei.m_depthRepresentationType = = 3 ) 1107 { 1108 sei.m_depthNonlinearRepresentationNumMinus1 = TBD ; 1109 for( Int i = 1; i <= sei.m_depthNonlinearRepresentationNumMinus1 + 1; i++ ) 1081 1082 m_currLayerID=slice->getLayerIdInVps(); 1083 }; 1084 1085 Void SEIDepthRepresentationInfo::setupFromCfgFile(const Char* cfgFile) 1086 { 1087 // Set default values 1088 IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes; 1089 1090 // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send. 1091 //defAppLayerIds .push_back( TBD ); 1092 defAppPocs .push_back( 0 ); 1093 //defAppTids .push_back( TBD ); 1094 //defAppVclNaluTypes.push_back( TBD ); 1095 1096 Int defSeiNaluId = 0; 1097 Int defPositionInSeiNalu = 0; 1098 Bool defModifyByEncoder = true; 1099 1100 // Setup config file options 1101 po::Options opts; 1102 1103 xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder ); 1104 1105 opts.addOptions() 1106 ("ZNear_%d" , m_zNear , std::vector<double>(0,0) , MAX_NUM_LAYERS , "ZNear" ) 1107 ("ZFar_%d" , m_zFar , std::vector<double>(0,0) , MAX_NUM_LAYERS , "ZFar" ) 1108 ("DMin_%d" , m_dMin , std::vector<double>(0,0) , MAX_NUM_LAYERS , "DMin" ) 1109 ("DMax_%d" , m_dMax , std::vector<double>(0,0) , MAX_NUM_LAYERS , "DMax" ) 1110 ("DepthRepresentationInfoSeiPresentFlag_%d", m_depthRepresentationInfoSeiPresentFlag, BoolAry1d(1,0), MAX_NUM_LAYERS, "DepthRepresentationInfoSeiPresentFlag") 1111 ("DepthRepresentationType_%d" , m_depthRepresentationType , IntAry1d(0,0), MAX_NUM_LAYERS, "DepthRepresentationType" ) 1112 ("DisparityRefViewId_%d" , m_disparityRefViewId , IntAry1d(0,0), MAX_NUM_LAYERS, "DisparityRefViewId" ) 1113 ("DepthNonlinearRepresentationNumMinus1_%d", m_depthNonlinearRepresentationNumMinus1, IntAry1d(0,0), MAX_NUM_LAYERS, "DepthNonlinearRepresentationNumMinus1") 1114 ("DepthNonlinearRepresentationModel_%d" , m_depth_nonlinear_representation_model , IntAry1d(0,0), MAX_NUM_LAYERS, "DepthNonlinearRepresentationModel") ; 1115 1116 1117 po::setDefaults(opts); 1118 1119 // Parse the cfg file 1120 po::ErrorReporter err; 1121 po::parseConfigFile( opts, cfgFile, err ); 1122 1123 Bool wrongConfig = false; 1124 1125 for(int i=0;i<MAX_NUM_LAYERS;i++) 1110 1126 { 1111 DepthNonlinearRepresentationModel( i ); 1127 if (m_zNear[i].size()>0) 1128 m_zNearFlag.push_back(true); 1129 else 1130 m_zNearFlag.push_back(false); 1131 1132 if (m_zFar[i].size()>0) 1133 m_zFarFlag.push_back(true); 1134 else 1135 m_zFarFlag.push_back(false); 1136 1137 if (m_dMin[i].size()>0) 1138 m_dMinFlag.push_back(true); 1139 else 1140 m_dMinFlag.push_back(false); 1141 1142 if (m_dMax[i].size()>0) 1143 m_dMaxFlag.push_back(true); 1144 else 1145 m_dMaxFlag.push_back(false); 1146 1147 1148 if (m_depthRepresentationInfoSeiPresentFlag[i][0]) 1149 { 1150 if ( m_depthRepresentationType[i].size()<=0 ) 1151 { 1152 printf("DepthRepresentationType_%d must be present for layer %d\n",i,i ); 1153 return; 1154 } 1155 1156 if ( m_depthRepresentationType[i][0]<0 ) 1157 { 1158 printf("DepthRepresentationType_%d must be equal to or greater than 0\n",i ); 1159 return; 1160 } 1161 1162 if (m_dMinFlag[i] || m_dMaxFlag[i]) 1163 { 1164 if (m_disparityRefViewId[i].size()<=0) 1165 { 1166 printf("DisparityRefViewId_%d must be present for layer %d\n",i,i ); 1167 assert(false); 1168 return; 1169 } 1170 if (m_disparityRefViewId[i][0]<0) 1171 { 1172 printf("DisparityRefViewId_%d must be equal to or greater than 0\n",i ); 1173 assert(false); 1174 return; 1175 } 1176 } 1177 1178 if (m_depthRepresentationType[i][0]==3) 1179 { 1180 if (m_depthNonlinearRepresentationNumMinus1[i].size()<=0) 1181 { 1182 printf("DepthNonlinearRepresentationNumMinus1_%d must be present for layer %d\n",i,i ); 1183 assert(false); 1184 return; 1185 } 1186 if (m_depthNonlinearRepresentationNumMinus1[i][0]<0) 1187 { 1188 printf("DepthNonlinearRepresentationNumMinus1_%d must be equal to or greater than 0\n",i ); 1189 assert(false); 1190 return; 1191 } 1192 1193 if (m_depth_nonlinear_representation_model[i].size() != m_depthNonlinearRepresentationNumMinus1[i][0]+1) 1194 { 1195 printf("the number of values in Depth_nonlinear_representation_model must be equal to DepthNonlinearRepresentationNumMinus1+1 in layer %d\n",i ); 1196 assert(false); 1197 return; 1198 } 1199 1200 1201 } 1202 1203 1204 } 1205 1206 1207 } 1208 1209 assert(m_zNearFlag.size()==MAX_NUM_LAYERS); 1210 assert(m_zFarFlag.size()==MAX_NUM_LAYERS); 1211 assert(m_dMinFlag.size()==MAX_NUM_LAYERS); 1212 assert(m_dMaxFlag.size()==MAX_NUM_LAYERS); 1213 } 1214 1215 Bool SEIDepthRepresentationInfo::checkCfg( const TComSlice* slice ) 1216 { 1217 // Check config values 1218 Bool wrongConfig = false; 1219 assert(m_currLayerID>=0); 1220 1221 if (m_depthRepresentationInfoSeiPresentFlag[m_currLayerID][0]==false) 1222 { 1223 printf("DepthRepresentationInfoSeiPresentFlag_%d should be equal to 1 when ApplicableLayerIds is empty or ApplicableLayerIds contains %d\n",m_currLayerID,slice->getLayerId()); 1224 assert(false); 1112 1225 } 1113 } 1114 }; 1115 1116 Void SEIDepthRepresentationInfo::setupFromCfgFile(const Char* cfgFile) 1117 { 1118 // Set default values 1119 IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes; 1120 1121 // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send. 1122 defAppLayerIds .push_back( TBD ); 1123 defAppPocs .push_back( TBD ); 1124 defAppTids .push_back( TBD ); 1125 defAppVclNaluTypes.push_back( TBD ); 1126 1127 Int defSeiNaluId = 0; 1128 Int defPositionInSeiNalu = 0; 1129 Bool defModifyByEncoder = TBD; 1130 1131 // Setup config file options 1132 po::Options opts; 1133 xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder ); 1134 1135 opts.addOptions() 1136 ("ZNearFlag" , m_zNearFlag , false , "ZNearFlag" ) 1137 ("ZFarFlag" , m_zFarFlag , false , "ZFarFlag" ) 1138 ("DMinFlag" , m_dMinFlag , false , "DMinFlag" ) 1139 ("DMaxFlag" , m_dMaxFlag , false , "DMaxFlag" ) 1140 ("DepthRepresentationType" , m_depthRepresentationType , 0 , "DepthRepresentationType" ) 1141 ("DisparityRefViewId" , m_disparityRefViewId , 0 , "DisparityRefViewId" ) 1142 ("DepthNonlinearRepresentationNumMinus1", m_depthNonlinearRepresentationNumMinus1, 0 , "DepthNonlinearRepresentationNumMinus1") 1143 ; 1144 1145 po::setDefaults(opts); 1146 1147 // Parse the cfg file 1148 po::ErrorReporter err; 1149 po::parseConfigFile( opts, cfgFile, err ); 1150 }; 1151 1152 Bool SEIDepthRepresentationInfo::checkCfg( const TComSlice* slice ) 1153 { 1154 // Check config values 1155 Bool wrongConfig = false; 1156 1157 // TBD: Add constraints on presence of SEI here. 1158 xCheckCfg ( wrongConfig, TBD , "TBD" ); 1159 xCheckCfg ( wrongConfig, TBD , "TBD" ); 1160 1161 // TBD: Modify constraints according to the SEI semantics. 1162 xCheckCfgRange( wrongConfig, m_zNearFlag , MINVAL , MAXVAL, "z_near_flag" ); 1163 xCheckCfgRange( wrongConfig, m_zFarFlag , MINVAL , MAXVAL, "z_far_flag" ); 1164 xCheckCfgRange( wrongConfig, m_dMinFlag , MINVAL , MAXVAL, "d_min_flag" ); 1165 xCheckCfgRange( wrongConfig, m_dMaxFlag , MINVAL , MAXVAL, "d_max_flag" ); 1166 xCheckCfgRange( wrongConfig, m_depthRepresentationType , MINVAL , MAXVAL, "depth_representation_type" ); 1167 xCheckCfgRange( wrongConfig, m_disparityRefViewId , MINVAL , MAXVAL, "disparity_ref_view_id" ); 1168 xCheckCfgRange( wrongConfig, m_depthNonlinearRepresentationNumMinus1, MINVAL , MAXVAL, "depth_nonlinear_representation_num_minus1"); 1169 1170 return wrongConfig; 1171 }; 1172 1173 Void SEIDepthRepInfoElement::setupFromSlice ( const TComSlice* slice ) 1174 { 1175 sei.m_daSignFlag = TBD ; 1176 sei.m_daExponent = TBD ; 1177 sei.m_daMantissaLenMinus1 = TBD ; 1178 sei.m_daMantissa = TBD ; 1179 }; 1180 1181 Void SEIDepthRepInfoElement::setupFromCfgFile(const Char* cfgFile) 1182 { 1183 // Set default values 1184 IntAry1d defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes; 1185 1186 // TBD: Add default values for which layers, POCS, Tids or Nalu types the SEI should be send. 1187 defAppLayerIds .push_back( TBD ); 1188 defAppPocs .push_back( TBD ); 1189 defAppTids .push_back( TBD ); 1190 defAppVclNaluTypes.push_back( TBD ); 1191 1192 Int defSeiNaluId = 0; 1193 Int defPositionInSeiNalu = 0; 1194 Bool defModifyByEncoder = TBD; 1195 1196 // Setup config file options 1197 po::Options opts; 1198 xAddGeneralOpts( opts , defAppLayerIds, defAppPocs, defAppTids, defAppVclNaluTypes, defSeiNaluId, defPositionInSeiNalu, defModifyByEncoder ); 1199 1200 opts.addOptions() 1201 ("DaSignFlag" , m_daSignFlag , false , "DaSignFlag" ) 1202 ("DaExponent" , m_daExponent , 0 , "DaExponent" ) 1203 ("DaMantissaLenMinus1" , m_daMantissaLenMinus1 , 0 , "DaMantissaLenMinus1" ) 1204 ("DaMantissa" , m_daMantissa , 0 , "DaMantissa" ) 1205 ; 1206 1207 po::setDefaults(opts); 1208 1209 // Parse the cfg file 1210 po::ErrorReporter err; 1211 po::parseConfigFile( opts, cfgFile, err ); 1212 }; 1213 1214 Bool SEIDepthRepInfoElement::checkCfg( const TComSlice* slice ) 1215 { 1216 // Check config values 1217 Bool wrongConfig = false; 1218 1219 // TBD: Add constraints on presence of SEI here. 1220 xCheckCfg ( wrongConfig, TBD , "TBD" ); 1221 xCheckCfg ( wrongConfig, TBD , "TBD" ); 1222 1223 // TBD: Modify constraints according to the SEI semantics. 1224 xCheckCfgRange( wrongConfig, m_daSignFlag , MINVAL , MAXVAL, "da_sign_flag" ); 1225 xCheckCfgRange( wrongConfig, m_daExponent , MINVAL , MAXVAL, "da_exponent" ); 1226 xCheckCfgRange( wrongConfig, m_daMantissaLenMinus1 , MINVAL , MAXVAL, "da_mantissa_len_minus1" ); 1227 xCheckCfgRange( wrongConfig, m_daMantissa , MINVAL , MAXVAL, "da_mantissa" ); 1228 1229 return wrongConfig; 1230 }; 1226 // TBD: Add constraints on presence of SEI here. 1227 xCheckCfg ( wrongConfig, m_depthRepresentationType[m_currLayerID][0] >=0 , "depth_representation_type must be equal to or greater than 0" ); 1228 if ( m_dMaxFlag[m_currLayerID] || m_dMinFlag[m_currLayerID]) 1229 { 1230 xCheckCfg( wrongConfig , m_disparityRefViewId[m_currLayerID][0]>=0, "disparity_ref_view_id must be equal to or greater than 0 when d_min or d_max are present"); 1231 } 1232 1233 if (m_depthRepresentationType[m_currLayerID][0]==3) 1234 { 1235 xCheckCfg(wrongConfig , m_depthNonlinearRepresentationNumMinus1[m_currLayerID][0]>=0, "depth_nonlinear_representation_num_minus1 must be greater than or equal to 0"); 1236 1237 if (m_depthNonlinearRepresentationNumMinus1[m_currLayerID][0]>=0) 1238 { 1239 xCheckCfg( wrongConfig , m_depthNonlinearRepresentationNumMinus1[m_currLayerID][0]+1 == m_depth_nonlinear_representation_model[m_currLayerID].size() ,"the number of values in depth_nonlinear_representation_model must be equal to depth_nonlinear_representation_num_minus1+1"); 1240 } 1241 1242 } 1243 1244 return wrongConfig; 1245 } 1231 1246 #endif 1232 1247
Note: See TracChangeset for help on using the changeset viewer.