Changeset 296 in 3DVCSoftware for trunk/source/Lib/TLibDecoder/TDecTop.cpp
- Timestamp:
- 20 Feb 2013, 22:07:43 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibDecoder/TDecTop.cpp
r210 r296 59 59 m_aaiCodedScale [ uiId ] = new Int [ MAX_VIEW_NUM ]; 60 60 } 61 62 #if MERL_VSP_C0152 63 xCreateLUTs( (UInt)MAX_VIEW_NUM, (UInt)MAX_VIEW_NUM, m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); 64 m_iLog2Precision = LOG2_DISP_PREC_LUT; 65 m_uiBitDepthForLUT = 8; // fixed 66 #endif 61 67 } 62 68 … … 72 78 delete [] m_aiViewOrderIndex; 73 79 delete [] m_aiViewReceived; 80 81 #if MERL_VSP_C0152 82 xDeleteArray( m_adBaseViewShiftLUT, MAX_VIEW_NUM, MAX_VIEW_NUM, 2 ); 83 xDeleteArray( m_aiBaseViewShiftLUT, MAX_VIEW_NUM, MAX_VIEW_NUM, 2 ); 84 #endif 74 85 } 75 86 … … 85 96 m_uiMaxViewId = 0; 86 97 } 98 99 #if MERL_VSP_C0152 100 Void 101 CamParsCollector::xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT) 102 { 103 //AOF( m_uiBitDepthForLUT == 8 ); 104 //AOF(radLUT == NULL && raiLUT == NULL ); 105 106 uiNumberSourceViews = Max( 1, uiNumberSourceViews ); 107 uiNumberTargetViews = Max( 1, uiNumberTargetViews ); 108 109 radLUT = new Double***[ uiNumberSourceViews ]; 110 raiLUT = new Int ***[ uiNumberSourceViews ]; 111 112 for( UInt uiSourceView = 0; uiSourceView < uiNumberSourceViews; uiSourceView++ ) 113 { 114 radLUT [ uiSourceView ] = new Double**[ uiNumberTargetViews ]; 115 raiLUT [ uiSourceView ] = new Int **[ uiNumberTargetViews ]; 116 117 for( UInt uiTargetView = 0; uiTargetView < uiNumberTargetViews; uiTargetView++ ) 118 { 119 radLUT [ uiSourceView ][ uiTargetView ] = new Double*[ 2 ]; 120 radLUT [ uiSourceView ][ uiTargetView ][ 0 ] = new Double [ 257 ]; 121 radLUT [ uiSourceView ][ uiTargetView ][ 1 ] = new Double [ 257 ]; 122 123 raiLUT [ uiSourceView ][ uiTargetView ] = new Int* [ 2 ]; 124 raiLUT [ uiSourceView ][ uiTargetView ][ 0 ] = new Int [ 257 ]; 125 raiLUT [ uiSourceView ][ uiTargetView ][ 1 ] = new Int [ 257 ]; 126 } 127 } 128 } 129 130 Void 131 CamParsCollector::xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Double****& radLUT, Int****& raiLUT) 132 { 133 Int iLog2DivLuma = m_uiBitDepthForLUT + m_uiCamParsCodedPrecision + 1 - m_iLog2Precision; AOF( iLog2DivLuma > 0 ); 134 Int iLog2DivChroma = iLog2DivLuma + 1; 135 136 iOffset <<= m_uiBitDepthForLUT; 137 138 Double dScale = (Double) iScale / (( Double ) ( 1 << iLog2DivLuma )); 139 Double dOffset = (Double) iOffset / (( Double ) ( 1 << iLog2DivLuma )); 140 141 // offsets including rounding offsets 142 Int64 iOffsetLuma = iOffset + ( ( 1 << iLog2DivLuma ) >> 1 ); 143 Int64 iOffsetChroma = iOffset + ( ( 1 << iLog2DivChroma ) >> 1 ); 144 145 146 for( UInt uiDepthValue = 0; uiDepthValue < 256; uiDepthValue++ ) 147 { 148 149 // real-valued look-up tables 150 Double dShiftLuma = ( (Double)uiDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision ); 151 Double dShiftChroma = dShiftLuma / 2; 152 radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = dShiftLuma; 153 radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = dShiftChroma; 154 155 // integer-valued look-up tables 156 Int64 iTempScale = (Int64)uiDepthValue * iScale; 157 Int64 iShiftLuma = ( iTempScale + iOffsetLuma ) >> iLog2DivLuma; 158 Int64 iShiftChroma = ( iTempScale + iOffsetChroma ) >> iLog2DivChroma; 159 raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = (Int)iShiftLuma; 160 raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = (Int)iShiftChroma; 161 162 // maximum deviation 163 //dMaxDispDev = Max( dMaxDispDev, fabs( Double( (Int) iTestScale ) - dShiftLuma * Double( 1 << iLog2DivLuma ) ) / Double( 1 << iLog2DivLuma ) ); 164 //dMaxRndDispDvL = Max( dMaxRndDispDvL, fabs( Double( (Int) iShiftLuma ) - dShiftLuma ) ); 165 //dMaxRndDispDvC = Max( dMaxRndDispDvC, fabs( Double( (Int) iShiftChroma ) - dShiftChroma ) ); 166 } 167 168 radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ]; 169 radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ]; 170 raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ]; 171 raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ]; 172 } 173 #endif // end MERL_VSP_C0152 87 174 88 175 Void … … 167 254 m_aaiCodedScale [ uiViewId ][ uiBaseId ] = pcSlice->getInvCodedScale () [ uiBaseId ]; 168 255 m_aaiCodedOffset[ uiViewId ][ uiBaseId ] = pcSlice->getInvCodedOffset() [ uiBaseId ]; 256 #if MERL_VSP_C0152 257 xInitLUTs( uiBaseId, uiViewId, m_aaiCodedScale[ uiBaseId ][ uiViewId ], m_aaiCodedOffset[ uiBaseId ][ uiViewId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT); 258 xInitLUTs( uiViewId, uiBaseId, m_aaiCodedScale[ uiViewId ][ uiBaseId ], m_aaiCodedOffset[ uiViewId ][ uiBaseId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT); 259 #endif 169 260 } 170 261 else … … 174 265 m_aaiCodedScale [ uiViewId ][ uiBaseId ] = pcSlice->getSPS()->getInvCodedScale () [ uiBaseId ]; 175 266 m_aaiCodedOffset[ uiViewId ][ uiBaseId ] = pcSlice->getSPS()->getInvCodedOffset() [ uiBaseId ]; 267 #if MERL_VSP_C0152 268 xInitLUTs( uiBaseId, uiViewId, m_aaiCodedScale[ uiBaseId ][ uiViewId ], m_aaiCodedOffset[ uiBaseId ][ uiViewId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); 269 xInitLUTs( uiViewId, uiBaseId, m_aaiCodedScale[ uiViewId ][ uiBaseId ], m_aaiCodedOffset[ uiViewId ][ uiBaseId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); 270 #endif 176 271 } 177 272 } … … 188 283 m_aaiCodedScale [ uiViewId ][ uiBaseId ] = pcSlice->getInvCodedScale () [ uiBaseId ]; 189 284 m_aaiCodedOffset[ uiViewId ][ uiBaseId ] = pcSlice->getInvCodedOffset() [ uiBaseId ]; 285 #if MERL_VSP_C0152 286 xInitLUTs( uiBaseId, uiViewId, m_aaiCodedScale[ uiBaseId ][ uiViewId ], m_aaiCodedOffset[ uiBaseId ][ uiViewId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); 287 xInitLUTs( uiViewId, uiBaseId, m_aaiCodedScale[ uiViewId ][ uiBaseId ], m_aaiCodedOffset[ uiViewId ][ uiBaseId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); 288 #endif 190 289 } 191 290 } … … 254 353 m_iMaxRefPicNum = 0; 255 354 m_uiValidPS = 0; 256 #if SONY_COLPIC_AVAILABILITY257 m_iViewOrderIdx = 0;258 #endif259 355 #if ENC_DEC_TRACE 260 g_hTrace = fopen( "TraceDec.txt", "wb" );356 if(!g_hTrace) g_hTrace = fopen( "TraceDec.txt", "wb" ); 261 357 g_bJustDoIt = g_bEncDecTraceDisable; 262 358 g_nSymbolCounter = 0; … … 277 373 { 278 374 #if ENC_DEC_TRACE 279 fclose( g_hTrace ); 375 if(g_hTrace) fclose( g_hTrace ); 376 g_hTrace=NULL; 280 377 #endif 281 378 } … … 301 398 m_cDepthMapGenerator.destroy(); 302 399 #endif 303 #if H HI_INTER_VIEW_RESIDUAL_PRED400 #if H3D_IVRP 304 401 m_cResidualGenerator.destroy(); 305 402 #endif 403 306 404 } 307 405 … … 317 415 , &m_cDepthMapGenerator 318 416 #endif 319 #if H HI_INTER_VIEW_RESIDUAL_PRED417 #if H3D_IVRP 320 418 , &m_cResidualGenerator 321 419 #endif … … 331 429 #endif 332 430 #endif 333 #if H HI_INTER_VIEW_RESIDUAL_PRED431 #if H3D_IVRP 334 432 m_cResidualGenerator.init( &m_cTrQuant, &m_cDepthMapGenerator ); 335 433 #endif … … 367 465 } 368 466 369 #if H HI_INTER_VIEW_RESIDUAL_PRED467 #if H3D_IVRP 370 468 Void 371 469 TDecTop::deleteExtraPicBuffers( Int iPoc ) … … 427 525 xUpdateGopSize(pcSlice); 428 526 429 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER430 527 m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer())+pcSlice->getSPS()->getNumReorderPics(pcSlice->getTLayer()) + 1; // +1 to have space for the picture currently being decoded 431 #else432 m_iMaxRefPicNum = pcSlice->getSPS()->getMaxNumberOfReferencePictures()+pcSlice->getSPS()->getNumReorderFrames() + 1; // +1 to have space for the picture currently being decoded433 #endif434 528 435 529 #if DEPTH_MAP_GENERATION … … 618 712 } 619 713 620 #if !LCU_SYNTAX_ALF621 // create ALF temporary buffer622 m_cAdaptiveLoopFilter.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );623 #endif624 714 m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); 625 715 m_cLoopFilter. create( g_uiMaxCUDepth ); 626 716 } 627 717 628 #if SKIPFRAME_BUGFIX629 718 Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay ) 630 #else631 Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int iSkipFrame, Int iPOCLastDisplay )632 #endif633 719 { 634 720 TComPic*& pcPic = m_pcPic; … … 687 773 } 688 774 689 #if SONY_COLPIC_AVAILABILITY690 m_apcSlicePilot->setViewOrderIdx( m_apcSlicePilot->getSPS()->getViewOrderIdx());691 #endif692 693 #if NAL_REF_FLAG694 775 m_apcSlicePilot->setReferenced(nalu.m_nalRefFlag); 776 m_apcSlicePilot->setTLayerInfo(nalu.m_temporalId); 777 778 // ALF CU parameters should be part of the slice header -> needs to be fixed 779 #if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137 780 m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder, m_cGopDecoder.getAlfCuCtrlParam(), m_cGopDecoder.getAlfParamSet(),m_apcSlicePilot->getVPS()->getDepthFlag(nalu.m_layerId)); 695 781 #else 696 m_apcSlicePilot->setReferenced(nalu.m_nalRefIDC != NAL_REF_IDC_PRIORITY_LOWEST);697 #endif698 m_apcSlicePilot->setTLayerInfo(nalu.m_temporalId);699 700 // ALF CU parameters should be part of the slice header -> needs to be fixed701 #if LCU_SYNTAX_ALF702 782 m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder, m_cGopDecoder.getAlfCuCtrlParam(), m_cGopDecoder.getAlfParamSet()); 703 #else704 m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder, m_cGopDecoder.getAlfCuCtrlParam() );705 783 #endif 706 784 // byte align … … 718 796 if (m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence) 719 797 { 720 #if START_DECODING_AT_CRA721 798 if (m_prevPOC >= m_pocRandomAccess) 722 799 { … … 725 802 } 726 803 m_prevPOC = m_apcSlicePilot->getPOC(); 727 #else728 m_prevPOC = m_apcSlicePilot->getPOC();729 return true;730 #endif731 804 } 732 805 // actual decoding starts here … … 748 821 } 749 822 //detect lost reference picture and insert copy of earlier frame. 750 #if START_DECODING_AT_CRA751 823 while(m_apcSlicePilot->checkThatAllRefPicsAreAvailable(m_cListPic, m_apcSlicePilot->getRPS(), true, m_pocRandomAccess) > 0) 752 #else753 while(m_apcSlicePilot->checkThatAllRefPicsAreAvailable(m_cListPic, m_apcSlicePilot->getRPS(), true) > 0)754 #endif755 824 { 756 825 xCreateLostPicture(m_apcSlicePilot->checkThatAllRefPicsAreAvailable(m_cListPic, m_apcSlicePilot->getRPS(), false)-1); … … 764 833 xGetNewPicBuffer (m_apcSlicePilot, pcPic); 765 834 766 #if SONY_COLPIC_AVAILABILITY 767 pcPic->setViewOrderIdx( m_apcSlicePilot->getSPS()->getViewOrderIdx() ); 768 #endif 769 835 #if INTER_VIEW_VECTOR_SCALING_C0115 836 pcPic->setViewOrderIdx( m_apcSlicePilot->getVPS()->getViewOrderIdx(nalu.m_layerId) ); // will be changed to view_id 837 #endif 770 838 /* transfer any SEI messages that have been received to the picture */ 771 839 pcPic->setSEIs(m_SEIs); … … 787 855 } 788 856 #endif 789 #if H HI_INTER_VIEW_RESIDUAL_PRED857 #if H3D_IVRP 790 858 m_cResidualGenerator.create( true, m_apcSlicePilot->getSPS()->getPicWidthInLumaSamples(), m_apcSlicePilot->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUDepth, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiBitDepth + g_uiBitIncrement ); 791 859 #endif … … 800 868 UInt i, j, p; 801 869 802 #if !REMOVE_TILE_DEPENDENCE803 //set the TileBoundaryIndependenceIdr804 if(pcSlice->getPPS()->getTileBehaviorControlPresentFlag() == 1)805 {806 pcPic->getPicSym()->setTileBoundaryIndependenceIdr( pcSlice->getPPS()->getTileBoundaryIndependenceIdr() );807 }808 else809 {810 pcPic->getPicSym()->setTileBoundaryIndependenceIdr( pcSlice->getPPS()->getSPS()->getTileBoundaryIndependenceIdr() );811 }812 #endif813 870 814 871 if( pcSlice->getPPS()->getColumnRowInfoPresent() == 1 ) … … 992 1049 #endif 993 1050 994 #if SONY_COLPIC_AVAILABILITY1051 #if INTER_VIEW_VECTOR_SCALING_C0115 995 1052 #if VIDYO_VPS_INTEGRATION 996 pcSlice->setViewOrderIdx( pcSlice->getVPS()->getViewOrderIdx(nalu.m_layerId) ); 1053 pcSlice->setViewOrderIdx( pcSlice->getVPS()->getViewOrderIdx(nalu.m_layerId) ); // will be changed to view_id 997 1054 #else 998 1055 pcSlice->setViewOrderIdx( pcPic->getViewOrderIdx() ); 999 1056 #endif 1057 #endif 1058 1059 #if INTER_VIEW_VECTOR_SCALING_C0115 1060 pcSlice->setIVScalingFlag( pcSlice->getVPS()->getIVScalingFlag()); 1000 1061 #endif 1001 1062 … … 1111 1172 #endif 1112 1173 1174 #if MERL_VSP_C0152 // set BW LUT 1175 if( m_pcCamParsCollector ) // Initialize the LUT elements 1176 { 1177 m_pcCamParsCollector->setSlice( pcSlice ); 1178 } 1179 if( pcSlice->getViewId() !=0 ) 1180 { 1181 TComPic* pcBaseTxtPic = m_tAppDecTop->getPicFromView( 0, pcSlice->getPOC(), false ); // get base view reconstructed texture 1182 TComPic* pcBaseDepthPic = m_tAppDecTop->getPicFromView( 0, pcSlice->getPOC(), true ); // get base view reconstructed depth 1183 pcSlice->setRefPicBaseTxt(pcBaseTxtPic); 1184 pcSlice->setRefPicBaseDepth(pcBaseDepthPic); 1185 } 1186 getTAppDecTop()->setBWVSPLUT( pcSlice, pcSlice->getViewId(), pcSlice->getPOC() ); // get the LUT for backward warping 1187 #endif 1188 1113 1189 // Decode a picture 1114 1190 m_cGopDecoder.decompressGop(nalu.m_Bitstream, pcPic, false); … … 1149 1225 { 1150 1226 TComSPS* sps = new TComSPS(); 1151 #if RPS_IN_SPS1152 1227 TComRPSList* rps = new TComRPSList(); 1153 1228 sps->setRPSList(rps); 1154 #endif 1155 #if HHI_MPI 1229 #if HHI_MPI || OL_QTLIMIT_PREDCODING_B0068 1156 1230 m_cEntropyDecoder.decodeSPS( sps, m_isDepth ); 1157 1231 #else … … 1159 1233 #endif 1160 1234 m_parameterSetManagerDecoder.storePrefetchedSPS(sps); 1161 #if LCU_SYNTAX_ALF1162 1235 m_cAdaptiveLoopFilter.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); 1163 #endif1164 1236 } 1165 1237 1166 1238 Void TDecTop::xDecodePPS() 1167 1239 { 1168 #if !RPS_IN_SPS1169 TComRPSList* rps = new TComRPSList();1170 #endif1171 1240 TComPPS* pps = new TComPPS(); 1172 #if !RPS_IN_SPS1173 pps->setRPSList(rps);1174 #endif1175 #if TILES_OR_ENTROPY_SYNC_IDC1176 1241 m_cEntropyDecoder.decodePPS( pps, &m_parameterSetManagerDecoder ); 1177 #else1178 m_cEntropyDecoder.decodePPS( pps );1179 #endif1180 1242 m_parameterSetManagerDecoder.storePrefetchedPPS( pps ); 1181 1243 … … 1230 1292 case NAL_UNIT_CODED_SLICE: 1231 1293 case NAL_UNIT_CODED_SLICE_IDR: 1232 #if H0566_TLA1233 1294 #if !QC_REM_IDV_B0046 1234 1295 case NAL_UNIT_CODED_SLICE_IDV: … … 1236 1297 case NAL_UNIT_CODED_SLICE_CRA: 1237 1298 case NAL_UNIT_CODED_SLICE_TLA: 1238 #else1239 case NAL_UNIT_CODED_SLICE_CDR:1240 #endif1241 1299 return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay); 1242 1300 break; … … 1259 1317 sps = pSPSV0; 1260 1318 m_parameterSetManagerDecoder.storePrefetchedSPS(sps); 1261 #if LCU_SYNTAX_ALF1262 1319 m_cAdaptiveLoopFilter.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); 1263 #endif1264 1320 } 1265 1321 … … 1296 1352 else if (m_pocRandomAccess == MAX_INT) // start of random access point, m_pocRandomAccess has not been set yet. 1297 1353 { 1298 #if H0566_TLA1299 1354 if( m_apcSlicePilot->getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CRA ) 1300 #else1301 if( m_apcSlicePilot->getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CDR )1302 #endif1303 1355 { 1304 1356 m_pocRandomAccess = m_apcSlicePilot->getPOC(); // set the POC random access since we need to skip the reordered pictures in CRA. … … 1310 1362 else 1311 1363 { 1312 #if START_DECODING_AT_CRA1313 1364 static bool warningMessage = false; 1314 1365 if(!warningMessage) … … 1318 1369 } 1319 1370 return true; 1320 #else1321 printf("\nUnsafe random access point. Decoder may crash.");1322 m_pocRandomAccess = 0;1323 #endif1324 1371 } 1325 1372 } … … 1342 1389 m_cSAO.allocSaoParam(pAPS->getSaoParam()); 1343 1390 pAPS->createAlfParam(); 1344 #if !LCU_SYNTAX_ALF1345 m_cAdaptiveLoopFilter.allocALFParam(pAPS->getAlfParam());1346 #endif1347 1391 } 1348 1392
Note: See TracChangeset for help on using the changeset viewer.