Changeset 125 in SHVCSoftware for trunk/source/App/TAppDecoder
- Timestamp:
- 16 Apr 2013, 06:39:31 (12 years ago)
- Location:
- trunk/source/App/TAppDecoder
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/App/TAppDecoder/TAppDecCfg.cpp
r55 r125 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 64 64 Bool TAppDecCfg::parseCfg( Int argc, Char* argv[] ) 65 65 { 66 bool do_help = false;66 Bool do_help = false; 67 67 string cfg_BitstreamFile; 68 68 #if SVC_EXTENSION … … 78 78 string cfg_BLSyntaxFile; 79 79 #endif 80 #if TARGET_DECLAYERID_SET81 80 string cfg_TargetDecLayerIdSetFile; 82 #endif83 81 84 82 po::Options opts; … … 108 106 #endif 109 107 ("SkipFrames,s", m_iSkipFrame, 0, "number of frames to skip before random access") 110 ("OutputBitDepth,d", m_outputBitDepth, 0u, "bit depth of YUV output file (use 0 for native depth)") 108 ("OutputBitDepth,d", m_outputBitDepthY, 0, "bit depth of YUV output luma component (default: use 0 for native depth)") 109 ("OutputBitDepthC,d", m_outputBitDepthC, 0, "bit depth of YUV output chroma component (default: use 0 for native depth)") 111 110 #if SVC_EXTENSION 112 111 ("LayerNum,-ls", nLayerNum, 1, "Number of layers to be decoded.") 113 112 #endif 114 113 ("MaxTemporalLayer,t", m_iMaxTemporalLayer, -1, "Maximum Temporal Layer to be decoded. -1 to decode all layers") 115 ("SEIpictureDigest", m_decodedPictureHashSEIEnabled, 1, "Control handling of decoded picture hash SEI messages\n" 116 "\t3: checksum\n" 117 "\t2: CRC\n" 118 "\t1: MD5\n" 119 "\t0: ignore") 120 #if TARGET_DECLAYERID_SET 114 ("SEIDecodedPictureHash", m_decodedPictureHashSEIEnabled, 1, "Control handling of decoded picture hash SEI messages\n" 115 "\t1: check hash in SEI messages if available in the bitstream\n" 116 "\t0: ignore SEI message") 117 ("SEIpictureDigest", m_decodedPictureHashSEIEnabled, 1, "deprecated alias for SEIDecodedPictureHash") 121 118 ("TarDecLayerIdSetFile,l", cfg_TargetDecLayerIdSetFile, string(""), "targetDecLayerIdSet file name. The file should include white space separated LayerId values to be decoded. Omitting the option or a value of -1 in the file decodes all layers.") 122 #endif 119 ("RespectDefDispWindow,w", m_respectDefDispWindow, 0, "Only output content inside the default display window\n") 123 120 ; 124 121 po::setDefaults(opts); 125 const list<const char*>& argv_unhandled = po::scanArgv(opts, argc, (const char**) argv);126 127 for (list<const char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++)122 const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv); 123 124 for (list<const Char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++) 128 125 { 129 126 fprintf(stderr, "Unhandled argument ignored: `%s'\n", *it); … … 161 158 } 162 159 163 #if TARGET_DECLAYERID_SET164 160 if ( !cfg_TargetDecLayerIdSetFile.empty() ) 165 161 { … … 206 202 } 207 203 } 208 #endif209 204 210 205 return true; -
trunk/source/App/TAppDecoder/TAppDecCfg.h
r55 r125 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 44 44 45 45 #include "TLibCommon/CommonDef.h" 46 #if TARGET_DECLAYERID_SET47 46 #include <vector> 48 #endif49 47 50 48 //! \ingroup TAppDecoder … … 59 57 { 60 58 protected: 61 char* m_pchBitstreamFile; ///< input bitstream file name59 Char* m_pchBitstreamFile; ///< input bitstream file name 62 60 #if SVC_EXTENSION 63 char* m_pchReconFile [MAX_LAYERS]; ///< output reconstruction file name61 Char* m_pchReconFile [MAX_LAYERS]; ///< output reconstruction file name 64 62 #if AVC_BASE 65 char* m_pchBLReconFile; ///< input BL reconstruction file name63 Char* m_pchBLReconFile; ///< input BL reconstruction file name 66 64 Int m_iBLSourceWidth; 67 65 Int m_iBLSourceHeight; 68 66 #if AVC_SYNTAX 69 char* m_pchBLSyntaxFile; ///< input BL syntax file name67 Char* m_pchBLSyntaxFile; ///< input BL syntax file name 70 68 #endif 71 69 #endif 72 70 #else 73 char* m_pchReconFile; ///< output reconstruction file name71 Char* m_pchReconFile; ///< output reconstruction file name 74 72 #endif 75 73 #if SYNTAX_OUTPUT 76 char* m_pchBLSyntaxFile; ///< input BL syntax file name74 Char* m_pchBLSyntaxFile; ///< input BL syntax file name 77 75 Int m_iBLSourceWidth; 78 76 Int m_iBLSourceHeight; … … 80 78 #endif 81 79 Int m_iSkipFrame; ///< counter for frames prior to the random access point to skip 82 UInt m_outputBitDepth; ///< bit depth used for writing output 80 Int m_outputBitDepthY; ///< bit depth used for writing output (luma) 81 Int m_outputBitDepthC; ///< bit depth used for writing output (chroma)t 83 82 84 83 Int m_iMaxTemporalLayer; ///< maximum temporal layer to be decoded … … 88 87 Int m_tgtLayerId; ///< target layer ID 89 88 #endif 89 std::vector<Int> m_targetDecLayerIdSet; ///< set of LayerIds to be included in the sub-bitstream extraction process. 90 Int m_respectDefDispWindow; ///< Only output content inside the default display window 90 91 91 #if TARGET_DECLAYERID_SET 92 std::vector<Int> m_targetDecLayerIdSet; ///< set of LayerIds to be included in the sub-bitstream extraction process. 92 public: 93 TAppDecCfg() 94 : m_pchBitstreamFile(NULL) 95 #if !SVC_EXTENSION 96 , m_pchReconFile(NULL) 93 97 #endif 94 95 public: 96 TAppDecCfg() {} 98 , m_iSkipFrame(0) 99 , m_outputBitDepthY(0) 100 , m_outputBitDepthC(0) 101 , m_iMaxTemporalLayer(-1) 102 , m_decodedPictureHashSEIEnabled(0) 103 #if SVC_EXTENSION 104 , m_tgtLayerId(0) 105 #endif 106 , m_respectDefDispWindow(0) 107 #if AVC_BASE 108 , m_iBLSourceWidth(0) 109 , m_iBLSourceHeight(0) 110 #endif 111 #if SYNTAX_OUTPUT 112 , m_iBLSourceWidth(0) 113 , m_iBLSourceHeight(0) 114 , m_iBLFrames(0) 115 #endif 116 {} 97 117 virtual ~TAppDecCfg() {} 98 118 -
trunk/source/App/TAppDecoder/TAppDecTop.cpp
r55 r125 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 53 53 // ==================================================================================================================== 54 54 55 #if SVC_EXTENSION 55 56 TAppDecTop::TAppDecTop() 56 57 { 57 58 ::memset (m_abDecFlag, 0, sizeof (m_abDecFlag)); 58 #if SVC_EXTENSION59 59 for(UInt layer=0; layer < MAX_LAYERS; layer++) 60 60 { … … 62 62 m_apcTDecTop[layer] = &m_acTDecTop[layer]; 63 63 } 64 #else 65 m_iPOCLastDisplay = -MAX_INT; 66 #endif 67 68 } 64 } 65 #else 66 TAppDecTop::TAppDecTop() 67 : m_iPOCLastDisplay(-MAX_INT) 68 { 69 ::memset (m_abDecFlag, 0, sizeof (m_abDecFlag)); 70 } 71 #endif 69 72 70 73 Void TAppDecTop::create() … … 126 129 Void TAppDecTop::decode() 127 130 { 128 UInt uiPOC;131 Int poc; 129 132 TComList<TComPic*>* pcListPic = NULL; 130 133 … … 143 146 144 147 // main decoder loop 145 bool recon_opened[MAX_LAYERS]; // reconstruction file not yet opened. (must be performed after SPS is seen)148 Bool recon_opened[MAX_LAYERS]; // reconstruction file not yet opened. (must be performed after SPS is seen) 146 149 for(UInt layer=0; layer<=m_tgtLayerId; layer++) 147 150 { … … 200 203 201 204 // call actual decoding function 202 bool bNewPicture = false;203 bool bNewPOC = false;205 Bool bNewPicture = false; 206 Bool bNewPOC = false; 204 207 if (nalUnit.empty()) 205 208 { … … 214 217 { 215 218 read(nalu, nalUnit); 216 #if TARGET_DECLAYERID_SET217 219 if( (m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer) || !isNaluWithinTargetDecLayerIdSet(&nalu) || 218 220 (nalu.m_layerId > m_tgtLayerId) ) 219 #else220 if(m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer ||221 (nalu.m_layerId > m_tgtLayerId) )222 #endif223 221 { 224 222 bNewPicture = false; … … 241 239 if (bNewPicture || !bitstreamFile) 242 240 { 243 m_acTDecTop[curLayerId].execute DeblockAndAlf(uiPOC, pcListPic, m_iSkipFrame, m_aiPOCLastDisplay[curLayerId]);241 m_acTDecTop[curLayerId].executeLoopFilters(poc, pcListPic); 244 242 } 245 243 … … 248 246 if ( m_pchReconFile[curLayerId] && !recon_opened[curLayerId] ) 249 247 { 250 if ( m_outputBitDepth == 0 ) 251 { 252 m_outputBitDepth = g_uiBitDepth + g_uiBitIncrement; 253 } 254 255 m_acTVideoIOYuvReconFile[curLayerId].open( m_pchReconFile[curLayerId], true, m_outputBitDepth, g_uiBitDepth + g_uiBitIncrement ); // write mode 248 if (!m_outputBitDepthY) { m_outputBitDepthY = g_bitDepthY; } 249 if (!m_outputBitDepthC) { m_outputBitDepthC = g_bitDepthC; } 250 251 m_acTVideoIOYuvReconFile[curLayerId].open( m_pchReconFile[curLayerId], true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode 252 256 253 recon_opened[curLayerId] = true; 257 254 } 258 255 if ( bNewPicture && bNewPOC && 259 256 ( nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR 260 #if SUPPORT_FOR_RAP_N_LP261 257 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP 262 258 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP 263 #endif264 259 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLANT 265 260 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA ) ) … … 306 301 Void TAppDecTop::decode() 307 302 { 308 UInt uiPOC;303 Int poc; 309 304 TComList<TComPic*>* pcListPic = NULL; 310 305 … … 324 319 325 320 // main decoder loop 326 bool recon_opened = false; // reconstruction file not yet opened. (must be performed after SPS is seen)321 Bool recon_opened = false; // reconstruction file not yet opened. (must be performed after SPS is seen) 327 322 328 323 #if SYNTAX_OUTPUT … … 355 350 streampos location = bitstreamFile.tellg(); 356 351 AnnexBStats stats = AnnexBStats(); 357 bool bPreviousPictureDecoded = false;352 Bool bPreviousPictureDecoded = false; 358 353 359 354 vector<uint8_t> nalUnit; … … 362 357 363 358 // call actual decoding function 364 bool bNewPicture = false;359 Bool bNewPicture = false; 365 360 if (nalUnit.empty()) 366 361 { … … 375 370 { 376 371 read(nalu, nalUnit); 377 #if TARGET_DECLAYERID_SET378 372 if( (m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer) || !isNaluWithinTargetDecLayerIdSet(&nalu) ) 379 #else380 if(m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer)381 #endif382 373 { 383 374 if(bPreviousPictureDecoded) … … 409 400 if (bNewPicture || !bitstreamFile) 410 401 { 411 m_cTDecTop.execute DeblockAndAlf(uiPOC, pcListPic, m_iSkipFrame, m_iPOCLastDisplay);402 m_cTDecTop.executeLoopFilters(poc, pcListPic); 412 403 } 413 404 … … 416 407 if ( m_pchReconFile && !recon_opened ) 417 408 { 418 if ( m_outputBitDepth == 0 ) 419 { 420 m_outputBitDepth = g_uiBitDepth + g_uiBitIncrement; 421 } 422 423 m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepth, g_uiBitDepth + g_uiBitIncrement ); // write mode 409 if (!m_outputBitDepthY) { m_outputBitDepthY = g_bitDepthY; } 410 if (!m_outputBitDepthC) { m_outputBitDepthC = g_bitDepthC; } 411 412 m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode 424 413 recon_opened = true; 425 414 } 426 415 if ( bNewPicture && 427 416 ( nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR 428 #if SUPPORT_FOR_RAP_N_LP429 417 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP 430 418 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP 431 #endif432 419 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLANT 433 420 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA ) ) … … 442 429 } 443 430 } 444 431 445 432 #if SYNTAX_OUTPUT 446 433 if( streamSyntaxFile.is_open() ) … … 559 546 { 560 547 TComPic* pcPic = *(iterPic); 561 TComSPS *sps = pcPic->getSlice(0)->getSPS();562 548 563 549 #if SVC_EXTENSION 564 if ( pcPic->getOutputMark() && (not_displayed > pcPic->get Slice(0)->getSPS()->getNumReorderPics(tId) && pcPic->getPOC() > m_aiPOCLastDisplay[layerId]))565 #else 566 if ( pcPic->getOutputMark() && (not_displayed > pcPic->get Slice(0)->getSPS()->getNumReorderPics(tId) && pcPic->getPOC() > m_iPOCLastDisplay))550 if ( pcPic->getOutputMark() && (not_displayed > pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_aiPOCLastDisplay[layerId])) 551 #else 552 if ( pcPic->getOutputMark() && (not_displayed > pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_iPOCLastDisplay)) 567 553 #endif 568 554 { … … 572 558 if ( m_pchReconFile[layerId] ) 573 559 { 574 m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(), sps->getPicCropLeftOffset(), sps->getPicCropRightOffset(), sps->getPicCropTopOffset(), sps->getPicCropBottomOffset() ); 560 const Window &conf = pcPic->getConformanceWindow(); 561 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 562 m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(), 563 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 564 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 565 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 566 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() ); 575 567 } 576 568 … … 580 572 if ( m_pchReconFile ) 581 573 { 582 m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(), sps->getPicCropLeftOffset(), sps->getPicCropRightOffset(), sps->getPicCropTopOffset(), sps->getPicCropBottomOffset() ); 574 const Window &conf = pcPic->getConformanceWindow(); 575 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 576 m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(), 577 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 578 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 579 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 580 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() ); 583 581 } 584 582 … … 630 628 { 631 629 TComPic* pcPic = *(iterPic); 632 TComSPS *sps = pcPic->getSlice(0)->getSPS();633 630 634 631 if ( pcPic->getOutputMark() ) … … 638 635 if ( m_pchReconFile[layerId] ) 639 636 { 640 m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(), sps->getPicCropLeftOffset(), sps->getPicCropRightOffset(), sps->getPicCropTopOffset(), sps->getPicCropBottomOffset() ); 637 const Window &conf = pcPic->getConformanceWindow(); 638 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 639 m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(), 640 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 641 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 642 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 643 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() ); 641 644 } 642 645 … … 646 649 if ( m_pchReconFile ) 647 650 { 648 m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(), sps->getPicCropLeftOffset(), sps->getPicCropRightOffset(), sps->getPicCropTopOffset(), sps->getPicCropBottomOffset() ); 651 const Window &conf = pcPic->getConformanceWindow(); 652 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 653 m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(), 654 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 655 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 656 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 657 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() ); 649 658 } 650 659 … … 679 688 pcPic = NULL; 680 689 } 681 #endif 690 #endif 682 691 #endif 683 692 iterPic++; … … 686 695 m_aiPOCLastDisplay[layerId] = -MAX_INT; 687 696 #else 688 pcListPic->clear(); //k Cannot be cleared here. Otherwise, pictures will never be destroyed.697 pcListPic->clear(); 689 698 m_iPOCLastDisplay = -MAX_INT; 690 699 #endif 691 700 } 692 701 693 #if TARGET_DECLAYERID_SET694 702 /** \param nalu Input nalu to check whether its LayerId is within targetDecLayerIdSet 695 703 */ … … 709 717 return false; 710 718 } 711 #endif712 719 713 720 //! \} -
trunk/source/App/TAppDecoder/TAppDecTop.h
r2 r125 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 98 98 Void xFlushOutput ( TComList<TComPic*>* pcListPic ); ///< flush all remaining decoded pictures to file 99 99 #endif 100 #if TARGET_DECLAYERID_SET101 100 Bool isNaluWithinTargetDecLayerIdSet ( InputNALUnit* nalu ); ///< check whether given Nalu is within targetDecLayerIdSet 102 #endif103 101 }; 104 102 -
trunk/source/App/TAppDecoder/decmain.cpp
r14 r125 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 *
Note: See TracChangeset for help on using the changeset viewer.