Changeset 1074 in 3DVCSoftware for branches/HTM-12.1-dev0/source/Lib/TLibEncoder/TEncSbac.cpp
- Timestamp:
- 21 Oct 2014, 20:39:50 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-12.1-dev0/source/Lib/TLibEncoder/TEncSbac.cpp
r1066 r1074 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_I009560 #if H_3D_SINGLE_DEPTH 61 61 , m_cCUSingleDepthFlagSCModel ( 1, 1, NUM_SINGLEDEPTH_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 62 62 , m_cSingleDepthValueSCModel ( 1, 1, NUM_SINGLE_DEPTH_VALUE_DATA_CTX , m_contextModels + m_numContextModels, m_numContextModels) … … 134 134 135 135 m_cCUSkipFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SKIP_FLAG ); 136 #if MTK_SINGLE_DEPTH_MODE_I0095136 #if H_3D_SINGLE_DEPTH 137 137 m_cCUSingleDepthFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SINGLEDEPTH_FLAG ); 138 138 m_cSingleDepthValueSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SINGLE_DEPTH_VALUE_DATA ); … … 214 214 curCost = m_cCUSplitFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SPLIT_FLAG ); 215 215 curCost += m_cCUSkipFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SKIP_FLAG ); 216 #if MTK_SINGLE_DEPTH_MODE_I0095216 #if H_3D_SINGLE_DEPTH 217 217 curCost += m_cCUSingleDepthFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SINGLEDEPTH_FLAG ); 218 218 curCost += m_cSingleDepthValueSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SINGLE_DEPTH_VALUE_DATA ); … … 255 255 curCost += m_CUTransquantBypassFlagSCModel.calcCost( curSliceType, qp, (UChar*)INIT_CU_TRANSQUANT_BYPASS_FLAG ); 256 256 #if H_3D_DIM 257 #if SEPARATE_FLAG_I0085258 257 if( m_pcSlice->getVpsDepthModesFlag() || m_pcSlice->getIVPFlag() ) 259 #else260 if( m_pcSlice->getVpsDepthModesFlag() )261 #endif262 258 { 263 259 curCost += m_cDepthIntraModeSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_DEPTH_INTRA_MODE ); … … 291 287 292 288 m_cCUSkipFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SKIP_FLAG ); 293 #if MTK_SINGLE_DEPTH_MODE_I0095289 #if H_3D_SINGLE_DEPTH 294 290 m_cCUSingleDepthFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SINGLEDEPTH_FLAG ); 295 291 m_cSingleDepthValueSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SINGLE_DEPTH_VALUE_DATA ); … … 454 450 m_pcBinIf->encodeBinsEP( bins, numBins ); 455 451 } 456 #if MTK_SINGLE_DEPTH_MODE_I0095452 #if H_3D_SINGLE_DEPTH 457 453 Void TEncSbac::codeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx ) 458 454 { … … 462 458 { 463 459 UInt uiUnaryIdx = (UInt) pcCU->getSingleDepthValue(uiAbsPartIdx); 464 UInt uiNumCand = MTK_SINGLE_DEPTH_MODE_CANDIDATE_LIST_SIZE;460 UInt uiNumCand = SINGLE_DEPTH_MODE_CAND_LIST_SIZE; 465 461 if ( uiNumCand > 1 ) 466 462 { … … 563 559 564 560 #endif 565 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 561 #endif 654 562 … … 717 625 PartSize eSize = pcCU->getPartitionSize( uiAbsPartIdx ); 718 626 #if H_3D_QTLPC 719 #if MTK_I0099_VPS_EX2720 627 TComVPS *vps = pcCU->getPic()->getSlice(0)->getVPS(); 721 628 Bool bLimQtPredFlag = vps->getLimQtPredFlag(pcCU->getPic()->getSlice(0)->getLayerId()); 722 #else723 TComSPS *sps = pcCU->getPic()->getSlice(0)->getSPS();724 #endif725 629 TComPic *pcTexture = pcCU->getSlice()->getTexturePic(); 726 630 Bool bDepthMapDetect = (pcTexture != NULL); … … 731 635 Bool depthDependent = false; 732 636 UInt uiTexturePart = eSize; 733 #if MTK_I0099_VPS_EX2 734 #if LGE_FCO_I0116637 638 #if H_3D_FCO 735 639 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && pcCU->getPic()->getReduceBitsFlag() && bLimQtPredFlag && pcTexture->getReconMark()) 736 640 #else 737 641 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && pcCU->getPic()->getReduceBitsFlag() && bLimQtPredFlag ) 738 #endif739 #else740 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && pcCU->getPic()->getReduceBitsFlag() && sps->getUseQTL() && sps->getUsePC() )741 642 #endif 742 643 { … … 1097 998 Bool bCodeSplitFlag = true; 1098 999 1099 #if MTK_I0099_VPS_EX21100 1000 TComVPS *vps = pcCU->getPic()->getSlice(0)->getVPS(); 1101 1001 Bool bLimQtPredFlag = vps->getLimQtPredFlag(pcCU->getPic()->getSlice(0)->getLayerId()); 1102 #else1103 TComSPS *sps = pcCU->getPic()->getSlice(0)->getSPS();1104 #endif1105 1002 TComPic *pcTexture = pcCU->getSlice()->getTexturePic(); 1106 1003 Bool bDepthMapDetect = (pcTexture != NULL); … … 1109 1006 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 1007 1111 #if MTK_I0099_VPS_EX2 1112 #if LGE_FCO_I0116 1008 #if H_3D_FCO 1113 1009 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && pcCU->getPic()->getReduceBitsFlag() && bLimQtPredFlag && pcTexture->getReconMark() ) 1114 1010 #else 1115 1011 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && pcCU->getPic()->getReduceBitsFlag() && bLimQtPredFlag ) 1116 #endif1117 #else1118 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && pcCU->getPic()->getReduceBitsFlag() && sps->getUseQTL() && sps->getUsePC())1119 1012 #endif 1120 1013 { … … 1167 1060 dir[j] = pcCU->getLumaIntraDir( absPartIdx+partOffset*j ); 1168 1061 #if H_3D_DIM 1169 #if SEPARATE_FLAG_I00851170 1062 if( pcCU->getSlice()->getVpsDepthModesFlag() || pcCU->getSlice()->getIVPFlag() ) 1171 #else1172 if( pcCU->getSlice()->getVpsDepthModesFlag() )1173 #endif1174 1063 { 1175 1064 codeIntraDepth( pcCU, absPartIdx+partOffset*j ); … … 1317 1206 } 1318 1207 //mode coding 1319 #if SEPARATE_FLAG_I00851320 1208 if( pcCU->getSlice()->getVpsDepthModesFlag() && pcCU->getSlice()->getIVPFlag()) 1321 1209 { 1322 1210 m_pcBinIf->encodeBin( uiCodeIdx == 0 ? 0 : 1, m_cDepthIntraModeSCModel.get( 0, 0, 0 ) ); 1323 1211 } 1324 #else1325 m_pcBinIf->encodeBin( uiCodeIdx == 0 ? 0 : 1, m_cDepthIntraModeSCModel.get( 0, 0, 0 ) );1326 #endif1327 1212 } 1328 1213 } … … 2368 2253 } 2369 2254 2370 #if HS_DMM_SIGNALLING_I01202371 2255 UInt uiNumSegments = isDimMode( pcCU->getLumaIntraDir( absPartIdx ) ) ? 2 : 1; 2372 2256 UInt dimDeltaDC = 1; 2373 #else 2374 UInt uiNumSegments = 0; 2375 UInt dimDeltaDC = 0; 2376 #endif 2377 2378 #if HS_DMM_SIGNALLING_I0120 2257 2379 2258 if( pcCU->isIntra( absPartIdx ) && pcCU->getSDCFlag( absPartIdx )) 2380 2259 { 2381 #else2382 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 #endif2390 2260 if( uiNumSegments == 1 ) 2391 2261 { … … 2396 2266 dimDeltaDC = ( pcCU->getSDCSegmentDCOffset( 0, absPartIdx ) || pcCU->getSDCSegmentDCOffset( 1, absPartIdx ) ) ? 1 : 0; 2397 2267 } 2398 #if !HS_DMM_SIGNALLING_I01202399 }2400 else2401 {2402 dimDeltaDC = isDimDeltaDC( dir );2403 }2404 #endif2405 2268 m_pcBinIf->encodeBin( dimDeltaDC, m_cDdcFlagSCModel.get( 0, 0, 0 ) ); 2406 2269 } 2407 #if !HS_DMM_SIGNALLING_I01202408 else //all-zero inter SDC is not allowed2409 {2410 uiNumSegments = 1;2411 dimDeltaDC = 1;2412 }2413 #endif2414 2270 2415 2271 if( dimDeltaDC ) … … 2447 2303 Void TEncSbac::codeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) 2448 2304 { 2449 #if SEC_DBBP_EXPLICIT_SIG_I00772450 2305 PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx ); 2451 2306 AOF( ePartSize == SIZE_2NxN || ePartSize == SIZE_Nx2N ); 2452 #endif2453 2307 AOF( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) ); 2454 2308 AOF( !pcCU->getSlice()->getIsDepth() );
Note: See TracChangeset for help on using the changeset viewer.