Changeset 467 in 3DVCSoftware for branches/HTM-DEV-0.3-dev1/source/Lib/TLibEncoder
- Timestamp:
- 14 Jun 2013, 17:12:18 (12 years ago)
- Location:
- branches/HTM-DEV-0.3-dev1/source/Lib/TLibEncoder
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-DEV-0.3-dev1/source/Lib/TLibEncoder/TEncCavlc.cpp
r459 r467 752 752 { 753 753 WRITE_FLAG( pcVPS->getVpsDepthModesFlag( i ), "vps_depth_modes_flag[i]" ); 754 755 #if H_3D_DIM_DLT 756 if( pcVPS->getVpsDepthModesFlag( i ) ) 757 { 758 WRITE_FLAG( pcVPS->getUseDLTFlag( i ) ? 1 : 0, "use_dlt_flag[i]" ); 759 if( pcVPS->getUseDLTFlag( i ) ) 760 { 761 // code mapping 762 WRITE_UVLC(pcVPS->getNumDepthValues(i), "num_dlt_depth_values[i]"); 763 for(Int d=0; d<pcVPS->getNumDepthValues(i); d++) 764 { 765 WRITE_UVLC( pcVPS->idx2DepthValue(i, d), "dlt_depth_value[i][d]" ); 766 } 767 } 768 } 769 #endif 754 770 } 755 771 } -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibEncoder/TEncCu.cpp
r460 r467 1487 1487 m_ppcRecoYuvTemp[uiDepth]->copyToPicLuma(rpcTempCU->getPic()->getPicYuvRec(), rpcTempCU->getAddr(), rpcTempCU->getZorderIdxInCU() ); 1488 1488 1489 #if H_3D_DIM_SDC 1490 if( !rpcTempCU->getSDCFlag( 0 ) ) 1491 #endif 1489 1492 m_pcPredSearch ->estIntraPredChromaQT( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth], uiPreCalcDistC ); 1490 1493 -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibEncoder/TEncEntropy.cpp
r446 r467 217 217 return; 218 218 } 219 #if H_3D_DIM_SDC 220 if( pcCU->getSDCFlag(uiAbsPartIdx) ) 221 { 222 return; 223 } 224 #endif 219 225 220 226 if( bRD ) … … 427 433 { 428 434 encodeIntraDirModeLuma ( pcCU, uiAbsPartIdx,true ); 435 #if H_3D_DIM_SDC 436 if(!pcCU->getSDCFlag(uiAbsPartIdx)) 437 #endif 429 438 encodeIntraDirModeChroma( pcCU, uiAbsPartIdx, bRD ); 430 439 } … … 592 601 UInt uiLumaOffset = uiMinCoeffSize*uiAbsPartIdx; 593 602 UInt uiChromaOffset = uiLumaOffset>>2; 594 603 604 #if H_3D_DIM_SDC 605 if( pcCU->getSDCFlag( uiAbsPartIdx ) ) 606 { 607 assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ); 608 assert( pcCU->getTransformIdx(uiAbsPartIdx) == 0 ); 609 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_LUMA) == 1 ); 610 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 ); 611 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) == 1 ); 612 return; 613 } 614 #endif 615 595 616 if( pcCU->isIntra(uiAbsPartIdx) ) 596 617 { -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibEncoder/TEncSbac.cpp
r459 r467 95 95 , m_cRbcDataSCModel ( 1, 1, NUM_RBC_DATA_CTX , m_contextModels + m_numContextModels, m_numContextModels) 96 96 #endif 97 #if H_3D_DIM_SDC 98 , m_cSDCResidualFlagSCModel ( 1, 1, SDC_NUM_RESIDUAL_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 99 , m_cSDCResidualSCModel ( 1, 1, SDC_NUM_RESIDUAL_CTX , m_contextModels + m_numContextModels, m_numContextModels) 100 #endif 97 101 #endif 98 102 { … … 159 163 #if H_3D_DIM_RBC 160 164 m_cRbcDataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_RBC_DATA ); 165 #endif 166 #if H_3D_DIM_SDC 167 m_cSDCResidualFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL_FLAG ); 168 m_cSDCResidualSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL ); 161 169 #endif 162 170 #endif … … 293 301 m_cRbcDataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_RBC_DATA ); 294 302 #endif 303 #if H_3D_DIM_SDC 304 m_cSDCResidualFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL_FLAG ); 305 m_cSDCResidualSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL ); 306 #endif 295 307 #endif 296 308 m_pcBinIf->start(); … … 557 569 if( uiReorderSymbol != 6 ) 558 570 m_pcBinIf->encodeBin( 0, m_cRbcDataSCModel.get( 0, 0, 0 ) ); 571 } 572 } 573 #endif 574 #if H_3D_DIM_SDC 575 Void TEncSbac::xCodeSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment ) 576 { 577 assert( pcCU->getSlice()->getIsDepth() ); 578 assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ); 579 assert( pcCU->getSDCFlag(uiAbsPartIdx) ); 580 assert( uiSegment < 2 ); 581 582 Pel segmentDCOffset = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx); 583 584 UInt uiResidual = segmentDCOffset == 0 ? 0 : 1; 585 UInt uiSign = segmentDCOffset < 0 ? 1 : 0; 586 UInt uiAbsIdx = abs(segmentDCOffset); 587 588 #if H_3D_DIM_DLT 589 UInt uiMaxResidualBits = pcCU->getSlice()->getVPS()->getBitsPerDepthValue( pcCU->getSlice()->getLayerIdInVps() ); 590 #else 591 UInt uiMaxResidualBits = g_bitDepthY; 592 #endif 593 assert( uiMaxResidualBits <= g_bitDepthY ); 594 595 // residual flag 596 m_pcBinIf->encodeBin( uiResidual, m_cSDCResidualFlagSCModel.get( 0, 0, 0 ) ); 597 598 if (uiResidual) 599 { 600 // encode sign bit of residual 601 m_pcBinIf->encodeBinEP( uiSign ); 602 603 #if H_3D_DIM_DLT 604 UInt uiNumDepthValues = pcCU->getSlice()->getVPS()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ); 605 #else 606 UInt uiNumDepthValues = ((1 << g_bitDepthY)-1); 607 #endif 608 assert(uiAbsIdx <= uiNumDepthValues); 609 610 // encode residual magnitude 611 uiAbsIdx -= 1; 612 // prefix part 613 if ( uiAbsIdx == 0 ) 614 m_pcBinIf->encodeBin( 0, m_cSDCResidualSCModel.get(0, 0, 0) ); 615 else 616 { 617 UInt l = uiAbsIdx; 618 UInt k = 0; 619 UInt uiPrefixThreshold = ((uiNumDepthValues * 3) >> 2); 620 while ( l > 0 && k < uiPrefixThreshold ) 621 { 622 m_pcBinIf->encodeBin( 1, m_cSDCResidualSCModel.get(0, 0, 0) ); 623 l--; 624 k++; 625 } 626 if ( uiAbsIdx < uiPrefixThreshold ) 627 m_pcBinIf->encodeBin( 0, m_cSDCResidualSCModel.get(0, 0, 0) ); 628 // suffix part 629 else 630 { 631 uiAbsIdx -= uiPrefixThreshold; 632 UInt uiSuffixLength = ( (UInt)ceil( Log2(uiNumDepthValues - uiPrefixThreshold) ) ); 633 UInt uiBitInfo = 0; 634 for ( Int i = 0; i < uiSuffixLength; i++) 635 { 636 uiBitInfo = ( uiAbsIdx & ( 1 << i ) ) >> i; 637 m_pcBinIf->encodeBinEP( uiBitInfo); 638 } 639 } 640 } 641 559 642 } 560 643 } … … 695 778 Void TEncSbac::codePredMode( TComDataCU* pcCU, UInt uiAbsPartIdx ) 696 779 { 780 #if H_3D_DIM_SDC 781 if ( pcCU->getSlice()->isIntra() ) 782 { 783 assert( pcCU->isIntra(uiAbsPartIdx) ); 784 return; 785 } 786 #endif 787 697 788 // get context function is here 698 789 Int iPredMode = pcCU->getPredictionMode( uiAbsPartIdx ); … … 916 1007 917 1008 #if H_3D_DIM 918 Void TEncSbac::codeIntraDepth( TComDataCU* pcCU, UInt absPartIdx , Bool sdcRD)1009 Void TEncSbac::codeIntraDepth( TComDataCU* pcCU, UInt absPartIdx ) 919 1010 { 920 1011 codeIntraDepthMode( pcCU, absPartIdx ); … … 953 1044 if( pcCU->getSDCFlag( absPartIdx ) ) 954 1045 { 955 // assert(pcCU->getPartitionSize(uiAbsPartIdx)==SIZE_2Nx2N); 956 // UInt uiNumSegments = ( uiDir == DC_IDX || uiDir == PLANAR_IDX )? 1 : 2; 957 // if(!bSdcRD) 958 // { 959 // for (int uiSeg=0; uiSeg<uiNumSegments; uiSeg++) 960 // { 961 // codeSDCResidualData(pcCU, uiAbsPartIdx, uiSeg); 962 // } 963 // } 1046 assert(pcCU->getPartitionSize(absPartIdx)==SIZE_2Nx2N); 1047 UInt uiNumSegments = ( dir == DC_IDX || dir == PLANAR_IDX )? 1 : 2; 1048 for(UInt uiSeg=0; uiSeg<uiNumSegments; uiSeg++) 1049 { 1050 xCodeSDCResidualData(pcCU, absPartIdx, uiSeg); 1051 } 964 1052 } 965 1053 else … … 1010 1098 #if H_3D_DIM_SDC 1011 1099 if( pcCU->getSDCFlag( absPartIdx ) ) 1012 { 1013 // switch( dir ) 1014 // { 1015 // case PLANAR_IDX: codeIdx = 0; break; 1016 // case DC_IDX: codeIdx = 6; break; 1017 // case (2*DMM1_IDX+DIM_OFFSET): codeIdx = 2; break; 1018 // default: break; 1019 // } 1100 { 1101 switch( dir ) 1102 { 1103 case PLANAR_IDX: codeIdx = 0; break; 1104 case DC_IDX: codeIdx = 6; break; 1105 default: codeIdx = 2; break; 1106 } 1020 1107 } 1021 1108 #endif -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibEncoder/TEncSbac.h
r459 r467 127 127 Void xCodeRbcEdge ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 128 128 #endif 129 #if H_3D_DIM_SDC 130 Void xCodeSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment ); 131 #endif 129 132 #endif 130 133 … … 165 168 166 169 #if H_3D_DIM 167 Void codeIntraDepth ( TComDataCU* pcCU, UInt absPartIdx , Bool sdcRD = false);170 Void codeIntraDepth ( TComDataCU* pcCU, UInt absPartIdx ); 168 171 Void codeIntraDepthMode ( TComDataCU* pcCU, UInt absPartIdx ); 169 172 #endif … … 241 244 ContextModel3DBuffer m_cRbcDataSCModel; 242 245 #endif 246 #if H_3D_DIM_SDC 247 ContextModel3DBuffer m_cSDCResidualFlagSCModel; 248 ContextModel3DBuffer m_cSDCResidualSCModel; 249 #endif 243 250 #endif 244 251 }; -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibEncoder/TEncSearch.cpp
r466 r467 1838 1838 } 1839 1839 1840 #if H_3D_DIM_SDC 1841 Void TEncSearch::xIntraCodingSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Bool bResidual ) 1842 { 1843 UInt uiLumaPredMode = pcCU ->getLumaIntraDir( uiAbsPartIdx ); 1844 UInt uiWidth = pcCU ->getWidth ( 0 ); 1845 UInt uiHeight = pcCU ->getHeight ( 0 ); 1846 UInt uiStride = pcOrgYuv ->getStride (); 1847 Pel* piOrg = pcOrgYuv ->getLumaAddr( uiAbsPartIdx ); 1848 Pel* piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx ); 1849 Pel* piReco = pcPredYuv->getLumaAddr( uiAbsPartIdx ); 1850 1851 UInt uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; 1852 Pel* piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder ); 1853 UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride (); 1854 1855 AOF( uiWidth == uiHeight ); 1856 AOF( uiAbsPartIdx == 0 ); 1857 AOF( pcCU->getSDCAvailable(uiAbsPartIdx) ); 1858 AOF( pcCU->getSDCFlag(uiAbsPartIdx) ); 1859 AOF( uiLumaPredMode == DC_IDX || uiLumaPredMode == PLANAR_IDX || ( getDimType( uiLumaPredMode ) == DMM1_IDX && !isDimDeltaDC( uiLumaPredMode ) ) ); 1860 AOF( uiLumaPredMode == DC_IDX || uiLumaPredMode == PLANAR_IDX || uiWidth < 64 ); 1861 1862 //===== init availability pattern ===== 1863 Bool bAboveAvail = false; 1864 Bool bLeftAvail = false; 1865 pcCU->getPattern()->initPattern ( pcCU, 0, uiAbsPartIdx ); 1866 pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, 0, m_piYuvExt, m_iYuvExtStride, m_iYuvExtHeight, bAboveAvail, bLeftAvail ); 1867 1868 //===== get prediction signal ===== 1869 #if H_3D_DIM 1870 if( isDimMode( uiLumaPredMode ) ) 1871 { 1872 predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, true ); 1873 } 1874 else 1875 { 1876 #endif 1877 predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); 1878 #if H_3D_DIM 1879 } 1880 #endif 1881 1882 // number of segments depends on prediction mode 1883 UInt uiNumSegments = 1; 1884 Bool* pbMask = NULL; 1885 UInt uiMaskStride = 0; 1886 1887 if( getDimType( uiLumaPredMode ) == DMM1_IDX ) 1888 { 1889 Int uiTabIdx = pcCU->getDmmWedgeTabIdx(DMM1_IDX, uiAbsPartIdx); 1890 1891 WedgeList* pacWedgeList = &g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])]; 1892 TComWedgelet* pcWedgelet = &(pacWedgeList->at( uiTabIdx )); 1893 1894 uiNumSegments = 2; 1895 pbMask = pcWedgelet->getPattern(); 1896 uiMaskStride = pcWedgelet->getStride(); 1897 } 1898 1899 // get DC prediction for each segment 1900 Pel apDCPredValues[2]; 1901 analyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride ); 1902 1903 // get original DC for each segment 1904 Pel apDCOrigValues[2]; 1905 analyzeSegmentsSDC(piOrg, uiStride, uiWidth, apDCOrigValues, uiNumSegments, pbMask, uiMaskStride ); 1906 1907 for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ ) 1908 { 1909 // remap reconstructed value to valid depth values 1910 Pel pDCRec = bResidual?apDCOrigValues[uiSegment]:apDCPredValues[uiSegment]; 1911 1912 // get residual (idx) 1913 #if H_3D_DIM_DLT 1914 Pel pResidualIdx = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pDCRec ) - pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] ); 1915 #else 1916 Pel pResidualIdx = pDCRec - apDCPredValues[uiSegment]; 1917 #endif 1918 1919 // save SDC DC offset 1920 pcCU->setSDCSegmentDCOffset(pResidualIdx, uiSegment, uiAbsPartIdx); 1921 } 1922 1923 // reconstruct residual based on mask + DC residuals 1924 Pel apDCResiValues[2]; 1925 for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ ) 1926 { 1927 #if H_3D_DIM_DLT 1928 Pel pPredIdx = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] ); 1929 Pel pResiIdx = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx); 1930 Pel pRecoValue = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pPredIdx + pResiIdx ); 1931 1932 apDCResiValues[uiSegment] = pRecoValue - apDCPredValues[uiSegment]; 1933 #else 1934 apDCResiValues[uiSegment] = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx); 1935 #endif 1936 } 1937 1938 //===== reconstruction ===== 1939 Bool* pMask = pbMask; 1940 Pel* pPred = piPred; 1941 Pel* pReco = piReco; 1942 Pel* pRecIPred = piRecIPred; 1943 1944 for( UInt uiY = 0; uiY < uiHeight; uiY++ ) 1945 { 1946 for( UInt uiX = 0; uiX < uiWidth; uiX++ ) 1947 { 1948 UChar ucSegment = pMask?(UChar)pMask[uiX]:0; 1949 assert( ucSegment < uiNumSegments ); 1950 1951 Pel pResiDC = apDCResiValues[ucSegment]; 1952 1953 pReco [ uiX ] = ClipY( pPred[ uiX ] + pResiDC ); 1954 pRecIPred[ uiX ] = pReco[ uiX ]; 1955 } 1956 pPred += uiStride; 1957 pReco += uiStride; 1958 pRecIPred += uiRecIPredStride; 1959 pMask += uiMaskStride; 1960 } 1961 1962 // clear UV 1963 UInt uiStrideC = pcPredYuv->getCStride(); 1964 Pel *pRecCb = pcPredYuv->getCbAddr(); 1965 Pel *pRecCr = pcPredYuv->getCrAddr(); 1966 1967 for (Int y=0; y<uiHeight/2; y++) 1968 { 1969 for (Int x=0; x<uiWidth/2; x++) 1970 { 1971 pRecCb[x] = 128; 1972 pRecCr[x] = 128; 1973 } 1974 1975 pRecCb += uiStrideC; 1976 pRecCr += uiStrideC; 1977 } 1978 1979 //===== determine distortion ===== 1980 #if H_3D_VSO 1981 if( m_pcRdCost->getUseVSO() ) 1982 { 1983 if( m_pcRdCost->getUseEstimatedVSD() ) 1984 { 1985 ruiDist = m_pcRdCost->getDistPartVSD( pcCU, uiAbsPartIdx, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight, false ); 1986 } 1987 else 1988 { 1989 ruiDist = m_pcRdCost->getDistPartVSO( pcCU, uiAbsPartIdx, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight, false ); 1990 } 1991 } 1992 else 1993 #endif 1994 { 1995 ruiDist = m_pcRdCost->getDistPart( g_bitDepthY, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight ); 1996 } 1997 1998 //----- determine rate and r-d cost ----- 1999 m_pcEntropyCoder->resetBits(); 2000 2001 // encode reduced intra header 2002 m_pcEntropyCoder->encodeSkipFlag( pcCU, 0, true ); 2003 m_pcEntropyCoder->encodePredMode( pcCU, 0, true ); 2004 2005 // encode pred direction + residual data 2006 m_pcEntropyCoder->encodePredInfo( pcCU, 0, true ); 2007 UInt uiBits = m_pcEntropyCoder->getNumberOfWrittenBits(); 2008 2009 #if HHI_VSO 2010 if ( m_pcRdCost->getUseLambdaScaleVSO()) 2011 { 2012 dRDCost = m_pcRdCost->calcRdCostVSO( uiBits, ruiDist ); 2013 } 2014 else 2015 #endif 2016 { 2017 dRDCost = m_pcRdCost->calcRdCost( uiBits, ruiDist ); 2018 } 2019 } 2020 #endif 1840 2021 1841 2022 Void … … 2766 2947 UInt uiBestPUDistC = 0; 2767 2948 Double dBestPUCost = MAX_DOUBLE; 2949 #if H_3D_DIM_SDC 2950 Bool bBestUseSDC = false; 2951 Pel apBestDCOffsets[2] = {0,0}; 2952 #endif 2768 2953 for( UInt uiMode = 0; uiMode < numModesForFullRD; uiMode++ ) 2769 2954 { 2770 #if H_3D_DIM_ENC2771 for( UInt testZeroResi = 0; testZeroResi <= ((pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->isIRAP()) ? 1 : 0 ); testZeroResi++ )2772 {2773 #endif2774 2955 // set luma prediction mode 2775 2956 UInt uiOrgMode = uiRdModeList[uiMode]; … … 2777 2958 pcCU->setLumaIntraDirSubParts ( uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth ); 2778 2959 2960 #if H_3D_DIM_SDC 2961 Bool bTestSDC = ( m_pcEncCfg->getUseSDC() && pcCU->getSDCAvailable(uiPartOffset) ); 2962 2963 for( UInt uiSDC=0; uiSDC<=(bTestSDC?1:0); uiSDC++ ) 2964 { 2965 pcCU->setSDCFlagSubParts( (uiSDC != 0), uiPartOffset, uiDepth + uiInitTrDepth ); 2966 #endif 2967 2968 #if H_3D_DIM_ENC || H_3D_DIM_SDC 2969 Bool bTestZeroResi = false; 2970 #if H_3D_DIM_ENC 2971 bTestZeroResi |= pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->isIRAP(); 2972 #endif 2973 #if H_3D_DIM_SDC 2974 bTestZeroResi |= pcCU->getSDCFlag(uiPartOffset); 2975 #endif 2976 #endif 2977 2978 #if H_3D_DIM_ENC || H_3D_DIM_SDC 2979 for( UInt testZeroResi = 0; testZeroResi <= (bTestZeroResi ? 1 : 0) ; testZeroResi++ ) 2980 { 2981 #endif 2779 2982 // set context models 2780 2983 if( m_bUseSBACRD ) … … 2797 3000 } 2798 3001 #endif 3002 #if H_3D_DIM_SDC 3003 if( pcCU->getSDCFlag(uiPartOffset) ) 3004 { 3005 pcCU->setTrIdxSubParts(0, uiPartOffset, uiDepth + uiInitTrDepth); 3006 pcCU->setCbfSubParts(1, 1, 1, uiPartOffset, uiDepth + uiInitTrDepth); 3007 3008 // start encoding with SDC 3009 xIntraCodingSDC(pcCU, uiPartOffset, pcOrgYuv, pcPredYuv, uiPUDistY, dPUCost, (testZeroResi!=0)); 3010 } 3011 else 3012 { 3013 #endif 2799 3014 #if HHI_RQT_INTRA_SPEEDUP 2800 3015 #if H_3D_DIM_ENC … … 2810 3025 #endif 2811 3026 #endif 3027 #if H_3D_DIM_SDC 3028 } 3029 #endif 2812 3030 2813 3031 // check r-d cost … … 2822 3040 uiBestPUDistC = uiPUDistC; 2823 3041 dBestPUCost = dPUCost; 3042 3043 #if H_3D_DIM_SDC 3044 if( pcCU->getSDCFlag(uiPartOffset) ) 3045 { 3046 bBestUseSDC = true; 3047 3048 // copy reconstruction 3049 pcPredYuv->copyPartToPartYuv(pcRecoYuv, uiPartOffset, uiWidth, uiHeight); 3050 3051 // copy DC values 3052 apBestDCOffsets[0] = pcCU->getSDCSegmentDCOffset(0, uiPartOffset); 3053 apBestDCOffsets[1] = pcCU->getSDCSegmentDCOffset(1, uiPartOffset); 3054 } 3055 else 3056 { 3057 bBestUseSDC = false; 3058 #endif 3059 xSetIntraResultQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcRecoYuv ); 3060 3061 UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 ); 3062 ::memcpy( m_puhQTTempTrIdx, pcCU->getTransformIdx() + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3063 ::memcpy( m_puhQTTempCbf[0], pcCU->getCbf( TEXT_LUMA ) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3064 ::memcpy( m_puhQTTempCbf[1], pcCU->getCbf( TEXT_CHROMA_U ) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3065 ::memcpy( m_puhQTTempCbf[2], pcCU->getCbf( TEXT_CHROMA_V ) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3066 ::memcpy( m_puhQTTempTransformSkipFlag[0], pcCU->getTransformSkip(TEXT_LUMA) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3067 ::memcpy( m_puhQTTempTransformSkipFlag[1], pcCU->getTransformSkip(TEXT_CHROMA_U) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3068 ::memcpy( m_puhQTTempTransformSkipFlag[2], pcCU->getTransformSkip(TEXT_CHROMA_V) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3069 #if H_3D_DIM_SDC 3070 } 3071 #endif 3072 } 3073 #if HHI_RQT_INTRA_SPEEDUP_MOD 3074 else if( dPUCost < dSecondBestPUCost ) 3075 { 3076 uiSecondBestMode = uiOrgMode; 3077 dSecondBestPUCost = dPUCost; 3078 } 3079 #endif 3080 #if H_3D_DIM_ENC || H_3D_DIM_SDC 3081 } 3082 #endif 3083 #if H_3D_DIM_SDC 3084 } // SDC loop 3085 #endif 3086 } // Mode loop 3087 3088 #if HHI_RQT_INTRA_SPEEDUP 3089 #if HHI_RQT_INTRA_SPEEDUP_MOD 3090 for( UInt ui =0; ui < 2; ++ui ) 3091 #endif 3092 { 3093 #if HHI_RQT_INTRA_SPEEDUP_MOD 3094 UInt uiOrgMode = ui ? uiSecondBestMode : uiBestPUMode; 3095 if( uiOrgMode == MAX_UINT ) 3096 { 3097 break; 3098 } 3099 #else 3100 UInt uiOrgMode = uiBestPUMode; 3101 #endif 3102 3103 pcCU->setLumaIntraDirSubParts ( uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth ); 3104 #if H_3D_DIM_SDC 3105 pcCU->setSDCFlagSubParts(false, uiPartOffset, uiDepth + uiInitTrDepth); 3106 #endif 3107 3108 // set context models 3109 if( m_bUseSBACRD ) 3110 { 3111 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] ); 3112 } 3113 3114 // determine residual for partition 3115 #if H_3D_VSO 3116 Dist uiPUDistY = 0; 3117 #else 3118 UInt uiPUDistY = 0; 3119 #endif 3120 UInt uiPUDistC = 0; 3121 Double dPUCost = 0.0; 3122 3123 #if H_3D_VSO // M37 3124 // reset Model 3125 if( m_pcRdCost->getUseRenModel() ) 3126 { 3127 m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight ); 3128 } 3129 #endif 3130 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, false, dPUCost ); 3131 3132 // check r-d cost 3133 if( dPUCost < dBestPUCost ) 3134 { 3135 uiBestPUMode = uiOrgMode; 3136 uiBestPUDistY = uiPUDistY; 3137 uiBestPUDistC = uiPUDistC; 3138 dBestPUCost = dPUCost; 3139 #if H_3D_DIM_SDC 3140 bBestUseSDC = false; 3141 #endif 2824 3142 2825 3143 xSetIntraResultQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcRecoYuv ); … … 2834 3152 ::memcpy( m_puhQTTempTransformSkipFlag[2], pcCU->getTransformSkip(TEXT_CHROMA_V) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 2835 3153 } 2836 #if HHI_RQT_INTRA_SPEEDUP_MOD2837 else if( dPUCost < dSecondBestPUCost )2838 {2839 uiSecondBestMode = uiOrgMode;2840 dSecondBestPUCost = dPUCost;2841 }2842 #endif2843 #if H_3D_DIM_ENC2844 }2845 #endif2846 } // Mode loop2847 2848 #if HHI_RQT_INTRA_SPEEDUP2849 #if HHI_RQT_INTRA_SPEEDUP_MOD2850 for( UInt ui =0; ui < 2; ++ui )2851 #endif2852 {2853 #if HHI_RQT_INTRA_SPEEDUP_MOD2854 UInt uiOrgMode = ui ? uiSecondBestMode : uiBestPUMode;2855 if( uiOrgMode == MAX_UINT )2856 {2857 break;2858 }2859 #else2860 UInt uiOrgMode = uiBestPUMode;2861 #endif2862 2863 pcCU->setLumaIntraDirSubParts ( uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth );2864 2865 // set context models2866 if( m_bUseSBACRD )2867 {2868 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] );2869 }2870 2871 // determine residual for partition2872 #if H_3D_VSO2873 Dist uiPUDistY = 0;2874 #else2875 UInt uiPUDistY = 0;2876 #endif2877 UInt uiPUDistC = 0;2878 Double dPUCost = 0.0;2879 2880 #if H_3D_VSO // M372881 // reset Model2882 if( m_pcRdCost->getUseRenModel() )2883 {2884 m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight );2885 }2886 #endif2887 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, false, dPUCost );2888 2889 // check r-d cost2890 if( dPUCost < dBestPUCost )2891 {2892 uiBestPUMode = uiOrgMode;2893 uiBestPUDistY = uiPUDistY;2894 uiBestPUDistC = uiPUDistC;2895 dBestPUCost = dPUCost;2896 2897 xSetIntraResultQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcRecoYuv );2898 2899 UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 );2900 ::memcpy( m_puhQTTempTrIdx, pcCU->getTransformIdx() + uiPartOffset, uiQPartNum * sizeof( UChar ) );2901 ::memcpy( m_puhQTTempCbf[0], pcCU->getCbf( TEXT_LUMA ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );2902 ::memcpy( m_puhQTTempCbf[1], pcCU->getCbf( TEXT_CHROMA_U ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );2903 ::memcpy( m_puhQTTempCbf[2], pcCU->getCbf( TEXT_CHROMA_V ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );2904 ::memcpy( m_puhQTTempTransformSkipFlag[0], pcCU->getTransformSkip(TEXT_LUMA) + uiPartOffset, uiQPartNum * sizeof( UChar ) );2905 ::memcpy( m_puhQTTempTransformSkipFlag[1], pcCU->getTransformSkip(TEXT_CHROMA_U) + uiPartOffset, uiQPartNum * sizeof( UChar ) );2906 ::memcpy( m_puhQTTempTransformSkipFlag[2], pcCU->getTransformSkip(TEXT_CHROMA_V) + uiPartOffset, uiQPartNum * sizeof( UChar ) );2907 }2908 3154 } // Mode loop 2909 3155 #endif … … 2912 3158 uiOverallDistY += uiBestPUDistY; 2913 3159 uiOverallDistC += uiBestPUDistC; 3160 3161 #if H_3D_DIM_SDC 3162 if( bBestUseSDC ) 3163 { 3164 pcCU->setTrIdxSubParts(0, uiPartOffset, uiDepth + uiInitTrDepth); 3165 pcCU->setCbfSubParts(1, 1, 1, uiPartOffset, uiDepth + uiInitTrDepth); 3166 3167 //=== copy best DC segment values back to CU ==== 3168 pcCU->setSDCSegmentDCOffset(apBestDCOffsets[0], 0, uiPartOffset); 3169 pcCU->setSDCSegmentDCOffset(apBestDCOffsets[1], 1, uiPartOffset); 3170 } 3171 else 3172 { 3173 #endif 2914 3174 2915 3175 //--- update transform index and cbf --- … … 2922 3182 ::memcpy( pcCU->getTransformSkip(TEXT_CHROMA_U) + uiPartOffset, m_puhQTTempTransformSkipFlag[1], uiQPartNum * sizeof( UChar ) ); 2923 3183 ::memcpy( pcCU->getTransformSkip(TEXT_CHROMA_V) + uiPartOffset, m_puhQTTempTransformSkipFlag[2], uiQPartNum * sizeof( UChar ) ); 3184 #if H_3D_DIM_SDC 3185 } 3186 #endif 2924 3187 //--- set reconstruction for next intra prediction blocks --- 2925 3188 if( uiPU != uiNumPU - 1 ) … … 2989 3252 //=== update PU data ==== 2990 3253 pcCU->setLumaIntraDirSubParts ( uiBestPUMode, uiPartOffset, uiDepth + uiInitTrDepth ); 3254 #if H_3D_DIM_SDC 3255 pcCU->setSDCFlagSubParts ( bBestUseSDC, uiPartOffset, uiDepth + uiInitTrDepth ); 3256 #endif 2991 3257 pcCU->copyToPic ( uiDepth, uiPU, uiInitTrDepth ); 2992 3258 } // PU loop … … 6729 6995 6730 6996 #if H_3D_DIM_DLT 6731 rDeltaDC1 = (Int)GetDepthValue2Idx( ClipY(predDC1 + rDeltaDC1) ) - (Int)GetDepthValue2Idx(predDC1 );6732 rDeltaDC2 = (Int)GetDepthValue2Idx( ClipY(predDC2 + rDeltaDC2) ) - (Int)GetDepthValue2Idx(predDC2 );6997 rDeltaDC1 = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipY(predDC1 + rDeltaDC1) ) - pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC1 ); 6998 rDeltaDC2 = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipY(predDC2 + rDeltaDC2) ) - pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC2 ); 6733 6999 #endif 6734 7000 } -
branches/HTM-DEV-0.3-dev1/source/Lib/TLibEncoder/TEncSearch.h
r460 r467 352 352 Bool xConstructChainCode ( TComDataCU* pcCU, UInt uiAbsPtIdx, UInt uiWidth, UInt uiHeight ); 353 353 #endif 354 #if H_3D_DIM_SDC 355 Void xIntraCodingSDC ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Bool bResidual ); 356 #endif 354 357 #endif 355 358
Note: See TracChangeset for help on using the changeset viewer.