Changeset 158 in 3DVCSoftware for branches/HTM-4.1-dev2-HHI/source/Lib/TLibCommon
- Timestamp:
- 30 Oct 2012, 12:09:04 (12 years ago)
- Location:
- branches/HTM-4.1-dev2-HHI/source/Lib/TLibCommon
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-4.1-dev2-HHI/source/Lib/TLibCommon/TComPrediction.cpp
r156 r158 2117 2117 { 2118 2118 assert( uiWidth >= DMM_WEDGEMODEL_MIN_SIZE && uiWidth <= DMM_WEDGEMODEL_MAX_SIZE ); 2119 WedgeList* pacWedgeList = &g_aacWedgeLists[(g_aucConvertToBit[uiWidth])];2120 2119 2121 2120 // get copy of co-located texture luma block … … 2136 2135 UInt uiPredStride = cPredYuv.getStride(); 2137 2136 2138 // regularwedge search2137 // wedge search 2139 2138 TComWedgeDist cWedgeDist; 2140 2139 UInt uiBestDist = MAX_UINT; … … 2142 2141 Int iDC1 = 0; 2143 2142 Int iDC2 = 0; 2144 2143 WedgeList* pacWedgeList = &g_aacWedgeLists[(g_aucConvertToBit[uiWidth])]; 2144 2145 #if HHIQC_DMMFASTSEARCH_B0039 2146 TComPic* pcPicTex = pcCU->getSlice()->getTexturePic(); 2147 TComDataCU* pcColTexCU = pcPicTex->getCU(pcCU->getAddr()); 2148 UInt uiTexPartIdx = pcCU->getZorderIdxInCU() + uiAbsPartIdx; 2149 Int uiColTexIntraDir = pcColTexCU->isIntra( uiTexPartIdx ) ? pcColTexCU->getLumaIntraDir( uiTexPartIdx ) : 255; 2150 2151 std::vector< std::vector<UInt> > pauiWdgLstSz = g_aauiWdgLstM3[g_aucConvertToBit[uiWidth]]; 2152 if( uiColTexIntraDir > DC_IDX && uiColTexIntraDir < 35 ) 2153 { 2154 std::vector<UInt>* pauiWdgLst = &pauiWdgLstSz[uiColTexIntraDir-2]; 2155 for( UInt uiIdxW = 0; uiIdxW < pauiWdgLst->size(); uiIdxW++ ) 2156 { 2157 UInt uiIdx = pauiWdgLst->at(uiIdxW); 2158 calcWedgeDCs ( &(pacWedgeList->at(uiIdx)), piRefBlkY, uiWidth, iDC1, iDC2 ); 2159 assignWedgeDCs2Pred( &(pacWedgeList->at(uiIdx)), piPred, uiPredStride, iDC1, iDC2 ); 2160 2161 UInt uiActDist = cWedgeDist.getDistPart( piPred, uiPredStride, piRefBlkY, uiWidth, uiWidth, uiHeight, WedgeDist_SAD ); 2162 2163 if( uiActDist < uiBestDist || uiBestDist == MAX_UINT ) 2164 { 2165 uiBestDist = uiActDist; 2166 uiBestTabIdx = uiIdx; 2167 } 2168 } 2169 } 2170 else 2171 { 2172 WedgeNodeList* pacWedgeNodeList = &g_aacWedgeNodeLists[(g_aucConvertToBit[uiWidth])]; 2173 UInt uiBestNodeDist = MAX_UINT; 2174 UInt uiBestNodeId = 0; 2175 for( UInt uiNodeId = 0; uiNodeId < pacWedgeNodeList->size(); uiNodeId++ ) 2176 { 2177 calcWedgeDCs ( &(pacWedgeList->at(pacWedgeNodeList->at(uiNodeId).getPatternIdx())), piRefBlkY, uiWidth, iDC1, iDC2 ); 2178 assignWedgeDCs2Pred( &(pacWedgeList->at(pacWedgeNodeList->at(uiNodeId).getPatternIdx())), piPred, uiPredStride, iDC1, iDC2 ); 2179 2180 UInt uiActDist = cWedgeDist.getDistPart( piPred, uiPredStride, piRefBlkY, uiWidth, uiWidth, uiHeight, WedgeDist_SAD ); 2181 2182 if( uiActDist < uiBestNodeDist || uiBestNodeDist == MAX_UINT ) 2183 { 2184 uiBestNodeDist = uiActDist; 2185 uiBestNodeId = uiNodeId; 2186 } 2187 } 2188 2189 // refinement 2190 uiBestDist = uiBestNodeDist; 2191 uiBestTabIdx = pacWedgeNodeList->at(uiBestNodeId).getPatternIdx(); 2192 for( UInt uiRefId = 0; uiRefId < NUM_WEDGE_REFINES; uiRefId++ ) 2193 { 2194 if( pacWedgeNodeList->at(uiBestNodeId).getRefineIdx( uiRefId ) != NO_IDX ) 2195 { 2196 calcWedgeDCs ( &(pacWedgeList->at(pacWedgeNodeList->at(uiBestNodeId).getRefineIdx( uiRefId ))), piRefBlkY, uiWidth, iDC1, iDC2 ); 2197 assignWedgeDCs2Pred( &(pacWedgeList->at(pacWedgeNodeList->at(uiBestNodeId).getRefineIdx( uiRefId ))), piPred, uiPredStride, iDC1, iDC2 ); 2198 2199 UInt uiActDist = cWedgeDist.getDistPart( piPred, uiPredStride, piRefBlkY, uiWidth, uiWidth, uiHeight, WedgeDist_SAD ); 2200 2201 if( uiActDist < uiBestDist || uiBestDist == MAX_UINT ) 2202 { 2203 uiBestDist = uiActDist; 2204 uiBestTabIdx = pacWedgeNodeList->at(uiBestNodeId).getRefineIdx( uiRefId ); 2205 } 2206 } 2207 } 2208 } 2209 #else 2145 2210 for( UInt uiIdx = 0; uiIdx < pacWedgeList->size(); uiIdx++ ) 2146 2211 { … … 2156 2221 } 2157 2222 } 2223 #endif 2158 2224 2159 2225 cPredYuv.destroy(); -
branches/HTM-4.1-dev2-HHI/source/Lib/TLibCommon/TComRom.cpp
r77 r158 174 174 g_aacWedgeRefLists.clear(); 175 175 } 176 #if HHIQC_DMMFASTSEARCH_B0039 177 if ( !g_aacWedgeNodeLists.empty() ) 178 { 179 for ( UInt ui = 0; ui < g_aacWedgeNodeLists.size(); ui++ ) 180 { 181 g_aacWedgeNodeLists[ui].clear(); 182 } 183 g_aacWedgeNodeLists.clear(); 184 } 185 #endif 176 186 #endif 177 187 } … … 1170 1180 std::vector< std::vector<TComWedgeRef> > g_aacWedgeRefLists; 1171 1181 1182 #if HHIQC_DMMFASTSEARCH_B0039 1183 std::vector< std::vector< std::vector<UInt> > > g_aauiWdgLstM3; 1184 std::vector< std::vector< TComWedgeNode> > g_aacWedgeNodeLists; 1185 #endif 1186 1172 1187 Void initWedgeLists() 1173 1188 { … … 1180 1195 g_aacWedgeLists.push_back( acWedgeList ); 1181 1196 g_aacWedgeRefLists.push_back( acWedgeRefList ); 1197 1198 #if HHIQC_DMMFASTSEARCH_B0039 1199 // create WedgeNodeList 1200 std::vector<TComWedgeNode> acWedgeNodeList; 1201 for( UInt uiPos = 0; uiPos < acWedgeList.size(); uiPos++ ) 1202 { 1203 if( acWedgeList[uiPos].getIsCoarse() ) 1204 { 1205 TComWedgeNode cWedgeNode; 1206 cWedgeNode.setPatternIdx( uiPos ); 1207 1208 // set refinement idxs 1209 UInt uiRefPos = 0; 1210 for( Int iOffS = -1; iOffS <= 1; iOffS++ ) 1211 { 1212 for( Int iOffE = -1; iOffE <= 1; iOffE++ ) 1213 { 1214 if( iOffS == 0 && iOffE == 0 ) { continue; } 1215 1216 Int iSx = (Int)acWedgeList[uiPos].getStartX(); 1217 Int iSy = (Int)acWedgeList[uiPos].getStartY(); 1218 Int iEx = (Int)acWedgeList[uiPos].getEndX(); 1219 Int iEy = (Int)acWedgeList[uiPos].getEndY(); 1220 1221 switch( acWedgeList[uiPos].getOri() ) 1222 { 1223 case( 0 ): { iSx += iOffS; iEy += iOffE; } break; 1224 case( 1 ): { iSy += iOffS; iEx -= iOffE; } break; 1225 case( 2 ): { iSx -= iOffS; iEy -= iOffE; } break; 1226 case( 3 ): { iSy -= iOffS; iEx += iOffE; } break; 1227 case( 4 ): { iSx += iOffS; iEx += iOffE; } break; 1228 case( 5 ): { iSy += iOffS; iEy += iOffE; } break; 1229 default: assert( 0 ); 1230 } 1231 1232 for( UInt k = 0; k < acWedgeRefList.size(); k++ ) 1233 { 1234 if( iSx == (Int)acWedgeRefList[k].getStartX() && 1235 iSy == (Int)acWedgeRefList[k].getStartY() && 1236 iEx == (Int)acWedgeRefList[k].getEndX() && 1237 iEy == (Int)acWedgeRefList[k].getEndY() ) 1238 { 1239 if( acWedgeRefList[k].getRefIdx() != cWedgeNode.getPatternIdx() ) 1240 { 1241 Bool bNew = true; 1242 for( UInt m = 0; m < uiRefPos; m++ ) { if( acWedgeRefList[k].getRefIdx() == cWedgeNode.getRefineIdx( m ) ) { bNew = false; break; } } 1243 1244 if( bNew ) 1245 { 1246 cWedgeNode.setRefineIdx( acWedgeRefList[k].getRefIdx(), uiRefPos ); 1247 uiRefPos++; 1248 break; 1249 } 1250 } 1251 } 1252 } 1253 } 1254 } 1255 acWedgeNodeList.push_back( cWedgeNode ); 1256 } 1257 } 1258 g_aacWedgeNodeLists.push_back( acWedgeNodeList ); 1259 #endif 1182 1260 } 1183 1261 return; … … 1217 1295 for( Int iL = 0; iL < uiBlockSize; iL++ ) 1218 1296 { 1297 #if HHIQC_DMMFASTSEARCH_B0039 1298 cTempWedgelet.setWedgelet( uhStartX + (iK*iStepStartX) , uhStartY + (iK*iStepStartY), uhEndX + (iL*iStepEndX), uhEndY + (iL*iStepEndY), (UChar)uiOri, eWedgeRes, ((iL%2)==0 && (iK%2)==0) ); 1299 #else 1219 1300 cTempWedgelet.setWedgelet( uhStartX + (iK*iStepStartX) , uhStartY + (iK*iStepStartY), uhEndX + (iL*iStepEndX), uhEndY + (iL*iStepEndY), (UChar)uiOri, eWedgeRes ); 1301 #endif 1220 1302 addWedgeletToList( cTempWedgelet, racWedgeList, racWedgeRefList ); 1221 1303 } 1222 1304 } 1223 1305 } 1306 #if HHIQC_DMMFASTSEARCH_B0039 1307 UInt uiThrSz = DMM3_SIMPLIFY_TR; 1308 1309 std::vector< std::vector<UInt> > auiWdgListSz; 1310 for( Int idxM=2; idxM<=34 ; idxM++) 1311 { 1312 std::vector<UInt> auiWdgList; 1313 for( Int idxW=0; idxW<racWedgeList.size(); idxW++) 1314 { 1315 UInt uiAbsDiff = abs(idxM-(Int)racWedgeList[idxW].getAng()); 1316 if( uiAbsDiff <= uiThrSz ) 1317 { 1318 auiWdgList.push_back(idxW); 1319 } 1320 } 1321 auiWdgListSz.push_back(auiWdgList); 1322 } 1323 g_aauiWdgLstM3.push_back(auiWdgListSz); 1324 #endif 1224 1325 } 1225 1326 … … 1257 1358 if( bValid ) 1258 1359 { 1360 #if HHIQC_DMMFASTSEARCH_B0039 1361 cWedgelet.findClosetAngle(); 1362 #endif 1259 1363 racWedgeList.push_back( cWedgelet ); 1260 1364 TComWedgeRef cWedgeRef; -
branches/HTM-4.1-dev2-HHI/source/Lib/TLibCommon/TComRom.h
r100 r158 193 193 extern std::vector< std::vector<TComWedgeRef> > g_aacWedgeRefLists; 194 194 195 #if HHIQC_DMMFASTSEARCH_B0039 196 extern std::vector< std::vector< std::vector<UInt> > > g_aauiWdgLstM3; 197 extern std::vector< std::vector<TComWedgeNode> > g_aacWedgeNodeLists; 198 #endif 199 195 200 Void initWedgeLists(); 196 201 Void createWedgeList( UInt uiWidth, UInt uiHeight, std::vector<TComWedgelet> &racWedgeList, std::vector<TComWedgeRef> &racWedgeRefList, WedgeResolution eWedgeRes ); -
branches/HTM-4.1-dev2-HHI/source/Lib/TLibCommon/TComWedgelet.cpp
r56 r158 52 52 m_uhOri ( 0 ), 53 53 m_eWedgeRes( FULL_PEL ) 54 #if HHIQC_DMMFASTSEARCH_B0039 55 , m_bIsCoarse( false ) 56 #endif 54 57 { 55 58 create( uiWidth, uiHeight ); … … 62 65 m_uhOri ( rcWedge.m_uhOri ), 63 66 m_eWedgeRes( rcWedge.m_eWedgeRes ), 67 #if HHIQC_DMMFASTSEARCH_B0039 68 m_bIsCoarse( rcWedge.m_bIsCoarse ), 69 m_uiAng ( rcWedge.m_uiAng ), 70 #endif 64 71 m_uiWidth ( rcWedge.m_uiWidth ), 65 72 m_uiHeight ( rcWedge.m_uiHeight ), … … 94 101 } 95 102 103 #if HHIQC_DMMFASTSEARCH_B0039 104 Void TComWedgelet::findClosetAngle() 105 { 106 UInt uiAng=0,uiOptAng=0; 107 UInt uiMinD=MAX_UINT; 108 UInt uiTmpD=0; 109 Int angTable[9] = {0, 2, 5, 9, 13, 17, 21, 26, 32}; 110 111 UChar uhXs = m_uhXs; 112 UChar uhYs = m_uhYs; 113 UChar uhXe = m_uhXe; 114 UChar uhYe = m_uhYe; 115 116 for(uiAng=2; uiAng<=34; uiAng++) 117 { 118 Int iSign = (uiAng<VER_IDX && uiAng>HOR_IDX ) ? -1 : 1; 119 Int iVer = uiAng>17 ? 32 : angTable[(uiAng>10) ? (uiAng-10) : (10-uiAng)]; 120 Int iHor = uiAng<19 ? 32 : angTable[(uiAng>26) ? (uiAng-26) : (26-uiAng)]; 121 122 uiTmpD = abs(iVer*iSign*(uhXs-uhXe) - iHor*(uhYe-uhYs)); 123 124 if( uiTmpD < uiMinD ) 125 { 126 uiMinD = uiTmpD; 127 uiOptAng = uiAng; 128 } 129 } 130 m_uiAng = uiOptAng; 131 } 132 133 Void TComWedgelet::setWedgelet( UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe, UChar uhOri, WedgeResolution eWedgeRes, Bool bIsCoarse ) 134 #else 96 135 Void TComWedgelet::setWedgelet( UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe, UChar uhOri, WedgeResolution eWedgeRes ) 136 #endif 97 137 { 98 138 m_uhXs = uhXs; … … 102 142 m_uhOri = uhOri; 103 143 m_eWedgeRes = eWedgeRes; 144 #if HHIQC_DMMFASTSEARCH_B0039 145 m_bIsCoarse = bIsCoarse; 146 #endif 104 147 105 148 xGenerateWedgePattern(); … … 644 687 case( 2 ): { for( UInt iX = uiTempBlockSize-1; iX > uhXs; iX-- ) { UInt iY = uiTempBlockSize-1; while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iY--; } } } break; 645 688 case( 3 ): { for( UInt iY = uiTempBlockSize-1; iY > uhYs; iY-- ) { UInt iX = 0; while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iX++; } } } break; 689 #if HHIQC_DMMFASTSEARCH_B0039 690 case( 4 ): 691 { 692 if( (uhXs+uhXe) < uiTempBlockSize ) { for( UInt iY = 0; iY < uiTempBlockSize; iY++ ) { UInt iX = 0; while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iX++; } } } 693 else { for( UInt iY = 0; iY < uiTempBlockSize; iY++ ) { UInt iX = uiTempBlockSize-1; while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iX--; } } } 694 } 695 break; 696 case( 5 ): 697 { 698 if( (uhYs+uhYe) < uiTempBlockSize ) { for( UInt iX = 0; iX < uiTempBlockSize; iX++ ) { UInt iY = 0; while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iY++; } } } 699 else { for( UInt iX = 0; iX < uiTempBlockSize; iX++ ) { UInt iY = uiTempBlockSize-1; while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iY--; } } } 700 } 701 #else 646 702 case( 4 ): { for( UInt iY = 0; iY < uiTempBlockSize; iY++ ) { UInt iX = 0; while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iX++; } } } break; 647 703 case( 5 ): { for( UInt iX = 0; iX < uiTempBlockSize; iX++ ) { UInt iY = 0; while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iY++; } } } break; 704 #endif 648 705 } 649 706 … … 664 721 case( 2 ): { uiOffX = 1; uiOffY = 1; } break; 665 722 case( 3 ): { uiOffX = 0; uiOffY = 1; } break; 723 #if HHIQC_DMMFASTSEARCH_B0039 724 case( 4 ): 725 { 726 if( (uhXs+uhXe) < uiTempBlockSize ) { uiOffX = 0; uiOffY = 0; } 727 else { uiOffX = 1; uiOffY = 0; } 728 } 729 break; 730 case( 5 ): 731 { 732 if( (uhYs+uhYe) < uiTempBlockSize ) { uiOffX = 0; uiOffY = 0; } 733 else { uiOffX = 0; uiOffY = 1; } 734 } 735 break; 736 #else 666 737 case( 4 ): { uiOffX = 0; uiOffY = 0; } break; 667 738 case( 5 ): { uiOffX = 0; uiOffY = 0; } break; 739 #endif 668 740 default: { uiOffX = 0; uiOffY = 0; } break; 669 741 } … … 732 804 } 733 805 } 806 807 #if HHIQC_DMMFASTSEARCH_B0039 808 TComWedgeNode::TComWedgeNode() 809 { 810 m_uiPatternIdx = NO_IDX; 811 for( UInt uiPos = 0; uiPos < NUM_WEDGE_REFINES; uiPos++ ) 812 { 813 m_uiRefineIdx[uiPos] = NO_IDX; 814 } 815 } 816 817 UInt TComWedgeNode::getPatternIdx() 818 { 819 return m_uiPatternIdx; 820 } 821 UInt TComWedgeNode::getRefineIdx( UInt uiPos ) 822 { 823 assert( uiPos < NUM_WEDGE_REFINES ); 824 return m_uiRefineIdx[uiPos]; 825 } 826 Void TComWedgeNode::setPatternIdx( UInt uiIdx ) 827 { 828 m_uiPatternIdx = uiIdx; 829 } 830 Void TComWedgeNode::setRefineIdx( UInt uiIdx, UInt uiPos ) 831 { 832 assert( uiPos < NUM_WEDGE_REFINES ); 833 m_uiRefineIdx[uiPos] = uiIdx; 834 } 835 #endif 734 836 735 837 #if HHI_DMM_PRED_TEX -
branches/HTM-4.1-dev2-HHI/source/Lib/TLibCommon/TComWedgelet.h
r116 r158 50 50 }; 51 51 52 #if HHIQC_DMMFASTSEARCH_B0039 53 #define NUM_WEDGE_REFINES 8 54 #define NO_IDX MAX_UINT 55 #endif 56 52 57 // ==================================================================================================================== 53 58 // Class definition TComWedgelet … … 62 67 UChar m_uhOri; // orientation index 63 68 WedgeResolution m_eWedgeRes; // start/end pos resolution 69 #if HHIQC_DMMFASTSEARCH_B0039 70 Bool m_bIsCoarse; 71 UInt m_uiAng; 72 #endif 64 73 65 74 UInt m_uiWidth; … … 90 99 UChar getEndY () { return m_uhYe; } 91 100 UChar getOri () { return m_uhOri; } 92 101 #if HHIQC_DMMFASTSEARCH_B0039 102 Bool getIsCoarse() { return m_bIsCoarse; } 103 UInt getAng () { return m_uiAng; } 104 Void findClosetAngle(); 105 106 Void setWedgelet( UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe, UChar uhOri, WedgeResolution eWedgeRes, Bool bIsCoarse = false ); 107 #else 93 108 Void setWedgelet( UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe, UChar uhOri, WedgeResolution eWedgeRes ); 109 #endif 94 110 95 111 Bool checkNotPlain(); … … 136 152 // type definition wedgelet reference list 137 153 typedef std::vector<TComWedgeRef> WedgeRefList; 154 155 #if HHIQC_DMMFASTSEARCH_B0039 156 // ==================================================================================================================== 157 // Class definition TComWedgeNode 158 // ==================================================================================================================== 159 class TComWedgeNode 160 { 161 private: 162 UInt m_uiPatternIdx; 163 UInt m_uiRefineIdx[NUM_WEDGE_REFINES]; 164 165 public: 166 TComWedgeNode(); 167 virtual ~TComWedgeNode() {} 168 169 UInt getPatternIdx(); 170 UInt getRefineIdx ( UInt uiPos ); 171 172 Void setPatternIdx( UInt uiIdx ); 173 Void setRefineIdx ( UInt uiIdx, UInt uiPos ); 174 }; // END CLASS DEFINITION TComWedgeNode 175 176 // type definition wedgelet node list 177 typedef std::vector<TComWedgeNode> WedgeNodeList; 178 #endif 138 179 139 180 #if HHI_DMM_PRED_TEX -
branches/HTM-4.1-dev2-HHI/source/Lib/TLibCommon/TypeDef.h
r153 r158 127 127 #endif 128 128 129 #define HHIQC_DMMFASTSEARCH_B0039 1 // JCT3V-B0039: fast Wedgelet search for DMM modes 1 and 3 130 #if HHIQC_DMMFASTSEARCH_B0039 131 #define DMM3_SIMPLIFY_TR 1 132 #endif 133 129 134 #define HHI_MPI 1 // motion parameter inheritance from texture picture for depth map coding 130 135 #define HHI_MPI_MERGE_POS 0
Note: See TracChangeset for help on using the changeset viewer.