Changeset 28 in 3DVCSoftware for branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecTop.cpp
- Timestamp:
- 24 Feb 2012, 20:22:58 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecTop.cpp
r21 r28 53 53 m_aaiCodedScale [ uiId ] = new Int [ MAX_NUMBER_VIEWS ]; 54 54 } 55 #if POZNAN_SYNTH || (POZNAN_MP && !POZNAN_MP_USE_DEPTH_MAP_GENERATION) 56 xCreateLUTs ( (UInt)MAX_NUMBER_VIEWS, (UInt)MAX_NUMBER_VIEWS, m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT); 57 58 m_iLog2Precision = LOG2_DISP_PREC_LUT; 59 m_uiBitDepthForLUT = 8; //fixed 60 #endif 55 61 } 56 62 … … 66 72 delete [] m_aiViewOrderIndex; 67 73 delete [] m_aiViewReceived; 74 75 #if POZNAN_SYNTH || (POZNAN_MP && !POZNAN_MP_USE_DEPTH_MAP_GENERATION) 76 xDeleteArray( m_adBaseViewShiftLUT, MAX_NUMBER_VIEWS, MAX_NUMBER_VIEWS, 2 ); 77 xDeleteArray( m_aiBaseViewShiftLUT, MAX_NUMBER_VIEWS, MAX_NUMBER_VIEWS, 2 ); 78 #endif 68 79 } 69 80 … … 78 89 m_iLastPOC = -1; 79 90 m_uiMaxViewId = 0; 80 } 91 #if POZNAN_NONLINEAR_DEPTH 92 m_fDepthPower = 1.0; 93 #endif 94 } 95 96 #if POZNAN_SYNTH || (POZNAN_MP && !POZNAN_MP_USE_DEPTH_MAP_GENERATION) 97 Void 98 CamParsCollector::xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT) 99 { 100 //AOF( m_uiBitDepthForLUT == 8 ); 101 //AOF(radLUT == NULL && raiLUT == NULL ); 102 103 uiNumberSourceViews = Max( 1, uiNumberSourceViews ); 104 uiNumberTargetViews = Max( 1, uiNumberTargetViews ); 105 106 radLUT = new Double***[ uiNumberSourceViews ]; 107 raiLUT = new Int ***[ uiNumberSourceViews ]; 108 109 for( UInt uiSourceView = 0; uiSourceView < uiNumberSourceViews; uiSourceView++ ) 110 { 111 radLUT [ uiSourceView ] = new Double**[ uiNumberTargetViews ]; 112 raiLUT [ uiSourceView ] = new Int **[ uiNumberTargetViews ]; 113 114 for( UInt uiTargetView = 0; uiTargetView < uiNumberTargetViews; uiTargetView++ ) 115 { 116 radLUT [ uiSourceView ][ uiTargetView ] = new Double*[ 2 ]; 117 radLUT [ uiSourceView ][ uiTargetView ][ 0 ] = new Double [ 257 ]; 118 radLUT [ uiSourceView ][ uiTargetView ][ 1 ] = new Double [ 257 ]; 119 120 raiLUT [ uiSourceView ][ uiTargetView ] = new Int* [ 2 ]; 121 raiLUT [ uiSourceView ][ uiTargetView ][ 0 ] = new Int [ 257 ]; 122 raiLUT [ uiSourceView ][ uiTargetView ][ 1 ] = new Int [ 257 ]; 123 } 124 } 125 } 126 127 Void 128 CamParsCollector::xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Double****& radLUT, Int****& raiLUT) 129 { 130 Int iLog2DivLuma = m_uiBitDepthForLUT + m_uiCamParsCodedPrecision + 1 - m_iLog2Precision; AOF( iLog2DivLuma > 0 ); 131 Int iLog2DivChroma = iLog2DivLuma + 1; 132 133 iOffset <<= m_uiBitDepthForLUT; 134 135 Double dScale = (Double) iScale / (( Double ) ( 1 << iLog2DivLuma )); 136 Double dOffset = (Double) iOffset / (( Double ) ( 1 << iLog2DivLuma )); 137 138 // offsets including rounding offsets 139 Int64 iOffsetLuma = iOffset + ( ( 1 << iLog2DivLuma ) >> 1 ); 140 Int64 iOffsetChroma = iOffset + ( ( 1 << iLog2DivChroma ) >> 1 ); 141 142 #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 ); 160 Double dShiftChroma = dShiftLuma / 2; 161 radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = dShiftLuma; 162 radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = dShiftChroma; 163 164 // integer-valued look-up tables 165 Int64 iTempScale = iDepthValue * iScale; 166 #if POZNAN_LUT_INCREASED_PRECISION 167 iTempScale >>= g_uiBitIncrement; 168 #endif 169 Int64 iTestScale = ( iTempScale + iOffset ); // for checking accuracy of camera parameters 170 Int64 iShiftLuma = ( iTempScale + iOffsetLuma ) >> iLog2DivLuma; 171 Int64 iShiftChroma = ( iTempScale + iOffsetChroma ) >> iLog2DivChroma; 172 raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = (Int)iShiftLuma; 173 raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = (Int)iShiftChroma; 174 175 // maximum deviation 176 //dMaxDispDev = Max( dMaxDispDev, fabs( Double( (Int) iTestScale ) - dShiftLuma * Double( 1 << iLog2DivLuma ) ) / Double( 1 << iLog2DivLuma ) ); 177 //dMaxRndDispDvL = Max( dMaxRndDispDvL, fabs( Double( (Int) iShiftLuma ) - dShiftLuma ) ); 178 //dMaxRndDispDvC = Max( dMaxRndDispDvC, fabs( Double( (Int) iShiftChroma ) - dShiftChroma ) ); 179 } 180 181 radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ]; 182 radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ]; 183 raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ]; 184 raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ]; 185 } 186 187 Bool 188 CamParsCollector::getNearestBaseView( Int iSynthViewIdx, Int &riNearestViewIdx, Int &riRelDistToLeft, Bool& rbRenderFromLeft) 189 { 190 /* 191 riNearestViewIdx = 0; 192 193 Bool bDecencdingVN = ( m_aiSortedBaseViews.size() >= 2 && m_aiSortedBaseViews[ 0 ] > m_aiSortedBaseViews[ 1 ] ); 194 Int iFactor = ( bDecencdingVN ? -1 : 1 ); 195 196 if( ( m_aiBaseId2SortedId[iSynthViewIdx] - m_aiBaseId2SortedId[riNearestViewIdx] ) * iFactor <= 0 ) 197 { 198 rbRenderFromLeft = true; 199 } 200 else 201 { 202 rbRenderFromLeft = false; 203 } 204 205 riRelDistToLeft = 128; //Not used for now; 206 //*/ 207 return true; 208 } 209 210 #endif 81 211 82 212 Void … … 102 232 if ( pcSlice->getSPS()->isDepth () ) 103 233 { 234 #if POZNAN_NONLINEAR_DEPTH 235 m_fDepthPower = pcSlice->getSPS()->getDepthPower(); 236 #endif 104 237 return; 238 } 239 else 240 { 241 #if POZNAN_NONLINEAR_DEPTH 242 pcSlice->getSPS()->setDepthPower(m_fDepthPower); // OLGIERD: ToDo - QP-Tex should not use getDepthPower() from texture SPS. 243 #endif 105 244 } 106 245 Bool bFirstAU = ( pcSlice->getPOC() == 0 ); … … 161 300 m_aaiCodedScale [ uiViewId ][ uiBaseId ] = pcSlice->getInvCodedScale () [ uiBaseId ]; 162 301 m_aaiCodedOffset[ uiViewId ][ uiBaseId ] = pcSlice->getInvCodedOffset() [ uiBaseId ]; 302 #if POZNAN_SYNTH || (POZNAN_MP && !POZNAN_MP_USE_DEPTH_MAP_GENERATION) 303 xInitLUTs(uiBaseId,uiViewId,m_aaiCodedScale [ uiBaseId ][ uiViewId ],m_aaiCodedOffset[ uiBaseId ][ uiViewId ],m_adBaseViewShiftLUT,m_aiBaseViewShiftLUT); 304 xInitLUTs(uiViewId,uiBaseId,m_aaiCodedScale [ uiViewId ][ uiBaseId ],m_aaiCodedOffset[ uiViewId ][ uiBaseId ],m_adBaseViewShiftLUT,m_aiBaseViewShiftLUT); 305 #endif 163 306 } 164 307 else … … 168 311 m_aaiCodedScale [ uiViewId ][ uiBaseId ] = pcSlice->getSPS()->getInvCodedScale () [ uiBaseId ]; 169 312 m_aaiCodedOffset[ uiViewId ][ uiBaseId ] = pcSlice->getSPS()->getInvCodedOffset() [ uiBaseId ]; 313 #if POZNAN_SYNTH || (POZNAN_MP && !POZNAN_MP_USE_DEPTH_MAP_GENERATION) 314 xInitLUTs(uiBaseId,uiViewId,m_aaiCodedScale [ uiBaseId ][ uiViewId ],m_aaiCodedOffset[ uiBaseId ][ uiViewId ],m_adBaseViewShiftLUT,m_aiBaseViewShiftLUT); 315 xInitLUTs(uiViewId,uiBaseId,m_aaiCodedScale [ uiViewId ][ uiBaseId ],m_aaiCodedOffset[ uiViewId ][ uiBaseId ],m_adBaseViewShiftLUT,m_aiBaseViewShiftLUT); 316 #endif 170 317 } 171 318 } … … 182 329 m_aaiCodedScale [ uiViewId ][ uiBaseId ] = pcSlice->getInvCodedScale () [ uiBaseId ]; 183 330 m_aaiCodedOffset[ uiViewId ][ uiBaseId ] = pcSlice->getInvCodedOffset() [ uiBaseId ]; 331 #if POZNAN_SYNTH || (POZNAN_MP && !POZNAN_MP_USE_DEPTH_MAP_GENERATION) 332 xInitLUTs(uiBaseId,uiViewId,m_aaiCodedScale [ uiBaseId ][ uiViewId ],m_aaiCodedOffset[ uiBaseId ][ uiViewId ],m_adBaseViewShiftLUT,m_aiBaseViewShiftLUT); 333 xInitLUTs(uiViewId,uiBaseId,m_aaiCodedScale [ uiViewId ][ uiBaseId ],m_aaiCodedOffset[ uiViewId ][ uiBaseId ],m_adBaseViewShiftLUT,m_aiBaseViewShiftLUT); 334 #endif 184 335 } 185 336 } … … 269 420 m_bFirstSliceInSequence = true; 270 421 m_pcCamParsCollector = 0; 422 #if POZNAN_MP 423 m_pcMP = NULL; 424 #endif 271 425 } 272 426 … … 299 453 #if HHI_INTER_VIEW_RESIDUAL_PRED 300 454 m_cResidualGenerator.destroy(); 455 #endif 456 457 #if POZNAN_MP 458 m_pcMP = NULL; 301 459 #endif 302 460 } … … 336 494 m_cResidualGenerator.init( &m_cTrQuant, &m_cDepthMapGenerator ); 337 495 #endif 496 497 #if POZNAN_MP 498 m_pcMP = pcTAppDecTop->getMP(); 499 #endif 338 500 } 339 501 … … 462 624 #if HHI_INTERVIEW_SKIP 463 625 pcPic->removeUsedPelsMapBuffer(); 626 #endif 627 #if POZNAN_AVAIL_MAP 628 pcPic->removeAvailabilityBuffer(); 629 #endif 630 #if POZNAN_SYNTH_VIEW 631 pcPic->removeSynthesisBuffer(); 632 #endif 633 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 634 pcPic->removeSynthesisDepthBuffer(); 464 635 #endif 465 636 } … … 549 720 else 550 721 { 722 #if POZNAN_NONLINEAR_DEPTH 723 // For texture complete depth power information. Depth power is sended, for example, for base view depth map and it should be available prior non-base texture decoding 724 if(!cTempSPS.isDepth() && cTempSPS.getViewId()) 725 { 726 Float fDepthPower = getDecTop()->getPicFromView( 0, pcPic->getPOC(), true )->getSPS()->getDepthPower(); 727 cTempSPS.setDepthPower(fDepthPower); 728 } 729 #endif 551 730 cComSPS = cTempSPS; 552 731 return false; … … 563 742 } 564 743 m_uiValidPS |= 1; 744 745 #if POZNAN_MP 746 #if POZNAN_MP_USE_DEPTH_MAP_GENERATION 747 m_pcMP->init( m_cSPS.getHeight(), m_cSPS.getWidth() ); 748 #else 749 m_pcMP->init( m_cSPS.getHeight(), m_cSPS.getWidth(), m_pcCamParsCollector->getBaseViewShiftLUTI()); 750 #endif 751 #endif 565 752 566 753 return false; … … 686 873 m_apcSlicePilot = pcPic->getPicSym()->getSlice(m_uiSliceIdx); 687 874 pcPic->getPicSym()->setSlice(pcSlice, m_uiSliceIdx); 875 876 #if POZNAN_MP 877 pcSlice->setMP(m_pcMP); 878 #endif 688 879 689 880 if (bNextSlice) … … 744 935 #endif 745 936 937 #if POZNAN_SYNTH 938 if( m_pcCamParsCollector) 939 { 940 m_pcCamParsCollector->setSlice( pcSlice ); 941 } 942 //if(!getIsDepth()) 943 if(pcSlice->getSPS()->getUseCUSkip()) 944 { 945 getDecTop()->storeSynthPicsInBuffer(pcSlice->getViewIdx(),pcSlice->getSPS()->getViewOrderIdx(),pcSlice->getPOC(),getIsDepth()); 946 } 947 #endif 948 949 //* 950 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 951 if(!getIsDepth() && pcSlice->getSPS()->getUseTexDqpAccordingToDepth()) 952 { 953 getDecTop()->storeDepthSynthPicsInBuffer(pcSlice->getViewIdx(),pcSlice->getSPS()->getViewOrderIdx(),pcSlice->getPOC()); 954 } 955 #endif 956 //*/ 957 958 #if POZNAN_MP 959 std::vector<TComPic*> apcSpatDataRefPics = getDecTop()->getSpatialRefPics( pcPic->getViewIdx(), pcSlice->getPOC(), m_cSPS.isDepth() ); 960 pcSlice->getMP()->setRefPicsList(&apcSpatDataRefPics); 961 #if !POZNAN_MP_USE_DEPTH_MAP_GENERATION 962 std::vector<TComPic*> apcSpatDepthRefPics = getDecTop()->getSpatialRefPics( pcPic->getViewIdx(), pcSlice->getPOC(), true ); 963 pcSlice->getMP()->setDepthRefPicsList(&apcSpatDepthRefPics); 964 #endif 965 #endif 966 746 967 // Decode a picture 747 968 m_cGopDecoder.decompressGop ( bEos, pcBitstream, pcPic, false ); 969 970 #if POZNAN_MP 971 //pcSlice->getMP()->disable(); 972 #endif 748 973 749 974 if( m_pcCamParsCollector )
Note: See TracChangeset for help on using the changeset viewer.