Changeset 189 in SHVCSoftware for trunk/source/Lib/TLibEncoder/TEncSlice.cpp
- Timestamp:
- 13 May 2013, 16:58:44 (12 years ago)
- Location:
- trunk/source
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source
- Property svn:mergeinfo changed
/branches/SHM-2.0-dev/source (added) merged: 133-167,169-182,184-188
- Property svn:mergeinfo changed
-
trunk/source/Lib/TLibEncoder/TEncSlice.cpp
r125 r189 178 178 \param pPPS PPS associated with the slice 179 179 */ 180 #if SVC_EXTENSION 181 //\param vps VPS associated with the slice 182 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS, TComVPS *vps ) 183 #else 180 184 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS ) 185 #endif 181 186 { 182 187 Double dQP; … … 189 194 rpcSlice->setPic( pcPic ); 190 195 #if SVC_EXTENSION 191 rpcSlice->initSlice( pcPic->getLayerId() ); 196 UInt layerId = pcPic->getLayerId(); 197 rpcSlice->setVPS( vps ); 198 rpcSlice->initSlice( layerId ); 192 199 #else 193 200 rpcSlice->initSlice(); … … 337 344 } 338 345 346 #if JCTVC_M0259_LAMBDAREFINEMENT 347 if( rpcSlice->getLayerId() > 0 && depth >= 3 && m_pcCfg->getGOPSize() == ( 1 << depth ) ) 348 { 349 Int nCurLayer = rpcSlice->getLayerId(); 350 Double gamma = xCalEnhLambdaFactor( m_ppcTEncTop[nCurLayer-1]->getQP() - m_ppcTEncTop[nCurLayer]->getQP() , 351 1.0 * m_ppcTEncTop[nCurLayer]->getSourceWidth() * m_ppcTEncTop[nCurLayer]->getSourceHeight() 352 / m_ppcTEncTop[nCurLayer-1]->getSourceWidth() / m_ppcTEncTop[nCurLayer-1]->getSourceHeight() ); 353 dLambda *= gamma; 354 } 355 #endif 356 339 357 // store lambda 340 358 m_pcRdCost ->setLambda( dLambda ); … … 354 372 qpc = Clip3( 0, 57, iQP + chromaQPOffset); 355 373 weight = pow( 2.0, (iQP-g_aucChromaScale[qpc])/3.0 ); // takes into account of the chroma qp mapping and chroma qp Offset 374 #if JCTVC_M0259_LAMBDAREFINEMENT 375 if( rpcSlice->getLayerId() > 0 && m_pcCfg->getGOPSize() >= 8 && rpcSlice->isIntra() == false && depth == 0 ) 376 { 377 dLambda *= 1.1; 378 weight *= 1.15; 379 } 380 #endif 356 381 m_pcRdCost->setCrDistortionWeight(weight); 357 382 #endif … … 400 425 rpcSlice->setNumRefIdx(REF_PIC_LIST_1,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive); 401 426 427 #if L0386_DB_METRIC 428 if ( m_pcCfg->getDeblockingFilterMetric() ) 429 { 430 rpcSlice->setDeblockingFilterOverrideFlag(true); 431 rpcSlice->setDeblockingFilterDisable(false); 432 rpcSlice->setDeblockingFilterBetaOffsetDiv2( 0 ); 433 rpcSlice->setDeblockingFilterTcOffsetDiv2( 0 ); 434 } else 435 #endif 402 436 if (rpcSlice->getPPS()->getDeblockingFilterControlPresentFlag()) 403 437 { … … 452 486 rpcSlice->setMaxNumMergeCand ( m_pcCfg->getMaxNumMergeCand() ); 453 487 xStoreWPparam( pPPS->getUseWP(), pPPS->getWPBiPred() ); 488 489 #if SVC_EXTENSION && REF_IDX_FRAMEWORK 490 if( layerId > 0 ) 491 { 492 #if JCTVC_M0458_INTERLAYER_RPS_SIG 493 // currently only one reference layer is supported in software and no decision logic to select yet. 494 // hence num of active inter layer references is set to one always 495 if( rpcSlice->getNumILRRefIdx() > 0 ) 496 { 497 rpcSlice->setActiveNumILRRefIdx(1); 498 rpcSlice->setInterLayerPredEnabledFlag(1); 499 } 500 #else 501 rpcSlice->setNumILRRefIdx( rpcSlice->getVPS()->getNumDirectRefLayers( layerId ) ); 502 #endif 503 } 504 505 #endif 454 506 } 455 507 … … 1182 1234 \retval rpcBitstream bitstream class 1183 1235 */ 1184 Void TEncSlice::encodeSlice ( TComPic*& rpcPic, TComOutputBitstream* pc Bitstream, TComOutputBitstream* pcSubstreams )1236 Void TEncSlice::encodeSlice ( TComPic*& rpcPic, TComOutputBitstream* pcSubstreams ) 1185 1237 { 1186 1238 UInt uiCUAddr; … … 1362 1414 } 1363 1415 { 1364 UInt uiCounter = 0; 1365 vector<uint8_t>& rbsp = pcSubstreams[uiSubStrm].getFIFO(); 1366 for (vector<uint8_t>::iterator it = rbsp.begin(); it != rbsp.end();) 1367 { 1368 /* 1) find the next emulated 00 00 {00,01,02,03} 1369 * 2a) if not found, write all remaining bytes out, stop. 1370 * 2b) otherwise, write all non-emulated bytes out 1371 * 3) insert emulation_prevention_three_byte 1372 */ 1373 vector<uint8_t>::iterator found = it; 1374 do 1375 { 1376 /* NB, end()-1, prevents finding a trailing two byte sequence */ 1377 found = search_n(found, rbsp.end()-1, 2, 0); 1378 found++; 1379 /* if not found, found == end, otherwise found = second zero byte */ 1380 if (found == rbsp.end()) 1381 { 1382 break; 1383 } 1384 if (*(++found) <= 3) 1385 { 1386 break; 1387 } 1388 } while (true); 1389 it = found; 1390 if (found != rbsp.end()) 1391 { 1392 it++; 1393 uiCounter++; 1394 } 1395 } 1396 1416 UInt numStartCodeEmulations = pcSubstreams[uiSubStrm].countStartCodeEmulations(); 1397 1417 UInt uiAccumulatedSubstreamLength = 0; 1398 1418 for (Int iSubstrmIdx=0; iSubstrmIdx < iNumSubstreams; iSubstrmIdx++) … … 1402 1422 // add bits coded in previous dependent slices + bits coded so far 1403 1423 // add number of emulation prevention byte count in the tile 1404 pcSlice->addTileLocation( ((pcSlice->getTileOffstForMultES() + uiAccumulatedSubstreamLength - uiBitsOriginallyInSubstreams) >> 3) + uiCounter);1424 pcSlice->addTileLocation( ((pcSlice->getTileOffstForMultES() + uiAccumulatedSubstreamLength - uiBitsOriginallyInSubstreams) >> 3) + numStartCodeEmulations ); 1405 1425 } 1406 1426 } … … 1875 1895 } 1876 1896 1897 #if JCTVC_M0259_LAMBDAREFINEMENT 1898 Double TEncSlice::xCalEnhLambdaFactor( Double deltaQP , Double beta ) 1899 { 1900 double tmp = beta * pow( 2.0 , deltaQP / 6 ); 1901 double gamma = tmp / ( tmp + 1 ); 1902 return( gamma ); 1903 } 1904 #endif 1877 1905 //! \}
Note: See TracChangeset for help on using the changeset viewer.