Changeset 983 in 3DVCSoftware for branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibEncoder
- Timestamp:
- 11 Jul 2014, 03:49:39 (11 years ago)
- Location:
- branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibEncoder
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibEncoder/TEncCavlc.cpp
r976 r983 2022 2022 } 2023 2023 #endif 2024 2024 #if MTK_SINGLE_DEPTH_MODE_I0095 2025 if(pcSlice->getIsDepth()) 2026 { 2027 WRITE_FLAG( pcSlice->getApplySingleDepthMode() ? 1 : 0, "slice_enable_single_depth_mode" ); 2028 } 2029 #endif 2025 2030 #if H_3D_IV_MERGE 2026 2031 assert(pcSlice->getMaxNumMergeCand()<=MRG_MAX_NUM_CANDS_MEM); … … 2408 2413 assert(0); 2409 2414 } 2410 2415 #if MTK_SINGLE_DEPTH_MODE_I0095 2416 Void TEncCavlc::codeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx ) 2417 { 2418 assert(0); 2419 } 2420 #endif 2411 2421 Void TEncCavlc::codeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2412 2422 { -
branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibEncoder/TEncCavlc.h
r884 r983 123 123 Void codeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ); 124 124 Void codeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 125 #if MTK_SINGLE_DEPTH_MODE_I0095 126 Void codeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx ); 127 #endif 125 128 Void codeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 126 129 Void codeMergeIndex ( TComDataCU* pcCU, UInt uiAbsPartIdx ); -
branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibEncoder/TEncCfg.h
r976 r983 416 416 Bool m_useSDC; 417 417 Bool m_useDLT; 418 #endif 419 #if MTK_SINGLE_DEPTH_MODE_I0095 420 Bool m_useSingleDepthMode; 418 421 #endif 419 422 #if H_3D_IV_MERGE … … 1008 1011 Void setUseDLT ( Bool b) { m_useDLT = b; } 1009 1012 #endif 1013 #if MTK_SINGLE_DEPTH_MODE_I0095 1014 Void setUseSingleDepthMode ( Bool bVal ) { m_useSingleDepthMode = bVal; } 1015 Bool getUseSingleDepthMode () { return m_useSingleDepthMode; } 1016 #endif 1010 1017 #if H_3D_QTLPC 1011 1018 Void setUseQTL ( Bool b ) { m_bUseQTL = b; } -
branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibEncoder/TEncCu.cpp
r976 r983 709 709 } 710 710 #endif 711 711 #if MTK_SINGLE_DEPTH_MODE_I0095 712 rpcTempCU->initEstData( uiDepth, iMinQP, isAddLowestQP ); 713 if(rpcBestCU->getSlice()->getApplySingleDepthMode()) 714 { 715 xCheckRDCostSingleDepth( rpcBestCU, rpcTempCU, SIZE_2Nx2N ); 716 rpcTempCU->initEstData( uiDepth, iMinQP, isAddLowestQP ); 717 } 718 #endif 712 719 if(!earlyDetectionSkipMode) 713 720 { … … 1536 1543 return; 1537 1544 } 1545 #if MTK_SINGLE_DEPTH_MODE_I0095 1546 m_pcEntropyCoder->encodeSingleDepthMode( pcCU, uiAbsPartIdx ); 1547 if(!pcCU->getSingleDepthFlag(uiAbsPartIdx)) 1548 { 1549 #endif 1538 1550 m_pcEntropyCoder->encodePredMode( pcCU, uiAbsPartIdx ); 1539 1551 … … 1568 1580 m_pcEntropyCoder->encodeCoeff( pcCU, uiAbsPartIdx, uiDepth, pcCU->getWidth (uiAbsPartIdx), pcCU->getHeight(uiAbsPartIdx), bCodeDQP ); 1569 1581 setdQPFlag( bCodeDQP ); 1570 1582 #if MTK_SINGLE_DEPTH_MODE_I0095 1583 } 1584 #endif 1571 1585 // --- write terminating bit --- 1572 1586 finishCU(pcCU,uiAbsPartIdx,uiDepth); … … 1971 1985 1972 1986 rpcTempCU->setSkipFlagSubParts( rpcTempCU->getQtRootCbf(0) == 0, 0, uhDepth ); 1987 #if MTK_SINGLE_DEPTH_MODE_I0095 1988 rpcTempCU->setSingleDepthFlagSubParts( false, 0, uhDepth ); 1989 #endif 1973 1990 #if H_3D_VSP // possible bug fix 1974 1991 if( rpcTempCU->getSkipFlag(0) ) … … 1994 2011 } 1995 2012 rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth ); 2013 #if MTK_SINGLE_DEPTH_MODE_I0095 2014 rpcTempCU->setSingleDepthFlagSubParts( false, 0, uhDepth ); 2015 #endif 1996 2016 rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth ); 1997 2017 rpcTempCU->setCbfSubParts( 1, 1, 1, 0, uhDepth ); … … 2130 2150 2131 2151 rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth ); 2132 2152 #if MTK_SINGLE_DEPTH_MODE_I0095 2153 rpcTempCU->setSingleDepthFlagSubParts( false, 0, uhDepth ); 2154 #endif 2133 2155 rpcTempCU->setPartSizeSubParts ( ePartSize, 0, uhDepth ); 2134 2156 rpcTempCU->setPredModeSubParts ( MODE_INTER, 0, uhDepth ); … … 2226 2248 } 2227 2249 rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth ); 2250 #if MTK_SINGLE_DEPTH_MODE_I0095 2251 rpcTempCU->setSingleDepthFlagSubParts( false, 0, uhDepth ); 2252 #endif 2228 2253 rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth ); 2229 2254 rpcTempCU->setCbfSubParts( 1, 1, 1, 0, uhDepth ); … … 2320 2345 } 2321 2346 } 2322 2347 #if MTK_SINGLE_DEPTH_MODE_I0095 2348 Void TEncCu::xCheckRDCostSingleDepth( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize eSize ) 2349 { 2350 UInt uiDepth = rpcTempCU->getDepth( 0 ); 2351 if( !rpcBestCU->getSlice()->getIsDepth() || (eSize != SIZE_2Nx2N)) 2352 { 2353 return; 2354 } 2355 2356 #if H_3D_VSO // M5 2357 if( m_pcRdCost->getUseRenModel() ) 2358 { 2359 UInt uiWidth = m_ppcOrigYuv[uiDepth]->getWidth (); 2360 UInt uiHeight = m_ppcOrigYuv[uiDepth]->getHeight (); 2361 Pel* piSrc = m_ppcOrigYuv[uiDepth]->getLumaAddr(); 2362 UInt uiSrcStride = m_ppcOrigYuv[uiDepth]->getStride (); 2363 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 2364 } 2365 #endif 2366 2367 rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth ); 2368 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); 2369 rpcTempCU->setPredModeSubParts( MODE_INTRA, 0, uiDepth ); 2370 rpcTempCU->setCUTransquantBypassSubParts( rpcTempCU->getCUTransquantBypass(0), 0, uiDepth ); 2371 2372 rpcTempCU->setTrIdxSubParts(0, 0, uiDepth); 2373 rpcTempCU->setCbfSubParts(0, 1, 1, 0, uiDepth); 2374 rpcTempCU->setSingleDepthFlagSubParts(true, 0, uiDepth); 2375 rpcTempCU->setLumaIntraDirSubParts (DC_IDX, 0, uiDepth); 2376 #if H_3D_DIM_SDC 2377 rpcTempCU->setSDCFlagSubParts( false, 0, uiDepth); 2378 #endif 2379 2380 UInt uiPreCalcDistC; 2381 m_pcPredSearch ->estIntraPredSingleDepth ( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth], uiPreCalcDistC, false ); 2382 2383 2384 m_ppcRecoYuvTemp[uiDepth]->copyToPicLuma(rpcTempCU->getPic()->getPicYuvRec(), rpcTempCU->getAddr(), rpcTempCU->getZorderIdxInCU() ); 2385 2386 2387 m_pcEntropyCoder->resetBits(); 2388 if ( rpcTempCU->getSlice()->getPPS()->getTransquantBypassEnableFlag()) 2389 { 2390 m_pcEntropyCoder->encodeCUTransquantBypassFlag( rpcTempCU, 0, true ); 2391 } 2392 m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0, true ); 2393 m_pcEntropyCoder->encodeSingleDepthMode( rpcTempCU, 0, true ); 2394 2395 2396 m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]); 2397 2398 rpcTempCU->getTotalBits() = m_pcEntropyCoder->getNumberOfWrittenBits(); 2399 rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 2400 2401 2402 #if H_3D_VSO // M6 2403 if( m_pcRdCost->getUseLambdaScaleVSO()) 2404 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 2405 else 2406 #endif 2407 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 2408 2409 2410 xCheckDQP( rpcTempCU ); 2411 xCheckBestMode(rpcBestCU, rpcTempCU, uiDepth); 2412 } 2413 #endif 2323 2414 Void TEncCu::xCheckRDCostInterDBBP( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bUseMRG ) 2324 2415 { … … 2463 2554 2464 2555 rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth ); 2465 2556 #if MTK_SINGLE_DEPTH_MODE_I0095 2557 rpcTempCU->setSingleDepthFlagSubParts( false, 0, uiDepth ); 2558 #endif 2466 2559 rpcTempCU->setPartSizeSubParts( eSize, 0, uiDepth ); 2467 2560 rpcTempCU->setPredModeSubParts( MODE_INTRA, 0, uiDepth ); … … 2488 2581 } 2489 2582 m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0, true ); 2583 #if MTK_SINGLE_DEPTH_MODE_I0095 2584 m_pcEntropyCoder->encodeSingleDepthMode( rpcTempCU, 0, true ); 2585 if(!rpcTempCU->getSingleDepthFlag(0)) 2586 { 2587 #endif 2490 2588 m_pcEntropyCoder->encodePredMode( rpcTempCU, 0, true ); 2491 2589 m_pcEntropyCoder->encodePartSize( rpcTempCU, 0, uiDepth, true ); … … 2500 2598 m_pcEntropyCoder->encodeCoeff( rpcTempCU, 0, uiDepth, rpcTempCU->getWidth (0), rpcTempCU->getHeight(0), bCodeDQP ); 2501 2599 setdQPFlag( bCodeDQP ); 2502 2600 #if MTK_SINGLE_DEPTH_MODE_I0095 2601 } 2602 #endif 2503 2603 m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]); 2504 2604 … … 2528 2628 2529 2629 rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth ); 2530 2630 #if MTK_SINGLE_DEPTH_MODE_I0095 2631 rpcTempCU->setSingleDepthFlagSubParts( false, 0, uiDepth ); 2632 #endif 2531 2633 rpcTempCU->setIPCMFlag(0, true); 2532 2634 rpcTempCU->setIPCMFlagSubParts (true, 0, rpcTempCU->getDepth(0)); … … 2545 2647 } 2546 2648 m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0, true ); 2649 #if MTK_SINGLE_DEPTH_MODE_I0095 2650 m_pcEntropyCoder->encodeSingleDepthMode( rpcTempCU, 0, true ); 2651 #endif 2547 2652 m_pcEntropyCoder->encodePredMode ( rpcTempCU, 0, true ); 2548 2653 m_pcEntropyCoder->encodePartSize ( rpcTempCU, 0, uiDepth, true ); -
branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibEncoder/TEncCu.h
r872 r983 159 159 Void xCheckRDCostInterDBBP( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bUseMRG = false ); 160 160 #endif 161 #if MTK_SINGLE_DEPTH_MODE_I0095 162 Void xCheckRDCostSingleDepth ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize ); 163 #endif 161 164 Void xCheckRDCostIntra ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize ); 162 165 Void xCheckDQP ( TComDataCU* pcCU ); -
branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibEncoder/TEncEntropy.cpp
r976 r983 119 119 m_pcEntropyCoderIf->codeSkipFlag( pcCU, uiAbsPartIdx ); 120 120 } 121 121 #if MTK_SINGLE_DEPTH_MODE_I0095 122 Void TEncEntropy::encodeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD ) 123 { 124 if ( !pcCU->getSlice()->getIsDepth() ) 125 { 126 return; 127 } 128 if(!pcCU->getSlice()->getApplySingleDepthMode()) 129 { 130 return; 131 } 132 133 if( bRD ) 134 { 135 uiAbsPartIdx = 0; 136 } 137 m_pcEntropyCoderIf->codeSingleDepthMode( pcCU, uiAbsPartIdx ); 138 } 139 #endif 122 140 /** encode merge flag 123 141 * \param pcCU -
branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibEncoder/TEncEntropy.h
r884 r983 86 86 virtual Void codeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 87 87 virtual Void codeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 88 #if MTK_SINGLE_DEPTH_MODE_I0095 89 virtual Void codeSingleDepthMode ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 90 #endif 88 91 virtual Void codeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 89 92 virtual Void codeMergeIndex ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; … … 171 174 Void encodeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 172 175 Void encodeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 176 #if MTK_SINGLE_DEPTH_MODE_I0095 177 Void encodeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD=false ); 178 #endif 173 179 Void encodePUWise ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 174 180 Void encodeInterDirPU ( TComDataCU* pcSubCU, UInt uiAbsPartIdx ); -
branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibEncoder/TEncGOP.cpp
r976 r983 934 934 pcSlice->setRefPicList ( rcListPic ); 935 935 #endif 936 936 #if MTK_SINGLE_DEPTH_MODE_I0095 937 TEncTop* pcEncTop = (TEncTop*) m_pcCfg; 938 bool enableSingleDepthMode=false; 939 if(pcEncTop->getUseSingleDepthMode()) 940 { 941 if(pcSlice->getIsDepth()) 942 { 943 enableSingleDepthMode=true; 944 } 945 } 946 pcSlice->setApplySingleDepthMode(enableSingleDepthMode); 947 #endif 937 948 #if H_3D_ARP 938 949 //GT: This seems to be broken when layerId in vps is not equal to layerId in nuh -
branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibEncoder/TEncSbac.cpp
r976 r983 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_I0095 61 , 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 #endif 60 64 , m_cCUMergeFlagExtSCModel ( 1, 1, NUM_MERGE_FLAG_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels) 61 65 , m_cCUMergeIdxExtSCModel ( 1, 1, NUM_MERGE_IDX_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels) … … 130 134 131 135 m_cCUSkipFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SKIP_FLAG ); 136 #if MTK_SINGLE_DEPTH_MODE_I0095 137 m_cCUSingleDepthFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SINGLEDEPTH_FLAG ); 138 m_cSingleDepthValueSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SINGLE_DEPTH_VALUE_DATA ); 139 #endif 132 140 m_cCUMergeFlagExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_FLAG_EXT); 133 141 m_cCUMergeIdxExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_IDX_EXT); … … 206 214 curCost = m_cCUSplitFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SPLIT_FLAG ); 207 215 curCost += m_cCUSkipFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SKIP_FLAG ); 216 #if MTK_SINGLE_DEPTH_MODE_I0095 217 curCost += m_cCUSingleDepthFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SINGLEDEPTH_FLAG ); 218 curCost += m_cSingleDepthValueSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SINGLE_DEPTH_VALUE_DATA ); 219 #endif 208 220 curCost += m_cCUMergeFlagExtSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_MERGE_FLAG_EXT); 209 221 curCost += m_cCUMergeIdxExtSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_MERGE_IDX_EXT); … … 275 287 276 288 m_cCUSkipFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SKIP_FLAG ); 289 #if MTK_SINGLE_DEPTH_MODE_I0095 290 m_cCUSingleDepthFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SINGLEDEPTH_FLAG ); 291 m_cSingleDepthValueSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SINGLE_DEPTH_VALUE_DATA ); 292 #endif 277 293 m_cCUMergeFlagExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_FLAG_EXT); 278 294 m_cCUMergeIdxExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_IDX_EXT); … … 434 450 m_pcBinIf->encodeBinsEP( bins, numBins ); 435 451 } 436 452 #if MTK_SINGLE_DEPTH_MODE_I0095 453 Void TEncSbac::codeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx ) 454 { 455 UInt uiSymbol = pcCU->getSingleDepthFlag(uiAbsPartIdx ) ? 1 : 0; 456 m_pcBinIf->encodeBin( uiSymbol, m_cCUSingleDepthFlagSCModel.get( 0, 0, 0 ) ); 457 if(uiSymbol) 458 { 459 UInt uiUnaryIdx = (UInt) pcCU->getSingleDepthValue(uiAbsPartIdx); 460 UInt uiNumCand = MTK_SINGLE_DEPTH_MODE_CANDIDATE_LIST_SIZE; 461 if ( uiNumCand > 1 ) 462 { 463 for( UInt ui = 0; ui < uiNumCand - 1; ++ui ) 464 { 465 const UInt uiSymbol2 = ui == uiUnaryIdx ? 0 : 1; 466 if ( ui==0 ) 467 { 468 m_pcBinIf->encodeBin( uiSymbol2, m_cSingleDepthValueSCModel.get( 0, 0, 0 ) ); 469 } 470 else 471 { 472 m_pcBinIf->encodeBinEP( uiSymbol2 ); 473 } 474 if( uiSymbol2 == 0 ) 475 { 476 break; 477 } 478 } 479 } 480 } 481 } 482 #endif 437 483 /** Coding of coeff_abs_level_minus3 438 484 * \param uiSymbol value of coeff_abs_level_minus3 -
branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibEncoder/TEncSbac.h
r976 r983 153 153 Void codeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ); 154 154 Void codeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 155 #if MTK_SINGLE_DEPTH_MODE_I0095 156 Void codeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx ); 157 #endif 155 158 Void codeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 156 159 Void codeMergeIndex ( TComDataCU* pcCU, UInt uiAbsPartIdx ); … … 219 222 ContextModel3DBuffer m_cCUSplitFlagSCModel; 220 223 ContextModel3DBuffer m_cCUSkipFlagSCModel; 224 #if MTK_SINGLE_DEPTH_MODE_I0095 225 ContextModel3DBuffer m_cCUSingleDepthFlagSCModel; 226 ContextModel3DBuffer m_cSingleDepthValueSCModel; 227 #endif 221 228 ContextModel3DBuffer m_cCUMergeFlagExtSCModel; 222 229 ContextModel3DBuffer m_cCUMergeIdxExtSCModel; -
branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibEncoder/TEncSearch.cpp
r976 r983 915 915 } 916 916 m_pcEntropyCoder->encodeSkipFlag( pcCU, 0, true ); 917 #if MTK_SINGLE_DEPTH_MODE_I0095 918 m_pcEntropyCoder->encodeSingleDepthMode(pcCU, 0, true ); 919 if(!pcCU->getSingleDepthFlag(uiAbsPartIdx)) 920 #endif 917 921 m_pcEntropyCoder->encodePredMode( pcCU, 0, true ); 918 922 } 919 923 #if MTK_SINGLE_DEPTH_MODE_I0095 924 else 925 { 926 m_pcEntropyCoder->encodeSingleDepthMode(pcCU, 0, true ); 927 } 928 #endif 929 #if MTK_SINGLE_DEPTH_MODE_I0095 930 if(!pcCU->getSingleDepthFlag(uiAbsPartIdx)) 931 { 932 #endif 920 933 m_pcEntropyCoder ->encodePartSize( pcCU, 0, pcCU->getDepth(0), true ); 921 934 … … 932 945 } 933 946 } 934 } 947 #if MTK_SINGLE_DEPTH_MODE_I0095 948 } 949 #endif 950 } 951 #if MTK_SINGLE_DEPTH_MODE_I0095 952 if(!pcCU->getSingleDepthFlag(uiAbsPartIdx)) 953 { 954 #endif 935 955 // luma prediction mode 936 956 if( pcCU->getPartitionSize(0) == SIZE_2Nx2N ) … … 975 995 } 976 996 } 977 997 #if MTK_SINGLE_DEPTH_MODE_I0095 998 } 999 #endif 978 1000 } 979 1001 if( bChroma ) … … 1837 1859 dRDCost += dSingleCost; 1838 1860 } 1839 1861 #if MTK_SINGLE_DEPTH_MODE_I0095 1862 Void TEncSearch::xIntraCodingSingleDepth( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Int iTestDepthIdx, Pel *DepthNeighbor ) 1863 { 1864 UInt uiWidth = pcCU ->getWidth ( 0 ); 1865 UInt uiHeight = pcCU ->getHeight ( 0 ); 1866 UInt uiStride = pcOrgYuv ->getStride (); 1867 Pel* piOrg = pcOrgYuv ->getLumaAddr( uiAbsPartIdx ); 1868 Pel* piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx ); 1869 1870 AOF( uiWidth == uiHeight ); 1871 AOF( uiAbsPartIdx == 0 ); 1872 pcCU->setSingleDepthValueSubParts((Pel)iTestDepthIdx,uiAbsPartIdx, 0, pcCU->getDepth(0)); 1873 //===== reconstruction ===== 1874 1875 for( UInt uiY = 0; uiY < uiHeight; uiY++ ) 1876 { 1877 for( UInt uiX = 0; uiX < uiWidth; uiX++ ) 1878 { 1879 piPred[ uiX ] = DepthNeighbor[iTestDepthIdx]; 1880 } 1881 piPred += uiStride; 1882 } 1883 1884 // clear UV 1885 UInt uiStrideC = pcPredYuv->getCStride(); 1886 Pel *pRecCb = pcPredYuv->getCbAddr(); 1887 Pel *pRecCr = pcPredYuv->getCrAddr(); 1888 1889 for (Int y=0; y<uiHeight/2; y++) 1890 { 1891 for (Int x=0; x<uiWidth/2; x++) 1892 { 1893 pRecCb[x] = 1<<(g_bitDepthC-1); 1894 pRecCr[x] = 1<<(g_bitDepthC-1); 1895 } 1896 1897 pRecCb += uiStrideC; 1898 pRecCr += uiStrideC; 1899 } 1900 1901 piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx ); 1902 //===== determine distortion ===== 1903 #if H_3D_VSO 1904 if ( m_pcRdCost->getUseVSO() ) 1905 ruiDist = m_pcRdCost->getDistPartVSO ( pcCU, uiAbsPartIdx, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, false ); 1906 else 1907 #endif 1908 ruiDist = m_pcRdCost->getDistPart(g_bitDepthY, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight ); 1909 1910 //===== determine rate and r-d cost ===== 1911 m_pcEntropyCoder->resetBits(); 1912 m_pcEntropyCoder->encodeSingleDepthMode( pcCU, 0, true ); 1913 UInt uiBits = m_pcEntropyCoder->getNumberOfWrittenBits(); 1914 1915 #if H_3D_VSO 1916 if ( m_pcRdCost->getUseLambdaScaleVSO()) 1917 dRDCost = m_pcRdCost->calcRdCostVSO( uiBits, ruiDist ); 1918 else 1919 #endif 1920 dRDCost = m_pcRdCost->calcRdCost( uiBits, ruiDist ); 1921 } 1922 #endif 1840 1923 #if H_3D_DIM_SDC 1841 1924 Void TEncSearch::xIntraCodingSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Bool bZeroResidual, Int iSDCDeltaResi ) … … 2777 2860 pcCU->setChromIntraDirSubParts( uiBestMode, 0, pcCU->getDepth( 0 ) ); 2778 2861 } 2779 2862 #if MTK_SINGLE_DEPTH_MODE_I0095 2863 Void 2864 TEncSearch::estIntraPredSingleDepth( TComDataCU* pcCU, 2865 TComYuv* pcOrgYuv, 2866 TComYuv* pcPredYuv, 2867 TComYuv* pcResiYuv, 2868 TComYuv* pcRecoYuv, 2869 UInt& ruiDistC, 2870 Bool bLumaOnly ) 2871 { 2872 UInt uiDepth = pcCU->getDepth(0); 2873 UInt uiWidth = pcCU->getWidth (0); 2874 UInt uiHeight = pcCU->getHeight(0); 2875 2876 2877 Pel* piOrg = pcOrgYuv ->getLumaAddr( 0, uiWidth ); 2878 UInt uiStride = pcPredYuv->getStride(); 2879 2880 Int index=0; 2881 Pel testDepth; 2882 Pel DepthNeighbours[5]; 2883 //construction of depth candidates 2884 for( Int i = 0; (i < 5) && (index<MTK_SINGLE_DEPTH_MODE_CANDIDATE_LIST_SIZE) ; i++ ) 2885 { 2886 if(!pcCU->getNeighDepth (0, 0, &testDepth, i)) 2887 { 2888 continue; 2889 } 2890 DepthNeighbours[index]=testDepth; 2891 index++; 2892 for(Int j=0;j<index-1;j++) 2893 { 2894 if( (DepthNeighbours[index-1]==DepthNeighbours[j])) 2895 { 2896 index--; 2897 break; 2898 } 2899 } 2900 } 2901 2902 if(index==0) 2903 { 2904 DepthNeighbours[index]=1<<(g_bitDepthY-1); 2905 index++; 2906 } 2907 2908 if(index==1) 2909 { 2910 DepthNeighbours[index]=ClipY(DepthNeighbours[0] + 1 ); 2911 index++; 2912 } 2913 2914 2915 Dist uiDist = 0; 2916 Double dCost = 0.0; 2917 Dist uiBestDist = 0; 2918 Double dBestCost = MAX_DOUBLE; 2919 Pel pBestSingleDepthValue = 0; 2920 2921 for( Int testdepthidx = 0; testdepthidx < index ; testdepthidx++ ) 2922 { 2923 // set context models 2924 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] ); 2925 2926 // determine residual for partition 2927 uiDist = 0; 2928 dCost = 0.0; 2929 #if H_3D_VSO // M36 2930 if( m_pcRdCost->getUseRenModel() ) 2931 { 2932 m_pcRdCost->setRenModelData( pcCU, 0, piOrg, uiStride, uiWidth, uiHeight ); 2933 } 2934 #endif 2935 xIntraCodingSingleDepth(pcCU, 0, pcOrgYuv, pcPredYuv, uiDist, dCost, testdepthidx, DepthNeighbours); 2936 // check r-d cost 2937 if( dCost < dBestCost ) 2938 { 2939 uiBestDist = uiDist; 2940 dBestCost = dCost; 2941 pBestSingleDepthValue = pcCU->getSingleDepthValue(0); 2942 // copy reconstruction 2943 pcPredYuv->copyPartToPartYuv(pcRecoYuv, 0, uiWidth, uiHeight); 2944 } 2945 } // depth index loop 2946 2947 2948 pcCU->setSingleDepthValueSubParts((Pel)pBestSingleDepthValue,0, 0, uiDepth); 2949 assert(pBestSingleDepthValue>=0); 2950 2951 //===== reset context models ===== 2952 m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]); 2953 2954 //===== set distortion (rate and r-d costs are determined later) ===== 2955 pcCU->getTotalDistortion() = uiBestDist; 2956 } 2957 2958 #endif 2780 2959 Void 2781 2960 TEncSearch::estIntraPredQT( TComDataCU* pcCU, … … 6981 7160 } 6982 7161 m_pcEntropyCoder->encodeSkipFlag ( pcCU, 0, true ); 7162 #if MTK_SINGLE_DEPTH_MODE_I0095 7163 m_pcEntropyCoder->encodeSingleDepthMode ( pcCU, 0, true ); 7164 #endif 6983 7165 m_pcEntropyCoder->encodePredMode( pcCU, 0, true ); 6984 7166 m_pcEntropyCoder->encodePartSize( pcCU, 0, pcCU->getDepth(0), true ); -
branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibEncoder/TEncSearch.h
r884 r983 187 187 TComYuv* pcRecoYuv, 188 188 UInt uiPreCalcDistC ); 189 189 #if MTK_SINGLE_DEPTH_MODE_I0095 190 Void estIntraPredSingleDepth ( TComDataCU* pcCU, 191 TComYuv* pcOrgYuv, 192 TComYuv* pcPredYuv, 193 TComYuv* pcResiYuv, 194 TComYuv* pcRecoYuv, 195 UInt& ruiDistC, 196 Bool bLumaOnly ); 197 #endif 190 198 191 199 /// encoder estimation - inter prediction (non-skip) … … 342 350 UInt uiAbsPartIdx, 343 351 UInt stateU0V1Both2 ); 344 352 #if MTK_SINGLE_DEPTH_MODE_I0095 353 Void xIntraCodingSingleDepth( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Int iTestDepthIdx, Pel * DepthNeighbor ); 354 #endif 345 355 #if H_3D_DIM 346 356 // -------------------------------------------------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.