Changeset 12 in 3DVCSoftware for branches/0.2-poznan-univ/source/Lib/TLibCommon
- Timestamp:
- 6 Feb 2012, 00:52:17 (13 years ago)
- Location:
- branches/0.2-poznan-univ/source/Lib/TLibCommon
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/0.2-poznan-univ/source/Lib/TLibCommon/CommonDef.h
r11 r12 137 137 #define LOG2_DISP_PREC_LUT 2 ///< log2 of disparity precision used in integer disparity LUTs 138 138 139 #if ( HHI_INTER_VIEW_MOTION_PRED || HHI_INTER_VIEW_RESIDUAL_PRED )139 #if ( HHI_INTER_VIEW_MOTION_PRED || HHI_INTER_VIEW_RESIDUAL_PRED || POZNAN_MP_USE_DEPTH_MAP_GENERATION) 140 140 #define DEPTH_MAP_GENERATION 1 141 141 #else … … 178 178 #define POZNAN_OUTPUT_SYNTH 0 // output synthesised view (for debugging) 179 179 180 #if POZNAN_NONLINEAR_DEPTH 181 #define POZNAN_LUT_INCREASED_PRECISION 0 // 1 182 #else 183 #define POZNAN_LUT_INCREASED_PRECISION 0 184 #endif 185 186 #if POZNAN_NONLINEAR_DEPTH 187 inline UChar quantizeDepthPower(Float fDepthPower) 188 { 189 Int r = (Int) ( (fDepthPower-1.0f)*128.0f + 0.5f); 190 if (r<=0) return 0; 191 if (r>255) r=255; 192 return r; 193 }; 194 195 inline Float dequantizeDepthPower(Int iDepthQuant) 196 { 197 return iDepthQuant/128.0f + 1.0f; 198 }; 199 #endif 200 201 #if POZNAN_EIVD 202 #define POZNAN_EIVD_MERGE_POS 0 // position of EIVD candidate in merge list for coding (0..6) - overwrites PDM_MERGE_POS settings, is overwritten by HHI_MPI_MERGE_POS settings!!! 203 #endif 204 180 205 // ==================================================================================================================== 181 206 // Macro functions … … 187 212 #define Clip(x) ( Min(g_uiIBDI_MAX, Max( 0, (x)) ) ) ///< clip with bit-depth range 188 213 #define Clip3( MinVal, MaxVal, a) ( ((a)<(MinVal)) ? (MinVal) : (((a)>(MaxVal)) ? (MaxVal) :(a)) ) ///< general min/max clip 189 #define RemoveBitIncrement(x) ( (x + ( (1 << g_uiBitIncrement) >> 1 )) >> g_uiBitIncrement ) ///< Remove Bit increment 214 #define RemoveBitIncrement(x) ( ((x) + ( (1 << g_uiBitIncrement) >> 1 )) >> g_uiBitIncrement ) ///< Remove Bit increment 215 216 #if POZNAN_LUT_INCREASED_PRECISION 217 #define RemoveBitIncrementLUT(x) (x) ///< Remove Bit increment 218 #define SizeOfLUT (256 << g_uiBitIncrement) 219 #else 220 #define SizeOfLUT 256 221 #define RemoveBitIncrementLUT(x) ( ((x) + ( (1 << g_uiBitIncrement) >> 1 )) >> g_uiBitIncrement ) ///< Remove Bit increment 222 #endif 190 223 191 224 #define DATA_ALIGN 1 ///< use 32-bit aligned malloc/free … … 217 250 #define AMVP_MAX_NUM_CANDS 6 ///< max number of final candidates 218 251 // MERGE 252 #if POZNAN_EIVD 253 #define MRG_MAX_NUM_CANDS 7 254 #define POZNAN_EIVD_MRG_CAND MRG_MAX_NUM_CANDS-1 // position of EIVD candidate in merge list (0..6) 255 #else 219 256 #define MRG_MAX_NUM_CANDS 6 257 #endif 220 258 221 259 // Reference memory management -
branches/0.2-poznan-univ/source/Lib/TLibCommon/ContextTables.h
r5 r12 53 53 #define NUM_MERGE_FLAG_EXT_CTX 3 ///< number of context models for merge flag of merge extended 54 54 #define NUM_MERGE_IDX_EXT_CTX 4 ///< number of context models for merge index of merge extended 55 #define NUM_MV_MERGE_IDX_EXT_CTX 5///< number of context models for merge index of merge extended55 #define NUM_MV_MERGE_IDX_EXT_CTX 6 ///< number of context models for merge index of merge extended 56 56 #define NUM_RES_PRED_FLAG_CTX 3 ///< number of context for residual prediction flag 57 57 -
branches/0.2-poznan-univ/source/Lib/TLibCommon/TComDataCU.cpp
r11 r12 187 187 m_acCUMvField[1].create( uiNumPartition ); 188 188 189 #if POZNAN_EIVD_CALC_PRED_DATA 190 m_acCUMvField2nd[0].create( uiNumPartition ); 191 m_acCUMvField2nd[1].create( uiNumPartition ); 192 #endif 193 189 194 #if HHI_DMM_WEDGE_INTRA 190 195 m_puiWedgeFullTabIdx = (UInt*)xMalloc(UInt, uiNumPartition); … … 210 215 m_acCUMvField[0].setNumPartition(uiNumPartition ); 211 216 m_acCUMvField[1].setNumPartition(uiNumPartition ); 217 218 #if POZNAN_EIVD_CALC_PRED_DATA 219 m_acCUMvField2nd[0].setNumPartition(uiNumPartition ); 220 m_acCUMvField2nd[1].setNumPartition(uiNumPartition ); 221 #endif 212 222 } 213 223 … … 296 306 if ( m_piContourPredTexDeltaDC2 ) { xFree(m_piContourPredTexDeltaDC2); m_piContourPredTexDeltaDC2 = NULL; } 297 307 #endif 308 309 #if POZNAN_EIVD_CALC_PRED_DATA 310 m_acCUMvField2nd[0].destroy(); 311 m_acCUMvField2nd[1].destroy(); 312 #endif 313 298 314 } 299 315 … … 388 404 m_acCUMvField[0].clearMvField(); 389 405 m_acCUMvField[1].clearMvField(); 406 407 #if POZNAN_EIVD_CALC_PRED_DATA 408 m_acCUMvField2nd[0].clearMvField(); 409 m_acCUMvField2nd[1].clearMvField(); 410 #endif 390 411 391 412 UInt uiTmp = m_puhWidth[0]*m_puhHeight[0]; … … 508 529 m_acCUMvField[1].clearMvField(); 509 530 531 #if POZNAN_EIVD_CALC_PRED_DATA 532 m_acCUMvField2nd[0].clearMvField(); 533 m_acCUMvField2nd[1].clearMvField(); 534 #endif 535 510 536 #if HHI_DMM_WEDGE_INTRA 511 537 memset( m_puiWedgeFullTabIdx, 0, iSizeInUInt ); … … 617 643 m_uiEntropySliceStartCU = pcCU->getEntropySliceStartCU(); 618 644 645 #if POZNAN_EIVD_CALC_PRED_DATA 646 m_acCUMvField2nd[0].clearMvField(); 647 m_acCUMvField2nd[1].clearMvField(); 648 #endif 649 619 650 #if HHI_DMM_WEDGE_INTRA 620 651 memset( m_puiWedgeFullTabIdx, 0, iSizeInUInt ); … … 719 750 m_acCUMvField[1].setMvdPtr(pcCU->getCUMvField(REF_PIC_LIST_1)->getMvd() + uiPart); 720 751 m_acCUMvField[1].setRefIdxPtr(pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx() + uiPart); 752 753 #if POZNAN_EIVD_CALC_PRED_DATA 754 m_acCUMvField2nd[0].setMvPtr(pcCU->getCUMvField2nd(REF_PIC_LIST_0)->getMv() + uiPart); 755 m_acCUMvField2nd[0].setMvdPtr(pcCU->getCUMvField2nd(REF_PIC_LIST_0)->getMvd() + uiPart); 756 m_acCUMvField2nd[0].setRefIdxPtr(pcCU->getCUMvField2nd(REF_PIC_LIST_0)->getRefIdx() + uiPart); 757 m_acCUMvField2nd[1].setMvPtr(pcCU->getCUMvField2nd(REF_PIC_LIST_1)->getMv() + uiPart); 758 m_acCUMvField2nd[1].setMvdPtr(pcCU->getCUMvField2nd(REF_PIC_LIST_1)->getMvd() + uiPart); 759 m_acCUMvField2nd[1].setRefIdxPtr(pcCU->getCUMvField2nd(REF_PIC_LIST_1)->getRefIdx() + uiPart); 760 #endif 761 721 762 m_uiSliceStartCU = pcCU->getSliceStartCU(); 722 763 m_uiEntropySliceStartCU = pcCU->getEntropySliceStartCU(); … … 787 828 m_acCUMvField[eRefPicList].setMvdPtr(pcCU->getCUMvField(eRefPicList)->getMvd() + uiAbsPartIdx); 788 829 m_acCUMvField[eRefPicList].setRefIdxPtr(pcCU->getCUMvField(eRefPicList)->getRefIdx() + uiAbsPartIdx); 830 831 #if POZNAN_EIVD_CALC_PRED_DATA 832 m_acCUMvField2nd[eRefPicList].setMvPtr(pcCU->getCUMvField2nd(eRefPicList)->getMv() + uiAbsPartIdx); 833 m_acCUMvField2nd[eRefPicList].setMvdPtr(pcCU->getCUMvField2nd(eRefPicList)->getMvd() + uiAbsPartIdx); 834 m_acCUMvField2nd[eRefPicList].setRefIdxPtr(pcCU->getCUMvField2nd(eRefPicList)->getRefIdx() + uiAbsPartIdx); 835 #endif 836 789 837 #if HHI_MPI 790 838 m_piTextureModeDepth = pcCU->getTextureModeDepth() + uiAbsPartIdx; … … 857 905 m_acCUMvField[1].copyFrom( pcCU->getCUMvField( REF_PIC_LIST_1 ), pcCU->getTotalNumPart(), uiOffset ); 858 906 907 #if POZNAN_EIVD_CALC_PRED_DATA 908 m_acCUMvField2nd[0].copyFrom( pcCU->getCUMvField2nd( REF_PIC_LIST_0 ), pcCU->getTotalNumPart(), uiOffset ); 909 m_acCUMvField2nd[1].copyFrom( pcCU->getCUMvField2nd( REF_PIC_LIST_1 ), pcCU->getTotalNumPart(), uiOffset ); 910 #endif 911 859 912 UInt uiTmp = g_uiMaxCUWidth*g_uiMaxCUHeight >> (uiDepth<<1); 860 913 UInt uiTmp2 = uiPartUnitIdx*uiTmp; … … 943 996 m_acCUMvField[0].copyTo( rpcCU->getCUMvField( REF_PIC_LIST_0 ), m_uiAbsIdxInLCU ); 944 997 m_acCUMvField[1].copyTo( rpcCU->getCUMvField( REF_PIC_LIST_1 ), m_uiAbsIdxInLCU ); 998 999 #if POZNAN_EIVD_CALC_PRED_DATA 1000 m_acCUMvField2nd[0].copyTo( rpcCU->getCUMvField2nd( REF_PIC_LIST_0 ), m_uiAbsIdxInLCU ); 1001 m_acCUMvField2nd[1].copyTo( rpcCU->getCUMvField2nd( REF_PIC_LIST_1 ), m_uiAbsIdxInLCU ); 1002 #endif 945 1003 946 1004 UInt uiTmp = (g_uiMaxCUWidth*g_uiMaxCUHeight)>>(uhDepth<<1); … … 1030 1088 m_acCUMvField[0].copyTo( rpcCU->getCUMvField( REF_PIC_LIST_0 ), m_uiAbsIdxInLCU, uiPartStart, uiQNumPart ); 1031 1089 m_acCUMvField[1].copyTo( rpcCU->getCUMvField( REF_PIC_LIST_1 ), m_uiAbsIdxInLCU, uiPartStart, uiQNumPart ); 1090 1091 #if POZNAN_EIVD_CALC_PRED_DATA 1092 m_acCUMvField2nd[0].copyTo( rpcCU->getCUMvField2nd( REF_PIC_LIST_0 ), m_uiAbsIdxInLCU, uiPartStart, uiQNumPart ); 1093 m_acCUMvField2nd[1].copyTo( rpcCU->getCUMvField2nd( REF_PIC_LIST_1 ), m_uiAbsIdxInLCU, uiPartStart, uiQNumPart ); 1094 #endif 1032 1095 1033 1096 UInt uiTmp = (g_uiMaxCUWidth*g_uiMaxCUHeight)>>((uhDepth+uiPartDepth)<<1); … … 2697 2760 #endif 2698 2761 2762 #if POZNAN_EIVD 2763 Bool bEIVDMerge = getSlice()->getMP()->isEIVDEnabled(); 2764 UInt uiEIVDAddr = POZNAN_EIVD_MRG_CAND; 2765 #endif 2766 2699 2767 bool abCandIsInter[ MRG_MAX_NUM_CANDS ]; 2700 2768 for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS; ++ui ) … … 2712 2780 } 2713 2781 if( pcCULeft && !pcCULeft->isIntra( uiLeftPartIdx ) 2714 #if POZNAN_ ENCODE_ONLY_DISOCCLUDED_CU2782 #if POZNAN_CU_SKIP 2715 2783 && !pcCULeft->isCUSkiped( uiLeftPartIdx ) 2716 2784 #endif … … 2742 2810 } 2743 2811 if ( pcCUAbove && !pcCUAbove->isIntra( uiAbovePartIdx ) 2744 #if POZNAN_ ENCODE_ONLY_DISOCCLUDED_CU2812 #if POZNAN_CU_SKIP 2745 2813 && !pcCUAbove->isCUSkiped( uiAbovePartIdx ) 2746 2814 #endif … … 3191 3259 #endif 3192 3260 3261 #if POZNAN_EIVD 3262 //===== add point-to-point merge with depth maps ===== 3263 if ( bEIVDMerge ) 3264 { 3265 //prediction of motion data for points with disocclusion: 3266 UInt uiRefArrayAddr = uiEIVDAddr; 3267 for(UInt ui=0; ui<MRG_MAX_NUM_CANDS; ui++) if ( ui!=uiEIVDAddr && abCandIsInter[ui] ) {uiRefArrayAddr = ui; break;} 3268 if(uiRefArrayAddr != uiEIVDAddr) 3269 { 3270 puhInterDirNeighbours[uiEIVDAddr] = puhInterDirNeighbours[uiRefArrayAddr]; 3271 pcMvFieldNeighbours[uiEIVDAddr << 1].setMvField(pcMvFieldNeighbours[uiRefArrayAddr << 1].getMv(),pcMvFieldNeighbours[uiRefArrayAddr << 1].getRefIdx()); 3272 pcMvFieldNeighbours[(uiEIVDAddr << 1)+1].setMvField(pcMvFieldNeighbours[(uiRefArrayAddr << 1)+1].getMv(),pcMvFieldNeighbours[(uiRefArrayAddr << 1)+1].getRefIdx()); 3273 } 3274 else 3275 { 3276 TComMv cMVzero; cMVzero.setZero(); 3277 if( getSlice()->isInterB() ) 3278 { 3279 puhInterDirNeighbours[uiEIVDAddr] = 3; 3280 pcMvFieldNeighbours[uiEIVDAddr << 1].setMvField(cMVzero,0); 3281 pcMvFieldNeighbours[(uiEIVDAddr << 1)+1].setMvField(cMVzero,0); 3282 } 3283 else 3284 { 3285 if(getSlice()->getNumRefIdx(REF_PIC_LIST_0)>0) 3286 { 3287 puhInterDirNeighbours[uiEIVDAddr] = 1; 3288 pcMvFieldNeighbours[uiEIVDAddr << 1].setMvField(cMVzero,0); 3289 } 3290 else if(getSlice()->getNumRefIdx(REF_PIC_LIST_1)>0) 3291 { 3292 puhInterDirNeighbours[uiEIVDAddr] = 2; 3293 pcMvFieldNeighbours[(uiEIVDAddr << 1)+1].setMvField(cMVzero,0); 3294 } 3295 else puhInterDirNeighbours[uiEIVDAddr] = 0; 3296 } 3297 } 3298 if(puhInterDirNeighbours[uiEIVDAddr]) 3299 { 3300 abCandIsInter[uiEIVDAddr] = true; 3301 puiNeighbourCandIdx[uiEIVDAddr] = uiEIVDAddr + 1; 3302 } 3303 } 3304 #endif 3305 3193 3306 3194 3307 //===== remove duplicates ===== 3195 3308 for( UInt uiOuter = 0; uiOuter < MRG_MAX_NUM_CANDS; uiOuter++ ) 3196 3309 { 3310 #if POZNAN_EIVD 3311 if(uiOuter==POZNAN_EIVD_MRG_CAND) continue; 3312 #endif 3197 3313 if( abCandIsInter[ uiOuter ] && ( puiNeighbourCandIdx[uiOuter] == uiOuter + 1 ) ) 3198 3314 { 3199 3315 for( UInt uiIter = uiOuter + 1; uiIter < MRG_MAX_NUM_CANDS; uiIter++ ) 3200 3316 { 3317 #if POZNAN_EIVD 3318 if(uiIter==POZNAN_EIVD_MRG_CAND) continue; 3319 #endif 3201 3320 if( abCandIsInter[ uiIter ] ) 3202 3321 { … … 3280 3399 { 3281 3400 if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx ) 3282 #if POZNAN_ ENCODE_ONLY_DISOCCLUDED_CU3401 #if POZNAN_CU_SKIP 3283 3402 && !pcCorner->isCUSkiped( uiCornerPUIdx ) 3284 3403 #endif … … 3319 3438 { 3320 3439 if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx ) 3321 #if POZNAN_ ENCODE_ONLY_DISOCCLUDED_CU3440 #if POZNAN_CU_SKIP 3322 3441 && !pcCorner->isCUSkiped( uiCornerPUIdx ) 3323 3442 #endif … … 4441 4560 if (pColCU->isIntra(uiPartIdxCenter)) 4442 4561 return false; 4443 4444 #if POZNAN_ ENCODE_ONLY_DISOCCLUDED_CU4562 4563 #if POZNAN_CU_SKIP 4445 4564 if (pColCU->isSkipped(uiPartIdxCenter)) 4446 4565 return false; … … 4804 4923 } 4805 4924 #endif 4925 4926 #if POZNAN_EIVD_CALC_PRED_DATA 4927 pcCU->getCUMvField2nd( REF_PIC_LIST_0 )->copyTo( &m_acCUMvField2nd[0], -Int(uiAbsPartIdxSrc) + uiAbsPartIdxDst, uiAbsPartIdxSrc, uiNumPartition ); 4928 pcCU->getCUMvField2nd( REF_PIC_LIST_1 )->copyTo( &m_acCUMvField2nd[1], -Int(uiAbsPartIdxSrc) + uiAbsPartIdxDst, uiAbsPartIdxSrc, uiNumPartition ); 4929 #if HHI_FULL_PEL_DEPTH_MAP_MV_ACC 4930 for( UInt ui = 0; ui < uiNumPartition; ui++ ) 4931 { 4932 m_acCUMvField2nd[0].getMv( uiAbsPartIdxDst + ui ) += TComMv( 2, 2 ); 4933 m_acCUMvField2nd[0].getMv( uiAbsPartIdxDst + ui ) >>= 2; 4934 4935 m_acCUMvField2nd[1].getMv( uiAbsPartIdxDst + ui ) += TComMv( 2, 2 ); 4936 m_acCUMvField2nd[1].getMv( uiAbsPartIdxDst + ui ) >>= 2; 4937 4938 m_acCUMvField2nd[0].getMvd( uiAbsPartIdxDst + ui ) += TComMv( 2, 2 ); 4939 m_acCUMvField2nd[0].getMvd( uiAbsPartIdxDst + ui ) >>= 2; 4940 4941 m_acCUMvField2nd[1].getMvd( uiAbsPartIdxDst + ui ) += TComMv( 2, 2 ); 4942 m_acCUMvField2nd[1].getMvd( uiAbsPartIdxDst + ui ) >>= 2; 4943 } 4944 #endif 4945 #endif 4806 4946 } 4807 4947 #endif … … 4812 4952 riPosY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIndex]] + getCUPelY(); 4813 4953 } 4954 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 4955 Int TComDataCU::CuQpIncrementFunction(Pel uiBlockMax) 4956 { 4957 if((uiBlockMax >> g_uiBitIncrement) >= 256 || (uiBlockMax >> g_uiBitIncrement) <0) 4958 { 4959 fprintf(stderr, "Bitincrement = %d, uiBlockMax = %d\n", g_uiBitIncrement, uiBlockMax); 4960 exit(333); 4961 } 4962 Float fVal = (Float)((255 - (uiBlockMax >> g_uiBitIncrement)) >> 4); 4963 fVal = (fVal * fVal); 4964 #if POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC 4965 fVal = (Float)( fVal + getPic()->getTextureCuDeltaQpOffset() * 32); // add offset, if offset is negative than objects in front will have smaller QP than originaly - quality in front will be increased and in bacground will be decreased 4966 fVal = (Float)( fVal * getPic()->getTextureCuDeltaQpMul()); // 4967 #else 4968 fVal = (Float)( fVal + POZNAN_TEXTURE_TU_DELTA_QP_OFFSET * 32); // add offset, if offset is negative objects in front will have smaller QP than in original approach - quality in front will be increased and in bacground will be decreased 4969 fVal = (Float)( fVal * POZNAN_TEXTURE_TU_DELTA_QP_MUL); // 4970 #endif 4971 return (Int)fVal >> 5; 4972 } 4973 Int TComDataCU::getQpOffsetForTextCU(UInt uiPartIdx, Bool bIsIntra) 4974 { 4975 //if(!isTexture(getSlice()->getViewId())) 4976 if(this->getPic()->getSlice(0)->getSPS()->isDepth()) 4977 { 4978 return 0; 4979 } 4980 #if POZNAN_TEXTURE_TU_DELTA_QP_NOT_IN_BASE_VIEW 4981 //if(!getPic()->getIsSideView()) 4982 if(this->getPic()->getViewIdx() == 0)//KUBA czy indeksy na pewno s¹ od zera? 4983 { 4984 return 0; 4985 } 4986 #endif 4987 UInt iCuAddr = getAddr(); 4988 //TComPic * pcDepthPic = getPic()->getDepthPic(); 4989 TComPicYuv * pcDepthPicYUV = getPic()->getPicYuvSynthDepth(); 4990 if(pcDepthPicYUV /*pcDepthPic*/ == NULL) 4991 { 4992 char errortext[200]; 4993 sprintf(errortext, "depth map expected"); 4994 fprintf(stderr, "%s\n", errortext); 4995 exit(123); 4996 } 4997 //TComDataCU* rpcCUDepth = pcDepthPic->getCU(iCuAddr); 4998 Pel uiDepthLumaTransformBlockMax; 4999 if(bIsIntra) 5000 { 5001 // in intra block CU each TU block has QP chosen separatly so dQP is calculated for TU 5002 uiDepthLumaTransformBlockMax = getDepthLumaTransformBlockMax( pcDepthPicYUV /*rpcCUDepth*/, iCuAddr, uiPartIdx ); 5003 } 5004 else 5005 { 5006 // in inter block CU all TU block has the same QP so dQP is calculated for CU 5007 uiDepthLumaTransformBlockMax = getDepthLumaCodingBlockMax( pcDepthPicYUV /*rpcCUDepth*/, iCuAddr, uiPartIdx ); 5008 } 5009 #if POZNAN_NONLINEAR_DEPTH 5010 //Pel liczby_w[256]; 5011 //Pel liczby_t[256]; 5012 //Pel liczby_o[256]; 5013 //Float p = 1.9; 5014 //TComPowerConverter powconv_t(p, g_uiBitIncrement, g_uiBitIncrement); 5015 //TComPowerConverter powconv_o(1.0f/p, g_uiBitIncrement, g_uiBitIncrement); 5016 //for(UInt i = 0; i <256; i++) 5017 //{ 5018 // liczby_w[i] = i<<2; 5019 // liczby_t[i] = (Pel)( powconv_t(liczby_w[i]) + 0.5); 5020 // liczby_o[i] = (Pel)( powconv_o(liczby_t[i]) + 0.5)>>2; 5021 //} 5022 //printf("\n"); 5023 //if(bIsIntra)printf("intra "); 5024 //else printf("inter "); 5025 //printf("in:%d, ", uiDepthLumaTransformBlockMax); 5026 Float p = 1.0f / getSlice()->getSPS()->getDepthPower(); 5027 //printf("p:%f, ", p); 5028 TComPowerConverter powconv(p, g_uiBitIncrement, g_uiBitIncrement); 5029 uiDepthLumaTransformBlockMax = (Pel)( powconv(uiDepthLumaTransformBlockMax) + 0.5); 5030 //printf("out:%d, ", uiDepthLumaTransformBlockMax); 5031 #endif 5032 Int iDeltaQP = CuQpIncrementFunction(uiDepthLumaTransformBlockMax); 5033 //printf("dQP:%d ", iDeltaQP); 5034 #if POZNAN_TEXTURE_TU_DELTA_QP_TOP_BOTTOM_CU_ROW 5035 Int iMaxCUHeight = this->getPic()->getPicSym()->getMaxCUHeight(); 5036 Int iPicHeight = this->getPic()->getPicSym()->getPicHeight(); 5037 Int iLastPelYInFirstCURow = 0 + iMaxCUHeight; 5038 Int iFirstPelYInLastCURow = iPicHeight - iMaxCUHeight; 5039 Int iCUStartPelY = getCUPelY(); 5040 if((iCUStartPelY <= iLastPelYInFirstCURow) || (iCUStartPelY >= iFirstPelYInLastCURow)) 5041 { 5042 #if POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC 5043 iDeltaQP += getPic()->getTextureCuDeltaQpTopBottomRow();// POZNAN_TEXTURE_TU_DELTA_QP_TOP_BOTTOM_CU_ROW; 5044 #else 5045 iDeltaQP += POZNAN_TEXTURE_TU_DELTA_QP_TOP_BOTTOM_ROW_VAL;// POZNAN_TEXTURE_TU_DELTA_QP_TOP_BOTTOM_CU_ROW; 5046 #endif 5047 } 5048 #endif 5049 return iDeltaQP; 5050 } 5051 5052 Int cmpProc(const Void *arg1, const Void *arg2) 5053 { 5054 return *((Pel*)arg2) - *((Pel*)arg1); 5055 } 5056 5057 // Function gets median value of depth block that has the same size and position as texture block that calls this function 5058 Pel TComDataCU::getDepthLumaCodingBlockMedian( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx ) 5059 { 5060 static Pel pSortTable [64 * 64]; 5061 Int CUWidth, CUHeight; 5062 sortDepthLumaCodingBlock( pcDepthPicYUV /*rpcCUDepth*/, iCuAddr, uiPartIdx, pSortTable, CUWidth, CUHeight ); 5063 return pSortTable[(CUHeight * CUWidth) / 2]; 5064 } 5065 5066 // Function gets maximal value of depth block that has the same size and position as texture block that calls this function 5067 Pel TComDataCU::getDepthLumaCodingBlockMax( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx ) 5068 { 5069 return maxDepthLumaCodingBlock( pcDepthPicYUV /*rpcCUDepth*/, iCuAddr, uiPartIdx); 5070 } 5071 Void TComDataCU::sortDepthLumaCodingBlock ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx, Pel * pSortTable, Int& CUWidth, Int& CUHeight ) 5072 { 5073 Int x, y; 5074 UInt uiAbsZorderIdx = getZorderIdxInCU() + uiPartIdx; 5075 // CU size: 5076 CUHeight = getHeight(uiPartIdx); // Size is based on coded texture block size not on depth picture size 5077 CUWidth = getWidth(uiPartIdx); 5078 // uiAbsZorderIdx is z order idx of one particular base block (4x4 pix) in block that we process 5079 // What we need is z-order idx of first Base block (4x4 pix) in this block 5080 Int iNumBase4x4InBlock = (CUWidth >> 2) * (CUHeight >> 2); 5081 5082 UInt uiAbsZorderIdxBlockStart = (uiAbsZorderIdx / iNumBase4x4InBlock) * iNumBase4x4InBlock; 5083 // Address of block 5084 Pel* pPel = pcDepthPicYUV/*rpcCUDepth->getPic()->getPicYuvRec()*/->getLumaAddr ( iCuAddr, uiAbsZorderIdxBlockStart ); 5085 5086 Int p =0; 5087 Int iStride = getPic()->getPicYuvRec()->getStride(); 5088 for ( y = CUHeight - 1; y >= 0; y-- ) 5089 { 5090 for ( x = CUWidth - 1; x >= 0; x-- ) 5091 { 5092 pSortTable[p] = pPel[x]; ++p; 5093 } 5094 pPel += iStride; 5095 } 5096 // sort elements 5097 qsort(pSortTable, CUHeight * CUWidth, sizeof(Pel), cmpProc); 5098 } 5099 5100 Pel TComDataCU::maxDepthLumaCodingBlock ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx) 5101 { 5102 Int x, y; 5103 UInt uiAbsZorderIdx = getZorderIdxInCU() + uiPartIdx; 5104 // CU size: 5105 Int CUHeight = getHeight(uiPartIdx); // Size is based on coded texture block size not on depth picture size 5106 Int CUWidth = getWidth(uiPartIdx); 5107 // uiAbsZorderIdx is z order idx of one particular base block (4x4 pix) in block that we process 5108 // What we need is z-order idx of first Base block (4x4 pix) in this block 5109 Int iNumBase4x4InBlock = (CUWidth >> 2) * (CUHeight >> 2); 5110 5111 UInt uiAbsZorderIdxBlockStart = (uiAbsZorderIdx / iNumBase4x4InBlock) * iNumBase4x4InBlock; 5112 // Address of block 5113 Pel* pPel = pcDepthPicYUV/*rpcCUDepth->getPic()->getPicYuvRec()*/->getLumaAddr ( iCuAddr, uiAbsZorderIdxBlockStart ); 5114 5115 Pel pValue = 0; 5116 Int iStride = getPic()->getPicYuvRec()->getStride(); 5117 for ( y = CUHeight - 1; y >= 0; y-- ) 5118 { 5119 for ( x = CUWidth - 1; x >= 0; x-- ) 5120 { 5121 if (pPel[x]>pValue) pValue = pPel[x]; 5122 } 5123 pPel += iStride; 5124 } 5125 return pValue; 5126 } 5127 5128 // Function gets median value of depth block that has the same size and position as texture block that calls this function 5129 Pel TComDataCU::getDepthLumaTransformBlockMedian( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx ) 5130 { 5131 static Pel pSortTable [64 * 64]; 5132 Int TUWidth, TUHeight; 5133 sortDepthLumaTransformBlock( pcDepthPicYUV/*rpcCUDepth*/, iCuAddr, uiPartIdx, pSortTable, TUWidth, TUHeight ); 5134 return pSortTable[(TUHeight * TUWidth) / 2]; 5135 } 5136 5137 // Function gets maximal value of depth block that has the same size and position as texture block that calls this function 5138 Pel TComDataCU::getDepthLumaTransformBlockMax( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx ) 5139 { 5140 return maxDepthLumaTransformBlock( pcDepthPicYUV/*rpcCUDepth*/, iCuAddr, uiPartIdx ); 5141 } 5142 Void TComDataCU::sortDepthLumaTransformBlock ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx, Pel * pSortTable, Int& TUWidth, Int& TUHeight ) 5143 { 5144 Int x, y; 5145 UInt uiAbsZorderIdx = getZorderIdxInCU() + uiPartIdx; 5146 // CU size: 5147 TUHeight = getHeight(uiPartIdx); // Size is based on coded texture block size not on depth picture size 5148 TUWidth = getWidth(uiPartIdx); 5149 // correct CU size to trnsform size: 5150 if( getTransformIdx(uiPartIdx) ) 5151 { 5152 TUWidth = TUWidth >> 1; 5153 TUHeight = TUHeight >> 1; 5154 } 5155 // uiAbsZorderIdx is z order idx of one particular base block (4x4 pix) in block that we process 5156 // What we need is z-order idx of first Base block (4x4 pix) in this block 5157 Int iNumBase4x4InBlock = (TUWidth >> 2) * (TUHeight >> 2); 5158 5159 UInt uiAbsZorderIdxBlockStart = (uiAbsZorderIdx / iNumBase4x4InBlock) * iNumBase4x4InBlock; 5160 // Address of block 5161 Pel* pPel = pcDepthPicYUV/*rpcCUDepth->getPic()->getPicYuvRec()*/->getLumaAddr ( iCuAddr, uiAbsZorderIdxBlockStart ); 5162 5163 int p = 0; 5164 Int iStride = getPic()->getPicYuvRec()->getStride(); 5165 for ( y = TUHeight - 1; y >= 0; y-- ) 5166 { 5167 for ( x = TUWidth - 1; x >= 0; x-- ) 5168 { 5169 pSortTable[p] = pPel[x]; 5170 } 5171 pPel += iStride; 5172 } 5173 // sort elements 5174 qsort(pSortTable, TUHeight * TUWidth, sizeof(Pel), cmpProc); 5175 } 5176 Pel TComDataCU::maxDepthLumaTransformBlock ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx) 5177 { 5178 Int x, y; 5179 UInt uiAbsZorderIdx = getZorderIdxInCU() + uiPartIdx; 5180 // CU size: 5181 Int TUHeight = getHeight(uiPartIdx); // Size is based on coded texture block size not on depth picture size 5182 Int TUWidth = getWidth(uiPartIdx); 5183 // correct CU size to trnsform size: 5184 if( getTransformIdx(uiPartIdx) ) 5185 { 5186 TUWidth = TUWidth >> 1; 5187 TUHeight = TUHeight >> 1; 5188 } 5189 // uiAbsZorderIdx is z order idx of one particular base block (4x4 pix) in block that we process 5190 // What we need is z-order idx of first Base block (4x4 pix) in this block 5191 Int iNumBase4x4InBlock = (TUWidth >> 2) * (TUHeight >> 2); 5192 5193 UInt uiAbsZorderIdxBlockStart = (uiAbsZorderIdx / iNumBase4x4InBlock) * iNumBase4x4InBlock; 5194 // Address of block 5195 Pel* pPel = pcDepthPicYUV/*rpcCUDepth->getPic()->getPicYuvRec()*/->getLumaAddr ( iCuAddr, uiAbsZorderIdxBlockStart ); 5196 5197 Pel pValue = 0; 5198 Int iStride = getPic()->getPicYuvRec()->getStride(); 5199 for ( y = TUHeight - 1; y >= 0; y-- ) 5200 { 5201 for ( x = TUWidth - 1; x >= 0; x-- ) 5202 { 5203 if (pPel[x]>pValue) pValue = pPel[x]; 5204 } 5205 pPel += iStride; 5206 } 5207 return pValue; 5208 } 5209 // Function gets median value of depth block that has the same size and position as texture block that calls this function 5210 Pel TComDataCU::getDepthLumaPredictionBlockMedian( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx ) 5211 { 5212 static Pel pSortTable [64 * 64]; 5213 Int PUWidth, PUHeight; 5214 sortDepthLumaPredictionBlock( pcDepthPicYUV/*rpcCUDepth*/, iCuAddr, uiPartIdx, pSortTable, PUWidth, PUHeight ); 5215 return pSortTable[(PUHeight * PUWidth) / 2]; 5216 } 5217 5218 // Function gets maximal value of depth block that has the same size and position as texture block that calls this function 5219 Pel TComDataCU::getDepthLumaPredictionBlockMax( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx ) 5220 { 5221 static Pel pSortTable [64 * 64]; 5222 Int PUWidth, PUHeight; 5223 sortDepthLumaPredictionBlock( pcDepthPicYUV/*rpcCUDepth*/, iCuAddr, uiPartIdx, pSortTable, PUWidth, PUHeight ); 5224 return pSortTable[0]; 5225 } 5226 Void TComDataCU::sortDepthLumaPredictionBlock ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx, Pel * pSortTable, Int& PUWidth, Int& PUHeight ) 5227 { 5228 Int x, y; 5229 UInt uiAbsZorderIdx = getZorderIdxInCU() + uiPartIdx; 5230 // CU size: 5231 PUHeight = getHeight(uiPartIdx); // Size is based on coded texture block size not on depth picture size 5232 PUWidth = getWidth(uiPartIdx); 5233 // correct CU size to partition size: 5234 if( getPartitionSize(uiPartIdx) == SIZE_Nx2N || getPartitionSize(uiPartIdx) == SIZE_NxN ) 5235 { 5236 PUWidth = PUWidth >> 1; 5237 } 5238 if( getPartitionSize(uiPartIdx) == SIZE_2NxN || getPartitionSize(uiPartIdx) == SIZE_NxN ) 5239 { 5240 PUHeight = PUHeight >> 1; 5241 } 5242 5243 // uiAbsZorderIdx is z order idx of one particular base block (4x4 pix) in block that we process 5244 // What we need is z-order idx of first Base block (4x4 pix) in this block 5245 Int iNumBase4x4InBlock = (PUWidth >> 2) * (PUHeight >> 2); 5246 if(getPartitionSize(uiPartIdx) == SIZE_Nx2N) 5247 { 5248 iNumBase4x4InBlock = iNumBase4x4InBlock << 1; // KUBA if PU is Nx2N than to count start z-order idx we need to make such trick 5249 } 5250 UInt uiAbsZorderIdxBlockStart = (uiAbsZorderIdx / iNumBase4x4InBlock) * iNumBase4x4InBlock; 5251 // Address of block 5252 Pel* pPel = pcDepthPicYUV/*rpcCUDepth->getPic()->getPicYuvRec()*/->getLumaAddr ( iCuAddr, uiAbsZorderIdxBlockStart ); 5253 5254 UInt uiStride = getPic()->getPicYuvRec()->getStride(); 5255 for ( y = PUHeight - 1; y >= 0; y-- ) 5256 { 5257 for ( x = PUWidth - 1; x >= 0; x-- ) 5258 { 5259 pSortTable[y*PUWidth + x] = pPel[y*uiStride + x]; 5260 } 5261 } 5262 // sort elements 5263 qsort(pSortTable, PUHeight * PUWidth, sizeof(Pel), cmpProc); 5264 } 5265 #endif -
branches/0.2-poznan-univ/source/Lib/TLibCommon/TComDataCU.h
r11 r12 105 105 #endif//SNY_DQP 106 106 107 #if POZNAN_EIVD_CALC_PRED_DATA 108 TComCUMvField m_acCUMvField2nd[2]; ///< array of motion vectors selected for points with no MP prediction available 109 #endif 110 107 111 // ------------------------------------------------------------------------------------------------------------------- 108 112 // neighbour access variables … … 310 314 #endif 311 315 316 #if POZNAN_EIVD_CALC_PRED_DATA 317 TComCUMvField* getCUMvField2nd ( RefPicList e ) { return &m_acCUMvField2nd[e]; } 318 #endif 319 312 320 // ------------------------------------------------------------------------------------------------------------------- 313 321 // member functions for coding tool information … … 529 537 Bool isIntra ( UInt uiPartIdx ) { return m_pePredMode[ uiPartIdx ] == MODE_INTRA; } 530 538 Bool isSkipped ( UInt uiPartIdx ); ///< SKIP (no residual) 531 #if POZNAN_ ENCODE_ONLY_DISOCCLUDED_CU539 #if POZNAN_CU_SKIP 532 540 Bool isCUSkiped( UInt uiPartIdx ) { return m_pePredMode[ uiPartIdx ] == MODE_SYNTH; } 533 541 #endif … … 588 596 #endif //QC_MDCS 589 597 598 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 599 Int CuQpIncrementFunction ( Pel uiBlockMax ); 600 Int getQpOffsetForTextCU ( UInt uiPartIdx, Bool bIsIntra ); 601 Pel getDepthLumaCodingBlockMedian ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx ); 602 Pel getDepthLumaCodingBlockMax ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx ); 603 Void sortDepthLumaCodingBlock ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx, Pel * pSortTable, Int& TUWidth, Int& TUHeight); 604 Pel maxDepthLumaCodingBlock ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx ); 605 Pel getDepthLumaTransformBlockMedian ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx ); 606 Pel getDepthLumaTransformBlockMax ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx ); 607 Void sortDepthLumaTransformBlock ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx , Pel * pSortTable, Int& TUWidth, Int& TUHeight); 608 Pel maxDepthLumaTransformBlock ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx ); 609 Pel getDepthLumaPredictionBlockMedian( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx ); 610 Pel getDepthLumaPredictionBlockMax ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx ); 611 Void sortDepthLumaPredictionBlock ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx , Pel * pSortTable, Int& PUWidth, Int& PUHeight); 612 #endif 590 613 }; 591 614 -
branches/0.2-poznan-univ/source/Lib/TLibCommon/TComDepthMapGenerator.cpp
r11 r12 478 478 Pel* pSrcSamples = pcPicYuv->getLumaAddr ( 0 ); 479 479 Pel* pDstSamples = m_cTmpPic.getLumaAddr ( 0 ); 480 Int iDstStrideC = m_cTmpPic.getCStride ( ); 481 Pel* pDstSamplesCb = m_cTmpPic.getCbAddr ( 0 ); 482 Pel* pDstSamplesCr = m_cTmpPic.getCrAddr ( 0 ); 480 483 Int iMidOrgDpth = ( 1 << m_uiOrgDepthBitDepth ) >> 1; 481 484 AOF( m_cTmpPic.getWidth () == iWidth ); … … 483 486 for( Int iY = 0; iY < iHeight; iY++, pSrcSamples += iSrcStride, pDstSamples += iDstStride ) 484 487 { 488 if((iY%2) == 0 && iY != 0) 489 { 490 pDstSamplesCb += iDstStrideC; 491 pDstSamplesCr += iDstStrideC; 492 } 485 493 for( Int iX = 0; iX < iWidth; iX++ ) 486 494 { 495 if(pSrcSamples[ iX ] < 0)//== PDM_UNDEFINED_DEPTH) 496 { 497 pDstSamplesCb[ iX>>1 ] = 0; 498 pDstSamplesCr[ iX>>1 ] = 0; 499 } 487 500 Int iOrgDepth = ( pSrcSamples[ iX ] != PDM_UNDEFINED_DEPTH ? xGetOrigDepthFromVirtDepth( uiViewId, pSrcSamples[ iX ] ) : iMidOrgDpth ); 488 501 pDstSamples[ iX ] = Max( 0, Min( iMax, iOrgDepth ) ); … … 494 507 ::sprintf ( acFilename, "%s_V%d.yuv", pFilenameBase, uiViewId ); 495 508 m_cTmpPic.dump( acFilename, ( pcPic->getPOC() != 0 ) ); 509 510 pDstSamplesCb = m_cTmpPic.getCbAddr ( 0 ); 511 pDstSamplesCr = m_cTmpPic.getCrAddr ( 0 ); 512 for( Int iY = 0; iY < iHeight>>1; iY++, pDstSamplesCb += iDstStrideC, pDstSamplesCr += iDstStrideC) 513 { 514 for( Int iX = 0; iX < iWidth>>1; iX++ ) 515 { 516 pDstSamplesCb[ iX ] = iMidOrgDpth; 517 pDstSamplesCr[ iX ] = iMidOrgDpth; 518 } 519 } 496 520 } 497 521 … … 971 995 xInterPredictCUDepthMap( pcSubCU, pcSubDM ); 972 996 break; 973 #if POZNAN_ ENCODE_ONLY_DISOCCLUDED_CU997 #if POZNAN_CU_SKIP 974 998 case MODE_SYNTH: 975 //What to do? Need Fix !999 //What to do? Need Fix? 976 1000 xIntraPredictCUDepthMap( pcSubCU, pcSubDM ); 977 1001 break; -
branches/0.2-poznan-univ/source/Lib/TLibCommon/TComLoopFilter.cpp
r11 r12 445 445 //-- Set BS for Intra MB : BS = 4 or 3 446 446 if ( pcCUP->isIntra(uiPartP) || pcCUQ->isIntra(uiPartQ) 447 #if POZNAN_ ENCODE_ONLY_DISOCCLUDED_CU447 #if POZNAN_CU_SKIP && POZNAN_CU_SYNTH 448 448 || pcCUP->isCUSkiped(uiPartP) || pcCUQ->isCUSkiped(uiPartQ) 449 449 #endif … … 455 455 //-- Set BS for not Intra MB : BS = 2 or 1 or 0 456 456 if ( !pcCUP->isIntra(uiPartP) && !pcCUQ->isIntra(uiPartQ) 457 #if POZNAN_ ENCODE_ONLY_DISOCCLUDED_CU457 #if POZNAN_CU_SKIP && POZNAN_CU_SYNTH 458 458 && !pcCUP->isCUSkiped(uiPartP) && !pcCUQ->isCUSkiped(uiPartQ) 459 459 #endif … … 536 536 } // enf of "if( not Intra )" 537 537 538 #if POZNAN_ ENCODE_ONLY_DISOCCLUDED_CU//if one of the block is CUSkipped dont use loop filter538 #if POZNAN_CU_SKIP //if one of the block is CUSkipped dont use loop filter 539 539 if ( pcCUP->isCUSkiped(uiPartP) || pcCUQ->isCUSkiped(uiPartQ)) 540 540 { -
branches/0.2-poznan-univ/source/Lib/TLibCommon/TComPic.cpp
r11 r12 50 50 m_apcPicYuv[0] = NULL; 51 51 m_apcPicYuv[1] = NULL; 52 #if POZNAN_ AVAIL_MAP52 #if POZNAN_CU_SYNTH || POZNAN_CU_SKIP || POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 53 53 m_apcPicYuvAvail = NULL; 54 54 #endif 55 #if POZNAN_ SYNTH_VIEW55 #if POZNAN_CU_SYNTH 56 56 m_apcPicYuvSynth = NULL; 57 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 58 m_apcPicYuvSynthDepth= NULL; 59 #endif 57 60 #endif 58 61 #if DEPTH_MAP_GENERATION … … 122 125 m_apcPicYuv[1] = NULL; 123 126 } 124 #if POZNAN_ AVAIL_MAP127 #if POZNAN_CU_SYNTH || POZNAN_CU_SKIP || POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 125 128 if (m_apcPicYuvAvail) 126 129 { … … 131 134 #endif 132 135 133 #if POZNAN_ SYNTH_VIEW136 #if POZNAN_CU_SYNTH 134 137 if (m_apcPicYuvSynth) 135 138 { … … 138 141 m_apcPicYuvSynth = NULL; 139 142 } 143 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 144 if (m_apcPicYuvSynthDepth) 145 { 146 m_apcPicYuvSynthDepth->destroy(); 147 delete m_apcPicYuvSynthDepth; 148 m_apcPicYuvSynthDepth = NULL; 149 } 150 #endif 140 151 #endif 141 152 … … 216 227 } 217 228 218 #if POZNAN_ AVAIL_MAP229 #if POZNAN_CU_SYNTH || POZNAN_CU_SKIP || POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 219 230 Void 220 231 TComPic::addAvailabilityBuffer() … … 232 243 #endif 233 244 234 #if POZNAN_ SYNTH_VIEW245 #if POZNAN_CU_SYNTH 235 246 Void 236 247 TComPic::addSynthesisBuffer() … … 246 257 m_apcPicYuvSynth ->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth ); 247 258 } 259 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 260 Void 261 TComPic::addSynthesisDepthBuffer() 262 { 263 AOT( m_apcPicYuvSynthDepth ); 264 AOF( m_apcPicYuv[1] ); 265 Int iWidth = m_apcPicYuv[1]->getWidth (); 266 Int iHeight = m_apcPicYuv[1]->getHeight (); 267 UInt uiMaxCuWidth = m_apcPicYuv[1]->getMaxCuWidth (); 268 UInt uiMaxCuHeight = m_apcPicYuv[1]->getMaxCuHeight(); 269 UInt uiMaxCuDepth = m_apcPicYuv[1]->getMaxCuDepth (); 270 m_apcPicYuvSynthDepth = new TComPicYuv; 271 m_apcPicYuvSynthDepth ->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth ); 272 } 273 #endif 248 274 #endif 249 275 … … 339 365 } 340 366 341 #if POZNAN_ AVAIL_MAP367 #if POZNAN_CU_SYNTH || POZNAN_CU_SKIP || POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 342 368 Void 343 369 TComPic::removeAvailabilityBuffer() … … 352 378 #endif 353 379 354 #if POZNAN_ SYNTH_VIEW380 #if POZNAN_CU_SYNTH 355 381 Void 356 382 TComPic::removeSynthesisBuffer() … … 363 389 } 364 390 } 391 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 392 Void 393 TComPic::removeSynthesisDepthBuffer() 394 { 395 if( m_apcPicYuvSynthDepth ) 396 { 397 m_apcPicYuvSynthDepth->destroy(); 398 delete m_apcPicYuvSynthDepth; 399 m_apcPicYuvSynthDepth = NULL; 400 } 401 } 402 #endif 365 403 #endif 366 404 … … 430 468 #endif 431 469 432 #if POZNAN_ AVAIL_MAP470 #if POZNAN_CU_SYNTH || POZNAN_CU_SKIP 433 471 Void TComPic::checkSynthesisAvailability( TComDataCU*& rpcCU, UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth, Bool *&rpbCUSynthesied ) 434 472 { -
branches/0.2-poznan-univ/source/Lib/TLibCommon/TComPic.h
r11 r12 62 62 TComPicYuv* m_apcPicYuv[2]; // Texture, 0:org / 1:rec 63 63 64 #if POZNAN_ AVAIL_MAP64 #if POZNAN_CU_SYNTH || POZNAN_CU_SKIP || POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 65 65 TComPicYuv* m_apcPicYuvAvail; // Availability Map - Does the given pixel can be synthesised in receiver 66 66 #endif 67 67 68 #if POZNAN_ SYNTH_VIEW68 #if POZNAN_CU_SYNTH 69 69 TComPicYuv* m_apcPicYuvSynth; // Sythesied image 70 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 71 TComPicYuv* m_apcPicYuvSynthDepth; // Sythesied depth image 72 #endif 70 73 #endif 71 74 … … 107 110 #if HHI_INTERVIEW_SKIP 108 111 TComPicYuv* m_pcUsedPelsMap; 112 #endif 113 #if POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC 114 Double m_dTextureCuDeltaQpOffset; 115 Double m_dTextureCuDeltaQpMul; 116 Int m_iTextureCuDeltaQpTopBottomRow; 109 117 #endif 110 118 … … 136 144 TComPicYuv* getPicYuvRec() { return m_apcPicYuv[1]; } 137 145 138 #if POZNAN_ AVAIL_MAP146 #if POZNAN_CU_SYNTH || POZNAN_CU_SKIP || POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 139 147 TComPicYuv* getPicYuvAvail() { return m_apcPicYuvAvail; } //Owieczka - returns available map from other pic image 140 148 #endif 141 149 142 #if POZNAN_ SYNTH_VIEW150 #if POZNAN_CU_SYNTH 143 151 TComPicYuv* getPicYuvSynth() { return m_apcPicYuvSynth; } //Owieczka - returns synth form other pic in image 152 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 153 TComPicYuv* getPicYuvSynthDepth() { return m_apcPicYuvSynthDepth; }; // Sythesied depth image 154 #endif 144 155 #endif 145 156 … … 213 224 214 225 Void addOriginalBuffer (); 215 #if POZNAN_ AVAIL_MAP226 #if POZNAN_CU_SYNTH || POZNAN_CU_SKIP || POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 216 227 Void addAvailabilityBuffer (); 217 228 #endif 218 #if POZNAN_ SYNTH_VIEW229 #if POZNAN_CU_SYNTH 219 230 Void addSynthesisBuffer (); 231 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 232 Void addSynthesisDepthBuffer (); 233 #endif 220 234 #endif 221 235 #if PARALLEL_MERGED_DEBLK … … 237 251 238 252 Void removeOriginalBuffer (); 239 #if POZNAN_ SYNTH_VIEW253 #if POZNAN_CU_SYNTH 240 254 Void removeSynthesisBuffer (); 241 #endif 242 #if POZNAN_AVAIL_MAP 255 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 256 Void removeSynthesisDepthBuffer (); 257 #endif 258 #endif 259 #if POZNAN_CU_SYNTH || POZNAN_CU_SKIP || POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 243 260 Void removeAvailabilityBuffer(); 244 261 #endif … … 259 276 #endif 260 277 261 #if POZNAN_ AVAIL_MAP278 #if POZNAN_CU_SYNTH || POZNAN_CU_SKIP 262 279 Void checkSynthesisAvailability( TComDataCU*& rpcBestCU, UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth, Bool *&rpbCUSynthesied); 263 280 #endif … … 280 297 const SEImessages* getSEIs() const { return m_SEIs; } 281 298 299 #if POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC 300 Double getTextureCuDeltaQpOffset( ) { return m_dTextureCuDeltaQpOffset;} 301 Double getTextureCuDeltaQpMul( ) { return m_dTextureCuDeltaQpMul;} 302 Int getTextureCuDeltaQpTopBottomRow( ){ return m_iTextureCuDeltaQpTopBottomRow;} 303 Void setTextureCuDeltaQpOffset ( Double dTextureCuDeltaQpOffset ){ m_dTextureCuDeltaQpOffset = dTextureCuDeltaQpOffset; } 304 Void setTextureCuDeltaQpMul ( Double dTextureCuDeltaQpMul ){ m_dTextureCuDeltaQpMul = dTextureCuDeltaQpMul; } 305 Void setTextureCuDeltaQpTopBottomRow( Int iTextureCuDeltaQpTopBottomRow ){ m_iTextureCuDeltaQpTopBottomRow = iTextureCuDeltaQpTopBottomRow; } 306 #endif 282 307 };// END CLASS DEFINITION TComPic 283 308 -
branches/0.2-poznan-univ/source/Lib/TLibCommon/TComPicSym.cpp
r2 r12 18 18 m_uiNumPartitions = 1<<(m_uhTotalDepth<<1); 19 19 20 m_iPicWidth = iPicWidth; 21 m_iPicHeight = iPicHeight; 22 20 23 m_uiMaxCUWidth = uiMaxWidth; 21 24 m_uiMaxCUHeight = uiMaxHeight; -
branches/0.2-poznan-univ/source/Lib/TLibCommon/TComPicSym.h
r5 r12 43 43 44 44 // Include files 45 #if POZNAN_MP 46 #include "../TLibCommon/TComMP.h" 47 #endif 48 45 49 #include "CommonDef.h" 46 50 #include "TComSlice.h" … … 58 62 UInt m_uiHeightInCU; 59 63 64 Int m_iPicWidth; 65 Int m_iPicHeight; 60 66 UInt m_uiMaxCUWidth; 61 67 UInt m_uiMaxCUHeight; … … 93 99 UInt getNumPartInWidth() { return m_uiNumPartInWidth; } 94 100 UInt getNumPartInHeight() { return m_uiNumPartInHeight; } 101 Int getPicWidth () {return m_iPicWidth;} 102 Int getPicHeight () {return m_iPicHeight;} 103 UInt getMaxCUWidth () {return m_uiMaxCUWidth;} 104 UInt getMaxCUHeight () {return m_uiMaxCUHeight;} 105 UChar getTotalDepth () {return m_uhTotalDepth;} 95 106 };// END CLASS DEFINITION TComPicSym 96 107 -
branches/0.2-poznan-univ/source/Lib/TLibCommon/TComPicYuv.cpp
r2 r12 8 8 #include <assert.h> 9 9 #include <memory.h> 10 #include <math.h> 10 11 11 12 #ifdef __APPLE__ … … 16 17 17 18 #include "TComPicYuv.h" 19 18 20 19 21 TComPicYuv::TComPicYuv() … … 455 457 } 456 458 } 459 460 #if POZNAN_NONLINEAR_DEPTH 461 Void TComPicYuv::power(TComPicYuv *pcPicDst, Float p) 462 { 463 Int x,y; 464 TComPowerConverter powconv(p, g_uiBitIncrement, g_uiBitIncrement); 465 466 // Luma 467 Pel* pPelSrc = getLumaAddr(); 468 Pel* pPelDst = pcPicDst->getLumaAddr(); 469 for(y=0; y<m_iPicHeight; y++) 470 { 471 for(x=0; x<m_iPicWidth; x++) 472 { 473 pPelDst[x] = (Pel)( powconv(pPelSrc[x]) + 0.5); 474 } 475 pPelDst += pcPicDst->getStride(); 476 pPelSrc += getStride(); 477 } 478 // Chroma 479 copyToPicCb(pcPicDst); 480 copyToPicCr(pcPicDst); 481 } 482 #endif -
branches/0.2-poznan-univ/source/Lib/TLibCommon/TComPicYuv.h
r5 r12 44 44 #include "CommonDef.h" 45 45 46 #if POZNAN_NONLINEAR_DEPTH 47 48 #include <math.h> 49 50 class TComPowerConverter // OLGIERD - Z-NL-Power conversion 51 { 52 private: 53 Double m_fMul; 54 Float m_fPower; 55 56 public: 57 58 TComPowerConverter(Float fPower, Int iInputBitIncrement, Int iOutputBitIncrement) 59 :m_fPower(fPower) 60 { 61 Double fPostMul = (1<<(8+iOutputBitIncrement))-1; // OLGIERD ToDo - should be or not? 62 Double fPreMul = 1.0/((1<<(8+iInputBitIncrement))-1); 63 m_fMul = fPostMul*pow(fPreMul,(Double)fPower); 64 }; 65 66 inline Double operator() (Double Value) 67 { 68 if (Value<0) return -pow( -Value,(Double)m_fPower)*m_fMul; 69 return pow(Value,(Double)m_fPower)*m_fMul; 70 }; 71 }; 72 #else 73 class TComPowerConverter // OLGIERD - Z-NL-Power conversion 74 { 75 public: 76 77 TComPowerConverter(Float fPower, Int iInputBitIncrement, Int iOutputBitIncrement) 78 { 79 }; 80 81 inline Double operator() (Double Value) { return Value; }; 82 }; 83 #endif 46 84 // ==================================================================================================================== 47 85 // Class definition … … 175 213 Void setChromaTo ( Pel pVal ); 176 214 215 #if POZNAN_NONLINEAR_DEPTH 216 Void power(TComPicYuv *pcPicDst, Float p); 217 #endif 177 218 };// END CLASS DEFINITION TComPicYuv 178 219 -
branches/0.2-poznan-univ/source/Lib/TLibCommon/TComPrediction.cpp
r5 r12 1516 1516 { 1517 1517 pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight ); 1518 1519 #if POZNAN_EIVD 1520 if(pcCU->getMergeIndex(uiPartAddr)==POZNAN_EIVD_MRG_CAND) 1521 { 1522 motionCompensation_EIVD( pcCU, pcYuvPred, eRefPicList, iPartIdx, bPrdDepthMap ); 1523 return; 1524 } 1525 #endif 1526 1518 1527 if ( eRefPicList != REF_PIC_LIST_X ) 1519 1528 { … … 1538 1547 pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight ); 1539 1548 1549 #if POZNAN_EIVD 1550 if(pcCU->getMergeIndex(uiPartAddr)==POZNAN_EIVD_MRG_CAND) 1551 { 1552 motionCompensation_EIVD( pcCU, pcYuvPred, eRefPicList, iPartIdx, bPrdDepthMap ); 1553 continue; 1554 } 1555 #endif 1556 1540 1557 if ( eRefPicList != REF_PIC_LIST_X ) 1541 1558 { … … 1555 1572 return; 1556 1573 } 1574 1575 #if POZNAN_EIVD 1576 Void TComPrediction::motionCompensation_EIVD ( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList, Int iPartIdx, Bool bPrdDepthMap ) 1577 { 1578 if(!pcCU->getSlice()->getMP()->isEIVDEnabled()) return; 1579 1580 Int iPartIdxOrg = iPartIdx; 1581 Int iWidth; 1582 Int iHeight; 1583 UInt uiPartAddr; 1584 1585 Int x,y; 1586 Int px,py,iCUBaseX,iCUBaseY; 1587 Int ref_frame0, ref_frame1; 1588 Int ref_frame0_idx, ref_frame1_idx; 1589 TComMv mv0,mv1; 1590 1591 Int ref_frame0_idx_2nd, ref_frame1_idx_2nd; 1592 TComMv mv0_2nd,mv1_2nd; 1593 1594 Pel* piDstCb; 1595 Pel* piDstCr; 1596 Pel aiUTab[MAX_CU_SIZE]; 1597 Pel aiVTab[MAX_CU_SIZE]; 1598 Pel iULast; 1599 Pel iVLast; 1600 Pel iTemp; 1601 1602 TComMP* pcMP = pcCU->getSlice()->getMP(); 1603 UInt uiViewId = pcCU->getSlice()->getSPS()->getViewId(); 1604 Bool bIsDepth = pcCU->getSlice()->getSPS()->isDepth(); 1605 1606 #if POZNAN_EIVD_CALC_PRED_DATA 1607 UInt uiPointCnt; 1608 #endif 1609 1610 for ( iPartIdx = 0; iPartIdx < pcCU->getNumPartInter(); iPartIdx++ ) 1611 { 1612 if ( iPartIdxOrg >= 0 ) iPartIdx = iPartIdxOrg; 1613 1614 pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight ); 1615 1616 //get motion data used for no-MP predicted points 1617 #if POZNAN_EIVD_CALC_PRED_DATA 1618 ref_frame0_idx_2nd = pcCU->getCUMvField2nd(REF_PIC_LIST_0)->getRefIdx(uiPartAddr); 1619 mv0_2nd = pcCU->getCUMvField2nd( REF_PIC_LIST_0 )->getMv( uiPartAddr ); 1620 1621 ref_frame1_idx_2nd = pcCU->getCUMvField2nd(REF_PIC_LIST_1)->getRefIdx(uiPartAddr); 1622 mv1_2nd = pcCU->getCUMvField2nd( REF_PIC_LIST_1 )->getMv( uiPartAddr ); 1623 #else 1624 ref_frame0_idx_2nd = pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiPartAddr); 1625 mv0_2nd = pcCU->getCUMvField( REF_PIC_LIST_0 )->getMv( uiPartAddr ); 1626 1627 ref_frame1_idx_2nd = pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(uiPartAddr); 1628 mv1_2nd = pcCU->getCUMvField( REF_PIC_LIST_1 )->getMv( uiPartAddr ); 1629 #endif 1630 1631 iCUBaseX = pcCU->getCUPelX()+g_auiRasterToPelX[ g_auiZscanToRaster[uiPartAddr] ]; 1632 iCUBaseY = pcCU->getCUPelY()+g_auiRasterToPelY[ g_auiZscanToRaster[uiPartAddr] ]; 1633 1634 #if POZNAN_EIVD_CALC_PRED_DATA 1635 uiPointCnt = 0; 1636 #endif 1637 1638 for( py = 0; py < iHeight; py++) 1639 { 1640 for( px = 0; px < iWidth; px++) 1641 { 1642 x = iCUBaseX+px; 1643 y = iCUBaseY+py; 1644 1645 pcMP->getEIVDPredData(pcCU, x, y, ref_frame0, ref_frame0_idx, mv0, ref_frame0_idx_2nd, mv0_2nd, 1646 ref_frame1, ref_frame1_idx, mv1, ref_frame1_idx_2nd, mv1_2nd); 1647 1648 pcCU->getCUMvField(REF_PIC_LIST_0)->setRefIdx(ref_frame0_idx, uiPartAddr); 1649 pcCU->getCUMvField( REF_PIC_LIST_0 )->setMv( mv0, uiPartAddr ); 1650 1651 pcCU->getCUMvField(REF_PIC_LIST_1)->setRefIdx(ref_frame1_idx, uiPartAddr); 1652 pcCU->getCUMvField( REF_PIC_LIST_1 )->setMv( mv1, uiPartAddr ); 1653 1654 if ( eRefPicList != REF_PIC_LIST_X ) 1655 { 1656 xPredInterUni_EIVD (pcCU, uiPartAddr, px, py, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap ); 1657 #ifdef WEIGHT_PRED 1658 if ( pcCU->getSlice()->getPPS()->getUseWP() ) 1659 { 1660 xWeightedPredictionUni_EIVD( pcCU, pcYuvPred, uiPartAddr, px, py, eRefPicList, pcYuvPred, iPartIdx ); 1661 } 1662 #endif 1663 } 1664 else 1665 { 1666 xPredInterBi_EIVD (pcCU, uiPartAddr, px, py, pcYuvPred, iPartIdx, bPrdDepthMap ); 1667 } 1668 1669 if(!pcCU->getSlice()->getSPS()->isDepth()) // Chroma check only for non depth 1670 { 1671 piDstCb = pcYuvPred->getCbAddr( uiPartAddr ) + (py>>1)*pcYuvPred->getCStride(); 1672 piDstCr = pcYuvPred->getCrAddr( uiPartAddr ) + (py>>1)*pcYuvPred->getCStride(); 1673 1674 //Chroma decimation 16x16 -> 8x8: 1675 if(py%2 && px%2) 1676 { 1677 iTemp = (aiUTab[px-1] + aiUTab[px] + iULast + piDstCb[px>>1] + 2)>>2; 1678 aiUTab[px-1] = iULast; 1679 iULast = piDstCb[px>>1]; 1680 piDstCb[px>>1] = iTemp; 1681 1682 iTemp = (aiVTab[px-1] + aiVTab[px] + iVLast + piDstCr[px>>1] + 2)>>2; 1683 aiVTab[px-1] = iVLast; 1684 iVLast = piDstCr[px>>1]; 1685 piDstCr[px>>1] = iTemp; 1686 } 1687 else 1688 { 1689 aiUTab[(px==0)? iWidth-1 : (px-1)] = iULast; 1690 iULast = piDstCb[px>>1]; 1691 1692 aiVTab[(px==0)? iWidth-1 : (px-1)] = iVLast; 1693 iVLast = piDstCr[px>>1]; 1694 } 1695 } 1696 1697 #if !POZNAN_EIVD_COMPRESS_ME_DATA 1698 //save motion data for every CU point 1699 pcMP->setL0RefPOC(uiViewId,bIsDepth,x,y,ref_frame0); 1700 pcMP->setL0MvX(uiViewId,bIsDepth,x,y,mv0.getHor()); 1701 pcMP->setL0MvY(uiViewId,bIsDepth,x,y,mv0.getVer()); 1702 1703 pcMP->setL1RefPOC(uiViewId,bIsDepth,x,y,ref_frame1); 1704 pcMP->setL1MvX(uiViewId,bIsDepth,x,y,mv1.getHor()); 1705 pcMP->setL1MvY(uiViewId,bIsDepth,x,y,mv1.getVer()); 1706 #endif 1707 1708 #if POZNAN_EIVD_CALC_PRED_DATA 1709 pcMP->getTempL0RefIdx()[uiPointCnt] = ref_frame0_idx; 1710 pcMP->getTempL0MvX()[uiPointCnt] = mv0.getHor(); 1711 pcMP->getTempL0MvY()[uiPointCnt] = mv0.getVer(); 1712 1713 pcMP->getTempL1RefIdx()[uiPointCnt] = ref_frame1_idx; 1714 pcMP->getTempL1MvX()[uiPointCnt] = mv1.getHor(); 1715 pcMP->getTempL1MvY()[uiPointCnt] = mv1.getVer(); 1716 1717 uiPointCnt++; 1718 #endif 1719 1720 } 1721 } 1722 1723 //set motion data representing CU with EIVD 1724 PartSize ePartSize = pcCU->getPartitionSize( uiPartAddr ); //PartSize ePartSize = pcCU->getPartitionSize( 0 ); 1725 #if POZNAN_EIVD_CALC_PRED_DATA 1726 pcMP->xCalcEIVDPredData(uiPointCnt, ref_frame0_idx, mv0, ref_frame1_idx, mv1); 1727 1728 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( mv0, ref_frame0_idx, ePartSize, uiPartAddr, iPartIdx, 0 ); 1729 //pcCU->getCUMvField(REF_PIC_LIST_0)->setRefIdx(ref_frame0_idx,uiPartAddr); 1730 //pcCU->getCUMvField( REF_PIC_LIST_0 )->setMv(mv0, uiPartAddr); 1731 1732 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( mv1, ref_frame1_idx, ePartSize, uiPartAddr, iPartIdx, 0 ); 1733 //pcCU->getCUMvField(REF_PIC_LIST_1)->setRefIdx(ref_frame1_idx,uiPartAddr); 1734 //pcCU->getCUMvField( REF_PIC_LIST_1 )->setMv(mv1, uiPartAddr); 1735 #else 1736 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( mv0_2nd, ref_frame0_idx_2nd, ePartSize, uiPartAddr, iPartIdx, 0 ); 1737 //pcCU->getCUMvField(REF_PIC_LIST_0)->setRefIdx(ref_frame0_idx_2nd,uiPartAddr); 1738 //pcCU->getCUMvField( REF_PIC_LIST_0 )->setMv(mv0_2nd, uiPartAddr); 1739 //pcCU->getCUMvField( REF_PIC_LIST_0 )->setMv(mv0.setZero(), uiPartAddr); 1740 1741 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( mv1_2nd, ref_frame1_idx_2nd, ePartSize, uiPartAddr, iPartIdx, 0 ); 1742 //pcCU->getCUMvField(REF_PIC_LIST_1)->setRefIdx(ref_frame1_idx_2nd,uiPartAddr); 1743 //pcCU->getCUMvField( REF_PIC_LIST_1 )->setMv(mv1_2nd, uiPartAddr); 1744 //pcCU->getCUMvField( REF_PIC_LIST_1 )->setMv(mv1.setZero(), uiPartAddr); 1745 #endif 1746 1747 if ( iPartIdxOrg >= 0 ) break; 1748 } 1749 return; 1750 } 1751 #endif 1557 1752 1558 1753 #if HIGH_ACCURACY_BI … … 2090 2285 } 2091 2286 2287 2288 2289 #if POZNAN_EIVD 2290 2291 #if HIGH_ACCURACY_BI 2292 Void TComPrediction::xPredInterUni_EIVD ( TComDataCU* pcCU, UInt uiPartAddr, Int iPosX, Int iPosY, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, Bool bi ) 2293 #else 2294 Void TComPrediction::xPredInterUni_EIVD ( TComDataCU* pcCU, UInt uiPartAddr, Int iPosX, Int iPosY, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap ) 2295 #endif 2296 { 2297 Int iRefIdx = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr ); assert (iRefIdx >= 0); 2298 TComMv cMv = pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr ); 2299 pcCU->clipMv(cMv); 2300 2301 #if DEPTH_MAP_GENERATION 2302 if( bPrdDepthMap ) 2303 { 2304 #if HIGH_ACCURACY_BI 2305 UInt uiRShift = ( bi ? 14-g_uiBitDepth-g_uiBitIncrement : 0 ); 2306 #else 2307 UInt uiRShift = 0; 2308 #endif 2309 xPredInterPrdDepthMap_EIVD( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPredDepthMap(), uiPartAddr, &cMv, iPosX, iPosY, rpcYuvPred, uiRShift, PDM_DEPTH_MAP_MCP_FILTER ); 2310 return; 2311 } 2312 #endif 2313 2314 #if HHI_FULL_PEL_DEPTH_MAP_MV_ACC 2315 if( pcCU->getSlice()->getSPS()->isDepth() ) 2316 { 2317 #if HIGH_ACCURACY_BI 2318 UInt uiRShift = ( bi ? 14-g_uiBitDepth-g_uiBitIncrement : 0 ); 2319 #else 2320 UInt uiRShift = 0; 2321 #endif 2322 xPredInterPrdDepthMap_EIVD( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iPosX, iPosY, rpcYuvPred, uiRShift, 2 ); 2323 } 2324 else 2325 { 2326 #endif 2327 #if HIGH_ACCURACY_BI 2328 if(!bi) 2329 { 2330 xPredInterLumaBlk_EIVD ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iPosX, iPosY, rpcYuvPred ); 2331 } 2332 else 2333 { 2334 xPredInterLumaBlk_EIVD_ha ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iPosX, iPosY, rpcYuvPred ); 2335 } 2336 #else 2337 xPredInterLumaBlk_EIVD ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iPosX, iPosY, rpcYuvPred ); 2338 #endif 2339 #if HHI_FULL_PEL_DEPTH_MAP_MV_ACC 2340 } 2341 #endif 2342 2343 #if HIGH_ACCURACY_BI 2344 if (!bi) 2345 { 2346 xPredInterChromaBlk_EIVD ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iPosX, iPosY, rpcYuvPred ); 2347 } 2348 else 2349 { 2350 xPredInterChromaBlk_EIVD_ha ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec() , uiPartAddr, &cMv, iPosX, iPosY, rpcYuvPred ); 2351 } 2352 #else 2353 xPredInterChromaBlk_EIVD ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iPosX, iPosY, rpcYuvPred ); 2354 #endif 2355 } 2356 2357 Void TComPrediction::xPredInterBi_EIVD ( TComDataCU* pcCU, UInt uiPartAddr, Int iPosX, Int iPosY, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap ) 2358 { 2359 TComYuv* pcMbYuv; 2360 Int iRefIdx[2] = {-1, -1}; 2361 2362 for ( Int iRefList = 0; iRefList < 2; iRefList++ ) 2363 { 2364 RefPicList eRefPicList = (iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0); 2365 iRefIdx[iRefList] = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr ); 2366 2367 if ( iRefIdx[iRefList] < 0 ) 2368 { 2369 continue; 2370 } 2371 2372 assert( iRefIdx[iRefList] < pcCU->getSlice()->getNumRefIdx(eRefPicList) ); 2373 2374 pcMbYuv = &m_acYuvPred[iRefList]; 2375 #if HIGH_ACCURACY_BI 2376 if( pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( uiPartAddr ) >= 0 && pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( uiPartAddr ) >= 0 ) 2377 xPredInterUni_EIVD ( pcCU, uiPartAddr, iPosX, iPosY, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, true ); 2378 else 2379 xPredInterUni_EIVD ( pcCU, uiPartAddr, iPosX, iPosY, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap ); 2380 #else 2381 xPredInterUni_EIVD ( pcCU, uiPartAddr, iPosX, iPosY, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap ); 2382 #endif 2383 } 2384 2385 #ifdef WEIGHT_PRED 2386 if ( pcCU->getSlice()->getPPS()->getWPBiPredIdc() ) 2387 { 2388 xWeightedPredictionBi_EIVD( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iPosX, iPosY, rpcYuvPred ); 2389 } 2390 else 2391 #endif 2392 xWeightedAverage_EIVD( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iPosX, iPosY, rpcYuvPred ); 2393 } 2394 2395 Void TComPrediction::xPredInterPrdDepthMap_EIVD( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY, TComYuv*& rpcYuv, UInt uiRShift, UInt uiFilterMode ) // 0:std, 1:bilin, 2:nearest neighbour 2396 { 2397 AOF( uiFilterMode <= 2 ); 2398 2399 Int iFPelMask = ~3; 2400 Int iRefStride = pcPicYuvRef->getStride(); 2401 Int iDstStride = rpcYuv->getStride(); 2402 Int iHor = ( uiFilterMode == 2 ? ( pcMv->getHor() + 2 ) & iFPelMask : pcMv->getHor() ); 2403 Int iVer = ( uiFilterMode == 2 ? ( pcMv->getVer() + 2 ) & iFPelMask : pcMv->getVer() ); 2404 #if HHI_FULL_PEL_DEPTH_MAP_MV_ACC 2405 if( pcCU->getSlice()->getSPS()->isDepth() ) 2406 { 2407 assert( uiFilterMode == 2 ); 2408 iHor = pcMv->getHor() * 4; 2409 iVer = pcMv->getVer() * 4; 2410 } 2411 #endif 2412 Int iRefOffset = ( iHor >> 2 ) + ( iVer >> 2 ) * iRefStride; 2413 Int ixFrac = iHor & 0x3; 2414 Int iyFrac = iVer & 0x3; 2415 Pel* piRefY = pcPicYuvRef->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr ) + iRefOffset; 2416 Pel* piDstY = rpcYuv->getLumaAddr( uiPartAddr ); 2417 2418 piRefY += iPosY*iRefStride+iPosX; 2419 piDstY += iPosY*iDstStride+iPosX; 2420 2421 // Integer position 2422 if( ixFrac == 0 && iyFrac == 0 ) 2423 { 2424 piDstY[ 0 ] = piRefY[ 0 ] << uiRShift; 2425 return; 2426 } 2427 2428 // bi-linear interpolation 2429 if( uiFilterMode == 1 ) 2430 { 2431 Int iW00 = ( 4 - ixFrac ) * ( 4 - iyFrac ); 2432 Int iW01 = ( ixFrac ) * ( 4 - iyFrac ); 2433 Int iW10 = ( 4 - ixFrac ) * ( iyFrac ); 2434 Int iW11 = ( ixFrac ) * ( iyFrac ); 2435 Pel* piRefY1 = piRefY + iRefStride; 2436 Int iSV = iW00 * piRefY [ 0 ] + iW01 * piRefY [ 1 ] 2437 + iW10 * piRefY1[ 0 ] + iW11 * piRefY1[ 1 ]; 2438 iSV <<= uiRShift; 2439 piDstY[ 0 ] = ( iSV + 8 ) >> 4; 2440 return; 2441 } 2442 2443 xPredInterLumaBlk_EIVD( pcCU, pcPicYuvRef, uiPartAddr, pcMv, iPosX, iPosY, rpcYuv ); 2444 return; 2445 } 2446 2447 2448 #if HIGH_ACCURACY_BI 2449 2450 Void TComPrediction::xPredInterLumaBlk_EIVD_ha( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY, TComYuv*& rpcYuv ) 2451 { 2452 Int iRefStride = pcPicYuvRef->getStride(); 2453 Int iDstStride = rpcYuv->getStride(); 2454 2455 Int iRefOffset = ( pcMv->getHor() >> 2 ) + ( pcMv->getVer() >> 2 ) * iRefStride; 2456 Pel* piRefY = pcPicYuvRef->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr ) + iRefOffset; 2457 2458 Int ixFrac = pcMv->getHor() & 0x3; 2459 Int iyFrac = pcMv->getVer() & 0x3; 2460 2461 Pel* piDstY = rpcYuv->getLumaAddr( uiPartAddr ); 2462 UInt shiftNum = 14-g_uiBitDepth-g_uiBitIncrement; 2463 2464 piDstY += iPosY*iDstStride+iPosX; 2465 piRefY += iPosY*iRefStride+iPosX; 2466 2467 // Integer point 2468 if ( ixFrac == 0 && iyFrac == 0 ) 2469 { 2470 *piDstY = (*piRefY)<<shiftNum; 2471 return; 2472 } 2473 2474 Int iWidth = 1; 2475 Int iHeight = 1; 2476 2477 // Half-pel horizontal 2478 if ( ixFrac == 2 && iyFrac == 0 ) 2479 { 2480 xCTI_FilterHalfHor_ha ( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY ); 2481 return; 2482 } 2483 2484 // Half-pel vertical 2485 if ( ixFrac == 0 && iyFrac == 2 ) 2486 { 2487 xCTI_FilterHalfVer_ha ( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY ); 2488 return; 2489 } 2490 2491 Int iExtStride = m_iYuvExtStride;//m_cYuvExt.getStride(); 2492 Int* piExtY = m_piYuvExt;//m_cYuvExt.getLumaAddr(); 2493 2494 // Half-pel center 2495 if ( ixFrac == 2 && iyFrac == 2 ) 2496 { 2497 xCTI_FilterHalfVer (piRefY - 3, iRefStride, 1, iWidth +7, iHeight, iExtStride, 1, piExtY ); 2498 xCTI_FilterHalfHor_ha (piExtY + 3, iExtStride, 1, iWidth , iHeight, iDstStride, 1, piDstY ); 2499 return; 2500 } 2501 2502 // Quater-pel horizontal 2503 if ( iyFrac == 0) 2504 { 2505 if ( ixFrac == 1) 2506 { 2507 xCTI_FilterQuarter0Hor_ha( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY ); 2508 return; 2509 } 2510 if ( ixFrac == 3) 2511 { 2512 xCTI_FilterQuarter1Hor_ha( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY ); 2513 return; 2514 } 2515 } 2516 if ( iyFrac == 2 ) 2517 { 2518 if ( ixFrac == 1) 2519 { 2520 xCTI_FilterHalfVer (piRefY -3, iRefStride, 1, iWidth +7, iHeight, iExtStride, 1, piExtY ); 2521 xCTI_FilterQuarter0Hor_ha (piExtY + 3, iExtStride, 1, iWidth, iHeight, iDstStride, 1, piDstY ); 2522 return; 2523 } 2524 if ( ixFrac == 3) 2525 { 2526 xCTI_FilterHalfVer (piRefY - 3, iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY ); 2527 xCTI_FilterQuarter1Hor_ha (piExtY + 3, iExtStride, 1, iWidth, iHeight, iDstStride, 1, piDstY ); 2528 return; 2529 } 2530 } 2531 2532 // Quater-pel vertical 2533 if( ixFrac == 0 ) 2534 { 2535 if( iyFrac == 1 ) 2536 { 2537 xCTI_FilterQuarter0Ver_ha( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY ); 2538 return; 2539 } 2540 if( iyFrac == 3 ) 2541 { 2542 xCTI_FilterQuarter1Ver_ha( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY ); 2543 return; 2544 } 2545 } 2546 2547 if( ixFrac == 2 ) 2548 { 2549 if( iyFrac == 1 ) 2550 { 2551 xCTI_FilterQuarter0Ver (piRefY - 3, iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY ); 2552 xCTI_FilterHalfHor_ha (piExtY + 3, iExtStride, 1, iWidth , iHeight, iDstStride, 1, piDstY ); 2553 2554 return; 2555 } 2556 if( iyFrac == 3 ) 2557 { 2558 xCTI_FilterQuarter1Ver (piRefY -3, iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY ); 2559 xCTI_FilterHalfHor_ha (piExtY + 3, iExtStride, 1, iWidth , iHeight, iDstStride, 1, piDstY ); 2560 return; 2561 } 2562 } 2563 2564 /// Quarter-pel center 2565 if ( iyFrac == 1) 2566 { 2567 if ( ixFrac == 1) 2568 { 2569 xCTI_FilterQuarter0Ver (piRefY - 3, iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY ); 2570 xCTI_FilterQuarter0Hor_ha (piExtY + 3, iExtStride, 1, iWidth , iHeight, iDstStride, 1, piDstY ); 2571 return; 2572 } 2573 if ( ixFrac == 3) 2574 { 2575 xCTI_FilterQuarter0Ver (piRefY - 3, iRefStride, 1, iWidth +7, iHeight, iExtStride, 1, piExtY ); 2576 xCTI_FilterQuarter1Hor_ha (piExtY + 3, iExtStride, 1, iWidth , iHeight, iDstStride, 1, piDstY ); 2577 2578 return; 2579 } 2580 } 2581 if ( iyFrac == 3 ) 2582 { 2583 if ( ixFrac == 1) 2584 { 2585 xCTI_FilterQuarter1Ver (piRefY - 3, iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY ); 2586 xCTI_FilterQuarter0Hor_ha (piExtY + 3, iExtStride, 1, iWidth , iHeight, iDstStride, 1, piDstY ); 2587 return; 2588 } 2589 if ( ixFrac == 3) 2590 { 2591 xCTI_FilterQuarter1Ver (piRefY - 3, iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY ); 2592 xCTI_FilterQuarter1Hor_ha (piExtY + 3, iExtStride, 1, iWidth , iHeight, iDstStride, 1, piDstY ); 2593 return; 2594 } 2595 } 2596 } 2597 2598 #endif 2599 2600 Void TComPrediction::xPredInterLumaBlk_EIVD( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY, TComYuv*& rpcYuv ) 2601 { 2602 Int iRefStride = pcPicYuvRef->getStride(); 2603 Int iDstStride = rpcYuv->getStride(); 2604 2605 Int iRefOffset = ( pcMv->getHor() >> 2 ) + ( pcMv->getVer() >> 2 ) * iRefStride; 2606 Pel* piRefY = pcPicYuvRef->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr ) + iRefOffset; 2607 2608 Int ixFrac = pcMv->getHor() & 0x3; 2609 Int iyFrac = pcMv->getVer() & 0x3; 2610 2611 Pel* piDstY = rpcYuv->getLumaAddr( uiPartAddr ); 2612 2613 piDstY += iPosY*iDstStride+iPosX; 2614 piRefY += iPosY*iRefStride+iPosX; 2615 2616 // Integer point 2617 if ( ixFrac == 0 && iyFrac == 0 ) 2618 { 2619 ::memcpy(piDstY, piRefY, sizeof(Pel)); 2620 return; 2621 } 2622 2623 Int iWidth = 1; 2624 Int iHeight = 1; 2625 2626 // Half-pel horizontal 2627 if ( ixFrac == 2 && iyFrac == 0 ) 2628 { 2629 xCTI_FilterHalfHor ( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY ); 2630 return; 2631 } 2632 2633 // Half-pel vertical 2634 if ( ixFrac == 0 && iyFrac == 2 ) 2635 { 2636 xCTI_FilterHalfVer ( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY ); 2637 return; 2638 } 2639 2640 Int iExtStride = m_iYuvExtStride;//m_cYuvExt.getStride(); 2641 Int* piExtY = m_piYuvExt;//m_cYuvExt.getLumaAddr(); 2642 2643 // Half-pel center 2644 if ( ixFrac == 2 && iyFrac == 2 ) 2645 { 2646 2647 xCTI_FilterHalfVer (piRefY - 3, iRefStride, 1, iWidth +7, iHeight, iExtStride, 1, piExtY ); 2648 xCTI_FilterHalfHor (piExtY + 3, iExtStride, 1, iWidth , iHeight, iDstStride, 1, piDstY ); 2649 return; 2650 } 2651 2652 // Quater-pel horizontal 2653 if ( iyFrac == 0) 2654 { 2655 if ( ixFrac == 1) 2656 { 2657 xCTI_FilterQuarter0Hor( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY ); 2658 return; 2659 } 2660 if ( ixFrac == 3) 2661 { 2662 xCTI_FilterQuarter1Hor( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY ); 2663 return; 2664 } 2665 } 2666 if ( iyFrac == 2 ) 2667 { 2668 if ( ixFrac == 1) 2669 { 2670 xCTI_FilterHalfVer (piRefY -3, iRefStride, 1, iWidth +7, iHeight, iExtStride, 1, piExtY ); 2671 xCTI_FilterQuarter0Hor (piExtY + 3, iExtStride, 1, iWidth, iHeight, iDstStride, 1, piDstY ); 2672 return; 2673 } 2674 if ( ixFrac == 3) 2675 { 2676 xCTI_FilterHalfVer (piRefY - 3, iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY ); 2677 xCTI_FilterQuarter1Hor (piExtY + 3, iExtStride, 1, iWidth, iHeight, iDstStride, 1, piDstY ); 2678 return; 2679 } 2680 } 2681 2682 // Quater-pel vertical 2683 if( ixFrac == 0 ) 2684 { 2685 if( iyFrac == 1 ) 2686 { 2687 xCTI_FilterQuarter0Ver( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY ); 2688 return; 2689 } 2690 if( iyFrac == 3 ) 2691 { 2692 xCTI_FilterQuarter1Ver( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY ); 2693 return; 2694 } 2695 } 2696 2697 if( ixFrac == 2 ) 2698 { 2699 if( iyFrac == 1 ) 2700 { 2701 xCTI_FilterQuarter0Ver (piRefY - 3, iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY ); 2702 xCTI_FilterHalfHor (piExtY + 3, iExtStride, 1, iWidth , iHeight, iDstStride, 1, piDstY ); 2703 return; 2704 } 2705 if( iyFrac == 3 ) 2706 { 2707 xCTI_FilterQuarter1Ver (piRefY -3, iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY ); 2708 xCTI_FilterHalfHor (piExtY + 3, iExtStride, 1, iWidth , iHeight, iDstStride, 1, piDstY ); 2709 return; 2710 } 2711 } 2712 2713 /// Quarter-pel center 2714 if ( iyFrac == 1) 2715 { 2716 if ( ixFrac == 1) 2717 { 2718 xCTI_FilterQuarter0Ver (piRefY - 3, iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY ); 2719 xCTI_FilterQuarter0Hor (piExtY + 3, iExtStride, 1, iWidth , iHeight, iDstStride, 1, piDstY ); 2720 return; 2721 } 2722 if ( ixFrac == 3) 2723 { 2724 xCTI_FilterQuarter0Ver (piRefY - 3, iRefStride, 1, iWidth +7, iHeight, iExtStride, 1, piExtY ); 2725 xCTI_FilterQuarter1Hor (piExtY + 3, iExtStride, 1, iWidth , iHeight, iDstStride, 1, piDstY ); 2726 return; 2727 } 2728 } 2729 if ( iyFrac == 3 ) 2730 { 2731 if ( ixFrac == 1) 2732 { 2733 xCTI_FilterQuarter1Ver (piRefY - 3, iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY ); 2734 xCTI_FilterQuarter0Hor (piExtY + 3, iExtStride, 1, iWidth , iHeight, iDstStride, 1, piDstY ); 2735 return; 2736 } 2737 if ( ixFrac == 3) 2738 { 2739 xCTI_FilterQuarter1Ver (piRefY - 3, iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY ); 2740 xCTI_FilterQuarter1Hor (piExtY + 3, iExtStride, 1, iWidth , iHeight, iDstStride, 1, piDstY ); 2741 return; 2742 } 2743 } 2744 } 2745 2746 #if HIGH_ACCURACY_BI 2747 Void TComPrediction::xPredInterChromaBlk_EIVD_ha( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY, TComYuv*& rpcYuv ) 2748 { 2749 Int iRefStride = pcPicYuvRef->getCStride(); 2750 Int iDstStride = rpcYuv->getCStride(); 2751 2752 Int iRefOffset = (pcMv->getHor() >> 3) + (pcMv->getVer() >> 3) * iRefStride; 2753 2754 Pel* piRefCb = pcPicYuvRef->getCbAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr ) + iRefOffset; 2755 Pel* piRefCr = pcPicYuvRef->getCrAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr ) + iRefOffset; 2756 2757 Pel* piDstCb = rpcYuv->getCbAddr( uiPartAddr ); 2758 Pel* piDstCr = rpcYuv->getCrAddr( uiPartAddr ); 2759 2760 Int ixFrac = pcMv->getHor() & 0x7; 2761 Int iyFrac = pcMv->getVer() & 0x7; 2762 UInt uiCWidth = 1; 2763 UInt uiCHeight = 1; 2764 2765 piDstCb += (iPosY>>1)*iDstStride+(iPosX>>1); 2766 piDstCr += (iPosY>>1)*iDstStride+(iPosX>>1); 2767 piRefCb += (iPosY>>1)*iRefStride+(iPosX>>1); 2768 piRefCr += (iPosY>>1)*iRefStride+(iPosX>>1); 2769 2770 xDCTIF_FilterC_ha(piRefCb, iRefStride,piDstCb,iDstStride,uiCWidth,uiCHeight, iyFrac, ixFrac); 2771 xDCTIF_FilterC_ha(piRefCr, iRefStride,piDstCr,iDstStride,uiCWidth,uiCHeight, iyFrac, ixFrac); 2772 return; 2773 } 2774 #endif 2775 2776 //-- 2777 Void TComPrediction::xPredInterChromaBlk_EIVD( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY, TComYuv*& rpcYuv ) 2778 { 2779 Int iRefStride = pcPicYuvRef->getCStride(); 2780 Int iDstStride = rpcYuv->getCStride(); 2781 2782 Int iRefOffset = (pcMv->getHor() >> 3) + (pcMv->getVer() >> 3) * iRefStride; 2783 2784 Pel* piRefCb = pcPicYuvRef->getCbAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr ) + iRefOffset; 2785 Pel* piRefCr = pcPicYuvRef->getCrAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr ) + iRefOffset; 2786 2787 Pel* piDstCb = rpcYuv->getCbAddr( uiPartAddr ); 2788 Pel* piDstCr = rpcYuv->getCrAddr( uiPartAddr ); 2789 2790 Int ixFrac = pcMv->getHor() & 0x7; 2791 Int iyFrac = pcMv->getVer() & 0x7; 2792 UInt uiCWidth = 1; 2793 UInt uiCHeight = 1; 2794 2795 piDstCb += (iPosY>>1)*iDstStride+(iPosX>>1); 2796 piDstCr += (iPosY>>1)*iDstStride+(iPosX>>1); 2797 piRefCb += (iPosY>>1)*iRefStride+(iPosX>>1); 2798 piRefCr += (iPosY>>1)*iRefStride+(iPosX>>1); 2799 2800 xDCTIF_FilterC(piRefCb, iRefStride,piDstCb,iDstStride,uiCWidth,uiCHeight, iyFrac, ixFrac); 2801 xDCTIF_FilterC(piRefCr, iRefStride,piDstCr,iDstStride,uiCWidth,uiCHeight, iyFrac, ixFrac); 2802 return; 2803 } 2804 2805 #endif 2806 2807 2092 2808 Void TComPrediction::xDCTIF_FilterC ( Pel* piRefC, Int iRefStride,Pel* piDstC,Int iDstStride, 2093 2809 Int iWidth, Int iHeight,Int iMVyFrac,Int iMVxFrac) … … 2193 2909 } 2194 2910 } 2911 2912 #if POZNAN_EIVD 2913 Void TComPrediction::xWeightedAverage_EIVD( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iPosX, Int iPosY, TComYuv*& rpcYuvDst ) 2914 { 2915 if( iRefIdx0 >= 0 && iRefIdx1 >= 0 ) 2916 { 2917 #ifdef ROUNDING_CONTROL_BIPRED 2918 rpcYuvDst->addAvg_EIVD( pcYuvSrc0, pcYuvSrc1, uiPartIdx, iPosX, iPosY, pcCU->getSlice()->isRounding()); 2919 #else 2920 rpcYuvDst->addAvg_EIVD( pcYuvSrc0, pcYuvSrc1, uiPartIdx, iPosX, iPosY ); 2921 #endif 2922 } 2923 else if ( iRefIdx0 >= 0 && iRefIdx1 < 0 ) 2924 { 2925 pcYuvSrc0->copyPartToPartYuv_EIVD( rpcYuvDst, uiPartIdx, iPosX, iPosY ); 2926 } 2927 else if ( iRefIdx0 < 0 && iRefIdx1 >= 0 ) 2928 { 2929 pcYuvSrc1->copyPartToPartYuv_EIVD( rpcYuvDst, uiPartIdx, iPosX, iPosY ); 2930 } 2931 else 2932 { 2933 assert (0); 2934 } 2935 } 2936 #endif 2195 2937 2196 2938 // AMVP -
branches/0.2-poznan-univ/source/Lib/TLibCommon/TComPrediction.h
r5 r12 52 52 #endif 53 53 54 #if POZNAN_MP 55 #include "../TLibCommon/TComMP.h" 56 #endif 57 54 58 // ==================================================================================================================== 55 59 // Class definition … … 113 117 #endif 114 118 119 #if POZNAN_EIVD 120 #if HIGH_ACCURACY_BI 121 Void xPredInterUni_EIVD ( TComDataCU* pcCU, UInt uiPartAddr, Int iPosX, Int iPosY, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, Bool bi=false ); 122 #else 123 Void xPredInterUni_EIVD ( TComDataCU* pcCU, UInt uiPartAddr, Int iPosX, Int iPosY, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap ); 124 #endif 125 Void xPredInterBi_EIVD ( TComDataCU* pcCU, UInt uiPartAddr, Int iPosX, Int iPosY, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap ); 126 Void xPredInterPrdDepthMap_EIVD( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY, TComYuv*& rpcYuv, UInt uiRShift, UInt uiFilterMode ); // 0:std, 1:bilin, 2:nearest neighbour 127 Void xPredInterLumaBlk_EIVD ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY, TComYuv*& rpcYuv ); 128 Void xPredInterChromaBlk_EIVD ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY, TComYuv*& rpcYuv ); 129 Void xWeightedAverage_EIVD ( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iPosX, Int iPosY, TComYuv*& rpcYuvDst ); 130 131 #if HIGH_ACCURACY_BI 132 Void xPredInterLumaBlk_EIVD_ha( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY, TComYuv*& rpcYuv ); 133 Void xPredInterChromaBlk_EIVD_ha( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY, TComYuv*& rpcYuv ); 134 #endif 135 #endif 136 115 137 #if HHI_DMM_WEDGE_INTRA 116 138 Void xPredIntraWedgeFull ( TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bAbove, Bool bLeft, Bool bEncoder, Bool bDelta, UInt uiTabIdx, Int iDeltaDC1 = 0, Int iDeltaDC2 = 0 ); … … 147 169 Void motionCompensation ( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1, Bool bPrdDepthMap = false ); 148 170 171 #if POZNAN_EIVD 172 Void motionCompensation_EIVD ( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1, Bool bPrdDepthMap = false ); 173 #endif 174 149 175 // motion vector prediction 150 176 Void getMvPredAMVP ( TComDataCU* pcCU, UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMvPred ); -
branches/0.2-poznan-univ/source/Lib/TLibCommon/TComResidualGenerator.cpp
r11 r12 306 306 xSetRecResidualInterCU( pcSubCU, pcSubRes ); 307 307 break; 308 #if POZNAN_ ENCODE_ONLY_DISOCCLUDED_CU308 #if POZNAN_CU_SKIP 309 309 case MODE_SYNTH: 310 310 xSetRecResidualIntraCU( pcSubCU, pcSubRes ); //MayBe it should be seperate function … … 341 341 UInt uiLumaTrMode, uiChromaTrMode; 342 342 pcCU->convertTransIdx ( 0, pcCU->getTransformIdx( 0 ), uiLumaTrMode, uiChromaTrMode ); 343 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 344 m_pcTrQuant->setQPforQuant ( pcCU->getQP( 0 ) + pcCU->getQpOffsetForTextCU(0/*uiAbsPartIdx*/, false), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA ); 345 #else 343 346 m_pcTrQuant->setQPforQuant ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA ); 347 #endif 348 //m_pcTrQuant->setQPforQuant ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA ); 344 349 m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pRes, 0, pcCUResidual->getStride(), uiWidth, uiHeight, uiLumaTrMode, 0, piCoeff ); 345 350 // chroma Cb … … 348 353 piCoeff = pcCU->getCoeffCb(); 349 354 pRes = pcCUResidual->getCbAddr(); 355 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 356 m_pcTrQuant->setQPforQuant ( pcCU->getQP( 0 ) + pcCU->getQpOffsetForTextCU(0/*uiAbsPartIdx*/, false), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA ); 357 #else 350 358 m_pcTrQuant->setQPforQuant ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA ); 359 #endif 360 //m_pcTrQuant->setQPforQuant ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA ); 351 361 m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_U, pRes, 0, pcCUResidual->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff ); 352 362 // chroma Cr -
branches/0.2-poznan-univ/source/Lib/TLibCommon/TComSlice.cpp
r11 r12 85 85 initWpAcDcParam(); 86 86 #endif 87 88 #if POZNAN_MP 89 m_pcMP = NULL; 90 #endif 87 91 } 88 92 89 93 TComSlice::~TComSlice() 90 94 { 95 #if POZNAN_MP 96 m_pcMP = NULL; 97 #endif 91 98 } 92 99 … … 722 729 } 723 730 } 731 #if POZNAN_NONLINEAR_DEPTH 732 m_fDepthPower = 1.0; 733 #endif 724 734 } 725 735 … … 737 747 ::memset( m_aaiCodedScale, 0x00, sizeof( m_aaiCodedScale ) ); 738 748 ::memset( m_aaiCodedOffset, 0x00, sizeof( m_aaiCodedOffset ) ); 749 #if POZNAN_NONLINEAR_DEPTH 750 m_fDepthPower = 1.0; 751 #endif 739 752 } 740 753 -
branches/0.2-poznan-univ/source/Lib/TLibCommon/TComSlice.h
r11 r12 57 57 #endif 58 58 59 #if POZNAN_MP 60 //#include "../TLibCommon/TComMP.h" 61 class TComMP; 62 #endif 63 59 64 // ==================================================================================================================== 60 65 // Class definition … … 153 158 #if HHI_INTER_VIEW_RESIDUAL_PRED 154 159 TComResidualGenerator* m_pcResidualGenerator; 160 #endif 161 162 #if POZNAN_NONLINEAR_DEPTH 163 Float m_fDepthPower; 164 #endif 165 166 #if POZNAN_MP 167 TComMP* m_pcMP; 168 #endif 169 170 #if POZNAN_STAT_JK 171 FILE* m_pcStatFile[MAX_INPUT_VIEW_NUM]; 155 172 #endif 156 173 … … 305 322 TComResidualGenerator* getResidualGenerator() { return m_pcResidualGenerator; } 306 323 #endif 324 #if POZNAN_NONLINEAR_DEPTH 325 inline Void setDepthPower(Float p) {m_fDepthPower = p;} 326 inline Float getDepthPower() {return m_fDepthPower;} 327 #else 328 inline Float getDepthPower() {return 1.0f;} 329 #endif 307 330 }; 308 331 … … 445 468 #endif 446 469 470 #if POZNAN_MP 471 TComMP* m_pcMP; 472 #endif 473 474 #if POZNAN_STAT_JK 475 FILE* m_pcStatFile; 476 #endif 477 447 478 public: 448 479 TComSlice(); 480 #if POZNAN_MP 481 ~TComSlice(); 482 #else 449 483 virtual ~TComSlice(); 484 #endif 450 485 451 486 Void initSlice (); … … 605 640 #endif 606 641 642 #if POZNAN_MP 643 Void setMP(TComMP* pcMP) { m_pcMP = pcMP; } 644 TComMP* getMP() { return m_pcMP; } 645 #endif 646 647 #if POZNAN_STAT_JK 648 Void setStatFile(FILE* pcStatFile) { m_pcStatFile = pcStatFile; } 649 FILE* getStatFile() { return m_pcStatFile; } 650 #endif 651 607 652 protected: 608 653 #if 0 -
branches/0.2-poznan-univ/source/Lib/TLibCommon/TComWeightPrediction.cpp
r5 r12 393 393 } 394 394 395 #if POZNAN_EIVD 396 397 Void TComWeightPrediction::addWeightBi_EIVD( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iPosX, Int iPosY, wpScalingParam *wp0, wpScalingParam *wp1, TComYuv* rpcYuvDst, Bool bRound ) 398 { 399 Pel* pSrcY0 = pcYuvSrc0->getLumaAddr( iPartUnitIdx ); 400 Pel* pSrcU0 = pcYuvSrc0->getCbAddr ( iPartUnitIdx ); 401 Pel* pSrcV0 = pcYuvSrc0->getCrAddr ( iPartUnitIdx ); 402 403 Pel* pSrcY1 = pcYuvSrc1->getLumaAddr( iPartUnitIdx ); 404 Pel* pSrcU1 = pcYuvSrc1->getCbAddr ( iPartUnitIdx ); 405 Pel* pSrcV1 = pcYuvSrc1->getCrAddr ( iPartUnitIdx ); 406 407 Pel* pDstY = rpcYuvDst->getLumaAddr( iPartUnitIdx ); 408 Pel* pDstU = rpcYuvDst->getCbAddr ( iPartUnitIdx ); 409 Pel* pDstV = rpcYuvDst->getCrAddr ( iPartUnitIdx ); 410 411 // Luma : -------------------------------------------- 412 Int w0 = wp0[0].w; 413 Int o0 = wp0[0].o; 414 Int offset = wp0[0].offset; 415 Int shiftNum = 14 - (g_uiBitDepth + g_uiBitIncrement); 416 Int shift = wp0[0].shift + shiftNum; 417 Int round = (1<<(shift-1)) * bRound; 418 Int w1 = wp1[0].w; 419 Int o1 = wp1[0].o; 420 421 UInt iSrc0Stride = pcYuvSrc0->getStride(); 422 UInt iSrc1Stride = pcYuvSrc1->getStride(); 423 UInt iDstStride = rpcYuvDst->getStride(); 424 425 pDstY[iPosY*iDstStride+iPosX] = weightBidir(w0,pSrcY0[iPosY*iSrc0Stride+iPosX], w1,pSrcY1[iPosY*iSrc1Stride+iPosX], round, shift, offset); 426 427 // Chromas : -------------------------------------------- 428 iSrc0Stride = pcYuvSrc0->getCStride(); 429 iSrc1Stride = pcYuvSrc1->getCStride(); 430 iDstStride = rpcYuvDst->getCStride(); 431 432 iPosX = iPosX>>1; 433 iPosY = iPosY>>1; 434 435 // Chroma U : -------------------------------------------- 436 w0 = wp0[1].w; 437 o0 = wp0[1].o; 438 offset = wp0[1].offset; 439 shift = wp0[1].shift + shiftNum; 440 round = (1<<(shift-1)); 441 w1 = wp1[1].w; 442 o1 = wp1[1].o; 443 444 pDstU[iPosY*iDstStride+iPosX] = weightBidir(w0,pSrcU0[iPosY*iSrc0Stride+iPosX], w1,pSrcU1[iPosY*iSrc1Stride+iPosX], round, shift, offset); 445 446 // Chroma V : -------------------------------------------- 447 w0 = wp0[2].w; 448 o0 = wp0[2].o; 449 offset = wp0[2].offset; 450 shift = wp0[2].shift + shiftNum; 451 round = (1<<(shift-1)); 452 w1 = wp1[2].w; 453 o1 = wp1[2].o; 454 455 pDstV[iPosY*iDstStride+iPosX] = weightBidir(w0,pSrcV0[iPosY*iSrc0Stride+iPosX], w1,pSrcV1[iPosY*iSrc1Stride+iPosX], round, shift, offset); 456 } 457 458 Void TComWeightPrediction::addWeightUni_EIVD( TComYuv* pcYuvSrc0, UInt iPartUnitIdx, UInt iPosX, Int iPosY, wpScalingParam *wp0, TComYuv* rpcYuvDst ) 459 { 460 Pel* pSrcY0 = pcYuvSrc0->getLumaAddr( iPartUnitIdx ); 461 Pel* pSrcU0 = pcYuvSrc0->getCbAddr ( iPartUnitIdx ); 462 Pel* pSrcV0 = pcYuvSrc0->getCrAddr ( iPartUnitIdx ); 463 464 Pel* pDstY = rpcYuvDst->getLumaAddr( iPartUnitIdx ); 465 Pel* pDstU = rpcYuvDst->getCbAddr ( iPartUnitIdx ); 466 Pel* pDstV = rpcYuvDst->getCrAddr ( iPartUnitIdx ); 467 468 // Luma : -------------------------------------------- 469 Int w0 = wp0[0].w; 470 Int offset = wp0[0].offset; 471 Int shift = wp0[0].shift; 472 Int round = wp0[0].round; 473 474 UInt iSrc0Stride = pcYuvSrc0->getStride(); 475 UInt iDstStride = rpcYuvDst->getStride(); 476 477 pDstY[iPosY*iDstStride+iPosX] = weightUnidir(w0,pSrcY0[iPosY*iSrc0Stride+iPosX], round, shift, offset); 478 479 // Chromas : -------------------------------------------- 480 iSrc0Stride = pcYuvSrc0->getCStride(); 481 iDstStride = rpcYuvDst->getCStride(); 482 483 iPosX = iPosX>>1; 484 iPosY = iPosY>>1; 485 486 // Chroma U : -------------------------------------------- 487 w0 = wp0[1].w; 488 offset = wp0[1].offset; 489 shift = wp0[1].shift; 490 round = wp0[1].round; 491 492 pDstU[iPosY*iDstStride+iPosX] = weightUnidir(w0,pSrcU0[iPosY*iSrc0Stride+iPosX], round, shift, offset); 493 494 // Chroma V : -------------------------------------------- 495 w0 = wp0[2].w; 496 offset = wp0[2].offset; 497 shift = wp0[2].shift; 498 round = wp0[2].round; 499 500 pDstV[iPosY*iDstStride+iPosX] = weightUnidir(w0,pSrcV0[iPosY*iSrc0Stride+iPosX], round, shift, offset); 501 } 502 503 Void TComWeightPrediction::xWeightedPredictionUni_EIVD( TComDataCU* pcCU, TComYuv* pcYuvSrc, UInt uiPartAddr, Int iPosX, Int iPosY, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx ) 504 { 505 wpScalingParam *pwp, *pwpTmp; 506 Int iRefIdx = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr ); assert (iRefIdx >= 0); 507 Int ibdi = (g_uiBitDepth+g_uiBitIncrement); 508 509 if ( eRefPicList == REF_PIC_LIST_0 ) 510 { 511 getWpScaling(pcCU, iRefIdx, -1, pwp, pwpTmp, ibdi); 512 } 513 else 514 { 515 getWpScaling(pcCU, -1, iRefIdx, pwpTmp, pwp, ibdi); 516 } 517 addWeightUni_EIVD( pcYuvSrc, uiPartAddr, iPosX, iPosY, pwp, rpcYuvPred ); 518 } 519 520 Void TComWeightPrediction::xWeightedPredictionBi_EIVD( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iPosX, Int iPosY, TComYuv* rpcYuvDst ) 521 { 522 wpScalingParam *pwp0, *pwp1; 523 TComPPS *pps = pcCU->getSlice()->getPPS(); 524 525 if ( !pps->getUseWP() ) { 526 printf("TComWeightPrediction::xWeightedPredictionBi():\tassert failed: useWP is false.\n"); 527 exit(0); 528 } 529 530 Int ibdi = (g_uiBitDepth+g_uiBitIncrement); 531 getWpScaling(pcCU, iRefIdx0, iRefIdx1, pwp0, pwp1, ibdi); 532 533 if( iRefIdx0 >= 0 && iRefIdx1 >= 0 ) 534 { 535 addWeightBi_EIVD(pcYuvSrc0, pcYuvSrc1, uiPartIdx, iPosX, iPosY, pwp0, pwp1, rpcYuvDst ); 536 } 537 else if ( iRefIdx0 >= 0 && iRefIdx1 < 0 ) 538 { 539 addWeightUni_EIVD( pcYuvSrc0, uiPartIdx, iPosX, iPosY, pwp0, rpcYuvDst ); 540 } 541 else if ( iRefIdx0 < 0 && iRefIdx1 >= 0 ) 542 { 543 addWeightUni_EIVD( pcYuvSrc1, uiPartIdx, iPosX, iPosY, pwp1, rpcYuvDst ); 544 } 545 else 546 assert (0); 547 548 } 549 #endif 550 395 551 #endif // WEIGHT_PRED 396 552 -
branches/0.2-poznan-univ/source/Lib/TLibCommon/TComWeightPrediction.h
r2 r12 37 37 Void xWeightedPredictionBi( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv* rpcYuvDst ); 38 38 39 #if POZNAN_EIVD 40 Void addWeightBi_EIVD( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iPosX, Int iPosY, wpScalingParam *wp0, wpScalingParam *wp1, TComYuv* rpcYuvDst, Bool bRound=true ); 41 Void addWeightUni_EIVD( TComYuv* pcYuvSrc0, UInt iPartUnitIdx, UInt iPosX, Int iPosY, wpScalingParam *wp0, TComYuv* rpcYuvDst ); 42 43 Void xWeightedPredictionUni_EIVD( TComDataCU* pcCU, TComYuv* pcYuvSrc, UInt uiPartAddr, Int iPosX, Int iPosY, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx ); 44 Void xWeightedPredictionBi_EIVD( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iPosX, Int iPosY, TComYuv* rpcYuvDst ); 45 #endif 46 39 47 __inline Pel xClip ( Int x ); 40 48 __inline Pel weightBidir( Int w0, Pel P0, Int w1, Pel P1, Int round, Int shift, Int offset); -
branches/0.2-poznan-univ/source/Lib/TLibCommon/TComYuv.cpp
r5 r12 354 354 } 355 355 356 #if POZNAN_EIVD 357 358 Void TComYuv::copyPartToPartYuv_EIVD ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt uiPosX, UInt uiPosY ) 359 { 360 copyPartToPartLuma_EIVD (pcYuvDst, uiPartIdx, uiPosX, uiPosY ); 361 copyPartToPartChroma_EIVD (pcYuvDst, uiPartIdx, uiPosX>>1, uiPosY>>1 ); 362 } 363 364 Void TComYuv::copyPartToPartLuma_EIVD ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt uiPosX, UInt uiPosY ) 365 { 366 Pel* pSrc = getLumaAddr(uiPartIdx); 367 Pel* pDst = pcYuvDst->getLumaAddr(uiPartIdx); 368 if( pSrc == pDst ) 369 { 370 //th not a good idea 371 //th best would be to fix the caller 372 return ; 373 } 374 375 UInt iSrcStride = getStride(); 376 UInt iDstStride = pcYuvDst->getStride(); 377 378 ::memcpy( pDst+uiPosY*iDstStride+uiPosX, pSrc+uiPosY*iSrcStride+uiPosX, sizeof(Pel) ); 379 } 380 381 Void TComYuv::copyPartToPartChroma_EIVD( TComYuv* pcYuvDst, UInt uiPartIdx, UInt uiPosX, UInt uiPosY ) 382 { 383 Pel* pSrcU = getCbAddr(uiPartIdx); 384 Pel* pSrcV = getCrAddr(uiPartIdx); 385 Pel* pDstU = pcYuvDst->getCbAddr(uiPartIdx); 386 Pel* pDstV = pcYuvDst->getCrAddr(uiPartIdx); 387 388 if( getCbAddr() == NULL || getCrAddr() == NULL || pcYuvDst->getCbAddr() == NULL || pcYuvDst->getCrAddr() == NULL ) //KUBA CHROMA 389 { 390 return ; 391 } 392 if( pSrcU == pDstU && pSrcV == pDstV) 393 { 394 //th not a good idea 395 //th best would be to fix the caller 396 return ; 397 } 398 399 UInt iSrcStride = getCStride(); 400 UInt iDstStride = pcYuvDst->getCStride(); 401 402 ::memcpy( pDstU+uiPosY*iDstStride+uiPosX, pSrcU+uiPosY*iSrcStride+uiPosX, sizeof(Pel) ); 403 ::memcpy( pDstV+uiPosY*iDstStride+uiPosX, pSrcV+uiPosY*iSrcStride+uiPosX, sizeof(Pel) ); 404 } 405 406 #endif 407 356 408 Void TComYuv::addClipPartLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ) 357 409 { … … 801 853 } 802 854 855 #if POZNAN_EIVD 856 857 #ifdef ROUNDING_CONTROL_BIPRED 858 859 Void TComYuv::addAvg_EIVD( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iPosX, UInt iPosY, Bool bRound ) 860 { 861 Pel* pSrcY0 = pcYuvSrc0->getLumaAddr( iPartUnitIdx ); 862 Pel* pSrcU0 = pcYuvSrc0->getCbAddr ( iPartUnitIdx ); 863 Pel* pSrcV0 = pcYuvSrc0->getCrAddr ( iPartUnitIdx ); 864 865 Pel* pSrcY1 = pcYuvSrc1->getLumaAddr( iPartUnitIdx ); 866 Pel* pSrcU1 = pcYuvSrc1->getCbAddr ( iPartUnitIdx ); 867 Pel* pSrcV1 = pcYuvSrc1->getCrAddr ( iPartUnitIdx ); 868 869 Pel* pDstY = getLumaAddr( iPartUnitIdx ); 870 Pel* pDstU = getCbAddr ( iPartUnitIdx ); 871 Pel* pDstV = getCrAddr ( iPartUnitIdx ); 872 873 UInt iSrc0Stride = pcYuvSrc0->getStride(); 874 UInt iSrc1Stride = pcYuvSrc1->getStride(); 875 UInt iDstStride = getStride(); 876 877 #if HIGH_ACCURACY_BI 878 Int shiftNum = 15 - (g_uiBitDepth + g_uiBitIncrement); 879 Int offset = (1<<(shiftNum - 1)); 880 881 //Luma 882 (pDstY+iPosY*iDstStride)[iPosX] = Clip(((pSrcY0+iPosY*iSrc0Stride)[iPosX] + (pSrcY1+iPosY*iSrc1Stride)[iPosX] + offset) >> shiftNum ); 883 884 iSrc0Stride = pcYuvSrc0->getCStride(); 885 iSrc1Stride = pcYuvSrc1->getCStride(); 886 iDstStride = getCStride(); 887 888 //Chroma 889 (pDstU+(iPosY>>1)*iDstStride)[(iPosX>>1)] = Clip(((pSrcU0+(iPosY>>1)*iSrc0Stride)[(iPosX>>1)] + (pSrcU1+(iPosY>>1)*iSrc1Stride)[(iPosX>>1)] + offset) >> shiftNum ); 890 (pDstV+(iPosY>>1)*iDstStride)[(iPosX>>1)] = Clip(((pSrcV0+(iPosY>>1)*iSrc0Stride)[(iPosX>>1)] + (pSrcV1+(iPosY>>1)*iSrc1Stride)[(iPosX>>1)] + offset) >> shiftNum ); 891 892 #else 893 894 //Luma 895 (pDstY+iPosY*iDstStride)[iPosX] = ((pSrcY0+iPosY*iSrc0Stride)[iPosX] + (pSrcY1+iPosY*iSrc1Stride)[iPosX] + bRound) >> 1; 896 897 iSrc0Stride = pcYuvSrc0->getCStride(); 898 iSrc1Stride = pcYuvSrc1->getCStride(); 899 iDstStride = getCStride(); 900 901 //Chroma 902 (pDstU+(iPosY>>1)*iDstStride)[(iPosX>>1)] = ((pSrcU0+(iPosY>>1)*iSrc0Stride)[(iPosX>>1)] + (pSrcU1+(iPosY>>1)*iSrc1Stride)[(iPosX>>1)] + bRound) >> 1; 903 (pDstV+(iPosY>>1)*iDstStride)[(iPosX>>1)] = ((pSrcV0+(iPosY>>1)*iSrc0Stride)[(iPosX>>1)] + (pSrcV1+(iPosY>>1)*iSrc1Stride)[(iPosX>>1)] + bRound) >> 1; 904 #endif 905 } 906 907 #endif 908 909 Void TComYuv::addAvg_EIVD( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iPosX, UInt iPosY ) 910 { 911 Pel* pSrcY0 = pcYuvSrc0->getLumaAddr( iPartUnitIdx ); 912 Pel* pSrcU0 = pcYuvSrc0->getCbAddr ( iPartUnitIdx ); 913 Pel* pSrcV0 = pcYuvSrc0->getCrAddr ( iPartUnitIdx ); 914 915 Pel* pSrcY1 = pcYuvSrc1->getLumaAddr( iPartUnitIdx ); 916 Pel* pSrcU1 = pcYuvSrc1->getCbAddr ( iPartUnitIdx ); 917 Pel* pSrcV1 = pcYuvSrc1->getCrAddr ( iPartUnitIdx ); 918 919 Pel* pDstY = getLumaAddr( iPartUnitIdx ); 920 Pel* pDstU = getCbAddr ( iPartUnitIdx ); 921 Pel* pDstV = getCrAddr ( iPartUnitIdx ); 922 923 UInt iSrc0Stride = pcYuvSrc0->getStride(); 924 UInt iSrc1Stride = pcYuvSrc1->getStride(); 925 UInt iDstStride = getStride(); 926 #if HIGH_ACCURACY_BI 927 Int shiftNum = 15 - (g_uiBitDepth + g_uiBitIncrement); 928 Int offset = (1<<(shiftNum - 1)); 929 930 //Luma 931 (pDstY+iPosY*iDstStride)[iPosX] = Clip(((pSrcY0+iPosY*iSrc0Stride)[iPosX] + (pSrcY1+iPosY*iSrc1Stride)[iPosX] + offset) >> shiftNum ); 932 933 iSrc0Stride = pcYuvSrc0->getCStride(); 934 iSrc1Stride = pcYuvSrc1->getCStride(); 935 iDstStride = getCStride(); 936 937 //Chroma 938 (pDstU+(iPosY>>1)*iDstStride)[(iPosX>>1)] = Clip(((pSrcU0+(iPosY>>1)*iSrc0Stride)[(iPosX>>1)] + (pSrcU1+(iPosY>>1)*iSrc1Stride)[(iPosX>>1)] + offset) >> shiftNum ); 939 (pDstV+(iPosY>>1)*iDstStride)[(iPosX>>1)] = Clip(((pSrcV0+(iPosY>>1)*iSrc0Stride)[(iPosX>>1)] + (pSrcV1+(iPosY>>1)*iSrc1Stride)[(iPosX>>1)] + offset) >> shiftNum ); 940 941 #else 942 //Luma 943 (pDstY+iPosY*iDstStride)[iPosX] = ((pSrcY0+iPosY*iSrc0Stride)[iPosX] + (pSrcY1+iPosY*iSrc1Stride)[iPosX] + 1) >> 1; 944 945 iSrc0Stride = pcYuvSrc0->getCStride(); 946 iSrc1Stride = pcYuvSrc1->getCStride(); 947 iDstStride = getCStride(); 948 949 //Chroma 950 (pDstU+(iPosY>>1)*iDstStride)[(iPosX>>1)] = ((pSrcU0+(iPosY>>1)*iSrc0Stride)[(iPosX>>1)] + (pSrcU1+(iPosY>>1)*iSrc1Stride)[(iPosX>>1)] + 1) >> 1; 951 (pDstV+(iPosY>>1)*iDstStride)[(iPosX>>1)] = ((pSrcV0+(iPosY>>1)*iSrc0Stride)[(iPosX>>1)] + (pSrcV1+(iPosY>>1)*iSrc1Stride)[(iPosX>>1)] + 1) >> 1; 952 #endif 953 } 954 955 #endif 956 803 957 Void TComYuv::removeHighFreq( TComYuv* pcYuvSrc, UInt uiWidht, UInt uiHeight ) 804 958 { -
branches/0.2-poznan-univ/source/Lib/TLibCommon/TComYuv.h
r5 r12 114 114 Void copyPartToPartChroma ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt uiWidth, UInt uiHeight ); 115 115 116 #if POZNAN_EIVD 117 Void copyPartToPartYuv_EIVD ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt uiPosX, UInt uiPosY ); 118 Void copyPartToPartLuma_EIVD ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt uiPosX, UInt uiPosY ); 119 Void copyPartToPartChroma_EIVD ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt uiPosX, UInt uiPosY ); 120 #endif 121 116 122 // ------------------------------------------------------------------------------------------------------------------ 117 123 // Algebraic operation for YUV buffer … … 136 142 Void addAvg ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iWidth, UInt iHeight ); 137 143 144 #if POZNAN_EIVD 145 #ifdef ROUNDING_CONTROL_BIPRED 146 Void addAvg_EIVD ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iPosX, UInt iPosY, Bool bRound ); 147 #endif 148 Void addAvg_EIVD ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iPosX, UInt iPosY ); 149 #endif 150 138 151 // Remove High frequency 139 152 Void removeHighFreq ( TComYuv* pcYuvSrc, UInt uiWidht, UInt uiHeight ); -
branches/0.2-poznan-univ/source/Lib/TLibCommon/TypeDef.h
r11 r12 65 65 #define POZNAN_CU_SYNTH 1 //Poznan Cu Synth 66 66 67 #define POZNAN_AVAIL_MAP 1 //Creates Availibity buffers in all needed classes 68 69 #define POZNAN_SYNTH_VIEW 1 //Creates view synthesis buffers in all needed classes 70 #define POZNAN_SYNTH_DEPTH 1 71 72 #define POZNAN_SYNTH 1 //Creates aligned synthesis classes in encoder and decoder 73 74 #define POZNAN_ENCODE_ONLY_DISOCCLUDED_CU 1 //Poznan CU Skip 75 #define POZNAN_FILL_OCCLUDED_CU_WITH_SYNTHESIS 1 //Fills not sended CUs with synthesized data 76 77 #define POZNAN_CU_SKIP_PSNR 1 //Poznan Cu Skip Display psnr of the codded CU only 67 #define POZNAN_NONLINEAR_DEPTH 0 /// Non-linear depth processing (Maciej Kurc) 68 #define POZNAN_NONLINEAR_DEPTH_SEND_AS_BYTE 1 /// Send DepthPower as byte instead of float 69 70 #if POZNAN_CU_SYNTH 71 #define POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 0 /// increase QP for texture CUs that are in the background (according to proper depth map). This QP change is not encoded in a bitstream 72 #endif 73 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 74 #define POZNAN_TEXTURE_TU_DELTA_QP_NOT_IN_BASE_VIEW 1 /// should not be disabled in current software version - no depth synthesis map is available for base view anyway 75 #define POZNAN_TEXTURE_TU_DELTA_QP_TOP_BOTTOM_CU_ROW 1 /// increase of QP param for top and bottom LCU row in frame 76 #define POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC 0 /// used for optimization of function calculating dQP from depth block max value. Standard values set if disabled. If enabled params are set in cfg file for encoder (no decoder is supported in that case). 77 #if !POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC 78 #define POZNAN_TEXTURE_TU_DELTA_QP_OFFSET (-2.6) 79 #define POZNAN_TEXTURE_TU_DELTA_QP_MUL (1) 80 #define POZNAN_TEXTURE_TU_DELTA_QP_TOP_BOTTOM_ROW_VAL (2) 81 #endif 82 #endif 83 84 #define POZNAN_EIVD 0 // Depth Based Vector Prediction prediction for MERGE 85 #if POZNAN_EIVD 86 #define POZNAN_EIVD_USE_FOR_TEXTURE 1 //use Depth Based Vector Prediction in texture pictures (0 - no, 1 -yes) 87 #define POZNAN_EIVD_USE_FOR_DEPTH 1 // use Depth Based Vector Prediction in depth pictures (0 - no, 1 -yes) 88 89 #define POZNAN_EIVD_CALC_PRED_DATA 1 // Depth Based Vector Prediction motion data used for prediction in other CUs is calculated based on all CU points (otherwise motion data for none-MP points is used for prediction) 90 #define POZNAN_EIVD_COMPRESS_ME_DATA 0 // Depth Based Vector Prediction derives representative motion data from reference CUs even if they are EIVD-based predicted (otherwise motion data is derived with per-point resolution for EIVD-based predicted reference CUs) 91 #define POZNAN_EIVD_USE_IN_NONANCHOR_PIC_ONLY 1 // determines if Depth Based Vector Prediction is used in non-anchor pictures only 92 #endif 93 94 #endif 95 96 // --------------------------------------- 97 98 #define POZNAN_STAT_JK 0 // save CU statistics to file 99 100 #if POZNAN_STAT_JK 101 #define POZNAN_STAT_JK_FLUSH 1 // flush CU statistics to file after each CU 102 #endif 103 104 #define POZNAN_CU_SKIP_PSNR 1 78 105 //<<<<< Poznan 3DV tools <<<<<< 106 79 107 80 108 //////////////////////////// … … 356 384 typedef unsigned long ULong; 357 385 typedef double Double; 386 typedef float Float; 358 387 359 388 // ====================================================================================================================
Note: See TracChangeset for help on using the changeset viewer.