Changeset 1246 in SHVCSoftware for branches/SHM-dev/source/App/TAppEncoder
- Timestamp:
- 14 Jul 2015, 00:26:07 (10 years ago)
- Location:
- branches/SHM-dev/source/App/TAppEncoder
- Files:
-
- 2 edited
-
TAppEncCfg.cpp (modified) (19 diffs)
-
TAppEncTop.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.cpp
r1235 r1246 558 558 pStr=eptr; 559 559 for(;isspace(*pStr);pStr++); 560 if (*pStr == ',') pStr++; 560 if (*pStr == ',') 561 { 562 pStr++; 563 } 561 564 for(;isspace(*pStr);pStr++); 562 565 } … … 604 607 pStr=eptr; 605 608 for(;isspace(*pStr);pStr++); 606 if (*pStr == ',') pStr++; 609 if (*pStr == ',') 610 { 611 pStr++; 612 } 607 613 for(;isspace(*pStr);pStr++); 608 614 } … … 650 656 pStr=eptr; 651 657 for(;isspace(*pStr);pStr++); 652 if (*pStr == ',') pStr++; 658 if (*pStr == ',') 659 { 660 pStr++; 661 } 653 662 for(;isspace(*pStr);pStr++); 654 663 } … … 673 682 // Try to choose profile, according to table in Q1013. 674 683 UInt trialBitDepthConstraint=maxBitDepth; 675 if (trialBitDepthConstraint<8) trialBitDepthConstraint=8; 676 else if (trialBitDepthConstraint==9 || trialBitDepthConstraint==11) trialBitDepthConstraint++; 677 else if (trialBitDepthConstraint>12) trialBitDepthConstraint=16; 684 if (trialBitDepthConstraint<8) 685 { 686 trialBitDepthConstraint=8; 687 } 688 else if (trialBitDepthConstraint==9 || trialBitDepthConstraint==11) 689 { 690 trialBitDepthConstraint++; 691 } 692 else if (trialBitDepthConstraint>12) 693 { 694 trialBitDepthConstraint=16; 695 } 678 696 679 697 // both format and bit depth constraints are unspecified … … 713 731 bitDepthConstraint = trialBitDepthConstraint; 714 732 chromaFormatConstraint = chromaFormat; 715 if (bUsingChromaQPAdjustment && chromaFormat == CHROMA_420) chromaFormatConstraint = CHROMA_422; // 4:2:0 cannot use the chroma qp tool. 716 if (chromaFormatConstraint == CHROMA_422 && bitDepthConstraint == 8) bitDepthConstraint = 10; // there is no 8-bit 4:2:2 profile. 717 if (chromaFormatConstraint == CHROMA_420 && !bIntraConstraintFlag) bitDepthConstraint = 12; // there is no 8 or 10-bit 4:2:0 inter RExt profile. 733 if (bUsingChromaQPAdjustment && chromaFormat == CHROMA_420) 734 { 735 chromaFormatConstraint = CHROMA_422; // 4:2:0 cannot use the chroma qp tool. 736 } 737 if (chromaFormatConstraint == CHROMA_422 && bitDepthConstraint == 8) 738 { 739 bitDepthConstraint = 10; // there is no 8-bit 4:2:2 profile. 740 } 741 if (chromaFormatConstraint == CHROMA_420 && !bIntraConstraintFlag) 742 { 743 bitDepthConstraint = 12; // there is no 8 or 10-bit 4:2:0 inter RExt profile. 744 } 718 745 } 719 746 } … … 1651 1678 ; 1652 1679 1653 for(Int i=1; i<MAX_GOP+1; i++) { 1680 for(Int i=1; i<MAX_GOP+1; i++) 1681 { 1654 1682 std::ostringstream cOSS; 1655 1683 cOSS<<"Frame"<<i; … … 1766 1794 m_tileColumnWidth.resize(m_numTileColumnsMinus1); 1767 1795 for(UInt i=0; i<cfg_ColumnWidth.values.size(); i++) 1796 { 1768 1797 m_tileColumnWidth[i]=cfg_ColumnWidth.values[i]; 1798 } 1769 1799 } 1770 1800 } … … 1790 1820 m_tileRowHeight.resize(m_numTileRowsMinus1); 1791 1821 for(UInt i=0; i<cfg_RowHeight.values.size(); i++) 1822 { 1792 1823 m_tileRowHeight[i]=cfg_RowHeight.values[i]; 1824 } 1793 1825 } 1794 1826 } … … 1927 1959 #else 1928 1960 /* rules for input, output and internal bitdepths as per help text */ 1929 if (m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA ] == 0) { m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA ] = m_inputBitDepth [CHANNEL_TYPE_LUMA ]; } 1930 if (m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] == 0) { m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] = m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA ]; } 1931 if (m_internalBitDepth [CHANNEL_TYPE_LUMA ] == 0) { m_internalBitDepth [CHANNEL_TYPE_LUMA ] = m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA ]; } 1932 if (m_internalBitDepth [CHANNEL_TYPE_CHROMA] == 0) { m_internalBitDepth [CHANNEL_TYPE_CHROMA] = m_internalBitDepth [CHANNEL_TYPE_LUMA ]; } 1933 if (m_inputBitDepth [CHANNEL_TYPE_CHROMA] == 0) { m_inputBitDepth [CHANNEL_TYPE_CHROMA] = m_inputBitDepth [CHANNEL_TYPE_LUMA ]; } 1934 if (m_outputBitDepth [CHANNEL_TYPE_LUMA ] == 0) { m_outputBitDepth [CHANNEL_TYPE_LUMA ] = m_internalBitDepth [CHANNEL_TYPE_LUMA ]; } 1935 if (m_outputBitDepth [CHANNEL_TYPE_CHROMA] == 0) { m_outputBitDepth [CHANNEL_TYPE_CHROMA] = m_internalBitDepth [CHANNEL_TYPE_CHROMA]; } 1961 if (m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA ] == 0) 1962 { 1963 m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA ] = m_inputBitDepth [CHANNEL_TYPE_LUMA ]; 1964 } 1965 if (m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] == 0) 1966 { 1967 m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] = m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA ]; 1968 } 1969 if (m_internalBitDepth [CHANNEL_TYPE_LUMA ] == 0) 1970 { 1971 m_internalBitDepth [CHANNEL_TYPE_LUMA ] = m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA ]; 1972 } 1973 if (m_internalBitDepth [CHANNEL_TYPE_CHROMA] == 0) 1974 { 1975 m_internalBitDepth [CHANNEL_TYPE_CHROMA] = m_internalBitDepth [CHANNEL_TYPE_LUMA ]; 1976 } 1977 if (m_inputBitDepth [CHANNEL_TYPE_CHROMA] == 0) 1978 { 1979 m_inputBitDepth [CHANNEL_TYPE_CHROMA] = m_inputBitDepth [CHANNEL_TYPE_LUMA ]; 1980 } 1981 if (m_outputBitDepth [CHANNEL_TYPE_LUMA ] == 0) 1982 { 1983 m_outputBitDepth [CHANNEL_TYPE_LUMA ] = m_internalBitDepth [CHANNEL_TYPE_LUMA ]; 1984 } 1985 if (m_outputBitDepth [CHANNEL_TYPE_CHROMA] == 0) 1986 { 1987 m_outputBitDepth [CHANNEL_TYPE_CHROMA] = m_internalBitDepth [CHANNEL_TYPE_CHROMA]; 1988 } 1936 1989 1937 1990 m_InputChromaFormatIDC = numberToChromaFormat(tmpInputChromaFormat); … … 1963 2016 if (m_profile == Profile::HIGHTHROUGHPUTREXT ) 1964 2017 { 1965 if (m_bitDepthConstraint == 0) m_bitDepthConstraint = 16; 2018 if (m_bitDepthConstraint == 0) 2019 { 2020 m_bitDepthConstraint = 16; 2021 } 1966 2022 m_chromaFormatConstraint = (tmpConstraintChromaFormat == 0) ? CHROMA_444 : numberToChromaFormat(tmpConstraintChromaFormat); 1967 2023 } … … 2581 2637 while ( iPOC < m_framesToBeEncoded ) 2582 2638 { 2583 if ( fscanf(fpt, "%d", &iValue ) == EOF ) break; 2639 if ( fscanf(fpt, "%d", &iValue ) == EOF ) 2640 { 2641 break; 2642 } 2584 2643 m_aidQP[ iPOC ] = iValue; 2585 2644 iPOC++; … … 3194 3253 ui >>= 1; 3195 3254 if( (ui & 1) == 1) 3255 { 3196 3256 xConfirmPara( ui != 1 , "Width should be 2^n"); 3257 } 3197 3258 } 3198 3259 ui = m_uiMaxCUHeight; … … 3201 3262 ui >>= 1; 3202 3263 if( (ui & 1) == 1) 3264 { 3203 3265 xConfirmPara( ui != 1 , "Height should be 2^n"); 3266 } 3204 3267 } 3205 3268 #endif … … 4007 4070 { 4008 4071 xConfirmPara( m_kneeSEINumKneePointsMinus1 < 0 || m_kneeSEINumKneePointsMinus1 > 998, "SEIKneeFunctionNumKneePointsMinus1 must be in the range of 0 to 998"); 4009 for ( UInt i=0; i<=m_kneeSEINumKneePointsMinus1; i++ ){ 4072 for ( UInt i=0; i<=m_kneeSEINumKneePointsMinus1; i++ ) 4073 { 4010 4074 xConfirmPara( m_kneeSEIInputKneePoint[i] < 1 || m_kneeSEIInputKneePoint[i] > 999, "SEIKneeFunctionInputKneePointValue must be in the range of 1 to 999"); 4011 4075 xConfirmPara( m_kneeSEIOutputKneePoint[i] < 0 || m_kneeSEIOutputKneePoint[i] > 1000, "SEIKneeFunctionInputKneePointValue must be in the range of 0 to 1000"); … … 4243 4307 // compute actual CU depth with respect to config depth and max transform size 4244 4308 g_uiAddCUDepth = 0; 4245 while( (m_uiMaxCUWidth>>m_uiMaxCUDepth) > ( 1 << ( m_uiQuadtreeTULog2MinSize + g_uiAddCUDepth ) ) ) g_uiAddCUDepth++; 4309 while( (m_uiMaxCUWidth>>m_uiMaxCUDepth) > ( 1 << ( m_uiQuadtreeTULog2MinSize + g_uiAddCUDepth ) ) ) 4310 { 4311 g_uiAddCUDepth++; 4312 } 4246 4313 4247 4314 g_uiAddCUDepth+=getMaxCUDepthOffset(m_chromaFormatIDC, m_uiQuadtreeTULog2MinSize); // if minimum TU larger than 4x4, allow for additional part indices for 4:2:2 SubTUs. … … 4261 4328 #endif 4262 4329 g_PCMBitDepth[channelType] = m_bPCMInputBitDepthFlag ? m_MSBExtendedBitDepth[channelType] : m_internalBitDepth[channelType]; 4263 4264 if (m_useExtendedPrecision) g_maxTrDynamicRange[channelType] = std::max<Int>(15, (g_bitDepth[channelType] + 6)); 4265 else g_maxTrDynamicRange[channelType] = 15; 4330 g_maxTrDynamicRange[channelType] = m_useExtendedPrecision? std::max<Int>(15, (g_bitDepth[channelType] + 6)) : 15; 4266 4331 } 4267 4332 … … 4275 4340 for (UInt profileIndex = 0; profileIndex < numberOfProfiles; profileIndex++) 4276 4341 { 4277 if (strToProfile[profileIndex].value == profile) return strToProfile[profileIndex].str; 4342 if (strToProfile[profileIndex].value == profile) 4343 { 4344 return strToProfile[profileIndex].str; 4345 } 4278 4346 } 4279 4347 … … 4345 4413 const ExtendedProfileName validProfileName = (bitDepthIdx > 3 || chromaFormatIdx>3) ? NONE : validRExtProfileNames[intraIdx][bitDepthIdx][chromaFormatIdx]; 4346 4414 std::string rextSubProfile; 4347 if (validProfileName!=NONE) rextSubProfile=enumToString(strToExtendedProfile, sizeof(strToExtendedProfile)/sizeof(*strToExtendedProfile), validProfileName); 4348 if (rextSubProfile == "main_444_16") rextSubProfile="main_444_16 [NON STANDARD]"; 4415 if (validProfileName!=NONE) 4416 { 4417 rextSubProfile=enumToString(strToExtendedProfile, sizeof(strToExtendedProfile)/sizeof(*strToExtendedProfile), validProfileName); 4418 } 4419 if (rextSubProfile == "main_444_16") 4420 { 4421 rextSubProfile="main_444_16 [NON STANDARD]"; 4422 } 4349 4423 printf("Profile : %s (%s)\n", profileToString(m_profile), (rextSubProfile.empty())?"INVALID REXT PROFILE":rextSubProfile.c_str() ); 4350 4424 } … … 4511 4585 { 4512 4586 if (!bflag) 4587 { 4513 4588 return false; 4589 } 4514 4590 4515 4591 printf("Error: %s\n",message); -
branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp
r1237 r1246 571 571 m_acTEncTop[layer].setTimeCodeSEIEnabled ( m_timeCodeSEIEnabled ); 572 572 m_acTEncTop[layer].setNumberOfTimeSets ( m_timeCodeSEINumTs ); 573 for(Int i = 0; i < m_timeCodeSEINumTs; i++) { m_acTEncTop[layer].setTimeSet(m_timeSetArray[i], i); } 573 for(Int i = 0; i < m_timeCodeSEINumTs; i++) 574 { 575 m_acTEncTop[layer].setTimeSet(m_timeSetArray[i], i); 576 } 574 577 m_acTEncTop[layer].setKneeSEIEnabled ( m_kneeSEIEnabled ); 575 578 m_acTEncTop[layer].setKneeSEIId ( m_kneeSEIId ); … … 979 982 m_cTEncTop.setTimeCodeSEIEnabled ( m_timeCodeSEIEnabled ); 980 983 m_cTEncTop.setNumberOfTimeSets ( m_timeCodeSEINumTs ); 981 for(Int i = 0; i < m_timeCodeSEINumTs; i++) { m_cTEncTop.setTimeSet(m_timeSetArray[i], i); } 984 for(Int i = 0; i < m_timeCodeSEINumTs; i++) 985 { 986 m_cTEncTop.setTimeSet(m_timeSetArray[i], i); 987 } 982 988 m_cTEncTop.setKneeSEIEnabled ( m_kneeSEIEnabled ); 983 989 m_cTEncTop.setKneeSEIId ( m_kneeSEIId ); … … 1832 1838 #endif 1833 1839 // call encoding function for one frame 1834 if ( m_isField ) m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], snrCSC, m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP, m_isTopFieldFirst ); 1835 else m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], snrCSC, m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP ); 1840 if ( m_isField ) 1841 { 1842 m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], snrCSC, m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP, m_isTopFieldFirst ); 1843 } 1844 else 1845 { 1846 m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], snrCSC, m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP ); 1847 } 1836 1848 } 1837 1849 } … … 2093 2105 2094 2106 // call encoding function for one frame 2095 if ( m_isField ) m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, flush ? 0 : &cPicYuvTrueOrg, snrCSC, m_cListPicYuvRec, outputAccessUnits, iNumEncoded, m_isTopFieldFirst ); 2096 else m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, flush ? 0 : &cPicYuvTrueOrg, snrCSC, m_cListPicYuvRec, outputAccessUnits, iNumEncoded ); 2107 if ( m_isField ) 2108 { 2109 m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, flush ? 0 : &cPicYuvTrueOrg, snrCSC, m_cListPicYuvRec, outputAccessUnits, iNumEncoded, m_isTopFieldFirst ); 2110 } 2111 else 2112 { 2113 m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, flush ? 0 : &cPicYuvTrueOrg, snrCSC, m_cListPicYuvRec, outputAccessUnits, iNumEncoded ); 2114 } 2097 2115 2098 2116 // write bistream to file if necessary
Note: See TracChangeset for help on using the changeset viewer.