- Timestamp:
- 22 Mar 2016, 23:10:27 (9 years ago)
- Location:
- branches/SHM-dev/source/Lib
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/Lib/TLibCommon/TComPic.cpp
r1512 r1540 75 75 TComPic::~TComPic() 76 76 { 77 destroy(); 77 78 } 78 79 #if SVC_EXTENSION 79 80 Void TComPic::create( const TComSPS &sps, const TComPPS &pps, const Bool bIsVirtual, const UInt layerId ) 80 81 { 82 destroy(); 83 81 84 const ChromaFormat chromaFormatIDC = sps.getChromaFormatIdc(); 82 85 const Int iWidth = sps.getPicWidthInLumaSamples(); … … 116 119 Void TComPic::create( const TComSPS &sps, const TComPPS &pps, const Bool bIsVirtual) 117 120 { 121 destroy(); 122 118 123 const ChromaFormat chromaFormatIDC = sps.getChromaFormatIdc(); 119 124 const Int iWidth = sps.getPicWidthInLumaSamples(); -
branches/SHM-dev/source/Lib/TLibCommon/TComPicSym.cpp
r1503 r1540 77 77 {} 78 78 79 80 TComPicSym::~TComPicSym() 81 { 82 destroy(); 83 } 84 79 85 #if SVC_EXTENSION 80 86 Void TComPicSym::create ( const TComSPS &sps, const TComPPS &pps, UInt uiMaxDepth, const UInt layerId ) … … 84 90 { 85 91 #endif 86 UInt i; 92 destroy(); 93 87 94 m_sps = sps; 88 95 m_pps = pps; … … 91 98 const Int iPicWidth = sps.getPicWidthInLumaSamples(); 92 99 const Int iPicHeight = sps.getPicHeightInLumaSamples(); 93 94 100 const UInt uiMaxCuWidth = sps.getMaxCUWidth(); 95 101 const UInt uiMaxCuHeight = sps.getMaxCUHeight(); … … 124 130 #endif 125 131 126 for ( i=0; i<m_numCtusInFrame ; i++ )132 for (UInt i=0; i<m_numCtusInFrame ; i++ ) 127 133 { 128 134 m_pictureCtuArray[i] = new TComDataCU; … … 144 150 #endif 145 151 146 for( i=0; i<m_numCtusInFrame; i++ )152 for(UInt i=0; i<m_numCtusInFrame; i++ ) 147 153 { 148 154 m_ctuTsToRsAddrMap[i] = i; -
branches/SHM-dev/source/Lib/TLibCommon/TComPicSym.h
r1520 r1540 140 140 141 141 TComPicSym (); 142 ~TComPicSym(); 143 142 144 TComSlice* getSlice(UInt i) { return m_apSlices[i]; } 143 145 const TComSlice* getSlice(UInt i) const { return m_apSlices[i]; } -
branches/SHM-dev/source/Lib/TLibCommon/TComPicYuv.cpp
r1460 r1540 74 74 TComPicYuv::~TComPicYuv() 75 75 { 76 destroy(); 76 77 } 77 78 … … 90 91 91 92 { 93 destroy(); 92 94 93 95 #if SVC_EXTENSION -
branches/SHM-dev/source/Lib/TLibCommon/TComYuv.cpp
r1324 r1540 59 59 TComYuv::~TComYuv() 60 60 { 61 destroy(); 61 62 } 62 63 63 64 Void TComYuv::create( UInt iWidth, UInt iHeight, ChromaFormat chromaFormatIDC ) 64 65 { 66 destroy(); 65 67 // set width and height 66 68 m_iWidth = iWidth; -
branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r1538 r1540 3587 3587 assert(noCol > 1); 3588 3588 assert(noRows > 1); 3589 UInt64 *colSAD = (UInt64*)malloc(noCol*sizeof(UInt64));3590 UInt64 *rowSAD = (UInt64*)malloc(noRows*sizeof(UInt64));3589 std::vector<UInt64> colSAD(noCol, UInt64(0)); 3590 std::vector<UInt64> rowSAD(noCol, UInt64(0)); 3591 3591 UInt colIdx = 0; 3592 3592 UInt rowIdx = 0; … … 3600 3600 const Int thr1 = 2*bitdepthScale; 3601 3601 UInt a = 0; 3602 3603 memset(colSAD, 0, noCol*sizeof(UInt64));3604 memset(rowSAD, 0, noRows*sizeof(UInt64));3605 3602 3606 3603 if (maxTBsize > minBlockArtSize) … … 3692 3689 } 3693 3690 } 3694 3695 free(colSAD);3696 free(rowSAD);3697 3691 } 3698 3692 -
branches/SHM-dev/source/Lib/TLibEncoder/TEncSlice.cpp
r1527 r1540 50 50 : m_encCABACTableIdx(I_SLICE) 51 51 { 52 m_apcPicYuvPred = NULL;53 m_apcPicYuvResi = NULL;54 55 m_pdRdPicLambda = NULL;56 m_pdRdPicQp = NULL;57 m_piRdPicQp = NULL;58 52 } 59 53 60 54 TEncSlice::~TEncSlice() 61 55 { 56 destroy(); 62 57 } 63 58 … … 65 60 { 66 61 // create prediction picture 67 if ( m_apcPicYuvPred == NULL ) 68 { 69 m_apcPicYuvPred = new TComPicYuv; 70 m_apcPicYuvPred->create( iWidth, iHeight, chromaFormat, iMaxCUWidth, iMaxCUHeight, uhTotalDepth, true ); 71 } 62 m_picYuvPred.create( iWidth, iHeight, chromaFormat, iMaxCUWidth, iMaxCUHeight, uhTotalDepth, true ); 72 63 73 64 // create residual picture 74 if( m_apcPicYuvResi == NULL ) 75 { 76 m_apcPicYuvResi = new TComPicYuv; 77 m_apcPicYuvResi->create( iWidth, iHeight, chromaFormat, iMaxCUWidth, iMaxCUHeight, uhTotalDepth, true ); 78 } 65 m_picYuvResi.create( iWidth, iHeight, chromaFormat, iMaxCUWidth, iMaxCUHeight, uhTotalDepth, true ); 79 66 } 80 67 81 68 Void TEncSlice::destroy() 82 69 { 83 // destroy prediction picture 84 if ( m_apcPicYuvPred ) 85 { 86 m_apcPicYuvPred->destroy(); 87 delete m_apcPicYuvPred; 88 m_apcPicYuvPred = NULL; 89 } 90 91 // destroy residual picture 92 if ( m_apcPicYuvResi ) 93 { 94 m_apcPicYuvResi->destroy(); 95 delete m_apcPicYuvResi; 96 m_apcPicYuvResi = NULL; 97 } 70 m_picYuvPred.destroy(); 71 m_picYuvResi.destroy(); 98 72 99 73 // free lambda and QP arrays 100 if ( m_pdRdPicLambda ) 101 { 102 xFree( m_pdRdPicLambda ); 103 m_pdRdPicLambda = NULL; 104 } 105 if ( m_pdRdPicQp ) 106 { 107 xFree( m_pdRdPicQp ); 108 m_pdRdPicQp = NULL; 109 } 110 if ( m_piRdPicQp ) 111 { 112 xFree( m_piRdPicQp ); 113 m_piRdPicQp = NULL; 114 } 74 m_vdRdPicLambda.clear(); 75 m_vdRdPicQp.clear(); 76 m_viRdPicQp.clear(); 115 77 } 116 78 … … 134 96 135 97 // create lambda and QP arrays 136 m_ pdRdPicLambda = (Double*)xMalloc( Double,m_pcCfg->getDeltaQpRD() * 2 + 1 );137 m_ pdRdPicQp = (Double*)xMalloc( Double,m_pcCfg->getDeltaQpRD() * 2 + 1 );138 m_ piRdPicQp = (Int* )xMalloc( Int,m_pcCfg->getDeltaQpRD() * 2 + 1 );98 m_vdRdPicLambda.resize(m_pcCfg->getDeltaQpRD() * 2 + 1 ); 99 m_vdRdPicQp.resize( m_pcCfg->getDeltaQpRD() * 2 + 1 ); 100 m_viRdPicQp.resize( m_pcCfg->getDeltaQpRD() * 2 + 1 ); 139 101 m_pcRateCtrl = pcEncTop->getRateCtrl(); 140 102 … … 416 378 iQP = max( -rpcSlice->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) ); 417 379 418 m_ pdRdPicLambda[iDQpIdx] = dLambda;419 m_ pdRdPicQp [iDQpIdx] = dQP;420 m_ piRdPicQp [iDQpIdx] = iQP;380 m_vdRdPicLambda[iDQpIdx] = dLambda; 381 m_vdRdPicQp [iDQpIdx] = dQP; 382 m_viRdPicQp [iDQpIdx] = iQP; 421 383 } 422 384 423 385 // obtain dQP = 0 case 424 dLambda = m_ pdRdPicLambda[0];425 dQP = m_ pdRdPicQp [0];426 iQP = m_ piRdPicQp [0];386 dLambda = m_vdRdPicLambda[0]; 387 dQP = m_vdRdPicQp [0]; 388 iQP = m_viRdPicQp [0]; 427 389 428 390 const Int temporalId=m_pcCfg->getGOPEntry(iGOPid).m_temporalId; … … 536 498 rpcSlice->setTLayer( pcPic->getTLayer() ); 537 499 538 assert( m_apcPicYuvPred ); 539 assert( m_apcPicYuvResi ); 540 541 pcPic->setPicYuvPred( m_apcPicYuvPred ); 542 pcPic->setPicYuvResi( m_apcPicYuvResi ); 500 pcPic->setPicYuvPred( &m_picYuvPred ); 501 pcPic->setPicYuvResi( &m_picYuvResi ); 543 502 rpcSlice->setSliceMode ( m_pcCfg->getSliceMode() ); 544 503 rpcSlice->setSliceArgument ( m_pcCfg->getSliceArgument() ); … … 660 619 if (m_pcCfg->getGOPSize() > 1) 661 620 { 662 dFrameLambda = 0.68 * pow (2, (m_ piRdPicQp[0] - SHIFT_QP) / 3.0) * (pcSlice->isInterB()? 2 : 1);621 dFrameLambda = 0.68 * pow (2, (m_viRdPicQp[0] - SHIFT_QP) / 3.0) * (pcSlice->isInterB()? 2 : 1); 663 622 } 664 623 else 665 624 { 666 dFrameLambda = 0.68 * pow (2, (m_ piRdPicQp[0] - SHIFT_QP) / 3.0);625 dFrameLambda = 0.68 * pow (2, (m_viRdPicQp[0] - SHIFT_QP) / 3.0); 667 626 } 668 627 m_pcRdCost ->setFrameLambda(dFrameLambda); … … 671 630 for ( UInt uiQpIdx = 0; uiQpIdx < 2 * m_pcCfg->getDeltaQpRD() + 1; uiQpIdx++ ) 672 631 { 673 pcSlice ->setSliceQp ( m_ piRdPicQp [uiQpIdx] );632 pcSlice ->setSliceQp ( m_viRdPicQp [uiQpIdx] ); 674 633 #if ADAPTIVE_QP_SELECTION 675 pcSlice ->setSliceQpBase ( m_ piRdPicQp [uiQpIdx] );676 #endif 677 setUpLambda(pcSlice, m_ pdRdPicLambda[uiQpIdx], m_piRdPicQp [uiQpIdx]);634 pcSlice ->setSliceQpBase ( m_viRdPicQp [uiQpIdx] ); 635 #endif 636 setUpLambda(pcSlice, m_vdRdPicLambda[uiQpIdx], m_viRdPicQp [uiQpIdx]); 678 637 679 638 // try compress … … 699 658 700 659 // set best values 701 pcSlice ->setSliceQp ( m_ piRdPicQp [uiQpIdxBest] );660 pcSlice ->setSliceQp ( m_viRdPicQp [uiQpIdxBest] ); 702 661 #if ADAPTIVE_QP_SELECTION 703 pcSlice ->setSliceQpBase ( m_ piRdPicQp [uiQpIdxBest] );704 #endif 705 setUpLambda(pcSlice, m_ pdRdPicLambda[uiQpIdxBest], m_piRdPicQp [uiQpIdxBest]);662 pcSlice ->setSliceQpBase ( m_viRdPicQp [uiQpIdxBest] ); 663 #endif 664 setUpLambda(pcSlice, m_vdRdPicLambda[uiQpIdxBest], m_viRdPicQp [uiQpIdxBest]); 706 665 } 707 666 -
branches/SHM-dev/source/Lib/TLibEncoder/TEncSlice.h
r1391 r1540 68 68 // pictures 69 69 TComList<TComPic*>* m_pcListPic; ///< list of pictures 70 TComPicYuv * m_apcPicYuvPred;///< prediction picture buffer71 TComPicYuv * m_apcPicYuvResi;///< residual picture buffer70 TComPicYuv m_picYuvPred; ///< prediction picture buffer 71 TComPicYuv m_picYuvResi; ///< residual picture buffer 72 72 73 73 // processing units … … 91 91 UInt64 m_uiPicDist; ///< total distortion for the picture 92 92 Double m_dPicRdCost; ///< picture-level RD cost 93 Double* m_pdRdPicLambda; ///< array of lambda candidates94 Double* m_pdRdPicQp; ///< array of picture QP candidates (double-type for lambda)95 Int* m_piRdPicQp; ///< array of picture QP candidates (Int-type)93 std::vector<Double> m_vdRdPicLambda; ///< array of lambda candidates 94 std::vector<Double> m_vdRdPicQp; ///< array of picture QP candidates (double-type for lambda) 95 std::vector<Int> m_viRdPicQp; ///< array of picture QP candidates (Int-type) 96 96 TEncRateCtrl* m_pcRateCtrl; ///< Rate control manager 97 97 UInt m_uiSliceIdx;
Note: See TracChangeset for help on using the changeset viewer.