Changeset 5 in 3DVCSoftware for trunk/source/Lib/TLibEncoder/TEncSbac.cpp
- Timestamp:
- 12 Dec 2011, 18:35:44 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibEncoder/TEncSbac.cpp
r2 r5 1 /* The copyright in this software is being made available under the BSD 2 * License, included below. This software may be subject to other third party 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2011, ISO/IEC 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are met: 11 * 12 * * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * * Redistributions in binary form must reproduce the above copyright notice, 15 * this list of conditions and the following disclaimer in the documentation 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the ISO/IEC nor the names of its contributors may 18 * be used to endorse or promote products derived from this software without 19 * specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 1 34 2 35 … … 26 59 , m_uiMaxAlfCtrlDepth ( 0 ) 27 60 , m_cCUSplitFlagSCModel ( 1, 1, NUM_SPLIT_FLAG_CTX ) 28 #if MW_MVI_SIGNALLING_MODE == 029 , m_cCUMvInheritanceFlagSCModel(1, 1, NUM_MVI_FLAG_CTX )30 #endif31 61 , m_cCUSkipFlagSCModel ( 1, 1, NUM_SKIP_FLAG_CTX ) 32 62 , m_cCUMergeFlagExtSCModel ( 1, 1, NUM_MERGE_FLAG_EXT_CTX ) … … 72 102 #endif 73 103 , m_cViewIdxSCModel ( 1, 1, NUM_VIEW_IDX_CTX ) 74 #if HHI_DMM_ INTRA104 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 75 105 , m_cIntraDMMSCModel ( 1, 1, NUM_DMM_CTX ) 76 106 , m_cIntraWedgeSCModel ( 1, 1, NUM_WEDGE_CTX ) … … 94 124 95 125 m_cCUSplitFlagSCModel.initBuffer ( eSliceType, iQp, (Short*)INIT_SPLIT_FLAG ); 96 #if MW_MVI_SIGNALLING_MODE == 097 m_cCUMvInheritanceFlagSCModel.initBuffer( eSliceType, iQp, (Short*)INIT_MVI_FLAG );98 #endif99 126 100 127 m_cCUSkipFlagSCModel.initBuffer ( eSliceType, iQp, (Short*)INIT_SKIP_FLAG ); … … 137 164 #endif 138 165 m_cViewIdxSCModel.initBuffer ( eSliceType, iQp, (Short*)INIT_VIEW_IDX ); 139 #if HHI_DMM_ INTRA166 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 140 167 m_cIntraDMMSCModel.initBuffer ( eSliceType, iQp, (Short*)INIT_INTRA_DMM ); 141 168 m_cIntraWedgeSCModel.initBuffer ( eSliceType, iQp, (Short*)INIT_INTRA_WEDGELET ); … … 307 334 return; 308 335 } 309 #if HHI_DMM_ INTRA336 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 310 337 Void TEncSbac::xWriteExGolombLevel( UInt uiSymbol, ContextModel& rcSCModel ) 311 338 { … … 388 415 389 416 this->m_cCUSplitFlagSCModel .copyFrom( &pSrc->m_cCUSplitFlagSCModel ); 390 #if MW_MVI_SIGNALLING_MODE == 0391 this->m_cCUMvInheritanceFlagSCModel.copyFrom( &pSrc->m_cCUMvInheritanceFlagSCModel );392 #endif393 417 this->m_cCUSkipFlagSCModel .copyFrom( &pSrc->m_cCUSkipFlagSCModel ); 394 418 this->m_cCUMergeFlagExtSCModel .copyFrom( &pSrc->m_cCUMergeFlagExtSCModel); … … 421 445 this->m_cMVPIdxSCModel .copyFrom( &pSrc->m_cMVPIdxSCModel ); 422 446 this->m_cViewIdxSCModel .copyFrom( &pSrc->m_cViewIdxSCModel ); 423 #if HHI_DMM_ INTRA447 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 424 448 this->m_cIntraDMMSCModel .copyFrom( &pSrc->m_cIntraDMMSCModel ); 425 449 this->m_cIntraWedgeSCModel .copyFrom( &pSrc->m_cIntraWedgeSCModel ); … … 636 660 637 661 662 #if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI 638 663 Void TEncSbac::codeMergeIndexMV( TComDataCU* pcCU, UInt uiAbsPartIdx ) 639 664 { … … 641 666 Bool abAvailable[ MRG_MAX_NUM_CANDS ]; 642 667 UInt uiNumCand = 0; 643 #if MW_MVI_SIGNALLING_MODE == 1668 #if HHI_MPI 644 669 const Bool bMVIAvailable = pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE; 645 const UInt uiMviMergePos = bMVIAvailable ? MVI_MERGE_POS : MRG_MAX_NUM_CANDS;670 const UInt uiMviMergePos = bMVIAvailable ? HHI_MPI_MERGE_POS : MRG_MAX_NUM_CANDS; 646 671 #endif 647 672 for( UInt uiIdx = 0; uiIdx < MRG_MAX_NUM_CANDS; uiIdx++ ) 648 673 { 649 #if MW_MVI_SIGNALLING_MODE == 1674 #if HHI_MPI 650 675 if( uiIdx == uiMviMergePos ) 651 676 { … … 693 718 //--- determine unary index --- 694 719 UInt uiMergeIdx = pcCU->getMergeIndex( uiAbsPartIdx ); 695 #if MW_MVI_SIGNALLING_MODE == 1720 #if HHI_MPI 696 721 if( bMVIAvailable ) 697 722 { … … 699 724 if( bUseMVI ) 700 725 { 701 uiMergeIdx = MVI_MERGE_POS;702 } 703 else if( uiMergeIdx >= MVI_MERGE_POS )726 uiMergeIdx = HHI_MPI_MERGE_POS; 727 } 728 else if( uiMergeIdx >= HHI_MPI_MERGE_POS ) 704 729 { 705 730 uiMergeIdx++; … … 748 773 DTRACE_CABAC_T( "\n" ); 749 774 } 750 775 #endif 751 776 752 777 … … 758 783 Void TEncSbac::codeMergeIndex( TComDataCU* pcCU, UInt uiAbsPartIdx ) 759 784 { 760 #if MW_MVI_SIGNALLING_MODE == 1 785 #if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI 786 #if HHI_INTER_VIEW_MOTION_PRED && HHI_MPI 761 787 if( ( pcCU->getSlice()->getSPS()->getViewId() > 0 && ( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) == PDM_USE_FOR_MERGE ) || 762 788 ( pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) ) 789 #elif HHI_MPI 790 if( pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) 763 791 #else 764 792 if( pcCU->getSlice()->getSPS()->getViewId() > 0 && ( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) == PDM_USE_FOR_MERGE ) … … 768 796 return; 769 797 } 798 #endif 770 799 771 800 Bool bLeftInvolved = false; … … 884 913 885 914 915 #if HHI_INTER_VIEW_RESIDUAL_PRED 886 916 Void 887 917 TEncSbac::codeResPredFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) … … 891 921 m_pcBinIf->encodeBin( uiSymbol, m_cResPredFlagSCModel.get( 0, 0, uiCtx ) ); 892 922 } 923 #endif 893 924 894 925 … … 907 938 return; 908 939 } 909 910 #if MW_MVI_SIGNALLING_MODE == 0911 Void TEncSbac::codeMvInheritanceFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )912 {913 const Int iTextureModeDepth = pcCU->getTextureModeDepth( uiAbsPartIdx );914 if( iTextureModeDepth != -1 && uiDepth > iTextureModeDepth )915 return;916 917 UInt uiCtx = pcCU->getCtxMvInheritanceFlag( uiAbsPartIdx, uiDepth );918 UInt uiSymbol = iTextureModeDepth == uiDepth ? 1 : 0;919 920 assert( uiCtx < 3 );921 m_pcBinIf->encodeBin( uiSymbol, m_cCUMvInheritanceFlagSCModel.get( 0, 0, uiCtx ) );922 }923 #endif924 940 925 941 Void TEncSbac::codeTransformSubdivFlag( UInt uiSymbol, UInt uiCtx ) … … 935 951 } 936 952 937 #if HHI_DMM_ INTRA953 #if HHI_DMM_WEDGE_INTRA 938 954 Void TEncSbac::xCodeWedgeFullInfo( TComDataCU* pcCU, UInt uiAbsPartIdx ) 939 955 { … … 1031 1047 } 1032 1048 } 1033 1049 #endif 1050 #if HHI_DMM_PRED_TEX 1034 1051 Void TEncSbac::xCodeWedgePredTexDeltaInfo( TComDataCU* pcCU, UInt uiAbsPartIdx ) 1035 1052 { … … 1076 1093 UInt uiDir = pcCU->getLumaIntraDir( uiAbsPartIdx ); 1077 1094 1078 #if HHI_DMM_ INTRA1079 if ( pcCU->getSlice()->getSPS()->isDepth() && pcCU->getSlice()->getSPS()->getUseD epthModelModes() && pcCU->getWidth( uiAbsPartIdx ) < 64 )1095 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 1096 if ( pcCU->getSlice()->getSPS()->isDepth() && pcCU->getSlice()->getSPS()->getUseDMM() && pcCU->getWidth( uiAbsPartIdx ) < 64 ) 1080 1097 { 1081 1098 m_pcBinIf->encodeBin( uiDir > MAX_MODE_ID_INTRA_DIR, m_cIntraDMMSCModel.get(0, 0, 0) ); … … 1086 1103 UInt uiDMMode = uiDir - (MAX_MODE_ID_INTRA_DIR+1); 1087 1104 1088 if( !pcCU->getTextureModeAllowance( uiAbsPartIdx ) ) 1089 { 1105 #if HHI_DMM_WEDGE_INTRA && HHI_DMM_PRED_TEX 1106 m_pcBinIf->encodeBin( (uiDMMode & 0x01), m_cIntraDMMSCModel.get(0, 0, 1) ); 1107 m_pcBinIf->encodeBin( (uiDMMode & 0x02) >> 1, m_cIntraDMMSCModel.get(0, 0, 1) ); 1108 1090 1109 if ( pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_NxN && pcCU->getWidth( uiAbsPartIdx ) > 4 ) 1091 1110 { 1092 if( uiDMMode > 1 ) 1093 { 1094 uiDMMode -= 4; 1111 m_pcBinIf->encodeBin( (uiDMMode & 0x04) >> 2, m_cIntraDMMSCModel.get(0, 0, 1) ); 1095 1112 } 1113 #else 1096 1114 m_pcBinIf->encodeBin( (uiDMMode & 0x01), m_cIntraDMMSCModel.get(0, 0, 1) ); 1097 if( DMM_INTRA_MODE_BITS > 1 ) m_pcBinIf->encodeBin( (uiDMMode & 0x02) >> 1, m_cIntraDMMSCModel.get(0, 0, 1) );1098 }1099 else1100 {1101 m_pcBinIf->encodeBin( (uiDMMode & 0x01), m_cIntraDMMSCModel.get(0, 0, 1) );1102 }1103 }1104 else1105 {1106 m_pcBinIf->encodeBin( (uiDMMode & 0x01), m_cIntraDMMSCModel.get(0, 0, 1) );1107 if( DMM_INTRA_MODE_BITS > 1 ) m_pcBinIf->encodeBin( (uiDMMode & 0x02) >> 1, m_cIntraDMMSCModel.get(0, 0, 1) );1108 1115 1109 1116 if ( pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_NxN && pcCU->getWidth( uiAbsPartIdx ) > 4 ) 1110 1117 { 1111 if( DMM_INTRA_MODE_BITS > 2 ) m_pcBinIf->encodeBin( (uiDMMode & 0x04) >> 2, m_cIntraDMMSCModel.get(0, 0, 1) );1112 } 1113 } 1114 1118 m_pcBinIf->encodeBin( (uiDMMode & 0x02) >> 1, m_cIntraDMMSCModel.get(0, 0, 1) ); 1119 } 1120 #endif 1121 #if HHI_DMM_WEDGE_INTRA 1115 1122 if( uiDir == DMM_WEDGE_FULL_IDX ) { xCodeWedgeFullInfo ( pcCU, uiAbsPartIdx ); } 1116 1123 if( uiDir == DMM_WEDGE_FULL_D_IDX ) { xCodeWedgeFullDeltaInfo ( pcCU, uiAbsPartIdx ); } 1117 1124 if( uiDir == DMM_WEDGE_PREDDIR_IDX ) { xCodeWedgePredDirInfo ( pcCU, uiAbsPartIdx ); } 1118 1125 if( uiDir == DMM_WEDGE_PREDDIR_D_IDX ) { xCodeWedgePredDirDeltaInfo ( pcCU, uiAbsPartIdx ); } 1126 #endif 1127 #if HHI_DMM_PRED_TEX 1119 1128 if( uiDir == DMM_WEDGE_PREDTEX_D_IDX ) { xCodeWedgePredTexDeltaInfo ( pcCU, uiAbsPartIdx ); } 1120 1129 if( uiDir == DMM_CONTOUR_PREDTEX_D_IDX ) { xCodeContourPredTexDeltaInfo( pcCU, uiAbsPartIdx ); } 1130 #endif 1121 1131 } 1122 1132 else … … 1204 1214 { 1205 1215 UInt uiDir = pcCU->getLumaIntraDir( uiAbsPartIdx ); 1206 #if HHI_DMM_ INTRA1207 if ( pcCU->getSlice()->getSPS()->isDepth() && pcCU->getSlice()->getSPS()->getUseD epthModelModes() && pcCU->getWidth( uiAbsPartIdx ) < 64 )1216 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 1217 if ( pcCU->getSlice()->getSPS()->isDepth() && pcCU->getSlice()->getSPS()->getUseDMM() && pcCU->getWidth( uiAbsPartIdx ) < 64 ) 1208 1218 { 1209 1219 m_pcBinIf->encodeBin( uiDir > MAX_MODE_ID_INTRA_DIR, m_cIntraDMMSCModel.get(0, 0, 0) ); … … 1214 1224 UInt uiDMMode = uiDir - (MAX_MODE_ID_INTRA_DIR+1); 1215 1225 1216 if( !pcCU->getTextureModeAllowance( uiAbsPartIdx ) ) 1217 { 1226 #if HHI_DMM_WEDGE_INTRA && HHI_DMM_PRED_TEX 1227 m_pcBinIf->encodeBin( (uiDMMode & 0x01), m_cIntraDMMSCModel.get(0, 0, 1) ); 1228 m_pcBinIf->encodeBin( (uiDMMode & 0x02) >> 1, m_cIntraDMMSCModel.get(0, 0, 1) ); 1229 1218 1230 if ( pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_NxN && pcCU->getWidth( uiAbsPartIdx ) > 4 ) 1219 1231 { 1220 if( uiDMMode > 1 ) 1221 { 1222 uiDMMode -= 4; 1232 m_pcBinIf->encodeBin( (uiDMMode & 0x04) >> 2, m_cIntraDMMSCModel.get(0, 0, 1) ); 1223 1233 } 1234 #else 1224 1235 m_pcBinIf->encodeBin( (uiDMMode & 0x01), m_cIntraDMMSCModel.get(0, 0, 1) ); 1225 if( DMM_INTRA_MODE_BITS > 1 ) m_pcBinIf->encodeBin( (uiDMMode & 0x02) >> 1, m_cIntraDMMSCModel.get(0, 0, 1) );1226 }1227 else1228 {1229 m_pcBinIf->encodeBin( (uiDMMode & 0x01), m_cIntraDMMSCModel.get(0, 0, 1) );1230 }1231 }1232 else1233 {1234 m_pcBinIf->encodeBin( (uiDMMode & 0x01), m_cIntraDMMSCModel.get(0, 0, 1) );1235 if( DMM_INTRA_MODE_BITS > 1 ) m_pcBinIf->encodeBin( (uiDMMode & 0x02) >> 1, m_cIntraDMMSCModel.get(0, 0, 1) );1236 1236 1237 1237 if ( pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_NxN && pcCU->getWidth( uiAbsPartIdx ) > 4 ) 1238 1238 { 1239 if( DMM_INTRA_MODE_BITS > 2 ) m_pcBinIf->encodeBin( (uiDMMode & 0x04) >> 2, m_cIntraDMMSCModel.get(0, 0, 1) );1240 } 1241 } 1242 1239 m_pcBinIf->encodeBin( (uiDMMode & 0x02) >> 1, m_cIntraDMMSCModel.get(0, 0, 1) ); 1240 } 1241 #endif 1242 #if HHI_DMM_WEDGE_INTRA 1243 1243 if( uiDir == DMM_WEDGE_FULL_IDX ) { xCodeWedgeFullInfo ( pcCU, uiAbsPartIdx ); } 1244 1244 if( uiDir == DMM_WEDGE_FULL_D_IDX ) { xCodeWedgeFullDeltaInfo ( pcCU, uiAbsPartIdx ); } 1245 1245 if( uiDir == DMM_WEDGE_PREDDIR_IDX ) { xCodeWedgePredDirInfo ( pcCU, uiAbsPartIdx ); } 1246 1246 if( uiDir == DMM_WEDGE_PREDDIR_D_IDX ) { xCodeWedgePredDirDeltaInfo ( pcCU, uiAbsPartIdx ); } 1247 #endif 1248 #if HHI_DMM_PRED_TEX 1247 1249 if( uiDir == DMM_WEDGE_PREDTEX_D_IDX ) { xCodeWedgePredTexDeltaInfo ( pcCU, uiAbsPartIdx ); } 1248 1250 if( uiDir == DMM_CONTOUR_PREDTEX_D_IDX ) { xCodeContourPredTexDeltaInfo( pcCU, uiAbsPartIdx ); } 1251 #endif 1249 1252 } 1250 1253 else
Note: See TracChangeset for help on using the changeset viewer.