Changeset 41 in 3DVCSoftware for branches/0.3-poznan-univ/source/Lib
- Timestamp:
- 26 Mar 2012, 09:03:21 (13 years ago)
- Location:
- branches/0.3-poznan-univ/source/Lib
- Files:
-
- 22 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 // ==================================================================================================================== -
branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecCAVLC.cpp
r28 r41 238 238 #endif 239 239 #if POZNAN_DBMP 240 xReadFlag( uiCode ); 241 pcSPS->setDBMP ( uiCode ); 240 xReadFlag( uiCode ); pcSPS->setDBMP ( uiCode ); 242 241 #endif 243 242 #if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU 244 xReadFlag( uiCode ); 245 pcSPS->setUseCUSkip ( uiCode ); 243 xReadFlag( uiCode ); pcSPS->setUseCUSkip ( uiCode ); 246 244 #endif 247 245 xReadFlag( uiCode ); // SPS base view flag … … 279 277 #endif 280 278 #if POZNAN_NONLINEAR_DEPTH 281 #if POZNAN_NONLINEAR_DEPTH_SEND_AS_BYTE 282 uiCode = 0; 283 xReadCode(8, uiCode); 284 pcSPS->setDepthPower(dequantizeDepthPower(uiCode)); 285 #else 286 uiCode = 0; 287 xReadCode(sizeof(float)*8, uiCode); // We do not send seign 288 //uiCode &= ~0x80000000; 289 pcSPS->setDepthPower(*((float*)&uiCode)); 290 #endif 291 printf("\nfDepthPower = %f", pcSPS->getDepthPower()); 279 xReadFlag( uiCode ); 280 pcSPS->setUseNonlinearDepth( uiCode ? true : false ); 281 pcSPS->getNonlinearDepthModel().Clear(); 282 if( uiCode ) 283 { 284 uiCode = 0; //Owieczka Necessary?? 285 xReadUvlc( uiCode ); 286 int num = pcSPS->getNonlinearDepthModel().m_iNum = uiCode; 287 for (int i=1; i<=num; ++i) 288 { 289 uiCode = 0; 290 xReadUvlc( uiCode ); 291 pcSPS->getNonlinearDepthModel().m_aiPoints[i] = uiCode; 292 } 293 pcSPS->getNonlinearDepthModel().m_aiPoints[0] = 0; 294 pcSPS->getNonlinearDepthModel().m_aiPoints[num+1] = 0; 295 pcSPS->getNonlinearDepthModel().Init(); 296 } 292 297 #endif 293 298 } -
branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecTop.cpp
r28 r41 90 90 m_uiMaxViewId = 0; 91 91 #if POZNAN_NONLINEAR_DEPTH 92 m_fDepthPower = 1.0; 92 m_cNonlinearDepthModel.Clear(); 93 m_bUseNonlinearDepth = false; 93 94 #endif 94 95 } … … 140 141 Int64 iOffsetChroma = iOffset + ( ( 1 << iLog2DivChroma ) >> 1 ); 141 142 143 144 for( UInt uiDepthValue = 0; uiDepthValue < 256; uiDepthValue++ ) 145 { 146 147 // real-valued look-up tables 142 148 #if POZNAN_NONLINEAR_DEPTH 143 TComNonlinearDepthBackward cNonlinearDepthBwd(m_fDepthPower, (POZNAN_LUT_INCREASED_PRECISION) ? g_uiBitIncrement : 0, (POZNAN_LUT_INCREASED_PRECISION) ? g_uiBitIncrement : 0); 144 #endif 145 146 for( UInt uiDepthValue = 0; uiDepthValue < 256; uiDepthValue++ ) 147 { 148 Double dDepthValue = (Double)uiDepthValue; 149 Int64 iDepthValue = (Int64)uiDepthValue; 150 #if POZNAN_NONLINEAR_DEPTH 151 dDepthValue = cNonlinearDepthBwd(dDepthValue); 152 iDepthValue = (Int64)(dDepthValue+0.5); 153 #endif 154 #if POZNAN_LUT_INCREASED_PRECISION 155 dDepthValue /= (1<<g_uiBitIncrement); 156 #endif 157 158 // real-valued look-up tables 159 Double dShiftLuma = ( dDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision ); 149 Double dShiftLuma; 150 if( m_bUseNonlinearDepth ) 151 dShiftLuma = ( m_cNonlinearDepthModel.BackwardD( (Double)uiDepthValue, dScale) + dOffset ) * Double( 1 << m_iLog2Precision ); 152 else 153 dShiftLuma = ( (Double)uiDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision ); 154 #else 155 Double dShiftLuma = ( (Double)uiDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision ); 156 #endif 160 157 Double dShiftChroma = dShiftLuma / 2; 161 158 radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = dShiftLuma; … … 163 160 164 161 // integer-valued look-up tables 165 Int64 iTempScale = iDepthValue * iScale; 166 #if POZNAN_LUT_INCREASED_PRECISION 167 iTempScale >>= g_uiBitIncrement; 162 #if POZNAN_NONLINEAR_DEPTH 163 Int64 iTempScale; 164 if( m_bUseNonlinearDepth ) 165 iTempScale = (Int64)m_cNonlinearDepthModel.BackwardI(uiDepthValue, iScale); 166 else 167 iTempScale = (Int64)uiDepthValue * iScale; 168 #else 169 Int64 iTempScale = (Int64)uiDepthValue * iScale; 168 170 #endif 169 171 Int64 iTestScale = ( iTempScale + iOffset ); // for checking accuracy of camera parameters … … 233 235 { 234 236 #if POZNAN_NONLINEAR_DEPTH 235 m_fDepthPower = pcSlice->getSPS()->getDepthPower(); 237 m_bUseNonlinearDepth = pcSlice->getSPS()->getUseNonlinearDepth(); 238 m_cNonlinearDepthModel = pcSlice->getSPS()->getNonlinearDepthModel(); 236 239 #endif 237 240 return; … … 240 243 { 241 244 #if POZNAN_NONLINEAR_DEPTH 242 pcSlice->getSPS()->setDepthPower(m_fDepthPower); // OLGIERD: ToDo - QP-Tex should not use getDepthPower() from texture SPS. 245 pcSlice->getSPS()->setUseNonlinearDepth(m_bUseNonlinearDepth); 246 pcSlice->getSPS()->setNonlinearDepthModel(m_cNonlinearDepthModel); // OLGIERD: ToDo - QP-Tex should not use getDepthPower() from texture SPS. 243 247 #endif 244 248 } … … 684 688 685 689 #if DCM_SKIP_DECODING_FRAMES 690 #if FLEX_CODING_ORDER 691 Bool TDecTop::decode (Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS, Int& iSkipFrame, Int& iPOCLastDisplay, Bool& bNewPictureType) 692 #else 686 693 Bool TDecTop::decode (Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS, Int& iSkipFrame, Int& iPOCLastDisplay) 694 #endif 687 695 #else 688 696 Void TDecTop::decode (Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS ) … … 712 720 TComSPS cTempSPS; 713 721 m_cEntropyDecoder.decodeSPS( &cTempSPS ); 722 #if FLEX_CODING_ORDER 723 m_cNewSPS = cTempSPS; 724 #endif 714 725 715 726 if( (m_iViewIdx == cTempSPS.getViewId()) && ( m_bIsDepth == cTempSPS.isDepth() ) ) … … 724 735 if(!cTempSPS.isDepth() && cTempSPS.getViewId()) 725 736 { 726 Float fDepthPower = getDecTop()->getPicFromView( 0, pcPic->getPOC(), true )->getSPS()->getDepthPower();727 cTempSPS.set DepthPower(fDepthPower);737 cTempSPS.setUseNonlinearDepth(getDecTop()->getPicFromView( 0, pcPic->getPOC(), true )->getSPS()->getUseNonlinearDepth()); 738 cTempSPS.setNonlinearDepthModel(getDecTop()->getPicFromView( 0, pcPic->getPOC(), true )->getSPS()->getNonlinearDepthModel()); 728 739 } 729 740 #endif … … 802 813 { 803 814 m_uiPrevPOC = m_apcSlicePilot->getPOC(); 815 #if FLEX_CODING_ORDER 816 bNewPictureType = m_cNewSPS.isDepth(); 817 #endif 804 818 return true; 805 819 } … … 887 901 // Set reference list 888 902 std::vector<TComPic*> apcSpatRefPics = getDecTop()->getSpatialRefPics( pcPic->getViewIdx(), pcSlice->getPOC(), m_cSPS.isDepth() ); 889 TComPic * const pcTexturePic = m_cSPS.isDepth() ? getDecTop()->getPicFromView( pcPic->getViewIdx(), pcSlice->getPOC(), false ) : NULL; 903 TComPic * const pcTexturePic = ( m_cSPS.isDepth()) ? getDecTop()->getPicFromView( pcPic->getViewIdx(), pcSlice->getPOC(), false ) : NULL; 904 TComPic * const pcDepthPic = (!m_cSPS.isDepth()) ? getDecTop()->getPicFromView( pcPic->getViewIdx(), pcSlice->getPOC(), true ) : NULL; 905 #if FLEX_CODING_ORDER 906 if (pcTexturePic != NULL) 907 { 908 assert( ! m_cSPS.isDepth() || pcTexturePic != NULL ); 909 pcSlice->setTexturePic( pcTexturePic ); 910 } 911 if (pcDepthPic != NULL) 912 { 913 assert( m_cSPS.isDepth() || pcDepthPic != NULL ); 914 pcSlice->setDepthPic( pcDepthPic ); 915 } 916 #else 890 917 assert( ! m_cSPS.isDepth() || pcTexturePic != NULL ); 891 918 pcSlice->setTexturePic( pcTexturePic ); 919 pcSlice->setDepthPic( pcDepthPic ); 892 920 pcSlice->setViewIdx( pcPic->getViewIdx() ); 921 #endif 893 922 #if SONY_COLPIC_AVAILABILITY 894 923 pcSlice->setViewOrderIdx( pcPic->getViewOrderIdx() ); … … 949 978 //* 950 979 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 980 #if FLEX_CODING_ORDER 981 Bool bHaveReconDepth = (pcSlice->getDepthPic() != NULL) && (pcSlice->getDepthPic()->getReconMark()); 982 if(!getIsDepth() && pcSlice->getSPS()->getUseTexDqpAccordingToDepth() && !bHaveReconDepth ) 983 #else 951 984 if(!getIsDepth() && pcSlice->getSPS()->getUseTexDqpAccordingToDepth()) 985 #endif 952 986 { 953 987 getDecTop()->storeDepthSynthPicsInBuffer(pcSlice->getViewIdx(),pcSlice->getSPS()->getViewOrderIdx(),pcSlice->getPOC()); -
branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecTop.h
r28 r41 121 121 #endif 122 122 #if POZNAN_NONLINEAR_DEPTH 123 Float m_fDepthPower; 123 TComNonlinearDepthModel m_cNonlinearDepthModel; 124 Bool m_bUseNonlinearDepth; 124 125 #endif 125 126 … … 205 206 TComList<TComPic*> m_cListPic; // Dynamic buffer 206 207 TComSPS m_cSPS; 208 #if FLEX_CODING_ORDER 209 TComSPS m_cNewSPS; 210 #endif 207 211 TComPPS m_cPPS; 208 212 TComSlice* m_apcSlicePilot; … … 265 269 Void init( TAppDecTop* pcTAppDecTop, Bool bFirstInstance = true ); 266 270 #if DCM_SKIP_DECODING_FRAMES 271 #if FLEX_CODING_ORDER 272 Bool decode (Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS, Int& iSkipFrame, Int& iPOCLastDisplay, Bool& bNewPictureType); 273 #else 267 274 Bool decode (Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS, Int& iSkipFrame, Int& iPOCLastDisplay); 275 #endif 268 276 #else 269 277 Void decode ( Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS ); -
branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncCavlc.cpp
r28 r41 348 348 #endif 349 349 #if POZNAN_NONLINEAR_DEPTH 350 // Depth power coefficient 351 #if POZNAN_NONLINEAR_DEPTH_SEND_AS_BYTE 352 UInt uiCode = quantizeDepthPower(pcSPS->getDepthPower()); 353 xWriteCode(uiCode, 8); 354 #else 355 float fCode = pcSPS->getDepthPower(); 356 UInt uiCode = *((UInt*)&fCode); 357 //uiCode &= ~0x80000000; 358 xWriteCode(uiCode, sizeof(float)*8); // we do not send sign?; 359 #endif 350 if( pcSPS->getUseNonlinearDepth() ) 351 { 352 xWriteFlag( 1 ); //Nonlinear Depth Representation 353 // Nonlinear Depth Model coefficient 354 xWriteUvlc(pcSPS->getNonlinearDepthModel().m_iNum); 355 for (int i=1; i<=pcSPS->getNonlinearDepthModel().m_iNum; ++i) 356 xWriteUvlc(pcSPS->getNonlinearDepthModel().m_aiPoints[i]); 357 } 358 else 359 { 360 xWriteFlag( 0 ); // Don't use Nonlinear Depth Representation 361 } 360 362 #endif 361 363 } -
branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncCfg.h
r28 r41 159 159 Bool m_bUseDMM; 160 160 #endif 161 #if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER 162 Bool m_bUseDMM34; 163 #endif 161 164 #if HHI_MPI 162 165 Bool m_bUseMVI; … … 232 235 #endif 233 236 #if POZNAN_NONLINEAR_DEPTH 234 Float m_fDepthPower; 237 TComNonlinearDepthModel m_cNonlinearDepthModel; 238 Bool m_bUseNonlinearDepth; 235 239 #endif 236 240 … … 335 339 336 340 #if POZNAN_NONLINEAR_DEPTH 337 inline Float getDepthPower() { return m_fDepthPower; } 338 inline Void setDepthPower(Float p) { m_fDepthPower = p; } 339 #else 340 inline Float getDepthPower() { return 1.0f; } 341 inline TComNonlinearDepthModel& getNonlinearDepthModel() { return m_cNonlinearDepthModel; } 342 inline Void setNonlinearDepthModel( TComNonlinearDepthModel &rp ) { m_cNonlinearDepthModel = rp; } 343 344 Void setUseNonlinearDepth ( Bool bVal ) { m_bUseNonlinearDepth = bVal; } 345 bool getUseNonlinearDepth () { return m_bUseNonlinearDepth; } 341 346 #endif 342 347 … … 457 462 Bool getUseDMM() { return m_bUseDMM; } 458 463 #endif 459 464 #if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER 465 Void setUseDMM34( Bool b) { m_bUseDMM34 = b; } 466 Bool getUseDMM34() { return m_bUseDMM34; } 467 #endif 460 468 #if LM_CHROMA 461 469 Bool getUseLMChroma () { return m_bUseLMChroma; } -
branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncGOP.cpp
r28 r41 175 175 // GT FIX 176 176 std::vector<TComPic*> apcSpatRefPics = m_pcEncTop->getEncTop()->getSpatialRefPics( pcPic->getViewIdx(), pcSlice->getPOC(), m_pcEncTop->isDepthCoder() ); 177 TComPic * const pcTexturePic = m_pcEncTop->isDepthCoder() ? m_pcEncTop->getEncTop()->getPicFromView( pcPic->getViewIdx(), pcSlice->getPOC(), false ) : NULL; 177 TComPic * const pcTexturePic = ( m_pcEncTop->isDepthCoder()) ? m_pcEncTop->getEncTop()->getPicFromView( pcPic->getViewIdx(), pcSlice->getPOC(), false ) : NULL; 178 TComPic * const pcDepthPic = (!m_pcEncTop->isDepthCoder()) ? m_pcEncTop->getEncTop()->getPicFromView( pcPic->getViewIdx(), pcSlice->getPOC(), true ) : NULL; 178 179 assert( ! m_pcEncTop->isDepthCoder() || pcTexturePic != NULL ); 180 assert( m_pcEncTop->isDepthCoder() || pcDepthPic != NULL ); 179 181 pcSlice->setTexturePic( pcTexturePic ); 182 pcSlice->setDepthPic ( pcDepthPic ); 180 183 181 184 pcSlice->setRefPicListFromGOPSTring( rcListPic, apcSpatRefPics ); -
branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncSbac.cpp
r28 r41 1178 1178 #endif 1179 1179 #if HHI_DMM_PRED_TEX 1180 #if FLEX_CODING_ORDER 1181 if ( !pcCU->getSlice()->getSPS()->getUseDMM34() ) 1182 { 1183 assert( uiDir != DMM_WEDGE_PREDTEX_D_IDX ); 1184 assert( uiDir != DMM_CONTOUR_PREDTEX_D_IDX ); 1185 } 1186 #endif 1180 1187 if( uiDir == DMM_WEDGE_PREDTEX_D_IDX ) { xCodeWedgePredTexDeltaInfo ( pcCU, uiAbsPartIdx ); } 1181 1188 if( uiDir == DMM_CONTOUR_PREDTEX_D_IDX ) { xCodeContourPredTexDeltaInfo( pcCU, uiAbsPartIdx ); } -
branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncSearch.cpp
r28 r41 1934 1934 #endif 1935 1935 #if HHI_DMM_PRED_TEX 1936 #if FLEX_CODING_ORDER 1937 if ( pcCU->getSlice()->getSPS()->getUseDMM34() ) 1938 { 1939 #endif 1936 1940 TComYuv cTempYuv; cTempYuv.create( uiWidth, uiHeight ); cTempYuv.clear(); 1937 1941 Pel* piTempY = cTempYuv.getLumaAddr(); … … 1968 1972 1969 1973 cTempYuv.destroy(); 1974 #if FLEX_CODING_ORDER 1975 } 1976 #endif 1970 1977 #endif 1971 1978 } … … 1996 2003 #else 1997 2004 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 2005 #if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER 2006 if( m_pcEncCfg->isDepthCoder() && !predIntraLumaDMMAvailable( uiOrgMode, uiWidth, uiHeight, pcCU->getSlice()->getSPS()->getUseDMM34() ) ) 2007 #else 1998 2008 if( m_pcEncCfg->isDepthCoder() && !predIntraLumaDMMAvailable( uiOrgMode, uiWidth, uiHeight ) ) 2009 #endif 1999 2010 continue; 2000 2011 #endif … … 2084 2095 #else 2085 2096 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 2097 #if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER 2098 if( m_pcEncCfg->isDepthCoder() && !predIntraLumaDMMAvailable( uiOrgMode, uiWidth, uiHeight, pcCU->getSlice()->getSPS()->getUseDMM34() ) ) 2099 #else 2086 2100 if( m_pcEncCfg->isDepthCoder() && !predIntraLumaDMMAvailable( uiOrgMode, uiWidth, uiHeight ) ) 2101 #endif 2087 2102 continue; 2088 2103 #endif … … 2727 2742 } 2728 2743 2744 #if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER 2745 Bool TEncSearch::predIntraLumaDMMAvailable( UInt uiMode, UInt uiWidth, UInt uiHeight, Bool bDMMAvailable34 ) 2746 #else 2729 2747 Bool TEncSearch::predIntraLumaDMMAvailable( UInt uiMode, UInt uiWidth, UInt uiHeight ) 2748 #endif 2730 2749 { 2731 2750 if( uiMode <= MAX_MODE_ID_INTRA_DIR ) return true; … … 2755 2774 bDMMAvailable = false; 2756 2775 } 2776 #if FLEX_CODING_ORDER 2777 if ( !bDMMAvailable34 ) 2778 { 2779 bDMMAvailable = false; 2780 } 2781 #endif 2757 2782 } 2758 2783 -
branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncSearch.h
r28 r41 210 210 Bool predIntraLumaDMMAvailable( UInt uiMode, 211 211 UInt uiWidth, 212 #if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER 213 UInt uiHeight, 214 Bool bDMMAvailable34 ); 215 #else 212 216 UInt uiHeight ); 217 #endif 213 218 #endif 214 219 #if HHI_DMM_WEDGE_INTRA -
branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncTop.cpp
r28 r41 304 304 305 305 bool bSomethingCoded = false ; 306 306 #if FLEX_CODING_ORDER 307 if (TEncTop::m_bPicWaitingForCoding ) 308 #else 307 309 if (m_bPicWaitingForCoding ) 310 #endif 308 311 { 309 312 std::map<Int, TComPic*>::iterator cIter = m_acInputPicMap.find( (Int)m_cSeqIter.getPoc() ); … … 659 662 #endif 660 663 661 #if POZNAN_NONLINEAR_DEPTH 662 m_cSPS.setDepthPower ( m_fDepthPower ); 663 // OLGIERD: ToDo - QP-Tex should not use getDepthPower() from texture SPS. 664 #if POZNAN_NONLINEAR_DEPTH 665 m_cSPS.setNonlinearDepthModel ( m_cNonlinearDepthModel ); 666 m_cSPS.setUseNonlinearDepth ( m_bUseNonlinearDepth ); 667 // OLGIERD: ToDo - QP-Tex should not use getNonlinearDepthModel() from texture SPS. 664 668 #endif 665 669 -
branches/0.3-poznan-univ/source/Lib/TLibRenderer/TRenSingleModel.cpp
r28 r41 448 448 m_iLastOccludedSPosFP = xRangeLeftL( m_iLastOccludedSPos ); 449 449 xExtrapolateMarginL ( iCurSPos, iEndChangePos, iError ); 450 iMinChangedSPos = Min( iMinChangedSPos, (iEndChangePos << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrement LUT( Max(m_apiBaseDepthPelRow[m_iCurViewPos][iEndChangePos], m_piNewDepthData[iPosXinNewData] )) ]);450 iMinChangedSPos = Min( iMinChangedSPos, (iEndChangePos << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrement( Max(m_apiBaseDepthPelRow[m_iCurViewPos][iEndChangePos], m_piNewDepthData[iPosXinNewData] )) ]); 451 451 iLastSPos = iCurSPos; 452 452 m_iLastDepth = m_iCurDepth; … … 466 466 { 467 467 // Get minimal changed sample position 468 iMinChangedSPos = Min( iMinChangedSPos, (iCurPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrement LUT( Max(m_apiBaseDepthPelRow[m_iCurViewPos][iCurPosX], m_piNewDepthData[iPosXinNewData] )) ]);468 iMinChangedSPos = Min( iMinChangedSPos, (iCurPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrement( Max(m_apiBaseDepthPelRow[m_iCurViewPos][iCurPosX], m_piNewDepthData[iPosXinNewData] )) ]); 469 469 Int iCurSPos = xShiftNewData(iCurPosX,iPosXinNewData); 470 470 m_iCurDepth = m_piNewDepthData[iPosXinNewData]; … … 541 541 m_iLastOccludedSPosFP = xRangeRightR( m_iLastOccludedSPos ); 542 542 xExtrapolateMarginR ( iCurSPos, iStartChangePos, iError ); 543 iMaxChangedSPos = Max( iMaxChangedSPos, (iStartChangePos << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrement LUT( Max(m_apiBaseDepthPelRow[m_iCurViewPos][iStartChangePos], m_piNewDepthData[iPosXinNewData] )) ]);543 iMaxChangedSPos = Max( iMaxChangedSPos, (iStartChangePos << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrement( Max(m_apiBaseDepthPelRow[m_iCurViewPos][iStartChangePos], m_piNewDepthData[iPosXinNewData] )) ]); 544 544 iLastSPos = iCurSPos; 545 545 m_iLastDepth = m_iCurDepth; … … 559 559 { 560 560 // Get minimal changed sample position 561 iMaxChangedSPos = Max( iMaxChangedSPos, (iCurPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrement LUT( Max(m_apiBaseDepthPelRow[m_iCurViewPos][iCurPosX], m_piNewDepthData[iPosXinNewData] )) ]);561 iMaxChangedSPos = Max( iMaxChangedSPos, (iCurPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrement( Max(m_apiBaseDepthPelRow[m_iCurViewPos][iCurPosX], m_piNewDepthData[iPosXinNewData] )) ]); 562 562 Int iCurSPos = xShiftNewData(iCurPosX,iPosXinNewData); 563 563 m_iCurDepth = m_piNewDepthData[iPosXinNewData]; … … 948 948 AOF( iPosInNewData < m_iNewDataWidth ); 949 949 950 return (iPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrement LUT( m_piNewDepthData[iPosInNewData] )];950 return (iPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrement( m_piNewDepthData[iPosInNewData] )]; 951 951 } 952 952 … … 956 956 AOT( iPosX < 0); 957 957 AOF( iPosX < m_iWidth); 958 return (iPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrement LUT( m_apiBaseDepthPelRow[m_iCurViewPos][iPosX] )];958 return (iPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrement( m_apiBaseDepthPelRow[m_iCurViewPos][iPosX] )]; 959 959 } 960 960 … … 1149 1149 m_aapiSynthVideoPelRow [1][2][iTargetSPos] , 1150 1150 #endif 1151 m_piInvZLUTLeft [RemoveBitIncrement LUT(m_iThisDepth) ],1152 m_piInvZLUTRight[RemoveBitIncrement LUT(m_apiSynthDepthPelRow[1] [iTargetSPos])],1151 m_piInvZLUTLeft [RemoveBitIncrement(m_iThisDepth) ], 1152 m_piInvZLUTRight[RemoveBitIncrement(m_apiSynthDepthPelRow[1] [iTargetSPos])], 1153 1153 iFilled, 1154 1154 m_apiFilledRow [1] [iTargetSPos] , … … 1171 1171 m_aapiBaseVideoPelRow [1][2][iSourcePos ], 1172 1172 #endif 1173 m_piInvZLUTLeft [RemoveBitIncrement LUT(m_apiSynthDepthPelRow[0] [iTargetSPos])],1174 m_piInvZLUTRight[RemoveBitIncrement LUT(m_iThisDepth) ],1173 m_piInvZLUTLeft [RemoveBitIncrement(m_apiSynthDepthPelRow[0] [iTargetSPos])], 1174 m_piInvZLUTRight[RemoveBitIncrement(m_iThisDepth) ], 1175 1175 m_apiFilledRow [0] [iTargetSPos], 1176 1176 iFilled , -
branches/0.3-poznan-univ/source/Lib/TLibRenderer/TRenTop.cpp
r28 r41 498 498 499 499 // compute disparity and shift 500 iShiftedPos = ( iPosX << m_iRelShiftLUTPrec ) - m_aiShiftLUTCur[RemoveBitIncrement LUT( pcDepthData[iPosX])];500 iShiftedPos = ( iPosX << m_iRelShiftLUTPrec ) - m_aiShiftLUTCur[RemoveBitIncrement( pcDepthData[iPosX])]; 501 501 502 502 if (iPosX == 0) … … 652 652 653 653 // compute disparity and shift 654 assert( RemoveBitIncrement LUT(pcDepthData[iPosX]) >= 0 && RemoveBitIncrementLUT(pcDepthData[iPosX]) <= SizeOfLUT );655 dPrevShiftedPos = (Double) iPosX - m_adShiftLUTCur[ RemoveBitIncrement LUT(pcDepthData[iPosX])];654 assert( RemoveBitIncrement(pcDepthData[iPosX]) >= 0 && RemoveBitIncrement(pcDepthData[iPosX]) <= SizeOfLUT ); 655 dPrevShiftedPos = (Double) iPosX - m_adShiftLUTCur[ RemoveBitIncrement(pcDepthData[iPosX])]; 656 656 657 657 if (iPosX == 0) … … 833 833 for(Int iPosX = 0; iPosX < iWidth; iPosX++) 834 834 { 835 assert( RemoveBitIncrement LUT(pcDepthData[iPosX]) >= 0 && RemoveBitIncrementLUT(pcDepthData[iPosX]) <= SizeOfLUT );836 Int iShiftedPos = iPosX - m_aiShiftLUTCur[ RemoveBitIncrement LUT(pcDepthData[iPosX])] ;835 assert( RemoveBitIncrement(pcDepthData[iPosX]) >= 0 && RemoveBitIncrement(pcDepthData[iPosX]) <= SizeOfLUT ); 836 Int iShiftedPos = iPosX - m_aiShiftLUTCur[ RemoveBitIncrement(pcDepthData[iPosX])] ; 837 837 if (iShiftedPos < iWidth && iShiftedPos >= 0) 838 838 { … … 908 908 for(Int iPosX = 0; iPosX < iOutputWidth; iPosX ++) 909 909 { 910 Int iBackShiftedPos = (iPosX << m_iRelShiftLUTPrec) - m_aiShiftLUTCur[ RemoveBitIncrement LUT( pcDepthData[iPosX] )];910 Int iBackShiftedPos = (iPosX << m_iRelShiftLUTPrec) - m_aiShiftLUTCur[ RemoveBitIncrement( pcDepthData[iPosX] )]; 911 911 if( ( pcFilledData[iPosX] == REN_IS_FILLED ) && (iBackShiftedPos >= 0 ) && ( iBackShiftedPos < iInputWidth ) ) 912 912 { … … 981 981 { 982 982 // compute disparity and shift 983 iShiftedPos = iPosX - m_aiShiftLUTCur[RemoveBitIncrement LUT(pcDepthData[iPosX])];983 iShiftedPos = iPosX - m_aiShiftLUTCur[RemoveBitIncrement(pcDepthData[iPosX])]; 984 984 985 985 if ( iPosX == 0 ) … … 1866 1866 if ( (pcFilledRightData[uiXPos] != REN_IS_HOLE ) && ( pcFilledLeftData[uiXPos] != REN_IS_HOLE) ) 1867 1867 { 1868 Int iDepthDifference = m_piInvZLUTLeft[RemoveBitIncrement LUT(pcLeftDepthData[uiXPos])] - m_piInvZLUTRight[RemoveBitIncrementLUT(pcRightDepthData[uiXPos])];1868 Int iDepthDifference = m_piInvZLUTLeft[RemoveBitIncrement(pcLeftDepthData[uiXPos])] - m_piInvZLUTRight[RemoveBitIncrement(pcRightDepthData[uiXPos])]; 1869 1869 1870 1870 if ( abs ( iDepthDifference ) <= m_iBlendZThres ) … … 1895 1895 else if ( (pcFilledRightData[uiXPos] == REN_IS_HOLE) && (pcFilledLeftData[uiXPos] == REN_IS_HOLE)) 1896 1896 { 1897 pcOutputData[uiXPos] = m_piInvZLUTLeft[RemoveBitIncrement LUT( pcLeftDepthData[uiXPos])] < m_piInvZLUTRight[RemoveBitIncrementLUT(pcRightDepthData[uiXPos])] ? pcLeftVideoData[uiXPos] : pcRightVideoData[uiXPos];1897 pcOutputData[uiXPos] = m_piInvZLUTLeft[RemoveBitIncrement( pcLeftDepthData[uiXPos])] < m_piInvZLUTRight[RemoveBitIncrement(pcRightDepthData[uiXPos])] ? pcLeftVideoData[uiXPos] : pcRightVideoData[uiXPos]; 1898 1898 } 1899 1899 else
Note: See TracChangeset for help on using the changeset viewer.