Changeset 467 in 3DVCSoftware for branches/HTM-DEV-0.3-dev1/source/Lib/TLibDecoder
- Timestamp:
- 14 Jun 2013, 17:12:18 (11 years ago)
- Location:
- branches/HTM-DEV-0.3-dev1/source/Lib/TLibDecoder
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-DEV-0.3-dev1/source/Lib/TLibDecoder/TDecCAVLC.cpp
r459 r467 961 961 { 962 962 READ_FLAG( uiCode, "vps_depth_modes_flag[i]" ); pcVPS->setVpsDepthModesFlag( i, uiCode == 1 ? true : false ); 963 964 #if H_3D_DIM_DLT 965 if( pcVPS->getVpsDepthModesFlag( i ) ) 966 { 967 READ_FLAG( uiCode, "use_dlt_flag[i]" ); 968 pcVPS->setUseDLTFlag( i, uiCode == 1 ? true : false ); 969 if( pcVPS->getUseDLTFlag( i ) ) 970 { 971 // decode mapping 972 UInt uiNumDepthValues; 973 // parse number of values in DLT 974 READ_UVLC(uiNumDepthValues, "num_dlt_depth_values[i]"); 975 976 // parse actual DLT values 977 Int* aiIdx2DepthValue = (Int*) calloc(uiNumDepthValues, sizeof(Int)); 978 for(Int d=0; d<uiNumDepthValues; d++) 979 { 980 READ_UVLC(uiCode, "dlt_depth_value[i][d]"); 981 aiIdx2DepthValue[d] = (Int)uiCode; 982 } 983 984 pcVPS->setDepthLUTs(i, aiIdx2DepthValue, uiNumDepthValues); 985 986 // clean memory 987 free(aiIdx2DepthValue); 988 } 989 else 990 pcVPS->setDepthLUTs(i); 991 } 992 else 993 pcVPS->setDepthLUTs(i); 994 #endif 963 995 } 964 996 } -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibDecoder/TDecCu.cpp
r459 r467 399 399 break; 400 400 case MODE_INTRA: 401 #if H_3D_DIM_SDC 402 if( m_ppcCU[uiDepth]->getSDCFlag(0) ) 403 xReconIntraSDC( m_ppcCU[uiDepth], 0, uiDepth ); 404 else 405 #endif 401 406 xReconIntraQT( m_ppcCU[uiDepth], uiDepth ); 402 407 break; … … 634 639 635 640 } 641 642 #if H_3D_DIM_SDC 643 Void TDecCu::xReconIntraSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 644 { 645 UInt uiWidth = pcCU->getWidth ( 0 ); 646 UInt uiHeight = pcCU->getHeight ( 0 ); 647 648 TComYuv* pcRecoYuv = m_ppcYuvReco[uiDepth]; 649 TComYuv* pcPredYuv = m_ppcYuvReco[uiDepth]; 650 TComYuv* pcResiYuv = m_ppcYuvResi[uiDepth]; 651 652 UInt uiStride = pcRecoYuv->getStride (); 653 Pel* piReco = pcRecoYuv->getLumaAddr( uiAbsPartIdx ); 654 Pel* piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx ); 655 Pel* piResi = pcResiYuv->getLumaAddr( uiAbsPartIdx ); 656 657 UInt uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; 658 Pel* piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder ); 659 UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride (); 660 661 UInt uiLumaPredMode = pcCU->getLumaIntraDir ( uiAbsPartIdx ); 662 663 AOF( uiWidth == uiHeight ); 664 AOF( uiAbsPartIdx == 0 ); 665 AOF( pcCU->getSDCAvailable(uiAbsPartIdx) ); 666 AOF( pcCU->getSDCFlag(uiAbsPartIdx) ); 667 668 //===== init availability pattern ===== 669 Bool bAboveAvail = false; 670 Bool bLeftAvail = false; 671 pcCU->getPattern()->initPattern ( pcCU, 0, uiAbsPartIdx ); 672 pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, 0, m_pcPrediction->getPredicBuf(), m_pcPrediction->getPredicBufWidth(), m_pcPrediction->getPredicBufHeight(), bAboveAvail, bLeftAvail ); 673 674 //===== get prediction signal ===== 675 #if H_3D_DIM 676 if( isDimMode( uiLumaPredMode ) ) 677 { 678 m_pcPrediction->predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight ); 679 } 680 else 681 { 682 #endif 683 m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); 684 #if H_3D_DIM 685 } 686 #endif 687 688 // number of segments depends on prediction mode 689 UInt uiNumSegments = 1; 690 Bool* pbMask = NULL; 691 UInt uiMaskStride = 0; 692 693 if( getDimType( uiLumaPredMode ) == DMM1_IDX ) 694 { 695 Int uiTabIdx = pcCU->getDmmWedgeTabIdx(DMM1_IDX, uiAbsPartIdx); 696 697 WedgeList* pacWedgeList = &g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])]; 698 TComWedgelet* pcWedgelet = &(pacWedgeList->at( uiTabIdx )); 699 700 uiNumSegments = 2; 701 pbMask = pcWedgelet->getPattern(); 702 uiMaskStride = pcWedgelet->getStride(); 703 } 704 705 // get DC prediction for each segment 706 Pel apDCPredValues[2]; 707 m_pcPrediction->analyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride); 708 709 // reconstruct residual based on mask + DC residuals 710 Pel apDCResiValues[2]; 711 for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ ) 712 { 713 #if H_3D_DIM_DLT 714 Pel pPredIdx = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] ); 715 Pel pResiIdx = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx); 716 Pel pRecoValue = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pPredIdx + pResiIdx ); 717 718 apDCResiValues[uiSegment] = pRecoValue - apDCPredValues[uiSegment]; 719 #else 720 apDCResiValues[uiSegment] = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx); 721 #endif 722 } 723 724 //===== reconstruction ===== 725 Bool*pMask = pbMask; 726 Pel* pPred = piPred; 727 Pel* pResi = piResi; 728 Pel* pReco = piReco; 729 Pel* pRecIPred = piRecIPred; 730 731 for( UInt uiY = 0; uiY < uiHeight; uiY++ ) 732 { 733 for( UInt uiX = 0; uiX < uiWidth; uiX++ ) 734 { 735 UChar ucSegment = pMask?(UChar)pMask[uiX]:0; 736 assert( ucSegment < uiNumSegments ); 737 738 Pel pResiDC = apDCResiValues[ucSegment]; 739 740 pReco [ uiX ] = ClipY( pPred[ uiX ] + pResiDC ); 741 pRecIPred[ uiX ] = pReco[ uiX ]; 742 } 743 pPred += uiStride; 744 pResi += uiStride; 745 pReco += uiStride; 746 pRecIPred += uiRecIPredStride; 747 pMask += uiMaskStride; 748 } 749 750 // clear UV 751 UInt uiStrideC = pcPredYuv->getCStride(); 752 Pel *pRecCb = pcPredYuv->getCbAddr(); 753 Pel *pRecCr = pcPredYuv->getCrAddr(); 754 755 for (Int y=0; y<uiHeight/2; y++) 756 { 757 for (Int x=0; x<uiWidth/2; x++) 758 { 759 pRecCb[x] = 128; 760 pRecCr[x] = 128; 761 } 762 763 pRecCb += uiStrideC; 764 pRecCr += uiStrideC; 765 } 766 } 767 #endif 636 768 637 769 /** Function for deriving recontructed PU/CU Luma sample with QTree structure -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibDecoder/TDecCu.h
r324 r467 115 115 Void setdQPFlag ( Bool b ) { m_bDecodeDQP = b; } 116 116 Void xFillPCMBuffer (TComDataCU* pCU, UInt depth); 117 #if H_3D_DIM_SDC 118 Void xReconIntraSDC ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 119 #endif 117 120 }; 118 121 -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibDecoder/TDecEntropy.cpp
r324 r467 107 107 { 108 108 decodeIntraDirModeLuma ( pcCU, uiAbsPartIdx, uiDepth ); 109 decodeIntraDirModeChroma( pcCU, uiAbsPartIdx, uiDepth ); 109 #if H_3D_DIM_SDC 110 if(!pcCU->getSDCFlag(uiAbsPartIdx)) 111 #endif 112 decodeIntraDirModeChroma( pcCU, uiAbsPartIdx, uiDepth ); 110 113 } 111 114 else // if it is Inter mode, encode motion vector and reference index … … 129 132 return; 130 133 } 134 #if H_3D_DIM_SDC 135 if( pcCU->getSDCFlag(uiAbsPartIdx) ) 136 { 137 return; 138 } 139 #endif 131 140 132 141 m_pcEntropyDecoderIf->parseIPCMInfo( pcCU, uiAbsPartIdx, uiDepth ); … … 535 544 UInt uiChromaOffset = uiLumaOffset>>2; 536 545 546 #if H_3D_DIM_SDC 547 if( pcCU->getSDCFlag( uiAbsPartIdx ) ) 548 { 549 assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ); 550 assert( pcCU->getTransformIdx(uiAbsPartIdx) == 0 ); 551 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_LUMA) == 1 ); 552 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 ); 553 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) == 1 ); 554 return; 555 } 556 #endif 557 537 558 if( pcCU->isIntra(uiAbsPartIdx) ) 538 559 { -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibDecoder/TDecSbac.cpp
r459 r467 89 89 , m_cRbcDataSCModel ( 1, 1, NUM_RBC_DATA_CTX , m_contextModels + m_numContextModels, m_numContextModels) 90 90 #endif 91 #if H_3D_DIM_SDC 92 , m_cSDCResidualFlagSCModel ( 1, 1, SDC_NUM_RESIDUAL_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 93 , m_cSDCResidualSCModel ( 1, 1, SDC_NUM_RESIDUAL_CTX , m_contextModels + m_numContextModels, m_numContextModels) 94 #endif 91 95 #endif 92 96 { … … 162 166 #if H_3D_DIM_RBC 163 167 m_cRbcDataSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_RBC_DATA ); 168 #endif 169 #if H_3D_DIM_SDC 170 m_cSDCResidualFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL_FLAG ); 171 m_cSDCResidualSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL ); 164 172 #endif 165 173 #endif … … 222 230 m_cRbcDataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_RBC_DATA ); 223 231 #endif 232 #if H_3D_DIM_SDC 233 m_cSDCResidualFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL_FLAG ); 234 m_cSDCResidualSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL ); 235 #endif 224 236 #endif 225 237 m_pcTDecBinIf->start(); … … 505 517 } 506 518 #endif 519 #if H_3D_DIM_SDC 520 Void TDecSbac::xParseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiSegment ) 521 { 522 assert( pcCU->getSlice()->getIsDepth() ); 523 assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ); 524 assert( pcCU->getSDCFlag(uiAbsPartIdx) ); 525 assert( uiSegment < 2 ); 526 527 UInt uiResidual = 0; 528 UInt uiBit = 0; 529 UInt uiAbsIdx = 0; 530 UInt uiSign = 0; 531 Int iIdx = 0; 532 533 #if H_3D_DIM_DLT 534 UInt uiMaxResidualBits = pcCU->getSlice()->getVPS()->getBitsPerDepthValue( pcCU->getSlice()->getLayerIdInVps() ); 535 #else 536 UInt uiMaxResidualBits = g_bitDepthY; 537 #endif 538 assert( uiMaxResidualBits <= g_bitDepthY ); 539 540 m_pcTDecBinIf->decodeBin(uiResidual, m_cSDCResidualFlagSCModel.get( 0, 0, 0 ) ); 541 542 if (uiResidual) 543 { 544 // decode residual sign bit 545 m_pcTDecBinIf->decodeBinEP(uiSign); 546 547 // decode residual magnitude 548 // prefix part 549 UInt uiCount = 0; 550 #if H_3D_DIM_DLT 551 UInt uiNumDepthValues = pcCU->getSlice()->getVPS()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ); 552 #else 553 UInt uiNumDepthValues = ((1 << g_bitDepthY)-1); 554 #endif 555 UInt uiPrefixThreshold = ((uiNumDepthValues * 3) >> 2); 556 for ( UInt ui = 0; ui < uiPrefixThreshold; ui++) 557 { 558 m_pcTDecBinIf->decodeBin( uiBit, m_cSDCResidualSCModel.get(0, 0, 0) ); 559 if ( uiBit == 0 ) 560 break; 561 else 562 uiCount++; 563 } 564 // suffix part 565 if ( uiCount == uiPrefixThreshold ) 566 { 567 for ( UInt ui = 0; ui < ( (UInt)ceil( Log2(uiNumDepthValues - uiPrefixThreshold) ) ); ui++ ) 568 { 569 m_pcTDecBinIf->decodeBinEP( uiBit ); 570 uiAbsIdx |= uiBit << ui; 571 } 572 uiAbsIdx += uiCount; 573 } 574 else 575 uiAbsIdx = uiCount; 576 577 uiAbsIdx += 1; 578 iIdx =(Int)(uiSign ? -1 : 1)*uiAbsIdx; 579 } 580 581 pcCU->setSDCSegmentDCOffset(iIdx, uiSegment, uiAbsPartIdx); 582 } 583 #endif 507 584 #endif 508 585 … … 962 1039 963 1040 #if H_3D_DIM_SDC 964 if( pcCU->getSDC Available(absPartIdx) && pcCU->getSDCFlag(absPartIdx) ) // sdcFlag965 { 966 //assert(pcCU->getPartitionSize(uiAbsPartIdx)!=SIZE_NxN);967 //pcCU->setTrIdxSubParts(0, uiAbsPartIdx, uiDepth);968 //pcCU->setCbfSubParts(1, 1, 1, uiAbsPartIdx, uiDepth);969 970 //UInt uiNumSegments = ( uiDir == DC_IDX || uiDir == PLANAR_IDX )? 1 : 2;971 //for (int uiSeg=0; uiSeg<uiNumSegments; uiSeg++)972 //{973 // parseSDCResidualData(pcCU, uiAbsPartIdx, uiDepth, uiSeg);974 //}1041 if( pcCU->getSDCFlag(absPartIdx) ) 1042 { 1043 assert(pcCU->getPartitionSize(absPartIdx)==SIZE_2Nx2N); 1044 pcCU->setTrIdxSubParts(0, absPartIdx, depth); 1045 pcCU->setCbfSubParts(1, 1, 1, absPartIdx, depth); 1046 1047 UInt uiNumSegments = ( dir == DC_IDX || dir == PLANAR_IDX )? 1 : 2; 1048 for (UInt uiSeg=0; uiSeg<uiNumSegments; uiSeg++) 1049 { 1050 xParseSDCResidualData(pcCU, absPartIdx, depth, uiSeg); 1051 } 975 1052 } 976 1053 else 977 1054 { 978 1055 #endif 979 if( dimType < DIM_NUM_TYPE )980 {981 UInt symbol;982 m_pcTDecBinIf->decodeBin( symbol, m_cDdcFlagSCModel.get(0, 0, (RBC_IDX == dimType) ? 1 : 0) );983 if( symbol )984 {985 dir += symbol;986 for( UInt segment = 0; segment < 2; segment++ )987 {988 Pel valDeltaDC = 0;989 xParseDimDeltaDC( valDeltaDC, dimType );990 pcCU->setDimDeltaDC( dimType, segment, absPartIdx, valDeltaDC );991 }992 }993 }1056 if( dimType < DIM_NUM_TYPE ) 1057 { 1058 UInt symbol; 1059 m_pcTDecBinIf->decodeBin( symbol, m_cDdcFlagSCModel.get(0, 0, (RBC_IDX == dimType) ? 1 : 0) ); 1060 if( symbol ) 1061 { 1062 dir += symbol; 1063 for( UInt segment = 0; segment < 2; segment++ ) 1064 { 1065 Pel valDeltaDC = 0; 1066 xParseDimDeltaDC( valDeltaDC, dimType ); 1067 pcCU->setDimDeltaDC( dimType, segment, absPartIdx, valDeltaDC ); 1068 } 1069 } 1070 } 994 1071 #if H_3D_DIM_SDC 995 1072 } … … 1088 1165 pcCU->setLumaIntraDirSubParts( (UChar)dir, absPartIdx, depth ); 1089 1166 #if H_3D_DIM_SDC 1090 pcCU->setSDCFlagSubParts( sdcFlag, absPartIdx, 0,depth );1167 pcCU->setSDCFlagSubParts( sdcFlag, absPartIdx, depth ); 1091 1168 #endif 1092 1169 } -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibDecoder/TDecSbac.h
r459 r467 108 108 Void xParseRbcEdge ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 109 109 #endif 110 #if H_3D_DIM_SDC 111 Void xParseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart ); 112 #endif 110 113 #endif 111 114 private: … … 201 204 ContextModel3DBuffer m_cRbcDataSCModel; 202 205 #endif 206 #if H_3D_DIM_SDC 207 ContextModel3DBuffer m_cSDCResidualFlagSCModel; 208 ContextModel3DBuffer m_cSDCResidualSCModel; 209 #endif 203 210 #endif 204 211 };
Note: See TracChangeset for help on using the changeset viewer.