Changeset 494 in SHVCSoftware for trunk/source/Lib/TLibEncoder
- Timestamp:
- 16 Nov 2013, 22:09:25 (11 years ago)
- Location:
- trunk
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/SHM-4.0-dev (added) merged: 444-493
- Property svn:mergeinfo changed
-
trunk/source
- Property svn:mergeinfo changed
/branches/SHM-4.0-dev/source (added) merged: 445-471,473-479,481-486,488-493
- Property svn:mergeinfo changed
-
trunk/source/Lib/TLibEncoder/TEncCavlc.cpp
r442 r494 359 359 { 360 360 WRITE_FLAG(pcVUI->getTilesFixedStructureFlag(), "tiles_fixed_structure_flag"); 361 #if M0464_TILE_BOUNDARY_ALIGNED_FLAG362 if ( pcSPS->getLayerId() > 0 )363 {364 WRITE_FLAG( pcVUI->getTileBoundariesAlignedFlag( ) ? 1 : 0 , "tile_boundaries_aligned_flag" );365 }366 #endif367 361 WRITE_FLAG(pcVUI->getMotionVectorsOverPicBoundariesFlag(), "motion_vectors_over_pic_boundaries_flag"); 368 362 WRITE_FLAG(pcVUI->getRestrictedRefPicListsFlag(), "restricted_ref_pic_lists_flag"); … … 454 448 #endif 455 449 WRITE_CODE( pcSPS->getVPSId (), 4, "sps_video_parameter_set_id" ); 456 #if S PS_SUB_LAYER_INFO450 #if SVC_EXTENSION 457 451 if(pcSPS->getLayerId() == 0) 458 452 { … … 460 454 WRITE_CODE( pcSPS->getMaxTLayers() - 1, 3, "sps_max_sub_layers_minus1" ); 461 455 WRITE_FLAG( pcSPS->getTemporalIdNestingFlag() ? 1 : 0, "sps_temporal_id_nesting_flag" ); 462 #if S PS_SUB_LAYER_INFO456 #if SVC_EXTENSION 463 457 } 464 458 #endif … … 670 664 WRITE_FLAG( 0, "inter_view_mv_vert_constraint_flag" ); 671 665 #endif 672 #if SCALED_REF_LAYER_OFFSETS673 666 if( pcSPS->getLayerId() > 0 ) 674 667 { … … 683 676 } 684 677 } 685 #endif686 678 #if M0463_VUI_EXT_ILP_REF 687 679 //// sps_extension_vui_parameters( ) … … 708 700 Void TEncCavlc::codeVPS( TComVPS* pcVPS ) 709 701 { 702 #if VPS_EXTN_OFFSET_CALC 703 UInt numBytesInVps = this->m_pcBitIf->getNumberOfWrittenBits(); 704 #endif 710 705 WRITE_CODE( pcVPS->getVPSId(), 4, "vps_video_parameter_set_id" ); 711 706 WRITE_CODE( 3, 2, "vps_reserved_three_2bits" ); … … 811 806 WRITE_FLAG(1, "vps_extension_alignment_bit_equal_to_one"); 812 807 } 808 #if VPS_EXTN_OFFSET_CALC 809 Int vpsExntOffsetValueInBits = this->m_pcBitIf->getNumberOfWrittenBits() - numBytesInVps + 16; // 2 bytes for NUH 810 assert( vpsExntOffsetValueInBits % 8 == 0 ); 811 pcVPS->setExtensionOffset( vpsExntOffsetValueInBits >> 3 ); 812 #endif 813 813 codeVPSExtension(pcVPS); 814 814 WRITE_FLAG( 0, "vps_extension2_flag" ); // Flag value of 1 reserved … … 820 820 } 821 821 822 #if SVC_EXTENSION 822 823 #if VPS_EXTNS 823 824 Void TEncCavlc::codeVPSExtension (TComVPS *vps) … … 835 836 } 836 837 837 #if VPS_SPLIT_FLAG838 838 for(j = 0; j < vps->getNumScalabilityTypes() - vps->getSplittingFlag(); j++) 839 #else840 for(j = 0; j < vps->getNumScalabilityTypes(); j++)841 #endif842 839 { 843 840 WRITE_CODE( vps->getDimensionIdLen(j) - 1, 3, "dimension_id_len_minus1[j]" ); … … 863 860 WRITE_CODE( vps->getLayerIdInNuh(i), 6, "layer_id_in_nuh[i]" ); 864 861 } 865 #if VPS_SPLIT_FLAG 866 if( !vps->getSplittingFlag())867 #endif 862 863 if( !vps->getSplittingFlag() ) 864 { 868 865 for(j = 0; j < vps->getNumScalabilityTypes(); j++) 869 866 { … … 871 868 WRITE_CODE( vps->getDimensionId(i, j), bits, "dimension_id[i][j]" ); 872 869 } 870 } 873 871 } 874 872 #endif … … 885 883 } 886 884 #endif 887 #if VPS_MOVE_DIR_DEPENDENCY_FLAG888 885 #if VPS_EXTN_DIRECT_REF_LAYERS 889 886 for( Int layerCtr = 1; layerCtr <= vps->getMaxLayers() - 1; layerCtr++) … … 894 891 } 895 892 } 896 #endif897 893 #endif 898 894 #if JCTVC_M0203_INTERLAYER_PRED_IDC … … 903 899 for( i = 0; i < vps->getMaxLayers() - 1; i++) 904 900 { 901 #if O0225_MAX_TID_FOR_REF_LAYERS 902 for( j = i+1; j <= vps->getMaxLayers() - 1; j++) 903 { 904 if(vps->getDirectDependencyFlag(j, i)) 905 { 906 WRITE_CODE(vps->getMaxTidIlRefPicsPlus1(i,j), 3, "max_tid_il_ref_pics_plus1[i][j]" ); 907 } 908 } 909 #else 905 910 WRITE_CODE(vps->getMaxTidIlRefPicsPlus1(i), 3, "max_tid_il_ref_pics_plus1[i]" ); 911 #endif 906 912 } 907 913 } … … 909 915 for( i = 0; i < vps->getMaxLayers() - 1; i++) 910 916 { 917 #if O0225_MAX_TID_FOR_REF_LAYERS 918 for( j = i+1; j <= vps->getMaxLayers() - 1; j++) 919 { 920 if(vps->getDirectDependencyFlag(j, i)) 921 { 922 WRITE_CODE(vps->getMaxTidIlRefPicsPlus1(i,j), 3, "max_tid_il_ref_pics_plus1[i][j]" ); 923 } 924 } 925 #else 911 926 WRITE_CODE(vps->getMaxTidIlRefPicsPlus1(i), 3, "max_tid_il_ref_pics_plus1[i]" ); 927 #endif 912 928 } 913 929 #endif … … 918 934 #if VPS_EXTN_PROFILE_INFO 919 935 // Profile-tier-level signalling 920 #if VPS_PROFILE_OUTPUT_LAYERS921 936 WRITE_CODE( vps->getNumLayerSets() - 1 , 10, "vps_number_layer_sets_minus1" ); 922 937 WRITE_CODE( vps->getNumProfileTierLevel() - 1, 6, "vps_num_profile_tier_level_minus1"); 923 938 for(Int idx = 1; idx <= vps->getNumProfileTierLevel() - 1; idx++) 924 #else925 for(Int idx = 1; idx <= vps->getNumLayerSets() - 1; idx++)926 #endif927 939 { 928 940 WRITE_FLAG( vps->getProfilePresentFlag(idx), "vps_profile_present_flag[i]" ); 929 941 if( !vps->getProfilePresentFlag(idx) ) 930 942 { 931 #if VPS_PROFILE_OUTPUT_LAYERS932 943 WRITE_CODE( vps->getProfileLayerSetRef(idx) - 1, 6, "profile_ref_minus1[i]" ); 933 #else934 WRITE_UVLC( vps->getProfileLayerSetRef(idx) - 1, "vps_profile_layer_set_ref_minus1[i]" );935 #endif936 944 } 937 945 codePTL( vps->getPTLForExtn(idx), vps->getProfilePresentFlag(idx), vps->getMaxTLayers() - 1 ); … … 939 947 #endif 940 948 941 #if VPS_PROFILE_OUTPUT_LAYERS942 949 Int numOutputLayerSets = vps->getNumOutputLayerSets() ; 943 950 WRITE_FLAG( (numOutputLayerSets > vps->getNumLayerSets()), "more_output_layer_sets_than_default_flag" ); … … 974 981 WRITE_CODE( vps->getProfileLevelTierIdx(i), numBits, "profile_level_tier_idx[i]" ); 975 982 } 976 #else977 #if VPS_EXTN_OP_LAYER_SETS978 // Target output layer signalling979 WRITE_UVLC( vps->getNumOutputLayerSets(), "vps_num_output_layer_sets");980 for(i = 0; i < vps->getNumOutputLayerSets(); i++)981 {982 #if VPS_OUTPUT_LAYER_SET_IDX983 assert(vps->getOutputLayerSetIdx(i) > 0);984 WRITE_UVLC( vps->getOutputLayerSetIdx(i) - 1, "vps_output_layer_set_idx_minus1[i]");985 #else986 WRITE_UVLC( vps->getOutputLayerSetIdx(i), "vps_output_layer_set_idx[i]");987 #endif988 Int lsIdx = vps->getOutputLayerSetIdx(i);989 for(j = 0; j <= vps->getMaxLayerId(); j++)990 {991 if(vps->getLayerIdIncludedFlag(lsIdx, j))992 {993 WRITE_FLAG( vps->getOutputLayerFlag(lsIdx, j), "vps_output_layer_flag[lsIdx][j]");994 }995 }996 }997 #endif998 #endif999 983 1000 984 #if REPN_FORMAT_IN_VPS … … 1025 1009 #if JCTVC_M0458_INTERLAYER_RPS_SIG 1026 1010 WRITE_FLAG(vps->getMaxOneActiveRefLayerFlag(), "max_one_active_ref_layer_flag"); 1011 #endif 1012 #if O0062_POC_LSB_NOT_PRESENT_FLAG 1013 for(i = 1; i< vps->getMaxLayers(); i++) 1014 { 1015 if( vps->getNumDirectRefLayers( vps->getLayerIdInNuh(i) ) == 0 ) 1016 { 1017 WRITE_FLAG(vps->getPocLsbNotPresentFlag(i), "poc_lsb_not_present_flag[i]"); 1018 } 1019 } 1020 #endif 1021 #if O0215_PHASE_ALIGNMENT 1022 WRITE_FLAG(vps->getPhaseAlignFlag(), "cross_layer_phase_alignment_flag" ); 1023 #endif 1024 #if N0147_IRAP_ALIGN_FLAG && !IRAP_ALIGN_FLAG_IN_VPS_VUI 1025 WRITE_FLAG(vps->getCrossLayerIrapAlignFlag(), "cross_layer_irap_aligned_flag"); 1027 1026 #endif 1028 #if N0147_IRAP_ALIGN_FLAG1029 WRITE_FLAG(vps->getCrossLayerIrapAlignFlag(), "cross_layer_irap_aligned_flag");1030 #endif1031 #if !VPS_MOVE_DIR_DEPENDENCY_FLAG1032 #if VPS_EXTN_DIRECT_REF_LAYERS1033 for( Int layerCtr = 1; layerCtr <= vps->getMaxLayers() - 1; layerCtr++)1034 {1035 for( Int refLayerCtr = 0; refLayerCtr < layerCtr; refLayerCtr++)1036 {1037 WRITE_FLAG(vps->getDirectDependencyFlag(layerCtr, refLayerCtr), "direct_dependency_flag[i][j]" );1038 }1039 }1040 #endif1041 #endif1042 1027 #if VPS_EXTN_DIRECT_REF_LAYERS && M0457_PREDICTION_INDICATIONS 1043 1028 WRITE_UVLC( vps->getDirectDepTypeLen()-2, "direct_dep_type_len_minus2"); … … 1107 1092 { 1108 1093 Int i,j; 1094 #if IRAP_ALIGN_FLAG_IN_VPS_VUI 1095 WRITE_FLAG(vps->getCrossLayerIrapAlignFlag(), "cross_layer_irap_aligned_flag"); 1096 #endif 1109 1097 #if VPS_VUI_BITRATE_PICRATE 1110 1098 WRITE_FLAG( vps->getBitRatePresentVpsFlag(), "bit_rate_present_vps_flag" ); … … 1173 1161 } 1174 1162 #endif 1163 #endif //SVC_EXTENSION 1175 1164 1176 1165 Void TEncCavlc::codeSliceHeader ( TComSlice* pcSlice ) … … 1218 1207 if ( !pcSlice->getDependentSliceSegmentFlag() ) 1219 1208 { 1220 1209 #if SVC_EXTENSION 1221 1210 #if POC_RESET_FLAG 1222 1211 Int iBits = 0; … … 1238 1227 } 1239 1228 #else 1240 #if SH_DISCARDABLE_FLAG1241 1229 if (pcSlice->getPPS()->getNumExtraSliceHeaderBits()>0) 1242 1230 { … … 1249 1237 WRITE_FLAG(0, "slice_reserved_undetermined_flag[]"); 1250 1238 } 1251 #else 1239 #endif 1240 #else //SVC_EXTENSION 1252 1241 for (Int i = 0; i < pcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++) 1253 1242 { … … 1255 1244 WRITE_FLAG(0, "slice_reserved_undetermined_flag[]"); 1256 1245 } 1257 #endif 1258 #endif 1246 #endif //SVC_EXTENSION 1259 1247 1260 1248 WRITE_UVLC( pcSlice->getSliceType(), "slice_type" ); … … 1265 1253 } 1266 1254 1255 #if !AUXILIARY_PICTURES 1267 1256 #if REPN_FORMAT_IN_VPS 1268 1257 // in the first version chroma_format_idc is equal to one, thus colour_plane_id will not be present … … 1272 1261 assert (pcSlice->getSPS()->getChromaFormatIdc() == 1 ); 1273 1262 #endif 1263 #endif 1274 1264 // if( separate_colour_plane_flag == 1 ) 1275 1265 // colour_plane_id u(2) 1276 1266 1277 1267 #if N0065_LAYER_POC_ALIGNMENT 1268 #if O0062_POC_LSB_NOT_PRESENT_FLAG 1269 if( (pcSlice->getLayerId() > 0 && !pcSlice->getVPS()->getPocLsbNotPresentFlag( pcSlice->getVPS()->getLayerIdInVps(pcSlice->getLayerId())) ) || !pcSlice->getIdrPicFlag()) 1270 #else 1278 1271 if( pcSlice->getLayerId() > 0 || !pcSlice->getIdrPicFlag() ) 1272 #endif 1279 1273 #else 1280 1274 if( !pcSlice->getIdrPicFlag() ) … … 1297 1291 1298 1292 #if N0065_LAYER_POC_ALIGNMENT 1293 #if SHM_FIX7 1294 } 1295 #endif 1299 1296 if( !pcSlice->getIdrPicFlag() ) 1300 1297 { … … 1414 1411 WRITE_FLAG( pcSlice->getEnableTMVPFlag() ? 1 : 0, "slice_temporal_mvp_enable_flag" ); 1415 1412 } 1416 #if N0065_LAYER_POC_ALIGNMENT 1413 #if N0065_LAYER_POC_ALIGNMENT && !SHM_FIX7 1417 1414 } 1418 1415 #endif … … 1421 1418 #if JCTVC_M0458_INTERLAYER_RPS_SIG 1422 1419 #if ILP_SSH_SIG 1420 #if ILP_SSH_SIG_FIX 1421 if((pcSlice->getSPS()->getLayerId() > 0) && !(pcSlice->getVPS()->getIlpSshSignalingEnabledFlag()) && (pcSlice->getNumILRRefIdx() > 0) ) 1422 #else 1423 1423 if((pcSlice->getSPS()->getLayerId() > 0) && pcSlice->getVPS()->getIlpSshSignalingEnabledFlag() && (pcSlice->getNumILRRefIdx() > 0) ) 1424 #endif 1424 1425 #else 1425 1426 if((pcSlice->getSPS()->getLayerId() > 0) && (pcSlice->getNumILRRefIdx() > 0) ) … … 1468 1469 WRITE_FLAG( pcSlice->getSaoEnabledFlag(), "slice_sao_luma_flag" ); 1469 1470 { 1471 #if AUXILIARY_PICTURES 1472 if (pcSlice->getChromaFormatIdc() != CHROMA_400) 1473 { 1474 #endif 1470 1475 SAOParam *saoParam = pcSlice->getPic()->getPicSym()->getSaoParam(); 1471 1476 WRITE_FLAG( saoParam->bSaoFlag[1], "slice_sao_chroma_flag" ); 1477 #if AUXILIARY_PICTURES 1478 } 1479 #endif 1472 1480 } 1473 1481 } … … 1934 1942 UInt uiMode = 0; 1935 1943 UInt uiTotalSignalledWeightFlags = 0; 1944 #if AUXILIARY_PICTURES 1945 if (pcSlice->getChromaFormatIdc() == CHROMA_400) 1946 { 1947 bChroma = false; 1948 } 1949 #endif 1936 1950 if ( (pcSlice->getSliceType()==P_SLICE && pcSlice->getPPS()->getUseWP()) || (pcSlice->getSliceType()==B_SLICE && pcSlice->getPPS()->getWPBiPred()) ) 1937 1951 { -
trunk/source/Lib/TLibEncoder/TEncCfg.h
r442 r494 69 69 Int m_numRefIdc; 70 70 Int m_refIdc[MAX_NUM_REF_PICS+1]; 71 #if EXTERNAL_USEDBYCURR_N008272 Int m_UseExtusedByCurrPic;73 Int m_ExtusedByCurrPic[MAX_NUM_REF_PICS];74 #endif75 71 GOPEntry() 76 72 : m_POC(-1) … … 87 83 , m_deltaRPS(0) 88 84 , m_numRefIdc(0) 89 #if EXTERNAL_USEDBYCURR_N008290 , m_UseExtusedByCurrPic(0)91 #endif92 85 { 93 86 ::memset( m_referencePics, 0, sizeof(m_referencePics) ); 94 87 ::memset( m_usedByCurrPic, 0, sizeof(m_usedByCurrPic) ); 95 88 ::memset( m_refIdc, 0, sizeof(m_refIdc) ); 96 #if EXTERNAL_USEDBYCURR_N008297 ::memset( m_usedByCurrPic, 0, sizeof(m_ExtusedByCurrPic) );98 #endif99 89 } 100 90 }; … … 221 211 Int m_chromaCbQpOffset; // Chroma Cb QP Offset (0:default) 222 212 Int m_chromaCrQpOffset; // Chroma Cr Qp Offset (0:default) 213 #if AUXILIARY_PICTURES 214 ChromaFormat m_chromaFormatIDC; 215 #endif 223 216 224 217 #if ADAPTIVE_QP_SELECTION … … 941 934 Int getAdaptiveResolutionChange() { return m_adaptiveResolutionChange; } 942 935 #endif 936 #if AUXILIARY_PICTURES 937 Void setChromaFormatIDC(ChromaFormat x) { m_chromaFormatIDC = x; } 938 ChromaFormat getChromaFormatIDC() { return m_chromaFormatIDC; } 939 #endif 943 940 #endif 944 941 }; -
trunk/source/Lib/TLibEncoder/TEncCu.cpp
r442 r494 250 250 #endif 251 251 252 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 253 m_disableILP = xCheckTileSetConstraint(rpcCU); 254 m_pcPredSearch->setDisableILP(m_disableILP); 255 #endif 256 252 257 // analysis of CU 253 258 xCompressCU( m_ppcBestCU[0], m_ppcTempCU[0], 0 ); … … 261 266 } 262 267 } 268 #endif 269 270 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 271 xVerifyTileSetConstraint(rpcCU); 263 272 #endif 264 273 } … … 731 740 } 732 741 #if (ENCODER_FAST_MODE) 742 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 743 if(pcPic->getLayerId() > 0 && !m_disableILP) 744 #else 733 745 if(pcPic->getLayerId() > 0) 746 #endif 734 747 { 735 748 for(Int refLayer = 0; refLayer < pcSlice->getActiveNumILRRefIdx(); refLayer++) … … 1381 1394 Bool bZeroMVILR = rpcTempCU->xCheckZeroMVILRMerge(uhInterDirNeighbours[uiMergeCand], cMvFieldNeighbours[0 + 2*uiMergeCand], cMvFieldNeighbours[1 + 2*uiMergeCand]); 1382 1395 if(bZeroMVILR) 1396 { 1397 #endif 1398 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 1399 if (!(rpcTempCU->isInterLayerReference(uhInterDirNeighbours[uiMergeCand], cMvFieldNeighbours[0 + 2*uiMergeCand], cMvFieldNeighbours[1 + 2*uiMergeCand]) && m_disableILP)) 1383 1400 { 1384 1401 #endif … … 1426 1443 } 1427 1444 } 1445 } 1446 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 1447 } 1448 #endif 1428 1449 #if REF_IDX_ME_ZEROMV 1429 } 1430 #endif 1431 } 1450 } 1451 #endif 1432 1452 } 1433 1453 … … 1808 1828 } 1809 1829 1830 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 1831 Bool TEncCu::xCheckTileSetConstraint( TComDataCU*& rpcCU ) 1832 { 1833 Bool disableILP = false; 1834 1835 if (rpcCU->getLayerId() == (m_pcEncCfg->getNumLayer() - 1) && m_pcEncCfg->getInterLayerConstrainedTileSetsSEIEnabled() && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(rpcCU->getAddr()) >= 0) 1836 { 1837 if (rpcCU->getPic()->getPicSym()->getTileSetType(rpcCU->getAddr()) == 2) 1838 { 1839 disableILP = true; 1840 } 1841 if (rpcCU->getPic()->getPicSym()->getTileSetType(rpcCU->getAddr()) == 1) 1842 { 1843 Int currCUaddr = rpcCU->getAddr(); 1844 Int frameWitdhInCU = rpcCU->getPic()->getPicSym()->getFrameWidthInCU(); 1845 Int frameHeightInCU = rpcCU->getPic()->getPicSym()->getFrameHeightInCU(); 1846 Bool leftCUExists = (currCUaddr % frameWitdhInCU) > 0; 1847 Bool aboveCUExists = (currCUaddr / frameWitdhInCU) > 0; 1848 Bool rightCUExists = (currCUaddr % frameWitdhInCU) < (frameWitdhInCU - 1); 1849 Bool belowCUExists = (currCUaddr / frameWitdhInCU) < (frameHeightInCU - 1); 1850 Int currTileSetIdx = rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr); 1851 // Check if CU is at tile set boundary 1852 if ( (leftCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr-1) != currTileSetIdx) || 1853 (leftCUExists && aboveCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr-frameWitdhInCU-1) != currTileSetIdx) || 1854 (aboveCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr-frameWitdhInCU) != currTileSetIdx) || 1855 (aboveCUExists && rightCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr-frameWitdhInCU+1) != currTileSetIdx) || 1856 (rightCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr+1) != currTileSetIdx) || 1857 (rightCUExists && belowCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr+frameWitdhInCU+1) != currTileSetIdx) || 1858 (belowCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr+frameWitdhInCU) != currTileSetIdx) || 1859 (belowCUExists && leftCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr+frameWitdhInCU-1) != currTileSetIdx) ) 1860 { 1861 disableILP = true; // Disable ILP in tile set boundary CU 1862 } 1863 } 1864 } 1865 1866 return disableILP; 1867 } 1868 1869 Void TEncCu::xVerifyTileSetConstraint( TComDataCU*& rpcCU ) 1870 { 1871 if (rpcCU->getLayerId() == (m_pcEncCfg->getNumLayer() - 1) && m_pcEncCfg->getInterLayerConstrainedTileSetsSEIEnabled() && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(rpcCU->getAddr()) >= 0 && 1872 m_disableILP) 1873 { 1874 UInt numPartitions = rpcCU->getPic()->getNumPartInCU(); 1875 for (UInt i = 0; i < numPartitions; i++) 1876 { 1877 if (!rpcCU->isIntra(i)) 1878 { 1879 for (UInt refList = 0; refList < 2; refList++) 1880 { 1881 if (rpcCU->getInterDir(i) & (1<<refList)) 1882 { 1883 TComCUMvField *mvField = rpcCU->getCUMvField(RefPicList(refList)); 1884 if (mvField->getRefIdx(i) >= 0) 1885 { 1886 assert(!(rpcCU->getSlice()->getRefPic(RefPicList(refList), mvField->getRefIdx(i))->isILR(rpcCU->getLayerId()))); 1887 } 1888 } 1889 } 1890 } 1891 } 1892 } 1893 } 1894 #endif 1895 1810 1896 /** Collect ARL statistics from one LCU 1811 1897 * \param pcCU -
trunk/source/Lib/TLibEncoder/TEncCu.h
r345 r494 108 108 Int m_temporalSAD; 109 109 #endif 110 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 111 Bool m_disableILP; 112 #endif 110 113 public: 111 114 /// copy parameters from encoder class … … 171 174 #endif 172 175 176 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 177 Bool xCheckTileSetConstraint( TComDataCU*& rpcCU ); 178 Void xVerifyTileSetConstraint( TComDataCU*& rpcCU ); 179 #endif 180 173 181 #if AMP_ENC_SPEEDUP 174 182 #if AMP_MRG -
trunk/source/Lib/TLibEncoder/TEncEntropy.cpp
r345 r494 280 280 const UInt uiTrDepthCurr = uiDepth - pcCU->getDepth( uiAbsPartIdx ); 281 281 const Bool bFirstCbfOfCU = uiTrDepthCurr == 0; 282 #if AUXILIARY_PICTURES 283 if (pcCU->getSlice()->getChromaFormatIdc() != CHROMA_400) 284 { 285 #endif 282 286 if( bFirstCbfOfCU || uiLog2TrafoSize > 2 ) 283 287 { … … 296 300 assert( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepthCurr ) == pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepthCurr - 1 ) ); 297 301 } 302 #if AUXILIARY_PICTURES 303 } 304 else 305 { 306 assert( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepthCurr ) == 0 ); 307 assert( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepthCurr ) == 0 ); 308 } 309 #endif 298 310 299 311 if( uiSubdiv ) … … 402 414 Void TEncEntropy::encodeIntraDirModeChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD ) 403 415 { 416 #if AUXILIARY_PICTURES 417 if ( pcCU->getSlice()->getChromaFormatIdc() == CHROMA_400 ) 418 { 419 return; 420 } 421 #endif 404 422 if( bRD ) 405 423 { -
trunk/source/Lib/TLibEncoder/TEncGOP.cpp
r442 r494 753 753 pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR)); 754 754 #if SVC_EXTENSION 755 #if ILR_RESTR && ILR_RESTR_FIX 755 if (m_layerId > 0) 756 { 756 757 Int interLayerPredLayerIdcTmp[MAX_VPS_LAYER_ID_PLUS1]; 757 758 Int activeNumILRRefIdxTmp = 0; 758 #endif 759 if (m_layerId > 0) 760 { 759 761 760 for( Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ ) 762 761 { … … 769 768 pcSlice->setBaseColPic( *cListPic, refLayerIdc ); 770 769 771 #if ILR_RESTR && ILR_RESTR_FIX772 770 // Apply temporal layer restriction to inter-layer prediction 771 #if O0225_MAX_TID_FOR_REF_LAYERS 772 Int maxTidIlRefPicsPlus1 = m_pcEncTop->getVPS()->getMaxTidIlRefPicsPlus1(pcSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getLayerId(),m_layerId); 773 #else 773 774 Int maxTidIlRefPicsPlus1 = m_pcEncTop->getVPS()->getMaxTidIlRefPicsPlus1(pcSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getLayerId()); 775 #endif 774 776 if( ((Int)(pcSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getTLayer())<=maxTidIlRefPicsPlus1-1) || (maxTidIlRefPicsPlus1==0 && pcSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getRapPicFlag()) ) 775 777 { … … 780 782 continue; // ILP is not valid due to temporal layer restriction 781 783 } 782 #endif 783 784 #if SCALED_REF_LAYER_OFFSETS 784 785 785 const Window &scalEL = m_pcEncTop->getScaledRefLayerWindow(refLayerIdc); 786 786 … … 790 790 Int widthEL = pcPic->getPicYuvRec()->getWidth() - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset(); 791 791 Int heightEL = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset() - scalEL.getWindowBottomOffset(); 792 #else 793 const Window &confBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getConformanceWindow(); 794 const Window &confEL = pcPic->getPicYuvRec()->getConformanceWindow(); 795 796 Int widthBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset(); 797 Int heightBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset(); 798 799 Int widthEL = pcPic->getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset(); 800 Int heightEL = pcPic->getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset(); 801 #endif 792 802 793 g_mvScalingFactor[refLayerIdc][0] = widthEL == widthBL ? 4096 : Clip3(-4096, 4095, ((widthEL << 8) + (widthBL >> 1)) / widthBL); 803 794 g_mvScalingFactor[refLayerIdc][1] = heightEL == heightBL ? 4096 : Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL); … … 809 800 if( pcPic->isSpatialEnhLayer(refLayerIdc)) 810 801 { 811 #if SCALED_REF_LAYER_OFFSETS 802 #if O0215_PHASE_ALIGNMENT 803 #if O0194_JOINT_US_BITSHIFT 804 m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc), pcSlice->getVPS()->getPhaseAlignFlag() ); 805 #else 806 m_pcPredSearch->upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc), pcSlice->getVPS()->getPhaseAlignFlag() ); 807 #endif 808 #else 809 #if O0194_JOINT_US_BITSHIFT 810 m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc) ); 811 #else 812 812 m_pcPredSearch->upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc) ); 813 #else 814 m_pcPredSearch->upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec() ); 813 #endif 815 814 #endif 816 815 } … … 823 822 } 824 823 825 #if ILR_RESTR && ILR_RESTR_FIX826 824 // Update the list of active inter-layer pictures 827 825 for ( Int i = 0; i < activeNumILRRefIdxTmp; i++) … … 835 833 pcSlice->setInterLayerPredEnabledFlag(false); 836 834 } 837 #endif838 835 839 836 if( pocCurr % m_pcCfg->getIntraPeriod() == 0 ) … … 1167 1164 if( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() ) 1168 1165 { 1169 m_pcEncTop->setILRPic(pcPic);1166 pcSlice->setILRPic( m_pcEncTop->getIlpList() ); 1170 1167 #if REF_IDX_MFM 1171 1168 #if M0457_COL_PICTURE_SIGNALING … … 1201 1198 UInt ColFromL0Flag = pcSlice->getColFromL0Flag(); 1202 1199 UInt ColRefIdx = pcSlice->getColRefIdx(); 1200 1203 1201 for(Int colIdx = 0; colIdx < pcSlice->getNumRefIdx( RefPicList(1 - ColFromL0Flag) ); colIdx++) 1204 1202 { 1205 if( pcSlice->getRefPic( RefPicList(1 - ColFromL0Flag), colIdx)->isILR(m_layerId) ) 1203 if( pcSlice->getRefPic( RefPicList(1 - ColFromL0Flag), colIdx)->isILR(m_layerId) 1204 #if MFM_ENCCONSTRAINT 1205 && pcSlice->getBaseColPic( *m_ppcTEncTop[pcSlice->getRefPic( RefPicList(1 - ColFromL0Flag), colIdx)->getLayerId()]->getListPic() )->checkSameRefInfo() == true 1206 #endif 1207 ) 1206 1208 { 1207 1209 ColRefIdx = colIdx; … … 1216 1218 for(Int colIdx = 0; colIdx < pcSlice->getNumRefIdx( RefPicList(1 - ColFromL0Flag) ); colIdx++) 1217 1219 { 1218 if( pcSlice->getRefPic( RefPicList(1 - ColFromL0Flag), colIdx)->isILR(m_layerId) ) 1220 if( pcSlice->getRefPic( RefPicList(1 - ColFromL0Flag), colIdx)->isILR(m_layerId) 1221 #if MFM_ENCCONSTRAINT 1222 && pcSlice->getBaseColPic( *m_ppcTEncTop[pcSlice->getRefPic( RefPicList(1 - ColFromL0Flag), colIdx)->getLayerId()]->getListPic() )->checkSameRefInfo() == true 1223 #endif 1224 ) 1219 1225 { 1220 1226 ColRefIdx = colIdx; … … 1567 1573 { 1568 1574 pcPic->getPicYuvOrg()->copyToPic( pcPic->getPicYuvRec() ); 1575 #if O0194_WEIGHTED_PREDICTION_CGS 1576 // Calculate for the base layer to be used in EL as Inter layer reference 1577 m_pcSliceEncoder->estimateILWpParam( pcSlice ); 1578 #endif 1569 1579 #if AVC_SYNTAX 1570 1580 pcPic->readBLSyntax( m_ppcTEncTop[0]->getBLSyntaxFile(), SYNTAX_BYTES ); … … 1607 1617 pcSlice->setSliceSegmentCurStartCUAddr ( startCUAddrSlice ); 1608 1618 pcSlice->setSliceBits(0); 1619 #if SVC_EXTENSION 1620 // copy reference list modification info from the first slice, assuming that this information is the same across all slices in the picture 1621 memcpy( pcSlice->getRefPicListModification(), pcPic->getSlice(0)->getRefPicListModification(), sizeof(TComRefPicListModification) ); 1622 #endif 1609 1623 uiNumSlices ++; 1610 1624 } … … 1689 1703 #else 1690 1704 OutputNALUnit nalu(NAL_UNIT_VPS); 1705 #endif 1706 #if VPS_EXTN_OFFSET_CALC 1707 OutputNALUnit tempNalu(NAL_UNIT_VPS, 0, 0 ); // The value of nuh_layer_id of VPS NAL unit shall be equal to 0. 1708 m_pcEntropyCoder->setBitstream(&tempNalu.m_Bitstream); 1709 m_pcEntropyCoder->encodeVPS(m_pcEncTop->getVPS()); // Use to calculate the VPS extension offset 1691 1710 #endif 1692 1711 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); … … 3162 3181 3163 3182 TComPicYuv* pcOrgInterlaced = new TComPicYuv; 3183 #if AUXILIARY_PICTURES 3184 pcOrgInterlaced->create( iWidth, iHeight << 1, pcPicOrgTop->getChromaFormat(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); 3185 #else 3164 3186 pcOrgInterlaced->create( iWidth, iHeight << 1, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); 3187 #endif 3165 3188 3166 3189 TComPicYuv* pcRecInterlaced = new TComPicYuv; 3190 #if AUXILIARY_PICTURES 3191 pcRecInterlaced->create( iWidth, iHeight << 1, pcPicOrgTop->getChromaFormat(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); 3192 #else 3167 3193 pcRecInterlaced->create( iWidth, iHeight << 1, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); 3194 #endif 3168 3195 3169 3196 Pel* pOrgInterlaced = pcOrgInterlaced->getLumaAddr(); -
trunk/source/Lib/TLibEncoder/TEncPic.cpp
r313 r494 126 126 * \return Void 127 127 */ 128 #if AUXILIARY_PICTURES 129 #if SVC_UPSAMPLING 130 Void TEncPic::create( Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth, 131 Window &conformanceWindow, Window &defaultDisplayWindow, Int *numReorderPics, TComSPS* pcSps, Bool bIsVirtual ) 132 133 #else 134 135 Void TEncPic::create( Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth, 136 Window &conformanceWindow, Window &defaultDisplayWindow, Int *numReorderPics, Bool bIsVirtual ) 137 #endif 138 { 139 #if SVC_UPSAMPLING 140 TComPic::create( iWidth, iHeight, chromaFormat, uiMaxWidth, uiMaxHeight, uiMaxDepth, 141 conformanceWindow, defaultDisplayWindow, numReorderPics, pcSps, bIsVirtual ); 142 #else 143 TComPic::create( iWidth, iHeight, chromaFormat, uiMaxWidth, uiMaxHeight, uiMaxDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, bIsVirtual ); 144 #endif 145 m_uiMaxAQDepth = uiMaxAQDepth; 146 if ( uiMaxAQDepth > 0 ) 147 { 148 m_acAQLayer = new TEncPicQPAdaptationLayer[ m_uiMaxAQDepth ]; 149 for (UInt d = 0; d < m_uiMaxAQDepth; d++) 150 { 151 m_acAQLayer[d].create( iWidth, iHeight, uiMaxWidth>>d, uiMaxHeight>>d ); 152 } 153 } 154 } 155 #else 128 156 #if SVC_UPSAMPLING 129 157 Void TEncPic::create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth, … … 152 180 } 153 181 } 182 #endif 154 183 155 184 /** Clean up -
trunk/source/Lib/TLibEncoder/TEncPic.h
r313 r494 105 105 virtual ~TEncPic(); 106 106 107 #if AUXILIARY_PICTURES 108 #if SVC_UPSAMPLING 109 Void create( Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth, 110 Window &conformanceWindow, Window &defaultDisplayWindow, Int *numReorderPics, TComSPS* pcSps, Bool bIsVirtual=false ); 111 #else 112 Void create( Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth, 113 Window &conformanceWindow, Window &defaultDisplayWindow, Int *numReorderPics, Bool bIsVirtual = false ); 114 115 #endif 116 #else 107 117 #if SVC_UPSAMPLING 108 118 Void create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth, … … 111 121 Void create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth, 112 122 Window &conformanceWindow, Window &defaultDisplayWindow, Int *numReorderPics, Bool bIsVirtual = false ); 123 #endif 113 124 #endif 114 125 virtual Void destroy(); -
trunk/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp
r313 r494 1871 1871 1872 1872 saoParam->bSaoFlag[0] = true; 1873 #if AUXILIARY_PICTURES 1874 saoParam->bSaoFlag[1] = m_pcPic->getChromaFormat() == CHROMA_400 ? false : true; 1875 #else 1873 1876 saoParam->bSaoFlag[1] = true; 1877 #endif 1874 1878 saoParam->oneUnitFlag[0] = false; 1875 1879 saoParam->oneUnitFlag[1] = false; -
trunk/source/Lib/TLibEncoder/TEncSbac.cpp
r442 r494 914 914 } 915 915 916 #if AUXILIARY_PICTURES 917 if (pcCU->getSlice()->getChromaFormatIdc() != CHROMA_400) 918 { 919 #endif 916 920 piPCMSample = pcCU->getPCMSampleCb() + uiChromaOffset; 917 921 uiWidth = pcCU->getWidth(uiAbsPartIdx)/2; … … 945 949 piPCMSample += uiWidth; 946 950 } 951 #if AUXILIARY_PICTURES 952 } 953 #endif 947 954 m_pcBinIf->resetBac(); 948 955 } -
trunk/source/Lib/TLibEncoder/TEncSearch.cpp
r442 r494 3092 3092 { 3093 3093 #endif 3094 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 3095 if (!(pcCU->isInterLayerReference(uhInterDirNeighbours[uiMergeCand], cMvFieldNeighbours[0 + 2*uiMergeCand], cMvFieldNeighbours[1 + 2*uiMergeCand]) && m_disableILP)) 3096 { 3097 #endif 3094 3098 UInt uiCostCand = MAX_UINT; 3095 3099 UInt uiBitsCand = 0; … … 3115 3119 uiMergeIndex = uiMergeCand; 3116 3120 } 3121 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 3122 } 3123 #endif 3117 3124 #if REF_IDX_ME_ZEROMV 3118 3125 } … … 3221 3228 Int numValidMergeCand = 0 ; 3222 3229 3223 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI3224 Bool disableILP = false;3225 if (pcCU->getPic()->getLayerId() == (m_pcEncCfg->getNumLayer() - 1) && m_pcEncCfg->getInterLayerConstrainedTileSetsSEIEnabled() && pcCU->getPic()->getPicSym()->getTileSetIdxMap(pcCU->getAddr()) >= 0)3226 {3227 if (pcCU->getPic()->getPicSym()->getTileSetType(pcCU->getAddr()) == 2)3228 {3229 disableILP = true;3230 }3231 if (pcCU->getPic()->getPicSym()->getTileSetType(pcCU->getAddr()) == 1)3232 {3233 Int currCUaddr = pcCU->getAddr();3234 Int frameWitdhInCU = pcCU->getPic()->getPicSym()->getFrameWidthInCU();3235 Int frameHeightInCU = pcCU->getPic()->getPicSym()->getFrameHeightInCU();3236 Bool leftCUExists = (currCUaddr % frameWitdhInCU) > 0;3237 Bool aboveCUExists = (currCUaddr / frameWitdhInCU) > 0;3238 Bool rightCUExists = (currCUaddr % frameWitdhInCU) < (frameWitdhInCU - 1);3239 Bool belowCUExists = (currCUaddr / frameWitdhInCU) < (frameHeightInCU - 1);3240 Int currTileSetIdx = pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr);3241 // Check if CU is at tile set boundary3242 if ( (leftCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr-1) != currTileSetIdx) ||3243 (leftCUExists && aboveCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr-frameWitdhInCU-1) != currTileSetIdx) ||3244 (aboveCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr-frameWitdhInCU) != currTileSetIdx) ||3245 (aboveCUExists && rightCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr-frameWitdhInCU+1) != currTileSetIdx) ||3246 (rightCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr+1) != currTileSetIdx) ||3247 (rightCUExists && belowCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr+frameWitdhInCU+1) != currTileSetIdx) ||3248 (belowCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr+frameWitdhInCU) != currTileSetIdx) ||3249 (belowCUExists && leftCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr+frameWitdhInCU-1) != currTileSetIdx) )3250 {3251 disableILP = true; // Disable ILP in tile set boundary CU3252 }3253 }3254 }3255 #endif3256 3257 3230 for ( Int iPartIdx = 0; iPartIdx < iNumPart; iPartIdx++ ) 3258 3231 { … … 3305 3278 { 3306 3279 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 3307 if (pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxTemp )->isILR(pcCU->getLayerId()) && disableILP)3280 if (pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxTemp )->isILR(pcCU->getLayerId()) && m_disableILP) 3308 3281 { 3309 3282 continue; … … 3529 3502 } 3530 3503 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 3531 if (pcPic->isILR(pcCU->getLayerId()) && disableILP)3504 if (pcPic->isILR(pcCU->getLayerId()) && m_disableILP) 3532 3505 { 3533 3506 testIter = false; … … 3550 3523 } 3551 3524 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 3552 if (pcPic->isILR(pcCU->getLayerId()) && disableILP)3525 if (pcPic->isILR(pcCU->getLayerId()) && m_disableILP) 3553 3526 { 3554 3527 testRefIdx = false; … … 4119 4092 4120 4093 // prediction pattern 4094 #if O0194_WEIGHTED_PREDICTION_CGS 4095 // Bug Fix (It did not check WP for BSlices) 4096 if ( pcCU->getSlice()->getPPS()->getUseWP()) 4097 #else 4121 4098 if ( pcCU->getSlice()->getPPS()->getUseWP() && pcCU->getSlice()->getSliceType()==P_SLICE ) 4099 #endif 4122 4100 { 4123 4101 xPredInterLumaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, true ); … … 4128 4106 } 4129 4107 4108 #if O0194_WEIGHTED_PREDICTION_CGS 4109 if ( pcCU->getSlice()->getPPS()->getUseWP()) 4110 ///< Bug Fix (It did not check WP for BSlices) 4111 #else 4130 4112 if ( pcCU->getSlice()->getPPS()->getUseWP() && pcCU->getSlice()->getSliceType()==P_SLICE ) 4113 #endif 4131 4114 { 4132 4115 xWeightedPredictionUni( pcCU, pcTemplateCand, uiPartAddr, iSizeX, iSizeY, eRefPicList, pcTemplateCand, iRefIdx ); -
trunk/source/Lib/TLibEncoder/TEncSearch.h
r345 r494 129 129 // UInt m_auiMVPIdxCost[AMVP_MAX_NUM_CANDS+1][AMVP_MAX_NUM_CANDS]; 130 130 UInt m_auiMVPIdxCost[AMVP_MAX_NUM_CANDS+1][AMVP_MAX_NUM_CANDS+1]; //th array bounds 131 131 132 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 133 Bool m_disableILP; 134 #endif 135 132 136 public: 133 137 TEncSearch(); … … 220 224 Void xEncPCM (TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piOrg, Pel* piPCM, Pel* piPred, Pel* piResi, Pel* piReco, UInt uiStride, UInt uiWidth, UInt uiHeight, TextType eText); 221 225 Void IPCMSearch (TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv ); 226 227 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 228 Void setDisableILP(Bool a) {m_disableILP = a;} 229 #endif 230 222 231 protected: 223 232 -
trunk/source/Lib/TLibEncoder/TEncSlice.cpp
r442 r494 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 6 * Copyright (c) 2010-2013, ITU/ISO/IEC … … 51 51 m_apcPicYuvPred = NULL; 52 52 m_apcPicYuvResi = NULL; 53 53 54 54 m_pdRdPicLambda = NULL; 55 55 m_pdRdPicQp = NULL; … … 69 69 } 70 70 71 Void TEncSlice::initCtxMem( UInt i ) 72 { 71 Void TEncSlice::initCtxMem( UInt i ) 72 { 73 73 for (std::vector<TEncSbac*>::iterator j = CTXMem.begin(); j != CTXMem.end(); j++) 74 74 { 75 75 delete (*j); 76 76 } 77 CTXMem.clear(); 78 CTXMem.resize(i); 77 CTXMem.clear(); 78 CTXMem.resize(i); 79 79 } 80 80 81 #if AUXILIARY_PICTURES 82 Void TEncSlice::create( Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt iMaxCUWidth, UInt iMaxCUHeight, UChar uhTotalDepth ) 83 { 84 // create prediction picture 85 if ( m_apcPicYuvPred == NULL ) 86 { 87 m_apcPicYuvPred = new TComPicYuv; 88 m_apcPicYuvPred->create( iWidth, iHeight, chromaFormat, iMaxCUWidth, iMaxCUHeight, uhTotalDepth ); 89 } 90 91 // create residual picture 92 if( m_apcPicYuvResi == NULL ) 93 { 94 m_apcPicYuvResi = new TComPicYuv; 95 m_apcPicYuvResi->create( iWidth, iHeight, chromaFormat, iMaxCUWidth, iMaxCUHeight, uhTotalDepth ); 96 } 97 } 98 #else 81 99 Void TEncSlice::create( Int iWidth, Int iHeight, UInt iMaxCUWidth, UInt iMaxCUHeight, UChar uhTotalDepth ) 82 100 { … … 87 105 m_apcPicYuvPred->create( iWidth, iHeight, iMaxCUWidth, iMaxCUHeight, uhTotalDepth ); 88 106 } 89 107 90 108 // create residual picture 91 109 if( m_apcPicYuvResi == NULL ) … … 95 113 } 96 114 } 115 #endif 97 116 98 117 Void TEncSlice::destroy() … … 105 124 m_apcPicYuvPred = NULL; 106 125 } 107 126 108 127 // destroy residual picture 109 128 if ( m_apcPicYuvResi ) … … 113 132 m_apcPicYuvResi = NULL; 114 133 } 115 134 116 135 // free lambda and QP arrays 117 136 if ( m_pdRdPicLambda ) { xFree( m_pdRdPicLambda ); m_pdRdPicLambda = NULL; } … … 139 158 #if SVC_EXTENSION 140 159 m_ppcTEncTop = pcEncTop->getLayerEnc(); 141 #endif 160 #endif 142 161 m_pcGOPEncoder = pcEncTop->getGOPEncoder(); 143 162 m_pcCuEncoder = pcEncTop->getCuEncoder(); 144 163 m_pcPredSearch = pcEncTop->getPredSearch(); 145 164 146 165 m_pcEntropyCoder = pcEncTop->getEntropyCoder(); 147 166 m_pcCavlcCoder = pcEncTop->getCavlcCoder(); … … 149 168 m_pcBinCABAC = pcEncTop->getBinCABAC(); 150 169 m_pcTrQuant = pcEncTop->getTrQuant(); 151 170 152 171 m_pcBitCounter = pcEncTop->getBitCounter(); 153 172 m_pcRdCost = pcEncTop->getRdCost(); 154 173 m_pppcRDSbacCoder = pcEncTop->getRDSbacCoder(); 155 174 m_pcRDGoOnSbacCoder = pcEncTop->getRDGoOnSbacCoder(); 156 175 157 176 // create lambda and QP arrays 158 177 m_pdRdPicLambda = (Double*)xMalloc( Double, m_pcCfg->getDeltaQpRD() * 2 + 1 ); … … 187 206 Double dQP; 188 207 Double dLambda; 189 208 190 209 rpcSlice = pcPic->getSlice(0); 191 210 rpcSlice->setSPS( pSPS ); … … 202 221 rpcSlice->setPicOutputFlag( true ); 203 222 rpcSlice->setPOC( pocCurr ); 204 223 205 224 // depth computation based on GOP size 206 225 Int depth; … … 230 249 } 231 250 } 232 251 233 252 // slice type 234 253 SliceType eSliceType; 235 254 236 255 eSliceType=B_SLICE; 237 256 eSliceType = (pocLast == 0 || pocCurr % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType; 238 257 239 258 rpcSlice->setSliceType ( eSliceType ); 240 259 241 260 // ------------------------------------------------------------------------------------------------------------------ 242 261 // Non-referenced frame marking 243 262 // ------------------------------------------------------------------------------------------------------------------ 244 263 245 264 if(pocLast == 0) 246 265 { … … 252 271 } 253 272 rpcSlice->setReferenced(true); 254 273 255 274 // ------------------------------------------------------------------------------------------------------------------ 256 275 // QP setting 257 276 // ------------------------------------------------------------------------------------------------------------------ 258 277 259 278 dQP = m_pcCfg->getQP(); 260 279 if(eSliceType!=I_SLICE) 261 280 { 262 281 #if REPN_FORMAT_IN_VPS 263 if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless()))) 264 #else 265 if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getSPS()->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless()))) 282 if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless()))) 283 #else 284 if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getSPS()->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless()))) 266 285 #endif 267 286 { … … 269 288 } 270 289 } 271 290 272 291 // modify QP 273 292 Int* pdQPs = m_pcCfg->getdQPs(); … … 285 304 // Lambda computation 286 305 // ------------------------------------------------------------------------------------------------------------------ 287 306 288 307 Int iQP; 289 308 Double dOrigQP = dQP; … … 294 313 // compute QP value 295 314 dQP = dOrigQP + ((iDQpIdx+1)>>1)*(iDQpIdx%2 ? -1 : 1); 296 315 297 316 // compute lambda value 298 317 Int NumberBFrames = ( m_pcCfg->getGOPSize() - 1 ); … … 326 345 #endif 327 346 } 328 347 329 348 // if hadamard is used in ME process 330 349 if ( !m_pcCfg->getUseHADME() && rpcSlice->getSliceType( ) != I_SLICE ) … … 332 351 dLambda *= 0.95; 333 352 } 334 353 335 354 #if REPN_FORMAT_IN_VPS 336 355 iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) ); … … 343 362 m_piRdPicQp [iDQpIdx] = iQP; 344 363 } 345 364 346 365 // obtain dQP = 0 case 347 366 dLambda = m_pdRdPicLambda[0]; 348 367 dQP = m_pdRdPicQp [0]; 349 368 iQP = m_piRdPicQp [0]; 350 369 351 370 if( rpcSlice->getSliceType( ) != I_SLICE ) 352 371 { … … 359 378 Int nCurLayer = rpcSlice->getLayerId(); 360 379 Double gamma = xCalEnhLambdaFactor( m_ppcTEncTop[nCurLayer-1]->getQP() - m_ppcTEncTop[nCurLayer]->getQP() , 361 1.0 * m_ppcTEncTop[nCurLayer]->getSourceWidth() * m_ppcTEncTop[nCurLayer]->getSourceHeight() 380 1.0 * m_ppcTEncTop[nCurLayer]->getSourceWidth() * m_ppcTEncTop[nCurLayer]->getSourceHeight() 362 381 / m_ppcTEncTop[nCurLayer-1]->getSourceWidth() / m_ppcTEncTop[nCurLayer-1]->getSourceHeight() ); 363 382 dLambda *= gamma; … … 392 411 #endif 393 412 394 #if RDOQ_CHROMA_LAMBDA 413 #if RDOQ_CHROMA_LAMBDA 395 414 // for RDOQ 396 m_pcTrQuant->setLambda( dLambda, dLambda / weight ); 415 m_pcTrQuant->setLambda( dLambda, dLambda / weight ); 397 416 #else 398 417 m_pcTrQuant->setLambda( dLambda ); … … 401 420 #if SAO_CHROMA_LAMBDA 402 421 // For SAO 403 rpcSlice ->setLambda( dLambda, dLambda / weight ); 422 rpcSlice ->setLambda( dLambda, dLambda / weight ); 404 423 #else 405 424 rpcSlice ->setLambda( dLambda ); 406 425 #endif 407 426 408 427 #if HB_LAMBDA_FOR_LDC 409 428 // restore original slice type 410 429 eSliceType = (pocLast == 0 || pocCurr % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType; 411 430 412 431 #if SVC_EXTENSION 413 432 if(m_pcCfg->getLayerId() > 0) … … 418 437 rpcSlice->setSliceType ( eSliceType ); 419 438 #endif 420 439 421 440 if (m_pcCfg->getUseRecalculateQPAccordingToLambda()) 422 441 { 423 442 dQP = xGetQPValueAccordingToLambda( dLambda ); 424 443 #if REPN_FORMAT_IN_VPS 425 iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) ); 426 #else 427 iQP = max( -pSPS->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) ); 444 iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) ); 445 #else 446 iQP = max( -pSPS->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) ); 428 447 #endif 429 448 } … … 438 457 rpcSlice->setNumRefIdx(REF_PIC_LIST_0,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive); 439 458 rpcSlice->setNumRefIdx(REF_PIC_LIST_1,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive); 440 459 441 460 if ( m_pcCfg->getDeblockingFilterMetric() ) 442 461 { … … 479 498 480 499 rpcSlice->setDepth ( depth ); 481 500 482 501 pcPic->setTLayer( m_pcCfg->getGOPEntry(iGOPid).m_temporalId ); 483 #if TEMP_SCALABILITY_FIX 484 if((eSliceType==I_SLICE) || (rpcSlice->getPOC() == 0)) 485 #else 502 486 503 if(eSliceType==I_SLICE) 487 #endif488 504 { 489 505 pcPic->setTLayer(0); … … 493 509 assert( m_apcPicYuvPred ); 494 510 assert( m_apcPicYuvResi ); 495 511 496 512 pcPic->setPicYuvPred( m_apcPicYuvPred ); 497 513 pcPic->setPicYuvResi( m_apcPicYuvResi ); … … 557 573 #endif 558 574 559 #if RDOQ_CHROMA_LAMBDA 575 #if RDOQ_CHROMA_LAMBDA 560 576 // for RDOQ 561 577 m_pcTrQuant->setLambda( lambda, lambda / weight ); … … 665 681 #endif 666 682 667 #if RDOQ_CHROMA_LAMBDA 683 #if RDOQ_CHROMA_LAMBDA 668 684 // for RDOQ 669 m_pcTrQuant->setLambda( lambda, lambda / weight ); 685 m_pcTrQuant->setLambda( lambda, lambda / weight ); 670 686 #else 671 687 m_pcTrQuant->setLambda( lambda ); … … 674 690 #if SAO_CHROMA_LAMBDA 675 691 // For SAO 676 pcSlice ->setLambda( lambda, lambda / weight ); 692 pcSlice ->setLambda( lambda, lambda / weight ); 677 693 #else 678 694 pcSlice ->setLambda( lambda ); … … 692 708 Int iMaxSR = m_pcCfg->getSearchRange(); 693 709 Int iNumPredDir = pcSlice->isInterP() ? 1 : 2; 694 710 695 711 for (Int iDir = 0; iDir <= iNumPredDir; iDir++) 696 712 { … … 726 742 } 727 743 #endif 728 744 729 745 TComSlice* pcSlice = rpcPic->getSlice(getSliceIdx()); 730 746 Double dPicRdCostBest = MAX_DOUBLE; 731 747 UInt uiQpIdxBest = 0; 732 748 733 749 Double dFrameLambda; 734 750 #if FULL_NBIT … … 737 753 Int SHIFT_QP = 12; 738 754 #endif 739 755 740 756 // set frame lambda 741 757 if (m_pcCfg->getGOPSize() > 1) … … 748 764 } 749 765 m_pcRdCost ->setFrameLambda(dFrameLambda); 750 766 751 767 // for each QP candidate 752 768 for ( UInt uiQpIdx = 0; uiQpIdx < 2 * m_pcCfg->getDeltaQpRD() + 1; uiQpIdx++ ) … … 776 792 #endif 777 793 778 #if RDOQ_CHROMA_LAMBDA 794 #if RDOQ_CHROMA_LAMBDA 779 795 // for RDOQ 780 796 m_pcTrQuant ->setLambda( m_pdRdPicLambda[uiQpIdx], m_pdRdPicLambda[uiQpIdx] / weight ); … … 784 800 #if SAO_CHROMA_LAMBDA 785 801 // For SAO 786 pcSlice ->setLambda ( m_pdRdPicLambda[uiQpIdx], m_pdRdPicLambda[uiQpIdx] / weight ); 802 pcSlice ->setLambda ( m_pdRdPicLambda[uiQpIdx], m_pdRdPicLambda[uiQpIdx] / weight ); 787 803 #else 788 804 pcSlice ->setLambda ( m_pdRdPicLambda[uiQpIdx] ); 789 805 #endif 790 806 791 807 // try compress 792 808 compressSlice ( rpcPic ); 793 809 794 810 Double dPicRdCost; 795 811 UInt64 uiPicDist = m_uiPicDist; 796 812 UInt64 uiALFBits = 0; 797 813 798 814 m_pcGOPEncoder->preLoopFilterPicAll( rpcPic, uiPicDist, uiALFBits ); 799 815 800 816 // compute RD cost and choose the best 801 817 dPicRdCost = m_pcRdCost->calcRdCost64( m_uiPicTotalBits + uiALFBits, uiPicDist, true, DF_SSE_FRAME); 802 818 803 819 if ( dPicRdCost < dPicRdCostBest ) 804 820 { … … 807 823 } 808 824 } 809 825 810 826 // set best values 811 827 pcSlice ->setSliceQp ( m_piRdPicQp [uiQpIdxBest] ); … … 832 848 #endif 833 849 834 #if RDOQ_CHROMA_LAMBDA 835 // for RDOQ 836 m_pcTrQuant ->setLambda( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight ); 850 #if RDOQ_CHROMA_LAMBDA 851 // for RDOQ 852 m_pcTrQuant ->setLambda( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight ); 837 853 #else 838 854 m_pcTrQuant ->setLambda ( m_pdRdPicLambda[uiQpIdxBest] ); … … 840 856 #if SAO_CHROMA_LAMBDA 841 857 // For SAO 842 pcSlice ->setLambda ( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight ); 858 pcSlice ->setLambda ( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight ); 843 859 #else 844 860 pcSlice ->setLambda ( m_pdRdPicLambda[uiQpIdxBest] ); … … 862 878 863 879 UInt uiEncCUOrder; 864 uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 880 uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 865 881 for( uiEncCUOrder = uiStartCUAddr/rpcPic->getNumPartInCU(); 866 882 uiEncCUOrder < (uiBoundingCUAddr+(rpcPic->getNumPartInCU()-1))/rpcPic->getNumPartInCU(); … … 898 914 TComSlice* pcSlice = rpcPic->getSlice(getSliceIdx()); 899 915 xDetermineStartAndBoundingCUAddr ( uiStartCUAddr, uiBoundingCUAddr, rpcPic, false ); 900 916 901 917 // initialize cost values 902 918 m_uiPicTotalBits = 0; 903 919 m_dPicRdCost = 0; 904 920 m_uiPicDist = 0; 905 921 906 922 // set entropy coder 907 923 if( m_pcCfg->getUseSBACRD() ) … … 921 937 m_pcEntropyCoder->setBitstream ( m_pcBitCounter ); 922 938 } 923 939 924 940 //------------------------------------------------------------------------------ 925 941 // Weighted Prediction parameters estimation. … … 930 946 xCalcACDCParamSlice(pcSlice); 931 947 } 948 #if O0194_WEIGHTED_PREDICTION_CGS 949 else 950 { 951 // Calculate for the base layer to be used in EL as Inter layer reference 952 estimateILWpParam( pcSlice ); 953 } 954 #endif 932 955 933 956 Bool bWp_explicit = (pcSlice->getSliceType()==P_SLICE && pcSlice->getPPS()->getUseWP()) || (pcSlice->getSliceType()==B_SLICE && pcSlice->getPPS()->getWPBiPred()); … … 1021 1044 m_pcBufferSbacCoders[uiTileCol].loadContexts( CTXMem[1] ); 1022 1045 Int iNumSubstreamsPerTile = iNumSubstreams/rpcPic->getPicSym()->getNumTiles(); 1023 uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 1046 uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 1024 1047 uiLin = uiCUAddr / uiWidthInLCUs; 1025 1048 uiSubStrm = rpcPic->getPicSym()->getTileIdxMap(rpcPic->getPicSym()->getCUOrderMap(uiCUAddr))*iNumSubstreamsPerTile … … 1098 1121 pcCUTR = rpcPic->getCU( uiCUAddr - uiWidthInCU + 1 ); 1099 1122 } 1100 if ( ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) || 1123 if ( ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) || 1101 1124 (pcCUTR->getSCUAddr()+uiMaxParts-1 < pcSlice->getSliceCurStartCUAddr()) || 1102 1125 ((rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(uiCUAddr))) … … 1137 1160 m_pcEntropyCoder->setEntropyCoder ( m_pcRDGoOnSbacCoder, pcSlice ); 1138 1161 m_pcEntropyCoder->setBitstream( &pcBitCounters[uiSubStrm] ); 1139 1162 1140 1163 ((TEncBinCABAC*)m_pcRDGoOnSbacCoder->getEncBinIf())->setBinCountingEnableFlag(true); 1141 1164 … … 1242 1265 m_pcRdCost->setLambda(oldLambda); 1243 1266 #if RATE_CONTROL_INTRA 1244 m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 1267 m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 1245 1268 pcCU->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() ); 1246 1269 #else … … 1250 1273 #endif 1251 1274 #endif 1252 1275 1253 1276 // restore entropy coder to an initial stage 1254 1277 m_pcEntropyCoder->setEntropyCoder ( m_pppcRDSbacCoder[0][CI_CURR_BEST], pcSlice ); … … 1275 1298 { 1276 1299 ppppcRDSbacCoders[uiSubStrm][0][CI_CURR_BEST]->load( m_pppcRDSbacCoder[0][CI_CURR_BEST] ); 1277 1300 1278 1301 //Store probabilties of second LCU in line into buffer 1279 1302 if ( ( uiCol == uiTileLCUX+1) && (depSliceSegmentsEnabled || (pcSlice->getPPS()->getNumSubstreams() > 1)) && m_pcCfg->getWaveFrontsynchro()) … … 1325 1348 1326 1349 #if RATE_CONTROL_INTRA 1327 m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 1350 m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 1328 1351 pcCU->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() ); 1329 1352 #else … … 1350 1373 } 1351 1374 } 1352 1375 1353 1376 m_uiPicTotalBits += pcCU->getTotalBits(); 1354 1377 m_dPicRdCost += pcCU->getTotalCost(); … … 1401 1424 m_pcEntropyCoder->setEntropyCoder ( m_pcSbacCoder, pcSlice ); 1402 1425 } 1403 1426 1404 1427 m_pcCuEncoder->setBitCounter( NULL ); 1405 1428 m_pcBitCounter = NULL; … … 1427 1450 m_pcBufferSbacCoders[ui].load(m_pcSbacCoder); //init. state 1428 1451 } 1429 1452 1430 1453 for (Int iSubstrmIdx=0; iSubstrmIdx < iNumSubstreams; iSubstrmIdx++) 1431 1454 { … … 1524 1547 } 1525 1548 if ( (true/*bEnforceSliceRestriction*/ && 1526 ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) || 1549 ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) || 1527 1550 (pcCUTR->getSCUAddr()+uiMaxParts-1 < pcSlice->getSliceCurStartCUAddr()) || 1528 1551 ((rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(uiCUAddr))) … … 1579 1602 } 1580 1603 1581 TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr ); 1604 TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr ); 1582 1605 if ( pcSlice->getSPS()->getUseSAO() && (pcSlice->getSaoEnabledFlag()||pcSlice->getSaoEnabledFlagChroma()) ) 1583 1606 { … … 1613 1636 if (allowMergeLeft) 1614 1637 { 1615 m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoMerge(mergeLeft); 1638 m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoMerge(mergeLeft); 1616 1639 } 1617 1640 else … … 1676 1699 #if ENC_DEC_TRACE 1677 1700 g_bJustDoIt = g_bEncDecTraceDisable; 1678 #endif 1701 #endif 1679 1702 if( m_pcCfg->getUseSBACRD() ) 1680 1703 { 1681 1704 pcSbacCoders[uiSubStrm].load(m_pcSbacCoder); //load back status of the entropy coder after encoding the LCU into relevant bitstream entropy coder 1682 1705 1683 1706 1684 1707 //Store probabilties of second LCU in line into buffer … … 1733 1756 UInt uiNumberOfCUsInFrame = rpcPic->getNumCUsInFrame(); 1734 1757 uiBoundingCUAddrSlice = uiNumberOfCUsInFrame; 1735 if (bEncodeSlice) 1758 if (bEncodeSlice) 1736 1759 { 1737 1760 UInt uiCUAddrIncrement; … … 1769 1792 uiBoundingCUAddrSlice = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU(); 1770 1793 break; 1771 } 1794 } 1772 1795 // WPP: if a slice does not start at the beginning of a CTB row, it must end within the same CTB row 1773 1796 if (pcSlice->getPPS()->getNumSubstreams() > 1 && (uiStartCUAddrSlice % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0)) … … 1809 1832 uiBoundingCUAddrSlice = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU(); 1810 1833 break; 1811 } 1834 } 1812 1835 // WPP: if a slice does not start at the beginning of a CTB row, it must end within the same CTB row 1813 1836 if (pcSlice->getPPS()->getNumSubstreams() > 1 && (uiStartCUAddrSlice % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0)) … … 1819 1842 1820 1843 Bool tileBoundary = false; 1821 if ((m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_BYTES) && 1844 if ((m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_BYTES) && 1822 1845 (m_pcCfg->getNumRowsMinus1() > 0 || m_pcCfg->getNumColumnsMinus1() > 0)) 1823 1846 { … … 1832 1855 } 1833 1856 tileBoundingCUAddrSlice = lcuEncAddr*rpcPic->getNumPartInCU(); 1834 1857 1835 1858 if (tileBoundingCUAddrSlice < uiBoundingCUAddrSlice) 1836 1859 { … … 1845 1868 startCUAddrSliceSegment = pcSlice->getSliceSegmentCurStartCUAddr(); 1846 1869 boundingCUAddrSliceSegment = uiNumberOfCUsInFrame; 1847 if (bEncodeSlice) 1870 if (bEncodeSlice) 1848 1871 { 1849 1872 UInt uiCUAddrIncrement; … … 1880 1903 boundingCUAddrSliceSegment = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU(); 1881 1904 break; 1882 } 1905 } 1883 1906 // WPP: if a slice segment does not start at the beginning of a CTB row, it must end within the same CTB row 1884 1907 if (pcSlice->getPPS()->getNumSubstreams() > 1 && (startCUAddrSliceSegment % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0)) … … 1919 1942 boundingCUAddrSliceSegment = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU(); 1920 1943 break; 1921 } 1944 } 1922 1945 // WPP: if a slice segment does not start at the beginning of a CTB row, it must end within the same CTB row 1923 1946 if (pcSlice->getPPS()->getNumSubstreams() > 1 && (startCUAddrSliceSegment % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0)) … … 1927 1950 pcSlice->setSliceSegmentCurEndCUAddr( boundingCUAddrSliceSegment ); 1928 1951 } 1929 if ((m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_BYTES) && 1952 if ((m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_BYTES) && 1930 1953 (m_pcCfg->getNumRowsMinus1() > 0 || m_pcCfg->getNumColumnsMinus1() > 0)) 1931 1954 { … … 1979 2002 } 1980 2003 UInt uiRealStartAddress = rpcPic->getPicSym()->getPicSCUEncOrder(uiExternalAddress*rpcPic->getNumPartInCU()+uiInternalAddress); 1981 2004 1982 2005 pcSlice->setSliceSegmentCurStartCUAddr(uiRealStartAddress); 1983 2006 startCUAddrSliceSegment=uiRealStartAddress; 1984 2007 1985 2008 //calculate real slice start address 1986 2009 uiInternalAddress = rpcPic->getPicSym()->getPicSCUAddr(pcSlice->getSliceCurStartCUAddr()) % rpcPic->getNumPartInCU(); … … 2007 2030 } 2008 2031 uiRealStartAddress = rpcPic->getPicSym()->getPicSCUEncOrder(uiExternalAddress*rpcPic->getNumPartInCU()+uiInternalAddress); 2009 2032 2010 2033 pcSlice->setSliceCurStartCUAddr(uiRealStartAddress); 2011 2034 uiStartCUAddrSlice=uiRealStartAddress; 2012 2035 2013 2036 // Make a joint decision based on reconstruction and dependent slice bounds 2014 2037 startCUAddr = max(uiStartCUAddrSlice , startCUAddrSliceSegment ); … … 2022 2045 if ( (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU) 2023 2046 || (m_pcCfg->getSliceMode()==0 && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU) 2024 || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==0) 2047 || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==0) 2025 2048 || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU) 2026 || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceSegmentMode()==0) 2049 || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceSegmentMode()==0) 2027 2050 || (m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceMode()==0) 2028 2051 || tileBoundary … … 2066 2089 } 2067 2090 #endif 2091 #if O0194_WEIGHTED_PREDICTION_CGS 2092 Void TEncSlice::estimateILWpParam( TComSlice* pcSlice ) 2093 { 2094 xCalcACDCParamSlice(pcSlice); 2095 wpACDCParam * temp_weightACDCParam; 2096 2097 pcSlice->getWpAcDcParam(temp_weightACDCParam); 2098 g_refWeightACDCParam = (void *) temp_weightACDCParam; 2099 } 2100 #endif 2068 2101 //! \} -
trunk/source/Lib/TLibEncoder/TEncSlice.h
r442 r494 111 111 virtual ~TEncSlice(); 112 112 113 #if AUXILIARY_PICTURES 114 Void create ( Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt iMaxCUWidth, UInt iMaxCUHeight, UChar uhTotalDepth ); 115 #else 113 116 Void create ( Int iWidth, Int iHeight, UInt iMaxCUWidth, UInt iMaxCUHeight, UChar uhTotalDepth ); 117 #endif 114 118 Void destroy (); 115 119 Void init ( TEncTop* pcEncTop ); … … 119 123 Void initEncSlice ( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, 120 124 Int iGOPid, TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS, TComVPS *vps, Bool isField ); 125 #if O0194_WEIGHTED_PREDICTION_CGS 126 Void estimateILWpParam ( TComSlice* pcSlice ); 127 #endif 121 128 #else 122 129 Void initEncSlice ( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, -
trunk/source/Lib/TLibEncoder/TEncTop.cpp
r442 r494 88 88 m_bMFMEnabledFlag = false; 89 89 #endif 90 #if SCALED_REF_LAYER_OFFSETS91 90 m_numScaledRefLayerOffsets = 0; 92 #endif93 #endif94 91 #if POC_RESET_FLAG 95 92 m_pocAdjustmentValue = 0; 96 93 #endif 94 #endif //SVC_EXTENSION 97 95 } 98 96 … … 117 115 m_cGOPEncoder. create(); 118 116 #endif 117 #if AUXILIARY_PICTURES 118 m_cSliceEncoder. create( getSourceWidth(), getSourceHeight(), m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); 119 #else 119 120 m_cSliceEncoder. create( getSourceWidth(), getSourceHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); 121 #endif 120 122 m_cCuEncoder. create( g_uiMaxCUDepth, g_uiMaxCUWidth, g_uiMaxCUHeight ); 121 123 if (m_bUseSAO) … … 175 177 } 176 178 } 179 180 #if LAYER_CTB 181 memcpy(g_auiLayerZscanToRaster[m_layerId], g_auiZscanToRaster, sizeof( g_auiZscanToRaster ) ); 182 memcpy(g_auiLayerRasterToZscan[m_layerId], g_auiRasterToZscan, sizeof( g_auiRasterToZscan ) ); 183 memcpy(g_auiLayerRasterToPelX[m_layerId], g_auiRasterToPelX, sizeof( g_auiRasterToPelX ) ); 184 memcpy(g_auiLayerRasterToPelY[m_layerId], g_auiRasterToPelY, sizeof( g_auiRasterToPelY ) ); 185 #endif 177 186 } 178 187 … … 601 610 else 602 611 { 612 #if AUXILIARY_PICTURES 613 rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); 614 #else 603 615 rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); 616 #endif 604 617 } 605 618 rcListPicYuvRecOut.pushBack( rpcPicYuvRec ); … … 801 814 #endif 802 815 816 #if AUXILIARY_PICTURES 817 #if SVC_UPSAMPLING 818 pcEPic->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_cPPS.getMaxCuDQPDepth()+1 , 819 m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics, &m_cSPS); 820 #else 821 pcEPic->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_cPPS.getMaxCuDQPDepth()+1 , 822 m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics); 823 #endif 824 #else 803 825 #if SVC_UPSAMPLING 804 826 pcEPic->create( m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_cPPS.getMaxCuDQPDepth()+1 , … … 807 829 pcEPic->create( m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_cPPS.getMaxCuDQPDepth()+1 , 808 830 m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics); 831 #endif 809 832 #endif 810 833 rpcPic = pcEPic; … … 842 865 #endif 843 866 867 #if AUXILIARY_PICTURES 868 #if SVC_UPSAMPLING 869 rpcPic->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, 870 m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics, &m_cSPS); 871 #else 872 rpcPic->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, 873 m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics); 874 #endif 875 #else 844 876 #if SVC_UPSAMPLING 845 877 rpcPic->create( m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, … … 849 881 m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics); 850 882 #endif 883 #endif 851 884 } 852 885 … … 871 904 #if SVC_EXTENSION 872 905 m_cSPS.setLayerId(m_layerId); 873 #endif874 906 #if REF_IDX_MFM 875 907 #if !M0457_COL_PICTURE_SIGNALING … … 877 909 #endif 878 910 #endif 879 #if SCALED_REF_LAYER_OFFSETS880 911 m_cSPS.setNumScaledRefLayerOffsets(m_numScaledRefLayerOffsets); 881 912 for(Int i = 0; i < m_cSPS.getNumScaledRefLayerOffsets(); i++) … … 883 914 m_cSPS.getScaledRefLayerWindow(i) = m_scaledRefLayerWindow[i]; 884 915 } 885 #endif 916 #endif //SVC_EXTENSION 886 917 ProfileTierLevel& profileTierLevel = *m_cSPS.getPTL()->getGeneralPTL(); 887 918 profileTierLevel.setLevelIdc(m_level); … … 914 945 m_cSPS.setMaxCUHeight ( g_uiMaxCUHeight ); 915 946 m_cSPS.setMaxCUDepth ( g_uiMaxCUDepth ); 947 #if AUXILIARY_PICTURES 948 m_cSPS.setChromaFormatIdc( m_chromaFormatIDC); 949 #endif 916 950 917 951 Int minCUSize = m_cSPS.getMaxCUWidth() >> ( m_cSPS.getMaxCUDepth()-g_uiAddCUDepth ); … … 1188 1222 for( Int i = 0; i < getGOPSize()+m_extraRPSs; i++) 1189 1223 { 1190 #if FINAL_RPL_CHANGE_N00821191 GOPEntry ge = m_ppcTEncTop[m_cSPS.getLayerId()]->getGOPEntry(i);1192 #else1193 1224 GOPEntry ge = getGOPEntry(i); 1194 #endif1195 1225 rps = rpsList->getReferencePictureSet(i); 1196 1226 rps->setNumberOfPictures(ge.m_numRefPics); … … 1536 1566 #endif 1537 1567 1538 #if SVC_EXTENSION1539 1568 #if !REPN_FORMAT_IN_VPS 1540 1569 Void TEncTop::xInitILRP() … … 1559 1588 m_cIlpPic[j] = new TComPic; 1560 1589 #if SVC_UPSAMPLING 1590 #if AUXILIARY_PICTURES 1591 m_cIlpPic[j]->create(m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, &m_cSPS, true); 1592 #else 1561 1593 m_cIlpPic[j]->create(m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, &m_cSPS, true); 1594 #endif 1562 1595 #else 1563 1596 m_cIlpPic[j]->create(m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, true); … … 1611 1644 m_cIlpPic[j] = new TComPic; 1612 1645 #if SVC_UPSAMPLING 1646 #if AUXILIARY_PICTURES 1647 m_cIlpPic[j]->create(picWidth, picHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, &m_cSPS, true); 1648 #else 1613 1649 m_cIlpPic[j]->create(picWidth, picHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, &m_cSPS, true); 1650 #endif 1614 1651 #else 1615 1652 m_cIlpPic[j]->create(m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, true); … … 1624 1661 } 1625 1662 #endif 1626 Void TEncTop::setILRPic(TComPic *pcPic) 1627 { 1628 for( Int i = 0; i < pcPic->getSlice(0)->getActiveNumILRRefIdx(); i++ ) 1629 { 1630 Int refLayerIdc = pcPic->getSlice(0)->getInterLayerPredLayerIdc(i); 1631 1632 if(m_cIlpPic[refLayerIdc]) 1633 { 1634 m_cIlpPic[refLayerIdc]->copyUpsampledPictureYuv(pcPic->getFullPelBaseRec(refLayerIdc), m_cIlpPic[refLayerIdc]->getPicYuvRec()); 1635 m_cIlpPic[refLayerIdc]->getSlice(0)->setPOC(pcPic->getPOC()); 1636 m_cIlpPic[refLayerIdc]->setLayerId(pcPic->getSlice(0)->getBaseColPic(refLayerIdc)->getLayerId()); //set reference layerId 1637 m_cIlpPic[refLayerIdc]->getPicYuvRec()->setBorderExtension(false); 1638 m_cIlpPic[refLayerIdc]->getPicYuvRec()->extendPicBorder(); 1639 for (Int j=0; j<m_cIlpPic[refLayerIdc]->getPicSym()->getNumberOfCUsInFrame(); j++) // set reference CU layerId 1640 { 1641 m_cIlpPic[refLayerIdc]->getPicSym()->getCU(j)->setLayerId(m_cIlpPic[refLayerIdc]->getLayerId()); 1642 } 1643 } 1644 } 1645 } 1646 #endif 1647 #endif 1663 #endif //SVC_EXTENSION 1648 1664 //! \} -
trunk/source/Lib/TLibEncoder/TEncTop.h
r442 r494 140 140 Int m_ilSampleOnlyPred; 141 141 #endif 142 #if SCALED_REF_LAYER_OFFSETS143 142 UInt m_numScaledRefLayerOffsets; 144 143 Window m_scaledRefLayerWindow[MAX_LAYERS]; 145 #endif146 144 #if POC_RESET_FLAG 147 145 Int m_pocAdjustmentValue; 148 146 #endif 149 #endif 147 #endif //SVC_EXTENSION 150 148 protected: 151 149 Void xGetNewPicBuffer ( TComPic*& rpcPic ); ///< get picture buffer which will be processed … … 209 207 Int getNumPicRcvd () { return m_iNumPicRcvd; } 210 208 Void setNumPicRcvd ( Int num ) { m_iNumPicRcvd = num; } 211 #if SCALED_REF_LAYER_OFFSETS212 209 Void setNumScaledRefLayerOffsets(Int x) { m_numScaledRefLayerOffsets = x; } 213 210 UInt getNumScaledRefLayerOffsets() { return m_numScaledRefLayerOffsets; } 214 211 Window& getScaledRefLayerWindow(Int x) { return m_scaledRefLayerWindow[x]; } 215 #endif 216 #endif 212 #endif //SVC_EXTENSION 217 213 218 214 // ------------------------------------------------------------------------------------------------------------------- … … 223 219 #if SVC_EXTENSION 224 220 TComPic** getIlpList() { return m_cIlpPic; } 225 Void setILRPic(TComPic *pcPic);226 221 #if REF_IDX_MFM 227 222 Void setMFMEnabledFlag (Bool flag) {m_bMFMEnabledFlag = flag;} -
trunk/source/Lib/TLibEncoder/WeightPredAnalysis.cpp
r313 r494 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 6 * Copyright (c) 2010-2013, ITU/ISO/IEC … … 51 51 for ( Int iList =0 ; iList<2 ; iList++ ) 52 52 { 53 for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) 53 for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) 54 54 { 55 55 for ( Int comp=0 ; comp<3 ;comp++ ) … … 74 74 TComPicYuv* pPic = slice->getPic()->getPicYuvOrg(); 75 75 Int iSample = 0; 76 #if O0194_WEIGHTED_PREDICTION_CGS 77 // Define here to assign the parameter of "iSample" 78 wpACDCParam weightACDCParam[3]; 79 #endif 76 80 77 81 // calculate DC/AC value for Y … … 81 85 pOrg = pPic->getLumaAddr(); 82 86 Int64 iOrgACY = xCalcACValueSlice(slice, pOrg, iOrgNormDCY); 87 #if O0194_WEIGHTED_PREDICTION_CGS 88 weightACDCParam[0].iSamples = iSample; 89 #endif 83 90 84 91 // calculate DC/AC value for Cb … … 88 95 pOrg = pPic->getCbAddr(); 89 96 Int64 iOrgACCb = xCalcACValueUVSlice(slice, pOrg, iOrgNormDCCb); 97 #if O0194_WEIGHTED_PREDICTION_CGS 98 weightACDCParam[1].iSamples = iSample; 99 #endif 90 100 91 101 // calculate DC/AC value for Cr … … 95 105 pOrg = pPic->getCrAddr(); 96 106 Int64 iOrgACCr = xCalcACValueUVSlice(slice, pOrg, iOrgNormDCCr); 97 107 #if O0194_WEIGHTED_PREDICTION_CGS 108 weightACDCParam[2].iSamples = iSample; 109 #endif 110 111 #if !O0194_WEIGHTED_PREDICTION_CGS 98 112 wpACDCParam weightACDCParam[3]; 113 #endif 99 114 weightACDCParam[0].iAC = iOrgACY; 100 115 weightACDCParam[0].iDC = iOrgNormDCY; … … 138 153 for ( Int iList=0 ; iList<2 ; iList++ ) 139 154 { 140 for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) 141 { 142 for ( Int iComp=0 ; iComp<3 ;iComp++ ) 155 for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) 156 { 157 for ( Int iComp=0 ; iComp<3 ;iComp++ ) 143 158 { 144 159 wpScalingParam *pwp = &(m_wp[iList][iRefIdx][iComp]); … … 154 169 for ( Int iList=0 ; iList<2 ; iList++ ) 155 170 { 156 for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) 171 for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) 157 172 { 158 for ( Int iComp=0 ; iComp<3 ;iComp++ ) 173 for ( Int iComp=0 ; iComp<3 ;iComp++ ) 159 174 { 160 175 wpScalingParam *pwp = &(m_wp[iList][iRefIdx][iComp]); … … 195 210 // selecting whether WP is used, or not 196 211 xSelectWP(slice, m_wp, iDenom); 197 212 198 213 slice->setWpScaling( m_wp ); 199 214 … … 216 231 slice->getWpAcDcParam(currWeightACDCParam); 217 232 slice->getRefPic(eRefPicList, refIdxTemp)->getSlice(0)->getWpAcDcParam(refWeightACDCParam); 233 #if O0194_WEIGHTED_PREDICTION_CGS 234 UInt currLayerId = slice->getLayerId(); 235 UInt refLayerId = slice->getRefPic(eRefPicList, refIdxTemp)->getLayerId(); 236 Bool validILRPic = slice->getRefPic(eRefPicList, refIdxTemp)->isILR( currLayerId ) && refLayerId == 0; 237 238 if( validILRPic ) 239 { 240 refWeightACDCParam = (wpACDCParam *)g_refWeightACDCParam; 241 } 242 #endif 218 243 219 244 for ( Int comp = 0; comp < 3; comp++ ) … … 229 254 Int64 refDC = refWeightACDCParam[comp].iDC; 230 255 Int64 refAC = refWeightACDCParam[comp].iAC; 256 #if O0194_WEIGHTED_PREDICTION_CGS 257 if( validILRPic ) 258 { 259 refAC = ( refAC * currWeightACDCParam[comp].iSamples ) /refWeightACDCParam[comp].iSamples; 260 #if O0194_JOINT_US_BITSHIFT 261 refAC <<= (g_bitDepthYLayer[currLayerId]-g_bitDepthYLayer[refLayerId]); 262 refDC <<= (g_bitDepthYLayer[currLayerId]-g_bitDepthYLayer[refLayerId]); 263 #endif 264 } 265 #endif 231 266 232 267 // calculating iWeight and iOffset params … … 234 269 Int weight = (Int)( 0.5 + dWeight * (Double)(1<<log2Denom) ); 235 270 Int offset = (Int)( ((currDC<<log2Denom) - ((Int64)weight * refDC) + (Int64)realOffset) >> realLog2Denom ); 271 #if O0194_WEIGHTED_PREDICTION_CGS 272 if( !validILRPic ) 273 { 274 dWeight = 1; 275 offset = 0; 276 } 277 weight = (Int)( 0.5 + dWeight * (Double)(1<<log2Denom) ); 278 #endif 236 279 237 280 // Chroma offset range limitation … … 253 296 if(deltaWeight > 127 || deltaWeight < -128) 254 297 return (false); 298 #if O0194_WEIGHTED_PREDICTION_CGS 299 // make sure the reference frames other than ILR are not using weighted prediction 300 else 301 if( !validILRPic ) 302 { 303 continue; 304 } 305 #endif 255 306 256 307 m_wp[refList][refIdxTemp][comp].bPresentFlag = true; … … 264 315 } 265 316 266 /** select whether weighted pred enables or not. 317 /** select whether weighted pred enables or not. 267 318 * \param TComSlice *slice 268 319 * \param wpScalingParam … … 325 376 } 326 377 327 /** calculate DC value of original image for luma. 378 /** calculate DC value of original image for luma. 328 379 * \param TComSlice *slice 329 380 * \param Pel *pPel … … 345 396 } 346 397 347 /** calculate AC value of original image for luma. 398 /** calculate AC value of original image for luma. 348 399 * \param TComSlice *slice 349 400 * \param Pel *pPel … … 363 414 } 364 415 365 /** calculate DC value of original image for chroma. 416 /** calculate DC value of original image for chroma. 366 417 * \param TComSlice *slice 367 418 * \param Pel *pPel … … 383 434 } 384 435 385 /** calculate AC value of original image for chroma. 436 /** calculate AC value of original image for chroma. 386 437 * \param TComSlice *slice 387 438 * \param Pel *pPel … … 401 452 } 402 453 403 /** calculate DC value. 454 /** calculate DC value. 404 455 * \param Pel *pPel 405 456 * \param Int iWidth … … 423 474 } 424 475 425 /** calculate AC value. 476 /** calculate AC value. 426 477 * \param Pel *pPel 427 478 * \param Int iWidth … … 446 497 } 447 498 448 /** calculate SAD values for both WP version and non-WP version. 499 /** calculate SAD values for both WP version and non-WP version. 449 500 * \param Pel *pOrgPel 450 501 * \param Pel *pRefPel
Note: See TracChangeset for help on using the changeset viewer.