Changeset 537 in 3DVCSoftware for branches/HTM-DEV-0.3-dev2/source/Lib
- Timestamp:
- 13 Jul 2013, 15:51:26 (12 years ago)
- Location:
- branches/HTM-DEV-0.3-dev2/source/Lib
- Files:
-
- 42 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/CommonDef.h
r479 r537 115 115 #define MAX_NUM_REF_PICS 16 ///< max. number of pictures used for reference 116 116 #define MAX_NUM_REF 16 ///< max. number of entries in picture reference list 117 #if !L0034_COMBINED_LIST_CLEANUP118 #define MAX_NUM_REF_LC MAX_NUM_REF_PICS // TODO: remove this macro definition (leftover from combined list concept)119 #endif120 117 121 118 #define MAX_UINT 0xFFFFFFFFU ///< max. value of unsigned 32-bit integer -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/NAL.h
r446 r537 94 94 || m_nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R; 95 95 } 96 #if L0045_NON_NESTED_SEI_RESTRICTIONS97 96 Bool isSei() 98 97 { … … 105 104 return ( (UInt)m_nalUnitType < 32 ); 106 105 } 107 #endif108 106 }; 109 107 -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/SEI.cpp
r446 r537 39 39 #include "SEI.h" 40 40 41 #if J0149_TONE_MAPPING_SEI42 41 //Table D-7 Meaning of camera iso sensitivity indicator and exposure index rating indicator 43 42 Int Table_exp_indicator[32] = {0, 10, 12, 16, 20, 25, 32, 40, 50, 64, 80, 100, 125, 160, 200, 250, 320, 400, 500, 640, 800, 1000, 1250, 1600, 2000, 2500, 3200, 4000, 5000, 6400, 8000, -1}; 44 #endif45 43 46 44 SEIMessages getSeisByType(SEIMessages &seiList, SEI::PayloadType seiType) -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/SEI.h
r446 r537 124 124 125 125 SEIActiveParameterSets() 126 #if !L0047_APS_FLAGS127 :numSpsIdsMinus1(0)128 #else129 126 : activeVPSId (0) 130 127 , m_fullRandomAccessFlag (false) 131 128 , m_noParamSetUpdateFlag (false) 132 129 , numSpsIdsMinus1 (0) 133 #endif134 130 {} 135 131 virtual ~SEIActiveParameterSets() {} 136 132 137 133 Int activeVPSId; 138 #if L0047_APS_FLAGS139 134 Bool m_fullRandomAccessFlag; 140 135 Bool m_noParamSetUpdateFlag; 141 #endif142 136 Int numSpsIdsMinus1; 143 137 std::vector<Int> activeSeqParamSetId; … … 150 144 151 145 SEIBufferingPeriod() 152 #if L0044_CPB_DPB_DELAY_OFFSET153 146 : m_bpSeqParameterSetId (0) 154 147 , m_rapCpbParamsPresentFlag (false) … … 161 154 ::memset(m_initialAltCpbRemovalDelayOffset, 0, sizeof(m_initialAltCpbRemovalDelayOffset)); 162 155 } 163 #else164 {}165 #endif166 156 virtual ~SEIBufferingPeriod() {} 167 157 168 158 UInt m_bpSeqParameterSetId; 169 159 Bool m_rapCpbParamsPresentFlag; 170 #if L0044_CPB_DPB_DELAY_OFFSET171 160 Bool m_cpbDelayOffset; 172 161 Bool m_dpbDelayOffset; 173 #endif174 162 UInt m_initialCpbRemovalDelay [MAX_CPB_CNT][2]; 175 163 UInt m_initialCpbRemovalDelayOffset [MAX_CPB_CNT][2]; 176 164 UInt m_initialAltCpbRemovalDelay [MAX_CPB_CNT][2]; 177 165 UInt m_initialAltCpbRemovalDelayOffset[MAX_CPB_CNT][2]; 178 #if L0328_SPLICING179 166 Bool m_concatenationFlag; 180 167 UInt m_auCpbRemovalDelayDelta; 181 #endif182 168 }; 183 169 class SEIPictureTiming : public SEI … … 188 174 SEIPictureTiming() 189 175 : m_picStruct (0) 190 #if L0046_RENAME_PROG_SRC_IDC191 176 , m_sourceScanType (0) 192 #else193 , m_progressiveSourceIdc (0)194 #endif195 177 , m_duplicateFlag (false) 196 #if L0044_DU_DPB_OUTPUT_DELAY_HRD197 178 , m_picDpbOutputDuDelay (0) 198 #endif199 179 , m_numNalusInDuMinus1 (NULL) 200 180 , m_duCpbRemovalDelayMinus1 (NULL) … … 213 193 214 194 UInt m_picStruct; 215 #if L0046_RENAME_PROG_SRC_IDC216 195 UInt m_sourceScanType; 217 #else218 UInt m_progressiveSourceIdc;219 #endif220 196 Bool m_duplicateFlag; 221 197 222 198 UInt m_auCpbRemovalDelay; 223 199 UInt m_picDpbOutputDelay; 224 #if L0044_DU_DPB_OUTPUT_DELAY_HRD225 200 UInt m_picDpbOutputDuDelay; 226 #endif227 201 UInt m_numDecodingUnitsMinus1; 228 202 Bool m_duCommonCpbRemovalDelayFlag; … … 240 214 : m_decodingUnitIdx(0) 241 215 , m_duSptCpbRemovalDelay(0) 242 #if L0044_DU_DPB_OUTPUT_DELAY_HRD243 216 , m_dpbOutputDuDelayPresentFlag(false) 244 217 , m_picSptDpbOutputDuDelay(0) 245 #endif246 218 {} 247 219 virtual ~SEIDecodingUnitInfo() {} 248 220 Int m_decodingUnitIdx; 249 221 Int m_duSptCpbRemovalDelay; 250 #if L0044_DU_DPB_OUTPUT_DELAY_HRD251 222 Bool m_dpbOutputDuDelayPresentFlag; 252 223 Int m_picSptDpbOutputDuDelay; 253 #endif254 224 }; 255 225 … … 290 260 Int m_frame1GridPositionY; 291 261 Int m_arrangementReservedByte; 292 #if L0045_PERSISTENCE_FLAGS293 262 Bool m_arrangementPersistenceFlag; 294 #else295 Int m_arrangementRepetetionPeriod;296 #endif297 263 Bool m_upsampledAspectRatio; 298 264 }; … … 305 271 SEIDisplayOrientation() 306 272 : cancelFlag(true) 307 #if L0045_PERSISTENCE_FLAGS308 273 , persistenceFlag(0) 309 #else310 , repetitionPeriod(1)311 #endif312 274 , extensionFlag(false) 313 275 {} … … 319 281 320 282 UInt anticlockwiseRotation; 321 #if L0045_PERSISTENCE_FLAGS322 283 Bool persistenceFlag; 323 #else324 UInt repetitionPeriod;325 #endif326 284 Bool extensionFlag; 327 285 }; … … 355 313 }; 356 314 357 #if L0208_SOP_DESCRIPTION_SEI358 315 class SEISOPDescription : public SEI 359 316 { … … 372 329 Int m_sopDescPocDelta[MAX_NUM_PICS_IN_SOP]; 373 330 }; 374 #endif 375 376 #if J0149_TONE_MAPPING_SEI 331 377 332 class SEIToneMappingInfo : public SEI 378 333 { … … 407 362 Int m_extendedWhiteLevelLumaCodeValue; 408 363 }; 409 #endif410 364 411 365 typedef std::list<SEI*> SEIMessages; … … 420 374 Void deleteSEIs (SEIMessages &seiList); 421 375 422 #if K0180_SCALABLE_NESTING_SEI423 376 class SEIScalableNesting : public SEI 424 377 { … … 450 403 SEIMessages m_nestedSEIs; 451 404 }; 452 #endif453 405 454 406 //! \} -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComBitStream.h
r446 r537 193 193 } 194 194 195 Void peekPreviousByte( UInt &byte ) 196 { 197 assert(m_fifo_idx > 0); 198 byte = (*m_fifo)[m_fifo_idx - 1]; 199 } 200 195 201 Void readOutTrailingBits (); 196 202 UChar getHeldBits () { return m_held_bits; } -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComDataCU.cpp
r534 r537 136 136 #endif 137 137 #endif 138 139 138 m_bDecSubCu = false; 140 139 m_sliceStartCU = 0; … … 143 142 m_pDvInfo = NULL; 144 143 #endif 145 146 144 #if H_3D_VSP 147 145 m_piVSPFlag = NULL; 148 146 #endif 149 150 147 #if H_3D_ARP 151 148 m_puhARPW = NULL; 152 149 #endif 153 154 150 #if H_3D_IC 155 151 m_pbICFlag = NULL; … … 783 779 } 784 780 785 UInt uiTmp = uhWidth*uhHeight;786 787 781 if(getPic()->getPicSym()->getInverseCUOrderMap(getAddr())*m_pcPic->getNumPartInCU()+m_uiAbsIdxInLCU >= getSlice()->getSliceSegmentCurStartCUAddr()) 788 782 { 789 783 m_acCUMvField[0].clearMvField(); 790 784 m_acCUMvField[1].clearMvField(); 791 uiTmp = uhWidth*uhHeight;785 UInt uiTmp = uhWidth*uhHeight; 792 786 793 787 memset( m_pcTrCoeffY, 0, uiTmp * sizeof( *m_pcTrCoeffY ) ); … … 1056 1050 m_uiCUPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; 1057 1051 1058 UInt uiWidth = g_uiMaxCUWidth >> uiDepth;1059 UInt uiHeight = g_uiMaxCUHeight >> uiDepth;1060 1061 1052 m_skipFlag=pcCU->getSkipFlag() + uiPart; 1062 1053 … … 1139 1130 m_apcCUColocated[1] = pcCU->getCUColocated(REF_PIC_LIST_1); 1140 1131 1141 UInt uiTmp = uiWidth*uiHeight;1142 1132 UInt uiMaxCuWidth=pcCU->getSlice()->getSPS()->getMaxCUWidth(); 1143 1133 UInt uiMaxCuHeight=pcCU->getSlice()->getSPS()->getMaxCUHeight(); … … 1151 1141 m_pcIPCMSampleY = pcCU->getPCMSampleY() + uiCoffOffset; 1152 1142 1153 uiTmp >>= 2;1154 1143 uiCoffOffset >>=2; 1155 1144 m_pcTrCoeffCb=pcCU->getCoeffCb() + uiCoffOffset; … … 1352 1341 memcpy( m_sliceStartCU + uiOffset, pcCU->m_sliceStartCU, sizeof( UInt ) * uiNumPartition ); 1353 1342 memcpy( m_sliceSegmentStartCU + uiOffset, pcCU->m_sliceSegmentStartCU, sizeof( UInt ) * uiNumPartition ); 1354 1355 1343 #if H_3D_ARP 1356 1344 memcpy( m_puhARPW + uiOffset, pcCU->getARPW(), iSizeInUchar ); … … 1430 1418 #endif 1431 1419 #endif 1432 1433 1420 memcpy( rpcCU->getDepth() + m_uiAbsIdxInLCU, m_puhDepth, iSizeInUchar ); 1434 1421 memcpy( rpcCU->getWidth() + m_uiAbsIdxInLCU, m_puhWidth, iSizeInUchar ); … … 1465 1452 memcpy( rpcCU->m_sliceStartCU + m_uiAbsIdxInLCU, m_sliceStartCU, sizeof( UInt ) * m_uiNumPartition ); 1466 1453 memcpy( rpcCU->m_sliceSegmentStartCU + m_uiAbsIdxInLCU, m_sliceSegmentStartCU, sizeof( UInt ) * m_uiNumPartition ); 1467 1468 1454 #if H_3D_ARP 1469 1455 memcpy( rpcCU->getARPW() + m_uiAbsIdxInLCU, m_puhARPW, iSizeInUchar ); … … 1539 1525 #endif 1540 1526 #endif 1541 1542 1527 memcpy( rpcCU->getDepth() + uiPartOffset, m_puhDepth, iSizeInUchar ); 1543 1528 memcpy( rpcCU->getWidth() + uiPartOffset, m_puhWidth, iSizeInUchar ); … … 1575 1560 memcpy( rpcCU->m_sliceStartCU + uiPartOffset, m_sliceStartCU, sizeof( UInt ) * uiQNumPart ); 1576 1561 memcpy( rpcCU->m_sliceSegmentStartCU + uiPartOffset, m_sliceSegmentStartCU, sizeof( UInt ) * uiQNumPart ); 1577 1578 1562 #if H_3D_ARP 1579 1563 memcpy( rpcCU->getARPW() + uiPartOffset, m_puhARPW, iSizeInUchar ); … … 2027 2011 return getSlice()->getSliceQp(); 2028 2012 } 2029 else 2030 if ( iLastValidPartIdx >= 0 ) 2013 else if ( iLastValidPartIdx >= 0 ) 2031 2014 { 2032 2015 return getQP( iLastValidPartIdx ); … … 2255 2238 } 2256 2239 #endif 2257 2258 2240 UInt TComDataCU::getCtxInterDir( UInt uiAbsPartIdx ) 2259 2241 { … … 2492 2474 } 2493 2475 #endif 2494 2495 2476 Void TComDataCU::setMergeFlagSubParts ( Bool bMergeFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) 2496 2477 { … … 2509 2490 } 2510 2491 #endif 2511 2512 2492 Void TComDataCU::setChromIntraDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiDepth ) 2513 2493 { … … 3030 3010 3031 3011 #endif 3032 3033 3012 /** Constructs a list of merging candidates 3034 3013 * \param uiAbsPartIdx … … 3139 3118 pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 3140 3119 TComMv cMvPred = pcMvFieldNeighbours[(iCount<<1)+1].getMv(); 3141 3142 3120 #if H_3D_IC 3143 3121 const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) ); … … 3568 3546 //>> MTK colocated-RightBottom 3569 3547 UInt uiPartIdxRB; 3570 Int uiLCUIdx = getAddr();3571 3548 3572 3549 deriveRightBottomIdx( uiPUIdx, uiPartIdxRB ); … … 3577 3554 TComMv cColMv; 3578 3555 Int iRefIdx; 3556 Int uiLCUIdx = -1; 3579 3557 3580 3558 if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) // image boundary check 3581 3559 { 3582 uiLCUIdx = -1;3583 3560 } 3584 3561 else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) 3585 3562 { 3586 uiLCUIdx = -1;3587 3563 } 3588 3564 else … … 3597 3573 { 3598 3574 uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ]; 3599 uiLCUIdx = -1 ;3600 3575 } 3601 3576 else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU … … 3607 3582 { 3608 3583 uiAbsPartAddr = 0; 3609 uiLCUIdx = -1 ;3610 3584 } 3611 3585 } … … 3885 3859 if (!bAdded) 3886 3860 { 3887 bAdded =xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_LEFT );3861 xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLB, MD_LEFT ); 3888 3862 } 3889 3863 } … … 3898 3872 if(!bAdded) 3899 3873 { 3900 bAdded =xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT);3874 xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT); 3901 3875 } 3902 3876 bAdded = bAddedSmvp; … … 3913 3887 if(!bAdded) 3914 3888 { 3915 bAdded =xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT);3889 xAddMVPCandOrder( pInfo, eRefPicList, iRefIdx, uiPartIdxLT, MD_ABOVE_LEFT); 3916 3890 } 3917 3891 } … … 3933 3907 UInt uiAbsPartIdx; 3934 3908 UInt uiAbsPartAddr; 3935 Int uiLCUIdx = getAddr();3936 3909 3937 3910 deriveRightBottomIdx( uiPartIdx, uiPartIdxRB ); … … 3940 3913 //---- co-located RightBottom Temporal Predictor (H) ---// 3941 3914 uiAbsPartIdx = g_auiZscanToRaster[uiPartIdxRB]; 3915 Int uiLCUIdx = -1; 3942 3916 if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdx] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) // image boundary check 3943 3917 { 3944 uiLCUIdx = -1;3945 3918 } 3946 3919 else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdx] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) 3947 3920 { 3948 uiLCUIdx = -1;3949 3921 } 3950 3922 else … … 3959 3931 { 3960 3932 uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdx + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ]; 3961 uiLCUIdx = -1 ;3962 3933 } 3963 3934 else if ( uiAbsPartIdx / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU … … 3969 3940 { 3970 3941 uiAbsPartAddr = 0; 3971 uiLCUIdx = -1 ;3972 3942 } 3973 3943 } … … 4043 4013 UInt TComDataCU::getIntraSizeIdx(UInt uiAbsPartIdx) 4044 4014 { 4045 UInt uiShift = ( (m_puhTrIdx[uiAbsPartIdx]==0) && (m_pePartSize[uiAbsPartIdx]==SIZE_NxN) ) ? m_puhTrIdx[uiAbsPartIdx]+1 : m_puhTrIdx[uiAbsPartIdx]; 4046 uiShift = ( m_pePartSize[uiAbsPartIdx]==SIZE_NxN ? 1 : 0 ); 4015 UInt uiShift = ( m_pePartSize[uiAbsPartIdx]==SIZE_NxN ? 1 : 0 ); 4047 4016 4048 4017 UChar uiWidth = m_puhWidth[uiAbsPartIdx]>>uiShift; … … 4130 4099 } 4131 4100 4132 #if L0363_MVP_POC4133 4101 if ( pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) >= 0 && m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getPOC() == pcTmpCU->getSlice()->getRefPOC( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) )) 4134 #else4135 if ( m_pcSlice->isEqualRef(eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx), iRefIdx) )4136 #endif4137 4102 { 4138 4103 TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx); … … 4340 4305 } 4341 4306 iCurrPOC = m_pcSlice->getPOC(); 4342 iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC();4343 4307 iColPOC = pColCU->getSlice()->getPOC(); 4344 4308 -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComLoopFilter.cpp
r446 r537 461 461 if ( ((piRefP0==piRefQ0)&&(piRefP1==piRefQ1)) || ((piRefP0==piRefQ1)&&(piRefP1==piRefQ0)) ) 462 462 { 463 uiBs = 0;464 463 if ( piRefP0 != piRefP1 ) // Different L0 & L1 465 464 { … … 694 693 for ( UInt iIdx = 0; iIdx < uiNumParts; iIdx++ ) 695 694 { 696 ucBs = 0;697 698 695 uiBsAbsIdx = xCalcBsIdx( pcCU, uiAbsZorderIdx, iDir, iEdge, iIdx); 699 696 ucBs = m_aapucBS[iDir][uiBsAbsIdx]; -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComPrediction.cpp
r532 r537 76 76 m_acYuvPredBase[1].destroy(); 77 77 #endif 78 79 78 if( m_pLumaRecBuffer ) 80 79 { … … 146 145 Pel TComPrediction::predIntraGetPredValDC( Int* pSrc, Int iSrcStride, UInt iWidth, UInt iHeight, Bool bAbove, Bool bLeft ) 147 146 { 147 assert(iWidth > 0 && iHeight > 0); 148 148 Int iInd, iSum = 0; 149 149 Pel pDcVal; … … 934 934 } 935 935 #endif 936 937 936 if ( yFrac == 0 ) 938 937 { … … 1246 1245 return; 1247 1246 } 1248 1249 1247 #if H_3D_IC 1250 1248 /** Function for deriving the position of first non-zero binary bit of a value -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComRdCost.cpp
r531 r537 570 570 #endif 571 571 572 #if RATE_CONTROL_LAMBDA_DOMAIN 572 #if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT 573 573 UInt TComRdCost::getSADPart ( Int bitDepth, Pel* pelCur, Int curStride, Pel* pelOrg, Int orgStride, UInt width, UInt height ) 574 574 { … … 636 636 return xGetSADw( pcDtParam ); 637 637 } 638 639 638 #if H_3D_IC 640 639 if( pcDtParam->bUseIC ) … … 643 642 } 644 643 #endif 645 646 644 Pel* piOrg = pcDtParam->pOrg; 647 645 Pel* piCur = pcDtParam->pCur; … … 675 673 return xGetSADw( pcDtParam ); 676 674 } 677 678 675 #if H_3D_IC 679 676 if( pcDtParam->bUseIC ) … … 682 679 } 683 680 #endif 684 685 681 Pel* piOrg = pcDtParam->pOrg; 686 682 Pel* piCur = pcDtParam->pCur; … … 718 714 return xGetSADw( pcDtParam ); 719 715 } 720 721 716 #if H_3D_IC 722 717 if( pcDtParam->bUseIC ) … … 725 720 } 726 721 #endif 727 728 722 Pel* piOrg = pcDtParam->pOrg; 729 723 Pel* piCur = pcDtParam->pCur; … … 770 764 return xGetSADw( pcDtParam ); 771 765 } 772 773 766 #if H_3D_IC 774 767 if( pcDtParam->bUseIC ) … … 777 770 } 778 771 #endif 779 780 772 Pel* piOrg = pcDtParam->pOrg; 781 773 Pel* piCur = pcDtParam->pCur; … … 820 812 } 821 813 #endif 822 823 814 Pel* piOrg = pcDtParam->pOrg; 824 815 Pel* piCur = pcDtParam->pCur; … … 867 858 return xGetSADw( pcDtParam ); 868 859 } 869 870 860 #if H_3D_IC 871 861 if( pcDtParam->bUseIC ) … … 874 864 } 875 865 #endif 876 877 866 Pel* piOrg = pcDtParam->pOrg; 878 867 Pel* piCur = pcDtParam->pCur; … … 935 924 return xGetSADw( pcDtParam ); 936 925 } 937 938 926 #if H_3D_IC 939 927 if( pcDtParam->bUseIC ) … … 942 930 } 943 931 #endif 944 945 932 Pel* piOrg = pcDtParam->pOrg; 946 933 Pel* piCur = pcDtParam->pCur; … … 996 983 return xGetSADw( pcDtParam ); 997 984 } 998 999 985 #if H_3D_IC 1000 986 if( pcDtParam->bUseIC ) … … 1003 989 } 1004 990 #endif 1005 1006 991 Pel* piOrg = pcDtParam->pOrg; 1007 992 Pel* piCur = pcDtParam->pCur; … … 1096 1081 return xGetSADw( pcDtParam ); 1097 1082 } 1098 1099 1083 #if H_3D_IC 1100 1084 if( pcDtParam->bUseIC ) … … 1103 1087 } 1104 1088 #endif 1105 1106 1089 Pel* piOrg = pcDtParam->pOrg; 1107 1090 Pel* piCur = pcDtParam->pCur; … … 3420 3403 return xGetHADsw( pcDtParam ); 3421 3404 } 3422 3423 3405 #if H_3D_IC 3424 3406 if( pcDtParam->bUseIC ) … … 3427 3409 } 3428 3410 #endif 3429 3430 3411 Pel* piOrg = pcDtParam->pOrg; 3431 3412 Pel* piCur = pcDtParam->pCur; -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComRdCost.h
r504 r537 209 209 #if RATE_CONTROL_LAMBDA_DOMAIN 210 210 Double getLambda() { return m_dLambda; } 211 #if M0036_RC_IMPROVEMENT 212 Double getChromaWeight () {return((m_cbDistortionWeight+m_crDistortionWeight)/2.0);} 213 #endif 211 214 #endif 212 215 … … 331 334 #endif 332 335 333 #if RATE_CONTROL_LAMBDA_DOMAIN 336 #if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT 334 337 UInt getSADPart ( Int bitDepth, Pel* pelCur, Int curStride, Pel* pelOrg, Int orgStride, UInt width, UInt height ); 335 338 #endif -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComSlice.cpp
r534 r537 60 60 , m_deblockingFilterBetaOffsetDiv2 ( 0 ) 61 61 , m_deblockingFilterTcOffsetDiv2 ( 0 ) 62 #if !L0034_COMBINED_LIST_CLEANUP63 , m_bRefPicListModificationFlagLC ( false )64 , m_bRefPicListCombinationFlag ( false )65 #endif66 62 , m_bCheckLDC ( false ) 67 63 , m_iSliceQpDelta ( 0 ) … … 80 76 #else 81 77 , m_dLambda ( 0.0 ) 82 #endif83 #if !L0034_COMBINED_LIST_CLEANUP84 , m_bNoBackPredFlag ( false )85 78 #endif 86 79 , m_uiTLayer ( 0 ) … … 131 124 #endif 132 125 { 133 #if L0034_COMBINED_LIST_CLEANUP134 126 m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = 0; 135 #else136 m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = m_aiNumRefIdx[2] = 0;137 #endif138 127 139 128 initEqualRef(); 140 129 141 #if L0034_COMBINED_LIST_CLEANUP142 130 for ( Int idx = 0; idx < MAX_NUM_REF; idx++ ) 143 131 { 144 132 m_list1IdxToList0Idx[idx] = -1; 145 133 } 146 #else147 for(Int iNumCount = 0; iNumCount < MAX_NUM_REF_LC; iNumCount++)148 {149 m_iRefIdxOfLC[REF_PIC_LIST_0][iNumCount]=-1;150 m_iRefIdxOfLC[REF_PIC_LIST_1][iNumCount]=-1;151 m_eListIdFromIdxOfLC[iNumCount]=0;152 m_iRefIdxFromIdxOfLC[iNumCount]=0;153 m_iRefIdxOfL0FromRefIdxOfL1[iNumCount] = -1;154 m_iRefIdxOfL1FromRefIdxOfL0[iNumCount] = -1;155 }156 #endif157 134 for(Int iNumCount = 0; iNumCount < MAX_NUM_REF; iNumCount++) 158 135 { … … 213 190 m_colRefIdx = 0; 214 191 initEqualRef(); 215 #if !L0034_COMBINED_LIST_CLEANUP216 m_bNoBackPredFlag = false;217 m_bRefPicListCombinationFlag = false;218 m_bRefPicListModificationFlagLC = false;219 #endif220 192 m_bCheckLDC = false; 221 193 m_iSliceQpDeltaCb = 0; 222 194 m_iSliceQpDeltaCr = 0; 223 224 #if !L0034_COMBINED_LIST_CLEANUP225 m_aiNumRefIdx[REF_PIC_LIST_C] = 0;226 #endif227 195 228 196 #if H_3D_IV_MERGE … … 378 346 } 379 347 380 #if L0034_COMBINED_LIST_CLEANUP381 348 Void TComSlice::setList1IdxToList0Idx() 382 349 { … … 395 362 } 396 363 } 397 #else398 Void TComSlice::generateCombinedList()399 {400 if(m_aiNumRefIdx[REF_PIC_LIST_C] > 0)401 {402 m_aiNumRefIdx[REF_PIC_LIST_C]=0;403 for(Int iNumCount = 0; iNumCount < MAX_NUM_REF_LC; iNumCount++)404 {405 m_iRefIdxOfLC[REF_PIC_LIST_0][iNumCount]=-1;406 m_iRefIdxOfLC[REF_PIC_LIST_1][iNumCount]=-1;407 m_eListIdFromIdxOfLC[iNumCount]=0;408 m_iRefIdxFromIdxOfLC[iNumCount]=0;409 m_iRefIdxOfL0FromRefIdxOfL1[iNumCount] = -1;410 m_iRefIdxOfL1FromRefIdxOfL0[iNumCount] = -1;411 }412 413 for (Int iNumRefIdx = 0; iNumRefIdx < MAX_NUM_REF; iNumRefIdx++)414 {415 if(iNumRefIdx < m_aiNumRefIdx[REF_PIC_LIST_0])416 {417 Bool bTempRefIdxInL2 = true;418 for ( Int iRefIdxLC = 0; iRefIdxLC < m_aiNumRefIdx[REF_PIC_LIST_C]; iRefIdxLC++ )419 {420 #if H_MV421 if ( m_apcRefPicList[REF_PIC_LIST_0][iNumRefIdx]->getPOC() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getPOC() &&422 m_apcRefPicList[REF_PIC_LIST_0][iNumRefIdx]->getLayerId() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getLayerId() )423 #else424 if ( m_apcRefPicList[REF_PIC_LIST_0][iNumRefIdx]->getPOC() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getPOC() )425 #endif426 {427 m_iRefIdxOfL1FromRefIdxOfL0[iNumRefIdx] = m_iRefIdxFromIdxOfLC[iRefIdxLC];428 m_iRefIdxOfL0FromRefIdxOfL1[m_iRefIdxFromIdxOfLC[iRefIdxLC]] = iNumRefIdx;429 bTempRefIdxInL2 = false;430 break;431 }432 }433 434 if(bTempRefIdxInL2 == true)435 {436 m_eListIdFromIdxOfLC[m_aiNumRefIdx[REF_PIC_LIST_C]] = REF_PIC_LIST_0;437 m_iRefIdxFromIdxOfLC[m_aiNumRefIdx[REF_PIC_LIST_C]] = iNumRefIdx;438 m_iRefIdxOfLC[REF_PIC_LIST_0][iNumRefIdx] = m_aiNumRefIdx[REF_PIC_LIST_C]++;439 }440 }441 442 if(iNumRefIdx < m_aiNumRefIdx[REF_PIC_LIST_1])443 {444 Bool bTempRefIdxInL2 = true;445 for ( Int iRefIdxLC = 0; iRefIdxLC < m_aiNumRefIdx[REF_PIC_LIST_C]; iRefIdxLC++ )446 {447 #if H_MV448 if ( m_apcRefPicList[REF_PIC_LIST_1][iNumRefIdx]->getPOC() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getPOC() &&449 m_apcRefPicList[REF_PIC_LIST_1][iNumRefIdx]->getLayerId() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getLayerId() )450 #else451 if ( m_apcRefPicList[REF_PIC_LIST_1][iNumRefIdx]->getPOC() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getPOC() )452 #endif453 {454 m_iRefIdxOfL0FromRefIdxOfL1[iNumRefIdx] = m_iRefIdxFromIdxOfLC[iRefIdxLC];455 m_iRefIdxOfL1FromRefIdxOfL0[m_iRefIdxFromIdxOfLC[iRefIdxLC]] = iNumRefIdx;456 bTempRefIdxInL2 = false;457 break;458 }459 }460 if(bTempRefIdxInL2 == true)461 {462 m_eListIdFromIdxOfLC[m_aiNumRefIdx[REF_PIC_LIST_C]] = REF_PIC_LIST_1;463 m_iRefIdxFromIdxOfLC[m_aiNumRefIdx[REF_PIC_LIST_C]] = iNumRefIdx;464 m_iRefIdxOfLC[REF_PIC_LIST_1][iNumRefIdx] = m_aiNumRefIdx[REF_PIC_LIST_C]++;465 }466 }467 }468 }469 }470 #endif471 472 364 #if H_MV 473 365 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& refPicSetInterLayer , Bool checkNumPocTotalCurr) … … 506 398 UInt NumPocLtCurr = 0; 507 399 Int i; 400 508 401 for(i=0; i < m_pcRPS->getNumberOfNegativePictures(); i++) 509 402 { … … 585 478 } 586 479 587 assert(numPocTotalCurr !=0);480 assert(numPocTotalCurr > 0); 588 481 589 482 m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0); … … 617 510 } 618 511 #endif 512 assert(cIdx == numPocTotalCurr); 619 513 620 514 if (m_eSliceType==B_SLICE) … … 645 539 } 646 540 #endif 541 assert(cIdx == numPocTotalCurr); 647 542 } 648 543 … … 673 568 } 674 569 #else 675 676 for (Int rIdx = 0; rIdx <= (m_aiNumRefIdx[0]-1); rIdx ++)677 {678 m_apcRefPicList[0][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL0() ? rpsCurrList0[ m_RefPicListModification.getRefPicSetIdxL0(rIdx) ] : rpsCurrList0[rIdx % numPocTotalCurr];679 m_ bIsUsedAsLongTerm[0][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL0() ? (m_RefPicListModification.getRefPicSetIdxL0(rIdx) >= (NumPocStCurr0 + NumPocStCurr1))680 : ((rIdx % numPocTotalCurr) >= (NumPocStCurr0 + NumPocStCurr1));681 } 682 if ( m_eSliceType == P_SLICE )570 for (Int rIdx = 0; rIdx < m_aiNumRefIdx[0]; rIdx ++) 571 { 572 cIdx = m_RefPicListModification.getRefPicListModificationFlagL0() ? m_RefPicListModification.getRefPicSetIdxL0(rIdx) : rIdx % numPocTotalCurr; 573 assert(cIdx >= 0 && cIdx < numPocTotalCurr); 574 m_apcRefPicList[0][rIdx] = rpsCurrList0[ cIdx ]; 575 m_bIsUsedAsLongTerm[0][rIdx] = ( cIdx >= NumPocStCurr0 + NumPocStCurr1 ); 576 } 577 if ( m_eSliceType != B_SLICE ) 683 578 { 684 579 m_aiNumRefIdx[1] = 0; … … 687 582 else 688 583 { 689 for (Int rIdx = 0; rIdx <= (m_aiNumRefIdx[1]-1); rIdx ++) 690 { 691 m_apcRefPicList[1][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL1() ? rpsCurrList1[ m_RefPicListModification.getRefPicSetIdxL1(rIdx) ] : rpsCurrList1[rIdx % numPocTotalCurr]; 692 m_bIsUsedAsLongTerm[1][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL1() ? 693 (m_RefPicListModification.getRefPicSetIdxL1(rIdx) >= (NumPocStCurr0 + NumPocStCurr1)): ((rIdx % numPocTotalCurr) >= (NumPocStCurr0 + NumPocStCurr1)); 694 } 695 } 696 #endif 697 } 698 699 #if H_MV && !H_MV_FIX1071 700 // Temporary fix for FIX1071 should be removed later 701 Int TComSlice::getNumRpsCurrTempList( TComReferencePictureSet* rps /* = 0 */) 702 #else 584 for (Int rIdx = 0; rIdx < m_aiNumRefIdx[1]; rIdx ++) 585 { 586 cIdx = m_RefPicListModification.getRefPicListModificationFlagL1() ? m_RefPicListModification.getRefPicSetIdxL1(rIdx) : rIdx % numPocTotalCurr; 587 assert(cIdx >= 0 && cIdx < numPocTotalCurr); 588 m_apcRefPicList[1][rIdx] = rpsCurrList1[ cIdx ]; 589 m_bIsUsedAsLongTerm[1][rIdx] = ( cIdx >= NumPocStCurr0 + NumPocStCurr1 ); 590 } 591 } 592 #endif 593 } 594 703 595 Int TComSlice::getNumRpsCurrTempList() 704 #endif705 596 { 706 597 Int numRpsCurrTempList = 0; … … 710 601 return 0; 711 602 } 712 #if H_MV && !H_MV_FIX1071713 // Temporary fix for FIX1071 should be removed later714 if (rps == NULL)715 {716 rps = m_pcRPS;717 }718 719 for(UInt i=0; i < rps->getNumberOfNegativePictures()+ rps->getNumberOfPositivePictures() + rps->getNumberOfLongtermPictures(); i++)720 {721 if(rps->getUsed(i))722 #else723 603 for(UInt i=0; i < m_pcRPS->getNumberOfNegativePictures()+ m_pcRPS->getNumberOfPositivePictures() + m_pcRPS->getNumberOfLongtermPictures(); i++) 724 604 { 725 605 if(m_pcRPS->getUsed(i)) 726 #endif727 606 { 728 607 numRpsCurrTempList++; … … 945 824 m_deblockingFilterTcOffsetDiv2 = pSrc->m_deblockingFilterTcOffsetDiv2; 946 825 947 #if L0034_COMBINED_LIST_CLEANUP948 826 for (i = 0; i < 2; i++) 949 #else950 for (i = 0; i < 3; i++)951 #endif952 827 { 953 828 m_aiNumRefIdx[i] = pSrc->m_aiNumRefIdx[i]; 954 829 } 955 830 956 #if L0034_COMBINED_LIST_CLEANUP957 831 for (i = 0; i < MAX_NUM_REF; i++) 958 832 { 959 833 m_list1IdxToList0Idx[i] = pSrc->m_list1IdxToList0Idx[i]; 960 834 } 961 #else962 for (i = 0; i < 2; i++)963 {964 for (j = 0; j < MAX_NUM_REF_LC; j++)965 {966 m_iRefIdxOfLC[i][j] = pSrc->m_iRefIdxOfLC[i][j];967 }968 }969 for (i = 0; i < MAX_NUM_REF_LC; i++)970 {971 m_eListIdFromIdxOfLC[i] = pSrc->m_eListIdFromIdxOfLC[i];972 m_iRefIdxFromIdxOfLC[i] = pSrc->m_iRefIdxFromIdxOfLC[i];973 m_iRefIdxOfL1FromRefIdxOfL0[i] = pSrc->m_iRefIdxOfL1FromRefIdxOfL0[i];974 m_iRefIdxOfL0FromRefIdxOfL1[i] = pSrc->m_iRefIdxOfL0FromRefIdxOfL1[i];975 }976 m_bRefPicListModificationFlagLC = pSrc->m_bRefPicListModificationFlagLC;977 m_bRefPicListCombinationFlag = pSrc->m_bRefPicListCombinationFlag;978 #endif979 835 m_bCheckLDC = pSrc->m_bCheckLDC; 980 836 m_iSliceQpDelta = pSrc->m_iSliceQpDelta; … … 1014 870 1015 871 m_pcPic = pSrc->m_pcPic; 872 1016 873 m_colFromL0Flag = pSrc->m_colFromL0Flag; 1017 874 m_colRefIdx = pSrc->m_colRefIdx; … … 1033 890 } 1034 891 1035 #if !L0034_COMBINED_LIST_CLEANUP1036 m_bNoBackPredFlag = pSrc->m_bNoBackPredFlag;1037 #endif1038 892 m_uiTLayer = pSrc->m_uiTLayer; 1039 893 m_bTLayerSwitchingFlag = pSrc->m_bTLayerSwitchingFlag; … … 1366 1220 /** Function for constructing an explicit Reference Picture Set out of the available pictures in a referenced Reference Picture Set 1367 1221 */ 1368 #if FIX1071 && H_MV_FIX10711222 #if FIX1071 1369 1223 Void TComSlice::createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool isRAP) 1370 1224 #else … … 1395 1249 // and should be added to the explicit Reference Picture Set 1396 1250 pcRPS->setDeltaPOC(k, pReferencePictureSet->getDeltaPOC(i)); 1397 #if FIX1071 && H_MV_FIX10711251 #if FIX1071 1398 1252 pcRPS->setUsed(k, pReferencePictureSet->getUsed(i) && (!isRAP)); 1399 1253 #else … … 1566 1420 { 1567 1421 m_numReorderPics[i] = 0; 1568 #if L0323_DPB1569 1422 m_uiMaxDecPicBuffering[i] = 1; 1570 #else1571 m_uiMaxDecPicBuffering[i] = 0;1572 #endif1573 1423 m_uiMaxLatencyIncrease[i] = 0; 1574 1424 } … … 2005 1855 , m_pcmLog2MaxSize ( 5) 2006 1856 , m_uiPCMLog2MinSize ( 7) 2007 #if !L0034_COMBINED_LIST_CLEANUP2008 , m_bUseLComb (false)2009 #endif2010 1857 , m_bitDepthY ( 8) 2011 1858 , m_bitDepthC ( 8) … … 2037 1884 { 2038 1885 m_uiMaxLatencyIncrease[i] = 0; 2039 #if L0323_DPB2040 1886 m_uiMaxDecPicBuffering[i] = 1; 2041 #else2042 m_uiMaxDecPicBuffering[i] = 0;2043 #endif2044 1887 m_numReorderPics[i] = 0; 2045 1888 } … … 2079 1922 TComHRD *hrd = vui->getHrdParameters(); 2080 1923 2081 #if L0043_TIMING_INFO2082 1924 TimingInfo *timingInfo = vui->getTimingInfo(); 2083 1925 timingInfo->setTimingInfoPresentFlag( true ); … … 2103 1945 break; 2104 1946 } 2105 #else2106 hrd->setTimingInfoPresentFlag( true );2107 switch( frameRate )2108 {2109 case 24:2110 hrd->setNumUnitsInTick( 1125000 ); hrd->setTimeScale ( 27000000 );2111 break;2112 case 25:2113 hrd->setNumUnitsInTick( 1080000 ); hrd->setTimeScale ( 27000000 );2114 break;2115 case 30:2116 hrd->setNumUnitsInTick( 900900 ); hrd->setTimeScale ( 27000000 );2117 break;2118 case 50:2119 hrd->setNumUnitsInTick( 540000 ); hrd->setTimeScale ( 27000000 );2120 break;2121 case 60:2122 hrd->setNumUnitsInTick( 450450 ); hrd->setTimeScale ( 27000000 );2123 break;2124 default:2125 hrd->setNumUnitsInTick( 1001 ); hrd->setTimeScale ( 60000 );2126 break;2127 }2128 #endif2129 1947 2130 1948 Bool rateCnt = ( bitRate > 0 ); … … 2139 1957 hrd->setDuCpbRemovalDelayLengthMinus1( 7 ); // 8-bit precision ( plus 1 for last DU in AU ) 2140 1958 hrd->setSubPicCpbParamsInPicTimingSEIFlag( true ); 2141 #if L0044_DU_DPB_OUTPUT_DELAY_HRD2142 1959 hrd->setDpbOutputDelayDuLengthMinus1( 5 + 7 ); // With sub-clock tick factor of 100, at least 7 bits to have the same value as AU dpb delay 2143 #endif2144 1960 } 2145 1961 else … … 2170 1986 UInt birateValue, cpbSizeValue; 2171 1987 UInt ducpbSizeValue; 2172 #if L0363_DU_BIT_RATE2173 1988 UInt duBitRateValue = 0; 2174 #endif2175 1989 2176 1990 for( i = 0; i < MAX_TLAYER; i ++ ) … … 2184 1998 cpbSizeValue = bitRate; // 1 second 2185 1999 ducpbSizeValue = bitRate/numDU; 2186 #if L0363_DU_BIT_RATE2187 2000 duBitRateValue = bitRate; 2188 #endif2189 2001 for( j = 0; j < ( hrd->getCpbCntMinus1( i ) + 1 ); j ++ ) 2190 2002 { … … 2197 2009 hrd->setCpbSizeValueMinus1( i, j, 1, ( cpbSizeValue - 1 ) ); 2198 2010 hrd->setDuCpbSizeValueMinus1( i, j, 1, ( ducpbSizeValue - 1 ) ); 2199 #if L0363_DU_BIT_RATE2200 2011 hrd->setDuBitRateValueMinus1( i, j, 1, ( duBitRateValue - 1 ) ); 2201 #endif2202 2012 hrd->setCbrFlag( i, j, 1, ( j == 0 ) ); 2203 2013 } … … 2282 2092 } 2283 2093 #endif 2284 2285 2094 TComReferencePictureSet::TComReferencePictureSet() 2286 2095 : m_numberOfPictures (0) … … 3167 2976 , m_profileIdc (0) 3168 2977 , m_levelIdc (0) 3169 #if L0046_CONSTRAINT_FLAGS3170 2978 , m_progressiveSourceFlag (false) 3171 2979 , m_interlacedSourceFlag (false) 3172 2980 , m_nonPackedConstraintFlag(false) 3173 2981 , m_frameOnlyConstraintFlag(false) 3174 #endif3175 2982 { 3176 2983 ::memset(m_profileCompatibilityFlag, 0, sizeof(m_profileCompatibilityFlag)); … … 3205 3012 } 3206 3013 #endif 3207 3208 3014 //! \} -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComSlice.h
r535 r537 190 190 Int m_levelIdc; 191 191 192 #if L0046_CONSTRAINT_FLAGS193 192 Bool m_progressiveSourceFlag; 194 193 Bool m_interlacedSourceFlag; 195 194 Bool m_nonPackedConstraintFlag; 196 195 Bool m_frameOnlyConstraintFlag; 197 #endif198 196 199 197 public: … … 215 213 Void setLevelIdc(Int x) { m_levelIdc = x; } 216 214 217 #if L0046_CONSTRAINT_FLAGS218 215 Bool getProgressiveSourceFlag() const { return m_progressiveSourceFlag; } 219 216 Void setProgressiveSourceFlag(Bool b) { m_progressiveSourceFlag = b; } … … 227 224 Bool getFrameOnlyConstraintFlag() const { return m_frameOnlyConstraintFlag; } 228 225 Void setFrameOnlyConstraintFlag(Bool b) { m_frameOnlyConstraintFlag = b; } 229 #endif230 226 }; 231 227 … … 253 249 }; 254 250 /// VPS class 255 256 #if SIGNAL_BITRATE_PICRATE_IN_VPS257 class TComBitRatePicRateInfo258 {259 Bool m_bitRateInfoPresentFlag[MAX_TLAYER];260 Bool m_picRateInfoPresentFlag[MAX_TLAYER];261 Int m_avgBitRate[MAX_TLAYER];262 Int m_maxBitRate[MAX_TLAYER];263 Int m_constantPicRateIdc[MAX_TLAYER];264 Int m_avgPicRate[MAX_TLAYER];265 public:266 TComBitRatePicRateInfo();267 Bool getBitRateInfoPresentFlag(Int i) {return m_bitRateInfoPresentFlag[i];}268 Void setBitRateInfoPresentFlag(Int i, Bool x) {m_bitRateInfoPresentFlag[i] = x;}269 270 Bool getPicRateInfoPresentFlag(Int i) {return m_picRateInfoPresentFlag[i];}271 Void setPicRateInfoPresentFlag(Int i, Bool x) {m_picRateInfoPresentFlag[i] = x;}272 273 Int getAvgBitRate(Int i) {return m_avgBitRate[i];}274 Void setAvgBitRate(Int i, Int x) {m_avgBitRate[i] = x;}275 276 Int getMaxBitRate(Int i) {return m_maxBitRate[i];}277 Void setMaxBitRate(Int i, Int x) {m_maxBitRate[i] = x;}278 279 Int getConstantPicRateIdc(Int i) {return m_constantPicRateIdc[i];}280 Void setConstantPicRateIdc(Int i, Int x) {m_constantPicRateIdc[i] = x;}281 282 Int getAvgPicRate(Int i) {return m_avgPicRate[i];}283 Void setAvgPicRate(Int i, Int x) {m_avgPicRate[i] = x;}284 };285 #endif286 251 287 252 struct HrdSubLayerInfo … … 296 261 UInt ducpbSizeValue [MAX_CPB_CNT][2]; 297 262 UInt cbrFlag [MAX_CPB_CNT][2]; 298 #if L0363_DU_BIT_RATE299 263 UInt duBitRateValue [MAX_CPB_CNT][2]; 300 #endif301 264 }; 302 265 … … 304 267 { 305 268 private: 306 #if !L0043_TIMING_INFO307 Bool m_timingInfoPresentFlag;308 UInt m_numUnitsInTick;309 UInt m_timeScale;310 #endif311 269 Bool m_nalHrdParametersPresentFlag; 312 270 Bool m_vclHrdParametersPresentFlag; … … 315 273 UInt m_duCpbRemovalDelayLengthMinus1; 316 274 Bool m_subPicCpbParamsInPicTimingSEIFlag; 317 #if L0044_DU_DPB_OUTPUT_DELAY_HRD318 275 UInt m_dpbOutputDelayDuLengthMinus1; 319 #endif320 276 UInt m_bitRateScale; 321 277 UInt m_cpbSizeScale; … … 329 285 public: 330 286 TComHRD() 331 #if !L0043_TIMING_INFO332 :m_timingInfoPresentFlag(false)333 ,m_numUnitsInTick(1001)334 ,m_timeScale(60000)335 ,m_nalHrdParametersPresentFlag(0)336 #else337 287 :m_nalHrdParametersPresentFlag(0) 338 #endif339 288 ,m_vclHrdParametersPresentFlag(0) 340 289 ,m_subPicCpbParamsPresentFlag(false) … … 342 291 ,m_duCpbRemovalDelayLengthMinus1(0) 343 292 ,m_subPicCpbParamsInPicTimingSEIFlag(false) 344 #if L0044_DU_DPB_OUTPUT_DELAY_HRD345 293 ,m_dpbOutputDelayDuLengthMinus1(0) 346 #endif347 294 ,m_bitRateScale(0) 348 295 ,m_cpbSizeScale(0) … … 353 300 354 301 virtual ~TComHRD() {} 355 #if !L0043_TIMING_INFO356 Void setTimingInfoPresentFlag ( Bool flag ) { m_timingInfoPresentFlag = flag; }357 Bool getTimingInfoPresentFlag ( ) { return m_timingInfoPresentFlag; }358 359 Void setNumUnitsInTick ( UInt value ) { m_numUnitsInTick = value; }360 UInt getNumUnitsInTick ( ) { return m_numUnitsInTick; }361 362 Void setTimeScale ( UInt value ) { m_timeScale = value; }363 UInt getTimeScale ( ) { return m_timeScale; }364 #endif365 302 366 303 Void setNalHrdParametersPresentFlag ( Bool flag ) { m_nalHrdParametersPresentFlag = flag; } … … 382 319 Bool getSubPicCpbParamsInPicTimingSEIFlag () { return m_subPicCpbParamsInPicTimingSEIFlag; } 383 320 384 #if L0044_DU_DPB_OUTPUT_DELAY_HRD385 321 Void setDpbOutputDelayDuLengthMinus1 (UInt value ) { m_dpbOutputDelayDuLengthMinus1 = value; } 386 322 UInt getDpbOutputDelayDuLengthMinus1 () { return m_dpbOutputDelayDuLengthMinus1; } 387 #endif388 323 389 324 Void setBitRateScale ( UInt value ) { m_bitRateScale = value; } … … 426 361 Void setDuCpbSizeValueMinus1 ( Int layer, Int cpbcnt, Int nalOrVcl, UInt value ) { m_HRD[layer].ducpbSizeValue[cpbcnt][nalOrVcl] = value; } 427 362 UInt getDuCpbSizeValueMinus1 ( Int layer, Int cpbcnt, Int nalOrVcl ) { return m_HRD[layer].ducpbSizeValue[cpbcnt][nalOrVcl]; } 428 #if L0363_DU_BIT_RATE429 363 Void setDuBitRateValueMinus1 ( Int layer, Int cpbcnt, Int nalOrVcl, UInt value ) { m_HRD[layer].duBitRateValue[cpbcnt][nalOrVcl] = value; } 430 364 UInt getDuBitRateValueMinus1 (Int layer, Int cpbcnt, Int nalOrVcl ) { return m_HRD[layer].duBitRateValue[cpbcnt][nalOrVcl]; } 431 #endif432 365 Void setCbrFlag ( Int layer, Int cpbcnt, Int nalOrVcl, UInt value ) { m_HRD[layer].cbrFlag[cpbcnt][nalOrVcl] = value; } 433 366 Bool getCbrFlag ( Int layer, Int cpbcnt, Int nalOrVcl ) { return m_HRD[layer].cbrFlag[cpbcnt][nalOrVcl]; } … … 435 368 Void setNumDU ( UInt value ) { m_numDU = value; } 436 369 UInt getNumDU ( ) { return m_numDU; } 437 #if L0045_CONDITION_SIGNALLING438 370 Bool getCpbDpbDelaysPresentFlag() { return getNalHrdParametersPresentFlag() || getVclHrdParametersPresentFlag(); } 439 #endif440 371 }; 441 372 442 #if L0043_TIMING_INFO443 373 class TimingInfo 444 374 { … … 471 401 Void setNumTicksPocDiffOneMinus1 (Int x ) { m_numTicksPocDiffOneMinus1 = x; } 472 402 }; 473 #endif474 403 475 404 class TComVPS … … 483 412 UInt m_numReorderPics[MAX_TLAYER]; 484 413 UInt m_uiMaxDecPicBuffering[MAX_TLAYER]; 485 UInt m_uiMaxLatencyIncrease[MAX_TLAYER]; 414 UInt m_uiMaxLatencyIncrease[MAX_TLAYER]; // Really max latency increase plus 1 (value 0 expresses no limit) 486 415 487 416 UInt m_numHrdParameters; … … 507 436 TComPTL m_pcPTL; 508 437 #endif 509 #if SIGNAL_BITRATE_PICRATE_IN_VPS510 TComBitRatePicRateInfo m_bitRatePicRateInfo;511 #endif512 #if L0043_TIMING_INFO513 438 TimingInfo m_timingInfo; 514 #endif515 516 439 #if H_MV 517 440 /// VPS EXTENSION SYNTAX ELEMENTS … … 648 571 TComPTL* getPTL() { return &m_pcPTL; } 649 572 #endif 650 #if SIGNAL_BITRATE_PICRATE_IN_VPS651 TComBitRatePicRateInfo *getBitratePicrateInfo() { return &m_bitRatePicRateInfo; }652 #endif653 #if L0043_TIMING_INFO654 573 TimingInfo* getTimingInfo() { return &m_timingInfo; } 655 #endif656 574 #if H_MV 657 575 Void setAvcBaseLayerFlag( Bool val ) { m_avcBaseLayerFlag = val; } … … 878 796 Int m_log2MaxMvLengthVertical; 879 797 TComHRD m_hrdParameters; 880 #if L0043_TIMING_INFO881 798 TimingInfo m_timingInfo; 882 #else883 Bool m_pocProportionalToTimingFlag;884 Int m_numTicksPocDiffOneMinus1;885 #endif886 799 #if H_MV 887 800 Bool m_tileBoundariesAlignedFlag; 888 801 #endif 802 889 803 public: 890 804 TComVUI() … … 918 832 ,m_log2MaxMvLengthHorizontal(15) 919 833 ,m_log2MaxMvLengthVertical(15) 920 #if !L0043_TIMING_INFO921 ,m_pocProportionalToTimingFlag(false)922 ,m_numTicksPocDiffOneMinus1(0)923 #endif924 834 #if H_MV 925 835 ,m_tileBoundariesAlignedFlag(true) … … 1019 929 1020 930 TComHRD* getHrdParameters () { return &m_hrdParameters; } 1021 #if L0043_TIMING_INFO1022 931 TimingInfo* getTimingInfo() { return &m_timingInfo; } 1023 #else 1024 Bool getPocProportionalToTimingFlag() {return m_pocProportionalToTimingFlag; } 1025 Void setPocProportionalToTimingFlag(Bool x) {m_pocProportionalToTimingFlag = x;} 1026 Int getNumTicksPocDiffOneMinus1() {return m_numTicksPocDiffOneMinus1;} 1027 Void setNumTicksPocDiffOneMinus1(Int x) { m_numTicksPocDiffOneMinus1 = x;} 1028 #endif 1029 #if H_MV 1030 Bool getTileBoundariesAlignedFlag( ) { return m_tileBoundariesAlignedFlag; } 932 #if H_MV 933 Bool getTileBoundariesAlignedFlag( ) { return m_tileBoundariesAlignedFlag; } 1031 934 Void setTileBoundariesAlignedFlag( Bool flag ) { m_tileBoundariesAlignedFlag = flag; } 1032 935 #endif … … 1070 973 Bool m_useAMP; 1071 974 1072 #if !L0034_COMBINED_LIST_CLEANUP1073 Bool m_bUseLComb;1074 #endif1075 1076 975 // Parameter 1077 976 Int m_bitDepthY; … … 1102 1001 TComScalingList* m_scalingList; //!< ScalingList class pointer 1103 1002 UInt m_uiMaxDecPicBuffering[MAX_TLAYER]; 1104 UInt m_uiMaxLatencyIncrease[MAX_TLAYER]; 1003 UInt m_uiMaxLatencyIncrease[MAX_TLAYER]; // Really max latency increase plus 1 (value 0 expresses no limit) 1105 1004 1106 1005 Bool m_useDF; … … 1203 1102 1204 1103 // Tool list 1205 #if !L0034_COMBINED_LIST_CLEANUP1206 Void setUseLComb (Bool b) { m_bUseLComb = b; }1207 Bool getUseLComb () { return m_bUseLComb; }1208 #endif1209 1210 1104 Bool getUseLossless () { return m_useLossless; } 1211 1105 Void setUseLossless ( Bool b ) { m_useLossless = b; } … … 1554 1448 Int m_deblockingFilterBetaOffsetDiv2; //< beta offset for deblocking filter 1555 1449 Int m_deblockingFilterTcOffsetDiv2; //< tc offset for deblocking filter 1556 #if L0034_COMBINED_LIST_CLEANUP1557 1450 Int m_list1IdxToList0Idx[MAX_NUM_REF]; 1558 1451 Int m_aiNumRefIdx [2]; // for multiple reference of current slice 1559 #else1560 Int m_aiNumRefIdx [3]; // for multiple reference of current slice1561 1562 Int m_iRefIdxOfLC[2][MAX_NUM_REF_LC];1563 Int m_eListIdFromIdxOfLC[MAX_NUM_REF_LC];1564 Int m_iRefIdxFromIdxOfLC[MAX_NUM_REF_LC];1565 Int m_iRefIdxOfL1FromRefIdxOfL0[MAX_NUM_REF_LC];1566 Int m_iRefIdxOfL0FromRefIdxOfL1[MAX_NUM_REF_LC];1567 Bool m_bRefPicListModificationFlagLC;1568 Bool m_bRefPicListCombinationFlag;1569 #endif1570 1452 1571 1453 Bool m_bCheckLDC; … … 1608 1490 1609 1491 Bool m_abEqualRef [2][MAX_NUM_REF][MAX_NUM_REF]; 1610 #if !L0034_COMBINED_LIST_CLEANUP1611 Bool m_bNoBackPredFlag;1612 #endif1613 1492 UInt m_uiTLayer; 1614 1493 Bool m_bTLayerSwitchingFlag; … … 1685 1564 #endif 1686 1565 #endif 1687 1688 1566 public: 1689 1567 TComSlice(); … … 1761 1639 UInt getARPStepNum( ) { return m_nARPStepNum; } 1762 1640 #endif 1763 1764 1641 Int getDepth () { return m_iDepth; } 1765 1642 UInt getColFromL0Flag () { return m_colFromL0Flag; } … … 1769 1646 Bool getCheckLDC () { return m_bCheckLDC; } 1770 1647 Bool getMvdL1ZeroFlag () { return m_bLMvdL1Zero; } 1771 #if H_MV && !H_MV_FIX1071 // This is a temporary fix of the temporary fix L01771772 Int getNumRpsCurrTempList( TComReferencePictureSet* rps = NULL );1773 #else1774 1648 Int getNumRpsCurrTempList(); 1775 #endif1776 #if L0034_COMBINED_LIST_CLEANUP1777 1649 Int getList1IdxToList0Idx ( Int list1Idx ) { return m_list1IdxToList0Idx[list1Idx]; } 1778 #else1779 Int getRefIdxOfLC (RefPicList e, Int iRefIdx) { return m_iRefIdxOfLC[e][iRefIdx]; }1780 Int getListIdFromIdxOfLC(Int iRefIdx) { return m_eListIdFromIdxOfLC[iRefIdx]; }1781 Int getRefIdxFromIdxOfLC(Int iRefIdx) { return m_iRefIdxFromIdxOfLC[iRefIdx]; }1782 Int getRefIdxOfL0FromRefIdxOfL1(Int iRefIdx) { return m_iRefIdxOfL0FromRefIdxOfL1[iRefIdx];}1783 Int getRefIdxOfL1FromRefIdxOfL0(Int iRefIdx) { return m_iRefIdxOfL1FromRefIdxOfL0[iRefIdx];}1784 Bool getRefPicListModificationFlagLC() {return m_bRefPicListModificationFlagLC;}1785 Void setRefPicListModificationFlagLC(Bool bflag) {m_bRefPicListModificationFlagLC=bflag;}1786 Bool getRefPicListCombinationFlag() {return m_bRefPicListCombinationFlag;}1787 Void setRefPicListCombinationFlag(Bool bflag) {m_bRefPicListCombinationFlag=bflag;}1788 #endif1789 1650 Void setReferenced(Bool b) { m_bRefenced = b; } 1790 1651 Bool isReferenced() { return m_bRefenced; } … … 1861 1722 1862 1723 static Void sortPicList ( TComList<TComPic*>& rcListPic ); 1863 #if L0034_COMBINED_LIST_CLEANUP1864 1724 Void setList1IdxToList0Idx(); 1865 #else1866 Bool getNoBackPredFlag() { return m_bNoBackPredFlag; }1867 Void setNoBackPredFlag( Bool b ) { m_bNoBackPredFlag = b; }1868 Void generateCombinedList ();1869 #endif1870 1725 1871 1726 UInt getTLayer () { return m_uiTLayer; } … … 1880 1735 static Void markCurrPic ( TComPic* currPic );; 1881 1736 static Void markIvRefPicsAsUnused ( TComPicLists* ivPicLists, std::vector<Int> targetDecLayerIdSet, TComVPS* vps, Int curLayerId, Int curPoc ); 1882 1883 1884 Void xPrintRefPicList(); 1737 Void xPrintRefPicList(); 1885 1738 #endif 1886 1739 Bool isTemporalLayerSwitchingPoint( TComList<TComPic*>& rcListPic ); 1887 1740 Bool isStepwiseTemporalLayerSwitchingPointCandidate( TComList<TComPic*>& rcListPic ); 1888 1741 Int checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool printErrors, Int pocRandomAccess = 0); 1889 #if FIX1071 && H_MV_FIX10711742 #if FIX1071 1890 1743 Void createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool isRAP); 1891 1744 #else … … 2036 1889 2037 1890 #endif 2038 2039 1891 protected: 2040 1892 TComPic* xGetRefPic (TComList<TComPic*>& rcListPic, -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComTrQuant.cpp
r446 r537 1075 1075 Int iTransformShift = MAX_TR_DYNAMIC_RANGE - uiBitDepth - uiLog2TrSize; // Represents scaling through forward transform 1076 1076 1077 Int iQBits = QUANT_SHIFT + m_cQP.m_iPer + iTransformShift; // Right shift of non-RDOQ quantizer; level = (coeff*uiQ + offset)>>q_bits1078 1079 iAdd = (pcCU->getSlice()->getSliceType()==I_SLICE ? 171 : 85) << (iQBits-9);1080 1081 1077 #if ADAPTIVE_QP_SELECTION 1082 iQBits = QUANT_SHIFT + cQpBase.m_iPer + iTransformShift;1078 Int iQBits = QUANT_SHIFT + cQpBase.m_iPer + iTransformShift; 1083 1079 iAdd = (pcCU->getSlice()->getSliceType()==I_SLICE ? 171 : 85) << (iQBits-9); 1084 1080 Int iQBitsC = QUANT_SHIFT + cQpBase.m_iPer + iTransformShift - ARL_C_PRECISION; 1085 1081 Int iAddC = 1 << (iQBitsC-1); 1082 #else 1083 Int iQBits = QUANT_SHIFT + m_cQP.m_iPer + iTransformShift; // Right shift of non-RDOQ quantizer; level = (coeff*uiQ + offset)>>q_bits 1084 iAdd = (pcCU->getSlice()->getSliceType()==I_SLICE ? 171 : 85) << (iQBits-9); 1086 1085 #endif 1087 1086 … … 1347 1346 #else 1348 1347 Int j; 1349 { 1350 Short block[ 64 * 64 ]; 1351 Short coeff[ 64 * 64 ]; 1352 { 1348 Short block[ 32 * 32 ]; 1349 Short coeff[ 32 * 32 ]; 1353 1350 for (j = 0; j < iHeight; j++) 1354 1351 { 1355 1352 memcpy( block + j * iWidth, piBlkResi + j * uiStride, iWidth * sizeof( Short ) ); 1356 1353 } 1357 }1358 1354 xTrMxN(bitDepth, block, coeff, iWidth, iHeight, uiMode ); 1359 1355 for ( j = 0; j < iHeight * iWidth; j++ ) … … 1361 1357 psCoeff[ j ] = coeff[ j ]; 1362 1358 } 1363 return ;1364 }1365 1359 #endif 1366 1360 } … … 1382 1376 Int j; 1383 1377 { 1384 Short block[ 64 * 64];1385 Short coeff[ 64 * 64];1378 Short block[ 32 * 32 ]; 1379 Short coeff[ 32 * 32 ]; 1386 1380 for ( j = 0; j < iHeight * iWidth; j++ ) 1387 1381 { … … 1505 1499 UInt uiAbsPartIdx ) 1506 1500 { 1507 Int iQBits = m_cQP.m_iBits;1508 Double dTemp = 0;1509 1501 UInt uiLog2TrSize = g_aucConvertToBit[ uiWidth ] + 2; 1510 Int uiQ = g_quantScales[m_cQP.rem()];1511 1502 1512 1503 UInt uiBitDepth = eTType == TEXT_LUMA ? g_bitDepthY : g_bitDepthC; … … 1519 1510 assert(scalingListType < 6); 1520 1511 1521 iQBits = QUANT_SHIFT + m_cQP.m_iPer + iTransformShift; // Right shift of non-RDOQ quantizer; level = (coeff*uiQ + offset)>>q_bits 1522 Double dErrScale = 0; 1512 Int iQBits = QUANT_SHIFT + m_cQP.m_iPer + iTransformShift; // Right shift of non-RDOQ quantizer; level = (coeff*uiQ + offset)>>q_bits 1523 1513 Double *pdErrScaleOrg = getErrScaleCoeff(scalingListType,uiLog2TrSize-2,m_cQP.m_iRem); 1524 1514 Int *piQCoefOrg = getQuantCoeff(scalingListType,m_cQP.m_iRem,uiLog2TrSize-2); … … 1572 1562 Double d64BaseCost = 0; 1573 1563 Int iLastScanPos = -1; 1574 dTemp = dErrScale;1575 1564 1576 1565 UInt c1Idx = 0; … … 1601 1590 UInt uiBlkPos = scan[iScanPos]; 1602 1591 // set coeff 1603 uiQ = piQCoef[uiBlkPos];1604 dTemp = pdErrScale[uiBlkPos];1592 Int uiQ = piQCoef[uiBlkPos]; 1593 Double dTemp = pdErrScale[uiBlkPos]; 1605 1594 Int lLevelDouble = plSrcCoeff[ uiBlkPos ]; 1606 1595 lLevelDouble = (Int)min<Int64>((Int64)abs((Int)lLevelDouble) * uiQ , MAX_INT - (1 << (iQBits - 1))); -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComWeightPrediction.cpp
r324 r537 271 271 Void TComWeightPrediction::getWpScaling( TComDataCU* pcCU, Int iRefIdx0, Int iRefIdx1, wpScalingParam *&wp0, wpScalingParam *&wp1) 272 272 { 273 assert(iRefIdx0 >= 0 || iRefIdx1 >= 0); 274 273 275 TComSlice* pcSlice = pcCU->getSlice(); 274 276 TComPPS* pps = pcCU->getSlice()->getPPS(); -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TypeDef.h
r534 r537 41 41 //! \ingroup TLibCommon 42 42 //! \{ 43 44 43 ///////////////////////////////////////////////////////////////////////////////////////// 45 44 ///////////////////////////////// EXTENSION SELECTION /////////////////////////////////// … … 204 203 ///////////////////////////////////////////////////////////////////////////////////////// 205 204 206 #define FIX1071 1 ///< Temporary fix for issue #1071 207 208 #define L0208_SOP_DESCRIPTION_SEI 1 ///< L0208: add SOP descrioption SEI 205 #define FIX1071 1 ///< fix for issue #1071 206 209 207 #define MAX_NUM_PICS_IN_SOP 1024 210 208 211 #define K0180_SCALABLE_NESTING_SEI 1 ///JCTVC-K0180 scalable nesting sei message212 209 #define MAX_NESTING_NUM_OPS 1024 213 210 #define MAX_NESTING_NUM_LAYER 64 214 215 #define J0149_TONE_MAPPING_SEI 1 ///< J0149: Tone mapping information SEI216 #define L0363_DU_BIT_RATE 1 ///< L0363: add bit_rate_du_value_minus1 to HRD parameters217 #define L0328_SPLICING 1 ///< L0328: splicing support in HRD218 #define L0044_DU_DPB_OUTPUT_DELAY_HRD 1 ///< L0044: Include dpb_output_delay_du_length_minus1 in hrd_parameters(), dpb_output_du_delay in219 ///< picture timing SEI and DU information SEI220 #define L0045_PERSISTENCE_FLAGS 1 ///< L0045: Replace "repetition_period" syntax elements in SEI with "persistence_flag"221 #define L0045_NON_NESTED_SEI_RESTRICTIONS 1 ///< L0045; Include restriction on the order of APS and non-nested BP, PT and DU info SEI messages222 #define L0044_CPB_DPB_DELAY_OFFSET 1 ///< L0044: Include syntax elements cpb_delay_offset and dpb_delay_offset in the BP SEI message223 #define L0047_APS_FLAGS 1 ///< L0047: Include full_random_access_flag and no_param_set_update_flag in the active parameter set SEI message224 #define L0043_TIMING_INFO 1 ///< L0043: Timing information is signalled in VUI outside hrd_parameters()225 #define L0046_RENAME_PROG_SRC_IDC 1 ///< L0046: Rename progressive_source_idc to source_scan_type226 #define L0045_CONDITION_SIGNALLING 1 ///< L0045: Condition the signaling of some syntax elements in picture timing SEI message227 #define L0043_MSS_IDC 1228 #define L0116_ENTRY_POINT 1229 #define L0363_MORE_BITS 1230 #define L0363_MVP_POC 1231 #define L0363_BYTE_ALIGN 1232 #define L0363_SEI_ALLOW_SUFFIX 1233 #define L0323_LIMIT_DEFAULT_LIST_SIZE 1234 #define L0046_CONSTRAINT_FLAGS 1235 #define L0255_MOVE_PPS_FLAGS 1 ///< move some flags to earlier positions in the PPS236 #define L0444_FPA_TYPE 1 ///< allow only FPA types 3, 4 and 5237 #define L0372 1238 #define SIGNAL_BITRATE_PICRATE_IN_VPS 0 ///< K0125: Signal bit_rate and pic_rate in VPS239 #define L0232_RD_PENALTY 1 ///< L0232: RD-penalty for 32x32 TU for intra in non-intra slices240 #define L0386_DB_METRIC 1 ///< L0386: non-normative blockiness metric (automatically configures deblocking parameters in bitstream)241 #define L0323_DPB 1 ///< L0323: Specification of active reference indices and decoded picture buffer242 243 #define L0034_COMBINED_LIST_CLEANUP 1244 211 245 212 #define MAX_VPS_NUM_HRD_PARAMETERS 1 … … 254 221 255 222 #define RATE_CONTROL_LAMBDA_DOMAIN 1 ///< JCTVC-K0103, rate control by R-lambda model 256 #define L0033_RC_BUGFIX 1 ///< JCTVC-L0033, bug fix for R-lambda model based rate control 223 #define M0036_RC_IMPROVEMENT 1 ///< JCTVC-M0036, improvement for R-lambda model based rate control 224 #define TICKET_1090_FIX 1 225 226 #define RC_FIX 1 /// suggested fix for M0036 227 #define RATE_CONTROL_INTRA 1 ///< JCTVC-M0257, rate control for intra 257 228 258 229 #define MAX_CPB_CNT 32 ///< Upper bound of (cpb_cnt_minus1 + 1) … … 281 252 282 253 #define REMOVE_SAO_LCU_ENC_CONSTRAINTS_3 1 ///< disable the encoder constraint that conditionally disable SAO for chroma for entire slice in interleaved mode 283 284 #define REMOVE_SINGLE_SEI_EXTENSION_FLAGS 1 ///< remove display orientation SEI extension flag (there is a generic SEI extension mechanism now)285 254 286 255 #define SAO_ENCODING_CHOICE 1 ///< I0184: picture early termination … … 601 570 REF_PIC_LIST_0 = 0, ///< reference list 0 602 571 REF_PIC_LIST_1 = 1, ///< reference list 1 603 #if !L0034_COMBINED_LIST_CLEANUP604 REF_PIC_LIST_C = 2, ///< combined reference list for uni-prediction in B-Slices605 #endif606 572 REF_PIC_LIST_X = 100 ///< special mark 607 573 }; -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/SEIread.cpp
r446 r537 90 90 fprintf( g_hTrace, "=========== Decoding Unit Information SEI message ===========\n"); 91 91 break; 92 #if J0149_TONE_MAPPING_SEI93 92 case SEI::TONE_MAPPING_INFO: 94 93 fprintf( g_hTrace, "===========Tone Mapping Info SEI message ===========\n"); 95 94 break; 96 #endif97 #if L0208_SOP_DESCRIPTION_SEI98 95 case SEI::SOP_DESCRIPTION: 99 96 fprintf( g_hTrace, "=========== SOP Description SEI message ===========\n"); 100 97 break; 101 #endif102 #if K0180_SCALABLE_NESTING_SEI103 98 case SEI::SCALABLE_NESTING: 104 99 fprintf( g_hTrace, "=========== Scalable Nesting SEI message ===========\n"); 105 100 break; 106 #endif107 101 default: 108 102 fprintf( g_hTrace, "=========== Unknown SEI message ===========\n"); … … 234 228 xParseSEIGradualDecodingRefreshInfo((SEIGradualDecodingRefreshInfo&) *sei, payloadSize); 235 229 break; 236 #if J0149_TONE_MAPPING_SEI237 230 case SEI::TONE_MAPPING_INFO: 238 231 sei = new SEIToneMappingInfo; 239 232 xParseSEIToneMappingInfo((SEIToneMappingInfo&) *sei, payloadSize); 240 233 break; 241 #endif242 #if L0208_SOP_DESCRIPTION_SEI243 234 case SEI::SOP_DESCRIPTION: 244 235 sei = new SEISOPDescription; 245 236 xParseSEISOPDescription((SEISOPDescription&) *sei, payloadSize); 246 237 break; 247 #endif248 #if K0180_SCALABLE_NESTING_SEI249 238 case SEI::SCALABLE_NESTING: 250 239 sei = new SEIScalableNesting; 251 240 xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, sps); 252 241 break; 253 #endif254 242 default: 255 243 for (UInt i = 0; i < payloadSize; i++) … … 265 253 switch (payloadType) 266 254 { 267 #if L0363_SEI_ALLOW_SUFFIX268 255 case SEI::USER_DATA_UNREGISTERED: 269 256 sei = new SEIuserDataUnregistered; 270 257 xParseSEIuserDataUnregistered((SEIuserDataUnregistered&) *sei, payloadSize); 271 258 break; 272 #endif273 259 case SEI::DECODED_PICTURE_HASH: 274 260 sei = new SEIDecodedPictureHash; … … 402 388 UInt val; 403 389 READ_CODE(4, val, "active_vps_id"); sei.activeVPSId = val; 404 #if L0047_APS_FLAGS405 390 READ_FLAG( val, "full_random_access_flag"); sei.m_fullRandomAccessFlag = val ? true : false; 406 391 READ_FLAG( val, "no_param_set_update_flag"); sei.m_noParamSetUpdateFlag = val ? true : false; 407 #endif408 392 READ_UVLC( val, "num_sps_ids_minus1"); sei.numSpsIdsMinus1 = val; 409 393 … … 438 422 sei.m_duSptCpbRemovalDelay = 0; 439 423 } 440 #if L0044_DU_DPB_OUTPUT_DELAY_HRD441 424 READ_FLAG( val, "dpb_output_du_delay_present_flag"); sei.m_dpbOutputDuDelayPresentFlag = val ? true : false; 442 425 if(sei.m_dpbOutputDuDelayPresentFlag) … … 445 428 sei.m_picSptDpbOutputDuDelay = val; 446 429 } 447 #endif448 430 xParseByteAlign(); 449 431 } … … 462 444 READ_FLAG( code, "rap_cpb_params_present_flag" ); sei.m_rapCpbParamsPresentFlag = code; 463 445 } 464 #if L0328_SPLICING465 446 //read splicing flag and cpb_removal_delay_delta 466 447 READ_FLAG( code, "concatenation_flag"); … … 468 449 READ_CODE( ( pHRD->getCpbRemovalDelayLengthMinus1() + 1 ), code, "au_cpb_removal_delay_delta_minus1" ); 469 450 sei.m_auCpbRemovalDelayDelta = code + 1; 470 #endif471 #if L0044_CPB_DPB_DELAY_OFFSET472 451 if( sei.m_rapCpbParamsPresentFlag ) 473 452 { … … 475 454 READ_CODE( pHRD->getDpbOutputDelayLengthMinus1() + 1, code, "dpb_delay_offset" ); sei.m_dpbDelayOffset = code; 476 455 } 477 #endif478 456 for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) 479 457 { … … 507 485 TComHRD *hrd = vui->getHrdParameters(); 508 486 509 #if !L0045_CONDITION_SIGNALLING510 // This condition was probably OK before the pic_struct, progressive_source_idc, duplicate_flag were added511 if( !hrd->getNalHrdParametersPresentFlag() && !hrd->getVclHrdParametersPresentFlag() )512 {513 return;514 }515 #endif516 517 487 if( vui->getFrameFieldInfoPresentFlag() ) 518 488 { 519 489 READ_CODE( 4, code, "pic_struct" ); sei.m_picStruct = code; 520 #if L0046_RENAME_PROG_SRC_IDC521 490 READ_CODE( 2, code, "source_scan_type" ); sei.m_sourceScanType = code; 522 #else523 READ_CODE( 2, code, "progressive_source_idc" ); sei.m_progressiveSourceIdc = code;524 #endif525 491 READ_FLAG( code, "duplicate_flag" ); sei.m_duplicateFlag = ( code == 1 ? true : false ); 526 492 } 527 493 528 #if L0045_CONDITION_SIGNALLING529 494 if( hrd->getCpbDpbDelaysPresentFlag()) 530 495 { 531 #endif532 496 READ_CODE( ( hrd->getCpbRemovalDelayLengthMinus1() + 1 ), code, "au_cpb_removal_delay_minus1" ); 533 497 sei.m_auCpbRemovalDelay = code + 1; … … 535 499 sei.m_picDpbOutputDelay = code; 536 500 537 #if L0044_DU_DPB_OUTPUT_DELAY_HRD538 501 if(hrd->getSubPicCpbParamsPresentFlag()) 539 502 { … … 541 504 sei.m_picDpbOutputDuDelay = code; 542 505 } 543 #endif544 506 if( hrd->getSubPicCpbParamsPresentFlag() && hrd->getSubPicCpbParamsInPicTimingSEIFlag() ) 545 507 { … … 575 537 } 576 538 } 577 #if L0045_CONDITION_SIGNALLING 578 } 579 #endif 539 } 580 540 xParseByteAlign(); 581 541 } … … 598 558 { 599 559 READ_CODE( 7, val, "frame_packing_arrangement_type" ); sei.m_arrangementType = val; 600 #if L0444_FPA_TYPE601 560 assert((sei.m_arrangementType > 2) && (sei.m_arrangementType < 6) ); 602 #endif603 561 READ_FLAG( val, "quincunx_sampling_flag" ); sei.m_quincunxSamplingFlag = val; 604 562 … … 620 578 621 579 READ_CODE( 8, val, "frame_packing_arrangement_reserved_byte" ); sei.m_arrangementReservedByte = val; 622 #if L0045_PERSISTENCE_FLAGS623 580 READ_FLAG( val, "frame_packing_arrangement_persistence_flag" ); sei.m_arrangementPersistenceFlag = val ? true : false; 624 #else625 READ_UVLC( val, "frame_packing_arrangement_repetition_period" ); sei.m_arrangementRepetetionPeriod = val;626 #endif627 581 } 628 582 READ_FLAG( val, "upsampled_aspect_ratio" ); sei.m_upsampledAspectRatio = val; … … 640 594 READ_FLAG( val, "ver_flip" ); sei.verFlip = val; 641 595 READ_CODE( 16, val, "anticlockwise_rotation" ); sei.anticlockwiseRotation = val; 642 #if L0045_PERSISTENCE_FLAGS643 596 READ_FLAG( val, "display_orientation_persistence_flag" ); sei.persistenceFlag = val; 644 #else645 READ_UVLC( val, "display_orientation_repetition_period" ); sei.repetitionPeriod = val;646 #endif647 #if !REMOVE_SINGLE_SEI_EXTENSION_FLAGS648 READ_FLAG( val, "display_orientation_extension_flag" ); sei.extensionFlag = val;649 assert( !sei.extensionFlag );650 #endif651 597 } 652 598 xParseByteAlign(); … … 668 614 } 669 615 670 #if J0149_TONE_MAPPING_SEI671 616 Void SEIReader::xParseSEIToneMappingInfo(SEIToneMappingInfo& sei, UInt /*payloadSize*/) 672 617 { … … 749 694 xParseByteAlign(); 750 695 } 751 #endif 752 753 #if L0208_SOP_DESCRIPTION_SEI 696 754 697 Void SEIReader::xParseSEISOPDescription(SEISOPDescription &sei, UInt payloadSize) 755 698 { … … 775 718 xParseByteAlign(); 776 719 } 777 #endif 778 779 #if K0180_SCALABLE_NESTING_SEI 720 780 721 Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComSPS *sps) 781 722 { … … 824 765 825 766 } 826 #endif827 767 828 768 Void SEIReader::xParseByteAlign() -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/SEIread.h
r446 r537 70 70 Void xParseSEITemporalLevel0Index (SEITemporalLevel0Index &sei, UInt payloadSize); 71 71 Void xParseSEIGradualDecodingRefreshInfo (SEIGradualDecodingRefreshInfo &sei, UInt payloadSize); 72 #if J0149_TONE_MAPPING_SEI73 72 Void xParseSEIToneMappingInfo (SEIToneMappingInfo& sei, UInt payloadSize); 74 #endif75 #if L0208_SOP_DESCRIPTION_SEI76 73 Void xParseSEISOPDescription (SEISOPDescription &sei, UInt payloadSize); 77 #endif78 #if K0180_SCALABLE_NESTING_SEI79 74 Void xParseSEIScalableNesting (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComSPS *sps); 80 #endif81 75 Void xParseByteAlign(); 82 76 }; -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecBinCoder.h
r324 r537 54 54 virtual Void start () = 0; 55 55 virtual Void finish () = 0; 56 virtual Void flush () = 0;57 56 58 57 virtual Void decodeBin ( UInt& ruiBin, ContextModel& rcCtxModel ) = 0; … … 61 60 virtual Void decodeBinTrm ( UInt& ruiBin ) = 0; 62 61 63 virtual Void resetBac () = 0;64 virtual Void decodePCMAlignBits() = 0;65 62 virtual Void xReadPCMCode ( UInt uiLength, UInt& ruiCode) = 0; 66 63 -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecBinCoderCABAC.cpp
r521 r537 76 76 TDecBinCABAC::finish() 77 77 { 78 } 79 80 Void 81 TDecBinCABAC::flush() 82 { 83 while (m_pcTComBitstream->getNumBitsLeft() > 0 && m_pcTComBitstream->getNumBitsUntilByteAligned() != 0) 84 { 85 UInt uiBits; 86 m_pcTComBitstream->read ( 1, uiBits ); 87 } 88 start(); 78 UInt lastByte; 79 80 m_pcTComBitstream->peekPreviousByte( lastByte ); 81 // Check for proper stop/alignment pattern 82 assert( ((lastByte << (8 + m_bitsNeeded)) & 0xff) == 0x80 ); 89 83 } 90 84 … … 242 236 } 243 237 244 /** Reset BAC register values.245 * \returns Void246 */247 Void TDecBinCABAC::resetBac()248 {249 m_uiRange = 510;250 m_bitsNeeded = -8;251 m_uiValue = m_pcTComBitstream->read( 16 );252 }253 254 /** Decode PCM alignment zero bits.255 * \returns Void256 */257 Void TDecBinCABAC::decodePCMAlignBits()258 {259 Int iNum = m_pcTComBitstream->getNumBitsUntilByteAligned();260 261 UInt uiBit = 0;262 m_pcTComBitstream->read( iNum, uiBit );263 #if H_MV_ENC_DEC_TRAC264 DTRACE_CU("Number of pcm_alignment_zero_bit", iNum)265 #endif266 }267 268 238 /** Read a PCM code. 269 239 * \param uiLength code bit-depth -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecBinCoderCABAC.h
r324 r537 56 56 Void start (); 57 57 Void finish (); 58 Void flush ();59 58 60 59 Void decodeBin ( UInt& ruiBin, ContextModel& rcCtxModel ); … … 63 62 Void decodeBinTrm ( UInt& ruiBin ); 64 63 65 Void resetBac ();66 Void decodePCMAlignBits();67 64 Void xReadPCMCode ( UInt uiLength, UInt& ruiCode ); 68 65 -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecCAVLC.cpp
r536 r537 224 224 Int iCode; 225 225 226 READ_UVLC( uiCode, "pps_pic_parameter_set_id"); pcPPS->setPPSId (uiCode); 227 READ_UVLC( uiCode, "pps_seq_parameter_set_id"); pcPPS->setSPSId (uiCode); 226 READ_UVLC( uiCode, "pps_pic_parameter_set_id"); 227 assert(uiCode <= 63); 228 pcPPS->setPPSId (uiCode); 229 230 READ_UVLC( uiCode, "pps_seq_parameter_set_id"); 231 assert(uiCode <= 15); 232 pcPPS->setSPSId (uiCode); 233 228 234 READ_FLAG( uiCode, "dependent_slice_segments_enabled_flag" ); pcPPS->setDependentSliceSegmentsEnabledFlag ( uiCode == 1 ); 229 #if L0255_MOVE_PPS_FLAGS230 235 READ_FLAG( uiCode, "output_flag_present_flag" ); pcPPS->setOutputFlagPresentFlag( uiCode==1 ); 231 236 232 237 READ_CODE(3, uiCode, "num_extra_slice_header_bits"); pcPPS->setNumExtraSliceHeaderBits(uiCode); 233 #endif234 238 READ_FLAG ( uiCode, "sign_data_hiding_flag" ); pcPPS->setSignHideFlag( uiCode ); 235 239 236 240 READ_FLAG( uiCode, "cabac_init_present_flag" ); pcPPS->setCabacInitPresentFlag( uiCode ? true : false ); 237 241 238 #if L0323_LIMIT_DEFAULT_LIST_SIZE239 242 READ_UVLC(uiCode, "num_ref_idx_l0_default_active_minus1"); 240 243 assert(uiCode <= 14); … … 244 247 assert(uiCode <= 14); 245 248 pcPPS->setNumRefIdxL1DefaultActive(uiCode+1); 246 #else247 READ_UVLC(uiCode, "num_ref_idx_l0_default_active_minus1"); pcPPS->setNumRefIdxL0DefaultActive(uiCode+1);248 READ_UVLC(uiCode, "num_ref_idx_l1_default_active_minus1"); pcPPS->setNumRefIdxL1DefaultActive(uiCode+1);249 #endif250 249 251 250 READ_SVLC(iCode, "init_qp_minus26" ); pcPPS->setPicInitQPMinus26(iCode); … … 282 281 pcPPS->setWPBiPred( uiCode==1 ); 283 282 284 #if !L0255_MOVE_PPS_FLAGS285 READ_FLAG( uiCode, "output_flag_present_flag" );286 pcPPS->setOutputFlagPresentFlag( uiCode==1 );287 #endif288 283 READ_FLAG( uiCode, "transquant_bypass_enable_flag"); 289 284 pcPPS->setTransquantBypassEnableFlag(uiCode ? true : false); … … 347 342 pcPPS->setLog2ParallelMergeLevelMinus2 (uiCode); 348 343 349 #if !L0255_MOVE_PPS_FLAGS350 READ_CODE(3, uiCode, "num_extra_slice_header_bits");351 pcPPS->setNumExtraSliceHeaderBits(uiCode);352 #endif353 344 READ_FLAG( uiCode, "slice_segment_header_extension_present_flag"); 354 345 pcPPS->setSliceHeaderExtensionPresentFlag(uiCode); … … 424 415 READ_UVLC( uiCode, "def_disp_win_bottom_offset" ); defDisp.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) ); 425 416 } 426 #if L0043_TIMING_INFO427 417 TimingInfo *timingInfo = pcVUI->getTimingInfo(); 428 418 READ_FLAG( uiCode, "vui_timing_info_present_flag"); timingInfo->setTimingInfoPresentFlag (uiCode ? true : false); … … 436 426 READ_UVLC( uiCode, "vui_num_ticks_poc_diff_one_minus1"); timingInfo->setNumTicksPocDiffOneMinus1 (uiCode); 437 427 } 438 #endif439 428 READ_FLAG( uiCode, "hrd_parameters_present_flag"); pcVUI->setHrdParametersPresentFlag(uiCode); 440 429 if( pcVUI->getHrdParametersPresentFlag() ) … … 442 431 parseHrdParameters( pcVUI->getHrdParameters(), 1, pcSPS->getMaxTLayers() - 1 ); 443 432 } 444 #if L0043_TIMING_INFO 445 } 446 #endif 447 #if !L0043_TIMING_INFO 448 READ_FLAG( uiCode, "poc_proportional_to_timing_flag" ); pcVUI->setPocProportionalToTimingFlag(uiCode ? true : false); 449 if( pcVUI->getPocProportionalToTimingFlag() && pcVUI->getHrdParameters()->getTimingInfoPresentFlag() ) 450 { 451 READ_UVLC( uiCode, "num_ticks_poc_diff_one_minus1" ); pcVUI->setNumTicksPocDiffOneMinus1(uiCode); 452 } 453 #endif 433 } 454 434 READ_FLAG( uiCode, "bitstream_restriction_flag"); pcVUI->setBitstreamRestrictionFlag(uiCode); 455 435 if (pcVUI->getBitstreamRestrictionFlag()) … … 464 444 READ_FLAG( uiCode, "motion_vectors_over_pic_boundaries_flag"); pcVUI->setMotionVectorsOverPicBoundariesFlag(uiCode); 465 445 READ_FLAG( uiCode, "restricted_ref_pic_lists_flag"); pcVUI->setRestrictedRefPicListsFlag(uiCode); 466 #if L0043_MSS_IDC467 446 READ_UVLC( uiCode, "min_spatial_segmentation_idc"); pcVUI->setMinSpatialSegmentationIdc(uiCode); 468 447 assert(uiCode < 4096); 469 #else470 READ_CODE( 8, uiCode, "min_spatial_segmentation_idc"); pcVUI->setMinSpatialSegmentationIdc(uiCode);471 #endif472 448 READ_UVLC( uiCode, "max_bytes_per_pic_denom" ); pcVUI->setMaxBytesPerPicDenom(uiCode); 473 449 READ_UVLC( uiCode, "max_bits_per_mincu_denom" ); pcVUI->setMaxBitsPerMinCuDenom(uiCode); … … 482 458 if( commonInfPresentFlag ) 483 459 { 484 #if !L0043_TIMING_INFO485 READ_FLAG( uiCode, "timing_info_present_flag" ); hrd->setTimingInfoPresentFlag( uiCode == 1 ? true : false );486 if( hrd->getTimingInfoPresentFlag() )487 {488 READ_CODE( 32, uiCode, "num_units_in_tick" ); hrd->setNumUnitsInTick( uiCode );489 READ_CODE( 32, uiCode, "time_scale" ); hrd->setTimeScale( uiCode );490 }491 #endif492 460 READ_FLAG( uiCode, "nal_hrd_parameters_present_flag" ); hrd->setNalHrdParametersPresentFlag( uiCode == 1 ? true : false ); 493 461 READ_FLAG( uiCode, "vcl_hrd_parameters_present_flag" ); hrd->setVclHrdParametersPresentFlag( uiCode == 1 ? true : false ); … … 500 468 READ_CODE( 5, uiCode, "du_cpb_removal_delay_length_minus1" ); hrd->setDuCpbRemovalDelayLengthMinus1( uiCode ); 501 469 READ_FLAG( uiCode, "sub_pic_cpb_params_in_pic_timing_sei_flag" ); hrd->setSubPicCpbParamsInPicTimingSEIFlag( uiCode == 1 ? true : false ); 502 #if L0044_DU_DPB_OUTPUT_DELAY_HRD503 470 READ_CODE( 5, uiCode, "dpb_output_delay_du_length_minus1" ); hrd->setDpbOutputDelayDuLengthMinus1( uiCode ); 504 #endif505 471 } 506 472 READ_CODE( 4, uiCode, "bit_rate_scale" ); hrd->setBitRateScale( uiCode ); … … 527 493 hrd->setFixedPicRateWithinCvsFlag( i, true ); 528 494 } 529 #if L0372530 495 hrd->setLowDelayHrdFlag( i, 0 ); // Infered to be 0 when not present 531 496 hrd->setCpbCntMinus1 ( i, 0 ); // Infered to be 0 when not present 532 #endif533 497 if( hrd->getFixedPicRateWithinCvsFlag( i ) ) 534 498 { 535 499 READ_UVLC( uiCode, "elemental_duration_in_tc_minus1" ); hrd->setPicDurationInTcMinus1( i, uiCode ); 536 500 } 537 #if L0372538 501 else 539 502 { … … 544 507 READ_UVLC( uiCode, "cpb_cnt_minus1" ); hrd->setCpbCntMinus1( i, uiCode ); 545 508 } 546 #else547 READ_FLAG( uiCode, "low_delay_hrd_flag" ); hrd->setLowDelayHrdFlag( i, uiCode == 1 ? true : false );548 READ_UVLC( uiCode, "cpb_cnt_minus1" ); hrd->setCpbCntMinus1( i, uiCode );549 #endif550 509 for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) 551 510 { … … 559 518 if( hrd->getSubPicCpbParamsPresentFlag() ) 560 519 { 561 #if L0363_DU_BIT_RATE 520 READ_UVLC( uiCode, "cpb_size_du_value_minus1" ); hrd->setDuCpbSizeValueMinus1( i, j, nalOrVcl, uiCode ); 562 521 READ_UVLC( uiCode, "bit_rate_du_value_minus1" ); hrd->setDuBitRateValueMinus1( i, j, nalOrVcl, uiCode ); 563 #endif564 READ_UVLC( uiCode, "cpb_size_du_value_minus1" ); hrd->setDuCpbSizeValueMinus1( i, j, nalOrVcl, uiCode );565 522 } 566 523 READ_FLAG( uiCode, "cbr_flag" ); hrd->setCbrFlag( i, j, nalOrVcl, uiCode == 1 ? true : false ); … … 588 545 #endif 589 546 READ_CODE( 3, uiCode, "sps_max_sub_layers_minus1" ); pcSPS->setMaxTLayers ( uiCode+1 ); 547 assert(uiCode <= 6); 548 590 549 READ_FLAG( uiCode, "sps_temporal_id_nesting_flag" ); pcSPS->setTemporalIdNestingFlag ( uiCode > 0 ? true : false ); 591 550 if ( pcSPS->getMaxTLayers() == 1 ) … … 594 553 assert( uiCode == 1 ); 595 554 } 555 596 556 parsePTL(pcSPS->getPTL(), 1, pcSPS->getMaxTLayers() - 1); 597 557 #if H_MV … … 599 559 #endif 600 560 READ_UVLC( uiCode, "sps_seq_parameter_set_id" ); pcSPS->setSPSId( uiCode ); 561 assert(uiCode <= 15); 562 601 563 READ_UVLC( uiCode, "chroma_format_idc" ); pcSPS->setChromaFormatIdc( uiCode ); 564 assert(uiCode <= 3); 602 565 // in the first version we only support chroma_format_idc equal to 1 (4:2:0), so separate_colour_plane_flag cannot appear in the bitstream 603 566 assert (uiCode == 1); … … 620 583 621 584 READ_UVLC( uiCode, "bit_depth_luma_minus8" ); 585 assert(uiCode <= 6); 622 586 pcSPS->setBitDepthY( uiCode + 8 ); 623 587 pcSPS->setQpBDOffsetY( (Int) (6*uiCode) ); 624 588 625 589 READ_UVLC( uiCode, "bit_depth_chroma_minus8" ); 590 assert(uiCode <= 6); 626 591 pcSPS->setBitDepthC( uiCode + 8 ); 627 592 pcSPS->setQpBDOffsetC( (Int) (6*uiCode) ); 628 593 629 594 READ_UVLC( uiCode, "log2_max_pic_order_cnt_lsb_minus4" ); pcSPS->setBitsForPOC( 4 + uiCode ); 595 assert(uiCode <= 12); 630 596 631 597 UInt subLayerOrderingInfoPresentFlag; 632 598 READ_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag"); 599 633 600 for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++) 634 601 { 635 #if L0323_DPB636 602 #if H_MV 637 603 READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1[i]"); … … 640 606 #endif 641 607 pcSPS->setMaxDecPicBuffering( uiCode + 1, i); 642 #else643 READ_UVLC ( uiCode, "sps_max_dec_pic_buffering");644 pcSPS->setMaxDecPicBuffering( uiCode, i);645 #endif646 608 #if H_MV 647 609 READ_UVLC ( uiCode, "sps_num_reorder_pics[i]" ); … … 711 673 712 674 READ_UVLC( uiCode, "num_short_term_ref_pic_sets" ); 675 assert(uiCode <= 64); 713 676 pcSPS->createRPSList(uiCode); 714 677 … … 838 801 #endif 839 802 parsePTL ( pcVPS->getPTL(), true, pcVPS->getMaxTLayers()-1); 840 #if SIGNAL_BITRATE_PICRATE_IN_VPS841 parseBitratePicRateInfo( pcVPS->getBitratePicrateInfo(), 0, pcVPS->getMaxTLayers() - 1);842 #endif843 803 UInt subLayerOrderingInfoPresentFlag; 844 804 READ_FLAG(subLayerOrderingInfoPresentFlag, "vps_sub_layer_ordering_info_present_flag"); 845 805 for(UInt i = 0; i <= pcVPS->getMaxTLayers()-1; i++) 846 806 { 847 #if L0323_DPB848 807 READ_UVLC( uiCode, "vps_max_dec_pic_buffering_minus1[i]" ); pcVPS->setMaxDecPicBuffering( uiCode + 1, i ); 849 #else850 READ_UVLC( uiCode, "vps_max_dec_pic_buffering[i]" ); pcVPS->setMaxDecPicBuffering( uiCode, i );851 #endif852 808 READ_UVLC( uiCode, "vps_num_reorder_pics[i]" ); pcVPS->setNumReorderPics( uiCode, i ); 853 READ_UVLC( uiCode, "vps_max_latency_increase [i]" ); pcVPS->setMaxLatencyIncrease( uiCode, i );809 READ_UVLC( uiCode, "vps_max_latency_increase_plus1[i]" ); pcVPS->setMaxLatencyIncrease( uiCode, i ); 854 810 855 811 if (!subLayerOrderingInfoPresentFlag) … … 887 843 } 888 844 } 889 #if L0043_TIMING_INFO890 845 TimingInfo *timingInfo = pcVPS->getTimingInfo(); 891 846 READ_FLAG( uiCode, "vps_timing_info_present_flag"); timingInfo->setTimingInfoPresentFlag (uiCode ? true : false); … … 899 854 READ_UVLC( uiCode, "vps_num_ticks_poc_diff_one_minus1"); timingInfo->setNumTicksPocDiffOneMinus1 (uiCode); 900 855 } 901 #endif902 856 READ_UVLC( uiCode, "vps_num_hrd_parameters" ); pcVPS->setNumHrdParameters( uiCode ); 903 857 … … 915 869 parseHrdParameters(pcVPS->getHrdParameters(i), pcVPS->getCprmsPresentFlag( i ), pcVPS->getMaxTLayers() - 1); 916 870 } 917 #if L0043_TIMING_INFO 918 } 919 #endif 871 } 920 872 READ_FLAG( uiCode, "vps_extension_flag" ); 921 873 if (uiCode) … … 1311 1263 uiCode = 0; 1312 1264 } 1313 memcpy(rps,sps->getRPSList()->getReferencePictureSet(uiCode),sizeof(TComReferencePictureSet));1265 *rps = *(sps->getRPSList()->getReferencePictureSet(uiCode)); 1314 1266 } 1315 1267 if(sps->getLongTermRefsPresent()) … … 1736 1688 for (UInt idx=0; idx<numEntryPointOffsets; idx++) 1737 1689 { 1738 #if L0116_ENTRY_POINT1739 1690 READ_CODE(offsetLenMinus1+1, uiCode, "entry_point_offset_minus1"); 1740 1691 entryPointOffset[ idx ] = uiCode + 1; 1741 #else1742 READ_CODE(offsetLenMinus1+1, uiCode, "entry_point_offset");1743 entryPointOffset[ idx ] = uiCode;1744 #endif1745 1692 } 1746 1693 } … … 1791 1738 { 1792 1739 Int endOfSliceHeaderLocation = m_pcBitstream->getByteLocation(); 1740 1741 // Adjust endOfSliceHeaderLocation to account for emulation prevention bytes in the slice segment header 1742 for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ ) 1743 { 1744 if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < endOfSliceHeaderLocation ) 1745 { 1746 endOfSliceHeaderLocation++; 1747 } 1748 } 1749 1793 1750 Int curEntryPointOffset = 0; 1794 1751 Int prevEntryPointOffset = 0; … … 1858 1815 READ_CODE( 8, uiCode, "general_level_idc" ); rpcPTL->getGeneralPTL()->setLevelIdc(uiCode); 1859 1816 1860 #if L0363_BYTE_ALIGN1861 1817 for (Int i = 0; i < maxNumSubLayersMinus1; i++) 1862 1818 { … … 1882 1838 } 1883 1839 } 1884 #endif1885 1840 1886 1841 for(Int i = 0; i < maxNumSubLayersMinus1; i++) 1887 1842 { 1888 #if !L0363_BYTE_ALIGN1889 if(profilePresentFlag)1890 {1891 READ_FLAG( uiCode, "sub_layer_profile_present_flag[i]" ); rpcPTL->setSubLayerProfilePresentFlag(i, uiCode);1892 }1893 READ_FLAG( uiCode, "sub_layer_level_present_flag[i]" ); rpcPTL->setSubLayerLevelPresentFlag (i, uiCode);1894 #endif1895 1843 if( profilePresentFlag && rpcPTL->getSubLayerProfilePresentFlag(i) ) 1896 1844 { … … 1914 1862 READ_FLAG( uiCode, "XXX_profile_compatibility_flag[][j]"); ptl->setProfileCompatibilityFlag(j, uiCode ? 1 : 0); 1915 1863 } 1916 #if L0046_CONSTRAINT_FLAGS1917 1864 READ_FLAG(uiCode, "general_progressive_source_flag"); 1918 1865 ptl->setProgressiveSourceFlag(uiCode ? true : false); … … 1930 1877 READ_CODE(16, uiCode, "XXX_reserved_zero_44bits[16..31]"); 1931 1878 READ_CODE(12, uiCode, "XXX_reserved_zero_44bits[32..43]"); 1932 #elif L0363_MORE_BITS 1933 READ_CODE(16, uiCode, "XXX_reserved_zero_48bits[0..15]"); 1934 READ_CODE(16, uiCode, "XXX_reserved_zero_48bits[16..31]"); 1935 READ_CODE(16, uiCode, "XXX_reserved_zero_48bits[32..47]"); 1936 #else 1937 READ_CODE(16, uiCode, "XXX_reserved_zero_16bits[]"); assert( uiCode == 0 ); 1938 #endif 1939 } 1940 #if SIGNAL_BITRATE_PICRATE_IN_VPS 1941 Void TDecCavlc::parseBitratePicRateInfo(TComBitRatePicRateInfo *info, Int tempLevelLow, Int tempLevelHigh) 1942 { 1943 UInt uiCode; 1944 for(Int i = tempLevelLow; i <= tempLevelHigh; i++) 1945 { 1946 READ_FLAG( uiCode, "bit_rate_info_present_flag[i]" ); info->setBitRateInfoPresentFlag(i, uiCode ? true : false); 1947 READ_FLAG( uiCode, "pic_rate_info_present_flag[i]" ); info->setPicRateInfoPresentFlag(i, uiCode ? true : false); 1948 if(info->getBitRateInfoPresentFlag(i)) 1949 { 1950 READ_CODE( 16, uiCode, "avg_bit_rate[i]" ); info->setAvgBitRate(i, uiCode); 1951 READ_CODE( 16, uiCode, "max_bit_rate[i]" ); info->setMaxBitRate(i, uiCode); 1952 } 1953 if(info->getPicRateInfoPresentFlag(i)) 1954 { 1955 READ_CODE( 2, uiCode, "constant_pic_rate_idc[i]" ); info->setConstantPicRateIdc(i, uiCode); 1956 READ_CODE( 16, uiCode, "avg_pic_rate[i]" ); info->setAvgPicRate(i, uiCode); 1957 } 1958 } 1959 } 1960 #endif 1879 } 1880 1961 1881 Void TDecCavlc::parseTerminatingBit( UInt& ruiBit ) 1962 1882 { -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecCAVLC.h
r504 r537 86 86 Void parsePTL ( TComPTL *rpcPTL, Bool profilePresentFlag, Int maxNumSubLayersMinus1 ); 87 87 Void parseProfileTier (ProfileTierLevel *ptl); 88 #if SIGNAL_BITRATE_PICRATE_IN_VPS89 Void parseBitratePicRateInfo(TComBitRatePicRateInfo *info, Int tempLevelLow, Int tempLevelHigh);90 #endif91 88 Void parseHrdParameters (TComHRD *hrd, Bool cprms_present_flag, UInt tempLevelHigh); 92 89 Void parseSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager); -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecSbac.cpp
r531 r537 166 166 m_cTransformSkipSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_TRANSFORMSKIP_FLAG ); 167 167 m_CUTransquantBypassFlagSCModel.initBuffer( sliceType, qp, (UChar*)INIT_CU_TRANSQUANT_BYPASS_FLAG ); 168 169 168 #if H_3D_DIM 170 169 m_cDepthIntraModeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DEPTH_INTRA_MODE ); … … 184 183 #endif 185 184 #endif 186 187 185 m_uiLastDQpNonZero = 0; 188 186 … … 200 198 UInt uiBit; 201 199 m_pcTDecBinIf->decodeBinTrm(uiBit); 200 assert(uiBit); // end_of_sub_stream_one_bit must be equal to 1 202 201 m_pcTDecBinIf->finish(); 203 202 m_pcBitstream->readOutTrailingBits(); … … 259 258 { 260 259 m_pcTDecBinIf->decodeBinTrm( ruiBit ); 260 if ( ruiBit ) 261 { 262 m_pcTDecBinIf->finish(); 263 } 261 264 } 262 265 … … 613 616 { 614 617 UInt uiSymbol; 615 Bool readPCMSampleFlag = false;616 618 617 619 m_pcTDecBinIf->decodeBinTrm(uiSymbol); … … 622 624 if (uiSymbol) 623 625 { 624 readPCMSampleFlag = true;625 m_pcTDecBinIf->decodePCMAlignBits();626 }627 628 if (readPCMSampleFlag == true)629 {630 626 Bool bIpcmFlag = true; 631 627 … … 693 689 } 694 690 695 m_pcTDecBinIf->resetBac();691 m_pcTDecBinIf->start(); 696 692 } 697 693 } … … 1003 999 else 1004 1000 { 1005 intraPredMode = 0;1006 1001 m_pcTDecBinIf->decodeBinsEP( symbol, 5 ); 1007 1002 intraPredMode = symbol; … … 1444 1439 else 1445 1440 { 1446 iDQp=0;1447 1441 qp = pcCU->getRefQP(uiAbsPartIdx); 1448 1442 } … … 1634 1628 1635 1629 //===== decode significance flags ===== 1636 UInt uiScanPosLast = uiBlkPosLast;1630 UInt uiScanPosLast; 1637 1631 const UInt *scan = g_auiSigLastScan[ uiScanIdx ][ uiLog2BlockSize-1 ]; 1638 1632 for( uiScanPosLast = 0; uiScanPosLast < uiMaxNumCoeffM1; uiScanPosLast++ ) -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecSlice.cpp
r521 r537 372 372 pcSbacDecoders[uiSubStrm].load(pcSbacDecoder); 373 373 374 if ( uiCol == rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iCUAddr))->getRightEdgePosInCU() 375 && pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag() 376 && !uiIsLast ) 377 { 378 // Parse end_of_substream_one_bit for WPP case 379 UInt binVal; 380 pcSbacDecoder->parseTerminatingBit( binVal ); 381 assert( binVal ); 382 } 383 374 384 //Store probabilities of second LCU in line into buffer 375 385 if ( (uiCol == uiTileLCUX+1)&& (depSliceSegmentsEnabled || (pcSlice->getPPS()->getNumSubstreams() > 1)) && (pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag()) ) -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecTop.cpp
r534 r537 441 441 } 442 442 443 #if L0323_DPB 444 m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer())+pcSlice->getSPS()->getNumReorderPics(pcSlice->getTLayer()); // m_uiMaxDecPicBuffering has the space for the picture currently being decoded 445 #else 446 m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer())+pcSlice->getSPS()->getNumReorderPics(pcSlice->getTLayer()) + 1; // +1 to have space for the picture currently being decoded 447 #endif 443 m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer()); // m_uiMaxDecPicBuffering has the space for the picture currently being decoded 448 444 if (m_cListPic.size() < (UInt)m_iMaxRefPicNum) 449 445 { … … 964 960 //--------------- 965 961 pcSlice->setRefPOCList(); 966 #if !L0034_COMBINED_LIST_CLEANUP967 pcSlice->setNoBackPredFlag( false );968 if ( pcSlice->getSliceType() == B_SLICE )969 {970 if ( pcSlice->getNumRefIdx(RefPicList( 0 ) ) == pcSlice->getNumRefIdx(RefPicList( 1 ) ) )971 {972 pcSlice->setNoBackPredFlag( true );973 for ( i=0; i < pcSlice->getNumRefIdx(RefPicList( 1 ) ); i++ )974 {975 if ( pcSlice->getRefPOC(RefPicList(1), i) != pcSlice->getRefPOC(RefPicList(0), i) )976 {977 pcSlice->setNoBackPredFlag( false );978 break;979 }980 }981 }982 }983 #endif984 962 #if H_3D_TMVP 985 963 if(pcSlice->getLayerId()) -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/SEIwrite.cpp
r446 r537 84 84 fprintf( g_hTrace, "=========== Decoding Unit Information SEI message ===========\n"); 85 85 break; 86 #if J0149_TONE_MAPPING_SEI87 86 case SEI::TONE_MAPPING_INFO: 88 87 fprintf( g_hTrace, "=========== Tone Mapping Info SEI message ===========\n"); 89 88 break; 90 #endif91 #if L0208_SOP_DESCRIPTION_SEI92 89 case SEI::SOP_DESCRIPTION: 93 90 fprintf( g_hTrace, "=========== SOP Description SEI message ===========\n"); 94 91 break; 95 #endif96 #if K0180_SCALABLE_NESTING_SEI97 92 case SEI::SCALABLE_NESTING: 98 93 fprintf( g_hTrace, "=========== Scalable Nesting SEI message ===========\n"); 99 94 break; 100 #endif101 95 default: 102 96 fprintf( g_hTrace, "=========== Unknown SEI message ===========\n"); … … 106 100 #endif 107 101 108 #if K0180_SCALABLE_NESTING_SEI109 102 void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps) 110 #else111 void SEIWriter::xWriteSEIpayloadData(const SEI& sei, TComSPS *sps)112 #endif113 103 { 114 104 switch (sei.payloadType()) … … 147 137 xWriteSEIGradualDecodingRefreshInfo(*static_cast<const SEIGradualDecodingRefreshInfo*>(&sei)); 148 138 break; 149 #if J0149_TONE_MAPPING_SEI150 139 case SEI::TONE_MAPPING_INFO: 151 140 xWriteSEIToneMappingInfo(*static_cast<const SEIToneMappingInfo*>(&sei)); 152 141 break; 153 #endif154 #if L0208_SOP_DESCRIPTION_SEI155 142 case SEI::SOP_DESCRIPTION: 156 143 xWriteSEISOPDescription(*static_cast<const SEISOPDescription*>(&sei)); 157 144 break; 158 #endif159 #if K0180_SCALABLE_NESTING_SEI160 145 case SEI::SCALABLE_NESTING: 161 146 xWriteSEIScalableNesting(bs, *static_cast<const SEIScalableNesting*>(&sei), sps); 162 147 break; 163 #endif164 148 default: 165 149 assert(!"Unhandled SEI message"); … … 179 163 setBitstream(&bs_count); 180 164 181 182 #if K0180_SCALABLE_NESTING_SEI183 165 184 166 #if ENC_DEC_TRACE … … 191 173 #endif 192 174 193 #else194 195 #if ENC_DEC_TRACE196 g_HLSTraceEnable = false;197 #endif198 xWriteSEIpayloadData(sei, sps);199 #if ENC_DEC_TRACE200 g_HLSTraceEnable = true;201 #endif202 203 #endif204 205 175 UInt payload_data_num_bits = bs_count.getNumberOfWrittenBits(); 206 176 assert(0 == payload_data_num_bits % 8); … … 209 179 210 180 #if ENC_DEC_TRACE 211 #if K0180_SCALABLE_NESTING_SEI212 181 if (g_HLSTraceEnable) 213 #endif214 182 xTraceSEIHeader(); 215 183 #endif … … 231 199 /* payloadData */ 232 200 #if ENC_DEC_TRACE 233 #if K0180_SCALABLE_NESTING_SEI234 201 if (g_HLSTraceEnable) 235 #endif236 202 xTraceSEIMessageType(sei.payloadType()); 237 203 #endif 238 204 239 #if K0180_SCALABLE_NESTING_SEI240 205 xWriteSEIpayloadData(bs, sei, sps); 241 #else242 xWriteSEIpayloadData(sei, sps);243 #endif244 206 } 245 207 … … 296 258 { 297 259 WRITE_CODE(sei.activeVPSId, 4, "active_vps_id"); 298 #if L0047_APS_FLAGS299 260 WRITE_FLAG(sei.m_fullRandomAccessFlag, "full_random_access_flag"); 300 261 WRITE_FLAG(sei.m_noParamSetUpdateFlag, "no_param_set_update_flag"); 301 #endif302 262 WRITE_UVLC(sei.numSpsIdsMinus1, "num_sps_ids_minus1"); 303 263 … … 330 290 WRITE_CODE( sei.m_duSptCpbRemovalDelay, (vui->getHrdParameters()->getDuCpbRemovalDelayLengthMinus1() + 1), "du_spt_cpb_removal_delay"); 331 291 } 332 #if L0044_DU_DPB_OUTPUT_DELAY_HRD333 292 WRITE_FLAG( sei.m_dpbOutputDuDelayPresentFlag, "dpb_output_du_delay_present_flag"); 334 293 if(sei.m_dpbOutputDuDelayPresentFlag) … … 336 295 WRITE_CODE(sei.m_picSptDpbOutputDuDelay, vui->getHrdParameters()->getDpbOutputDelayDuLengthMinus1() + 1, "pic_spt_dpb_output_du_delay"); 337 296 } 338 #endif339 297 xWriteByteAlign(); 340 298 } … … 351 309 WRITE_FLAG( sei.m_rapCpbParamsPresentFlag, "rap_cpb_params_present_flag" ); 352 310 } 353 #if L0328_SPLICING354 311 WRITE_FLAG( sei.m_concatenationFlag, "concatenation_flag"); 355 312 WRITE_CODE( sei.m_auCpbRemovalDelayDelta - 1, ( hrd->getCpbRemovalDelayLengthMinus1() + 1 ), "au_cpb_removal_delay_delta_minus1" ); 356 #endif357 #if L0044_CPB_DPB_DELAY_OFFSET358 313 if( sei.m_rapCpbParamsPresentFlag ) 359 314 { … … 361 316 WRITE_CODE( sei.m_dpbDelayOffset, hrd->getDpbOutputDelayLengthMinus1() + 1, "dpb_delay_offset" ); 362 317 } 363 #endif364 318 for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) 365 319 { … … 387 341 TComHRD *hrd = vui->getHrdParameters(); 388 342 389 #if !L0045_CONDITION_SIGNALLING390 // This condition was probably OK before the pic_struct, progressive_source_idc, duplicate_flag were added391 if( !hrd->getNalHrdParametersPresentFlag() && !hrd->getVclHrdParametersPresentFlag() )392 return;393 #endif394 343 if( vui->getFrameFieldInfoPresentFlag() ) 395 344 { 396 345 WRITE_CODE( sei.m_picStruct, 4, "pic_struct" ); 397 #if L0046_RENAME_PROG_SRC_IDC398 346 WRITE_CODE( sei.m_sourceScanType, 2, "source_scan_type" ); 399 #else400 WRITE_CODE( sei.m_progressiveSourceIdc, 2, "progressive_source_idc" );401 #endif402 347 WRITE_FLAG( sei.m_duplicateFlag ? 1 : 0, "duplicate_flag" ); 403 348 } 404 349 405 #if L0045_CONDITION_SIGNALLING406 350 if( hrd->getCpbDpbDelaysPresentFlag() ) 407 351 { 408 #endif409 352 WRITE_CODE( sei.m_auCpbRemovalDelay - 1, ( hrd->getCpbRemovalDelayLengthMinus1() + 1 ), "au_cpb_removal_delay_minus1" ); 410 353 WRITE_CODE( sei.m_picDpbOutputDelay, ( hrd->getDpbOutputDelayLengthMinus1() + 1 ), "pic_dpb_output_delay" ); 411 #if L0044_DU_DPB_OUTPUT_DELAY_HRD412 354 if(hrd->getSubPicCpbParamsPresentFlag()) 413 355 { 414 356 WRITE_CODE(sei.m_picDpbOutputDuDelay, hrd->getDpbOutputDelayDuLengthMinus1()+1, "pic_dpb_output_du_delay" ); 415 357 } 416 #endif417 358 if( hrd->getSubPicCpbParamsPresentFlag() && hrd->getSubPicCpbParamsInPicTimingSEIFlag() ) 418 359 { … … 432 373 } 433 374 } 434 #if L0045_CONDITION_SIGNALLING 435 } 436 #endif 375 } 437 376 xWriteByteAlign(); 438 377 } … … 471 410 472 411 WRITE_CODE( sei.m_arrangementReservedByte, 8, "frame_packing_arrangement_reserved_byte" ); 473 #if L0045_PERSISTENCE_FLAGS474 412 WRITE_FLAG( sei.m_arrangementPersistenceFlag, "frame_packing_arrangement_persistence_flag" ); 475 #else476 WRITE_UVLC( sei.m_arrangementRepetetionPeriod, "frame_packing_arrangement_repetition_period" );477 #endif478 413 } 479 414 … … 483 418 } 484 419 485 #if J0149_TONE_MAPPING_SEI486 420 Void SEIWriter::xWriteSEIToneMappingInfo(const SEIToneMappingInfo& sei) 487 421 { … … 555 489 xWriteByteAlign(); 556 490 } 557 #endif558 491 559 492 Void SEIWriter::xWriteSEIDisplayOrientation(const SEIDisplayOrientation &sei) … … 565 498 WRITE_FLAG( sei.verFlip, "ver_flip" ); 566 499 WRITE_CODE( sei.anticlockwiseRotation, 16, "anticlockwise_rotation" ); 567 #if L0045_PERSISTENCE_FLAGS568 500 WRITE_FLAG( sei.persistenceFlag, "display_orientation_persistence_flag" ); 569 #else570 WRITE_UVLC( sei.repetitionPeriod, "display_orientation_repetition_period" );571 #endif572 #if !REMOVE_SINGLE_SEI_EXTENSION_FLAGS573 WRITE_FLAG( sei.extensionFlag, "display_orientation_extension_flag" );574 assert( !sei.extensionFlag );575 #endif576 501 } 577 502 xWriteByteAlign(); … … 591 516 } 592 517 593 #if L0208_SOP_DESCRIPTION_SEI594 518 Void SEIWriter::xWriteSEISOPDescription(const SEISOPDescription& sei) 595 519 { … … 612 536 xWriteByteAlign(); 613 537 } 614 #endif 615 616 #if K0180_SCALABLE_NESTING_SEI 538 617 539 Void SEIWriter::xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComSPS *sps) 618 540 { … … 656 578 } 657 579 } 658 #endif659 580 660 581 Void SEIWriter::xWriteByteAlign() -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/SEIwrite.h
r446 r537 50 50 51 51 protected: 52 #if K0180_SCALABLE_NESTING_SEI53 52 Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps); 54 #else55 Void xWriteSEIpayloadData(const SEI& sei, TComSPS *sps);56 #endif57 53 Void xWriteSEIuserDataUnregistered(const SEIuserDataUnregistered &sei); 58 54 Void xWriteSEIActiveParameterSets(const SEIActiveParameterSets& sei); … … 67 63 Void xWriteSEITemporalLevel0Index(const SEITemporalLevel0Index &sei); 68 64 Void xWriteSEIGradualDecodingRefreshInfo(const SEIGradualDecodingRefreshInfo &sei); 69 #if J0149_TONE_MAPPING_SEI70 65 Void xWriteSEIToneMappingInfo(const SEIToneMappingInfo& sei); 71 #endif72 #if L0208_SOP_DESCRIPTION_SEI73 66 Void xWriteSEISOPDescription(const SEISOPDescription& sei); 74 #endif75 #if K0180_SCALABLE_NESTING_SEI76 67 Void xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComSPS *sps); 77 #endif78 68 Void xWriteByteAlign(); 79 69 }; -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncCavlc.cpp
r534 r537 172 172 WRITE_UVLC( pcPPS->getSPSId(), "pps_seq_parameter_set_id" ); 173 173 WRITE_FLAG( pcPPS->getDependentSliceSegmentsEnabledFlag() ? 1 : 0, "dependent_slice_segments_enabled_flag" ); 174 #if L0255_MOVE_PPS_FLAGS175 174 WRITE_FLAG( pcPPS->getOutputFlagPresentFlag() ? 1 : 0, "output_flag_present_flag" ); 176 175 WRITE_CODE( pcPPS->getNumExtraSliceHeaderBits(), 3, "num_extra_slice_header_bits"); 177 #endif178 176 WRITE_FLAG( pcPPS->getSignHideFlag(), "sign_data_hiding_flag" ); 179 177 WRITE_FLAG( pcPPS->getCabacInitPresentFlag() ? 1 : 0, "cabac_init_present_flag" ); … … 195 193 WRITE_FLAG( pcPPS->getUseWP() ? 1 : 0, "weighted_pred_flag" ); // Use of Weighting Prediction (P_SLICE) 196 194 WRITE_FLAG( pcPPS->getWPBiPred() ? 1 : 0, "weighted_bipred_flag" ); // Use of Weighting Bi-Prediction (B_SLICE) 197 #if !L0255_MOVE_PPS_FLAGS198 WRITE_FLAG( pcPPS->getOutputFlagPresentFlag() ? 1 : 0, "output_flag_present_flag" );199 #endif200 195 WRITE_FLAG( pcPPS->getTransquantBypassEnableFlag() ? 1 : 0, "transquant_bypass_enable_flag" ); 201 196 WRITE_FLAG( pcPPS->getTilesEnabledFlag() ? 1 : 0, "tiles_enabled_flag" ); … … 244 239 WRITE_FLAG( pcPPS->getListsModificationPresentFlag(), "lists_modification_present_flag"); 245 240 WRITE_UVLC( pcPPS->getLog2ParallelMergeLevelMinus2(), "log2_parallel_merge_level_minus2"); 246 #if !L0255_MOVE_PPS_FLAGS247 WRITE_CODE( pcPPS->getNumExtraSliceHeaderBits(), 3, "num_extra_slice_header_bits");248 #endif249 241 WRITE_FLAG( pcPPS->getSliceHeaderExtensionPresentFlag() ? 1 : 0, "slice_segment_header_extension_present_flag"); 250 242 WRITE_FLAG( 0, "pps_extension_flag" ); … … 305 297 WRITE_UVLC(defaultDisplayWindow.getWindowBottomOffset(), "def_disp_win_bottom_offset"); 306 298 } 307 #if L0043_TIMING_INFO308 299 TimingInfo *timingInfo = pcVUI->getTimingInfo(); 309 300 WRITE_FLAG(timingInfo->getTimingInfoPresentFlag(), "vui_timing_info_present_flag"); … … 317 308 WRITE_UVLC(timingInfo->getNumTicksPocDiffOneMinus1(), "vui_num_ticks_poc_diff_one_minus1"); 318 309 } 319 #endif320 310 WRITE_FLAG(pcVUI->getHrdParametersPresentFlag(), "hrd_parameters_present_flag"); 321 311 if( pcVUI->getHrdParametersPresentFlag() ) … … 323 313 codeHrdParameters(pcVUI->getHrdParameters(), 1, pcSPS->getMaxTLayers() - 1 ); 324 314 } 325 #if L0043_TIMING_INFO 326 } 327 #endif 328 #if !L0043_TIMING_INFO 329 WRITE_FLAG( pcVUI->getPocProportionalToTimingFlag(), "poc_proportional_to_timing_flag" ); 330 if( pcVUI->getPocProportionalToTimingFlag() && pcVUI->getHrdParameters()->getTimingInfoPresentFlag() ) 331 { 332 WRITE_UVLC( pcVUI->getNumTicksPocDiffOneMinus1(), "num_ticks_poc_diff_one_minus1" ); 333 } 334 #endif 315 } 335 316 336 317 WRITE_FLAG(pcVUI->getBitstreamRestrictionFlag(), "bitstream_restriction_flag"); … … 346 327 WRITE_FLAG(pcVUI->getMotionVectorsOverPicBoundariesFlag(), "motion_vectors_over_pic_boundaries_flag"); 347 328 WRITE_FLAG(pcVUI->getRestrictedRefPicListsFlag(), "restricted_ref_pic_lists_flag"); 348 #if L0043_MSS_IDC349 329 WRITE_UVLC(pcVUI->getMinSpatialSegmentationIdc(), "min_spatial_segmentation_idc"); 350 #else351 WRITE_CODE(pcVUI->getMinSpatialSegmentationIdc(), 8, "min_spatial_segmentation_idc");352 #endif353 330 WRITE_UVLC(pcVUI->getMaxBytesPerPicDenom(), "max_bytes_per_pic_denom"); 354 331 WRITE_UVLC(pcVUI->getMaxBitsPerMinCuDenom(), "max_bits_per_mincu_denom"); … … 362 339 if( commonInfPresentFlag ) 363 340 { 364 #if !L0043_TIMING_INFO365 WRITE_FLAG( hrd->getTimingInfoPresentFlag() ? 1 : 0, "timing_info_present_flag" );366 if( hrd->getTimingInfoPresentFlag() )367 {368 WRITE_CODE( hrd->getNumUnitsInTick(), 32, "num_units_in_tick" );369 WRITE_CODE( hrd->getTimeScale(), 32, "time_scale" );370 }371 #endif372 341 WRITE_FLAG( hrd->getNalHrdParametersPresentFlag() ? 1 : 0 , "nal_hrd_parameters_present_flag" ); 373 342 WRITE_FLAG( hrd->getVclHrdParametersPresentFlag() ? 1 : 0 , "vcl_hrd_parameters_present_flag" ); … … 380 349 WRITE_CODE( hrd->getDuCpbRemovalDelayLengthMinus1(), 5, "du_cpb_removal_delay_length_minus1" ); 381 350 WRITE_FLAG( hrd->getSubPicCpbParamsInPicTimingSEIFlag() ? 1 : 0, "sub_pic_cpb_params_in_pic_timing_sei_flag" ); 382 #if L0044_DU_DPB_OUTPUT_DELAY_HRD383 351 WRITE_CODE( hrd->getDpbOutputDelayDuLengthMinus1(), 5, "dpb_output_delay_du_length_minus1" ); 384 #endif385 352 } 386 353 WRITE_CODE( hrd->getBitRateScale(), 4, "bit_rate_scale" ); … … 411 378 WRITE_UVLC( hrd->getPicDurationInTcMinus1( i ), "elemental_duration_in_tc_minus1"); 412 379 } 413 #if L0372414 380 else 415 381 { … … 420 386 WRITE_UVLC( hrd->getCpbCntMinus1( i ), "cpb_cnt_minus1"); 421 387 } 422 #else423 WRITE_FLAG( hrd->getLowDelayHrdFlag( i ) ? 1 : 0, "low_delay_hrd_flag");424 WRITE_UVLC( hrd->getCpbCntMinus1( i ), "cpb_cnt_minus1");425 #endif426 388 427 389 for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) … … 436 398 if( hrd->getSubPicCpbParamsPresentFlag() ) 437 399 { 438 #if L0363_DU_BIT_RATE 400 WRITE_UVLC( hrd->getDuCpbSizeValueMinus1( i, j, nalOrVcl ), "cpb_size_du_value_minus1"); 439 401 WRITE_UVLC( hrd->getDuBitRateValueMinus1( i, j, nalOrVcl ), "bit_rate_du_value_minus1"); 440 #endif441 WRITE_UVLC( hrd->getDuCpbSizeValueMinus1( i, j, nalOrVcl ), "cpb_size_du_value_minus1");442 402 } 443 403 WRITE_FLAG( hrd->getCbrFlag( i, j, nalOrVcl ) ? 1 : 0, "cbr_flag"); … … 499 459 for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++) 500 460 { 501 #if L0323_DPB502 461 WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i) - 1, "sps_max_dec_pic_buffering_minus1[i]" ); 503 #else504 WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i), "sps_max_dec_pic_buffering[i]" );505 #endif506 462 WRITE_UVLC( pcSPS->getNumReorderPics(i), "sps_num_reorder_pics[i]" ); 507 WRITE_UVLC( pcSPS->getMaxLatencyIncrease(i), "sps_max_latency_increase [i]" );463 WRITE_UVLC( pcSPS->getMaxLatencyIncrease(i), "sps_max_latency_increase_plus1[i]" ); 508 464 if (!subLayerOrderingInfoPresentFlag) 509 465 { … … 642 598 #endif 643 599 codePTL( pcVPS->getPTL(), true, pcVPS->getMaxTLayers() - 1 ); 644 #if SIGNAL_BITRATE_PICRATE_IN_VPS645 codeBitratePicRateInfo(pcVPS->getBitratePicrateInfo(), 0, pcVPS->getMaxTLayers() - 1);646 #endif647 600 const Bool subLayerOrderingInfoPresentFlag = 1; 648 601 WRITE_FLAG(subLayerOrderingInfoPresentFlag, "vps_sub_layer_ordering_info_present_flag"); 649 602 for(UInt i=0; i <= pcVPS->getMaxTLayers()-1; i++) 650 603 { 651 #if L0323_DPB652 604 WRITE_UVLC( pcVPS->getMaxDecPicBuffering(i) - 1, "vps_max_dec_pic_buffering_minus1[i]" ); 653 #else654 WRITE_UVLC( pcVPS->getMaxDecPicBuffering(i), "vps_max_dec_pic_buffering[i]" );655 #endif656 605 WRITE_UVLC( pcVPS->getNumReorderPics(i), "vps_num_reorder_pics[i]" ); 657 WRITE_UVLC( pcVPS->getMaxLatencyIncrease(i), "vps_max_latency_increase [i]" );606 WRITE_UVLC( pcVPS->getMaxLatencyIncrease(i), "vps_max_latency_increase_plus1[i]" ); 658 607 if (!subLayerOrderingInfoPresentFlag) 659 608 { … … 676 625 assert( pcVPS->getMaxNuhReservedZeroLayerId() < MAX_VPS_NUH_RESERVED_ZERO_LAYER_ID_PLUS1 ); 677 626 WRITE_CODE( pcVPS->getMaxNuhReservedZeroLayerId(), 6, "vps_max_nuh_reserved_zero_layer_id" ); 678 679 627 pcVPS->setMaxOpSets(1); 680 628 WRITE_UVLC( pcVPS->getMaxOpSets() - 1, "vps_max_op_sets_minus1" ); … … 690 638 } 691 639 } 692 #if L0043_TIMING_INFO693 640 TimingInfo *timingInfo = pcVPS->getTimingInfo(); 694 641 WRITE_FLAG(timingInfo->getTimingInfoPresentFlag(), "vps_timing_info_present_flag"); … … 702 649 WRITE_UVLC(timingInfo->getNumTicksPocDiffOneMinus1(), "vps_num_ticks_poc_diff_one_minus1"); 703 650 } 704 #endif705 651 pcVPS->setNumHrdParameters( 0 ); 706 652 WRITE_UVLC( pcVPS->getNumHrdParameters(), "vps_num_hrd_parameters" ); … … 721 667 codeHrdParameters(pcVPS->getHrdParameters(i), pcVPS->getCprmsPresentFlag( i ), pcVPS->getMaxTLayers() - 1); 722 668 } 723 #if L0043_TIMING_INFO 724 } 725 #endif 669 } 726 670 #if H_MV 727 671 WRITE_FLAG( 1, "vps_extension_flag" ); … … 983 927 // colour_plane_id u(2) 984 928 985 #if H_MV && !H_MV_FIX1071986 // Temporary fix for FIX1071 should be removed later987 TComReferencePictureSet* rps = pcSlice->getRPS();988 #endif989 929 if( !pcSlice->getIdrPicFlag() ) 990 930 { 991 931 Int picOrderCntLSB = (pcSlice->getPOC()-pcSlice->getLastIDR()+(1<<pcSlice->getSPS()->getBitsForPOC()))%(1<<pcSlice->getSPS()->getBitsForPOC()); 992 932 WRITE_CODE( picOrderCntLSB, pcSlice->getSPS()->getBitsForPOC(), "pic_order_cnt_lsb"); 993 #if !H_MV || H_MV_FIX1071994 933 TComReferencePictureSet* rps = pcSlice->getRPS(); 995 #endif996 #if FIX1071 && H_MV_FIX1071934 935 #if FIX1071 997 936 // check for bitstream restriction stating that: 998 937 // If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0. … … 1006 945 } 1007 946 #endif 1008 #if FIX1071 && !H_MV_FIX1071 1009 // Deal with bitstream restriction stating that: 1010 // – If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0. 1011 // Ideally this process should not be repeated for each slice in a picture 1012 TComReferencePictureSet altRps; 1013 Bool useAltRps = false; 1014 if (pcSlice->getRapPicFlag()) 1015 { 1016 for (Int picIdx = 0; !useAltRps && picIdx < rps->getNumberOfPictures(); picIdx++) 1017 { 1018 useAltRps = rps->getUsed(picIdx); 1019 } 1020 if (useAltRps) 1021 { 1022 memcpy(&altRps, rps, sizeof(TComReferencePictureSet)); 1023 rps = &altRps; 1024 for (Int picIdx = 0; picIdx < rps->getNumberOfPictures(); picIdx++) 1025 { 1026 rps->setUsed(picIdx, false); 1027 } 1028 } 1029 } 1030 if(pcSlice->getRPSidx() < 0 || useAltRps) 1031 #else 947 1032 948 if(pcSlice->getRPSidx() < 0) 1033 #endif1034 949 { 1035 950 WRITE_FLAG( 0, "short_term_ref_pic_set_sps_flag"); … … 1188 1103 pcSlice->setNumRefIdx(REF_PIC_LIST_1, 0); 1189 1104 } 1190 #if H_MV && !H_MV_FIX1071 1191 // Temporary fix for FIX1071 should be removed later 1192 if( pcSlice->getPPS()->getListsModificationPresentFlag() && pcSlice->getNumRpsCurrTempList( rps ) > 1) 1193 #else 1105 1194 1106 if( pcSlice->getPPS()->getListsModificationPresentFlag() && pcSlice->getNumRpsCurrTempList() > 1) 1195 #endif1196 1107 { 1197 1108 TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification(); … … 1385 1296 WRITE_CODE( pcPTL->getGeneralPTL()->getLevelIdc(), 8, "general_level_idc" ); 1386 1297 1387 #if L0363_BYTE_ALIGN1388 1298 for (Int i = 0; i < maxNumSubLayersMinus1; i++) 1389 1299 { … … 1407 1317 } 1408 1318 } 1409 #endif1410 1319 1411 1320 for(Int i = 0; i < maxNumSubLayersMinus1; i++) 1412 1321 { 1413 #if !L0363_BYTE_ALIGN1414 if(profilePresentFlag)1415 {1416 WRITE_FLAG( pcPTL->getSubLayerProfilePresentFlag(i), "sub_layer_profile_present_flag[i]" );1417 }1418 1419 WRITE_FLAG( pcPTL->getSubLayerLevelPresentFlag(i), "sub_layer_level_present_flag[i]" );1420 #endif1421 1322 if( profilePresentFlag && pcPTL->getSubLayerProfilePresentFlag(i) ) 1422 1323 { … … 1439 1340 } 1440 1341 1441 #if L0046_CONSTRAINT_FLAGS1442 1342 WRITE_FLAG(ptl->getProgressiveSourceFlag(), "general_progressive_source_flag"); 1443 1343 WRITE_FLAG(ptl->getInterlacedSourceFlag(), "general_interlaced_source_flag"); … … 1448 1348 WRITE_CODE(0 , 16, "XXX_reserved_zero_44bits[16..31]"); 1449 1349 WRITE_CODE(0 , 12, "XXX_reserved_zero_44bits[32..43]"); 1450 #elif L0363_MORE_BITS 1451 WRITE_CODE(0 , 16, "XXX_reserved_zero_48bits[0..15]"); 1452 WRITE_CODE(0 , 16, "XXX_reserved_zero_48bits[16..31]"); 1453 WRITE_CODE(0 , 16, "XXX_reserved_zero_48bits[32..47]"); 1454 #else 1455 WRITE_CODE(0 , 16, "XXX_reserved_zero_16bits[]"); 1456 #endif 1457 } 1458 #if SIGNAL_BITRATE_PICRATE_IN_VPS 1459 Void TEncCavlc::codeBitratePicRateInfo(TComBitRatePicRateInfo *info, Int tempLevelLow, Int tempLevelHigh) 1460 { 1461 for(Int i = tempLevelLow; i <= tempLevelHigh; i++) 1462 { 1463 WRITE_FLAG( info->getBitRateInfoPresentFlag(i), "bit_rate_info_present_flag[i]" ); 1464 WRITE_FLAG( info->getPicRateInfoPresentFlag(i), "pic_rate_info_present_flag[i]" ); 1465 if(info->getBitRateInfoPresentFlag(i)) 1466 { 1467 WRITE_CODE( info->getAvgBitRate(i), 16, "avg_bit_rate[i]" ); 1468 WRITE_CODE( info->getMaxBitRate(i), 16, "max_bit_rate[i]" ); 1469 } 1470 if(info->getPicRateInfoPresentFlag(i)) 1471 { 1472 WRITE_CODE( info->getConstantPicRateIdc(i), 2, "constant_pic_rate_idc[i]" ); 1473 WRITE_CODE( info->getAvgPicRate(i), 16, "avg_pic_rate[i]" ); 1474 } 1475 } 1476 } 1477 #endif 1350 } 1351 1478 1352 /** 1479 1353 - write wavefront substreams sizes for the slice header. … … 1545 1419 for (UInt idx=0; idx<numEntryPointOffsets; idx++) 1546 1420 { 1547 #if L0116_ENTRY_POINT1548 1421 WRITE_CODE(entryPointOffset[ idx ]-1, offsetLenMinus1+1, "entry_point_offset_minus1"); 1549 #else1550 WRITE_CODE(entryPointOffset[ idx ], offsetLenMinus1+1, "entry_point_offset");1551 #endif1552 1422 } 1553 1423 -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncCavlc.h
r504 r537 94 94 Void codePTL ( TComPTL* pcPTL, Bool profilePresentFlag, Int maxNumSubLayersMinus1); 95 95 Void codeProfileTier ( ProfileTierLevel* ptl ); 96 #if SIGNAL_BITRATE_PICRATE_IN_VPS97 Void codeBitratePicRateInfo(TComBitRatePicRateInfo *info, Int tempLevelLow, Int tempLevelHigh);98 #endif99 96 Void codeHrdParameters ( TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1 ); 100 97 Void codeTilesWPPEntryPoint( TComSlice* pSlice ); -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncCfg.h
r534 r537 135 135 Level::Tier m_levelTier; 136 136 Level::Name m_level; 137 #if L0046_CONSTRAINT_FLAGS138 137 Bool m_progressiveSourceFlag; 139 138 Bool m_interlacedSourceFlag; 140 139 Bool m_nonPackedConstraintFlag; 141 140 Bool m_frameOnlyConstraintFlag; 142 #endif143 141 144 142 //====== Coding Structure ======== … … 177 175 Int m_loopFilterTcOffsetDiv2; 178 176 Bool m_DeblockingFilterControlPresent; 179 #if L0386_DB_METRIC180 177 Bool m_DeblockingFilterMetric; 181 #endif182 178 Bool m_bUseSAO; 183 179 Int m_maxNumOffsetsPerPic; … … 210 206 Bool m_bUseASR; 211 207 Bool m_bUseHADME; 212 #if !L0034_COMBINED_LIST_CLEANUP213 Bool m_bUseLComb;214 #endif215 208 Bool m_useRDOQ; 216 209 Bool m_useRDOQTS; 217 #if L0232_RD_PENALTY218 210 UInt m_rdPenalty; 219 #endif220 211 Bool m_bUseFastEnc; 221 212 Bool m_bUseEarlyCU; … … 258 249 Int m_pictureTimingSEIEnabled; 259 250 Int m_recoveryPointSEIEnabled; 260 #if J0149_TONE_MAPPING_SEI261 251 Bool m_toneMappingInfoSEIEnabled; 262 252 Int m_toneMapId; … … 284 274 Int* m_codedPivotValue; 285 275 Int* m_targetPivotValue; 286 #endif287 276 Int m_framePackingSEIEnabled; 288 277 Int m_framePackingSEIType; … … 294 283 Int m_gradualDecodingRefreshInfoEnabled; 295 284 Int m_decodingUnitInfoSEIEnabled; 296 #if L0208_SOP_DESCRIPTION_SEI297 285 Int m_SOPDescriptionSEIEnabled; 298 #endif299 #if K0180_SCALABLE_NESTING_SEI300 286 Int m_scalableNestingSEIEnabled; 301 #endif302 287 //====== Weighted Prediction ======== 303 288 Bool m_useWeightedPred; //< Use of Weighting Prediction (P_SLICE) … … 312 297 Bool m_RCEnableRateControl; 313 298 Int m_RCTargetBitrate; 299 #if M0036_RC_IMPROVEMENT 300 Int m_RCKeepHierarchicalBit; 301 #else 314 302 Bool m_RCKeepHierarchicalBit; 303 #endif 315 304 Bool m_RCLCULevelRC; 316 305 Bool m_RCUseLCUSeparateModel; … … 389 378 Double m_dLambdaScaleVSO; 390 379 UInt m_uiVSOMode; 391 392 380 // LGE_WVSO_A0119 393 381 Bool m_bUseWVSO; … … 395 383 Int m_iVSDWeight; 396 384 Int m_iDWeight; 397 #endif398 399 385 // SAIT_VSO_EST_A0033 400 386 Bool m_bUseEstimatedVSD; 401 387 Double m_dDispCoeff; 402 388 #endif 403 389 #if H_3D_ARP 404 390 UInt m_uiUseAdvResPred; 405 391 UInt m_uiARPStepNum; 406 392 #endif 407 408 393 #if H_3D_IC 409 394 Bool m_bUseIC; 410 395 #endif 411 412 396 //====== Depth Intra Modes ====== 413 397 #if H_3D_DIM … … 417 401 Bool m_useDLT; 418 402 #endif 419 420 #endif 421 403 #endif 422 404 public: 423 405 TEncCfg() … … 519 501 Void setLoopFilterTcOffset ( Int i ) { m_loopFilterTcOffsetDiv2 = i; } 520 502 Void setDeblockingFilterControlPresent ( Bool b ) { m_DeblockingFilterControlPresent = b; } 521 #if L0386_DB_METRIC522 503 Void setDeblockingFilterMetric ( Bool b ) { m_DeblockingFilterMetric = b; } 523 #endif524 504 525 505 //====== Motion search ======== … … 576 556 Int getLoopFilterTcOffset () { return m_loopFilterTcOffsetDiv2; } 577 557 Bool getDeblockingFilterControlPresent() { return m_DeblockingFilterControlPresent; } 578 #if L0386_DB_METRIC579 558 Bool getDeblockingFilterMetric () { return m_DeblockingFilterMetric; } 580 #endif581 559 582 560 //==== Motion search ======== … … 596 574 Void setUseASR ( Bool b ) { m_bUseASR = b; } 597 575 Void setUseHADME ( Bool b ) { m_bUseHADME = b; } 598 #if !L0034_COMBINED_LIST_CLEANUP599 Void setUseLComb ( Bool b ) { m_bUseLComb = b; }600 #endif601 576 Void setUseRDOQ ( Bool b ) { m_useRDOQ = b; } 602 577 Void setUseRDOQTS ( Bool b ) { m_useRDOQTS = b; } 603 #if L0232_RD_PENALTY604 578 Void setRDpenalty ( UInt b ) { m_rdPenalty = b; } 605 #endif606 579 Void setUseFastEnc ( Bool b ) { m_bUseFastEnc = b; } 607 580 Void setUseEarlyCU ( Bool b ) { m_bUseEarlyCU = b; } … … 620 593 Bool getUseASR () { return m_bUseASR; } 621 594 Bool getUseHADME () { return m_bUseHADME; } 622 #if !L0034_COMBINED_LIST_CLEANUP623 Bool getUseLComb () { return m_bUseLComb; }624 #endif625 595 Bool getUseRDOQ () { return m_useRDOQ; } 626 596 Bool getUseRDOQTS () { return m_useRDOQTS; } 627 #if L0232_RD_PENALTY628 597 Int getRDpenalty () { return m_rdPenalty; } 629 #endif630 598 Bool getUseFastEnc () { return m_bUseFastEnc; } 631 599 Bool getUseEarlyCU () { return m_bUseEarlyCU; } … … 719 687 Void setRecoveryPointSEIEnabled(Int b) { m_recoveryPointSEIEnabled = b; } 720 688 Int getRecoveryPointSEIEnabled() { return m_recoveryPointSEIEnabled; } 721 #if J0149_TONE_MAPPING_SEI722 689 Void setToneMappingInfoSEIEnabled(Bool b) { m_toneMappingInfoSEIEnabled = b; } 723 690 Bool getToneMappingInfoSEIEnabled() { return m_toneMappingInfoSEIEnabled; } … … 770 737 Void setTMISEIExtendedWhiteLevelLumaCodeValue(Int b) { m_extendedWhiteLevelLumaCodeValue =b; } 771 738 Int getTMISEIExtendedWhiteLevelLumaCodeValue() { return m_extendedWhiteLevelLumaCodeValue; } 772 #endif773 739 Void setFramePackingArrangementSEIEnabled(Int b) { m_framePackingSEIEnabled = b; } 774 740 Int getFramePackingArrangementSEIEnabled() { return m_framePackingSEIEnabled; } … … 789 755 Void setDecodingUnitInfoSEIEnabled(Int b) { m_decodingUnitInfoSEIEnabled = b; } 790 756 Int getDecodingUnitInfoSEIEnabled() { return m_decodingUnitInfoSEIEnabled; } 791 #if L0208_SOP_DESCRIPTION_SEI792 757 Void setSOPDescriptionSEIEnabled(Int b) { m_SOPDescriptionSEIEnabled = b; } 793 758 Int getSOPDescriptionSEIEnabled() { return m_SOPDescriptionSEIEnabled; } 794 #endif795 #if K0180_SCALABLE_NESTING_SEI796 759 Void setScalableNestingSEIEnabled(Int b) { m_scalableNestingSEIEnabled = b; } 797 760 Int getScalableNestingSEIEnabled() { return m_scalableNestingSEIEnabled; } 798 #endif799 761 Void setUseWP ( Bool b ) { m_useWeightedPred = b; } 800 762 Void setWPBiPred ( Bool b ) { m_useWeightedBiPred = b; } … … 818 780 Int getTargetBitrate () { return m_RCTargetBitrate; } 819 781 Void setTargetBitrate ( Int bitrate ) { m_RCTargetBitrate = bitrate; } 782 #if M0036_RC_IMPROVEMENT 783 Int getKeepHierBit () { return m_RCKeepHierarchicalBit; } 784 Void setKeepHierBit ( Int i ) { m_RCKeepHierarchicalBit = i; } 785 #else 820 786 Bool getKeepHierBit () { return m_RCKeepHierarchicalBit; } 821 787 Void setKeepHierBit ( Bool b ) { m_RCKeepHierarchicalBit = b; } 788 #endif 822 789 Bool getLCULevelRC () { return m_RCLCULevelRC; } 823 790 Void setLCULevelRC ( Bool b ) { m_RCLCULevelRC = b; } … … 916 883 Void setLog2MaxMvLengthVertical(Int i) { m_log2MaxMvLengthVertical = i; } 917 884 918 #if L0046_CONSTRAINT_FLAGS919 885 Bool getProgressiveSourceFlag() const { return m_progressiveSourceFlag; } 920 886 Void setProgressiveSourceFlag(Bool b) { m_progressiveSourceFlag = b; } … … 928 894 Bool getFrameOnlyConstraintFlag() const { return m_frameOnlyConstraintFlag; } 929 895 Void setFrameOnlyConstraintFlag(Bool b) { m_frameOnlyConstraintFlag = b; } 930 #endif931 896 #if H_3D 932 897 /// 3D Tools -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncCu.cpp
r531 r537 103 103 104 104 m_bEncodeDQP = false; 105 #if RATE_CONTROL_LAMBDA_DOMAIN 105 #if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT 106 106 m_LCUPredictionSAD = 0; 107 107 m_addSADDepth = 0; … … 256 256 m_ppcTempCU[0]->initCU( rpcCU->getPic(), rpcCU->getAddr() ); 257 257 258 #if RATE_CONTROL_LAMBDA_DOMAIN 258 #if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT 259 259 m_addSADDepth = 0; 260 260 m_LCUPredictionSAD = 0; … … 592 592 } 593 593 594 #if RATE_CONTROL_LAMBDA_DOMAIN 594 #if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT 595 595 if ( uiDepth <= m_addSADDepth ) 596 596 { … … 862 862 { 863 863 bBoundary = true; 864 #if RATE_CONTROL_LAMBDA_DOMAIN 864 #if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT 865 865 m_addSADDepth++; 866 866 #endif … … 1348 1348 } 1349 1349 1350 #if RATE_CONTROL_INTRA 1351 Int xCalcHADs8x8_ISlice(Pel *piOrg, Int iStrideOrg) 1352 { 1353 Int k, i, j, jj; 1354 Int diff[64], m1[8][8], m2[8][8], m3[8][8], iSumHad = 0; 1355 1356 for( k = 0; k < 64; k += 8 ) 1357 { 1358 diff[k+0] = piOrg[0] ; 1359 diff[k+1] = piOrg[1] ; 1360 diff[k+2] = piOrg[2] ; 1361 diff[k+3] = piOrg[3] ; 1362 diff[k+4] = piOrg[4] ; 1363 diff[k+5] = piOrg[5] ; 1364 diff[k+6] = piOrg[6] ; 1365 diff[k+7] = piOrg[7] ; 1366 1367 piOrg += iStrideOrg; 1368 } 1369 1370 //horizontal 1371 for (j=0; j < 8; j++) 1372 { 1373 jj = j << 3; 1374 m2[j][0] = diff[jj ] + diff[jj+4]; 1375 m2[j][1] = diff[jj+1] + diff[jj+5]; 1376 m2[j][2] = diff[jj+2] + diff[jj+6]; 1377 m2[j][3] = diff[jj+3] + diff[jj+7]; 1378 m2[j][4] = diff[jj ] - diff[jj+4]; 1379 m2[j][5] = diff[jj+1] - diff[jj+5]; 1380 m2[j][6] = diff[jj+2] - diff[jj+6]; 1381 m2[j][7] = diff[jj+3] - diff[jj+7]; 1382 1383 m1[j][0] = m2[j][0] + m2[j][2]; 1384 m1[j][1] = m2[j][1] + m2[j][3]; 1385 m1[j][2] = m2[j][0] - m2[j][2]; 1386 m1[j][3] = m2[j][1] - m2[j][3]; 1387 m1[j][4] = m2[j][4] + m2[j][6]; 1388 m1[j][5] = m2[j][5] + m2[j][7]; 1389 m1[j][6] = m2[j][4] - m2[j][6]; 1390 m1[j][7] = m2[j][5] - m2[j][7]; 1391 1392 m2[j][0] = m1[j][0] + m1[j][1]; 1393 m2[j][1] = m1[j][0] - m1[j][1]; 1394 m2[j][2] = m1[j][2] + m1[j][3]; 1395 m2[j][3] = m1[j][2] - m1[j][3]; 1396 m2[j][4] = m1[j][4] + m1[j][5]; 1397 m2[j][5] = m1[j][4] - m1[j][5]; 1398 m2[j][6] = m1[j][6] + m1[j][7]; 1399 m2[j][7] = m1[j][6] - m1[j][7]; 1400 } 1401 1402 //vertical 1403 for (i=0; i < 8; i++) 1404 { 1405 m3[0][i] = m2[0][i] + m2[4][i]; 1406 m3[1][i] = m2[1][i] + m2[5][i]; 1407 m3[2][i] = m2[2][i] + m2[6][i]; 1408 m3[3][i] = m2[3][i] + m2[7][i]; 1409 m3[4][i] = m2[0][i] - m2[4][i]; 1410 m3[5][i] = m2[1][i] - m2[5][i]; 1411 m3[6][i] = m2[2][i] - m2[6][i]; 1412 m3[7][i] = m2[3][i] - m2[7][i]; 1413 1414 m1[0][i] = m3[0][i] + m3[2][i]; 1415 m1[1][i] = m3[1][i] + m3[3][i]; 1416 m1[2][i] = m3[0][i] - m3[2][i]; 1417 m1[3][i] = m3[1][i] - m3[3][i]; 1418 m1[4][i] = m3[4][i] + m3[6][i]; 1419 m1[5][i] = m3[5][i] + m3[7][i]; 1420 m1[6][i] = m3[4][i] - m3[6][i]; 1421 m1[7][i] = m3[5][i] - m3[7][i]; 1422 1423 m2[0][i] = m1[0][i] + m1[1][i]; 1424 m2[1][i] = m1[0][i] - m1[1][i]; 1425 m2[2][i] = m1[2][i] + m1[3][i]; 1426 m2[3][i] = m1[2][i] - m1[3][i]; 1427 m2[4][i] = m1[4][i] + m1[5][i]; 1428 m2[5][i] = m1[4][i] - m1[5][i]; 1429 m2[6][i] = m1[6][i] + m1[7][i]; 1430 m2[7][i] = m1[6][i] - m1[7][i]; 1431 } 1432 1433 for (i = 0; i < 8; i++) 1434 { 1435 for (j = 0; j < 8; j++) 1436 { 1437 iSumHad += abs(m2[i][j]); 1438 } 1439 } 1440 iSumHad -= abs(m2[0][0]); 1441 iSumHad =(iSumHad+2)>>2; 1442 return(iSumHad); 1443 } 1444 1445 Int TEncCu::updateLCUDataISlice(TComDataCU* pcCU, Int LCUIdx, Int width, Int height) 1446 { 1447 Int xBl, yBl; 1448 const Int iBlkSize = 8; 1449 1450 Pel* pOrgInit = pcCU->getPic()->getPicYuvOrg()->getLumaAddr(pcCU->getAddr(), 0); 1451 Int iStrideOrig = pcCU->getPic()->getPicYuvOrg()->getStride(); 1452 Pel *pOrg; 1453 1454 Int iSumHad = 0; 1455 for ( yBl=0; (yBl+iBlkSize)<=height; yBl+= iBlkSize) 1456 { 1457 for ( xBl=0; (xBl+iBlkSize)<=width; xBl+= iBlkSize) 1458 { 1459 pOrg = pOrgInit + iStrideOrig*yBl + xBl; 1460 iSumHad += xCalcHADs8x8_ISlice(pOrg, iStrideOrig); 1461 } 1462 } 1463 return(iSumHad); 1464 } 1465 #endif 1466 1350 1467 /** check RD costs for a CU block encoded with merge 1351 1468 * \param rpcBestCU … … 1360 1477 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM]; 1361 1478 #else 1362 TComMvField cMvFieldNeighbours[ MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists1479 TComMvField cMvFieldNeighbours[2 * MRG_MAX_NUM_CANDS]; // double length for mv of both lists 1363 1480 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; 1364 1481 #endif … … 1400 1517 Int mergeCandBuffer[MRG_MAX_NUM_CANDS]; 1401 1518 #endif 1402 for( UInt ui = 0; ui < rpcTempCU->getSlice()->getMaxNumMergeCand(); ++ui )1519 for( UInt ui = 0; ui < numValidMergeCand; ++ui ) 1403 1520 { 1404 1521 mergeCandBuffer[ui] = 0; … … 1430 1547 { 1431 1548 for( UInt uiMergeCand = 0; uiMergeCand < numValidMergeCand; ++uiMergeCand ) 1432 { 1433 { 1549 { 1434 1550 #if H_3D_IC 1435 1551 if( rpcTempCU->getSlice()->getApplyIC() && rpcTempCU->getSlice()->getIcSkipParseFlag() ) … … 1443 1559 if(!(uiNoResidual==1 && mergeCandBuffer[uiMergeCand]==1)) 1444 1560 { 1445 1446 1561 if( !(bestIsSkip && uiNoResidual == 0) ) 1447 1562 { … … 1487 1602 m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] ); 1488 1603 // estimate residual and encode everything 1489 1490 1604 #if H_3D_VSO //M2 1491 1605 if( m_pcRdCost->getUseRenModel() ) … … 1498 1612 } 1499 1613 #endif 1500 1501 1614 m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, 1502 1615 m_ppcOrigYuv [uhDepth], … … 1508 1621 1509 1622 1510 if(uiNoResidual==0) 1511 { 1512 if(rpcTempCU->getQtRootCbf(0) == 0) 1623 if ( uiNoResidual == 0 && rpcTempCU->getQtRootCbf(0) == 0 ) 1513 1624 { 1625 // If no residual when allowing for one, then set mark to not try case where residual is forced to 0 1514 1626 mergeCandBuffer[uiMergeCand] = 1; 1515 1627 } 1516 } 1517 1518 rpcTempCU->setSkipFlagSubParts( rpcTempCU->getQtRootCbf(0) == 0, 0, uhDepth ); 1628 1629 rpcTempCU->setSkipFlagSubParts( rpcTempCU->getQtRootCbf(0) == 0, 0, uhDepth ); 1519 1630 Int orgQP = rpcTempCU->getQP( 0 ); 1520 1631 xCheckDQP( rpcTempCU ); … … 1522 1633 rpcTempCU->initEstData( uhDepth, orgQP ); 1523 1634 1524 1525 1635 if( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip ) 1526 1636 { 1527 1637 bestIsSkip = rpcBestCU->getQtRootCbf(0) == 0; 1528 1638 } 1529 1530 }1531 1639 } 1532 1640 } … … 1689 1797 #endif 1690 1798 1691 #if RATE_CONTROL_LAMBDA_DOMAIN 1799 #if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT 1692 1800 if ( m_pcEncCfg->getUseRateCtrl() && m_pcEncCfg->getLCULevelRC() && ePartSize == SIZE_2Nx2N && uhDepth <= m_addSADDepth ) 1693 1801 { -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncCu.h
r504 r537 102 102 Bool m_bUseSBACRD; 103 103 TEncRateCtrl* m_pcRateCtrl; 104 #if RATE_CONTROL_LAMBDA_DOMAIN 104 #if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT 105 105 UInt m_LCUPredictionSAD; 106 106 Int m_addSADDepth; … … 124 124 125 125 Void setBitCounter ( TComBitCounter* pcBitCounter ) { m_pcBitCounter = pcBitCounter; } 126 #if RATE_CONTROL_LAMBDA_DOMAIN 126 #if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT 127 127 UInt getLCUPredictionSAD() { return m_LCUPredictionSAD; } 128 #endif 129 #if RATE_CONTROL_INTRA 130 Int updateLCUDataISlice ( TComDataCU* pcCU, Int LCUIdx, Int width, Int height ); 128 131 #endif 129 132 protected: -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncGOP.cpp
r534 r537 94 94 m_cpbRemovalDelay = 0; 95 95 m_lastBPSEI = 0; 96 #if L0045_NON_NESTED_SEI_RESTRICTIONS97 96 xResetNonNestedSEIPresentFlags(); 98 #if K0180_SCALABLE_NESTING_SEI99 97 xResetNestedSEIPresentFlags(); 100 #endif101 #endif102 98 #if H_MV 103 99 m_layerId = 0; … … 163 159 SEIActiveParameterSets *seiActiveParameterSets = new SEIActiveParameterSets(); 164 160 seiActiveParameterSets->activeVPSId = m_pcCfg->getVPS()->getVPSId(); 165 #if L0047_APS_FLAGS166 161 seiActiveParameterSets->m_fullRandomAccessFlag = false; 167 162 seiActiveParameterSets->m_noParamSetUpdateFlag = false; 168 #endif169 163 seiActiveParameterSets->numSpsIdsMinus1 = 0; 170 164 seiActiveParameterSets->activeSeqParamSetId.resize(seiActiveParameterSets->numSpsIdsMinus1 + 1); … … 179 173 seiFramePacking->m_arrangementCancelFlag = 0; 180 174 seiFramePacking->m_arrangementType = m_pcCfg->getFramePackingArrangementSEIType(); 181 #if L0444_FPA_TYPE182 175 assert((seiFramePacking->m_arrangementType > 2) && (seiFramePacking->m_arrangementType < 6) ); 183 #endif184 176 seiFramePacking->m_quincunxSamplingFlag = m_pcCfg->getFramePackingArrangementSEIQuincunx(); 185 177 seiFramePacking->m_contentInterpretationType = m_pcCfg->getFramePackingArrangementSEIInterpretation(); … … 195 187 seiFramePacking->m_frame1GridPositionY = 0; 196 188 seiFramePacking->m_arrangementReservedByte = 0; 197 #if L0045_PERSISTENCE_FLAGS198 189 seiFramePacking->m_arrangementPersistenceFlag = true; 199 #else200 seiFramePacking->m_arrangementRepetetionPeriod = 1;201 #endif202 190 seiFramePacking->m_upsampledAspectRatio = 0; 203 191 return seiFramePacking; … … 214 202 } 215 203 216 #if J0149_TONE_MAPPING_SEI217 204 SEIToneMappingInfo* TEncGOP::xCreateSEIToneMappingInfo() 218 205 { … … 225 212 assert(seiToneMappingInfo->m_codedDataBitDepth >= 8 && seiToneMappingInfo->m_codedDataBitDepth <= 14); 226 213 seiToneMappingInfo->m_targetBitDepth = m_pcCfg->getTMISEITargetBitDepth(); 227 assert( (seiToneMappingInfo->m_targetBitDepth >= 1 && seiToneMappingInfo->m_targetBitDepth <= 17) || (seiToneMappingInfo->m_targetBitDepth == 255));214 assert( seiToneMappingInfo->m_targetBitDepth >= 1 && seiToneMappingInfo->m_targetBitDepth <= 17 ); 228 215 seiToneMappingInfo->m_modelId = m_pcCfg->getTMISEIModelID(); 229 216 assert(seiToneMappingInfo->m_modelId >=0 &&seiToneMappingInfo->m_modelId<=4); … … 300 287 return seiToneMappingInfo; 301 288 } 302 #endif 289 303 290 Void TEncGOP::xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps) 304 291 { … … 315 302 accessUnit.push_back(new NALUnitEBSP(nalu)); 316 303 delete sei; 317 #if L0045_NON_NESTED_SEI_RESTRICTIONS318 304 m_activeParameterSetSEIPresentInAU = true; 319 #endif320 305 } 321 306 … … 342 327 delete sei; 343 328 } 344 #if J0149_TONE_MAPPING_SEI345 329 if(m_pcCfg->getToneMappingInfoSEIEnabled()) 346 330 { … … 354 338 delete sei; 355 339 } 356 #endif357 340 } 358 341 … … 389 372 #endif 390 373 SEIPictureTiming pictureTimingSEI; 391 #if L0208_SOP_DESCRIPTION_SEI392 374 Bool writeSOP = m_pcCfg->getSOPDescriptionSEIEnabled(); 393 #endif394 #if K0180_SCALABLE_NESTING_SEI395 375 // Initialize Scalable Nesting SEI with single layer values 396 376 SEIScalableNesting scalableNestingSEI; … … 403 383 scalableNestingSEI.m_nestingLayerId[0] = 0; 404 384 scalableNestingSEI.m_callerOwnsSEIs = true; 405 #endif406 #if L0044_DU_DPB_OUTPUT_DELAY_HRD407 385 Int picSptDpbOutputDuDelay = 0; 408 #endif409 386 UInt *accumBitsDU = NULL; 410 387 UInt *accumNalsDU = NULL; … … 596 573 pcSlice->getRPS()->setNumberOfLongtermPictures(0); 597 574 598 #if FIX1071 && H_MV_FIX1071575 #if FIX1071 599 576 if ((pcSlice->checkThatAllRefPicsAreAvailable(rcListPic, pcSlice->getRPS(), false) != 0) || (pcSlice->isIRAP())) 600 577 { … … 772 749 } 773 750 #endif 774 #if !L0034_COMBINED_LIST_CLEANUP775 if (pcSlice->getSliceType() != B_SLICE || !pcSlice->getSPS()->getUseLComb())776 {777 pcSlice->setNumRefIdx(REF_PIC_LIST_C, 0);778 pcSlice->setRefPicListCombinationFlag(false);779 pcSlice->setRefPicListModificationFlagLC(false);780 }781 else782 {783 pcSlice->setRefPicListCombinationFlag(pcSlice->getSPS()->getUseLComb());784 pcSlice->setNumRefIdx(REF_PIC_LIST_C, pcSlice->getNumRefIdx(REF_PIC_LIST_0));785 }786 #endif787 788 751 if (pcSlice->getSliceType() == B_SLICE) 789 752 { … … 820 783 pcSlice->setRefPOCList(); 821 784 822 #if L0034_COMBINED_LIST_CLEANUP823 785 pcSlice->setList1IdxToList0Idx(); 824 #else825 pcSlice->setNoBackPredFlag( false );826 if ( pcSlice->getSliceType() == B_SLICE && !pcSlice->getRefPicListCombinationFlag())827 {828 if ( pcSlice->getNumRefIdx(RefPicList( 0 ) ) == pcSlice->getNumRefIdx(RefPicList( 1 ) ) )829 {830 pcSlice->setNoBackPredFlag( true );831 Int i;832 for ( i=0; i < pcSlice->getNumRefIdx(RefPicList( 1 ) ); i++ )833 {834 if ( pcSlice->getRefPOC(RefPicList(1), i) != pcSlice->getRefPOC(RefPicList(0), i) )835 {836 pcSlice->setNoBackPredFlag( false );837 break;838 }839 }840 }841 }842 843 if(pcSlice->getNoBackPredFlag())844 {845 pcSlice->setNumRefIdx(REF_PIC_LIST_C, 0);846 }847 pcSlice->generateCombinedList();848 #endif849 786 #if H_3D_TMVP 850 787 if(pcSlice->getLayerId()) … … 943 880 944 881 #if RATE_CONTROL_LAMBDA_DOMAIN 945 Int sliceQP = pcSlice->getSliceQp();946 882 Double lambda = 0.0; 947 883 Int actualHeadBits = 0; … … 959 895 estimatedBits = m_pcRateCtrl->getRCPic()->getTargetBits(); 960 896 897 Int sliceQP = m_pcCfg->getInitialQP(); 961 898 if ( ( pcSlice->getPOC() == 0 && m_pcCfg->getInitialQP() > 0 ) || ( frameLevel == 0 && m_pcCfg->getForceIntraQP() ) ) // QP is specified 962 899 { 963 sliceQP = m_pcCfg->getInitialQP();964 900 Int NumberBFrames = ( m_pcCfg->getGOPSize() - 1 ); 965 901 Double dLambda_scale = 1.0 - Clip3( 0.0, 0.5, 0.05*(Double)NumberBFrames ); … … 972 908 else if ( frameLevel == 0 ) // intra case, but use the model 973 909 { 910 #if RATE_CONTROL_INTRA 911 m_pcSliceEncoder->calCostSliceI(pcPic); 912 #endif 974 913 if ( m_pcCfg->getIntraPeriod() != 1 ) // do not refine allocated bits for all intra case 975 914 { 976 915 Int bits = m_pcRateCtrl->getRCSeq()->getLeftAverageBits(); 916 #if RATE_CONTROL_INTRA 917 bits = m_pcRateCtrl->getRCPic()->getRefineBitsForIntra( bits ); 918 #else 977 919 bits = m_pcRateCtrl->getRCSeq()->getRefineBitsForIntra( bits ); 920 #endif 978 921 if ( bits < 200 ) 979 922 { … … 984 927 985 928 list<TEncRCPic*> listPreviousPicture = m_pcRateCtrl->getPicList(); 929 #if RATE_CONTROL_INTRA 930 m_pcRateCtrl->getRCPic()->getLCUInitTargetBits(); 931 lambda = m_pcRateCtrl->getRCPic()->estimatePicLambda( listPreviousPicture, pcSlice->getSliceType()); 932 #else 986 933 lambda = m_pcRateCtrl->getRCPic()->estimatePicLambda( listPreviousPicture ); 934 #endif 987 935 sliceQP = m_pcRateCtrl->getRCPic()->estimatePicQP( lambda, listPreviousPicture ); 988 936 } … … 990 938 { 991 939 list<TEncRCPic*> listPreviousPicture = m_pcRateCtrl->getPicList(); 940 #if RATE_CONTROL_INTRA 941 lambda = m_pcRateCtrl->getRCPic()->estimatePicLambda( listPreviousPicture, pcSlice->getSliceType()); 942 #else 992 943 lambda = m_pcRateCtrl->getRCPic()->estimatePicLambda( listPreviousPicture ); 944 #endif 993 945 sliceQP = m_pcRateCtrl->getRCPic()->estimatePicQP( lambda, listPreviousPicture ); 994 946 } … … 1199 1151 Bool bLFCrossTileBoundary = pcSlice->getPPS()->getLoopFilterAcrossTilesEnabledFlag(); 1200 1152 m_pcLoopFilter->setCfg(bLFCrossTileBoundary); 1201 #if L0386_DB_METRIC1202 1153 if ( m_pcCfg->getDeblockingFilterMetric() ) 1203 1154 { 1204 1155 dblMetric(pcPic, uiNumSlices); 1205 1156 } 1206 #endif1207 1157 m_pcLoopFilter->loopFilterPic( pcPic ); 1208 1158 … … 1267 1217 UInt maxCU = m_pcCfg->getSliceArgument() >> ( pcSlice->getSPS()->getMaxCUDepth() << 1); 1268 1218 UInt numDU = ( m_pcCfg->getSliceMode() == 1 ) ? ( pcPic->getNumCUsInFrame() / maxCU ) : ( 0 ); 1269 if( pcPic->getNumCUsInFrame() % maxCU != 0 )1219 if( pcPic->getNumCUsInFrame() % maxCU != 0 || numDU == 0 ) 1270 1220 { 1271 1221 numDU ++; … … 1307 1257 } 1308 1258 1309 #if L0208_SOP_DESCRIPTION_SEI1310 1259 if (writeSOP) // write SOP description SEI (if enabled) at the beginning of GOP 1311 1260 { … … 1345 1294 writeSOP = false; 1346 1295 } 1347 #endif1348 1296 1349 1297 if( ( m_pcCfg->getPictureTimingSEIEnabled() || m_pcCfg->getDecodingUnitInfoSEIEnabled() ) && … … 1377 1325 pictureTimingSEI.m_auCpbRemovalDelay = std::max<Int>(1, m_totalCoded - m_lastBPSEI); // Syntax element signalled as minus, hence the . 1378 1326 pictureTimingSEI.m_picDpbOutputDelay = pcSlice->getSPS()->getNumReorderPics(0) + pcSlice->getPOC() - m_totalCoded; 1379 #if L0044_DU_DPB_OUTPUT_DELAY_HRD1380 1327 Int factor = pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getTickDivisorMinus2() + 2; 1381 1328 pictureTimingSEI.m_picDpbOutputDuDelay = factor * pictureTimingSEI.m_picDpbOutputDelay; … … 1384 1331 picSptDpbOutputDuDelay = factor * pictureTimingSEI.m_picDpbOutputDelay; 1385 1332 } 1386 #endif1387 1333 } 1388 1334 … … 1404 1350 sei_buffering_period.m_initialCpbRemovalDelayOffset[0][1] = uiInitialCpbRemovalDelay; 1405 1351 1406 #if L0043_TIMING_INFO1407 1352 Double dTmp = (Double)pcSlice->getSPS()->getVuiParameters()->getTimingInfo()->getNumUnitsInTick() / (Double)pcSlice->getSPS()->getVuiParameters()->getTimingInfo()->getTimeScale(); 1408 #else1409 Double dTmp = (Double)pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getNumUnitsInTick() / (Double)pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getTimeScale();1410 #endif1411 1353 1412 1354 UInt uiTmp = (UInt)( dTmp * 90000.0 ); … … 1419 1361 1420 1362 sei_buffering_period.m_rapCpbParamsPresentFlag = 0; 1421 #if L0328_SPLICING1422 1363 //for the concatenation, it can be set to one during splicing. 1423 1364 sei_buffering_period.m_concatenationFlag = 0; 1424 1365 //since the temporal layer HRD is not ready, we assumed it is fixed 1425 1366 sei_buffering_period.m_auCpbRemovalDelayDelta = 1; 1426 #endif1427 #if L0044_CPB_DPB_DELAY_OFFSET1428 1367 sei_buffering_period.m_cpbDelayOffset = 0; 1429 1368 sei_buffering_period.m_dpbDelayOffset = 0; 1430 #endif1431 1369 1432 1370 m_seiWriter.writeSEImessage( nalu.m_Bitstream, sei_buffering_period, pcSlice->getSPS()); 1433 1371 writeRBSPTrailingBits(nalu.m_Bitstream); 1434 #if L0045_NON_NESTED_SEI_RESTRICTIONS1435 1372 { 1436 1373 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit); … … 1444 1381 m_bufferingPeriodSEIPresentInAU = true; 1445 1382 } 1446 #else 1447 accessUnit.push_back(new NALUnitEBSP(nalu)); 1448 #endif 1449 1450 #if K0180_SCALABLE_NESTING_SEI 1383 1451 1384 if (m_pcCfg->getScalableNestingSEIEnabled()) 1452 1385 { … … 1458 1391 m_seiWriter.writeSEImessage( naluTmp.m_Bitstream, scalableNestingSEI, pcSlice->getSPS()); 1459 1392 writeRBSPTrailingBits(naluTmp.m_Bitstream); 1460 #if L0045_NON_NESTED_SEI_RESTRICTIONS1461 1393 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit); 1462 1394 UInt offsetPosition = m_activeParameterSetSEIPresentInAU + m_bufferingPeriodSEIPresentInAU + m_pictureTimingSEIPresentInAU; // Insert BP SEI after non-nested APS, BP and PT SEIs … … 1468 1400 accessUnit.insert(it, new NALUnitEBSP(naluTmp)); 1469 1401 m_nestedBufferingPeriodSEIPresentInAU = true; 1470 #else 1471 accessUnit.push_back(new NALUnitEBSP(naluTmp)); 1472 #endif 1473 } 1474 #endif 1402 } 1475 1403 1476 1404 m_lastBPSEI = m_totalCoded; … … 1935 1863 if ( m_pcCfg->getUseRateCtrl() ) 1936 1864 { 1865 #if !M0036_RC_IMPROVEMENT 1937 1866 Double effectivePercentage = m_pcRateCtrl->getRCPic()->getEffectivePercentage(); 1867 #endif 1938 1868 Double avgQP = m_pcRateCtrl->getRCPic()->calAverageQP(); 1939 1869 Double avgLambda = m_pcRateCtrl->getRCPic()->calAverageLambda(); … … 1942 1872 avgLambda = lambda; 1943 1873 } 1874 #if M0036_RC_IMPROVEMENT 1875 #if RATE_CONTROL_INTRA 1876 m_pcRateCtrl->getRCPic()->updateAfterPicture( actualHeadBits, actualTotalBits, avgQP, avgLambda, pcSlice->getSliceType()); 1877 #else 1878 m_pcRateCtrl->getRCPic()->updateAfterPicture( actualHeadBits, actualTotalBits, avgQP, avgLambda ); 1879 #endif 1880 #else 1944 1881 m_pcRateCtrl->getRCPic()->updateAfterPicture( actualHeadBits, actualTotalBits, avgQP, avgLambda, effectivePercentage ); 1882 #endif 1945 1883 m_pcRateCtrl->getRCPic()->addToPictureLsit( m_pcRateCtrl->getPicList() ); 1946 1884 … … 1962 1900 } 1963 1901 #endif 1902 1964 1903 if( ( m_pcCfg->getPictureTimingSEIEnabled() || m_pcCfg->getDecodingUnitInfoSEIEnabled() ) && 1965 1904 ( pcSlice->getSPS()->getVuiParametersPresentFlag() ) && … … 1996 1935 for( i = ( numDU - 2 ); i >= 0; i -- ) 1997 1936 { 1998 #if L0043_TIMING_INFO1999 1937 ui64Tmp = ( ( ( accumBitsDU[ numDU - 1 ] - accumBitsDU[ i ] ) * ( vui->getTimingInfo()->getTimeScale() / vui->getTimingInfo()->getNumUnitsInTick() ) * ( hrd->getTickDivisorMinus2() + 2 ) ) / ( m_pcCfg->getTargetBitrate() ) ); 2000 #else2001 ui64Tmp = ( ( ( accumBitsDU[ numDU - 1 ] - accumBitsDU[ i ] ) * ( hrd->getTimeScale() / hrd->getNumUnitsInTick() ) * ( hrd->getTickDivisorMinus2() + 2 ) ) / ( m_pcCfg->getTargetBitrate() ) );2002 #endif2003 1938 if( (UInt)ui64Tmp > maxDiff ) 2004 1939 { … … 2012 1947 { 2013 1948 flag = 0; 2014 #if L0043_TIMING_INFO2015 1949 ui64Tmp = ( ( ( accumBitsDU[ numDU - 1 ] - accumBitsDU[ i ] ) * ( vui->getTimingInfo()->getTimeScale() / vui->getTimingInfo()->getNumUnitsInTick() ) * ( hrd->getTickDivisorMinus2() + 2 ) ) / ( m_pcCfg->getTargetBitrate() ) ); 2016 #else2017 ui64Tmp = ( ( ( accumBitsDU[ numDU - 1 ] - accumBitsDU[ i ] ) * ( hrd->getTimeScale() / hrd->getNumUnitsInTick() ) * ( hrd->getTickDivisorMinus2() + 2 ) ) / ( m_pcCfg->getTargetBitrate() ) );2018 #endif2019 1950 2020 1951 if( (UInt)ui64Tmp > maxDiff ) … … 2048 1979 m_seiWriter.writeSEImessage(nalu.m_Bitstream, pictureTimingSEI, pcSlice->getSPS()); 2049 1980 writeRBSPTrailingBits(nalu.m_Bitstream); 2050 #if L0045_NON_NESTED_SEI_RESTRICTIONS2051 1981 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit); 2052 1982 UInt offsetPosition = m_activeParameterSetSEIPresentInAU … … 2059 1989 accessUnit.insert(it, new NALUnitEBSP(nalu)); 2060 1990 m_pictureTimingSEIPresentInAU = true; 2061 #else 2062 AccessUnit::iterator it = find_if(accessUnit.begin(), accessUnit.end(), mem_fun(&NALUnit::isSlice)); 2063 accessUnit.insert(it, new NALUnitEBSP(nalu)); 2064 #endif 2065 } 2066 #if K0180_SCALABLE_NESTING_SEI 1991 } 2067 1992 if ( m_pcCfg->getScalableNestingSEIEnabled() ) // put picture timing SEI into scalable nesting SEI 2068 1993 { … … 2073 1998 m_seiWriter.writeSEImessage(nalu.m_Bitstream, scalableNestingSEI, pcSlice->getSPS()); 2074 1999 writeRBSPTrailingBits(nalu.m_Bitstream); 2075 #if L0045_NON_NESTED_SEI_RESTRICTIONS2076 2000 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit); 2077 2001 UInt offsetPosition = m_activeParameterSetSEIPresentInAU … … 2084 2008 accessUnit.insert(it, new NALUnitEBSP(nalu)); 2085 2009 m_nestedPictureTimingSEIPresentInAU = true; 2086 #else2087 AccessUnit::iterator it = find_if(accessUnit.begin(), accessUnit.end(), mem_fun(&NALUnit::isSlice));2088 accessUnit.insert(it, new NALUnitEBSP(nalu));2089 #endif2090 2010 } 2091 #endif2092 2093 2011 } 2094 2012 if( m_pcCfg->getDecodingUnitInfoSEIEnabled() && hrd->getSubPicCpbParamsPresentFlag() ) … … 2102 2020 tempSEI.m_decodingUnitIdx = i; 2103 2021 tempSEI.m_duSptCpbRemovalDelay = pictureTimingSEI.m_duCpbRemovalDelayMinus1[i] + 1; 2104 #if L0044_DU_DPB_OUTPUT_DELAY_HRD2105 2022 tempSEI.m_dpbOutputDuDelayPresentFlag = false; 2106 2023 tempSEI.m_picSptDpbOutputDuDelay = picSptDpbOutputDuDelay; 2107 #endif2108 2024 2109 2025 AccessUnit::iterator it; … … 2115 2031 writeRBSPTrailingBits(nalu.m_Bitstream); 2116 2032 2117 #if L0045_NON_NESTED_SEI_RESTRICTIONS2118 2033 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit); 2119 2034 UInt offsetPosition = m_activeParameterSetSEIPresentInAU … … 2125 2040 } 2126 2041 accessUnit.insert(it, new NALUnitEBSP(nalu)); 2127 #else2128 it = find_if(accessUnit.begin(), accessUnit.end(), mem_fun(&NALUnit::isSlice));2129 accessUnit.insert(it, new NALUnitEBSP(nalu));2130 #endif2131 2042 } 2132 2043 else … … 2154 2065 } 2155 2066 } 2156 #if L0045_NON_NESTED_SEI_RESTRICTIONS2157 2067 xResetNonNestedSEIPresentFlags(); 2158 #if K0180_SCALABLE_NESTING_SEI2159 2068 xResetNestedSEIPresentFlags(); 2160 #endif2161 #endif2162 2069 pcPic->getPicYuvRec()->copyToPic(pcPicYuvRecOut); 2163 2070 … … 2851 2758 } 2852 2759 2853 #if L0045_NON_NESTED_SEI_RESTRICTIONS2854 2760 /** Function for finding the position to insert the first of APS and non-nested BP, PT, DU info SEI messages. 2855 2761 * \param accessUnit Access Unit of the current picture … … 2871 2777 return seiStartPos; 2872 2778 } 2873 #endif 2874 2875 #if L0386_DB_METRIC 2779 2876 2780 Void TEncGOP::dblMetric( TComPic* pcPic, UInt uiNumSlices ) 2877 2781 { … … 2887 2791 const UInt noCol = (picWidth>>log2maxTB); 2888 2792 const UInt noRows = (picHeight>>log2maxTB); 2793 assert(noCol > 1); 2794 assert(noRows > 1); 2889 2795 UInt64 *colSAD = (UInt64*)malloc(noCol*sizeof(UInt64)); 2890 2796 UInt64 *rowSAD = (UInt64*)malloc(noRows*sizeof(UInt64)); … … 2995 2901 free(rowSAD); 2996 2902 } 2997 #endif 2903 2998 2904 #if H_MV 2999 2905 Void TEncGOP::xSetRefPicListModificationsMv( TComSlice* pcSlice, UInt iGOPid ) -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncGOP.h
r534 r537 128 128 UInt m_tl0Idx; 129 129 UInt m_rapIdx; 130 #if L0045_NON_NESTED_SEI_RESTRICTIONS131 130 Bool m_activeParameterSetSEIPresentInAU; 132 131 Bool m_bufferingPeriodSEIPresentInAU; 133 132 Bool m_pictureTimingSEIPresentInAU; 134 #if K0180_SCALABLE_NESTING_SEI135 133 Bool m_nestedBufferingPeriodSEIPresentInAU; 136 134 Bool m_nestedPictureTimingSEIPresentInAU; 137 #endif138 #endif139 135 public: 140 136 TEncGOP(); … … 199 195 SEIDisplayOrientation* xCreateSEIDisplayOrientation(); 200 196 201 #if J0149_TONE_MAPPING_SEI202 197 SEIToneMappingInfo* xCreateSEIToneMappingInfo(); 203 #endif204 198 205 199 Void xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps); 206 #if L0045_NON_NESTED_SEI_RESTRICTIONS207 200 Int xGetFirstSeiLocation (AccessUnit &accessUnit); 208 201 Void xResetNonNestedSEIPresentFlags() … … 212 205 m_pictureTimingSEIPresentInAU = false; 213 206 } 214 #if K0180_SCALABLE_NESTING_SEI215 207 Void xResetNestedSEIPresentFlags() 216 208 { … … 218 210 m_nestedPictureTimingSEIPresentInAU = false; 219 211 } 220 #endif221 #endif222 212 #if H_MV 223 213 Void xSetRefPicListModificationsMv( TComSlice* pcSlice, UInt iGOPid ); 224 214 #endif 225 #if L0386_DB_METRIC226 215 Void dblMetric( TComPic* pcPic, UInt uiNumSlices ); 227 #endif228 216 };// END CLASS DEFINITION TEncGOP 229 217 -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncRateCtrl.cpp
r324 r537 67 67 m_bitsLeft = 0; 68 68 m_useLCUSeparateModel = false; 69 #if M0036_RC_IMPROVEMENT 70 m_adaptiveBit = 0; 71 m_lastLambda = 0.0; 72 #endif 69 73 } 70 74 … … 74 78 } 75 79 80 #if M0036_RC_IMPROVEMENT 81 Void TEncRCSeq::create( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int numberOfLevel, Bool useLCUSeparateModel, Int adaptiveBit ) 82 #else 76 83 Void TEncRCSeq::create( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int numberOfLevel, Bool useLCUSeparateModel ) 84 #endif 77 85 { 78 86 destroy(); … … 101 109 m_betaUpdate = 0.025; 102 110 } 103 else 111 #if M0036_RC_IMPROVEMENT 112 else if ( m_seqTargetBpp < 0.2 ) 104 113 { 105 114 m_alphaUpdate = 0.1; 106 115 m_betaUpdate = 0.05; 107 116 } 117 else if ( m_seqTargetBpp < 0.5 ) 118 { 119 m_alphaUpdate = 0.2; 120 m_betaUpdate = 0.1; 121 } 122 else 123 { 124 m_alphaUpdate = 0.4; 125 m_betaUpdate = 0.2; 126 } 127 #else 128 else 129 { 130 m_alphaUpdate = 0.1; 131 m_betaUpdate = 0.05; 132 } 133 #endif 108 134 m_averageBits = (Int)(m_targetBits / totalFrames); 109 135 Int picWidthInBU = ( m_picWidth % m_LCUWidth ) == 0 ? m_picWidth / m_LCUWidth : m_picWidth / m_LCUWidth + 1; … … 146 172 m_framesLeft = m_totalFrames; 147 173 m_bitsLeft = m_targetBits; 174 #if M0036_RC_IMPROVEMENT 175 m_adaptiveBit = adaptiveBit; 176 m_lastLambda = 0.0; 177 #endif 148 178 } 149 179 … … 203 233 for ( Int i=0; i<m_numberOfLevel; i++ ) 204 234 { 235 #if RATE_CONTROL_INTRA 236 if (i>0) 237 { 238 m_picPara[i].m_alpha = 3.2003; 239 m_picPara[i].m_beta = -1.367; 240 } 241 else 242 { 243 m_picPara[i].m_alpha = ALPHA; 244 m_picPara[i].m_beta = BETA2; 245 } 246 #else 205 247 m_picPara[i].m_alpha = 3.2003; 206 248 m_picPara[i].m_beta = -1.367; 249 #endif 207 250 } 208 251 } … … 228 271 for ( Int j=0; j<m_numberOfLCU; j++) 229 272 { 273 #if RATE_CONTROL_INTRA 274 m_LCUPara[i][j].m_alpha = m_picPara[i].m_alpha; 275 m_LCUPara[i][j].m_beta = m_picPara[i].m_beta; 276 #else 230 277 m_LCUPara[i][j].m_alpha = 3.2003; 231 278 m_LCUPara[i][j].m_beta = -1.367; 279 #endif 232 280 } 233 281 } … … 251 299 } 252 300 301 #if !RATE_CONTROL_INTRA 253 302 Int TEncRCSeq::getRefineBitsForIntra( Int orgBits ) 254 303 { … … 264 313 return orgBits * 10; 265 314 } 315 #endif 316 317 #if M0036_RC_IMPROVEMENT 318 Void TEncRCSeq::setAllBitRatio( Double basicLambda, Double* equaCoeffA, Double* equaCoeffB ) 319 { 320 Int* bitsRatio = new Int[m_GOPSize]; 321 for ( Int i=0; i<m_GOPSize; i++ ) 322 { 323 bitsRatio[i] = (Int)( equaCoeffA[i] * pow( basicLambda, equaCoeffB[i] ) * m_numberOfPixel ); 324 } 325 initBitsRatio( bitsRatio ); 326 delete[] bitsRatio; 327 } 328 #endif 266 329 267 330 //GOP level … … 286 349 Int targetBits = xEstGOPTargetBits( encRCSeq, numPic ); 287 350 351 #if M0036_RC_IMPROVEMENT 352 if ( encRCSeq->getAdaptiveBits() > 0 && encRCSeq->getLastLambda() > 0.1 ) 353 { 354 Double targetBpp = (Double)targetBits / encRCSeq->getNumPixel(); 355 Double basicLambda = 0.0; 356 Double* lambdaRatio = new Double[encRCSeq->getGOPSize()]; 357 Double* equaCoeffA = new Double[encRCSeq->getGOPSize()]; 358 Double* equaCoeffB = new Double[encRCSeq->getGOPSize()]; 359 360 if ( encRCSeq->getAdaptiveBits() == 1 ) // for GOP size =4, low delay case 361 { 362 if ( encRCSeq->getLastLambda() < 120.0 ) 363 { 364 lambdaRatio[1] = 0.725 * log( encRCSeq->getLastLambda() ) + 0.5793; 365 lambdaRatio[0] = 1.3 * lambdaRatio[1]; 366 lambdaRatio[2] = 1.3 * lambdaRatio[1]; 367 lambdaRatio[3] = 1.0; 368 } 369 else 370 { 371 lambdaRatio[0] = 5.0; 372 lambdaRatio[1] = 4.0; 373 lambdaRatio[2] = 5.0; 374 lambdaRatio[3] = 1.0; 375 } 376 } 377 else if ( encRCSeq->getAdaptiveBits() == 2 ) // for GOP size = 8, random access case 378 { 379 if ( encRCSeq->getLastLambda() < 90.0 ) 380 { 381 lambdaRatio[0] = 1.0; 382 lambdaRatio[1] = 0.725 * log( encRCSeq->getLastLambda() ) + 0.7963; 383 lambdaRatio[2] = 1.3 * lambdaRatio[1]; 384 lambdaRatio[3] = 3.25 * lambdaRatio[1]; 385 lambdaRatio[4] = 3.25 * lambdaRatio[1]; 386 lambdaRatio[5] = 1.3 * lambdaRatio[1]; 387 lambdaRatio[6] = 3.25 * lambdaRatio[1]; 388 lambdaRatio[7] = 3.25 * lambdaRatio[1]; 389 } 390 else 391 { 392 lambdaRatio[0] = 1.0; 393 lambdaRatio[1] = 4.0; 394 lambdaRatio[2] = 5.0; 395 lambdaRatio[3] = 12.3; 396 lambdaRatio[4] = 12.3; 397 lambdaRatio[5] = 5.0; 398 lambdaRatio[6] = 12.3; 399 lambdaRatio[7] = 12.3; 400 } 401 } 402 403 xCalEquaCoeff( encRCSeq, lambdaRatio, equaCoeffA, equaCoeffB, encRCSeq->getGOPSize() ); 404 basicLambda = xSolveEqua( targetBpp, equaCoeffA, equaCoeffB, encRCSeq->getGOPSize() ); 405 encRCSeq->setAllBitRatio( basicLambda, equaCoeffA, equaCoeffB ); 406 407 delete []lambdaRatio; 408 delete []equaCoeffA; 409 delete []equaCoeffB; 410 } 411 #endif 412 288 413 m_picTargetBitInGOP = new Int[numPic]; 289 414 Int i; … … 297 422 { 298 423 currPicRatio = encRCSeq->getBitRatio( i ); 424 #if M0036_RC_IMPROVEMENT 425 m_picTargetBitInGOP[i] = (Int)( ((Double)targetBits) * currPicRatio / totalPicRatio ); 426 #else 299 427 m_picTargetBitInGOP[i] = targetBits * currPicRatio / totalPicRatio; 428 #endif 300 429 } 301 430 … … 306 435 m_bitsLeft = m_targetBits; 307 436 } 437 438 #if M0036_RC_IMPROVEMENT 439 Void TEncRCGOP::xCalEquaCoeff( TEncRCSeq* encRCSeq, Double* lambdaRatio, Double* equaCoeffA, Double* equaCoeffB, Int GOPSize ) 440 { 441 for ( Int i=0; i<GOPSize; i++ ) 442 { 443 Int frameLevel = encRCSeq->getGOPID2Level(i); 444 Double alpha = encRCSeq->getPicPara(frameLevel).m_alpha; 445 Double beta = encRCSeq->getPicPara(frameLevel).m_beta; 446 equaCoeffA[i] = pow( 1.0/alpha, 1.0/beta ) * pow( lambdaRatio[i], 1.0/beta ); 447 equaCoeffB[i] = 1.0/beta; 448 } 449 } 450 451 Double TEncRCGOP::xSolveEqua( Double targetBpp, Double* equaCoeffA, Double* equaCoeffB, Int GOPSize ) 452 { 453 Double solution = 100.0; 454 Double minNumber = 0.1; 455 Double maxNumber = 10000.0; 456 for ( Int i=0; i<g_RCIterationNum; i++ ) 457 { 458 Double fx = 0.0; 459 for ( Int j=0; j<GOPSize; j++ ) 460 { 461 fx += equaCoeffA[j] * pow( solution, equaCoeffB[j] ); 462 } 463 464 if ( fabs( fx - targetBpp ) < 0.000001 ) 465 { 466 break; 467 } 468 469 if ( fx > targetBpp ) 470 { 471 minNumber = solution; 472 solution = ( solution + maxNumber ) / 2.0; 473 } 474 else 475 { 476 maxNumber = solution; 477 solution = ( solution + minNumber ) / 2.0; 478 } 479 } 480 481 solution = Clip3( 0.1, 10000.0, solution ); 482 return solution; 483 } 484 #endif 308 485 309 486 Void TEncRCGOP::destroy() … … 357 534 358 535 m_LCUs = NULL; 536 #if !M0036_RC_IMPROVEMENT 359 537 m_lastPicture = NULL; 538 #endif 360 539 m_picActualHeaderBits = 0; 540 #if !M0036_RC_IMPROVEMENT 361 541 m_totalMAD = 0.0; 542 #endif 362 543 m_picActualBits = 0; 363 544 m_picQP = 0; … … 384 565 } 385 566 567 #if M0036_RC_IMPROVEMENT 568 targetBits = Int( ((Double)GOPbitsLeft) * currPicRatio / totalPicRatio ); 569 #else 386 570 targetBits = Int( GOPbitsLeft * currPicRatio / totalPicRatio ); 571 #endif 387 572 388 573 if ( targetBits < 100 ) … … 480 665 m_LCUs[LCUIdx].m_lambda = 0.0; 481 666 m_LCUs[LCUIdx].m_targetBits = 0; 667 #if M0036_RC_IMPROVEMENT 668 m_LCUs[LCUIdx].m_bitWeight = 1.0; 669 #else 482 670 m_LCUs[LCUIdx].m_MAD = 0.0; 671 #endif 483 672 Int currWidth = ( (i == picWidthInLCU -1) ? picWidth - LCUWidth *(picWidthInLCU -1) : LCUWidth ); 484 673 Int currHeight = ( (j == picHeightInLCU-1) ? picHeight - LCUHeight*(picHeightInLCU-1) : LCUHeight ); … … 487 676 } 488 677 m_picActualHeaderBits = 0; 678 #if !M0036_RC_IMPROVEMENT 489 679 m_totalMAD = 0.0; 680 #endif 490 681 m_picActualBits = 0; 491 682 m_picQP = 0; 492 683 m_picLambda = 0.0; 493 684 685 #if !M0036_RC_IMPROVEMENT 494 686 m_lastPicture = NULL; 495 687 list<TEncRCPic*>::reverse_iterator it; … … 502 694 } 503 695 } 696 #endif 504 697 } 505 698 … … 515 708 } 516 709 710 711 #if RATE_CONTROL_INTRA 712 Double TEncRCPic::estimatePicLambda( list<TEncRCPic*>& listPreviousPictures, SliceType eSliceType) 713 #else 517 714 Double TEncRCPic::estimatePicLambda( list<TEncRCPic*>& listPreviousPictures ) 715 #endif 518 716 { 519 717 Double alpha = m_encRCSeq->getPicPara( m_frameLevel ).m_alpha; 520 718 Double beta = m_encRCSeq->getPicPara( m_frameLevel ).m_beta; 521 719 Double bpp = (Double)m_targetBits/(Double)m_numberOfPixel; 720 #if RATE_CONTROL_INTRA 721 Double estLambda; 722 if (eSliceType == I_SLICE) 723 { 724 estLambda = calculateLambdaIntra(alpha, beta, pow(m_totalCostIntra/(Double)m_numberOfPixel, BETA1), bpp); 725 } 726 else 727 { 728 estLambda = alpha * pow( bpp, beta ); 729 } 730 #else 522 731 Double estLambda = alpha * pow( bpp, beta ); 732 #endif 733 523 734 Double lastLevelLambda = -1.0; 524 735 Double lastPicLambda = -1.0; … … 566 777 567 778 m_estPicLambda = estLambda; 779 780 #if M0036_RC_IMPROVEMENT 781 Double totalWeight = 0.0; 782 // initial BU bit allocation weight 783 for ( Int i=0; i<m_numberOfLCU; i++ ) 784 { 785 #if RC_FIX 786 Double alphaLCU, betaLCU; 787 if ( m_encRCSeq->getUseLCUSeparateModel() ) 788 { 789 alphaLCU = m_encRCSeq->getLCUPara( m_frameLevel, i ).m_alpha; 790 betaLCU = m_encRCSeq->getLCUPara( m_frameLevel, i ).m_beta; 791 } 792 else 793 { 794 alphaLCU = m_encRCSeq->getPicPara( m_frameLevel ).m_alpha; 795 betaLCU = m_encRCSeq->getPicPara( m_frameLevel ).m_beta; 796 } 797 #else 798 Double alphaLCU = m_encRCSeq->getLCUPara( m_frameLevel, i ).m_alpha; 799 Double betaLCU = m_encRCSeq->getLCUPara( m_frameLevel, i ).m_beta; 800 #endif 801 802 m_LCUs[i].m_bitWeight = m_LCUs[i].m_numberOfPixel * pow( estLambda/alphaLCU, 1.0/betaLCU ); 803 804 if ( m_LCUs[i].m_bitWeight < 0.01 ) 805 { 806 m_LCUs[i].m_bitWeight = 0.01; 807 } 808 totalWeight += m_LCUs[i].m_bitWeight; 809 } 810 for ( Int i=0; i<m_numberOfLCU; i++ ) 811 { 812 Double BUTargetBits = m_targetBits * m_LCUs[i].m_bitWeight / totalWeight; 813 m_LCUs[i].m_bitWeight = BUTargetBits; 814 } 815 #endif 816 568 817 return estLambda; 569 818 } … … 607 856 } 608 857 858 #if RATE_CONTROL_INTRA 859 Double TEncRCPic::getLCUTargetBpp(SliceType eSliceType) 860 #else 609 861 Double TEncRCPic::getLCUTargetBpp() 862 #endif 610 863 { 611 864 Int LCUIdx = getLCUCoded(); 612 865 Double bpp = -1.0; 613 866 Int avgBits = 0; 867 #if !M0036_RC_IMPROVEMENT 614 868 Double totalMAD = -1.0; 615 869 Double MAD = -1.0; 616 870 #endif 871 872 #if RATE_CONTROL_INTRA 873 if (eSliceType == I_SLICE){ 874 Int noOfLCUsLeft = m_numberOfLCU - LCUIdx + 1; 875 Int bitrateWindow = min(4,noOfLCUsLeft); 876 Double MAD = getLCU(LCUIdx).m_costIntra; 877 878 if (m_remainingCostIntra > 0.1 ) 879 { 880 Double weightedBitsLeft = (m_bitsLeft*bitrateWindow+(m_bitsLeft-getLCU(LCUIdx).m_targetBitsLeft)*noOfLCUsLeft)/(Double)bitrateWindow; 881 avgBits = Int( MAD*weightedBitsLeft/m_remainingCostIntra ); 882 } 883 else 884 { 885 avgBits = Int( m_bitsLeft / m_LCULeft ); 886 } 887 m_remainingCostIntra -= MAD; 888 } 889 else 890 { 891 #endif 892 #if M0036_RC_IMPROVEMENT 893 Double totalWeight = 0; 894 for ( Int i=LCUIdx; i<m_numberOfLCU; i++ ) 895 { 896 totalWeight += m_LCUs[i].m_bitWeight; 897 } 898 Int realInfluenceLCU = min( g_RCLCUSmoothWindowSize, getLCULeft() ); 899 avgBits = (Int)( m_LCUs[LCUIdx].m_bitWeight - ( totalWeight - m_bitsLeft ) / realInfluenceLCU + 0.5 ); 900 #else 617 901 if ( m_lastPicture == NULL ) 618 902 { … … 637 921 } 638 922 } 639 640 #if L0033_RC_BUGFIX 923 #endif 924 #if RATE_CONTROL_INTRA 925 } 926 #endif 927 641 928 if ( avgBits < 1 ) 642 929 { 643 930 avgBits = 1; 644 931 } 645 #else646 if ( avgBits < 5 )647 {648 avgBits = 5;649 }650 #endif651 932 652 933 bpp = ( Double )avgBits/( Double )m_LCUs[ LCUIdx ].m_numberOfPixel; … … 716 997 //for Lambda clip, LCU level clip 717 998 Int clipNeighbourQP = g_RCInvalidQPValue; 718 #if L0033_RC_BUGFIX719 999 for ( int i=LCUIdx - 1; i>=0; i-- ) 720 #else721 for ( int i=LCUIdx; i>=0; i-- )722 #endif723 1000 { 724 1001 if ( (getLCU(i)).m_QP > g_RCInvalidQPValue ) … … 773 1050 beta *= ( 1.0 - m_encRCSeq->getBetaUpdate() / 2.0 ); 774 1051 1052 #if M0036_RC_IMPROVEMENT 1053 alpha = Clip3( g_RCAlphaMinValue, g_RCAlphaMaxValue, alpha ); 1054 beta = Clip3( g_RCBetaMinValue, g_RCBetaMaxValue, beta ); 1055 #else 775 1056 alpha = Clip3( 0.05, 20.0, alpha ); 776 1057 beta = Clip3( -3.0, -0.1, beta ); 1058 #endif 777 1059 778 1060 TRCParameter rcPara; … … 787 1069 alpha += m_encRCSeq->getAlphaUpdate() * ( log( inputLambda ) - log( calLambda ) ) * alpha; 788 1070 double lnbpp = log( bpp ); 1071 #if M0036_RC_IMPROVEMENT 1072 lnbpp = Clip3( -5.0, -0.1, lnbpp ); 1073 #else 789 1074 lnbpp = Clip3( -5.0, 1.0, lnbpp ); 1075 #endif 790 1076 beta += m_encRCSeq->getBetaUpdate() * ( log( inputLambda ) - log( calLambda ) ) * lnbpp; 791 1077 1078 #if M0036_RC_IMPROVEMENT 1079 alpha = Clip3( g_RCAlphaMinValue, g_RCAlphaMaxValue, alpha ); 1080 beta = Clip3( g_RCBetaMinValue, g_RCBetaMaxValue, beta ); 1081 #else 792 1082 alpha = Clip3( 0.05, 20.0, alpha ); 793 1083 beta = Clip3( -3.0, -0.1, beta ); 1084 #endif 794 1085 TRCParameter rcPara; 795 1086 rcPara.m_alpha = alpha; … … 799 1090 } 800 1091 1092 #if !M0036_RC_IMPROVEMENT 801 1093 Double TEncRCPic::getEffectivePercentage() 802 1094 { … … 816 1108 return effectivePixelPercentage; 817 1109 } 1110 #endif 818 1111 819 1112 Double TEncRCPic::calAverageQP() … … 871 1164 } 872 1165 1166 #if M0036_RC_IMPROVEMENT 1167 #if RATE_CONTROL_INTRA 1168 Void TEncRCPic::updateAfterPicture( Int actualHeaderBits, Int actualTotalBits, Double averageQP, Double averageLambda, SliceType eSliceType) 1169 #else 1170 Void TEncRCPic::updateAfterPicture( Int actualHeaderBits, Int actualTotalBits, Double averageQP, Double averageLambda ) 1171 #endif 1172 #else 873 1173 Void TEncRCPic::updateAfterPicture( Int actualHeaderBits, Int actualTotalBits, Double averageQP, Double averageLambda, Double effectivePercentage ) 1174 #endif 874 1175 { 875 1176 m_picActualHeaderBits = actualHeaderBits; … … 884 1185 } 885 1186 m_picLambda = averageLambda; 1187 #if !M0036_RC_IMPROVEMENT 886 1188 for ( Int i=0; i<m_numberOfLCU; i++ ) 887 1189 { 888 1190 m_totalMAD += m_LCUs[i].m_MAD; 889 1191 } 1192 #endif 890 1193 891 1194 Double alpha = m_encRCSeq->getPicPara( m_frameLevel ).m_alpha; 892 1195 Double beta = m_encRCSeq->getPicPara( m_frameLevel ).m_beta; 893 1196 #if RATE_CONTROL_INTRA 1197 if (eSliceType == I_SLICE) 1198 { 1199 updateAlphaBetaIntra(&alpha, &beta); 1200 } 1201 else 1202 { 1203 #endif 894 1204 // update parameters 895 1205 Double picActualBits = ( Double )m_picActualBits; … … 898 1208 Double inputLambda = m_picLambda; 899 1209 1210 #if M0036_RC_IMPROVEMENT 1211 if ( inputLambda < 0.01 || calLambda < 0.01 || picActualBpp < 0.0001 ) 1212 #else 900 1213 if ( inputLambda < 0.01 || calLambda < 0.01 || picActualBpp < 0.0001 || effectivePercentage < 0.05 ) 1214 #endif 901 1215 { 902 1216 alpha *= ( 1.0 - m_encRCSeq->getAlphaUpdate() / 2.0 ); 903 1217 beta *= ( 1.0 - m_encRCSeq->getBetaUpdate() / 2.0 ); 904 1218 1219 #if M0036_RC_IMPROVEMENT 1220 alpha = Clip3( g_RCAlphaMinValue, g_RCAlphaMaxValue, alpha ); 1221 beta = Clip3( g_RCBetaMinValue, g_RCBetaMaxValue, beta ); 1222 #else 905 1223 alpha = Clip3( 0.05, 20.0, alpha ); 906 1224 beta = Clip3( -3.0, -0.1, beta ); 1225 #endif 907 1226 TRCParameter rcPara; 908 1227 rcPara.m_alpha = alpha; … … 916 1235 alpha += m_encRCSeq->getAlphaUpdate() * ( log( inputLambda ) - log( calLambda ) ) * alpha; 917 1236 double lnbpp = log( picActualBpp ); 1237 #if M0036_RC_IMPROVEMENT 1238 lnbpp = Clip3( -5.0, -0.1, lnbpp ); 1239 #else 918 1240 lnbpp = Clip3( -5.0, 1.0, lnbpp ); 1241 #endif 919 1242 beta += m_encRCSeq->getBetaUpdate() * ( log( inputLambda ) - log( calLambda ) ) * lnbpp; 920 1243 1244 #if M0036_RC_IMPROVEMENT 1245 alpha = Clip3( g_RCAlphaMinValue, g_RCAlphaMaxValue, alpha ); 1246 beta = Clip3( g_RCBetaMinValue, g_RCBetaMaxValue, beta ); 1247 #else 921 1248 alpha = Clip3( 0.05, 20.0, alpha ); 922 1249 beta = Clip3( -3.0, -0.1, beta ); 1250 #endif 1251 #if RATE_CONTROL_INTRA 1252 } 1253 #endif 923 1254 924 1255 TRCParameter rcPara; … … 927 1258 928 1259 m_encRCSeq->setPicPara( m_frameLevel, rcPara ); 929 } 1260 1261 #if M0036_RC_IMPROVEMENT 1262 if ( m_frameLevel == 1 ) 1263 { 1264 Double currLambda = Clip3( 0.1, 10000.0, m_picLambda ); 1265 Double updateLastLambda = g_RCWeightHistoryLambda * m_encRCSeq->getLastLambda() + g_RCWeightCurrentLambda * currLambda; 1266 m_encRCSeq->setLastLambda( updateLastLambda ); 1267 } 1268 #endif 1269 } 1270 1271 #if RATE_CONTROL_INTRA 1272 Int TEncRCPic::getRefineBitsForIntra( Int orgBits ) 1273 { 1274 Double alpha=0.25, beta=0.5582; 1275 Int iIntraBits; 1276 1277 if (orgBits*40 < m_numberOfPixel) 1278 { 1279 alpha=0.25; 1280 } 1281 else 1282 { 1283 alpha=0.30; 1284 } 1285 1286 iIntraBits = (Int)(alpha* pow(m_totalCostIntra*4.0/(Double)orgBits, beta)*(Double)orgBits+0.5); 1287 1288 return iIntraBits; 1289 } 1290 1291 Double TEncRCPic::calculateLambdaIntra(double alpha, double beta, double MADPerPixel, double bitsPerPixel) 1292 { 1293 return ( (alpha/256.0) * pow( MADPerPixel/bitsPerPixel, beta ) ); 1294 } 1295 1296 Void TEncRCPic::updateAlphaBetaIntra(double *alpha, double *beta) 1297 { 1298 Double lnbpp = log(pow(m_totalCostIntra / (Double)m_numberOfPixel, BETA1)); 1299 Double diffLambda = (*beta)*(log((Double)m_picActualBits)-log((Double)m_targetBits)); 1300 1301 diffLambda = Clip3(-0.125, 0.125, 0.25*diffLambda); 1302 *alpha = (*alpha) * exp(diffLambda); 1303 *beta = (*beta) + diffLambda / lnbpp; 1304 } 1305 1306 1307 Void TEncRCPic::getLCUInitTargetBits() 1308 { 1309 Int iAvgBits = 0; 1310 1311 m_remainingCostIntra = m_totalCostIntra; 1312 for (Int i=m_numberOfLCU-1; i>=0; i--) 1313 { 1314 iAvgBits += Int(m_targetBits * getLCU(i).m_costIntra/m_totalCostIntra); 1315 getLCU(i).m_targetBitsLeft = iAvgBits; 1316 } 1317 } 1318 1319 1320 Double TEncRCPic::getLCUEstLambdaAndQP(Double bpp, Int clipPicQP, Int *estQP) 1321 { 1322 Int LCUIdx = getLCUCoded(); 1323 1324 Double alpha = m_encRCSeq->getPicPara( m_frameLevel ).m_alpha; 1325 Double beta = m_encRCSeq->getPicPara( m_frameLevel ).m_beta; 1326 1327 Double costPerPixel = getLCU(LCUIdx).m_costIntra/(Double)getLCU(LCUIdx).m_numberOfPixel; 1328 costPerPixel = pow(costPerPixel, BETA1); 1329 Double estLambda = calculateLambdaIntra(alpha, beta, costPerPixel, bpp); 1330 1331 Int clipNeighbourQP = g_RCInvalidQPValue; 1332 for (int i=LCUIdx-1; i>=0; i--) 1333 { 1334 if ((getLCU(i)).m_QP > g_RCInvalidQPValue) 1335 { 1336 clipNeighbourQP = getLCU(i).m_QP; 1337 break; 1338 } 1339 } 1340 1341 Int minQP = clipPicQP - 2; 1342 Int maxQP = clipPicQP + 2; 1343 1344 if ( clipNeighbourQP > g_RCInvalidQPValue ) 1345 { 1346 maxQP = min(clipNeighbourQP + 1, maxQP); 1347 minQP = max(clipNeighbourQP - 1, minQP); 1348 } 1349 1350 Double maxLambda=exp(((Double)(maxQP+0.49)-13.7122)/4.2005); 1351 Double minLambda=exp(((Double)(minQP-0.49)-13.7122)/4.2005); 1352 1353 estLambda = Clip3(minLambda, maxLambda, estLambda); 1354 1355 *estQP = Int( 4.2005 * log(estLambda) + 13.7122 + 0.5 ); 1356 *estQP = Clip3(minQP, maxQP, *estQP); 1357 1358 return estLambda; 1359 } 1360 #endif 930 1361 931 1362 TEncRateCtrl::TEncRateCtrl() … … 961 1392 } 962 1393 1394 #if M0036_RC_IMPROVEMENT 1395 Void TEncRateCtrl::init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int keepHierBits, Bool useLCUSeparateModel, GOPEntry GOPList[MAX_GOP] ) 1396 #else 963 1397 Void TEncRateCtrl::init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Bool keepHierBits, Bool useLCUSeparateModel, GOPEntry GOPList[MAX_GOP] ) 1398 #endif 964 1399 { 965 1400 destroy(); … … 976 1411 977 1412 Int numberOfLevel = 1; 1413 #if M0036_RC_IMPROVEMENT 1414 Int adaptiveBit = 0; 1415 if ( keepHierBits > 0 ) 1416 #else 978 1417 if ( keepHierBits ) 1418 #endif 979 1419 { 980 1420 numberOfLevel = Int( log((Double)GOPSize)/log(2.0) + 0.5 ) + 1; … … 998 1438 } 999 1439 } 1440 1441 #if M0036_RC_IMPROVEMENT 1442 if ( keepHierBits > 0 ) 1443 #else 1000 1444 if ( keepHierBits ) 1445 #endif 1001 1446 { 1002 1447 Double bpp = (Double)( targetBitrate / (Double)( frameRate*picWidth*picHeight ) ); … … 1031 1476 bitsRatio[3] = 14; 1032 1477 } 1478 #if M0036_RC_IMPROVEMENT 1479 if ( keepHierBits == 2 ) 1480 { 1481 adaptiveBit = 1; 1482 } 1483 #endif 1033 1484 } 1034 1485 else if ( GOPSize == 8 && !isLowdelay ) … … 1078 1529 bitsRatio[7] = 1; 1079 1530 } 1531 #if M0036_RC_IMPROVEMENT 1532 if ( keepHierBits == 2 ) 1533 { 1534 adaptiveBit = 2; 1535 } 1536 #endif 1080 1537 } 1081 1538 else 1082 1539 { 1540 #if M0036_RC_IMPROVEMENT 1541 printf( "\n hierarchical bit allocation is not support for the specified coding structure currently.\n" ); 1542 #else 1083 1543 printf( "\n hierarchical bit allocation is not support for the specified coding structure currently." ); 1544 #endif 1084 1545 } 1085 1546 } … … 1094 1555 } 1095 1556 } 1557 #if M0036_RC_IMPROVEMENT 1558 if ( keepHierBits > 0 ) 1559 #else 1096 1560 if ( keepHierBits ) 1561 #endif 1097 1562 { 1098 1563 if ( GOPSize == 4 && isLowdelay ) … … 1129 1594 1130 1595 m_encRCSeq = new TEncRCSeq; 1596 #if M0036_RC_IMPROVEMENT 1597 m_encRCSeq->create( totalFrames, targetBitrate, frameRate, GOPSize, picWidth, picHeight, LCUWidth, LCUHeight, numberOfLevel, useLCUSeparateModel, adaptiveBit ); 1598 #else 1131 1599 m_encRCSeq->create( totalFrames, targetBitrate, frameRate, GOPSize, picWidth, picHeight, LCUWidth, LCUHeight, numberOfLevel, useLCUSeparateModel ); 1600 #endif 1132 1601 m_encRCSeq->initBitsRatio( bitsRatio ); 1133 1602 m_encRCSeq->initGOPID2Level( GOPID2Level ); -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncRateCtrl.h
r324 r537 65 65 const Double g_RCWeightPicTargetBitInGOP = 0.9; 66 66 const Double g_RCWeightPicRargetBitInBuffer = 1.0 - g_RCWeightPicTargetBitInGOP; 67 #if M0036_RC_IMPROVEMENT 68 const Int g_RCIterationNum = 20; 69 const Double g_RCWeightHistoryLambda = 0.5; 70 const Double g_RCWeightCurrentLambda = 1.0 - g_RCWeightHistoryLambda; 71 const Int g_RCLCUSmoothWindowSize = 4; 72 const Double g_RCAlphaMinValue = 0.05; 73 const Double g_RCAlphaMaxValue = 500.0; 74 const Double g_RCBetaMinValue = -3.0; 75 const Double g_RCBetaMaxValue = -0.1; 76 #endif 77 78 #if RATE_CONTROL_INTRA 79 #define ALPHA 6.7542; 80 #define BETA1 1.2517 81 #define BETA2 1.7860 82 #endif 67 83 68 84 struct TRCLCU … … 72 88 Int m_targetBits; 73 89 Double m_lambda; 90 #if M0036_RC_IMPROVEMENT 91 Double m_bitWeight; 92 #else 74 93 Double m_MAD; 94 #endif 75 95 Int m_numberOfPixel; 96 #if RATE_CONTROL_INTRA 97 Double m_costIntra; 98 Int m_targetBitsLeft; 99 #endif 76 100 }; 77 101 … … 89 113 90 114 public: 115 #if M0036_RC_IMPROVEMENT 116 Void create( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int numberOfLevel, Bool useLCUSeparateModel, Int adaptiveBit ); 117 #else 91 118 Void create( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int numberOfLevel, Bool useLCUSeparateModel ); 119 #endif 92 120 Void destroy(); 93 121 Void initBitsRatio( Int bitsRatio[] ); … … 96 124 Void initLCUPara( TRCParameter** LCUPara = NULL ); // NULL to initial with default value 97 125 Void updateAfterPic ( Int bits ); 126 #if !RATE_CONTROL_INTRA 98 127 Int getRefineBitsForIntra( Int orgBits ); 128 #endif 129 #if M0036_RC_IMPROVEMENT 130 Void setAllBitRatio( Double basicLambda, Double* equaCoeffA, Double* equaCoeffB ); 131 #endif 99 132 100 133 public: … … 134 167 Double getBetaUpdate() { return m_betaUpdate; } 135 168 169 #if M0036_RC_IMPROVEMENT 170 Int getAdaptiveBits() { return m_adaptiveBit; } 171 Double getLastLambda() { return m_lastLambda; } 172 Void setLastLambda( Double lamdba ) { m_lastLambda = lamdba; } 173 #endif 174 136 175 private: 137 176 Int m_totalFrames; … … 160 199 Double m_betaUpdate; 161 200 Bool m_useLCUSeparateModel; 201 202 #if M0036_RC_IMPROVEMENT 203 Int m_adaptiveBit; 204 Double m_lastLambda; 205 #endif 162 206 }; 163 207 … … 175 219 private: 176 220 Int xEstGOPTargetBits( TEncRCSeq* encRCSeq, Int GOPSize ); 221 #if M0036_RC_IMPROVEMENT 222 Void xCalEquaCoeff( TEncRCSeq* encRCSeq, Double* lambdaRatio, Double* equaCoeffA, Double* equaCoeffB, Int GOPSize ); 223 Double xSolveEqua( Double targetBpp, Double* equaCoeffA, Double* equaCoeffB, Int GOPSize ); 224 #endif 177 225 178 226 public: … … 203 251 Void destroy(); 204 252 253 #if !RATE_CONTROL_INTRA 205 254 Double estimatePicLambda( list<TEncRCPic*>& listPreviousPictures ); 255 #endif 206 256 Int estimatePicQP ( Double lambda, list<TEncRCPic*>& listPreviousPictures ); 257 #if RATE_CONTROL_INTRA 258 Int getRefineBitsForIntra(Int orgBits); 259 Double calculateLambdaIntra(double alpha, double beta, double MADPerPixel, double bitsPerPixel); 260 Double estimatePicLambda( list<TEncRCPic*>& listPreviousPictures, SliceType eSliceType); 261 262 Void updateAlphaBetaIntra(double *alpha, double *beta); 263 264 Double getLCUTargetBpp(SliceType eSliceType); 265 Double getLCUEstLambdaAndQP(Double bpp, Int clipPicQP, Int *estQP); 266 #else 207 267 Double getLCUTargetBpp(); 268 #endif 208 269 Double getLCUEstLambda( Double bpp ); 209 270 Int getLCUEstQP( Double lambda, Int clipPicQP ); 210 271 211 272 Void updateAfterLCU( Int LCUIdx, Int bits, Int QP, Double lambda, Bool updateLCUParameter = true ); 273 #if M0036_RC_IMPROVEMENT 274 #if RATE_CONTROL_INTRA 275 Void updateAfterPicture( Int actualHeaderBits, Int actualTotalBits, Double averageQP, Double averageLambda, SliceType eSliceType); 276 #else 277 Void updateAfterPicture( Int actualHeaderBits, Int actualTotalBits, Double averageQP, Double averageLambda ); 278 #endif 279 #else 212 280 Void updateAfterPicture( Int actualHeaderBits, Int actualTotalBits, Double averageQP, Double averageLambda, Double effectivePercentage ); 281 #endif 213 282 214 283 Void addToPictureLsit( list<TEncRCPic*>& listPreviousPictures ); 284 #if !M0036_RC_IMPROVEMENT 215 285 Double getEffectivePercentage(); 286 #endif 216 287 Double calAverageQP(); 217 288 Double calAverageLambda(); … … 229 300 Int getNumberOfLCU() { return m_numberOfLCU; } 230 301 Int getTargetBits() { return m_targetBits; } 302 #if !RATE_CONTROL_INTRA 231 303 Void setTargetBits( Int bits ) { m_targetBits = bits; } 304 #endif 232 305 Int getEstHeaderBits() { return m_estHeaderBits; } 233 306 Int getLCULeft() { return m_LCULeft; } … … 239 312 TRCLCU& getLCU( Int LCUIdx ) { return m_LCUs[LCUIdx]; } 240 313 Int getPicActualHeaderBits() { return m_picActualHeaderBits; } 314 #if !M0036_RC_IMPROVEMENT 241 315 Double getTotalMAD() { return m_totalMAD; } 242 316 Void setTotalMAD( Double MAD ) { m_totalMAD = MAD; } 317 #endif 318 #if RATE_CONTROL_INTRA 319 Void setTargetBits( Int bits ) { m_targetBits = bits; m_bitsLeft = bits;} 320 Void setTotalIntraCost(Double cost) { m_totalCostIntra = cost; } 321 Void getLCUInitTargetBits(); 322 #endif 323 243 324 Int getPicActualBits() { return m_picActualBits; } 244 325 Int getPicActualQP() { return m_picQP; } … … 267 348 TRCLCU* m_LCUs; 268 349 Int m_picActualHeaderBits; // only SH and potential APS 350 #if !M0036_RC_IMPROVEMENT 269 351 Double m_totalMAD; 352 #endif 353 #if RATE_CONTROL_INTRA 354 Double m_totalCostIntra; 355 Double m_remainingCostIntra; 356 #endif 270 357 Int m_picActualBits; // the whole picture, including header 271 358 Int m_picQP; // in integer form 272 359 Double m_picLambda; 360 #if !M0036_RC_IMPROVEMENT 273 361 TEncRCPic* m_lastPicture; 362 #endif 274 363 }; 275 364 … … 281 370 282 371 public: 372 #if M0036_RC_IMPROVEMENT 373 Void init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int keepHierBits, Bool useLCUSeparateModel, GOPEntry GOPList[MAX_GOP] ); 374 #else 283 375 Void init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Bool keepHierBits, Bool useLCUSeparateModel, GOPEntry GOPList[MAX_GOP] ); 376 #endif 284 377 Void destroy(); 285 378 Void initRCPic( Int frameLevel ); -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp
r446 r537 299 299 m_iTypePartBest[iPartIdx] = -1; 300 300 if( m_bUseSBACRD ) 301 { 301 302 m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[pOnePart->PartLevel][CI_TEMP_BEST] ); 303 } 302 304 } 303 305 } -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncSearch.cpp
r532 r537 1067 1067 } 1068 1068 #endif 1069 1070 1069 // save prediction 1071 1070 if(default0Save1Load2 == 1) … … 1427 1426 #if H_3D_DIM_ENC 1428 1427 , Bool zeroResi 1429 #endif 1430 1428 #endif 1429 ) 1431 1430 { 1432 1431 UInt uiFullDepth = pcCU->getDepth( 0 ) + uiTrDepth; … … 1436 1435 1437 1436 #if HHI_RQT_INTRA_SPEEDUP 1438 #if L0232_RD_PENALTY1439 1437 Int maxTuSize = pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize(); 1440 1438 Int isIntraSlice = (pcCU->getSlice()->getSliceType() == I_SLICE); … … 1453 1451 } 1454 1452 if( bCheckFirst && noSplitIntraMaxTuSize ) 1453 { 1454 bCheckSplit = false; 1455 } 1455 1456 #else 1456 if( bCheckFirst && bCheckFull )1457 #endif1458 {1459 bCheckSplit = false;1460 }1461 #else1462 #if L0232_RD_PENALTY1463 1457 Int maxTuSize = pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize(); 1464 1458 Int isIntraSlice = (pcCU->getSlice()->getSliceType() == I_SLICE); … … 1469 1463 } 1470 1464 #endif 1471 #endif1472 1465 #if H_3D_DIM 1473 1466 if( isDimMode( pcCU->getLumaIntraDir( uiAbsPartIdx ) ) ) … … 1476 1469 } 1477 1470 #endif 1478 1479 1471 Double dSingleCost = MAX_DOUBLE; 1480 1472 #if H_3D_VSO … … 1667 1659 //----- determine rate and r-d cost ----- 1668 1660 UInt uiSingleBits = xGetIntraBitsQT( pcCU, uiTrDepth, uiAbsPartIdx, true, !bLumaOnly, false ); 1669 #if L0232_RD_PENALTY1670 1661 if(m_pcEncCfg->getRDpenalty() && (uiLog2TrSize==5) && !isIntraSlice) 1671 1662 { 1672 1663 uiSingleBits=uiSingleBits*4; 1673 1664 } 1674 #endif1675 1665 #if H_3D_VSO // M40 1676 1666 if ( m_pcRdCost->getUseLambdaScaleVSO()) … … 1823 1813 } 1824 1814 } 1825 1826 1815 #if H_3D_VSO // M42 1827 1816 if ( m_pcRdCost->getUseRenModel() && bCheckFull ) … … 1836 1825 } 1837 1826 #endif 1838 1839 1827 ruiDistY += uiSingleDistY; 1840 1828 ruiDistC += uiSingleDistC; … … 2788 2776 2789 2777 UInt iModeBits = xModeBitsIntra( pcCU, uiMode, uiPU, uiPartOffset, uiDepth, uiInitTrDepth ); 2790 2791 2792 2778 #if H_3D_VSO // M35 2793 2779 #if H_3D_VSO_FIX // This fix should be enabled after verification … … 2924 2910 } 2925 2911 #endif 2926 2927 2912 //===== check modes (using r-d costs) ===== 2928 2913 #if HHI_RQT_INTRA_SPEEDUP_MOD … … 3112 3097 UInt uiPUDistC = 0; 3113 3098 Double dPUCost = 0.0; 3114 3115 3099 #if H_3D_VSO // M37 3116 3100 // reset Model … … 3164 3148 { 3165 3149 #endif 3166 3167 //--- update transform index and cbf --- 3150 //--- update transform index and cbf --- 3168 3151 UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 ); 3169 3152 ::memcpy( pcCU->getTransformIdx() + uiPartOffset, m_puhQTTempTrIdx, uiQPartNum * sizeof( UChar ) ); … … 3764 3747 UInt uiBitsTempL0[MAX_NUM_REF]; 3765 3748 3766 #if L0034_COMBINED_LIST_CLEANUP3767 3749 TComMv mvValidList1; 3768 3750 Int refIdxValidList1 = 0; 3769 3751 UInt bitsValidList1 = MAX_UINT; 3770 3752 UInt costValidList1 = MAX_UINT; 3771 #endif3772 3753 3773 3754 xGetBlkBits( ePartSize, pcCU->getSlice()->isInterP(), iPartIdx, uiLastMode, uiMbBits); … … 3821 3802 uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdx[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS]; 3822 3803 #if ZERO_MVD_EST 3823 #if L0034_COMBINED_LIST_CLEANUP3824 3804 if ( iRefList == 0 || pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) < 0 ) 3825 #else3826 if ((iRefList != 1 || !pcCU->getSlice()->getNoBackPredFlag()) &&3827 (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) <= 0 || pcCU->getSlice()->getRefIdxOfLC(eRefPicList, iRefIdxTemp)>=0))3828 #endif3829 3805 { 3830 3806 uiZeroMvdBitsTemp = uiBitsTemp; … … 3846 3822 3847 3823 #if GPB_SIMPLE_UNI 3848 #if L0034_COMBINED_LIST_CLEANUP3849 3824 if ( iRefList == 1 ) // list 1 3850 3825 { … … 3871 3846 } 3872 3847 #else 3873 if ( pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0)3874 {3875 if ( iRefList && ( pcCU->getSlice()->getNoBackPredFlag() || (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && !pcCU->getSlice()->getNoBackPredFlag() && pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(iRefIdxTemp)>=0 ) ) )3876 {3877 if ( pcCU->getSlice()->getNoBackPredFlag() )3878 {3879 cMvTemp[1][iRefIdxTemp] = cMvTemp[0][iRefIdxTemp];3880 uiCostTemp = uiCostTempL0[iRefIdxTemp];3881 /*first subtract the bit-rate part of the cost of the other list*/3882 uiCostTemp -= m_pcRdCost->getCost( uiBitsTempL0[iRefIdxTemp] );3883 }3884 else3885 {3886 cMvTemp[1][iRefIdxTemp] = cMvTemp[0][pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(iRefIdxTemp)];3887 uiCostTemp = uiCostTempL0[pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(iRefIdxTemp)];3888 /*first subtract the bit-rate part of the cost of the other list*/3889 uiCostTemp -= m_pcRdCost->getCost( uiBitsTempL0[pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(iRefIdxTemp)] );3890 }3891 /*correct the bit-rate part of the current ref*/3892 m_pcRdCost->setPredictor ( cMvPred[iRefList][iRefIdxTemp] );3893 uiBitsTemp += m_pcRdCost->getBits( cMvTemp[1][iRefIdxTemp].getHor(), cMvTemp[1][iRefIdxTemp].getVer() );3894 /*calculate the correct cost*/3895 uiCostTemp += m_pcRdCost->getCost( uiBitsTemp );3896 }3897 else3898 {3899 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp );3900 }3901 }3902 else3903 {3904 if (iRefList && pcCU->getSlice()->getNoBackPredFlag())3905 {3906 uiCostTemp = MAX_UINT;3907 cMvTemp[1][iRefIdxTemp] = cMvTemp[0][iRefIdxTemp];3908 }3909 else3910 {3911 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp );3912 }3913 }3914 #endif3915 #else3916 3848 xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); 3917 3849 #endif … … 3919 3851 xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp); 3920 3852 3921 #if L0034_COMBINED_LIST_CLEANUP3922 3853 if ( iRefList == 0 ) 3923 3854 { … … 3944 3875 refIdxValidList1 = iRefIdxTemp; 3945 3876 } 3946 #else3947 if(pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && !pcCU->getSlice()->getNoBackPredFlag())3948 {3949 if(iRefList==REF_PIC_LIST_0)3950 {3951 uiCostTempL0[iRefIdxTemp] = uiCostTemp;3952 uiBitsTempL0[iRefIdxTemp] = uiBitsTemp;3953 if(pcCU->getSlice()->getRefIdxOfLC(REF_PIC_LIST_0, iRefIdxTemp)<0)3954 {3955 uiCostTemp = MAX_UINT;3956 }3957 }3958 else3959 {3960 if(pcCU->getSlice()->getRefIdxOfLC(REF_PIC_LIST_1, iRefIdxTemp)<0)3961 {3962 uiCostTemp = MAX_UINT;3963 }3964 }3965 }3966 3967 if ( ( iRefList == 0 && uiCostTemp < uiCost[iRefList] ) ||3968 ( iRefList == 1 && pcCU->getSlice()->getNoBackPredFlag() && iRefIdxTemp == iRefIdx[0] ) ||3969 ( iRefList == 1 && (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0) && (iRefIdxTemp==0 || iRefIdxTemp == iRefIdx[0]) && !pcCU->getSlice()->getNoBackPredFlag() && (iRefIdxTemp == pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(iRefIdxTemp)) ) ||3970 ( iRefList == 1 && !pcCU->getSlice()->getNoBackPredFlag() && uiCostTemp < uiCost[iRefList] ) )3971 {3972 uiCost[iRefList] = uiCostTemp;3973 uiBits[iRefList] = uiBitsTemp; // storing for bi-prediction3974 3975 // set motion3976 cMv[iRefList] = cMvTemp[iRefList][iRefIdxTemp];3977 iRefIdx[iRefList] = iRefIdxTemp;3978 pcCU->getCUMvField(eRefPicList)->setAllMv( cMv[iRefList], ePartSize, uiPartAddr, 0, iPartIdx );3979 pcCU->getCUMvField(eRefPicList)->setAllRefIdx( iRefIdx[iRefList], ePartSize, uiPartAddr, 0, iPartIdx );3980 3981 if(!pcCU->getSlice()->getMvdL1ZeroFlag())3982 {3983 // storing list 1 prediction signal for iterative bi-directional prediction3984 if ( eRefPicList == REF_PIC_LIST_1 )3985 {3986 TComYuv* pcYuvPred = &m_acYuvPred[iRefList];3987 motionCompensation ( pcCU, pcYuvPred, eRefPicList, iPartIdx );3988 }3989 if ( (pcCU->getSlice()->getNoBackPredFlag() || (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(0)==0 )) && eRefPicList == REF_PIC_LIST_0 )3990 {3991 TComYuv* pcYuvPred = &m_acYuvPred[iRefList];3992 motionCompensation ( pcCU, pcYuvPred, eRefPicList, iPartIdx );3993 }3994 }3995 }3996 #endif3997 3877 } 3998 3878 } … … 4058 3938 4059 3939 Int iRefList = iIter % 2; 4060 #if L0034_COMBINED_LIST_CLEANUP4061 3940 if ( m_pcEncCfg->getUseFastEnc() ) 4062 3941 { … … 4081 3960 motionCompensation ( pcCU, pcYuvPred, RefPicList(1-iRefList), iPartIdx ); 4082 3961 } 4083 #else4084 if ( m_pcEncCfg->getUseFastEnc() && (pcCU->getSlice()->getNoBackPredFlag() || (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(0)==0 )) )4085 {4086 iRefList = 1;4087 }4088 #endif4089 3962 RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); 4090 3963 … … 4221 4094 UInt uiMEBits = 0; 4222 4095 // Set Motion Field_ 4223 #if L0034_COMBINED_LIST_CLEANUP4224 4096 cMv[1] = mvValidList1; 4225 4097 iRefIdx[1] = refIdxValidList1; 4226 4098 uiBits[1] = bitsValidList1; 4227 4099 uiCost[1] = costValidList1; 4228 #else4229 if ( pcCU->getSlice()->getNoBackPredFlag() || (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(0)==0 ) )4230 {4231 uiCost[1] = MAX_UINT;4232 }4233 #endif4234 4100 #if AMP_MRG 4235 4101 if (bTestNormalMC) -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncSlice.cpp
r521 r537 475 475 #endif 476 476 477 #if L0386_DB_METRIC478 477 if ( m_pcCfg->getDeblockingFilterMetric() ) 479 478 { … … 483 482 rpcSlice->setDeblockingFilterTcOffsetDiv2( 0 ); 484 483 } else 485 #endif486 484 if (rpcSlice->getPPS()->getDeblockingFilterControlPresentFlag()) 487 485 { … … 560 558 // store lambda 561 559 slice->setSliceQp( sliceQP ); 562 #if L0033_RC_BUGFIX563 560 slice->setSliceQpBase ( sliceQP ); 564 #endif565 561 m_pcRdCost ->setLambda( lambda ); 566 562 #if WEIGHTED_CHROMA_DISTORTION … … 876 872 /** \param rpcPic picture class 877 873 */ 874 #if RATE_CONTROL_INTRA 875 Void TEncSlice::calCostSliceI(TComPic*& rpcPic) 876 { 877 UInt uiCUAddr; 878 UInt uiStartCUAddr; 879 UInt uiBoundingCUAddr; 880 Int iSumHad, shift = g_bitDepthY-8, offset = (shift>0)?(1<<(shift-1)):0;; 881 Double iSumHadSlice = 0; 882 883 rpcPic->getSlice(getSliceIdx())->setSliceSegmentBits(0); 884 TComSlice* pcSlice = rpcPic->getSlice(getSliceIdx()); 885 xDetermineStartAndBoundingCUAddr ( uiStartCUAddr, uiBoundingCUAddr, rpcPic, false ); 886 887 UInt uiEncCUOrder; 888 uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 889 for( uiEncCUOrder = uiStartCUAddr/rpcPic->getNumPartInCU(); 890 uiEncCUOrder < (uiBoundingCUAddr+(rpcPic->getNumPartInCU()-1))/rpcPic->getNumPartInCU(); 891 uiCUAddr = rpcPic->getPicSym()->getCUOrderMap(++uiEncCUOrder) ) 892 { 893 // initialize CU encoder 894 TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr ); 895 pcCU->initCU( rpcPic, uiCUAddr ); 896 897 Int height = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getSPS()->getPicHeightInLumaSamples() - uiCUAddr / rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUHeight() ); 898 Int width = min( pcSlice->getSPS()->getMaxCUWidth(),pcSlice->getSPS()->getPicWidthInLumaSamples() - uiCUAddr % rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUWidth() ); 899 900 iSumHad = m_pcCuEncoder->updateLCUDataISlice(pcCU, uiCUAddr, width, height); 901 902 (m_pcRateCtrl->getRCPic()->getLCU(uiCUAddr)).m_costIntra=(iSumHad+offset)>>shift; 903 iSumHadSlice += (m_pcRateCtrl->getRCPic()->getLCU(uiCUAddr)).m_costIntra; 904 905 } 906 m_pcRateCtrl->getRCPic()->setTotalIntraCost(iSumHadSlice); 907 } 908 #endif 909 878 910 Void TEncSlice::compressSlice( TComPic*& rpcPic ) 879 911 { … … 1161 1193 Double bpp = -1.0; 1162 1194 1195 #if M0036_RC_IMPROVEMENT 1196 if ( ( rpcPic->getSlice( 0 )->getSliceType() == I_SLICE && m_pcCfg->getForceIntraQP() ) || !m_pcCfg->getLCULevelRC() ) 1197 #else 1163 1198 if ( rpcPic->getSlice( 0 )->getSliceType() == I_SLICE || !m_pcCfg->getLCULevelRC() ) 1199 #endif 1164 1200 { 1165 1201 estQP = pcSlice->getSliceQp(); … … 1167 1203 else 1168 1204 { 1205 #if RATE_CONTROL_INTRA 1206 bpp = m_pcRateCtrl->getRCPic()->getLCUTargetBpp(pcSlice->getSliceType()); 1207 if ( rpcPic->getSlice( 0 )->getSliceType() == I_SLICE) 1208 { 1209 estLambda = m_pcRateCtrl->getRCPic()->getLCUEstLambdaAndQP(bpp, pcSlice->getSliceQp(), &estQP); 1210 } 1211 else 1212 { 1213 estLambda = m_pcRateCtrl->getRCPic()->getLCUEstLambda( bpp ); 1214 estQP = m_pcRateCtrl->getRCPic()->getLCUEstQP ( estLambda, pcSlice->getSliceQp() ); 1215 } 1216 #else 1169 1217 bpp = m_pcRateCtrl->getRCPic()->getLCUTargetBpp(); 1170 1218 estLambda = m_pcRateCtrl->getRCPic()->getLCUEstLambda( bpp ); 1171 1219 estQP = m_pcRateCtrl->getRCPic()->getLCUEstQP ( estLambda, pcSlice->getSliceQp() ); 1220 #endif 1221 1172 1222 estQP = Clip3( -pcSlice->getSPS()->getQpBDOffsetY(), MAX_QP, estQP ); 1173 1223 1174 1224 m_pcRdCost->setLambda(estLambda); 1225 #if M0036_RC_IMPROVEMENT 1226 #if RDOQ_CHROMA_LAMBDA 1227 // set lambda for RDOQ 1228 Double weight=m_pcRdCost->getChromaWeight(); 1229 m_pcTrQuant->setLambda( estLambda, estLambda / weight ); 1230 #else 1231 m_pcTrQuant->setLambda( estLambda ); 1232 #endif 1233 #endif 1175 1234 } 1176 1235 1177 1236 m_pcRateCtrl->setRCQP( estQP ); 1178 #if L0033_RC_BUGFIX1179 1237 pcCU->getSlice()->setSliceQpBase( estQP ); 1180 #endif1181 1238 } 1182 1239 #endif … … 1185 1242 m_pcCuEncoder->compressCU( pcCU ); 1186 1243 1244 #if !TICKET_1090_FIX 1187 1245 #if RATE_CONTROL_LAMBDA_DOMAIN 1188 1246 if ( m_pcCfg->getUseRateCtrl() ) 1189 1247 { 1248 #if !M0036_RC_IMPROVEMENT 1190 1249 UInt SAD = m_pcCuEncoder->getLCUPredictionSAD(); 1191 1250 Int height = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getSPS()->getPicHeightInLumaSamples() - uiCUAddr / rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUHeight() ); … … 1194 1253 MAD = MAD * MAD; 1195 1254 ( m_pcRateCtrl->getRCPic()->getLCU(uiCUAddr) ).m_MAD = MAD; 1255 #endif 1196 1256 1197 1257 Int actualQP = g_RCInvalidQPValue; … … 1217 1277 } 1218 1278 m_pcRdCost->setLambda(oldLambda); 1219 1279 #if RATE_CONTROL_INTRA 1280 m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 1281 pcCU->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() ); 1282 #else 1220 1283 m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, m_pcCfg->getLCULevelRC() ); 1221 } 1284 #endif 1285 } 1286 #endif 1222 1287 #endif 1223 1288 … … 1253 1318 } 1254 1319 } 1320 1321 #if TICKET_1090_FIX 1322 #if RATE_CONTROL_LAMBDA_DOMAIN 1323 if ( m_pcCfg->getUseRateCtrl() ) 1324 { 1325 #if !M0036_RC_IMPROVEMENT 1326 UInt SAD = m_pcCuEncoder->getLCUPredictionSAD(); 1327 Int height = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getSPS()->getPicHeightInLumaSamples() - uiCUAddr / rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUHeight() ); 1328 Int width = min( pcSlice->getSPS()->getMaxCUWidth(),pcSlice->getSPS()->getPicWidthInLumaSamples() - uiCUAddr % rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUWidth() ); 1329 Double MAD = (Double)SAD / (Double)(height * width); 1330 MAD = MAD * MAD; 1331 ( m_pcRateCtrl->getRCPic()->getLCU(uiCUAddr) ).m_MAD = MAD; 1332 #endif 1333 1334 Int actualQP = g_RCInvalidQPValue; 1335 Double actualLambda = m_pcRdCost->getLambda(); 1336 Int actualBits = pcCU->getTotalBits(); 1337 Int numberOfEffectivePixels = 0; 1338 for ( Int idx = 0; idx < rpcPic->getNumPartInCU(); idx++ ) 1339 { 1340 if ( pcCU->getPredictionMode( idx ) != MODE_NONE && ( !pcCU->isSkipped( idx ) ) ) 1341 { 1342 numberOfEffectivePixels = numberOfEffectivePixels + 16; 1343 break; 1344 } 1345 } 1346 1347 if ( numberOfEffectivePixels == 0 ) 1348 { 1349 actualQP = g_RCInvalidQPValue; 1350 } 1351 else 1352 { 1353 actualQP = pcCU->getQP( 0 ); 1354 } 1355 m_pcRdCost->setLambda(oldLambda); 1356 1357 #if RATE_CONTROL_INTRA 1358 m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 1359 pcCU->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() ); 1360 #else 1361 m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, m_pcCfg->getLCULevelRC() ); 1362 #endif 1363 } 1364 #endif 1365 #endif 1255 1366 } 1256 1367 // other case: encodeCU is not called -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncSlice.h
r481 r537 131 131 Void precompressSlice ( TComPic*& rpcPic ); ///< precompress slice for multi-loop opt. 132 132 Void compressSlice ( TComPic*& rpcPic ); ///< analysis stage of slice 133 #if RATE_CONTROL_INTRA 134 Void calCostSliceI ( TComPic*& rpcPic ); 135 #endif 133 136 Void encodeSlice ( TComPic*& rpcPic, TComOutputBitstream* pcSubstreams ); 134 137 -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncTop.cpp
r534 r537 293 293 // This seems to be incorrect, but irrelevant for the MV-HEVC 294 294 *(m_cVPS->getPTL()) = *m_cSPS.getPTL(); 295 #if L0043_TIMING_INFO296 295 m_cVPS->getTimingInfo()->setTimingInfoPresentFlag ( false ); 297 #endif298 296 #else 299 297 *m_cVPS.getPTL() = *m_cSPS.getPTL(); 300 301 #if L0043_TIMING_INFO302 298 m_cVPS.getTimingInfo()->setTimingInfoPresentFlag ( false ); 303 #endif304 299 #endif 305 300 // initialize PPS … … 532 527 profileTierLevel.setProfileIdc(m_profile); 533 528 profileTierLevel.setProfileCompatibilityFlag(m_profile, 1); 534 #if L0046_CONSTRAINT_FLAGS535 529 profileTierLevel.setProgressiveSourceFlag(m_progressiveSourceFlag); 536 530 profileTierLevel.setInterlacedSourceFlag(m_interlacedSourceFlag); 537 531 profileTierLevel.setNonPackedConstraintFlag(m_nonPackedConstraintFlag); 538 532 profileTierLevel.setFrameOnlyConstraintFlag(m_frameOnlyConstraintFlag); 539 #endif540 533 541 534 if (m_profile == Profile::MAIN10 && g_bitDepthY == 8 && g_bitDepthC == 8) … … 584 577 585 578 m_cSPS.setMaxTrSize ( 1 << m_uiQuadtreeTULog2MaxSize ); 586 #if !L0034_COMBINED_LIST_CLEANUP587 m_cSPS.setUseLComb ( m_bUseLComb );588 #endif589 579 590 580 Int i; … … 651 641 pcVUI->setFieldSeqFlag(false); 652 642 pcVUI->setHrdParametersPresentFlag(false); 653 #if L0043_TIMING_INFO654 643 pcVUI->getTimingInfo()->setPocProportionalToTimingFlag(getPocProportionalToTimingFlag()); 655 644 pcVUI->getTimingInfo()->setNumTicksPocDiffOneMinus1 (getNumTicksPocDiffOneMinus1() ); 656 #else657 pcVUI->setPocProportionalToTimingFlag(getPocProportionalToTimingFlag());658 pcVUI->setNumTicksPocDiffOneMinus1 (getNumTicksPocDiffOneMinus1() );659 #endif660 645 pcVUI->setBitstreamRestrictionFlag(getBitstreamRestrictionFlag()); 661 646 pcVUI->setTilesFixedStructureFlag(getTilesFixedStructureFlag()); … … 790 775 } 791 776 } 792 #if L0323_LIMIT_DEFAULT_LIST_SIZE793 777 assert(bestPos <= 15); 794 #endif795 778 m_cPPS.setNumRefIdxL0DefaultActive(bestPos); 796 779 m_cPPS.setNumRefIdxL1DefaultActive(bestPos); … … 1047 1030 } 1048 1031 1049 #if L0208_SOP_DESCRIPTION_SEI1050 1032 Int TEncTop::getReferencePictureSetIdxForSOP(TComSlice* slice, Int POCCurr, Int GOPid ) 1051 1033 { … … 1077 1059 return rpsIdx; 1078 1060 } 1079 #endif1080 1061 1081 1062 Void TEncTop::xInitPPSforTiles() -
branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncTop.h
r479 r537 188 188 TComPPS* getPPS () { return &m_cPPS; } 189 189 Void selectReferencePictureSet(TComSlice* slice, Int POCCurr, Int GOPid ); 190 #if L0208_SOP_DESCRIPTION_SEI191 190 Int getReferencePictureSetIdxForSOP(TComSlice* slice, Int POCCurr, Int GOPid ); 192 #endif193 191 TComScalingList* getScalingList () { return &m_scalingList; } 194 192 #if H_MV
Note: See TracChangeset for help on using the changeset viewer.