Changeset 1390 in 3DVCSoftware for branches/HTM-16.0-MV-draft-5/source/Lib/TLibDecoder/TDecTop.cpp
- Timestamp:
- 13 Nov 2015, 17:00:20 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-16.0-MV-draft-5/source/Lib/TLibDecoder/TDecTop.cpp
r1386 r1390 44 44 //! \{ 45 45 46 #if NH_3D47 CamParsCollector::CamParsCollector()48 : m_bInitialized( false )49 {50 m_aaiCodedOffset = new Int* [ MAX_NUM_LAYERS ];51 m_aaiCodedScale = new Int* [ MAX_NUM_LAYERS ];52 for( UInt uiId = 0; uiId < MAX_NUM_LAYERS; uiId++ )53 {54 m_aaiCodedOffset [ uiId ] = new Int [ MAX_NUM_LAYERS ];55 m_aaiCodedScale [ uiId ] = new Int [ MAX_NUM_LAYERS ];56 }57 58 xCreateLUTs( (UInt)MAX_NUM_LAYERS, (UInt)MAX_NUM_LAYERS, m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );59 m_iLog2Precision = LOG2_DISP_PREC_LUT;60 m_uiBitDepthForLUT = 8; // fixed61 m_receivedIdc = NULL;62 m_vps = NULL;63 }64 65 CamParsCollector::~CamParsCollector()66 {67 for( UInt uiId = 0; uiId < MAX_NUM_LAYERS; uiId++ )68 {69 delete [] m_aaiCodedOffset [ uiId ];70 delete [] m_aaiCodedScale [ uiId ];71 }72 delete [] m_aaiCodedOffset;73 delete [] m_aaiCodedScale;74 75 xDeleteArray( m_adBaseViewShiftLUT, MAX_NUM_LAYERS, MAX_NUM_LAYERS, 2 );76 xDeleteArray( m_aiBaseViewShiftLUT, MAX_NUM_LAYERS, MAX_NUM_LAYERS, 2 );77 if ( m_receivedIdc != NULL )78 {79 xDeleteArray( m_receivedIdc, m_vps->getNumViews() );80 }81 }82 83 84 Void85 CamParsCollector::init( const TComVPS* vps)86 {87 assert( !isInitialized() ); // Only one initialization currently supported88 m_bInitialized = true;89 m_vps = vps;90 m_bCamParsVaryOverTime = false;91 m_lastPoc = -1;92 m_firstReceivedPoc = -2;93 94 for (Int i = 0; i <= vps->getMaxLayersMinus1(); i++)95 {96 Int curViewIdxInVps = m_vps->getVoiInVps( m_vps->getViewIndex( m_vps->getLayerIdInNuh( i ) ) ) ;97 m_bCamParsVaryOverTime = m_bCamParsVaryOverTime || vps->getCpInSliceSegmentHeaderFlag( curViewIdxInVps );98 }99 100 assert( m_receivedIdc == NULL );101 m_receivedIdc = new Int*[ m_vps->getNumViews() ];102 for (Int i = 0; i < m_vps->getNumViews(); i++)103 {104 m_receivedIdc[i] = new Int[ m_vps->getNumViews() ];105 }106 107 xResetReceivedIdc( true );108 109 for (Int voiInVps = 0; voiInVps < m_vps->getNumViews(); voiInVps++ )110 {111 if( !m_vps->getCpInSliceSegmentHeaderFlag( voiInVps ) )112 {113 for (Int baseVoiInVps = 0; baseVoiInVps < m_vps->getNumViews(); baseVoiInVps++ )114 {115 if( m_vps->getCpPresentFlag( voiInVps, baseVoiInVps ) )116 {117 m_receivedIdc [ baseVoiInVps ][ voiInVps ] = -1;118 m_aaiCodedScale [ baseVoiInVps ][ voiInVps ] = m_vps->getCodedScale (voiInVps) [ baseVoiInVps ];119 m_aaiCodedOffset[ baseVoiInVps ][ voiInVps ] = m_vps->getCodedOffset (voiInVps) [ baseVoiInVps ];120 121 m_receivedIdc [ voiInVps ][ baseVoiInVps ] = -1;122 m_aaiCodedScale [ voiInVps ][ baseVoiInVps ] = m_vps->getInvCodedScale (voiInVps) [ baseVoiInVps ];123 m_aaiCodedOffset[ voiInVps ][ baseVoiInVps ] = m_vps->getInvCodedOffset(voiInVps) [ baseVoiInVps ];124 xInitLUTs( baseVoiInVps, voiInVps, m_aaiCodedScale[ baseVoiInVps ][ voiInVps ], m_aaiCodedOffset[ baseVoiInVps ][ voiInVps ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );125 xInitLUTs( voiInVps, baseVoiInVps, m_aaiCodedScale[ voiInVps ][ baseVoiInVps ], m_aaiCodedOffset[ voiInVps ][ baseVoiInVps ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );126 }127 }128 }129 }130 }131 132 Void133 CamParsCollector::xResetReceivedIdc( Bool overWriteFlag )134 {135 for (Int i = 0; i < m_vps->getNumViews(); i++)136 {137 for (Int j = 0; j < m_vps->getNumViews(); j++)138 {139 if ( overWriteFlag || ( m_receivedIdc[i][j] != -1 ) )140 {141 m_receivedIdc[i][j] = 0;142 }143 }144 }145 }146 147 148 Void149 CamParsCollector::xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT)150 {151 152 uiNumberSourceViews = std::max( (UInt) 1, uiNumberSourceViews );153 uiNumberTargetViews = std::max( (UInt) 1, uiNumberTargetViews );154 155 radLUT = new Double***[ uiNumberSourceViews ];156 raiLUT = new Int ***[ uiNumberSourceViews ];157 158 for( UInt uiSourceView = 0; uiSourceView < uiNumberSourceViews; uiSourceView++ )159 {160 radLUT [ uiSourceView ] = new Double**[ uiNumberTargetViews ];161 raiLUT [ uiSourceView ] = new Int **[ uiNumberTargetViews ];162 163 for( UInt uiTargetView = 0; uiTargetView < uiNumberTargetViews; uiTargetView++ )164 {165 radLUT [ uiSourceView ][ uiTargetView ] = new Double*[ 2 ];166 radLUT [ uiSourceView ][ uiTargetView ][ 0 ] = new Double [ 257 ];167 radLUT [ uiSourceView ][ uiTargetView ][ 1 ] = new Double [ 257 ];168 169 raiLUT [ uiSourceView ][ uiTargetView ] = new Int* [ 2 ];170 raiLUT [ uiSourceView ][ uiTargetView ][ 0 ] = new Int [ 257 ];171 raiLUT [ uiSourceView ][ uiTargetView ][ 1 ] = new Int [ 257 ];172 }173 }174 }175 176 Void177 CamParsCollector::xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Double****& radLUT, Int****& raiLUT)178 {179 Int iLog2DivLuma = m_uiBitDepthForLUT + m_vps->getCpPrecision() + 1 - m_iLog2Precision; AOF( iLog2DivLuma > 0 );180 Int iLog2DivChroma = iLog2DivLuma + 1;181 182 iOffset <<= m_uiBitDepthForLUT;183 184 Double dScale = (Double) iScale / (( Double ) ( 1 << iLog2DivLuma ));185 Double dOffset = (Double) iOffset / (( Double ) ( 1 << iLog2DivLuma ));186 187 // offsets including rounding offsets188 Int64 iOffsetLuma = iOffset + ( ( 1 << iLog2DivLuma ) >> 1 );189 Int64 iOffsetChroma = iOffset + ( ( 1 << iLog2DivChroma ) >> 1 );190 191 192 for( UInt uiDepthValue = 0; uiDepthValue < 256; uiDepthValue++ )193 {194 195 // real-valued look-up tables196 Double dShiftLuma = ( (Double)uiDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision );197 Double dShiftChroma = dShiftLuma / 2;198 radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = dShiftLuma;199 radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = dShiftChroma;200 201 // integer-valued look-up tables202 Int64 iTempScale = (Int64)uiDepthValue * iScale;203 Int64 iShiftLuma = ( iTempScale + iOffsetLuma ) >> iLog2DivLuma;204 Int64 iShiftChroma = ( iTempScale + iOffsetChroma ) >> iLog2DivChroma;205 raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = (Int)iShiftLuma;206 raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = (Int)iShiftChroma;207 }208 209 radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ];210 radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ];211 raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ];212 raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ];213 }214 215 Void216 CamParsCollector::uninit()217 {218 m_bInitialized = false;219 }220 221 Void CamParsCollector::setSlice( const TComSlice* pcSlice )222 {223 if( pcSlice == 0 )224 {225 xOutput( m_lastPoc );226 return;227 }228 229 #if !H_3D_FCO230 if ( pcSlice->getIsDepth())231 {232 return;233 }234 #endif235 236 Int curPoc = pcSlice->getPOC();237 if( m_firstReceivedPoc == -2 )238 {239 m_firstReceivedPoc = curPoc;240 }241 242 Bool newPocFlag = ( m_lastPoc != curPoc );243 244 if ( newPocFlag )245 {246 if( m_lastPoc != -1 )247 {248 xOutput( m_lastPoc );249 }250 251 xResetReceivedIdc( false );252 m_lastPoc = pcSlice->getPOC();253 }254 255 UInt voiInVps = m_vps->getVoiInVps(pcSlice->getViewIndex());256 if( m_vps->getCpInSliceSegmentHeaderFlag( voiInVps ) ) // check consistency of slice parameters here257 {258 for( Int baseVoiInVps = 0; baseVoiInVps < m_vps->getNumViews(); baseVoiInVps++ )259 {260 if ( m_vps->getCpPresentFlag( voiInVps, baseVoiInVps ) )261 {262 if ( m_receivedIdc[ voiInVps ][ baseVoiInVps ] != 0 )263 {264 AOF( m_aaiCodedScale [ voiInVps ][ baseVoiInVps ] == pcSlice->getInvCodedScale () [ baseVoiInVps ] );265 AOF( m_aaiCodedOffset[ voiInVps ][ baseVoiInVps ] == pcSlice->getInvCodedOffset() [ baseVoiInVps ] );266 }267 else268 {269 m_receivedIdc [ voiInVps ][ baseVoiInVps ] = 1;270 m_aaiCodedScale [ voiInVps ][ baseVoiInVps ] = pcSlice->getInvCodedScale () [ baseVoiInVps ];271 m_aaiCodedOffset[ voiInVps ][ baseVoiInVps ] = pcSlice->getInvCodedOffset() [ baseVoiInVps ];272 xInitLUTs( voiInVps, baseVoiInVps, m_aaiCodedScale[ voiInVps ][ baseVoiInVps ], m_aaiCodedOffset[ voiInVps ][ baseVoiInVps ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT);273 }274 if ( m_receivedIdc[ baseVoiInVps ][ voiInVps ] != 0 )275 {276 AOF( m_aaiCodedScale [ baseVoiInVps ][ voiInVps ] == pcSlice->getCodedScale () [ baseVoiInVps ] );277 AOF( m_aaiCodedOffset[ baseVoiInVps ][ voiInVps ] == pcSlice->getCodedOffset () [ baseVoiInVps ] );278 }279 else280 {281 m_receivedIdc [ baseVoiInVps ][ voiInVps ] = 1;282 m_aaiCodedScale [ baseVoiInVps ][ voiInVps ] = pcSlice->getCodedScale () [ baseVoiInVps ];283 m_aaiCodedOffset[ baseVoiInVps ][ voiInVps ] = pcSlice->getCodedOffset () [ baseVoiInVps ];284 xInitLUTs( baseVoiInVps, voiInVps, m_aaiCodedScale[ baseVoiInVps ][ voiInVps ], m_aaiCodedOffset[ baseVoiInVps ][ voiInVps ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT);285 }286 }287 }288 }289 }290 291 Void292 CamParsCollector::xOutput( Int iPOC )293 {294 if( m_pCodedScaleOffsetFile )295 {296 if( iPOC == m_firstReceivedPoc )297 {298 fprintf( m_pCodedScaleOffsetFile, "#ViewOrderIdx ViewIdVal\n" );299 fprintf( m_pCodedScaleOffsetFile, "#------------ -------------\n" );300 301 for( UInt voiInVps = 0; voiInVps < m_vps->getNumViews(); voiInVps++ )302 {303 fprintf( m_pCodedScaleOffsetFile, "%13d %13d\n", m_vps->getViewOIdxList( voiInVps ), m_vps->getViewIdVal( m_vps->getViewOIdxList( voiInVps ) ) );304 }305 fprintf( m_pCodedScaleOffsetFile, "\n\n");306 fprintf( m_pCodedScaleOffsetFile, "# StartFrame EndFrame TargetVOI BaseVOI CodedScale CodedOffset Precision\n" );307 fprintf( m_pCodedScaleOffsetFile, "#----------- ------------ ------------ ------------ ------------ ------------ ------------\n" );308 }309 if( iPOC == m_firstReceivedPoc || m_bCamParsVaryOverTime )310 {311 Int iS = iPOC;312 Int iE = ( m_bCamParsVaryOverTime ? iPOC : ~( 1 << 31 ) );313 for( UInt voiInVps = 0; voiInVps < m_vps->getNumViews(); voiInVps++ )314 {315 for( UInt baseVoiInVps = 0; baseVoiInVps < m_vps->getNumViews(); baseVoiInVps++ )316 {317 if( voiInVps != baseVoiInVps )318 {319 if ( m_receivedIdc[baseVoiInVps][voiInVps] != 0 )320 {321 fprintf( m_pCodedScaleOffsetFile, "%12d %12d %12d %12d %12d %12d %12d\n",322 iS, iE, m_vps->getViewOIdxList( voiInVps ), m_vps->getViewOIdxList( baseVoiInVps ),323 m_aaiCodedScale [ baseVoiInVps ][ voiInVps ],324 m_aaiCodedOffset[ baseVoiInVps ][ voiInVps ], m_vps->getCpPrecision() );325 }326 }327 }328 }329 }330 }331 }332 #endif333 46 334 47 … … 393 106 m_viewId = 0; 394 107 395 #if NH_3D396 m_viewIndex = 0;397 m_isDepth = false;398 m_pcCamParsCollector = 0;399 #endif400 108 401 109 m_decodingProcess = CLAUSE_8; … … 735 443 #endif 736 444 737 #if NH_3D738 if ( !m_pcCamParsCollector->isInitialized() )739 {740 m_pcCamParsCollector->init( vps );741 }742 #endif743 445 // Initialise the various objects for the new set of settings 744 446 m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxTotalCUDepth(), pps->getPpsRangeExtension().getLog2SaoOffsetScale(CHANNEL_TYPE_LUMA), pps->getPpsRangeExtension().getLog2SaoOffsetScale(CHANNEL_TYPE_CHROMA) ); … … 1063 765 m_pcPic->setLayerId( nalu.m_nuhLayerId ); 1064 766 m_pcPic->setViewId ( getViewId() ); 1065 #if NH_3D1066 m_pcPic->setViewIndex( getViewIndex() );1067 m_pcPic->setIsDepth ( getIsDepth () );1068 pcSlice->setIvPicLists( m_dpb );1069 #endif1070 767 #endif 1071 768 … … 1105 802 } 1106 803 } 1107 #if NH_3D_NBDV1108 pcSlice->setDefaultRefView();1109 #endif1110 #if NH_3D_ARP1111 pcSlice->setPocsInCurrRPSs();1112 pcSlice->setARPStepNum(m_dpb);1113 #endif1114 804 #endif 1115 805 … … 1155 845 //--------------- 1156 846 pcSlice->setRefPOCList(); 1157 #if NH_3D_TMVP1158 if(pcSlice->getLayerId())1159 {1160 pcSlice->generateAlterRefforTMVP();1161 }1162 #endif1163 847 } 1164 848 … … 1193 877 } 1194 878 1195 #if NH_3D1196 if ( decProcAnnexI() )1197 {1198 pcSlice->checkInCompPredRefLayers();1199 }1200 #endif1201 879 1202 880 // Decode a picture 1203 881 m_cGopDecoder.decompressSlice(&(nalu.getBitstream()), m_pcPic); 1204 882 1205 #if NH_3D1206 if( m_pcCamParsCollector )1207 {1208 m_pcCamParsCollector->setSlice( pcSlice );1209 }1210 #endif1211 883 1212 884 #if !NH_MV … … 1240 912 sps->setForceDecodeBitDepth(m_forceDecodeBitDepth); 1241 913 #endif 1242 #if NH_3D1243 // GT: Please don't add parsing dependency of SPS from VPS here again!!!1244 #endif1245 914 m_cEntropyDecoder.decodeSPS( sps ); 1246 915 m_parameterSetManager.storeSPS(sps, naluData); … … 1252 921 #if NH_MV 1253 922 pps->setLayerId( getLayerId() ); 1254 #endif1255 #if NH_3D_DLT1256 // create mapping from depth layer indexes to layer ids1257 Int j=0;1258 for( Int i=0; i<=m_parameterSetManager.getFirstVPS()->getMaxLayersMinus1(); i++ )1259 {1260 Int layerId = m_parameterSetManager.getFirstVPS()->getLayerIdInNuh(i);1261 if( m_parameterSetManager.getFirstVPS()->getDepthId(layerId) )1262 pps->getDLT()->setDepthIdxToLayerId(j++, layerId);1263 }1264 923 #endif 1265 924 m_cEntropyDecoder.decodePPS( pps ); … … 1806 1465 { 1807 1466 setViewId ( vps->getViewId ( getLayerId() ) ); 1808 #if NH_3D1809 setViewIndex( vps->getViewIndex( getLayerId() ) );1810 setIsDepth ( vps->getDepthId ( getLayerId() ) == 1 );1811 #endif1812 1467 1813 1468 if ( !vps->getVpsExtensionFlag() )
Note: See TracChangeset for help on using the changeset viewer.