- Timestamp:
- 29 Aug 2014, 23:48:19 (10 years ago)
- Location:
- branches/SHM-dev/source/Lib
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/Lib/TLibCommon/TComPic.cpp
r869 r880 400 400 #endif 401 401 402 #if WPP_FIX 403 UInt TComPic::getSubstreamForLCUAddr(const UInt uiLCUAddr, const Bool bAddressInRaster, TComSlice *pcSlice) 404 { 405 const Int iNumSubstreams = pcSlice->getPPS()->getNumSubstreams(); 406 UInt uiSubStrm; 407 408 if (iNumSubstreams > 1) // wavefronts, and possibly tiles being used. 409 { 410 TComPicSym &picSym=*(getPicSym()); 411 const UInt uiLCUAddrRaster = bAddressInRaster?uiLCUAddr : picSym.getCUOrderMap(uiLCUAddr); 412 const UInt uiWidthInLCUs = picSym.getFrameWidthInCU(); 413 const UInt uiTileIndex=picSym.getTileIdxMap(uiLCUAddrRaster); 414 const UInt widthInTiles=(picSym.getNumColumnsMinus1()+1); 415 TComTile *pTile=picSym.getTComTile(uiTileIndex); 416 const UInt uiTileStartLCU = pTile->getFirstCUAddr(); 417 const UInt uiTileLCUY = uiTileStartLCU / uiWidthInLCUs; 418 // independent tiles => substreams are "per tile". iNumSubstreams has already been multiplied. 419 const UInt uiLin = uiLCUAddrRaster / uiWidthInLCUs; 420 UInt uiStartingSubstreamForTile=(uiTileLCUY*widthInTiles) + (pTile->getTileHeight()*(uiTileIndex%widthInTiles)); 421 uiSubStrm = uiStartingSubstreamForTile + (uiLin-uiTileLCUY); 422 } 423 else 424 { 425 // dependent tiles => substreams are "per frame". 426 uiSubStrm = 0;//uiLin % iNumSubstreams; // x modulo 1 = 0 ! 427 } 428 return uiSubStrm; 429 } 430 #endif 431 432 402 433 //! \} -
branches/SHM-dev/source/Lib/TLibCommon/TComPic.h
r820 r880 223 223 Void setCurrAuFlag(Bool x) {m_currAuFlag = x; } 224 224 #endif 225 #if WPP_FIX 226 UInt getSubstreamForLCUAddr(const UInt uiLCUAddr, const Bool bAddressInRaster, TComSlice *pcSlice); 227 #endif 225 228 };// END CLASS DEFINITION TComPic 226 229 -
branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h
r877 r880 274 274 AUX_ID = 3, 275 275 }; 276 277 #define WPP_FIX 1 276 278 277 279 /// normative encoder constraints -------- -
branches/SHM-dev/source/Lib/TLibDecoder/TDecSlice.cpp
r834 r880 146 146 UInt uiTilesAcross = rpcPic->getPicSym()->getNumColumnsMinus1()+1; 147 147 TComSlice* pcSlice = rpcPic->getSlice(rpcPic->getCurrSliceIdx()); 148 #if !WPP_FIX 148 149 Int iNumSubstreams = pcSlice->getPPS()->getNumSubstreams(); 150 #endif 149 151 150 152 // delete decoders if already allocated in previous slice … … 193 195 UInt uiWidthInLCUs = rpcPic->getPicSym()->getFrameWidthInCU(); 194 196 //UInt uiHeightInLCUs = rpcPic->getPicSym()->getFrameHeightInCU(); 197 198 #if WPP_FIX 199 UInt uiTileCol; 200 UInt uiTileLCUX; 201 const Bool depSliceSegmentsEnabled = rpcPic->getSlice(rpcPic->getCurrSliceIdx())->getPPS()->getDependentSliceSegmentsEnabledFlag(); 202 const UInt startTileIdx=rpcPic->getPicSym()->getTileIdxMap(iStartCUAddr); 203 TComTile *pCurrentTile=rpcPic->getPicSym()->getTComTile(startTileIdx); 204 UInt uiTileStartLCU = pCurrentTile->getFirstCUAddr(); // Code tidy 205 206 // The first LCU of the slice is the first coded substream, but the global substream number, as calculated by getSubstreamForLCUAddr may be higher. 207 // This calculates the common offset for all substreams in this slice. 208 const UInt subStreamOffset=rpcPic->getSubstreamForLCUAddr(iStartCUAddr, true, pcSlice); 209 #else 195 210 UInt uiCol=0, uiLin=0, uiSubStrm=0; 196 211 … … 201 216 Bool depSliceSegmentsEnabled = rpcPic->getSlice(rpcPic->getCurrSliceIdx())->getPPS()->getDependentSliceSegmentsEnabledFlag(); 202 217 uiTileStartLCU = rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iStartCUAddr))->getFirstCUAddr(); 218 #endif 203 219 if( depSliceSegmentsEnabled ) 204 220 { 221 #if WPP_FIX 222 if( (!rpcPic->getSlice(rpcPic->getCurrSliceIdx())->isNextSlice()) && iStartCUAddr != uiTileStartLCU) // Code tidy // Is this a dependent slice segment and not the start of a tile? 223 #else 205 224 if( (!rpcPic->getSlice(rpcPic->getCurrSliceIdx())->isNextSlice()) && 206 225 iStartCUAddr != rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iStartCUAddr))->getFirstCUAddr()) 226 #endif 207 227 { 208 228 if(pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag()) 209 229 { 230 #if WPP_FIX 231 uiTileCol = startTileIdx % (rpcPic->getPicSym()->getNumColumnsMinus1()+1); // Code tidy 232 #else 210 233 uiTileCol = rpcPic->getPicSym()->getTileIdxMap(iStartCUAddr) % (rpcPic->getPicSym()->getNumColumnsMinus1()+1); 234 #endif 211 235 m_pcBufferSbacDecoders[uiTileCol].loadContexts( CTXMem[1] );//2.LCU 236 #if WPP_FIX 237 if ( pCurrentTile->getTileWidth() < 2) 238 { 239 CTXMem[0]->loadContexts(pcSbacDecoder); // If tile width is less than 2, need to ensure CTX states get initialised to un-adapted CABAC. Set here, to load a few lines later (!) 240 } 241 #else 212 242 if ( (iStartCUAddr%uiWidthInLCUs+1) >= uiWidthInLCUs ) 213 243 { … … 219 249 } 220 250 } 251 #endif 221 252 } 222 253 pcSbacDecoder->loadContexts(CTXMem[0] ); //end of depSlice-1 254 #if WPP_FIX 255 pcSbacDecoders[0].loadContexts(pcSbacDecoder); // The first substream used for the slice will always be 0. (The original code was equivalent) 256 #else 223 257 pcSbacDecoders[uiSubStrm].loadContexts(pcSbacDecoder); 258 #endif 224 259 } 225 260 else … … 239 274 uiTileStartLCU = rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iCUAddr))->getFirstCUAddr(); 240 275 uiTileLCUX = uiTileStartLCU % uiWidthInLCUs; 276 #if WPP_FIX 277 UInt uiCol = iCUAddr % uiWidthInLCUs; 278 UInt uiSubStrm=rpcPic->getSubstreamForLCUAddr(iCUAddr, true, pcSlice)-subStreamOffset; 279 #else 241 280 uiCol = iCUAddr % uiWidthInLCUs; 242 281 // The 'line' is now relative to the 1st line in the slice, not the 1st line in the picture. 243 282 uiLin = (iCUAddr/uiWidthInLCUs)-(iStartCUAddr/uiWidthInLCUs); 283 #endif 244 284 // inherit from TR if necessary, select substream to use. 245 285 if( (pcSlice->getPPS()->getNumSubstreams() > 1) || ( depSliceSegmentsEnabled && (uiCol == uiTileLCUX)&&(pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag()) )) 246 286 { 287 #if !WPP_FIX 247 288 // independent tiles => substreams are "per tile". iNumSubstreams has already been multiplied. 248 289 iNumSubstreamsPerTile = iNumSubstreams/rpcPic->getPicSym()->getNumTiles(); 249 290 uiSubStrm = rpcPic->getPicSym()->getTileIdxMap(iCUAddr)*iNumSubstreamsPerTile 250 291 + uiLin%iNumSubstreamsPerTile; 292 #endif 251 293 m_pcEntropyDecoder->setBitstream( ppcSubstreams[uiSubStrm] ); 252 294 // Synchronize cabac probabilities with upper-right LCU if it's available and we're at the start of a line. … … 280 322 pcSbacDecoder->load(&pcSbacDecoders[uiSubStrm]); //this load is used to simplify the code (avoid to change all the call to pcSbacDecoders) 281 323 } 324 #if !WPP_FIX 282 325 else if ( pcSlice->getPPS()->getNumSubstreams() <= 1 ) 283 326 { … … 285 328 iNumSubstreamsPerTile = 1; 286 329 } 330 #endif 287 331 288 332 if ( (iCUAddr == rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iCUAddr))->getFirstCUAddr()) && // 1st in tile. -
branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
r878 r880 2427 2427 } 2428 2428 UInt numEntryPointOffsets = 0, offsetLenMinus1 = 0, maxOffset = 0; 2429 #if !WPP_FIX 2429 2430 Int numZeroSubstreamsAtStartOfSlice = 0; 2431 #endif 2430 2432 UInt *entryPointOffset = NULL; 2431 2433 if ( pSlice->getPPS()->getTilesEnabledFlag() ) … … 2454 2456 UInt* pSubstreamSizes = pSlice->getSubstreamSizes(); 2455 2457 Int maxNumParts = pSlice->getPic()->getNumPartInCU(); 2458 #if WPP_FIX 2459 Int numZeroSubstreamsAtStartOfSlice = pSlice->getPic()->getSubstreamForLCUAddr(pSlice->getSliceSegmentCurStartCUAddr()/maxNumParts, false, pSlice); 2460 Int subStreamOfLastSegmentOfSlice = pSlice->getPic()->getSubstreamForLCUAddr((pSlice->getSliceSegmentCurEndCUAddr()/maxNumParts)-1, false, pSlice); 2461 numEntryPointOffsets = subStreamOfLastSegmentOfSlice-numZeroSubstreamsAtStartOfSlice; 2462 #else 2456 2463 numZeroSubstreamsAtStartOfSlice = pSlice->getSliceSegmentCurStartCUAddr()/maxNumParts/pSlice->getPic()->getFrameWidthInCU(); 2457 2464 Int numZeroSubstreamsAtEndOfSlice = pSlice->getPic()->getFrameHeightInCU()-1 - ((pSlice->getSliceSegmentCurEndCUAddr()-1)/maxNumParts/pSlice->getPic()->getFrameWidthInCU()); 2458 2465 numEntryPointOffsets = pSlice->getPPS()->getNumSubstreams() - numZeroSubstreamsAtStartOfSlice - numZeroSubstreamsAtEndOfSlice - 1; 2466 #endif 2459 2467 pSlice->setNumEntryPointOffsets(numEntryPointOffsets); 2460 2468 entryPointOffset = new UInt[numEntryPointOffsets]; -
branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r877 r880 2086 2086 2087 2087 // Allocate some coders, now we know how many tiles there are. 2088 #if WPP_FIX 2089 const Int iNumSubstreams = pcSlice->getPPS()->getNumSubstreams(); 2090 #else 2088 2091 Int iNumSubstreams = pcSlice->getPPS()->getNumSubstreams(); 2092 #endif 2089 2093 2090 2094 //generate the Coding Order Map and Inverse Coding Order Map … … 2799 2803 m_pcEntropyCoder->setEntropyCoder ( m_pcSbacCoder, pcSlice ); 2800 2804 m_pcEntropyCoder->resetEntropy (); 2805 #if WPP_FIX 2806 for ( UInt ui = 0 ; ui < iNumSubstreams ; ui++ ) 2807 #else 2801 2808 for ( UInt ui = 0 ; ui < pcSlice->getPPS()->getNumSubstreams() ; ui++ ) 2809 #endif 2802 2810 { 2803 2811 m_pcEntropyCoder->setEntropyCoder ( &pcSbacCoders[ui], pcSlice ); … … 2811 2819 m_pcSbacCoder->init( (TEncBinIf*)m_pcBinCABAC ); 2812 2820 { 2821 #if WPP_FIX 2822 for ( UInt ui = 0 ; ui < iNumSubstreams ; ui++ ) 2823 #else 2813 2824 for ( UInt ui = 0 ; ui < pcSlice->getPPS()->getNumSubstreams() ; ui++ ) 2825 #endif 2814 2826 { 2815 2827 m_pcEntropyCoder->setEntropyCoder ( &pcSbacCoders[ui], pcSlice ); … … 2838 2850 2839 2851 pcSlice->setTileOffstForMultES( uiOneBitstreamPerSliceLength ); 2840 2852 pcSlice->setTileLocationCount ( 0 ); 2841 2853 m_pcSliceEncoder->encodeSlice(pcPic, pcSubstreamsOut); 2842 2854 … … 2865 2877 2866 2878 Bool bNextSubstreamInNewTile = ((ui+1) < iNumSubstreams)&& ((ui+1)%uiNumSubstreamsPerTile == 0); 2879 #if WPP_FIX 2880 if (bNextSubstreamInNewTile && !pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag() ) 2881 #else 2867 2882 if (bNextSubstreamInNewTile) 2883 #endif 2868 2884 { 2869 2885 pcSlice->setTileLocation(ui/uiNumSubstreamsPerTile, pcSlice->getTileOffstForMultES()+(uiTotalCodedSize>>3)); 2870 2886 } 2887 #if WPP_FIX 2888 if (ui+1 < iNumSubstreams) 2889 { 2890 puiSubstreamSizes[ui] = pcSubstreamsOut[ui].getNumberOfWrittenBits() + (pcSubstreamsOut[ui].countStartCodeEmulations()<<3); 2891 } 2892 #else 2871 2893 if (ui+1 < pcSlice->getPPS()->getNumSubstreams()) 2872 2894 { 2873 2895 puiSubstreamSizes[ui] = pcSubstreamsOut[ui].getNumberOfWrittenBits() + (pcSubstreamsOut[ui].countStartCodeEmulations()<<3); 2874 2896 } 2897 #endif 2875 2898 } 2876 2899 … … 2889 2912 // Substreams... 2890 2913 TComOutputBitstream *pcOut = pcBitstreamRedirect; 2891 Int offs = 0; 2914 #if WPP_FIX 2915 Int numZeroSubstreamsAtStartOfSlice = 0; 2916 Int numSubstreamsToCode = pcSlice->getPPS()->getNumSubstreams(); 2917 if (pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag()) 2918 { 2919 Int maxNumParts = pcPic->getNumPartInCU(); 2920 numZeroSubstreamsAtStartOfSlice = pcPic->getSubstreamForLCUAddr(pcSlice->getSliceSegmentCurStartCUAddr()/maxNumParts, false, pcSlice); 2921 // 1st line present for WPP. 2922 numSubstreamsToCode = pcSlice->getNumEntryPointOffsets()+1; 2923 } 2924 for ( UInt ui = 0 ; ui < numSubstreamsToCode; ui++ ) 2925 { 2926 pcOut->addSubstream(&pcSubstreamsOut[ui+numZeroSubstreamsAtStartOfSlice]); 2927 } 2928 #else 2929 Int offs = 0; 2892 2930 Int nss = pcSlice->getPPS()->getNumSubstreams(); 2893 2931 if (pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag()) … … 2901 2939 pcOut->addSubstream(&pcSubstreamsOut[ui+offs]); 2902 2940 } 2941 #endif 2903 2942 } 2904 2943 -
branches/SHM-dev/source/Lib/TLibEncoder/TEncSlice.cpp
r713 r880 836 836 Void TEncSlice::compressSlice( TComPic*& rpcPic ) 837 837 { 838 #if !WPP_FIX 838 839 UInt uiCUAddr; 840 #endif 839 841 UInt uiStartCUAddr; 840 842 UInt uiBoundingCUAddr; … … 907 909 TEncSbac**** ppppcRDSbacCoders = pcEncTop->getRDSbacCoders(); 908 910 TComBitCounter* pcBitCounters = pcEncTop->getBitCounters(); 911 #if WPP_FIX 912 const Int iNumSubstreams = pcSlice->getPPS()->getNumSubstreams(); 913 const UInt uiTilesAcross = rpcPic->getPicSym()->getNumColumnsMinus1()+1; 914 #else 909 915 Int iNumSubstreams = 1; 910 916 UInt uiTilesAcross = 0; … … 912 918 iNumSubstreams = pcSlice->getPPS()->getNumSubstreams(); 913 919 uiTilesAcross = rpcPic->getPicSym()->getNumColumnsMinus1()+1; 920 #endif 914 921 delete[] m_pcBufferSbacCoders; 915 922 delete[] m_pcBufferBinCoderCABACs; … … 943 950 UInt uiWidthInLCUs = rpcPic->getPicSym()->getFrameWidthInCU(); 944 951 //UInt uiHeightInLCUs = rpcPic->getPicSym()->getFrameHeightInCU(); 952 #if WPP_FIX 953 UInt uiTileCol = 0; 954 Bool depSliceSegmentsEnabled = pcSlice->getPPS()->getDependentSliceSegmentsEnabledFlag(); 955 UInt uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 956 UInt currentTileIdx = rpcPic->getPicSym()->getTileIdxMap(uiCUAddr); 957 TComTile *pCurrentTile = rpcPic->getPicSym()->getTComTile(currentTileIdx); 958 UInt uiTileStartLCU = pCurrentTile->getFirstCUAddr(); 959 #else 945 960 UInt uiCol=0, uiLin=0, uiSubStrm=0; 946 961 UInt uiTileCol = 0; … … 950 965 uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 951 966 uiTileStartLCU = rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(uiCUAddr))->getFirstCUAddr(); 967 #endif 952 968 if( depSliceSegmentsEnabled ) 953 969 { 954 970 if((pcSlice->getSliceSegmentCurStartCUAddr()!= pcSlice->getSliceCurStartCUAddr())&&(uiCUAddr != uiTileStartLCU)) 955 971 { 972 #if WPP_FIX 973 UInt uiSubStrm=0; 974 #endif 956 975 if( m_pcCfg->getWaveFrontsynchro() ) 957 976 { 977 #if WPP_FIX 978 uiTileCol = currentTileIdx % (rpcPic->getPicSym()->getNumColumnsMinus1()+1); 979 m_pcBufferSbacCoders[uiTileCol].loadContexts( CTXMem[1] ); 980 //uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 981 uiSubStrm=rpcPic->getSubstreamForLCUAddr(uiCUAddr, true, pcSlice); 982 if ( pCurrentTile->getTileWidth() < 2) 983 { 984 CTXMem[0]->loadContexts(m_pcSbacCoder); 985 } 986 #else 958 987 uiTileCol = rpcPic->getPicSym()->getTileIdxMap(uiCUAddr) % (rpcPic->getPicSym()->getNumColumnsMinus1()+1); 959 988 m_pcBufferSbacCoders[uiTileCol].loadContexts( CTXMem[1] ); … … 972 1001 } 973 1002 } 1003 #endif 974 1004 } 975 1005 m_pppcRDSbacCoder[0][CI_CURR_BEST]->loadContexts( CTXMem[0] ); … … 998 1028 uiTileCol = rpcPic->getPicSym()->getTileIdxMap(uiCUAddr) % (rpcPic->getPicSym()->getNumColumnsMinus1()+1); // what column of tiles are we in? 999 1029 uiTileStartLCU = rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(uiCUAddr))->getFirstCUAddr(); 1030 #if WPP_FIX 1031 UInt uiTileLCUX = uiTileStartLCU % uiWidthInLCUs; 1032 //UInt uiSliceStartLCU = pcSlice->getSliceCurStartCUAddr(); 1033 UInt uiCol = uiCUAddr % uiWidthInLCUs; 1034 UInt uiSubStrm=rpcPic->getSubstreamForLCUAddr(uiCUAddr, true, pcSlice); 1035 1036 if ( ((iNumSubstreams > 1) || depSliceSegmentsEnabled ) && (uiCol == uiTileLCUX) && m_pcCfg->getWaveFrontsynchro()) 1037 #else 1000 1038 uiTileLCUX = uiTileStartLCU % uiWidthInLCUs; 1001 1039 //UInt uiSliceStartLCU = pcSlice->getSliceCurStartCUAddr(); … … 1015 1053 } 1016 1054 if ( ((pcSlice->getPPS()->getNumSubstreams() > 1) || depSliceSegmentsEnabled ) && (uiCol == uiTileLCUX) && m_pcCfg->getWaveFrontsynchro()) 1055 #endif 1017 1056 { 1018 1057 // We'll sync if the TR is available. … … 1138 1177 ppppcRDSbacCoders[uiSubStrm][0][CI_CURR_BEST]->load( m_pppcRDSbacCoder[0][CI_CURR_BEST] ); 1139 1178 //Store probabilties of second LCU in line into buffer 1179 #if WPP_FIX 1180 if ( ( uiCol == uiTileLCUX+1) && (depSliceSegmentsEnabled || (iNumSubstreams > 1)) && m_pcCfg->getWaveFrontsynchro()) 1181 #else 1140 1182 if ( ( uiCol == uiTileLCUX+1) && (depSliceSegmentsEnabled || (pcSlice->getPPS()->getNumSubstreams() > 1)) && m_pcCfg->getWaveFrontsynchro()) 1183 #endif 1141 1184 { 1142 1185 m_pcBufferSbacCoders[uiTileCol].loadContexts(ppppcRDSbacCoders[uiSubStrm][0][CI_CURR_BEST]); … … 1177 1220 m_uiPicDist += pcCU->getTotalDistortion(); 1178 1221 } 1222 #if WPP_FIX 1223 if ((iNumSubstreams > 1) && !depSliceSegmentsEnabled) 1224 #else 1179 1225 if ((pcSlice->getPPS()->getNumSubstreams() > 1) && !depSliceSegmentsEnabled) 1226 #endif 1180 1227 { 1181 1228 pcSlice->setNextSlice( true ); … … 1239 1286 TEncTop* pcEncTop = (TEncTop*) m_pcCfg; 1240 1287 TEncSbac* pcSbacCoders = pcEncTop->getSbacCoders(); //coder for each substream 1288 #if WPP_FIX 1289 const Int iNumSubstreams = pcSlice->getPPS()->getNumSubstreams(); 1290 #else 1241 1291 Int iNumSubstreams = pcSlice->getPPS()->getNumSubstreams(); 1292 #endif 1242 1293 UInt uiBitsOriginallyInSubstreams = 0; 1243 1294 { … … 1268 1319 an encoding order index, so we need to convert the index (uiStartCUAddr) 1269 1320 into the real raster scan address (uiCUAddr) via the CUOrderMap */ 1321 #if WPP_FIX 1322 UInt currentTileIdx=rpcPic->getPicSym()->getTileIdxMap(uiCUAddr); 1323 TComTile *pCurrentTile=rpcPic->getPicSym()->getTComTile(currentTileIdx); 1324 uiTileStartLCU = pCurrentTile->getFirstCUAddr(); 1325 #else 1270 1326 uiTileStartLCU = rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(uiCUAddr))->getFirstCUAddr(); 1327 #endif 1271 1328 if( depSliceSegmentsEnabled ) 1272 1329 { 1330 #if WPP_FIX 1331 if( pcSlice->isNextSlice()|| uiCUAddr == uiTileStartLCU) 1332 #else 1273 1333 if( pcSlice->isNextSlice()|| 1274 1334 uiCUAddr == rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(uiCUAddr))->getFirstCUAddr()) 1335 #endif 1275 1336 { 1276 1337 if(m_pcCfg->getWaveFrontsynchro()) … … 1284 1345 if(m_pcCfg->getWaveFrontsynchro()) 1285 1346 { 1347 #if WPP_FIX 1348 uiTileCol = currentTileIdx % (rpcPic->getPicSym()->getNumColumnsMinus1()+1); 1349 #else 1286 1350 uiTileCol = rpcPic->getPicSym()->getTileIdxMap(uiCUAddr) % (rpcPic->getPicSym()->getNumColumnsMinus1()+1); 1351 #endif 1287 1352 m_pcBufferSbacCoders[uiTileCol].loadContexts( CTXMem[1] ); 1353 #if WPP_FIX 1354 uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 1355 uiSubStrm=rpcPic->getSubstreamForLCUAddr(uiCUAddr, true, pcSlice); 1356 if ( pCurrentTile->getTileWidth() < 2) 1357 { 1358 CTXMem[0]->loadContexts(m_pcSbacCoder); 1359 } 1360 #else 1288 1361 Int iNumSubstreamsPerTile = iNumSubstreams/rpcPic->getPicSym()->getNumTiles(); 1289 1362 uiLin = uiCUAddr / uiWidthInLCUs; … … 1299 1372 } 1300 1373 } 1374 #endif 1301 1375 } 1302 1376 pcSbacCoders[uiSubStrm].loadContexts( CTXMem[0] ); … … 1315 1389 uiCol = uiCUAddr % uiWidthInLCUs; 1316 1390 uiLin = uiCUAddr / uiWidthInLCUs; 1391 #if WPP_FIX 1392 uiSubStrm=rpcPic->getSubstreamForLCUAddr(uiCUAddr, true, pcSlice); 1393 #else 1317 1394 if (pcSlice->getPPS()->getNumSubstreams() > 1) 1318 1395 { … … 1327 1404 uiSubStrm = uiLin % iNumSubstreams; 1328 1405 } 1406 #endif 1329 1407 1330 1408 m_pcEntropyCoder->setBitstream( &pcSubstreams[uiSubStrm] ); 1331 1409 // Synchronize cabac probabilities with upper-right LCU if it's available and we're at the start of a line. 1410 #if WPP_FIX 1411 if (((iNumSubstreams > 1) || depSliceSegmentsEnabled) && (uiCol == uiTileLCUX) && m_pcCfg->getWaveFrontsynchro()) 1412 #else 1332 1413 if (((pcSlice->getPPS()->getNumSubstreams() > 1) || depSliceSegmentsEnabled) && (uiCol == uiTileLCUX) && m_pcCfg->getWaveFrontsynchro()) 1414 #endif 1333 1415 { 1334 1416 // We'll sync if the TR is available. … … 1368 1450 // When tiles are independent, we have "substreams per tile". Each substream has already been terminated, and we no longer 1369 1451 // have to perform it here. 1452 #if WPP_FIX 1453 if (iNumSubstreams <= 1) 1454 #else 1370 1455 if (pcSlice->getPPS()->getNumSubstreams() > 1) 1371 1456 { … … 1373 1458 } 1374 1459 else 1460 #endif 1375 1461 { 1376 1462 SliceType sliceType = pcSlice->getSliceType(); … … 1448 1534 pcSbacCoders[uiSubStrm].load(m_pcSbacCoder); //load back status of the entropy coder after encoding the LCU into relevant bitstream entropy coder 1449 1535 //Store probabilties of second LCU in line into buffer 1536 #if WPP_FIX 1537 if ( (depSliceSegmentsEnabled || (iNumSubstreams > 1)) && (uiCol == uiTileLCUX+1) && m_pcCfg->getWaveFrontsynchro()) 1538 #else 1450 1539 if ( (depSliceSegmentsEnabled || (pcSlice->getPPS()->getNumSubstreams() > 1)) && (uiCol == uiTileLCUX+1) && m_pcCfg->getWaveFrontsynchro()) 1540 #endif 1451 1541 { 1452 1542 m_pcBufferSbacCoders[uiTileCol].loadContexts( &pcSbacCoders[uiSubStrm] ); … … 1480 1570 } 1481 1571 1572 #if WPP_FIX 1573 Void TEncSlice::calculateBoundingCUAddrForSlice(UInt &uiStartCUAddrSlice, UInt &uiBoundingCUAddrSlice, Bool &bReachedTileBoundary, TComPic*& rpcPic, Bool bEncodeSlice, Int sliceMode, Int sliceArgument, UInt uiSliceCurEndCUAddr) 1574 { 1575 TComSlice* pcSlice = rpcPic->getSlice(getSliceIdx()); 1576 UInt uiNumberOfCUsInFrame = rpcPic->getNumCUsInFrame(); 1577 const UInt scaleCUAddr = rpcPic->getNumPartInCU(); // due to fine granularity slices all addresses are scaled. 1578 uiBoundingCUAddrSlice=0; 1579 bReachedTileBoundary=false; 1580 1581 switch (sliceMode) 1582 { 1583 case FIXED_NUMBER_OF_LCU: 1584 { 1585 UInt uiCUAddrIncrement = sliceArgument; 1586 uiBoundingCUAddrSlice = ((uiStartCUAddrSlice + uiCUAddrIncrement) < uiNumberOfCUsInFrame*scaleCUAddr) ? (uiStartCUAddrSlice + uiCUAddrIncrement) : uiNumberOfCUsInFrame*scaleCUAddr; 1587 } 1588 break; 1589 case FIXED_NUMBER_OF_BYTES: 1590 if (bEncodeSlice) 1591 uiBoundingCUAddrSlice = uiSliceCurEndCUAddr; 1592 else 1593 uiBoundingCUAddrSlice = uiNumberOfCUsInFrame*scaleCUAddr; 1594 break; 1595 case FIXED_NUMBER_OF_TILES: 1596 { 1597 UInt tileIdx = rpcPic->getPicSym()->getTileIdxMap( rpcPic->getPicSym()->getCUOrderMap(uiStartCUAddrSlice/scaleCUAddr) ); 1598 UInt uiCUAddrIncrement = 0; 1599 UInt tileTotalCount = (rpcPic->getPicSym()->getNumColumnsMinus1()+1) * (rpcPic->getPicSym()->getNumRowsMinus1()+1); 1600 1601 for(UInt tileIdxIncrement = 0; tileIdxIncrement < sliceArgument; tileIdxIncrement++) 1602 { 1603 if((tileIdx + tileIdxIncrement) < tileTotalCount) 1604 { 1605 UInt tileWidthInLcu = rpcPic->getPicSym()->getTComTile(tileIdx + tileIdxIncrement)->getTileWidth(); 1606 UInt tileHeightInLcu = rpcPic->getPicSym()->getTComTile(tileIdx + tileIdxIncrement)->getTileHeight(); 1607 uiCUAddrIncrement += (tileWidthInLcu * tileHeightInLcu * scaleCUAddr); 1608 } 1609 } 1610 1611 uiBoundingCUAddrSlice = ((uiStartCUAddrSlice + uiCUAddrIncrement) < uiNumberOfCUsInFrame*scaleCUAddr) ? (uiStartCUAddrSlice + uiCUAddrIncrement) : uiNumberOfCUsInFrame*scaleCUAddr; 1612 } 1613 break; 1614 default: 1615 uiBoundingCUAddrSlice = uiNumberOfCUsInFrame*scaleCUAddr; 1616 break; 1617 } 1618 1619 // Adjust for tiles and wavefronts. 1620 if ((sliceMode == FIXED_NUMBER_OF_LCU || sliceMode == FIXED_NUMBER_OF_BYTES) && 1621 (m_pcCfg->getNumRowsMinus1() > 0 || m_pcCfg->getNumColumnsMinus1() > 0)) 1622 { 1623 const UInt lcuEncAddrStart = (uiStartCUAddrSlice+scaleCUAddr-1)/scaleCUAddr; 1624 const UInt lcuAddr = rpcPic->getPicSym()->getCUOrderMap(lcuEncAddrStart); 1625 const UInt startTileIdx = rpcPic->getPicSym()->getTileIdxMap(lcuAddr); 1626 const Bool bWavefrontsEnabled = m_pcCfg->getWaveFrontsynchro(); 1627 1628 TComTile *pStartingTile = rpcPic->getPicSym()->getTComTile(startTileIdx); 1629 const UInt uiTileStartLCUEncAddr = rpcPic->getPicSym()->getInverseCUOrderMap(pStartingTile->getFirstCUAddr()); 1630 const UInt uiTileStartWidth = pStartingTile->getTileWidth(); 1631 const UInt uiTileStartHeight = pStartingTile->getTileHeight(); 1632 const UInt uiTileLastLCUEncAddr_excl = uiTileStartLCUEncAddr + uiTileStartWidth*uiTileStartHeight; 1633 const UInt tileBoundingCUAddrSlice = uiTileLastLCUEncAddr_excl * scaleCUAddr; 1634 1635 const UInt lcuColumnOfStartingTile=((lcuEncAddrStart-uiTileStartLCUEncAddr)%uiTileStartWidth); 1636 if (bWavefrontsEnabled && lcuColumnOfStartingTile!=0) 1637 { 1638 // WPP: if a slice does not start at the beginning of a CTB row, it must end within the same CTB row 1639 const UInt numberOfLCUsToEndOfRow=uiTileStartWidth-lcuColumnOfStartingTile; 1640 const UInt wavefrontTileBoundingCUAddrSlice = (lcuEncAddrStart+numberOfLCUsToEndOfRow)*scaleCUAddr; 1641 if (wavefrontTileBoundingCUAddrSlice < uiBoundingCUAddrSlice) 1642 { 1643 uiBoundingCUAddrSlice = wavefrontTileBoundingCUAddrSlice; 1644 } 1645 } 1646 1647 if (tileBoundingCUAddrSlice < uiBoundingCUAddrSlice) 1648 { 1649 uiBoundingCUAddrSlice = tileBoundingCUAddrSlice; 1650 bReachedTileBoundary = true; 1651 } 1652 } 1653 else if (pcSlice->getPPS()->getNumSubstreams() > 1 && (uiStartCUAddrSlice % (rpcPic->getFrameWidthInCU()*scaleCUAddr) != 0)) 1654 { 1655 // WPP: if a slice does not start at the beginning of a CTB row, it must end within the same CTB row 1656 uiBoundingCUAddrSlice = min(uiBoundingCUAddrSlice, uiStartCUAddrSlice - (uiStartCUAddrSlice % (rpcPic->getFrameWidthInCU()*scaleCUAddr)) + (rpcPic->getFrameWidthInCU()*scaleCUAddr)); 1657 } 1658 1659 //calculate real slice start address (fine granularity slices) 1660 { 1661 UInt uiInternalAddress = rpcPic->getPicSym()->getPicSCUAddr(uiStartCUAddrSlice) % scaleCUAddr; 1662 UInt uiExternalAddress = rpcPic->getPicSym()->getPicSCUAddr(uiStartCUAddrSlice) / scaleCUAddr; 1663 UInt uiPosX = ( uiExternalAddress % rpcPic->getFrameWidthInCU() ) * g_uiMaxCUWidth+ g_auiRasterToPelX[ g_auiZscanToRaster[uiInternalAddress] ]; 1664 UInt uiPosY = ( uiExternalAddress / rpcPic->getFrameWidthInCU() ) * g_uiMaxCUHeight+ g_auiRasterToPelY[ g_auiZscanToRaster[uiInternalAddress] ]; 1665 #if REPN_FORMAT_IN_VPS 1666 UInt uiWidth = pcSlice->getPicWidthInLumaSamples(); 1667 UInt uiHeight = pcSlice->getPicHeightInLumaSamples(); 1668 #else 1669 UInt uiWidth = pcSlice->getSPS()->getPicWidthInLumaSamples(); 1670 UInt uiHeight = pcSlice->getSPS()->getPicHeightInLumaSamples(); 1671 #endif 1672 while((uiPosX>=uiWidth||uiPosY>=uiHeight)&&!(uiPosX>=uiWidth&&uiPosY>=uiHeight)) 1673 { 1674 uiInternalAddress++; 1675 if(uiInternalAddress>=scaleCUAddr) 1676 { 1677 uiInternalAddress=0; 1678 uiExternalAddress = rpcPic->getPicSym()->getCUOrderMap(rpcPic->getPicSym()->getInverseCUOrderMap(uiExternalAddress)+1); 1679 } 1680 uiPosX = ( uiExternalAddress % rpcPic->getFrameWidthInCU() ) * g_uiMaxCUWidth+ g_auiRasterToPelX[ g_auiZscanToRaster[uiInternalAddress] ]; 1681 uiPosY = ( uiExternalAddress / rpcPic->getFrameWidthInCU() ) * g_uiMaxCUHeight+ g_auiRasterToPelY[ g_auiZscanToRaster[uiInternalAddress] ]; 1682 } 1683 UInt uiRealStartAddress = rpcPic->getPicSym()->getPicSCUEncOrder(uiExternalAddress*scaleCUAddr+uiInternalAddress); 1684 1685 uiStartCUAddrSlice=uiRealStartAddress; 1686 } 1687 } 1688 1689 /** Determines the starting and bounding LCU address of current slice / dependent slice 1690 * \param bEncodeSlice Identifies if the calling function is compressSlice() [false] or encodeSlice() [true] 1691 * \returns Updates uiStartCUAddr, uiBoundingCUAddr with appropriate LCU address 1692 */ 1693 Void TEncSlice::xDetermineStartAndBoundingCUAddr ( UInt& startCUAddr, UInt& boundingCUAddr, TComPic*& rpcPic, Bool bEncodeSlice ) 1694 { 1695 TComSlice* pcSlice = rpcPic->getSlice(getSliceIdx()); 1696 1697 // Non-dependent slice 1698 UInt uiStartCUAddrSlice = pcSlice->getSliceCurStartCUAddr(); 1699 Bool bTileBoundarySlice = false; 1700 UInt uiBoundingCUAddrSlice; 1701 calculateBoundingCUAddrForSlice(uiStartCUAddrSlice, uiBoundingCUAddrSlice, bTileBoundarySlice, rpcPic, bEncodeSlice, m_pcCfg->getSliceMode(), m_pcCfg->getSliceArgument(), pcSlice->getSliceCurEndCUAddr()); 1702 pcSlice->setSliceCurEndCUAddr( uiBoundingCUAddrSlice ); 1703 pcSlice->setSliceCurStartCUAddr(uiStartCUAddrSlice); 1704 1705 // Dependent slice 1706 UInt startCUAddrSliceSegment = pcSlice->getSliceSegmentCurStartCUAddr(); 1707 Bool bTileBoundarySliceSegment = false; 1708 UInt boundingCUAddrSliceSegment; 1709 calculateBoundingCUAddrForSlice(startCUAddrSliceSegment, boundingCUAddrSliceSegment, bTileBoundarySliceSegment, rpcPic, bEncodeSlice, m_pcCfg->getSliceSegmentMode(), m_pcCfg->getSliceSegmentArgument(), pcSlice->getSliceSegmentCurEndCUAddr()); 1710 pcSlice->setSliceSegmentCurEndCUAddr( boundingCUAddrSliceSegment ); 1711 pcSlice->setSliceSegmentCurStartCUAddr(startCUAddrSliceSegment); 1712 1713 // Make a joint decision based on reconstruction and dependent slice bounds 1714 startCUAddr = max(uiStartCUAddrSlice , startCUAddrSliceSegment ); 1715 boundingCUAddr = min(uiBoundingCUAddrSlice, boundingCUAddrSliceSegment); 1716 1717 1718 if (!bEncodeSlice) 1719 { 1720 // For fixed number of LCU within an entropy and reconstruction slice we already know whether we will encounter end of entropy and/or reconstruction slice 1721 // first. Set the flags accordingly. 1722 if ( (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU) 1723 || (m_pcCfg->getSliceMode()==0 && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU) 1724 || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==0) 1725 || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU) 1726 || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceSegmentMode()==0) 1727 || (m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceMode()==0) 1728 || bTileBoundarySlice || bTileBoundarySliceSegment ) 1729 { 1730 if (uiBoundingCUAddrSlice < boundingCUAddrSliceSegment) 1731 { 1732 pcSlice->setNextSlice ( true ); 1733 pcSlice->setNextSliceSegment( false ); 1734 } 1735 else if (uiBoundingCUAddrSlice > boundingCUAddrSliceSegment) 1736 { 1737 pcSlice->setNextSlice ( false ); 1738 pcSlice->setNextSliceSegment( true ); 1739 } 1740 else 1741 { 1742 pcSlice->setNextSlice ( true ); 1743 pcSlice->setNextSliceSegment( true ); 1744 } 1745 } 1746 else 1747 { 1748 pcSlice->setNextSlice ( false ); 1749 pcSlice->setNextSliceSegment( false ); 1750 } 1751 } 1752 } 1753 #else 1482 1754 /** Determines the starting and bounding LCU address of current slice / dependent slice 1483 1755 * \param bEncodeSlice Identifies if the calling function is compressSlice() [false] or encodeSlice() [true] … … 1816 2088 } 1817 2089 } 2090 #endif 1818 2091 1819 2092 Double TEncSlice::xGetQPValueAccordingToLambda ( Double lambda ) -
branches/SHM-dev/source/Lib/TLibEncoder/TEncSlice.h
r595 r880 150 150 Void setCtxMem( TEncSbac* sb, Int b ) { CTXMem[b] = sb; } 151 151 152 #if WPP_FIX 153 Void calculateBoundingCUAddrForSlice(UInt &uiStartCUAddrSlice, UInt &uiBoundingCUAddrSlice, Bool &bReachedTileBoundary, TComPic*& rpcPic, Bool bEncodeSlice, Int sliceMode, Int sliceArgument, UInt uiSliceCurEndCUAddr); 154 #endif 155 152 156 private: 153 157 Double xGetQPValueAccordingToLambda ( Double lambda );
Note: See TracChangeset for help on using the changeset viewer.