Changeset 1391 in SHVCSoftware for branches/SHM-dev/source/App
- Timestamp:
- 4 Aug 2015, 03:15:00 (9 years ago)
- Location:
- branches/SHM-dev/source/App/TAppEncoder
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.cpp
r1381 r1391 504 504 { 505 505 const T minValIncl; 506 const T maxValIncl; // Use 0 for unlimited506 const T maxValIncl; 507 507 const std::size_t minNumValuesIncl; 508 508 const std::size_t maxNumValuesIncl; // Use 0 for unlimited … … 516 516 SMultiValueInput<T> &operator=(const std::vector<T> &userValues) { values=userValues; return *this; } 517 517 SMultiValueInput<T> &operator=(const SMultiValueInput<T> &userValues) { values=userValues.values; return *this; } 518 519 T readValue(const Char *&pStr, Bool &bSuccess); 520 521 istream& readValues(std::istream &in); 518 522 }; 519 523 520 static inline istream& operator >> (istream &in, SMultiValueInput<UInt> &values) 521 { 522 values.values.clear(); 524 template <class T> 525 static inline istream& operator >> (std::istream &in, SMultiValueInput<T> &values) 526 { 527 return values.readValues(in); 528 } 529 530 template<> 531 UInt SMultiValueInput<UInt>::readValue(const Char *&pStr, Bool &bSuccess) 532 { 533 Char *eptr; 534 UInt val=strtoul(pStr, &eptr, 0); 535 pStr=eptr; 536 bSuccess=!(*eptr!=0 && !isspace(*eptr) && *eptr!=',') && !(val<minValIncl || val>maxValIncl); 537 return val; 538 } 539 540 template<> 541 Int SMultiValueInput<Int>::readValue(const Char *&pStr, Bool &bSuccess) 542 { 543 Char *eptr; 544 Int val=strtol(pStr, &eptr, 0); 545 pStr=eptr; 546 bSuccess=!(*eptr!=0 && !isspace(*eptr) && *eptr!=',') && !(val<minValIncl || val>maxValIncl); 547 return val; 548 } 549 550 template<> 551 Double SMultiValueInput<Double>::readValue(const Char *&pStr, Bool &bSuccess) 552 { 553 Char *eptr; 554 Double val=strtod(pStr, &eptr); 555 pStr=eptr; 556 bSuccess=!(*eptr!=0 && !isspace(*eptr) && *eptr!=',') && !(val<minValIncl || val>maxValIncl); 557 return val; 558 } 559 560 template<> 561 Bool SMultiValueInput<Bool>::readValue(const Char *&pStr, Bool &bSuccess) 562 { 563 Char *eptr; 564 Int val=strtol(pStr, &eptr, 0); 565 pStr=eptr; 566 bSuccess=!(*eptr!=0 && !isspace(*eptr) && *eptr!=',') && !(val<Int(minValIncl) || val>Int(maxValIncl)); 567 return val!=0; 568 } 569 570 template <class T> 571 istream& SMultiValueInput<T>::readValues(std::istream &in) 572 { 573 values.clear(); 523 574 string str; 524 575 while (!in.eof()) … … 534 585 while (*pStr != 0) 535 586 { 536 Char *eptr;537 UInt val=strtoul(pStr, &eptr, 0);538 if ( *eptr!=0 && !isspace(*eptr) && *eptr!=',')587 Bool bSuccess=true; 588 T val=readValue(pStr, bSuccess); 589 if (!bSuccess) 539 590 { 540 591 in.setstate(ios::failbit); 541 592 break; 542 593 } 543 if (val<values.minValIncl || val>values.maxValIncl) 594 595 if (maxNumValuesIncl != 0 && values.size() >= maxNumValuesIncl) 544 596 { 545 597 in.setstate(ios::failbit); 546 598 break; 547 599 } 548 549 if (values.maxNumValuesIncl != 0 && values.values.size() >= values.maxNumValuesIncl) 550 { 551 in.setstate(ios::failbit); 552 break; 553 } 554 values.values.push_back(val); 600 values.push_back(val); 555 601 // soak up any whitespace and up to 1 comma. 556 pStr=eptr;557 602 for(;isspace(*pStr);pStr++); 558 603 if (*pStr == ',') … … 563 608 } 564 609 } 565 if (values.values.size() < values.minNumValuesIncl) 566 { 567 in.setstate(ios::failbit); 568 } 569 return in; 570 } 571 572 static inline istream& operator >> (istream &in, SMultiValueInput<Int> &values) 573 { 574 values.values.clear(); 575 string str; 576 while (!in.eof()) 577 { 578 string tmp; in >> tmp; str+=" " + tmp; 579 } 580 if (!str.empty()) 581 { 582 const Char *pStr=str.c_str(); 583 // soak up any whitespace 584 for(;isspace(*pStr);pStr++); 585 586 while (*pStr != 0) 587 { 588 Char *eptr; 589 Int val=strtol(pStr, &eptr, 0); 590 if (*eptr!=0 && !isspace(*eptr) && *eptr!=',') 591 { 592 in.setstate(ios::failbit); 593 break; 594 } 595 if (val<values.minValIncl || val>values.maxValIncl) 596 { 597 in.setstate(ios::failbit); 598 break; 599 } 600 601 if (values.maxNumValuesIncl != 0 && values.values.size() >= values.maxNumValuesIncl) 602 { 603 in.setstate(ios::failbit); 604 break; 605 } 606 values.values.push_back(val); 607 // soak up any whitespace and up to 1 comma. 608 pStr=eptr; 609 for(;isspace(*pStr);pStr++); 610 if (*pStr == ',') 611 { 612 pStr++; 613 } 614 for(;isspace(*pStr);pStr++); 615 } 616 } 617 if (values.values.size() < values.minNumValuesIncl) 618 { 619 in.setstate(ios::failbit); 620 } 621 return in; 622 } 623 624 static inline istream& operator >> (istream &in, SMultiValueInput<Bool> &values) 625 { 626 values.values.clear(); 627 string str; 628 while (!in.eof()) 629 { 630 string tmp; in >> tmp; str+=" " + tmp; 631 } 632 if (!str.empty()) 633 { 634 const Char *pStr=str.c_str(); 635 // soak up any whitespace 636 for(;isspace(*pStr);pStr++); 637 638 while (*pStr != 0) 639 { 640 Char *eptr; 641 Int val=strtol(pStr, &eptr, 0); 642 if (*eptr!=0 && !isspace(*eptr) && *eptr!=',') 643 { 644 in.setstate(ios::failbit); 645 break; 646 } 647 if (val<Int(values.minValIncl) || val>Int(values.maxValIncl)) 648 { 649 in.setstate(ios::failbit); 650 break; 651 } 652 653 if (values.maxNumValuesIncl != 0 && values.values.size() >= values.maxNumValuesIncl) 654 { 655 in.setstate(ios::failbit); 656 break; 657 } 658 values.values.push_back(val!=0); 659 // soak up any whitespace and up to 1 comma. 660 pStr=eptr; 661 for(;isspace(*pStr);pStr++); 662 if (*pStr == ',') 663 { 664 pStr++; 665 } 666 for(;isspace(*pStr);pStr++); 667 } 668 } 669 if (values.values.size() < values.minNumValuesIncl) 610 if (values.size() < minNumValuesIncl) 670 611 { 671 612 in.setstate(ios::failbit); … … 1051 992 SMultiValueInput<Int> cfg_codedPivotValue (std::numeric_limits<Int>::min(), std::numeric_limits<Int>::max(), 0, 1<<16); 1052 993 SMultiValueInput<Int> cfg_targetPivotValue (std::numeric_limits<Int>::min(), std::numeric_limits<Int>::max(), 0, 1<<16); 994 995 SMultiValueInput<Double> cfg_adIntraLambdaModifier (0, std::numeric_limits<Double>::max(), 0, MAX_TLAYER); ///< Lambda modifier for Intra pictures, one for each temporal layer. If size>temporalLayer, then use [temporalLayer], else if size>0, use [size()-1], else use m_adLambdaModifier. 996 1053 997 1054 998 const UInt defaultInputKneeCodes[3] = { 600, 800, 900 }; … … 1359 1303 ("LambdaModifier6,-LM6", m_adLambdaModifier[ 6 ], ( Double )1.0, "Lambda modifier for temporal layer 6") 1360 1304 #endif 1305 ("LambdaModifierI,-LMI", cfg_adIntraLambdaModifier, cfg_adIntraLambdaModifier, "Lambda modifiers for Intra pictures, comma separated, up to one the number of temporal layer. If entry for temporalLayer exists, then use it, else if some are specified, use the last, else use the standard LambdaModifiers.") 1306 ("IQPFactor,-IQF", m_dIntraQpFactor, -1.0, "Intra QP Factor for Lambda Computation. If negative, use the default equation: 0.57*(1.0 - Clip3( 0.0, 0.5, 0.05*(Double)(isField ? (GopSize-1)/2 : GopSize-1) ))") 1361 1307 1362 1308 /* Quantization parameters */ … … 1831 1777 1832 1778 1779 m_adIntraLambdaModifier = cfg_adIntraLambdaModifier.values; 1833 1780 if(m_isField) 1834 1781 { -
branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.h
r1381 r1391 88 88 Char* m_pchReconFile; ///< output reconstruction file 89 89 #endif 90 // Lambda modifiers 90 91 Double m_adLambdaModifier[ MAX_TLAYER ]; ///< Lambda modifier array for each temporal layer 92 std::vector<Double> m_adIntraLambdaModifier; ///< Lambda modifier for Intra pictures, one for each temporal layer. If size>temporalLayer, then use [temporalLayer], else if size>0, use [size()-1], else use m_adLambdaModifier. 93 Double m_dIntraQpFactor; ///< Intra Q Factor. If negative, use a default equation: 0.57*(1.0 - Clip3( 0.0, 0.5, 0.05*(Double)(isField ? (GopSize-1)/2 : GopSize-1) )) 94 91 95 // source specification 92 96 #if !SVC_EXTENSION -
branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp
r1381 r1391 537 537 m_cTEncTop.setLambdaModifier ( uiLoop, m_adLambdaModifier[ uiLoop ] ); 538 538 } 539 m_cTEncTop.setIntraLambdaModifier ( m_adIntraLambdaModifier ); 540 m_cTEncTop.setIntraQpFactor ( m_dIntraQpFactor ); 541 539 542 m_cTEncTop.setQP ( m_iQP ); 540 543
Note: See TracChangeset for help on using the changeset viewer.