- Timestamp:
- 26 May 2016, 15:14:19 (9 years ago)
- Location:
- branches/HTM-16.1-dev/source/Lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-16.1-dev/source/Lib/TLibDecoder/SEIread.cpp
r1402 r1403 1278 1278 sei_read_code( pDecodedMessageOutputStream, 32, code, "min_display_mastering_luminance" ); sei.values.minLuminance = code; 1279 1279 } 1280 1281 #if U0033_ALTERNATIVE_TRANSFER_CHARACTERISTICS_SEI 1282 Void SEIReader::xParseSEIAlternativeTransferCharacteristics(SEIAlternativeTransferCharacteristics& sei, UInt payloadSize, ostream* pDecodedMessageOutputStream) 1283 { 1284 UInt code; 1285 output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); 1286 1287 sei_read_code(pDecodedMessageOutputStream, 8, code, "preferred_transfer_characteristics"); sei.m_preferredTransferCharacteristics = code; 1288 } 1289 #endif 1290 1280 1291 #if NH_MV 1281 1292 Void SEIReader::xParseSEILayersNotPresent(SEILayersNotPresent &sei, UInt payloadSize, const TComVPS *vps, std::ostream *pDecodedMessageOutputStream) -
branches/HTM-16.1-dev/source/Lib/TLibEncoder/TEncSlice.cpp
r1401 r1403 49 49 : m_encCABACTableIdx(I_SLICE) 50 50 { 51 m_apcPicYuvPred = NULL;52 m_apcPicYuvResi = NULL;53 54 m_pdRdPicLambda = NULL;55 m_pdRdPicQp = NULL;56 m_piRdPicQp = NULL;57 51 } 58 52 59 53 TEncSlice::~TEncSlice() 60 54 { 55 destroy(); 61 56 } 62 57 … … 64 59 { 65 60 // create prediction picture 66 if ( m_apcPicYuvPred == NULL ) 67 { 68 m_apcPicYuvPred = new TComPicYuv; 69 m_apcPicYuvPred->create( iWidth, iHeight, chromaFormat, iMaxCUWidth, iMaxCUHeight, uhTotalDepth, true ); 70 } 61 m_picYuvPred.create( iWidth, iHeight, chromaFormat, iMaxCUWidth, iMaxCUHeight, uhTotalDepth, true ); 71 62 72 63 // create residual picture 73 if( m_apcPicYuvResi == NULL ) 74 { 75 m_apcPicYuvResi = new TComPicYuv; 76 m_apcPicYuvResi->create( iWidth, iHeight, chromaFormat, iMaxCUWidth, iMaxCUHeight, uhTotalDepth, true ); 77 } 64 m_picYuvResi.create( iWidth, iHeight, chromaFormat, iMaxCUWidth, iMaxCUHeight, uhTotalDepth, true ); 78 65 } 79 66 80 67 Void TEncSlice::destroy() 81 68 { 82 // destroy prediction picture 83 if ( m_apcPicYuvPred ) 84 { 85 m_apcPicYuvPred->destroy(); 86 delete m_apcPicYuvPred; 87 m_apcPicYuvPred = NULL; 88 } 89 90 // destroy residual picture 91 if ( m_apcPicYuvResi ) 92 { 93 m_apcPicYuvResi->destroy(); 94 delete m_apcPicYuvResi; 95 m_apcPicYuvResi = NULL; 96 } 69 m_picYuvPred.destroy(); 70 m_picYuvResi.destroy(); 97 71 98 72 // free lambda and QP arrays 99 if ( m_pdRdPicLambda ) 100 { 101 xFree( m_pdRdPicLambda ); 102 m_pdRdPicLambda = NULL; 103 } 104 if ( m_pdRdPicQp ) 105 { 106 xFree( m_pdRdPicQp ); 107 m_pdRdPicQp = NULL; 108 } 109 if ( m_piRdPicQp ) 110 { 111 xFree( m_piRdPicQp ); 112 m_piRdPicQp = NULL; 113 } 73 m_vdRdPicLambda.clear(); 74 m_vdRdPicQp.clear(); 75 m_viRdPicQp.clear(); 114 76 } 115 77 … … 133 95 134 96 // create lambda and QP arrays 135 m_ pdRdPicLambda = (Double*)xMalloc( Double,m_pcCfg->getDeltaQpRD() * 2 + 1 );136 m_ pdRdPicQp = (Double*)xMalloc( Double,m_pcCfg->getDeltaQpRD() * 2 + 1 );137 m_ piRdPicQp = (Int* )xMalloc( Int,m_pcCfg->getDeltaQpRD() * 2 + 1 );97 m_vdRdPicLambda.resize(m_pcCfg->getDeltaQpRD() * 2 + 1 ); 98 m_vdRdPicQp.resize( m_pcCfg->getDeltaQpRD() * 2 + 1 ); 99 m_viRdPicQp.resize( m_pcCfg->getDeltaQpRD() * 2 + 1 ); 138 100 #if KWU_RC_MADPRED_E0227 139 101 if(m_pcCfg->getUseRateCtrl()) … … 427 389 } 428 390 391 #if W0062_RECALCULATE_QP_TO_ALIGN_WITH_LAMBDA 392 Double lambdaRef = 0.57*pow(2.0, qp_temp/3.0); 393 // QP correction due to modified lambda 394 Double qpOffset = floor((3.0*log(dLambda/lambdaRef)/log(2.0)) +0.5); 395 dQP += qpOffset; 396 #endif 397 429 398 iQP = max( -rpcSlice->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) ); 430 399 431 m_ pdRdPicLambda[iDQpIdx] = dLambda;432 m_ pdRdPicQp [iDQpIdx] = dQP;433 m_ piRdPicQp [iDQpIdx] = iQP;400 m_vdRdPicLambda[iDQpIdx] = dLambda; 401 m_vdRdPicQp [iDQpIdx] = dQP; 402 m_viRdPicQp [iDQpIdx] = iQP; 434 403 } 435 404 436 405 // obtain dQP = 0 case 437 dLambda = m_ pdRdPicLambda[0];438 dQP = m_ pdRdPicQp [0];439 iQP = m_ piRdPicQp [0];406 dLambda = m_vdRdPicLambda[0]; 407 dQP = m_vdRdPicQp [0]; 408 iQP = m_viRdPicQp [0]; 440 409 441 410 … … 446 415 #endif 447 416 const std::vector<Double> &intraLambdaModifiers=m_pcCfg->getIntraLambdaModifier(); 417 418 #if W0038_CQP_ADJ 419 if(rpcSlice->getPPS()->getSliceChromaQpFlag()) 420 { 421 const Bool bUseIntraOrPeriodicOffset = rpcSlice->getSliceType()==I_SLICE || (m_pcCfg->getSliceChromaOffsetQpPeriodicity()!=0 && (rpcSlice->getPOC()%m_pcCfg->getSliceChromaOffsetQpPeriodicity())==0); 422 Int cbQP = bUseIntraOrPeriodicOffset? m_pcCfg->getSliceChromaOffsetQpIntraOrPeriodic(false) : m_pcCfg->getGOPEntry(iGOPid).m_CbQPoffset; 423 Int crQP = bUseIntraOrPeriodicOffset? m_pcCfg->getSliceChromaOffsetQpIntraOrPeriodic(true) : m_pcCfg->getGOPEntry(iGOPid).m_CrQPoffset; 424 425 cbQP = Clip3( -12, 12, cbQP + rpcSlice->getPPS()->getQpOffset(COMPONENT_Cb) ) - rpcSlice->getPPS()->getQpOffset(COMPONENT_Cb); 426 crQP = Clip3( -12, 12, crQP + rpcSlice->getPPS()->getQpOffset(COMPONENT_Cr) ) - rpcSlice->getPPS()->getQpOffset(COMPONENT_Cr); 427 rpcSlice->setSliceChromaQpDelta(COMPONENT_Cb, Clip3( -12, 12, cbQP)); 428 assert(rpcSlice->getSliceChromaQpDelta(COMPONENT_Cb)+rpcSlice->getPPS()->getQpOffset(COMPONENT_Cb)<=12 && rpcSlice->getSliceChromaQpDelta(COMPONENT_Cb)+rpcSlice->getPPS()->getQpOffset(COMPONENT_Cb)>=-12); 429 rpcSlice->setSliceChromaQpDelta(COMPONENT_Cr, Clip3( -12, 12, crQP)); 430 assert(rpcSlice->getSliceChromaQpDelta(COMPONENT_Cr)+rpcSlice->getPPS()->getQpOffset(COMPONENT_Cr)<=12 && rpcSlice->getSliceChromaQpDelta(COMPONENT_Cr)+rpcSlice->getPPS()->getQpOffset(COMPONENT_Cr)>=-12); 431 } 432 else 433 { 434 rpcSlice->setSliceChromaQpDelta( COMPONENT_Cb, 0 ); 435 rpcSlice->setSliceChromaQpDelta( COMPONENT_Cr, 0 ); 436 } 437 #endif 448 438 449 439 Double lambdaModifier; … … 517 507 #endif 518 508 rpcSlice->setSliceQpDelta ( 0 ); 509 #if !W0038_CQP_ADJ 519 510 rpcSlice->setSliceChromaQpDelta( COMPONENT_Cb, 0 ); 520 511 rpcSlice->setSliceChromaQpDelta( COMPONENT_Cr, 0 ); 512 #endif 521 513 rpcSlice->setUseChromaQpAdj( rpcSlice->getPPS()->getPpsRangeExtension().getChromaQpOffsetListEnabledFlag() ); 522 514 #if NH_MV … … 575 567 rpcSlice->setTLayer( pcPic->getTLayer() ); 576 568 577 assert( m_apcPicYuvPred ); 578 assert( m_apcPicYuvResi ); 579 580 pcPic->setPicYuvPred( m_apcPicYuvPred ); 581 pcPic->setPicYuvResi( m_apcPicYuvResi ); 569 pcPic->setPicYuvPred( &m_picYuvPred ); 570 pcPic->setPicYuvResi( &m_picYuvResi ); 582 571 rpcSlice->setSliceMode ( m_pcCfg->getSliceMode() ); 583 572 rpcSlice->setSliceArgument ( m_pcCfg->getSliceArgument() ); … … 679 668 if (m_pcCfg->getGOPSize() > 1) 680 669 { 681 dFrameLambda = 0.68 * pow (2, (m_ piRdPicQp[0] - SHIFT_QP) / 3.0) * (pcSlice->isInterB()? 2 : 1);670 dFrameLambda = 0.68 * pow (2, (m_viRdPicQp[0] - SHIFT_QP) / 3.0) * (pcSlice->isInterB()? 2 : 1); 682 671 } 683 672 else 684 673 { 685 dFrameLambda = 0.68 * pow (2, (m_ piRdPicQp[0] - SHIFT_QP) / 3.0);674 dFrameLambda = 0.68 * pow (2, (m_viRdPicQp[0] - SHIFT_QP) / 3.0); 686 675 } 687 676 m_pcRdCost ->setFrameLambda(dFrameLambda); … … 690 679 for ( UInt uiQpIdx = 0; uiQpIdx < 2 * m_pcCfg->getDeltaQpRD() + 1; uiQpIdx++ ) 691 680 { 692 pcSlice ->setSliceQp ( m_ piRdPicQp [uiQpIdx] );681 pcSlice ->setSliceQp ( m_viRdPicQp [uiQpIdx] ); 693 682 #if ADAPTIVE_QP_SELECTION 694 pcSlice ->setSliceQpBase ( m_ piRdPicQp [uiQpIdx] );695 #endif 696 setUpLambda(pcSlice, m_ pdRdPicLambda[uiQpIdx], m_piRdPicQp [uiQpIdx]);683 pcSlice ->setSliceQpBase ( m_viRdPicQp [uiQpIdx] ); 684 #endif 685 setUpLambda(pcSlice, m_vdRdPicLambda[uiQpIdx], m_viRdPicQp [uiQpIdx]); 697 686 698 687 // try compress … … 730 719 731 720 // set best values 732 pcSlice ->setSliceQp ( m_ piRdPicQp [uiQpIdxBest] );721 pcSlice ->setSliceQp ( m_viRdPicQp [uiQpIdxBest] ); 733 722 #if ADAPTIVE_QP_SELECTION 734 pcSlice ->setSliceQpBase ( m_ piRdPicQp [uiQpIdxBest] );735 #endif 736 setUpLambda(pcSlice, m_ pdRdPicLambda[uiQpIdxBest], m_piRdPicQp [uiQpIdxBest]);723 pcSlice ->setSliceQpBase ( m_viRdPicQp [uiQpIdxBest] ); 724 #endif 725 setUpLambda(pcSlice, m_vdRdPicLambda[uiQpIdxBest], m_viRdPicQp [uiQpIdxBest]); 737 726 } 738 727
Note: See TracChangeset for help on using the changeset viewer.