Changeset 1072 in 3DVCSoftware for branches/HTM-12.1-MV-draft-1/source/Lib/TLibEncoder/TEncSbac.cpp
- Timestamp:
- 13 Oct 2014, 16:44:51 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-12.1-MV-draft-1/source/Lib/TLibEncoder/TEncSbac.cpp
r1066 r1072 58 58 , m_cCUSplitFlagSCModel ( 1, 1, NUM_SPLIT_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels ) 59 59 , m_cCUSkipFlagSCModel ( 1, 1, NUM_SKIP_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 60 #if MTK_SINGLE_DEPTH_MODE_I009561 , m_cCUSingleDepthFlagSCModel ( 1, 1, NUM_SINGLEDEPTH_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)62 , m_cSingleDepthValueSCModel ( 1, 1, NUM_SINGLE_DEPTH_VALUE_DATA_CTX , m_contextModels + m_numContextModels, m_numContextModels)63 #endif64 60 , m_cCUMergeFlagExtSCModel ( 1, 1, NUM_MERGE_FLAG_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels) 65 61 , m_cCUMergeIdxExtSCModel ( 1, 1, NUM_MERGE_IDX_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels) 66 #if H_3D_ARP67 , m_cCUPUARPWSCModel ( 1, 1, NUM_ARPW_CTX , m_contextModels + m_numContextModels, m_numContextModels)68 #endif69 #if H_3D_IC70 , m_cCUICFlagSCModel ( 1, 1, NUM_IC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)71 #endif72 62 , m_cCUPartSizeSCModel ( 1, 1, NUM_PART_SIZE_CTX , m_contextModels + m_numContextModels, m_numContextModels) 73 63 , m_cCUPredModeSCModel ( 1, 1, NUM_PRED_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) … … 92 82 , m_cTransformSkipSCModel ( 1, 2, NUM_TRANSFORMSKIP_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 93 83 , m_CUTransquantBypassFlagSCModel( 1, 1, NUM_CU_TRANSQUANT_BYPASS_FLAG_CTX, m_contextModels + m_numContextModels, m_numContextModels) 94 #if H_3D_DIM95 , m_cDepthIntraModeSCModel ( 1, 1, NUM_DEPTH_INTRA_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels)96 , m_cDdcFlagSCModel ( 1, 1, NUM_DDC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)97 , m_cDdcDataSCModel ( 1, 1, NUM_DDC_DATA_CTX , m_contextModels + m_numContextModels, m_numContextModels)98 , m_cAngleFlagSCModel ( 1, 1, NUM_ANGLE_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)99 #if H_3D_DIM_SDC100 , m_cSDCResidualFlagSCModel ( 1, 1, SDC_NUM_RESIDUAL_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)101 , m_cSDCResidualSCModel ( 1, 1, SDC_NUM_RESIDUAL_CTX , m_contextModels + m_numContextModels, m_numContextModels)102 #endif103 #endif104 #if H_3D_DIM_SDC105 , m_cSDCFlagSCModel ( 1, 1, NUM_SDC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)106 #endif107 #if H_3D_DBBP108 , m_cDBBPFlagSCModel ( 1, 1, DBBP_NUM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)109 #endif110 84 { 111 85 assert( m_numContextModels <= MAX_NUM_CTX_MOD ); … … 134 108 135 109 m_cCUSkipFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SKIP_FLAG ); 136 #if MTK_SINGLE_DEPTH_MODE_I0095137 m_cCUSingleDepthFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SINGLEDEPTH_FLAG );138 m_cSingleDepthValueSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SINGLE_DEPTH_VALUE_DATA );139 #endif140 110 m_cCUMergeFlagExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_FLAG_EXT); 141 111 m_cCUMergeIdxExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_IDX_EXT); 142 #if H_3D_ARP143 m_cCUPUARPWSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ARPW );144 #endif145 #if H_3D_IC146 m_cCUICFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_IC_FLAG );147 #endif148 112 m_cCUPartSizeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_PART_SIZE ); 149 113 m_cCUPredModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_PRED_MODE ); … … 169 133 m_CUTransquantBypassFlagSCModel.initBuffer( eSliceType, iQp, (UChar*)INIT_CU_TRANSQUANT_BYPASS_FLAG ); 170 134 171 #if H_3D_DIM172 m_cDepthIntraModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DEPTH_INTRA_MODE );173 m_cDdcFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DDC_FLAG );174 m_cDdcDataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DDC_DATA );175 m_cAngleFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ANGLE_FLAG );176 #if H_3D_DIM_SDC177 m_cSDCResidualFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL_FLAG );178 m_cSDCResidualSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL );179 #endif180 #endif181 #if H_3D_DIM_SDC182 m_cSDCFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_FLAG );183 #endif184 #if H_3D_DBBP185 m_cDBBPFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DBBP_FLAG );186 #endif187 135 // new structure 188 136 m_uiLastQp = iQp; … … 214 162 curCost = m_cCUSplitFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SPLIT_FLAG ); 215 163 curCost += m_cCUSkipFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SKIP_FLAG ); 216 #if MTK_SINGLE_DEPTH_MODE_I0095217 curCost += m_cCUSingleDepthFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SINGLEDEPTH_FLAG );218 curCost += m_cSingleDepthValueSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SINGLE_DEPTH_VALUE_DATA );219 #endif220 164 curCost += m_cCUMergeFlagExtSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_MERGE_FLAG_EXT); 221 165 curCost += m_cCUMergeIdxExtSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_MERGE_IDX_EXT); 222 #if H_3D_ARP223 curCost += m_cCUPUARPWSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_ARPW );224 #endif225 #if H_3D_IC226 curCost += m_cCUICFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_IC_FLAG );227 #endif228 #if H_3D_DIM_SDC229 curCost += m_cSDCFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SDC_FLAG );230 #endif231 #if H_3D_DBBP232 curCost += m_cDBBPFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_DBBP_FLAG );233 #endif234 166 curCost += m_cCUPartSizeSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_PART_SIZE ); 235 167 curCost += m_cCUPredModeSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_PRED_MODE ); … … 254 186 curCost += m_cTransformSkipSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_TRANSFORMSKIP_FLAG ); 255 187 curCost += m_CUTransquantBypassFlagSCModel.calcCost( curSliceType, qp, (UChar*)INIT_CU_TRANSQUANT_BYPASS_FLAG ); 256 #if H_3D_DIM257 #if SEPARATE_FLAG_I0085258 if( m_pcSlice->getVpsDepthModesFlag() || m_pcSlice->getIVPFlag() )259 #else260 if( m_pcSlice->getVpsDepthModesFlag() )261 #endif262 {263 curCost += m_cDepthIntraModeSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_DEPTH_INTRA_MODE );264 curCost += m_cDdcFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_DDC_FLAG );265 curCost += m_cDdcDataSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_DDC_DATA );266 curCost += m_cAngleFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_ANGLE_FLAG );267 }268 #endif269 188 if (curCost < bestCost) 270 189 { … … 291 210 292 211 m_cCUSkipFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SKIP_FLAG ); 293 #if MTK_SINGLE_DEPTH_MODE_I0095294 m_cCUSingleDepthFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SINGLEDEPTH_FLAG );295 m_cSingleDepthValueSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SINGLE_DEPTH_VALUE_DATA );296 #endif297 212 m_cCUMergeFlagExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_FLAG_EXT); 298 213 m_cCUMergeIdxExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_IDX_EXT); 299 #if H_3D_ARP300 m_cCUPUARPWSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ARPW );301 #endif302 #if H_3D_IC303 m_cCUICFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_IC_FLAG );304 #endif305 214 m_cCUPartSizeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_PART_SIZE ); 306 215 m_cCUPredModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_PRED_MODE ); … … 325 234 m_cTransformSkipSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_TRANSFORMSKIP_FLAG ); 326 235 m_CUTransquantBypassFlagSCModel.initBuffer( eSliceType, iQp, (UChar*)INIT_CU_TRANSQUANT_BYPASS_FLAG ); 327 #if H_3D_DIM328 m_cDepthIntraModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DEPTH_INTRA_MODE );329 m_cDdcFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DDC_FLAG );330 m_cDdcDataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DDC_DATA );331 m_cAngleFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ANGLE_FLAG );332 #if H_3D_DIM_SDC333 m_cSDCResidualFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL_FLAG );334 m_cSDCResidualSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL );335 #endif336 #endif337 #if H_3D_DIM_SDC338 m_cSDCFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_FLAG );339 #endif340 #if H_3D_DBBP341 m_cDBBPFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DBBP_FLAG );342 #endif343 236 m_pcBinIf->start(); 344 237 } … … 350 243 } 351 244 352 #if H_3D353 Void TEncSbac::codeSPS( TComSPS* pcSPS, Int viewIndex, Bool depthFlag )354 #else355 245 Void TEncSbac::codeSPS( TComSPS* pcSPS ) 356 #endif357 246 { 358 247 assert (0); … … 454 343 m_pcBinIf->encodeBinsEP( bins, numBins ); 455 344 } 456 #if MTK_SINGLE_DEPTH_MODE_I0095457 Void TEncSbac::codeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx )458 {459 UInt uiSymbol = pcCU->getSingleDepthFlag(uiAbsPartIdx ) ? 1 : 0;460 m_pcBinIf->encodeBin( uiSymbol, m_cCUSingleDepthFlagSCModel.get( 0, 0, 0 ) );461 if(uiSymbol)462 {463 UInt uiUnaryIdx = (UInt) pcCU->getSingleDepthValue(uiAbsPartIdx);464 UInt uiNumCand = MTK_SINGLE_DEPTH_MODE_CANDIDATE_LIST_SIZE;465 if ( uiNumCand > 1 )466 {467 for( UInt ui = 0; ui < uiNumCand - 1; ++ui )468 {469 const UInt uiSymbol2 = ui == uiUnaryIdx ? 0 : 1;470 if ( ui==0 )471 {472 m_pcBinIf->encodeBin( uiSymbol2, m_cSingleDepthValueSCModel.get( 0, 0, 0 ) );473 }474 else475 {476 m_pcBinIf->encodeBinEP( uiSymbol2 );477 }478 if( uiSymbol2 == 0 )479 {480 break;481 }482 }483 }484 }485 }486 #endif487 345 /** Coding of coeff_abs_level_minus3 488 346 * \param uiSymbol value of coeff_abs_level_minus3 … … 513 371 } 514 372 515 #if H_3D_DIM516 Void TEncSbac::xWriteExGolombLevel( UInt uiSymbol, ContextModel& rcSCModel )517 {518 if( uiSymbol )519 {520 m_pcBinIf->encodeBin( 1, rcSCModel );521 UInt uiCount = 0;522 Bool bNoExGo = ( uiSymbol < 3 );523 524 while( --uiSymbol && ++uiCount < 3 )525 {526 m_pcBinIf->encodeBin( 1, rcSCModel );527 }528 if( bNoExGo )529 {530 m_pcBinIf->encodeBin( 0, rcSCModel );531 }532 else533 {534 xWriteEpExGolomb( uiSymbol, 0 );535 }536 }537 else538 {539 m_pcBinIf->encodeBin( 0, rcSCModel );540 }541 542 return;543 }544 545 Void TEncSbac::xCodeDimDeltaDC( Pel valDeltaDC, UInt uiNumSeg )546 {547 xWriteExGolombLevel( UInt( abs( valDeltaDC ) - ( uiNumSeg > 1 ? 0 : 1 ) ), m_cDdcDataSCModel.get(0, 0, 0) );548 if( valDeltaDC != 0 )549 {550 UInt uiSign = valDeltaDC > 0 ? 0 : 1;551 m_pcBinIf->encodeBinEP( uiSign );552 }553 }554 555 #if H_3D_DIM_DMM556 Void TEncSbac::xCodeDmm1WedgeIdx( UInt uiTabIdx, Int iNumBit )557 {558 for ( Int i = 0; i < iNumBit; i++ )559 {560 m_pcBinIf->encodeBinEP( ( uiTabIdx >> i ) & 1 );561 }562 }563 564 #endif565 566 #if !FIX_TICKET_76567 #if H_3D_DIM_SDC568 Void TEncSbac::xCodeSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment )569 {570 assert( pcCU->getSlice()->getIsDepth() );571 assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N );572 assert( pcCU->getSDCFlag(uiAbsPartIdx) );573 assert( uiSegment < 2 );574 575 Pel segmentDCOffset = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);576 577 UInt uiResidual = segmentDCOffset == 0 ? 0 : 1;578 UInt uiSign = segmentDCOffset < 0 ? 1 : 0;579 UInt uiAbsIdx = abs(segmentDCOffset);580 581 #if H_3D_DIM_DLT582 UInt uiMaxResidualBits = pcCU->getSlice()->getPPS()->getDLT()->getBitsPerDepthValue( pcCU->getSlice()->getLayerIdInVps() );583 #else584 UInt uiMaxResidualBits = g_bitDepthY;585 #endif586 assert( uiMaxResidualBits <= g_bitDepthY );587 588 // residual flag589 m_pcBinIf->encodeBin( uiResidual, m_cSDCResidualFlagSCModel.get( 0, 0, 0 ) );590 #if H_MV_ENC_DEC_TRAC591 DTRACE_CU("sdc_residual_flag[i]", uiResidual)592 #endif593 594 if (uiResidual)595 {596 // encode sign bit of residual597 m_pcBinIf->encodeBinEP( uiSign );598 #if H_MV_ENC_DEC_TRAC599 DTRACE_CU("sdc_residual_sign_flag[i]", uiSign)600 #endif601 #if H_3D_DIM_DLT602 UInt uiNumDepthValues = pcCU->getSlice()->getPPS()->getDLT()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() );603 #else604 UInt uiNumDepthValues = ((1 << g_bitDepthY)-1);605 #endif606 607 assert(uiAbsIdx <= uiNumDepthValues);608 609 // encode residual magnitude610 uiAbsIdx -= 1;611 612 #if H_MV_ENC_DEC_TRAC613 DTRACE_CU("sdc_residual_abs_minus1[i]", uiAbsIdx)614 #endif615 616 // prefix part617 if ( uiAbsIdx == 0 )618 {619 m_pcBinIf->encodeBin( 0, m_cSDCResidualSCModel.get(0, 0, 0) );620 }621 else622 {623 UInt l = uiAbsIdx;624 UInt k = 0;625 UInt uiPrefixThreshold = ((uiNumDepthValues * 3) >> 2);626 while ( l > 0 && k < uiPrefixThreshold )627 {628 m_pcBinIf->encodeBin( 1, m_cSDCResidualSCModel.get(0, 0, 0) );629 l--;630 k++;631 }632 if ( uiAbsIdx < uiPrefixThreshold )633 {634 m_pcBinIf->encodeBin( 0, m_cSDCResidualSCModel.get(0, 0, 0) );635 }636 else637 { // suffix part638 uiAbsIdx -= uiPrefixThreshold;639 UInt uiSuffixLength = numBitsForValue(uiNumDepthValues - uiPrefixThreshold);640 UInt uiBitInfo = 0;641 for ( Int i = 0; i < uiSuffixLength; i++)642 {643 uiBitInfo = ( uiAbsIdx & ( 1 << i ) ) >> i;644 m_pcBinIf->encodeBinEP( uiBitInfo);645 }646 }647 }648 649 }650 }651 #endif652 #endif653 #endif654 373 655 374 … … 666 385 this->m_cCUIntraPredSCModel .copyFrom( &pSrc->m_cCUIntraPredSCModel ); 667 386 } 668 #if H_3D_DIM669 Void TEncSbac::loadIntraDepthMode( TEncSbac* pSrc)670 {671 m_pcBinIf->copyState( pSrc->m_pcBinIf );672 673 this->m_cDepthIntraModeSCModel .copyFrom( &pSrc->m_cDepthIntraModeSCModel );674 this->m_cDdcFlagSCModel .copyFrom( &pSrc->m_cDdcFlagSCModel );675 this->m_cAngleFlagSCModel .copyFrom( &pSrc->m_cAngleFlagSCModel );676 }677 #endif678 387 679 388 Void TEncSbac::store( TEncSbac* pDest) … … 716 425 { 717 426 PartSize eSize = pcCU->getPartitionSize( uiAbsPartIdx ); 718 #if H_3D_QTLPC719 #if MTK_I0099_VPS_EX2720 TComVPS *vps = pcCU->getPic()->getSlice(0)->getVPS();721 Bool bLimQtPredFlag = vps->getLimQtPredFlag(pcCU->getPic()->getSlice(0)->getLayerId());722 #else723 TComSPS *sps = pcCU->getPic()->getSlice(0)->getSPS();724 #endif725 TComPic *pcTexture = pcCU->getSlice()->getTexturePic();726 Bool bDepthMapDetect = (pcTexture != NULL);727 Bool bIntraSliceDetect = (pcCU->getSlice()->getSliceType() == I_SLICE);728 729 Bool rapPic = (pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA);730 731 Bool depthDependent = false;732 UInt uiTexturePart = eSize;733 #if MTK_I0099_VPS_EX2734 #if LGE_FCO_I0116735 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && pcCU->getPic()->getReduceBitsFlag() && bLimQtPredFlag && pcTexture->getReconMark())736 #else737 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && pcCU->getPic()->getReduceBitsFlag() && bLimQtPredFlag )738 #endif739 #else740 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && pcCU->getPic()->getReduceBitsFlag() && sps->getUseQTL() && sps->getUsePC() )741 #endif742 {743 TComDataCU *pcTextureCU = pcTexture->getCU(pcCU->getAddr());744 UInt uiCUIdx = (pcCU->getZorderIdxInCU() == 0) ? uiAbsPartIdx : pcCU->getZorderIdxInCU();745 assert(pcTextureCU->getDepth(uiCUIdx) >= uiDepth);746 if(pcTextureCU->getDepth(uiCUIdx) == uiDepth )747 {748 depthDependent = true;749 uiTexturePart = pcTextureCU->getPartitionSize( uiCUIdx );750 }751 if (pcTextureCU->getDepth(uiCUIdx) == uiDepth && pcTextureCU->getPartitionSize( uiCUIdx ) == SIZE_2Nx2N)752 {753 assert( eSize == SIZE_2Nx2N );754 return;755 }756 }757 #endif758 427 if ( pcCU->isIntra( uiAbsPartIdx ) ) 759 428 { … … 771 440 DTRACE_CU("part_mode", eSize ) 772 441 #endif 773 #if H_3D_QTLPC774 if (depthDependent==false || uiTexturePart == SIZE_NxN|| uiTexturePart == SIZE_2Nx2N)775 {776 #endif777 442 switch(eSize) 778 443 { … … 841 506 } 842 507 } 843 #if H_3D_QTLPC844 }845 else if(uiTexturePart == SIZE_2NxN || uiTexturePart == SIZE_2NxnU || uiTexturePart == SIZE_2NxnD)846 {847 //assert(eSize!=SIZE_NxN);848 //assert(eSize!=SIZE_Nx2N);849 //assert(eSize==SIZE_2Nx2N || eSize==SIZE_2NxN || eSize==SIZE_2NxnU || eSize==SIZE_2NxnD);850 switch(eSize)851 {852 case SIZE_2Nx2N:853 {854 m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 0) );855 break;856 }857 case SIZE_2NxN:858 {859 m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );860 if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) )861 {862 m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 1) );863 }864 break;865 }866 case SIZE_2NxnU:867 case SIZE_2NxnD:868 {869 m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );870 m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 1) );871 m_pcBinIf->encodeBinEP((eSize == SIZE_2NxnU? 0: 1));872 break;873 }874 default:875 {876 assert(0);877 }878 }879 }880 else if(uiTexturePart == SIZE_Nx2N|| uiTexturePart==SIZE_nLx2N || uiTexturePart==SIZE_nRx2N)881 {882 //assert(eSize!=SIZE_NxN);883 //assert(eSize!=SIZE_2NxN);884 //assert(eSize==SIZE_2Nx2N ||eSize==SIZE_Nx2N || eSize==SIZE_nLx2N || eSize==SIZE_nRx2N);885 switch(eSize)886 {887 case SIZE_2Nx2N:888 {889 m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 0) );890 break;891 }892 case SIZE_Nx2N:893 {894 m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );895 if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) )896 {897 m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 1) );898 }899 break;900 }901 case SIZE_nLx2N:902 case SIZE_nRx2N:903 {904 m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );905 m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 1) );906 m_pcBinIf->encodeBinEP((eSize == SIZE_nLx2N? 0: 1));907 break;908 }909 default:910 {911 assert(0);912 }913 }914 }915 else916 {917 printf("uiTexturePart=%d",uiTexturePart);918 assert(0);919 }920 #endif921 508 } 922 509 … … 928 515 Void TEncSbac::codePredMode( TComDataCU* pcCU, UInt uiAbsPartIdx ) 929 516 { 930 #if H_3D_DIM_SDC931 if ( pcCU->getSlice()->isIntra() )932 {933 assert( pcCU->isIntra(uiAbsPartIdx) );934 return;935 }936 #endif937 517 938 518 // get context function is here … … 1041 621 } 1042 622 1043 #if H_3D_ARP 1044 Void TEncSbac::codeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx ) 1045 { 1046 Int iW = (Int)pcCU->getARPW( uiAbsPartIdx ); 1047 Int iMaxW = pcCU->getSlice()->getARPStepNum() - 1; 1048 assert( iMaxW > 0); 1049 1050 Int nOffset = pcCU->getCTXARPWFlag(uiAbsPartIdx); 1051 Int nBinNum = iW + ( iW != iMaxW ); 1052 m_pcBinIf->encodeBin( iW ? 1 : 0 , m_cCUPUARPWSCModel.get( 0, 0, 0 + nOffset ) ); 1053 if( nBinNum > 1 ) 1054 { 1055 m_pcBinIf->encodeBin( ( iW == iMaxW ) ? 1 : 0, m_cCUPUARPWSCModel.get( 0, 0, 2 ) ); 1056 } 1057 #if H_MV_ENC_DEC_TRAC 1058 DTRACE_CU("iv_res_pred_weight_idx", iW); 1059 #endif 1060 } 1061 #endif 1062 1063 #if H_3D_IC 1064 /** code Illumination Compensation flag 1065 * \param pcCU 1066 * \param uiAbsPartIdx 1067 * \returns Void 1068 */ 1069 Void TEncSbac::codeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) 1070 { 1071 // get context function is here 1072 UInt uiSymbol = pcCU->getICFlag( uiAbsPartIdx ) ? 1 : 0; 1073 m_pcBinIf->encodeBin( uiSymbol, m_cCUICFlagSCModel.get( 0, 0, 0 ) ); 1074 #if !H_MV_ENC_DEC_TRAC 1075 DTRACE_CABAC_VL( g_nSymbolCounter++ ); 1076 DTRACE_CABAC_T( "\tICFlag" ); 1077 DTRACE_CABAC_T( "\tuiSymbol: "); 1078 DTRACE_CABAC_V( uiSymbol ); 1079 DTRACE_CABAC_T( "\n"); 1080 #else 1081 DTRACE_CU("ic_flag", uiSymbol ); 1082 #endif 1083 } 1084 #endif 623 1085 624 1086 625 … … 1094 633 1095 634 assert( uiCtx < 3 ); 1096 #if H_3D_QTLPC1097 Bool bCodeSplitFlag = true;1098 1099 #if MTK_I0099_VPS_EX21100 TComVPS *vps = pcCU->getPic()->getSlice(0)->getVPS();1101 Bool bLimQtPredFlag = vps->getLimQtPredFlag(pcCU->getPic()->getSlice(0)->getLayerId());1102 #else1103 TComSPS *sps = pcCU->getPic()->getSlice(0)->getSPS();1104 #endif1105 TComPic *pcTexture = pcCU->getSlice()->getTexturePic();1106 Bool bDepthMapDetect = (pcTexture != NULL);1107 Bool bIntraSliceDetect = (pcCU->getSlice()->getSliceType() == I_SLICE);1108 1109 Bool rapPic = (pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA);1110 1111 #if MTK_I0099_VPS_EX21112 #if LGE_FCO_I01161113 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && pcCU->getPic()->getReduceBitsFlag() && bLimQtPredFlag && pcTexture->getReconMark() )1114 #else1115 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && pcCU->getPic()->getReduceBitsFlag() && bLimQtPredFlag )1116 #endif1117 #else1118 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && pcCU->getPic()->getReduceBitsFlag() && sps->getUseQTL() && sps->getUsePC())1119 #endif1120 {1121 TComDataCU *pcTextureCU = pcTexture->getCU(pcCU->getAddr());1122 UInt uiCUIdx = (pcCU->getZorderIdxInCU() == 0) ? uiAbsPartIdx : pcCU->getZorderIdxInCU();1123 assert(pcTextureCU->getDepth(uiCUIdx) >= uiDepth);1124 bCodeSplitFlag = (pcTextureCU->getDepth(uiCUIdx) > uiDepth);1125 }1126 1127 if(!bCodeSplitFlag)1128 {1129 assert(uiCurrSplitFlag == 0);1130 return;1131 }1132 #endif1133 635 m_pcBinIf->encodeBin( uiCurrSplitFlag, m_cCUSplitFlagSCModel.get( 0, 0, uiCtx ) ); 1134 636 #if !H_MV_ENC_DEC_TRAC … … 1166 668 { 1167 669 dir[j] = pcCU->getLumaIntraDir( absPartIdx+partOffset*j ); 1168 #if H_3D_DIM1169 #if SEPARATE_FLAG_I00851170 if( pcCU->getSlice()->getVpsDepthModesFlag() || pcCU->getSlice()->getIVPFlag() )1171 #else1172 if( pcCU->getSlice()->getVpsDepthModesFlag() )1173 #endif1174 {1175 codeIntraDepth( pcCU, absPartIdx+partOffset*j );1176 }1177 if( pcCU->getLumaIntraDir( absPartIdx+partOffset*j ) < NUM_INTRA_MODE )1178 {1179 #endif1180 670 predNum[j] = pcCU->getIntraDirLumaPredictor(absPartIdx+partOffset*j, preds[j]); 1181 671 for(UInt i = 0; i < predNum[j]; i++) … … 1190 680 DTRACE_CU("prev_intra_luma_pred_flag", (predIdx[j] != -1)? 1 : 0); 1191 681 #endif 1192 #if H_3D_DIM1193 }1194 #endif1195 682 1196 683 } 1197 684 for (j=0;j<partNum;j++) 1198 685 { 1199 #if H_3D_DIM1200 if( pcCU->getLumaIntraDir( absPartIdx+partOffset*j ) < NUM_INTRA_MODE )1201 {1202 #endif1203 686 if(predIdx[j] != -1) 1204 687 { … … 1235 718 #endif 1236 719 } 1237 #if H_3D_DIM1238 }1239 #endif1240 720 } 1241 721 return; … … 1277 757 } 1278 758 1279 #if H_3D_DIM1280 Void TEncSbac::codeIntraDepth( TComDataCU* pcCU, UInt absPartIdx )1281 {1282 codeIntraDepthMode( pcCU, absPartIdx );1283 1284 UInt dir = pcCU->getLumaIntraDir( absPartIdx );1285 UInt dimType = getDimType( dir );1286 1287 switch( dimType )1288 {1289 #if H_3D_DIM_DMM1290 case( DMM1_IDX ):1291 {1292 xCodeDmm1WedgeIdx( pcCU->getDmmWedgeTabIdx( dimType, absPartIdx ), g_dmm1TabIdxBits[pcCU->getIntraSizeIdx(absPartIdx)] );1293 } break;1294 case( DMM4_IDX ): break;1295 #endif1296 default: break;1297 }1298 }1299 1300 Void TEncSbac::codeIntraDepthMode( TComDataCU* pcCU, UInt absPartIdx )1301 {1302 UInt dir = pcCU->getLumaIntraDir( absPartIdx );1303 1304 if( ( pcCU->getSlice()->getSPS()->getMaxCUWidth() >> pcCU->getDepth( absPartIdx ) ) < 64 ) //DMM and HEVC intra modes are both allowed1305 {1306 m_pcBinIf->encodeBin( isDimMode( dir ) ? 0 : 1, m_cAngleFlagSCModel.get( 0, 0, 0 ) );1307 }1308 if( isDimMode( dir ) )1309 {1310 UInt uiCodeIdx = 0;1311 1312 switch( getDimType( dir ) )1313 {1314 case DMM1_IDX: uiCodeIdx = 0; break;1315 case DMM4_IDX: uiCodeIdx = 1; break;1316 default: break;1317 }1318 //mode coding1319 #if SEPARATE_FLAG_I00851320 if( pcCU->getSlice()->getVpsDepthModesFlag() && pcCU->getSlice()->getIVPFlag())1321 {1322 m_pcBinIf->encodeBin( uiCodeIdx == 0 ? 0 : 1, m_cDepthIntraModeSCModel.get( 0, 0, 0 ) );1323 }1324 #else1325 m_pcBinIf->encodeBin( uiCodeIdx == 0 ? 0 : 1, m_cDepthIntraModeSCModel.get( 0, 0, 0 ) );1326 #endif1327 }1328 }1329 #endif1330 759 1331 760 … … 2360 1789 } 2361 1790 2362 #if H_3D_INTER_SDC 2363 Void TEncSbac::codeDeltaDC( TComDataCU* pcCU, UInt absPartIdx ) 2364 { 2365 if( !( pcCU->getSDCFlag( absPartIdx ) || ( pcCU->isIntra( absPartIdx ) && getDimType( pcCU->getLumaIntraDir( absPartIdx ) ) < DIM_NUM_TYPE ) ) ) 2366 { 2367 assert( 0 ); 2368 } 2369 2370 #if HS_DMM_SIGNALLING_I0120 2371 UInt uiNumSegments = isDimMode( pcCU->getLumaIntraDir( absPartIdx ) ) ? 2 : 1; 2372 UInt dimDeltaDC = 1; 2373 #else 2374 UInt uiNumSegments = 0; 2375 UInt dimDeltaDC = 0; 2376 #endif 2377 2378 #if HS_DMM_SIGNALLING_I0120 2379 if( pcCU->isIntra( absPartIdx ) && pcCU->getSDCFlag( absPartIdx )) 2380 { 2381 #else 2382 if( pcCU->isIntra( absPartIdx ) ) 2383 { 2384 UInt dir = pcCU->getLumaIntraDir( absPartIdx ); 2385 uiNumSegments = isDimMode( dir ) ? 2 : 1; 2386 2387 if( pcCU->getSDCFlag( absPartIdx ) ) 2388 { 2389 #endif 2390 if( uiNumSegments == 1 ) 2391 { 2392 dimDeltaDC = pcCU->getSDCSegmentDCOffset( 0, absPartIdx ) ? 1 : 0; 2393 } 2394 else 2395 { 2396 dimDeltaDC = ( pcCU->getSDCSegmentDCOffset( 0, absPartIdx ) || pcCU->getSDCSegmentDCOffset( 1, absPartIdx ) ) ? 1 : 0; 2397 } 2398 #if !HS_DMM_SIGNALLING_I0120 2399 } 2400 else 2401 { 2402 dimDeltaDC = isDimDeltaDC( dir ); 2403 } 2404 #endif 2405 m_pcBinIf->encodeBin( dimDeltaDC, m_cDdcFlagSCModel.get( 0, 0, 0 ) ); 2406 } 2407 #if !HS_DMM_SIGNALLING_I0120 2408 else //all-zero inter SDC is not allowed 2409 { 2410 uiNumSegments = 1; 2411 dimDeltaDC = 1; 2412 } 2413 #endif 2414 2415 if( dimDeltaDC ) 2416 { 2417 for( UInt segment = 0; segment < uiNumSegments; segment++ ) 2418 { 2419 Pel deltaDC = 0; 2420 2421 if( pcCU->isIntra( absPartIdx ) ) 2422 { 2423 UInt dir = pcCU->getLumaIntraDir( absPartIdx ); 2424 deltaDC = pcCU->getSDCFlag( absPartIdx ) ? pcCU->getSDCSegmentDCOffset( segment, absPartIdx ) : pcCU->getDimDeltaDC( getDimType( dir ), segment, absPartIdx ); 2425 } 2426 else 2427 { 2428 deltaDC = pcCU->getSDCSegmentDCOffset( segment, absPartIdx ); 2429 } 2430 2431 xCodeDimDeltaDC( deltaDC, uiNumSegments ); 2432 } 2433 } 2434 } 2435 2436 Void TEncSbac::codeSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) 2437 { 2438 UInt uiSymbol = pcCU->getSDCFlag( uiAbsPartIdx ) ? 1 : 0; 2439 UInt uiCtxSDCFlag = pcCU->getCtxSDCFlag( uiAbsPartIdx ); 2440 2441 m_pcBinIf->encodeBin( uiSymbol, m_cSDCFlagSCModel.get( 0, 0, uiCtxSDCFlag ) ); 2442 } 2443 2444 #endif 2445 2446 #if H_3D_DBBP 2447 Void TEncSbac::codeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) 2448 { 2449 #if SEC_DBBP_EXPLICIT_SIG_I0077 2450 PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx ); 2451 AOF( ePartSize == SIZE_2NxN || ePartSize == SIZE_Nx2N ); 2452 #endif 2453 AOF( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) ); 2454 AOF( !pcCU->getSlice()->getIsDepth() ); 2455 2456 UInt uiSymbol = pcCU->getDBBPFlag( uiAbsPartIdx ) ? 1 : 0; 2457 m_pcBinIf->encodeBin( uiSymbol, m_cDBBPFlagSCModel.get( 0, 0, 0 ) ); 2458 } 2459 #endif 1791 2460 1792 2461 1793 //! \}
Note: See TracChangeset for help on using the changeset viewer.