Changeset 442 in SHVCSoftware for trunk/source/App
- Timestamp:
- 21 Oct 2013, 13:41:29 (11 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/SHM-3.0-dev merged: 350-351,357-360 /branches/SHM-3.1-dev (added) merged: 354-356,361-403,405-441 /trunk merged: 352 reverse-merged: 312-314
- Property svn:mergeinfo changed
-
trunk/source
- Property svn:mergeinfo changed
/branches/SHM-3.0-dev/source merged: 357-360 /branches/SHM-3.1-dev/source (added) merged: 355-356,361-364,366-403,405,407-441 /trunk/source merged: 352 reverse-merged: 312-314
- Property svn:mergeinfo changed
-
trunk/source/App/TAppDecoder/TAppDecTop.cpp
r313 r442 56 56 TAppDecTop::TAppDecTop() 57 57 { 58 ::memset (m_abDecFlag, 0, sizeof (m_abDecFlag));59 58 for(UInt layer=0; layer < MAX_LAYERS; layer++) 60 59 { … … 67 66 : m_iPOCLastDisplay(-MAX_INT) 68 67 { 69 ::memset (m_abDecFlag, 0, sizeof (m_abDecFlag));70 68 } 71 69 #endif … … 146 144 147 145 // main decoder loop 148 Bool recon_opened[MAX_LAYERS]; // reconstruction file not yet opened. (must be performed after SPS is seen)146 Bool openedReconFile[MAX_LAYERS]; // reconstruction file not yet opened. (must be performed after SPS is seen) 149 147 for(UInt layer=0; layer<=m_tgtLayerId; layer++) 150 148 { 151 recon_opened[layer] = false;149 openedReconFile[layer] = false; 152 150 m_aiPOCLastDisplay[layer] += m_iSkipFrame; // set the last displayed POC correctly for skip forward. 153 151 } … … 228 226 { 229 227 m_acTDecTop[curLayerId].executeLoopFilters(poc, pcListPic); 228 #if EARLY_REF_PIC_MARKING 229 m_acTDecTop[curLayerId].earlyPicMarking(m_iMaxTemporalLayer, m_targetDecLayerIdSet); 230 #endif 230 231 } 231 232 232 233 if( pcListPic ) 233 234 { 234 if ( m_pchReconFile[curLayerId] && ! recon_opened[curLayerId] )235 if ( m_pchReconFile[curLayerId] && !openedReconFile[curLayerId] ) 235 236 { 236 237 if (!m_outputBitDepthY) { m_outputBitDepthY = g_bitDepthY; } … … 239 240 m_acTVideoIOYuvReconFile[curLayerId].open( m_pchReconFile[curLayerId], true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode 240 241 241 recon_opened[curLayerId] = true;242 openedReconFile[curLayerId] = true; 242 243 } 243 244 if ( bNewPicture && bNewPOC && … … 263 264 // delete buffers 264 265 #if AVC_BASE 266 UInt layerIdmin = m_acTDecTop[0].getBLReconFile()->is_open() ? 1 : 0; 267 265 268 if( streamYUV.is_open() ) 266 269 { … … 273 276 } 274 277 #endif 275 pcBLPic.destroy(); 276 277 for(UInt layer = 1; layer <= m_tgtLayerId; layer++)278 pcBLPic.destroy(); 279 280 for(UInt layer = layerIdmin; layer <= m_tgtLayerId; layer++) 278 281 #else 279 282 for(UInt layer = 0; layer <= m_tgtLayerId; layer++) … … 307 310 308 311 // main decoder loop 309 Bool recon_opened= false; // reconstruction file not yet opened. (must be performed after SPS is seen)312 Bool openedReconFile = false; // reconstruction file not yet opened. (must be performed after SPS is seen) 310 313 311 314 #if SYNTAX_OUTPUT … … 338 341 streampos location = bitstreamFile.tellg(); 339 342 AnnexBStats stats = AnnexBStats(); 340 Bool bPreviousPictureDecoded = false;341 343 342 344 vector<uint8_t> nalUnit; … … 360 362 if( (m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer) || !isNaluWithinTargetDecLayerIdSet(&nalu) ) 361 363 { 362 if(bPreviousPictureDecoded)363 {364 bNewPicture = true;365 bPreviousPictureDecoded = false;366 }367 else368 {369 364 bNewPicture = false; 370 365 } 371 }372 366 else 373 367 { … … 383 377 bytestream.reset(); 384 378 } 385 bPreviousPictureDecoded = true;386 379 } 387 380 } … … 393 386 if( pcListPic ) 394 387 { 395 if ( m_pchReconFile && ! recon_opened)388 if ( m_pchReconFile && !openedReconFile ) 396 389 { 397 390 if (!m_outputBitDepthY) { m_outputBitDepthY = g_bitDepthY; } … … 399 392 400 393 m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode 401 recon_opened= true;394 openedReconFile = true; 402 395 } 403 396 if ( bNewPicture && … … 470 463 if ( m_pchReconFile[layer] ) 471 464 { 472 m_acTVideoIOYuvReconFile[layer]. 465 m_acTVideoIOYuvReconFile[layer].close(); 473 466 } 474 467 … … 505 498 506 499 /** \param pcListPic list of pictures to be written to file 507 508 500 \todo DYN_REF_FREE should be revised 501 */ 509 502 #if SVC_EXTENSION 510 503 Void TAppDecTop::xWriteOutput( TComList<TComPic*>* pcListPic, UInt layerId, UInt tId ) … … 514 507 { 515 508 TComList<TComPic*>::iterator iterPic = pcListPic->begin(); 516 Int n ot_displayed = 0;509 Int numPicsNotYetDisplayed = 0; 517 510 518 511 while (iterPic != pcListPic->end()) … … 525 518 #endif 526 519 { 527 not_displayed++;520 numPicsNotYetDisplayed++; 528 521 } 529 522 iterPic++; 530 523 } 531 524 iterPic = pcListPic->begin(); 532 533 while (iterPic != pcListPic->end()) 534 { 535 TComPic* pcPic = *(iterPic); 536 537 #if SVC_EXTENSION 538 if ( pcPic->getOutputMark() && (not_displayed > pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_aiPOCLastDisplay[layerId])) 539 #else 540 if ( pcPic->getOutputMark() && (not_displayed > pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_iPOCLastDisplay)) 541 #endif 542 { 543 // write to file 544 not_displayed--; 545 #if SVC_EXTENSION 546 if ( m_pchReconFile[layerId] ) 547 { 548 const Window &conf = pcPic->getConformanceWindow(); 549 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 550 m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(), 551 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 552 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 553 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 554 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() ); 555 } 556 557 // update POC of display order 558 m_aiPOCLastDisplay[layerId] = pcPic->getPOC(); 559 #else 560 if ( m_pchReconFile ) 561 { 562 #if SYNTAX_OUTPUT && ILP_DECODED_PICTURE 563 m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec() ); 564 #else 565 const Window &conf = pcPic->getConformanceWindow(); 566 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 567 m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(), 568 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 569 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 570 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 571 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() ); 572 #endif 573 } 574 575 // update POC of display order 576 m_iPOCLastDisplay = pcPic->getPOC(); 577 #endif 578 579 // erase non-referenced picture in the reference picture list after display 580 if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true ) 581 { 525 if (numPicsNotYetDisplayed>2) 526 { 527 iterPic++; 528 } 529 530 TComPic* pcPic = *(iterPic); 531 if (numPicsNotYetDisplayed>2 && pcPic->isField()) //Field Decoding 532 { 533 TComList<TComPic*>::iterator endPic = pcListPic->end(); 534 endPic--; 535 iterPic = pcListPic->begin(); 536 while (iterPic != endPic) 537 { 538 TComPic* pcPicTop = *(iterPic); 539 iterPic++; 540 TComPic* pcPicBottom = *(iterPic); 541 542 #if SVC_EXTENSION 543 if ( pcPicTop->getOutputMark() && (numPicsNotYetDisplayed > pcPicTop->getNumReorderPics(tId) && !(pcPicTop->getPOC()%2) && pcPicBottom->getPOC() == pcPicTop->getPOC()+1) 544 && pcPicBottom->getOutputMark() && (numPicsNotYetDisplayed > pcPicBottom->getNumReorderPics(tId) && (pcPicTop->getPOC() == m_aiPOCLastDisplay[layerId]+1 || m_aiPOCLastDisplay[layerId]<0))) 545 #else 546 if ( pcPicTop->getOutputMark() && (numPicsNotYetDisplayed > pcPicTop->getNumReorderPics(tId) && !(pcPicTop->getPOC()%2) && pcPicBottom->getPOC() == pcPicTop->getPOC()+1) 547 && pcPicBottom->getOutputMark() && (numPicsNotYetDisplayed > pcPicBottom->getNumReorderPics(tId) && (pcPicTop->getPOC() == m_iPOCLastDisplay+1 || m_iPOCLastDisplay<0))) 548 #endif 549 { 550 // write to file 551 numPicsNotYetDisplayed = numPicsNotYetDisplayed-2; 552 #if SVC_EXTENSION 553 if ( m_pchReconFile[layerId] ) 554 { 555 const Window &conf = pcPicTop->getConformanceWindow(); 556 const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window(); 557 const Bool isTff = pcPicTop->isTopField(); 558 #if REPN_FORMAT_IN_VPS 559 UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc(); 560 Int xScal = TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc ); 561 m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), 562 conf.getWindowLeftOffset() * xScal + defDisp.getWindowLeftOffset(), 563 conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(), 564 conf.getWindowTopOffset() * yScal + defDisp.getWindowTopOffset(), 565 conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset(), isTff ); 566 567 #else 568 m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), 569 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 570 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 571 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 572 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff ); 573 #endif 574 } 575 576 // update POC of display order 577 m_aiPOCLastDisplay[layerId] = pcPicBottom->getPOC(); 578 #else 579 if ( m_pchReconFile ) 580 { 581 const Window &conf = pcPicTop->getConformanceWindow(); 582 const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window(); 583 const Bool isTff = pcPicTop->isTopField(); 584 m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), 585 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 586 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 587 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 588 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff ); 589 } 590 591 // update POC of display order 592 m_iPOCLastDisplay = pcPicBottom->getPOC(); 593 #endif 594 595 // erase non-referenced picture in the reference picture list after display 596 if ( !pcPicTop->getSlice(0)->isReferenced() && pcPicTop->getReconMark() == true ) 597 { 582 598 #if !DYN_REF_FREE 583 pcPic->setReconMark(false); 584 585 // mark it should be extended later 586 pcPic->getPicYuvRec()->setBorderExtension( false ); 587 588 #else 589 pcPic->destroy(); 590 pcListPic->erase( iterPic ); 591 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised! 592 continue; 593 #endif 594 } 595 pcPic->setOutputMark(false); 596 } 597 598 iterPic++; 599 pcPicTop->setReconMark(false); 600 601 // mark it should be extended later 602 pcPicTop->getPicYuvRec()->setBorderExtension( false ); 603 604 #else 605 pcPicTop->destroy(); 606 pcListPic->erase( iterPic ); 607 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised! 608 continue; 609 #endif 610 } 611 if ( !pcPicBottom->getSlice(0)->isReferenced() && pcPicBottom->getReconMark() == true ) 612 { 613 #if !DYN_REF_FREE 614 pcPicBottom->setReconMark(false); 615 616 // mark it should be extended later 617 pcPicBottom->getPicYuvRec()->setBorderExtension( false ); 618 619 #else 620 pcPicBottom->destroy(); 621 pcListPic->erase( iterPic ); 622 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised! 623 continue; 624 #endif 625 } 626 pcPicTop->setOutputMark(false); 627 pcPicBottom->setOutputMark(false); 628 } 629 } 630 } 631 else if (!pcPic->isField()) //Frame Decoding 632 { 633 iterPic = pcListPic->begin(); 634 while (iterPic != pcListPic->end()) 635 { 636 pcPic = *(iterPic); 637 638 #if SVC_EXTENSION 639 if ( pcPic->getOutputMark() && (numPicsNotYetDisplayed > pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_aiPOCLastDisplay[layerId])) 640 #else 641 if ( pcPic->getOutputMark() && (numPicsNotYetDisplayed > pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_iPOCLastDisplay)) 642 #endif 643 { 644 // write to file 645 numPicsNotYetDisplayed--; 646 #if SVC_EXTENSION 647 if ( m_pchReconFile[layerId] ) 648 { 649 const Window &conf = pcPic->getConformanceWindow(); 650 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 651 #if REPN_FORMAT_IN_VPS 652 UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc(); 653 Int xScal = TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc ); 654 m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(), 655 conf.getWindowLeftOffset() * xScal + defDisp.getWindowLeftOffset(), 656 conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(), 657 conf.getWindowTopOffset() * yScal + defDisp.getWindowTopOffset(), 658 conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset() ); 659 660 #else 661 m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(), 662 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 663 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 664 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 665 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() ); 666 #endif 667 } 668 669 // update POC of display order 670 m_aiPOCLastDisplay[layerId] = pcPic->getPOC(); 671 #else 672 if ( m_pchReconFile ) 673 { 674 #if SYNTAX_OUTPUT 675 const Window &conf = pcPic->getConformanceWindow(); 676 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 677 m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(), 678 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 679 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 680 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 681 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() ); 682 #endif 683 } 684 685 // update POC of display order 686 m_iPOCLastDisplay = pcPic->getPOC(); 687 #endif 688 689 // erase non-referenced picture in the reference picture list after display 690 if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true ) 691 { 692 #if !DYN_REF_FREE 693 pcPic->setReconMark(false); 694 695 // mark it should be extended later 696 pcPic->getPicYuvRec()->setBorderExtension( false ); 697 698 #else 699 pcPic->destroy(); 700 pcListPic->erase( iterPic ); 701 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised! 702 continue; 703 #endif 704 } 705 pcPic->setOutputMark(false); 706 } 707 708 iterPic++; 709 } 599 710 } 600 711 } … … 616 727 617 728 iterPic = pcListPic->begin(); 618 619 while (iterPic != pcListPic->end()) 620 { 621 TComPic* pcPic = *(iterPic); 622 623 if ( pcPic->getOutputMark() ) 624 { 625 // write to file 626 #if SVC_EXTENSION 627 if ( m_pchReconFile[layerId] ) 628 { 629 const Window &conf = pcPic->getConformanceWindow(); 630 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 631 m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(), 632 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 633 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 634 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 635 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() ); 636 } 637 638 // update POC of display order 639 m_aiPOCLastDisplay[layerId] = pcPic->getPOC(); 640 #else 641 if ( m_pchReconFile ) 642 { 643 const Window &conf = pcPic->getConformanceWindow(); 644 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 645 m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(), 646 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 647 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 648 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 649 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() ); 650 } 651 652 // update POC of display order 653 m_iPOCLastDisplay = pcPic->getPOC(); 654 #endif 655 656 // erase non-referenced picture in the reference picture list after display 657 if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true ) 658 { 729 TComPic* pcPic = *(iterPic); 730 731 if (pcPic->isField()) //Field Decoding 732 { 733 TComList<TComPic*>::iterator endPic = pcListPic->end(); 734 endPic--; 735 TComPic *pcPicTop, *pcPicBottom = NULL; 736 while (iterPic != endPic) 737 { 738 pcPicTop = *(iterPic); 739 iterPic++; 740 pcPicBottom = *(iterPic); 741 742 if ( pcPicTop->getOutputMark() && pcPicBottom->getOutputMark() && !(pcPicTop->getPOC()%2) && (pcPicBottom->getPOC() == pcPicTop->getPOC()+1) ) 743 { 744 // write to file 745 #if SVC_EXTENSION 746 if ( m_pchReconFile[layerId] ) 747 { 748 const Window &conf = pcPicTop->getConformanceWindow(); 749 const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window(); 750 const Bool isTff = pcPicTop->isTopField(); 751 #if REPN_FORMAT_IN_VPS 752 UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc(); 753 Int xScal = TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc ); 754 m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), 755 conf.getWindowLeftOffset() *xScal + defDisp.getWindowLeftOffset(), 756 conf.getWindowRightOffset() *xScal + defDisp.getWindowRightOffset(), 757 conf.getWindowTopOffset() *yScal + defDisp.getWindowTopOffset(), 758 conf.getWindowBottomOffset()*yScal + defDisp.getWindowBottomOffset(), isTff ); 759 760 #else 761 m_cTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), 762 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 763 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 764 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 765 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff ); 766 #endif 767 } 768 769 // update POC of display order 770 m_aiPOCLastDisplay[layerId] = pcPicBottom->getPOC(); 771 #else 772 if ( m_pchReconFile ) 773 { 774 const Window &conf = pcPicTop->getConformanceWindow(); 775 const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window(); 776 const Bool isTff = pcPicTop->isTopField(); 777 m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), 778 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 779 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 780 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 781 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff ); 782 } 783 784 // update POC of display order 785 m_iPOCLastDisplay = pcPicBottom->getPOC(); 786 #endif 787 788 // erase non-referenced picture in the reference picture list after display 789 if ( !pcPicTop->getSlice(0)->isReferenced() && pcPicTop->getReconMark() == true ) 790 { 659 791 #if !DYN_REF_FREE 660 pcPic->setReconMark(false); 661 662 // mark it should be extended later 663 pcPic->getPicYuvRec()->setBorderExtension( false ); 664 665 #else 666 pcPic->destroy(); 667 pcListPic->erase( iterPic ); 668 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised! 669 continue; 670 #endif 671 } 672 pcPic->setOutputMark(false); 673 } 792 pcPicTop->setReconMark(false); 793 794 // mark it should be extended later 795 pcPicTop->getPicYuvRec()->setBorderExtension( false ); 796 797 #else 798 pcPicTop->destroy(); 799 pcListPic->erase( iterPic ); 800 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised! 801 continue; 802 #endif 803 } 804 if ( !pcPicBottom->getSlice(0)->isReferenced() && pcPicBottom->getReconMark() == true ) 805 { 806 #if !DYN_REF_FREE 807 pcPicBottom->setReconMark(false); 808 809 // mark it should be extended later 810 pcPicBottom->getPicYuvRec()->setBorderExtension( false ); 811 812 #else 813 pcPicBottom->destroy(); 814 pcListPic->erase( iterPic ); 815 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised! 816 continue; 817 #endif 818 } 819 pcPicTop->setOutputMark(false); 820 pcPicBottom->setOutputMark(false); 821 822 #if !DYN_REF_FREE 823 if(pcPicTop) 824 { 825 pcPicTop->destroy(); 826 delete pcPicTop; 827 pcPicTop = NULL; 828 } 829 #endif 830 } 831 } 832 if(pcPicBottom) 833 { 834 pcPicBottom->destroy(); 835 delete pcPicBottom; 836 pcPicBottom = NULL; 837 } 838 } 839 else //Frame decoding 840 { 841 while (iterPic != pcListPic->end()) 842 { 843 pcPic = *(iterPic); 844 845 if ( pcPic->getOutputMark() ) 846 { 847 // write to file 848 #if SVC_EXTENSION 849 if ( m_pchReconFile[layerId] ) 850 { 851 const Window &conf = pcPic->getConformanceWindow(); 852 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 853 #if REPN_FORMAT_IN_VPS 854 UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc(); 855 Int xScal = TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc ); 856 m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(), 857 conf.getWindowLeftOffset() *xScal + defDisp.getWindowLeftOffset(), 858 conf.getWindowRightOffset() *xScal + defDisp.getWindowRightOffset(), 859 conf.getWindowTopOffset() *yScal + defDisp.getWindowTopOffset(), 860 conf.getWindowBottomOffset()*yScal + defDisp.getWindowBottomOffset() ); 861 862 #else 863 m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(), 864 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 865 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 866 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 867 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() ); 868 #endif 869 } 870 871 // update POC of display order 872 m_aiPOCLastDisplay[layerId] = pcPic->getPOC(); 873 #else 874 if ( m_pchReconFile ) 875 { 876 const Window &conf = pcPic->getConformanceWindow(); 877 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 878 m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(), 879 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 880 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 881 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 882 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() ); 883 } 884 885 // update POC of display order 886 m_iPOCLastDisplay = pcPic->getPOC(); 887 #endif 888 889 // erase non-referenced picture in the reference picture list after display 890 if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true ) 891 { 892 #if !DYN_REF_FREE 893 pcPic->setReconMark(false); 894 895 // mark it should be extended later 896 pcPic->getPicYuvRec()->setBorderExtension( false ); 897 898 #else 899 pcPic->destroy(); 900 pcListPic->erase( iterPic ); 901 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised! 902 continue; 903 #endif 904 } 905 pcPic->setOutputMark(false); 906 } 674 907 #if !SVC_EXTENSION 675 908 #if !DYN_REF_FREE 676 if(pcPic)677 {678 pcPic->destroy();679 delete pcPic;680 pcPic = NULL;681 }909 if(pcPic) 910 { 911 pcPic->destroy(); 912 delete pcPic; 913 pcPic = NULL; 914 } 682 915 #endif 683 916 #endif 684 iterPic++; 917 iterPic++; 918 } 685 919 } 686 920 #if SVC_EXTENSION -
trunk/source/App/TAppDecoder/TAppDecTop.h
r313 r442 70 70 #endif 71 71 72 // for output control 73 Bool m_abDecFlag[ MAX_GOP ]; ///< decoded flag in one GOP 72 // for output control 74 73 #if SVC_EXTENSION 75 74 Int m_aiPOCLastDisplay [MAX_LAYERS]; ///< last POC in display order -
trunk/source/App/TAppDownConvert/TAppDownConvert.cpp
r340 r442 270 270 FILE * outfile; 271 271 272 int M ,N;273 int ratio ;272 int M = -1 ,N = -1; 273 int ratio = -1; 274 274 int Frames=0; 275 275 int totalFrames=0; … … 326 326 return -1; 327 327 } 328 if ( ratio > 1 || ratio < 0) 329 { 328 329 switch( ratio ) 330 { 331 default: 330 332 printf("\ndown sampling parameter %d is not supported (0: 2x downsampling, 1: 1.5x downsampling)\n", ratio); 331 333 return -1; 332 } 333 334 if (ratio==0) 335 { 334 case 0: 336 335 M=4; 337 336 N=8; 338 } 339 else if (ratio==1) 340 { 337 break; 338 case 1: 341 339 M=8; 342 340 N=12; 341 break; 343 342 } 344 343 -
trunk/source/App/TAppEncoder/TAppEncCfg.cpp
r345 r442 69 69 , m_avcBaseLayerFlag(0) 70 70 #endif 71 #if N0120_MAX_TID_REF_CFG 72 , m_maxTidRefPresentFlag(1) 73 #endif 71 74 , m_pColumnWidth() 72 75 , m_pRowHeight() 73 76 , m_scalingListFile() 74 #if REF_IDX_FRAMEWORK75 77 , m_elRapSliceBEnabled(0) 76 #endif77 78 { 78 79 for(UInt layer=0; layer<MAX_LAYERS; layer++) … … 217 218 { 218 219 in>>entry.m_refIdc[i]; 220 } 221 } 222 #endif 223 #if EXTERNAL_USEDBYCURR_N0082 224 if(entry.m_numRefPics>0){ 225 in>>entry.m_UseExtusedByCurrPic; 226 if(entry.m_UseExtusedByCurrPic) 227 { 228 for ( Int i = 0; i < entry.m_numRefPics; i++ ) 229 { 230 in>>entry.m_ExtusedByCurrPic[i]; 231 } 219 232 } 220 233 } … … 335 348 336 349 #if SVC_EXTENSION 337 string cfg_LayerCfgFile [MAX_LAYERS];350 string cfg_LayerCfgFile [MAX_LAYERS]; 338 351 string cfg_BitstreamFile; 339 string* cfg_InputFile [MAX_LAYERS]; 340 string* cfg_ReconFile [MAX_LAYERS]; 341 Double* cfg_fQP [MAX_LAYERS]; 342 352 string* cfg_InputFile [MAX_LAYERS]; 353 string* cfg_ReconFile [MAX_LAYERS]; 354 Double* cfg_fQP [MAX_LAYERS]; 355 356 #if REPN_FORMAT_IN_VPS 357 Int* cfg_repFormatIdx [MAX_LAYERS]; 358 #endif 343 359 Int* cfg_SourceWidth [MAX_LAYERS]; 344 360 Int* cfg_SourceHeight [MAX_LAYERS]; … … 384 400 Bool* cfg_RCForceIntraQP [MAX_LAYERS]; 385 401 #endif 402 #if N0120_MAX_TID_REF_CFG 403 Int* cfg_maxTidIlRefPicsPlus1[MAX_LAYERS]; 404 #endif 386 405 for(UInt layer = 0; layer < MAX_LAYERS; layer++) 387 406 { … … 389 408 cfg_ReconFile[layer] = &m_acLayerCfg[layer].m_cReconFile; 390 409 cfg_fQP[layer] = &m_acLayerCfg[layer].m_fQP; 410 #if REPN_FORMAT_IN_VPS 411 cfg_repFormatIdx[layer] = &m_acLayerCfg[layer].m_repFormatIdx; 412 #endif 391 413 cfg_SourceWidth[layer] = &m_acLayerCfg[layer].m_iSourceWidth; 392 414 cfg_SourceHeight[layer] = &m_acLayerCfg[layer].m_iSourceHeight; … … 426 448 cfg_RCForceIntraQP[layer] = &m_acLayerCfg[layer].m_RCForceIntraQP; 427 449 #endif 450 #if N0120_MAX_TID_REF_CFG 451 cfg_maxTidIlRefPicsPlus1[layer] = &m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1; 452 #endif 428 453 } 429 454 #if AVC_BASE … … 432 457 #if AVC_SYNTAX 433 458 string cfg_BLSyntaxFile; 459 #endif 460 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 461 string cfg_tileSets; 434 462 #endif 435 463 #else … … 459 487 ("FrameRate%d,-fr%d", cfg_FrameRate, 0, MAX_LAYERS, "Frame rate for layer %d") 460 488 ("LambdaModifier%d,-LM%d", m_adLambdaModifier, ( double )1.0, MAX_TLAYER, "Lambda modifier for temporal layer %d") 489 #if REPN_FORMAT_IN_VPS 490 ("RepFormatIdx%d", cfg_repFormatIdx, -1, MAX_LAYERS, "Index to the representation format structure used from the VPS") 491 #endif 461 492 #if VPS_EXTN_DIRECT_REF_LAYERS 462 493 #if M0457_PREDICTION_INDICATIONS … … 474 505 ("NumLayers", m_numLayers, 1, "Number of layers to code") 475 506 ("ConformanceMode%d", cfg_conformanceMode,0, MAX_LAYERS, "Window conformance mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping") 507 #if SCALABILITY_MASK_E0104 508 ("ScalabilityMask1", m_scalabilityMask[1], 0, "scalability_mask[1] (multiview)") 509 ("ScalabilityMask2", m_scalabilityMask[2], 1, "scalability_mask[2] (scalable)" ) 510 #else 476 511 ("ScalabilityMask0", m_scalabilityMask[0], 0, "scalability_mask[0] (multiview)") 477 512 ("ScalabilityMask1", m_scalabilityMask[1], 1, "scalability_mask[1] (scalable)" ) 513 #endif 478 514 ("BitstreamFile,b", cfg_BitstreamFile, string(""), "Bitstream output file name") 479 515 ("InputBitDepth", m_inputBitDepthY, 8, "Bit-depth of input file") … … 495 531 " bottom-right luma sample of the EL picture, in units of two luma samples") 496 532 #endif 533 #if N0120_MAX_TID_REF_CFG 534 ("MaxTidRefPresentFlag", m_maxTidRefPresentFlag, true, "max_tid_ref_present_flag (0: not present, 1: present(default)) " ) 535 ("MaxTidIlRefPicsPlus1%d", cfg_maxTidIlRefPicsPlus1, 1, MAX_LAYERS, "allowed maximum temporal_id for inter-layer prediction") 536 #endif 497 537 #if AVC_BASE 498 538 ("AvcBase,-avc", m_avcBaseLayerFlag, 0, "avc_base_layer_flag") … … 502 542 #endif 503 543 #endif 504 #if REF_IDX_FRAMEWORK505 544 ("EnableElRapB,-use-rap-b", m_elRapSliceBEnabled, 0, "Set ILP over base-layer I picture to B picture (default is P picture)") 506 #endif507 545 #if M0457_IL_SAMPLE_PRED_ONLY_FLAG 508 546 ("IlSampleOnlyPred%d", m_ilSampleOnlyPred, 0, MAX_LAYERS, "Set inter_layer_sample_pred_only_flag for all slices") 509 547 #endif 510 #else 548 #else 511 549 ("InputFile,i", cfg_InputFile, string(""), "Original YUV input file name") 512 550 ("BitstreamFile,b", cfg_BitstreamFile, string(""), "Bitstream output file name") … … 530 568 ("FrameRate,-fr", m_iFrameRate, 0, "Frame rate") 531 569 #endif 570 571 //Field coding parameters 572 ("FieldCoding", m_isField, false, "Signals if it's a field based coding") 573 ("TopFieldFirst, Tff", m_isTopFieldFirst, false, "In case of field based coding, signals whether if it's a top field first or not") 532 574 ("FrameSkip,-fs", m_FrameSkip, 0u, "Number of frames to skip at start of input YUV") 533 575 ("FramesToBeEncoded,f", m_framesToBeEncoded, 0, "Number of frames to be encoded (default=all)") … … 810 852 ("AdaptiveResolutionChange", m_adaptiveResolutionChange, 0, "Adaptive resolution change frame number. Should coincide with EL RAP picture. (0: disable)") 811 853 #endif 854 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 855 ("SEIInterLayerConstrainedTileSets", m_interLayerConstrainedTileSetsSEIEnabled, false, "Control generation of inter layer constrained tile sets SEI message") 856 ("IlNumSetsInMessage", m_ilNumSetsInMessage, 0u, "Number of inter layer constrained tile sets") 857 ("TileSetsArray", cfg_tileSets, string(""), "Array containing tile sets params (TopLeftTileIndex, BottonRightTileIndex and ilcIdc for each set) ") 858 #endif 812 859 ; 813 860 … … 827 874 const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv); 828 875 876 if(m_isField) 877 { 878 #if SVC_EXTENSION 879 for(Int layer = 0; layer < MAX_LAYERS; layer++) 880 { 881 //Frame height 882 m_acLayerCfg[layer].m_iSourceHeightOrg = m_acLayerCfg[layer].m_iSourceHeight; 883 //Field height 884 m_acLayerCfg[layer].m_iSourceHeight = m_acLayerCfg[layer].m_iSourceHeight >> 1; 885 } 886 #else 887 //Frame height 888 m_iSourceHeightOrg = m_iSourceHeight; 889 //Field height 890 m_iSourceHeight = m_iSourceHeight >> 1; 891 #endif 892 //number of fields to encode 893 m_framesToBeEncoded *= 2; 894 } 895 829 896 for (list<const Char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++) 830 897 { … … 1119 1186 #endif 1120 1187 m_scalingListFile = cfg_ScalingListFile.empty() ? NULL : strdup(cfg_ScalingListFile.c_str()); 1121 1188 1189 #if REPN_FORMAT_IN_VPS_123 1190 for(Int layer = 0; layer < MAX_LAYERS; layer++) 1191 { 1192 m_acLayerCfg[layer].setSourceHeight( m_repFormatCfg[ m_acLayerCfg[layer].getRepFormatIdx() ].m_picHeightInLumaSamples); 1193 m_acLayerCfg[layer].setSourceWidth ( m_repFormatCfg[ m_acLayerCfg[layer].getRepFormatIdx() ].m_picWidthInLumaSamples ); 1194 } 1195 #endif 1122 1196 /* rules for input, output and internal bitdepths as per help text */ 1123 1197 if (!m_internalBitDepthY) { m_internalBitDepthY = m_inputBitDepthY; } … … 1151 1225 m_aiPad[1] = m_confBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight; 1152 1226 m_iSourceHeight += m_confBottom; 1227 if ( m_isField ) 1228 { 1229 m_iSourceHeightOrg += m_confBottom << 1; 1230 m_aiPad[1] = m_confBottom << 1; 1231 } 1153 1232 } 1154 1233 if (m_aiPad[0] % TComSPS::getWinUnitX(CHROMA_420) != 0) … … 1284 1363 } 1285 1364 } 1365 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 1366 if (m_interLayerConstrainedTileSetsSEIEnabled) 1367 { 1368 if (m_iNumColumnsMinus1 == 0 && m_iNumRowsMinus1 == 0) 1369 { 1370 printf( "Tiles are not defined (needed for inter-layer comnstrained tile sets SEI).\n" ); 1371 exit( EXIT_FAILURE ); 1372 } 1373 Char* pTileSets = cfg_tileSets.empty() ? NULL : strdup(cfg_tileSets.c_str()); 1374 int i = 0; 1375 char *topLeftTileIndex = strtok(pTileSets, " ,"); 1376 while(topLeftTileIndex != NULL) 1377 { 1378 if( i >= m_ilNumSetsInMessage ) 1379 { 1380 printf( "The number of tile sets is larger than defined by IlNumSetsInMessage.\n" ); 1381 exit( EXIT_FAILURE ); 1382 } 1383 *( m_topLeftTileIndex + i ) = atoi( topLeftTileIndex ); 1384 char *bottonRightTileIndex = strtok(NULL, " ,"); 1385 if( bottonRightTileIndex == NULL ) 1386 { 1387 printf( "BottonRightTileIndex is missing in the tile sets.\n" ); 1388 exit( EXIT_FAILURE ); 1389 } 1390 *( m_bottomRightTileIndex + i ) = atoi( bottonRightTileIndex ); 1391 char *ilcIdc = strtok(NULL, " ,"); 1392 if( ilcIdc == NULL ) 1393 { 1394 printf( "IlcIdc is missing in the tile sets.\n" ); 1395 exit( EXIT_FAILURE ); 1396 } 1397 *( m_ilcIdc + i ) = atoi( ilcIdc ); 1398 topLeftTileIndex = strtok(NULL, " ,"); 1399 i++; 1400 } 1401 if( i < m_ilNumSetsInMessage ) 1402 { 1403 printf( "The number of tile sets is smaller than defined by IlNumSetsInMessage.\n" ); 1404 exit( EXIT_FAILURE ); 1405 } 1406 m_skippedTileSetPresentFlag = false; 1407 } 1408 #endif 1286 1409 // check validity of input parameters 1287 1410 xCheckParameter(); … … 1467 1590 #endif 1468 1591 1469 #if !FINAL_RPL_CHANGE_N00821592 #if EXTERNAL_USEDBYCURR_N0082|| !FINAL_RPL_CHANGE_N0082 1470 1593 Bool verifiedGOP=false; 1471 1594 #endif 1472 1595 Bool errorGOP=false; 1473 #if !FINAL_RPL_CHANGE_N00821596 #if EXTERNAL_USEDBYCURR_N0082|| !FINAL_RPL_CHANGE_N0082 1474 1597 Int checkGOP=1; 1475 Int numRefs = 1;1598 Int numRefs = m_isField ? 2 : 1; 1476 1599 #endif 1477 1600 Int refList[MAX_NUM_REF_PICS+1]; 1478 1601 refList[0]=0; 1602 if(m_isField) 1603 { 1604 refList[1] = 1; 1605 } 1479 1606 Bool isOK[MAX_GOP]; 1480 1607 for(Int i=0; i<MAX_GOP; i++) … … 1482 1609 isOK[i]=false; 1483 1610 } 1484 #if !FINAL_RPL_CHANGE_N00821611 #if EXTERNAL_USEDBYCURR_N0082|| !FINAL_RPL_CHANGE_N0082 1485 1612 Int numOK=0; 1486 1613 #endif … … 1504 1631 for(UInt layer=0; layer<m_numLayers; layer++) 1505 1632 { 1506 if(m_acLayerCfg[layer].xCheckParameter( ))1633 if(m_acLayerCfg[layer].xCheckParameter(m_isField)) 1507 1634 { 1508 1635 printf("\nError: invalid configuration parameter found in layer %d \n", layer); … … 1530 1657 for(UInt layer=0; layer<m_numLayers; layer++) 1531 1658 { 1532 if (m_acLayerCfg[layer].m_GOPListLayer[0].m_POC<0){ 1659 if (m_acLayerCfg[layer].m_GOPListLayer[0].m_POC<0) 1660 { 1533 1661 memcpy( m_acLayerCfg[layer].m_GOPListLayer, m_GOPList, sizeof(GOPEntry)*MAX_GOP ); 1534 1662 } … … 1536 1664 xConfirmPara(errorGOP,"Invalid GOP structure given"); 1537 1665 } 1666 #if TEMP_SCALABILITY_FIX 1667 if( m_acLayerCfg[1].m_GOPListLayer[5].m_POC == 6 && m_acLayerCfg[1].m_GOPListLayer[7].m_POC == 7 && 1668 m_acLayerCfg[1].m_GOPListLayer[5].m_temporalId == 0 && m_acLayerCfg[1].m_GOPListLayer[7].m_temporalId == 0) 1669 #else 1538 1670 //tentative for encoder 1539 if( m_acLayerCfg[1].m_GOPListLayer[5].m_POC == 6 && m_acLayerCfg[1].m_GOPListLayer[7].m_POC == 7 ){ 1671 if( m_acLayerCfg[1].m_GOPListLayer[5].m_POC == 6 && m_acLayerCfg[1].m_GOPListLayer[7].m_POC == 7 ) 1672 #endif 1673 { 1540 1674 //RA, POC5 1541 1675 m_acLayerCfg[1].m_GOPListLayer[5].m_usedByCurrPic[2] = 0; … … 1545 1679 m_acLayerCfg[1].m_GOPListLayer[7].m_refIdc[2] = 0; 1546 1680 } 1547 #else 1681 #endif 1682 #if EXTERNAL_USEDBYCURR_N0082|| !FINAL_RPL_CHANGE_N0082 1548 1683 m_extraRPSs=0; 1549 1684 //start looping through frames in coding order until we can verify that the GOP structure is correct. … … 1742 1877 xConfirmPara(errorGOP,"Invalid GOP structure given"); 1743 1878 #endif 1879 #if EXTERNAL_USEDBYCURR_N0082 1880 for(UInt layer=0; layer<m_numLayers; layer++) 1881 { 1882 for (Int i=0; i< m_iGOPSize; i++){ 1883 if (m_acLayerCfg[layer].m_GOPListLayer[i].m_UseExtusedByCurrPic == 1 ) 1884 { 1885 for(Int j=0; j<m_acLayerCfg[layer].m_GOPListLayer[i].m_numRefPics; j++ ) 1886 { 1887 m_acLayerCfg[layer].m_GOPListLayer[i].m_usedByCurrPic[j] = m_acLayerCfg[layer].m_GOPListLayer[i].m_ExtusedByCurrPic[j]; 1888 m_acLayerCfg[layer].m_GOPListLayer[i].m_refIdc[j] = m_acLayerCfg[layer].m_GOPListLayer[i].m_ExtusedByCurrPic[j]; 1889 } 1890 } 1891 } 1892 } 1893 #endif 1744 1894 m_maxTempLayer = 1; 1745 1895 for(Int i=0; i<m_iGOPSize; i++) … … 2045 2195 } 2046 2196 #endif 2197 #if N0120_MAX_TID_REF_CFG 2198 for (UInt layer=0; layer < MAX_LAYERS-1; layer++) 2199 { 2200 xConfirmPara(m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1 < 0 || m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1 > 7, "MaxTidIlRefPicsPlus1 must be in range 0 to 7"); 2201 } 2202 #endif 2047 2203 #undef xConfirmPara 2048 2204 if (check_failed) … … 2081 2237 #if SVC_EXTENSION 2082 2238 printf("Total number of layers : %d\n", m_numLayers ); 2239 #if SCALABILITY_MASK_E0104 2240 printf("Multiview : %d\n", m_scalabilityMask[1] ); 2241 printf("Scalable : %d\n", m_scalabilityMask[2] ); 2242 #else 2083 2243 printf("Multiview : %d\n", m_scalabilityMask[0] ); 2084 2244 printf("Scalable : %d\n", m_scalabilityMask[1] ); 2245 #endif 2085 2246 #if M0040_ADAPTIVE_RESOLUTION_CHANGE 2086 2247 printf("Adaptive Resolution Change : %d\n", m_adaptiveResolutionChange ); … … 2105 2266 printf("Internal Format : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate ); 2106 2267 #endif 2107 printf("Frame index : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded ); 2268 if (m_isField) 2269 { 2270 printf("Frame/Field : Field based coding\n"); 2271 printf("Field index : %u - %d (%d fields)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded ); 2272 if (m_isTopFieldFirst) 2273 { 2274 printf("Field Order : Top field first\n"); 2275 } 2276 else 2277 { 2278 printf("Field Order : Bottom field first\n"); 2279 } 2280 } 2281 else 2282 { 2283 printf("Frame/Field : Frame based coding\n"); 2284 printf("Frame index : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded ); 2285 } 2108 2286 printf("CU size / depth : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth ); 2109 2287 printf("RQT trans. size (min / max) : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize ); … … 2209 2387 printf("AvcBase:%d ", 0); 2210 2388 #endif 2211 #if REF_IDX_FRAMEWORK2212 printf("REF_IDX_FRAMEWORK:%d ", REF_IDX_FRAMEWORK);2213 2389 printf("EL_RAP_SliceType: %d ", m_elRapSliceBEnabled); 2214 2390 printf("REF_IDX_ME_ZEROMV: %d ", REF_IDX_ME_ZEROMV); 2215 2391 printf("ENCODER_FAST_MODE: %d ", ENCODER_FAST_MODE); 2216 2392 printf("REF_IDX_MFM: %d ", REF_IDX_MFM); 2217 #endif2218 2393 #else 2219 2394 printf("RecalQP:%d", m_recalculateQPAccordingToLambda ? 1 : 0 ); -
trunk/source/App/TAppEncoder/TAppEncCfg.h
r345 r442 59 59 // file I/O 60 60 #if SVC_EXTENSION 61 TAppEncLayerCfg m_acLayerCfg [MAX_LAYERS]; 61 TAppEncLayerCfg m_acLayerCfg [MAX_LAYERS]; 62 62 Int m_numLayers; ///< number of layers 63 63 Int m_scalabilityMask[MAX_VPS_NUM_SCALABILITY_TYPES]; ///< scalability_mask … … 68 68 Int m_framesToBeEncoded; ///< number of encoded frames 69 69 #if AVC_BASE 70 Int m_avcBaseLayerFlag; ///< AVC_BASElayer_flag70 Int m_avcBaseLayerFlag; ///< avc_baselayer_flag 71 71 #endif 72 72 #if AVC_SYNTAX … … 76 76 Int m_ilSampleOnlyPred[ MAX_LAYERS ]; 77 77 #endif 78 #if N0120_MAX_TID_REF_CFG 79 Bool m_maxTidRefPresentFlag; 80 #endif 78 81 #else 79 82 Char* m_pchInputFile; ///< source file name … … 85 88 UInt m_FrameSkip; ///< number of skipped frames from the beginning 86 89 Int m_iSourceWidth; ///< source width in pixel 87 Int m_iSourceHeight; ///< source height in pixel 90 Int m_iSourceHeight; ///< source height in pixel (when interlaced = field height) 91 92 Int m_iSourceHeightOrg; ///< original source height in pixel (when interlaced = frame height) 93 94 88 95 Int m_conformanceMode; 89 96 Int m_confLeft; … … 94 101 Int m_aiPad[2]; ///< number of padded pixels for width and height 95 102 #endif 103 104 Bool m_isField; ///< enable field coding 105 Bool m_isTopFieldFirst; 96 106 97 107 // profile/level … … 340 350 Int m_log2MaxMvLengthVertical; ///< Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units 341 351 342 #if REF_IDX_FRAMEWORK352 #if SVC_EXTENSION 343 353 Int m_elRapSliceBEnabled; 344 354 #endif … … 353 363 #if M0040_ADAPTIVE_RESOLUTION_CHANGE 354 364 Int m_adaptiveResolutionChange; ///< Indicate adaptive resolution change frame 365 #endif 366 #if REPN_FORMAT_IN_VPS 367 RepFormatCfg m_repFormatCfg[16]; ///< Rep_format structures 368 #endif 369 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 370 Bool m_interLayerConstrainedTileSetsSEIEnabled; 371 UInt m_ilNumSetsInMessage; 372 Bool m_skippedTileSetPresentFlag; 373 UInt m_topLeftTileIndex[1024]; 374 UInt m_bottomRightTileIndex[1024]; 375 UInt m_ilcIdc[1024]; 355 376 #endif 356 377 public: … … 381 402 Void cfgStringToArray(Int **arr, string cfgString, Int numEntries, const char* logString); 382 403 #endif 404 #if REPN_FORMAT_IN_VPS 405 RepFormatCfg* getRepFormatCfg(Int i) { return &m_repFormatCfg[i]; } 406 #endif 383 407 #endif 384 408 };// END CLASS DEFINITION TAppEncCfg -
trunk/source/App/TAppEncoder/TAppEncLayerCfg.cpp
r313 r442 32 32 m_conformanceMode( 0 ), 33 33 m_aidQP(NULL) 34 #if REPN_FORMAT_IN_VPS 35 , m_repFormatIdx (-1) 36 #endif 34 37 { 35 38 m_confLeft = m_confRight = m_confTop = m_confBottom = 0; … … 158 161 Bool confirmPara(Bool bflag, const char* message); 159 162 160 Bool TAppEncLayerCfg::xCheckParameter( )163 Bool TAppEncLayerCfg::xCheckParameter( Bool isField ) 161 164 { 162 165 switch (m_conformanceMode) … … 182 185 m_aiPad[1] = m_confBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight; 183 186 m_iSourceHeight += m_confBottom; 187 if ( isField ) 188 { 189 m_iSourceHeightOrg += m_confBottom << 1; 190 m_aiPad[1] = m_confBottom << 1; 191 } 184 192 } 185 193 break; -
trunk/source/App/TAppEncoder/TAppEncLayerCfg.h
r345 r442 33 33 Int m_iFrameRate; ///< source frame-rates (Hz) 34 34 Int m_iSourceWidth; ///< source width in pixel 35 Int m_iSourceHeight; ///< source height in pixel 35 Int m_iSourceHeight; ///< source height in pixel (when interlaced = field height) 36 Int m_iSourceHeightOrg; ///< original source height in pixel (when interlaced = frame height) 36 37 Int m_conformanceMode; 37 38 Int m_confLeft; … … 66 67 #endif 67 68 69 #if N0120_MAX_TID_REF_CFG 70 Int m_maxTidIlRefPicsPlus1; 71 #endif 68 72 #if SVC_EXTENSION 69 73 Int m_iWaveFrontSubstreams; //< If iWaveFrontSynchro, this is the number of substreams per frame (dependent tiles) or per tile (independent tiles). … … 84 88 GOPEntry m_GOPListLayer[MAX_GOP]; ///< for layer 85 89 #endif 90 #if REPN_FORMAT_IN_VPS 91 Int m_repFormatIdx; 92 #endif 86 93 public: 87 94 TAppEncLayerCfg(); … … 98 105 Void xPrintParameter(); 99 106 #endif 100 Bool xCheckParameter( );107 Bool xCheckParameter( Bool isField ); 101 108 102 109 Void setAppEncCfg(TAppEncCfg* p) {m_cAppEncCfg = p; } … … 107 114 Int getSourceWidth() {return m_iSourceWidth; } 108 115 Int getSourceHeight() {return m_iSourceHeight; } 116 Int getSourceHeightOrg() {return m_iSourceHeightOrg; } 109 117 Int getConformanceMode() { return m_conformanceMode; } 110 118 Int* getPad() {return m_aiPad; } … … 147 155 GOPEntry getGOPEntry(Int i ) {return m_GOPListLayer[i]; } 148 156 #endif 157 #if REPN_FORMAT_IN_VPS 158 Int getRepFormatIdx() { return m_repFormatIdx; } 159 Void setRepFormatIdx(Int x) { m_repFormatIdx = x; } 160 Void setSourceWidth(Int x) { m_iSourceWidth = x; } 161 Void setSourceHeight(Int x) { m_iSourceHeight = x; } 162 #endif 163 #if N0120_MAX_TID_REF_CFG 164 Int getMaxTidIlRefPicsPlus1() { return m_maxTidIlRefPicsPlus1; } 165 #endif 149 166 }; // END CLASS DEFINITION TAppEncLayerCfg 150 167 -
trunk/source/App/TAppEncoder/TAppEncTop.cpp
r345 r442 90 90 vps->setMaxDecPicBuffering ( m_maxDecPicBuffering[i], i ); 91 91 } 92 92 #if REPN_FORMAT_IN_VPS 93 vps->setRepFormatIdxPresentFlag( true ); // Could be disabled to optimize in some cases. 94 Int maxRepFormatIdx = -1; 95 Int formatIdx = -1; 96 for(UInt layer=0; layer < m_numLayers; layer++) 97 { 98 // Auto generation of the format index 99 if( m_acLayerCfg[layer].getRepFormatIdx() == -1 ) 100 { 101 // Currently only picture width and height are considred. It has to be updated if different chroma format and bit-depth will are used. 102 Bool found = false; 103 for( UInt idx = 0; idx < layer; idx++ ) 104 { 105 if( m_acLayerCfg[layer].getSourceWidth() == m_acLayerCfg[idx].getSourceWidth() && m_acLayerCfg[layer].getSourceHeight() == m_acLayerCfg[idx].getSourceHeight() ) 106 { 107 found = true; 108 break; 109 } 110 } 111 if( !found ) 112 { 113 formatIdx++; 114 } 115 116 m_acLayerCfg[layer].setRepFormatIdx( formatIdx ); 117 } 118 119 assert( m_acLayerCfg[layer].getRepFormatIdx() != -1 && "RepFormatIdx not assigned for a layer" ); 120 vps->setVpsRepFormatIdx( layer, m_acLayerCfg[layer].getRepFormatIdx() ); 121 maxRepFormatIdx = std::max( m_acLayerCfg[layer].getRepFormatIdx(), maxRepFormatIdx ); 122 } 123 assert( vps->getVpsRepFormatIdx( 0 ) == 0 ); // Base layer should point to the first one. 124 Int* mapIdxToLayer = new Int[maxRepFormatIdx + 1]; 125 // Check that all the indices from 0 to maxRepFormatIdx are used in the VPS 126 for(Int i = 0; i <= maxRepFormatIdx; i++) 127 { 128 mapIdxToLayer[i] = -1; 129 UInt layer; 130 for(layer=0; layer < m_numLayers; layer++) 131 { 132 if( vps->getVpsRepFormatIdx(layer) == i ) 133 { 134 mapIdxToLayer[i] = layer; 135 break; 136 } 137 } 138 assert( layer != m_numLayers ); // One of the VPS Rep format indices not set 139 } 140 vps->setVpsNumRepFormats( maxRepFormatIdx + 1 ); 141 for(UInt idx=0; idx < vps->getVpsNumRepFormats(); idx++) 142 { 143 RepFormat *repFormat = vps->getVpsRepFormat( idx ); 144 repFormat->setPicWidthVpsInLumaSamples ( m_acLayerCfg[mapIdxToLayer[idx]].getSourceWidth() ); 145 repFormat->setPicHeightVpsInLumaSamples ( m_acLayerCfg[mapIdxToLayer[idx]].getSourceHeight() ); 146 repFormat->setChromaFormatVpsIdc ( 1 ); // Need modification to change for each layer - corresponds to 420 147 repFormat->setSeparateColourPlaneVpsFlag( 0 ); // Need modification to change for each layer 148 repFormat->setBitDepthVpsLuma ( getInternalBitDepthY() ); // Need modification to change for each layer 149 repFormat->setBitDepthVpsChroma ( getInternalBitDepthC() ); // Need modification to change for each layer 150 } 151 delete [] mapIdxToLayer; 152 #endif 93 153 for(UInt layer=0; layer<m_numLayers; layer++) 94 154 { … … 157 217 m_acTEncTop[layer].setMaxTempLayer ( m_maxTempLayer ); 158 218 m_acTEncTop[layer].setUseAMP( m_enableAMP ); 219 #if N0120_MAX_TID_REF_CFG 220 if (layer<m_numLayers-1) 221 { 222 m_acTEncTop[layer].setMaxTidIlRefPicsPlus1 ( m_acLayerCfg[layer].getMaxTidIlRefPicsPlus1()); 223 } 224 #endif 159 225 #if VPS_EXTN_DIRECT_REF_LAYERS 160 226 if(layer) … … 195 261 { 196 262 m_acTEncTop[layer].setMotionPredRefLayerId ( i, m_acLayerCfg[layer].getMotionPredRefLayerId(i)); 197 m_acTEncTop[layer].setMotionPredEnabledFlag (m_acLayerCfg[layer].get SamplePredRefLayerId(i), true);263 m_acTEncTop[layer].setMotionPredEnabledFlag (m_acLayerCfg[layer].getMotionPredRefLayerId(i), true); 198 264 } 199 265 } … … 397 463 m_acTEncTop[layer].setSOPDescriptionSEIEnabled( m_SOPDescriptionSEIEnabled ); 398 464 m_acTEncTop[layer].setScalableNestingSEIEnabled( m_scalableNestingSEIEnabled ); 465 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 466 m_acTEncTop[layer].setInterLayerConstrainedTileSetsSEIEnabled( m_interLayerConstrainedTileSetsSEIEnabled ); 467 m_acTEncTop[layer].setIlNumSetsInMessage( m_ilNumSetsInMessage ); 468 m_acTEncTop[layer].setSkippedTileSetPresentFlag( m_skippedTileSetPresentFlag ); 469 m_acTEncTop[layer].setTopLeftTileIndex( m_topLeftTileIndex ); 470 m_acTEncTop[layer].setBottomRightTileIndex( m_bottomRightTileIndex ); 471 m_acTEncTop[layer].setIlcIdc( m_ilcIdc ); 472 #endif 399 473 m_acTEncTop[layer].setUniformSpacingIdr ( m_iUniformSpacingIdr ); 400 474 m_acTEncTop[layer].setNumColumnsMinus1 ( m_iNumColumnsMinus1 ); … … 475 549 m_acTEncTop[layer].setLog2MaxMvLengthHorizontal( m_log2MaxMvLengthHorizontal ); 476 550 m_acTEncTop[layer].setLog2MaxMvLengthVertical( m_log2MaxMvLengthVertical ); 477 #if REF_IDX_FRAMEWORK478 551 m_acTEncTop[layer].setElRapSliceTypeB(layer == 0? 0 : m_elRapSliceBEnabled); 479 #endif480 552 #if SCALED_REF_LAYER_OFFSETS 481 553 if( layer > 0 ) … … 824 896 } 825 897 826 Void TAppEncTop::xInitLib( )898 Void TAppEncTop::xInitLib(Bool isFieldCoding) 827 899 { 828 900 #if SVC_EXTENSION 829 901 for(UInt layer=0; layer<m_numLayers; layer++) 830 902 { 831 m_acTEncTop[layer].init( );903 m_acTEncTop[layer].init(isFieldCoding); 832 904 } 833 905 #if VPS_RENAME … … 889 961 #endif 890 962 #if N0120_MAX_TID_REF_PRESENT_FLAG 891 vps->setMaxTidIlRefPicsPlus1PresentFlag(true); 892 if (vps->getMaxTidIlRefPicsPlus1PresentFlag()) 963 #if N0120_MAX_TID_REF_CFG 964 vps->setMaxTidRefPresentFlag(m_maxTidRefPresentFlag); 965 #else 966 vps->setMaxTidRefPresentFlag(true); 967 #endif 968 if (vps->getMaxTidRefPresentFlag()) 893 969 { 894 970 for( i = 0; i < MAX_VPS_LAYER_ID_PLUS1 - 1; i++ ) 895 971 { 896 vps->setMaxSublayerForIlpPlus1(i, vps->getMaxTLayers()+1); 972 #if N0120_MAX_TID_REF_CFG 973 vps->setMaxTidIlRefPicsPlus1(i, m_acTEncTop[i].getMaxTidIlRefPicsPlus1()); 974 #else 975 vps->setMaxTidIlRefPicsPlus1(i, vps->getMaxTLayers()+1); 976 #endif 897 977 } 898 978 } … … 901 981 for( i = 0; i < MAX_VPS_LAYER_ID_PLUS1 - 1; i++ ) 902 982 { 903 vps->setMax SublayerForIlpPlus1(i, 7);983 vps->setMaxTidIlRefPicsPlus1(i, 7); 904 984 } 905 985 } … … 983 1063 #endif 984 1064 } 1065 #if IL_SL_SIGNALLING_N0371 1066 for(i = 1; i < vps->getMaxLayers(); i++) 1067 { 1068 for(Int j = 0; j < i; j++) 1069 { 1070 vps->setScalingListLayerDependency( i, j, vps->checkLayerDependency( i,j ) ); 1071 } 1072 } 1073 #endif 985 1074 #endif 986 1075 #if JCTVC_M0458_INTERLAYER_RPS_SIG 987 1076 vps->setMaxOneActiveRefLayerFlag(maxDirectRefLayers > 1 ? false : true); 988 1077 #endif 1078 #if N0147_IRAP_ALIGN_FLAG 1079 vps->setCrossLayerIrapAlignFlag(true); 1080 for(UInt layerCtr = 1;layerCtr <= vps->getMaxLayers() - 1; layerCtr++) 1081 { 1082 for(Int refLayerCtr = 0; refLayerCtr < layerCtr; refLayerCtr++) 1083 { 1084 if (vps->getDirectDependencyFlag( layerCtr, refLayerCtr)) 1085 { 1086 if(m_acTEncTop[layerCtr].getIntraPeriod() != m_acTEncTop[refLayerCtr].getIntraPeriod()) 1087 { 1088 vps->setCrossLayerIrapAlignFlag(false); 1089 break; 1090 } 1091 } 1092 } 1093 } 1094 1095 if( vps->getAvcBaseLayerFlag() ) 1096 { 1097 vps->setCrossLayerIrapAlignFlag(false); 1098 } 1099 #endif 989 1100 #if M0040_ADAPTIVE_RESOLUTION_CHANGE 990 1101 vps->setSingleLayerForNonIrapFlag(m_adaptiveResolutionChange > 0 ? true : false); 991 1102 #endif 992 #else 993 m_cTEncTop.init(); 994 #endif 1103 #if VPS_EXTN_OFFSET 1104 // to be updated according to the current semantics 1105 vps->setExtensionOffset( 0xffff ); 1106 #endif 1107 #else //SVC_EXTENSION 1108 m_cTEncTop.init(isFieldCoding); 1109 #endif //SVC_EXTENSION 995 1110 } 996 1111 … … 1023 1138 xInitLibCfg(); 1024 1139 xCreateLib(); 1025 xInitLib( );1140 xInitLib(m_isField); 1026 1141 1027 1142 // main encoder loop … … 1035 1150 // allocate original YUV buffer 1036 1151 pcPicYuvOrg[layer] = new TComPicYuv; 1152 if( m_isField ) 1153 { 1037 1154 #if SVC_UPSAMPLING 1038 pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL ); 1039 #else 1040 pcPicYuvOrg->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 1041 #endif 1155 pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL ); 1156 #else 1157 pcPicYuvOrg->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 1158 #endif 1159 } 1160 else 1161 { 1162 #if SVC_UPSAMPLING 1163 pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL ); 1164 #else 1165 pcPicYuvOrg->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 1166 #endif 1167 } 1042 1168 } 1043 1169 … … 1081 1207 m_iFrameRcvd++; 1082 1208 // check end of file 1083 bEos = (m_i FrameRcvd == m_framesToBeEncoded);1209 bEos = (m_isField && (m_iFrameRcvd == (m_framesToBeEncoded >> 1) )) || ( !m_isField && (m_iFrameRcvd == m_framesToBeEncoded) ); 1084 1210 } 1085 1211 1086 m_acTEncTop[layer].encodePrep( pcPicYuvOrg[layer] ); 1212 if ( m_isField ) 1213 { 1214 m_acTEncTop[layer].encodePrep( pcPicYuvOrg[layer], m_isTopFieldFirst ); 1215 } 1216 else 1217 { 1218 m_acTEncTop[layer].encodePrep( pcPicYuvOrg[layer] ); 1219 } 1087 1220 } 1088 1221 … … 1131 1264 { 1132 1265 // call encoding function for one frame 1133 m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP ); 1266 if ( m_isField ) 1267 { 1268 m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP, m_isTopFieldFirst ); 1269 } 1270 else 1271 { 1272 m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP ); 1273 } 1134 1274 } 1135 1275 } … … 1168 1308 if (bEos) 1169 1309 { 1170 printOutSummary( );1310 printOutSummary(m_isTopFieldFirst); 1171 1311 } 1172 1312 … … 1200 1340 } 1201 1341 1202 Void TAppEncTop::printOutSummary( )1342 Void TAppEncTop::printOutSummary(Bool isField) 1203 1343 { 1204 1344 UInt layer; … … 1207 1347 for(layer = 0; layer < m_numLayers; layer++) 1208 1348 { 1209 m_gcAnalyzeAll[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate()); 1210 m_gcAnalyzeI[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() ); 1211 m_gcAnalyzeP[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() ); 1212 m_gcAnalyzeB[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() ); 1349 if(isField) 1350 { 1351 m_gcAnalyzeAll[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() * 2); 1352 m_gcAnalyzeI[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() * 2 ); 1353 m_gcAnalyzeP[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() * 2 ); 1354 m_gcAnalyzeB[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() * 2 ); 1355 } 1356 else 1357 { 1358 m_gcAnalyzeAll[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate()); 1359 m_gcAnalyzeI[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() ); 1360 m_gcAnalyzeP[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() ); 1361 m_gcAnalyzeB[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() ); 1362 } 1213 1363 } 1214 1364 … … 1241 1391 m_gcAnalyzeB[layer].printOut('b', layer); 1242 1392 } 1393 1394 if(isField) 1395 { 1396 for(layer = 0; layer < m_numLayers; layer++) 1397 { 1398 //-- interlaced summary 1399 m_gcAnalyzeAll_in.setFrmRate( m_acLayerCfg[layer].getFrameRate()); 1400 printf( "\n\nSUMMARY INTERLACED ---------------------------------------------\n" ); 1401 m_gcAnalyzeAll_in.printOutInterlaced('a', m_gcAnalyzeAll[layer].getBits()); 1402 1403 #if _SUMMARY_OUT_ 1404 m_gcAnalyzeAll_in.printSummaryOutInterlaced(); 1405 #endif 1406 } 1407 } 1243 1408 } 1244 1409 … … 1259 1424 xInitLibCfg(); 1260 1425 xCreateLib(); 1261 xInitLib( );1426 xInitLib(m_isField); 1262 1427 1263 1428 // main encoder loop … … 1268 1433 1269 1434 // allocate original YUV buffer 1270 pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 1435 if( m_isField ) 1436 { 1437 pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeightOrg, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 1438 } 1439 else 1440 { 1441 pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 1442 } 1271 1443 1272 1444 while ( !bEos ) … … 1281 1453 m_iFrameRcvd++; 1282 1454 1283 bEos = (m_iFrameRcvd == m_framesToBeEncoded); 1284 1455 bEos = (m_isField && (m_iFrameRcvd == (m_framesToBeEncoded >> 1) )) || ( !m_isField && (m_iFrameRcvd == m_framesToBeEncoded) ); 1285 1456 Bool flush = 0; 1286 1457 // if end of file (which is only detected on a read failure) flush the encoder of any queued pictures … … 1294 1465 1295 1466 // call encoding function for one frame 1467 if ( m_isField ) 1468 { 1469 m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, m_cListPicYuvRec, outputAccessUnits, iNumEncoded, m_isTopFieldFirst); 1470 } 1471 else 1472 { 1296 1473 m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, m_cListPicYuvRec, outputAccessUnits, iNumEncoded ); 1474 } 1297 1475 1298 1476 // write bistream to file if necessary … … 1304 1482 } 1305 1483 1306 m_cTEncTop.printSummary( );1484 m_cTEncTop.printSummary(m_isField); 1307 1485 1308 1486 // delete original YUV buffer … … 1378 1556 Void TAppEncTop::xWriteRecon(UInt layer, Int iNumEncoded) 1379 1557 { 1380 Int i; 1381 1382 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_acListPicYuvRec[layer].end(); 1383 1384 for ( i = 0; i < iNumEncoded; i++ ) 1385 { 1386 --iterPicYuvRec; 1387 } 1388 1389 for ( i = 0; i < iNumEncoded; i++ ) 1390 { 1391 TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); 1558 if (m_isField) 1559 { 1560 //Reinterlace fields 1561 Int i; 1562 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_acListPicYuvRec[layer].end(); 1563 1564 for ( i = 0; i < iNumEncoded; i++ ) 1565 { 1566 --iterPicYuvRec; 1567 } 1568 1569 for ( i = 0; i < iNumEncoded/2; i++ ) 1570 { 1571 TComPicYuv* pcPicYuvRecTop = *(iterPicYuvRec++); 1572 TComPicYuv* pcPicYuvRecBottom = *(iterPicYuvRec++); 1573 1392 1574 #if M0040_ADAPTIVE_RESOLUTION_CHANGE 1393 if (!m_acLayerCfg[layer].getReconFile().empty() && pcPicYuvRec->isReconstructed()) 1394 #else 1395 if (!m_acLayerCfg[layer].getReconFile().empty()) 1396 #endif 1397 { 1398 m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getConfLeft(), m_acLayerCfg[layer].getConfRight(), 1399 m_acLayerCfg[layer].getConfTop(), m_acLayerCfg[layer].getConfBottom() ); 1575 if (!m_acLayerCfg[layer].getReconFile().empty() && pcPicYuvRecTop->isReconstructed() && pcPicYuvRecBottom->isReconstructed()) 1576 #else 1577 if (!m_acLayerCfg[layer].getReconFile().empty()) 1578 #endif 1579 { 1580 m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRecTop, pcPicYuvRecBottom, m_acLayerCfg[layer].getConfLeft(), m_acLayerCfg[layer].getConfRight(), m_acLayerCfg[layer].getConfTop(), m_acLayerCfg[layer].getConfBottom(), m_isTopFieldFirst ); 1581 } 1582 } 1583 } 1584 else 1585 { 1586 Int i; 1587 1588 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_acListPicYuvRec[layer].end(); 1589 1590 for ( i = 0; i < iNumEncoded; i++ ) 1591 { 1592 --iterPicYuvRec; 1593 } 1594 1595 for ( i = 0; i < iNumEncoded; i++ ) 1596 { 1597 TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); 1598 #if M0040_ADAPTIVE_RESOLUTION_CHANGE 1599 if (!m_acLayerCfg[layer].getReconFile().empty() && pcPicYuvRec->isReconstructed()) 1600 #else 1601 if (!m_acLayerCfg[layer].getReconFile().empty()) 1602 #endif 1603 { 1604 m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getConfLeft(), m_acLayerCfg[layer].getConfRight(), 1605 m_acLayerCfg[layer].getConfTop(), m_acLayerCfg[layer].getConfBottom() ); 1606 } 1400 1607 } 1401 1608 } … … 1404 1611 Void TAppEncTop::xWriteStream(std::ostream& bitstreamFile, Int iNumEncoded, const std::list<AccessUnit>& accessUnits) 1405 1612 { 1406 Int i; 1407 1408 list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin(); 1613 if (m_isField) 1614 { 1615 //Reinterlace fields 1616 Int i; 1617 list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin(); 1409 1618 1410 1619 #if M0040_ADAPTIVE_RESOLUTION_CHANGE 1411 for ( i = 0; i < iNumEncoded && iterBitstream != accessUnits.end(); i++ ) 1412 #else 1413 for ( i = 0; i < iNumEncoded; i++ ) 1414 #endif 1415 { 1416 const AccessUnit& au = *(iterBitstream++); 1417 const vector<UInt>& stats = writeAnnexB(bitstreamFile, au); 1418 rateStatsAccum(au, stats); 1620 for ( i = 0; i < iNumEncoded/2 && iterBitstream != accessUnits.end(); i++ ) 1621 #else 1622 for ( i = 0; i < iNumEncoded/2; i++ ) 1623 #endif 1624 { 1625 const AccessUnit& auTop = *(iterBitstream++); 1626 const vector<UInt>& statsTop = writeAnnexB(bitstreamFile, auTop); 1627 rateStatsAccum(auTop, statsTop); 1628 1629 const AccessUnit& auBottom = *(iterBitstream++); 1630 const vector<UInt>& statsBottom = writeAnnexB(bitstreamFile, auBottom); 1631 rateStatsAccum(auBottom, statsBottom); 1632 } 1633 } 1634 else 1635 { 1636 Int i; 1637 1638 list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin(); 1639 1640 #if M0040_ADAPTIVE_RESOLUTION_CHANGE 1641 for ( i = 0; i < iNumEncoded && iterBitstream != accessUnits.end(); i++ ) 1642 #else 1643 for ( i = 0; i < iNumEncoded; i++ ) 1644 #endif 1645 { 1646 const AccessUnit& au = *(iterBitstream++); 1647 const vector<UInt>& stats = writeAnnexB(bitstreamFile, au); 1648 rateStatsAccum(au, stats); 1649 } 1419 1650 } 1420 1651 } … … 1460 1691 Void TAppEncTop::xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, const std::list<AccessUnit>& accessUnits) 1461 1692 { 1462 Int i; 1463 1464 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.end(); 1465 list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin(); 1466 1467 for ( i = 0; i < iNumEncoded; i++ ) 1468 { 1469 --iterPicYuvRec; 1470 } 1471 1472 for ( i = 0; i < iNumEncoded; i++ ) 1473 { 1474 TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); 1475 if (m_pchReconFile) 1476 { 1477 #if SYNTAX_OUTPUT && ILP_DECODED_PICTURE 1478 m_cTVideoIOYuvReconFile.write( pcPicYuvRec ); 1479 #else 1480 m_cTVideoIOYuvReconFile.write( pcPicYuvRec, m_confLeft, m_confRight, m_confTop, m_confBottom ); 1481 #endif 1482 } 1483 1484 const AccessUnit& au = *(iterBitstream++); 1485 const vector<UInt>& stats = writeAnnexB(bitstreamFile, au); 1486 rateStatsAccum(au, stats); 1693 if (m_isField) 1694 { 1695 //Reinterlace fields 1696 Int i; 1697 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.end(); 1698 list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin(); 1699 1700 for ( i = 0; i < iNumEncoded; i++ ) 1701 { 1702 --iterPicYuvRec; 1703 } 1704 1705 for ( i = 0; i < iNumEncoded/2; i++ ) 1706 { 1707 TComPicYuv* pcPicYuvRecTop = *(iterPicYuvRec++); 1708 TComPicYuv* pcPicYuvRecBottom = *(iterPicYuvRec++); 1709 1710 if (m_pchReconFile) 1711 { 1712 m_cTVideoIOYuvReconFile.write( pcPicYuvRecTop, pcPicYuvRecBottom, m_confLeft, m_confRight, m_confTop, m_confBottom, m_isTopFieldFirst ); 1713 } 1714 1715 const AccessUnit& auTop = *(iterBitstream++); 1716 const vector<UInt>& statsTop = writeAnnexB(bitstreamFile, auTop); 1717 rateStatsAccum(auTop, statsTop); 1718 1719 const AccessUnit& auBottom = *(iterBitstream++); 1720 const vector<UInt>& statsBottom = writeAnnexB(bitstreamFile, auBottom); 1721 rateStatsAccum(auBottom, statsBottom); 1722 } 1723 } 1724 else 1725 { 1726 Int i; 1727 1728 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.end(); 1729 list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin(); 1730 1731 for ( i = 0; i < iNumEncoded; i++ ) 1732 { 1733 --iterPicYuvRec; 1734 } 1735 1736 for ( i = 0; i < iNumEncoded; i++ ) 1737 { 1738 TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); 1739 if (m_pchReconFile) 1740 { 1741 #if SYNTAX_OUTPUT 1742 m_cTVideoIOYuvReconFile.write( pcPicYuvRec, m_confLeft, m_confRight, m_confTop, m_confBottom ); 1743 #endif 1744 } 1745 1746 const AccessUnit& au = *(iterBitstream++); 1747 const vector<UInt>& stats = writeAnnexB(bitstreamFile, au); 1748 rateStatsAccum(au, stats); 1749 } 1487 1750 } 1488 1751 } -
trunk/source/App/TAppEncoder/TAppEncTop.h
r313 r442 82 82 Void xCreateLib (); ///< create files & encoder class 83 83 Void xInitLibCfg (); ///< initialize internal variables 84 Void xInitLib ( );///< initialize encoder class84 Void xInitLib (Bool isFieldCoding); ///< initialize encoder class 85 85 Void xDestroyLib (); ///< destroy encoder class 86 86 … … 99 99 Void xWriteRecon(UInt layer, Int iNumEncoded); 100 100 Void xWriteStream(std::ostream& bitstreamFile, Int iNumEncoded, const std::list<AccessUnit>& accessUnits); 101 Void printOutSummary( );101 Void printOutSummary(Bool isField); 102 102 #else 103 103 Void xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, const std::list<AccessUnit>& accessUnits); ///< write bitstream to file
Note: See TracChangeset for help on using the changeset viewer.