Changeset 125 in SHVCSoftware for trunk/source/App
- Timestamp:
- 16 Apr 2013, 06:39:31 (12 years ago)
- Location:
- trunk/source/App
- Files:
-
- 13 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 * -
trunk/source/App/TAppEncoder/TAppEncCfg.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 * … … 42 42 #include "TLibCommon/TComRom.h" 43 43 #include "TAppEncCfg.h" 44 45 static istream& operator>>(istream &, Level::Name &); 46 static istream& operator>>(istream &, Level::Tier &); 47 static istream& operator>>(istream &, Profile::Name &); 48 44 49 #include "TAppCommon/program_options_lite.h" 45 50 #include "TLibEncoder/TEncRateCtrl.h" … … 58 63 // ==================================================================================================================== 59 64 65 #if SVC_EXTENSION 60 66 TAppEncCfg::TAppEncCfg() 61 #if SVC_EXTENSION 62 : m_pchBitstreamFile() 63 , m_pchColumnWidth() 64 , m_pchRowHeight() 67 : m_pBitstreamFile() 68 , m_pColumnWidth() 69 , m_pRowHeight() 65 70 , m_scalingListFile() 66 71 #if REF_IDX_FRAMEWORK 67 72 , m_elRapSliceBEnabled(0) 68 73 #endif 74 { 75 for(UInt layer=0; layer<MAX_LAYERS; layer++) 76 { 77 m_acLayerCfg[layer].setAppEncCfg(this); 78 } 79 } 69 80 #else 81 TAppEncCfg::TAppEncCfg() 70 82 : m_pchInputFile() 71 83 , m_pchBitstreamFile() 72 84 , m_pchReconFile() 73 85 , m_pchdQPFile() 74 , m_p chColumnWidth()75 , m_p chRowHeight()86 , m_pColumnWidth() 87 , m_pRowHeight() 76 88 , m_scalingListFile() 77 #endif 89 { 90 m_aidQP = NULL; 91 } 92 #endif 93 94 TAppEncCfg::~TAppEncCfg() 78 95 { 79 96 #if SVC_EXTENSION 80 for(UInt layer=0; layer<MAX_LAYERS; layer++) 81 { 82 m_acLayerCfg[layer].setAppEncCfg(this); 83 } 97 free(m_pBitstreamFile); 84 98 #else 85 m_aidQP = NULL; 86 #endif 87 } 88 89 TAppEncCfg::~TAppEncCfg() 90 { 91 #if !SVC_EXTENSION 99 free(m_pchBitstreamFile); 92 100 if ( m_aidQP ) 93 101 { 94 102 delete[] m_aidQP; 95 103 } 96 free(m_pchInputFile); 97 #endif 98 free(m_pchBitstreamFile); 104 free(m_pchInputFile); 105 #endif 99 106 #if !SVC_EXTENSION 100 107 free(m_pchReconFile); 101 108 free(m_pchdQPFile); 102 109 #endif 103 free(m_p chColumnWidth);104 free(m_p chRowHeight);110 free(m_pColumnWidth); 111 free(m_pRowHeight); 105 112 free(m_scalingListFile); 106 113 } … … 120 127 in>>entry.m_QPOffset; 121 128 in>>entry.m_QPFactor; 129 in>>entry.m_tcOffsetDiv2; 130 in>>entry.m_betaOffsetDiv2; 122 131 in>>entry.m_temporalId; 123 132 in>>entry.m_numRefPicsActive; 124 #if !TEMPORAL_LAYER_NON_REFERENCE125 in>>entry.m_refPic;126 #endif127 133 in>>entry.m_numRefPics; 128 134 for ( Int i = 0; i < entry.m_numRefPics; i++ ) … … 134 140 if (entry.m_interRPSPrediction==1) 135 141 { 136 #if !J0234_INTER_RPS_SIMPL137 in>>entry.m_deltaRIdxMinus1;138 #endif139 142 in>>entry.m_deltaRPS; 140 143 in>>entry.m_numRefIdc; … … 146 149 else if (entry.m_interRPSPrediction==2) 147 150 { 148 #if !J0234_INTER_RPS_SIMPL149 in>>entry.m_deltaRIdxMinus1;150 #endif151 151 in>>entry.m_deltaRPS; 152 152 } … … 154 154 if (entry.m_interRPSPrediction) 155 155 { 156 #if !J0234_INTER_RPS_SIMPL157 in>>entry.m_deltaRIdxMinus1;158 #endif159 156 in>>entry.m_deltaRPS; 160 157 in>>entry.m_numRefIdc; … … 194 191 #endif 195 192 193 static const struct MapStrToProfile { 194 const Char* str; 195 Profile::Name value; 196 } strToProfile[] = { 197 {"none", Profile::NONE}, 198 {"main", Profile::MAIN}, 199 {"main10", Profile::MAIN10}, 200 {"main-still-picture", Profile::MAINSTILLPICTURE}, 201 }; 202 203 static const struct MapStrToTier { 204 const Char* str; 205 Level::Tier value; 206 } strToTier[] = { 207 {"main", Level::MAIN}, 208 {"high", Level::HIGH}, 209 }; 210 211 static const struct MapStrToLevel { 212 const Char* str; 213 Level::Name value; 214 } strToLevel[] = { 215 {"none",Level::NONE}, 216 {"1", Level::LEVEL1}, 217 {"2", Level::LEVEL2}, 218 {"2.1", Level::LEVEL2_1}, 219 {"3", Level::LEVEL3}, 220 {"3.1", Level::LEVEL3_1}, 221 {"4", Level::LEVEL4}, 222 {"4.1", Level::LEVEL4_1}, 223 {"5", Level::LEVEL5}, 224 {"5.1", Level::LEVEL5_1}, 225 {"5.2", Level::LEVEL5_2}, 226 {"6", Level::LEVEL6}, 227 {"6.1", Level::LEVEL6_1}, 228 {"6.2", Level::LEVEL6_2}, 229 }; 230 231 template<typename T, typename P> 232 static istream& readStrToEnum(P map[], unsigned long mapLen, istream &in, T &val) 233 { 234 string str; 235 in >> str; 236 237 for (Int i = 0; i < mapLen; i++) 238 { 239 if (str == map[i].str) 240 { 241 val = map[i].value; 242 goto found; 243 } 244 } 245 /* not found */ 246 in.setstate(ios::failbit); 247 found: 248 return in; 249 } 250 251 static istream& operator>>(istream &in, Profile::Name &profile) 252 { 253 return readStrToEnum(strToProfile, sizeof(strToProfile)/sizeof(*strToProfile), in, profile); 254 } 255 256 static istream& operator>>(istream &in, Level::Tier &tier) 257 { 258 return readStrToEnum(strToTier, sizeof(strToTier)/sizeof(*strToTier), in, tier); 259 } 260 261 static istream& operator>>(istream &in, Level::Name &level) 262 { 263 return readStrToEnum(strToLevel, sizeof(strToLevel)/sizeof(*strToLevel), in, level); 264 } 265 266 #if SIGNAL_BITRATE_PICRATE_IN_VPS 267 Void readBoolString(const string inpString, const Int numEntries, Bool* &memberArray, const char *elementName); 268 Void readIntString(const string inpString, const Int numEntries, Int* &memberArray, const char *elementName); 269 #endif 196 270 // ==================================================================================================================== 197 271 // Public member functions … … 204 278 Bool TAppEncCfg::parseCfg( Int argc, Char* argv[] ) 205 279 { 206 bool do_help = false;280 Bool do_help = false; 207 281 208 282 #if SVC_EXTENSION … … 217 291 Int* cfg_FrameRate [MAX_LAYERS]; 218 292 Int* cfg_IntraPeriod [MAX_LAYERS]; 219 Int* cfg_CroppingMode [MAX_LAYERS]; 293 Int* cfg_conformanceMode [MAX_LAYERS]; 294 #if VPS_EXTN_DIRECT_REF_LAYERS 295 Int* cfg_numDirectRefLayers [MAX_LAYERS]; 296 string cfg_refLayerIds [MAX_LAYERS]; 297 string* cfg_refLayerIdsPtr [MAX_LAYERS]; 298 #endif 220 299 for(UInt layer = 0; layer < MAX_LAYERS; layer++) 221 300 { … … 227 306 cfg_FrameRate[layer] = &m_acLayerCfg[layer].m_iFrameRate; 228 307 cfg_IntraPeriod[layer] = &m_acLayerCfg[layer].m_iIntraPeriod; 229 cfg_CroppingMode[layer] = &m_acLayerCfg[layer].m_croppingMode; 308 cfg_conformanceMode[layer] = &m_acLayerCfg[layer].m_conformanceMode; 309 #if VPS_EXTN_DIRECT_REF_LAYERS 310 cfg_numDirectRefLayers [layer] = &m_acLayerCfg[layer].m_numDirectRefLayers; 311 cfg_refLayerIdsPtr [layer] = &cfg_refLayerIds[layer]; 312 #endif 230 313 } 231 314 #if AVC_SYNTAX … … 241 324 string cfg_RowHeight; 242 325 string cfg_ScalingListFile; 326 #if SIGNAL_BITRATE_PICRATE_IN_VPS 327 string cfg_bitRateInfoPresentFlag; 328 string cfg_picRateInfoPresentFlag; 329 string cfg_avgBitRate; 330 string cfg_maxBitRate; 331 string cfg_avgPicRate; 332 string cfg_constantPicRateIdc; 333 #endif 243 334 po::Options opts; 244 335 opts.addOptions() … … 251 342 ("ReconFile%d,-o%d", cfg_ReconFile, string(""), MAX_LAYERS, "reconstruction YUV input file name for layer %d") 252 343 ("LayerConfig%d,-lc%d", cfg_LayerCfgFile, string(""), MAX_LAYERS, "layer %d configuration file name") 253 ("BitstreamFile,b", cfg_BitstreamFile, string(""), "bitstream output file name")254 344 ("SourceWidth%d,-wdt%d", cfg_SourceWidth, 0, MAX_LAYERS, "Source picture width for layer %d") 255 345 ("SourceHeight%d,-hgt%d", cfg_SourceHeight, 0, MAX_LAYERS, "Source picture height for layer %d") 256 346 ("FrameRate%d,-fr%d", cfg_FrameRate, 0, MAX_LAYERS, "Frame rate for layer %d") 257 347 ("LambdaModifier%d,-LM%d", m_adLambdaModifier, ( double )1.0, MAX_TLAYER, "Lambda modifier for temporal layer %d") 258 ("CroppingMode%d", cfg_CroppingMode,0, MAX_LAYERS, "Cropping mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping") 259 ("InputBitDepth", m_uiInputBitDepth, 8u, "bit-depth of input file") 260 ("BitDepth", m_uiInputBitDepth, 8u, "deprecated alias of InputBitDepth") 261 ("OutputBitDepth", m_uiOutputBitDepth, 0u, "bit-depth of output file") 262 ("InternalBitDepth", m_uiInternalBitDepth, 0u, "Internal bit-depth (BitDepth+BitIncrement)") 348 #if VPS_EXTN_DIRECT_REF_LAYERS 349 ("NumDirectRefLayers%d", cfg_numDirectRefLayers, -1, MAX_LAYERS, "Number of direct reference layers") 350 ("RefLayerIds%d", cfg_refLayerIdsPtr, string(""), MAX_LAYERS, "direct reference layer IDs") 351 #endif 352 ("NumLayers", m_numLayers, 1, "Number of layers to code") 353 ("ConformanceMode%d", cfg_conformanceMode,0, MAX_LAYERS, "Window conformance mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping") 354 355 ("BitstreamFile,b", cfg_BitstreamFile, string(""), "Bitstream output file name") 356 ("InputBitDepth", m_inputBitDepthY, 8, "Bit-depth of input file") 357 ("OutputBitDepth", m_outputBitDepthY, 0, "Bit-depth of output file (default:InternalBitDepth)") 358 ("InternalBitDepth", m_internalBitDepthY, 0, "Bit-depth the codec operates at. (default:InputBitDepth)" 359 "If different to InputBitDepth, source data will be converted") 360 ("InputBitDepthC", m_inputBitDepthC, 0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)") 361 ("OutputBitDepthC", m_outputBitDepthC, 0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)") 362 ("InternalBitDepthC", m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)") 363 263 364 #if AVC_BASE 264 365 ("InputBLFile,-ibl", *cfg_InputFile[0], string(""), "Base layer rec YUV input file name") … … 269 370 #if REF_IDX_FRAMEWORK 270 371 ("EnableElRapB,-use-rap-b", m_elRapSliceBEnabled, 0, "Set ILP over base-layer I picture to B picture (default is P picture_") 271 #endif 272 #else 372 #endif 373 #else 273 374 ("InputFile,i", cfg_InputFile, string(""), "Original YUV input file name") 274 375 ("BitstreamFile,b", cfg_BitstreamFile, string(""), "Bitstream output file name") … … 276 377 ("SourceWidth,-wdt", m_iSourceWidth, 0, "Source picture width") 277 378 ("SourceHeight,-hgt", m_iSourceHeight, 0, "Source picture height") 278 ("InputBitDepth", m_uiInputBitDepth, 8u, "Bit-depth of input file") 279 ("BitDepth", m_uiInputBitDepth, 8u, "Deprecated alias of InputBitDepth") 280 ("OutputBitDepth", m_uiOutputBitDepth, 0u, "Bit-depth of output file") 281 ("InternalBitDepth", m_uiInternalBitDepth, 0u, "Internal bit-depth (BitDepth+BitIncrement)") 282 ("CroppingMode", m_croppingMode, 0, "Cropping mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping") 283 ("HorizontalPadding,-pdx",m_aiPad[0], 0, "Horizontal source padding for cropping mode 2") 284 ("VerticalPadding,-pdy", m_aiPad[1], 0, "Vertical source padding for cropping mode 2") 285 ("CropLeft", m_cropLeft, 0, "Left cropping for cropping mode 3") 286 ("CropRight", m_cropRight, 0, "Right cropping for cropping mode 3") 287 ("CropTop", m_cropTop, 0, "Top cropping for cropping mode 3") 288 ("CropBottom", m_cropBottom, 0, "Bottom cropping for cropping mode 3") 379 ("InputBitDepth", m_inputBitDepthY, 8, "Bit-depth of input file") 380 ("OutputBitDepth", m_outputBitDepthY, 0, "Bit-depth of output file (default:InternalBitDepth)") 381 ("InternalBitDepth", m_internalBitDepthY, 0, "Bit-depth the codec operates at. (default:InputBitDepth)" 382 "If different to InputBitDepth, source data will be converted") 383 ("InputBitDepthC", m_inputBitDepthC, 0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)") 384 ("OutputBitDepthC", m_outputBitDepthC, 0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)") 385 ("InternalBitDepthC", m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)") 386 ("ConformanceMode", m_conformanceMode, 0, "Window conformance mode (0: no window, 1:automatic padding, 2:padding, 3:conformance") 387 ("HorizontalPadding,-pdx",m_aiPad[0], 0, "Horizontal source padding for conformance window mode 2") 388 ("VerticalPadding,-pdy", m_aiPad[1], 0, "Vertical source padding for conformance window mode 2") 389 ("ConfLeft", m_confLeft, 0, "Left offset for window conformance mode 3") 390 ("ConfRight", m_confRight, 0, "Right offset for window conformance mode 3") 391 ("ConfTop", m_confTop, 0, "Top offset for window conformance mode 3") 392 ("ConfBottom", m_confBottom, 0, "Bottom offset for window conformance mode 3") 289 393 ("FrameRate,-fr", m_iFrameRate, 0, "Frame rate") 290 394 #endif 291 395 ("FrameSkip,-fs", m_FrameSkip, 0u, "Number of frames to skip at start of input YUV") 292 ("FramesToBeEncoded,f", m_iFrameToBeEncoded, 0, "Number of frames to be encoded (default=all)") 293 294 #if SVC_EXTENSION 295 ("NumLayers", m_numLayers, 1, "Number of layers to code") 396 ("FramesToBeEncoded,f", m_framesToBeEncoded, 0, "Number of frames to be encoded (default=all)") 397 398 // Profile and level 399 ("Profile", m_profile, Profile::NONE, "Profile to be used when encoding (Incomplete)") 400 ("Level", m_level, Level::NONE, "Level limit to be used, eg 5.1 (Incomplete)") 401 ("Tier", m_levelTier, Level::MAIN, "Tier to use for interpretation of --Level") 402 403 #if L0046_CONSTRAINT_FLAGS 404 ("ProgressiveSource", m_progressiveSourceFlag, false, "Indicate that source is progressive") 405 ("InterlacedSource", m_interlacedSourceFlag, false, "Indicate that source is interlaced") 406 ("NonPackedSource", m_nonPackedConstraintFlag, false, "Indicate that source does not contain frame packing") 407 ("FrameOnly", m_frameOnlyConstraintFlag, false, "Indicate that the bitstream contains only frames") 296 408 #endif 297 409 … … 326 438 ("ASR", m_bUseASR, false, "Adaptive motion search range") 327 439 328 #if !SVC_EXTENSION 440 #if SVC_EXTENSION 441 ("LambdaModifier%d,-LM%d", m_adLambdaModifier, ( double )1.0, MAX_TLAYER, "Lambda modifier for temporal layer %d") 442 #else 329 443 // Mode decision parameters 330 ("LambdaModifier0,-LM0", m_adLambdaModifier[ 0 ], ( double )1.0, "Lambda modifier for temporal layer 0")331 ("LambdaModifier1,-LM1", m_adLambdaModifier[ 1 ], ( double )1.0, "Lambda modifier for temporal layer 1")332 ("LambdaModifier2,-LM2", m_adLambdaModifier[ 2 ], ( double )1.0, "Lambda modifier for temporal layer 2")333 ("LambdaModifier3,-LM3", m_adLambdaModifier[ 3 ], ( double )1.0, "Lambda modifier for temporal layer 3")334 ("LambdaModifier4,-LM4", m_adLambdaModifier[ 4 ], ( double )1.0, "Lambda modifier for temporal layer 4")335 ("LambdaModifier5,-LM5", m_adLambdaModifier[ 5 ], ( double )1.0, "Lambda modifier for temporal layer 5")336 ("LambdaModifier6,-LM6", m_adLambdaModifier[ 6 ], ( double )1.0, "Lambda modifier for temporal layer 6")337 ("LambdaModifier7,-LM7", m_adLambdaModifier[ 7 ], ( double )1.0, "Lambda modifier for temporal layer 7")444 ("LambdaModifier0,-LM0", m_adLambdaModifier[ 0 ], ( Double )1.0, "Lambda modifier for temporal layer 0") 445 ("LambdaModifier1,-LM1", m_adLambdaModifier[ 1 ], ( Double )1.0, "Lambda modifier for temporal layer 1") 446 ("LambdaModifier2,-LM2", m_adLambdaModifier[ 2 ], ( Double )1.0, "Lambda modifier for temporal layer 2") 447 ("LambdaModifier3,-LM3", m_adLambdaModifier[ 3 ], ( Double )1.0, "Lambda modifier for temporal layer 3") 448 ("LambdaModifier4,-LM4", m_adLambdaModifier[ 4 ], ( Double )1.0, "Lambda modifier for temporal layer 4") 449 ("LambdaModifier5,-LM5", m_adLambdaModifier[ 5 ], ( Double )1.0, "Lambda modifier for temporal layer 5") 450 ("LambdaModifier6,-LM6", m_adLambdaModifier[ 6 ], ( Double )1.0, "Lambda modifier for temporal layer 6") 451 ("LambdaModifier7,-LM7", m_adLambdaModifier[ 7 ], ( Double )1.0, "Lambda modifier for temporal layer 7") 338 452 #endif 339 453 … … 360 474 ("dQPFile,m", cfg_dQPFile, string(""), "dQP file name") 361 475 #endif 362 ("RDOQ", m_bUseRDOQ, true ) 363 476 ("RDOQ", m_useRDOQ, true ) 477 ("RDOQTS", m_useRDOQTS, true ) 478 #if L0232_RD_PENALTY 479 ("RDpenalty", m_rdPenalty, 0, "RD-penalty for 32x32 TU for intra in non-intra slices. 0:disbaled 1:RD-penalty 2:maximum RD-penalty") 480 #endif 364 481 // Entropy coding parameters 365 482 ("SBACRD", m_bUseSBACRD, true, "SBAC based RD estimation") … … 373 490 374 491 // Coding tools 375 #if !REMOVE_NSQT 376 ("NSQT", m_enableNSQT, true, "Enable non-square transforms") 377 #endif 378 ("AMP", m_enableAMP, true, "Enable asymmetric motion partitions") 379 #if !REMOVE_LMCHROMA 380 ("LMChroma", m_bUseLMChroma, true, "Intra chroma prediction based on reconstructed luma") 381 #endif 382 ("TransformSkip", m_useTransformSkip, false, "Intra transform skipping") 383 ("TransformSkipFast", m_useTransformSkipFast, false, "Fast intra transform skipping") 384 #if !REMOVE_ALF 385 ("ALF", m_bUseALF, true, "Enable Adaptive Loop Filter") 386 #endif 387 ("SAO", m_bUseSAO, true, "Enable Sample Adaptive Offset") 388 ("MaxNumOffsetsPerPic", m_maxNumOffsetsPerPic, 2048, "Max number of SAO offset per picture (Default: 2048)") 389 #if SAO_LCU_BOUNDARY 390 ("SAOLcuBoundary", m_saoLcuBoundary, false, "0: right/bottom LCU boundary areas skipped from SAO parameter estimation, 1: non-deblocked pixels are used for those areas") 391 #endif 392 ("SAOLcuBasedOptimization", m_saoLcuBasedOptimization, true, "0: SAO picture-based optimization, 1: SAO LCU-based optimization ") 393 #if !REMOVE_ALF 394 ("ALFLowLatencyEncode", m_alfLowLatencyEncoding, false, "Low-latency ALF encoding, 0: picture latency (trained from current frame), 1: LCU latency(trained from previous frame)") 395 #endif 396 ("SliceMode", m_iSliceMode, 0, "0: Disable all Recon slice limits, 1: Enforce max # of LCUs, 2: Enforce max # of bytes") 397 ("SliceArgument", m_iSliceArgument, 0, "if SliceMode==1 SliceArgument represents max # of LCUs. if SliceMode==2 SliceArgument represents max # of bytes.") 398 ("DependentSliceMode", m_iDependentSliceMode, 0, "0: Disable all dependent slice limits, 1: Enforce max # of LCUs, 2: Enforce constraint based dependent slices") 399 ("DependentSliceArgument", m_iDependentSliceArgument,0, "if DependentSliceMode==1 SliceArgument represents max # of LCUs. if DependentSliceMode==2 DependentSliceArgument represents max # of bins.") 400 #if DEPENDENT_SLICES 401 #if TILES_WPP_ENTROPYSLICES_FLAGS 402 ("EntropySliceEnabledFlag", m_entropySliceEnabledFlag, false, "Enable use of entropy slices instead of dependent slices." ) 403 #else 404 ("CabacIndependentFlag", m_bCabacIndependentFlag, false) 405 #endif 406 #endif 407 #if !REMOVE_FGS 408 ("SliceGranularity", m_iSliceGranularity, 0, "0: Slices always end at LCU borders. 1-3: slices may end at a depth of 1-3 below LCU level.") 409 #endif 410 ("LFCrossSliceBoundaryFlag", m_bLFCrossSliceBoundaryFlag, true) 411 412 ("ConstrainedIntraPred", m_bUseConstrainedIntraPred, false, "Constrained Intra Prediction") 413 ("PCMEnabledFlag", m_usePCM , false) 414 ("PCMLog2MaxSize", m_pcmLog2MaxSize, 5u) 415 ("PCMLog2MinSize", m_uiPCMLog2MinSize, 3u) 416 417 ("PCMInputBitDepthFlag", m_bPCMInputBitDepthFlag, true) 418 ("PCMFilterDisableFlag", m_bPCMFilterDisableFlag, false) 419 ("LosslessCuEnabled", m_useLossless, false) 420 ("weighted_pred_flag,-wpP", m_bUseWeightPred, false, "weighted prediction flag (P-Slices)") 421 ("weighted_bipred_flag,-wpB", m_useWeightedBiPred, false, "weighted bipred flag (B-Slices)") 422 ("Log2ParallelMergeLevel", m_log2ParallelMergeLevel, 2u, "Parallel merge estimation region") 423 ("UniformSpacingIdc", m_iUniformSpacingIdr, 0, "Indicates if the column and row boundaries are distributed uniformly") 424 ("NumTileColumnsMinus1", m_iNumColumnsMinus1, 0, "Number of columns in a picture minus 1") 425 ("ColumnWidthArray", cfg_ColumnWidth, string(""), "Array containing ColumnWidth values in units of LCU") 426 ("NumTileRowsMinus1", m_iNumRowsMinus1, 0, "Number of rows in a picture minus 1") 427 ("RowHeightArray", cfg_RowHeight, string(""), "Array containing RowHeight values in units of LCU") 428 ("LFCrossTileBoundaryFlag", m_bLFCrossTileBoundaryFlag, true, "1: cross-tile-boundary loop filtering. 0:non-cross-tile-boundary loop filtering") 429 ("WaveFrontSynchro", m_iWaveFrontSynchro, 0, "0: no synchro; 1 synchro with TR; 2 TRR etc") 430 ("ScalingList", m_useScalingListId, 0, "0: no scaling list, 1: default scaling lists, 2: scaling lists specified in ScalingListFile") 431 ("ScalingListFile", cfg_ScalingListFile, string(""), "Scaling list file name") 432 ("SignHideFlag,-SBH", m_signHideFlag, 1) 433 ("MaxNumMergeCand", m_maxNumMergeCand, 5u, "Maximum number of merge candidates") 492 ("AMP", m_enableAMP, true, "Enable asymmetric motion partitions") 493 ("TransformSkip", m_useTransformSkip, false, "Intra transform skipping") 494 ("TransformSkipFast", m_useTransformSkipFast, false, "Fast intra transform skipping") 495 ("SAO", m_bUseSAO, true, "Enable Sample Adaptive Offset") 496 ("MaxNumOffsetsPerPic", m_maxNumOffsetsPerPic, 2048, "Max number of SAO offset per picture (Default: 2048)") 497 ("SAOLcuBoundary", m_saoLcuBoundary, false, "0: right/bottom LCU boundary areas skipped from SAO parameter estimation, 1: non-deblocked pixels are used for those areas") 498 ("SAOLcuBasedOptimization", m_saoLcuBasedOptimization, true, "0: SAO picture-based optimization, 1: SAO LCU-based optimization ") 499 ("SliceMode", m_sliceMode, 0, "0: Disable all Recon slice limits, 1: Enforce max # of LCUs, 2: Enforce max # of bytes, 3:specify tiles per dependent slice") 500 ("SliceArgument", m_sliceArgument, 0, "Depending on SliceMode being:" 501 "\t1: max number of CTUs per slice" 502 "\t2: max number of bytes per slice" 503 "\t3: max number of tiles per slice") 504 ("SliceSegmentMode", m_sliceSegmentMode, 0, "0: Disable all slice segment limits, 1: Enforce max # of LCUs, 2: Enforce max # of bytes, 3:specify tiles per dependent slice") 505 ("SliceSegmentArgument", m_sliceSegmentArgument, 0, "Depending on SliceSegmentMode being:" 506 "\t1: max number of CTUs per slice segment" 507 "\t2: max number of bytes per slice segment" 508 "\t3: max number of tiles per slice segment") 509 ("LFCrossSliceBoundaryFlag", m_bLFCrossSliceBoundaryFlag, true) 510 511 ("ConstrainedIntraPred", m_bUseConstrainedIntraPred, false, "Constrained Intra Prediction") 512 513 ("PCMEnabledFlag", m_usePCM, false) 514 ("PCMLog2MaxSize", m_pcmLog2MaxSize, 5u) 515 ("PCMLog2MinSize", m_uiPCMLog2MinSize, 3u) 516 ("PCMInputBitDepthFlag", m_bPCMInputBitDepthFlag, true) 517 ("PCMFilterDisableFlag", m_bPCMFilterDisableFlag, false) 518 519 ("LosslessCuEnabled", m_useLossless, false) 520 521 ("WeightedPredP,-wpP", m_useWeightedPred, false, "Use weighted prediction in P slices") 522 ("WeightedPredB,-wpB", m_useWeightedBiPred, false, "Use weighted (bidirectional) prediction in B slices") 523 ("Log2ParallelMergeLevel", m_log2ParallelMergeLevel, 2u, "Parallel merge estimation region") 524 ("UniformSpacingIdc", m_iUniformSpacingIdr, 0, "Indicates if the column and row boundaries are distributed uniformly") 525 ("NumTileColumnsMinus1", m_iNumColumnsMinus1, 0, "Number of columns in a picture minus 1") 526 ("ColumnWidthArray", cfg_ColumnWidth, string(""), "Array containing ColumnWidth values in units of LCU") 527 ("NumTileRowsMinus1", m_iNumRowsMinus1, 0, "Number of rows in a picture minus 1") 528 ("RowHeightArray", cfg_RowHeight, string(""), "Array containing RowHeight values in units of LCU") 529 ("LFCrossTileBoundaryFlag", m_bLFCrossTileBoundaryFlag, true, "1: cross-tile-boundary loop filtering. 0:non-cross-tile-boundary loop filtering") 530 ("WaveFrontSynchro", m_iWaveFrontSynchro, 0, "0: no synchro; 1 synchro with TR; 2 TRR etc") 531 ("ScalingList", m_useScalingListId, 0, "0: no scaling list, 1: default scaling lists, 2: scaling lists specified in ScalingListFile") 532 ("ScalingListFile", cfg_ScalingListFile, string(""), "Scaling list file name") 533 ("SignHideFlag,-SBH", m_signHideFlag, 1) 534 ("MaxNumMergeCand", m_maxNumMergeCand, 5u, "Maximum number of merge candidates") 434 535 435 536 /* Misc. */ 436 ("SEIpictureDigest", m_decodePictureHashSEIEnabled, 0, "Control generation of decode picture hash SEI messages\n" 437 "\t3: checksum\n" 438 "\t2: CRC\n" 439 "\t1: use MD5\n" 440 "\t0: disable") 537 ("SEIDecodedPictureHash", m_decodedPictureHashSEIEnabled, 0, "Control generation of decode picture hash SEI messages\n" 538 "\t3: checksum\n" 539 "\t2: CRC\n" 540 "\t1: use MD5\n" 541 "\t0: disable") 542 ("SEIpictureDigest", m_decodedPictureHashSEIEnabled, 0, "deprecated alias for SEIDecodedPictureHash") 441 543 ("TMVPMode", m_TMVPModeId, 1, "TMVP mode 0: TMVP disable for all slices. 1: TMVP enable for all slices (default) 2: TMVP enable for certain slices only") 442 544 ("FEN", m_bUseFastEnc, false, "fast encoder setting") … … 445 547 ("CFM", m_bUseCbfFastMode, false, "Cbf fast mode setting") 446 548 ("ESD", m_useEarlySkipDetection, false, "Early SKIP detection setting") 549 #if RATE_CONTROL_LAMBDA_DOMAIN 550 ( "RateControl", m_RCEnableRateControl, false, "Rate control: enable rate control" ) 551 ( "TargetBitrate", m_RCTargetBitrate, 0, "Rate control: target bitrate" ) 552 ( "KeepHierarchicalBit", m_RCKeepHierarchicalBit, false, "Rate control: keep hierarchical bit allocation in rate control algorithm" ) 553 ( "LCULevelRateControl", m_RCLCULevelRC, true, "Rate control: true: LCU level RC; false: picture level RC" ) 554 ( "RCLCUSeparateModel", m_RCUseLCUSeparateModel, true, "Rate control: use LCU level separate R-lambda model" ) 555 ( "InitialQP", m_RCInitialQP, 0, "Rate control: initial QP" ) 556 ( "RCForceIntraQP", m_RCForceIntraQP, false, "Rate control: force intra QP to be equal to initial QP" ) 557 #else 447 558 ("RateCtrl,-rc", m_enableRateCtrl, false, "Rate control on/off") 448 559 ("TargetBitrate,-tbr", m_targetBitrate, 0, "Input target bitrate") 449 560 ("NumLCUInUnit,-nu", m_numLCUInUnit, 0, "Number of LCUs in an Unit") 561 #endif 450 562 451 563 ("TransquantBypassEnableFlag", m_TransquantBypassEnableFlag, false, "transquant_bypass_enable_flag indicator in PPS") 452 564 ("CUTransquantBypassFlagValue", m_CUTransquantBypassFlagValue, false, "Fixed cu_transquant_bypass_flag value, when transquant_bypass_enable_flag is enabled") 453 #if RECALCULATE_QP_ACCORDING_LAMBDA454 565 ("RecalculateQPAccordingToLambda", m_recalculateQPAccordingToLambda, false, "Recalculate QP values according to lambda values. Do not suggest to be enabled in all intra case") 455 #endif 456 #if ACTIVE_PARAMETER_SETS_SEI_MESSAGE 457 ("ActiveParameterSets", m_activeParameterSetsSEIEnabled, 0, "Control generation of active parameter sets SEI messages\n" 458 "\t2: enable active parameter sets SEI message with active_sps_id\n" 459 "\t1: enable active parameter sets SEI message without active_sps_id\n" 460 "\t0: disable") 461 #endif 462 #if SUPPORT_FOR_VUI 566 ("StrongIntraSmoothing,-sis", m_useStrongIntraSmoothing, true, "Enable strong intra smoothing for 32x32 blocks") 567 ("SEIActiveParameterSets", m_activeParameterSetsSEIEnabled, 0, "Enable generation of active parameter sets SEI messages") 463 568 ("VuiParametersPresent,-vui", m_vuiParametersPresentFlag, false, "Enable generation of vui_parameters()") 464 569 ("AspectRatioInfoPresent", m_aspectRatioInfoPresentFlag, false, "Signals whether aspect_ratio_idc is present") … … 466 571 ("SarWidth", m_sarWidth, 0, "horizontal size of the sample aspect ratio") 467 572 ("SarHeight", m_sarHeight, 0, "vertical size of the sample aspect ratio") 468 ("OverscanInfoPresent", m_overscanInfoPresentFlag, false, "Indicates whether c roppeddecoded pictures are suitable for display using overscan\n")469 ("OverscanAppropriate", m_overscanAppropriateFlag, false, "Indicates whether c roppeddecoded pictures are suitable for display using overscan\n")573 ("OverscanInfoPresent", m_overscanInfoPresentFlag, false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n") 574 ("OverscanAppropriate", m_overscanAppropriateFlag, false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n") 470 575 ("VideoSignalTypePresent", m_videoSignalTypePresentFlag, false, "Signals whether video_format, video_full_range_flag, and colour_description_present_flag are present") 471 576 ("VideoFormat", m_videoFormat, 5, "Indicates representation of pictures") … … 479 584 ("ChromaSampleLocTypeBottomField", m_chromaSampleLocTypeBottomField, 0, "Specifies the location of chroma samples for bottom field") 480 585 ("NeutralChromaIndication", m_neutralChromaIndicationFlag, false, "Indicates that the value of all decoded chroma samples is equal to 1<<(BitDepthCr-1)") 586 ("DefaultDisplayWindowFlag", m_defaultDisplayWindowFlag, false, "Indicates the presence of the Default Window parameters") 587 ("DefDispWinLeftOffset", m_defDispWinLeftOffset, 0, "Specifies the left offset of the default display window from the conformance window") 588 ("DefDispWinRightOffset", m_defDispWinRightOffset, 0, "Specifies the right offset of the default display window from the conformance window") 589 ("DefDispWinTopOffset", m_defDispWinTopOffset, 0, "Specifies the top offset of the default display window from the conformance window") 590 ("DefDispWinBottomOffset", m_defDispWinBottomOffset, 0, "Specifies the bottom offset of the default display window from the conformance window") 591 ("FrameFieldInfoPresentFlag", m_frameFieldInfoPresentFlag, false, "Indicates that pic_struct and field coding related values are present in picture timing SEI messages") 592 ("PocProportionalToTimingFlag", m_pocProportionalToTimingFlag, false, "Indicates that the POC value is proportional to the output time w.r.t. first picture in CVS") 593 ("NumTicksPocDiffOneMinus1", m_numTicksPocDiffOneMinus1, 0, "Number of ticks minus 1 that for a POC difference of one") 481 594 ("BitstreamRestriction", m_bitstreamRestrictionFlag, false, "Signals whether bitstream restriction parameters are present") 482 595 ("TilesFixedStructure", m_tilesFixedStructureFlag, false, "Indicates that each active picture parameter set has the same values of the syntax elements related to tiles") … … 486 599 ("Log2MaxMvLengthHorizontal", m_log2MaxMvLengthHorizontal, 15, "Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units") 487 600 ("Log2MaxMvLengthVertical", m_log2MaxMvLengthVertical, 15, "Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units") 488 #endif489 #if RECOVERY_POINT_SEI490 601 ("SEIRecoveryPoint", m_recoveryPointSEIEnabled, 0, "Control generation of recovery point SEI messages") 491 #endif492 #if BUFFERING_PERIOD_AND_TIMING_SEI493 602 ("SEIBufferingPeriod", m_bufferingPeriodSEIEnabled, 0, "Control generation of buffering period SEI messages") 494 603 ("SEIPictureTiming", m_pictureTimingSEIEnabled, 0, "Control generation of picture timing SEI messages") 604 ("SEIFramePacking", m_framePackingSEIEnabled, 0, "Control generation of frame packing SEI messages") 605 ("SEIFramePackingType", m_framePackingSEIType, 0, "Define frame packing arrangement\n" 606 "\t0: checkerboard - pixels alternatively represent either frames\n" 607 "\t1: column alternation - frames are interlaced by column\n" 608 "\t2: row alternation - frames are interlaced by row\n" 609 "\t3: side by side - frames are displayed horizontally\n" 610 "\t4: top bottom - frames are displayed vertically\n" 611 "\t5: frame alternation - one frame is alternated with the other") 612 ("SEIFramePackingId", m_framePackingSEIId, 0, "Id of frame packing SEI message for a given session") 613 ("SEIFramePackingQuincunx", m_framePackingSEIQuincunx, 0, "Indicate the presence of a Quincunx type video frame") 614 ("SEIFramePackingInterpretation", m_framePackingSEIInterpretation, 0, "Indicate the interpretation of the frame pair\n" 615 "\t0: unspecified\n" 616 "\t1: stereo pair, frame0 represents left view\n" 617 "\t2: stereo pair, frame0 represents right view") 618 ("SEIDisplayOrientation", m_displayOrientationSEIAngle, 0, "Control generation of display orientation SEI messages\n" 619 "\tN: 0 < N < (2^16 - 1) enable display orientation SEI message with anticlockwise_rotation = N and display_orientation_repetition_period = 1\n" 620 "\t0: disable") 621 ("SEITemporalLevel0Index", m_temporalLevel0IndexSEIEnabled, 0, "Control generation of temporal level 0 index SEI messages") 622 ("SEIGradualDecodingRefreshInfo", m_gradualDecodingRefreshInfoEnabled, 0, "Control generation of gradual decoding refresh information SEI message") 623 ("SEIDecodingUnitInfo", m_decodingUnitInfoSEIEnabled, 0, "Control generation of decoding unit information SEI message.") 624 #if SIGNAL_BITRATE_PICRATE_IN_VPS 625 ("BitRatePicRateMaxTLayers", m_bitRatePicRateMaxTLayers, 0, "Maximum number of sub-layers signalled; can be inferred otherwise; here for easy parsing of config. file") 626 ("BitRateInfoPresent", cfg_bitRateInfoPresentFlag, string(""), "Control signalling of bit rate information of avg. bit rate and max. bit rate in VPS\n" 627 "\t0: Do not sent bit rate info\n" 628 "\tN (N > 0): Send bit rate info for N sub-layers. N should equal maxTempLayers.") 629 ("PicRateInfoPresent", cfg_picRateInfoPresentFlag, string(""), "Control signalling of picture rate information of avg. bit rate and max. bit rate in VPS\n" 630 "\t0: Do not sent picture rate info\n" 631 "\tN (N > 0): Send picture rate info for N sub-layers. N should equal maxTempLayers.") 632 ("AvgBitRate", cfg_avgBitRate, string(""), "List of avg. bit rates for the different sub-layers; include non-negative number even if corresponding flag is 0") 633 ("MaxBitRate", cfg_maxBitRate, string(""), "List of max. bit rates for the different sub-layers; include non-negative number even if corresponding flag is 0") 634 ("AvgPicRate", cfg_avgPicRate, string(""), "List of avg. picture rates for the different sub-layers; include non-negative number even if corresponding flag is 0") 635 ("ConstantPicRateIdc", cfg_constantPicRateIdc, string(""), "List of constant picture rate IDCs; include non-negative number even if corresponding flag is 0") 495 636 #endif 496 637 ; … … 502 643 } 503 644 po::setDefaults(opts); 504 const list<const char*>& argv_unhandled = po::scanArgv(opts, argc, (const char**) argv);505 506 for (list<const char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++)645 const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv); 646 647 for (list<const Char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++) 507 648 { 508 649 fprintf(stderr, "Unhandled argument ignored: `%s'\n", *it); … … 521 662 /* convert std::string to c string for compatability */ 522 663 #if SVC_EXTENSION 523 m_p chBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str());664 m_pBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str()); 524 665 #if AVC_SYNTAX 525 666 m_BLSyntaxFile = cfg_BLSyntaxFile.empty() ? NULL : strdup(cfg_BLSyntaxFile.c_str()); … … 530 671 m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str()); 531 672 m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str()); 532 #endif 533 534 m_pchColumnWidth = cfg_ColumnWidth.empty() ? NULL: strdup(cfg_ColumnWidth.c_str()); 535 m_pchRowHeight = cfg_RowHeight.empty() ? NULL : strdup(cfg_RowHeight.c_str()); 673 #endif 674 675 Char* pColumnWidth = cfg_ColumnWidth.empty() ? NULL: strdup(cfg_ColumnWidth.c_str()); 676 Char* pRowHeight = cfg_RowHeight.empty() ? NULL : strdup(cfg_RowHeight.c_str()); 677 if( m_iUniformSpacingIdr == 0 && m_iNumColumnsMinus1 > 0 ) 678 { 679 char *columnWidth; 680 int i=0; 681 m_pColumnWidth = new UInt[m_iNumColumnsMinus1]; 682 columnWidth = strtok(pColumnWidth, " ,-"); 683 while(columnWidth!=NULL) 684 { 685 if( i>=m_iNumColumnsMinus1 ) 686 { 687 printf( "The number of columns whose width are defined is larger than the allowed number of columns.\n" ); 688 exit( EXIT_FAILURE ); 689 } 690 *( m_pColumnWidth + i ) = atoi( columnWidth ); 691 columnWidth = strtok(NULL, " ,-"); 692 i++; 693 } 694 if( i<m_iNumColumnsMinus1 ) 695 { 696 printf( "The width of some columns is not defined.\n" ); 697 exit( EXIT_FAILURE ); 698 } 699 } 700 else 701 { 702 m_pColumnWidth = NULL; 703 } 704 705 if( m_iUniformSpacingIdr == 0 && m_iNumRowsMinus1 > 0 ) 706 { 707 char *rowHeight; 708 int i=0; 709 m_pRowHeight = new UInt[m_iNumRowsMinus1]; 710 rowHeight = strtok(pRowHeight, " ,-"); 711 while(rowHeight!=NULL) 712 { 713 if( i>=m_iNumRowsMinus1 ) 714 { 715 printf( "The number of rows whose height are defined is larger than the allowed number of rows.\n" ); 716 exit( EXIT_FAILURE ); 717 } 718 *( m_pRowHeight + i ) = atoi( rowHeight ); 719 rowHeight = strtok(NULL, " ,-"); 720 i++; 721 } 722 if( i<m_iNumRowsMinus1 ) 723 { 724 printf( "The height of some rows is not defined.\n" ); 725 exit( EXIT_FAILURE ); 726 } 727 } 728 else 729 { 730 m_pRowHeight = NULL; 731 } 732 #if VPS_EXTN_DIRECT_REF_LAYERS 733 for(Int layer = 0; layer < MAX_LAYERS; layer++) 734 { 735 Char* pRefLayerIds = cfg_refLayerIds[layer].empty() ? NULL: strdup(cfg_refLayerIds[layer].c_str()); 736 if( m_acLayerCfg[layer].m_numDirectRefLayers > 0 ) 737 { 738 char *refLayerId; 739 int i=0; 740 m_acLayerCfg[layer].m_refLayerIds = new Int[m_acLayerCfg[layer].m_numDirectRefLayers]; 741 refLayerId = strtok(pRefLayerIds, " ,-"); 742 while(refLayerId != NULL) 743 { 744 if( i >= m_acLayerCfg[layer].m_numDirectRefLayers ) 745 { 746 printf( "The number of columns whose width are defined is larger than the allowed number of columns.\n" ); 747 exit( EXIT_FAILURE ); 748 } 749 *( m_acLayerCfg[layer].m_refLayerIds + i ) = atoi( refLayerId ); 750 refLayerId = strtok(NULL, " ,-"); 751 i++; 752 } 753 if( i < m_acLayerCfg[layer].m_numDirectRefLayers ) 754 { 755 printf( "The width of some columns is not defined.\n" ); 756 exit( EXIT_FAILURE ); 757 } 758 } 759 else 760 { 761 m_acLayerCfg[layer].m_refLayerIds = NULL; 762 } 763 } 764 #endif 765 #if SIGNAL_BITRATE_PICRATE_IN_VPS 766 readBoolString(cfg_bitRateInfoPresentFlag, m_bitRatePicRateMaxTLayers, m_bitRateInfoPresentFlag, "bit rate info. present flag" ); 767 readIntString (cfg_avgBitRate, m_bitRatePicRateMaxTLayers, m_avgBitRate, "avg. bit rate" ); 768 readIntString (cfg_maxBitRate, m_bitRatePicRateMaxTLayers, m_maxBitRate, "max. bit rate" ); 769 readBoolString(cfg_picRateInfoPresentFlag, m_bitRatePicRateMaxTLayers, m_picRateInfoPresentFlag, "bit rate info. present flag" ); 770 readIntString (cfg_avgPicRate, m_bitRatePicRateMaxTLayers, m_avgPicRate, "avg. pic rate" ); 771 readIntString (cfg_constantPicRateIdc, m_bitRatePicRateMaxTLayers, m_constantPicRateIdc, "constant pic rate Idc" ); 772 #endif 536 773 m_scalingListFile = cfg_ScalingListFile.empty() ? NULL : strdup(cfg_ScalingListFile.c_str()); 537 774 775 /* rules for input, output and internal bitdepths as per help text */ 776 if (!m_internalBitDepthY) { m_internalBitDepthY = m_inputBitDepthY; } 777 if (!m_internalBitDepthC) { m_internalBitDepthC = m_internalBitDepthY; } 778 if (!m_inputBitDepthC) { m_inputBitDepthC = m_inputBitDepthY; } 779 if (!m_outputBitDepthY) { m_outputBitDepthY = m_internalBitDepthY; } 780 if (!m_outputBitDepthC) { m_outputBitDepthC = m_internalBitDepthC; } 781 538 782 #if !SVC_EXTENSION 539 783 // TODO:ChromaFmt assumes 4:2:0 below 540 switch (m_c roppingMode)784 switch (m_conformanceMode) 541 785 { 542 786 case 0: 543 787 { 544 // no c roppingor padding545 m_c ropLeft = m_cropRight = m_cropTop = m_cropBottom = 0;788 // no conformance or padding 789 m_confLeft = m_confRight = m_confTop = m_confBottom = 0; 546 790 m_aiPad[1] = m_aiPad[0] = 0; 547 791 break; … … 553 797 if (m_iSourceWidth % minCuSize) 554 798 { 555 m_aiPad[0] = m_c ropRight = ((m_iSourceWidth / minCuSize) + 1) * minCuSize - m_iSourceWidth;556 m_iSourceWidth += m_c ropRight;799 m_aiPad[0] = m_confRight = ((m_iSourceWidth / minCuSize) + 1) * minCuSize - m_iSourceWidth; 800 m_iSourceWidth += m_confRight; 557 801 } 558 802 if (m_iSourceHeight % minCuSize) 559 803 { 560 m_aiPad[1] = m_c ropBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight;561 m_iSourceHeight += m_c ropBottom;562 } 563 if (m_aiPad[0] % TComSPS::get CropUnitX(CHROMA_420) != 0)804 m_aiPad[1] = m_confBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight; 805 m_iSourceHeight += m_confBottom; 806 } 807 if (m_aiPad[0] % TComSPS::getWinUnitX(CHROMA_420) != 0) 564 808 { 565 809 fprintf(stderr, "Error: picture width is not an integer multiple of the specified chroma subsampling\n"); 566 810 exit(EXIT_FAILURE); 567 811 } 568 if (m_aiPad[1] % TComSPS::get CropUnitY(CHROMA_420) != 0)812 if (m_aiPad[1] % TComSPS::getWinUnitY(CHROMA_420) != 0) 569 813 { 570 814 fprintf(stderr, "Error: picture height is not an integer multiple of the specified chroma subsampling\n"); … … 578 822 m_iSourceWidth += m_aiPad[0]; 579 823 m_iSourceHeight += m_aiPad[1]; 580 m_c ropRight = m_aiPad[0];581 m_c ropBottom = m_aiPad[1];824 m_confRight = m_aiPad[0]; 825 m_confBottom = m_aiPad[1]; 582 826 break; 583 827 } 584 828 case 3: 585 829 { 586 // c ropping587 if ((m_c ropLeft == 0) && (m_cropRight == 0) && (m_cropTop == 0) && (m_cropBottom == 0))588 { 589 fprintf(stderr, "Warning: C ropping enabled, but all croppingparameters set to zero\n");830 // conformance 831 if ((m_confLeft == 0) && (m_confRight == 0) && (m_confTop == 0) && (m_confBottom == 0)) 832 { 833 fprintf(stderr, "Warning: Conformance window enabled, but all conformance window parameters set to zero\n"); 590 834 } 591 835 if ((m_aiPad[1] != 0) || (m_aiPad[0]!=0)) 592 836 { 593 fprintf(stderr, "Warning: C roppingenabled, padding parameters will be ignored\n");837 fprintf(stderr, "Warning: Conformance window enabled, padding parameters will be ignored\n"); 594 838 } 595 839 m_aiPad[1] = m_aiPad[0] = 0; … … 599 843 600 844 // allocate slice-based dQP values 601 m_aidQP = new Int[ m_ iFrameToBeEncoded + m_iGOPSize + 1 ];602 ::memset( m_aidQP, 0, sizeof(Int)*( m_ iFrameToBeEncoded + m_iGOPSize + 1 ) );845 m_aidQP = new Int[ m_framesToBeEncoded + m_iGOPSize + 1 ]; 846 ::memset( m_aidQP, 0, sizeof(Int)*( m_framesToBeEncoded + m_iGOPSize + 1 ) ); 603 847 604 848 // handling of floating-point QP values … … 607 851 if ( m_iQP < m_fQP ) 608 852 { 609 Int iSwitchPOC = (Int)( m_ iFrameToBeEncoded - (m_fQP - m_iQP)*m_iFrameToBeEncoded + 0.5 );853 Int iSwitchPOC = (Int)( m_framesToBeEncoded - (m_fQP - m_iQP)*m_framesToBeEncoded + 0.5 ); 610 854 611 855 iSwitchPOC = (Int)( (Double)iSwitchPOC / m_iGOPSize + 0.5 )*m_iGOPSize; 612 for ( Int i=iSwitchPOC; i<m_ iFrameToBeEncoded + m_iGOPSize + 1; i++ )856 for ( Int i=iSwitchPOC; i<m_framesToBeEncoded + m_iGOPSize + 1; i++ ) 613 857 { 614 858 m_aidQP[i] = 1; … … 624 868 Int iValue; 625 869 Int iPOC = 0; 626 while ( iPOC < m_ iFrameToBeEncoded )870 while ( iPOC < m_framesToBeEncoded ) 627 871 { 628 872 if ( fscanf(fpt, "%d", &iValue ) == EOF ) break; … … 633 877 } 634 878 } 635 m_iWaveFrontSubstreams = m_iWaveFrontSynchro ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1; 879 m_iWaveFrontSubstreams = m_iWaveFrontSynchro ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1; 636 880 #endif 637 881 // check validity of input parameters … … 646 890 return true; 647 891 } 648 892 #if SIGNAL_BITRATE_PICRATE_IN_VPS 893 Void readBoolString(const string inpString, const Int numEntries, Bool* &memberArray, const char *elementName) 894 { 895 Char* inpArray = inpString.empty() ? NULL : strdup(inpString.c_str()); 896 Int i = 0; 897 if(numEntries) 898 { 899 Char* tempArray = strtok(inpArray, " ,-"); 900 memberArray = new Bool[numEntries]; 901 while( tempArray != NULL ) 902 { 903 if( i >= numEntries ) 904 { 905 printf( "The number of %s defined is larger than the allowed number\n", elementName ); 906 exit( EXIT_FAILURE ); 907 } 908 assert( (atoi(tempArray) == 0) || (atoi(tempArray) == 1) ); 909 *( memberArray + i ) = atoi(tempArray); 910 tempArray = strtok(NULL, " ,-"); 911 i++; 912 } 913 if( i < numEntries ) 914 { 915 printf( "Some %s are not defined\n", elementName ); 916 exit( EXIT_FAILURE ); 917 } 918 } 919 else 920 { 921 memberArray = NULL; 922 } 923 } 924 925 Void readIntString(const string inpString, const Int numEntries, Int* &memberArray, const char *elementName) 926 { 927 Char* inpArray = inpString.empty() ? NULL : strdup(inpString.c_str()); 928 Int i = 0; 929 if(numEntries) 930 { 931 Char* tempArray = strtok(inpArray, " ,-"); 932 memberArray = new Int[numEntries]; 933 while( tempArray != NULL ) 934 { 935 if( i >= numEntries ) 936 { 937 printf( "The number of %s defined is larger than the allowed number\n", elementName ); 938 exit( EXIT_FAILURE ); 939 } 940 *( memberArray + i ) = atoi(tempArray); 941 tempArray = strtok(NULL, " ,-"); 942 i++; 943 } 944 if( i < numEntries ) 945 { 946 printf( "Some %s are not defined\n", elementName ); 947 exit( EXIT_FAILURE ); 948 } 949 } 950 else 951 { 952 memberArray = NULL; 953 } 954 } 955 #endif 649 956 // ==================================================================================================================== 650 957 // Private member functions 651 958 // ==================================================================================================================== 652 959 653 Bool confirmPara(Bool bflag, const char* message);960 Bool confirmPara(Bool bflag, const Char* message); 654 961 655 962 Void TAppEncCfg::xCheckParameter() 656 963 { 657 if (!m_decode PictureHashSEIEnabled)658 { 659 fprintf(stderr, "************************************************************* \n");660 fprintf(stderr, "** WARNING: --SEI pictureDigestis now disabled by default. **\n");661 fprintf(stderr, "** Automatic verification of decoded pictures by **\n");662 fprintf(stderr, "** a decoder requires this option to be enabled.**\n");663 fprintf(stderr, "************************************************************* \n");664 } 665 666 bool check_failed = false; /* abort if there is a fatal configuration problem */964 if (!m_decodedPictureHashSEIEnabled) 965 { 966 fprintf(stderr, "******************************************************************\n"); 967 fprintf(stderr, "** WARNING: --SEIDecodedPictureHash is now disabled by default. **\n"); 968 fprintf(stderr, "** Automatic verification of decoded pictures by a **\n"); 969 fprintf(stderr, "** decoder requires this option to be enabled. **\n"); 970 fprintf(stderr, "******************************************************************\n"); 971 } 972 973 Bool check_failed = false; /* abort if there is a fatal configuration problem */ 667 974 #define xConfirmPara(a,b) check_failed |= confirmPara(a,b) 668 975 // check range of parameters 669 xConfirmPara( m_uiInputBitDepth < 8, "InputBitDepth must be at least 8" ); 670 #if !SVC_EXTENSION 976 xConfirmPara( m_inputBitDepthY < 8, "InputBitDepth must be at least 8" ); 977 xConfirmPara( m_inputBitDepthC < 8, "InputBitDepthC must be at least 8" ); 978 #if !SVC_EXTENSION 671 979 xConfirmPara( m_iFrameRate <= 0, "Frame rate must be more than 1" ); 672 980 #endif 673 xConfirmPara( m_ iFrameToBeEncoded <= 0, "Total Number Of Frames encoded must be more than 0" );981 xConfirmPara( m_framesToBeEncoded <= 0, "Total Number Of Frames encoded must be more than 0" ); 674 982 xConfirmPara( m_iGOPSize < 1 , "GOP Size must be greater or equal to 1" ); 675 983 xConfirmPara( m_iGOPSize > 1 && m_iGOPSize % 2, "GOP Size must be a multiple of 2, if GOP Size is greater than 1" ); 676 #if !SVC_EXTENSION 984 #if !SVC_EXTENSION 677 985 xConfirmPara( (m_iIntraPeriod > 0 && m_iIntraPeriod < m_iGOPSize) || m_iIntraPeriod == 0, "Intra period must be more than GOP size, or -1 , not 0" ); 678 986 #endif 679 987 xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 2, "Decoding Refresh Type must be equal to 0, 1 or 2" ); 680 988 #if !SVC_EXTENSION 681 xConfirmPara( m_iQP < -6 * ( (Int)m_uiInternalBitDepth - 8) || m_iQP > 51,"QP exceeds supported range (-QpBDOffsety to 51)" );989 xConfirmPara( m_iQP < -6 * (m_internalBitDepthY - 8) || m_iQP > 51, "QP exceeds supported range (-QpBDOffsety to 51)" ); 682 990 #endif 683 991 xConfirmPara( m_loopFilterBetaOffsetDiv2 < -13 || m_loopFilterBetaOffsetDiv2 > 13, "Loop Filter Beta Offset div. 2 exceeds supported range (-13 to 13)"); … … 711 1019 712 1020 xConfirmPara( m_uiQuadtreeTULog2MinSize < 2, "QuadtreeTULog2MinSize must be 2 or greater."); 713 xConfirmPara( m_uiQuadtreeTULog2MinSize > 5, "QuadtreeTULog2MinSize must be 5 or smaller.");714 xConfirmPara( m_uiQuadtreeTULog2MaxSize < 2, "QuadtreeTULog2MaxSize must be 2 or greater.");715 1021 xConfirmPara( m_uiQuadtreeTULog2MaxSize > 5, "QuadtreeTULog2MaxSize must be 5 or smaller."); 1022 xConfirmPara( (1<<m_uiQuadtreeTULog2MaxSize) > m_uiMaxCUWidth, "QuadtreeTULog2MaxSize must be log2(maxCUSize) or smaller."); 1023 716 1024 xConfirmPara( m_uiQuadtreeTULog2MaxSize < m_uiQuadtreeTULog2MinSize, "QuadtreeTULog2MaxSize must be greater than or equal to m_uiQuadtreeTULog2MinSize."); 717 1025 xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUWidth >>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS … … 720 1028 xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUHeight >> m_uiMaxCUDepth ), "Minimum CU height must be greater than minimum transform size." ); 721 1029 xConfirmPara( m_uiQuadtreeTUMaxDepthInter < 1, "QuadtreeTUMaxDepthInter must be greater than or equal to 1" ); 722 xConfirmPara( m_ui QuadtreeTUMaxDepthInter > m_uiQuadtreeTULog2MaxSize - m_uiQuadtreeTULog2MinSize + 1, "QuadtreeTUMaxDepthInter must be less than or equal to the difference between QuadtreeTULog2MaxSizeand QuadtreeTULog2MinSize plus 1" );1030 xConfirmPara( m_uiMaxCUWidth < ( 1 << (m_uiQuadtreeTULog2MinSize + m_uiQuadtreeTUMaxDepthInter - 1) ), "QuadtreeTUMaxDepthInter must be less than or equal to the difference between log2(maxCUSize) and QuadtreeTULog2MinSize plus 1" ); 723 1031 xConfirmPara( m_uiQuadtreeTUMaxDepthIntra < 1, "QuadtreeTUMaxDepthIntra must be greater than or equal to 1" ); 724 xConfirmPara( m_ui QuadtreeTUMaxDepthIntra > m_uiQuadtreeTULog2MaxSize - m_uiQuadtreeTULog2MinSize + 1, "QuadtreeTUMaxDepthIntra must be less than or equal to the difference between QuadtreeTULog2MaxSizeand QuadtreeTULog2MinSize plus 1" );1032 xConfirmPara( m_uiMaxCUWidth < ( 1 << (m_uiQuadtreeTULog2MinSize + m_uiQuadtreeTUMaxDepthIntra - 1) ), "QuadtreeTUMaxDepthInter must be less than or equal to the difference between log2(maxCUSize) and QuadtreeTULog2MinSize plus 1" ); 725 1033 726 1034 xConfirmPara( m_maxNumMergeCand < 1, "MaxNumMergeCand must be 1 or greater."); … … 742 1050 } 743 1051 744 xConfirmPara( m_iSliceMode < 0 || m_iSliceMode > 3, "SliceMode exceeds supported range (0 to 3)" ); 745 if (m_iSliceMode!=0) 746 { 747 xConfirmPara( m_iSliceArgument < 1 , "SliceArgument should be larger than or equal to 1" ); 748 } 749 #if !REMOVE_FGS 750 if (m_iSliceMode==3) 751 { 752 xConfirmPara( m_iSliceGranularity > 0 , "When SliceMode == 3 is chosen, the SliceGranularity must be 0" ); 753 } 754 #endif 755 xConfirmPara( m_iDependentSliceMode < 0 || m_iDependentSliceMode > 2, "DependentSliceMode exceeds supported range (0 to 2)" ); 756 if (m_iDependentSliceMode!=0) 757 { 758 xConfirmPara( m_iDependentSliceArgument < 1 , "DependentSliceArgument should be larger than or equal to 1" ); 759 } 760 #if !REMOVE_FGS 761 xConfirmPara( m_iSliceGranularity >= m_uiMaxCUDepth, "SliceGranularity must be smaller than maximum cu depth"); 762 xConfirmPara( m_iSliceGranularity <0 || m_iSliceGranularity > 3, "SliceGranularity exceeds supported range (0 to 3)" ); 763 xConfirmPara( m_iSliceGranularity > m_iMaxCuDQPDepth, "SliceGranularity must be smaller smaller than or equal to maximum dqp depth" ); 764 #endif 765 766 bool tileFlag = (m_iNumColumnsMinus1 > 0 || m_iNumRowsMinus1 > 0 ); 767 #if !TILES_WPP_ENTROPYSLICES_FLAGS 768 xConfirmPara( tileFlag && m_iDependentSliceMode, "Tile and Dependent Slice can not be applied together"); 769 #endif 1052 xConfirmPara( m_sliceMode < 0 || m_sliceMode > 3, "SliceMode exceeds supported range (0 to 3)" ); 1053 if (m_sliceMode!=0) 1054 { 1055 xConfirmPara( m_sliceArgument < 1 , "SliceArgument should be larger than or equal to 1" ); 1056 } 1057 xConfirmPara( m_sliceSegmentMode < 0 || m_sliceSegmentMode > 3, "SliceSegmentMode exceeds supported range (0 to 3)" ); 1058 if (m_sliceSegmentMode!=0) 1059 { 1060 xConfirmPara( m_sliceSegmentArgument < 1 , "SliceSegmentArgument should be larger than or equal to 1" ); 1061 } 1062 1063 Bool tileFlag = (m_iNumColumnsMinus1 > 0 || m_iNumRowsMinus1 > 0 ); 770 1064 xConfirmPara( tileFlag && m_iWaveFrontSynchro, "Tile and Wavefront can not be applied together"); 771 #if !DEPENDENT_SLICES772 xConfirmPara( m_iWaveFrontSynchro && m_iDependentSliceMode, "Wavefront and Dependent Slice can not be applied together");773 #endif774 #if DEPENDENT_SLICES775 #if TILES_WPP_ENTROPYSLICES_FLAGS776 xConfirmPara( m_iWaveFrontSynchro && m_entropySliceEnabledFlag, "WaveFrontSynchro and EntropySliceEnabledFlag can not be applied together");777 #else778 xConfirmPara( m_iWaveFrontSynchro && m_bCabacIndependentFlag, "Wavefront and CabacIndependentFlag can not be applied together");779 #endif780 #endif781 1065 782 1066 //TODO:ChromaFmt assumes 4:2:0 below 783 1067 #if !SVC_EXTENSION 784 xConfirmPara( m_iSourceWidth % TComSPS::getCropUnitX(CHROMA_420) != 0, "Picture width must be an integer multiple of the specified chroma subsampling"); 785 xConfirmPara( m_iSourceHeight % TComSPS::getCropUnitY(CHROMA_420) != 0, "Picture height must be an integer multiple of the specified chroma subsampling"); 786 #endif 787 788 #if !SVC_EXTENSION 789 xConfirmPara( m_aiPad[0] % TComSPS::getCropUnitX(CHROMA_420) != 0, "Horizontal padding must be an integer multiple of the specified chroma subsampling"); 790 xConfirmPara( m_aiPad[1] % TComSPS::getCropUnitY(CHROMA_420) != 0, "Vertical padding must be an integer multiple of the specified chroma subsampling"); 791 792 xConfirmPara( m_cropLeft % TComSPS::getCropUnitX(CHROMA_420) != 0, "Left cropping must be an integer multiple of the specified chroma subsampling"); 793 xConfirmPara( m_cropRight % TComSPS::getCropUnitX(CHROMA_420) != 0, "Right cropping must be an integer multiple of the specified chroma subsampling"); 794 xConfirmPara( m_cropTop % TComSPS::getCropUnitY(CHROMA_420) != 0, "Top cropping must be an integer multiple of the specified chroma subsampling"); 795 xConfirmPara( m_cropBottom % TComSPS::getCropUnitY(CHROMA_420) != 0, "Bottom cropping must be an integer multiple of the specified chroma subsampling"); 796 #endif 797 798 #if REF_IDX_ME_AROUND_ZEROMV || REF_IDX_ME_ZEROMV 799 xConfirmPara( REF_IDX_ME_AROUND_ZEROMV && REF_IDX_ME_ZEROMV, "REF_IDX_ME_AROUND_ZEROMV and REF_IDX_ME_ZEROMV cannot be enabled simultaneously"); 800 #endif 1068 xConfirmPara( m_iSourceWidth % TComSPS::getWinUnitX(CHROMA_420) != 0, "Picture width must be an integer multiple of the specified chroma subsampling"); 1069 xConfirmPara( m_iSourceHeight % TComSPS::getWinUnitY(CHROMA_420) != 0, "Picture height must be an integer multiple of the specified chroma subsampling"); 1070 1071 xConfirmPara( m_aiPad[0] % TComSPS::getWinUnitX(CHROMA_420) != 0, "Horizontal padding must be an integer multiple of the specified chroma subsampling"); 1072 xConfirmPara( m_aiPad[1] % TComSPS::getWinUnitY(CHROMA_420) != 0, "Vertical padding must be an integer multiple of the specified chroma subsampling"); 1073 1074 xConfirmPara( m_confLeft % TComSPS::getWinUnitX(CHROMA_420) != 0, "Left conformance window offset must be an integer multiple of the specified chroma subsampling"); 1075 xConfirmPara( m_confRight % TComSPS::getWinUnitX(CHROMA_420) != 0, "Right conformance window offset must be an integer multiple of the specified chroma subsampling"); 1076 xConfirmPara( m_confTop % TComSPS::getWinUnitY(CHROMA_420) != 0, "Top conformance window offset must be an integer multiple of the specified chroma subsampling"); 1077 xConfirmPara( m_confBottom % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling"); 1078 #endif 1079 801 1080 // max CU width and height should be power of 2 802 1081 UInt ui = m_uiMaxCUWidth; … … 814 1093 xConfirmPara( ui != 1 , "Height should be 2^n"); 815 1094 } 1095 1096 1097 /* if this is an intra-only sequence, ie IntraPeriod=1, don't verify the GOP structure 1098 * This permits the ability to omit a GOP structure specification */ 1099 #if SVC_EXTENSION 1100 for(UInt layer = 0; layer < MAX_LAYERS; layer++) 1101 { 1102 Int m_iIntraPeriod = m_acLayerCfg[layer].m_iIntraPeriod; 1103 #endif 1104 if (m_iIntraPeriod == 1 && m_GOPList[0].m_POC == -1) { 1105 m_GOPList[0] = GOPEntry(); 1106 m_GOPList[0].m_QPFactor = 1; 1107 m_GOPList[0].m_betaOffsetDiv2 = 0; 1108 m_GOPList[0].m_tcOffsetDiv2 = 0; 1109 m_GOPList[0].m_POC = 1; 1110 m_GOPList[0].m_numRefPicsActive = 4; 1111 } 1112 #if SVC_EXTENSION 1113 } 1114 #endif 816 1115 817 1116 Bool verifiedGOP=false; … … 838 1137 } 839 1138 } 840 841 m_extraRPSs=0;842 1139 843 1140 #if SVC_EXTENSION … … 851 1148 } 852 1149 } 853 #endif 854 1150 #endif 1151 1152 #if SVC_EXTENSION 1153 // verify layer configuration parameters 1154 for(UInt layer=0; layer<m_numLayers; layer++) 1155 { 1156 Int m_iIntraPeriod = m_acLayerCfg[layer].m_iIntraPeriod; 1157 #endif 1158 if ( (m_iIntraPeriod != 1) && !m_loopFilterOffsetInPPS && m_DeblockingFilterControlPresent && (!m_bLoopFilterDisable) ) 1159 { 1160 for(Int i=0; i<m_iGOPSize; i++) 1161 { 1162 xConfirmPara( (m_GOPList[i].m_betaOffsetDiv2 + m_loopFilterBetaOffsetDiv2) < -6 || (m_GOPList[i].m_betaOffsetDiv2 + m_loopFilterBetaOffsetDiv2) > 6, "Loop Filter Beta Offset div. 2 for one of the GOP entries exceeds supported range (-6 to 6)" ); 1163 xConfirmPara( (m_GOPList[i].m_tcOffsetDiv2 + m_loopFilterTcOffsetDiv2) < -6 || (m_GOPList[i].m_tcOffsetDiv2 + m_loopFilterTcOffsetDiv2) > 6, "Loop Filter Tc Offset div. 2 for one of the GOP entries exceeds supported range (-6 to 6)" ); 1164 } 1165 } 1166 #if SVC_EXTENSION 1167 } 1168 #endif 1169 1170 m_extraRPSs=0; 855 1171 //start looping through frames in coding order until we can verify that the GOP structure is correct. 856 1172 while(!verifiedGOP&&!errorGOP) … … 886 1202 if(absPOC%m_iGOPSize == m_GOPList[k].m_POC%m_iGOPSize) 887 1203 { 888 #if TEMPORAL_LAYER_NON_REFERENCE889 1204 if(m_GOPList[k].m_temporalId==m_GOPList[curGOP].m_temporalId) 890 1205 { 891 1206 m_GOPList[k].m_refPic = true; 892 1207 } 893 #endif894 1208 m_GOPList[curGOP].m_usedByCurrPic[i]=m_GOPList[k].m_temporalId<=m_GOPList[curGOP].m_temporalId; 895 1209 } … … 939 1253 Int offGOP = (checkGOP-1+offset)%m_iGOPSize; 940 1254 Int offPOC = ((checkGOP-1+offset)/m_iGOPSize)*m_iGOPSize + m_GOPList[offGOP].m_POC; 941 #if TEMPORAL_LAYER_NON_REFERENCE942 1255 if(offPOC>=0&&m_GOPList[offGOP].m_temporalId<=m_GOPList[curGOP].m_temporalId) 943 #else944 if(offPOC>=0&&m_GOPList[offGOP].m_refPic&&m_GOPList[offGOP].m_temporalId<=m_GOPList[curGOP].m_temporalId)945 #endif946 1256 { 947 1257 Bool newRef=false; … … 964 1274 Int insertPoint=newRefs; 965 1275 //this picture can be added, find appropriate place in list and insert it. 966 #if TEMPORAL_LAYER_NON_REFERENCE967 1276 if(m_GOPList[offGOP].m_temporalId==m_GOPList[curGOP].m_temporalId) 968 1277 { 969 1278 m_GOPList[offGOP].m_refPic = true; 970 1279 } 971 #endif972 1280 for(Int j=0; j<newRefs; j++) 973 1281 { … … 1035 1343 m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefIdc = newIdc; 1036 1344 m_GOPList[m_iGOPSize+m_extraRPSs].m_deltaRPS = refPOC - m_GOPList[m_iGOPSize+m_extraRPSs].m_POC; 1037 #if !J0234_INTER_RPS_SIMPL1038 m_GOPList[m_iGOPSize+m_extraRPSs].m_deltaRIdxMinus1 = 0;1039 #endif1040 1345 } 1041 1346 curGOP=m_iGOPSize+m_extraRPSs; … … 1124 1429 } 1125 1430 1431 #if SVC_EXTENSION // ToDo: it should be checked for the case when parameters are different for the layers 1432 for(UInt layer = 0; layer < MAX_LAYERS; layer++) 1433 { 1434 Int m_iSourceWidth = m_acLayerCfg[layer].m_iSourceWidth; 1435 Int m_iSourceHeight = m_acLayerCfg[layer].m_iSourceHeight; 1436 #endif 1437 if(m_vuiParametersPresentFlag && m_bitstreamRestrictionFlag) 1438 { 1439 Int PicSizeInSamplesY = m_iSourceWidth * m_iSourceHeight; 1440 if(tileFlag) 1441 { 1442 Int maxTileWidth = 0; 1443 Int maxTileHeight = 0; 1444 Int widthInCU = (m_iSourceWidth % m_uiMaxCUWidth) ? m_iSourceWidth/m_uiMaxCUWidth + 1: m_iSourceWidth/m_uiMaxCUWidth; 1445 Int heightInCU = (m_iSourceHeight % m_uiMaxCUHeight) ? m_iSourceHeight/m_uiMaxCUHeight + 1: m_iSourceHeight/m_uiMaxCUHeight; 1446 if(m_iUniformSpacingIdr) 1447 { 1448 maxTileWidth = m_uiMaxCUWidth*((widthInCU+m_iNumColumnsMinus1)/(m_iNumColumnsMinus1+1)); 1449 maxTileHeight = m_uiMaxCUHeight*((heightInCU+m_iNumRowsMinus1)/(m_iNumRowsMinus1+1)); 1450 // if only the last tile-row is one treeblock higher than the others 1451 // the maxTileHeight becomes smaller if the last row of treeblocks has lower height than the others 1452 if(!((heightInCU-1)%(m_iNumRowsMinus1+1))) 1453 { 1454 maxTileHeight = maxTileHeight - m_uiMaxCUHeight + (m_iSourceHeight % m_uiMaxCUHeight); 1455 } 1456 // if only the last tile-column is one treeblock wider than the others 1457 // the maxTileWidth becomes smaller if the last column of treeblocks has lower width than the others 1458 if(!((widthInCU-1)%(m_iNumColumnsMinus1+1))) 1459 { 1460 maxTileWidth = maxTileWidth - m_uiMaxCUWidth + (m_iSourceWidth % m_uiMaxCUWidth); 1461 } 1462 } 1463 else // not uniform spacing 1464 { 1465 if(m_iNumColumnsMinus1<1) 1466 { 1467 maxTileWidth = m_iSourceWidth; 1468 } 1469 else 1470 { 1471 Int accColumnWidth = 0; 1472 for(Int col=0; col<(m_iNumColumnsMinus1); col++) 1473 { 1474 maxTileWidth = m_pColumnWidth[col]>maxTileWidth ? m_pColumnWidth[col]:maxTileWidth; 1475 accColumnWidth += m_pColumnWidth[col]; 1476 } 1477 maxTileWidth = (widthInCU-accColumnWidth)>maxTileWidth ? m_uiMaxCUWidth*(widthInCU-accColumnWidth):m_uiMaxCUWidth*maxTileWidth; 1478 } 1479 if(m_iNumRowsMinus1<1) 1480 { 1481 maxTileHeight = m_iSourceHeight; 1482 } 1483 else 1484 { 1485 Int accRowHeight = 0; 1486 for(Int row=0; row<(m_iNumRowsMinus1); row++) 1487 { 1488 maxTileHeight = m_pRowHeight[row]>maxTileHeight ? m_pRowHeight[row]:maxTileHeight; 1489 accRowHeight += m_pRowHeight[row]; 1490 } 1491 maxTileHeight = (heightInCU-accRowHeight)>maxTileHeight ? m_uiMaxCUHeight*(heightInCU-accRowHeight):m_uiMaxCUHeight*maxTileHeight; 1492 } 1493 } 1494 Int maxSizeInSamplesY = maxTileWidth*maxTileHeight; 1495 m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/maxSizeInSamplesY-4; 1496 } 1497 else if(m_iWaveFrontSynchro) 1498 { 1499 m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/((2*m_iSourceHeight+m_iSourceWidth)*m_uiMaxCUHeight)-4; 1500 } 1501 else if(m_sliceMode == 1) 1502 { 1503 m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/(m_sliceArgument*m_uiMaxCUWidth*m_uiMaxCUHeight)-4; 1504 } 1505 else 1506 { 1507 m_minSpatialSegmentationIdc = 0; 1508 } 1509 } 1510 #if SVC_EXTENSION 1511 } 1512 #endif 1513 1126 1514 xConfirmPara( m_bUseLComb==false && m_numReorderPics[MAX_TLAYER-1]!=0, "ListCombination can only be 0 in low delay coding (more precisely when L0 and L1 are identical)" ); // Note however this is not the full necessary condition as ref_pic_list_combination_flag can only be 0 if L0 == L1. 1127 1515 xConfirmPara( m_iWaveFrontSynchro < 0, "WaveFrontSynchro cannot be negative" ); … … 1131 1519 #endif 1132 1520 1133 xConfirmPara( m_decodePictureHashSEIEnabled<0 || m_decodePictureHashSEIEnabled>3, "this hash type is not correct!\n"); 1134 1135 #if !SVC_EXTENSION 1521 xConfirmPara( m_decodedPictureHashSEIEnabled<0 || m_decodedPictureHashSEIEnabled>3, "this hash type is not correct!\n"); 1522 1523 #if RATE_CONTROL_LAMBDA_DOMAIN 1524 if ( m_RCEnableRateControl ) 1525 { 1526 if ( m_RCForceIntraQP ) 1527 { 1528 if ( m_RCInitialQP == 0 ) 1529 { 1530 printf( "\nInitial QP for rate control is not specified. Reset not to use force intra QP!" ); 1531 m_RCForceIntraQP = false; 1532 } 1533 } 1534 xConfirmPara( m_uiDeltaQpRD > 0, "Rate control cannot be used together with slice level multiple-QP optimization!\n" ); 1535 } 1536 #else 1136 1537 if(m_enableRateCtrl) 1137 1538 { … … 1150 1551 1151 1552 xConfirmPara(m_log2ParallelMergeLevel < 2, "Log2ParallelMergeLevel should be larger than or equal to 2"); 1152 1153 #if ACTIVE_PARAMETER_SETS_SEI_MESSAGE 1154 xConfirmPara(m_activeParameterSetsSEIEnabled < 0 || m_activeParameterSetsSEIEnabled > 2, "ActiveParametersSEIEnabled exceeds supported range (0 to 2)"); 1155 #endif 1156 1553 #if L0444_FPA_TYPE 1554 if (m_framePackingSEIEnabled) 1555 { 1556 xConfirmPara(m_framePackingSEIType < 3 || m_framePackingSEIType > 5 , "SEIFramePackingType must be in rage 3 to 5"); 1557 } 1558 #endif 1559 #if VPS_EXTN_DIRECT_REF_LAYERS 1560 xConfirmPara( (m_acLayerCfg[0].m_numDirectRefLayers != 0) && (m_acLayerCfg[0].m_numDirectRefLayers != -1), "Layer 0 cannot have any reference layers" ); 1561 // NOTE: m_numDirectRefLayers (for any layer) could be -1 (not signalled in cfg), in which case only the "previous layer" would be taken for reference 1562 for(Int layer = 1; layer < MAX_LAYERS; layer++) 1563 { 1564 xConfirmPara(m_acLayerCfg[layer].m_numDirectRefLayers > layer, "Cannot reference more layers than before current layer"); 1565 for(Int i = 0; i < m_acLayerCfg[layer].m_numDirectRefLayers; i++) 1566 { 1567 xConfirmPara(m_acLayerCfg[layer].m_refLayerIds[i] > layer, "Cannot reference higher layers"); 1568 xConfirmPara(m_acLayerCfg[layer].m_refLayerIds[i] == layer, "Cannot reference the current layer itself"); 1569 } 1570 } 1571 #endif 1157 1572 #undef xConfirmPara 1158 1573 if (check_failed) … … 1179 1594 1180 1595 // set internal bit-depth and constants 1181 #if FULL_NBIT 1182 g_uiBitDepth = m_uiInternalBitDepth; 1183 g_uiBitIncrement = 0; 1184 #else 1185 g_uiBitDepth = 8; 1186 g_uiBitIncrement = m_uiInternalBitDepth - g_uiBitDepth; 1187 #endif 1188 1189 g_uiBASE_MAX = ((1<<(g_uiBitDepth))-1); 1190 1191 #if IBDI_NOCLIP_RANGE 1192 g_uiIBDI_MAX = g_uiBASE_MAX << g_uiBitIncrement; 1193 #else 1194 g_uiIBDI_MAX = ((1<<(g_uiBitDepth+g_uiBitIncrement))-1); 1195 #endif 1196 1197 if (m_uiOutputBitDepth == 0) 1198 { 1199 m_uiOutputBitDepth = m_uiInternalBitDepth; 1200 } 1201 1202 g_uiPCMBitDepthLuma = m_uiPCMBitDepthLuma = ((m_bPCMInputBitDepthFlag)? m_uiInputBitDepth : m_uiInternalBitDepth); 1203 g_uiPCMBitDepthChroma = ((m_bPCMInputBitDepthFlag)? m_uiInputBitDepth : m_uiInternalBitDepth); 1596 g_bitDepthY = m_internalBitDepthY; 1597 g_bitDepthC = m_internalBitDepthC; 1598 1599 g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_inputBitDepthY : m_internalBitDepthY; 1600 g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_inputBitDepthC : m_internalBitDepthC; 1204 1601 } 1205 1602 … … 1216 1613 } 1217 1614 printf("=== Common configuration settings === \n"); 1218 printf("Bitstream File : %s\n", m_p chBitstreamFile );1615 printf("Bitstream File : %s\n", m_pBitstreamFile ); 1219 1616 #else 1220 1617 printf("Input File : %s\n", m_pchInputFile ); 1221 1618 printf("Bitstream File : %s\n", m_pchBitstreamFile ); 1222 1619 printf("Reconstruction File : %s\n", m_pchReconFile ); 1223 printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_c ropLeft - m_cropRight, m_iSourceHeight - m_cropTop - m_cropBottom, m_iFrameRate );1620 printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_confLeft - m_confRight, m_iSourceHeight - m_confTop - m_confBottom, m_iFrameRate ); 1224 1621 printf("Internal Format : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate ); 1225 1622 #endif 1226 printf("Frame index : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_ iFrameToBeEncoded-1, m_iFrameToBeEncoded );1623 printf("Frame index : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded ); 1227 1624 printf("CU size / depth : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth ); 1228 1625 printf("RQT trans. size (min / max) : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize ); … … 1245 1642 printf("QP adaptation : %d (range=%d)\n", m_bUseAdaptiveQP, (m_bUseAdaptiveQP ? m_iQPAdaptationRange : 0) ); 1246 1643 printf("GOP size : %d\n", m_iGOPSize ); 1247 printf("Internal bit depth : %d\n", m_uiInternalBitDepth ); 1248 printf("PCM sample bit depth : %d\n", m_uiPCMBitDepthLuma ); 1644 printf("Internal bit depth : (Y:%d, C:%d)\n", m_internalBitDepthY, m_internalBitDepthC ); 1645 printf("PCM sample bit depth : (Y:%d, C:%d)\n", g_uiPCMBitDepthLuma, g_uiPCMBitDepthChroma ); 1646 #if RATE_CONTROL_LAMBDA_DOMAIN 1647 printf("RateControl : %d\n", m_RCEnableRateControl ); 1648 if(m_RCEnableRateControl) 1649 { 1650 printf("TargetBitrate : %d\n", m_RCTargetBitrate ); 1651 printf("KeepHierarchicalBit : %d\n", m_RCKeepHierarchicalBit ); 1652 printf("LCULevelRC : %d\n", m_RCLCULevelRC ); 1653 printf("UseLCUSeparateModel : %d\n", m_RCUseLCUSeparateModel ); 1654 printf("InitialQP : %d\n", m_RCInitialQP ); 1655 printf("ForceIntraQP : %d\n", m_RCForceIntraQP ); 1656 } 1657 #else 1249 1658 printf("RateControl : %d\n", m_enableRateCtrl); 1250 1659 if(m_enableRateCtrl) … … 1253 1662 printf("NumLCUInUnit : %d\n", m_numLCUInUnit); 1254 1663 } 1664 #endif 1255 1665 printf("Max Num Merge Candidates : %d\n", m_maxNumMergeCand); 1256 1666 printf("\n"); 1257 1667 1258 1668 printf("TOOL CFG: "); 1259 #if !REMOVE_ALF 1260 printf("ALF:%d ", m_bUseALF ); 1261 printf("ALFLowLatencyEncode:%d ", m_alfLowLatencyEncoding?1:0); 1262 #endif 1263 printf("IBD:%d ", !!g_uiBitIncrement); 1669 printf("IBD:%d ", g_bitDepthY > m_inputBitDepthY || g_bitDepthC > m_inputBitDepthC); 1264 1670 printf("HAD:%d ", m_bUseHADME ); 1265 1671 printf("SRD:%d ", m_bUseSBACRD ); 1266 printf("RDQ:%d ", m_bUseRDOQ ); 1672 printf("RDQ:%d ", m_useRDOQ ); 1673 printf("RDQTS:%d ", m_useRDOQTS ); 1674 #if L0232_RD_PENALTY 1675 printf("RDpenalty:%d ", m_rdPenalty ); 1676 #endif 1267 1677 printf("SQP:%d ", m_uiDeltaQpRD ); 1268 1678 printf("ASR:%d ", m_bUseASR ); … … 1274 1684 printf("ESD:%d ", m_useEarlySkipDetection ); 1275 1685 printf("RQT:%d ", 1 ); 1276 #if !REMOVE_LMCHROMA1277 printf("LMC:%d ", m_bUseLMChroma );1278 #endif1279 1686 printf("TransformSkip:%d ", m_useTransformSkip ); 1280 1687 printf("TransformSkipFast:%d ", m_useTransformSkipFast ); 1281 #if REMOVE_FGS 1282 printf("Slice: M=%d ", m_iSliceMode); 1283 #else 1284 printf("Slice: G=%d M=%d ", m_iSliceGranularity, m_iSliceMode); 1285 #endif 1286 if (m_iSliceMode!=0) 1287 { 1288 printf("A=%d ", m_iSliceArgument); 1289 } 1290 printf("DependentSlice: M=%d ",m_iDependentSliceMode); 1291 if (m_iDependentSliceMode!=0) 1292 { 1293 printf("A=%d ", m_iDependentSliceArgument); 1688 printf("Slice: M=%d ", m_sliceMode); 1689 if (m_sliceMode!=0) 1690 { 1691 printf("A=%d ", m_sliceArgument); 1692 } 1693 printf("SliceSegment: M=%d ",m_sliceSegmentMode); 1694 if (m_sliceSegmentMode!=0) 1695 { 1696 printf("A=%d ", m_sliceSegmentArgument); 1294 1697 } 1295 1698 printf("CIP:%d ", m_bUseConstrainedIntraPred); … … 1299 1702 1300 1703 printf("LosslessCuEnabled:%d ", (m_useLossless)? 1:0 ); 1301 printf("WPP:%d ", (Int)m_ bUseWeightPred);1704 printf("WPP:%d ", (Int)m_useWeightedPred); 1302 1705 printf("WPB:%d ", (Int)m_useWeightedBiPred); 1303 1706 printf("PME:%d ", m_log2ParallelMergeLevel); … … 1314 1717 printf(" SignBitHidingFlag:%d ", m_signHideFlag); 1315 1718 #if SVC_EXTENSION 1316 #if RECALCULATE_QP_ACCORDING_LAMBDA1317 1719 printf("RecalQP:%d ", m_recalculateQPAccordingToLambda ? 1 : 0 ); 1318 #endif1319 1720 printf("AVC_BASE:%d ", AVC_BASE); 1320 1721 #if REF_IDX_FRAMEWORK 1321 1722 printf("REF_IDX_FRAMEWORK:%d ", REF_IDX_FRAMEWORK); 1322 1723 printf("EL_RAP_SliceType: %d ", m_elRapSliceBEnabled); 1323 printf("REF_IDX_ME_AROUND_ZEROMV:%d ", REF_IDX_ME_AROUND_ZEROMV);1324 1724 printf("REF_IDX_ME_ZEROMV: %d", REF_IDX_ME_ZEROMV); 1325 1725 #elif INTRA_BL … … 1331 1731 #endif 1332 1732 #else 1333 #if RECALCULATE_QP_ACCORDING_LAMBDA1334 1733 printf("RecalQP:%d", m_recalculateQPAccordingToLambda ? 1 : 0 ); 1335 #endif1336 1734 #endif 1337 1735 printf("\n\n"); … … 1340 1738 } 1341 1739 1342 Bool confirmPara(Bool bflag, const char* message)1740 Bool confirmPara(Bool bflag, const Char* message) 1343 1741 { 1344 1742 if (!bflag) -
trunk/source/App/TAppEncoder/TAppEncCfg.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 * … … 60 60 #if SVC_EXTENSION 61 61 TAppEncLayerCfg m_acLayerCfg [MAX_LAYERS]; 62 Int m_numLayers; ///< number of layers63 64 char* m_pchBitstreamFile;///< output bitstream file62 Int m_numLayers; ///< number of layers 63 64 Char* m_pBitstreamFile; ///< output bitstream file 65 65 Double m_adLambdaModifier[ MAX_TLAYER ]; ///< Lambda modifier array for each temporal layer 66 66 // source specification 67 unsigned int m_FrameSkip;///< number of skipped frames from the beginning68 Int m_ iFrameToBeEncoded; ///< number of encoded frames67 UInt m_FrameSkip; ///< number of skipped frames from the beginning 68 Int m_framesToBeEncoded; ///< number of encoded frames 69 69 #if AVC_SYNTAX 70 70 char* m_BLSyntaxFile; ///< input syntax file 71 71 #endif 72 72 #else 73 char* m_pchInputFile; ///< source file name74 char* m_pchBitstreamFile; ///< output bitstream file75 char* m_pchReconFile; ///< output reconstruction file73 Char* m_pchInputFile; ///< source file name 74 Char* m_pchBitstreamFile; ///< output bitstream file 75 Char* m_pchReconFile; ///< output reconstruction file 76 76 Double m_adLambdaModifier[ MAX_TLAYER ]; ///< Lambda modifier array for each temporal layer 77 77 // source specification 78 78 Int m_iFrameRate; ///< source frame-rates (Hz) 79 unsigned int m_FrameSkip;///< number of skipped frames from the beginning79 UInt m_FrameSkip; ///< number of skipped frames from the beginning 80 80 Int m_iSourceWidth; ///< source width in pixel 81 81 Int m_iSourceHeight; ///< source height in pixel 82 Int m_c roppingMode;83 Int m_c ropLeft;84 Int m_c ropRight;85 Int m_c ropTop;86 Int m_c ropBottom;87 Int m_ iFrameToBeEncoded; ///< number of encoded frames82 Int m_conformanceMode; 83 Int m_confLeft; 84 Int m_confRight; 85 Int m_confTop; 86 Int m_confBottom; 87 Int m_framesToBeEncoded; ///< number of encoded frames 88 88 Int m_aiPad[2]; ///< number of padded pixels for width and height 89 #endif 90 91 // profile/level 92 Profile::Name m_profile; 93 Level::Tier m_levelTier; 94 Level::Name m_level; 95 #if L0046_CONSTRAINT_FLAGS 96 Bool m_progressiveSourceFlag; 97 Bool m_interlacedSourceFlag; 98 Bool m_nonPackedConstraintFlag; 99 Bool m_frameOnlyConstraintFlag; 100 #endif 89 101 90 102 // coding structure 103 #if !SVC_EXTENSION 91 104 Int m_iIntraPeriod; ///< period of I-slice (random access period) 92 105 #endif … … 100 113 Bool m_useTransformSkip; ///< flag for enabling intra transform skipping 101 114 Bool m_useTransformSkipFast; ///< flag for enabling fast intra transform skipping 102 #if !REMOVE_NSQT103 Bool m_enableNSQT; ///< flag for enabling NSQT104 #endif105 115 Bool m_enableAMP; 106 116 // coding quality … … 108 118 Double m_fQP; ///< QP value of key-picture (floating point) 109 119 Int m_iQP; ///< QP value of key-picture (integer) 110 char* m_pchdQPFile; ///< QP offset for each slice (initialized from external file)120 Char* m_pchdQPFile; ///< QP offset for each slice (initialized from external file) 111 121 Int* m_aidQP; ///< array of slice QP values 112 122 #endif … … 140 150 141 151 // coding tools (bit-depth) 142 UInt m_uiInputBitDepth; ///< bit-depth of input file 143 UInt m_uiOutputBitDepth; ///< bit-depth of output file 144 UInt m_uiInternalBitDepth; ///< Internal bit-depth (BitDepth+BitIncrement) 152 Int m_inputBitDepthY; ///< bit-depth of input file (luma component) 153 Int m_inputBitDepthC; ///< bit-depth of input file (chroma component) 154 Int m_outputBitDepthY; ///< bit-depth of output file (luma component) 155 Int m_outputBitDepthC; ///< bit-depth of output file (chroma component) 156 Int m_internalBitDepthY; ///< bit-depth codec operates at in luma (input/output files will be converted) 157 Int m_internalBitDepthC; ///< bit-depth codec operates at in chroma (input/output files will be converted) 145 158 146 159 // coding tools (PCM bit-depth) 147 160 Bool m_bPCMInputBitDepthFlag; ///< 0: PCM bit-depth is internal bit-depth. 1: PCM bit-depth is input bit-depth. 148 UInt m_uiPCMBitDepthLuma; ///< PCM bit-depth for luma149 161 150 162 // coding tool (lossless) … … 152 164 Bool m_bUseSAO; 153 165 Int m_maxNumOffsetsPerPic; ///< SAO maximun number of offset per picture 154 #if SAO_LCU_BOUNDARY155 166 Bool m_saoLcuBoundary; ///< SAO parameter estimation using non-deblocked pixels for LCU bottom and right boundary areas 156 #endif157 167 Bool m_saoLcuBasedOptimization; ///< SAO LCU-based optimization 158 168 // coding tools (loop filter) 159 #if !REMOVE_ALF160 Bool m_bUseALF; ///< flag for using adaptive loop filter161 Bool m_alfLowLatencyEncoding;162 #endif163 169 Bool m_bLoopFilterDisable; ///< flag for using deblocking filter 164 170 Bool m_loopFilterOffsetInPPS; ///< offset for deblocking filter in 0 = slice header, 1 = PPS … … 167 173 Bool m_DeblockingFilterControlPresent; ///< deblocking filter control present flag in PPS 168 174 169 #if !REMOVE_LMCHROMA170 Bool m_bUseLMChroma; ///< JL: Chroma intra prediction based on luma signal171 #endif172 173 175 // coding tools (PCM) 174 176 Bool m_usePCM; ///< flag for using IPCM … … 181 183 Bool m_bUseASR; ///< flag for using adaptive motion search range 182 184 Bool m_bUseHADME; ///< flag for using HAD in sub-pel ME 183 Bool m_bUseRDOQ; ///< flag for using RD optimized quantization 185 Bool m_useRDOQ; ///< flag for using RD optimized quantization 186 Bool m_useRDOQTS; ///< flag for using RD optimized quantization for transform skip 187 #if L0232_RD_PENALTY 188 Int m_rdPenalty; ///< RD-penalty for 32x32 TU for intra in non-intra slices (0: no RD-penalty, 1: RD-penalty, 2: maximum RD-penalty) 189 #endif 184 190 Int m_iFastSearch; ///< ME mode, 0 = full, 1 = diamond, 2 = PMVFAST 185 191 Int m_iSearchRange; ///< ME search range … … 190 196 Bool m_bUseCbfFastMode; ///< flag for using Cbf Fast PU Mode Decision 191 197 Bool m_useEarlySkipDetection; ///< flag for using Early SKIP Detection 192 Int m_iSliceMode; ///< 0: Disable all Recon slice limits, 1 : Maximum number of largest coding units per slice, 2: Maximum number of bytes in a slice 193 Int m_iSliceArgument; ///< If m_iSliceMode==1, m_iSliceArgument=max. # of largest coding units. If m_iSliceMode==2, m_iSliceArgument=max. # of bytes. 194 Int m_iDependentSliceMode; ///< 0: Disable all dependent slice limits, 1 : Maximum number of largest coding units per slice, 2: Constraint based dependent slice 195 Int m_iDependentSliceArgument;///< If m_iDependentSliceMode==1, m_iEDependentSliceArgument=max. # of largest coding units. If m_iDependnetSliceMode==2, m_iDependnetSliceArgument=max. # of bins. 196 #if DEPENDENT_SLICES 197 #if TILES_WPP_ENTROPYSLICES_FLAGS 198 Bool m_entropySliceEnabledFlag; 199 #else 200 Bool m_bCabacIndependentFlag; // 0: CABAC dependence between slices, 1:CABAC independence between slices 201 #endif 202 #endif 203 204 #if !REMOVE_FGS 205 Int m_iSliceGranularity;///< 0: Slices always end at LCU borders. 1-3: slices may end at a depth of 1-3 below LCU level. 206 #endif 207 Bool m_bLFCrossSliceBoundaryFlag; ///< 0: Cross-slice-boundary in-loop filtering 1: non-cross-slice-boundary in-loop filtering 208 Bool m_bLFCrossTileBoundaryFlag; //!< 1: Cross-tile-boundary in-loop filtering 0: non-cross-tile-boundary in-loop filtering 198 Int m_sliceMode; ///< 0: no slice limits, 1 : max number of CTBs per slice, 2: max number of bytes per slice, 199 ///< 3: max number of tiles per slice 200 Int m_sliceArgument; ///< argument according to selected slice mode 201 Int m_sliceSegmentMode; ///< 0: no slice segment limits, 1 : max number of CTBs per slice segment, 2: max number of bytes per slice segment, 202 ///< 3: max number of tiles per slice segment 203 Int m_sliceSegmentArgument; ///< argument according to selected slice segment mode 204 205 Bool m_bLFCrossSliceBoundaryFlag; ///< 1: filter across slice boundaries 0: do not filter across slice boundaries 206 Bool m_bLFCrossTileBoundaryFlag; ///< 1: filter across tile boundaries 0: do not filter across tile boundaries 209 207 Int m_iUniformSpacingIdr; 210 208 Int m_iNumColumnsMinus1; 211 char* m_pchColumnWidth;209 Char* m_pchColumnWidth; 212 210 Int m_iNumRowsMinus1; 213 char* m_pchRowHeight; 211 Char* m_pchRowHeight; 212 UInt* m_pColumnWidth; 213 UInt* m_pRowHeight; 214 214 Int m_iWaveFrontSynchro; //< 0: no WPP. >= 1: WPP is enabled, the "Top right" from which inheritance occurs is this LCU offset in the line above the current. 215 215 #if !SVC_EXTENSION … … 219 219 Bool m_bUseConstrainedIntraPred; ///< flag for using constrained intra prediction 220 220 221 Int m_decodePictureHashSEIEnabled; ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message 222 #if RECOVERY_POINT_SEI 221 Int m_decodedPictureHashSEIEnabled; ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message 223 222 Int m_recoveryPointSEIEnabled; 224 #endif225 #if BUFFERING_PERIOD_AND_TIMING_SEI226 223 Int m_bufferingPeriodSEIEnabled; 227 224 Int m_pictureTimingSEIEnabled; 228 #endif 225 Int m_framePackingSEIEnabled; 226 Int m_framePackingSEIType; 227 Int m_framePackingSEIId; 228 Int m_framePackingSEIQuincunx; 229 Int m_framePackingSEIInterpretation; 230 Int m_displayOrientationSEIAngle; 231 Int m_temporalLevel0IndexSEIEnabled; 232 Int m_gradualDecodingRefreshInfoEnabled; 233 Int m_decodingUnitInfoSEIEnabled; 229 234 // weighted prediction 230 Bool m_ bUseWeightPred; ///< Use of explicit Weighting Prediction for P_SLICE231 Bool m_useWeightedBiPred; ///< Use of Bi-Directional Weighting Prediction (B_SLICE)235 Bool m_useWeightedPred; ///< Use of weighted prediction in P slices 236 Bool m_useWeightedBiPred; ///< Use of bi-directional weighted prediction in B slices 232 237 233 238 UInt m_log2ParallelMergeLevel; ///< Parallel merge estimation region … … 236 241 Int m_TMVPModeId; 237 242 Int m_signHideFlag; 243 #if RATE_CONTROL_LAMBDA_DOMAIN 244 Bool m_RCEnableRateControl; ///< enable rate control or not 245 Int m_RCTargetBitrate; ///< target bitrate when rate control is enabled 246 Bool m_RCKeepHierarchicalBit; ///< whether keeping hierarchical bit allocation structure or not 247 Bool m_RCLCULevelRC; ///< true: LCU level rate control; false: picture level rate control 248 Bool m_RCUseLCUSeparateModel; ///< use separate R-lambda model at LCU level 249 Int m_RCInitialQP; ///< inital QP for rate control 250 Bool m_RCForceIntraQP; ///< force all intra picture to use initial QP or not 251 #else 238 252 Bool m_enableRateCtrl; ///< Flag for using rate control algorithm 239 253 Int m_targetBitrate; ///< target bitrate 240 254 Int m_numLCUInUnit; ///< Total number of LCUs in a frame should be completely divided by the NumLCUInUnit 255 #endif 241 256 Int m_useScalingListId; ///< using quantization matrix 242 char* m_scalingListFile; ///< quantization matrix file name257 Char* m_scalingListFile; ///< quantization matrix file name 243 258 244 259 Bool m_TransquantBypassEnableFlag; ///< transquant_bypass_enable_flag setting in PPS. 245 260 Bool m_CUTransquantBypassFlagValue; ///< if transquant_bypass_enable_flag, the fixed value to use for the per-CU cu_transquant_bypass_flag. 246 261 247 #if RECALCULATE_QP_ACCORDING_LAMBDA248 262 Bool m_recalculateQPAccordingToLambda; ///< recalculate QP value according to the lambda value 249 #endif 250 #if ACTIVE_PARAMETER_SETS_SEI_MESSAGE 263 Bool m_useStrongIntraSmoothing; ///< enable strong intra smoothing for 32x32 blocks where the reference samples are flat 251 264 Int m_activeParameterSetsSEIEnabled; 252 #endif 253 254 #if SUPPORT_FOR_VUI 265 255 266 Bool m_vuiParametersPresentFlag; ///< enable generation of VUI parameters 256 267 Bool m_aspectRatioInfoPresentFlag; ///< Signals whether aspect_ratio_idc is present … … 259 270 Int m_sarHeight; ///< vertical size of the sample aspect ratio 260 271 Bool m_overscanInfoPresentFlag; ///< Signals whether overscan_appropriate_flag is present 261 Bool m_overscanAppropriateFlag; ///< Indicates whether c roppeddecoded pictures are suitable for display using overscan272 Bool m_overscanAppropriateFlag; ///< Indicates whether conformant decoded pictures are suitable for display using overscan 262 273 Bool m_videoSignalTypePresentFlag; ///< Signals whether video_format, video_full_range_flag, and colour_description_present_flag are present 263 274 Int m_videoFormat; ///< Indicates representation of pictures … … 271 282 Int m_chromaSampleLocTypeBottomField; ///< Specifies the location of chroma samples for bottom field 272 283 Bool m_neutralChromaIndicationFlag; ///< Indicates that the value of all decoded chroma samples is equal to 1<<(BitDepthCr-1) 284 Bool m_defaultDisplayWindowFlag; ///< Indicates the presence of the default window parameters 285 Int m_defDispWinLeftOffset; ///< Specifies the left offset from the conformance window of the default window 286 Int m_defDispWinRightOffset; ///< Specifies the right offset from the conformance window of the default window 287 Int m_defDispWinTopOffset; ///< Specifies the top offset from the conformance window of the default window 288 Int m_defDispWinBottomOffset; ///< Specifies the bottom offset from the conformance window of the default window 289 Bool m_frameFieldInfoPresentFlag; ///< Indicates that pic_struct values are present in picture timing SEI messages 290 Bool m_pocProportionalToTimingFlag; ///< Indicates that the POC value is proportional to the output time w.r.t. first picture in CVS 291 Int m_numTicksPocDiffOneMinus1; ///< Number of ticks minus 1 that for a POC difference of one 273 292 Bool m_bitstreamRestrictionFlag; ///< Signals whether bitstream restriction parameters are present 274 293 Bool m_tilesFixedStructureFlag; ///< Indicates that each active picture parameter set has the same values of the syntax elements related to tiles 275 294 Bool m_motionVectorsOverPicBoundariesFlag; ///< Indicates that no samples outside the picture boundaries are used for inter prediction 295 Int m_minSpatialSegmentationIdc; ///< Indicates the maximum size of the spatial segments in the pictures in the coded video sequence 276 296 Int m_maxBytesPerPicDenom; ///< Indicates a number of bytes not exceeded by the sum of the sizes of the VCL NAL units associated with any coded picture 277 297 Int m_maxBitsPerMinCuDenom; ///< Indicates an upper bound for the number of bits of coding_unit() data 278 298 Int m_log2MaxMvLengthHorizontal; ///< Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units 279 299 Int m_log2MaxMvLengthVertical; ///< Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units 280 #endif 300 281 301 #if REF_IDX_FRAMEWORK 282 302 Int m_elRapSliceBEnabled; … … 287 307 Void xPrintParameter (); ///< print configuration values 288 308 Void xPrintUsage (); ///< print usage 289 309 #if SIGNAL_BITRATE_PICRATE_IN_VPS 310 Int m_bitRatePicRateMaxTLayers; ///< Indicates max. number of sub-layers for which bit rate is signalled. 311 Bool* m_bitRateInfoPresentFlag; ///< Indicates whether bit rate information is signalled 312 Bool* m_picRateInfoPresentFlag; ///< Indicates whether pic rate information is signalled 313 Int* m_avgBitRate; ///< Indicates avg. bit rate information for various sub-layers 314 Int* m_maxBitRate; ///< Indicates max. bit rate information for various sub-layers 315 Int* m_avgPicRate; ///< Indicates avg. picture rate information for various sub-layers 316 Int* m_constantPicRateIdc; ///< Indicates constant picture rate idc for various sub-layers 317 #endif 318 # 290 319 public: 291 320 TAppEncCfg(); … … 298 327 299 328 #if SVC_EXTENSION 300 Int getNumFrameToBeEncoded() {return m_ iFrameToBeEncoded; }329 Int getNumFrameToBeEncoded() {return m_framesToBeEncoded; } 301 330 Int getNumLayer() {return m_numLayers; } 302 331 Int getGOPSize() {return m_iGOPSize; } 303 UInt getInternalBitDepth() {return m_uiInternalBitDepth; } 332 UInt getInternalBitDepthY() {return m_internalBitDepthY; } 333 UInt getInternalBitDepthC() {return m_internalBitDepthC; } 304 334 UInt getMaxCUWidth() {return m_uiMaxCUWidth; } 305 335 UInt getMaxCUHeight() {return m_uiMaxCUHeight; } 306 336 UInt getMaxCUDepth() {return m_uiMaxCUDepth; } 307 337 Int getDecodingRefreshType() {return m_iDecodingRefreshType; } 338 Int getWaveFrontSynchro() { return m_iWaveFrontSynchro; } 308 339 Void getDirFilename(string& filename, string& dir, const string path); 309 Int getWaveFrontSynchro() { return m_iWaveFrontSynchro; }310 340 #if AVC_SYNTAX 311 341 Char* getBLSyntaxFile() { return m_BLSyntaxFile; } -
trunk/source/App/TAppEncoder/TAppEncLayerCfg.cpp
r55 r125 1 1 /** \file TAppEncLayerCfg.cpp 2 2 \brief Handle encoder configuration parameters 3 3 */ 4 4 … … 28 28 #if SVC_EXTENSION 29 29 TAppEncLayerCfg::TAppEncLayerCfg() 30 :m_cInputFile(string("")),31 m_cReconFile(string("")),32 m_croppingMode( 0 ),33 m_aidQP(NULL)34 { 35 m_c ropLeft = m_cropRight = m_cropTop = m_cropBottom = 0;30 :m_cInputFile(string("")), 31 m_cReconFile(string("")), 32 m_conformanceMode( 0 ), 33 m_aidQP(NULL) 34 { 35 m_confLeft = m_confRight = m_confTop = m_confBottom = 0; 36 36 m_aiPad[1] = m_aiPad[0] = 0; 37 37 } … … 59 59 60 60 /** \param argc number of arguments 61 62 63 61 \param argv array of arguments 62 \retval true when success 63 */ 64 64 bool TAppEncLayerCfg::parseCfg( const string& cfgFileName ) 65 65 { … … 69 69 po::Options opts; 70 70 opts.addOptions() 71 ("InputFile,i", cfg_InputFile, string(""), "original YUV input file name")71 ("InputFile,i", cfg_InputFile, string(""), "original YUV input file name") 72 72 #if AVC_BASE 73 ("InputBLFile,-ibl", cfg_InputFile, string(""), "original YUV input file name")74 #endif 75 ("ReconFile,o", cfg_ReconFile, string(""), "reconstructed YUV output file name")76 ("SourceWidth,-wdt", m_iSourceWidth, 0, "Source picture width")77 ("SourceHeight,-hgt", m_iSourceHeight, 0, "Source picture height")78 ("CroppingMode", m_croppingMode, 0, "Cropping mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping")79 ("CropLeft", m_cropLeft, 0, "Left cropping/padding for cropping mode 3")80 ("CropRight", m_cropRight, 0, "Right cropping/padding for cropping mode 3")81 ("CropTop", m_cropTop, 0, "Top cropping/padding for cropping mode 3")82 ("CropBottom", m_cropBottom, 0, "Bottom cropping/padding for cropping mode 3")83 ("HorizontalPadding,-pdx",m_aiPad[0], 0, "horizontal source padding for cropping mode 2")84 ("VerticalPadding,-pdy", m_aiPad[1], 0, "vertical source padding for cropping mode 2")85 ("IntraPeriod,-ip", m_iIntraPeriod, -1, "intra period in frames, (-1: only first frame)")86 ("FrameRate,-fr", m_iFrameRate, 0, "Frame rate")87 ("dQPFile,m", cfg_dQPFile, string(""), "dQP file name")88 ("QP,q", m_fQP, 30.0, "Qp value, if value is float, QP is switched once during encoding")89 ;90 73 ("InputBLFile,-ibl", cfg_InputFile, string(""), "original YUV input file name") 74 #endif 75 ("ReconFile,o", cfg_ReconFile, string(""), "reconstructed YUV output file name") 76 ("SourceWidth,-wdt", m_iSourceWidth, 0, "Source picture width") 77 ("SourceHeight,-hgt", m_iSourceHeight, 0, "Source picture height") 78 ("CroppingMode", m_conformanceMode, 0, "Cropping mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping") 79 ("CropLeft", m_confLeft, 0, "Left cropping/padding for cropping mode 3") 80 ("CropRight", m_confRight, 0, "Right cropping/padding for cropping mode 3") 81 ("CropTop", m_confTop, 0, "Top cropping/padding for cropping mode 3") 82 ("CropBottom", m_confBottom, 0, "Bottom cropping/padding for cropping mode 3") 83 ("HorizontalPadding,-pdx",m_aiPad[0], 0, "horizontal source padding for cropping mode 2") 84 ("VerticalPadding,-pdy", m_aiPad[1], 0, "vertical source padding for cropping mode 2") 85 ("IntraPeriod,-ip", m_iIntraPeriod, -1, "intra period in frames, (-1: only first frame)") 86 ("FrameRate,-fr", m_iFrameRate, 0, "Frame rate") 87 ("dQPFile,m", cfg_dQPFile, string(""), "dQP file name") 88 ("QP,q", m_fQP, 30.0, "Qp value, if value is float, QP is switched once during encoding") 89 ; 90 91 91 po::setDefaults(opts); 92 92 po::parseConfigFile(opts, cfgFileName); … … 123 123 printf("Base layer input file : %s\n", m_cAppEncCfg->getBLSyntaxFile() ); 124 124 #endif 125 printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_c ropLeft - m_cropRight, m_iSourceHeight - m_cropTop - m_cropBottom, m_iFrameRate );125 printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_confLeft - m_confRight, m_iSourceHeight - m_confTop - m_confBottom, m_iFrameRate ); 126 126 printf("Internal Format : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate ); 127 127 printf("QP : %5.2f\n", m_fQP ); 128 128 printf("Intra period : %d\n", m_iIntraPeriod ); 129 #if SVC_EXTENSION 130 printf("WaveFrontSynchro:%d WaveFrontSubstreams:%d", 131 m_cAppEncCfg->getWaveFrontSynchro(), m_iWaveFrontSubstreams); 132 #endif 129 printf("WaveFrontSynchro:%d WaveFrontSubstreams:%d", m_cAppEncCfg->getWaveFrontSynchro(), m_iWaveFrontSubstreams); 133 130 } 134 131 … … 137 134 Bool TAppEncLayerCfg::xCheckParameter() 138 135 { 139 switch (m_c roppingMode)136 switch (m_conformanceMode) 140 137 { 141 138 case 0: 142 139 { 143 140 // no cropping or padding 144 m_c ropLeft = m_cropRight = m_cropTop = m_cropBottom = 0;141 m_confLeft = m_confRight = m_confTop = m_confBottom = 0; 145 142 m_aiPad[1] = m_aiPad[0] = 0; 146 143 break; … … 152 149 if (m_iSourceWidth % minCuSize) 153 150 { 154 m_aiPad[0] = m_c ropRight = ((m_iSourceWidth / minCuSize) + 1) * minCuSize - m_iSourceWidth;155 m_iSourceWidth += m_c ropRight;151 m_aiPad[0] = m_confRight = ((m_iSourceWidth / minCuSize) + 1) * minCuSize - m_iSourceWidth; 152 m_iSourceWidth += m_confRight; 156 153 } 157 154 if (m_iSourceHeight % minCuSize) 158 155 { 159 m_aiPad[1] = m_c ropBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight;160 m_iSourceHeight += m_c ropBottom;156 m_aiPad[1] = m_confBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight; 157 m_iSourceHeight += m_confBottom; 161 158 } 162 159 break; … … 167 164 m_iSourceWidth += m_aiPad[0]; 168 165 m_iSourceHeight += m_aiPad[1]; 169 m_c ropRight = m_aiPad[0];170 m_c ropBottom = m_aiPad[1];166 m_confRight = m_aiPad[0]; 167 m_confBottom = m_aiPad[1]; 171 168 break; 172 169 } 173 170 case 3: 174 171 { 175 // c ropping176 if ((m_c ropLeft == 0) && (m_cropRight == 0) && (m_cropTop == 0) && (m_cropBottom == 0))172 // conformance 173 if ((m_confLeft == 0) && (m_confRight == 0) && (m_confTop == 0) && (m_confBottom == 0)) 177 174 { 178 175 fprintf(stderr, "Warning: Cropping enabled, but all cropping parameters set to zero\n"); … … 200 197 { 201 198 Int iSwitchPOC = (Int)( iFrameToBeEncoded - (m_fQP - m_iQP)*iFrameToBeEncoded + 0.5 ); 202 199 203 200 204 201 iSwitchPOC = (Int)( (Double)iSwitchPOC / iGOPSize + 0.5 )*iGOPSize; … … 224 221 } 225 222 226 xConfirmPara( m_iQP < -6 * ((Int)m_cAppEncCfg->getInternalBitDepth() - 8) || m_iQP > 51, "QP exceeds supported range (-QpBDOffsety to 51)" ); 227 228 229 #if SVC_EXTENSION 223 xConfirmPara( m_iQP < -6 * ((Int)m_cAppEncCfg->getInternalBitDepthY() - 8) || m_iQP > 51, "QP exceeds supported range (-QpBDOffsety to 51)" ); 224 225 230 226 m_iWaveFrontSubstreams = m_cAppEncCfg->getWaveFrontSynchro() ? (m_iSourceHeight + m_cAppEncCfg->getMaxCUHeight() - 1) / m_cAppEncCfg->getMaxCUHeight() : 1; 231 227 xConfirmPara( m_iWaveFrontSubstreams <= 0, "WaveFrontSubstreams must be positive" ); 232 228 xConfirmPara( m_iWaveFrontSubstreams > 1 && !m_cAppEncCfg->getWaveFrontSynchro(), "Must have WaveFrontSynchro > 0 in order to have WaveFrontSubstreams > 1" ); 233 #endif 234 229 230 //chekc parameters 231 xConfirmPara( m_iSourceWidth % TComSPS::getWinUnitX(CHROMA_420) != 0, "Picture width must be an integer multiple of the specified chroma subsampling"); 232 xConfirmPara( m_iSourceHeight % TComSPS::getWinUnitY(CHROMA_420) != 0, "Picture height must be an integer multiple of the specified chroma subsampling"); 233 234 xConfirmPara( m_aiPad[0] % TComSPS::getWinUnitX(CHROMA_420) != 0, "Horizontal padding must be an integer multiple of the specified chroma subsampling"); 235 xConfirmPara( m_aiPad[1] % TComSPS::getWinUnitY(CHROMA_420) != 0, "Vertical padding must be an integer multiple of the specified chroma subsampling"); 236 237 xConfirmPara( m_confLeft % TComSPS::getWinUnitX(CHROMA_420) != 0, "Left conformance window offset must be an integer multiple of the specified chroma subsampling"); 238 xConfirmPara( m_confRight % TComSPS::getWinUnitX(CHROMA_420) != 0, "Right conformance window offset must be an integer multiple of the specified chroma subsampling"); 239 xConfirmPara( m_confTop % TComSPS::getWinUnitY(CHROMA_420) != 0, "Top conformance window offset must be an integer multiple of the specified chroma subsampling"); 240 xConfirmPara( m_confBottom % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling"); 235 241 #undef xConfirmPara 236 242 return check_failed; -
trunk/source/App/TAppEncoder/TAppEncLayerCfg.h
r2 r125 34 34 Int m_iSourceWidth; ///< source width in pixel 35 35 Int m_iSourceHeight; ///< source height in pixel 36 Int m_c roppingMode;37 Int m_c ropLeft;38 Int m_c ropRight;39 Int m_c ropTop;40 Int m_c ropBottom;36 Int m_conformanceMode; 37 Int m_confLeft; 38 Int m_confRight; 39 Int m_confTop; 40 Int m_confBottom; 41 41 Int m_aiPad[2]; ///< number of padded pixels for width and height 42 42 Int m_iIntraPeriod; ///< period of I-slice (random access period) 43 43 Double m_fQP; ///< QP value of key-picture (floating point) 44 44 #if VPS_EXTN_DIRECT_REF_LAYERS 45 Int *m_refLayerIds; 46 Int m_numDirectRefLayers; 47 #endif 45 48 #if SVC_EXTENSION 46 49 Int m_iWaveFrontSubstreams; //< If iWaveFrontSynchro, this is the number of substreams per frame (dependent tiles) or per tile (independent tiles). … … 64 67 65 68 Void setAppEncCfg(TAppEncCfg* p) {m_cAppEncCfg = p; } 69 66 70 string getInputFile() {return m_cInputFile; } 67 71 string getReconFile() {return m_cReconFile; } … … 69 73 Int getSourceWidth() {return m_iSourceWidth; } 70 74 Int getSourceHeight() {return m_iSourceHeight; } 71 Int getCroppingMode() {return m_croppingMode; } 72 Int getCropLeft() {return m_cropLeft; } 73 Int getCropRight() {return m_cropRight; } 74 Int getCropTop() {return m_cropTop; } 75 Int getCropBottom() {return m_cropBottom; } 75 Int getConformanceMode() { return m_conformanceMode; } 76 76 Int* getPad() {return m_aiPad; } 77 77 Double getFloatQP() {return m_fQP; } 78 Int getConfLeft() {return m_confLeft; } 79 Int getConfRight() {return m_confRight; } 80 Int getConfTop() {return m_confTop; } 81 Int getConfBottom() {return m_confBottom; } 78 82 79 83 Int getIntQP() {return m_iQP; } 80 84 Int* getdQPs() {return m_aidQP; } 81 85 #if VPS_EXTN_DIRECT_REF_LAYERS 86 Int getNumDirectRefLayers() {return m_numDirectRefLayers;} 87 Int* getRefLayerIds() {return m_refLayerIds; } 88 Int getRefLayerId(Int i) {return m_refLayerIds[i]; } 89 #endif 82 90 }; // END CLASS DEFINITION TAppEncLayerCfg 83 91 -
trunk/source/App/TAppEncoder/TAppEncTop.cpp
r55 r125 1 1 /* The copyright in this software is being made available under the BSD 2 3 4 5 6 * Copyright (c) 2010-2012, ITU/ISO/IEC7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 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-2013, ITU/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 ITU/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 33 34 34 /** \file TAppEncTop.cpp 35 35 \brief Encoder application class 36 36 */ 37 37 … … 75 75 Void TAppEncTop::xInitLibCfg() 76 76 { 77 TComVPS* vps = m_acTEncTop[0].getVPS(); 78 79 vps->setMaxTLayers ( m_maxTempLayer ); 80 if (m_maxTempLayer == 1) 81 { 82 vps->setTemporalNestingFlag(true); 83 } 84 #if !VPS_RENAME 85 vps.setMaxLayers ( 1 ); 86 #endif 87 for(Int i = 0; i < MAX_TLAYER; i++) 88 { 89 vps->setNumReorderPics ( m_numReorderPics[i], i ); 90 vps->setMaxDecPicBuffering ( m_maxDecPicBuffering[i], i ); 91 } 92 77 93 for(UInt layer=0; layer<m_numLayers; layer++) 78 94 { 79 TComVPS vps; 80 81 vps.setMaxTLayers ( m_maxTempLayer ); 82 vps.setMaxLayers ( 1 ); 83 for(Int i = 0; i < MAX_TLAYER; i++) 84 { 85 vps.setNumReorderPics ( m_numReorderPics[i], i ); 86 vps.setMaxDecPicBuffering ( m_maxDecPicBuffering[i], i ); 87 } 88 m_acTEncTop[layer].setVPS(&vps); 95 //m_acTEncTop[layer].setVPS(&vps); 89 96 m_acTEncTop[layer].setFrameRate ( m_acLayerCfg[layer].getFrameRate() ); 90 97 m_acTEncTop[layer].setFrameSkip ( m_FrameSkip ); 91 98 m_acTEncTop[layer].setSourceWidth ( m_acLayerCfg[layer].getSourceWidth() ); 92 99 m_acTEncTop[layer].setSourceHeight ( m_acLayerCfg[layer].getSourceHeight() ); 93 m_acTEncTop[layer].setCroppingMode ( m_acLayerCfg[layer].getCroppingMode() ); 94 m_acTEncTop[layer].setCropLeft ( m_acLayerCfg[layer].getCropLeft() ); 95 m_acTEncTop[layer].setCropRight ( m_acLayerCfg[layer].getCropRight() ); 96 m_acTEncTop[layer].setCropTop ( m_acLayerCfg[layer].getCropTop() ); 97 m_acTEncTop[layer].setCropBottom ( m_acLayerCfg[layer].getCropBottom() ); 98 m_acTEncTop[layer].setFrameToBeEncoded ( m_iFrameToBeEncoded ); 100 m_acTEncTop[layer].setConformanceMode ( m_acLayerCfg[layer].getConformanceMode() ); 101 m_acTEncTop[layer].setConformanceWindow ( m_acLayerCfg[layer].m_confLeft, m_acLayerCfg[layer].m_confRight, m_acLayerCfg[layer].m_confTop, m_acLayerCfg[layer].m_confBottom ); 102 m_acTEncTop[layer].setFramesToBeEncoded ( m_framesToBeEncoded ); 103 104 m_acTEncTop[layer].setProfile(m_profile); 105 m_acTEncTop[layer].setLevel(m_levelTier, m_level); 106 #if L0046_CONSTRAINT_FLAGS 107 m_acTEncTop[layer].setProgressiveSourceFlag(m_progressiveSourceFlag); 108 m_acTEncTop[layer].setInterlacedSourceFlag(m_interlacedSourceFlag); 109 m_acTEncTop[layer].setNonPackedConstraintFlag(m_nonPackedConstraintFlag); 110 m_acTEncTop[layer].setFrameOnlyConstraintFlag(m_frameOnlyConstraintFlag); 111 #endif 99 112 100 113 #if REF_IDX_MFM 101 if(layer == 0) 102 { 103 m_acTEncTop[layer].setMFMEnabledFlag(false); 104 } 105 else 106 { 107 m_acTEncTop[layer].setMFMEnabledFlag(true); 108 } 114 m_acTEncTop[layer].setMFMEnabledFlag(layer == 0 ? false : true); 109 115 #endif 110 116 // set layer ID … … 112 118 m_acTEncTop[layer].setNumLayer ( m_numLayers ); 113 119 m_acTEncTop[layer].setLayerEnc(m_apcTEncTop); 114 115 120 116 121 //====== Coding Structure ======== … … 134 139 135 140 m_acTEncTop[layer].setMaxTempLayer ( m_maxTempLayer ); 136 #if !REMOVE_NSQT137 m_acTEncTop[layer].setUseNSQT( m_enableNSQT );138 #endif139 141 m_acTEncTop[layer].setUseAMP( m_enableAMP ); 140 142 #if VPS_EXTN_DIRECT_REF_LAYERS 143 if(layer) 144 { 145 if(m_acLayerCfg[layer].getNumDirectRefLayers() == -1) 146 { 147 // Not included in the configuration file; assume that each layer depends on previous layer 148 m_acTEncTop[layer].setNumDirectRefLayers (1); // One ref. layer 149 m_acTEncTop[layer].setRefLayerId (0, layer - 1); // Previous layer 150 } 151 else 152 { 153 m_acTEncTop[layer].setNumDirectRefLayers ( m_acLayerCfg[layer].getNumDirectRefLayers() ); 154 for(Int i = 0; i < m_acTEncTop[layer].getNumDirectRefLayers(); i++) 155 { 156 m_acTEncTop[layer].setRefLayerId ( i, m_acLayerCfg[layer].getRefLayerId(i)); 157 } 158 } 159 } 160 #endif 141 161 //===== Slice ======== 142 162 … … 157 177 m_acTEncTop[layer].setMaxCuDQPDepth ( m_iMaxCuDQPDepth ); 158 178 159 m_acTEncTop[layer].setChromaCbQpOffset 160 m_acTEncTop[layer].setChromaCrQpOffset ( m_crQpOffset );179 m_acTEncTop[layer].setChromaCbQpOffset ( m_cbQpOffset ); 180 m_acTEncTop[layer].setChromaCrQpOffset ( m_crQpOffset ); 161 181 162 182 #if ADAPTIVE_QP_SELECTION … … 165 185 166 186 Int lowestQP; 167 lowestQP = - ( (Int)(6*(g_uiBitDepth + g_uiBitIncrement - 8)) );187 lowestQP = - 6*(g_bitDepthY - 8); // XXX: check 168 188 169 189 if ((m_iMaxDeltaQP == 0 ) && (m_acLayerCfg[layer].getIntQP() == lowestQP) && (m_useLossless == true)) … … 179 199 m_acTEncTop[layer].setUseASR ( m_bUseASR ); 180 200 m_acTEncTop[layer].setUseHADME ( m_bUseHADME ); 181 #if !REMOVE_ALF182 m_acTEncTop[layer].setUseALF ( m_bUseALF );183 #endif184 201 m_acTEncTop[layer].setUseLossless ( m_useLossless ); 185 202 m_acTEncTop[layer].setUseLComb ( m_bUseLComb ); 186 m_acTEncTop[layer].setdQPs ( m_acLayerCfg[layer].getdQPs() ); 187 m_acTEncTop[layer].setUseRDOQ ( m_bUseRDOQ ); 203 m_acTEncTop[layer].setdQPs ( m_acLayerCfg[layer].getdQPs() ); 204 m_acTEncTop[layer].setUseRDOQ ( m_useRDOQ ); 205 m_acTEncTop[layer].setUseRDOQTS ( m_useRDOQTS ); 206 #if L0232_RD_PENALTY 207 m_acTEncTop[layer].setRDpenalty ( m_rdPenalty ); 208 #endif 188 209 m_acTEncTop[layer].setQuadtreeTULog2MaxSize ( m_uiQuadtreeTULog2MaxSize ); 189 210 m_acTEncTop[layer].setQuadtreeTULog2MinSize ( m_uiQuadtreeTULog2MinSize ); … … 193 214 m_acTEncTop[layer].setUseEarlyCU ( m_bUseEarlyCU ); 194 215 m_acTEncTop[layer].setUseFastDecisionForMerge ( m_useFastDecisionForMerge ); 195 m_acTEncTop[layer].setUseCbfFastMode ( m_bUseCbfFastMode ); 196 m_acTEncTop[layer].setUseEarlySkipDetection ( m_useEarlySkipDetection ); 197 198 #if !REMOVE_LMCHROMA 199 m_acTEncTop[layer].setUseLMChroma ( m_bUseLMChroma ); 200 #endif 216 m_acTEncTop[layer].setUseCbfFastMode ( m_bUseCbfFastMode ); 217 m_acTEncTop[layer].setUseEarlySkipDetection ( m_useEarlySkipDetection ); 218 201 219 m_acTEncTop[layer].setUseTransformSkip ( m_useTransformSkip ); 202 220 m_acTEncTop[layer].setUseTransformSkipFast ( m_useTransformSkipFast ); 203 221 m_acTEncTop[layer].setUseConstrainedIntraPred ( m_bUseConstrainedIntraPred ); 204 m_acTEncTop[layer].setPCMLog2MinSize ( m_uiPCMLog2MinSize);222 m_acTEncTop[layer].setPCMLog2MinSize ( m_uiPCMLog2MinSize); 205 223 m_acTEncTop[layer].setUsePCM ( m_usePCM ); 206 224 m_acTEncTop[layer].setPCMLog2MaxSize ( m_pcmLog2MaxSize); … … 209 227 210 228 //====== Weighted Prediction ======== 211 m_acTEncTop[layer].setUseWP ( m_ bUseWeightPred );229 m_acTEncTop[layer].setUseWP ( m_useWeightedPred ); 212 230 m_acTEncTop[layer].setWPBiPred ( m_useWeightedBiPred ); 213 231 //====== Parallel Merge Estimation ======== … … 215 233 216 234 //====== Slice ======== 217 m_acTEncTop[layer].setSliceMode ( m_ iSliceMode );218 m_acTEncTop[layer].setSliceArgument ( m_ iSliceArgument );235 m_acTEncTop[layer].setSliceMode ( m_sliceMode ); 236 m_acTEncTop[layer].setSliceArgument ( m_sliceArgument ); 219 237 220 238 //====== Dependent Slice ======== 221 m_acTEncTop[layer].setDependentSliceMode ( m_iDependentSliceMode ); 222 m_acTEncTop[layer].setDependentSliceArgument ( m_iDependentSliceArgument ); 223 #if DEPENDENT_SLICES 224 #if TILES_WPP_ENTROPYSLICES_FLAGS 225 m_acTEncTop[layer].setEntropySliceEnabledFlag ( m_entropySliceEnabledFlag ); 226 #else 227 m_acTEncTop[layer].setCabacIndependentFlag ( m_bCabacIndependentFlag ); 228 #endif 229 #endif 230 int iNumPartInCU = 1<<(m_uiMaxCUDepth<<1); 231 if(m_iDependentSliceMode==SHARP_FIXED_NUMBER_OF_LCU_IN_DEPENDENT_SLICE) 232 { 233 #if REMOVE_FGS 234 m_acTEncTop[layer].setDependentSliceArgument ( m_iDependentSliceArgument * iNumPartInCU ); 235 #else 236 m_acTEncTop[layer].setDependentSliceArgument ( m_iDependentSliceArgument * ( iNumPartInCU >> ( m_iSliceGranularity << 1 ) ) ); 237 #endif 238 } 239 if(m_iSliceMode==AD_HOC_SLICES_FIXED_NUMBER_OF_LCU_IN_SLICE) 240 { 241 #if REMOVE_FGS 242 m_acTEncTop[layer].setSliceArgument ( m_iSliceArgument * iNumPartInCU ); 243 #else 244 m_acTEncTop[layer].setSliceArgument ( m_iSliceArgument * ( iNumPartInCU >> ( m_iSliceGranularity << 1 ) ) ); 245 #endif 246 } 247 if(m_iSliceMode==AD_HOC_SLICES_FIXED_NUMBER_OF_TILES_IN_SLICE) 248 { 249 m_acTEncTop[layer].setSliceArgument ( m_iSliceArgument ); 250 } 251 252 #if !REMOVE_FGS 253 m_acTEncTop[layer].setSliceGranularity ( m_iSliceGranularity ); 254 #endif 255 if(m_iSliceMode == 0 ) 239 m_acTEncTop[layer].setSliceSegmentMode ( m_sliceSegmentMode ); 240 m_acTEncTop[layer].setSliceSegmentArgument ( m_sliceSegmentArgument ); 241 Int iNumPartInCU = 1<<(m_uiMaxCUDepth<<1); 242 if(m_sliceSegmentMode==FIXED_NUMBER_OF_LCU) 243 { 244 m_acTEncTop[layer].setSliceSegmentArgument ( m_sliceSegmentArgument * iNumPartInCU ); 245 } 246 if(m_sliceMode==FIXED_NUMBER_OF_LCU) 247 { 248 m_acTEncTop[layer].setSliceArgument ( m_sliceArgument * iNumPartInCU ); 249 } 250 if(m_sliceMode==FIXED_NUMBER_OF_TILES) 251 { 252 m_acTEncTop[layer].setSliceArgument ( m_sliceArgument ); 253 } 254 255 if(m_sliceMode == 0 ) 256 256 { 257 257 m_bLFCrossSliceBoundaryFlag = true; … … 261 261 m_acTEncTop[layer].setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic); 262 262 263 #if SAO_LCU_BOUNDARY264 263 m_acTEncTop[layer].setSaoLcuBoundary (m_saoLcuBoundary); 265 #endif266 264 m_acTEncTop[layer].setSaoLcuBasedOptimization (m_saoLcuBasedOptimization); 267 265 m_acTEncTop[layer].setPCMInputBitDepthFlag ( m_bPCMInputBitDepthFlag); 268 266 m_acTEncTop[layer].setPCMFilterDisableFlag ( m_bPCMFilterDisableFlag); 269 267 270 m_acTEncTop[layer].setDecodedPictureHashSEIEnabled(m_decodePictureHashSEIEnabled); 271 #if RECOVERY_POINT_SEI 268 m_acTEncTop[layer].setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled); 272 269 m_acTEncTop[layer].setRecoveryPointSEIEnabled( m_recoveryPointSEIEnabled ); 273 #endif274 #if BUFFERING_PERIOD_AND_TIMING_SEI275 270 m_acTEncTop[layer].setBufferingPeriodSEIEnabled( m_bufferingPeriodSEIEnabled ); 276 271 m_acTEncTop[layer].setPictureTimingSEIEnabled( m_pictureTimingSEIEnabled ); 277 #endif 272 m_acTEncTop[layer].setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled ); 273 m_acTEncTop[layer].setFramePackingArrangementSEIType( m_framePackingSEIType ); 274 m_acTEncTop[layer].setFramePackingArrangementSEIId( m_framePackingSEIId ); 275 m_acTEncTop[layer].setFramePackingArrangementSEIQuincunx( m_framePackingSEIQuincunx ); 276 m_acTEncTop[layer].setFramePackingArrangementSEIInterpretation( m_framePackingSEIInterpretation ); 277 m_acTEncTop[layer].setDisplayOrientationSEIAngle( m_displayOrientationSEIAngle ); 278 m_acTEncTop[layer].setTemporalLevel0IndexSEIEnabled( m_temporalLevel0IndexSEIEnabled ); 279 m_acTEncTop[layer].setGradualDecodingRefreshInfoEnabled( m_gradualDecodingRefreshInfoEnabled ); 280 m_acTEncTop[layer].setDecodingUnitInfoSEIEnabled( m_decodingUnitInfoSEIEnabled ); 278 281 m_acTEncTop[layer].setUniformSpacingIdr ( m_iUniformSpacingIdr ); 279 282 m_acTEncTop[layer].setNumColumnsMinus1 ( m_iNumColumnsMinus1 ); … … 281 284 if(m_iUniformSpacingIdr==0) 282 285 { 283 m_acTEncTop[layer].setColumnWidth ( m_p chColumnWidth );284 m_acTEncTop[layer].setRowHeight ( m_p chRowHeight );286 m_acTEncTop[layer].setColumnWidth ( m_pColumnWidth ); 287 m_acTEncTop[layer].setRowHeight ( m_pRowHeight ); 285 288 } 286 289 m_acTEncTop[layer].xCheckGSParameters(); … … 297 300 m_acTEncTop[layer].setScalingListFile ( m_scalingListFile ); 298 301 m_acTEncTop[layer].setSignHideFlag(m_signHideFlag); 299 #if !REMOVE_ALF 300 m_acTEncTop[layer].setALFLowLatencyEncoding( m_alfLowLatencyEncoding ); 301 #endif 302 #if RATE_CONTROL_LAMBDA_DOMAIN 303 m_acTEncTop[layer].setUseRateCtrl ( m_RCEnableRateControl ); 304 m_acTEncTop[layer].setTargetBitrate ( m_RCTargetBitrate ); 305 m_acTEncTop[layer].setKeepHierBit ( m_RCKeepHierarchicalBit ); 306 m_acTEncTop[layer].setLCULevelRC ( m_RCLCULevelRC ); 307 m_acTEncTop[layer].setUseLCUSeparateModel ( m_RCUseLCUSeparateModel ); 308 m_acTEncTop[layer].setInitialQP ( m_RCInitialQP ); 309 m_acTEncTop[layer].setForceIntraQP ( m_RCForceIntraQP ); 310 #else 302 311 m_acTEncTop[layer].setUseRateCtrl ( m_enableRateCtrl); 303 312 m_acTEncTop[layer].setTargetBitrate ( m_targetBitrate); 304 313 m_acTEncTop[layer].setNumLCUInUnit ( m_numLCUInUnit); 314 #endif 305 315 m_acTEncTop[layer].setTransquantBypassEnableFlag(m_TransquantBypassEnableFlag); 306 316 m_acTEncTop[layer].setCUTransquantBypassFlagValue(m_CUTransquantBypassFlagValue); 307 #if RECALCULATE_QP_ACCORDING_LAMBDA308 317 m_acTEncTop[layer].setUseRecalculateQPAccordingToLambda( m_recalculateQPAccordingToLambda ); 309 #endif 310 #if ACTIVE_PARAMETER_SETS_SEI_MESSAGE 318 m_acTEncTop[layer].setUseStrongIntraSmoothing( m_useStrongIntraSmoothing ); 311 319 m_acTEncTop[layer].setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled ); 312 #endif313 #if SUPPORT_FOR_VUI314 320 m_acTEncTop[layer].setVuiParametersPresentFlag( m_vuiParametersPresentFlag ); 315 321 m_acTEncTop[layer].setAspectRatioIdc( m_aspectRatioIdc ); … … 329 335 m_acTEncTop[layer].setChromaSampleLocTypeBottomField( m_chromaSampleLocTypeBottomField ); 330 336 m_acTEncTop[layer].setNeutralChromaIndicationFlag( m_neutralChromaIndicationFlag ); 337 m_acTEncTop[layer].setDefaultDisplayWindow( m_defDispWinLeftOffset, m_defDispWinRightOffset, m_defDispWinTopOffset, m_defDispWinBottomOffset ); 338 m_acTEncTop[layer].setFrameFieldInfoPresentFlag( m_frameFieldInfoPresentFlag ); 339 m_acTEncTop[layer].setPocProportionalToTimingFlag( m_pocProportionalToTimingFlag ); 340 m_acTEncTop[layer].setNumTicksPocDiffOneMinus1 ( m_numTicksPocDiffOneMinus1 ); 331 341 m_acTEncTop[layer].setBitstreamRestrictionFlag( m_bitstreamRestrictionFlag ); 332 342 m_acTEncTop[layer].setTilesFixedStructureFlag( m_tilesFixedStructureFlag ); 333 343 m_acTEncTop[layer].setMotionVectorsOverPicBoundariesFlag( m_motionVectorsOverPicBoundariesFlag ); 344 m_acTEncTop[layer].setMinSpatialSegmentationIdc( m_minSpatialSegmentationIdc ); 334 345 m_acTEncTop[layer].setMaxBytesPerPicDenom( m_maxBytesPerPicDenom ); 335 346 m_acTEncTop[layer].setMaxBitsPerMinCuDenom( m_maxBitsPerMinCuDenom ); 336 347 m_acTEncTop[layer].setLog2MaxMvLengthHorizontal( m_log2MaxMvLengthHorizontal ); 337 348 m_acTEncTop[layer].setLog2MaxMvLengthVertical( m_log2MaxMvLengthVertical ); 349 #if SIGNAL_BITRATE_PICRATE_IN_VPS 350 TComBitRatePicRateInfo *bitRatePicRateInfo = m_cTEncTop[layer].getVPS()->getBitratePicrateInfo(); 351 // The number of bit rate/pic rate have to equal to number of sub-layers. 352 if(m_bitRatePicRateMaxTLayers) 353 { 354 assert(m_bitRatePicRateMaxTLayers == m_cTEncTop[layer].getVPS()->getMaxTLayers()); 355 } 356 for(Int i = 0; i < m_bitRatePicRateMaxTLayers; i++) 357 { 358 bitRatePicRateInfo->setBitRateInfoPresentFlag( i, m_bitRateInfoPresentFlag[i] ); 359 if( bitRatePicRateInfo->getBitRateInfoPresentFlag(i) ) 360 { 361 bitRatePicRateInfo->setAvgBitRate(i, m_avgBitRate[i]); 362 bitRatePicRateInfo->setMaxBitRate(i, m_maxBitRate[i]); 363 } 364 } 365 for(Int i = 0; i < m_bitRatePicRateMaxTLayers; i++) 366 { 367 bitRatePicRateInfo->setPicRateInfoPresentFlag( i, m_picRateInfoPresentFlag[i] ); 368 if( bitRatePicRateInfo->getPicRateInfoPresentFlag(i) ) 369 { 370 bitRatePicRateInfo->setAvgPicRate (i, m_avgPicRate[i]); 371 bitRatePicRateInfo->setConstantPicRateIdc(i, m_constantPicRateIdc[i]); 372 } 373 } 338 374 #endif 339 375 #if REF_IDX_FRAMEWORK … … 346 382 { 347 383 TComVPS vps; 348 384 349 385 vps.setMaxTLayers ( m_maxTempLayer ); 386 if (m_maxTempLayer == 1) 387 { 388 vps.setTemporalNestingFlag(true); 389 } 350 390 vps.setMaxLayers ( 1 ); 351 391 for(Int i = 0; i < MAX_TLAYER; i++) … … 355 395 } 356 396 m_cTEncTop.setVPS(&vps); 397 398 m_cTEncTop.setProfile(m_profile); 399 m_cTEncTop.setLevel(m_levelTier, m_level); 400 #if L0046_CONSTRAINT_FLAGS 401 m_cTEncTop.setProgressiveSourceFlag(m_progressiveSourceFlag); 402 m_cTEncTop.setInterlacedSourceFlag(m_interlacedSourceFlag); 403 m_cTEncTop.setNonPackedConstraintFlag(m_nonPackedConstraintFlag); 404 m_cTEncTop.setFrameOnlyConstraintFlag(m_frameOnlyConstraintFlag); 405 #endif 406 357 407 m_cTEncTop.setFrameRate ( m_iFrameRate ); 358 408 m_cTEncTop.setFrameSkip ( m_FrameSkip ); 359 409 m_cTEncTop.setSourceWidth ( m_iSourceWidth ); 360 410 m_cTEncTop.setSourceHeight ( m_iSourceHeight ); 361 m_cTEncTop.setCroppingMode ( m_croppingMode ); 362 m_cTEncTop.setCropLeft ( m_cropLeft ); 363 m_cTEncTop.setCropRight ( m_cropRight ); 364 m_cTEncTop.setCropTop ( m_cropTop ); 365 m_cTEncTop.setCropBottom ( m_cropBottom ); 366 m_cTEncTop.setFrameToBeEncoded ( m_iFrameToBeEncoded ); 367 411 m_cTEncTop.setConformanceWindow ( m_confLeft, m_confRight, m_confTop, m_confBottom ); 412 m_cTEncTop.setFramesToBeEncoded ( m_framesToBeEncoded ); 413 368 414 //====== Coding Structure ======== 369 415 m_cTEncTop.setIntraPeriod ( m_iIntraPeriod ); … … 382 428 } 383 429 m_cTEncTop.setQP ( m_iQP ); 384 430 385 431 m_cTEncTop.setPad ( m_aiPad ); 386 432 387 433 m_cTEncTop.setMaxTempLayer ( m_maxTempLayer ); 388 #if !REMOVE_NSQT389 m_cTEncTop.setUseNSQT( m_enableNSQT );390 #endif391 434 m_cTEncTop.setUseAMP( m_enableAMP ); 392 435 393 436 //===== Slice ======== 394 437 395 438 //====== Loop/Deblock Filter ======== 396 439 m_cTEncTop.setLoopFilterDisable ( m_bLoopFilterDisable ); … … 417 460 418 461 Int lowestQP; 419 lowestQP = - ( (Int)(6*(g_uiBitDepth + g_uiBitIncrement - 8)) );462 lowestQP = - 6*(g_bitDepthY - 8); // XXX: check 420 463 421 464 if ((m_iMaxDeltaQP == 0 ) && (m_iQP == lowestQP) && (m_useLossless == true)) … … 425 468 m_cTEncTop.setUseAdaptiveQP ( m_bUseAdaptiveQP ); 426 469 m_cTEncTop.setQPAdaptationRange ( m_iQPAdaptationRange ); 427 470 428 471 //====== Tool list ======== 429 472 m_cTEncTop.setUseSBACRD ( m_bUseSBACRD ); … … 431 474 m_cTEncTop.setUseASR ( m_bUseASR ); 432 475 m_cTEncTop.setUseHADME ( m_bUseHADME ); 433 #if !REMOVE_ALF434 m_cTEncTop.setUseALF ( m_bUseALF );435 #endif436 476 m_cTEncTop.setUseLossless ( m_useLossless ); 437 477 m_cTEncTop.setUseLComb ( m_bUseLComb ); 438 478 m_cTEncTop.setdQPs ( m_aidQP ); 439 m_cTEncTop.setUseRDOQ ( m_bUseRDOQ ); 479 m_cTEncTop.setUseRDOQ ( m_useRDOQ ); 480 m_cTEncTop.setUseRDOQTS ( m_useRDOQTS ); 481 #if L0232_RD_PENALTY 482 m_cTEncTop.setRDpenalty ( m_rdPenalty ); 483 #endif 440 484 m_cTEncTop.setQuadtreeTULog2MaxSize ( m_uiQuadtreeTULog2MaxSize ); 441 485 m_cTEncTop.setQuadtreeTULog2MinSize ( m_uiQuadtreeTULog2MinSize ); … … 448 492 m_cTEncTop.setUseEarlySkipDetection ( m_useEarlySkipDetection ); 449 493 450 #if !REMOVE_LMCHROMA451 m_cTEncTop.setUseLMChroma ( m_bUseLMChroma );452 #endif453 494 m_cTEncTop.setUseTransformSkip ( m_useTransformSkip ); 454 495 m_cTEncTop.setUseTransformSkipFast ( m_useTransformSkipFast ); … … 458 499 m_cTEncTop.setPCMLog2MaxSize ( m_pcmLog2MaxSize); 459 500 m_cTEncTop.setMaxNumMergeCand ( m_maxNumMergeCand ); 460 501 461 502 462 503 //====== Weighted Prediction ======== 463 m_cTEncTop.setUseWP ( m_ bUseWeightPred );504 m_cTEncTop.setUseWP ( m_useWeightedPred ); 464 505 m_cTEncTop.setWPBiPred ( m_useWeightedBiPred ); 465 506 //====== Parallel Merge Estimation ======== … … 467 508 468 509 //====== Slice ======== 469 m_cTEncTop.setSliceMode ( m_ iSliceMode );470 m_cTEncTop.setSliceArgument ( m_ iSliceArgument );510 m_cTEncTop.setSliceMode ( m_sliceMode ); 511 m_cTEncTop.setSliceArgument ( m_sliceArgument ); 471 512 472 513 //====== Dependent Slice ======== 473 m_cTEncTop.setDependentSliceMode ( m_iDependentSliceMode ); 474 m_cTEncTop.setDependentSliceArgument ( m_iDependentSliceArgument ); 475 #if DEPENDENT_SLICES 476 #if TILES_WPP_ENTROPYSLICES_FLAGS 477 m_cTEncTop.setEntropySliceEnabledFlag ( m_entropySliceEnabledFlag ); 478 #else 479 m_cTEncTop.setCabacIndependentFlag ( m_bCabacIndependentFlag ); 480 #endif 481 #endif 482 int iNumPartInCU = 1<<(m_uiMaxCUDepth<<1); 483 if(m_iDependentSliceMode==SHARP_FIXED_NUMBER_OF_LCU_IN_DEPENDENT_SLICE) 484 { 485 #if REMOVE_FGS 486 m_cTEncTop.setDependentSliceArgument ( m_iDependentSliceArgument * iNumPartInCU ); 487 #else 488 m_cTEncTop.setDependentSliceArgument ( m_iDependentSliceArgument * ( iNumPartInCU >> ( m_iSliceGranularity << 1 ) ) ); 489 #endif 490 } 491 if(m_iSliceMode==AD_HOC_SLICES_FIXED_NUMBER_OF_LCU_IN_SLICE) 492 { 493 #if REMOVE_FGS 494 m_cTEncTop.setSliceArgument ( m_iSliceArgument * iNumPartInCU ); 495 #else 496 m_cTEncTop.setSliceArgument ( m_iSliceArgument * ( iNumPartInCU >> ( m_iSliceGranularity << 1 ) ) ); 497 #endif 498 } 499 if(m_iSliceMode==AD_HOC_SLICES_FIXED_NUMBER_OF_TILES_IN_SLICE) 500 { 501 m_cTEncTop.setSliceArgument ( m_iSliceArgument ); 502 } 503 504 #if !REMOVE_FGS 505 m_cTEncTop.setSliceGranularity ( m_iSliceGranularity ); 506 #endif 507 if(m_iSliceMode == 0 ) 514 m_cTEncTop.setSliceSegmentMode ( m_sliceSegmentMode ); 515 m_cTEncTop.setSliceSegmentArgument ( m_sliceSegmentArgument ); 516 Int iNumPartInCU = 1<<(m_uiMaxCUDepth<<1); 517 if(m_sliceSegmentMode==FIXED_NUMBER_OF_LCU) 518 { 519 m_cTEncTop.setSliceSegmentArgument ( m_sliceSegmentArgument * iNumPartInCU ); 520 } 521 if(m_sliceMode==FIXED_NUMBER_OF_LCU) 522 { 523 m_cTEncTop.setSliceArgument ( m_sliceArgument * iNumPartInCU ); 524 } 525 if(m_sliceMode==FIXED_NUMBER_OF_TILES) 526 { 527 m_cTEncTop.setSliceArgument ( m_sliceArgument ); 528 } 529 530 if(m_sliceMode == 0 ) 508 531 { 509 532 m_bLFCrossSliceBoundaryFlag = true; … … 513 536 m_cTEncTop.setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic); 514 537 515 #if SAO_LCU_BOUNDARY516 538 m_cTEncTop.setSaoLcuBoundary (m_saoLcuBoundary); 517 #endif518 539 m_cTEncTop.setSaoLcuBasedOptimization (m_saoLcuBasedOptimization); 519 540 m_cTEncTop.setPCMInputBitDepthFlag ( m_bPCMInputBitDepthFlag); 520 541 m_cTEncTop.setPCMFilterDisableFlag ( m_bPCMFilterDisableFlag); 521 542 522 m_cTEncTop.setDecodedPictureHashSEIEnabled(m_decodePictureHashSEIEnabled); 523 #if RECOVERY_POINT_SEI 543 m_cTEncTop.setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled); 524 544 m_cTEncTop.setRecoveryPointSEIEnabled( m_recoveryPointSEIEnabled ); 525 #endif526 #if BUFFERING_PERIOD_AND_TIMING_SEI527 545 m_cTEncTop.setBufferingPeriodSEIEnabled( m_bufferingPeriodSEIEnabled ); 528 546 m_cTEncTop.setPictureTimingSEIEnabled( m_pictureTimingSEIEnabled ); 529 #endif 547 m_cTEncTop.setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled ); 548 m_cTEncTop.setFramePackingArrangementSEIType( m_framePackingSEIType ); 549 m_cTEncTop.setFramePackingArrangementSEIId( m_framePackingSEIId ); 550 m_cTEncTop.setFramePackingArrangementSEIQuincunx( m_framePackingSEIQuincunx ); 551 m_cTEncTop.setFramePackingArrangementSEIInterpretation( m_framePackingSEIInterpretation ); 552 m_cTEncTop.setDisplayOrientationSEIAngle( m_displayOrientationSEIAngle ); 553 m_cTEncTop.setTemporalLevel0IndexSEIEnabled( m_temporalLevel0IndexSEIEnabled ); 554 m_cTEncTop.setGradualDecodingRefreshInfoEnabled( m_gradualDecodingRefreshInfoEnabled ); 555 m_cTEncTop.setDecodingUnitInfoSEIEnabled( m_decodingUnitInfoSEIEnabled ); 530 556 m_cTEncTop.setUniformSpacingIdr ( m_iUniformSpacingIdr ); 531 557 m_cTEncTop.setNumColumnsMinus1 ( m_iNumColumnsMinus1 ); … … 533 559 if(m_iUniformSpacingIdr==0) 534 560 { 535 m_cTEncTop.setColumnWidth ( m_p chColumnWidth );536 m_cTEncTop.setRowHeight ( m_p chRowHeight );561 m_cTEncTop.setColumnWidth ( m_pColumnWidth ); 562 m_cTEncTop.setRowHeight ( m_pRowHeight ); 537 563 } 538 564 m_cTEncTop.xCheckGSParameters(); … … 549 575 m_cTEncTop.setScalingListFile ( m_scalingListFile ); 550 576 m_cTEncTop.setSignHideFlag(m_signHideFlag); 551 #if !REMOVE_ALF 552 m_cTEncTop.setALFLowLatencyEncoding( m_alfLowLatencyEncoding ); 553 #endif 577 #if RATE_CONTROL_LAMBDA_DOMAIN 578 m_cTEncTop.setUseRateCtrl ( m_RCEnableRateControl ); 579 m_cTEncTop.setTargetBitrate ( m_RCTargetBitrate ); 580 m_cTEncTop.setKeepHierBit ( m_RCKeepHierarchicalBit ); 581 m_cTEncTop.setLCULevelRC ( m_RCLCULevelRC ); 582 m_cTEncTop.setUseLCUSeparateModel ( m_RCUseLCUSeparateModel ); 583 m_cTEncTop.setInitialQP ( m_RCInitialQP ); 584 m_cTEncTop.setForceIntraQP ( m_RCForceIntraQP ); 585 #else 554 586 m_cTEncTop.setUseRateCtrl ( m_enableRateCtrl); 555 587 m_cTEncTop.setTargetBitrate ( m_targetBitrate); 556 588 m_cTEncTop.setNumLCUInUnit ( m_numLCUInUnit); 589 #endif 557 590 m_cTEncTop.setTransquantBypassEnableFlag(m_TransquantBypassEnableFlag); 558 591 m_cTEncTop.setCUTransquantBypassFlagValue(m_CUTransquantBypassFlagValue); 559 #if RECALCULATE_QP_ACCORDING_LAMBDA560 592 m_cTEncTop.setUseRecalculateQPAccordingToLambda( m_recalculateQPAccordingToLambda ); 561 #endif 562 #if ACTIVE_PARAMETER_SETS_SEI_MESSAGE 593 m_cTEncTop.setUseStrongIntraSmoothing( m_useStrongIntraSmoothing ); 563 594 m_cTEncTop.setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled ); 564 #endif565 #if SUPPORT_FOR_VUI566 595 m_cTEncTop.setVuiParametersPresentFlag( m_vuiParametersPresentFlag ); 567 596 m_cTEncTop.setAspectRatioIdc( m_aspectRatioIdc ); … … 581 610 m_cTEncTop.setChromaSampleLocTypeBottomField( m_chromaSampleLocTypeBottomField ); 582 611 m_cTEncTop.setNeutralChromaIndicationFlag( m_neutralChromaIndicationFlag ); 612 m_cTEncTop.setDefaultDisplayWindow( m_defDispWinLeftOffset, m_defDispWinRightOffset, m_defDispWinTopOffset, m_defDispWinBottomOffset ); 613 m_cTEncTop.setFrameFieldInfoPresentFlag( m_frameFieldInfoPresentFlag ); 614 m_cTEncTop.setPocProportionalToTimingFlag( m_pocProportionalToTimingFlag ); 615 m_cTEncTop.setNumTicksPocDiffOneMinus1 ( m_numTicksPocDiffOneMinus1 ); 583 616 m_cTEncTop.setBitstreamRestrictionFlag( m_bitstreamRestrictionFlag ); 584 617 m_cTEncTop.setTilesFixedStructureFlag( m_tilesFixedStructureFlag ); 585 618 m_cTEncTop.setMotionVectorsOverPicBoundariesFlag( m_motionVectorsOverPicBoundariesFlag ); 619 m_cTEncTop.setMinSpatialSegmentationIdc( m_minSpatialSegmentationIdc ); 586 620 m_cTEncTop.setMaxBytesPerPicDenom( m_maxBytesPerPicDenom ); 587 621 m_cTEncTop.setMaxBitsPerMinCuDenom( m_maxBitsPerMinCuDenom ); 588 622 m_cTEncTop.setLog2MaxMvLengthHorizontal( m_log2MaxMvLengthHorizontal ); 589 623 m_cTEncTop.setLog2MaxMvLengthVertical( m_log2MaxMvLengthVertical ); 624 #if SIGNAL_BITRATE_PICRATE_IN_VPS 625 TComBitRatePicRateInfo *bitRatePicRateInfo = m_cTEncTop.getVPS()->getBitratePicrateInfo(); 626 // The number of bit rate/pic rate have to equal to number of sub-layers. 627 if(m_bitRatePicRateMaxTLayers) 628 { 629 assert(m_bitRatePicRateMaxTLayers == m_cTEncTop.getVPS()->getMaxTLayers()); 630 } 631 for(Int i = 0; i < m_bitRatePicRateMaxTLayers; i++) 632 { 633 bitRatePicRateInfo->setBitRateInfoPresentFlag( i, m_bitRateInfoPresentFlag[i] ); 634 if( bitRatePicRateInfo->getBitRateInfoPresentFlag(i) ) 635 { 636 bitRatePicRateInfo->setAvgBitRate(i, m_avgBitRate[i]); 637 bitRatePicRateInfo->setMaxBitRate(i, m_maxBitRate[i]); 638 } 639 } 640 for(Int i = 0; i < m_bitRatePicRateMaxTLayers; i++) 641 { 642 bitRatePicRateInfo->setPicRateInfoPresentFlag( i, m_picRateInfoPresentFlag[i] ); 643 if( bitRatePicRateInfo->getPicRateInfoPresentFlag(i) ) 644 { 645 bitRatePicRateInfo->setAvgPicRate (i, m_avgPicRate[i]); 646 bitRatePicRateInfo->setConstantPicRateIdc(i, m_constantPicRateIdc[i]); 647 } 648 } 590 649 #endif 591 650 } … … 601 660 for(UInt layer=0; layer<m_numLayers; layer++) 602 661 { 603 m_acTVideoIOYuvInputFile[layer].open( ( char *)m_acLayerCfg[layer].getInputFile().c_str(), false, m_uiInputBitDepth, m_uiInternalBitDepth); // read mode662 m_acTVideoIOYuvInputFile[layer].open( (Char *)m_acLayerCfg[layer].getInputFile().c_str(), false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC ); // read mode 604 663 m_acTVideoIOYuvInputFile[layer].skipFrames(m_FrameSkip, m_acLayerCfg[layer].getSourceWidth() - m_acLayerCfg[layer].getPad()[0], m_acLayerCfg[layer].getSourceHeight() - m_acLayerCfg[layer].getPad()[1]); 605 664 606 665 if (!m_acLayerCfg[layer].getReconFile().empty()) 607 666 { 608 m_acTVideoIOYuvReconFile[layer].open(( char *)m_acLayerCfg[layer].getReconFile().c_str(), true, m_uiOutputBitDepth, m_uiInternalBitDepth); // write mode667 m_acTVideoIOYuvReconFile[layer].open((Char *)m_acLayerCfg[layer].getReconFile().c_str(), true, m_outputBitDepthY, m_outputBitDepthC, m_internalBitDepthY, m_internalBitDepthC ); // write mode 609 668 } 610 669 … … 612 671 } 613 672 #else 614 m_cTVideoIOYuvInputFile.open( m_pchInputFile, false, m_ uiInputBitDepth, m_uiInternalBitDepth); // read mode673 m_cTVideoIOYuvInputFile.open( m_pchInputFile, false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC ); // read mode 615 674 m_cTVideoIOYuvInputFile.skipFrames(m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1]); 616 675 617 676 if (m_pchReconFile) 618 m_cTVideoIOYuvReconFile.open(m_pchReconFile, true, m_ uiOutputBitDepth, m_uiInternalBitDepth); // write mode619 677 m_cTVideoIOYuvReconFile.open(m_pchReconFile, true, m_outputBitDepthY, m_outputBitDepthC, m_internalBitDepthY, m_internalBitDepthC); // write mode 678 620 679 // Neo Decoder 621 680 m_cTEncTop.create(); … … 640 699 m_cTVideoIOYuvInputFile.close(); 641 700 m_cTVideoIOYuvReconFile.close(); 642 701 643 702 // Neo Decoder 644 703 m_cTEncTop.destroy(); … … 653 712 m_acTEncTop[layer].init(); 654 713 } 714 #if VPS_RENAME 715 m_acTEncTop[0].getVPS()->setMaxLayers( m_numLayers ); 716 #endif 717 #if VPS_EXTN_OP_LAYER_SETS 718 TComVPS* vps = m_acTEncTop[0].getVPS(); 719 vps->setMaxLayerId(m_numLayers - 1); // Set max-layer ID 720 721 vps->setNumLayerSets(m_numLayers); 722 for(Int setId = 1; setId < vps->getNumLayerSets(); setId++) 723 { 724 for(Int layerId = 0; layerId <= vps->getMaxLayerId(); layerId++) 725 { 726 vps->setLayerIdIncludedFlag(true, setId, layerId); 727 } 728 } 729 #if VPS_EXTN_MASK_AND_DIM_INFO 730 UInt i = 0, dimIdLen = 0; 731 vps->setAvcBaseLayerFlag(false); 732 vps->setSplittingFlag(false); 733 for(i = 0; i < MAX_VPS_NUM_SCALABILITY_TYPES; i++) 734 { 735 vps->setScalabilityMask(i, false); 736 } 737 if(m_numLayers > 1) 738 { 739 vps->setScalabilityMask(1, true); // Only turn on spatial/SNR scalability 740 vps->setNumScalabilityTypes(1); 741 } 742 else 743 { 744 vps->setNumScalabilityTypes(0); 745 } 746 while((1 << dimIdLen) < m_numLayers) 747 { 748 dimIdLen++; 749 } 750 vps->setDimensionIdLen(0, dimIdLen); 751 vps->setNuhLayerIdPresentFlag(false); 752 vps->setLayerIdInNuh(0, 0); 753 vps->setLayerIdInVps(0, 0); 754 for(i = 1; i < vps->getMaxLayers(); i++) 755 { 756 vps->setLayerIdInNuh(i, i); 757 vps->setLayerIdInVps(vps->getLayerIdInNuh(i), i); 758 vps->setDimensionId(i, 0, i); 759 } 760 #endif 761 #if VPS_EXTN_PROFILE_INFO 762 vps->getPTLForExtnPtr()->resize(vps->getNumLayerSets()); 763 for(Int setId = 1; setId < vps->getNumLayerSets(); setId++) 764 { 765 vps->setProfilePresentFlag(setId, true); 766 // Note - may need to be changed for other layer structures. 767 *(vps->getPTLForExtn(setId)) = *(m_acTEncTop[setId].getSPS()->getPTL()); 768 } 769 #endif 770 // Target output layer 771 vps->setNumOutputLayerSets(1); 772 Int lsIdx = 1; 773 vps->setOutputLayerSetIdx(0, lsIdx); // Because only one layer set 774 // Include the highest layer as output layer 775 for(UInt layer=0; layer <= vps->getMaxLayerId() ; layer++) 776 { 777 if(vps->getLayerIdIncludedFlag(lsIdx, layer)) 778 { 779 vps->setOutputLayerFlag(lsIdx, layer, layer == (vps->getMaxLayerId())); 780 } 781 } 782 #endif 783 #if VPS_EXTN_DIRECT_REF_LAYERS 784 // Direct reference layers 785 for(UInt layerCtr = 1;layerCtr <= vps->getMaxLayers() - 1; layerCtr++) 786 { 787 vps->setNumDirectRefLayers( layerCtr, m_acTEncTop[layerCtr].getNumDirectRefLayers() ); 788 for(i = 0; i < vps->getNumDirectRefLayers(layerCtr); i++) 789 { 790 vps->setRefLayerId( layerCtr, i, m_acTEncTop[layerCtr].getRefLayerId(i) ); 791 } 792 // Set direct dependency flag 793 // Initialize flag to 0 794 for(Int refLayerCtr = 0; refLayerCtr < layerCtr; refLayerCtr++) 795 { 796 vps->setDirectDependencyFlag( layerCtr, refLayerCtr, false ); 797 } 798 for(i = 0; i < vps->getNumDirectRefLayers(layerCtr); i++) 799 { 800 vps->setDirectDependencyFlag( layerCtr, vps->getLayerIdInVps(m_acTEncTop[layerCtr].getRefLayerId(i)), true); 801 } 802 } 803 #endif 655 804 #else 656 805 m_cTEncTop.init(); … … 663 812 664 813 /** 665 666 667 668 669 670 671 814 - create internal class 815 - initialize internal variable 816 - until the end of input YUV file, call encoding function in TEncTop class 817 - delete allocated buffers 818 - destroy internal class 819 . 820 */ 672 821 #if SVC_EXTENSION 673 822 Void TAppEncTop::encode() 674 823 { 675 fstream bitstreamFile(m_p chBitstreamFile, fstream::binary | fstream::out);824 fstream bitstreamFile(m_pBitstreamFile, fstream::binary | fstream::out); 676 825 if (!bitstreamFile) 677 826 { 678 fprintf(stderr, "\nfailed to open bitstream file `%s' for writing\n", m_p chBitstreamFile);827 fprintf(stderr, "\nfailed to open bitstream file `%s' for writing\n", m_pBitstreamFile); 679 828 exit(EXIT_FAILURE); 680 829 } … … 682 831 TComPicYuv* pcPicYuvOrg [MAX_LAYERS]; 683 832 TComPicYuv* pcPicYuvRec = NULL; 684 833 685 834 // initialize internal class & member variables 686 687 835 xInitLibCfg(); 688 836 xCreateLib(); … … 690 838 691 839 // main encoder loop 692 Int iNumEncoded , iTotalNumEncoded;693 Bool bEos = false , bBaseEos = false;694 840 Int iNumEncoded = 0, iTotalNumEncoded = 0; 841 Bool bEos = false; 842 695 843 list<AccessUnit> outputAccessUnits; ///< list of access units to write out. is populated by the encoding process 696 844 … … 699 847 // allocate original YUV buffer 700 848 pcPicYuvOrg[layer] = new TComPicYuv; 701 #if SVC_UPSAMPLING 849 #if SVC_UPSAMPLING 702 850 pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL ); 703 851 #else 704 pcPicYuvOrg [layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );852 pcPicYuvOrg->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 705 853 #endif 706 854 } … … 733 881 xGetBuffer(pcPicYuvRec, layer); 734 882 883 // read input YUV file 735 884 m_acTVideoIOYuvInputFile[layer].read( pcPicYuvOrg[layer], m_acLayerCfg[layer].getPad() ); 736 885 737 886 if(layer == m_numLayers-1) 738 887 { … … 740 889 m_iFrameRcvd++; 741 890 // check end of file 742 bEos = ( m_acTVideoIOYuvInputFile[layer].isEof() == 1 ? true : bBaseEos? true : bEos ); 743 bEos = ( m_iFrameRcvd == m_iFrameToBeEncoded ? true : bEos ); 891 bEos = (m_iFrameRcvd == m_framesToBeEncoded); 744 892 } 745 else 746 { 747 // check end of file of base layers 748 bBaseEos = ( m_acTVideoIOYuvInputFile[layer].isEof() == 1 ? true : bBaseEos ); 749 } 750 m_acTEncTop[layer].encodePrep( bEos, pcPicYuvOrg[layer] ); 893 894 m_acTEncTop[layer].encodePrep( pcPicYuvOrg[layer] ); 751 895 } 752 896 753 897 bFramesReadyToCode = !(!bFirstFrame && ( m_acTEncTop[m_numLayers-1].getNumPicRcvd() != m_iGOPSize && m_iGOPSize ) && !bEos ); 898 } 899 Bool flush = 0; 900 // if end of file (which is only detected on a read failure) flush the encoder of any queued pictures 901 if (m_acTVideoIOYuvInputFile[m_numLayers-1].isEof()) 902 { 903 flush = true; 904 bEos = true; 905 m_iFrameRcvd--; 906 m_acTEncTop[m_numLayers-1].setFramesToBeEncoded(m_iFrameRcvd); 754 907 } 755 908 … … 761 914 { 762 915 // call encoding function for one frame 763 m_acTEncTop[layer].encode( pcPicYuvOrg[layer], m_acListPicYuvRec[layer], 764 outputAccessUnits, iPicIdInGOP ); 916 m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP ); 765 917 } 766 918 } … … 771 923 // write bistream to file if necessary 772 924 iNumEncoded = m_acTEncTop[layer].getNumPicRcvd(); 773 if ( iNumEncoded > 0 ) 925 if ( iNumEncoded > 0 ) 774 926 { 775 927 xWriteRecon(layer, iNumEncoded); … … 794 946 bFirstFrame = false; 795 947 } 796 797 948 // delete original YUV buffer 798 949 for(UInt layer=0; layer<m_numLayers; layer++) … … 805 956 m_acTEncTop[layer].deletePicBuffer(); 806 957 } 807 958 808 959 #if AVC_SYNTAX 809 960 if( streamSyntaxFile.is_open() ) … … 816 967 xDeleteBuffer(); 817 968 xDestroyLib(); 818 969 819 970 printRateSummary(); 820 971 821 972 return; 822 973 } 823 824 974 825 975 Void TAppEncTop::printOutSummary() … … 843 993 m_gcAnalyzeAll[layer].printOut('a', layer); 844 994 } 845 995 846 996 printf( "\n\nI Slices--------------------------------------------------------\n" ); 847 997 printf( "\tTotal Frames | " "Bitrate " "Y-PSNR " "U-PSNR " "V-PSNR \n" ); … … 850 1000 m_gcAnalyzeI[layer].printOut('i', layer); 851 1001 } 852 1002 853 1003 printf( "\n\nP Slices--------------------------------------------------------\n" ); 854 1004 printf( "\tTotal Frames | " "Bitrate " "Y-PSNR " "U-PSNR " "V-PSNR \n" ); … … 857 1007 m_gcAnalyzeP[layer].printOut('p', layer); 858 1008 } 859 1009 860 1010 printf( "\n\nB Slices--------------------------------------------------------\n" ); 861 1011 printf( "\tTotal Frames | " "Bitrate " "Y-PSNR " "U-PSNR " "V-PSNR \n" ); … … 878 1028 TComPicYuv* pcPicYuvOrg = new TComPicYuv; 879 1029 TComPicYuv* pcPicYuvRec = NULL; 880 1030 881 1031 // initialize internal class & member variables 882 1032 xInitLibCfg(); 883 1033 xCreateLib(); 884 1034 xInitLib(); 885 1035 886 1036 // main encoder loop 887 1037 Int iNumEncoded = 0; 888 1038 Bool bEos = false; 889 1039 890 1040 list<AccessUnit> outputAccessUnits; ///< list of access units to write out. is populated by the encoding process 891 1041 892 1042 // allocate original YUV buffer 893 1043 pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 894 1044 895 1045 while ( !bEos ) 896 1046 { … … 900 1050 // read input YUV file 901 1051 m_cTVideoIOYuvInputFile.read( pcPicYuvOrg, m_aiPad ); 902 1052 903 1053 // increase number of received frames 904 1054 m_iFrameRcvd++; 905 906 // check end of file 907 bEos = ( m_cTVideoIOYuvInputFile.isEof() == 1 ? true : false ); 908 bEos = ( m_iFrameRcvd == m_iFrameToBeEncoded ? true : bEos ); 909 1055 1056 bEos = (m_iFrameRcvd == m_framesToBeEncoded); 1057 1058 Bool flush = 0; 1059 // if end of file (which is only detected on a read failure) flush the encoder of any queued pictures 1060 if (m_cTVideoIOYuvInputFile.isEof()) 1061 { 1062 flush = true; 1063 bEos = true; 1064 m_iFrameRcvd--; 1065 m_cTEncTop.setFramesToBeEncoded(m_iFrameRcvd); 1066 } 1067 910 1068 // call encoding function for one frame 911 m_cTEncTop.encode( bEos, pcPicYuvOrg, m_cListPicYuvRec, outputAccessUnits, iNumEncoded );912 1069 m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, m_cListPicYuvRec, outputAccessUnits, iNumEncoded ); 1070 913 1071 // write bistream to file if necessary 914 1072 if ( iNumEncoded > 0 ) … … 918 1076 } 919 1077 } 1078 1079 m_cTEncTop.printSummary(); 1080 920 1081 // delete original YUV buffer 921 1082 pcPicYuvOrg->destroy(); 922 1083 delete pcPicYuvOrg; 923 1084 pcPicYuvOrg = NULL; 924 1085 925 1086 // delete used buffers in encoder class 926 1087 m_cTEncTop.deletePicBuffer(); 927 1088 928 1089 // delete buffers & classes 929 1090 xDeleteBuffer(); 930 1091 xDestroyLib(); 931 1092 932 1093 printRateSummary(); 933 1094 … … 941 1102 942 1103 /** 943 944 945 946 947 1104 - application has picture buffer list with size of GOP 1105 - picture buffer list acts as ring buffer 1106 - end of the list has the latest picture 1107 . 1108 */ 948 1109 #if SVC_EXTENSION 949 1110 Void TAppEncTop::xGetBuffer( TComPicYuv*& rpcPicYuvRec, UInt layer) 950 1111 { 951 1112 assert( m_iGOPSize > 0 ); 952 1113 953 1114 // org. buffer 954 1115 if ( m_acListPicYuvRec[layer].size() == (UInt)m_iGOPSize ) … … 960 1121 { 961 1122 rpcPicYuvRec = new TComPicYuv; 962 1123 963 1124 #if SVC_UPSAMPLING 964 1125 rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL ); … … 976 1137 { 977 1138 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_acListPicYuvRec[layer].begin(); 978 1139 979 1140 Int iSize = Int( m_acListPicYuvRec[layer].size() ); 980 1141 981 1142 for ( Int i = 0; i < iSize; i++ ) 982 1143 { … … 988 1149 } 989 1150 990 991 992 1151 Void TAppEncTop::xWriteRecon(UInt layer, Int iNumEncoded) 993 1152 { 994 1153 Int i; 995 1154 996 1155 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_acListPicYuvRec[layer].end(); 997 1156 998 1157 for ( i = 0; i < iNumEncoded; i++ ) 999 1158 { 1000 1159 --iterPicYuvRec; 1001 1160 } 1002 1161 1003 1162 for ( i = 0; i < iNumEncoded; i++ ) 1004 1163 { … … 1006 1165 if (!m_acLayerCfg[layer].getReconFile().empty()) 1007 1166 { 1008 m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getCropLeft(), m_acLayerCfg[layer].getCropRight(), 1009 m_acLayerCfg[layer].getCropTop(), m_acLayerCfg[layer].getCropBottom() ); 1010 } 1011 } 1012 } 1013 1167 m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getConfLeft(), m_acLayerCfg[layer].getConfRight(), 1168 m_acLayerCfg[layer].getConfTop(), m_acLayerCfg[layer].getConfBottom() ); 1169 } 1170 } 1171 } 1014 1172 1015 1173 Void TAppEncTop::xWriteStream(std::ostream& bitstreamFile, Int iNumEncoded, const std::list<AccessUnit>& accessUnits) 1016 1174 { 1017 1175 Int i; 1018 1176 1019 1177 list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin(); 1020 1178 1021 1179 for ( i = 0; i < iNumEncoded; i++ ) 1022 1180 { 1023 1181 const AccessUnit& au = *(iterBitstream++); 1024 const vector< unsigned>& stats = writeAnnexB(bitstreamFile, au);1182 const vector<UInt>& stats = writeAnnexB(bitstreamFile, au); 1025 1183 rateStatsAccum(au, stats); 1026 1184 } … … 1031 1189 { 1032 1190 assert( m_iGOPSize > 0 ); 1033 1191 1034 1192 // org. buffer 1035 1193 if ( m_cListPicYuvRec.size() == (UInt)m_iGOPSize ) … … 1041 1199 { 1042 1200 rpcPicYuvRec = new TComPicYuv; 1043 1201 1044 1202 rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 1045 1203 … … 1051 1209 { 1052 1210 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.begin(); 1053 1211 1054 1212 Int iSize = Int( m_cListPicYuvRec.size() ); 1055 1213 1056 1214 for ( Int i = 0; i < iSize; i++ ) 1057 1215 { … … 1060 1218 delete pcPicYuvRec; pcPicYuvRec = NULL; 1061 1219 } 1062 1220 1063 1221 } 1064 1222 1065 1223 /** \param iNumEncoded number of encoded frames 1066 1224 */ 1067 1225 Void TAppEncTop::xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, const std::list<AccessUnit>& accessUnits) 1068 1226 { 1069 1227 Int i; 1070 1228 1071 1229 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.end(); 1072 1230 list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin(); 1073 1231 1074 1232 for ( i = 0; i < iNumEncoded; i++ ) 1075 1233 { 1076 1234 --iterPicYuvRec; 1077 1235 } 1078 1236 1079 1237 for ( i = 0; i < iNumEncoded; i++ ) 1080 1238 { … … 1082 1240 if (m_pchReconFile) 1083 1241 { 1084 m_cTVideoIOYuvReconFile.write( pcPicYuvRec, m_c ropLeft, m_cropRight, m_cropTop, m_cropBottom );1242 m_cTVideoIOYuvReconFile.write( pcPicYuvRec, m_confLeft, m_confRight, m_confTop, m_confBottom ); 1085 1243 } 1086 1244 1087 1245 const AccessUnit& au = *(iterBitstream++); 1088 const vector< unsigned>& stats = writeAnnexB(bitstreamFile, au);1246 const vector<UInt>& stats = writeAnnexB(bitstreamFile, au); 1089 1247 rateStatsAccum(au, stats); 1090 1248 } … … 1093 1251 1094 1252 /** 1095 1096 1097 void TAppEncTop::rateStatsAccum(const AccessUnit& au, const std::vector< unsigned>& annexBsizes)1253 * 1254 */ 1255 void TAppEncTop::rateStatsAccum(const AccessUnit& au, const std::vector<UInt>& annexBsizes) 1098 1256 { 1099 1257 AccessUnit::const_iterator it_au = au.begin(); 1100 vector< unsigned>::const_iterator it_stats = annexBsizes.begin();1258 vector<UInt>::const_iterator it_stats = annexBsizes.begin(); 1101 1259 1102 1260 for (; it_au != au.end(); it_au++, it_stats++) … … 1104 1262 switch ((*it_au)->m_nalUnitType) 1105 1263 { 1106 #if NAL_UNIT_TYPES_J1003_D71107 1264 case NAL_UNIT_CODED_SLICE_TRAIL_R: 1108 1265 case NAL_UNIT_CODED_SLICE_TRAIL_N: … … 1117 1274 case NAL_UNIT_CODED_SLICE_IDR_N_LP: 1118 1275 case NAL_UNIT_CODED_SLICE_CRA: 1276 case NAL_UNIT_CODED_SLICE_RADL_N: 1119 1277 case NAL_UNIT_CODED_SLICE_DLP: 1278 case NAL_UNIT_CODED_SLICE_RASL_N: 1120 1279 case NAL_UNIT_CODED_SLICE_TFD: 1121 #else1122 case NAL_UNIT_CODED_SLICE:1123 case NAL_UNIT_CODED_SLICE_TFD:1124 case NAL_UNIT_CODED_SLICE_TLA:1125 case NAL_UNIT_CODED_SLICE_CRA:1126 case NAL_UNIT_CODED_SLICE_CRANT:1127 case NAL_UNIT_CODED_SLICE_BLA:1128 case NAL_UNIT_CODED_SLICE_BLANT:1129 case NAL_UNIT_CODED_SLICE_IDR:1130 #endif1131 1280 case NAL_UNIT_VPS: 1132 1281 case NAL_UNIT_SPS: … … 1145 1294 { 1146 1295 #if SVC_EXTENSION 1147 double time = (double) m_iFrameRcvd / m_acLayerCfg[m_numLayers-1].getFrameRate();1296 Double time = (Double) m_iFrameRcvd / m_acLayerCfg[m_numLayers-1].getFrameRate(); 1148 1297 #else 1149 double time = (double) m_iFrameRcvd / m_iFrameRate;1298 Double time = (Double) m_iFrameRcvd / m_iFrameRate; 1150 1299 #endif 1151 1300 printf("Bytes written to file: %u (%.3f kbps)\n", m_totalBytes, 0.008 * m_totalBytes / time); -
trunk/source/App/TAppEncoder/TAppEncTop.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 * … … 73 73 TComList<TComPicYuv*> m_cListPicYuvRec; ///< list of reconstruction YUV files 74 74 #endif 75 75 76 76 Int m_iFrameRcvd; ///< number of received frames 77 77 78 unsignedm_essentialBytes;79 unsignedm_totalBytes;78 UInt m_essentialBytes; 79 UInt m_totalBytes; 80 80 protected: 81 81 // initialization … … 103 103 Void xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, const std::list<AccessUnit>& accessUnits); ///< write bitstream to file 104 104 #endif 105 void rateStatsAccum(const AccessUnit& au, const std::vector< unsigned>& stats);105 void rateStatsAccum(const AccessUnit& au, const std::vector<UInt>& stats); 106 106 void printRateSummary(); 107 107 … … 116 116 TEncTop& getTEncTop () { return m_cTEncTop; } ///< return encoder class pointer reference 117 117 #endif 118 119 120 121 118 };// END CLASS DEFINITION TAppEncTop 122 119 -
trunk/source/App/TAppEncoder/encmain.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 * … … 37 37 38 38 #include <time.h> 39 #include <iostream> 39 40 #include "TAppEncTop.h" 41 #include "TAppCommon/program_options_lite.h" 42 43 using namespace std; 44 namespace po = df::program_options_lite; 40 45 41 46 //! \ingroup TAppEncoder … … 62 67 63 68 // parse configuration 64 if(!cTAppEncTop.parseCfg( argc, argv ))69 try 65 70 { 66 cTAppEncTop.destroy(); 71 if(!cTAppEncTop.parseCfg( argc, argv )) 72 { 73 cTAppEncTop.destroy(); 74 return 1; 75 } 76 } 77 catch (po::ParseFailure& e) 78 { 79 cerr << "Error parsing option \""<< e.arg <<"\" with argument \""<< e.val <<"\"." << endl; 67 80 return 1; 68 81 } -
trunk/source/App/utils/convert_NtoMbit_YCbCr.cpp
r2 r125 76 76 TVideoIOYuv output; 77 77 78 input.open((char*)filename_in.c_str(), false, bitdepth_in, bitdepth_ out);79 output.open((char*)filename_out.c_str(), true, bitdepth_out, bitdepth_out );78 input.open((char*)filename_in.c_str(), false, bitdepth_in, bitdepth_in, bitdepth_out, bitdepth_out); 79 output.open((char*)filename_out.c_str(), true, bitdepth_out, bitdepth_out, bitdepth_out, bitdepth_out); 80 80 81 81 input.skipFrames(num_frames_skip, width, height);
Note: See TracChangeset for help on using the changeset viewer.