Changeset 290 in SHVCSoftware for branches/SHM-2.1-dev/source/App/TAppEncoder
- Timestamp:
- 18 Jun 2013, 13:57:03 (12 years ago)
- Location:
- branches/SHM-2.1-dev/source/App/TAppEncoder
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncCfg.cpp
r288 r290 146 146 { 147 147 #if VPS_EXTN_DIRECT_REF_LAYERS 148 #if M0457_PREDICTION_INDICATIONS 148 149 for(Int layer = 0; layer < MAX_LAYERS; layer++) 149 150 { 151 if( m_acLayerCfg[layer].m_numSamplePredRefLayers > 0 ) 152 { 153 delete [] m_acLayerCfg[layer].m_samplePredRefLayerIds; 154 } 155 } 156 for(Int layer = 0; layer < MAX_LAYERS; layer++) 157 { 158 if( m_acLayerCfg[layer].m_numMotionPredRefLayers > 0 ) 159 { 160 delete [] m_acLayerCfg[layer].m_motionPredRefLayerIds; 161 } 162 } 163 #else 164 for(Int layer = 0; layer < MAX_LAYERS; layer++) 165 { 150 166 if( m_acLayerCfg[layer].m_numDirectRefLayers > 0 ) 151 167 { … … 153 169 } 154 170 } 155 171 #endif 156 172 for(Int layer = 0; layer < MAX_LAYERS; layer++) 157 173 { … … 336 352 Int* cfg_conformanceMode [MAX_LAYERS]; 337 353 #if VPS_EXTN_DIRECT_REF_LAYERS 354 #if M0457_PREDICTION_INDICATIONS 355 Int* cfg_numSamplePredRefLayers [MAX_LAYERS]; 356 string cfg_samplePredRefLayerIds [MAX_LAYERS]; 357 string* cfg_samplePredRefLayerIdsPtr[MAX_LAYERS]; 358 Int* cfg_numMotionPredRefLayers [MAX_LAYERS]; 359 string cfg_motionPredRefLayerIds [MAX_LAYERS]; 360 string* cfg_motionPredRefLayerIdsPtr[MAX_LAYERS]; 361 #else 338 362 Int* cfg_numDirectRefLayers [MAX_LAYERS]; 339 363 string cfg_refLayerIds [MAX_LAYERS]; 340 364 string* cfg_refLayerIdsPtr [MAX_LAYERS]; 341 365 #endif 342 366 Int* cfg_numActiveRefLayers [MAX_LAYERS]; 343 367 string cfg_predLayerIds [MAX_LAYERS]; … … 376 400 cfg_conformanceMode[layer] = &m_acLayerCfg[layer].m_conformanceMode; 377 401 #if VPS_EXTN_DIRECT_REF_LAYERS 402 #if M0457_PREDICTION_INDICATIONS 403 cfg_numSamplePredRefLayers [layer] = &m_acLayerCfg[layer].m_numSamplePredRefLayers; 404 cfg_samplePredRefLayerIdsPtr[layer] = &cfg_samplePredRefLayerIds[layer]; 405 cfg_numMotionPredRefLayers [layer] = &m_acLayerCfg[layer].m_numMotionPredRefLayers; 406 cfg_motionPredRefLayerIdsPtr[layer] = &cfg_motionPredRefLayerIds[layer]; 407 #else 378 408 cfg_numDirectRefLayers [layer] = &m_acLayerCfg[layer].m_numDirectRefLayers; 379 409 cfg_refLayerIdsPtr [layer] = &cfg_refLayerIds[layer]; 410 #endif 380 411 cfg_numActiveRefLayers [layer] = &m_acLayerCfg[layer].m_numActiveRefLayers; 381 412 cfg_predLayerIdsPtr [layer] = &cfg_predLayerIds[layer]; … … 444 475 ("LambdaModifier%d,-LM%d", m_adLambdaModifier, ( double )1.0, MAX_TLAYER, "Lambda modifier for temporal layer %d") 445 476 #if VPS_EXTN_DIRECT_REF_LAYERS 477 #if M0457_PREDICTION_INDICATIONS 478 ("NumSamplePredRefLayers%d",cfg_numSamplePredRefLayers, -1, MAX_LAYERS, "Number of sample prediction reference layers") 479 ("SamplePredRefLayerIds%d", cfg_samplePredRefLayerIdsPtr, string(""), MAX_LAYERS, "sample pred reference layer IDs") 480 ("NumMotionPredRefLayers%d",cfg_numMotionPredRefLayers, -1, MAX_LAYERS, "Number of motion prediction reference layers") 481 ("MotionPredRefLayerIds%d", cfg_motionPredRefLayerIdsPtr, string(""), MAX_LAYERS, "motion pred reference layer IDs") 482 #else 446 483 ("NumDirectRefLayers%d", cfg_numDirectRefLayers, -1, MAX_LAYERS, "Number of direct reference layers") 447 484 ("RefLayerIds%d", cfg_refLayerIdsPtr, string(""), MAX_LAYERS, "direct reference layer IDs") 485 #endif 448 486 ("NumActiveRefLayers%d", cfg_numActiveRefLayers, -1, MAX_LAYERS, "Number of active reference layers") 449 487 ("PredLayerIds%d", cfg_predLayerIdsPtr, string(""), MAX_LAYERS, "inter-layer prediction layer IDs") … … 975 1013 #endif 976 1014 #if VPS_EXTN_DIRECT_REF_LAYERS 1015 #if M0457_PREDICTION_INDICATIONS 1016 for(Int layer = 0; layer < MAX_LAYERS; layer++) 1017 { 1018 Char* pSamplePredRefLayerIds = cfg_samplePredRefLayerIds[layer].empty() ? NULL: strdup(cfg_samplePredRefLayerIds[layer].c_str()); 1019 if( m_acLayerCfg[layer].m_numSamplePredRefLayers > 0 ) 1020 { 1021 char *samplePredRefLayerId; 1022 int i=0; 1023 m_acLayerCfg[layer].m_samplePredRefLayerIds = new Int[m_acLayerCfg[layer].m_numSamplePredRefLayers]; 1024 samplePredRefLayerId = strtok(pSamplePredRefLayerIds, " ,-"); 1025 while(samplePredRefLayerId != NULL) 1026 { 1027 if( i >= m_acLayerCfg[layer].m_numSamplePredRefLayers ) 1028 { 1029 printf( "NumSamplePredRefLayers: The number of columns whose width are defined is larger than the allowed number of columns.\n" ); 1030 exit( EXIT_FAILURE ); 1031 } 1032 *( m_acLayerCfg[layer].m_samplePredRefLayerIds + i ) = atoi( samplePredRefLayerId ); 1033 samplePredRefLayerId = strtok(NULL, " ,-"); 1034 i++; 1035 } 1036 if( i < m_acLayerCfg[layer].m_numSamplePredRefLayers ) 1037 { 1038 printf( "NumSamplePredRefLayers: The width of some columns is not defined.\n" ); 1039 exit( EXIT_FAILURE ); 1040 } 1041 } 1042 else 1043 { 1044 m_acLayerCfg[layer].m_samplePredRefLayerIds = NULL; 1045 } 1046 } 1047 for(Int layer = 0; layer < MAX_LAYERS; layer++) 1048 { 1049 Char* pMotionPredRefLayerIds = cfg_motionPredRefLayerIds[layer].empty() ? NULL: strdup(cfg_motionPredRefLayerIds[layer].c_str()); 1050 if( m_acLayerCfg[layer].m_numMotionPredRefLayers > 0 ) 1051 { 1052 char *motionPredRefLayerId; 1053 int i=0; 1054 m_acLayerCfg[layer].m_motionPredRefLayerIds = new Int[m_acLayerCfg[layer].m_numMotionPredRefLayers]; 1055 motionPredRefLayerId = strtok(pMotionPredRefLayerIds, " ,-"); 1056 while(motionPredRefLayerId != NULL) 1057 { 1058 if( i >= m_acLayerCfg[layer].m_numMotionPredRefLayers ) 1059 { 1060 printf( "NumMotionPredRefLayers: The number of columns whose width are defined is larger than the allowed number of columns.\n" ); 1061 exit( EXIT_FAILURE ); 1062 } 1063 *( m_acLayerCfg[layer].m_motionPredRefLayerIds + i ) = atoi( motionPredRefLayerId ); 1064 motionPredRefLayerId = strtok(NULL, " ,-"); 1065 i++; 1066 } 1067 if( i < m_acLayerCfg[layer].m_numMotionPredRefLayers ) 1068 { 1069 printf( "NumMotionPredRefLayers: The width of some columns is not defined.\n" ); 1070 exit( EXIT_FAILURE ); 1071 } 1072 } 1073 else 1074 { 1075 m_acLayerCfg[layer].m_motionPredRefLayerIds = NULL; 1076 } 1077 } 1078 #else 977 1079 for(Int layer = 0; layer < MAX_LAYERS; layer++) 978 1080 { … … 1006 1108 } 1007 1109 } 1008 1110 #endif 1009 1111 for(Int layer = 0; layer < MAX_LAYERS; layer++) 1010 1112 { … … 1959 2061 #endif 1960 2062 #if VPS_EXTN_DIRECT_REF_LAYERS 2063 #if M0457_PREDICTION_INDICATIONS 2064 xConfirmPara( (m_acLayerCfg[0].m_numSamplePredRefLayers != 0) && (m_acLayerCfg[0].m_numSamplePredRefLayers != -1), "Layer 0 cannot have any reference layers" ); 2065 // NOTE: m_numSamplePredRefLayers (for any layer) could be -1 (not signalled in cfg), in which case only the "previous layer" would be taken for reference 2066 for(Int layer = 1; layer < MAX_LAYERS; layer++) 2067 { 2068 xConfirmPara(m_acLayerCfg[layer].m_numSamplePredRefLayers > layer, "Cannot reference more layers than before current layer"); 2069 for(Int i = 0; i < m_acLayerCfg[layer].m_numSamplePredRefLayers; i++) 2070 { 2071 xConfirmPara(m_acLayerCfg[layer].m_samplePredRefLayerIds[i] > layer, "Cannot reference higher layers"); 2072 xConfirmPara(m_acLayerCfg[layer].m_samplePredRefLayerIds[i] == layer, "Cannot reference the current layer itself"); 2073 } 2074 } 2075 xConfirmPara( (m_acLayerCfg[0].m_numMotionPredRefLayers != 0) && (m_acLayerCfg[0].m_numMotionPredRefLayers != -1), "Layer 0 cannot have any reference layers" ); 2076 // NOTE: m_numMotionPredRefLayers (for any layer) could be -1 (not signalled in cfg), in which case only the "previous layer" would be taken for reference 2077 for(Int layer = 1; layer < MAX_LAYERS; layer++) 2078 { 2079 xConfirmPara(m_acLayerCfg[layer].m_numMotionPredRefLayers > layer, "Cannot reference more layers than before current layer"); 2080 for(Int i = 0; i < m_acLayerCfg[layer].m_numMotionPredRefLayers; i++) 2081 { 2082 xConfirmPara(m_acLayerCfg[layer].m_motionPredRefLayerIds[i] > layer, "Cannot reference higher layers"); 2083 xConfirmPara(m_acLayerCfg[layer].m_motionPredRefLayerIds[i] == layer, "Cannot reference the current layer itself"); 2084 } 2085 } 2086 #else 1961 2087 xConfirmPara( (m_acLayerCfg[0].m_numDirectRefLayers != 0) && (m_acLayerCfg[0].m_numDirectRefLayers != -1), "Layer 0 cannot have any reference layers" ); 1962 2088 // NOTE: m_numDirectRefLayers (for any layer) could be -1 (not signalled in cfg), in which case only the "previous layer" would be taken for reference … … 1970 2096 } 1971 2097 } 1972 2098 #endif 1973 2099 xConfirmPara( (m_acLayerCfg[0].m_numActiveRefLayers != 0) && (m_acLayerCfg[0].m_numActiveRefLayers != -1), "Layer 0 cannot have any active reference layers" ); 1974 2100 // NOTE: m_numActiveRefLayers (for any layer) could be -1 (not signalled in cfg), in which case only the "previous layer" would be taken for reference 1975 2101 for(Int layer = 1; layer < MAX_LAYERS; layer++) 1976 2102 { 2103 #if M0457_PREDICTION_INDICATIONS 2104 Bool predEnabledFlag[MAX_LAYERS]; 2105 for (Int refLayer = 0; refLayer < layer; refLayer++) 2106 { 2107 predEnabledFlag[refLayer] = false; 2108 } 2109 for(Int i = 0; i < m_acLayerCfg[layer].m_numSamplePredRefLayers; i++) 2110 { 2111 predEnabledFlag[m_acLayerCfg[layer].m_samplePredRefLayerIds[i]] = true; 2112 } 2113 for(Int i = 0; i < m_acLayerCfg[layer].m_numMotionPredRefLayers; i++) 2114 { 2115 predEnabledFlag[m_acLayerCfg[layer].m_motionPredRefLayerIds[i]] = true; 2116 } 2117 Int numDirectRefLayers = 0; 2118 for (Int refLayer = 0; refLayer < layer; refLayer++) 2119 { 2120 if (predEnabledFlag[refLayer] == true) numDirectRefLayers++; 2121 } 2122 xConfirmPara(m_acLayerCfg[layer].m_numActiveRefLayers > numDirectRefLayers, "Cannot reference more layers than NumDirectRefLayers"); 2123 for(Int i = 0; i < m_acLayerCfg[layer].m_numActiveRefLayers; i++) 2124 { 2125 xConfirmPara(m_acLayerCfg[layer].m_predLayerIds[i] > numDirectRefLayers, "Cannot reference higher layers"); 2126 } 2127 #else 1977 2128 xConfirmPara(m_acLayerCfg[layer].m_numActiveRefLayers > m_acLayerCfg[layer].m_numDirectRefLayers, "Cannot reference more layers than NumDirectRefLayers"); 1978 2129 for(Int i = 0; i < m_acLayerCfg[layer].m_numActiveRefLayers; i++) … … 1980 2131 xConfirmPara(m_acLayerCfg[layer].m_predLayerIds[i] > m_acLayerCfg[layer].m_numDirectRefLayers, "Cannot reference higher layers"); 1981 2132 } 2133 #endif 1982 2134 } 1983 2135 #endif -
branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncLayerCfg.h
r288 r290 43 43 Double m_fQP; ///< QP value of key-picture (floating point) 44 44 #if VPS_EXTN_DIRECT_REF_LAYERS 45 #if M0457_PREDICTION_INDICATIONS 46 Int *m_samplePredRefLayerIds; 47 Int m_numSamplePredRefLayers; 48 Int *m_motionPredRefLayerIds; 49 Int m_numMotionPredRefLayers; 50 #else 45 51 Int *m_refLayerIds; 46 52 Int m_numDirectRefLayers; 53 #endif 47 54 Int *m_predLayerIds; 48 55 Int m_numActiveRefLayers; … … 108 115 Int* getdQPs() {return m_aidQP; } 109 116 #if VPS_EXTN_DIRECT_REF_LAYERS 117 #if M0457_PREDICTION_INDICATIONS 118 Int getNumSamplePredRefLayers() {return m_numSamplePredRefLayers; } 119 Int* getSamplePredRefLayerIds() {return m_samplePredRefLayerIds; } 120 Int getSamplePredRefLayerId(Int i) {return m_samplePredRefLayerIds[i]; } 121 Int getNumMotionPredRefLayers() {return m_numMotionPredRefLayers; } 122 Int* getMotionPredRefLayerIds() {return m_motionPredRefLayerIds; } 123 Int getMotionPredRefLayerId(Int i) {return m_motionPredRefLayerIds[i]; } 124 #else 110 125 Int getNumDirectRefLayers() {return m_numDirectRefLayers;} 111 126 Int* getRefLayerIds() {return m_refLayerIds; } 112 127 Int getRefLayerId(Int i) {return m_refLayerIds[i]; } 128 #endif 113 129 114 130 Int getNumActiveRefLayers() {return m_numActiveRefLayers;} -
branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncTop.cpp
r288 r290 147 147 if(layer) 148 148 { 149 #if M0457_PREDICTION_INDICATIONS 150 for(Int i = 0; i < MAX_VPS_LAYER_ID_PLUS1; i++) 151 { 152 m_acTEncTop[layer].setSamplePredEnabledFlag(i, false); 153 m_acTEncTop[layer].setMotionPredEnabledFlag(i, false); 154 } 155 if(m_acLayerCfg[layer].getNumSamplePredRefLayers() == -1) 156 { 157 // Not included in the configuration file; assume that each layer depends on previous layer 158 m_acTEncTop[layer].setNumSamplePredRefLayers (1); // One sample pred ref. layer 159 m_acTEncTop[layer].setSamplePredRefLayerId (0, layer - 1); // Previous layer 160 m_acTEncTop[layer].setSamplePredEnabledFlag (layer - 1, true); 161 } 162 else 163 { 164 m_acTEncTop[layer].setNumSamplePredRefLayers ( m_acLayerCfg[layer].getNumSamplePredRefLayers() ); 165 for(Int i = 0; i < m_acTEncTop[layer].getNumSamplePredRefLayers(); i++) 166 { 167 m_acTEncTop[layer].setSamplePredRefLayerId ( i, m_acLayerCfg[layer].getSamplePredRefLayerId(i)); 168 m_acTEncTop[layer].setSamplePredEnabledFlag (m_acLayerCfg[layer].getSamplePredRefLayerId(i), true); 169 } 170 } 171 if(m_acLayerCfg[layer].getNumMotionPredRefLayers() == -1) 172 { 173 // Not included in the configuration file; assume that each layer depends on previous layer 174 m_acTEncTop[layer].setNumMotionPredRefLayers (1); // One motion pred ref. layer 175 m_acTEncTop[layer].setMotionPredRefLayerId (0, layer - 1); // Previous layer 176 m_acTEncTop[layer].setMotionPredEnabledFlag (layer - 1, true); 177 } 178 else 179 { 180 m_acTEncTop[layer].setNumMotionPredRefLayers ( m_acLayerCfg[layer].getNumMotionPredRefLayers() ); 181 for(Int i = 0; i < m_acTEncTop[layer].getNumMotionPredRefLayers(); i++) 182 { 183 m_acTEncTop[layer].setMotionPredRefLayerId ( i, m_acLayerCfg[layer].getMotionPredRefLayerId(i)); 184 m_acTEncTop[layer].setMotionPredEnabledFlag (m_acLayerCfg[layer].getSamplePredRefLayerId(i), true); 185 } 186 } 187 Int numDirectRefLayers = 0; 188 for (Int i = 0; i < layer; i++) 189 { 190 if (m_acTEncTop[layer].getSamplePredEnabledFlag(i) || m_acTEncTop[layer].getMotionPredEnabledFlag(i)) 191 { 192 m_acTEncTop[layer].setRefLayerId(numDirectRefLayers, i); 193 numDirectRefLayers++; 194 } 195 } 196 m_acTEncTop[layer].setNumDirectRefLayers(numDirectRefLayers); 197 #else 149 198 if(m_acLayerCfg[layer].getNumDirectRefLayers() == -1) 150 199 { … … 161 210 } 162 211 } 163 212 #endif 164 213 if(m_acLayerCfg[layer].getNumActiveRefLayers() == -1) 165 214 { 215 #if M0457_PREDICTION_INDICATIONS 216 m_acTEncTop[layer].setNumActiveRefLayers( m_acTEncTop[layer].getNumDirectRefLayers() ); 217 #else 166 218 m_acTEncTop[layer].setNumActiveRefLayers( m_acLayerCfg[layer].getNumDirectRefLayers() ); 219 #endif 167 220 for( Int i = 0; i < m_acTEncTop[layer].getNumActiveRefLayers(); i++ ) 168 221 { … … 951 1004 vps->setDirectDependencyFlag( layerCtr, vps->getLayerIdInVps(m_acTEncTop[layerCtr].getRefLayerId(i)), true); 952 1005 } 1006 #if M0457_PREDICTION_INDICATIONS 1007 vps->setDirectDepTypeLen(2); // sample and motion types are encoded 1008 for(Int refLayerCtr = 0; refLayerCtr < layerCtr; refLayerCtr++) 1009 { 1010 if (vps->getDirectDependencyFlag( layerCtr, refLayerCtr)) 1011 { 1012 assert(m_acTEncTop[layerCtr].getSamplePredEnabledFlag(refLayerCtr) || m_acTEncTop[layerCtr].getMotionPredEnabledFlag(refLayerCtr)); 1013 vps->setDirectDependencyType( layerCtr, refLayerCtr, ((m_acTEncTop[layerCtr].getSamplePredEnabledFlag(refLayerCtr) ? 1 : 0) | 1014 (m_acTEncTop[layerCtr].getMotionPredEnabledFlag(refLayerCtr) ? 2 : 0)) - 1); 1015 } 1016 else 1017 { 1018 vps->setDirectDependencyType( layerCtr, refLayerCtr, 0 ); 1019 } 1020 } 1021 #endif 953 1022 } 954 1023 #endif
Note: See TracChangeset for help on using the changeset viewer.