Changeset 56 in 3DVCSoftware for trunk/source/App/TAppDecoder
- Timestamp:
- 11 May 2012, 21:20:17 (13 years ago)
- Location:
- trunk/source/App/TAppDecoder
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/App/TAppDecoder/TAppDecCfg.cpp
r5 r56 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 1,ISO/IEC6 * Copyright (c) 2010-2012, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 15 15 * this list of conditions and the following disclaimer in the documentation 16 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the I SO/IEC nor the names of its contributors may17 * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 18 * be used to endorse or promote products derived from this software without 19 19 * specific prior written permission. … … 32 32 */ 33 33 34 35 36 34 /** \file TAppDecCfg.cpp 37 35 \brief Decoder configuration class … … 42 40 #include <string> 43 41 #include "TAppDecCfg.h" 44 #include " ../../App/TAppCommon/program_options_lite.h"42 #include "TAppCommon/program_options_lite.h" 45 43 46 44 #ifdef WIN32 … … 50 48 using namespace std; 51 49 namespace po = df::program_options_lite; 50 51 //! \ingroup TAppDecoder 52 //! \{ 52 53 53 54 // ==================================================================================================================== … … 72 73 "YUV writing is skipped if omitted") 73 74 ("ScaleOffsetFile,p", cfg_ScaleOffsetFile, string(""), "file with coded scales and offsets") 74 #if DCM_SKIP_DECODING_FRAMES75 75 ("SkipFrames,s", m_iSkipFrame, 0, "number of frames to skip before random access") 76 #endif77 76 ("OutputBitDepth,d", m_outputBitDepth, 0u, "bit depth of YUV output file (use 0 for native depth)") 78 ("SEIpictureDigest", m_pictureDigestEnabled, false, "Control handling of picture_digest SEI messages\n" 77 ("MaxTemporalLayer,t", m_iMaxTemporalLayer, -1, "Maximum Temporal Layer to be decoded. -1 to decode all layers") 78 ("SEIpictureDigest", m_pictureDigestEnabled, true, "Control handling of picture_digest SEI messages\n" 79 79 "\t1: check\n" 80 80 "\t0: ignore") … … 99 99 m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str()); 100 100 m_pchScaleOffsetFile = cfg_ScaleOffsetFile.empty() ? NULL : strdup(cfg_ScaleOffsetFile.c_str()); 101 101 102 102 103 if (!m_pchBitstreamFile) … … 124 125 rpchOutputFileName[iInLength+iAppendLength] = '\0'; 125 126 } 127 128 //! \} -
trunk/source/App/TAppDecoder/TAppDecCfg.h
r5 r56 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 1,ISO/IEC6 * Copyright (c) 2010-2012, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 15 15 * this list of conditions and the following disclaimer in the documentation 16 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the I SO/IEC nor the names of its contributors may17 * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 18 * be used to endorse or promote products derived from this software without 19 19 * specific prior written permission. … … 32 32 */ 33 33 34 35 36 34 /** \file TAppDecCfg.h 37 35 \brief Decoder configuration class (header) … … 45 43 #endif // _MSC_VER > 1000 46 44 47 #include "../../Lib/TLibCommon/CommonDef.h" 45 #include "TLibCommon/CommonDef.h" 46 47 //! \ingroup TAppDecoder 48 //! \{ 48 49 49 50 // ==================================================================================================================== … … 58 59 char* m_pchReconFile; ///< output reconstruction file name 59 60 char* m_pchScaleOffsetFile; ///< output coded scale and offset parameters 60 #if DCM_SKIP_DECODING_FRAMES61 61 Int m_iSkipFrame; ///< counter for frames prior to the random access point to skip 62 #endif63 62 UInt m_outputBitDepth; ///< bit depth used for writing output 64 63 64 Int m_iMaxTemporalLayer; ///< maximum temporal layer to be decoded 65 65 bool m_pictureDigestEnabled; ///< enable(1)/disable(0) acting on SEI picture_digest message 66 66 Void xAppendToFileNameEnd( Char* pchInputFileName, const Char* pchStringToAppend, Char*& rpchOutputFileName); ///< create filenames … … 73 73 }; 74 74 75 //! \} 76 75 77 #endif 76 78 -
trunk/source/App/TAppDecoder/TAppDecTop.cpp
r42 r56 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 1,ISO/IEC6 * Copyright (c) 2010-2012, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 15 15 * this list of conditions and the following disclaimer in the documentation 16 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the I SO/IEC nor the names of its contributors may17 * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 18 * be used to endorse or promote products derived from this software without 19 19 * specific prior written permission. … … 32 32 */ 33 33 34 35 36 34 /** \file TAppDecTop.cpp 37 35 \brief Decoder application class … … 39 37 40 38 #include <list> 39 #include <vector> 41 40 #include <stdio.h> 42 41 #include <fcntl.h> … … 44 43 45 44 #include "TAppDecTop.h" 46 47 // ==================================================================================================================== 48 // Local constants 49 // ==================================================================================================================== 50 51 /// initial bitstream buffer size 52 /// should be large enough for parsing SPS 53 /// resized as a function of picture size after parsing SPS 54 #define BITS_BUF_SIZE 65536 45 #include "TLibDecoder/AnnexBread.h" 46 #include "TLibDecoder/NALread.h" 47 48 //! \ingroup TAppDecoder 49 //! \{ 55 50 56 51 // ==================================================================================================================== … … 61 56 { 62 57 ::memset (m_abDecFlag, 0, sizeof (m_abDecFlag)); 63 m_bUsingDepth = false; 64 // m_iPOCLastDisplay = -1; 65 m_pScaleOffsetFile = 0; 58 m_useDepth = false; 66 59 } 67 60 68 61 Void TAppDecTop::create() 69 62 { 70 m_apcBitstream = new TComBitstream;71 72 m_apcBitstream->create( BITS_BUF_SIZE );73 63 } 74 64 75 65 Void TAppDecTop::destroy() 76 66 { 77 if ( m_apcBitstream )78 {79 m_apcBitstream->destroy();80 delete m_apcBitstream;81 m_apcBitstream = NULL;82 }83 if( m_pchBitstreamFile )84 {85 free(m_pchBitstreamFile);86 }87 if( m_pchReconFile )88 {89 free(m_pchReconFile);90 }91 67 } 92 68 … … 105 81 Void TAppDecTop::decode() 106 82 { 107 TComBitstream* pcBitstream = m_apcBitstream; 108 UInt uiPOC; 109 TComList<TComPic*>* pcListPic; 110 Bool bFirstSliceDecoded = true; 111 112 // create & initialize internal classes 113 xCreateDecLib(); 114 xInitDecLib (); 115 #if DCM_SKIP_DECODING_FRAMES 116 // m_iPOCLastDisplay += m_iSkipFrame; // set the last displayed POC correctly for skip forward. 117 #endif 118 119 // main decoder loop 120 Bool bEos = false; 121 Bool resizedBitstreamBuffer = false; 122 123 Bool bIsDepth = false; 124 Int iViewIdx = 0; 125 TComSPS cComSPS ; 126 NalUnitType eNalUnitType; 127 128 #if FLEX_CODING_ORDER 129 Int iDepthViewIdx = 0; 130 Bool bCountDepthViewIdx = false; // a flag which avoid repeating assign a value to iDepthViewIdx 131 Bool bNewPictureType =true; 132 Bool bFirstDepth = false; 133 #endif 134 135 while ( !bEos ) 136 { 137 streampos lLocation = m_cTVideoIOBitstreamFile.getFileLocation(); 138 bEos = m_cTVideoIOBitstreamFile.readBits( pcBitstream ); 139 if (bEos) 140 { 141 //if (!bFirstSliceDecoded) m_cTDecTop.decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_iPOCLastDisplay); 142 if( bIsDepth ) 143 { 144 #if FLEX_CODING_ORDER 145 if (!bFirstSliceDecoded) m_acTDecDepthTopList[iDepthViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iDepthViewIdx] ,bNewPictureType); 146 m_acTDecDepthTopList[iDepthViewIdx]->executeDeblockAndAlf( bEos, pcBitstream, uiPOC, pcListPic, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iDepthViewIdx]); 147 148 #else 149 if (!bFirstSliceDecoded) m_acTDecDepthTopList[iViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iViewIdx] ); 150 m_acTDecDepthTopList[iViewIdx]->executeDeblockAndAlf( bEos, pcBitstream, uiPOC, pcListPic, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iViewIdx]); 151 #endif 152 } 153 else 154 { 155 #if FLEX_CODING_ORDER 156 if (!bFirstSliceDecoded) m_acTDecTopList[iViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiPOCLastDisplayList[iViewIdx], bNewPictureType); 157 #else 158 if (!bFirstSliceDecoded) m_acTDecTopList[iViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiPOCLastDisplayList[iViewIdx] ); 159 #endif 160 m_acTDecTopList[iViewIdx]->executeDeblockAndAlf( bEos, pcBitstream, uiPOC, pcListPic, m_iSkipFrame, m_aiPOCLastDisplayList[iViewIdx]); 161 } 162 if( pcListPic ) 163 { 164 // write reconstuction to file 165 xWriteOutput( pcListPic ); 166 } 167 break; 168 } 169 170 // call actual decoding function 171 #if DCM_SKIP_DECODING_FRAMES 172 Bool bNewPicture; 173 if( bIsDepth ) 174 #if FLEX_CODING_ORDER 175 bNewPicture = m_acTDecDepthTopList[iDepthViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iDepthViewIdx], bNewPictureType); 176 #else 177 bNewPicture = m_acTDecDepthTopList[iViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iViewIdx] ); 178 #endif 179 else 180 #if FLEX_CODING_ORDER 181 bNewPicture = m_acTDecTopList[iViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiPOCLastDisplayList[iViewIdx], bNewPictureType ); 182 #else 183 bNewPicture = m_acTDecTopList[iViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiPOCLastDisplayList[iViewIdx] ); 184 #endif 185 bFirstSliceDecoded = true; 186 187 #if FLEX_CODING_ORDER 188 if (eNalUnitType == NAL_UNIT_SPS) 189 { 190 if( cComSPS.isDepth() && (m_bUsingDepth==false) ) // expected not using depth, but bitstream are using depth 191 { // know from sps 192 assert( cComSPS.getViewId() == 0 && iDepthViewIdx == 0 && !bIsDepth ); 193 startUsingDepth() ; 194 } 195 if (cComSPS.isDepth()) 196 { 197 if (cComSPS.getViewId() >= m_acTVideoIOYuvDepthReconFileList.size()) 198 { 199 assert( cComSPS.getViewId() == m_acTVideoIOYuvReconFileList.size() ); 200 increaseNumberOfViews(cComSPS.getViewId()+1); 201 } 202 203 m_acTDecDepthTopList[cComSPS.getViewId()]->setSPS(cComSPS); 204 } 205 else 206 { 207 if (cComSPS.getViewId() >= m_acTVideoIOYuvReconFileList.size()) 208 { 209 assert( cComSPS.getViewId() == m_acTVideoIOYuvReconFileList.size() ); 210 increaseNumberOfViews(cComSPS.getViewId()+1); 211 } 212 m_acTDecTopList[cComSPS.getViewId()]->setSPS(cComSPS); 213 } 214 bEos = m_cTVideoIOBitstreamFile.readBits( pcBitstream ); 215 assert( !bEos); 216 if( cComSPS.isDepth() ) 217 m_acTDecDepthTopList[cComSPS.getViewId()]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiDepthPOCLastDisplayList[cComSPS.getViewId()], bNewPictureType); // decode PPS 218 else 219 m_acTDecTopList[cComSPS.getViewId()]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiPOCLastDisplayList[cComSPS.getViewId()], bNewPictureType); // decode PPS 220 assert( eNalUnitType == NAL_UNIT_PPS ); 221 } 222 #else 223 224 if( eNalUnitType == NAL_UNIT_SPS ) 225 { 226 if( cComSPS.isDepth() && (m_bUsingDepth==false) ) // expected not using depth, but bitstream are using depth 227 { // know from sps 228 assert( cComSPS.getViewId() == 0 && iViewIdx == 0 && !bIsDepth ); 229 startUsingDepth() ; 230 } 231 if( cComSPS.isDepth() && !bIsDepth ) 232 { 233 assert( cComSPS.getViewId() == iViewIdx ); 234 m_acTDecDepthTopList[iViewIdx]->setSPS(cComSPS); 235 } 236 else if( cComSPS.getViewId() >= m_acTVideoIOYuvReconFileList.size() ) // expecting iViewIdx, but got cComSPS.getViewIdx() 237 { 238 assert( cComSPS.getViewId() == m_acTVideoIOYuvReconFileList.size() ); 239 assert( !cComSPS.isDepth() ); 240 increaseNumberOfViews(cComSPS.getViewId()+1); 241 m_acTDecTopList[cComSPS.getViewId()]->setSPS(cComSPS); 242 } 243 bEos = m_cTVideoIOBitstreamFile.readBits( pcBitstream ); 244 assert( !bEos); 245 if( cComSPS.isDepth() ) 246 m_acTDecDepthTopList[cComSPS.getViewId()]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiDepthPOCLastDisplayList[cComSPS.getViewId()]); // decode PPS 247 else 248 m_acTDecTopList[cComSPS.getViewId()]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiPOCLastDisplayList[cComSPS.getViewId()]); // decode PPS 249 assert( eNalUnitType == NAL_UNIT_PPS ); 250 } 251 252 #endif 253 assert( eNalUnitType != NAL_UNIT_SEI ); // not yet supported for MVC 254 if (bNewPicture) 255 { 256 if( bIsDepth ) 257 #if FLEX_CODING_ORDER 258 m_acTDecDepthTopList[iDepthViewIdx]->executeDeblockAndAlf( bEos, pcBitstream, uiPOC, pcListPic, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iDepthViewIdx]); 259 #else 260 m_acTDecDepthTopList[iViewIdx]->executeDeblockAndAlf( bEos, pcBitstream, uiPOC, pcListPic, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iViewIdx]); 261 #endif 262 else 263 m_acTDecTopList[iViewIdx]->executeDeblockAndAlf( bEos, pcBitstream, uiPOC, pcListPic, m_iSkipFrame, m_aiPOCLastDisplayList[iViewIdx]); 264 if (!m_cTVideoIOBitstreamFile.good()) m_cTVideoIOBitstreamFile.clear(); 265 m_cTVideoIOBitstreamFile.setFileLocation( lLocation ); 266 bFirstSliceDecoded = false; 267 268 #if FLEX_CODING_ORDER 269 if (m_bUsingDepth) 270 { 271 bIsDepth = bNewPictureType; 272 273 } 274 if (bCountDepthViewIdx == false ) 275 { 276 bCountDepthViewIdx = true; 277 if (bIsDepth == true) 278 { 279 bFirstDepth = true; 280 bCountDepthViewIdx = true; 281 } 282 if (!bFirstDepth && !bIsDepth) 283 { 284 iViewIdx++; 285 bCountDepthViewIdx = false; 286 } 287 288 } 289 else 290 { 291 if (bIsDepth) 292 { 293 iDepthViewIdx++; 294 } 295 else 296 { 297 iViewIdx ++; 298 } 299 300 if (iViewIdx >= m_acTDecTopList.size() || iDepthViewIdx >= m_acTDecDepthTopList.size()) 301 { 302 bFirstDepth = false; 303 iViewIdx = 0; 304 iDepthViewIdx = 0; 305 bCountDepthViewIdx = false; 306 // end of access unit: delete extra pic buffers 307 Int iNumViews = (Int)m_acTVideoIOYuvReconFileList.size(); 308 for( Int iVId = 0; iVId < iNumViews; iVId++ ) 309 { 310 if( iVId < (Int)m_acTDecTopList.size() && m_acTDecTopList[iVId] ) 311 { 312 m_acTDecTopList[iVId]->deleteExtraPicBuffers( (Int)uiPOC ); 313 } 314 if( iVId < (Int)m_acTDecDepthTopList.size() && m_acTDecDepthTopList[iVId] ) 315 { 316 m_acTDecDepthTopList[iVId]->deleteExtraPicBuffers( (Int)uiPOC ); 317 } 318 } 319 320 #if AMVP_BUFFERCOMPRESS 321 // compress motion for entire access unit 322 for( Int iVId = 0; iVId < iNumViews; iVId++ ) 323 { 324 if( iVId < (Int)m_acTDecTopList.size() && m_acTDecTopList[iVId] ) 325 { 326 m_acTDecTopList[iVId]->compressMotion( (Int)uiPOC ); 327 } 328 if( iVId < (Int)m_acTDecDepthTopList.size() && m_acTDecDepthTopList[iVId] ) 329 { 330 m_acTDecDepthTopList[iVId]->compressMotion( (Int)uiPOC ); 331 } 332 } 333 #endif 334 } 335 } 336 337 #else 338 339 if( m_bUsingDepth && !bIsDepth ) 340 { 341 bIsDepth = true; 342 } 343 else 344 { 345 bIsDepth = false; 346 if( iViewIdx<m_acTDecTopList.size()-1) 347 { 348 iViewIdx++ ; 349 } 350 else 351 { 352 iViewIdx = 0; 353 354 // end of access unit: delete extra pic buffers 355 Int iNumViews = (Int)m_acTVideoIOYuvReconFileList.size(); 356 for( Int iVId = 0; iVId < iNumViews; iVId++ ) 357 { 358 if( iVId < (Int)m_acTDecTopList.size() && m_acTDecTopList[iVId] ) 359 { 360 m_acTDecTopList[iVId]->deleteExtraPicBuffers( (Int)uiPOC ); 361 } 362 if( iVId < (Int)m_acTDecDepthTopList.size() && m_acTDecDepthTopList[iVId] ) 363 { 364 m_acTDecDepthTopList[iVId]->deleteExtraPicBuffers( (Int)uiPOC ); 365 } 366 } 367 368 #if AMVP_BUFFERCOMPRESS 369 // compress motion for entire access unit 370 for( Int iVId = 0; iVId < iNumViews; iVId++ ) 371 { 372 if( iVId < (Int)m_acTDecTopList.size() && m_acTDecTopList[iVId] ) 373 { 374 m_acTDecTopList[iVId]->compressMotion( (Int)uiPOC ); 375 } 376 if( iVId < (Int)m_acTDecDepthTopList.size() && m_acTDecDepthTopList[iVId] ) 377 { 378 m_acTDecDepthTopList[iVId]->compressMotion( (Int)uiPOC ); 379 } 380 } 381 #endif 382 } 383 } 384 #endif 385 } 386 #else 387 #error 388 m_cTDecTop.decode( bEos, pcBitstream, uiPOC, pcListPic ); 389 #endif 390 391 392 if (!resizedBitstreamBuffer) 393 { 394 TComSPS *sps = m_acTDecTopList[0]->getSPS(); 395 if (sps) 396 { 397 pcBitstream->destroy(); 398 pcBitstream->create(sps->getWidth() * sps->getHeight() * 2); 399 resizedBitstreamBuffer = true; 400 } 401 } 402 403 if( pcListPic ) 404 { 405 // write reconstuction to file 406 xWriteOutput( pcListPic ); 407 } 408 } 409 410 // delete buffers 411 for(Int i=0; i<m_acTDecTopList.size(); i++) 412 m_acTDecTopList[i]->deletePicBuffer(); 413 414 if (m_bUsingDepth) 415 { 416 for(Int i=0; i<m_acTDecDepthTopList.size(); i++) 417 m_acTDecDepthTopList[i]->deletePicBuffer(); 418 } 419 420 // destroy internal classes 421 xDestroyDecLib(); 422 } 423 424 // ==================================================================================================================== 425 // Protected member functions 426 // ==================================================================================================================== 427 428 Void TAppDecTop::xCreateDecLib() 429 { 430 // open bitstream file 431 m_cTVideoIOBitstreamFile.openBits( m_pchBitstreamFile, false); // read mode 432 433 // create decoder class 434 // m_cTDecTop.create(); 435 m_acTDecTopList.push_back(new TDecTop) ;// at least one decoder 436 m_acTDecTopList[0]->create() ; 437 438 m_aiPOCLastDisplayList.push_back(-1+m_iSkipFrame) ; 83 increaseNumberOfViews( 1 ); 84 #if SONY_COLPIC_AVAILABILITY 85 m_tDecTop[0]->setViewOrderIdx(0); 86 #endif 87 Int viewDepthId = 0; 88 Int previousViewDepthId = 0; 89 UInt uiPOC[MAX_VIEW_NUM*2]; 90 TComList<TComPic*>* pcListPic[MAX_VIEW_NUM*2]; 91 Bool newPicture[MAX_VIEW_NUM*2]; 92 Bool previousPictureDecoded = false; 93 for( Int i = 0; i < MAX_VIEW_NUM*2; i++ ) 94 { 95 uiPOC[i] = 0; 96 pcListPic[i] = NULL; 97 newPicture[i] = false; 98 } 99 100 ifstream bitstreamFile(m_pchBitstreamFile, ifstream::in | ifstream::binary); 101 if (!bitstreamFile) 102 { 103 fprintf(stderr, "\nfailed to open bitstream file `%s' for reading\n", m_pchBitstreamFile); 104 exit(EXIT_FAILURE); 105 } 439 106 440 107 if( m_pchScaleOffsetFile ) … … 444 111 } 445 112 m_cCamParsCollector.init( m_pScaleOffsetFile ); 446 } 113 114 InputByteStream bytestream(bitstreamFile); 115 116 while (!!bitstreamFile) 117 { 118 /* location serves to work around a design fault in the decoder, whereby 119 * the process of reading a new slice that is the first slice of a new frame 120 * requires the TDecTop::decode() method to be called again with the same 121 * nal unit. */ 122 streampos location = bitstreamFile.tellg(); 123 AnnexBStats stats = AnnexBStats(); 124 vector<uint8_t> nalUnit; 125 InputNALUnit nalu; 126 byteStreamNALUnit(bytestream, nalUnit, stats); 127 128 // call actual decoding function 129 if (nalUnit.empty()) 130 { 131 /* this can happen if the following occur: 132 * - empty input file 133 * - two back-to-back start_code_prefixes 134 * - start_code_prefix immediately followed by EOF 135 */ 136 fprintf(stderr, "Warning: Attempt to decode an empty NAL unit\n"); 137 } 138 else 139 { 140 read(nalu, nalUnit); 141 Int viewId = nalu.m_viewId; 142 Int depth = nalu.m_isDepth ? 1 : 0; 143 viewDepthId = viewId * 2 + depth; // coding order T0D0T1D1T2D2 144 newPicture[viewDepthId] = false; 145 if( viewDepthId >= m_tDecTop.size() ) 146 { 147 increaseNumberOfViews( viewDepthId +1 ); 148 } 149 if(m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer) 150 { 151 previousPictureDecoded = false; 152 } 153 if(m_tDecTop.size() > 1 && (viewDepthId != previousViewDepthId) && previousPictureDecoded ) 154 { 155 m_tDecTop[previousViewDepthId]->executeDeblockAndAlf(uiPOC[previousViewDepthId], pcListPic[previousViewDepthId], m_iSkipFrame, m_pocLastDisplay[previousViewDepthId]); 156 } 157 if( ( viewDepthId == 0 && (viewDepthId != previousViewDepthId) ) || m_tDecTop.size() == 1 ) 158 { 159 #if HHI_INTER_VIEW_RESIDUAL_PRED 160 for( Int i = 0; i < m_tDecTop.size(); i++ ) 161 { 162 m_tDecTop[i]->deleteExtraPicBuffers( uiPOC[i] ); 163 } 164 #endif 165 for( Int i = 0; i < m_tDecTop.size(); i++ ) 166 { 167 m_tDecTop[i]->compressMotion( uiPOC[i] ); 168 } 169 } 170 if( !(m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer) ) 171 { 172 newPicture[viewDepthId] = m_tDecTop[viewDepthId]->decode(nalu, m_iSkipFrame, m_pocLastDisplay[viewDepthId]); 173 if (newPicture[viewDepthId]) 174 { 175 bitstreamFile.clear(); 176 /* location points to the current nalunit payload[1] due to the 177 * need for the annexB parser to read three extra bytes. 178 * [1] except for the first NAL unit in the file 179 * (but bNewPicture doesn't happen then) */ 180 bitstreamFile.seekg(location-streamoff(3)); 181 bytestream.reset(); 182 } 183 if( nalu.isSlice() ) 184 { 185 previousPictureDecoded = true; 186 } 187 } 188 } 189 if( ( (newPicture[viewDepthId] || !bitstreamFile) && m_tDecTop.size() == 1) || (!bitstreamFile && previousPictureDecoded == true) ) 190 { 191 m_tDecTop[viewDepthId]->executeDeblockAndAlf(uiPOC[viewDepthId], pcListPic[viewDepthId], m_iSkipFrame, m_pocLastDisplay[viewDepthId]); 192 } 193 if( pcListPic[viewDepthId] ) 194 { 195 if( newPicture[viewDepthId] && (nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR || (nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDV && m_tDecTop[viewDepthId]->getNalUnitTypeBaseView() == NAL_UNIT_CODED_SLICE_IDR)) ) 196 { 197 xFlushOutput( pcListPic[viewDepthId], viewDepthId ); 198 } 199 // write reconstruction to file 200 if(newPicture[viewDepthId]) 201 { 202 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER 203 xWriteOutput( pcListPic[viewDepthId], viewDepthId, nalu.m_temporalId ); 204 #else 205 xWriteOutput( pcListPic[viewDepthId], viewDepthId ); 206 #endif 207 } 208 } 209 previousViewDepthId = viewDepthId; 210 } 211 // last frame 212 for( Int viewDepthIdx = 0; viewDepthIdx < m_tDecTop.size(); viewDepthIdx++ ) 213 { 214 xFlushOutput( pcListPic[viewDepthIdx], viewDepthIdx ); 215 } 216 xDestroyDecLib(); 217 } 218 219 // ==================================================================================================================== 220 // Protected member functions 221 // ==================================================================================================================== 447 222 448 223 Void TAppDecTop::xDestroyDecLib() 449 224 { 450 // close bitstream file 451 m_cTVideoIOBitstreamFile.closeBits(); 452 453 for(Int iViewIdx=0; iViewIdx<m_acTVideoIOYuvReconFileList.size() ; iViewIdx++) 454 { 455 m_acTVideoIOYuvReconFileList[iViewIdx]->close(); 456 delete m_acTVideoIOYuvReconFileList[iViewIdx]; m_acTVideoIOYuvReconFileList[iViewIdx] = NULL ; 457 } 458 459 // destroy decoder class 460 // m_cTDecTop.destroy(); 461 for(Int iViewIdx=0; iViewIdx<m_acTDecTopList.size() ; iViewIdx++) 462 { 463 m_acTDecTopList[iViewIdx]->destroy() ; 464 delete m_acTDecTopList[iViewIdx] ; m_acTDecTopList[iViewIdx] = NULL ; 465 } 466 467 for(Int iViewIdx=0; iViewIdx<m_acTVideoIOYuvDepthReconFileList.size() ; iViewIdx++) 468 { 469 m_acTVideoIOYuvDepthReconFileList[iViewIdx]->close(); 470 delete m_acTVideoIOYuvDepthReconFileList[iViewIdx]; m_acTVideoIOYuvDepthReconFileList[iViewIdx] = NULL ; 471 } 472 473 for(Int iViewIdx=0; iViewIdx<m_acTDecDepthTopList.size() ; iViewIdx++) 474 { 475 m_acTDecDepthTopList[iViewIdx]->destroy() ; 476 delete m_acTDecDepthTopList[iViewIdx] ; m_acTDecDepthTopList[iViewIdx] = NULL ; 477 } 478 479 m_cCamParsCollector.uninit(); 480 if( m_pScaleOffsetFile ) 481 { 482 ::fclose( m_pScaleOffsetFile ); 483 } 484 } 485 486 Void TAppDecTop::xInitDecLib() 487 { 488 // initialize decoder class 489 m_acTDecTopList[0]->init( this ); 490 m_acTDecTopList[0]->setViewIdx(0); 491 m_acTDecTopList[0]->setPictureDigestEnabled(m_pictureDigestEnabled); 492 m_acTDecTopList[0]->setCamParsCollector( &m_cCamParsCollector ); 493 #if SONY_COLPIC_AVAILABILITY 494 m_acTDecTopList[0]->setViewOrderIdx(0); 495 #endif 225 226 for(Int viewDepthIdx=0; viewDepthIdx<m_tVideoIOYuvReconFile.size() ; viewDepthIdx++) 227 { 228 if( m_tVideoIOYuvReconFile[viewDepthIdx] ) 229 { 230 m_tVideoIOYuvReconFile[viewDepthIdx]->close(); 231 delete m_tVideoIOYuvReconFile[viewDepthIdx]; 232 m_tVideoIOYuvReconFile[viewDepthIdx] = NULL ; 233 } 234 } 235 236 for(Int viewDepthIdx=0; viewDepthIdx<m_tDecTop.size() ; viewDepthIdx++) 237 { 238 if( m_tDecTop[viewDepthIdx] ) 239 { 240 if( !m_useDepth && (viewDepthIdx % 2 == 1) ) 241 { 242 } 243 else 244 { 245 m_tDecTop[viewDepthIdx]->deletePicBuffer(); 246 m_tDecTop[viewDepthIdx]->destroy() ; 247 } 248 delete m_tDecTop[viewDepthIdx] ; 249 m_tDecTop[viewDepthIdx] = NULL ; 250 } 251 } 252 } 253 254 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER 255 Void TAppDecTop::xWriteOutput( TComList<TComPic*>* pcListPic, Int viewDepthId, UInt tId ) 256 #else 257 Void TAppDecTop::xWriteOutput( TComList<TComPic*>* pcListPic, Int viewDepthId ) 258 #endif 259 { 260 TComList<TComPic*>::iterator iterPic = pcListPic->begin(); 261 Int not_displayed = 0; 262 263 while (iterPic != pcListPic->end()) 264 { 265 TComPic* pcPic = *(iterPic); 266 if(pcPic->getOutputMark() && pcPic->getPOC() > m_pocLastDisplay[viewDepthId]) 267 { 268 not_displayed++; 269 } 270 iterPic++; 271 } 272 iterPic = pcListPic->begin(); 273 274 while (iterPic != pcListPic->end()) 275 { 276 TComPic* pcPic = *(iterPic); 277 #if PIC_CROPPING 278 TComSPS *sps = pcPic->getSlice(0)->getSPS(); 279 #endif 280 281 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER 282 if ( pcPic->getOutputMark() && (not_displayed > pcPic->getSlice(0)->getSPS()->getNumReorderPics(tId) && pcPic->getPOC() > m_pocLastDisplay[viewDepthId])) 283 #else 284 if ( pcPic->getOutputMark() && (not_displayed > pcPic->getSlice(0)->getSPS()->getNumReorderFrames() && pcPic->getPOC() > m_pocLastDisplay[viewDepthId])) 285 #endif 286 { 287 // write to file 288 not_displayed--; 289 if ( m_pchReconFile ) 290 { 291 #if PIC_CROPPING 292 m_tVideoIOYuvReconFile[viewDepthId]->write( pcPic->getPicYuvRec(), sps->getPicCropLeftOffset(), sps->getPicCropRightOffset(), sps->getPicCropTopOffset(), sps->getPicCropBottomOffset() ); 293 #else 294 m_tVideoIOYuvReconFile[viewDepthId]->write( pcPic->getPicYuvRec(), pcPic->getSlice(0)->getSPS()->getPad() ); 295 #endif 296 } 297 298 // update POC of display order 299 m_pocLastDisplay[viewDepthId] = pcPic->getPOC(); 300 301 // erase non-referenced picture in the reference picture list after display 302 if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true ) 303 { 304 #if !DYN_REF_FREE 305 pcPic->setReconMark(false); 306 307 // mark it should be extended later 308 pcPic->getPicYuvRec()->setBorderExtension( false ); 309 310 #else 311 pcPic->destroy(); 312 pcListPic->erase( iterPic ); 313 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised! 314 continue; 315 #endif 316 } 317 pcPic->setOutputMark(false); 318 } 319 320 iterPic++; 321 } 496 322 } 497 323 498 324 /** \param pcListPic list of pictures to be written to file 499 \param bFirst first picture?500 325 \todo DYN_REF_FREE should be revised 501 326 */ 502 Void TAppDecTop::xWriteOutput( TComList<TComPic*>* pcListPic ) 503 { 327 Void TAppDecTop::xFlushOutput( TComList<TComPic*>* pcListPic, Int viewDepthId ) 328 { 329 if(!pcListPic) 330 { 331 return; 332 } 504 333 TComList<TComPic*>::iterator iterPic = pcListPic->begin(); 505 334 335 iterPic = pcListPic->begin(); 336 506 337 while (iterPic != pcListPic->end()) 507 338 { 508 339 TComPic* pcPic = *(iterPic); 509 Int iViewIdx = pcPic->getViewIdx(); 510 Int bIsDepth = pcPic->getSlice(0)->getSPS()->isDepth() ; 511 512 if (!bIsDepth) 513 { 514 if( m_acTVideoIOYuvReconFileList.size() < iViewIdx+1 ) 515 increaseNumberOfViews( iViewIdx+1 ) ; 516 517 if ( pcPic->getReconMark() && pcPic->getPOC() == (m_aiPOCLastDisplayList[iViewIdx] + 1) ) 518 { 519 // write to file 520 if ( m_pchReconFile ) 521 { 522 m_acTVideoIOYuvReconFileList[iViewIdx]->write( pcPic->getPicYuvRec(), pcPic->getSlice(0)->getSPS()->getPad() ); 523 } 524 525 // update POC of display order 526 m_aiPOCLastDisplayList[iViewIdx] = pcPic->getPOC(); 527 528 // erase non-referenced picture in the reference picture list after display 529 if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true ) 530 { 531 #if !DYN_REF_FREE 532 pcPic->setReconMark(false); 533 534 // mark it should be extended later 535 pcPic->getPicYuvRec()->setBorderExtension( false ); 536 537 #else 538 pcPic->destroy(); 539 pcListPic->erase( iterPic ); 540 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised! 541 continue; 542 #endif 543 } 544 } 545 } /// end !bIsDepth 546 else 547 { 548 if( m_acTVideoIOYuvDepthReconFileList.size() < iViewIdx+1 ) 549 increaseNumberOfViews( iViewIdx+1 ) ; 550 551 if ( pcPic->getReconMark() && pcPic->getPOC() == (m_aiDepthPOCLastDisplayList[iViewIdx] + 1) ) 552 { 553 // write to file 554 if ( m_pchReconFile ) 555 { 556 m_acTVideoIOYuvDepthReconFileList[iViewIdx]->write( pcPic->getPicYuvRec(), pcPic->getSlice(0)->getSPS()->getPad() ); 557 } 558 559 // update POC of display order 560 m_aiDepthPOCLastDisplayList[iViewIdx] = pcPic->getPOC(); 561 562 // erase non-referenced picture in the reference picture list after display 563 if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true ) 564 { 565 #if !DYN_REF_FREE 566 pcPic->setReconMark(false); 567 568 // mark it should be extended later 569 pcPic->getPicYuvRec()->setBorderExtension( false ); 570 571 #else 572 pcPic->destroy(); 573 pcListPic->erase( iterPic ); 574 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised! 575 continue; 576 #endif 577 } 578 } 579 } // end bIsDepth 580 340 #if PIC_CROPPING 341 TComSPS *sps = pcPic->getSlice(0)->getSPS(); 342 #endif 343 344 if ( pcPic->getOutputMark() ) 345 { 346 // write to file 347 if ( m_pchReconFile ) 348 { 349 #if PIC_CROPPING 350 m_tVideoIOYuvReconFile[viewDepthId]->write( pcPic->getPicYuvRec(), sps->getPicCropLeftOffset(), sps->getPicCropRightOffset(), sps->getPicCropTopOffset(), sps->getPicCropBottomOffset() ); 351 #else 352 m_tVideoIOYuvReconFile[viewDepthId]->write( pcPic->getPicYuvRec(), pcPic->getSlice(0)->getSPS()->getPad() ); 353 #endif 354 } 355 356 // update POC of display order 357 m_pocLastDisplay[viewDepthId] = pcPic->getPOC(); 358 359 // erase non-referenced picture in the reference picture list after display 360 if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true ) 361 { 362 #if !DYN_REF_FREE 363 pcPic->setReconMark(false); 364 365 // mark it should be extended later 366 pcPic->getPicYuvRec()->setBorderExtension( false ); 367 368 #else 369 pcPic->destroy(); 370 pcListPic->erase( iterPic ); 371 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised! 372 continue; 373 #endif 374 } 375 pcPic->setOutputMark(false); 376 } 377 581 378 iterPic++; 582 379 } 583 } 584 585 Void TAppDecTop::startUsingDepth() 586 { 587 m_bUsingDepth = true ; 588 increaseNumberOfViews( (Int)m_acTVideoIOYuvReconFileList.size() ); 589 } 590 591 Void TAppDecTop::increaseNumberOfViews (Int iNewNumberOfViews) 592 { 593 while( m_acTVideoIOYuvReconFileList.size() < iNewNumberOfViews) 594 { 595 m_acTVideoIOYuvReconFileList.push_back(new TVideoIOYuv); 596 597 // GT FIX 598 Char cBuffer[4] ; 599 sprintf(cBuffer,"_%i",(Int)m_acTVideoIOYuvReconFileList.size()-1 ); 600 Char* pchNextFilename; 601 xAppendToFileNameEnd( m_pchReconFile, cBuffer, pchNextFilename); 602 // GT FIX END 603 if ( m_outputBitDepth == 0 ) 604 m_outputBitDepth = g_uiBitDepth + g_uiBitIncrement; 605 m_acTVideoIOYuvReconFileList.back()->open( pchNextFilename, true, m_outputBitDepth, g_uiBitDepth + g_uiBitIncrement ); 606 free (pchNextFilename); 607 } 608 609 while( m_aiPOCLastDisplayList.size() < iNewNumberOfViews ) 610 m_aiPOCLastDisplayList.push_back(-1+m_iSkipFrame) ; 611 612 while( m_acTDecTopList.size() < iNewNumberOfViews) 613 { 614 m_acTDecTopList.push_back(new TDecTop) ;// at least one decoder 615 m_acTDecTopList.back()->create() ; 616 m_acTDecTopList.back()->init( this, false ); 617 m_acTDecTopList.back()->setViewIdx((Int)m_acTDecTopList.size()-1); 618 m_acTDecTopList.back()->setPictureDigestEnabled(m_pictureDigestEnabled); 619 m_acTDecTopList.back()->setCamParsCollector( &m_cCamParsCollector ); 620 } 621 if( m_bUsingDepth ) 622 { 623 while( m_acTVideoIOYuvDepthReconFileList.size() < iNewNumberOfViews ) 624 { 625 m_acTVideoIOYuvDepthReconFileList.push_back(new TVideoIOYuv); 626 // GT FIX 380 pcListPic->clear(); 381 m_pocLastDisplay[viewDepthId] = -MAX_INT; 382 } 383 384 Void TAppDecTop::increaseNumberOfViews ( Int newNumberOfViewDepth ) 385 { 386 if ( m_outputBitDepth == 0 ) 387 { 388 m_outputBitDepth = g_uiBitDepth + g_uiBitIncrement; 389 } 390 Int viewId = (newNumberOfViewDepth-1)>>1; // coding order T0D0T1D1T2D2 391 Bool isDepth = ((newNumberOfViewDepth % 2) == 0); // coding order T0D0T1D1T2D2 392 if( isDepth ) 393 m_useDepth = true; 394 while( m_tVideoIOYuvReconFile.size() < newNumberOfViewDepth) 395 { 396 m_tVideoIOYuvReconFile.push_back(new TVideoIOYuv); 397 Char buffer[4]; 398 sprintf(buffer,"_%i", (Int)(m_tVideoIOYuvReconFile.size()-1) / 2 ); 399 Char* nextFilename = NULL; 400 if( (m_tVideoIOYuvReconFile.size() % 2) == 0 ) 401 { 627 402 Char* pchTempFilename = NULL; 628 403 xAppendToFileNameEnd( m_pchReconFile, "_depth", pchTempFilename); 629 Char cBuffer[4] ; 630 sprintf(cBuffer,"_%i",(Int)m_acTVideoIOYuvDepthReconFileList.size()-1 ); 631 Char* pchDepthFilename = NULL; 632 xAppendToFileNameEnd( pchTempFilename, cBuffer, pchDepthFilename); 633 // GT FIX END 634 if ( m_outputBitDepth == 0 ) 635 m_outputBitDepth = g_uiBitDepth + g_uiBitIncrement; 636 m_acTVideoIOYuvDepthReconFileList.back()->open( pchDepthFilename, true, m_outputBitDepth, g_uiBitDepth + g_uiBitIncrement ); 637 free (pchTempFilename); 638 free( pchDepthFilename ); 639 } 640 while( m_aiDepthPOCLastDisplayList.size() < iNewNumberOfViews ) 641 m_aiDepthPOCLastDisplayList.push_back(-1+m_iSkipFrame) ; 642 while( m_acTDecDepthTopList.size() < iNewNumberOfViews) 643 { 644 m_acTDecDepthTopList.push_back(new TDecTop) ;// at least one decoder 645 m_acTDecDepthTopList.back()->create() ; 646 m_acTDecDepthTopList.back()->init( this, false ); 647 #if FLEX_CODING_ORDER 648 Int iNumofgen = (Int)m_acTDecDepthTopList.size(); 649 m_acTDecDepthTopList.back()->setViewIdx(iNumofgen-1); 650 #else 651 m_acTDecDepthTopList.back()->setViewIdx((Int)m_acTDecTopList.size()-1); 652 #endif 653 654 m_acTDecDepthTopList.back()->setPictureDigestEnabled(m_pictureDigestEnabled); 655 m_acTDecDepthTopList.back()->setToDepth( true ); 656 m_acTDecDepthTopList.back()->setCamParsCollector( &m_cCamParsCollector ); 657 } 658 } 659 } 660 661 662 // GT FIX 663 std::vector<TComPic*> TAppDecTop::getSpatialRefPics( Int iViewIdx, Int iPoc, Bool bIsDepth ) // only for mvc functionality yet 664 { 665 std::vector<TComPic*> apcRefPics( iViewIdx, (TComPic*)NULL ); 666 for( int iRefViewIdx = 0; iRefViewIdx < iViewIdx; iRefViewIdx++ ) 667 { 668 TComPic* pcRefPic = getPicFromView( iRefViewIdx, iPoc, bIsDepth ); 404 xAppendToFileNameEnd( pchTempFilename, buffer, nextFilename); 405 free ( pchTempFilename ); 406 } 407 else 408 { 409 xAppendToFileNameEnd( m_pchReconFile, buffer, nextFilename); 410 } 411 if( isDepth || ( !isDepth && (m_tVideoIOYuvReconFile.size() % 2) == 1 ) ) 412 { 413 m_tVideoIOYuvReconFile.back()->open( nextFilename, true, m_outputBitDepth, g_uiBitDepth + g_uiBitIncrement ); 414 } 415 free ( nextFilename ); 416 } 417 while( m_pocLastDisplay.size() < newNumberOfViewDepth ) 418 { 419 m_pocLastDisplay.push_back(-MAX_INT+m_iSkipFrame); 420 } 421 while( m_tDecTop.size() < newNumberOfViewDepth) 422 { 423 m_tDecTop.push_back(new TDecTop); 424 if( isDepth || ( !isDepth && (m_tVideoIOYuvReconFile.size() % 2) == 1 ) ) 425 { 426 m_tDecTop.back()->create(); 427 m_tDecTop.back()->init( this, newNumberOfViewDepth == 1); 428 m_tDecTop.back()->setViewId( viewId ); 429 m_tDecTop.back()->setIsDepth( isDepth ); 430 m_tDecTop.back()->setPictureDigestEnabled(m_pictureDigestEnabled); 431 } 432 } 433 } 434 435 TDecTop* TAppDecTop::getTDecTop( Int viewId, Bool isDepth ) 436 { 437 return m_tDecTop[(isDepth ? 1 : 0) + viewId * 2]; // coding order T0D0T1D1T2D2 438 } 439 440 std::vector<TComPic*> TAppDecTop::getInterViewRefPics( Int viewId, Int poc, Bool isDepth, TComSPS* sps ) 441 { 442 std::vector<TComPic*> apcRefPics( sps->getNumberOfUsableInterViewRefs(), (TComPic*)NULL ); 443 for( Int k = 0; k < sps->getNumberOfUsableInterViewRefs(); k++ ) 444 { 445 TComPic* pcRefPic = xGetPicFromView( sps->getUsableInterViewRef( k ) + viewId, poc, isDepth ); 669 446 assert( pcRefPic != NULL ); 670 apcRefPics[ iRefViewIdx] = pcRefPic;447 apcRefPics[k] = pcRefPic; 671 448 } 672 449 return apcRefPics; 673 450 } 674 451 675 TComPic* TAppDecTop::getPicFromView( Int iViewIdx, Int iPoc, bool bIsDepth ) 676 { 677 TComList<TComPic*>* apcListPic = (bIsDepth ? m_acTDecDepthTopList[iViewIdx] : m_acTDecTopList[iViewIdx])->getListPic(); 678 TComPic* pcRefPic = NULL; 452 TComPic* TAppDecTop::xGetPicFromView( Int viewId, Int poc, Bool isDepth ) 453 { 454 assert( ( viewId >= 0 ) ); 455 456 TComList<TComPic*>* apcListPic = getTDecTop( viewId, isDepth )->getListPic(); 457 TComPic* pcPic = NULL; 679 458 for( TComList<TComPic*>::iterator it=apcListPic->begin(); it!=apcListPic->end(); it++ ) 680 459 { 681 if( (*it)->getPOC() == iPoc )682 { 683 pc RefPic = *it;460 if( (*it)->getPOC() == poc ) 461 { 462 pcPic = *it; 684 463 break; 685 464 } 686 465 } 687 return pcRefPic; 688 } 466 return pcPic; 467 } 468 //! \} -
trunk/source/App/TAppDecoder/TAppDecTop.h
r21 r56 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 1,ISO/IEC6 * Copyright (c) 2010-2012, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 15 15 * this list of conditions and the following disclaimer in the documentation 16 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the I SO/IEC nor the names of its contributors may17 * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 18 * be used to endorse or promote products derived from this software without 19 19 * specific prior written permission. … … 32 32 */ 33 33 34 35 36 34 /** \file TAppDecTop.h 37 35 \brief Decoder application class (header) … … 45 43 #endif // _MSC_VER > 1000 46 44 47 #include "../../Lib/TLibVideoIO/TVideoIOYuv.h" 48 #include "../../Lib/TLibVideoIO/TVideoIOBits.h" 49 #include "../../Lib/TLibCommon/TComList.h" 50 #include "../../Lib/TLibCommon/TComPicYuv.h" 51 #include "../../Lib/TLibCommon/TComBitStream.h" 52 #include "../../Lib/TLibCommon/TComDepthMapGenerator.h" 53 #include "../../Lib/TLibDecoder/TDecTop.h" 45 #include "TLibVideoIO/TVideoIOYuv.h" 46 #include "TLibCommon/TComList.h" 47 #include "TLibCommon/TComPicYuv.h" 48 #include "TLibCommon/TComDepthMapGenerator.h" 49 #include "TLibDecoder/TDecTop.h" 54 50 #include "TAppDecCfg.h" 51 52 //! \ingroup TAppDecoder 53 //! \{ 55 54 56 55 // ==================================================================================================================== … … 63 62 private: 64 63 // class interface 65 std::vector<TDecTop*> m_acTDecTopList; 66 std::vector<TDecTop*> m_acTDecDepthTopList; 67 TComBitstream* m_apcBitstream; ///< bitstream class 68 TVideoIOBitsStartCode m_cTVideoIOBitstreamFile; ///< file I/O class 69 std::vector<TVideoIOYuv*> m_acTVideoIOYuvReconFileList; 70 std::vector<TVideoIOYuv*> m_acTVideoIOYuvDepthReconFileList; 64 std::vector<TDecTop*> m_tDecTop; ///< decoder classes 71 65 72 Bool m_bUsingDepth;66 std::vector<TVideoIOYuv*> m_tVideoIOYuvReconFile; ///< reconstruction YUV class 73 67 74 68 // for output control 75 69 Bool m_abDecFlag[ MAX_GOP ]; ///< decoded flag in one GOP 76 // Int m_iPOCLastDisplay; ///< last POC in display order 77 78 std::vector<Bool> m_abDecFlagList; ///< decoded flag in one GOP 79 std::vector<Int> m_aiPOCLastDisplayList; 80 std::vector<Int> m_aiDepthPOCLastDisplayList; 70 std::vector<Int> m_pocLastDisplay; ///< last POC in display order 71 Bool m_useDepth; 81 72 82 73 FILE* m_pScaleOffsetFile; … … 90 81 TAppDecTop(); 91 82 virtual ~TAppDecTop() {} 92 83 93 84 Void create (); ///< create internal members 94 85 Void destroy (); ///< destroy internal members 95 86 Void decode (); ///< main decoding function 96 Void increaseNumberOfViews (Int iNewNumberOfViews);97 Void startUsingDepth();87 Void increaseNumberOfViews (Int newNumberOfViewDepth); 88 TDecTop* getTDecTop ( Int viewId, Bool isDepth ); 98 89 99 // GT FIX 100 std::vector<TComPic*> getSpatialRefPics( Int iViewIdx, Int iPoc, Bool bIsDepth ); 101 TComPic* getPicFromView( Int iViewIdx, Int iPoc, bool bDepth ); 102 // GT FIX END 90 std::vector<TComPic*> getInterViewRefPics( Int viewId, Int poc, Bool isDepth, TComSPS* sps ); 91 TComPic* getPicFromView ( Int viewId, Int poc, bool isDepth ) { return xGetPicFromView( viewId, poc, isDepth ); } 103 92 104 93 #if DEPTH_MAP_GENERATION 105 94 TComSPSAccess* getSPSAccess () { return &m_cSPSAccess; } 106 95 TComAUPicAccess* getAUPicAccess() { return &m_cAUPicAccess; } 107 TDecTop* getDecTop0 () { return m_ acTDecTopList[0]; }96 TDecTop* getDecTop0 () { return m_tDecTop[0]; } 108 97 #endif 109 98 110 99 protected: 111 Void xCreateDecLib (); ///< create internal classes100 // Void xCreateDecLib (); ///< create internal classes 112 101 Void xDestroyDecLib (); ///< destroy internal classes 113 Void xInitDecLib (); ///< initialize decoder class 102 // Void xInitDecLib (); ///< initialize decoder class 103 104 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER 105 Void xWriteOutput ( TComList<TComPic*>* pcListPic, Int viewDepthId, UInt tId); ///< write YUV to file 106 #else 107 Void xWriteOutput ( TComList<TComPic*>* pcListPic, Int viewDepthId ); ///< write YUV to file 108 #endif 109 Void xFlushOutput ( TComList<TComPic*>* pcListPic, Int viewDepthId ); ///< flush all remaining decoded pictures to file 114 110 115 Void xWriteOutput ( TComList<TComPic*>* pcListPic ); ///< write YUV to file111 TComPic* xGetPicFromView( Int viewId, Int poc, Bool isDepth ); 116 112 }; 117 113 114 //! \} 118 115 #endif 119 116 -
trunk/source/App/TAppDecoder/decmain.cpp
r8 r56 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 1,ISO/IEC6 * Copyright (c) 2010-2012, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 15 15 * this list of conditions and the following disclaimer in the documentation 16 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the I SO/IEC nor the names of its contributors may17 * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 18 * be used to endorse or promote products derived from this software without 19 19 * specific prior written permission. … … 32 32 */ 33 33 34 35 36 34 /** \file decmain.cpp 37 35 \brief Decoder application main … … 42 40 #include <time.h> 43 41 #include "TAppDecTop.h" 42 43 //! \ingroup TAppDecoder 44 //! \{ 44 45 45 46 bool g_md5_mismatch = false; ///< top level flag that indicates if there has been a decoding mismatch … … 55 56 // print information 56 57 fprintf( stdout, "\n" ); 57 fprintf( stdout, " HM %s based Multiview Video plus Depth coder: Decoder Version [%s]", HM_VERSION, NV_VERSION );58 fprintf( stdout, "3D-HTM Software: Decoder Version [%s] based on HM Version [%s]", NV_VERSION, HM_VERSION ); 58 59 fprintf( stdout, NVM_ONOS ); 59 60 fprintf( stdout, NVM_COMPILEDBY ); … … 93 94 } 94 95 95 96 //! \}
Note: See TracChangeset for help on using the changeset viewer.