Changeset 41 in 3DVCSoftware for branches/0.3-poznan-univ/source/Lib/TLibCommon
- Timestamp:
- 26 Mar 2012, 09:03:21 (13 years ago)
- Location:
- branches/0.3-poznan-univ/source/Lib/TLibCommon
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/0.3-poznan-univ/source/Lib/TLibCommon/CommonDef.h
r28 r41 144 144 #endif 145 145 146 #if POZNAN_NONLINEAR_DEPTH147 #define POZNAN_LUT_INCREASED_PRECISION 0 // 1 //to do148 #else149 #define POZNAN_LUT_INCREASED_PRECISION 0150 #endif151 152 146 //>>>>> generation and usage of virtual prediction depth maps >>>>> 153 147 #define PDM_ONE_DEPTH_PER_PU 1 // use only a single depth for a prediction unit (in update) … … 192 186 #endif 193 187 194 #if POZNAN_NONLINEAR_DEPTH195 inline UChar quantizeDepthPower(Float fDepthPower)196 {197 Int r = (Int) ( (fDepthPower-1.0f)*128.0f + 0.5f);198 if (r<=0) return 0;199 if (r>255) r=255;200 return r;201 };202 203 inline Float dequantizeDepthPower(Int iDepthQuant)204 {205 return iDepthQuant/128.0f + 1.0f;206 };207 #endif208 209 188 // ==================================================================================================================== 210 189 // Macro functions … … 218 197 #define RemoveBitIncrement(x) ( ((x) + ( (1 << g_uiBitIncrement) >> 1 )) >> g_uiBitIncrement ) ///< Remove Bit increment 219 198 220 #if POZNAN_LUT_INCREASED_PRECISION221 #define RemoveBitIncrementLUT(x) (x) ///< Remove Bit increment222 #define SizeOfLUT (256 << g_uiBitIncrement)223 #else224 199 #define SizeOfLUT 256 225 #define RemoveBitIncrementLUT(x) ( ((x) + ( (1 << g_uiBitIncrement) >> 1 )) >> g_uiBitIncrement ) ///< Remove Bit increment226 #endif227 200 228 201 #define DATA_ALIGN 1 ///< use 32-bit aligned malloc/free … … 665 638 666 639 640 #if POZNAN_NONLINEAR_DEPTH 641 struct TComNonlinearDepthModel // // OS: cannot be stdarray, due to memcpy done on SlicePilot 642 { 643 Int m_aiPoints[257]; 644 Int m_iNum; 645 646 Int m_aiX[257]; 647 Int m_aiY[257]; 648 649 Void Clear() { m_iNum=0; m_aiPoints[0]=0; m_aiPoints[1]=0; }; 650 Void Init() 651 { 652 for (Int k=m_iNum+1; k>=0; --k) 653 { 654 int q = 255*k/(m_iNum+1); 655 m_aiX[k] = q + m_aiPoints[k]; 656 m_aiY[k] = q - m_aiPoints[k]; 657 } 658 }; 659 660 Double xInterpolateD(Int *aiX,Int *aiY, Double x, Double dScale) 661 { 662 Int x1 = 0; 663 Int x2 = m_iNum+1; 664 665 for (;;) 666 { 667 if (x1+1>=x2) 668 return ((x-aiX[x1])*(aiY[x2]-aiY[x1])/(aiX[x2]-aiX[x1]) + aiY[x1])*dScale; 669 Int xm = (x1+x2)>>1; 670 if (x >= aiX[xm]) x1 = xm; 671 else x2 = xm; 672 } 673 } 674 675 inline Double ForwardD(Double x, Double dScale) { return xInterpolateD(m_aiX, m_aiY, x, dScale); } 676 inline Double BackwardD(Double x, Double dScale) { return xInterpolateD(m_aiY, m_aiX, x, dScale); } 677 678 Int64 xInterpolateI(Int *aiX,Int *aiY, Int x, Int64 iScale) 679 { 680 Int x1 = 0; 681 Int x2 = m_iNum+1; 682 683 for (;;) 684 { 685 if (x1+1>=x2) 686 { 687 Int aiXx2x1 = (aiX[x2]-aiX[x1]); 688 Int64 res = (x-aiX[x1])*(aiY[x2]-aiY[x1])*iScale; 689 if (res>0) return (res + (aiXx2x1>>1) )/aiXx2x1 + aiY[x1]*iScale; 690 else return (res - (aiXx2x1>>1) )/aiXx2x1 + aiY[x1]*iScale; 691 } 692 Int xm = (x1+x2)>>1; 693 if (x >= aiX[xm]) x1 = xm; 694 else x2 = xm; 695 } 696 } 697 698 inline Int64 ForwardI (Int x, Int64 iScale) { return xInterpolateI(m_aiX, m_aiY, x, iScale); } 699 inline Int64 BackwardI(Int x, Int64 iScale) { return xInterpolateI(m_aiY, m_aiX, x, iScale); } 700 701 }; 702 #endif 703 667 704 #endif // end of #ifndef __COMMONDEF__ 668 705 -
branches/0.3-poznan-univ/source/Lib/TLibCommon/TComDataCU.cpp
r30 r41 5004 5004 exit(333); 5005 5005 } 5006 Float fVal = (Float)((255 - (uiBlockMax >> g_uiBitIncrement)) >> 4);5006 Double fVal = (Double)((255 - (uiBlockMax >> g_uiBitIncrement)) >> 4); //Owieczka ?? ToDo Convert Double to Int 5007 5007 fVal = (fVal * fVal); 5008 5008 #if POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC 5009 fVal = ( Float)( fVal + getPic()->getTexDqpAccordingToDepthOffset() * 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 decreased5010 fVal = ( Float)( fVal * getPic()->getTexDqpAccordingToDepthMul()); //5009 fVal = (Double)( fVal + getPic()->getTexDqpAccordingToDepthOffset() * 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 5010 fVal = (Double)( fVal * getPic()->getTexDqpAccordingToDepthMul()); // 5011 5011 #else 5012 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 decreased5013 fVal = ( Float)( fVal * POZNAN_TEXTURE_TU_DELTA_QP_MUL); //5012 fVal = (Double)( 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 5013 fVal = (Double)( fVal * POZNAN_TEXTURE_TU_DELTA_QP_MUL); // 5014 5014 #endif 5015 5015 return (Int)fVal >> 5; … … 5034 5034 UInt iCuAddr = getAddr(); 5035 5035 //TComPic * pcDepthPic = getPic()->getDepthPic(); 5036 #if FLEX_CODING_ORDER 5037 TComPicYuv * pcDepthPicYUV = NULL; 5038 // if depth map reconstruction picture is available use it Use synthesis picture otherwise. 5039 if(getPic()->getSlice(0)->getDepthPic() != NULL && getPic()->getSlice(0)->getDepthPic()->getReconMark()) 5040 { 5041 pcDepthPicYUV = getPic()->getSlice(0)->getDepthPic()->getPicYuvRec(); 5042 } 5043 else 5044 { 5045 pcDepthPicYUV = getPic()->getPicYuvSynthDepth(); 5046 } 5047 #else 5036 5048 TComPicYuv * pcDepthPicYUV = getPic()->getPicYuvSynthDepth(); 5049 #endif 5037 5050 if(pcDepthPicYUV /*pcDepthPic*/ == NULL) 5038 5051 { … … 5055 5068 } 5056 5069 #if POZNAN_NONLINEAR_DEPTH 5057 TComNonlinearDepthBackward cNonlinearDepthBwd(getSlice()->getSPS()->getDepthPower(), g_uiBitIncrement, g_uiBitIncrement);5058 uiDepthLumaTransformBlockMax = (Pel)( cNonlinearDepthBwd(uiDepthLumaTransformBlockMax) + 0.5);5070 if( getSlice()->getSPS()->getUseNonlinearDepth() ) 5071 uiDepthLumaTransformBlockMax = (Pel)( getSlice()->getSPS()->getNonlinearDepthModel().BackwardI(RemoveBitIncrement(uiDepthLumaTransformBlockMax), 1<<g_uiBitIncrement ) ) ; 5059 5072 #endif 5060 5073 Int iDeltaQP = CuQpIncrementFunction(uiDepthLumaTransformBlockMax); -
branches/0.3-poznan-univ/source/Lib/TLibCommon/TComMP.cpp
r28 r41 44 44 //m_pcCameraData = NULL; 45 45 m_aiBaseViewShiftLUT = NULL; 46 #if POZNAN_MP_USE_CURRENT_VIEW_DEPTH_MAP_IF_AVAILABLE 47 m_ppiTempMvPtCorrX = NULL; 48 m_ppiTempMvPtCorrY = NULL; 49 m_ppiTempMvPtCorrZ = NULL; 50 #endif 46 51 #endif 47 52 … … 96 101 #endif 97 102 98 /*99 m_ppiMvPtCorrX = new Short*[m_uiHeight];100 m_ppiMvPtCorrY = new Short*[m_uiHeight];101 m_ppiMvPtCorrZ = new Short*[m_uiHeight];102 m_ppiMvPtCorrRefViewIdx = new Short*[m_uiHeight];103 m_pppcRefCU = new TComDataCU**[m_uiHeight];104 m_ppuicRefPartAddr = new UShort*[m_uiHeight];105 for(Int i=0;i<m_uiHeight;i++)106 {107 m_ppiMvPtCorrX[i] = new Short[m_uiWidth];108 m_ppiMvPtCorrY[i] = new Short[m_uiWidth];109 m_ppiMvPtCorrZ[i] = new Short[m_uiWidth];110 m_ppiMvPtCorrRefViewIdx[i] = new Short[m_uiWidth];111 m_pppcRefCU[i] = new TComDataCU*[m_uiWidth];112 m_ppuicRefPartAddr[i] = new UShort[m_uiWidth];113 }114 //*/115 ///*116 103 Short* piPtr; 117 104 UShort* puiPtr; … … 141 128 puiPtr = (UShort*)malloc(sizeof(UShort)*m_uiHeight*m_uiWidth); 142 129 for(UInt i=0,addr=0;i<m_uiHeight;i++,addr+=m_uiWidth) m_ppuicRefPartAddr[i] = &(puiPtr[addr]); 143 //*/ 130 131 #if !POZNAN_MP_USE_DEPTH_MAP_GENERATION && POZNAN_MP_USE_CURRENT_VIEW_DEPTH_MAP_IF_AVAILABLE 132 m_ppiTempMvPtCorrX = (Short**)malloc(sizeof(Short*)*m_uiHeight); 133 piPtr = (Short*)malloc(sizeof(Short)*m_uiHeight*m_uiWidth); 134 for(UInt i=0,addr=0;i<m_uiHeight;i++,addr+=m_uiWidth) m_ppiTempMvPtCorrX[i] = &(piPtr[addr]); 135 136 m_ppiTempMvPtCorrY = (Short**)malloc(sizeof(Short*)*m_uiHeight); 137 piPtr = (Short*)malloc(sizeof(Short)*m_uiHeight*m_uiWidth); 138 for(UInt i=0,addr=0;i<m_uiHeight;i++,addr+=m_uiWidth) m_ppiTempMvPtCorrY[i] = &(piPtr[addr]); 139 140 m_ppiTempMvPtCorrZ = (Short**)malloc(sizeof(Short*)*m_uiHeight); 141 piPtr = (Short*)malloc(sizeof(Short)*m_uiHeight*m_uiWidth); 142 for(UInt i=0,addr=0;i<m_uiHeight;i++,addr+=m_uiWidth) m_ppiTempMvPtCorrZ[i] = &(piPtr[addr]); 143 #endif 144 144 145 #if POZNAN_DBMP & !POZNAN_DBMP_COMPRESS_ME_DATA 145 146 m_ppiL0RefPOC.clear(); … … 303 304 } 304 305 306 #if !POZNAN_MP_USE_DEPTH_MAP_GENERATION && POZNAN_MP_USE_CURRENT_VIEW_DEPTH_MAP_IF_AVAILABLE 307 if(m_ppiTempMvPtCorrX!=NULL) 308 { 309 //for(Int i=0;i<m_uiHeight;i++) delete [] m_ppiTempMvPtCorrX[i]; 310 //delete [] m_ppiTempMvPtCorrX; 311 free(m_ppiTempMvPtCorrX[0]); 312 free(m_ppiTempMvPtCorrX); 313 m_ppiTempMvPtCorrX = NULL; 314 } 315 316 if(m_ppiTempMvPtCorrY!=NULL) 317 { 318 //for(Int i=0;i<m_uiHeight;i++) delete [] m_ppiTempMvPtCorrY[i]; 319 //delete [] m_ppiTempMvPtCorrY; 320 free(m_ppiTempMvPtCorrY[0]); 321 free(m_ppiTempMvPtCorrY); 322 m_ppiTempMvPtCorrY = NULL; 323 } 324 325 if(m_ppiTempMvPtCorrZ!=NULL) 326 { 327 //for(Int i=0;i<m_uiHeight;i++) delete [] m_ppiTempMvPtCorrZ[i]; 328 //delete [] m_ppiTempMvPtCorrZ; 329 free(m_ppiTempMvPtCorrZ[0]); 330 free(m_ppiTempMvPtCorrZ); 331 m_ppiTempMvPtCorrZ = NULL; 332 } 333 334 #endif 335 305 336 #if POZNAN_DBMP & !POZNAN_DBMP_COMPRESS_ME_DATA 306 337 PUT_MP_ARRAY_TYPE** ppiTemp; … … 439 470 } 440 471 472 #if !POZNAN_MP_USE_DEPTH_MAP_GENERATION && POZNAN_MP_USE_CURRENT_VIEW_DEPTH_MAP_IF_AVAILABLE 473 Void TComMP::clearTemp() 474 { 475 if(!isInit()) return; 476 477 for(Int i=0;i<m_uiHeight;i++) 478 for(Int j=0;j<m_uiWidth;j++) 479 { 480 m_ppiTempMvPtCorrX[i][j] = TComMP::OCCLUSION; 481 m_ppiTempMvPtCorrY[i][j] = TComMP::OCCLUSION; 482 //m_ppiTempMvPtCorrZ[i][j] = 0x7FFF; //Depth 483 m_ppiTempMvPtCorrZ[i][j] = TComMP::OCCLUSION; //Disparity 484 } 485 } 486 #endif 487 441 488 Bool TComMP::isInit() 442 489 { … … 498 545 //Bool bIsLeft; 499 546 Int iDepth; 547 #if POZNAN_MP_USE_CURRENT_VIEW_DEPTH_MAP_IF_AVAILABLE 548 Int iSrcX, iSrcY; 549 #endif 500 550 #endif 501 551 … … 547 597 } 548 598 #else 599 600 #if POZNAN_MP_USE_CURRENT_VIEW_DEPTH_MAP_IF_AVAILABLE 601 //pcDepthPic = GetPicFromList(m_pcDepthRefPicsList, uiPOC, uiViewId); 602 if(pcPic->getSlice(0)->getDepthPic()!=NULL && pcPic->getSlice(0)->getDepthPic()->getReconMark()) 603 pcDepthPic = pcPic->getSlice(0)->getDepthPic(); 604 else 605 pcDepthPic = NULL; 606 607 if(pcDepthPic!=NULL) 608 { 609 pDepth = pcDepthPic->getPicYuvRec()->getLumaAddr(); 610 iStride = pcDepthPic->getPicYuvRec()->getStride(); 611 612 for( UInt uiIdx = 0; uiIdx < uiViewId; uiIdx++ ) 613 //for( UInt uiIdx = uiViewId-1; uiIdx >= uiViewId; uiIdx-- ) 614 { 615 uiRefViewId = uiIdx; 616 617 pcRefPic = GetPicFromList(m_pcRefPicsList, uiPOC, uiRefViewId); 618 assert(pcRefPic!=NULL);//test 619 if(pcRefPic==NULL) return false; //No ref pic with current POC and RefView found in ref list!!! 620 621 if(!pcRefPic->getSlice(0)->isIntra()) bIsRefNoISliceAvailable = true; 622 else bIsAnchorPicture = true; 623 624 //ppiShiftLUTLeft = m_pcCameraData->getBaseViewShiftLUTI()[uiViewId][uiRefViewId]; 625 ppiShiftLUTLeft = m_aiBaseViewShiftLUT[uiViewId][uiRefViewId]; 626 627 clearTemp(); 628 629 for(iCurY=0; iCurY<(Int)m_uiHeight; iCurY++) 630 for(iCurX=0; iCurX<(Int)m_uiWidth; iCurX++) 631 { 632 //Check if point already has its reference: 633 if(m_ppiMvPtCorrX[iCurY][iCurX]!=TComMP::OCCLUSION && m_ppiMvPtCorrY[iCurY][iCurX]!=TComMP::OCCLUSION) continue; 634 635 iDepth = pDepth[ iCurX + iCurY * iStride ]; 636 iDepth = RemoveBitIncrement(iDepth); 637 assert( iDepth >= 0 && iDepth <= 256 ); 638 639 //if(bIsLeft) iDisparity = ppiShiftLUTLeft[0][iDepth]; 640 //else iDisparity = -ppiShiftLUTLeft[0][iDepth]; 641 iDisparity = ppiShiftLUTLeft[0][iDepth]; //!!! 642 643 iRefX = iCurX - ( ( iDisparity + 2 ) >> 2 ); 644 iRefY = iCurY; 645 646 if(iRefX>=0 && iRefX<m_uiWidth && iRefY>=0 && iRefY<m_uiHeight) 647 { 648 iSrcX = m_ppiTempMvPtCorrX[iRefY][iRefX]; 649 iSrcY = m_ppiTempMvPtCorrY[iRefY][iRefX]; 650 651 if(iSrcX==TComMP::OCCLUSION || iSrcY==TComMP::OCCLUSION) 652 { 653 m_ppiMvPtCorrRefViewIdx[iCurY][iCurX] = (Short)uiRefViewId; 654 m_ppiMvPtCorrX[iCurY][iCurX] = (Short)iRefX; 655 m_ppiMvPtCorrY[iCurY][iCurX] = (Short)iRefY; 656 657 m_ppiMvPtCorrZ[iCurY][iCurX] = (Short)iDepth; 658 //m_ppiMvPtCorrZ[iCurY][iCurX] = (Short)iDisparity; 659 660 pcRefCU = pcRefPic->getCU((UInt)(iRefY/pcRefPic->getSlice(0)->getSPS()->getMaxCUHeight()*pcRefPic->getFrameWidthInCU() + iRefX/pcRefPic->getSlice(0)->getSPS()->getMaxCUWidth())); 661 662 m_pppcRefCU[iCurY][iCurX] = pcRefCU; 663 m_ppuicRefPartAddr[iCurY][iCurX] = (UShort)g_auiRasterToZscan[(iRefY-pcRefCU->getCUPelY())/pcRefPic->getMinCUHeight()*pcRefPic->getNumPartInWidth()+(iRefX-pcRefCU->getCUPelX())/pcRefPic->getMinCUWidth()]; 664 665 m_ppiTempMvPtCorrX[iRefY][iRefX] = iCurX; 666 m_ppiTempMvPtCorrY[iRefY][iRefX] = iCurY; 667 m_ppiTempMvPtCorrZ[iRefY][iRefX] = (Short)iDepth; 668 //m_ppiTempMvPtCorrZ[iRefY][iRefX] = (Short)iDisparity; 669 } 670 else if((Short)iDepth>m_ppiTempMvPtCorrZ[iRefY][iRefX]) //Point assigned earlier to this location is occluded 671 //else if((Short)iDisparity>m_ppiTempMvPtCorrZ[iRefY][iRefX]) //Point assigned earlier to this location is occluded 672 { 673 m_ppiMvPtCorrRefViewIdx[iCurY][iCurX] = (Short)uiRefViewId; 674 m_ppiMvPtCorrX[iCurY][iCurX] = (Short)iRefX; 675 m_ppiMvPtCorrY[iCurY][iCurX] = (Short)iRefY; 676 677 m_ppiMvPtCorrZ[iCurY][iCurX] = (Short)iDepth; 678 //m_ppiMvPtCorrZ[iCurY][iCurX] = (Short)iDisparity; 679 680 pcRefCU = pcRefPic->getCU((UInt)(iRefY/pcRefPic->getSlice(0)->getSPS()->getMaxCUHeight()*pcRefPic->getFrameWidthInCU() + iRefX/pcRefPic->getSlice(0)->getSPS()->getMaxCUWidth())); 681 682 m_pppcRefCU[iCurY][iCurX] = pcRefCU; 683 m_ppuicRefPartAddr[iCurY][iCurX] = (UShort)g_auiRasterToZscan[(iRefY-pcRefCU->getCUPelY())/pcRefPic->getMinCUHeight()*pcRefPic->getNumPartInWidth()+(iRefX-pcRefCU->getCUPelX())/pcRefPic->getMinCUWidth()]; 684 685 m_ppiTempMvPtCorrX[iRefY][iRefX] = iCurX; 686 m_ppiTempMvPtCorrY[iRefY][iRefX] = iCurY; 687 m_ppiTempMvPtCorrZ[iRefY][iRefX] = (Short)iDepth; 688 //m_ppiTempMvPtCorrZ[iRefY][iRefX] = (Short)iDisparity; 689 690 //Mark point assigned earlier to this location as occluded: 691 m_ppiMvPtCorrRefViewIdx[iSrcY][iSrcX] = TComMP::OCCLUSION; 692 m_ppiMvPtCorrX[iSrcY][iSrcX] = TComMP::OCCLUSION; 693 m_ppiMvPtCorrY[iSrcY][iSrcX] = TComMP::OCCLUSION; 694 695 //m_ppiMvPtCorrZ[iSrcY][iSrcX] = 0x7FFF; 696 m_ppiMvPtCorrZ[iSrcY][iSrcX] = TComMP::OCCLUSION; 697 698 m_pppcRefCU[iSrcY][iSrcX] = NULL; 699 m_ppuicRefPartAddr[iSrcY][iSrcX] = 0; 700 } 701 } 702 } 703 } 704 } 705 else 706 #endif 707 { 549 708 iSynthViewIdx = uiViewId; 550 709 … … 605 764 } 606 765 } 766 } 607 767 #endif 608 768 -
branches/0.3-poznan-univ/source/Lib/TLibCommon/TComMP.h
r28 r41 69 69 Short** m_ppiMvPtCorrZ; 70 70 Short** m_ppiMvPtCorrRefViewIdx; 71 72 #if !POZNAN_MP_USE_DEPTH_MAP_GENERATION && POZNAN_MP_USE_CURRENT_VIEW_DEPTH_MAP_IF_AVAILABLE 73 Short** m_ppiTempMvPtCorrX; 74 Short** m_ppiTempMvPtCorrY; 75 Short** m_ppiTempMvPtCorrZ; 76 #endif 71 77 72 78 TComDataCU*** m_pppcRefCU; //XY array of pointers to reference CU for each point of picture … … 117 123 //Void init(UInt uiHeight, UInt uiWidth, TAppComCamPara* pcCameraData); 118 124 Void init(UInt uiHeight, UInt uiWidth, Int**** aiBaseViewShiftLUT); 125 #if POZNAN_MP_USE_CURRENT_VIEW_DEPTH_MAP_IF_AVAILABLE 126 Void clearTemp(); 127 #endif 119 128 #endif 120 129 Void uninit(); -
branches/0.3-poznan-univ/source/Lib/TLibCommon/TComPicYuv.cpp
r28 r41 457 457 } 458 458 #if POZNAN_NONLINEAR_DEPTH 459 Void TComPicYuv::nonlinearDepthForward(TComPicYuv *pcPicDst, Float p) 460 { 461 Int x,y; 462 TComNonlinearDepthForward cNonlinearDepthFwd(p, g_uiBitIncrement, g_uiBitIncrement); 459 Void TComPicYuv::nonlinearDepthForward(TComPicYuv *pcPicDst, TComNonlinearDepthModel &rcNonlinearDepthModel) 460 { 461 Int x,y,i; 462 Int LUT[256]; 463 464 for (i=0; i<256; ++i) 465 LUT[i] = (Int)rcNonlinearDepthModel.ForwardI(i, 1<<g_uiBitIncrement); 463 466 464 467 // Luma … … 469 472 for(x=0; x<m_iPicWidth; x++) 470 473 { 471 pPelDst[x] = (Pel)( cNonlinearDepthFwd(pPelSrc[x]) + 0.5);474 pPelDst[x] = LUT[RemoveBitIncrement(pPelSrc[x])]; 472 475 } 473 476 pPelDst += pcPicDst->getStride(); … … 478 481 copyToPicCr(pcPicDst); 479 482 } 480 Void TComPicYuv::nonlinearDepthBackward(TComPicYuv *pcPicDst, Float p) 481 { 482 Int x,y; 483 TComNonlinearDepthBackward cNonlinearDepthBwd(p, g_uiBitIncrement, g_uiBitIncrement); 483 484 Void TComPicYuv::nonlinearDepthBackward(TComPicYuv *pcPicDst, TComNonlinearDepthModel &rcNonlinearDepthModel) 485 { 486 Int x,y,i; 487 Int LUT[256]; 488 489 for (i=255; i>=0; --i) 490 LUT[i] = (Int)rcNonlinearDepthModel.BackwardI(i, 1<<g_uiBitIncrement ); // +0.5; 484 491 485 492 // Luma … … 490 497 for(x=0; x<m_iPicWidth; x++) 491 498 { 492 pPelDst[x] = (Pel)( cNonlinearDepthBwd(pPelSrc[x]) + 0.5);499 pPelDst[x] = LUT[RemoveBitIncrement(pPelSrc[x])]; 493 500 } 494 501 pPelDst += pcPicDst->getStride(); -
branches/0.3-poznan-univ/source/Lib/TLibCommon/TComPicYuv.h
r28 r41 44 44 #include "CommonDef.h" 45 45 46 #if POZNAN_NONLINEAR_DEPTH47 48 #include <math.h>49 50 class TComNonlinearDepthForward // OLGIERD - Z-NL-Power conversion51 {52 private:53 Double m_fMul;54 Float m_fPower;55 56 public:57 58 TComNonlinearDepthForward(Float fPower, Int iInputBitIncrement, Int iOutputBitIncrement)59 {60 m_fPower = fPower;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 73 class TComNonlinearDepthBackward // OLGIERD - Z-NL-Power conversion74 {75 private:76 Double m_fMul;77 Float m_fPower;78 79 public:80 81 TComNonlinearDepthBackward(Float fPower, Int iInputBitIncrement, Int iOutputBitIncrement)82 {83 m_fPower = fPower = 1.0/fPower;84 Double fPostMul = (1<<(8+iOutputBitIncrement))-1; // OLGIERD ToDo - should be or not?85 Double fPreMul = 1.0/((1<<(8+iInputBitIncrement))-1);86 m_fMul = fPostMul*pow(fPreMul,(Double)fPower);87 };88 89 inline Double operator() (Double Value)90 {91 if (Value<0) return -pow( -Value,(Double)m_fPower)*m_fMul;92 return pow(Value,(Double)m_fPower)*m_fMul;93 };94 };95 #endif96 46 // ==================================================================================================================== 97 47 // Class definition … … 226 176 227 177 #if POZNAN_NONLINEAR_DEPTH 228 Void nonlinearDepthForward(TComPicYuv *pcPicDst, Float p);229 Void nonlinearDepthBackward(TComPicYuv *pcPicDst, Float p);178 Void nonlinearDepthForward(TComPicYuv *pcPicDst, TComNonlinearDepthModel &rcNonlinearDepthModel); 179 Void nonlinearDepthBackward(TComPicYuv *pcPicDst, TComNonlinearDepthModel &rcNonlinearDepthModel); 230 180 #endif 231 181 };// END CLASS DEFINITION TComPicYuv -
branches/0.3-poznan-univ/source/Lib/TLibCommon/TComPrediction.cpp
r28 r41 1639 1639 TComMv mv0_2nd,mv1_2nd; 1640 1640 1641 #if DEPTH_MAP_GENERATION 1642 Int ref_frame0_idx_1st, ref_frame1_idx_1st; 1643 TComMv mv0_1st,mv1_1st; 1644 #endif 1645 1641 1646 Pel* piDstCb; 1642 1647 Pel* piDstCr; … … 1684 1689 iWidth >>= uiSubSampExpX; 1685 1690 iHeight >>= uiSubSampExpY; 1691 1692 //save orginal motion field of CU (it will be overwritten during the motion compensation) 1693 ref_frame0_idx_1st = pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiPartAddr); 1694 mv0_1st = pcCU->getCUMvField( REF_PIC_LIST_0 )->getMv( uiPartAddr ); 1695 1696 ref_frame1_idx_1st = pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(uiPartAddr); 1697 mv1_1st = pcCU->getCUMvField( REF_PIC_LIST_1 )->getMv( uiPartAddr ); 1686 1698 } 1687 1699 #endif … … 1804 1816 1805 1817 //set motion data representing CU with DBMP 1818 PartSize ePartSize = pcCU->getPartitionSize( uiPartAddr ); //PartSize ePartSize = pcCU->getPartitionSize( 0 ); 1806 1819 #if DEPTH_MAP_GENERATION 1807 1820 if( !bPrdDepthMap ) 1808 1821 #endif 1809 1822 { 1810 PartSize ePartSize = pcCU->getPartitionSize( uiPartAddr ); //PartSize ePartSize = pcCU->getPartitionSize( 0 );1811 1823 #if POZNAN_DBMP_CALC_PRED_DATA 1812 1824 pcMP->xCalcDBMPPredData(uiPointCnt, ref_frame0_idx, mv0, ref_frame1_idx, mv1); … … 1819 1831 #endif 1820 1832 } 1833 1834 #if DEPTH_MAP_GENERATION 1835 if( bPrdDepthMap ) 1836 { 1837 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( mv0_1st, ref_frame0_idx_1st, ePartSize, uiPartAddr, iPartIdx, 0 ); 1838 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( mv1_1st, ref_frame1_idx_1st, ePartSize, uiPartAddr, iPartIdx, 0 ); 1839 } 1840 #endif 1821 1841 1822 1842 if ( iPartIdxOrg >= 0 ) break; -
branches/0.3-poznan-univ/source/Lib/TLibCommon/TComSlice.cpp
r28 r41 85 85 ::memset( m_aaiCodedOffset, 0x00, sizeof( m_aaiCodedOffset ) ); 86 86 m_pcTexturePic = NULL; 87 m_pcDepthPic = NULL; 87 88 #ifdef WEIGHT_PRED 88 89 resetWpScaling(m_weightPredTable); … … 113 114 ::memset( m_aiNumRefIdx, 0, sizeof ( m_aiNumRefIdx )); 114 115 m_pcTexturePic = NULL; 116 m_pcDepthPic = NULL; 115 117 116 118 initEqualRef(); … … 703 705 m_bUseDMM = false; 704 706 #endif 707 #if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER 708 m_bUseDMM34 = false; 709 #endif 705 710 } 706 711 … … 747 752 } 748 753 #if POZNAN_NONLINEAR_DEPTH 749 m_ fDepthPower = 1.0;754 m_cNonlinearDepthModel.Clear(); 750 755 #endif 751 756 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH … … 768 773 ::memset( m_aaiCodedOffset, 0x00, sizeof( m_aaiCodedOffset ) ); 769 774 #if POZNAN_NONLINEAR_DEPTH 770 m_ fDepthPower = 1.0;775 m_cNonlinearDepthModel.Clear(); 771 776 #endif 772 777 } -
branches/0.3-poznan-univ/source/Lib/TLibCommon/TComSlice.h
r28 r41 139 139 Bool m_bUseDMM; 140 140 #endif 141 #if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER 142 Bool m_bUseDMM34; 143 #endif 141 144 142 145 #if DEPTH_MAP_GENERATION … … 169 172 170 173 #if POZNAN_NONLINEAR_DEPTH 171 Float m_fDepthPower; 174 TComNonlinearDepthModel m_cNonlinearDepthModel; 175 Bool m_bUseNonlinearDepth; 172 176 #endif 173 177 … … 258 262 Void setUseDMM( Bool b ) { m_bUseDMM = b; } 259 263 #endif 260 264 #if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER 265 Bool getUseDMM34() { return m_bUseDMM34; } 266 Void setUseDMM34( Bool b ) { m_bUseDMM34 = b; } 267 #endif 261 268 262 269 #if DCM_COMB_LIST … … 295 302 Void setUseSAO (Bool bVal) {m_bUseSAO = bVal;} 296 303 #if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU //todo fix SAO 297 Bool getUseSAO () { return (getViewId()>0)?false:m_bUseSAO;}304 Bool getUseSAO () { return (getUseCUSkip() && getViewId()>0)?false:m_bUseSAO;} 298 305 #else 299 306 Bool getUseSAO () {return m_bUseSAO;} … … 354 361 #endif 355 362 #if POZNAN_NONLINEAR_DEPTH 356 inline Void setDepthPower(Float p) {m_fDepthPower = p;}357 inline Float getDepthPower() {return m_fDepthPower;}358 #else 359 inline Float getDepthPower() {return 1.0f;}363 inline Void setNonlinearDepthModel( TComNonlinearDepthModel &rp ){ m_cNonlinearDepthModel = rp; } 364 inline TComNonlinearDepthModel& getNonlinearDepthModel() { return m_cNonlinearDepthModel; } 365 Bool getUseNonlinearDepth() { return m_bUseNonlinearDepth; } 366 Void setUseNonlinearDepth( Bool bVal ) { m_bUseNonlinearDepth = bVal; } 360 367 #endif 361 368 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH … … 459 466 Int m_iDepth; 460 467 TComPic* m_pcTexturePic; 468 TComPic* m_pcDepthPic; 461 469 462 470 // referenced slice? … … 664 672 665 673 Void setTexturePic( TComPic *pcTexturePic ) { m_pcTexturePic = pcTexturePic; } 674 Void setDepthPic ( TComPic *pcDepthPic ) { m_pcDepthPic = pcDepthPic; } 666 675 TComPic *getTexturePic() const { return m_pcTexturePic; } 676 TComPic *getDepthPic() const { return m_pcDepthPic; } 667 677 668 678 #ifdef WEIGHT_PRED -
branches/0.3-poznan-univ/source/Lib/TLibCommon/TypeDef.h
r28 r41 40 40 41 41 42 43 #define SONY_COLPIC_AVAILABILITY 1 42 #define FLEX_CODING_ORDER 1 43 44 #define SONY_COLPIC_AVAILABILITY 1 44 45 45 46 //>>>>> HHI 3DV tools >>>>> … … 83 84 #define POZNAN_CU_SKIP_PSNR 1 //Poznan Cu Skip Display psnr of the codded CUs only 84 85 85 #define POZNAN_NONLINEAR_DEPTH 1 /// Non-linear depth processing (Maciej Kurc)86 #define POZNAN_NONLINEAR_DEPTH_ SEND_AS_BYTE 1 /// Send DepthPower as byte instead of float86 #define POZNAN_NONLINEAR_DEPTH 1 /// Non-linear depth processing 87 #define POZNAN_NONLINEAR_DEPTH_THRESHOLD 1 /// Non-linear depth thrasholding 87 88 88 89 #if POZNAN_SYNTH … … 106 107 // POZNAN_MP_USE_DEPTH_MAP_GENERATION=1 - use DEPTH_MAP_GENERATION, 107 108 // POZNAN_MP_USE_DEPTH_MAP_GENERATION=0 - use reconstructed depth maps from neighboring views 109 110 #if !POZNAN_MP_USE_DEPTH_MAP_GENERATION 111 #define POZNAN_MP_USE_CURRENT_VIEW_DEPTH_MAP_IF_AVAILABLE 1 // Depth-Based Multiview Prediction of CU parameters will use depth picture of current view if this picture is available, otherwise reference view depth is utilized 112 #endif 108 113 109 114 #define POZNAN_MP_FILL 1 // Depth-Based Multiview Prediction of CU parameters with fill option for occluded areas … … 407 412 typedef unsigned long ULong; 408 413 typedef double Double; 409 typedef float Float;410 414 411 415 // ====================================================================================================================
Note: See TracChangeset for help on using the changeset viewer.