Changeset 879 in 3DVCSoftware for branches/HTM-10.1-dev0/source/Lib/TLibEncoder/TEncSearch.cpp
- Timestamp:
- 27 Mar 2014, 22:31:12 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-10.1-dev0/source/Lib/TLibEncoder/TEncSearch.cpp
r878 r879 1861 1861 1862 1862 #if H_3D_DIM_SDC 1863 Void TEncSearch::xIntraCodingSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, 1864 Bool bZeroResidual, Int iSDCDeltaResi 1865 ) 1863 Void TEncSearch::xIntraCodingSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Bool bZeroResidual, Int iSDCDeltaResi ) 1866 1864 { 1867 1865 UInt uiLumaPredMode = pcCU ->getLumaIntraDir( uiAbsPartIdx ); 1868 1866 UInt uiWidth = pcCU ->getWidth ( 0 ); 1869 1867 UInt uiHeight = pcCU ->getHeight ( 0 ); 1870 #if QC_PKU_SDC_SPLIT_G01231871 #if HS_TSINGHUA_SDC_SPLIT_G01111872 1868 TComWedgelet* dmm4SegmentationOrg = new TComWedgelet( uiWidth, uiHeight ); 1873 #else1874 #endif1875 #endif1876 #if QC_PKU_SDC_SPLIT_G01231877 1869 UInt numParts = 1; 1878 UInt i = 0;1879 1870 UInt sdcDepth = 0; 1880 1871 UInt uiStride; … … 1887 1878 UInt uiRecIPredStride; 1888 1879 1889 #if HS_TSINGHUA_SDC_SPLIT_G01111890 1880 if ( ( uiWidth >> pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() ) > 1 ) 1891 1881 { … … 1894 1884 uiWidth = uiHeight = ( 1 << pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() ); 1895 1885 } 1896 #else 1897 if (uiWidth == 64) 1898 { 1899 numParts = 4; 1900 sdcDepth = 1; 1901 uiWidth = uiHeight = 32; 1902 } 1903 #endif 1904 1905 for ( i = 0; i < numParts; i++ ) 1886 1887 for ( Int i = 0; i < numParts; i++ ) 1906 1888 { 1907 1889 uiStride = pcOrgYuv ->getStride (); … … 1915 1897 1916 1898 AOF( uiWidth == uiHeight ); 1917 #else 1918 UInt uiStride = pcOrgYuv ->getStride (); 1919 Pel* piOrg = pcOrgYuv ->getLumaAddr( uiAbsPartIdx ); 1920 Pel* piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx ); 1921 Pel* piReco = pcPredYuv->getLumaAddr( uiAbsPartIdx ); 1922 1923 UInt uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; 1924 Pel* piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder ); 1925 UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride (); 1926 1927 AOF( uiWidth == uiHeight ); 1928 AOF( uiAbsPartIdx == 0 ); 1929 AOF( pcCU->getSDCAvailable(uiAbsPartIdx) ); 1930 AOF( pcCU->getSDCFlag(uiAbsPartIdx) ); 1931 #endif 1932 1933 //===== init availability pattern ===== 1934 Bool bAboveAvail = false; 1935 Bool bLeftAvail = false; 1936 #if QC_PKU_SDC_SPLIT_G0123 1937 pcCU->getPattern()->initPattern ( pcCU, sdcDepth, uiAbsPartIdx ); 1938 pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, sdcDepth, m_piYuvExt, m_iYuvExtStride, m_iYuvExtHeight, bAboveAvail, bLeftAvail ); 1939 #else 1940 pcCU->getPattern()->initPattern ( pcCU, 0, uiAbsPartIdx ); 1941 pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, 0, m_piYuvExt, m_iYuvExtStride, m_iYuvExtHeight, bAboveAvail, bLeftAvail ); 1942 1943 #endif 1944 #if !QC_PKU_SDC_SPLIT_G0123 1945 TComWedgelet* dmm4Segmentation = new TComWedgelet( uiWidth, uiHeight ); 1946 #endif 1947 #if HS_TSINGHUA_SDC_SPLIT_G0111 1948 TComWedgelet* dmm4Segmentation = new TComWedgelet( uiWidth, uiHeight ); 1949 #endif 1950 //===== get prediction signal ===== 1951 #if H_3D_DIM 1952 if( isDimMode( uiLumaPredMode ) ) 1953 { 1954 #if HS_TSINGHUA_SDC_SPLIT_G0111 1955 UInt dimType = getDimType ( uiLumaPredMode ); 1956 UInt patternID = pcCU->getDmmWedgeTabIdx(dimType, uiAbsPartIdx); 1957 if ( patternID >= g_dmmWedgeLists[g_aucConvertToBit[uiWidth]].size() && dimType == DMM1_IDX ) 1958 { 1959 if (g_aucConvertToBit[uiWidth] == 2) // Encoder method. Avoid DMM1 pattern list index exceeds the maximum DMM1 pattern number when SDC split is used. 1960 patternID = 1349; // Split 32x32 to 16x16. 1349: Maximum DMM1 pattern number when block size is 16x16 1961 else 1962 patternID = patternID >> 1; // Other cases 1963 pcCU->setDmmWedgeTabIdx(dimType, uiAbsPartIdx, patternID); 1964 } 1965 #endif 1966 predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, true 1967 , dmm4Segmentation 1968 ); 1969 #if HS_TSINGHUA_SDC_SPLIT_G0111 1970 Bool* dmm4PatternSplit = dmm4Segmentation->getPattern(); 1971 Bool* dmm4PatternOrg = dmm4SegmentationOrg->getPattern(); 1972 for( UInt k = 0; k < (uiWidth*uiHeight); k++ ) 1973 { 1974 dmm4PatternOrg[k+(uiAbsPartIdx<<4)] = dmm4PatternSplit[k]; 1975 } 1976 #endif 1977 } 1978 else 1979 { 1980 #endif 1981 predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); 1982 #if H_3D_DIM 1983 } 1984 #endif 1985 #if QC_PKU_SDC_SPLIT_G0123 1899 1900 //===== init availability pattern ===== 1901 Bool bAboveAvail = false; 1902 Bool bLeftAvail = false; 1903 pcCU->getPattern()->initPattern ( pcCU, sdcDepth, uiAbsPartIdx ); 1904 pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, sdcDepth, m_piYuvExt, m_iYuvExtStride, m_iYuvExtHeight, bAboveAvail, bLeftAvail ); 1905 TComWedgelet* dmm4Segmentation = new TComWedgelet( uiWidth, uiHeight ); 1906 //===== get prediction signal ===== 1907 if( isDimMode( uiLumaPredMode ) ) 1908 { 1909 UInt dimType = getDimType ( uiLumaPredMode ); 1910 UInt patternID = pcCU->getDmmWedgeTabIdx(dimType, uiAbsPartIdx); 1911 if ( patternID >= g_dmmWedgeLists[g_aucConvertToBit[uiWidth]].size() && dimType == DMM1_IDX ) 1912 { 1913 if (g_aucConvertToBit[uiWidth] == 2) // Encoder method. Avoid DMM1 pattern list index exceeds the maximum DMM1 pattern number when SDC split is used. 1914 { 1915 patternID = 1349; // Split 32x32 to 16x16. 1349: Maximum DMM1 pattern number when block size is 16x16 1916 } 1917 else 1918 { 1919 patternID = patternID >> 1; // Other cases 1920 } 1921 pcCU->setDmmWedgeTabIdx(dimType, uiAbsPartIdx, patternID); 1922 } 1923 predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, true , dmm4Segmentation ); 1924 Bool* dmm4PatternSplit = dmm4Segmentation->getPattern(); 1925 Bool* dmm4PatternOrg = dmm4SegmentationOrg->getPattern(); 1926 for( UInt k = 0; k < (uiWidth*uiHeight); k++ ) 1927 { 1928 dmm4PatternOrg[k+(uiAbsPartIdx<<4)] = dmm4PatternSplit[k]; 1929 } 1930 } 1931 else 1932 { 1933 predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); 1934 } 1986 1935 if ( numParts > 1 ) 1987 1936 { … … 1998 1947 } 1999 1948 uiAbsPartIdx += ( ( uiWidth * uiWidth ) >> 4 ); 2000 #if HS_TSINGHUA_SDC_SPLIT_G01112001 1949 dmm4Segmentation->destroy(); delete dmm4Segmentation; 2002 #endif2003 1950 } 2004 1951 uiAbsPartIdx = 0; … … 2007 1954 piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx ); 2008 1955 piReco = pcPredYuv->getLumaAddr( uiAbsPartIdx ); 2009 1956 2010 1957 uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx; 2011 1958 piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder ); … … 2017 1964 uiHeight = pcCU->getHeight( 0 ); 2018 1965 } 2019 #endif2020 1966 // number of segments depends on prediction mode 2021 1967 UInt uiNumSegments = 1; 2022 1968 Bool* pbMask = NULL; 2023 1969 UInt uiMaskStride = 0; 2024 1970 2025 1971 if( getDimType( uiLumaPredMode ) == DMM1_IDX ) 2026 1972 { 2027 1973 Int uiTabIdx = pcCU->getDmmWedgeTabIdx(DMM1_IDX, uiAbsPartIdx); 2028 1974 2029 1975 WedgeList* pacWedgeList = &g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])]; 2030 1976 TComWedgelet* pcWedgelet = &(pacWedgeList->at( uiTabIdx )); 2031 1977 2032 1978 uiNumSegments = 2; 2033 1979 pbMask = pcWedgelet->getPattern(); … … 2037 1983 { 2038 1984 uiNumSegments = 2; 2039 #if HS_TSINGHUA_SDC_SPLIT_G0111 2040 pbMask = dmm4SegmentationOrg->getPattern(); 1985 pbMask = dmm4SegmentationOrg->getPattern(); 2041 1986 uiMaskStride = dmm4SegmentationOrg->getStride(); 2042 #else 2043 pbMask = dmm4Segmentation->getPattern(); 2044 uiMaskStride = dmm4Segmentation->getStride(); 2045 #endif 2046 } 2047 1987 } 1988 2048 1989 // get DC prediction for each segment 2049 1990 Pel apDCPredValues[2]; 2050 1991 analyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride, uiLumaPredMode ); 2051 1992 2052 1993 // get original DC for each segment 2053 1994 Pel apDCOrigValues[2]; 2054 1995 analyzeSegmentsSDC(piOrg, uiStride, uiWidth, apDCOrigValues, uiNumSegments, pbMask, uiMaskStride, uiLumaPredMode, true ); 2055 1996 2056 1997 for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ ) 2057 1998 { … … 2076 2017 pcCU->setSDCSegmentDCOffset(pResidualIdx, uiSegment, uiAbsPartIdx); 2077 2018 } 2078 2019 2079 2020 // reconstruct residual based on mask + DC residuals 2080 2021 Pel apDCResiValues[2]; … … 2091 2032 #endif 2092 2033 } 2093 2034 2094 2035 //===== reconstruction ===== 2095 2036 Bool* pMask = pbMask; … … 2097 2038 Pel* pReco = piReco; 2098 2039 Pel* pRecIPred = piRecIPred; 2099 2040 2100 2041 for( UInt uiY = 0; uiY < uiHeight; uiY++ ) 2101 2042 { … … 2106 2047 2107 2048 Pel pResiDC = apDCResiValues[ucSegment]; 2108 2049 2109 2050 pReco [ uiX ] = ClipY( pPred[ uiX ] + pResiDC ); 2110 2051 pRecIPred[ uiX ] = pReco[ uiX ]; … … 2115 2056 pMask += uiMaskStride; 2116 2057 } 2117 2058 2118 2059 // clear UV 2119 2060 UInt uiStrideC = pcPredYuv->getCStride(); 2120 2061 Pel *pRecCb = pcPredYuv->getCbAddr(); 2121 2062 Pel *pRecCr = pcPredYuv->getCrAddr(); 2122 2063 2123 2064 for (Int y=0; y<uiHeight/2; y++) 2124 2065 { … … 2128 2069 pRecCr[x] = 128; 2129 2070 } 2130 2071 2131 2072 pRecCb += uiStrideC; 2132 2073 pRecCr += uiStrideC; 2133 2074 } 2134 2075 2135 2076 //===== determine distortion ===== 2136 2077 #if H_3D_VSO … … 2140 2081 #endif 2141 2082 ruiDist = m_pcRdCost->getDistPart(g_bitDepthY, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight ); 2142 2083 2143 2084 //===== determine rate and r-d cost ===== 2144 2085 m_pcEntropyCoder->resetBits(); 2145 2086 2146 2087 // encode reduced intra header 2147 #if H_3D_DIM_SDC2148 2088 if( !pcCU->getSlice()->isIntra() ) 2149 2089 { … … 2158 2098 m_pcEntropyCoder->encodePartSize( pcCU, 0, pcCU->getDepth( 0 ), true ); 2159 2099 m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true ); 2160 #else 2161 m_pcEntropyCoder->encodePredMode( pcCU, 0, true ); 2162 #endif 2163 2100 2164 2101 // encode pred direction + DC residual data 2165 2102 m_pcEntropyCoder->encodePredInfo( pcCU, 0, true ); 2166 #if H_3D_DIM_SDC2167 2103 Bool bDummy = false; 2168 2104 m_pcEntropyCoder->encodeCoeff( pcCU, 0, pcCU->getDepth( 0 ), uiWidth, uiHeight, bDummy ); 2169 #endif2170 2105 UInt uiBits = m_pcEntropyCoder->getNumberOfWrittenBits(); 2171 2106 2172 2107 #if H_3D_VSO 2173 2108 if ( m_pcRdCost->getUseLambdaScaleVSO()) … … 2176 2111 #endif 2177 2112 dRDCost = m_pcRdCost->calcRdCost( uiBits, ruiDist ); 2178 #if HS_TSINGHUA_SDC_SPLIT_G01112179 2113 dmm4SegmentationOrg->destroy(); delete dmm4SegmentationOrg; 2180 #else2181 dmm4Segmentation->destroy(); delete dmm4Segmentation;2182 #endif2183 2114 } 2184 2115 #endif
Note: See TracChangeset for help on using the changeset viewer.