Changeset 466 in SHVCSoftware for branches/SHM-4.0-dev/source/Lib/TLibEncoder
- Timestamp:
- 13 Nov 2013, 23:25:47 (11 years ago)
- Location:
- branches/SHM-4.0-dev/source/Lib/TLibEncoder
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
r464 r466 359 359 { 360 360 WRITE_FLAG(pcVUI->getTilesFixedStructureFlag(), "tiles_fixed_structure_flag"); 361 #if M0464_TILE_BOUNDARY_ALIGNED_FLAG 362 if ( pcSPS->getLayerId() > 0 ) 363 { 364 WRITE_FLAG( pcVUI->getTileBoundariesAlignedFlag( ) ? 1 : 0 , "tile_boundaries_aligned_flag" ); 365 } 366 #endif 361 367 WRITE_FLAG(pcVUI->getMotionVectorsOverPicBoundariesFlag(), "motion_vectors_over_pic_boundaries_flag"); 362 368 WRITE_FLAG(pcVUI->getRestrictedRefPicListsFlag(), "restricted_ref_pic_lists_flag"); … … 448 454 #endif 449 455 WRITE_CODE( pcSPS->getVPSId (), 4, "sps_video_parameter_set_id" ); 450 #if S VC_EXTENSION456 #if SPS_SUB_LAYER_INFO 451 457 if(pcSPS->getLayerId() == 0) 452 458 { … … 454 460 WRITE_CODE( pcSPS->getMaxTLayers() - 1, 3, "sps_max_sub_layers_minus1" ); 455 461 WRITE_FLAG( pcSPS->getTemporalIdNestingFlag() ? 1 : 0, "sps_temporal_id_nesting_flag" ); 456 #if S VC_EXTENSION462 #if SPS_SUB_LAYER_INFO 457 463 } 458 464 #endif … … 664 670 WRITE_FLAG( 0, "inter_view_mv_vert_constraint_flag" ); 665 671 #endif 672 #if SCALED_REF_LAYER_OFFSETS 666 673 if( pcSPS->getLayerId() > 0 ) 667 674 { … … 676 683 } 677 684 } 685 #endif 678 686 #if M0463_VUI_EXT_ILP_REF 679 687 //// sps_extension_vui_parameters( ) … … 820 828 } 821 829 822 #if SVC_EXTENSION823 830 #if VPS_EXTNS 824 831 Void TEncCavlc::codeVPSExtension (TComVPS *vps) … … 836 843 } 837 844 845 #if VPS_SPLIT_FLAG 838 846 for(j = 0; j < vps->getNumScalabilityTypes() - vps->getSplittingFlag(); j++) 847 #else 848 for(j = 0; j < vps->getNumScalabilityTypes(); j++) 849 #endif 839 850 { 840 851 WRITE_CODE( vps->getDimensionIdLen(j) - 1, 3, "dimension_id_len_minus1[j]" ); … … 860 871 WRITE_CODE( vps->getLayerIdInNuh(i), 6, "layer_id_in_nuh[i]" ); 861 872 } 862 863 if( !vps->getSplittingFlag() ) 864 { 865 for(j = 0; j < vps->getNumScalabilityTypes(); j++) 866 { 867 UInt bits = vps->getDimensionIdLen(j); 868 WRITE_CODE( vps->getDimensionId(i, j), bits, "dimension_id[i][j]" ); 869 } 873 #if VPS_SPLIT_FLAG 874 if(!vps->getSplittingFlag()) 875 #endif 876 for(j = 0; j < vps->getNumScalabilityTypes(); j++) 877 { 878 UInt bits = vps->getDimensionIdLen(j); 879 WRITE_CODE( vps->getDimensionId(i, j), bits, "dimension_id[i][j]" ); 870 880 } 871 881 } … … 883 893 } 884 894 #endif 895 #if VPS_MOVE_DIR_DEPENDENCY_FLAG 885 896 #if VPS_EXTN_DIRECT_REF_LAYERS 886 897 for( Int layerCtr = 1; layerCtr <= vps->getMaxLayers() - 1; layerCtr++) … … 891 902 } 892 903 } 904 #endif 893 905 #endif 894 906 #if JCTVC_M0203_INTERLAYER_PRED_IDC … … 914 926 #if VPS_EXTN_PROFILE_INFO 915 927 // Profile-tier-level signalling 928 #if VPS_PROFILE_OUTPUT_LAYERS 916 929 WRITE_CODE( vps->getNumLayerSets() - 1 , 10, "vps_number_layer_sets_minus1" ); 917 930 WRITE_CODE( vps->getNumProfileTierLevel() - 1, 6, "vps_num_profile_tier_level_minus1"); 918 931 for(Int idx = 1; idx <= vps->getNumProfileTierLevel() - 1; idx++) 932 #else 933 for(Int idx = 1; idx <= vps->getNumLayerSets() - 1; idx++) 934 #endif 919 935 { 920 936 WRITE_FLAG( vps->getProfilePresentFlag(idx), "vps_profile_present_flag[i]" ); 921 937 if( !vps->getProfilePresentFlag(idx) ) 922 938 { 939 #if VPS_PROFILE_OUTPUT_LAYERS 923 940 WRITE_CODE( vps->getProfileLayerSetRef(idx) - 1, 6, "profile_ref_minus1[i]" ); 941 #else 942 WRITE_UVLC( vps->getProfileLayerSetRef(idx) - 1, "vps_profile_layer_set_ref_minus1[i]" ); 943 #endif 924 944 } 925 945 codePTL( vps->getPTLForExtn(idx), vps->getProfilePresentFlag(idx), vps->getMaxTLayers() - 1 ); … … 927 947 #endif 928 948 949 #if VPS_PROFILE_OUTPUT_LAYERS 929 950 Int numOutputLayerSets = vps->getNumOutputLayerSets() ; 930 951 WRITE_FLAG( (numOutputLayerSets > vps->getNumLayerSets()), "more_output_layer_sets_than_default_flag" ); … … 961 982 WRITE_CODE( vps->getProfileLevelTierIdx(i), numBits, "profile_level_tier_idx[i]" ); 962 983 } 963 984 #else 985 #if VPS_EXTN_OP_LAYER_SETS 986 // Target output layer signalling 987 WRITE_UVLC( vps->getNumOutputLayerSets(), "vps_num_output_layer_sets"); 988 for(i = 0; i < vps->getNumOutputLayerSets(); i++) 989 { 990 #if VPS_OUTPUT_LAYER_SET_IDX 991 assert(vps->getOutputLayerSetIdx(i) > 0); 992 WRITE_UVLC( vps->getOutputLayerSetIdx(i) - 1, "vps_output_layer_set_idx_minus1[i]"); 993 #else 994 WRITE_UVLC( vps->getOutputLayerSetIdx(i), "vps_output_layer_set_idx[i]"); 995 #endif 996 Int lsIdx = vps->getOutputLayerSetIdx(i); 997 for(j = 0; j <= vps->getMaxLayerId(); j++) 998 { 999 if(vps->getLayerIdIncludedFlag(lsIdx, j)) 1000 { 1001 WRITE_FLAG( vps->getOutputLayerFlag(lsIdx, j), "vps_output_layer_flag[lsIdx][j]"); 1002 } 1003 } 1004 } 1005 #endif 1006 #endif 1007 964 1008 #if REPN_FORMAT_IN_VPS 965 1009 WRITE_FLAG( vps->getRepFormatIdxPresentFlag(), "rep_format_idx_present_flag"); … … 988 1032 989 1033 #if JCTVC_M0458_INTERLAYER_RPS_SIG 990 WRITE_FLAG(vps->getMaxOneActiveRefLayerFlag(), "max_one_active_ref_layer_flag");1034 WRITE_FLAG(vps->getMaxOneActiveRefLayerFlag(), "max_one_active_ref_layer_flag"); 991 1035 #endif 992 1036 #if O0215_PHASE_ALIGNMENT … … 994 1038 #endif 995 1039 #if N0147_IRAP_ALIGN_FLAG 996 WRITE_FLAG(vps->getCrossLayerIrapAlignFlag(), "cross_layer_irap_aligned_flag");1040 WRITE_FLAG(vps->getCrossLayerIrapAlignFlag(), "cross_layer_irap_aligned_flag"); 997 1041 #endif 1042 #if !VPS_MOVE_DIR_DEPENDENCY_FLAG 1043 #if VPS_EXTN_DIRECT_REF_LAYERS 1044 for( Int layerCtr = 1; layerCtr <= vps->getMaxLayers() - 1; layerCtr++) 1045 { 1046 for( Int refLayerCtr = 0; refLayerCtr < layerCtr; refLayerCtr++) 1047 { 1048 WRITE_FLAG(vps->getDirectDependencyFlag(layerCtr, refLayerCtr), "direct_dependency_flag[i][j]" ); 1049 } 1050 } 1051 #endif 1052 #endif 998 1053 #if VPS_EXTN_DIRECT_REF_LAYERS && M0457_PREDICTION_INDICATIONS 999 1054 WRITE_UVLC( vps->getDirectDepTypeLen()-2, "direct_dep_type_len_minus2"); … … 1129 1184 } 1130 1185 #endif 1131 #endif //SVC_EXTENSION1132 1186 1133 1187 Void TEncCavlc::codeSliceHeader ( TComSlice* pcSlice ) … … 1175 1229 if ( !pcSlice->getDependentSliceSegmentFlag() ) 1176 1230 { 1177 #if SVC_EXTENSION 1231 1178 1232 #if POC_RESET_FLAG 1179 1233 Int iBits = 0; … … 1195 1249 } 1196 1250 #else 1251 #if SH_DISCARDABLE_FLAG 1197 1252 if (pcSlice->getPPS()->getNumExtraSliceHeaderBits()>0) 1198 1253 { … … 1205 1260 WRITE_FLAG(0, "slice_reserved_undetermined_flag[]"); 1206 1261 } 1207 #endif 1208 #else //SVC_EXTENSION 1262 #else 1209 1263 for (Int i = 0; i < pcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++) 1210 1264 { … … 1212 1266 WRITE_FLAG(0, "slice_reserved_undetermined_flag[]"); 1213 1267 } 1214 #endif //SVC_EXTENSION 1268 #endif 1269 #endif 1215 1270 1216 1271 WRITE_UVLC( pcSlice->getSliceType(), "slice_type" ); -
branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r464 r466 753 753 pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR)); 754 754 #if SVC_EXTENSION 755 #if ILR_RESTR && ILR_RESTR_FIX 756 Int interLayerPredLayerIdcTmp[MAX_VPS_LAYER_ID_PLUS1]; 757 Int activeNumILRRefIdxTmp = 0; 758 #endif 755 759 if (m_layerId > 0) 756 760 { 757 Int interLayerPredLayerIdcTmp[MAX_VPS_LAYER_ID_PLUS1];758 Int activeNumILRRefIdxTmp = 0;759 760 761 for( Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ ) 761 762 { … … 768 769 pcSlice->setBaseColPic( *cListPic, refLayerIdc ); 769 770 771 #if ILR_RESTR && ILR_RESTR_FIX 770 772 // Apply temporal layer restriction to inter-layer prediction 771 773 Int maxTidIlRefPicsPlus1 = m_pcEncTop->getVPS()->getMaxTidIlRefPicsPlus1(pcSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getLayerId()); … … 778 780 continue; // ILP is not valid due to temporal layer restriction 779 781 } 780 782 #endif 783 784 #if SCALED_REF_LAYER_OFFSETS 781 785 const Window &scalEL = m_pcEncTop->getScaledRefLayerWindow(refLayerIdc); 782 786 … … 786 790 Int widthEL = pcPic->getPicYuvRec()->getWidth() - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset(); 787 791 Int heightEL = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset() - scalEL.getWindowBottomOffset(); 788 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 789 802 g_mvScalingFactor[refLayerIdc][0] = widthEL == widthBL ? 4096 : Clip3(-4096, 4095, ((widthEL << 8) + (widthBL >> 1)) / widthBL); 790 803 g_mvScalingFactor[refLayerIdc][1] = heightEL == heightBL ? 4096 : Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL); … … 810 823 } 811 824 825 #if ILR_RESTR && ILR_RESTR_FIX 812 826 // Update the list of active inter-layer pictures 813 827 for ( Int i = 0; i < activeNumILRRefIdxTmp; i++) … … 821 835 pcSlice->setInterLayerPredEnabledFlag(false); 822 836 } 837 #endif 823 838 824 839 if( pocCurr % m_pcCfg->getIntraPeriod() == 0 ) … … 1601 1616 pcSlice->setSliceSegmentCurStartCUAddr ( startCUAddrSlice ); 1602 1617 pcSlice->setSliceBits(0); 1603 #if SVC_EXTENSION1604 // copy reference list modification info from the first slice, assuming that this information is the same across all slices in the picture1605 memcpy( pcSlice->getRefPicListModification(), pcPic->getSlice(0)->getRefPicListModification(), sizeof(TComRefPicListModification) );1606 #endif1607 1618 uiNumSlices ++; 1608 1619 } -
branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncSearch.cpp
r442 r466 4119 4119 4120 4120 // prediction pattern 4121 #if O0194_WEIGHTED_PREDICTION_CGS 4122 // Bug Fix (It did not check WP for BSlices) 4123 if ( pcCU->getSlice()->getPPS()->getUseWP()) 4124 #else 4121 4125 if ( pcCU->getSlice()->getPPS()->getUseWP() && pcCU->getSlice()->getSliceType()==P_SLICE ) 4126 #endif 4122 4127 { 4123 4128 xPredInterLumaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, true ); … … 4128 4133 } 4129 4134 4135 #if O0194_WEIGHTED_PREDICTION_CGS 4136 if ( pcCU->getSlice()->getPPS()->getUseWP()) 4137 ///< Bug Fix (It did not check WP for BSlices) 4138 #else 4130 4139 if ( pcCU->getSlice()->getPPS()->getUseWP() && pcCU->getSlice()->getSliceType()==P_SLICE ) 4140 #endif 4131 4141 { 4132 4142 xWeightedPredictionUni( pcCU, pcTemplateCand, uiPartAddr, iSizeX, iSizeY, eRefPicList, pcTemplateCand, iRefIdx ); -
branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncSlice.cpp
r442 r466 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 … … 87 87 m_apcPicYuvPred->create( iWidth, iHeight, iMaxCUWidth, iMaxCUHeight, uhTotalDepth ); 88 88 } 89 89 90 90 // create residual picture 91 91 if( m_apcPicYuvResi == NULL ) … … 105 105 m_apcPicYuvPred = NULL; 106 106 } 107 107 108 108 // destroy residual picture 109 109 if ( m_apcPicYuvResi ) … … 113 113 m_apcPicYuvResi = NULL; 114 114 } 115 115 116 116 // free lambda and QP arrays 117 117 if ( m_pdRdPicLambda ) { xFree( m_pdRdPicLambda ); m_pdRdPicLambda = NULL; } … … 139 139 #if SVC_EXTENSION 140 140 m_ppcTEncTop = pcEncTop->getLayerEnc(); 141 #endif 141 #endif 142 142 m_pcGOPEncoder = pcEncTop->getGOPEncoder(); 143 143 m_pcCuEncoder = pcEncTop->getCuEncoder(); 144 144 m_pcPredSearch = pcEncTop->getPredSearch(); 145 145 146 146 m_pcEntropyCoder = pcEncTop->getEntropyCoder(); 147 147 m_pcCavlcCoder = pcEncTop->getCavlcCoder(); … … 149 149 m_pcBinCABAC = pcEncTop->getBinCABAC(); 150 150 m_pcTrQuant = pcEncTop->getTrQuant(); 151 151 152 152 m_pcBitCounter = pcEncTop->getBitCounter(); 153 153 m_pcRdCost = pcEncTop->getRdCost(); 154 154 m_pppcRDSbacCoder = pcEncTop->getRDSbacCoder(); 155 155 m_pcRDGoOnSbacCoder = pcEncTop->getRDGoOnSbacCoder(); 156 156 157 157 // create lambda and QP arrays 158 158 m_pdRdPicLambda = (Double*)xMalloc( Double, m_pcCfg->getDeltaQpRD() * 2 + 1 ); … … 187 187 Double dQP; 188 188 Double dLambda; 189 189 190 190 rpcSlice = pcPic->getSlice(0); 191 191 rpcSlice->setSPS( pSPS ); … … 202 202 rpcSlice->setPicOutputFlag( true ); 203 203 rpcSlice->setPOC( pocCurr ); 204 204 205 205 // depth computation based on GOP size 206 206 Int depth; … … 230 230 } 231 231 } 232 232 233 233 // slice type 234 234 SliceType eSliceType; 235 235 236 236 eSliceType=B_SLICE; 237 237 eSliceType = (pocLast == 0 || pocCurr % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType; 238 238 239 239 rpcSlice->setSliceType ( eSliceType ); 240 240 241 241 // ------------------------------------------------------------------------------------------------------------------ 242 242 // Non-referenced frame marking 243 243 // ------------------------------------------------------------------------------------------------------------------ 244 244 245 245 if(pocLast == 0) 246 246 { … … 252 252 } 253 253 rpcSlice->setReferenced(true); 254 254 255 255 // ------------------------------------------------------------------------------------------------------------------ 256 256 // QP setting 257 257 // ------------------------------------------------------------------------------------------------------------------ 258 258 259 259 dQP = m_pcCfg->getQP(); 260 260 if(eSliceType!=I_SLICE) 261 261 { 262 262 #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()))) 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()))) 266 266 #endif 267 267 { … … 269 269 } 270 270 } 271 271 272 272 // modify QP 273 273 Int* pdQPs = m_pcCfg->getdQPs(); … … 285 285 // Lambda computation 286 286 // ------------------------------------------------------------------------------------------------------------------ 287 287 288 288 Int iQP; 289 289 Double dOrigQP = dQP; … … 294 294 // compute QP value 295 295 dQP = dOrigQP + ((iDQpIdx+1)>>1)*(iDQpIdx%2 ? -1 : 1); 296 296 297 297 // compute lambda value 298 298 Int NumberBFrames = ( m_pcCfg->getGOPSize() - 1 ); … … 326 326 #endif 327 327 } 328 328 329 329 // if hadamard is used in ME process 330 330 if ( !m_pcCfg->getUseHADME() && rpcSlice->getSliceType( ) != I_SLICE ) … … 332 332 dLambda *= 0.95; 333 333 } 334 334 335 335 #if REPN_FORMAT_IN_VPS 336 336 iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) ); … … 343 343 m_piRdPicQp [iDQpIdx] = iQP; 344 344 } 345 345 346 346 // obtain dQP = 0 case 347 347 dLambda = m_pdRdPicLambda[0]; 348 348 dQP = m_pdRdPicQp [0]; 349 349 iQP = m_piRdPicQp [0]; 350 350 351 351 if( rpcSlice->getSliceType( ) != I_SLICE ) 352 352 { … … 359 359 Int nCurLayer = rpcSlice->getLayerId(); 360 360 Double gamma = xCalEnhLambdaFactor( m_ppcTEncTop[nCurLayer-1]->getQP() - m_ppcTEncTop[nCurLayer]->getQP() , 361 1.0 * m_ppcTEncTop[nCurLayer]->getSourceWidth() * m_ppcTEncTop[nCurLayer]->getSourceHeight() 361 1.0 * m_ppcTEncTop[nCurLayer]->getSourceWidth() * m_ppcTEncTop[nCurLayer]->getSourceHeight() 362 362 / m_ppcTEncTop[nCurLayer-1]->getSourceWidth() / m_ppcTEncTop[nCurLayer-1]->getSourceHeight() ); 363 363 dLambda *= gamma; … … 392 392 #endif 393 393 394 #if RDOQ_CHROMA_LAMBDA 394 #if RDOQ_CHROMA_LAMBDA 395 395 // for RDOQ 396 m_pcTrQuant->setLambda( dLambda, dLambda / weight ); 396 m_pcTrQuant->setLambda( dLambda, dLambda / weight ); 397 397 #else 398 398 m_pcTrQuant->setLambda( dLambda ); … … 401 401 #if SAO_CHROMA_LAMBDA 402 402 // For SAO 403 rpcSlice ->setLambda( dLambda, dLambda / weight ); 403 rpcSlice ->setLambda( dLambda, dLambda / weight ); 404 404 #else 405 405 rpcSlice ->setLambda( dLambda ); 406 406 #endif 407 407 408 408 #if HB_LAMBDA_FOR_LDC 409 409 // restore original slice type 410 410 eSliceType = (pocLast == 0 || pocCurr % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType; 411 411 412 412 #if SVC_EXTENSION 413 413 if(m_pcCfg->getLayerId() > 0) … … 418 418 rpcSlice->setSliceType ( eSliceType ); 419 419 #endif 420 420 421 421 if (m_pcCfg->getUseRecalculateQPAccordingToLambda()) 422 422 { 423 423 dQP = xGetQPValueAccordingToLambda( dLambda ); 424 424 #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 ) ) ); 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 ) ) ); 428 428 #endif 429 429 } … … 438 438 rpcSlice->setNumRefIdx(REF_PIC_LIST_0,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive); 439 439 rpcSlice->setNumRefIdx(REF_PIC_LIST_1,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive); 440 440 441 441 if ( m_pcCfg->getDeblockingFilterMetric() ) 442 442 { … … 479 479 480 480 rpcSlice->setDepth ( depth ); 481 481 482 482 pcPic->setTLayer( m_pcCfg->getGOPEntry(iGOPid).m_temporalId ); 483 483 #if TEMP_SCALABILITY_FIX … … 493 493 assert( m_apcPicYuvPred ); 494 494 assert( m_apcPicYuvResi ); 495 495 496 496 pcPic->setPicYuvPred( m_apcPicYuvPred ); 497 497 pcPic->setPicYuvResi( m_apcPicYuvResi ); … … 557 557 #endif 558 558 559 #if RDOQ_CHROMA_LAMBDA 559 #if RDOQ_CHROMA_LAMBDA 560 560 // for RDOQ 561 561 m_pcTrQuant->setLambda( lambda, lambda / weight ); … … 665 665 #endif 666 666 667 #if RDOQ_CHROMA_LAMBDA 667 #if RDOQ_CHROMA_LAMBDA 668 668 // for RDOQ 669 m_pcTrQuant->setLambda( lambda, lambda / weight ); 669 m_pcTrQuant->setLambda( lambda, lambda / weight ); 670 670 #else 671 671 m_pcTrQuant->setLambda( lambda ); … … 674 674 #if SAO_CHROMA_LAMBDA 675 675 // For SAO 676 pcSlice ->setLambda( lambda, lambda / weight ); 676 pcSlice ->setLambda( lambda, lambda / weight ); 677 677 #else 678 678 pcSlice ->setLambda( lambda ); … … 692 692 Int iMaxSR = m_pcCfg->getSearchRange(); 693 693 Int iNumPredDir = pcSlice->isInterP() ? 1 : 2; 694 694 695 695 for (Int iDir = 0; iDir <= iNumPredDir; iDir++) 696 696 { … … 726 726 } 727 727 #endif 728 728 729 729 TComSlice* pcSlice = rpcPic->getSlice(getSliceIdx()); 730 730 Double dPicRdCostBest = MAX_DOUBLE; 731 731 UInt uiQpIdxBest = 0; 732 732 733 733 Double dFrameLambda; 734 734 #if FULL_NBIT … … 737 737 Int SHIFT_QP = 12; 738 738 #endif 739 739 740 740 // set frame lambda 741 741 if (m_pcCfg->getGOPSize() > 1) … … 748 748 } 749 749 m_pcRdCost ->setFrameLambda(dFrameLambda); 750 750 751 751 // for each QP candidate 752 752 for ( UInt uiQpIdx = 0; uiQpIdx < 2 * m_pcCfg->getDeltaQpRD() + 1; uiQpIdx++ ) … … 776 776 #endif 777 777 778 #if RDOQ_CHROMA_LAMBDA 778 #if RDOQ_CHROMA_LAMBDA 779 779 // for RDOQ 780 780 m_pcTrQuant ->setLambda( m_pdRdPicLambda[uiQpIdx], m_pdRdPicLambda[uiQpIdx] / weight ); … … 784 784 #if SAO_CHROMA_LAMBDA 785 785 // For SAO 786 pcSlice ->setLambda ( m_pdRdPicLambda[uiQpIdx], m_pdRdPicLambda[uiQpIdx] / weight ); 786 pcSlice ->setLambda ( m_pdRdPicLambda[uiQpIdx], m_pdRdPicLambda[uiQpIdx] / weight ); 787 787 #else 788 788 pcSlice ->setLambda ( m_pdRdPicLambda[uiQpIdx] ); 789 789 #endif 790 790 791 791 // try compress 792 792 compressSlice ( rpcPic ); 793 793 794 794 Double dPicRdCost; 795 795 UInt64 uiPicDist = m_uiPicDist; 796 796 UInt64 uiALFBits = 0; 797 797 798 798 m_pcGOPEncoder->preLoopFilterPicAll( rpcPic, uiPicDist, uiALFBits ); 799 799 800 800 // compute RD cost and choose the best 801 801 dPicRdCost = m_pcRdCost->calcRdCost64( m_uiPicTotalBits + uiALFBits, uiPicDist, true, DF_SSE_FRAME); 802 802 803 803 if ( dPicRdCost < dPicRdCostBest ) 804 804 { … … 807 807 } 808 808 } 809 809 810 810 // set best values 811 811 pcSlice ->setSliceQp ( m_piRdPicQp [uiQpIdxBest] ); … … 832 832 #endif 833 833 834 #if RDOQ_CHROMA_LAMBDA 835 // for RDOQ 836 m_pcTrQuant ->setLambda( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight ); 834 #if RDOQ_CHROMA_LAMBDA 835 // for RDOQ 836 m_pcTrQuant ->setLambda( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight ); 837 837 #else 838 838 m_pcTrQuant ->setLambda ( m_pdRdPicLambda[uiQpIdxBest] ); … … 840 840 #if SAO_CHROMA_LAMBDA 841 841 // For SAO 842 pcSlice ->setLambda ( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight ); 842 pcSlice ->setLambda ( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight ); 843 843 #else 844 844 pcSlice ->setLambda ( m_pdRdPicLambda[uiQpIdxBest] ); … … 862 862 863 863 UInt uiEncCUOrder; 864 uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 864 uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 865 865 for( uiEncCUOrder = uiStartCUAddr/rpcPic->getNumPartInCU(); 866 866 uiEncCUOrder < (uiBoundingCUAddr+(rpcPic->getNumPartInCU()-1))/rpcPic->getNumPartInCU(); … … 898 898 TComSlice* pcSlice = rpcPic->getSlice(getSliceIdx()); 899 899 xDetermineStartAndBoundingCUAddr ( uiStartCUAddr, uiBoundingCUAddr, rpcPic, false ); 900 900 901 901 // initialize cost values 902 902 m_uiPicTotalBits = 0; 903 903 m_dPicRdCost = 0; 904 904 m_uiPicDist = 0; 905 905 906 906 // set entropy coder 907 907 if( m_pcCfg->getUseSBACRD() ) … … 921 921 m_pcEntropyCoder->setBitstream ( m_pcBitCounter ); 922 922 } 923 923 924 924 //------------------------------------------------------------------------------ 925 925 // Weighted Prediction parameters estimation. … … 930 930 xCalcACDCParamSlice(pcSlice); 931 931 } 932 #if O0194_WEIGHTED_PREDICTION_CGS 933 else{ 934 // Calculate for the base layer to be used in EL as Inter layer reference 935 xCalcACDCParamSlice(pcSlice); 936 wpACDCParam * temp_weightACDCParam; 937 938 pcSlice->getWpAcDcParam(temp_weightACDCParam); 939 g_refWeightACDCParam = (void *) temp_weightACDCParam; 940 } 941 #endif 932 942 933 943 Bool bWp_explicit = (pcSlice->getSliceType()==P_SLICE && pcSlice->getPPS()->getUseWP()) || (pcSlice->getSliceType()==B_SLICE && pcSlice->getPPS()->getWPBiPred()); … … 1021 1031 m_pcBufferSbacCoders[uiTileCol].loadContexts( CTXMem[1] ); 1022 1032 Int iNumSubstreamsPerTile = iNumSubstreams/rpcPic->getPicSym()->getNumTiles(); 1023 uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 1033 uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 1024 1034 uiLin = uiCUAddr / uiWidthInLCUs; 1025 1035 uiSubStrm = rpcPic->getPicSym()->getTileIdxMap(rpcPic->getPicSym()->getCUOrderMap(uiCUAddr))*iNumSubstreamsPerTile … … 1098 1108 pcCUTR = rpcPic->getCU( uiCUAddr - uiWidthInCU + 1 ); 1099 1109 } 1100 if ( ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) || 1110 if ( ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) || 1101 1111 (pcCUTR->getSCUAddr()+uiMaxParts-1 < pcSlice->getSliceCurStartCUAddr()) || 1102 1112 ((rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(uiCUAddr))) … … 1137 1147 m_pcEntropyCoder->setEntropyCoder ( m_pcRDGoOnSbacCoder, pcSlice ); 1138 1148 m_pcEntropyCoder->setBitstream( &pcBitCounters[uiSubStrm] ); 1139 1149 1140 1150 ((TEncBinCABAC*)m_pcRDGoOnSbacCoder->getEncBinIf())->setBinCountingEnableFlag(true); 1141 1151 … … 1242 1252 m_pcRdCost->setLambda(oldLambda); 1243 1253 #if RATE_CONTROL_INTRA 1244 m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 1254 m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 1245 1255 pcCU->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() ); 1246 1256 #else … … 1250 1260 #endif 1251 1261 #endif 1252 1262 1253 1263 // restore entropy coder to an initial stage 1254 1264 m_pcEntropyCoder->setEntropyCoder ( m_pppcRDSbacCoder[0][CI_CURR_BEST], pcSlice ); … … 1275 1285 { 1276 1286 ppppcRDSbacCoders[uiSubStrm][0][CI_CURR_BEST]->load( m_pppcRDSbacCoder[0][CI_CURR_BEST] ); 1277 1287 1278 1288 //Store probabilties of second LCU in line into buffer 1279 1289 if ( ( uiCol == uiTileLCUX+1) && (depSliceSegmentsEnabled || (pcSlice->getPPS()->getNumSubstreams() > 1)) && m_pcCfg->getWaveFrontsynchro()) … … 1325 1335 1326 1336 #if RATE_CONTROL_INTRA 1327 m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 1337 m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 1328 1338 pcCU->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() ); 1329 1339 #else … … 1350 1360 } 1351 1361 } 1352 1362 1353 1363 m_uiPicTotalBits += pcCU->getTotalBits(); 1354 1364 m_dPicRdCost += pcCU->getTotalCost(); … … 1401 1411 m_pcEntropyCoder->setEntropyCoder ( m_pcSbacCoder, pcSlice ); 1402 1412 } 1403 1413 1404 1414 m_pcCuEncoder->setBitCounter( NULL ); 1405 1415 m_pcBitCounter = NULL; … … 1427 1437 m_pcBufferSbacCoders[ui].load(m_pcSbacCoder); //init. state 1428 1438 } 1429 1439 1430 1440 for (Int iSubstrmIdx=0; iSubstrmIdx < iNumSubstreams; iSubstrmIdx++) 1431 1441 { … … 1524 1534 } 1525 1535 if ( (true/*bEnforceSliceRestriction*/ && 1526 ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) || 1536 ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) || 1527 1537 (pcCUTR->getSCUAddr()+uiMaxParts-1 < pcSlice->getSliceCurStartCUAddr()) || 1528 1538 ((rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(uiCUAddr))) … … 1579 1589 } 1580 1590 1581 TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr ); 1591 TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr ); 1582 1592 if ( pcSlice->getSPS()->getUseSAO() && (pcSlice->getSaoEnabledFlag()||pcSlice->getSaoEnabledFlagChroma()) ) 1583 1593 { … … 1613 1623 if (allowMergeLeft) 1614 1624 { 1615 m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoMerge(mergeLeft); 1625 m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoMerge(mergeLeft); 1616 1626 } 1617 1627 else … … 1676 1686 #if ENC_DEC_TRACE 1677 1687 g_bJustDoIt = g_bEncDecTraceDisable; 1678 #endif 1688 #endif 1679 1689 if( m_pcCfg->getUseSBACRD() ) 1680 1690 { 1681 1691 pcSbacCoders[uiSubStrm].load(m_pcSbacCoder); //load back status of the entropy coder after encoding the LCU into relevant bitstream entropy coder 1682 1692 1683 1693 1684 1694 //Store probabilties of second LCU in line into buffer … … 1733 1743 UInt uiNumberOfCUsInFrame = rpcPic->getNumCUsInFrame(); 1734 1744 uiBoundingCUAddrSlice = uiNumberOfCUsInFrame; 1735 if (bEncodeSlice) 1745 if (bEncodeSlice) 1736 1746 { 1737 1747 UInt uiCUAddrIncrement; … … 1769 1779 uiBoundingCUAddrSlice = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU(); 1770 1780 break; 1771 } 1781 } 1772 1782 // WPP: if a slice does not start at the beginning of a CTB row, it must end within the same CTB row 1773 1783 if (pcSlice->getPPS()->getNumSubstreams() > 1 && (uiStartCUAddrSlice % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0)) … … 1809 1819 uiBoundingCUAddrSlice = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU(); 1810 1820 break; 1811 } 1821 } 1812 1822 // WPP: if a slice does not start at the beginning of a CTB row, it must end within the same CTB row 1813 1823 if (pcSlice->getPPS()->getNumSubstreams() > 1 && (uiStartCUAddrSlice % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0)) … … 1819 1829 1820 1830 Bool tileBoundary = false; 1821 if ((m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_BYTES) && 1831 if ((m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_BYTES) && 1822 1832 (m_pcCfg->getNumRowsMinus1() > 0 || m_pcCfg->getNumColumnsMinus1() > 0)) 1823 1833 { … … 1832 1842 } 1833 1843 tileBoundingCUAddrSlice = lcuEncAddr*rpcPic->getNumPartInCU(); 1834 1844 1835 1845 if (tileBoundingCUAddrSlice < uiBoundingCUAddrSlice) 1836 1846 { … … 1845 1855 startCUAddrSliceSegment = pcSlice->getSliceSegmentCurStartCUAddr(); 1846 1856 boundingCUAddrSliceSegment = uiNumberOfCUsInFrame; 1847 if (bEncodeSlice) 1857 if (bEncodeSlice) 1848 1858 { 1849 1859 UInt uiCUAddrIncrement; … … 1880 1890 boundingCUAddrSliceSegment = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU(); 1881 1891 break; 1882 } 1892 } 1883 1893 // WPP: if a slice segment does not start at the beginning of a CTB row, it must end within the same CTB row 1884 1894 if (pcSlice->getPPS()->getNumSubstreams() > 1 && (startCUAddrSliceSegment % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0)) … … 1919 1929 boundingCUAddrSliceSegment = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU(); 1920 1930 break; 1921 } 1931 } 1922 1932 // WPP: if a slice segment does not start at the beginning of a CTB row, it must end within the same CTB row 1923 1933 if (pcSlice->getPPS()->getNumSubstreams() > 1 && (startCUAddrSliceSegment % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0)) … … 1927 1937 pcSlice->setSliceSegmentCurEndCUAddr( boundingCUAddrSliceSegment ); 1928 1938 } 1929 if ((m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_BYTES) && 1939 if ((m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_BYTES) && 1930 1940 (m_pcCfg->getNumRowsMinus1() > 0 || m_pcCfg->getNumColumnsMinus1() > 0)) 1931 1941 { … … 1979 1989 } 1980 1990 UInt uiRealStartAddress = rpcPic->getPicSym()->getPicSCUEncOrder(uiExternalAddress*rpcPic->getNumPartInCU()+uiInternalAddress); 1981 1991 1982 1992 pcSlice->setSliceSegmentCurStartCUAddr(uiRealStartAddress); 1983 1993 startCUAddrSliceSegment=uiRealStartAddress; 1984 1994 1985 1995 //calculate real slice start address 1986 1996 uiInternalAddress = rpcPic->getPicSym()->getPicSCUAddr(pcSlice->getSliceCurStartCUAddr()) % rpcPic->getNumPartInCU(); … … 2007 2017 } 2008 2018 uiRealStartAddress = rpcPic->getPicSym()->getPicSCUEncOrder(uiExternalAddress*rpcPic->getNumPartInCU()+uiInternalAddress); 2009 2019 2010 2020 pcSlice->setSliceCurStartCUAddr(uiRealStartAddress); 2011 2021 uiStartCUAddrSlice=uiRealStartAddress; 2012 2022 2013 2023 // Make a joint decision based on reconstruction and dependent slice bounds 2014 2024 startCUAddr = max(uiStartCUAddrSlice , startCUAddrSliceSegment ); … … 2022 2032 if ( (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU) 2023 2033 || (m_pcCfg->getSliceMode()==0 && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU) 2024 || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==0) 2034 || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==0) 2025 2035 || (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) 2036 || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceSegmentMode()==0) 2027 2037 || (m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceMode()==0) 2028 2038 || tileBoundary -
branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncTop.cpp
r460 r466 88 88 m_bMFMEnabledFlag = false; 89 89 #endif 90 #if SCALED_REF_LAYER_OFFSETS 90 91 m_numScaledRefLayerOffsets = 0; 92 #endif 93 #endif 91 94 #if POC_RESET_FLAG 92 95 m_pocAdjustmentValue = 0; 93 96 #endif 94 #endif //SVC_EXTENSION95 97 } 96 98 … … 173 175 } 174 176 } 175 176 #if LAYER_CTB177 memcpy(g_auiLayerZscanToRaster[m_layerId], g_auiZscanToRaster, sizeof( g_auiZscanToRaster ) );178 memcpy(g_auiLayerRasterToZscan[m_layerId], g_auiRasterToZscan, sizeof( g_auiRasterToZscan ) );179 memcpy(g_auiLayerRasterToPelX[m_layerId], g_auiRasterToPelX, sizeof( g_auiRasterToPelX ) );180 memcpy(g_auiLayerRasterToPelY[m_layerId], g_auiRasterToPelY, sizeof( g_auiRasterToPelY ) );181 #endif182 177 } 183 178 … … 876 871 #if SVC_EXTENSION 877 872 m_cSPS.setLayerId(m_layerId); 873 #endif 878 874 #if REF_IDX_MFM 879 875 #if !M0457_COL_PICTURE_SIGNALING … … 881 877 #endif 882 878 #endif 879 #if SCALED_REF_LAYER_OFFSETS 883 880 m_cSPS.setNumScaledRefLayerOffsets(m_numScaledRefLayerOffsets); 884 881 for(Int i = 0; i < m_cSPS.getNumScaledRefLayerOffsets(); i++) … … 886 883 m_cSPS.getScaledRefLayerWindow(i) = m_scaledRefLayerWindow[i]; 887 884 } 888 #endif //SVC_EXTENSION885 #endif 889 886 ProfileTierLevel& profileTierLevel = *m_cSPS.getPTL()->getGeneralPTL(); 890 887 profileTierLevel.setLevelIdc(m_level); -
branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncTop.h
r460 r466 140 140 Int m_ilSampleOnlyPred; 141 141 #endif 142 #if SCALED_REF_LAYER_OFFSETS 142 143 UInt m_numScaledRefLayerOffsets; 143 144 Window m_scaledRefLayerWindow[MAX_LAYERS]; 145 #endif 144 146 #if POC_RESET_FLAG 145 147 Int m_pocAdjustmentValue; 146 148 #endif 147 #endif //SVC_EXTENSION149 #endif 148 150 protected: 149 151 Void xGetNewPicBuffer ( TComPic*& rpcPic ); ///< get picture buffer which will be processed … … 207 209 Int getNumPicRcvd () { return m_iNumPicRcvd; } 208 210 Void setNumPicRcvd ( Int num ) { m_iNumPicRcvd = num; } 211 #if SCALED_REF_LAYER_OFFSETS 209 212 Void setNumScaledRefLayerOffsets(Int x) { m_numScaledRefLayerOffsets = x; } 210 213 UInt getNumScaledRefLayerOffsets() { return m_numScaledRefLayerOffsets; } 211 214 Window& getScaledRefLayerWindow(Int x) { return m_scaledRefLayerWindow[x]; } 212 #endif //SVC_EXTENSION 215 #endif 216 #endif 213 217 214 218 // ------------------------------------------------------------------------------------------------------------------- -
branches/SHM-4.0-dev/source/Lib/TLibEncoder/WeightPredAnalysis.cpp
r313 r466 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 if (slice->getRefPic(eRefPicList, refIdxTemp)->isILR(1)){ 235 refWeightACDCParam = (wpACDCParam *)g_refWeightACDCParam; 236 } 237 #endif 218 238 219 239 for ( Int comp = 0; comp < 3; comp++ ) … … 229 249 Int64 refDC = refWeightACDCParam[comp].iDC; 230 250 Int64 refAC = refWeightACDCParam[comp].iAC; 251 #if O0194_WEIGHTED_PREDICTION_CGS 252 if (slice->getRefPic(eRefPicList, refIdxTemp)->isILR(1)){ 253 refAC *= (double)currWeightACDCParam[comp].iSamples/refWeightACDCParam[comp].iSamples; 254 #if O0194_JOINT_US_BITSHIFT 255 refAC *= (1<<(g_bitDepthYLayer[1]-g_bitDepthYLayer[0])); 256 refDC *= (1<<(g_bitDepthYLayer[1]-g_bitDepthYLayer[0])); 257 #endif 258 } 259 #endif 231 260 232 261 // calculating iWeight and iOffset params … … 234 263 Int weight = (Int)( 0.5 + dWeight * (Double)(1<<log2Denom) ); 235 264 Int offset = (Int)( ((currDC<<log2Denom) - ((Int64)weight * refDC) + (Int64)realOffset) >> realLog2Denom ); 265 #if O0194_WEIGHTED_PREDICTION_CGS 266 if (slice->getRefPic(eRefPicList, refIdxTemp)->isILR(1)){ 267 } 268 else{ 269 dWeight = 1; 270 offset = 0; 271 } 272 weight = (Int)( 0.5 + dWeight * (Double)(1<<log2Denom) ); 273 #endif 236 274 237 275 // Chroma offset range limitation … … 253 291 if(deltaWeight > 127 || deltaWeight < -128) 254 292 return (false); 293 #if O0194_WEIGHTED_PREDICTION_CGS 294 // make sure the reference frames other than ILR are not using weighted prediction 295 if (!(slice->getRefPic(eRefPicList, refIdxTemp)->isILR(1))){ 296 continue; 297 } 298 #endif 255 299 256 300 m_wp[refList][refIdxTemp][comp].bPresentFlag = true; … … 264 308 } 265 309 266 /** select whether weighted pred enables or not. 310 /** select whether weighted pred enables or not. 267 311 * \param TComSlice *slice 268 312 * \param wpScalingParam … … 325 369 } 326 370 327 /** calculate DC value of original image for luma. 371 /** calculate DC value of original image for luma. 328 372 * \param TComSlice *slice 329 373 * \param Pel *pPel … … 345 389 } 346 390 347 /** calculate AC value of original image for luma. 391 /** calculate AC value of original image for luma. 348 392 * \param TComSlice *slice 349 393 * \param Pel *pPel … … 363 407 } 364 408 365 /** calculate DC value of original image for chroma. 409 /** calculate DC value of original image for chroma. 366 410 * \param TComSlice *slice 367 411 * \param Pel *pPel … … 383 427 } 384 428 385 /** calculate AC value of original image for chroma. 429 /** calculate AC value of original image for chroma. 386 430 * \param TComSlice *slice 387 431 * \param Pel *pPel … … 401 445 } 402 446 403 /** calculate DC value. 447 /** calculate DC value. 404 448 * \param Pel *pPel 405 449 * \param Int iWidth … … 423 467 } 424 468 425 /** calculate AC value. 469 /** calculate AC value. 426 470 * \param Pel *pPel 427 471 * \param Int iWidth … … 446 490 } 447 491 448 /** calculate SAD values for both WP version and non-WP version. 492 /** calculate SAD values for both WP version and non-WP version. 449 493 * \param Pel *pOrgPel 450 494 * \param Pel *pRefPel
Note: See TracChangeset for help on using the changeset viewer.