Changeset 54 in SHVCSoftware for branches/HM-10.0-dev-SHM/source/App/TAppEncoder
- Timestamp:
- 2 Mar 2013, 09:25:00 (12 years ago)
- Location:
- branches/HM-10.0-dev-SHM/source/App/TAppEncoder
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HM-10.0-dev-SHM/source/App/TAppEncoder/TAppEncCfg.cpp
r51 r54 63 63 // ==================================================================================================================== 64 64 65 #if SVC_EXTENSION 66 TAppEncCfg::TAppEncCfg() 67 : m_pBitstreamFile() 68 , m_pColumnWidth() 69 , m_pRowHeight() 70 , m_scalingListFile() 71 #if REF_IDX_FRAMEWORK 72 , m_elRapSliceBEnabled(0) 73 #endif 74 { 75 for(UInt layer=0; layer<MAX_LAYERS; layer++) 76 { 77 m_acLayerCfg[layer].setAppEncCfg(this); 78 } 79 } 80 #else 65 81 TAppEncCfg::TAppEncCfg() 66 82 : m_pchInputFile() … … 74 90 m_aidQP = NULL; 75 91 } 92 #endif 76 93 77 94 TAppEncCfg::~TAppEncCfg() 78 95 { 96 #if !SVC_EXTENSION 79 97 if ( m_aidQP ) 80 98 { … … 82 100 } 83 101 free(m_pchInputFile); 84 free(m_pchBitstreamFile); 102 #endif 103 free(m_pBitstreamFile); 104 #if !SVC_EXTENSION 85 105 free(m_pchReconFile); 86 106 free(m_pchdQPFile); 107 #endif 87 108 free(m_pColumnWidth); 88 109 free(m_pRowHeight); … … 141 162 return in; 142 163 } 164 165 #if SVC_EXTENSION 166 void TAppEncCfg::getDirFilename(string& filename, string& dir, const string path) 167 { 168 size_t pos = path.find_last_of("\\"); 169 if(pos != std::string::npos) 170 { 171 filename.assign(path.begin() + pos + 1, path.end()); 172 dir.assign(path.begin(), path.begin() + pos + 1); 173 } 174 else 175 { 176 pos = path.find_last_of("/"); 177 if(pos != std::string::npos) 178 { 179 filename.assign(path.begin() + pos + 1, path.end()); 180 dir.assign(path.begin(), path.begin() + pos + 1); 181 } 182 else 183 { 184 filename = path; 185 dir.assign(""); 186 } 187 } 188 } 189 #endif 143 190 144 191 static const struct MapStrToProfile { … … 231 278 Bool do_help = false; 232 279 280 #if SVC_EXTENSION 281 string cfg_LayerCfgFile [MAX_LAYERS]; 282 string cfg_BitstreamFile; 283 string* cfg_InputFile [MAX_LAYERS]; 284 string* cfg_ReconFile [MAX_LAYERS]; 285 Double* cfg_fQP [MAX_LAYERS]; 286 287 Int* cfg_SourceWidth [MAX_LAYERS]; 288 Int* cfg_SourceHeight [MAX_LAYERS]; 289 Int* cfg_FrameRate [MAX_LAYERS]; 290 Int* cfg_IntraPeriod [MAX_LAYERS]; 291 Int* cfg_conformanceMode [MAX_LAYERS]; 292 for(UInt layer = 0; layer < MAX_LAYERS; layer++) 293 { 294 cfg_InputFile[layer] = &m_acLayerCfg[layer].m_cInputFile; 295 cfg_ReconFile[layer] = &m_acLayerCfg[layer].m_cReconFile; 296 cfg_fQP[layer] = &m_acLayerCfg[layer].m_fQP; 297 cfg_SourceWidth[layer] = &m_acLayerCfg[layer].m_iSourceWidth; 298 cfg_SourceHeight[layer] = &m_acLayerCfg[layer].m_iSourceHeight; 299 cfg_FrameRate[layer] = &m_acLayerCfg[layer].m_iFrameRate; 300 cfg_IntraPeriod[layer] = &m_acLayerCfg[layer].m_iIntraPeriod; 301 cfg_conformanceMode[layer] = &m_acLayerCfg[layer].m_conformanceMode; 302 } 303 #if AVC_SYNTAX 304 string cfg_BLSyntaxFile; 305 #endif 306 #else 233 307 string cfg_InputFile; 234 308 string cfg_BitstreamFile; 235 309 string cfg_ReconFile; 236 310 string cfg_dQPFile; 311 #endif 237 312 string cfg_ColumnWidth; 238 313 string cfg_RowHeight; … … 252 327 253 328 // File, I/O and source parameters 329 #if SVC_EXTENSION 330 ("InputFile%d,-i%d", cfg_InputFile, string(""), MAX_LAYERS, "original YUV input file name for layer %d") 331 ("ReconFile%d,-o%d", cfg_ReconFile, string(""), MAX_LAYERS, "reconstruction YUV input file name for layer %d") 332 ("LayerConfig%d,-lc%d", cfg_LayerCfgFile, string(""), MAX_LAYERS, "layer %d configuration file name") 333 ("SourceWidth%d,-wdt%d", cfg_SourceWidth, 0, MAX_LAYERS, "Source picture width for layer %d") 334 ("SourceHeight%d,-hgt%d", cfg_SourceHeight, 0, MAX_LAYERS, "Source picture height for layer %d") 335 ("FrameRate%d,-fr%d", cfg_FrameRate, 0, MAX_LAYERS, "Frame rate for layer %d") 336 ("LambdaModifier%d,-LM%d", m_adLambdaModifier, ( double )1.0, MAX_TLAYER, "Lambda modifier for temporal layer %d") 337 ("NumLayers", m_numLayers, 1, "Number of layers to code") 338 ("ConformanceMode%d", cfg_conformanceMode,0, MAX_LAYERS, "Window conformance mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping") 339 340 ("BitstreamFile,b", cfg_BitstreamFile, string(""), "Bitstream output file name") 341 ("InputBitDepth", m_inputBitDepthY, 8, "Bit-depth of input file") 342 ("OutputBitDepth", m_outputBitDepthY, 0, "Bit-depth of output file (default:InternalBitDepth)") 343 ("InternalBitDepth", m_internalBitDepthY, 0, "Bit-depth the codec operates at. (default:InputBitDepth)" 344 "If different to InputBitDepth, source data will be converted") 345 ("InputBitDepthC", m_inputBitDepthC, 0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)") 346 ("OutputBitDepthC", m_outputBitDepthC, 0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)") 347 ("InternalBitDepthC", m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)") 348 349 #if AVC_BASE 350 ("InputBLFile,-ibl", *cfg_InputFile[0], string(""), "Base layer rec YUV input file name") 351 #if AVC_SYNTAX 352 ("InputBLSyntaxFile,-ibs", cfg_BLSyntaxFile, string(""), "Base layer syntax input file name") 353 #endif 354 #endif 355 #if REF_IDX_FRAMEWORK 356 ("EnableElRapB,-use-rap-b", m_elRapSliceBEnabled, 0, "Set ILP over base-layer I picture to B picture (default is P picture_") 357 #endif 358 #else 254 359 ("InputFile,i", cfg_InputFile, string(""), "Original YUV input file name") 255 360 ("BitstreamFile,b", cfg_BitstreamFile, string(""), "Bitstream output file name") … … 272 377 ("ConfBottom", m_confBottom, 0, "Bottom offset for window conformance mode 3") 273 378 ("FrameRate,-fr", m_iFrameRate, 0, "Frame rate") 379 #endif 274 380 ("FrameSkip,-fs", m_FrameSkip, 0u, "Number of frames to skip at start of input YUV") 275 381 ("FramesToBeEncoded,f", m_framesToBeEncoded, 0, "Number of frames to be encoded (default=all)") … … 286 392 ("FrameOnly", m_frameOnlyConstraintFlag, false, "Indicate that the bitstream contains only frames") 287 393 #endif 288 394 289 395 // Unit definition parameters 290 396 ("MaxCUWidth", m_uiMaxCUWidth, 64u) … … 302 408 303 409 // Coding structure paramters 410 #if SVC_EXTENSION 411 ("IntraPeriod%d,-ip%d", cfg_IntraPeriod, -1, MAX_LAYERS, "intra period in frames for layer %d, (-1: only first frame)") 412 #else 304 413 ("IntraPeriod,-ip", m_iIntraPeriod, -1, "Intra period in frames, (-1: only first frame)") 414 #endif 305 415 ("DecodingRefreshType,-dr", m_iDecodingRefreshType, 0, "Intra refresh type (0:none 1:CRA 2:IDR)") 306 416 ("GOPSize,g", m_iGOPSize, 1, "GOP size of temporal structure") … … 313 423 ("ASR", m_bUseASR, false, "Adaptive motion search range") 314 424 425 #if SVC_EXTENSION 426 ("LambdaModifier%d,-LM%d", m_adLambdaModifier, ( double )1.0, MAX_TLAYER, "Lambda modifier for temporal layer %d") 427 #else 315 428 // Mode decision parameters 316 429 ("LambdaModifier0,-LM0", m_adLambdaModifier[ 0 ], ( Double )1.0, "Lambda modifier for temporal layer 0") … … 322 435 ("LambdaModifier6,-LM6", m_adLambdaModifier[ 6 ], ( Double )1.0, "Lambda modifier for temporal layer 6") 323 436 ("LambdaModifier7,-LM7", m_adLambdaModifier[ 7 ], ( Double )1.0, "Lambda modifier for temporal layer 7") 437 #endif 324 438 325 439 /* Quantization parameters */ 440 #if SVC_EXTENSION 441 ("QP%d,-q%d", cfg_fQP, 30.0, MAX_LAYERS, "Qp value for layer %d, if value is float, QP is switched once during encoding") 442 #else 326 443 ("QP,q", m_fQP, 30.0, "Qp value, if value is float, QP is switched once during encoding") 444 #endif 327 445 ("DeltaQpRD,-dqr",m_uiDeltaQpRD, 0u, "max dQp offset for slice") 328 446 ("MaxDeltaQP,d", m_iMaxDeltaQP, 0, "max dQp offset for block") … … 338 456 ("AdaptiveQP,-aq", m_bUseAdaptiveQP, false, "QP adaptation based on a psycho-visual model") 339 457 ("MaxQPAdaptationRange,-aqr", m_iQPAdaptationRange, 6, "QP adaptation range") 458 #if !SVC_EXTENSION 340 459 ("dQPFile,m", cfg_dQPFile, string(""), "dQP file name") 460 #endif 341 461 ("RDOQ", m_useRDOQ, true ) 342 462 ("RDOQTS", m_useRDOQTS, true ) … … 526 646 */ 527 647 /* convert std::string to c string for compatability */ 648 #if SVC_EXTENSION 649 m_pBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str()); 650 #if AVC_SYNTAX 651 m_BLSyntaxFile = cfg_BLSyntaxFile.empty() ? NULL : strdup(cfg_BLSyntaxFile.c_str()); 652 #endif 653 #else 528 654 m_pchInputFile = cfg_InputFile.empty() ? NULL : strdup(cfg_InputFile.c_str()); 529 m_p chBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str());655 m_phBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str()); 530 656 m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str()); 531 657 m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str()); 532 658 #endif 659 533 660 Char* pColumnWidth = cfg_ColumnWidth.empty() ? NULL: strdup(cfg_ColumnWidth.c_str()); 534 661 Char* pRowHeight = cfg_RowHeight.empty() ? NULL : strdup(cfg_RowHeight.c_str()); … … 605 732 if (!m_outputBitDepthC) { m_outputBitDepthC = m_internalBitDepthC; } 606 733 734 #if !SVC_EXTENSION 607 735 // TODO:ChromaFmt assumes 4:2:0 below 608 736 switch (m_conformanceMode) … … 702 830 } 703 831 m_iWaveFrontSubstreams = m_iWaveFrontSynchro ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1; 704 832 #endif 705 833 // check validity of input parameters 706 834 xCheckParameter(); … … 800 928 xConfirmPara( m_inputBitDepthY < 8, "InputBitDepth must be at least 8" ); 801 929 xConfirmPara( m_inputBitDepthC < 8, "InputBitDepthC must be at least 8" ); 930 #if !SVC_EXTENSION 802 931 xConfirmPara( m_iFrameRate <= 0, "Frame rate must be more than 1" ); 932 #endif 803 933 xConfirmPara( m_framesToBeEncoded <= 0, "Total Number Of Frames encoded must be more than 0" ); 804 934 xConfirmPara( m_iGOPSize < 1 , "GOP Size must be greater or equal to 1" ); 805 935 xConfirmPara( m_iGOPSize > 1 && m_iGOPSize % 2, "GOP Size must be a multiple of 2, if GOP Size is greater than 1" ); 936 #if !SVC_EXTENSION 806 937 xConfirmPara( (m_iIntraPeriod > 0 && m_iIntraPeriod < m_iGOPSize) || m_iIntraPeriod == 0, "Intra period must be more than GOP size, or -1 , not 0" ); 938 #endif 807 939 xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 2, "Decoding Refresh Type must be equal to 0, 1 or 2" ); 940 #if !SVC_EXTENSION 808 941 xConfirmPara( m_iQP < -6 * (m_internalBitDepthY - 8) || m_iQP > 51, "QP exceeds supported range (-QpBDOffsety to 51)" ); 942 #endif 809 943 xConfirmPara( m_loopFilterBetaOffsetDiv2 < -13 || m_loopFilterBetaOffsetDiv2 > 13, "Loop Filter Beta Offset div. 2 exceeds supported range (-13 to 13)"); 810 944 xConfirmPara( m_loopFilterTcOffsetDiv2 < -13 || m_loopFilterTcOffsetDiv2 > 13, "Loop Filter Tc Offset div. 2 exceeds supported range (-13 to 13)"); … … 821 955 822 956 xConfirmPara( m_iQPAdaptationRange <= 0, "QP Adaptation Range must be more than 0" ); 957 #if !SVC_EXTENSION 823 958 if (m_iDecodingRefreshType == 2) 824 959 { 825 960 xConfirmPara( m_iIntraPeriod > 0 && m_iIntraPeriod <= m_iGOPSize , "Intra period must be larger than GOP size for periodic IDR pictures"); 826 961 } 962 #endif 827 963 xConfirmPara( (m_uiMaxCUWidth >> m_uiMaxCUDepth) < 4, "Minimum partition width size should be larger than or equal to 8"); 828 964 xConfirmPara( (m_uiMaxCUHeight >> m_uiMaxCUDepth) < 4, "Minimum partition height size should be larger than or equal to 8"); 829 965 xConfirmPara( m_uiMaxCUWidth < 16, "Maximum partition width size should be larger than or equal to 16"); 830 966 xConfirmPara( m_uiMaxCUHeight < 16, "Maximum partition height size should be larger than or equal to 16"); 967 #if !SVC_EXTENSION 831 968 xConfirmPara( (m_iSourceWidth % (m_uiMaxCUWidth >> (m_uiMaxCUDepth-1)))!=0, "Resulting coded frame width must be a multiple of the minimum CU size"); 832 969 xConfirmPara( (m_iSourceHeight % (m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)))!=0, "Resulting coded frame height must be a multiple of the minimum CU size"); 970 #endif 833 971 834 972 xConfirmPara( m_uiQuadtreeTULog2MinSize < 2, "QuadtreeTULog2MinSize must be 2 or greater."); … … 849 987 xConfirmPara( m_maxNumMergeCand > 5, "MaxNumMergeCand must be 5 or smaller."); 850 988 989 #if !SVC_EXTENSION 851 990 #if ADAPTIVE_QP_SELECTION 852 991 xConfirmPara( m_bUseAdaptQpSelect == true && m_iQP < 0, "AdaptiveQpSelection must be disabled when QP < 0."); 853 992 xConfirmPara( m_bUseAdaptQpSelect == true && (m_cbQpOffset !=0 || m_crQpOffset != 0 ), "AdaptiveQpSelection must be disabled when ChromaQpOffset is not equal to 0."); 993 #endif 854 994 #endif 855 995 … … 877 1017 878 1018 //TODO:ChromaFmt assumes 4:2:0 below 1019 #if !SVC_EXTENSION 879 1020 xConfirmPara( m_iSourceWidth % TComSPS::getWinUnitX(CHROMA_420) != 0, "Picture width must be an integer multiple of the specified chroma subsampling"); 880 1021 xConfirmPara( m_iSourceHeight % TComSPS::getWinUnitY(CHROMA_420) != 0, "Picture height must be an integer multiple of the specified chroma subsampling"); … … 887 1028 xConfirmPara( m_confTop % TComSPS::getWinUnitY(CHROMA_420) != 0, "Top conformance window offset must be an integer multiple of the specified chroma subsampling"); 888 1029 xConfirmPara( m_confBottom % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling"); 889 1030 #endif 1031 1032 #if REF_IDX_ME_AROUND_ZEROMV || REF_IDX_ME_ZEROMV 1033 xConfirmPara( REF_IDX_ME_AROUND_ZEROMV && REF_IDX_ME_ZEROMV, "REF_IDX_ME_AROUND_ZEROMV and REF_IDX_ME_ZEROMV cannot be enabled simultaneously"); 1034 #endif 890 1035 // max CU width and height should be power of 2 891 1036 UInt ui = m_uiMaxCUWidth; … … 904 1049 } 905 1050 1051 906 1052 /* if this is an intra-only sequence, ie IntraPeriod=1, don't verify the GOP structure 907 1053 * This permits the ability to omit a GOP structure specification */ 1054 #if SVC_EXTENSION 1055 for(UInt layer = 0; layer < MAX_LAYERS; layer++) 1056 { 1057 Int m_iIntraPeriod = m_acLayerCfg[layer].m_iIntraPeriod; 1058 #endif 908 1059 if (m_iIntraPeriod == 1 && m_GOPList[0].m_POC == -1) { 909 1060 m_GOPList[0] = GOPEntry(); … … 914 1065 m_GOPList[0].m_numRefPicsActive = 4; 915 1066 } 1067 #if SVC_EXTENSION 1068 } 1069 #endif 916 1070 917 1071 Bool verifiedGOP=false; … … 927 1081 } 928 1082 Int numOK=0; 1083 #if !SVC_EXTENSION 929 1084 xConfirmPara( m_iIntraPeriod >=0&&(m_iIntraPeriod%m_iGOPSize!=0), "Intra period must be a multiple of GOPSize, or -1" ); 1085 #endif 930 1086 931 1087 for(Int i=0; i<m_iGOPSize; i++) … … 936 1092 } 937 1093 } 938 1094 1095 #if SVC_EXTENSION 1096 // verify layer configuration parameters 1097 for(UInt layer=0; layer<m_numLayers; layer++) 1098 { 1099 if(m_acLayerCfg[layer].xCheckParameter()) 1100 { 1101 printf("\nError: invalid configuration parameter found in layer %d \n", layer); 1102 check_failed = true; 1103 } 1104 } 1105 #endif 1106 1107 #if SVC_EXTENSION 1108 // verify layer configuration parameters 1109 for(UInt layer=0; layer<m_numLayers; layer++) 1110 { 1111 Int m_iIntraPeriod = m_acLayerCfg[layer].m_iIntraPeriod; 1112 #endif 939 1113 if ( (m_iIntraPeriod != 1) && !m_loopFilterOffsetInPPS && m_DeblockingFilterControlPresent && (!m_bLoopFilterDisable) ) 940 1114 { … … 945 1119 } 946 1120 } 1121 #if SVC_EXTENSION 1122 } 1123 #endif 1124 947 1125 m_extraRPSs=0; 948 1126 //start looping through frames in coding order until we can verify that the GOP structure is correct. … … 1206 1384 } 1207 1385 1386 #if SVC_EXTENSION // ToDo: it should be checked for the case when parameters are different for the layers 1387 for(UInt layer = 0; layer < MAX_LAYERS; layer++) 1388 { 1389 Int m_iSourceWidth = m_acLayerCfg[layer].m_iSourceWidth; 1390 Int m_iSourceHeight = m_acLayerCfg[layer].m_iSourceHeight; 1391 #endif 1208 1392 if(m_vuiParametersPresentFlag && m_bitstreamRestrictionFlag) 1209 1393 { … … 1279 1463 } 1280 1464 } 1465 #if SVC_EXTENSION 1466 } 1467 #endif 1468 1281 1469 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. 1282 1470 xConfirmPara( m_iWaveFrontSynchro < 0, "WaveFrontSynchro cannot be negative" ); 1471 #if !SVC_EXTENSION 1283 1472 xConfirmPara( m_iWaveFrontSubstreams <= 0, "WaveFrontSubstreams must be positive" ); 1284 1473 xConfirmPara( m_iWaveFrontSubstreams > 1 && !m_iWaveFrontSynchro, "Must have WaveFrontSynchro > 0 in order to have WaveFrontSubstreams > 1" ); 1474 #endif 1285 1475 1286 1476 xConfirmPara( m_decodedPictureHashSEIEnabled<0 || m_decodedPictureHashSEIEnabled>3, "this hash type is not correct!\n"); … … 1357 1547 { 1358 1548 printf("\n"); 1549 #if SVC_EXTENSION 1550 printf("Total number of layers : %d\n", m_numLayers ); 1551 for(UInt layer=0; layer<m_numLayers; layer++) 1552 { 1553 printf("=== Layer %d settings === \n", layer); 1554 m_acLayerCfg[layer].xPrintParameter(); 1555 printf("\n"); 1556 } 1557 printf("=== Common configuration settings === \n"); 1558 printf("Bitstream File : %s\n", m_pBitstreamFile ); 1559 #else 1359 1560 printf("Input File : %s\n", m_pchInputFile ); 1360 1561 printf("Bitstream File : %s\n", m_pchBitstreamFile ); … … 1362 1563 printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_confLeft - m_confRight, m_iSourceHeight - m_confTop - m_confBottom, m_iFrameRate ); 1363 1564 printf("Internal Format : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate ); 1565 #endif 1364 1566 printf("Frame index : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded ); 1365 1567 printf("CU size / depth : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth ); … … 1369 1571 printf("Min PCM size : %d\n", 1 << m_uiPCMLog2MinSize); 1370 1572 printf("Motion search range : %d\n", m_iSearchRange ); 1573 #if !SVC_EXTENSION 1371 1574 printf("Intra period : %d\n", m_iIntraPeriod ); 1575 #endif 1372 1576 printf("Decoding refresh type : %d\n", m_iDecodingRefreshType ); 1577 #if !SVC_EXTENSION 1373 1578 printf("QP : %5.2f\n", m_fQP ); 1579 #endif 1374 1580 printf("Max dQP signaling depth : %d\n", m_iMaxCuDQPDepth); 1375 1581 … … 1442 1648 printf("WPB:%d ", (Int)m_useWeightedBiPred); 1443 1649 printf("PME:%d ", m_log2ParallelMergeLevel); 1650 #if !SVC_EXTENSION 1444 1651 printf(" WaveFrontSynchro:%d WaveFrontSubstreams:%d", 1445 1652 m_iWaveFrontSynchro, m_iWaveFrontSubstreams); 1653 #endif 1446 1654 printf(" ScalingList:%d ", m_useScalingListId ); 1447 1655 printf("TMVPMode:%d ", m_TMVPModeId ); … … 1451 1659 1452 1660 printf(" SignBitHidingFlag:%d ", m_signHideFlag); 1661 #if SVC_EXTENSION 1662 printf("RecalQP:%d ", m_recalculateQPAccordingToLambda ? 1 : 0 ); 1663 printf("AVC_BASE:%d ", AVC_BASE); 1664 #if REF_IDX_FRAMEWORK 1665 printf("REF_IDX_FRAMEWORK:%d ", REF_IDX_FRAMEWORK); 1666 printf("EL_RAP_SliceType: %d ", m_elRapSliceBEnabled); 1667 printf("REF_IDX_ME_AROUND_ZEROMV:%d ", REF_IDX_ME_AROUND_ZEROMV); 1668 printf("REF_IDX_ME_ZEROMV: %d", REF_IDX_ME_ZEROMV); 1669 #elif INTRA_BL 1670 printf("INTRA_BL:%d ", INTRA_BL); 1671 #if !AVC_BASE 1672 printf("SVC_MVP:%d ", SVC_MVP ); 1673 printf("SVC_BL_CAND_INTRA:%d", SVC_BL_CAND_INTRA ); 1674 #endif 1675 #endif 1676 #else 1453 1677 printf("RecalQP:%d", m_recalculateQPAccordingToLambda ? 1 : 0 ); 1678 #endif 1454 1679 printf("\n\n"); 1455 1680 -
branches/HM-10.0-dev-SHM/source/App/TAppEncoder/TAppEncCfg.h
r51 r54 42 42 43 43 #include "TLibEncoder/TEncCfg.h" 44 #if SVC_EXTENSION 45 #include "TAppEncLayerCfg.h" 46 #endif 44 47 #include <sstream> 45 48 //! \ingroup TAppEncoder … … 55 58 protected: 56 59 // file I/O 60 #if SVC_EXTENSION 61 TAppEncLayerCfg m_acLayerCfg [MAX_LAYERS]; 62 Int m_numLayers; ///< number of layers 63 64 Char* m_pBitstreamFile; ///< output bitstream file 65 Double m_adLambdaModifier[ MAX_TLAYER ]; ///< Lambda modifier array for each temporal layer 66 // source specification 67 UInt m_FrameSkip; ///< number of skipped frames from the beginning 68 Int m_framesToBeEncoded; ///< number of encoded frames 69 #if AVC_SYNTAX 70 char* m_BLSyntaxFile; ///< input syntax file 71 #endif 72 #else 57 73 Char* m_pchInputFile; ///< source file name 58 74 Char* m_pchBitstreamFile; ///< output bitstream file … … 71 87 Int m_framesToBeEncoded; ///< number of encoded frames 72 88 Int m_aiPad[2]; ///< number of padded pixels for width and height 73 89 #endif 90 74 91 // profile/level 75 92 Profile::Name m_profile; … … 84 101 85 102 // coding structure 103 #if !SVC_EXTENSION 86 104 Int m_iIntraPeriod; ///< period of I-slice (random access period) 105 #endif 87 106 Int m_iDecodingRefreshType; ///< random access type 88 107 Int m_iGOPSize; ///< GOP size of hierarchical structure … … 96 115 Bool m_enableAMP; 97 116 // coding quality 117 #if !SVC_EXTENSION 98 118 Double m_fQP; ///< QP value of key-picture (floating point) 99 119 Int m_iQP; ///< QP value of key-picture (integer) 100 120 Char* m_pchdQPFile; ///< QP offset for each slice (initialized from external file) 101 121 Int* m_aidQP; ///< array of slice QP values 122 #endif 102 123 Int m_iMaxDeltaQP; ///< max. |delta QP| 103 124 UInt m_uiDeltaQpRD; ///< dQP range for multi-pass slice QP optimization … … 192 213 UInt* m_pRowHeight; 193 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 #if !SVC_EXTENSION 194 216 Int m_iWaveFrontSubstreams; //< If iWaveFrontSynchro, this is the number of substreams per frame (dependent tiles) or per tile (independent tiles). 217 #endif 195 218 196 219 Bool m_bUseConstrainedIntraPred; ///< flag for using constrained intra prediction … … 276 299 Int m_log2MaxMvLengthVertical; ///< Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units 277 300 301 #if REF_IDX_FRAMEWORK 302 Int m_elRapSliceBEnabled; 303 #endif 278 304 // internal member functions 279 305 Void xSetGlobal (); ///< set global variables … … 300 326 Bool parseCfg ( Int argc, Char* argv[] ); ///< parse configuration file to fill member variables 301 327 328 #if SVC_EXTENSION 329 Int getNumFrameToBeEncoded() {return m_framesToBeEncoded; } 330 Int getNumLayer() {return m_numLayers; } 331 Int getGOPSize() {return m_iGOPSize; } 332 UInt getInternalBitDepthY() {return m_internalBitDepthY; } 333 UInt getInternalBitDepthC() {return m_internalBitDepthC; } 334 UInt getMaxCUWidth() {return m_uiMaxCUWidth; } 335 UInt getMaxCUHeight() {return m_uiMaxCUHeight; } 336 UInt getMaxCUDepth() {return m_uiMaxCUDepth; } 337 Int getDecodingRefreshType() {return m_iDecodingRefreshType; } 338 Int getWaveFrontSynchro() { return m_iWaveFrontSynchro; } 339 Void getDirFilename(string& filename, string& dir, const string path); 340 #if AVC_SYNTAX 341 Char* getBLSyntaxFile() { return m_BLSyntaxFile; } 342 #endif 343 #endif 302 344 };// END CLASS DEFINITION TAppEncCfg 303 345 -
branches/HM-10.0-dev-SHM/source/App/TAppEncoder/TAppEncTop.cpp
r51 r54 1 1 /* The copyright in this software is being made available under the BSD 2 3 4 5 6 7 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 … … 60 60 m_totalBytes = 0; 61 61 m_essentialBytes = 0; 62 #if SVC_EXTENSION 63 for(UInt layer=0; layer < MAX_LAYERS; layer++) 64 { 65 m_apcTEncTop[layer] = &m_acTEncTop[layer]; 66 } 67 #endif 62 68 } 63 69 … … 66 72 } 67 73 74 #if SVC_EXTENSION 68 75 Void TAppEncTop::xInitLibCfg() 69 76 { 77 for(UInt layer=0; layer<m_numLayers; layer++) 78 { 79 TComVPS vps; 80 81 vps.setMaxTLayers ( m_maxTempLayer ); 82 if (m_maxTempLayer == 1) 83 { 84 vps.setTemporalNestingFlag(true); 85 } 86 vps.setMaxLayers ( 1 ); 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 m_acTEncTop[layer].setVPS(&vps); 93 m_acTEncTop[layer].setFrameRate ( m_acLayerCfg[layer].getFrameRate() ); 94 m_acTEncTop[layer].setFrameSkip ( m_FrameSkip ); 95 m_acTEncTop[layer].setSourceWidth ( m_acLayerCfg[layer].getSourceWidth() ); 96 m_acTEncTop[layer].setSourceHeight ( m_acLayerCfg[layer].getSourceHeight() ); 97 m_acTEncTop[layer].setConformanceMode ( m_acLayerCfg[layer].getConformanceMode() ); 98 m_acTEncTop[layer].setConformanceWindow ( m_acLayerCfg[layer].m_confLeft, m_acLayerCfg[layer].m_confRight, m_acLayerCfg[layer].m_confTop, m_acLayerCfg[layer].m_confBottom ); 99 m_acTEncTop[layer].setFramesToBeEncoded ( m_framesToBeEncoded ); 100 101 m_acTEncTop[layer].setProfile(m_profile); 102 m_acTEncTop[layer].setLevel(m_levelTier, m_level); 103 #if L0046_CONSTRAINT_FLAGS 104 m_acTEncTop[layer].setProgressiveSourceFlag(m_progressiveSourceFlag); 105 m_acTEncTop[layer].setInterlacedSourceFlag(m_interlacedSourceFlag); 106 m_acTEncTop[layer].setNonPackedConstraintFlag(m_nonPackedConstraintFlag); 107 m_acTEncTop[layer].setFrameOnlyConstraintFlag(m_frameOnlyConstraintFlag); 108 #endif 109 110 #if REF_IDX_MFM 111 if(layer == 0) 112 { 113 m_acTEncTop[layer].setMFMEnabledFlag(false); 114 } 115 else 116 { 117 m_acTEncTop[layer].setMFMEnabledFlag(true); 118 } 119 #endif 120 // set layer ID 121 m_acTEncTop[layer].setLayerId ( layer ); 122 m_acTEncTop[layer].setNumLayer ( m_numLayers ); 123 m_acTEncTop[layer].setLayerEnc(m_apcTEncTop); 124 125 //====== Coding Structure ======== 126 m_acTEncTop[layer].setIntraPeriod ( m_acLayerCfg[layer].m_iIntraPeriod ); 127 m_acTEncTop[layer].setDecodingRefreshType ( m_iDecodingRefreshType ); 128 m_acTEncTop[layer].setGOPSize ( m_iGOPSize ); 129 m_acTEncTop[layer].setGopList ( m_GOPList ); 130 m_acTEncTop[layer].setExtraRPSs ( m_extraRPSs ); 131 for(Int i = 0; i < MAX_TLAYER; i++) 132 { 133 m_acTEncTop[layer].setNumReorderPics ( m_numReorderPics[i], i ); 134 m_acTEncTop[layer].setMaxDecPicBuffering ( m_maxDecPicBuffering[i], i ); 135 } 136 for( UInt uiLoop = 0; uiLoop < MAX_TLAYER; ++uiLoop ) 137 { 138 m_acTEncTop[layer].setLambdaModifier( uiLoop, m_adLambdaModifier[ uiLoop ] ); 139 } 140 m_acTEncTop[layer].setQP ( m_acLayerCfg[layer].getIntQP() ); 141 142 m_acTEncTop[layer].setPad ( m_acLayerCfg[layer].getPad() ); 143 144 m_acTEncTop[layer].setMaxTempLayer ( m_maxTempLayer ); 145 m_acTEncTop[layer].setUseAMP( m_enableAMP ); 146 147 //===== Slice ======== 148 149 //====== Loop/Deblock Filter ======== 150 m_acTEncTop[layer].setLoopFilterDisable ( m_bLoopFilterDisable ); 151 m_acTEncTop[layer].setLoopFilterOffsetInPPS ( m_loopFilterOffsetInPPS ); 152 m_acTEncTop[layer].setLoopFilterBetaOffset ( m_loopFilterBetaOffsetDiv2 ); 153 m_acTEncTop[layer].setLoopFilterTcOffset ( m_loopFilterTcOffsetDiv2 ); 154 m_acTEncTop[layer].setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent); 155 156 //====== Motion search ======== 157 m_acTEncTop[layer].setFastSearch ( m_iFastSearch ); 158 m_acTEncTop[layer].setSearchRange ( m_iSearchRange ); 159 m_acTEncTop[layer].setBipredSearchRange ( m_bipredSearchRange ); 160 161 //====== Quality control ======== 162 m_acTEncTop[layer].setMaxDeltaQP ( m_iMaxDeltaQP ); 163 m_acTEncTop[layer].setMaxCuDQPDepth ( m_iMaxCuDQPDepth ); 164 165 m_acTEncTop[layer].setChromaCbQpOffset ( m_cbQpOffset ); 166 m_acTEncTop[layer].setChromaCrQpOffset ( m_crQpOffset ); 167 168 #if ADAPTIVE_QP_SELECTION 169 m_acTEncTop[layer].setUseAdaptQpSelect ( m_bUseAdaptQpSelect ); 170 #endif 171 172 Int lowestQP; 173 lowestQP = - 6*(g_bitDepthY - 8); // XXX: check 174 175 if ((m_iMaxDeltaQP == 0 ) && (m_acLayerCfg[layer].getIntQP() == lowestQP) && (m_useLossless == true)) 176 { 177 m_bUseAdaptiveQP = false; 178 } 179 m_acTEncTop[layer].setUseAdaptiveQP ( m_bUseAdaptiveQP ); 180 m_acTEncTop[layer].setQPAdaptationRange ( m_iQPAdaptationRange ); 181 182 //====== Tool list ======== 183 m_acTEncTop[layer].setUseSBACRD ( m_bUseSBACRD ); 184 m_acTEncTop[layer].setDeltaQpRD ( m_uiDeltaQpRD ); 185 m_acTEncTop[layer].setUseASR ( m_bUseASR ); 186 m_acTEncTop[layer].setUseHADME ( m_bUseHADME ); 187 m_acTEncTop[layer].setUseLossless ( m_useLossless ); 188 m_acTEncTop[layer].setUseLComb ( m_bUseLComb ); 189 m_acTEncTop[layer].setdQPs ( m_acLayerCfg[layer].getdQPs() ); 190 m_acTEncTop[layer].setUseRDOQ ( m_useRDOQ ); 191 m_acTEncTop[layer].setUseRDOQTS ( m_useRDOQTS ); 192 #if L0232_RD_PENALTY 193 m_acTEncTop[layer].setRDpenalty ( m_rdPenalty ); 194 #endif 195 m_acTEncTop[layer].setQuadtreeTULog2MaxSize ( m_uiQuadtreeTULog2MaxSize ); 196 m_acTEncTop[layer].setQuadtreeTULog2MinSize ( m_uiQuadtreeTULog2MinSize ); 197 m_acTEncTop[layer].setQuadtreeTUMaxDepthInter ( m_uiQuadtreeTUMaxDepthInter ); 198 m_acTEncTop[layer].setQuadtreeTUMaxDepthIntra ( m_uiQuadtreeTUMaxDepthIntra ); 199 m_acTEncTop[layer].setUseFastEnc ( m_bUseFastEnc ); 200 m_acTEncTop[layer].setUseEarlyCU ( m_bUseEarlyCU ); 201 m_acTEncTop[layer].setUseFastDecisionForMerge ( m_useFastDecisionForMerge ); 202 m_acTEncTop[layer].setUseCbfFastMode ( m_bUseCbfFastMode ); 203 m_acTEncTop[layer].setUseEarlySkipDetection ( m_useEarlySkipDetection ); 204 205 m_acTEncTop[layer].setUseTransformSkip ( m_useTransformSkip ); 206 m_acTEncTop[layer].setUseTransformSkipFast ( m_useTransformSkipFast ); 207 m_acTEncTop[layer].setUseConstrainedIntraPred ( m_bUseConstrainedIntraPred ); 208 m_acTEncTop[layer].setPCMLog2MinSize ( m_uiPCMLog2MinSize); 209 m_acTEncTop[layer].setUsePCM ( m_usePCM ); 210 m_acTEncTop[layer].setPCMLog2MaxSize ( m_pcmLog2MaxSize); 211 m_acTEncTop[layer].setMaxNumMergeCand ( m_maxNumMergeCand ); 212 213 214 //====== Weighted Prediction ======== 215 m_acTEncTop[layer].setUseWP ( m_useWeightedPred ); 216 m_acTEncTop[layer].setWPBiPred ( m_useWeightedBiPred ); 217 //====== Parallel Merge Estimation ======== 218 m_acTEncTop[layer].setLog2ParallelMergeLevelMinus2 ( m_log2ParallelMergeLevel - 2 ); 219 220 //====== Slice ======== 221 m_acTEncTop[layer].setSliceMode ( m_sliceMode ); 222 m_acTEncTop[layer].setSliceArgument ( m_sliceArgument ); 223 224 //====== Dependent Slice ======== 225 m_acTEncTop[layer].setSliceSegmentMode ( m_sliceSegmentMode ); 226 m_acTEncTop[layer].setSliceSegmentArgument ( m_sliceSegmentArgument ); 227 Int iNumPartInCU = 1<<(m_uiMaxCUDepth<<1); 228 if(m_sliceSegmentMode==FIXED_NUMBER_OF_LCU) 229 { 230 m_acTEncTop[layer].setSliceSegmentArgument ( m_sliceSegmentArgument * iNumPartInCU ); 231 } 232 if(m_sliceMode==FIXED_NUMBER_OF_LCU) 233 { 234 m_acTEncTop[layer].setSliceArgument ( m_sliceArgument * iNumPartInCU ); 235 } 236 if(m_sliceMode==FIXED_NUMBER_OF_TILES) 237 { 238 m_acTEncTop[layer].setSliceArgument ( m_sliceArgument ); 239 } 240 241 if(m_sliceMode == 0 ) 242 { 243 m_bLFCrossSliceBoundaryFlag = true; 244 } 245 m_acTEncTop[layer].setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag ); 246 m_acTEncTop[layer].setUseSAO ( m_bUseSAO ); 247 m_acTEncTop[layer].setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic); 248 249 m_acTEncTop[layer].setSaoLcuBoundary (m_saoLcuBoundary); 250 m_acTEncTop[layer].setSaoLcuBasedOptimization (m_saoLcuBasedOptimization); 251 m_acTEncTop[layer].setPCMInputBitDepthFlag ( m_bPCMInputBitDepthFlag); 252 m_acTEncTop[layer].setPCMFilterDisableFlag ( m_bPCMFilterDisableFlag); 253 254 m_acTEncTop[layer].setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled); 255 m_acTEncTop[layer].setRecoveryPointSEIEnabled( m_recoveryPointSEIEnabled ); 256 m_acTEncTop[layer].setBufferingPeriodSEIEnabled( m_bufferingPeriodSEIEnabled ); 257 m_acTEncTop[layer].setPictureTimingSEIEnabled( m_pictureTimingSEIEnabled ); 258 m_acTEncTop[layer].setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled ); 259 m_acTEncTop[layer].setFramePackingArrangementSEIType( m_framePackingSEIType ); 260 m_acTEncTop[layer].setFramePackingArrangementSEIId( m_framePackingSEIId ); 261 m_acTEncTop[layer].setFramePackingArrangementSEIQuincunx( m_framePackingSEIQuincunx ); 262 m_acTEncTop[layer].setFramePackingArrangementSEIInterpretation( m_framePackingSEIInterpretation ); 263 m_acTEncTop[layer].setDisplayOrientationSEIAngle( m_displayOrientationSEIAngle ); 264 m_acTEncTop[layer].setTemporalLevel0IndexSEIEnabled( m_temporalLevel0IndexSEIEnabled ); 265 m_acTEncTop[layer].setGradualDecodingRefreshInfoEnabled( m_gradualDecodingRefreshInfoEnabled ); 266 m_acTEncTop[layer].setDecodingUnitInfoSEIEnabled( m_decodingUnitInfoSEIEnabled ); 267 m_acTEncTop[layer].setUniformSpacingIdr ( m_iUniformSpacingIdr ); 268 m_acTEncTop[layer].setNumColumnsMinus1 ( m_iNumColumnsMinus1 ); 269 m_acTEncTop[layer].setNumRowsMinus1 ( m_iNumRowsMinus1 ); 270 if(m_iUniformSpacingIdr==0) 271 { 272 m_acTEncTop[layer].setColumnWidth ( m_pColumnWidth ); 273 m_acTEncTop[layer].setRowHeight ( m_pRowHeight ); 274 } 275 m_acTEncTop[layer].xCheckGSParameters(); 276 Int uiTilesCount = (m_iNumRowsMinus1+1) * (m_iNumColumnsMinus1+1); 277 if(uiTilesCount == 1) 278 { 279 m_bLFCrossTileBoundaryFlag = true; 280 } 281 m_acTEncTop[layer].setLFCrossTileBoundaryFlag( m_bLFCrossTileBoundaryFlag ); 282 m_acTEncTop[layer].setWaveFrontSynchro ( m_iWaveFrontSynchro ); 283 m_acTEncTop[layer].setWaveFrontSubstreams ( m_acLayerCfg[layer].m_iWaveFrontSubstreams ); 284 m_acTEncTop[layer].setTMVPModeId ( m_TMVPModeId ); 285 m_acTEncTop[layer].setUseScalingListId ( m_useScalingListId ); 286 m_acTEncTop[layer].setScalingListFile ( m_scalingListFile ); 287 m_acTEncTop[layer].setSignHideFlag(m_signHideFlag); 288 #if RATE_CONTROL_LAMBDA_DOMAIN 289 m_acTEncTop[layer].setUseRateCtrl ( m_RCEnableRateControl ); 290 m_acTEncTop[layer].setTargetBitrate ( m_RCTargetBitrate ); 291 m_acTEncTop[layer].setKeepHierBit ( m_RCKeepHierarchicalBit ); 292 m_acTEncTop[layer].setLCULevelRC ( m_RCLCULevelRC ); 293 m_acTEncTop[layer].setUseLCUSeparateModel ( m_RCUseLCUSeparateModel ); 294 m_acTEncTop[layer].setInitialQP ( m_RCInitialQP ); 295 m_acTEncTop[layer].setForceIntraQP ( m_RCForceIntraQP ); 296 #else 297 m_acTEncTop[layer].setUseRateCtrl ( m_enableRateCtrl); 298 m_acTEncTop[layer].setTargetBitrate ( m_targetBitrate); 299 m_acTEncTop[layer].setNumLCUInUnit ( m_numLCUInUnit); 300 #endif 301 m_acTEncTop[layer].setTransquantBypassEnableFlag(m_TransquantBypassEnableFlag); 302 m_acTEncTop[layer].setCUTransquantBypassFlagValue(m_CUTransquantBypassFlagValue); 303 m_acTEncTop[layer].setUseRecalculateQPAccordingToLambda( m_recalculateQPAccordingToLambda ); 304 m_acTEncTop[layer].setUseStrongIntraSmoothing( m_useStrongIntraSmoothing ); 305 m_acTEncTop[layer].setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled ); 306 m_acTEncTop[layer].setVuiParametersPresentFlag( m_vuiParametersPresentFlag ); 307 m_acTEncTop[layer].setAspectRatioIdc( m_aspectRatioIdc ); 308 m_acTEncTop[layer].setSarWidth( m_sarWidth ); 309 m_acTEncTop[layer].setSarHeight( m_sarHeight ); 310 m_acTEncTop[layer].setOverscanInfoPresentFlag( m_overscanInfoPresentFlag ); 311 m_acTEncTop[layer].setOverscanAppropriateFlag( m_overscanAppropriateFlag ); 312 m_acTEncTop[layer].setVideoSignalTypePresentFlag( m_videoSignalTypePresentFlag ); 313 m_acTEncTop[layer].setVideoFormat( m_videoFormat ); 314 m_acTEncTop[layer].setVideoFullRangeFlag( m_videoFullRangeFlag ); 315 m_acTEncTop[layer].setColourDescriptionPresentFlag( m_colourDescriptionPresentFlag ); 316 m_acTEncTop[layer].setColourPrimaries( m_colourPrimaries ); 317 m_acTEncTop[layer].setTransferCharacteristics( m_transferCharacteristics ); 318 m_acTEncTop[layer].setMatrixCoefficients( m_matrixCoefficients ); 319 m_acTEncTop[layer].setChromaLocInfoPresentFlag( m_chromaLocInfoPresentFlag ); 320 m_acTEncTop[layer].setChromaSampleLocTypeTopField( m_chromaSampleLocTypeTopField ); 321 m_acTEncTop[layer].setChromaSampleLocTypeBottomField( m_chromaSampleLocTypeBottomField ); 322 m_acTEncTop[layer].setNeutralChromaIndicationFlag( m_neutralChromaIndicationFlag ); 323 m_acTEncTop[layer].setDefaultDisplayWindow( m_defDispWinLeftOffset, m_defDispWinRightOffset, m_defDispWinTopOffset, m_defDispWinBottomOffset ); 324 m_acTEncTop[layer].setFrameFieldInfoPresentFlag( m_frameFieldInfoPresentFlag ); 325 m_acTEncTop[layer].setPocProportionalToTimingFlag( m_pocProportionalToTimingFlag ); 326 m_acTEncTop[layer].setNumTicksPocDiffOneMinus1 ( m_numTicksPocDiffOneMinus1 ); 327 m_acTEncTop[layer].setBitstreamRestrictionFlag( m_bitstreamRestrictionFlag ); 328 m_acTEncTop[layer].setTilesFixedStructureFlag( m_tilesFixedStructureFlag ); 329 m_acTEncTop[layer].setMotionVectorsOverPicBoundariesFlag( m_motionVectorsOverPicBoundariesFlag ); 330 m_acTEncTop[layer].setMinSpatialSegmentationIdc( m_minSpatialSegmentationIdc ); 331 m_acTEncTop[layer].setMaxBytesPerPicDenom( m_maxBytesPerPicDenom ); 332 m_acTEncTop[layer].setMaxBitsPerMinCuDenom( m_maxBitsPerMinCuDenom ); 333 m_acTEncTop[layer].setLog2MaxMvLengthHorizontal( m_log2MaxMvLengthHorizontal ); 334 m_acTEncTop[layer].setLog2MaxMvLengthVertical( m_log2MaxMvLengthVertical ); 335 #if SIGNAL_BITRATE_PICRATE_IN_VPS 336 TComBitRatePicRateInfo *bitRatePicRateInfo = m_cTEncTop[layer].getVPS()->getBitratePicrateInfo(); 337 // The number of bit rate/pic rate have to equal to number of sub-layers. 338 if(m_bitRatePicRateMaxTLayers) 339 { 340 assert(m_bitRatePicRateMaxTLayers == m_cTEncTop[layer].getVPS()->getMaxTLayers()); 341 } 342 for(Int i = 0; i < m_bitRatePicRateMaxTLayers; i++) 343 { 344 bitRatePicRateInfo->setBitRateInfoPresentFlag( i, m_bitRateInfoPresentFlag[i] ); 345 if( bitRatePicRateInfo->getBitRateInfoPresentFlag(i) ) 346 { 347 bitRatePicRateInfo->setAvgBitRate(i, m_avgBitRate[i]); 348 bitRatePicRateInfo->setMaxBitRate(i, m_maxBitRate[i]); 349 } 350 } 351 for(Int i = 0; i < m_bitRatePicRateMaxTLayers; i++) 352 { 353 bitRatePicRateInfo->setPicRateInfoPresentFlag( i, m_picRateInfoPresentFlag[i] ); 354 if( bitRatePicRateInfo->getPicRateInfoPresentFlag(i) ) 355 { 356 bitRatePicRateInfo->setAvgPicRate (i, m_avgPicRate[i]); 357 bitRatePicRateInfo->setConstantPicRateIdc(i, m_constantPicRateIdc[i]); 358 } 359 } 360 #endif 361 #if REF_IDX_FRAMEWORK 362 m_acTEncTop[layer].setElRapSliceTypeB(layer == 0? 0 : m_elRapSliceBEnabled); 363 #endif 364 } 365 } 366 #else 367 Void TAppEncTop::xInitLibCfg() 368 { 70 369 TComVPS vps; 71 370 72 371 vps.setMaxTLayers ( m_maxTempLayer ); 73 372 if (m_maxTempLayer == 1) … … 91 390 m_cTEncTop.setFrameOnlyConstraintFlag(m_frameOnlyConstraintFlag); 92 391 #endif 93 392 94 393 m_cTEncTop.setFrameRate ( m_iFrameRate ); 95 394 m_cTEncTop.setFrameSkip ( m_FrameSkip ); … … 98 397 m_cTEncTop.setConformanceWindow ( m_confLeft, m_confRight, m_confTop, m_confBottom ); 99 398 m_cTEncTop.setFramesToBeEncoded ( m_framesToBeEncoded ); 100 399 101 400 //====== Coding Structure ======== 102 401 m_cTEncTop.setIntraPeriod ( m_iIntraPeriod ); … … 115 414 } 116 415 m_cTEncTop.setQP ( m_iQP ); 117 416 118 417 m_cTEncTop.setPad ( m_aiPad ); 119 418 120 419 m_cTEncTop.setMaxTempLayer ( m_maxTempLayer ); 121 420 m_cTEncTop.setUseAMP( m_enableAMP ); 122 421 123 422 //===== Slice ======== 124 423 125 424 //====== Loop/Deblock Filter ======== 126 425 m_cTEncTop.setLoopFilterDisable ( m_bLoopFilterDisable ); … … 155 454 m_cTEncTop.setUseAdaptiveQP ( m_bUseAdaptiveQP ); 156 455 m_cTEncTop.setQPAdaptationRange ( m_iQPAdaptationRange ); 157 456 158 457 //====== Tool list ======== 159 458 m_cTEncTop.setUseSBACRD ( m_bUseSBACRD ); … … 186 485 m_cTEncTop.setPCMLog2MaxSize ( m_pcmLog2MaxSize); 187 486 m_cTEncTop.setMaxNumMergeCand ( m_maxNumMergeCand ); 188 487 189 488 190 489 //====== Weighted Prediction ======== … … 214 513 m_cTEncTop.setSliceArgument ( m_sliceArgument ); 215 514 } 216 515 217 516 if(m_sliceMode == 0 ) 218 517 { … … 336 635 #endif 337 636 } 637 #endif 338 638 339 639 Void TAppEncTop::xCreateLib() 340 640 { 341 641 // Video I/O 642 #if SVC_EXTENSION 643 // initialize global variables 644 initROM(); 645 646 for(UInt layer=0; layer<m_numLayers; layer++) 647 { 648 m_acTVideoIOYuvInputFile[layer].open( (Char *)m_acLayerCfg[layer].getInputFile().c_str(), false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC ); // read mode 649 m_acTVideoIOYuvInputFile[layer].skipFrames(m_FrameSkip, m_acLayerCfg[layer].getSourceWidth() - m_acLayerCfg[layer].getPad()[0], m_acLayerCfg[layer].getSourceHeight() - m_acLayerCfg[layer].getPad()[1]); 650 651 if (!m_acLayerCfg[layer].getReconFile().empty()) 652 { 653 m_acTVideoIOYuvReconFile[layer].open((Char *)m_acLayerCfg[layer].getReconFile().c_str(), true, m_outputBitDepthY, m_outputBitDepthC, m_internalBitDepthY, m_internalBitDepthC ); // write mode 654 } 655 656 m_acTEncTop[layer].create(); 657 } 658 #else 342 659 m_cTVideoIOYuvInputFile.open( m_pchInputFile, false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC ); // read mode 343 660 m_cTVideoIOYuvInputFile.skipFrames(m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1]); … … 345 662 if (m_pchReconFile) 346 663 m_cTVideoIOYuvReconFile.open(m_pchReconFile, true, m_outputBitDepthY, m_outputBitDepthC, m_internalBitDepthY, m_internalBitDepthC); // write mode 347 664 348 665 // Neo Decoder 349 666 m_cTEncTop.create(); 667 #endif 350 668 } 351 669 … … 353 671 { 354 672 // Video I/O 673 #if SVC_EXTENSION 674 // destroy ROM 675 destroyROM(); 676 677 for(UInt layer=0; layer<m_numLayers; layer++) 678 { 679 m_acTVideoIOYuvInputFile[layer].close(); 680 m_acTVideoIOYuvReconFile[layer].close(); 681 682 m_acTEncTop[layer].destroy(); 683 } 684 #else 355 685 m_cTVideoIOYuvInputFile.close(); 356 686 m_cTVideoIOYuvReconFile.close(); 357 687 358 688 // Neo Decoder 359 689 m_cTEncTop.destroy(); 690 #endif 360 691 } 361 692 362 693 Void TAppEncTop::xInitLib() 363 694 { 695 #if SVC_EXTENSION 696 for(UInt layer=0; layer<m_numLayers; layer++) 697 { 698 m_acTEncTop[layer].init(); 699 } 700 #else 364 701 m_cTEncTop.init(); 702 #endif 365 703 } 366 704 … … 370 708 371 709 /** 372 - create internal class 373 - initialize internal variable 374 - until the end of input YUV file, call encoding function in TEncTop class 375 - delete allocated buffers 376 - destroy internal class 377 . 378 */ 710 - create internal class 711 - initialize internal variable 712 - until the end of input YUV file, call encoding function in TEncTop class 713 - delete allocated buffers 714 - destroy internal class 715 . 716 */ 717 #if SVC_EXTENSION 379 718 Void TAppEncTop::encode() 380 719 { 381 fstream bitstreamFile(m_p chBitstreamFile, fstream::binary | fstream::out);720 fstream bitstreamFile(m_pBitstreamFile, fstream::binary | fstream::out); 382 721 if (!bitstreamFile) 383 722 { 384 fprintf(stderr, "\nfailed to open bitstream file `%s' for writing\n", m_p chBitstreamFile);723 fprintf(stderr, "\nfailed to open bitstream file `%s' for writing\n", m_pBitstreamFile); 385 724 exit(EXIT_FAILURE); 386 725 } 387 726 388 TComPicYuv* pcPicYuvOrg = new TComPicYuv;727 TComPicYuv* pcPicYuvOrg [MAX_LAYERS]; 389 728 TComPicYuv* pcPicYuvRec = NULL; 390 729 391 730 // initialize internal class & member variables 392 731 xInitLibCfg(); 393 732 xCreateLib(); 394 733 xInitLib(); 395 734 735 // main encoder loop 736 Int iNumEncoded = 0, iTotalNumEncoded = 0; 737 Bool bEos = false; 738 739 list<AccessUnit> outputAccessUnits; ///< list of access units to write out. is populated by the encoding process 740 741 for(UInt layer=0; layer<m_numLayers; layer++) 742 { 743 // allocate original YUV buffer 744 pcPicYuvOrg[layer] = new TComPicYuv; 745 #if SVC_UPSAMPLING 746 pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL ); 747 #else 748 pcPicYuvOrg->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 749 #endif 750 } 751 752 #if AVC_SYNTAX 753 if( !m_BLSyntaxFile ) 754 { 755 printf( "Wrong base layer syntax input file\n" ); 756 exit(EXIT_FAILURE); 757 } 758 fstream streamSyntaxFile( m_BLSyntaxFile, fstream::in | fstream::binary ); 759 if( !streamSyntaxFile.good() ) 760 { 761 printf( "Base layer syntax input reading error\n" ); 762 exit(EXIT_FAILURE); 763 } 764 m_acTEncTop[0].setBLSyntaxFile( &streamSyntaxFile ); 765 #endif 766 767 Bool bFirstFrame = true; 768 while ( !bEos ) 769 { 770 // Read enough frames 771 Bool bFramesReadyToCode = false; 772 while(!bFramesReadyToCode) 773 { 774 for(UInt layer=0; layer<m_numLayers; layer++) 775 { 776 // get buffers 777 xGetBuffer(pcPicYuvRec, layer); 778 779 // read input YUV file 780 m_acTVideoIOYuvInputFile[layer].read( pcPicYuvOrg[layer], m_acLayerCfg[layer].getPad() ); 781 782 if(layer == m_numLayers-1) 783 { 784 // increase number of received frames 785 m_iFrameRcvd++; 786 // check end of file 787 bEos = (m_iFrameRcvd == m_framesToBeEncoded); 788 } 789 790 m_acTEncTop[layer].encodePrep( pcPicYuvOrg[layer] ); 791 } 792 793 bFramesReadyToCode = !(!bFirstFrame && ( m_acTEncTop[m_numLayers-1].getNumPicRcvd() != m_iGOPSize && m_iGOPSize ) && !bEos ); 794 } 795 Bool flush = 0; 796 // if end of file (which is only detected on a read failure) flush the encoder of any queued pictures 797 if (m_acTVideoIOYuvInputFile[m_numLayers-1].isEof()) 798 { 799 flush = true; 800 bEos = true; 801 m_iFrameRcvd--; 802 m_acTEncTop[m_numLayers-1].setFramesToBeEncoded(m_iFrameRcvd); 803 } 804 805 // loop through frames in one GOP 806 for ( UInt iPicIdInGOP=0; iPicIdInGOP < (bFirstFrame? 1:m_iGOPSize); iPicIdInGOP++ ) 807 { 808 // layer by layer for each frame 809 for(UInt layer=0; layer<m_numLayers; layer++) 810 { 811 // call encoding function for one frame 812 m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP ); 813 } 814 } 815 816 iTotalNumEncoded = 0; 817 for(UInt layer=0; layer<m_numLayers; layer++) 818 { 819 // write bistream to file if necessary 820 iNumEncoded = m_acTEncTop[layer].getNumPicRcvd(); 821 if ( iNumEncoded > 0 ) 822 { 823 xWriteRecon(layer, iNumEncoded); 824 iTotalNumEncoded += iNumEncoded; 825 } 826 m_acTEncTop[layer].setNumPicRcvd( 0 ); 827 } 828 829 // write bitstream out 830 if(iTotalNumEncoded) 831 { 832 xWriteStream(bitstreamFile, iTotalNumEncoded, outputAccessUnits); 833 outputAccessUnits.clear(); 834 } 835 836 // print out summary 837 if (bEos) 838 { 839 printOutSummary(); 840 } 841 842 bFirstFrame = false; 843 } 844 // delete original YUV buffer 845 for(UInt layer=0; layer<m_numLayers; layer++) 846 { 847 pcPicYuvOrg[layer]->destroy(); 848 delete pcPicYuvOrg[layer]; 849 pcPicYuvOrg[layer] = NULL; 850 851 // delete used buffers in encoder class 852 m_acTEncTop[layer].deletePicBuffer(); 853 } 854 855 #if AVC_SYNTAX 856 if( streamSyntaxFile.is_open() ) 857 { 858 streamSyntaxFile.close(); 859 } 860 #endif 861 862 // delete buffers & classes 863 xDeleteBuffer(); 864 xDestroyLib(); 865 866 printRateSummary(); 867 868 return; 869 } 870 871 Void TAppEncTop::printOutSummary() 872 { 873 UInt layer; 874 875 // set frame rate 876 for(layer = 0; layer < m_numLayers; layer++) 877 { 878 m_gcAnalyzeAll[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate()); 879 m_gcAnalyzeI[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() ); 880 m_gcAnalyzeP[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() ); 881 m_gcAnalyzeB[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() ); 882 } 883 884 //-- all 885 printf( "\n\nSUMMARY --------------------------------------------------------\n" ); 886 printf( "\tTotal Frames | " "Bitrate " "Y-PSNR " "U-PSNR " "V-PSNR \n" ); 887 for(layer = 0; layer < m_numLayers; layer++) 888 { 889 m_gcAnalyzeAll[layer].printOut('a', layer); 890 } 891 892 printf( "\n\nI Slices--------------------------------------------------------\n" ); 893 printf( "\tTotal Frames | " "Bitrate " "Y-PSNR " "U-PSNR " "V-PSNR \n" ); 894 for(layer = 0; layer < m_numLayers; layer++) 895 { 896 m_gcAnalyzeI[layer].printOut('i', layer); 897 } 898 899 printf( "\n\nP Slices--------------------------------------------------------\n" ); 900 printf( "\tTotal Frames | " "Bitrate " "Y-PSNR " "U-PSNR " "V-PSNR \n" ); 901 for(layer = 0; layer < m_numLayers; layer++) 902 { 903 m_gcAnalyzeP[layer].printOut('p', layer); 904 } 905 906 printf( "\n\nB Slices--------------------------------------------------------\n" ); 907 printf( "\tTotal Frames | " "Bitrate " "Y-PSNR " "U-PSNR " "V-PSNR \n" ); 908 for(layer = 0; layer < m_numLayers; layer++) 909 { 910 m_gcAnalyzeB[layer].printOut('b', layer); 911 } 912 } 913 914 #else 915 Void TAppEncTop::encode() 916 { 917 fstream bitstreamFile(m_pchBitstreamFile, fstream::binary | fstream::out); 918 if (!bitstreamFile) 919 { 920 fprintf(stderr, "\nfailed to open bitstream file `%s' for writing\n", m_pchBitstreamFile); 921 exit(EXIT_FAILURE); 922 } 923 924 TComPicYuv* pcPicYuvOrg = new TComPicYuv; 925 TComPicYuv* pcPicYuvRec = NULL; 926 927 // initialize internal class & member variables 928 xInitLibCfg(); 929 xCreateLib(); 930 xInitLib(); 931 396 932 // main encoder loop 397 933 Int iNumEncoded = 0; 398 934 Bool bEos = false; 399 935 400 936 list<AccessUnit> outputAccessUnits; ///< list of access units to write out. is populated by the encoding process 401 937 402 938 // allocate original YUV buffer 403 939 pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 404 940 405 941 while ( !bEos ) 406 942 { … … 410 946 // read input YUV file 411 947 m_cTVideoIOYuvInputFile.read( pcPicYuvOrg, m_aiPad ); 412 948 413 949 // increase number of received frames 414 950 m_iFrameRcvd++; 415 951 416 952 bEos = (m_iFrameRcvd == m_framesToBeEncoded); 417 953 … … 428 964 // call encoding function for one frame 429 965 m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, m_cListPicYuvRec, outputAccessUnits, iNumEncoded ); 430 966 431 967 // write bistream to file if necessary 432 968 if ( iNumEncoded > 0 ) … … 443 979 delete pcPicYuvOrg; 444 980 pcPicYuvOrg = NULL; 445 981 446 982 // delete used buffers in encoder class 447 983 m_cTEncTop.deletePicBuffer(); 448 984 449 985 // delete buffers & classes 450 986 xDeleteBuffer(); 451 987 xDestroyLib(); 452 988 453 989 printRateSummary(); 454 990 455 991 return; 456 992 } 993 #endif 457 994 458 995 // ==================================================================================================================== … … 461 998 462 999 /** 463 - application has picture buffer list with size of GOP 464 - picture buffer list acts as ring buffer 465 - end of the list has the latest picture 466 . 467 */ 1000 - application has picture buffer list with size of GOP 1001 - picture buffer list acts as ring buffer 1002 - end of the list has the latest picture 1003 . 1004 */ 1005 #if SVC_EXTENSION 1006 Void TAppEncTop::xGetBuffer( TComPicYuv*& rpcPicYuvRec, UInt layer) 1007 { 1008 assert( m_iGOPSize > 0 ); 1009 1010 // org. buffer 1011 if ( m_acListPicYuvRec[layer].size() == (UInt)m_iGOPSize ) 1012 { 1013 rpcPicYuvRec = m_acListPicYuvRec[layer].popFront(); 1014 1015 } 1016 else 1017 { 1018 rpcPicYuvRec = new TComPicYuv; 1019 1020 #if SVC_UPSAMPLING 1021 rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL ); 1022 #else 1023 rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 1024 #endif 1025 1026 } 1027 m_acListPicYuvRec[layer].pushBack( rpcPicYuvRec ); 1028 } 1029 1030 Void TAppEncTop::xDeleteBuffer( ) 1031 { 1032 for(UInt layer=0; layer<m_numLayers; layer++) 1033 { 1034 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_acListPicYuvRec[layer].begin(); 1035 1036 Int iSize = Int( m_acListPicYuvRec[layer].size() ); 1037 1038 for ( Int i = 0; i < iSize; i++ ) 1039 { 1040 TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); 1041 pcPicYuvRec->destroy(); 1042 delete pcPicYuvRec; pcPicYuvRec = NULL; 1043 } 1044 } 1045 } 1046 1047 Void TAppEncTop::xWriteRecon(UInt layer, Int iNumEncoded) 1048 { 1049 Int i; 1050 1051 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_acListPicYuvRec[layer].end(); 1052 1053 for ( i = 0; i < iNumEncoded; i++ ) 1054 { 1055 --iterPicYuvRec; 1056 } 1057 1058 for ( i = 0; i < iNumEncoded; i++ ) 1059 { 1060 TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); 1061 if (!m_acLayerCfg[layer].getReconFile().empty()) 1062 { 1063 m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getConfLeft(), m_acLayerCfg[layer].getConfRight(), 1064 m_acLayerCfg[layer].getConfTop(), m_acLayerCfg[layer].getConfBottom() ); 1065 } 1066 } 1067 } 1068 1069 Void TAppEncTop::xWriteStream(std::ostream& bitstreamFile, Int iNumEncoded, const std::list<AccessUnit>& accessUnits) 1070 { 1071 Int i; 1072 1073 list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin(); 1074 1075 for ( i = 0; i < iNumEncoded; i++ ) 1076 { 1077 const AccessUnit& au = *(iterBitstream++); 1078 const vector<UInt>& stats = writeAnnexB(bitstreamFile, au); 1079 rateStatsAccum(au, stats); 1080 } 1081 } 1082 1083 #else // SVC_EXTENSION 468 1084 Void TAppEncTop::xGetBuffer( TComPicYuv*& rpcPicYuvRec) 469 1085 { 470 1086 assert( m_iGOPSize > 0 ); 471 1087 472 1088 // org. buffer 473 1089 if ( m_cListPicYuvRec.size() == (UInt)m_iGOPSize ) … … 479 1095 { 480 1096 rpcPicYuvRec = new TComPicYuv; 481 1097 482 1098 rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 483 1099 … … 489 1105 { 490 1106 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.begin(); 491 1107 492 1108 Int iSize = Int( m_cListPicYuvRec.size() ); 493 1109 494 1110 for ( Int i = 0; i < iSize; i++ ) 495 1111 { … … 498 1114 delete pcPicYuvRec; pcPicYuvRec = NULL; 499 1115 } 500 1116 501 1117 } 502 1118 503 1119 /** \param iNumEncoded number of encoded frames 504 1120 */ 505 1121 Void TAppEncTop::xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, const std::list<AccessUnit>& accessUnits) 506 1122 { 507 1123 Int i; 508 1124 509 1125 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.end(); 510 1126 list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin(); 511 1127 512 1128 for ( i = 0; i < iNumEncoded; i++ ) 513 1129 { 514 1130 --iterPicYuvRec; 515 1131 } 516 1132 517 1133 for ( i = 0; i < iNumEncoded; i++ ) 518 1134 { … … 528 1144 } 529 1145 } 1146 #endif 530 1147 531 1148 /** 532 533 1149 * 1150 */ 534 1151 void TAppEncTop::rateStatsAccum(const AccessUnit& au, const std::vector<UInt>& annexBsizes) 535 1152 { … … 572 1189 void TAppEncTop::printRateSummary() 573 1190 { 1191 #if SVC_EXTENSION 1192 Double time = (Double) m_iFrameRcvd / m_acLayerCfg[m_numLayers-1].getFrameRate(); 1193 #else 574 1194 Double time = (Double) m_iFrameRcvd / m_iFrameRate; 1195 #endif 575 1196 printf("Bytes written to file: %u (%.3f kbps)\n", m_totalBytes, 0.008 * m_totalBytes / time); 576 1197 #if VERBOSE_RATE -
branches/HM-10.0-dev-SHM/source/App/TAppEncoder/TAppEncTop.h
r51 r54 59 59 private: 60 60 // class interface 61 #if SVC_EXTENSION 62 TEncTop m_acTEncTop [MAX_LAYERS]; ///< encoder class 63 TEncTop* m_apcTEncTop [MAX_LAYERS]; ///< encoder pointer class 64 TVideoIOYuv m_acTVideoIOYuvInputFile [MAX_LAYERS]; ///< input YUV file 65 TVideoIOYuv m_acTVideoIOYuvReconFile [MAX_LAYERS]; ///< output reconstruction file 66 67 TComList<TComPicYuv*> m_acListPicYuvRec [MAX_LAYERS]; ///< list of reconstruction YUV files 68 #else 61 69 TEncTop m_cTEncTop; ///< encoder class 62 70 TVideoIOYuv m_cTVideoIOYuvInputFile; ///< input YUV file … … 64 72 65 73 TComList<TComPicYuv*> m_cListPicYuvRec; ///< list of reconstruction YUV files 74 #endif 66 75 67 76 Int m_iFrameRcvd; ///< number of received frames … … 77 86 78 87 /// obtain required buffers 88 #if SVC_EXTENSION 89 Void xGetBuffer(TComPicYuv*& rpcPicYuvRec, UInt layer); 90 #else 79 91 Void xGetBuffer(TComPicYuv*& rpcPicYuvRec); 92 #endif 80 93 81 94 /// delete allocated buffers … … 83 96 84 97 // file I/O 98 #if SVC_EXTENSION 99 Void xWriteRecon(UInt layer, Int iNumEncoded); 100 Void xWriteStream(std::ostream& bitstreamFile, Int iNumEncoded, const std::list<AccessUnit>& accessUnits); 101 Void printOutSummary(); 102 #else 85 103 Void xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, const std::list<AccessUnit>& accessUnits); ///< write bitstream to file 104 #endif 86 105 void rateStatsAccum(const AccessUnit& au, const std::vector<UInt>& stats); 87 106 void printRateSummary(); … … 92 111 93 112 Void encode (); ///< main encoding function 113 #if SVC_EXTENSION 114 TEncTop& getTEncTop (UInt layer) { return m_acTEncTop[layer]; } ///< return encoder class pointer reference 115 #else 94 116 TEncTop& getTEncTop () { return m_cTEncTop; } ///< return encoder class pointer reference 117 #endif 95 118 };// END CLASS DEFINITION TAppEncTop 96 119 -
branches/HM-10.0-dev-SHM/source/App/TAppEncoder/encmain.cpp
r51 r54 57 57 // print information 58 58 fprintf( stdout, "\n" ); 59 fprintf( stdout, " HM software: Encoder Version [%s]", NV_VERSION );59 fprintf( stdout, "SHM software: Encoder Version [%s]", NV_VERSION ); 60 60 fprintf( stdout, NVM_ONOS ); 61 61 fprintf( stdout, NVM_COMPILEDBY );
Note: See TracChangeset for help on using the changeset viewer.