Changeset 446 in 3DVCSoftware for branches/HTM-DEV-0.2-dev/source/App/TAppDecoder
- Timestamp:
- 26 May 2013, 16:22:23 (12 years ago)
- Location:
- branches/HTM-DEV-0.2-dev/source/App/TAppDecoder
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-DEV-0.2-dev/source/App/TAppDecoder/TAppDecCfg.cpp
r438 r446 45 45 #include <cassert> 46 46 #endif 47 48 47 #ifdef WIN32 49 48 #define strdup _strdup … … 69 68 string cfg_ReconFile; 70 69 string cfg_TargetDecLayerIdSetFile; 70 #if H_3D 71 string cfg_ScaleOffsetFile; 72 #endif 71 73 72 74 po::Options opts; … … 76 78 ("ReconFile,o", cfg_ReconFile, string(""), "reconstructed YUV output file name\n" 77 79 "YUV writing is skipped if omitted") 80 #if H_3D 81 ("ScaleOffsetFile,p", cfg_ScaleOffsetFile, string(""), "file with coded scales and offsets") 82 #endif 78 83 ("SkipFrames,s", m_iSkipFrame, 0, "number of frames to skip before random access") 79 84 ("OutputBitDepth,d", m_outputBitDepthY, 0, "bit depth of YUV output luma component (default: use 0 for native depth)") 80 85 ("OutputBitDepthC,d", m_outputBitDepthC, 0, "bit depth of YUV output chroma component (default: use 0 for native depth)") 81 82 86 #if H_MV 83 87 ("MaxLayerId,-ls", m_maxLayerId, MAX_NUM_LAYER_IDS-1, "Maximum LayerId to be decoded.") 84 88 #endif 85 86 89 ("MaxTemporalLayer,t", m_iMaxTemporalLayer, -1, "Maximum Temporal Layer to be decoded. -1 to decode all layers") 87 90 ("SEIDecodedPictureHash", m_decodedPictureHashSEIEnabled, 1, "Control handling of decoded picture hash SEI messages\n" … … 108 111 /* convert std::string to c string for compatability */ 109 112 m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str()); 110 111 113 m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str()); 112 114 115 #if H_3D 116 m_pchScaleOffsetFile = cfg_ScaleOffsetFile.empty() ? NULL : strdup(cfg_ScaleOffsetFile.c_str()); 117 #endif 113 118 if (!m_pchBitstreamFile) 114 119 { … … 191 196 } 192 197 #endif 193 194 198 //! \} -
branches/HTM-DEV-0.2-dev/source/App/TAppDecoder/TAppDecCfg.h
r368 r446 63 63 #endif 64 64 Char* m_pchReconFile; ///< output reconstruction file name 65 #if H_3D 66 Char* m_pchScaleOffsetFile; ///< output coded scale and offset parameters 67 #endif 65 68 Int m_iSkipFrame; ///< counter for frames prior to the random access point to skip 66 69 Int m_outputBitDepthY; ///< bit depth used for writing output (luma) -
branches/HTM-DEV-0.2-dev/source/App/TAppDecoder/TAppDecTop.cpp
r438 r446 54 54 55 55 TAppDecTop::TAppDecTop() 56 57 56 #if !H_MV 58 57 : m_iPOCLastDisplay(-MAX_INT) … … 60 59 : m_numDecoders( 0 ) 61 60 #endif 62 63 61 { 64 62 ::memset (m_abDecFlag, 0, sizeof (m_abDecFlag)); 65 63 #if H_MV 66 64 for (Int i = 0; i < MAX_NUM_LAYER_IDS; i++) m_layerIdToDecIdx[i] = -1; 65 #endif 66 #if H_3D 67 m_pScaleOffsetFile = 0; 67 68 #endif 68 69 } … … 79 80 m_pchBitstreamFile = NULL; 80 81 } 81 82 82 #if H_MV 83 83 for (Int decIdx = 0; decIdx < m_numDecoders; decIdx++) … … 115 115 poc = -1; 116 116 #endif 117 118 117 TComList<TComPic*>* pcListPic = NULL; 119 118 … … 125 124 } 126 125 126 #if H_3D 127 if( m_pchScaleOffsetFile ) 128 { 129 m_pScaleOffsetFile = ::fopen( m_pchScaleOffsetFile, "wt" ); 130 AOF( m_pScaleOffsetFile ); 131 } 132 m_cCamParsCollector.init( m_pScaleOffsetFile ); 133 #endif 127 134 InputByteStream bytestream(bitstreamFile); 128 135 … … 147 154 Bool firstSlice = true; 148 155 #endif 149 150 156 151 157 while (!!bitstreamFile) … … 156 162 * nal unit. */ 157 163 streampos location = bitstreamFile.tellg(); 164 #if H_MV 165 #if ENC_DEC_TRACE 166 Int64 symCount = g_nSymbolCounter; 167 #endif 168 #endif 158 169 AnnexBStats stats = AnnexBStats(); 159 170 #if !H_MV 160 171 Bool bPreviousPictureDecoded = false; 161 172 #endif 173 162 174 vector<uint8_t> nalUnit; 163 175 InputNALUnit nalu; … … 250 262 bitstreamFile.seekg(location-streamoff(3)); 251 263 bytestream.reset(); 264 #if H_MV 265 #if ENC_DEC_TRACE 266 g_nSymbolCounter = symCount; 267 #endif 268 #endif 252 269 } 253 270 #if !H_MV … … 276 293 } 277 294 #endif 295 278 296 if( pcListPic ) 279 297 { … … 286 304 if (!m_outputBitDepthY) { m_outputBitDepthY = g_bitDepthY; } 287 305 if (!m_outputBitDepthC) { m_outputBitDepthC = g_bitDepthC; } 306 288 307 #if H_MV 289 308 m_tVideoIOYuvReconFile[decIdxLastPic]->open( m_pchReconFiles[decIdxLastPic], true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode … … 297 316 if ( bNewPicture && 298 317 #endif 299 ( nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR 318 ( nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL 300 319 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP 301 320 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP 302 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA NT303 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA ) )321 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL 322 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP ) ) 304 323 { 305 324 #if H_MV … … 318 337 } 319 338 339 #if H_3D 340 if( m_cCamParsCollector.isInitialized() ) 341 { 342 m_cCamParsCollector.setSlice( 0 ); 343 } 344 #endif 320 345 for(UInt decIdx = 0; decIdx < m_numDecoders; decIdx++) 321 346 { … … 383 408 // destroy decoder class 384 409 m_cTDecTop.destroy(); 410 #endif 411 #if H_3D 412 m_cCamParsCollector.uninit(); 413 if( m_pScaleOffsetFile ) 414 { 415 ::fclose( m_pScaleOffsetFile ); 416 } 385 417 #endif 386 418 } … … 593 625 } 594 626 627 #if H_MV 628 Int TAppDecTop::xGetDecoderIdx( Int layerId, Bool createFlag /*= false */ ) 629 { 630 Int decIdx = -1; 631 if ( m_layerIdToDecIdx[ layerId ] != -1 ) 632 { 633 decIdx = m_layerIdToDecIdx[ layerId ]; 634 } 635 else 636 { 637 assert ( createFlag ); 638 assert( m_numDecoders < MAX_NUM_LAYERS ); 639 640 decIdx = m_numDecoders; 641 642 // Init decoder 643 m_tDecTop[ decIdx ] = new TDecTop; 644 m_tDecTop[ decIdx ]->create(); 645 m_tDecTop[ decIdx ]->init( ); 646 m_tDecTop[ decIdx ]->setLayerId( layerId ); 647 m_tDecTop[ decIdx ]->setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled); 648 m_tDecTop[ decIdx ]->setIvPicLists( &m_ivPicLists ); 649 #if H_3D 650 m_tDecTop[ decIdx ]->setCamParsCollector( &m_cCamParsCollector ); 651 #endif 652 653 // append pic list of new decoder to PicLists 654 assert( m_ivPicLists.size() == m_numDecoders ); 655 m_ivPicLists.push_back( m_tDecTop[ decIdx ]->getListPic() ); 656 657 // create recon file related stuff 658 Char* pchTempFilename = NULL; 659 if ( m_pchReconFile ) 660 { 661 Char buffer[4]; 662 sprintf(buffer,"_%i", layerId ); 663 assert ( m_pchReconFile ); 664 xAppendToFileNameEnd( m_pchReconFile , buffer, pchTempFilename ); 665 assert( m_pchReconFiles.size() == m_numDecoders ); 666 } 667 668 m_pchReconFiles.push_back( pchTempFilename ); 669 670 m_tVideoIOYuvReconFile[ decIdx ] = new TVideoIOYuv; 671 m_reconOpen [ decIdx ] = false; 672 673 // set others 674 m_pocLastDisplay [ decIdx ] = -MAX_INT; 675 m_layerIdToDecIdx [ layerId ] = decIdx; 676 677 m_numDecoders++; 678 }; 679 return decIdx; 680 } 681 #endif 595 682 //! \} -
branches/HTM-DEV-0.2-dev/source/App/TAppDecoder/TAppDecTop.h
r438 r446 71 71 TVideoIOYuv m_cTVideoIOYuvReconFile; ///< reconstruction YUV class 72 72 #endif 73 74 // for output control 73 // for output control 75 74 Bool m_abDecFlag[ MAX_GOP ]; ///< decoded flag in one GOP 76 77 75 #if H_MV 78 76 Int m_pocLastDisplay [ MAX_NUM_LAYERS ]; ///< last POC in display order … … 81 79 Int m_iPOCLastDisplay; ///< last POC in display order 82 80 #endif 83 81 #if H_3D 82 FILE* m_pScaleOffsetFile; 83 CamParsCollector m_cCamParsCollector; 84 #endif 84 85 public: 85 86 TAppDecTop(); … … 90 91 Void decode (); ///< main decoding function 91 92 92 93 93 protected: 94 94 Void xCreateDecLib (); ///< create internal classes … … 99 99 Void xWriteOutput ( TComList<TComPic*>* pcListPic, Int layerId, Int tId ); ///< write YUV to file 100 100 Void xFlushOutput ( TComList<TComPic*>* pcListPic, Int layerId ); ///< flush all remaining decoded pictures to file 101 Int xGetDecoderIdx ( Int layerId, Bool createFlag = false ) 102 { 103 Int decIdx = -1; 104 if ( m_layerIdToDecIdx[ layerId ] != -1 ) 105 { 106 decIdx = m_layerIdToDecIdx[ layerId ]; 107 } 108 else 109 { 110 assert ( createFlag ); 111 assert( m_numDecoders < MAX_NUM_LAYERS ); 112 113 decIdx = m_numDecoders; 114 115 // Init decoder 116 m_tDecTop[ decIdx ] = new TDecTop; 117 m_tDecTop[ decIdx ]->create(); 118 m_tDecTop[ decIdx ]->init( ); 119 m_tDecTop[ decIdx ]->setLayerId( layerId ); 120 m_tDecTop[ decIdx ]->setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled); 121 m_tDecTop[ decIdx ]->setIvPicLists( &m_ivPicLists ); 122 123 // append pic list of new decoder to PicLists 124 assert( m_ivPicLists.size() == m_numDecoders ); 125 m_ivPicLists.push_back( m_tDecTop[ decIdx ]->getListPic() ); 126 127 // create recon file related stuff 128 Char* pchTempFilename = NULL; 129 if ( m_pchReconFile ) 130 { 131 Char buffer[4]; 132 sprintf(buffer,"_%i", layerId ); 133 assert ( m_pchReconFile ); 134 xAppendToFileNameEnd( m_pchReconFile , buffer, pchTempFilename ); 135 assert( m_pchReconFiles.size() == m_numDecoders ); 136 } 137 138 m_pchReconFiles.push_back( pchTempFilename ); 139 140 m_tVideoIOYuvReconFile[ decIdx ] = new TVideoIOYuv; 141 m_reconOpen [ decIdx ] = false; 142 143 // set others 144 m_pocLastDisplay [ decIdx ] = -MAX_INT; 145 m_layerIdToDecIdx [ layerId ] = decIdx; 146 147 m_numDecoders++; 148 }; 149 return decIdx; 150 } 101 Int xGetDecoderIdx ( Int layerId, Bool createFlag = false ); 151 102 #else 152 103 Void xWriteOutput ( TComList<TComPic*>* pcListPic , UInt tId); ///< write YUV to file 153 104 Void xFlushOutput ( TComList<TComPic*>* pcListPic ); ///< flush all remaining decoded pictures to file 154 105 #endif 155 156 106 Bool isNaluWithinTargetDecLayerIdSet ( InputNALUnit* nalu ); ///< check whether given Nalu is within targetDecLayerIdSet 157 107 };
Note: See TracChangeset for help on using the changeset viewer.