Changeset 1279 in 3DVCSoftware for branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComPrediction.cpp
- Timestamp:
- 15 Jul 2015, 14:57:32 (9 years ago)
- Location:
- branches/HTM-14.1-update-dev1
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-14.1-update-dev1
-
branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComPrediction.cpp
r1243 r1279 82 82 } 83 83 } 84 #if H_3D_VSP85 m_pDepthBlock = (Int*) malloc(MAX_NUM_ SPU_W*MAX_NUM_SPU_W*sizeof(Int));84 #if NH_3D_VSP 85 m_pDepthBlock = (Int*) malloc(MAX_NUM_PART_IDXS_IN_CTU_WIDTH*MAX_NUM_PART_IDXS_IN_CTU_WIDTH*sizeof(Int)); 86 86 if (m_pDepthBlock == NULL) 87 87 { … … 94 94 TComPrediction::~TComPrediction() 95 95 { 96 #if H_3D_VSP96 #if NH_3D_VSP 97 97 if (m_pDepthBlock != NULL) 98 98 { … … 123 123 m_cYuvPredTemp.destroy(); 124 124 125 #if H_3D_ARP125 #if NH_3D_ARP 126 126 m_acYuvPredBase[0].destroy(); 127 127 m_acYuvPredBase[1].destroy(); … … 182 182 183 183 m_cYuvPredTemp.create( MAX_CU_SIZE, MAX_CU_SIZE, chromaFormatIDC ); 184 #if H_3D_ARP185 m_acYuvPredBase[0] .create( g_uiMaxCUWidth, g_uiMaxCUHeight);186 m_acYuvPredBase[1] .create( g_uiMaxCUWidth, g_uiMaxCUHeight);187 #endif 188 #if H_3D_VSP189 m_cYuvDepthOnVsp.create( g_uiMaxCUWidth, g_uiMaxCUHeight);184 #if NH_3D_ARP 185 m_acYuvPredBase[0] .create( MAX_CU_SIZE, MAX_CU_SIZE, chromaFormatIDC ); 186 m_acYuvPredBase[1] .create( MAX_CU_SIZE, MAX_CU_SIZE, chromaFormatIDC ); 187 #endif 188 #if NH_3D_VSP 189 m_cYuvDepthOnVsp.create( MAX_CU_SIZE, MAX_CU_SIZE, chromaFormatIDC ); 190 190 #endif 191 191 … … 201 201 } 202 202 } 203 #if H_3D_IC203 #if NH_3D_IC 204 204 m_uiaShift[0] = 0; 205 205 for( Int i = 1; i < 64; i++ ) … … 584 584 Int RefPOCL0 = pcCU->getSlice()->getRefPic(REF_PIC_LIST_0, pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr))->getPOC(); 585 585 Int RefPOCL1 = pcCU->getSlice()->getRefPic(REF_PIC_LIST_1, pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr))->getPOC(); 586 #if H_3D_ARP586 #if NH_3D_ARP 587 587 if(!pcCU->getARPW(PartAddr) && RefPOCL0 == RefPOCL1 && pcCU->getCUMvField(REF_PIC_LIST_0)->getMv(PartAddr) == pcCU->getCUMvField(REF_PIC_LIST_1)->getMv(PartAddr)) 588 588 #else … … 597 597 } 598 598 599 #if H_3D_SPIVMP599 #if NH_3D_SPIVMP 600 600 Void TComPrediction::xGetSubPUAddrAndMerge(TComDataCU* pcCU, UInt uiPartAddr, Int iSPWidth, Int iSPHeight, Int iNumSPInOneLine, Int iNumSP, UInt* uiMergedSPW, UInt* uiMergedSPH, UInt* uiSPAddr ) 601 601 { … … 606 606 pcCU->getSPAbsPartIdx(uiPartAddr, iSPWidth, iSPHeight, i, iNumSPInOneLine, uiSPAddr[i]); 607 607 } 608 #if H_3D_ARP // check this! 608 609 if( pcCU->getARPW( uiPartAddr ) != 0 ) 609 610 { 610 611 return; 611 612 } 613 #endif 612 614 613 615 // horizontal sub-PU merge … … 683 685 #endif 684 686 685 #if H_3D_DBBP687 #if NH_3D_DBBP 686 688 PartSize TComPrediction::getPartitionSizeFromDepth(Pel* pDepthPels, UInt uiDepthStride, UInt uiSize, TComDataCU*& pcCU) 687 689 { 690 const TComSPS* sps = pcCU->getSlice()->getSPS(); 691 UInt uiMaxCUWidth = sps->getMaxCUWidth(); 692 UInt uiMaxCUHeight = sps->getMaxCUHeight(); 693 688 694 // find virtual partitioning for this CU based on depth block 689 695 // segmentation of texture block --> mask IDs … … 693 699 Int iSumDepth = 0; 694 700 Int iSubSample = 4; 695 Int iPictureWidth = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getWidth( );696 Int iPictureHeight = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getHeight( );701 Int iPictureWidth = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getWidth(COMPONENT_Y); 702 Int iPictureHeight = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getHeight(COMPONENT_Y); 697 703 TComMv cDv = pcCU->getSlice()->getDepthRefinementFlag( ) ? pcCU->getDvInfo(0).m_acDoNBDV : pcCU->getDvInfo(0).m_acNBDV; 698 704 if( pcCU->getSlice()->getDepthRefinementFlag( ) ) … … 700 706 cDv.setVer(0); 701 707 } 702 Int iBlkX = ( pcCU->get Addr() % pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getFrameWidthInCU() ) * g_uiMaxCUWidth + g_auiRasterToPelX[ g_auiZscanToRaster[ pcCU->getZorderIdxInCU() ] ]+ ((cDv.getHor()+2)>>2);703 Int iBlkY = ( pcCU->get Addr() / pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ pcCU->getZorderIdxInCU() ] ]+ ((cDv.getVer()+2)>>2);708 Int iBlkX = ( pcCU->getCtuRsAddr() % pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getFrameWidthInCtus() ) * uiMaxCUWidth + g_auiRasterToPelX[ g_auiZscanToRaster[ pcCU->getZorderIdxInCtu() ] ]+ ((cDv.getHor()+2)>>2); 709 Int iBlkY = ( pcCU->getCtuRsAddr() / pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getFrameWidthInCtus() ) * uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ pcCU->getZorderIdxInCtu() ] ]+ ((cDv.getVer()+2)>>2); 704 710 705 711 UInt t=0; … … 788 794 } 789 795 790 PartSize matchedPartSize = SIZE_NONE;796 PartSize matchedPartSize = NUMBER_OF_PART_SIZES; 791 797 792 798 Int iMaxMatchSum = 0; … … 803 809 } 804 810 805 AOF( matchedPartSize != SIZE_NONE);811 AOF( matchedPartSize != NUMBER_OF_PART_SIZES ); 806 812 807 813 return matchedPartSize; … … 810 816 Bool TComPrediction::getSegmentMaskFromDepth( Pel* pDepthPels, UInt uiDepthStride, UInt uiWidth, UInt uiHeight, Bool* pMask, TComDataCU*& pcCU) 811 817 { 818 const TComSPS* sps = pcCU->getSlice()->getSPS(); 819 UInt uiMaxCUWidth = sps->getMaxCUWidth(); 820 UInt uiMaxCUHeight = sps->getMaxCUHeight(); 821 812 822 // segmentation of texture block --> mask IDs 813 823 Pel* pDepthBlockStart = pDepthPels; … … 821 831 iSumDepth = pDepthPels[ 0 ]; 822 832 823 Int iPictureWidth = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getWidth( );824 Int iPictureHeight = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getHeight( );833 Int iPictureWidth = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getWidth(COMPONENT_Y); 834 Int iPictureHeight = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getHeight(COMPONENT_Y); 825 835 TComMv cDv = pcCU->getSlice()->getDepthRefinementFlag( ) ? pcCU->getDvInfo(0).m_acDoNBDV : pcCU->getDvInfo(0).m_acNBDV; 826 836 if( pcCU->getSlice()->getDepthRefinementFlag( ) ) … … 828 838 cDv.setVer(0); 829 839 } 830 Int iBlkX = ( pcCU->get Addr() % pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getFrameWidthInCU() ) * g_uiMaxCUWidth + g_auiRasterToPelX[ g_auiZscanToRaster[ pcCU->getZorderIdxInCU() ] ]+ ((cDv.getHor()+2)>>2);831 Int iBlkY = ( pcCU->get Addr() / pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ pcCU->getZorderIdxInCU() ] ]+ ((cDv.getVer()+2)>>2);840 Int iBlkX = ( pcCU->getCtuRsAddr() % pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getFrameWidthInCtus() ) * uiMaxCUWidth + g_auiRasterToPelX[ g_auiZscanToRaster[ pcCU->getZorderIdxInCtu() ] ]+ ((cDv.getHor()+2)>>2); 841 Int iBlkY = ( pcCU->getCtuRsAddr() / pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getFrameWidthInCtus() ) * uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ pcCU->getZorderIdxInCtu() ] ]+ ((cDv.getVer()+2)>>2); 832 842 if (iBlkX>(Int)(iPictureWidth - uiWidth)) 833 843 { … … 944 954 } 945 955 946 Void TComPrediction::combineSegmentsWithMask( TComYuv* pInYuv[2], TComYuv* pOutYuv, Bool* pMask, UInt uiWidth, UInt uiHeight, UInt uiPartAddr, UInt partSize )947 { 948 Pel* piSrc[2] = {pInYuv[0]->get LumaAddr(uiPartAddr), pInYuv[1]->getLumaAddr(uiPartAddr)};949 UInt uiSrcStride = pInYuv[0]->getStride( );950 Pel* piDst = pOutYuv->get LumaAddr(uiPartAddr);951 UInt uiDstStride = pOutYuv->getStride( );956 Void TComPrediction::combineSegmentsWithMask( TComYuv* pInYuv[2], TComYuv* pOutYuv, Bool* pMask, UInt uiWidth, UInt uiHeight, UInt uiPartAddr, UInt partSize, Int bitDepthY ) 957 { 958 Pel* piSrc[2] = {pInYuv[0]->getAddr(COMPONENT_Y, uiPartAddr), pInYuv[1]->getAddr(COMPONENT_Y, uiPartAddr)}; 959 UInt uiSrcStride = pInYuv[0]->getStride(COMPONENT_Y); 960 Pel* piDst = pOutYuv->getAddr(COMPONENT_Y, uiPartAddr); 961 UInt uiDstStride = pOutYuv->getStride(COMPONENT_Y); 952 962 953 963 UInt uiMaskStride= MAX_CU_SIZE; … … 988 998 right = (x==uiWidth-1) ? tmpTar[y*uiWidth+x] : tmpTar[y*uiWidth+x+1]; 989 999 990 piDst[x] = (l!=r) ? Clip Y( Pel(( left + (tmpTar[y*uiWidth+x] << 1) + right ) >> 2 )) : tmpTar[y*uiWidth+x];1000 piDst[x] = (l!=r) ? ClipBD( Pel(( left + (tmpTar[y*uiWidth+x] << 1) + right ) >> 2 ), bitDepthY) : tmpTar[y*uiWidth+x]; 991 1001 } 992 1002 piDst += uiDstStride; … … 1006 1016 bottom = (y==uiHeight-1) ? tmpTar[y*uiWidth+x] : tmpTar[(y+1)*uiWidth+x]; 1007 1017 1008 piDst[x] = (t!=b) ? Clip Y( Pel(( top + (tmpTar[y*uiWidth+x] << 1) + bottom ) >> 2 )) : tmpTar[y*uiWidth+x];1018 piDst[x] = (t!=b) ? ClipBD( Pel(( top + (tmpTar[y*uiWidth+x] << 1) + bottom ) >> 2 ), bitDepthY) : tmpTar[y*uiWidth+x]; 1009 1019 } 1010 1020 piDst += uiDstStride; … … 1019 1029 1020 1030 // now combine chroma 1021 Pel* piSrcU[2] = { pInYuv[0]->get CbAddr(uiPartAddr), pInYuv[1]->getCbAddr(uiPartAddr) };1022 Pel* piSrcV[2] = { pInYuv[0]->get CrAddr(uiPartAddr), pInYuv[1]->getCrAddr(uiPartAddr) };1023 UInt uiSrcStrideC = pInYuv[0]->get CStride();1024 Pel* piDstU = pOutYuv->get CbAddr(uiPartAddr);1025 Pel* piDstV = pOutYuv->get CrAddr(uiPartAddr);1026 UInt uiDstStrideC = pOutYuv->get CStride();1031 Pel* piSrcU[2] = { pInYuv[0]->getAddr(COMPONENT_Cb, uiPartAddr), pInYuv[1]->getAddr(COMPONENT_Cb, uiPartAddr) }; 1032 Pel* piSrcV[2] = { pInYuv[0]->getAddr(COMPONENT_Cr, uiPartAddr), pInYuv[1]->getAddr(COMPONENT_Cr, uiPartAddr) }; 1033 UInt uiSrcStrideC = pInYuv[0]->getStride(COMPONENT_Cb); 1034 Pel* piDstU = pOutYuv->getAddr(COMPONENT_Cb, uiPartAddr); 1035 Pel* piDstV = pOutYuv->getAddr(COMPONENT_Cr, uiPartAddr); 1036 UInt uiDstStrideC = pOutYuv->getStride(COMPONENT_Cb); 1027 1037 UInt uiWidthC = uiWidth >> 1; 1028 1038 UInt uiHeightC = uiHeight >> 1; … … 1070 1080 if (l!=r) 1071 1081 { 1072 filSrcU = Clip C( Pel(( leftU + (tmpTarU[y*uiWidthC+x] << 1) + rightU ) >> 2 ));1073 filSrcV = Clip C( Pel(( leftV + (tmpTarV[y*uiWidthC+x] << 1) + rightV ) >> 2 ));1082 filSrcU = ClipBD( Pel(( leftU + (tmpTarU[y*uiWidthC+x] << 1) + rightU ) >> 2 ), bitDepthY); 1083 filSrcV = ClipBD( Pel(( leftV + (tmpTarV[y*uiWidthC+x] << 1) + rightV ) >> 2 ), bitDepthY); 1074 1084 } 1075 1085 else … … 1103 1113 if (t!=b) 1104 1114 { 1105 filSrcU = Clip C( Pel(( topU + (tmpTarU[y*uiWidthC+x] << 1) + bottomU ) >> 2 ));1106 filSrcV = Clip C( Pel(( topV + (tmpTarV[y*uiWidthC+x] << 1) + bottomV ) >> 2 ));1115 filSrcU = ClipBD( Pel(( topU + (tmpTarU[y*uiWidthC+x] << 1) + bottomU ) >> 2 ), bitDepthY); 1116 filSrcV = ClipBD( Pel(( topV + (tmpTarV[y*uiWidthC+x] << 1) + bottomV ) >> 2 ), bitDepthY); 1107 1117 } 1108 1118 else … … 1141 1151 { 1142 1152 pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight ); 1143 #if H_3D_VSP1153 #if NH_3D_VSP 1144 1154 if ( pcCU->getVSPFlag(uiPartAddr) == 0) 1145 1155 { 1146 1156 #endif 1147 if ( eRefPicList != REF_PIC_LIST_X ) 1148 { 1149 if( pcCU->getSlice()->getPPS()->getUseWP()) 1150 { 1151 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, true ); 1157 if ( eRefPicList != REF_PIC_LIST_X ) 1158 { 1159 if( pcCU->getSlice()->getPPS()->getUseWP()) 1160 { 1161 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, true ); 1162 } 1163 else 1164 { 1165 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred ); 1166 } 1167 if ( pcCU->getSlice()->getPPS()->getUseWP() ) 1168 { 1169 xWeightedPredictionUni( pcCU, pcYuvPred, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred ); 1170 } 1152 1171 } 1153 1172 else 1154 1173 { 1155 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred ); 1156 } 1157 if ( pcCU->getSlice()->getPPS()->getUseWP() ) 1158 { 1159 xWeightedPredictionUni( pcCU, pcYuvPred, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred ); 1160 } 1161 } 1162 else 1163 { 1164 #if H_3D_SPIVMP 1174 #if NH_3D_SPIVMP 1165 1175 if ( pcCU->getSPIVMPFlag(uiPartAddr)!=0) 1166 1176 { … … 1194 1204 { 1195 1205 #endif 1206 if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) ) 1207 { 1208 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred ); 1209 } 1210 else 1211 { 1212 xPredInterBi (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred ); 1213 } 1214 #if NH_3D_SPIVMP 1215 } 1216 #endif 1217 } 1218 #if NH_3D_VSP 1219 } 1220 else 1221 { 1196 1222 if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) ) 1197 1223 { 1198 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred );1224 xPredInterUniVSP( pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred ); 1199 1225 } 1200 1226 else 1201 1227 { 1202 xPredInterBi (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred ); 1203 } 1204 #if H_3D_SPIVMP 1205 } 1206 #endif 1207 } 1208 #if H_3D_VSP 1228 xPredInterBiVSP ( pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred ); 1229 } 1230 } 1231 #endif 1232 return; 1233 } 1234 1235 for ( iPartIdx = 0; iPartIdx < pcCU->getNumPartitions(); iPartIdx++ ) 1236 { 1237 pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight ); 1238 1239 #if NH_3D_VSP 1240 if ( pcCU->getVSPFlag(uiPartAddr) == 0 ) 1241 { 1242 #endif 1243 if ( eRefPicList != REF_PIC_LIST_X ) 1244 { 1245 if( pcCU->getSlice()->getPPS()->getUseWP()) 1246 { 1247 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, true ); 1248 } 1249 else 1250 { 1251 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred ); 1252 } 1253 if ( pcCU->getSlice()->getPPS()->getUseWP() ) 1254 { 1255 xWeightedPredictionUni( pcCU, pcYuvPred, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred ); 1256 } 1209 1257 } 1210 1258 else 1211 1259 { 1212 if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) ) 1213 { 1214 xPredInterUniVSP( pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred ); 1215 } 1216 else 1217 { 1218 xPredInterBiVSP ( pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred ); 1219 } 1220 } 1221 #endif 1222 return; 1223 } 1224 1225 for ( iPartIdx = 0; iPartIdx < pcCU->getNumPartitions(); iPartIdx++ ) 1226 { 1227 pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight ); 1228 1229 #if H_3D_VSP 1230 if ( pcCU->getVSPFlag(uiPartAddr) == 0 ) 1231 { 1232 #endif 1233 if ( eRefPicList != REF_PIC_LIST_X ) 1234 { 1235 if( pcCU->getSlice()->getPPS()->getUseWP()) 1236 { 1237 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, true ); 1238 } 1239 else 1240 { 1241 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred ); 1242 } 1243 if ( pcCU->getSlice()->getPPS()->getUseWP() ) 1244 { 1245 xWeightedPredictionUni( pcCU, pcYuvPred, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred ); 1246 } 1247 } 1248 else 1249 { 1250 #if H_3D_SPIVMP 1251 if (pcCU->getSPIVMPFlag(uiPartAddr)!=0) 1260 #if NH_3D_SPIVMP 1261 if (pcCU->getSPIVMPFlag(uiPartAddr)!=0) 1252 1262 { 1253 1263 Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight; … … 1279 1289 { 1280 1290 #endif 1281 if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) )1282 {1283 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred );1284 }1285 else1286 {1287 xPredInterBi (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred );1288 }1289 #if H_3D_SPIVMP1290 1291 #endif 1292 } 1293 #if H_3D_VSP1291 if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) ) 1292 { 1293 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred ); 1294 } 1295 else 1296 { 1297 xPredInterBi (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred ); 1298 } 1299 #if NH_3D_SPIVMP 1300 } 1301 #endif 1302 } 1303 #if NH_3D_VSP 1294 1304 } 1295 1305 else … … 1317 1327 pcCU->checkMvVertRest(cMv, eRefPicList, iRefIdx ); 1318 1328 #endif 1319 #if H_3D_ARP 1320 if(pcCU->getARPW( uiPartAddr ) > 0 && pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPOC()== pcCU->getSlice()->getPOC()) 1321 { 1322 xPredInterUniARPviewRef( pcCU , uiPartAddr , iWidth , iHeight , eRefPicList , rpcYuvPred , bi ); 1329 #if NH_3D_ARP 1330 if( pcCU->getARPW( uiPartAddr ) > 0 ) 1331 { 1332 if( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPOC()== pcCU->getSlice()->getPOC() ) 1333 { 1334 xPredInterUniARPviewRef( pcCU , uiPartAddr , iWidth , iHeight , eRefPicList , pcYuvPred , bi ); 1323 1335 } 1324 1336 else 1325 1337 { 1326 if( pcCU->getARPW( uiPartAddr ) > 0 1327 && pcCU->getPartitionSize(uiPartAddr)==SIZE_2Nx2N 1328 && pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPOC()!= pcCU->getSlice()->getPOC() 1329 ) 1330 { 1331 xPredInterUniARP( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, rpcYuvPred, bi ); 1338 xPredInterUniARP( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, bi ); 1339 } 1332 1340 } 1333 1341 else 1334 1342 { 1335 1343 #endif 1336 #if H_3D_IC 1337 Bool bICFlag = pcCU->getICFlag( uiPartAddr ) && ( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getViewIndex() != pcCU->getSlice()->getViewIndex() ); 1338 xPredInterLumaBlk ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi 1339 #if H_3D_ARP 1340 , false 1341 #endif 1342 , bICFlag ); 1343 bICFlag = bICFlag && (iWidth > 8); 1344 xPredInterChromaBlk( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi 1345 #if H_3D_ARP 1344 for (UInt comp=COMPONENT_Y; comp<pcYuvPred->getNumberValidComponents(); comp++) 1345 { 1346 const ComponentID compID=ComponentID(comp); 1347 #if NH_3D_IC 1348 Bool bICFlag = pcCU->getICFlag( uiPartAddr ) && ( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getViewIndex() != pcCU->getSlice()->getViewIndex() ) && ( isLuma(compID) || (iWidth > 8) ); 1349 xPredInterBlk(compID, pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, pcYuvPred, bi, pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)) 1350 #if NH_3D_ARP 1346 1351 , false 1347 1352 #endif 1348 1353 , bICFlag ); 1349 1354 #else 1350 1351 for (UInt comp=COMPONENT_Y; comp<pcYuvPred->getNumberValidComponents(); comp++)1352 {1353 const ComponentID compID=ComponentID(comp);1354 1355 xPredInterBlk (compID, pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, pcYuvPred, bi, pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)) ); 1355 } 1356 #endif 1357 #if H_3D_ARP 1358 } 1359 } 1360 #endif 1361 } 1362 1363 #if H_3D_VSP 1356 #endif 1357 } 1358 #if NH_3D_ARP 1359 } 1360 #endif 1361 } 1362 1363 #if NH_3D_VSP 1364 1364 Void TComPrediction::xPredInterUniVSP( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi ) 1365 1365 { … … 1382 1382 Void TComPrediction::xPredInterUniSubPU( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, Int widthSubPU, Int heightSubPU ) 1383 1383 { 1384 UInt numPartsInLine = pcCU->getPic()->getNumPartIn Width();1384 UInt numPartsInLine = pcCU->getPic()->getNumPartInCtuWidth(); 1385 1385 UInt horiNumPartsInSubPU = widthSubPU >> 2; 1386 1386 UInt vertNumPartsInSubPU = (heightSubPU >> 2) * numPartsInLine; … … 1398 1398 pcCU->clipMv(cMv); 1399 1399 1400 xPredInter LumaBlk ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, refIdx )->getPicYuvRec(), partAddrSubPU, &cMv, widthSubPU, heightSubPU, rpcYuvPred, bi);1401 xPredInter ChromaBlk( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, refIdx )->getPicYuvRec(), partAddrSubPU, &cMv, widthSubPU, heightSubPU, rpcYuvPred, bi);1402 1403 } 1404 } 1405 } 1406 1407 #endif 1408 1409 #if H_3D_ARP1410 Void TComPrediction::xPredInterUniARP( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi , TComMvField * pNewMvFiled)1411 { 1412 Int iRefIdx = p NewMvFiled ? pNewMvFiled->getRefIdx() : pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr );1413 TComMv cMv = p NewMvFiled ? pNewMvFiled->getMv() : pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr );1400 xPredInterBlk( COMPONENT_Y, pcCU, pcCU->getSlice()->getRefPic( eRefPicList, refIdx )->getPicYuvRec(), partAddrSubPU, &cMv, widthSubPU, heightSubPU, rpcYuvPred, bi, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) ); 1401 xPredInterBlk( COMPONENT_Cb, pcCU, pcCU->getSlice()->getRefPic( eRefPicList, refIdx )->getPicYuvRec(), partAddrSubPU, &cMv, widthSubPU, heightSubPU, rpcYuvPred, bi, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA) ); 1402 xPredInterBlk( COMPONENT_Cr, pcCU, pcCU->getSlice()->getRefPic( eRefPicList, refIdx )->getPicYuvRec(), partAddrSubPU, &cMv, widthSubPU, heightSubPU, rpcYuvPred, bi, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA) ); 1403 } 1404 } 1405 } 1406 #endif 1407 1408 #if NH_3D_ARP 1409 //temporal ARP 1410 Void TComPrediction::xPredInterUniARP( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi ) 1411 { 1412 Int iRefIdx = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr ); 1413 TComMv cMv = pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr ); 1414 1414 Bool bTobeScaled = false; 1415 1415 TComPic* pcPicYuvBaseCol = NULL; 1416 1416 TComPic* pcPicYuvBaseRef = NULL; 1417 1417 1418 #if H_3D_NBDV1418 #if NH_3D_NBDV 1419 1419 DisInfo cDistparity; 1420 1420 cDistparity.m_acNBDV = pcCU->getDvInfo(0).m_acNBDV; … … 1425 1425 UChar dW = pcCU->getARPW ( uiPartAddr ); 1426 1426 1427 {1428 1427 Int arpRefIdx = pcCU->getSlice()->getFirstTRefIdx(eRefPicList); 1429 if( dW > 0 && pcCU->getSlice()->getRefPic( eRefPicList, arpRefIdx )->getPOC()!= pcCU->getSlice()->getPOC() ) 1430 { 1431 bTobeScaled = true; 1432 } 1433 1434 pcPicYuvBaseCol = pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getPOC(), cDistparity.m_aVIdxCan ); 1435 1436 pcPicYuvBaseRef = pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getRefPic( eRefPicList, arpRefIdx )->getPOC(), cDistparity.m_aVIdxCan ); 1437 1438 if (!pcCU->getSlice()->getArpRefPicAvailable( eRefPicList, cDistparity.m_aVIdxCan)) 1428 if (arpRefIdx < 0 || !pcCU->getSlice()->getArpRefPicAvailable( eRefPicList, cDistparity.m_aVIdxCan)) 1439 1429 { 1440 1430 dW = 0; … … 1443 1433 else 1444 1434 { 1445 assert( pcPicYuvBaseCol->getPOC() == pcCU->getSlice()->getPOC() && pcPicYuvBaseRef->getPOC() == pcCU->getSlice()->getRefPic( eRefPicList, arpRefIdx )->getPOC() ); 1435 if( arpRefIdx != iRefIdx ) 1436 { 1437 bTobeScaled = true; 1438 } 1439 pcPicYuvBaseCol = pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getPOC(), cDistparity.m_aVIdxCan ); 1440 pcPicYuvBaseRef = pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getRefPic( eRefPicList, arpRefIdx )->getPOC(), cDistparity.m_aVIdxCan ); 1446 1441 } 1447 1442 … … 1450 1445 Int iCurrPOC = pcCU->getSlice()->getPOC(); 1451 1446 Int iColRefPOC = pcCU->getSlice()->getRefPOC( eRefPicList, iRefIdx ); 1452 Int iCurrRefPOC = pcCU->getSlice()->getRefPOC( eRefPicList, 0);1447 Int iCurrRefPOC = pcCU->getSlice()->getRefPOC( eRefPicList, arpRefIdx ); 1453 1448 Int iScale = pcCU-> xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iCurrPOC, iColRefPOC); 1454 1449 if ( iScale != 4096 ) … … 1456 1451 cMv = cMv.scaleMv( iScale ); 1457 1452 } 1458 iRefIdx = 0; 1459 } 1453 iRefIdx = arpRefIdx; 1460 1454 } 1461 1455 1462 1456 pcCU->clipMv(cMv); 1463 1457 TComPicYuv* pcPicYuvRef = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(); 1464 xPredInterLumaBlk ( pcCU, pcPicYuvRef, uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi || ( dW > 0 ), true ); 1465 xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi || ( dW > 0 ), true ); 1458 1459 for (UInt comp=COMPONENT_Y; comp< rpcYuvPred->getNumberValidComponents(); comp++) 1460 { 1461 const ComponentID compID=ComponentID(comp); 1462 xPredInterBlk ( compID, pcCU, pcPicYuvRef, uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi || ( dW > 0 ), pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)), true ); 1463 } 1466 1464 1467 1465 if( dW > 0 ) … … 1479 1477 pcCU->clipMv( cNBDV ); 1480 1478 1481 pcPicYuvRef = pcPicYuvBaseCol->getPicYuvRec(); 1482 xPredInterLumaBlk ( pcCU, pcPicYuvRef, uiPartAddr, &cNBDV, iWidth, iHeight, pYuvB0, true, true ); 1483 if (iWidth > 8) 1484 xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cNBDV, iWidth, iHeight, pYuvB0, true, true ); 1479 TComPicYuv* pcPicYuvBaseColRec = pcPicYuvBaseCol->getPicYuvRec(); 1480 TComPicYuv* pcPicYuvBaseRefRec = pcPicYuvBaseRef->getPicYuvRec(); 1485 1481 1486 pcPicYuvRef = pcPicYuvBaseRef->getPicYuvRec(); 1487 xPredInterLumaBlk ( pcCU, pcPicYuvRef, uiPartAddr, &cMVwithDisparity, iWidth, iHeight, pYuvB1, true, true ); 1488 1489 if (iWidth > 8) 1490 xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMVwithDisparity, iWidth, iHeight, pYuvB1, true, true ); 1482 UInt uiCompNum = ( iWidth > 8 ) ? 3: 1; 1483 for (UInt comp=COMPONENT_Y; comp< uiCompNum; comp++) 1484 { 1485 const ComponentID compID=ComponentID(comp); 1486 xPredInterBlk ( compID, pcCU, pcPicYuvBaseColRec, uiPartAddr, &cNBDV, iWidth, iHeight, pYuvB0, true, pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)), true ); 1487 xPredInterBlk ( compID, pcCU, pcPicYuvBaseRefRec, uiPartAddr, &cMVwithDisparity, iWidth, iHeight, pYuvB1, true, pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)), true ); 1488 } 1491 1489 1492 1490 pYuvB0->subtractARP( pYuvB0 , pYuvB1 , uiPartAddr , iWidth , iHeight ); … … 1496 1494 pYuvB0->multiplyARP( uiPartAddr , iWidth , iHeight , dW ); 1497 1495 } 1498 rpcYuvPred->addARP( rpcYuvPred , pYuvB0 , uiPartAddr , iWidth , iHeight , !bi );1496 rpcYuvPred->addARP( rpcYuvPred , pYuvB0 , uiPartAddr , iWidth , iHeight , !bi, pcCU->getSlice()->getSPS()->getBitDepths() ); 1499 1497 } 1500 1498 } … … 1505 1503 TComMv cDMv = pcCU->getCUMvField( eBaseRefPicList )->getMv( uiPartAddr ); 1506 1504 TComPic* pcPicYuvBaseCol = pcCU->getSlice()->getRefPic( eBaseRefPicList, iRefIdx ); 1507 TComPicYuv* pcYuvBaseCol = pcPicYuvBaseCol->getPicYuvRec();1508 Int uiLCUAddr,uiAbsPartAddr;1509 1505 Int irefPUX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[uiPartAddr]] + iWidth/2 + ((cDMv.getHor() + 2)>>2); 1510 1506 Int irefPUY = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[uiPartAddr]] + iHeight/2 + ((cDMv.getVer() + 2)>>2); … … 1512 1508 irefPUX = (Int)Clip3<Int>(0, pcCU->getSlice()->getSPS()-> getPicWidthInLumaSamples()-1, irefPUX); 1513 1509 irefPUY = (Int)Clip3<Int>(0, pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples()-1, irefPUY); 1514 pcYuvBaseCol->getCUAddrAndPartIdx( irefPUX, irefPUY, uiLCUAddr, uiAbsPartAddr); 1515 TComDataCU *pColCU = pcPicYuvBaseCol->getCU( uiLCUAddr ); 1510 1511 Int uiLCUAddr,uiAbsPartAddr; 1512 pcPicYuvBaseCol->getCUAddrAndPartIdx( irefPUX, irefPUY, uiLCUAddr, uiAbsPartAddr); 1513 TComDataCU *pColCU = pcPicYuvBaseCol->getCtu( uiLCUAddr ); 1516 1514 1517 1515 TComPic* pcPicYuvBaseTRef = NULL; … … 1565 1563 } 1566 1564 1567 Void TComPrediction::xPredInterUniARPviewRef( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, TComMvField * pNewMvFiled ) 1565 //inter-view ARP 1566 Void TComPrediction::xPredInterUniARPviewRef( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi ) 1568 1567 { 1569 1568 Int iRefIdx = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr ); … … 1578 1577 Bool bTMVAvai = false; 1579 1578 TComMv cBaseTMV; 1580 if( pNewMvFiled ) 1581 { 1582 iRefIdx = pNewMvFiled->getRefIdx(); 1583 cDMv = pNewMvFiled->getMv(); 1584 } 1579 1585 1580 pcCU->clipMv(cTempDMv); 1586 1581 1587 assert(dW > 0);1588 if (!pcCU->getSlice()->getArpRefPicAvailable( eRefPicList, pcPicYuvBaseCol->getViewIndex()))1589 {1590 dW = 0;1591 }1592 Int uiLCUAddr,uiAbsPartAddr;1593 1582 Int irefPUX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[uiPartAddr]] + iWidth/2 + ((cDMv.getHor() + 2)>>2); 1594 1583 Int irefPUY = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[uiPartAddr]] + iHeight/2 + ((cDMv.getVer() + 2)>>2); … … 1596 1585 irefPUX = (Int)Clip3<Int>(0, pcCU->getSlice()->getSPS()-> getPicWidthInLumaSamples()-1, irefPUX); 1597 1586 irefPUY = (Int)Clip3<Int>(0, pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples()-1, irefPUY); 1598 pcYuvBaseCol->getCUAddrAndPartIdx( irefPUX, irefPUY, uiLCUAddr, uiAbsPartAddr); 1599 TComDataCU *pColCU = pcPicYuvBaseCol->getCU( uiLCUAddr ); 1587 1588 Int uiLCUAddr,uiAbsPartAddr; 1589 pcPicYuvBaseCol->getCUAddrAndPartIdx( irefPUX, irefPUY, uiLCUAddr, uiAbsPartAddr); 1590 TComDataCU *pColCU = pcPicYuvBaseCol->getCtu( uiLCUAddr ); 1600 1591 if( pcCU->getSlice()->isInterB() && !pcCU->getSlice()->getIsDepth() ) 1601 1592 { … … 1668 1659 RefPicList eRefPicListCurr = RefPicList(iList); 1669 1660 Int iRef = pColCU->getCUMvField(eRefPicListCurr)->getRefIdx(uiAbsPartAddr); 1670 if( iRef != -1 )1661 if( iRef != -1 && pcCU->getSlice()->getArpRefPicAvailable( eRefPicListCurr, pcPicYuvBaseCol->getViewIndex())) 1671 1662 { 1672 1663 pcPicYuvBaseTRef = pColCU->getSlice()->getRefPic(eRefPicListCurr, iRef); … … 1702 1693 } 1703 1694 1704 xPredInterLumaBlk ( pcCU, pcYuvBaseCol, uiPartAddr, &cTempDMv, iWidth, iHeight, rpcYuvPred, bi || ( dW > 0 && bTMVAvai ), bTMVAvai); 1705 xPredInterChromaBlk( pcCU, pcYuvBaseCol, uiPartAddr, &cTempDMv, iWidth, iHeight, rpcYuvPred, bi || ( dW > 0 && bTMVAvai ), bTMVAvai); 1706 1707 if( dW > 0 && bTMVAvai ) 1708 { 1695 for (UInt comp=COMPONENT_Y; comp< rpcYuvPred->getNumberValidComponents(); comp++) 1696 { 1697 const ComponentID compID=ComponentID(comp); 1698 xPredInterBlk ( compID, pcCU, pcYuvBaseCol, uiPartAddr, &cTempDMv, iWidth, iHeight, rpcYuvPred, bi || ( dW > 0 && bTMVAvai ), pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)), bTMVAvai ); 1699 } 1700 1701 if( dW > 0 ) 1702 { 1703 assert ( bTMVAvai ); 1709 1704 TComYuv* pYuvCurrTRef = &m_acYuvPredBase[0]; 1710 1705 TComYuv* pYuvBaseTRef = &m_acYuvPredBase[1]; … … 1720 1715 pYuvCurrTRef->clear(); pYuvBaseTRef->clear(); 1721 1716 } 1722 xPredInterLumaBlk ( pcCU, pcYuvCurrTref, uiPartAddr, &cBaseTMV, iWidth, iHeight, pYuvCurrTRef, true, true); 1723 1724 if (iWidth > 8) 1725 xPredInterChromaBlk( pcCU, pcYuvCurrTref, uiPartAddr, &cBaseTMV, iWidth, iHeight, pYuvCurrTRef, true, true); 1726 1727 xPredInterLumaBlk ( pcCU, pcYuvBaseTref, uiPartAddr, &cTempMv, iWidth, iHeight, pYuvBaseTRef, true, true); 1728 1729 if (iWidth > 8) 1730 xPredInterChromaBlk( pcCU, pcYuvBaseTref, uiPartAddr, &cTempMv, iWidth, iHeight, pYuvBaseTRef, true, true); 1717 1718 UInt uiCompNum = ( iWidth > 8 ) ? 3: 1; 1719 for (UInt comp=COMPONENT_Y; comp< uiCompNum; comp++) 1720 { 1721 const ComponentID compID=ComponentID(comp); 1722 xPredInterBlk ( compID, pcCU, pcYuvCurrTref, uiPartAddr, &cBaseTMV, iWidth, iHeight, pYuvCurrTRef, true, pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)), true ); 1723 xPredInterBlk ( compID, pcCU, pcYuvBaseTref, uiPartAddr, &cTempMv, iWidth, iHeight, pYuvBaseTRef, true, pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)), true ); 1724 } 1731 1725 1732 1726 pYuvCurrTRef->subtractARP( pYuvCurrTRef , pYuvBaseTRef , uiPartAddr , iWidth , iHeight ); … … 1735 1729 pYuvCurrTRef->multiplyARP( uiPartAddr , iWidth , iHeight , dW ); 1736 1730 } 1737 rpcYuvPred->addARP( rpcYuvPred , pYuvCurrTRef , uiPartAddr , iWidth , iHeight , !bi );1731 rpcYuvPred->addARP( rpcYuvPred , pYuvCurrTRef , uiPartAddr , iWidth , iHeight , !bi, pcCU->getSlice()->getSPS()->getBitDepths() ); 1738 1732 } 1739 1733 } … … 1790 1784 } 1791 1785 1792 #if H_3D_VSP 1793 1786 #if NH_3D_VSP 1794 1787 Void TComPrediction::xPredInterBiVSP( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvPred ) 1795 1788 { … … 1813 1806 } 1814 1807 1815 xWeightedAverage( &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred ); 1816 } 1817 1808 xWeightedAverage( &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred, pcCU->getSlice()->getSPS()->getBitDepths() ); 1809 } 1818 1810 #endif 1819 1811 … … 1835 1827 1836 1828 Void TComPrediction::xPredInterBlk(const ComponentID compID, TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *dstPic, Bool bi, const Int bitDepth 1837 #if H_3D_ARP1829 #if NH_3D_ARP 1838 1830 , Bool filterType 1839 1831 #endif 1840 #if H_3D_IC1832 #if NH_3D_IC 1841 1833 , Bool bICFlag 1842 1834 #endif … … 1857 1849 Int yFrac = mv->getVer() & ((1<<shiftVer)-1); 1858 1850 1859 #if H_3D_IC1851 #if NH_3D_INTEGER_MV_DEPTH 1860 1852 if( cu->getSlice()->getIsDepth() ) 1861 1853 { 1862 1854 refOffset = mv->getHor() + mv->getVer() * refStride; 1863 ref = refPic->get LumaAddr( cu->getAddr(), cu->getZorderIdxInCU() + partAddr ) + refOffset;1855 ref = refPic->getAddr(compID, cu->getCtuRsAddr(), cu->getZorderIdxInCtu() + partAddr ) + refOffset; 1864 1856 xFrac = 0; 1865 1857 yFrac = 0; … … 1874 1866 if ( yFrac == 0 ) 1875 1867 { 1876 #if H_3D_IC1877 m_if.filterHor Luma( ref, refStride, dst, dstStride, width, height, xFrac, !bi || bICFlag1868 #if NH_3D_IC 1869 m_if.filterHor(compID, ref, refStride, dst, dstStride, cxWidth, cxHeight, xFrac, !bi || bICFlag, chFmt, bitDepth 1878 1870 #else 1879 1871 m_if.filterHor(compID, ref, refStride, dst, dstStride, cxWidth, cxHeight, xFrac, !bi, chFmt, bitDepth 1880 1872 #endif 1881 #if H_3D_ARP1873 #if NH_3D_ARP 1882 1874 , filterType 1883 1875 #endif … … 1886 1878 else if ( xFrac == 0 ) 1887 1879 { 1888 #if H_3D_IC1889 m_if.filterVer Luma( ref, refStride, dst, dstStride, width, height, yFrac, true, !bi || bICFlag1880 #if NH_3D_IC 1881 m_if.filterVer(compID, ref, refStride, dst, dstStride, cxWidth, cxHeight, yFrac, true, !bi || bICFlag, chFmt, bitDepth 1890 1882 #else 1891 1883 m_if.filterVer(compID, ref, refStride, dst, dstStride, cxWidth, cxHeight, yFrac, true, !bi, chFmt, bitDepth 1892 1884 #endif 1893 #if H_3D_ARP1885 #if NH_3D_ARP 1894 1886 , filterType 1895 1887 #endif … … 1904 1896 1905 1897 m_if.filterHor(compID, ref - ((vFilterSize>>1) -1)*refStride, refStride, tmp, tmpStride, cxWidth, cxHeight+vFilterSize-1, xFrac, false, chFmt, bitDepth 1906 #if H_3D_ARP1898 #if NH_3D_ARP 1907 1899 , filterType 1908 1900 #endif 1909 1901 ); 1910 #if H_3D_IC1911 m_if.filterVer Luma(tmp + (halfFilterSize-1)*tmpStride, tmpStride, dst, dstStride, width, height, yFrac, false, !bi || bICFlag1902 #if NH_3D_IC 1903 m_if.filterVer(compID, tmp + ((vFilterSize>>1) -1)*tmpStride, tmpStride, dst, dstStride, cxWidth, cxHeight, yFrac, false, !bi || bICFlag, chFmt, bitDepth 1912 1904 #else 1913 1905 m_if.filterVer(compID, tmp + ((vFilterSize>>1) -1)*tmpStride, tmpStride, dst, dstStride, cxWidth, cxHeight, yFrac, false, !bi, chFmt, bitDepth 1914 1906 #endif 1915 #if H_3D_ARP1907 #if NH_3D_ARP 1916 1908 , filterType 1917 1909 #endif … … 1919 1911 } 1920 1912 1921 #if H_3D_IC1913 #if NH_3D_IC 1922 1914 if( bICFlag ) 1923 1915 { 1924 1916 Int a, b, i, j; 1925 1917 const Int iShift = IC_CONST_SHIFT; 1926 1927 xGetLLSICPrediction( cu, mv, refPic, a, b, TEXT_LUMA ); 1928 1929 1930 for ( i = 0; i < height; i++ )1931 { 1932 for ( j = 0; j < width; j++ )1933 { 1934 dst[j] = Clip3( 0, ( 1 << g_bitDepthY) - 1, ( ( a*dst[j] ) >> iShift ) + b );1918 Pel *dst2 = dst; 1919 1920 xGetLLSICPrediction( compID, cu, mv, refPic, a, b, bitDepth ); 1921 1922 for ( i = 0; i < cxHeight; i++ ) 1923 { 1924 for ( j = 0; j < cxWidth; j++ ) 1925 { 1926 dst[j] = Clip3( 0, ( 1 << bitDepth ) - 1, ( ( a*dst[j] ) >> iShift ) + b ); 1935 1927 } 1936 1928 dst += dstStride; … … 1939 1931 if(bi) 1940 1932 { 1941 Pel *dst2 = dstPic->getLumaAddr( partAddr ); 1942 Int shift = IF_INTERNAL_PREC - g_bitDepthY; 1943 for (i = 0; i < height; i++) 1944 { 1945 for (j = 0; j < width; j++) 1946 { 1947 Short val = dst2[j] << shift; 1948 dst2[j] = val - (Short)IF_INTERNAL_OFFS; 1933 Int shift = IF_INTERNAL_PREC - bitDepth; 1934 for (i = 0; i < cxHeight; i++) 1935 { 1936 for (j = 0; j < cxWidth; j++) 1937 { 1938 Pel val = dst2[j] << shift; 1939 dst2[j] = val - (Pel)IF_INTERNAL_OFFS; 1949 1940 } 1950 1941 dst2 += dstStride; … … 1956 1947 } 1957 1948 1958 1959 #if H_3D_ARP1960 , Bool filterType1961 #endif1962 #if H_3D_IC1963 , Bool bICFlag1964 #endif1965 #if H_3D_IC1966 m_if.filterHorChroma(refCb, refStride, dstCb, dstStride, cxWidth, cxHeight, xFrac, !bi || bICFlag1967 #else1968 #endif1969 #if H_3D_ARP1970 , filterType1971 #endif1972 #if H_3D_IC1973 m_if.filterHorChroma(refCr, refStride, dstCr, dstStride, cxWidth, cxHeight, xFrac, !bi || bICFlag1974 #else1975 #endif1976 #if H_3D_ARP1977 , filterType1978 #endif1979 #if H_3D_IC1980 m_if.filterVerChroma(refCb, refStride, dstCb, dstStride, cxWidth, cxHeight, yFrac, true, !bi || bICFlag1981 #else1982 #endif1983 #if H_3D_ARP1984 , filterType1985 #endif1986 #if H_3D_IC1987 m_if.filterVerChroma(refCr, refStride, dstCr, dstStride, cxWidth, cxHeight, yFrac, true, !bi || bICFlag1988 #else1989 #endif1990 #if H_3D_ARP1991 , filterType1992 #endif1993 #if H_3D_ARP1994 , filterType1995 #endif1996 #if H_3D_IC1997 m_if.filterVerChroma(extY + (halfFilterSize-1)*extStride, extStride, dstCb, dstStride, cxWidth, cxHeight , yFrac, false, !bi || bICFlag1998 #else1999 #endif2000 #if H_3D_ARP2001 , filterType2002 #endif2003 #if H_3D_ARP2004 , filterType2005 #endif2006 #if H_3D_IC2007 m_if.filterVerChroma(extY + (halfFilterSize-1)*extStride, extStride, dstCr, dstStride, cxWidth, cxHeight , yFrac, false, !bi || bICFlag2008 #else2009 #endif2010 #if H_3D_ARP2011 , filterType2012 #endif2013 #if H_3D_IC2014 if( bICFlag )2015 {2016 Int a, b, i, j;2017 const Int iShift = IC_CONST_SHIFT;2018 2019 xGetLLSICPrediction( cu, mv, refPic, a, b, TEXT_CHROMA_U ); // Cb2020 for ( i = 0; i < cxHeight; i++ )2021 {2022 for ( j = 0; j < cxWidth; j++ )2023 {2024 dstCb[j] = Clip3( 0, ( 1 << g_bitDepthC ) - 1, ( ( a*dstCb[j] ) >> iShift ) + b );2025 }2026 dstCb += dstStride;2027 }2028 xGetLLSICPrediction( cu, mv, refPic, a, b, TEXT_CHROMA_V ); // Cr2029 for ( i = 0; i < cxHeight; i++ )2030 {2031 for ( j = 0; j < cxWidth; j++ )2032 {2033 dstCr[j] = Clip3( 0, ( 1 << g_bitDepthC ) - 1, ( ( a*dstCr[j] ) >> iShift ) + b );2034 }2035 dstCr += dstStride;2036 }2037 2038 if(bi)2039 {2040 Pel* dstCb2 = dstPic->getCbAddr( partAddr );2041 Pel* dstCr2 = dstPic->getCrAddr( partAddr );2042 Int shift = IF_INTERNAL_PREC - g_bitDepthC;2043 for (i = 0; i < cxHeight; i++)2044 {2045 for (j = 0; j < cxWidth; j++)2046 {2047 Short val = dstCb2[j] << shift;2048 dstCb2[j] = val - (Short)IF_INTERNAL_OFFS;2049 2050 val = dstCr2[j] << shift;2051 dstCr2[j] = val - (Short)IF_INTERNAL_OFFS;2052 }2053 dstCb2 += dstStride;2054 dstCr2 += dstStride;2055 }2056 }2057 }2058 #endif2059 1949 Void TComPrediction::xWeightedAverage( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv* pcYuvDst, const BitDepths &clipBitDepths 2060 1950 ) … … 2201 2091 (uiDirMode==HOR_IDX || uiDirMode==VER_IDX); 2202 2092 } 2203 #if H_3D_IC2093 #if NH_3D_IC 2204 2094 /** Function for deriving the position of first non-zero binary bit of a value 2205 2095 * \param x input value … … 2231 2121 /** Function for deriving LM illumination compensation. 2232 2122 */ 2233 Void TComPrediction::xGetLLSICPrediction( TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, TextType eType)2123 Void TComPrediction::xGetLLSICPrediction( const ComponentID compID, TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, const Int bitDepth ) 2234 2124 { 2235 2125 TComPicYuv *pRecPic = pcCU->getPic()->getPicYuvRec(); 2236 2126 Pel *pRec = NULL, *pRef = NULL; 2237 2127 UInt uiWidth, uiHeight, uiTmpPartIdx; 2238 Int iRecStride = ( eType == TEXT_LUMA ) ? pRecPic->getStride() : pRecPic->getCStride();2239 Int iRefStride = ( eType == TEXT_LUMA ) ? pRefPic->getStride() : pRefPic->getCStride();2128 Int iRecStride = pRecPic->getStride(compID); 2129 Int iRefStride = pRefPic->getStride(compID); 2240 2130 Int iRefOffset, iHor, iVer; 2241 2131 iHor = pcCU->getSlice()->getIsDepth() ? pMv->getHor() : ( ( pMv->getHor() + 2 ) >> 2 ); 2242 2132 iVer = pcCU->getSlice()->getIsDepth() ? pMv->getVer() : ( ( pMv->getVer() + 2 ) >> 2 ); 2243 if( eType != TEXT_LUMA)2133 if( !isLuma(compID) ) 2244 2134 { 2245 2135 iHor = pcCU->getSlice()->getIsDepth() ? ( ( pMv->getHor() + 1 ) >> 1 ) : ( ( pMv->getHor() + 4 ) >> 3 ); 2246 2136 iVer = pcCU->getSlice()->getIsDepth() ? ( ( pMv->getVer() + 1 ) >> 1 ) : ( ( pMv->getVer() + 4 ) >> 3 ); 2247 2137 } 2248 uiWidth = ( eType == TEXT_LUMA ) ? pcCU->getWidth( 0 ) : ( pcCU->getWidth( 0 ) >> 1);2249 uiHeight = ( eType == TEXT_LUMA ) ? pcCU->getHeight( 0 ) : ( pcCU->getHeight( 0 ) >> 1);2138 uiWidth = pcCU->getWidth( 0 ) >> pRefPic->getComponentScaleX(compID); 2139 uiHeight = pcCU->getHeight( 0 ) >> pRefPic->getComponentScaleY(compID); 2250 2140 2251 2141 Int i, j, iCountShift = 0; 2252 2142 2253 // LLS parameters estimation -->2143 // LLS parameters estimation 2254 2144 2255 2145 Int x = 0, y = 0, xx = 0, xy = 0; 2256 Int precShift = std::max(0, (( eType == TEXT_LUMA ) ? g_bitDepthY : g_bitDepthC) - 12); 2257 2258 if( pcCU->getPUAbove( uiTmpPartIdx, pcCU->getZorderIdxInCU() ) ) 2146 Int precShift = std::max(0, bitDepth - 12); 2147 2148 UInt partAddr = 0; 2149 if( pcCU->getPUAbove( uiTmpPartIdx, pcCU->getZorderIdxInCtu() ) ) 2259 2150 { 2260 2151 iRefOffset = iHor + iVer * iRefStride - iRefStride; 2261 if( eType == TEXT_LUMA ) 2262 { 2263 pRef = pRefPic->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset; 2264 pRec = pRecPic->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - iRecStride; 2265 } 2266 else if( eType == TEXT_CHROMA_U ) 2267 { 2268 pRef = pRefPic->getCbAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset; 2269 pRec = pRecPic->getCbAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - iRecStride; 2270 } 2271 else 2272 { 2273 assert( eType == TEXT_CHROMA_V ); 2274 pRef = pRefPic->getCrAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset; 2275 pRec = pRecPic->getCrAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - iRecStride; 2276 } 2277 2152 pRef = pRefPic->getAddr(compID, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu() + partAddr ) + iRefOffset; 2153 pRec = pRecPic->getAddr(compID, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu() + partAddr ) - iRecStride; 2278 2154 for( j = 0; j < uiWidth; j+=2 ) 2279 2155 { 2280 2156 x += pRef[j]; 2281 2157 y += pRec[j]; 2282 if ( eType == TEXT_LUMA)2158 if( isLuma(compID) ) 2283 2159 { 2284 2160 xx += (pRef[j] * pRef[j])>>precShift; … … 2289 2165 } 2290 2166 2291 if( pcCU->getPULeft( uiTmpPartIdx, pcCU->getZorderIdxInC U() ) )2167 if( pcCU->getPULeft( uiTmpPartIdx, pcCU->getZorderIdxInCtu() ) ) 2292 2168 { 2293 2169 iRefOffset = iHor + iVer * iRefStride - 1; 2294 if( eType == TEXT_LUMA ) 2295 { 2296 pRef = pRefPic->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset; 2297 pRec = pRecPic->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - 1; 2298 } 2299 else if( eType == TEXT_CHROMA_U ) 2300 { 2301 pRef = pRefPic->getCbAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset; 2302 pRec = pRecPic->getCbAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - 1; 2303 } 2304 else 2305 { 2306 assert( eType == TEXT_CHROMA_V ); 2307 pRef = pRefPic->getCrAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset; 2308 pRec = pRecPic->getCrAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - 1; 2309 } 2310 2170 pRef = pRefPic->getAddr(compID, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu() + partAddr ) + iRefOffset; 2171 pRec = pRecPic->getAddr(compID, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu() + partAddr ) - 1; 2311 2172 for( i = 0; i < uiHeight; i+=2 ) 2312 2173 { 2313 2174 x += pRef[0]; 2314 2175 y += pRec[0]; 2315 if ( eType == TEXT_LUMA)2176 if( isLuma(compID) ) 2316 2177 { 2317 2178 xx += (pRef[0] * pRef[0])>>precShift; … … 2331 2192 } 2332 2193 2333 if ( eType != TEXT_LUMA)2334 { 2335 a = 32;2194 if( !isLuma(compID) ) 2195 { 2196 a = ( 1 << IC_CONST_SHIFT ); 2336 2197 b = ( y - x + ( 1 << ( iCountShift - 1 ) ) ) >> iCountShift; 2337 2198 } … … 2343 2204 Int a2 = ( xx << iCountShift ) - ((x * x) >> precShift); 2344 2205 const Int iShift = IC_CONST_SHIFT; 2345 {2346 {2347 2206 const Int iShiftA2 = 6; 2348 2207 const Int iAccuracyShift = 15; … … 2350 2209 Int iScaleShiftA2 = 0; 2351 2210 Int iScaleShiftA1 = 0; 2352 Int a1s = a1;2353 Int a2s = a2;2211 Int a1s; 2212 Int a2s; 2354 2213 2355 2214 a1 = Clip3(0, 2*a2, a1); … … 2379 2238 } 2380 2239 } 2381 }2382 }2383 2240 #endif 2384 2241
Note: See TracChangeset for help on using the changeset viewer.