- Timestamp:
- 25 Sep 2015, 06:51:14 (9 years ago)
- Location:
- branches/HTM-15.1-dev0-Nokia/source/Lib
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-15.1-dev0-Nokia/source/Lib/TAppCommon/program_options_lite.h
r1328 r1339 405 405 xParseVec ( arg, opt_storage[ idcs[0] ][ idcs[1] ] ); 406 406 }; 407 #if SEI_DRI_F0169 408 template<> 409 inline void 410 Option< std::vector<std::vector<double>> >::parse(const std::string& arg, const IntAry1d& idcs, ErrorReporter&) 411 { 412 // xParseVec ( arg, opt_storage[ idcs[0] ] ); 413 char* pcNextStart = (char*) arg.data(); 414 char* pcEnd = pcNextStart + arg.length(); 415 416 char* pcOldStart = 0; 417 418 size_t iIdx = 0; 419 420 while (pcNextStart < pcEnd) 421 { 422 errno = 0; 423 424 if ( iIdx < opt_storage[idcs[0]].size() ) 425 { 426 opt_storage[idcs[0]][iIdx] = strtod(pcNextStart, &pcNextStart); 427 } 428 else 429 { 430 opt_storage[idcs[0]].push_back( strtod(pcNextStart, &pcNextStart)) ; 431 } 432 iIdx++; 433 434 if ( errno == ERANGE || (pcNextStart == pcOldStart) ) 435 { 436 std::cerr << "Error Parsing Doubles: `" << arg << "'" << std::endl; 437 exit(EXIT_FAILURE); 438 }; 439 while( (pcNextStart < pcEnd) && ( *pcNextStart == ' ' || *pcNextStart == '\t' || *pcNextStart == '\r' ) ) pcNextStart++; 440 pcOldStart = pcNextStart; 441 442 } 443 444 445 } 446 #endif 407 447 #else 408 448 template<> -
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 -
branches/HTM-15.1-dev0-Nokia/source/Lib/TLibCommon/SEI.h
r1337 r1339 925 925 }; 926 926 927 #if NH_MV_SEI_TBD927 #if SEI_DRI_F0169 928 928 class SEIDepthRepresentationInfo : public SEI 929 929 { 930 public: 931 PayloadType payloadType( ) const { return DEPTH_REPRESENTATION_INFO; } 932 SEIDepthRepresentationInfo ( ) { }; 933 ~SEIDepthRepresentationInfo( ) { }; 934 SEI* getCopy( ) const { return new SEIDepthRepresentationInfo(*this); }; 935 936 Void setupFromCfgFile( const Char* cfgFile ); 937 Void setupFromSlice ( const TComSlice* slice ); 938 Bool checkCfg ( const TComSlice* slice ); 939 940 Bool m_zNearFlag; 941 Bool m_zFarFlag; 942 Bool m_dMinFlag; 943 Bool m_dMaxFlag; 944 Int m_depthRepresentationType; 945 Int m_disparityRefViewId; 946 Int m_depthNonlinearRepresentationNumMinus1; 947 }; 948 949 class SEIDepthRepInfoElement : public SEI 950 { 951 public: 952 PayloadType payloadType( ) const { return DEPTH_REP_INFO_ELEMENT; } 953 SEIDepthRepInfoElement ( ) { }; 954 ~SEIDepthRepInfoElement( ) { }; 955 SEI* getCopy( ) const { return new SEIDepthRepInfoElement(*this); }; 956 957 Void setupFromCfgFile( const Char* cfgFile ); 958 Void setupFromSlice ( const TComSlice* slice ); 959 Bool checkCfg ( const TComSlice* slice ); 960 961 Bool m_daSignFlag; 962 Int m_daExponent; 963 Int m_daMantissaLenMinus1; 964 Int m_daMantissa; 930 public: 931 PayloadType payloadType( ) const { return DEPTH_REPRESENTATION_INFO; } 932 SEIDepthRepresentationInfo ( ) 933 { 934 m_currLayerID=-1; 935 }; 936 ~SEIDepthRepresentationInfo( ) { }; 937 SEI* getCopy( ) const { return new SEIDepthRepresentationInfo(*this); }; 938 939 Void setupFromCfgFile( const Char* cfgFile ); 940 Void setupFromSlice ( const TComSlice* slice ); 941 Bool checkCfg ( const TComSlice* slice ); 942 Void clear() 943 { 944 int i; 945 m_zNearFlag.clear(); 946 m_zFarFlag.clear(); 947 m_dMinFlag.clear(); 948 m_dMaxFlag.clear(); 949 950 for(i=0;i<m_zNear.size();i++) 951 m_zNear[i].clear(); 952 m_zNear.clear(); 953 954 for(i=0;i<m_zFar.size();i++) 955 m_zFar[i].clear(); 956 m_zFar.clear(); 957 958 for(i=0;i<m_dMin.size();i++) 959 m_dMin[i].clear(); 960 m_dMin.clear(); 961 962 for(i=0;i<m_dMax.size();i++) 963 m_dMax[i].clear(); 964 m_dMax.clear(); 965 966 for(i=0;i<m_depthRepresentationType.size();i++) 967 m_depthRepresentationType[i].clear(); 968 m_depthRepresentationType.clear(); 969 970 for(i=0;i<m_disparityRefViewId.size();i++) 971 m_disparityRefViewId[i].clear(); 972 m_disparityRefViewId.clear(); 973 974 for(i=0;i<m_depthNonlinearRepresentationNumMinus1.size();i++) 975 m_depthNonlinearRepresentationNumMinus1[i].clear(); 976 m_depthNonlinearRepresentationNumMinus1.clear(); 977 978 for(i=0;i<m_depth_nonlinear_representation_model.size();i++) 979 m_depth_nonlinear_representation_model[i].clear(); 980 m_depth_nonlinear_representation_model.clear(); 981 982 } 983 int m_currLayerID; 984 BoolAry1d m_zNearFlag; 985 BoolAry1d m_zFarFlag; 986 BoolAry1d m_dMinFlag; 987 BoolAry1d m_dMaxFlag; 988 BoolAry2d m_depthRepresentationInfoSeiPresentFlag; 989 std::vector<std::vector<Double>> m_zNear,m_zFar,m_dMin,m_dMax; 990 991 IntAry2d m_depthRepresentationType; 992 IntAry2d m_disparityRefViewId; 993 IntAry2d m_depthNonlinearRepresentationNumMinus1; 994 IntAry2d m_depth_nonlinear_representation_model; 965 995 }; 966 996 #endif -
branches/HTM-15.1-dev0-Nokia/source/Lib/TLibCommon/TypeDef.h
r1331 r1339 71 71 #define NH_MV_FIX_NUM_POC_TOTAL_CUR 1 // Derivation of NumPocTotalCur for IDR pictures. !!SPEC!! 72 72 #define NH_MV_LAYERS_NOT_PRESENT_SEI 1 // Layers not present SEI message JCTMV-M0043 73 #if NH_MV_SEI 74 #define SEI_DRI_F0169 1 75 #endif 73 76 #endif 74 77 #if NH_3D -
branches/HTM-15.1-dev0-Nokia/source/Lib/TLibDecoder/SEIread.cpp
r1337 r1339 360 360 xParseSEIThreeDimensionalReferenceDisplaysInfo((SEIThreeDimensionalReferenceDisplaysInfo&) *sei, payloadSize, pDecodedMessageOutputStream ); 361 361 break; 362 #if NH_MV_SEI_TBD362 #if SEI_DRI_F0169 363 363 case SEI::DEPTH_REPRESENTATION_INFO: 364 sei = new SEIDepthRepresentationInfo;365 xParseSEIDepthRepresentationInfo((SEIDepthRepresentationInfo&) *sei, payloadSize, pDecodedMessageOutputStream );366 break;364 sei = new SEIDepthRepresentationInfo; 365 xParseSEIDepthRepresentationInfo((SEIDepthRepresentationInfo&) *sei, payloadSize, pDecodedMessageOutputStream ); 366 break; 367 367 #endif 368 368 case SEI::MULTIVIEW_SCENE_INFO: … … 1474 1474 }; 1475 1475 1476 #if NH_MV_SEI_TBD 1476 #if SEI_DRI_F0169 1477 Void SEIReader::xParseSEIDepthRepInfoElement(double& f,std::ostream *pDecodedMessageOutputStream) 1478 { 1479 UInt val; 1480 UInt x_sign,x_mantissa_len,x_mantissa; 1481 Int x_exp; 1482 1483 sei_read_flag(pDecodedMessageOutputStream, val,"da_sign_flag"); x_sign = val ? 1 : 0 ; 1484 sei_read_code(pDecodedMessageOutputStream, 7, val, "da_exponent" ); x_exp = val-31; 1485 sei_read_code(pDecodedMessageOutputStream, 5, val, "da_mantissa_len_minus1" ); x_mantissa_len = val+1; 1486 sei_read_code(pDecodedMessageOutputStream, x_mantissa_len, val, "da_mantissa" ); x_mantissa = val; 1487 if (x_mantissa_len>=16) 1488 { 1489 f =1.0 + (x_mantissa*1.0)/(1u<<(x_mantissa_len-16))/(256.0*256.0 ); 1490 }else 1491 { 1492 f =1.0 + (x_mantissa*1.0)/(1u<<x_mantissa_len); 1493 } 1494 double m=1.0; 1495 int i; 1496 if (x_exp<0) 1497 { 1498 for(i=0;i<-x_exp;i++) 1499 m = m * 2; 1500 1501 f = f/m; 1502 } 1503 else 1504 { 1505 for(i=0;i<x_exp;i++) 1506 m = m * 2; 1507 1508 f= f * m; 1509 } 1510 if (x_sign==1) 1511 { 1512 f= -f; 1513 } 1514 }; 1515 1477 1516 Void SEIReader::xParseSEIDepthRepresentationInfo(SEIDepthRepresentationInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) 1478 1517 { 1479 UInt code; 1480 output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); 1481 1482 sei_read_flag( pDecodedMessageOutputStream, code, "z_near_flag" ); sei.m_zNearFlag = (code == 1); 1483 sei_read_flag( pDecodedMessageOutputStream, code, "z_far_flag" ); sei.m_zFarFlag = (code == 1); 1484 sei_read_flag( pDecodedMessageOutputStream, code, "d_min_flag" ); sei.m_dMinFlag = (code == 1); 1485 sei_read_flag( pDecodedMessageOutputStream, code, "d_max_flag" ); sei.m_dMaxFlag = (code == 1); 1486 sei_read_uvlc( pDecodedMessageOutputStream, code, "depth_representation_type" ); sei.m_depthRepresentationType = code; 1487 if( sei.m_dMinFlag | | sei.m_dMaxFlag ) 1488 { 1489 sei_read_uvlc( pDecodedMessageOutputStream, code, "disparity_ref_view_id" ); sei.m_disparityRefViewId = code; 1490 } 1491 if( sei.m_zNearFlag ) 1492 { 1493 DepthRepInfoElement(() ZNearSign, ZNearExp, ZNearMantissa, ZNearManLen ); 1494 } 1495 if( sei.m_zFarFlag ) 1496 { 1497 DepthRepInfoElement(() ZFarSign, ZFarExp, ZFarMantissa, ZFarManLen ); 1498 } 1499 if( sei.m_dMinFlag ) 1500 { 1501 DepthRepInfoElement(() DMinSign, DMinExp, DMinMantissa, DMinManLen ); 1502 } 1503 if( sei.m_dMaxFlag ) 1504 { 1505 DepthRepInfoElement(() DMaxSign, DMaxExp, DMaxMantissa, DMaxManLen ); 1506 } 1507 if( sei.m_depthRepresentationType == 3 ) 1508 { 1509 sei_read_uvlc( pDecodedMessageOutputStream, code, "depth_nonlinear_representation_num_minus1" ); sei.m_depthNonlinearRepresentationNumMinus1 = code; 1510 for( Int i = 1; i <= sei.m_depthNonlinearRepresentationNumMinus1 + 1; i++ ) 1511 { 1512 DepthNonlinearRepresentationModel( i ); 1513 } 1514 } 1515 }; 1516 1517 Void SEIReader::xParseSEIDepthRepInfoElement(SEIDepthRepInfoElement& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) 1518 { 1519 UInt code; 1520 output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); 1521 1522 sei_read_flag( pDecodedMessageOutputStream, code, "da_sign_flag" ); sei.m_daSignFlag = (code == 1); 1523 sei_read_code( pDecodedMessageOutputStream, 7, code, "da_exponent" ); sei.m_daExponent = code; 1524 sei_read_code( pDecodedMessageOutputStream, 5, code, "da_mantissa_len_minus1" ); sei.m_daMantissaLenMinus1 = code; 1525 sei_read_code( pDecodedMessageOutputStream, getDaMantissaLen ), code, "da_mantissa" ); sei.m_daMantissa = code; 1526 }; 1518 UInt code; 1519 double zNear,zFar,dMin,dMax; 1520 bool zNearFlag,zFarFlag,dMinFlag,dMaxFlag; 1521 int depth_representation_type,disparityRefViewId,depthNonlinearRepresentationNumMinus1; 1522 std::vector<int> DepthNonlinearRepresentationModel; 1523 1524 sei.clear(); 1525 1526 output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); 1527 1528 sei_read_flag( pDecodedMessageOutputStream, code, "z_near_flag" ); zNearFlag = (code == 1); 1529 sei_read_flag( pDecodedMessageOutputStream, code, "z_far_flag" ); zFarFlag = (code == 1); 1530 sei_read_flag( pDecodedMessageOutputStream, code, "d_min_flag" ); dMinFlag = (code == 1); 1531 sei_read_flag( pDecodedMessageOutputStream, code, "d_max_flag" ); dMaxFlag = (code == 1); 1532 sei_read_uvlc( pDecodedMessageOutputStream, code, "depth_representation_type" ); depth_representation_type = code; 1533 1534 sei.m_zNearFlag.push_back(zNearFlag); 1535 sei.m_zFarFlag.push_back(zFarFlag); 1536 sei.m_dMinFlag.push_back(dMinFlag); 1537 sei.m_dMaxFlag.push_back(dMaxFlag); 1538 1539 sei.m_depthRepresentationType.push_back(IntAry1d(1,depth_representation_type)); 1540 1541 if( dMinFlag || dMaxFlag ) 1542 { 1543 sei_read_uvlc( pDecodedMessageOutputStream, code, "disparity_ref_view_id" ); disparityRefViewId = code; 1544 sei.m_disparityRefViewId.push_back(IntAry1d(1,disparityRefViewId)); 1545 } 1546 if( zNearFlag ) 1547 { 1548 xParseSEIDepthRepInfoElement(zNear , pDecodedMessageOutputStream); 1549 sei.m_zNear.push_back(std::vector<double>(1,zNear)); 1550 } 1551 if( zFarFlag ) 1552 { 1553 xParseSEIDepthRepInfoElement(zFar , pDecodedMessageOutputStream); 1554 sei.m_zFar.push_back(std::vector<double>(1,zFar)); 1555 } 1556 if( dMinFlag ) 1557 { 1558 xParseSEIDepthRepInfoElement(dMin , pDecodedMessageOutputStream); 1559 sei.m_dMin.push_back(std::vector<double>(1,dMin)); 1560 } 1561 if( dMaxFlag ) 1562 { 1563 xParseSEIDepthRepInfoElement(dMax , pDecodedMessageOutputStream); 1564 sei.m_dMax.push_back(std::vector<double>(1,dMax)); 1565 } 1566 if( depth_representation_type == 3 ) 1567 { 1568 sei_read_uvlc( pDecodedMessageOutputStream, code, "depth_nonlinear_representation_num_minus1" ); depthNonlinearRepresentationNumMinus1 = code; 1569 sei.m_depthNonlinearRepresentationNumMinus1.push_back(IntAry1d(1,depthNonlinearRepresentationNumMinus1)); 1570 for( Int i = 1; i <= depthNonlinearRepresentationNumMinus1 + 1; i++ ) 1571 { 1572 sei_read_uvlc(pDecodedMessageOutputStream,code,"DepthNonlinearRepresentationModel" ) ; 1573 DepthNonlinearRepresentationModel.push_back(code); 1574 } 1575 1576 sei.m_depth_nonlinear_representation_model.push_back(DepthNonlinearRepresentationModel); 1577 } 1578 } 1527 1579 #endif 1528 1580 Void SEIReader::xParseSEIMultiviewSceneInfo(SEIMultiviewSceneInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) -
branches/HTM-15.1-dev0-Nokia/source/Lib/TLibDecoder/SEIread.h
r1337 r1339 120 120 #endif 121 121 Void xParseSEIThreeDimensionalReferenceDisplaysInfo (SEIThreeDimensionalReferenceDisplaysInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream); 122 #if NH_MV_SEI_TBD 122 #if SEI_DRI_F0169 123 Void xParseSEIDepthRepInfoElement (double &f,std::ostream *pDecodedMessageOutputStream); 123 124 Void xParseSEIDepthRepresentationInfo (SEIDepthRepresentationInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream); 124 125 Void xParseSEIDepthRepInfoElement (SEIDepthRepInfoElement& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);126 125 #endif 127 126 Void xParseSEIMultiviewSceneInfo (SEIMultiviewSceneInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream); -
branches/HTM-15.1-dev0-Nokia/source/Lib/TLibEncoder/SEIwrite.cpp
r1337 r1339 167 167 xWriteSEIThreeDimensionalReferenceDisplaysInfo(*static_cast<const SEIThreeDimensionalReferenceDisplaysInfo*>(&sei)); 168 168 break; 169 #if NH_MV_SEI_TBD 169 #if SEI_DRI_F0169 170 170 case SEI::DEPTH_REPRESENTATION_INFO: 171 xWriteSEIDepthRepresentationInfo(*static_cast<const SEIDepthRepresentationInfo*>(&sei));172 break;173 #endif 171 xWriteSEIDepthRepresentationInfo(*static_cast<const SEIDepthRepresentationInfo*>(&sei)); 172 break; 173 #endif 174 174 case SEI::MULTIVIEW_SCENE_INFO: 175 175 xWriteSEIMultiviewSceneInfo(*static_cast<const SEIMultiviewSceneInfo*>(&sei)); … … 1102 1102 }; 1103 1103 1104 #if NH_MV_SEI_TBD1104 #if SEI_DRI_F0169 1105 1105 Void SEIWriter::xWriteSEIDepthRepresentationInfo( const SEIDepthRepresentationInfo& sei) 1106 1106 { 1107 WRITE_FLAG( ( sei.m_zNearFlag ? 1 : 0 ), "z_near_flag" ); 1108 WRITE_FLAG( ( sei.m_zFarFlag ? 1 : 0 ), "z_far_flag" ); 1109 WRITE_FLAG( ( sei.m_dMinFlag ? 1 : 0 ), "d_min_flag" ); 1110 WRITE_FLAG( ( sei.m_dMaxFlag ? 1 : 0 ), "d_max_flag" ); 1111 WRITE_UVLC( sei.m_depthRepresentationType, "depth_representation_type" ); 1112 if( sei.m_dMinFlag | | sei.m_dMaxFlag ) 1113 { 1114 WRITE_UVLC( sei.m_disparityRefViewId, "disparity_ref_view_id" ); 1115 } 1116 if( sei.m_zNearFlag ) 1117 { 1118 DepthRepInfoElement(() ZNearSign, ZNearExp, ZNearMantissa, ZNearManLen ); 1119 } 1120 if( sei.m_zFarFlag ) 1121 { 1122 DepthRepInfoElement(() ZFarSign, ZFarExp, ZFarMantissa, ZFarManLen ); 1123 } 1124 if( sei.m_dMinFlag ) 1125 { 1126 DepthRepInfoElement(() DMinSign, DMinExp, DMinMantissa, DMinManLen ); 1127 } 1128 if( sei.m_dMaxFlag ) 1129 { 1130 DepthRepInfoElement(() DMaxSign, DMaxExp, DMaxMantissa, DMaxManLen ); 1131 } 1132 if( sei.m_depthRepresentationType == 3 ) 1133 { 1134 WRITE_UVLC( sei.m_depthNonlinearRepresentationNumMinus1, "depth_nonlinear_representation_num_minus1" ); 1135 for( Int i = 1; i <= sei.m_depthNonlinearRepresentationNumMinus1 + 1; i++ ) 1136 { 1137 DepthNonlinearRepresentationModel( i ); 1138 } 1139 } 1107 1108 assert(sei.m_currLayerID>=0); 1109 1110 WRITE_FLAG( ( sei.m_zNearFlag[sei.m_currLayerID] ? 1 : 0 ), "z_near_flag" ); 1111 WRITE_FLAG( ( sei.m_zFarFlag[sei.m_currLayerID] ? 1 : 0 ), "z_far_flag" ); 1112 WRITE_FLAG( ( sei.m_dMinFlag[sei.m_currLayerID] ? 1 : 0 ), "d_min_flag" ); 1113 WRITE_FLAG( ( sei.m_dMaxFlag[sei.m_currLayerID] ? 1 : 0 ), "d_max_flag" ); 1114 WRITE_UVLC( sei.m_depthRepresentationType[sei.m_currLayerID][0], "depth_representation_type" ); 1115 if( sei.m_dMinFlag[sei.m_currLayerID] || sei.m_dMaxFlag[sei.m_currLayerID] ) 1116 { 1117 WRITE_UVLC( sei.m_disparityRefViewId[sei.m_currLayerID][0], "disparity_ref_view_id" ); 1118 } 1119 if( sei.m_zNearFlag[sei.m_currLayerID] ) 1120 { 1121 xWriteSEIDepthRepInfoElement(sei.m_zNear[sei.m_currLayerID][0]); 1122 } 1123 if( sei.m_zFarFlag[sei.m_currLayerID] ) 1124 { 1125 xWriteSEIDepthRepInfoElement(sei.m_zFar[sei.m_currLayerID][0]); 1126 } 1127 if( sei.m_dMinFlag[sei.m_currLayerID] ) 1128 { 1129 xWriteSEIDepthRepInfoElement(sei.m_dMin[sei.m_currLayerID][0]); 1130 } 1131 if( sei.m_dMaxFlag[sei.m_currLayerID] ) 1132 { 1133 xWriteSEIDepthRepInfoElement(sei.m_dMax[sei.m_currLayerID][0]); 1134 } 1135 1136 if (sei.m_depthRepresentationType[sei.m_currLayerID][0] == 3) 1137 { 1138 WRITE_UVLC( sei.m_depthNonlinearRepresentationNumMinus1[sei.m_currLayerID][0], "depth_nonlinear_representation_num_minus1" ); 1139 for( Int i = 1; i <= sei.m_depthNonlinearRepresentationNumMinus1[sei.m_currLayerID][0] + 1; i++ ) 1140 { 1141 WRITE_UVLC(sei.m_depth_nonlinear_representation_model[sei.m_currLayerID][i-1],"depth_nonlinear_representation_model[ i ]"); 1142 } 1143 } 1144 } 1145 1146 Void SEIWriter::xWriteSEIDepthRepInfoElement( double f) 1147 { 1148 UInt x_sign, x_exp, x_mantissa,x_mantissa_len; 1149 if (f < 0) 1150 { 1151 f = f * (-1); 1152 x_sign = 1; 1153 } 1154 else 1155 { 1156 x_sign = 0; 1157 } 1158 int exponent=0; 1159 if(f >= 1) 1160 { 1161 while(f>=2) 1162 { 1163 exponent++; 1164 f = f/2; 1165 } 1166 } 1167 else 1168 { 1169 while (f<1) 1170 { 1171 exponent++; 1172 f = f*2; 1173 } 1174 exponent=-exponent; 1175 } 1176 1177 int i; 1178 f = f -1; 1179 double s = 1; 1180 char s_mantissa[32]; 1181 double thr=1.0/(4.0*(1<<30)); 1182 1183 if (f>=thr) 1184 { 1185 for(i=0;i<32;i++) 1186 { 1187 s /= 2; 1188 if(f>=s) 1189 { 1190 f = f-s; 1191 s_mantissa[i]=1; 1192 1193 if (f<thr) 1194 break; 1195 }else 1196 { 1197 s_mantissa[i]=0; 1198 } 1199 } 1200 1201 if (i<32) 1202 x_mantissa_len=i+1; 1203 else 1204 x_mantissa_len=32; 1205 1206 x_mantissa=0; 1207 1208 for(i=0;i<x_mantissa_len;i++) 1209 { 1210 if (s_mantissa[i]==1) 1211 x_mantissa += (1u)<<(x_mantissa_len-1-i) ; 1212 } 1213 1214 }else 1215 { 1216 x_mantissa=0; 1217 x_mantissa_len=1; 1218 } 1219 1220 assert(exponent>=-31 && exponent<= (1<<7)-32); 1221 x_exp=exponent+31; 1222 1223 WRITE_FLAG( x_sign, "da_sign_flag" ); 1224 WRITE_CODE( x_exp, 7 , "da_exponent" ); 1225 WRITE_CODE( x_mantissa_len-1, 5 , "da_mantissa_len_minus1" ); 1226 WRITE_CODE( x_mantissa, x_mantissa_len , "da_mantissa" ); 1227 1140 1228 }; 1141 1142 Void SEIWriter::xWriteSEIDepthRepInfoElement( const SEIDepthRepInfoElement& sei) 1143 { 1144 WRITE_FLAG( ( sei.m_daSignFlag ? 1 : 0 ), "da_sign_flag" ); 1145 WRITE_CODE( sei.m_daExponent, 7, "da_exponent" ); 1146 WRITE_CODE( sei.m_daMantissaLenMinus1, 5, "da_mantissa_len_minus1" ); 1147 WRITE_CODE( sei.m_daMantissa, getDaMantissaLen ), "da_mantissa" ); 1148 }; 1149 1150 #endif 1229 #endif 1151 1230 Void SEIWriter::xWriteSEIMultiviewSceneInfo( const SEIMultiviewSceneInfo& sei) 1152 1231 { -
branches/HTM-15.1-dev0-Nokia/source/Lib/TLibEncoder/SEIwrite.h
r1337 r1339 102 102 #endif 103 103 Void xWriteSEIThreeDimensionalReferenceDisplaysInfo ( const SEIThreeDimensionalReferenceDisplaysInfo& sei); 104 #if NH_MV_SEI_TBD 104 #if SEI_DRI_F0169 105 Void xWriteSEIDepthRepInfoElement ( double f); 105 106 Void xWriteSEIDepthRepresentationInfo ( const SEIDepthRepresentationInfo& sei); 106 Void xWriteSEIDepthRepInfoElement ( const SEIDepthRepInfoElement& sei);107 107 #endif 108 108 Void xWriteSEIMultiviewSceneInfo ( const SEIMultiviewSceneInfo& sei);
Note: See TracChangeset for help on using the changeset viewer.