Changeset 854 in 3DVCSoftware for branches/HTM-10.0-dev0/source/Lib/TLibEncoder
- Timestamp:
- 13 Feb 2014, 22:58:51 (11 years ago)
- Location:
- branches/HTM-10.0-dev0/source/Lib/TLibEncoder
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-10.0-dev0/source/Lib/TLibEncoder/TEncCavlc.cpp
r852 r854 279 279 WRITE_FLAG( pcPPS->getSliceHeaderExtensionPresentFlag() ? 1 : 0, "slice_segment_header_extension_present_flag"); 280 280 281 #if H_MV_HLS_7_GEN_P0166_PPS_EXTENSION 282 #if !H_MV 283 WRITE_FLAG( 0, "pps_extension_flag" ); 284 #else 285 WRITE_FLAG( 1, "pps_extension_flag" ); 286 287 for ( Int i = 0; i < PPS_EX_T_MAX_NUM; i++ ) 288 { 289 WRITE_FLAG( pcPPS->getPpsExtensionTypeFlag( i ) ? 1 : 0 , "pps_extension_type_flag" ); 290 #if H_3D 291 assert( !pcPPS->getPpsExtensionTypeFlag( i ) || i == PPS_EX_T_MV || i == PPS_EX_T_3D || i == PPS_EX_T_ESC ); 292 #else 293 assert( !pcPPS->getPpsExtensionTypeFlag( i ) || i == PPS_EX_T_MV || i == PPS_EX_T_ESC ); 294 #endif 295 } 296 297 if( pcPPS->getPpsExtensionTypeFlag( PPS_EX_T_MV ) ) 298 { 299 #if H_MV_HLS7_GEN 300 WRITE_FLAG( pcPPS->getPocResetInfoPresentFlag( ) ? 1 : 0 , "poc_reset_info_present_flag" ); 301 #endif 302 } 303 304 #if H_3D 305 if( pcPPS->getPpsExtensionTypeFlag( PPS_EX_T_3D ) ) // This probably needs to be aligned with Rext and SHVC 306 { 307 codePPSExtension( pcPPS ); 308 } 309 #endif 310 311 #endif 312 #else 281 313 #if !H_3D 282 314 WRITE_FLAG( 0, "pps_extension_flag" ); … … 285 317 codePPSExtension( pcPPS ); 286 318 WRITE_FLAG( 0, "pps_extension2_flag" ); 319 #endif 287 320 #endif 288 321 } … … 433 466 else 434 467 { 435 WRITE_CODE(uiNumDepthValues_coded, 8, "num_depth_values_in_dlt[ layerId]"); // num_entry468 WRITE_CODE(uiNumDepthValues_coded, 8, "num_depth_values_in_dlt[i]"); // num_entry 436 469 437 470 #if !H_3D_DELTA_DLT … … 699 732 #endif 700 733 WRITE_UVLC( pcSPS->getBitsForPOC()-4, "log2_max_pic_order_cnt_lsb_minus4" ); 701 734 #if H_MV_HLS_7_SPS_P0155_16_32 735 if ( pcSPS->getLayerId() == 0 ) 736 { 737 #endif 702 738 const Bool subLayerOrderingInfoPresentFlag = 1; 703 739 WRITE_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag"); … … 712 748 } 713 749 } 750 #if H_MV_HLS_7_SPS_P0155_16_32 751 } 752 #endif 753 714 754 assert( pcSPS->getMaxCUWidth() == pcSPS->getMaxCUHeight() ); 715 755 … … 838 878 WRITE_SVLC( pcSPS->getScaledRefLayerRightOffset( j ), "scaled_ref_layer_right_offset" ); 839 879 WRITE_SVLC( pcSPS->getScaledRefLayerBottomOffset( j ), "scaled_ref_layer_bottom_offset" ); 880 #if H_MV_HLS_7_RESERVED_FLAGS 881 WRITE_FLAG( 0, "sps_multilayer_ext_reserved_zero_flag[ j ]" ); 882 #endif 840 883 } 841 884 } … … 868 911 WRITE_FLAG( pcVPS->getTemporalNestingFlag(), "vps_temporal_id_nesting_flag" ); 869 912 assert (pcVPS->getMaxTLayers()>1||pcVPS->getTemporalNestingFlag()); 870 #if H_MV 913 #if H_MV && !H_MV_HLS7_GEN 871 914 WRITE_CODE( 0xffff, 16, "vps_extension_offset" ); 872 915 #else … … 970 1013 { 971 1014 WRITE_FLAG( pcVPS->getAvcBaseLayerFlag() ? 1 : 0, "avc_base_layer_flag" ); 1015 #if !H_MV_HLS7_GEN 972 1016 WRITE_FLAG( pcVPS->getVpsVuiPresentFlag() ? 1 : 0 , "vps_vui_present_flag" ); 973 1017 if ( pcVPS->getVpsVuiPresentFlag() ) … … 975 1019 WRITE_CODE( pcVPS->getVpsVuiOffset( ), 16, "vps_vui_offset" ); // TBD 976 1020 } 1021 #endif 1022 977 1023 WRITE_FLAG( pcVPS->getSplittingFlag() ? 1 : 0, "splitting_flag" ); 978 1024 … … 1049 1095 if ( pcVPS->getVpsSubLayersMaxMinus1PresentFlag() ) 1050 1096 { 1051 for (Int i = 0; i < pcVPS->getMaxLayersMinus1(); i++ )1097 for (Int i = 0; i <= pcVPS->getMaxLayersMinus1(); i++ ) 1052 1098 { 1053 1099 WRITE_CODE( pcVPS->getSubLayersVpsMaxMinus1( i ), 3, "sub_layers_vps_max_minus1" ); … … 1057 1103 else 1058 1104 { 1059 for (Int i = 0; i < pcVPS->getMaxLayersMinus1(); i++ )1105 for (Int i = 0; i <= pcVPS->getMaxLayersMinus1(); i++ ) 1060 1106 { 1061 1107 assert( pcVPS->getSubLayersVpsMaxMinus1( i ) + 1 == pcVPS->getMaxTLayers( ) ); … … 1079 1125 1080 1126 WRITE_FLAG( pcVPS->getAllRefLayersActiveFlag( ) ? 1 : 0 , "all_ref_layers_active_flag" ); 1127 #if !H_MV_HLS_7_OUTPUT_LAYERS_5_10_22_27 1081 1128 WRITE_CODE( pcVPS->getVpsNumberLayerSetsMinus1( ) , 10, "vps_number_layer_sets_minus1" ); 1129 #endif 1130 1131 #if !H_MV_HLS7_GEN 1082 1132 WRITE_CODE( pcVPS->getVpsNumProfileTierLevelMinus1( ), 6, "vps_num_profile_tier_level_minus1" ); 1133 #else 1134 WRITE_UVLC( pcVPS->getVpsNumProfileTierLevelMinus1( ), "vps_num_profile_tier_level_minus1" ); 1135 #endif 1083 1136 1084 1137 for( Int i = 1; i <= pcVPS->getVpsNumProfileTierLevelMinus1(); i++ ) 1085 1138 { 1086 1139 WRITE_FLAG( pcVPS->getVpsProfilePresentFlag( i ) ? 1 : 0, "vps_profile_present_flag[i]" ); 1140 #if !H_MV_HLS_7_VPS_P0048_14 1087 1141 if( !pcVPS->getVpsProfilePresentFlag( i ) ) 1088 1142 { … … 1090 1144 pcVPS->checkProfileRefMinus1( i ); 1091 1145 } 1146 #endif 1092 1147 codePTL( pcVPS->getPTL( i ), pcVPS->getVpsProfilePresentFlag( i ), pcVPS->getMaxTLayers() - 1 ); 1093 1148 } 1094 1149 1150 1151 1152 1153 1154 1155 #if H_MV_HLS_7_OUTPUT_LAYERS_5_10_22_27 1156 WRITE_UVLC( pcVPS->getNumAddOutputLayerSets( ), "num_add_output_layer_sets" ); 1157 1158 if( pcVPS->getNumOutputLayerSets() > 1) 1159 { 1160 WRITE_CODE( pcVPS->getDefaultTargetOutputLayerIdc( ), 2, "default_target_output_layer_idc" ); 1161 } 1162 #else 1095 1163 Int numOutputLayerSets = pcVPS->getVpsNumberLayerSetsMinus1( ) + 1; 1096 1164 … … 1108 1176 pcVPS->checkDefaultOneTargetOutputLayerIdc(); 1109 1177 } 1178 #endif 1110 1179 1111 1180 assert( pcVPS->getOutputLayerFlag(0, 0) == pcVPS->inferOutputLayerFlag( 0, 0 )); 1112 1181 assert( pcVPS->getOutputLayerSetIdxMinus1( 0 ) == -1 ); 1182 1183 #if H_MV_HLS_7_OUTPUT_LAYERS_5_10_22_27 1184 1185 for( Int i = 1; i < pcVPS->getNumOutputLayerSets( ); i++ ) 1186 { 1187 if( i > pcVPS->getVpsNumLayerSetsMinus1( ) ) 1188 #else 1113 1189 for( Int i = 1; i < numOutputLayerSets; i++ ) 1114 1190 { 1115 1191 if( i > pcVPS->getVpsNumberLayerSetsMinus1( ) ) 1192 #endif 1116 1193 { 1117 1194 WRITE_UVLC( pcVPS->getOutputLayerSetIdxMinus1( i ), "output_layer_set_idx_minus1[i]" ); 1195 #if H_MV_HLS_7_OUTPUT_LAYERS_5_10_22_27 1196 } 1197 1198 if ( i > pcVPS->getVpsNumLayerSetsMinus1() || pcVPS->getDefaultTargetOutputLayerIdc() == 2 ) 1199 { 1200 for( Int j = 0; j < pcVPS->getNumLayersInIdList( pcVPS->getLayerSetIdxForOutputLayerSet( i ) ); j++ ) 1201 { 1202 WRITE_FLAG( pcVPS->getOutputLayerFlag( i, j) ? 1 : 0, "output_layer_flag" ); 1203 } 1204 } 1205 else 1206 { 1207 for( Int j = 0; j < pcVPS->getNumLayersInIdList( pcVPS->getLayerSetIdxForOutputLayerSet( i ) ) - 1; j++ ) 1208 { 1209 assert( pcVPS->getOutputLayerFlag( i , j ) == pcVPS->inferOutputLayerFlag( i, j )); 1210 } 1211 } 1212 1213 #else 1118 1214 for( Int j = 0; j < pcVPS->getNumLayersInIdList( j ) - 1 ; j++ ) 1119 1215 { … … 1129 1225 } 1130 1226 } 1131 1227 #endif 1132 1228 if ( pcVPS->getProfileLevelTierIdxLen() > 0 ) 1133 1229 { 1134 1230 WRITE_CODE( pcVPS->getProfileLevelTierIdx( i ), pcVPS->getProfileLevelTierIdxLen() ,"profile_level_tier_idx[ i ]" ); 1135 1231 } 1232 #if H_MV_HLS_7_OUTPUT_LAYERS_5_10_22_27 1233 if( pcVPS->getNumOutputLayersInOutputLayerSet( i ) == 1 && pcVPS->getNumDirectRefLayers( pcVPS->getOlsHighestOutputLayerId( i ) ) > 0 ) 1234 { 1235 WRITE_FLAG( pcVPS->getAltOutputLayerFlag( i ) ? 1 : 0 , "alt_output_layer_flag[ i ]" ); 1236 } 1237 } 1238 #else 1136 1239 } 1137 1240 … … 1140 1243 WRITE_FLAG( pcVPS->getAltOutputLayerFlag( ) ? 1 : 0 , "alt_output_layer_flag" ); 1141 1244 } 1245 #endif 1246 1247 1248 1249 1142 1250 1143 1251 WRITE_FLAG( pcVPS->getRepFormatIdxPresentFlag( ) ? 1 : 0 , "rep_format_idx_present_flag" ); 1144 1252 if ( pcVPS->getRepFormatIdxPresentFlag() ) 1145 1253 { 1254 #if H_MV_HLS7_GEN 1255 WRITE_UVLC( pcVPS->getVpsNumRepFormatsMinus1( ), "vps_num_rep_formats_minus1" ); 1256 #else 1146 1257 WRITE_CODE( pcVPS->getVpsNumRepFormatsMinus1( ), 4, "vps_num_rep_formats_minus1" ); 1258 #endif 1147 1259 } 1148 1260 … … 1166 1278 1167 1279 WRITE_FLAG( pcVPS->getMaxOneActiveRefLayerFlag( ) ? 1 : 0, "max_one_active_ref_layer_flag" ); 1280 #if H_MV_HLS7_GEN 1281 WRITE_FLAG( pcVPS->getVpsPocLsbAlignedFlag( ) ? 1 : 0 , "vps_poc_lsb_aligned_flag" ); 1282 #endif 1168 1283 for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) 1169 1284 { … … 1173 1288 } 1174 1289 } 1290 #if H_MV_HLS_7_RESERVED_FLAGS 1291 WRITE_FLAG( 0, "vps_reserved_zero_flag" ); 1292 #endif 1175 1293 codeDpbSize( pcVPS ); 1176 1294 … … 1202 1320 } 1203 1321 } 1322 #if H_MV_HLS7_GEN 1323 WRITE_UVLC( 0, "vps_non_vui_extension_length" ); 1324 WRITE_FLAG( pcVPS->getVpsVuiPresentFlag() ? 1 : 0 , "vps_vui_present_flag" ); 1325 #endif 1326 #if !H_MV_HLS_7_RESERVED_FLAGS 1204 1327 WRITE_FLAG ( 0, "vps_shvc_reserved_zero_flag" ); 1205 1328 #endif 1206 1329 if( pcVPS->getVpsVuiPresentFlag() ) 1207 1330 { … … 1209 1332 codeVPSVUI( pcVPS ); 1210 1333 } 1334 #if H_MV_HLS_7_FIX_INFER_CROSS_LAYER_IRAP_ALIGNED_FLAG 1335 { 1336 TComVPSVUI* pcVPSVUI = pcVPS->getVPSVUI( ); 1337 assert( pcVPSVUI ); 1338 pcVPSVUI->inferVpsVui( true ); 1339 } 1340 #endif 1211 1341 } 1212 1342 Void TEncCavlc::codeVideoSignalInfo( TComVideoSignalInfo* pcVideoSignalInfo ) … … 1228 1358 { 1229 1359 WRITE_FLAG( dpbSize->getSubLayerFlagInfoPresentFlag( i ) ? 1 : 0 , "sub_layer_flag_info_present_flag" ); 1230 1360 #if H_MV_HLS_7_HRD_P0156_7 1361 for( Int j = 0; j <= vps->getMaxSubLayersInLayerSetMinus1( i ); j++ ) 1362 #else 1231 1363 for( Int j = 0; j <= vps->getMaxTLayers() - 1 ; j++ ) 1364 #endif 1232 1365 { 1233 1366 if( j > 0 && dpbSize->getSubLayerDpbInfoPresentFlag( i, j ) ) … … 1237 1370 if( dpbSize->getSubLayerDpbInfoPresentFlag( i, j ) ) 1238 1371 { 1372 #if H_MV_HLS_7_OUTPUT_LAYERS_5_10_22_27 1373 for( Int k = 0; k < vps->getNumSubDpbs( vps->getLayerSetIdxForOutputLayerSet( i )); k++ ) 1374 #else 1239 1375 for( Int k = 0; k < vps->getNumSubDpbs( vps->getOutputLayerSetIdxMinus1( i ) + 1 ); k++ ) // Preliminary fix does not match with spec 1376 #endif 1240 1377 { 1241 1378 WRITE_UVLC( dpbSize->getMaxVpsDecPicBufferingMinus1( i, k, j ), "max_vps_dec_pic_buffering_minus1" ); 1242 1379 } 1243 1380 WRITE_UVLC( dpbSize->getMaxVpsNumReorderPics( i, j ), "max_vps_num_reorder_pics" ); 1381 #if H_MV_HLS7_GEN 1382 if( vps->getNumSubDpbs( vps->getLayerSetIdxForOutputLayerSet( i ) ) != vps->getNumLayersInIdList( vps->getLayerSetIdxForOutputLayerSet( i ) ) ) 1383 { 1384 for( Int k = 0; k < vps->getNumLayersInIdList( vps->getLayerSetIdxForOutputLayerSet( i ) ); k++ ) 1385 { 1386 WRITE_UVLC( dpbSize->getMaxVpsLayerDecPicBuffMinus1( i, k, j ), "max_vps_layer_dec_pic_buff_minus1" ); 1387 } 1388 } 1389 #endif 1244 1390 WRITE_UVLC( dpbSize->getMaxVpsLatencyIncreasePlus1( i, j ), "max_vps_latency_increase_plus1" ); 1245 1391 } … … 1248 1394 if ( j > 0 ) 1249 1395 { 1396 #if H_MV_HLS_7_OUTPUT_LAYERS_5_10_22_27 1397 for( Int k = 0; k < vps->getNumSubDpbs( vps->getLayerSetIdxForOutputLayerSet( i ) ); k++ ) 1398 #else 1250 1399 for( Int k = 0; k < vps->getNumSubDpbs( vps->getOutputLayerSetIdxMinus1( i ) + 1 ); k++ ) 1400 #endif 1251 1401 { 1252 1402 assert( dpbSize->getMaxVpsDecPicBufferingMinus1( i, k, j ) == dpbSize->getMaxVpsDecPicBufferingMinus1( i,k, j - 1 ) ); … … 1300 1450 WRITE_FLAG( pcVPSVUI->getCrossLayerIrapAlignedFlag( ) ? 1 : 0 , "cross_layer_irap_aligned_flag" ); 1301 1451 } 1302 1452 #if H_MV_HLS_7_MISC_P0068_21 1453 if( pcVPSVUI->getCrossLayerIrapAlignedFlag( ) ) 1454 { 1455 WRITE_FLAG( pcVPSVUI->getAllLayersIdrAlignedFlag( ) ? 1 : 0 , "all_layers_idr_aligned_flag" ); 1456 } 1457 #endif 1303 1458 WRITE_FLAG( pcVPSVUI->getBitRatePresentVpsFlag( ) ? 1 : 0 , "bit_rate_present_vps_flag" ); 1304 1459 WRITE_FLAG( pcVPSVUI->getPicRatePresentVpsFlag( ) ? 1 : 0 , "pic_rate_present_vps_flag" ); 1305 1460 if( pcVPSVUI->getBitRatePresentVpsFlag( ) || pcVPSVUI->getPicRatePresentVpsFlag( ) ) 1306 1461 { 1462 #if H_MV_HLS_7_OUTPUT_LAYERS_5_10_22_27 1463 for( Int i = 0; i <= pcVPS->getVpsNumLayerSetsMinus1(); i++ ) 1464 #else 1307 1465 for( Int i = 0; i <= pcVPS->getVpsNumberLayerSetsMinus1(); i++ ) 1466 #endif 1308 1467 { 1309 1468 for( Int j = 0; j <= pcVPS->getMaxTLayers(); j++ ) … … 1331 1490 } 1332 1491 1492 #if H_MV_HLS_7_VPS_P0076_15 1493 WRITE_FLAG( pcVPSVUI->getVideoSignalInfoIdxPresentFlag( ) ? 1 : 0 , "video_signal_info_idx_present_flag" ); 1494 if( pcVPSVUI->getVideoSignalInfoIdxPresentFlag() ) 1495 { 1496 WRITE_CODE( pcVPSVUI->getVpsNumVideoSignalInfoMinus1( ), 4, "vps_num_video_signal_info_minus1" ); 1497 } 1498 else 1499 { 1500 pcVPSVUI->setVpsNumVideoSignalInfoMinus1( pcVPS->getMaxLayersMinus1() ); 1501 } 1502 1503 for( Int i = 0; i <= pcVPSVUI->getVpsNumVideoSignalInfoMinus1(); i++ ) 1504 { 1505 assert( pcVPSVUI->getVideoSignalInfo( i ) != NULL ); 1506 TComVideoSignalInfo* curVideoSignalInfo = pcVPSVUI->getVideoSignalInfo( i ); 1507 codeVideoSignalInfo( curVideoSignalInfo ); 1508 1509 } 1510 1511 if( pcVPSVUI->getVideoSignalInfoIdxPresentFlag() && pcVPSVUI->getVpsNumVideoSignalInfoMinus1() > 0 ) 1512 { 1513 for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) 1514 { 1515 WRITE_CODE( pcVPSVUI->getVpsVideoSignalInfoIdx( i ), 4, "vps_video_signal_info_idx" ); 1516 assert( pcVPSVUI->getVpsVideoSignalInfoIdx( i ) >= 0 && pcVPSVUI->getVpsVideoSignalInfoIdx( i ) <= pcVPSVUI->getVpsNumVideoSignalInfoMinus1() ); 1517 } 1518 } 1519 else 1520 { 1521 for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) 1522 { 1523 assert( pcVPSVUI->getVpsVideoSignalInfoIdx( i ) == ( pcVPSVUI->getVideoSignalInfoIdxPresentFlag() ? 0 : i ) ); 1524 } 1525 } 1526 #endif 1333 1527 WRITE_FLAG( pcVPSVUI->getTilesNotInUseFlag( ) ? 1 : 0 , "tiles_not_in_use_flag" ); 1334 1528 if( !pcVPSVUI->getTilesNotInUseFlag() ) … … 1365 1559 } 1366 1560 } 1561 #if H_MV_HLS_7_RESERVED_FLAGS 1562 WRITE_CODE( 0, 3, "vps_vui_reserved_zero_3bits" ); 1563 #endif 1367 1564 WRITE_FLAG( pcVPSVUI->getIlpRestrictedRefLayersFlag( ) ? 1 : 0 , "ilp_restricted_ref_layers_flag" ); 1368 1565 … … 1385 1582 } 1386 1583 } 1584 1585 #if !H_MV_HLS_7_VPS_P0076_15 1387 1586 WRITE_FLAG( pcVPSVUI->getVideoSignalInfoIdxPresentFlag( ) ? 1 : 0 , "video_signal_info_idx_present_flag" ); 1388 1587 if( pcVPSVUI->getVideoSignalInfoIdxPresentFlag() ) … … 1417 1616 } 1418 1617 } 1618 #endif 1419 1619 WRITE_FLAG( pcVPSVUI->getVpsVuiBspHrdPresentFlag( ) ? 1 : 0 , "vps_vui_bsp_hrd_present_flag" ); 1420 1620 if ( pcVPSVUI->getVpsVuiBspHrdPresentFlag( ) ) … … 1422 1622 codeVpsVuiBspHrdParameters( pcVPS ); 1423 1623 } 1424 } 1624 #if H_MV_HLS_7_MISC_P0182_13 1625 for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) 1626 { 1627 if( pcVPS->getNumDirectRefLayers( pcVPS->getLayerIdInNuh( i )) == 0 ) 1628 { 1629 WRITE_FLAG( pcVPSVUI->getBaseLayerParameterSetCompatibilityFlag( i ) ? 1 : 0 , "base_layer_parameter_set_compatibility_flag" ); 1630 } 1631 } 1632 #endif 1633 } 1634 1425 1635 Void TEncCavlc::codeVpsVuiBspHrdParameters( TComVPS* pcVPS ) 1426 1636 { … … 1638 1848 } 1639 1849 pcSlice->checkCrossLayerBlaFlag( ); 1640 1850 #if !H_MV_HLS7_GEN 1641 1851 if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb ) 1642 1852 { … … 1644 1854 WRITE_FLAG( pcSlice->getPocResetFlag( ) ? 1 : 0 , "poc_reset_flag" ); 1645 1855 } 1856 #endif 1646 1857 1647 1858 … … 2023 2234 #endif 2024 2235 2236 #if !H_MV_HLS7_GEN 2025 2237 #if PPS_FIX_DEPTH 2026 2238 if(pcSlice->getPPS()->getSliceHeaderExtensionPresentFlag() || pcSlice->getIsDepth() ) … … 2031 2243 WRITE_UVLC(0,"slice_header_extension_length"); 2032 2244 } 2245 #endif 2246 2247 #if H_MV_HLS7_GEN 2248 #if !H_MV 2249 if(pcSlice->getPPS()->getSliceHeaderExtensionPresentFlag()) 2250 { 2251 WRITE_UVLC(0,"slice_header_extension_length"); 2252 } 2253 #else 2254 if(pcSlice->getPPS()->getSliceHeaderExtensionPresentFlag()) 2255 { 2256 WRITE_UVLC( pcSlice->getSliceSegmentHeaderExtensionLength( ), "slice_segment_header_extension_length" ); 2257 UInt posFollSliceSegHeaderExtLen = m_pcBitIf->getNumberOfWrittenBits(); 2258 if( pcSlice->getPPS()->getPocResetInfoPresentFlag() ) 2259 { 2260 WRITE_CODE( pcSlice->getPocResetIdc( ), 2, "poc_reset_idc" ); 2261 } 2262 2263 if( pcSlice->getPocResetIdc() != 0 ) 2264 { 2265 WRITE_CODE( pcSlice->getPocResetPeriodId( ), 6, "poc_reset_period_id" ); 2266 } 2267 2268 if( pcSlice->getPocResetIdc() == 3 ) 2269 { 2270 WRITE_FLAG( pcSlice->getFullPocResetFlag( ) ? 1 : 0 , "full_poc_reset_flag" ); 2271 WRITE_CODE( pcSlice->getPocLsbVal( ), getPocLsbValLen ), "poc_lsb_val" ); 2272 } 2273 2274 if( !pcSlice->getPocMsbValRequiredFlag() && pcSlice->getVPS()->getVpsPocLsbAlignedFlag() ) 2275 { 2276 WRITE_FLAG( pcSlice->getPocMsbValPresentFlag( ) ? 1 : 0 , "poc_msb_val_present_flag" ); 2277 } 2278 2279 if( pcSlice->getPocMsbValPresentFlag() ) 2280 { 2281 WRITE_UVLC( pcSlice->getPocMsbVal( ), "poc_msb_val" ); 2282 } 2283 2284 while( ( m_pcBitIf->getNumberOfWrittenBits() - posFollSliceSegHeaderExtLen ) < pcSlice->getSliceSegmentHeaderExtensionLength() * 8 ); 2285 { 2286 WRITE_FLAG( 0, "slice_segment_header_extension_data_bit" ); 2287 } 2288 2289 assert( m_pcBitIf->getNumberOfWrittenBits() - posFollSliceSegHeaderExtLen ) == pcSlice->getSliceSegmentHeaderExtensionLength() * 8 ); 2290 #endif 2291 2292 #endif 2033 2293 } 2034 2294 -
branches/HTM-10.0-dev0/source/Lib/TLibEncoder/TEncCu.cpp
r852 r854 40 40 #include "TEncCu.h" 41 41 #include "TEncAnalyze.h" 42 42 43 #include <cmath> 43 44 #include <algorithm> … … 421 422 // get Original YUV data from picture 422 423 m_ppcOrigYuv[uiDepth]->copyFromPicYuv( pcPic->getPicYuvOrg(), rpcBestCU->getAddr(), rpcBestCU->getZorderIdxInCU() ); 423 424 424 425 #if H_3D_QTLPC 425 426 Bool bTrySplit = true; … … 1198 1199 if(bInSlice && ( pcSubBestPartCU->getCUPelX() < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( pcSubBestPartCU->getCUPelY() < pcSlice->getSPS()->getPicHeightInLumaSamples() ) ) 1199 1200 { 1200 if ( 0 == uiPartUnitIdx) //initialize RD with previous depth buffer1201 {1202 m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]);1203 }1204 else1205 {1206 m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]);1207 }1201 if ( 0 == uiPartUnitIdx) //initialize RD with previous depth buffer 1202 { 1203 m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]); 1204 } 1205 else 1206 { 1207 m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]); 1208 } 1208 1209 1209 1210 #if AMP_ENC_SPEEDUP … … 1236 1237 1237 1238 rpcTempCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // split bits 1238 rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();1239 }1239 rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 1240 } 1240 1241 #if H_3D_VSO // M10 1241 1242 if ( m_pcRdCost->getUseVSO() ) … … 1243 1244 else 1244 1245 #endif 1245 1246 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 1246 1247 1247 1248 if( (g_uiMaxCUWidth>>uiDepth) == rpcTempCU->getSlice()->getPPS()->getMinCuDQPSize() && rpcTempCU->getSlice()->getPPS()->getUseDQP()) … … 1251 1252 { 1252 1253 if( ( pcPic->getCU( rpcTempCU->getAddr() )->getSliceSegmentStartCU(uiBlkIdx+rpcTempCU->getZorderIdxInCU()) == rpcTempCU->getSlice()->getSliceSegmentCurStartCUAddr() ) && 1253 ( rpcTempCU->getCbf( uiBlkIdx, TEXT_LUMA ) || rpcTempCU->getCbf( uiBlkIdx, TEXT_CHROMA_U ) || rpcTempCU->getCbf( uiBlkIdx, TEXT_CHROMA_V ) ) )1254 ( rpcTempCU->getCbf( uiBlkIdx, TEXT_LUMA ) || rpcTempCU->getCbf( uiBlkIdx, TEXT_CHROMA_U ) || rpcTempCU->getCbf( uiBlkIdx, TEXT_CHROMA_V ) ) ) 1254 1255 { 1255 1256 hasResidual = true; … … 1273 1274 m_pcEntropyCoder->encodeQP( rpcTempCU, uiTargetPartIdx, false ); 1274 1275 rpcTempCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // dQP bits 1275 rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();1276 rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 1276 1277 #if H_3D_VSO // M11 1277 1278 if ( m_pcRdCost->getUseLambdaScaleVSO()) … … 1279 1280 else 1280 1281 #endif 1281 1282 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 1282 1283 #endif 1283 1284 … … 1292 1293 } 1293 1294 1294 m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]);1295 m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]); 1295 1296 Bool isEndOfSlice = rpcBestCU->getSlice()->getSliceMode()==FIXED_NUMBER_OF_BYTES 1296 && (rpcBestCU->getTotalBits()>rpcBestCU->getSlice()->getSliceArgument()<<3);1297 && (rpcBestCU->getTotalBits()>rpcBestCU->getSlice()->getSliceArgument()<<3); 1297 1298 Bool isEndOfSliceSegment = rpcBestCU->getSlice()->getSliceSegmentMode()==FIXED_NUMBER_OF_BYTES 1298 && (rpcBestCU->getTotalBits()>rpcBestCU->getSlice()->getSliceSegmentArgument()<<3);1299 && (rpcBestCU->getTotalBits()>rpcBestCU->getSlice()->getSliceSegmentArgument()<<3); 1299 1300 if(isEndOfSlice||isEndOfSliceSegment) 1300 1301 { … … 1303 1304 xCheckBestMode( rpcBestCU, rpcTempCU, uiDepth); // RD compare current larger prediction 1304 1305 } // with sub partitioned prediction. 1305 }1306 } 1306 1307 1307 1308 #if H_3D_VSO // M12 … … 1786 1787 #endif 1787 1788 #if H_3D_ARP 1788 1789 #else 1790 1789 for( UInt ui = 0; ui < rpcTempCU->getSlice()->getMaxNumMergeCand(); ++ui ) 1790 #else 1791 for( UInt ui = 0; ui < numValidMergeCand; ++ui ) 1791 1792 #endif 1792 1793 { … … 1861 1862 #endif 1862 1863 1863 1864 1865 1866 1864 for( UInt uiNoResidual = 0; uiNoResidual < iteration; ++uiNoResidual ) 1865 { 1866 for( UInt uiMergeCand = 0; uiMergeCand < numValidMergeCand; ++uiMergeCand ) 1867 { 1867 1868 #if H_3D_IC 1868 1869 if( rpcTempCU->getSlice()->getApplyIC() && rpcTempCU->getSlice()->getIcSkipParseFlag() ) … … 1876 1877 if(!(uiNoResidual==1 && mergeCandBuffer[uiMergeCand]==1)) 1877 1878 { 1878 if( !(bestIsSkip && uiNoResidual == 0) ) 1879 if( !(bestIsSkip && uiNoResidual == 0) ) 1880 { 1881 // set MC parameters 1882 rpcTempCU->setPredModeSubParts( MODE_INTER, 0, uhDepth ); // interprets depth relative to LCU level 1883 rpcTempCU->setCUTransquantBypassSubParts( bTransquantBypassFlag, 0, uhDepth ); 1884 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level 1885 #if H_3D_IC 1886 rpcTempCU->setICFlagSubParts( bICFlag, 0, 0, uhDepth ); 1887 #endif 1888 #if H_3D_ARP 1889 rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth ); 1890 #endif 1891 rpcTempCU->setMergeFlagSubParts( true, 0, 0, uhDepth ); // interprets depth relative to LCU level 1892 rpcTempCU->setMergeIndexSubParts( uiMergeCand, 0, 0, uhDepth ); // interprets depth relative to LCU level 1893 #if H_3D_VSP 1894 rpcTempCU->setVSPFlagSubParts( vspFlag[uiMergeCand], 0, 0, uhDepth ); 1895 rpcTempCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeCand].m_acDvInfo, 0, 0, uhDepth ); 1896 #endif 1897 #if MTK_DDD_G0063 1898 if( rpcTempCU->getSlice()->getIsDepth() && rpcTempCU->getSlice()->getViewIndex() != 0 && iDDDCand == uiMergeCand ) 1879 1899 { 1880 // set MC parameters1881 rpcTempCU->setPredModeSubParts( MODE_INTER, 0, uhDepth ); // interprets depth relative to LCU level1882 rpcTempCU->setCUTransquantBypassSubParts( bTransquantBypassFlag, 0, uhDepth );1883 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level1884 #if H_3D_IC1885 rpcTempCU->setICFlagSubParts( bICFlag, 0, 0, uhDepth );1886 #endif1887 #if H_3D_ARP1888 rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth );1889 #endif1890 rpcTempCU->setMergeFlagSubParts( true, 0, 0, uhDepth ); // interprets depth relative to LCU level1891 rpcTempCU->setMergeIndexSubParts( uiMergeCand, 0, 0, uhDepth ); // interprets depth relative to LCU level1892 #if H_3D_VSP1893 rpcTempCU->setVSPFlagSubParts( vspFlag[uiMergeCand], 0, 0, uhDepth );1894 rpcTempCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeCand].m_acDvInfo, 0, 0, uhDepth );1895 #endif1896 #if MTK_DDD_G00631897 if( rpcTempCU->getSlice()->getIsDepth() && rpcTempCU->getSlice()->getViewIndex() != 0 && iDDDCand == uiMergeCand )1898 {1899 1900 rpcTempCU->setUseDDD( true, 0, 0, uhDepth ); 1900 1901 rpcTempCU->setDDDepthSubParts( ucDDDepth, 0, 0, uhDepth ); 1902 } 1903 else 1904 { 1905 rpcTempCU->setUseDDD( false, 0, 0, uhDepth ); 1906 } 1907 #endif 1908 #if H_3D_SPIVMP 1909 rpcTempCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeCand], 0, 0, uhDepth); 1910 if (bSPIVMPFlag[uiMergeCand]) 1911 { 1912 UInt uiSPAddr; 1913 Int iWidth = rpcTempCU->getWidth(0); 1914 Int iHeight = rpcTempCU->getHeight(0); 1915 Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight; 1916 rpcTempCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight); 1917 for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++) 1918 { 1919 rpcTempCU->getSPAbsPartIdx(0, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr); 1920 rpcTempCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight); 1921 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(rpcTempCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight); 1922 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(rpcTempCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight); 1923 } 1924 } 1925 else 1926 #endif 1927 #if NTT_STORE_SPDV_VSP_G0148 1928 { 1929 if ( vspFlag[uiMergeCand] ) 1930 { 1931 UInt partAddr; 1932 Int vspSize; 1933 Int width, height; 1934 rpcTempCU->getPartIndexAndSize( 0, partAddr, width, height ); 1935 if( uhInterDirNeighbours[ uiMergeCand ] & 0x01 ) 1936 { 1937 rpcTempCU->setMvFieldPUForVSP( rpcTempCU, partAddr, width, height, REF_PIC_LIST_0, cMvFieldNeighbours[ 2*uiMergeCand + 0 ].getRefIdx(), vspSize ); 1938 rpcTempCU->setVSPFlag( partAddr, vspSize ); 1901 1939 } 1902 1940 else 1903 1941 { 1904 rpcTempCU-> setUseDDD( false, 0, 0, uhDepth );1942 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 1905 1943 } 1906 #endif 1907 #if H_3D_SPIVMP 1908 rpcTempCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeCand], 0, 0, uhDepth); 1909 if (bSPIVMPFlag[uiMergeCand]) 1944 if( uhInterDirNeighbours[ uiMergeCand ] & 0x02 ) 1910 1945 { 1911 UInt uiSPAddr; 1912 Int iWidth = rpcTempCU->getWidth(0); 1913 Int iHeight = rpcTempCU->getHeight(0); 1914 Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight; 1915 rpcTempCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight); 1916 for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++) 1917 { 1918 rpcTempCU->getSPAbsPartIdx(0, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr); 1919 rpcTempCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight); 1920 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(rpcTempCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight); 1921 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(rpcTempCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight); 1922 } 1946 rpcTempCU->setMvFieldPUForVSP( rpcTempCU, partAddr, width, height, REF_PIC_LIST_1 , cMvFieldNeighbours[ 2*uiMergeCand + 1 ].getRefIdx(), vspSize ); 1947 rpcTempCU->setVSPFlag( partAddr, vspSize ); 1923 1948 } 1924 1949 else 1925 #endif 1950 { 1951 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 1952 } 1953 rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level 1954 } 1955 else 1956 { 1957 #endif 1958 rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level 1959 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 1960 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 1926 1961 #if NTT_STORE_SPDV_VSP_G0148 1962 } 1963 } 1964 #endif 1965 // do MC 1966 m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] ); 1967 // estimate residual and encode everything 1968 #if H_3D_VSO //M2 1969 if( m_pcRdCost->getUseRenModel() ) 1970 { //Reset 1971 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth (); 1972 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight (); 1973 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getLumaAddr (); 1974 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride (); 1975 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 1976 } 1977 #endif 1978 m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, 1979 m_ppcOrigYuv [uhDepth], 1980 m_ppcPredYuvTemp[uhDepth], 1981 m_ppcResiYuvTemp[uhDepth], 1982 m_ppcResiYuvBest[uhDepth], 1983 m_ppcRecoYuvTemp[uhDepth], 1984 (uiNoResidual? true:false)); 1985 1986 1987 if ( uiNoResidual == 0 && rpcTempCU->getQtRootCbf(0) == 0 ) 1988 { 1989 // If no residual when allowing for one, then set mark to not try case where residual is forced to 0 1990 mergeCandBuffer[uiMergeCand] = 1; 1991 } 1992 1993 rpcTempCU->setSkipFlagSubParts( rpcTempCU->getQtRootCbf(0) == 0, 0, uhDepth ); 1994 #if NTT_STORE_SPDV_VSP_G0148 // possible bug fix 1995 if( rpcTempCU->getSkipFlag(0) ) 1996 { 1997 rpcTempCU->setTrIdxSubParts(0, 0, uhDepth); 1998 } 1999 #endif 2000 #if H_3D_INTER_SDC 2001 TComDataCU *rpcTempCUPre = rpcTempCU; 2002 #endif 2003 Int orgQP = rpcTempCU->getQP( 0 ); 2004 xCheckDQP( rpcTempCU ); 2005 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth); 2006 #if H_3D_INTER_SDC 2007 if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) && rpcTempCU->getSlice()->getIsDepth() && !uiNoResidual ) 2008 { 2009 #if SEC_INTER_SDC_G0101 2010 for( Int uiOffest = -2 ; uiOffest <= 2 ; uiOffest++ ) 1927 2011 { 1928 if ( vspFlag[uiMergeCand] )1929 {1930 UInt partAddr;1931 Int vspSize;1932 Int width, height;1933 rpcTempCU->getPartIndexAndSize( 0, partAddr, width, height );1934 if( uhInterDirNeighbours[ uiMergeCand ] & 0x01 )1935 {1936 rpcTempCU->setMvFieldPUForVSP( rpcTempCU, partAddr, width, height, REF_PIC_LIST_0, cMvFieldNeighbours[ 2*uiMergeCand + 0 ].getRefIdx(), vspSize );1937 rpcTempCU->setVSPFlag( partAddr, vspSize );1938 }1939 else1940 {1941 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level1942 }1943 if( uhInterDirNeighbours[ uiMergeCand ] & 0x02 )1944 {1945 rpcTempCU->setMvFieldPUForVSP( rpcTempCU, partAddr, width, height, REF_PIC_LIST_1 , cMvFieldNeighbours[ 2*uiMergeCand + 1 ].getRefIdx(), vspSize );1946 rpcTempCU->setVSPFlag( partAddr, vspSize );1947 }1948 else1949 {1950 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level1951 }1952 rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level1953 }1954 else1955 {1956 #endif1957 rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level1958 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level1959 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level1960 #if NTT_STORE_SPDV_VSP_G01481961 }1962 }1963 #endif1964 // do MC1965 m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] );1966 // estimate residual and encode everything1967 #if H_3D_VSO //M21968 if( m_pcRdCost->getUseRenModel() )1969 { //Reset1970 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth ();1971 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight ();1972 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getLumaAddr ();1973 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride ();1974 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );1975 }1976 #endif1977 m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU,1978 m_ppcOrigYuv [uhDepth],1979 m_ppcPredYuvTemp[uhDepth],1980 m_ppcResiYuvTemp[uhDepth],1981 m_ppcResiYuvBest[uhDepth],1982 m_ppcRecoYuvTemp[uhDepth],1983 (uiNoResidual? true:false));1984 1985 1986 if ( uiNoResidual == 0 && rpcTempCU->getQtRootCbf(0) == 0 )1987 {1988 // If no residual when allowing for one, then set mark to not try case where residual is forced to 01989 mergeCandBuffer[uiMergeCand] = 1;1990 }1991 1992 rpcTempCU->setSkipFlagSubParts( rpcTempCU->getQtRootCbf(0) == 0, 0, uhDepth );1993 #if NTT_STORE_SPDV_VSP_G0148 // possible bug fix1994 if( rpcTempCU->getSkipFlag(0) )1995 {1996 rpcTempCU->setTrIdxSubParts(0, 0, uhDepth);1997 }1998 #endif1999 #if H_3D_INTER_SDC2000 TComDataCU *rpcTempCUPre = rpcTempCU;2001 #endif2002 Int orgQP = rpcTempCU->getQP( 0 );2003 xCheckDQP( rpcTempCU );2004 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);2005 #if H_3D_INTER_SDC2006 if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) && rpcTempCU->getSlice()->getIsDepth() && !uiNoResidual )2007 {2008 #if SEC_INTER_SDC_G01012009 for( Int uiOffest = -2 ; uiOffest <= 2 ; uiOffest++ )2010 {2011 if( rpcTempCU != rpcTempCUPre )2012 {2013 rpcTempCU->initEstData( uhDepth, orgQP, bTransquantBypassFlag );2014 rpcTempCU->copyPartFrom( rpcBestCU, 0, uhDepth );2015 }2016 rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );2017 rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth );2018 rpcTempCU->setCbfSubParts( 1, 1, 1, 0, uhDepth );2019 #if H_3D_VSO //M22020 if( m_pcRdCost->getUseRenModel() )2021 { //Reset2022 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth ();2023 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight ();2024 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getLumaAddr ();2025 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride ();2026 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );2027 }2028 #endif2029 m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU,2030 m_ppcOrigYuv[uhDepth],2031 ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth],2032 m_ppcResiYuvTemp[uhDepth],2033 m_ppcRecoYuvTemp[uhDepth],2034 uiOffest,2035 uhDepth );2036 2037 xCheckDQP( rpcTempCU );2038 xCheckBestMode( rpcBestCU, rpcTempCU, uhDepth );2039 }2040 #else2041 2012 if( rpcTempCU != rpcTempCUPre ) 2042 2013 { … … 2061 2032 ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth], 2062 2033 m_ppcResiYuvTemp[uhDepth], 2063 m_ppcRecoYuvTemp[uhDepth], 2034 m_ppcRecoYuvTemp[uhDepth], 2035 uiOffest, 2064 2036 uhDepth ); 2065 2037 2066 2038 xCheckDQP( rpcTempCU ); 2067 2039 xCheckBestMode( rpcBestCU, rpcTempCU, uhDepth ); 2068 #endif2069 2040 } 2070 #endif 2071 rpcTempCU->initEstData( uhDepth, orgQP, bTransquantBypassFlag ); 2072 2073 if( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip ) 2041 #else 2042 if( rpcTempCU != rpcTempCUPre ) 2074 2043 { 2044 rpcTempCU->initEstData( uhDepth, orgQP, bTransquantBypassFlag ); 2045 rpcTempCU->copyPartFrom( rpcBestCU, 0, uhDepth ); 2046 } 2047 rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth ); 2048 rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth ); 2049 rpcTempCU->setCbfSubParts( 1, 1, 1, 0, uhDepth ); 2050 #if H_3D_VSO //M2 2051 if( m_pcRdCost->getUseRenModel() ) 2052 { //Reset 2053 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth (); 2054 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight (); 2055 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getLumaAddr (); 2056 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride (); 2057 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 2058 } 2059 #endif 2060 m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU, 2061 m_ppcOrigYuv[uhDepth], 2062 ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth], 2063 m_ppcResiYuvTemp[uhDepth], 2064 m_ppcRecoYuvTemp[uhDepth], 2065 uhDepth ); 2066 2067 xCheckDQP( rpcTempCU ); 2068 xCheckBestMode( rpcBestCU, rpcTempCU, uhDepth ); 2069 #endif 2070 } 2071 #endif 2072 rpcTempCU->initEstData( uhDepth, orgQP, bTransquantBypassFlag ); 2073 2074 if( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip ) 2075 { 2075 2076 #if H_3D_INTER_SDC 2076 2077 2078 2079 2080 2081 2082 #endif 2083 2077 if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) ) 2078 { 2079 bestIsSkip = !rpcBestCU->getSDCFlag( 0 ) && ( rpcBestCU->getQtRootCbf(0) == 0 ); 2080 } 2081 else 2082 { 2083 #endif 2084 bestIsSkip = rpcBestCU->getQtRootCbf(0) == 0; 2084 2085 #if H_3D_INTER_SDC 2085 } 2086 #endif 2087 } 2086 } 2087 #endif 2088 } 2089 } 2090 } 2091 } 2092 2093 if(uiNoResidual == 0 && m_pcEncCfg->getUseEarlySkipDetection()) 2094 { 2095 if(rpcBestCU->getQtRootCbf( 0 ) == 0) 2096 { 2097 if( rpcBestCU->getMergeFlag( 0 )) 2098 { 2099 *earlyDetectionSkipMode = true; 2100 } 2101 else 2102 { 2103 Int absoulte_MV=0; 2104 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) 2105 { 2106 if ( rpcBestCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) 2107 { 2108 TComCUMvField* pcCUMvField = rpcBestCU->getCUMvField(RefPicList( uiRefListIdx )); 2109 Int iHor = pcCUMvField->getMvd( 0 ).getAbsHor(); 2110 Int iVer = pcCUMvField->getMvd( 0 ).getAbsVer(); 2111 absoulte_MV+=iHor+iVer; 2088 2112 } 2089 2113 } 2090 } 2091 2092 if(uiNoResidual == 0 && m_pcEncCfg->getUseEarlySkipDetection()) 2093 { 2094 if(rpcBestCU->getQtRootCbf( 0 ) == 0) 2114 2115 if(absoulte_MV == 0) 2095 2116 { 2096 if( rpcBestCU->getMergeFlag( 0 )) 2097 { 2098 *earlyDetectionSkipMode = true; 2099 } 2100 else 2101 { 2102 Int absoulte_MV=0; 2103 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) 2104 { 2105 if ( rpcBestCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) 2106 { 2107 TComCUMvField* pcCUMvField = rpcBestCU->getCUMvField(RefPicList( uiRefListIdx )); 2108 Int iHor = pcCUMvField->getMvd( 0 ).getAbsHor(); 2109 Int iVer = pcCUMvField->getMvd( 0 ).getAbsVer(); 2110 absoulte_MV+=iHor+iVer; 2111 } 2112 } 2113 2114 if(absoulte_MV == 0) 2115 { 2116 *earlyDetectionSkipMode = true; 2117 } 2118 } 2117 *earlyDetectionSkipMode = true; 2119 2118 } 2120 2119 } 2121 2120 } 2121 } 2122 } 2122 2123 #if H_3D_SPIVMP 2123 2124 2124 delete[] pcMvFieldSP; 2125 delete[] puhInterDirSP; 2125 2126 #endif 2126 2127 #if H_3D_ARP 2127 2128 } 2128 2129 #endif 2129 2130 } -
branches/HTM-10.0-dev0/source/Lib/TLibEncoder/TEncGOP.cpp
r852 r854 49 49 #include <time.h> 50 50 #include <math.h> 51 51 52 using namespace std; 52 53 //! \ingroup TLibEncoder -
branches/HTM-10.0-dev0/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp
r852 r854 41 41 #include <stdio.h> 42 42 #include <math.h> 43 43 44 //! \ingroup TLibEncoder 44 45 //! \{ -
branches/HTM-10.0-dev0/source/Lib/TLibEncoder/TEncSearch.cpp
r852 r854 3950 3950 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx ); 3951 3951 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx ); 3952 3952 3953 #if NTT_STORE_SPDV_VSP_G0148 3953 3954 } … … 4042 4043 m_cYuvPredTemp.clear(); 4043 4044 rpcPredYuv->clear(); 4044 4045 4045 4046 if ( !bUseRes ) 4046 4047 { 4047 4048 rpcResiYuv->clear(); 4048 4049 } 4049 4050 4050 4051 rpcRecoYuv->clear(); 4051 4052 4052 4053 TComMv cMvSrchRngLT; 4053 4054 TComMv cMvSrchRngRB; 4054 4055 4055 4056 TComMv cMvZero; 4056 4057 TComMv TempMv; //kolya 4057 4058 4058 4059 TComMv cMv[2]; 4059 4060 TComMv cMvBi[2]; 4060 4061 TComMv cMvTemp[2][33]; 4061 4062 4062 4063 Int iNumPart = pcCU->getNumPartInter(); 4063 4064 Int iNumPredDir = pcCU->getSlice()->isInterP() ? 1 : 2; 4064 4065 4065 4066 TComMv cMvPred[2][33]; 4066 4067 4067 4068 TComMv cMvPredBi[2][33]; 4068 4069 Int aaiMvpIdxBi[2][33]; 4069 4070 4070 4071 Int aaiMvpIdx[2][33]; 4071 4072 Int aaiMvpNum[2][33]; 4072 4073 4073 4074 AMVPInfo aacAMVPInfo[2][33]; 4074 4075 4075 4076 Int iRefIdx[2]={0,0}; //If un-initialized, may cause SEGV in bi-directional prediction iterative stage. 4076 4077 Int iRefIdxBi[2]; 4077 4078 4078 4079 UInt uiPartAddr; 4079 4080 Int iRoiWidth, iRoiHeight; 4080 4081 4081 4082 UInt uiMbBits[3] = {1, 1, 0}; 4082 4083 4083 4084 UInt uiLastMode = 0; 4084 4085 Int iRefStart, iRefEnd; 4085 4086 4086 4087 PartSize ePartSize = pcCU->getPartitionSize( 0 ); 4087 4088 … … 4110 4111 UInt uiCostBi = MAX_UINT; 4111 4112 UInt uiCostTemp; 4112 4113 4113 4114 UInt uiBits[3]; 4114 4115 UInt uiBitsTemp; … … 4135 4136 4136 4137 xGetBlkBits( ePartSize, pcCU->getSlice()->isInterP(), iPartIdx, uiLastMode, uiMbBits); 4137 4138 4138 4139 pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRoiWidth, iRoiHeight ); 4139 4140 … … 4141 4142 pcCU->setVSPFlagSubParts( 0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr) ); 4142 4143 #endif 4143 4144 4144 4145 #if AMP_MRG 4145 4146 Bool bTestNormalMC = true; … … 4152 4153 bTestNormalMC = false; 4153 4154 } 4154 4155 4155 4156 if (bTestNormalMC) 4156 4157 { 4157 4158 #endif 4158 4159 4159 // Uni-directional prediction 4160 for ( Int iRefList = 0; iRefList < iNumPredDir; iRefList++ ) 4161 { 4160 // Uni-directional prediction 4161 for ( Int iRefList = 0; iRefList < iNumPredDir; iRefList++ ) 4162 { 4163 RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); 4164 4165 for ( Int iRefIdxTemp = 0; iRefIdxTemp < pcCU->getSlice()->getNumRefIdx(eRefPicList); iRefIdxTemp++ ) 4166 { 4167 uiBitsTemp = uiMbBits[iRefList]; 4168 if ( pcCU->getSlice()->getNumRefIdx(eRefPicList) > 1 ) 4169 { 4170 uiBitsTemp += iRefIdxTemp+1; 4171 if ( iRefIdxTemp == pcCU->getSlice()->getNumRefIdx(eRefPicList)-1 ) uiBitsTemp--; 4172 } 4173 #if ZERO_MVD_EST 4174 xEstimateMvPredAMVP( pcCU, pcOrgYuv, iPartIdx, eRefPicList, iRefIdxTemp, cMvPred[iRefList][iRefIdxTemp], false, &biPDistTemp, &uiZeroMvdDistTemp); 4175 #else 4176 xEstimateMvPredAMVP( pcCU, pcOrgYuv, iPartIdx, eRefPicList, iRefIdxTemp, cMvPred[iRefList][iRefIdxTemp], false, &biPDistTemp); 4177 #endif 4178 aaiMvpIdx[iRefList][iRefIdxTemp] = pcCU->getMVPIdx(eRefPicList, uiPartAddr); 4179 aaiMvpNum[iRefList][iRefIdxTemp] = pcCU->getMVPNum(eRefPicList, uiPartAddr); 4180 4181 if(pcCU->getSlice()->getMvdL1ZeroFlag() && iRefList==1 && biPDistTemp < bestBiPDist) 4182 { 4183 bestBiPDist = biPDistTemp; 4184 bestBiPMvpL1 = aaiMvpIdx[iRefList][iRefIdxTemp]; 4185 bestBiPRefIdxL1 = iRefIdxTemp; 4186 } 4187 4188 uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdx[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS]; 4189 #if ZERO_MVD_EST 4190 if ( iRefList == 0 || pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) < 0 ) 4191 { 4192 uiZeroMvdBitsTemp = uiBitsTemp; 4193 uiZeroMvdBitsTemp += 2; //zero mvd bits 4194 4195 m_pcRdCost->getMotionCost( 1, 0 ); 4196 uiZeroMvdCostTemp = uiZeroMvdDistTemp + m_pcRdCost->getCost(uiZeroMvdBitsTemp); 4197 4198 if (uiZeroMvdCostTemp < uiZeroMvdCost) 4199 { 4200 uiZeroMvdCost = uiZeroMvdCostTemp; 4201 iZeroMvdDir = iRefList + 1; 4202 aiZeroMvdRefIdx[iRefList] = iRefIdxTemp; 4203 aiZeroMvdMvpIdx[iRefList] = aaiMvpIdx[iRefList][iRefIdxTemp]; 4204 auiZeroMvdBits[iRefList] = uiZeroMvdBitsTemp; 4205 } 4206 } 4207 #endif 4208 4209 #if GPB_SIMPLE_UNI 4210 if ( iRefList == 1 ) // list 1 4211 { 4212 if ( pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) >= 0 ) 4213 { 4214 cMvTemp[1][iRefIdxTemp] = cMvTemp[0][pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )]; 4215 uiCostTemp = uiCostTempL0[pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )]; 4216 /*first subtract the bit-rate part of the cost of the other list*/ 4217 uiCostTemp -= m_pcRdCost->getCost( uiBitsTempL0[pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )] ); 4218 /*correct the bit-rate part of the current ref*/ 4219 m_pcRdCost->setPredictor ( cMvPred[iRefList][iRefIdxTemp] ); 4220 uiBitsTemp += m_pcRdCost->getBits( cMvTemp[1][iRefIdxTemp].getHor(), cMvTemp[1][iRefIdxTemp].getVer() ); 4221 /*calculate the correct cost*/ 4222 uiCostTemp += m_pcRdCost->getCost( uiBitsTemp ); 4223 } 4224 else 4225 { 4226 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); 4227 } 4228 } 4229 else 4230 { 4231 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); 4232 } 4233 #else 4234 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); 4235 #endif 4236 xCopyAMVPInfo(pcCU->getCUMvField(eRefPicList)->getAMVPInfo(), &aacAMVPInfo[iRefList][iRefIdxTemp]); // must always be done ( also when AMVP_MODE = AM_NONE ) 4237 xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp); 4238 4239 if ( iRefList == 0 ) 4240 { 4241 uiCostTempL0[iRefIdxTemp] = uiCostTemp; 4242 uiBitsTempL0[iRefIdxTemp] = uiBitsTemp; 4243 } 4244 if ( uiCostTemp < uiCost[iRefList] ) 4245 { 4246 uiCost[iRefList] = uiCostTemp; 4247 uiBits[iRefList] = uiBitsTemp; // storing for bi-prediction 4248 4249 // set motion 4250 cMv[iRefList] = cMvTemp[iRefList][iRefIdxTemp]; 4251 iRefIdx[iRefList] = iRefIdxTemp; 4252 } 4253 4254 if ( iRefList == 1 && uiCostTemp < costValidList1 && pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) < 0 ) 4255 { 4256 costValidList1 = uiCostTemp; 4257 bitsValidList1 = uiBitsTemp; 4258 4259 // set motion 4260 mvValidList1 = cMvTemp[iRefList][iRefIdxTemp]; 4261 refIdxValidList1 = iRefIdxTemp; 4262 } 4263 } 4264 } 4265 // Bi-directional prediction 4266 if ( (pcCU->getSlice()->isInterB()) && (pcCU->isBipredRestriction(iPartIdx) == false) ) 4267 { 4268 4269 cMvBi[0] = cMv[0]; cMvBi[1] = cMv[1]; 4270 iRefIdxBi[0] = iRefIdx[0]; iRefIdxBi[1] = iRefIdx[1]; 4271 4272 ::memcpy(cMvPredBi, cMvPred, sizeof(cMvPred)); 4273 ::memcpy(aaiMvpIdxBi, aaiMvpIdx, sizeof(aaiMvpIdx)); 4274 4275 UInt uiMotBits[2]; 4276 4277 if(pcCU->getSlice()->getMvdL1ZeroFlag()) 4278 { 4279 xCopyAMVPInfo(&aacAMVPInfo[1][bestBiPRefIdxL1], pcCU->getCUMvField(REF_PIC_LIST_1)->getAMVPInfo()); 4280 pcCU->setMVPIdxSubParts( bestBiPMvpL1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4281 aaiMvpIdxBi[1][bestBiPRefIdxL1] = bestBiPMvpL1; 4282 cMvPredBi[1][bestBiPRefIdxL1] = pcCU->getCUMvField(REF_PIC_LIST_1)->getAMVPInfo()->m_acMvCand[bestBiPMvpL1]; 4283 4284 cMvBi[1] = cMvPredBi[1][bestBiPRefIdxL1]; 4285 iRefIdxBi[1] = bestBiPRefIdxL1; 4286 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMv( cMvBi[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4287 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllRefIdx( iRefIdxBi[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4288 TComYuv* pcYuvPred = &m_acYuvPred[1]; 4289 motionCompensation( pcCU, pcYuvPred, REF_PIC_LIST_1, iPartIdx ); 4290 4291 uiMotBits[0] = uiBits[0] - uiMbBits[0]; 4292 uiMotBits[1] = uiMbBits[1]; 4293 4294 if ( pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_1) > 1 ) 4295 { 4296 uiMotBits[1] += bestBiPRefIdxL1+1; 4297 if ( bestBiPRefIdxL1 == pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_1)-1 ) uiMotBits[1]--; 4298 } 4299 4300 uiMotBits[1] += m_auiMVPIdxCost[aaiMvpIdxBi[1][bestBiPRefIdxL1]][AMVP_MAX_NUM_CANDS]; 4301 4302 uiBits[2] = uiMbBits[2] + uiMotBits[0] + uiMotBits[1]; 4303 4304 cMvTemp[1][bestBiPRefIdxL1] = cMvBi[1]; 4305 } 4306 else 4307 { 4308 uiMotBits[0] = uiBits[0] - uiMbBits[0]; 4309 uiMotBits[1] = uiBits[1] - uiMbBits[1]; 4310 uiBits[2] = uiMbBits[2] + uiMotBits[0] + uiMotBits[1]; 4311 } 4312 4313 // 4-times iteration (default) 4314 Int iNumIter = 4; 4315 4316 // fast encoder setting: only one iteration 4317 if ( m_pcEncCfg->getUseFastEnc() || pcCU->getSlice()->getMvdL1ZeroFlag()) 4318 { 4319 iNumIter = 1; 4320 } 4321 4322 for ( Int iIter = 0; iIter < iNumIter; iIter++ ) 4323 { 4324 4325 Int iRefList = iIter % 2; 4326 if ( m_pcEncCfg->getUseFastEnc() ) 4327 { 4328 if( uiCost[0] <= uiCost[1] ) 4329 { 4330 iRefList = 1; 4331 } 4332 else 4333 { 4334 iRefList = 0; 4335 } 4336 } 4337 else if ( iIter == 0 ) 4338 { 4339 iRefList = 0; 4340 } 4341 if ( iIter == 0 && !pcCU->getSlice()->getMvdL1ZeroFlag()) 4342 { 4343 pcCU->getCUMvField(RefPicList(1-iRefList))->setAllMv( cMv[1-iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 4344 pcCU->getCUMvField(RefPicList(1-iRefList))->setAllRefIdx( iRefIdx[1-iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 4345 TComYuv* pcYuvPred = &m_acYuvPred[1-iRefList]; 4346 motionCompensation ( pcCU, pcYuvPred, RefPicList(1-iRefList), iPartIdx ); 4347 } 4162 4348 RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); 4163 4349 4164 for ( Int iRefIdxTemp = 0; iRefIdxTemp < pcCU->getSlice()->getNumRefIdx(eRefPicList); iRefIdxTemp++ ) 4165 { 4166 uiBitsTemp = uiMbBits[iRefList]; 4350 if(pcCU->getSlice()->getMvdL1ZeroFlag()) 4351 { 4352 iRefList = 0; 4353 eRefPicList = REF_PIC_LIST_0; 4354 } 4355 4356 Bool bChanged = false; 4357 4358 iRefStart = 0; 4359 iRefEnd = pcCU->getSlice()->getNumRefIdx(eRefPicList)-1; 4360 4361 for ( Int iRefIdxTemp = iRefStart; iRefIdxTemp <= iRefEnd; iRefIdxTemp++ ) 4362 { 4363 uiBitsTemp = uiMbBits[2] + uiMotBits[1-iRefList]; 4167 4364 if ( pcCU->getSlice()->getNumRefIdx(eRefPicList) > 1 ) 4168 4365 { … … 4170 4367 if ( iRefIdxTemp == pcCU->getSlice()->getNumRefIdx(eRefPicList)-1 ) uiBitsTemp--; 4171 4368 } 4369 uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdxBi[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS]; 4370 // call ME 4371 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPredBi[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp, true ); 4372 xCopyAMVPInfo(&aacAMVPInfo[iRefList][iRefIdxTemp], pcCU->getCUMvField(eRefPicList)->getAMVPInfo()); 4373 xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPredBi[iRefList][iRefIdxTemp], aaiMvpIdxBi[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp); 4374 4375 if ( uiCostTemp < uiCostBi ) 4376 { 4377 bChanged = true; 4378 4379 cMvBi[iRefList] = cMvTemp[iRefList][iRefIdxTemp]; 4380 iRefIdxBi[iRefList] = iRefIdxTemp; 4381 4382 uiCostBi = uiCostTemp; 4383 uiMotBits[iRefList] = uiBitsTemp - uiMbBits[2] - uiMotBits[1-iRefList]; 4384 uiBits[2] = uiBitsTemp; 4385 4386 if(iNumIter!=1) 4387 { 4388 // Set motion 4389 pcCU->getCUMvField( eRefPicList )->setAllMv( cMvBi[iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 4390 pcCU->getCUMvField( eRefPicList )->setAllRefIdx( iRefIdxBi[iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 4391 4392 TComYuv* pcYuvPred = &m_acYuvPred[iRefList]; 4393 motionCompensation( pcCU, pcYuvPred, eRefPicList, iPartIdx ); 4394 } 4395 } 4396 } // for loop-iRefIdxTemp 4397 4398 if ( !bChanged ) 4399 { 4400 if ( uiCostBi <= uiCost[0] && uiCostBi <= uiCost[1] ) 4401 { 4402 xCopyAMVPInfo(&aacAMVPInfo[0][iRefIdxBi[0]], pcCU->getCUMvField(REF_PIC_LIST_0)->getAMVPInfo()); 4403 xCheckBestMVP(pcCU, REF_PIC_LIST_0, cMvBi[0], cMvPredBi[0][iRefIdxBi[0]], aaiMvpIdxBi[0][iRefIdxBi[0]], uiBits[2], uiCostBi); 4404 if(!pcCU->getSlice()->getMvdL1ZeroFlag()) 4405 { 4406 xCopyAMVPInfo(&aacAMVPInfo[1][iRefIdxBi[1]], pcCU->getCUMvField(REF_PIC_LIST_1)->getAMVPInfo()); 4407 xCheckBestMVP(pcCU, REF_PIC_LIST_1, cMvBi[1], cMvPredBi[1][iRefIdxBi[1]], aaiMvpIdxBi[1][iRefIdxBi[1]], uiBits[2], uiCostBi); 4408 } 4409 } 4410 break; 4411 } 4412 } // for loop-iter 4413 } // if (B_SLICE) 4172 4414 #if ZERO_MVD_EST 4173 xEstimateMvPredAMVP( pcCU, pcOrgYuv, iPartIdx, eRefPicList, iRefIdxTemp, cMvPred[iRefList][iRefIdxTemp], false, &biPDistTemp, &uiZeroMvdDistTemp); 4174 #else 4175 xEstimateMvPredAMVP( pcCU, pcOrgYuv, iPartIdx, eRefPicList, iRefIdxTemp, cMvPred[iRefList][iRefIdxTemp], false, &biPDistTemp); 4176 #endif 4177 aaiMvpIdx[iRefList][iRefIdxTemp] = pcCU->getMVPIdx(eRefPicList, uiPartAddr); 4178 aaiMvpNum[iRefList][iRefIdxTemp] = pcCU->getMVPNum(eRefPicList, uiPartAddr); 4179 4180 if(pcCU->getSlice()->getMvdL1ZeroFlag() && iRefList==1 && biPDistTemp < bestBiPDist) 4415 if ( (pcCU->getSlice()->isInterB()) && (pcCU->isBipredRestriction(iPartIdx) == false) ) 4416 { 4417 m_pcRdCost->getMotionCost( 1, 0 ); 4418 4419 for ( Int iL0RefIdxTemp = 0; iL0RefIdxTemp <= pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_0)-1; iL0RefIdxTemp++ ) 4420 for ( Int iL1RefIdxTemp = 0; iL1RefIdxTemp <= pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_1)-1; iL1RefIdxTemp++ ) 4421 { 4422 UInt uiRefIdxBitsTemp = 0; 4423 if ( pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_0) > 1 ) 4424 { 4425 uiRefIdxBitsTemp += iL0RefIdxTemp+1; 4426 if ( iL0RefIdxTemp == pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_0)-1 ) uiRefIdxBitsTemp--; 4427 } 4428 if ( pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_1) > 1 ) 4429 { 4430 uiRefIdxBitsTemp += iL1RefIdxTemp+1; 4431 if ( iL1RefIdxTemp == pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_1)-1 ) uiRefIdxBitsTemp--; 4432 } 4433 4434 Int iL0MVPIdx = 0; 4435 Int iL1MVPIdx = 0; 4436 4437 for (iL0MVPIdx = 0; iL0MVPIdx < aaiMvpNum[0][iL0RefIdxTemp]; iL0MVPIdx++) 4438 { 4439 for (iL1MVPIdx = 0; iL1MVPIdx < aaiMvpNum[1][iL1RefIdxTemp]; iL1MVPIdx++) 4181 4440 { 4182 bestBiPDist = biPDistTemp; 4183 bestBiPMvpL1 = aaiMvpIdx[iRefList][iRefIdxTemp]; 4184 bestBiPRefIdxL1 = iRefIdxTemp; 4185 } 4186 4187 uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdx[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS]; 4188 #if ZERO_MVD_EST 4189 if ( iRefList == 0 || pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) < 0 ) 4190 { 4191 uiZeroMvdBitsTemp = uiBitsTemp; 4192 uiZeroMvdBitsTemp += 2; //zero mvd bits 4193 4194 m_pcRdCost->getMotionCost( 1, 0 ); 4195 uiZeroMvdCostTemp = uiZeroMvdDistTemp + m_pcRdCost->getCost(uiZeroMvdBitsTemp); 4196 4441 uiZeroMvdBitsTemp = uiRefIdxBitsTemp; 4442 uiZeroMvdBitsTemp += uiMbBits[2]; 4443 uiZeroMvdBitsTemp += m_auiMVPIdxCost[iL0MVPIdx][aaiMvpNum[0][iL0RefIdxTemp]] + m_auiMVPIdxCost[iL1MVPIdx][aaiMvpNum[1][iL1RefIdxTemp]]; 4444 uiZeroMvdBitsTemp += 4; //zero mvd for both directions 4445 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( aacAMVPInfo[0][iL0RefIdxTemp].m_acMvCand[iL0MVPIdx], iL0RefIdxTemp, ePartSize, uiPartAddr, iPartIdx, 0 ); 4446 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( aacAMVPInfo[1][iL1RefIdxTemp].m_acMvCand[iL1MVPIdx], iL1RefIdxTemp, ePartSize, uiPartAddr, iPartIdx, 0 ); 4447 4448 xGetInterPredictionError( pcCU, pcOrgYuv, iPartIdx, uiZeroMvdDistTemp, m_pcEncCfg->getUseHADME() ); 4449 uiZeroMvdCostTemp = uiZeroMvdDistTemp + m_pcRdCost->getCost( uiZeroMvdBitsTemp ); 4197 4450 if (uiZeroMvdCostTemp < uiZeroMvdCost) 4198 4451 { 4199 4452 uiZeroMvdCost = uiZeroMvdCostTemp; 4200 iZeroMvdDir = iRefList + 1; 4201 aiZeroMvdRefIdx[iRefList] = iRefIdxTemp; 4202 aiZeroMvdMvpIdx[iRefList] = aaiMvpIdx[iRefList][iRefIdxTemp]; 4203 auiZeroMvdBits[iRefList] = uiZeroMvdBitsTemp; 4204 } 4205 } 4206 #endif 4207 4208 #if GPB_SIMPLE_UNI 4209 if ( iRefList == 1 ) // list 1 4210 { 4211 if ( pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) >= 0 ) 4212 { 4213 cMvTemp[1][iRefIdxTemp] = cMvTemp[0][pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )]; 4214 uiCostTemp = uiCostTempL0[pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )]; 4215 /*first subtract the bit-rate part of the cost of the other list*/ 4216 uiCostTemp -= m_pcRdCost->getCost( uiBitsTempL0[pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )] ); 4217 /*correct the bit-rate part of the current ref*/ 4218 m_pcRdCost->setPredictor ( cMvPred[iRefList][iRefIdxTemp] ); 4219 uiBitsTemp += m_pcRdCost->getBits( cMvTemp[1][iRefIdxTemp].getHor(), cMvTemp[1][iRefIdxTemp].getVer() ); 4220 /*calculate the correct cost*/ 4221 uiCostTemp += m_pcRdCost->getCost( uiBitsTemp ); 4222 } 4223 else 4224 { 4225 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); 4453 iZeroMvdDir = 3; 4454 aiZeroMvdMvpIdx[0] = iL0MVPIdx; 4455 aiZeroMvdMvpIdx[1] = iL1MVPIdx; 4456 aiZeroMvdRefIdx[0] = iL0RefIdxTemp; 4457 aiZeroMvdRefIdx[1] = iL1RefIdxTemp; 4458 auiZeroMvdBits[2] = uiZeroMvdBitsTemp; 4226 4459 } 4227 4460 } 4228 else 4229 { 4230 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); 4231 } 4232 #else 4233 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); 4234 #endif 4235 xCopyAMVPInfo(pcCU->getCUMvField(eRefPicList)->getAMVPInfo(), &aacAMVPInfo[iRefList][iRefIdxTemp]); // must always be done ( also when AMVP_MODE = AM_NONE ) 4236 xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp); 4237 4238 if ( iRefList == 0 ) 4239 { 4240 uiCostTempL0[iRefIdxTemp] = uiCostTemp; 4241 uiBitsTempL0[iRefIdxTemp] = uiBitsTemp; 4242 } 4243 if ( uiCostTemp < uiCost[iRefList] ) 4244 { 4245 uiCost[iRefList] = uiCostTemp; 4246 uiBits[iRefList] = uiBitsTemp; // storing for bi-prediction 4247 4248 // set motion 4249 cMv[iRefList] = cMvTemp[iRefList][iRefIdxTemp]; 4250 iRefIdx[iRefList] = iRefIdxTemp; 4251 } 4252 4253 if ( iRefList == 1 && uiCostTemp < costValidList1 && pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) < 0 ) 4254 { 4255 costValidList1 = uiCostTemp; 4256 bitsValidList1 = uiBitsTemp; 4257 4258 // set motion 4259 mvValidList1 = cMvTemp[iRefList][iRefIdxTemp]; 4260 refIdxValidList1 = iRefIdxTemp; 4261 } 4262 } 4263 } 4264 // Bi-directional prediction 4265 if ( (pcCU->getSlice()->isInterB()) && (pcCU->isBipredRestriction(iPartIdx) == false) ) 4266 { 4267 4268 cMvBi[0] = cMv[0]; cMvBi[1] = cMv[1]; 4269 iRefIdxBi[0] = iRefIdx[0]; iRefIdxBi[1] = iRefIdx[1]; 4270 4271 ::memcpy(cMvPredBi, cMvPred, sizeof(cMvPred)); 4272 ::memcpy(aaiMvpIdxBi, aaiMvpIdx, sizeof(aaiMvpIdx)); 4273 4274 UInt uiMotBits[2]; 4275 4276 if(pcCU->getSlice()->getMvdL1ZeroFlag()) 4277 { 4278 xCopyAMVPInfo(&aacAMVPInfo[1][bestBiPRefIdxL1], pcCU->getCUMvField(REF_PIC_LIST_1)->getAMVPInfo()); 4279 pcCU->setMVPIdxSubParts( bestBiPMvpL1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4280 aaiMvpIdxBi[1][bestBiPRefIdxL1] = bestBiPMvpL1; 4281 cMvPredBi[1][bestBiPRefIdxL1] = pcCU->getCUMvField(REF_PIC_LIST_1)->getAMVPInfo()->m_acMvCand[bestBiPMvpL1]; 4282 4283 cMvBi[1] = cMvPredBi[1][bestBiPRefIdxL1]; 4284 iRefIdxBi[1] = bestBiPRefIdxL1; 4285 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMv( cMvBi[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4286 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllRefIdx( iRefIdxBi[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4287 TComYuv* pcYuvPred = &m_acYuvPred[1]; 4288 motionCompensation( pcCU, pcYuvPred, REF_PIC_LIST_1, iPartIdx ); 4289 4290 uiMotBits[0] = uiBits[0] - uiMbBits[0]; 4291 uiMotBits[1] = uiMbBits[1]; 4292 4293 if ( pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_1) > 1 ) 4294 { 4295 uiMotBits[1] += bestBiPRefIdxL1+1; 4296 if ( bestBiPRefIdxL1 == pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_1)-1 ) uiMotBits[1]--; 4297 } 4298 4299 uiMotBits[1] += m_auiMVPIdxCost[aaiMvpIdxBi[1][bestBiPRefIdxL1]][AMVP_MAX_NUM_CANDS]; 4300 4301 uiBits[2] = uiMbBits[2] + uiMotBits[0] + uiMotBits[1]; 4302 4303 cMvTemp[1][bestBiPRefIdxL1] = cMvBi[1]; 4304 } 4305 else 4306 { 4307 uiMotBits[0] = uiBits[0] - uiMbBits[0]; 4308 uiMotBits[1] = uiBits[1] - uiMbBits[1]; 4309 uiBits[2] = uiMbBits[2] + uiMotBits[0] + uiMotBits[1]; 4310 } 4311 4312 // 4-times iteration (default) 4313 Int iNumIter = 4; 4314 4315 // fast encoder setting: only one iteration 4316 if ( m_pcEncCfg->getUseFastEnc() || pcCU->getSlice()->getMvdL1ZeroFlag()) 4317 { 4318 iNumIter = 1; 4319 } 4320 4321 for ( Int iIter = 0; iIter < iNumIter; iIter++ ) 4322 { 4323 4324 Int iRefList = iIter % 2; 4325 if ( m_pcEncCfg->getUseFastEnc() ) 4326 { 4327 if( uiCost[0] <= uiCost[1] ) 4328 { 4329 iRefList = 1; 4330 } 4331 else 4332 { 4333 iRefList = 0; 4334 } 4335 } 4336 else if ( iIter == 0 ) 4337 { 4338 iRefList = 0; 4339 } 4340 if ( iIter == 0 && !pcCU->getSlice()->getMvdL1ZeroFlag()) 4341 { 4342 pcCU->getCUMvField(RefPicList(1-iRefList))->setAllMv( cMv[1-iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 4343 pcCU->getCUMvField(RefPicList(1-iRefList))->setAllRefIdx( iRefIdx[1-iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 4344 TComYuv* pcYuvPred = &m_acYuvPred[1-iRefList]; 4345 motionCompensation ( pcCU, pcYuvPred, RefPicList(1-iRefList), iPartIdx ); 4346 } 4347 RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); 4348 4349 if(pcCU->getSlice()->getMvdL1ZeroFlag()) 4350 { 4351 iRefList = 0; 4352 eRefPicList = REF_PIC_LIST_0; 4353 } 4354 4355 Bool bChanged = false; 4356 4357 iRefStart = 0; 4358 iRefEnd = pcCU->getSlice()->getNumRefIdx(eRefPicList)-1; 4359 4360 for ( Int iRefIdxTemp = iRefStart; iRefIdxTemp <= iRefEnd; iRefIdxTemp++ ) 4361 { 4362 uiBitsTemp = uiMbBits[2] + uiMotBits[1-iRefList]; 4363 if ( pcCU->getSlice()->getNumRefIdx(eRefPicList) > 1 ) 4364 { 4365 uiBitsTemp += iRefIdxTemp+1; 4366 if ( iRefIdxTemp == pcCU->getSlice()->getNumRefIdx(eRefPicList)-1 ) uiBitsTemp--; 4367 } 4368 uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdxBi[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS]; 4369 // call ME 4370 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPredBi[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp, true ); 4371 xCopyAMVPInfo(&aacAMVPInfo[iRefList][iRefIdxTemp], pcCU->getCUMvField(eRefPicList)->getAMVPInfo()); 4372 xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPredBi[iRefList][iRefIdxTemp], aaiMvpIdxBi[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp); 4373 4374 if ( uiCostTemp < uiCostBi ) 4375 { 4376 bChanged = true; 4377 4378 cMvBi[iRefList] = cMvTemp[iRefList][iRefIdxTemp]; 4379 iRefIdxBi[iRefList] = iRefIdxTemp; 4380 4381 uiCostBi = uiCostTemp; 4382 uiMotBits[iRefList] = uiBitsTemp - uiMbBits[2] - uiMotBits[1-iRefList]; 4383 uiBits[2] = uiBitsTemp; 4384 4385 if(iNumIter!=1) 4386 { 4387 // Set motion 4388 pcCU->getCUMvField( eRefPicList )->setAllMv( cMvBi[iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 4389 pcCU->getCUMvField( eRefPicList )->setAllRefIdx( iRefIdxBi[iRefList], ePartSize, uiPartAddr, 0, iPartIdx ); 4390 4391 TComYuv* pcYuvPred = &m_acYuvPred[iRefList]; 4392 motionCompensation( pcCU, pcYuvPred, eRefPicList, iPartIdx ); 4393 } 4394 } 4395 } // for loop-iRefIdxTemp 4396 4397 if ( !bChanged ) 4398 { 4399 if ( uiCostBi <= uiCost[0] && uiCostBi <= uiCost[1] ) 4400 { 4401 xCopyAMVPInfo(&aacAMVPInfo[0][iRefIdxBi[0]], pcCU->getCUMvField(REF_PIC_LIST_0)->getAMVPInfo()); 4402 xCheckBestMVP(pcCU, REF_PIC_LIST_0, cMvBi[0], cMvPredBi[0][iRefIdxBi[0]], aaiMvpIdxBi[0][iRefIdxBi[0]], uiBits[2], uiCostBi); 4403 if(!pcCU->getSlice()->getMvdL1ZeroFlag()) 4404 { 4405 xCopyAMVPInfo(&aacAMVPInfo[1][iRefIdxBi[1]], pcCU->getCUMvField(REF_PIC_LIST_1)->getAMVPInfo()); 4406 xCheckBestMVP(pcCU, REF_PIC_LIST_1, cMvBi[1], cMvPredBi[1][iRefIdxBi[1]], aaiMvpIdxBi[1][iRefIdxBi[1]], uiBits[2], uiCostBi); 4407 } 4408 } 4409 break; 4410 } 4411 } // for loop-iter 4412 } // if (B_SLICE) 4413 #if ZERO_MVD_EST 4414 if ( (pcCU->getSlice()->isInterB()) && (pcCU->isBipredRestriction(iPartIdx) == false) ) 4415 { 4416 m_pcRdCost->getMotionCost( 1, 0 ); 4417 4418 for ( Int iL0RefIdxTemp = 0; iL0RefIdxTemp <= pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_0)-1; iL0RefIdxTemp++ ) 4419 for ( Int iL1RefIdxTemp = 0; iL1RefIdxTemp <= pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_1)-1; iL1RefIdxTemp++ ) 4420 { 4421 UInt uiRefIdxBitsTemp = 0; 4422 if ( pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_0) > 1 ) 4423 { 4424 uiRefIdxBitsTemp += iL0RefIdxTemp+1; 4425 if ( iL0RefIdxTemp == pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_0)-1 ) uiRefIdxBitsTemp--; 4426 } 4427 if ( pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_1) > 1 ) 4428 { 4429 uiRefIdxBitsTemp += iL1RefIdxTemp+1; 4430 if ( iL1RefIdxTemp == pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_1)-1 ) uiRefIdxBitsTemp--; 4431 } 4432 4433 Int iL0MVPIdx = 0; 4434 Int iL1MVPIdx = 0; 4435 4436 for (iL0MVPIdx = 0; iL0MVPIdx < aaiMvpNum[0][iL0RefIdxTemp]; iL0MVPIdx++) 4437 { 4438 for (iL1MVPIdx = 0; iL1MVPIdx < aaiMvpNum[1][iL1RefIdxTemp]; iL1MVPIdx++) 4439 { 4440 uiZeroMvdBitsTemp = uiRefIdxBitsTemp; 4441 uiZeroMvdBitsTemp += uiMbBits[2]; 4442 uiZeroMvdBitsTemp += m_auiMVPIdxCost[iL0MVPIdx][aaiMvpNum[0][iL0RefIdxTemp]] + m_auiMVPIdxCost[iL1MVPIdx][aaiMvpNum[1][iL1RefIdxTemp]]; 4443 uiZeroMvdBitsTemp += 4; //zero mvd for both directions 4444 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( aacAMVPInfo[0][iL0RefIdxTemp].m_acMvCand[iL0MVPIdx], iL0RefIdxTemp, ePartSize, uiPartAddr, iPartIdx, 0 ); 4445 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( aacAMVPInfo[1][iL1RefIdxTemp].m_acMvCand[iL1MVPIdx], iL1RefIdxTemp, ePartSize, uiPartAddr, iPartIdx, 0 ); 4446 4447 xGetInterPredictionError( pcCU, pcOrgYuv, iPartIdx, uiZeroMvdDistTemp, m_pcEncCfg->getUseHADME() ); 4448 uiZeroMvdCostTemp = uiZeroMvdDistTemp + m_pcRdCost->getCost( uiZeroMvdBitsTemp ); 4449 if (uiZeroMvdCostTemp < uiZeroMvdCost) 4450 { 4451 uiZeroMvdCost = uiZeroMvdCostTemp; 4452 iZeroMvdDir = 3; 4453 aiZeroMvdMvpIdx[0] = iL0MVPIdx; 4454 aiZeroMvdMvpIdx[1] = iL1MVPIdx; 4455 aiZeroMvdRefIdx[0] = iL0RefIdxTemp; 4456 aiZeroMvdRefIdx[1] = iL1RefIdxTemp; 4457 auiZeroMvdBits[2] = uiZeroMvdBitsTemp; 4458 } 4459 } 4460 } 4461 } 4462 } 4461 } 4462 } 4463 } 4463 4464 #endif 4464 4465 … … 4476 4477 pcCU->setMVPIdxSubParts( -1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4477 4478 pcCU->setMVPNumSubParts( -1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4478 4479 4479 4480 UInt uiMEBits = 0; 4480 4481 // Set Motion Field_ … … 4488 4489 #endif 4489 4490 #if ZERO_MVD_EST 4490 if (uiZeroMvdCost <= uiCostBi && uiZeroMvdCost <= uiCost[0] && uiZeroMvdCost <= uiCost[1]) 4491 { 4492 if (iZeroMvdDir == 3) 4493 { 4494 uiLastMode = 2; 4495 4496 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( aacAMVPInfo[0][aiZeroMvdRefIdx[0]].m_acMvCand[aiZeroMvdMvpIdx[0]], aiZeroMvdRefIdx[0], ePartSize, uiPartAddr, iPartIdx, 0 ); 4497 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( aacAMVPInfo[1][aiZeroMvdRefIdx[1]].m_acMvCand[aiZeroMvdMvpIdx[1]], aiZeroMvdRefIdx[1], ePartSize, uiPartAddr, iPartIdx, 0 ); 4498 4499 pcCU->setInterDirSubParts( 3, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); 4500 4501 pcCU->setMVPIdxSubParts( aiZeroMvdMvpIdx[0], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4502 pcCU->setMVPNumSubParts( aaiMvpNum[0][aiZeroMvdRefIdx[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4503 pcCU->setMVPIdxSubParts( aiZeroMvdMvpIdx[1], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4504 pcCU->setMVPNumSubParts( aaiMvpNum[1][aiZeroMvdRefIdx[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4505 uiMEBits = auiZeroMvdBits[2]; 4506 } 4507 else if (iZeroMvdDir == 1) 4508 { 4509 uiLastMode = 0; 4510 4511 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( aacAMVPInfo[0][aiZeroMvdRefIdx[0]].m_acMvCand[aiZeroMvdMvpIdx[0]], aiZeroMvdRefIdx[0], ePartSize, uiPartAddr, iPartIdx, 0 ); 4512 4513 pcCU->setInterDirSubParts( 1, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); 4514 4515 pcCU->setMVPIdxSubParts( aiZeroMvdMvpIdx[0], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4516 pcCU->setMVPNumSubParts( aaiMvpNum[0][aiZeroMvdRefIdx[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4517 uiMEBits = auiZeroMvdBits[0]; 4518 } 4519 else if (iZeroMvdDir == 2) 4520 { 4521 uiLastMode = 1; 4522 4523 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( aacAMVPInfo[1][aiZeroMvdRefIdx[1]].m_acMvCand[aiZeroMvdMvpIdx[1]], aiZeroMvdRefIdx[1], ePartSize, uiPartAddr, iPartIdx, 0 ); 4524 4525 pcCU->setInterDirSubParts( 2, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); 4526 4527 pcCU->setMVPIdxSubParts( aiZeroMvdMvpIdx[1], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4528 pcCU->setMVPNumSubParts( aaiMvpNum[1][aiZeroMvdRefIdx[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4529 uiMEBits = auiZeroMvdBits[1]; 4530 } 4531 else 4532 { 4533 assert(0); 4534 } 4491 if (uiZeroMvdCost <= uiCostBi && uiZeroMvdCost <= uiCost[0] && uiZeroMvdCost <= uiCost[1]) 4492 { 4493 if (iZeroMvdDir == 3) 4494 { 4495 uiLastMode = 2; 4496 4497 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( aacAMVPInfo[0][aiZeroMvdRefIdx[0]].m_acMvCand[aiZeroMvdMvpIdx[0]], aiZeroMvdRefIdx[0], ePartSize, uiPartAddr, iPartIdx, 0 ); 4498 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( aacAMVPInfo[1][aiZeroMvdRefIdx[1]].m_acMvCand[aiZeroMvdMvpIdx[1]], aiZeroMvdRefIdx[1], ePartSize, uiPartAddr, iPartIdx, 0 ); 4499 4500 pcCU->setInterDirSubParts( 3, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); 4501 4502 pcCU->setMVPIdxSubParts( aiZeroMvdMvpIdx[0], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4503 pcCU->setMVPNumSubParts( aaiMvpNum[0][aiZeroMvdRefIdx[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4504 pcCU->setMVPIdxSubParts( aiZeroMvdMvpIdx[1], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4505 pcCU->setMVPNumSubParts( aaiMvpNum[1][aiZeroMvdRefIdx[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4506 uiMEBits = auiZeroMvdBits[2]; 4507 } 4508 else if (iZeroMvdDir == 1) 4509 { 4510 uiLastMode = 0; 4511 4512 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( aacAMVPInfo[0][aiZeroMvdRefIdx[0]].m_acMvCand[aiZeroMvdMvpIdx[0]], aiZeroMvdRefIdx[0], ePartSize, uiPartAddr, iPartIdx, 0 ); 4513 4514 pcCU->setInterDirSubParts( 1, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); 4515 4516 pcCU->setMVPIdxSubParts( aiZeroMvdMvpIdx[0], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4517 pcCU->setMVPNumSubParts( aaiMvpNum[0][aiZeroMvdRefIdx[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4518 uiMEBits = auiZeroMvdBits[0]; 4519 } 4520 else if (iZeroMvdDir == 2) 4521 { 4522 uiLastMode = 1; 4523 4524 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( aacAMVPInfo[1][aiZeroMvdRefIdx[1]].m_acMvCand[aiZeroMvdMvpIdx[1]], aiZeroMvdRefIdx[1], ePartSize, uiPartAddr, iPartIdx, 0 ); 4525 4526 pcCU->setInterDirSubParts( 2, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); 4527 4528 pcCU->setMVPIdxSubParts( aiZeroMvdMvpIdx[1], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4529 pcCU->setMVPNumSubParts( aaiMvpNum[1][aiZeroMvdRefIdx[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4530 uiMEBits = auiZeroMvdBits[1]; 4535 4531 } 4536 4532 else 4537 #endif 4538 if ( uiCostBi <= uiCost[0] && uiCostBi <= uiCost[1]) 4539 { 4540 uiLastMode = 2; 4541 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMv( cMvBi[0], ePartSize, uiPartAddr, 0, iPartIdx ); 4542 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllRefIdx( iRefIdxBi[0], ePartSize, uiPartAddr, 0, iPartIdx ); 4543 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMv( cMvBi[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4544 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllRefIdx( iRefIdxBi[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4545 4546 TempMv = cMvBi[0] - cMvPredBi[0][iRefIdxBi[0]]; 4547 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd ( TempMv, ePartSize, uiPartAddr, 0, iPartIdx ); 4548 4549 TempMv = cMvBi[1] - cMvPredBi[1][iRefIdxBi[1]]; 4550 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd ( TempMv, ePartSize, uiPartAddr, 0, iPartIdx ); 4551 4552 pcCU->setInterDirSubParts( 3, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); 4553 4554 pcCU->setMVPIdxSubParts( aaiMvpIdxBi[0][iRefIdxBi[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4555 pcCU->setMVPNumSubParts( aaiMvpNum[0][iRefIdxBi[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4556 pcCU->setMVPIdxSubParts( aaiMvpIdxBi[1][iRefIdxBi[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4557 pcCU->setMVPNumSubParts( aaiMvpNum[1][iRefIdxBi[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4558 4559 uiMEBits = uiBits[2]; 4560 } 4561 else if ( uiCost[0] <= uiCost[1] ) 4562 { 4563 uiLastMode = 0; 4533 { 4534 assert(0); 4535 } 4536 } 4537 else 4538 #endif 4539 if ( uiCostBi <= uiCost[0] && uiCostBi <= uiCost[1]) 4540 { 4541 uiLastMode = 2; 4542 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMv( cMvBi[0], ePartSize, uiPartAddr, 0, iPartIdx ); 4543 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllRefIdx( iRefIdxBi[0], ePartSize, uiPartAddr, 0, iPartIdx ); 4544 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMv( cMvBi[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4545 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllRefIdx( iRefIdxBi[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4546 4547 TempMv = cMvBi[0] - cMvPredBi[0][iRefIdxBi[0]]; 4548 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd ( TempMv, ePartSize, uiPartAddr, 0, iPartIdx ); 4549 4550 TempMv = cMvBi[1] - cMvPredBi[1][iRefIdxBi[1]]; 4551 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd ( TempMv, ePartSize, uiPartAddr, 0, iPartIdx ); 4552 4553 pcCU->setInterDirSubParts( 3, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); 4554 4555 pcCU->setMVPIdxSubParts( aaiMvpIdxBi[0][iRefIdxBi[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4556 pcCU->setMVPNumSubParts( aaiMvpNum[0][iRefIdxBi[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4557 pcCU->setMVPIdxSubParts( aaiMvpIdxBi[1][iRefIdxBi[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4558 pcCU->setMVPNumSubParts( aaiMvpNum[1][iRefIdxBi[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4559 4560 uiMEBits = uiBits[2]; 4561 } 4562 else if ( uiCost[0] <= uiCost[1] ) 4563 { 4564 uiLastMode = 0; 4564 4565 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMv( cMv[0], ePartSize, uiPartAddr, 0, iPartIdx ); 4565 4566 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllRefIdx( iRefIdx[0], ePartSize, uiPartAddr, 0, iPartIdx ); 4566 4567 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd ( TempMv, ePartSize, uiPartAddr, 0, iPartIdx );4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4567 TempMv = cMv[0] - cMvPred[0][iRefIdx[0]]; 4568 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd ( TempMv, ePartSize, uiPartAddr, 0, iPartIdx ); 4569 pcCU->setInterDirSubParts( 1, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); 4570 4571 pcCU->setMVPIdxSubParts( aaiMvpIdx[0][iRefIdx[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4572 pcCU->setMVPNumSubParts( aaiMvpNum[0][iRefIdx[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4573 4574 uiMEBits = uiBits[0]; 4575 } 4576 else 4577 { 4578 uiLastMode = 1; 4578 4579 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMv( cMv[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4579 4580 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllRefIdx( iRefIdx[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4580 4581 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd ( TempMv, ePartSize, uiPartAddr, 0, iPartIdx );4582 4583 4584 4585 4586 4587 4588 4581 TempMv = cMv[1] - cMvPred[1][iRefIdx[1]]; 4582 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd ( TempMv, ePartSize, uiPartAddr, 0, iPartIdx ); 4583 pcCU->setInterDirSubParts( 2, uiPartAddr, iPartIdx, pcCU->getDepth(0) ); 4584 4585 pcCU->setMVPIdxSubParts( aaiMvpIdx[1][iRefIdx[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4586 pcCU->setMVPNumSubParts( aaiMvpNum[1][iRefIdx[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4587 4588 uiMEBits = uiBits[1]; 4589 } 4589 4590 #if AMP_MRG 4590 4591 } // end if bTestNormalMC … … 4649 4650 xMergeEstimation( pcCU, pcOrgYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost, cMvFieldNeighbours, uhInterDirNeighbours 4650 4651 #if H_3D_VSP 4651 , vspFlag4652 , inheritedVSPDisInfo4652 , vspFlag 4653 , inheritedVSPDisInfo 4653 4654 #endif 4654 4655 #if H_3D_SPIVMP 4655 , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP4656 , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP 4656 4657 #endif 4657 , numValidMergeCand4658 );4658 , numValidMergeCand 4659 ); 4659 4660 if ( uiMRGCost < uiMECost ) 4660 4661 { … … 4669 4670 if( uiMRGIndex == pcCU->getUseDDDCandIdx() ) 4670 4671 { 4671 assert( vspFlag[uiMRGIndex] == 0 );4672 assert( bSPIVMPFlag[uiMRGIndex] == 0 );4673 pcCU->setUseDDD( true, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );4674 pcCU->setDDDepthSubParts( pcCU->getDDTmpDepth(), uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );4672 assert( vspFlag[uiMRGIndex] == 0 ); 4673 assert( bSPIVMPFlag[uiMRGIndex] == 0 ); 4674 pcCU->setUseDDD( true, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4675 pcCU->setDDDepthSubParts( pcCU->getDDTmpDepth(), uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4675 4676 } 4676 4677 else 4677 4678 { 4678 pcCU->setUseDDD( false, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );4679 pcCU->setUseDDD( false, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4679 4680 } 4680 4681 #endif … … 4704 4705 #if NTT_STORE_SPDV_VSP_G0148 4705 4706 #if H_3D_DBBP 4706 4707 if ( vspFlag[uiMRGIndex] && !pcCU->getDBBPFlag(uiPartAddr) ) 4707 4708 #else 4708 if ( vspFlag[uiMRGIndex] ) 4709 #endif 4709 if ( vspFlag[uiMRGIndex] ) 4710 #endif 4711 { 4712 UInt partAddrTemp; 4713 Int vspSize; 4714 Int width, height; 4715 pcCU->getPartIndexAndSize( iPartIdx, partAddrTemp, width, height ); // true or pcCU->getTotalNumPart()==256 4716 if( uiMRGInterDir & 0x01 ) 4710 4717 { 4711 UInt partAddrTemp; 4712 Int vspSize; 4713 Int width, height; 4714 pcCU->getPartIndexAndSize( iPartIdx, partAddrTemp, width, height ); // true or pcCU->getTotalNumPart()==256 4715 if( uiMRGInterDir & 0x01 ) 4716 { 4717 pcCU->setMvFieldPUForVSP( pcCU, partAddrTemp, width, height, REF_PIC_LIST_0, cMRGMvField[0].getRefIdx(), vspSize ); 4718 pcCU->setVSPFlag( partAddrTemp, vspSize ); 4719 } 4720 else 4721 { 4722 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMRGMvField[0], ePartSize, uiPartAddr, 0, iPartIdx ); 4723 } 4724 if( uiMRGInterDir & 0x02 ) 4725 { 4726 pcCU->setMvFieldPUForVSP( pcCU, partAddrTemp, width, height, REF_PIC_LIST_1, cMRGMvField[1].getRefIdx(), vspSize ); 4727 pcCU->setVSPFlag( partAddrTemp, vspSize ); 4728 } 4729 else 4730 { 4731 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMRGMvField[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4732 } 4733 pcCU->setInterDirSubParts ( uiMRGInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4718 pcCU->setMvFieldPUForVSP( pcCU, partAddrTemp, width, height, REF_PIC_LIST_0, cMRGMvField[0].getRefIdx(), vspSize ); 4719 pcCU->setVSPFlag( partAddrTemp, vspSize ); 4734 4720 } 4735 4721 else 4722 { 4723 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMRGMvField[0], ePartSize, uiPartAddr, 0, iPartIdx ); 4724 } 4725 if( uiMRGInterDir & 0x02 ) 4726 { 4727 pcCU->setMvFieldPUForVSP( pcCU, partAddrTemp, width, height, REF_PIC_LIST_1, cMRGMvField[1].getRefIdx(), vspSize ); 4728 pcCU->setVSPFlag( partAddrTemp, vspSize ); 4729 } 4730 else 4731 { 4732 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMRGMvField[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4733 } 4734 pcCU->setInterDirSubParts ( uiMRGInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4735 } 4736 else 4736 4737 #if H_3D_FIX_G0148_BRACE 4737 4738 { 4738 4739 #endif 4739 4740 #endif 4740 4741 pcCU->setInterDirSubParts ( uiMRGInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4741 4742 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMRGMvField[0], ePartSize, uiPartAddr, 0, iPartIdx ); 4742 4743 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMRGMvField[1], ePartSize, uiPartAddr, 0, iPartIdx ); … … 4744 4745 } 4745 4746 #endif 4746 4747 4748 4749 4750 4751 4752 4747 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd ( cMvZero, ePartSize, uiPartAddr, 0, iPartIdx ); 4748 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd ( cMvZero, ePartSize, uiPartAddr, 0, iPartIdx ); 4749 4750 pcCU->setMVPIdxSubParts( -1, REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4751 pcCU->setMVPNumSubParts( -1, REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4752 pcCU->setMVPIdxSubParts( -1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4753 pcCU->setMVPNumSubParts( -1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4753 4754 } 4754 4755 else … … 4767 4768 pcCU->setDvInfoSubParts(OriginalDvInfo, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4768 4769 #endif 4769 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMEMvField[0], ePartSize, uiPartAddr, 0, iPartIdx );4770 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMEMvField[1], ePartSize, uiPartAddr, 0, iPartIdx );4771 }4770 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMEMvField[0], ePartSize, uiPartAddr, 0, iPartIdx ); 4771 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMEMvField[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4772 } 4772 4773 #if H_3D_SPIVMP 4773 4774 delete[] pcMvFieldSP; … … 4778 4779 // MC 4779 4780 motionCompensation ( pcCU, rpcPredYuv, REF_PIC_LIST_X, iPartIdx ); 4780 4781 4781 4782 } // end of for ( Int iPartIdx = 0; iPartIdx < iNumPart; iPartIdx++ ) 4782 4783 … … 5803 5804 dCostBest = dCost; 5804 5805 qpBest = qp; 5805 m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[ pcCU->getDepth( 0 ) ][ CI_TEMP_BEST ] );5806 }5806 m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[ pcCU->getDepth( 0 ) ][ CI_TEMP_BEST ] ); 5807 } 5807 5808 #if H_3D_VSO // M21 5808 5809 if( m_pcRdCost->getUseRenModel() && !m_pcRdCost->getUseEstimatedVSD() ) -
branches/HTM-10.0-dev0/source/Lib/TLibEncoder/TEncTop.cpp
r852 r854 668 668 m_cSPS.setLayerId( getLayerId() ); 669 669 #endif 670 #if H_MV_HLS_7_VPS_P0048_14 671 // Code below needs to be moved to VPS 672 #endif 670 673 ProfileTierLevel& profileTierLevel = *m_cSPS.getPTL()->getGeneralPTL(); 671 674 profileTierLevel.setLevelIdc(m_level); … … 828 831 m_cPPS.setPPSId( getLayerIdInVps() ); 829 832 m_cPPS.setSPSId( getLayerIdInVps() ); 830 #endif 833 834 #if H_MV_HLS_7_GEN_P0166_PPS_EXTENSION 835 #if H_MV 836 m_cPPS.setPpsExtensionTypeFlag ( PPS_EX_T_MV ,true ); 837 #if H_3D 838 m_cPPS.setPpsExtensionTypeFlag ( PPS_EX_T_3D ,true ); 839 #endif 840 #endif 841 #endif 842 #endif 843 831 844 #if H_3D 832 845 m_cPPS.setDLT( getDLT() );
Note: See TracChangeset for help on using the changeset viewer.