Changeset 431 in SHVCSoftware for branches/SHM-3.1-dev/source/App
- Timestamp:
- 11 Oct 2013, 05:54:02 (11 years ago)
- Location:
- branches/SHM-3.1-dev/source/App
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-3.1-dev/source/App/TAppDecoder/TAppDecTop.cpp
r389 r431 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 } … … 235 233 if( pcListPic ) 236 234 { 237 if ( m_pchReconFile[curLayerId] && ! recon_opened[curLayerId] )235 if ( m_pchReconFile[curLayerId] && !openedReconFile[curLayerId] ) 238 236 { 239 237 if (!m_outputBitDepthY) { m_outputBitDepthY = g_bitDepthY; } … … 242 240 m_acTVideoIOYuvReconFile[curLayerId].open( m_pchReconFile[curLayerId], true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode 243 241 244 recon_opened[curLayerId] = true;242 openedReconFile[curLayerId] = true; 245 243 } 246 244 if ( bNewPicture && bNewPOC && … … 278 276 pcBLPic.destroy(); 279 277 280 for(UInt layer = 1; layer <= m_tgtLayerId; layer++) 278 UInt layerIdmin = m_acTDecTop[0].getBLReconFile() == NULL ? 0 : 1; 279 280 for(UInt layer = layerIdmin; layer <= m_tgtLayerId; layer++) 281 281 #else 282 282 for(UInt layer = 0; layer <= m_tgtLayerId; layer++) … … 310 310 311 311 // main decoder loop 312 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) 313 313 314 314 #if SYNTAX_OUTPUT … … 341 341 streampos location = bitstreamFile.tellg(); 342 342 AnnexBStats stats = AnnexBStats(); 343 Bool bPreviousPictureDecoded = false;344 343 345 344 vector<uint8_t> nalUnit; … … 363 362 if( (m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer) || !isNaluWithinTargetDecLayerIdSet(&nalu) ) 364 363 { 365 if(bPreviousPictureDecoded)366 {367 bNewPicture = true;368 bPreviousPictureDecoded = false;369 }370 else371 {372 364 bNewPicture = false; 373 365 } 374 }375 366 else 376 367 { … … 386 377 bytestream.reset(); 387 378 } 388 bPreviousPictureDecoded = true;389 379 } 390 380 } … … 396 386 if( pcListPic ) 397 387 { 398 if ( m_pchReconFile && ! recon_opened)388 if ( m_pchReconFile && !openedReconFile ) 399 389 { 400 390 if (!m_outputBitDepthY) { m_outputBitDepthY = g_bitDepthY; } … … 402 392 403 393 m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode 404 recon_opened= true;394 openedReconFile = true; 405 395 } 406 396 if ( bNewPicture && … … 508 498 509 499 /** \param pcListPic list of pictures to be written to file 510 511 500 \todo DYN_REF_FREE should be revised 501 */ 512 502 #if SVC_EXTENSION 513 503 Void TAppDecTop::xWriteOutput( TComList<TComPic*>* pcListPic, UInt layerId, UInt tId ) … … 517 507 { 518 508 TComList<TComPic*>::iterator iterPic = pcListPic->begin(); 519 Int n ot_displayed = 0;509 Int numPicsNotYetDisplayed = 0; 520 510 521 511 while (iterPic != pcListPic->end()) … … 528 518 #endif 529 519 { 530 not_displayed++;520 numPicsNotYetDisplayed++; 531 521 } 532 522 iterPic++; 533 523 } 534 524 iterPic = pcListPic->begin(); 535 536 while (iterPic != pcListPic->end()) 537 { 538 TComPic* pcPic = *(iterPic); 539 540 #if SVC_EXTENSION 541 if ( pcPic->getOutputMark() && (not_displayed > pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_aiPOCLastDisplay[layerId])) 542 #else 543 if ( pcPic->getOutputMark() && (not_displayed > pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_iPOCLastDisplay)) 544 #endif 545 { 546 // write to file 547 not_displayed--; 548 #if SVC_EXTENSION 549 if ( m_pchReconFile[layerId] ) 550 { 551 const Window &conf = pcPic->getConformanceWindow(); 552 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 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(); 553 558 #if REPN_FORMAT_IN_VPS 554 UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc(); 555 Int xScal = TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc ); 556 m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(), 557 conf.getWindowLeftOffset() * xScal + defDisp.getWindowLeftOffset(), 558 conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(), 559 conf.getWindowTopOffset() * yScal + defDisp.getWindowTopOffset(), 560 conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset() ); 561 562 #else 563 m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(), 564 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 565 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 566 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 567 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() ); 568 #endif 569 } 570 571 // update POC of display order 572 m_aiPOCLastDisplay[layerId] = pcPic->getPOC(); 573 #else 574 if ( m_pchReconFile ) 575 { 559 UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc(); 560 Int xScal = TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc ); 561 m_acTVideoIOYuvReconFile[layerId].write( pcPic->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() ); 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 { 598 #if !DYN_REF_FREE 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 { 576 674 #if SYNTAX_OUTPUT 577 const Window &conf = pcPic->getConformanceWindow();578 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();579 m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),580 581 582 583 584 #endif 585 }586 587 // update POC of display order588 m_iPOCLastDisplay = pcPic->getPOC();589 #endif 590 591 // erase non-referenced picture in the reference picture list after display592 if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true )593 {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 { 594 692 #if !DYN_REF_FREE 595 pcPic->setReconMark(false); 596 597 // mark it should be extended later 598 pcPic->getPicYuvRec()->setBorderExtension( false ); 599 600 #else 601 pcPic->destroy(); 602 pcListPic->erase( iterPic ); 603 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised! 604 continue; 605 #endif 606 } 607 pcPic->setOutputMark(false); 608 } 609 610 iterPic++; 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 } 611 710 } 612 711 } … … 628 727 629 728 iterPic = pcListPic->begin(); 630 631 while (iterPic != pcListPic->end()) 632 { 633 TComPic* pcPic = *(iterPic); 634 635 if ( pcPic->getOutputMark() ) 636 { 637 // write to file 638 #if SVC_EXTENSION 639 if ( m_pchReconFile[layerId] ) 640 { 641 const Window &conf = pcPic->getConformanceWindow(); 642 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 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(); 643 751 #if REPN_FORMAT_IN_VPS 644 UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc(); 645 Int xScal = TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc ); 646 m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(), 647 conf.getWindowLeftOffset() *xScal + defDisp.getWindowLeftOffset(), 648 conf.getWindowRightOffset() *xScal + defDisp.getWindowRightOffset(), 649 conf.getWindowTopOffset() *yScal + defDisp.getWindowTopOffset(), 650 conf.getWindowBottomOffset()*yScal + defDisp.getWindowBottomOffset() ); 651 652 #else 653 m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(), 654 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 655 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 656 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 657 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() ); 658 #endif 659 } 660 661 // update POC of display order 662 m_aiPOCLastDisplay[layerId] = pcPic->getPOC(); 663 #else 664 if ( m_pchReconFile ) 665 { 666 const Window &conf = pcPic->getConformanceWindow(); 667 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 668 m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(), 669 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 670 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 671 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 672 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() ); 673 } 674 675 // update POC of display order 676 m_iPOCLastDisplay = pcPic->getPOC(); 677 #endif 678 679 // erase non-referenced picture in the reference picture list after display 680 if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true ) 681 { 752 UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc(); 753 Int xScal = TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc ); 754 m_acTVideoIOYuvReconFile[layerId].write( pcPic->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() ); 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 { 682 791 #if !DYN_REF_FREE 683 pcPic->setReconMark(false); 684 685 // mark it should be extended later 686 pcPic->getPicYuvRec()->setBorderExtension( false ); 687 688 #else 689 pcPic->destroy(); 690 pcListPic->erase( iterPic ); 691 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised! 692 continue; 693 #endif 694 } 695 pcPic->setOutputMark(false); 696 } 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 } 697 907 #if !SVC_EXTENSION 698 908 #if !DYN_REF_FREE 699 if(pcPic)700 {701 pcPic->destroy();702 delete pcPic;703 pcPic = NULL;704 }909 if(pcPic) 910 { 911 pcPic->destroy(); 912 delete pcPic; 913 pcPic = NULL; 914 } 705 915 #endif 706 916 #endif 707 iterPic++; 917 iterPic++; 918 } 708 919 } 709 920 #if SVC_EXTENSION -
branches/SHM-3.1-dev/source/App/TAppDecoder/TAppDecTop.h
r313 r431 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 -
branches/SHM-3.1-dev/source/App/TAppEncoder/TAppEncCfg.cpp
r405 r431 348 348 349 349 #if SVC_EXTENSION 350 string cfg_LayerCfgFile [MAX_LAYERS];350 string cfg_LayerCfgFile [MAX_LAYERS]; 351 351 string cfg_BitstreamFile; 352 string* cfg_InputFile [MAX_LAYERS];353 string* cfg_ReconFile [MAX_LAYERS];354 Double* cfg_fQP [MAX_LAYERS];352 string* cfg_InputFile [MAX_LAYERS]; 353 string* cfg_ReconFile [MAX_LAYERS]; 354 Double* cfg_fQP [MAX_LAYERS]; 355 355 356 356 #if REPN_FORMAT_IN_VPS … … 565 565 ("FrameRate,-fr", m_iFrameRate, 0, "Frame rate") 566 566 #endif 567 568 //Field coding parameters 569 ("FieldCoding", m_isField, false, "Signals if it's a field based coding") 570 ("TopFieldFirst, Tff", m_isTopFieldFirst, false, "In case of field based coding, signals whether if it's a top field first or not") 567 571 ("FrameSkip,-fs", m_FrameSkip, 0u, "Number of frames to skip at start of input YUV") 568 572 ("FramesToBeEncoded,f", m_framesToBeEncoded, 0, "Number of frames to be encoded (default=all)") … … 862 866 const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv); 863 867 868 if(m_isField) 869 { 870 #if SVC_EXTENSION 871 for(Int layer = 0; layer < MAX_LAYERS; layer++) 872 { 873 //Frame height 874 m_acLayerCfg[layer].m_iSourceHeightOrg = m_acLayerCfg[layer].m_iSourceHeight; 875 //Field height 876 m_acLayerCfg[layer].m_iSourceHeight = m_acLayerCfg[layer].m_iSourceHeight >> 1; 877 } 878 #else 879 //Frame height 880 m_iSourceHeightOrg = m_iSourceHeight; 881 //Field height 882 m_iSourceHeight = m_iSourceHeight >> 1; 883 #endif 884 //number of fields to encode 885 m_framesToBeEncoded *= 2; 886 } 887 864 888 for (list<const Char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++) 865 889 { … … 1193 1217 m_aiPad[1] = m_confBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight; 1194 1218 m_iSourceHeight += m_confBottom; 1219 if ( m_isField ) 1220 { 1221 m_iSourceHeightOrg += m_confBottom << 1; 1222 m_aiPad[1] = m_confBottom << 1; 1223 } 1195 1224 } 1196 1225 if (m_aiPad[0] % TComSPS::getWinUnitX(CHROMA_420) != 0) … … 1515 1544 #if EXTERNAL_USEDBYCURR_N0082|| !FINAL_RPL_CHANGE_N0082 1516 1545 Int checkGOP=1; 1517 Int numRefs = 1;1546 Int numRefs = m_isField ? 2 : 1; 1518 1547 #endif 1519 1548 Int refList[MAX_NUM_REF_PICS+1]; 1520 1549 refList[0]=0; 1550 if(m_isField) 1551 { 1552 refList[1] = 1; 1553 } 1521 1554 Bool isOK[MAX_GOP]; 1522 1555 for(Int i=0; i<MAX_GOP; i++) … … 1546 1579 for(UInt layer=0; layer<m_numLayers; layer++) 1547 1580 { 1548 if(m_acLayerCfg[layer].xCheckParameter( ))1581 if(m_acLayerCfg[layer].xCheckParameter(m_isField)) 1549 1582 { 1550 1583 printf("\nError: invalid configuration parameter found in layer %d \n", layer); … … 2181 2214 printf("Internal Format : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate ); 2182 2215 #endif 2183 printf("Frame index : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded ); 2216 if (m_isField) 2217 { 2218 printf("Frame/Field : Field based coding\n"); 2219 printf("Field index : %u - %d (%d fields)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded ); 2220 if (m_isTopFieldFirst) 2221 { 2222 printf("Field Order : Top field first\n"); 2223 } 2224 else 2225 { 2226 printf("Field Order : Bottom field first\n"); 2227 } 2228 } 2229 else 2230 { 2231 printf("Frame/Field : Frame based coding\n"); 2232 printf("Frame index : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded ); 2233 } 2184 2234 printf("CU size / depth : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth ); 2185 2235 printf("RQT trans. size (min / max) : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize ); -
branches/SHM-3.1-dev/source/App/TAppEncoder/TAppEncCfg.h
r402 r431 88 88 UInt m_FrameSkip; ///< number of skipped frames from the beginning 89 89 Int m_iSourceWidth; ///< source width in pixel 90 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 91 95 Int m_conformanceMode; 92 96 Int m_confLeft; … … 97 101 Int m_aiPad[2]; ///< number of padded pixels for width and height 98 102 #endif 103 104 Bool m_isField; ///< enable field coding 105 Bool m_isTopFieldFirst; 99 106 100 107 // profile/level -
branches/SHM-3.1-dev/source/App/TAppEncoder/TAppEncLayerCfg.cpp
r389 r431 161 161 Bool confirmPara(Bool bflag, const char* message); 162 162 163 Bool TAppEncLayerCfg::xCheckParameter( )163 Bool TAppEncLayerCfg::xCheckParameter( Bool isField ) 164 164 { 165 165 switch (m_conformanceMode) … … 185 185 m_aiPad[1] = m_confBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight; 186 186 m_iSourceHeight += m_confBottom; 187 if ( isField ) 188 { 189 m_iSourceHeightOrg += m_confBottom << 1; 190 m_aiPad[1] = m_confBottom << 1; 191 } 187 192 } 188 193 break; -
branches/SHM-3.1-dev/source/App/TAppEncoder/TAppEncLayerCfg.h
r403 r431 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; … … 104 105 Void xPrintParameter(); 105 106 #endif 106 Bool xCheckParameter( );107 Bool xCheckParameter( Bool isField ); 107 108 108 109 Void setAppEncCfg(TAppEncCfg* p) {m_cAppEncCfg = p; } … … 113 114 Int getSourceWidth() {return m_iSourceWidth; } 114 115 Int getSourceHeight() {return m_iSourceHeight; } 116 Int getSourceHeightOrg() {return m_iSourceHeightOrg; } 115 117 Int getConformanceMode() { return m_conformanceMode; } 116 118 Int* getPad() {return m_aiPad; } -
branches/SHM-3.1-dev/source/App/TAppEncoder/TAppEncTop.cpp
r427 r431 888 888 } 889 889 890 Void TAppEncTop::xInitLib( )890 Void TAppEncTop::xInitLib(Bool isFieldCoding) 891 891 { 892 892 #if SVC_EXTENSION 893 893 for(UInt layer=0; layer<m_numLayers; layer++) 894 894 { 895 m_acTEncTop[layer].init( );895 m_acTEncTop[layer].init(isFieldCoding); 896 896 } 897 897 #if VPS_RENAME … … 1091 1091 vps->setExtensionOffset( 0xffff ); 1092 1092 #endif 1093 #else 1094 m_cTEncTop.init( );1095 #endif 1093 #else //SVC_EXTENSION 1094 m_cTEncTop.init(isFieldCoding); 1095 #endif //SVC_EXTENSION 1096 1096 } 1097 1097 … … 1124 1124 xInitLibCfg(); 1125 1125 xCreateLib(); 1126 xInitLib( );1126 xInitLib(m_isField); 1127 1127 1128 1128 // main encoder loop … … 1136 1136 // allocate original YUV buffer 1137 1137 pcPicYuvOrg[layer] = new TComPicYuv; 1138 if( m_isField ) 1139 { 1138 1140 #if SVC_UPSAMPLING 1139 pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL ); 1140 #else 1141 pcPicYuvOrg->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 1142 #endif 1141 pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL ); 1142 #else 1143 pcPicYuvOrg->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 1144 #endif 1145 } 1146 else 1147 { 1148 #if SVC_UPSAMPLING 1149 pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL ); 1150 #else 1151 pcPicYuvOrg->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 1152 #endif 1153 } 1143 1154 } 1144 1155 … … 1182 1193 m_iFrameRcvd++; 1183 1194 // check end of file 1184 bEos = (m_i FrameRcvd == m_framesToBeEncoded);1195 bEos = (m_isField && (m_iFrameRcvd == (m_framesToBeEncoded >> 1) )) || ( !m_isField && (m_iFrameRcvd == m_framesToBeEncoded) ); 1185 1196 } 1186 1197 1187 m_acTEncTop[layer].encodePrep( pcPicYuvOrg[layer] ); 1198 if ( m_isField ) 1199 { 1200 m_acTEncTop[layer].encodePrep( pcPicYuvOrg[layer], m_isTopFieldFirst ); 1201 } 1202 else 1203 { 1204 m_acTEncTop[layer].encodePrep( pcPicYuvOrg[layer] ); 1205 } 1188 1206 } 1189 1207 … … 1232 1250 { 1233 1251 // call encoding function for one frame 1234 m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP ); 1252 if ( m_isField ) 1253 { 1254 m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP, m_isTopFieldFirst ); 1255 } 1256 else 1257 { 1258 m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP ); 1259 } 1235 1260 } 1236 1261 } … … 1269 1294 if (bEos) 1270 1295 { 1271 printOutSummary( );1296 printOutSummary(m_isTopFieldFirst); 1272 1297 } 1273 1298 … … 1301 1326 } 1302 1327 1303 Void TAppEncTop::printOutSummary( )1328 Void TAppEncTop::printOutSummary(Bool isField) 1304 1329 { 1305 1330 UInt layer; … … 1308 1333 for(layer = 0; layer < m_numLayers; layer++) 1309 1334 { 1310 m_gcAnalyzeAll[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate()); 1311 m_gcAnalyzeI[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() ); 1312 m_gcAnalyzeP[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() ); 1313 m_gcAnalyzeB[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() ); 1335 if(isField) 1336 { 1337 m_gcAnalyzeAll[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate()); 1338 m_gcAnalyzeI[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() ); 1339 m_gcAnalyzeP[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() ); 1340 m_gcAnalyzeB[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() ); 1341 } 1342 else 1343 { 1344 m_gcAnalyzeAll[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() * 2); 1345 m_gcAnalyzeI[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() * 2 ); 1346 m_gcAnalyzeP[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() * 2 ); 1347 m_gcAnalyzeB[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() * 2 ); 1348 } 1314 1349 } 1315 1350 … … 1342 1377 m_gcAnalyzeB[layer].printOut('b', layer); 1343 1378 } 1379 1380 if(isField) 1381 { 1382 for(layer = 0; layer < m_numLayers; layer++) 1383 { 1384 //-- interlaced summary 1385 m_gcAnalyzeAll_in.setFrmRate( m_acLayerCfg[layer].getFrameRate()); 1386 printf( "\n\nSUMMARY INTERLACED ---------------------------------------------\n" ); 1387 m_gcAnalyzeAll_in.printOutInterlaced('a', m_gcAnalyzeAll[layer].getBits()); 1388 1389 #if _SUMMARY_OUT_ 1390 m_gcAnalyzeAll_in.printSummaryOutInterlaced(); 1391 #endif 1392 } 1393 } 1344 1394 } 1345 1395 … … 1360 1410 xInitLibCfg(); 1361 1411 xCreateLib(); 1362 xInitLib( );1412 xInitLib(m_isField); 1363 1413 1364 1414 // main encoder loop … … 1369 1419 1370 1420 // allocate original YUV buffer 1371 pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 1421 if( m_isField ) 1422 { 1423 pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeightOrg, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 1424 } 1425 else 1426 { 1427 pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 1428 } 1372 1429 1373 1430 while ( !bEos ) … … 1382 1439 m_iFrameRcvd++; 1383 1440 1384 bEos = (m_iFrameRcvd == m_framesToBeEncoded); 1385 1441 bEos = (m_isField && (m_iFrameRcvd == (m_framesToBeEncoded >> 1) )) || ( !m_isField && (m_iFrameRcvd == m_framesToBeEncoded) ); 1386 1442 Bool flush = 0; 1387 1443 // if end of file (which is only detected on a read failure) flush the encoder of any queued pictures … … 1395 1451 1396 1452 // call encoding function for one frame 1453 if ( m_isField ) 1454 { 1455 m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, m_cListPicYuvRec, outputAccessUnits, iNumEncoded, m_isTopFieldFirst); 1456 } 1457 else 1458 { 1397 1459 m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, m_cListPicYuvRec, outputAccessUnits, iNumEncoded ); 1460 } 1398 1461 1399 1462 // write bistream to file if necessary … … 1405 1468 } 1406 1469 1407 m_cTEncTop.printSummary( );1470 m_cTEncTop.printSummary(m_isField); 1408 1471 1409 1472 // delete original YUV buffer … … 1479 1542 Void TAppEncTop::xWriteRecon(UInt layer, Int iNumEncoded) 1480 1543 { 1481 Int i; 1482 1483 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_acListPicYuvRec[layer].end(); 1484 1485 for ( i = 0; i < iNumEncoded; i++ ) 1486 { 1487 --iterPicYuvRec; 1488 } 1489 1490 for ( i = 0; i < iNumEncoded; i++ ) 1491 { 1492 TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); 1544 if (m_isField) 1545 { 1546 //Reinterlace fields 1547 Int i; 1548 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_acListPicYuvRec[layer].end(); 1549 1550 for ( i = 0; i < iNumEncoded; i++ ) 1551 { 1552 --iterPicYuvRec; 1553 } 1554 1555 for ( i = 0; i < iNumEncoded/2; i++ ) 1556 { 1557 TComPicYuv* pcPicYuvRecTop = *(iterPicYuvRec++); 1558 TComPicYuv* pcPicYuvRecBottom = *(iterPicYuvRec++); 1559 1493 1560 #if M0040_ADAPTIVE_RESOLUTION_CHANGE 1494 if (!m_acLayerCfg[layer].getReconFile().empty() && pcPicYuvRec->isReconstructed()) 1495 #else 1496 if (!m_acLayerCfg[layer].getReconFile().empty()) 1497 #endif 1498 { 1499 m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getConfLeft(), m_acLayerCfg[layer].getConfRight(), 1500 m_acLayerCfg[layer].getConfTop(), m_acLayerCfg[layer].getConfBottom() ); 1561 if (!m_acLayerCfg[layer].getReconFile().empty() && pcPicYuvRecTop->isReconstructed() && pcPicYuvRecBottom->isReconstructed()) 1562 #else 1563 if (!m_acLayerCfg[layer].getReconFile().empty()) 1564 #endif 1565 { 1566 m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRecTop, pcPicYuvRecBottom, m_acLayerCfg[layer].getConfLeft(), m_acLayerCfg[layer].getConfRight(), m_acLayerCfg[layer].getConfTop(), m_acLayerCfg[layer].getConfBottom(), m_isTopFieldFirst ); 1567 } 1568 } 1569 } 1570 else 1571 { 1572 Int i; 1573 1574 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_acListPicYuvRec[layer].end(); 1575 1576 for ( i = 0; i < iNumEncoded; i++ ) 1577 { 1578 --iterPicYuvRec; 1579 } 1580 1581 for ( i = 0; i < iNumEncoded; i++ ) 1582 { 1583 TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); 1584 #if M0040_ADAPTIVE_RESOLUTION_CHANGE 1585 if (!m_acLayerCfg[layer].getReconFile().empty() && pcPicYuvRec->isReconstructed()) 1586 #else 1587 if (!m_acLayerCfg[layer].getReconFile().empty()) 1588 #endif 1589 { 1590 m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getConfLeft(), m_acLayerCfg[layer].getConfRight(), 1591 m_acLayerCfg[layer].getConfTop(), m_acLayerCfg[layer].getConfBottom() ); 1592 } 1501 1593 } 1502 1594 } … … 1505 1597 Void TAppEncTop::xWriteStream(std::ostream& bitstreamFile, Int iNumEncoded, const std::list<AccessUnit>& accessUnits) 1506 1598 { 1507 Int i; 1508 1509 list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin(); 1599 if (m_isField) 1600 { 1601 //Reinterlace fields 1602 Int i; 1603 list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin(); 1510 1604 1511 1605 #if M0040_ADAPTIVE_RESOLUTION_CHANGE 1512 for ( i = 0; i < iNumEncoded && iterBitstream != accessUnits.end(); i++ ) 1513 #else 1514 for ( i = 0; i < iNumEncoded; i++ ) 1515 #endif 1516 { 1517 const AccessUnit& au = *(iterBitstream++); 1518 const vector<UInt>& stats = writeAnnexB(bitstreamFile, au); 1519 rateStatsAccum(au, stats); 1606 for ( i = 0; i < iNumEncoded/2 && iterBitstream != accessUnits.end(); i++ ) 1607 #else 1608 for ( i = 0; i < iNumEncoded/2; i++ ) 1609 #endif 1610 { 1611 const AccessUnit& auTop = *(iterBitstream++); 1612 const vector<UInt>& statsTop = writeAnnexB(bitstreamFile, auTop); 1613 rateStatsAccum(auTop, statsTop); 1614 1615 const AccessUnit& auBottom = *(iterBitstream++); 1616 const vector<UInt>& statsBottom = writeAnnexB(bitstreamFile, auBottom); 1617 rateStatsAccum(auBottom, statsBottom); 1618 } 1619 } 1620 else 1621 { 1622 Int i; 1623 1624 list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin(); 1625 1626 #if M0040_ADAPTIVE_RESOLUTION_CHANGE 1627 for ( i = 0; i < iNumEncoded && iterBitstream != accessUnits.end(); i++ ) 1628 #else 1629 for ( i = 0; i < iNumEncoded; i++ ) 1630 #endif 1631 { 1632 const AccessUnit& au = *(iterBitstream++); 1633 const vector<UInt>& stats = writeAnnexB(bitstreamFile, au); 1634 rateStatsAccum(au, stats); 1635 } 1520 1636 } 1521 1637 } … … 1561 1677 Void TAppEncTop::xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, const std::list<AccessUnit>& accessUnits) 1562 1678 { 1563 Int i; 1564 1565 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.end(); 1566 list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin(); 1567 1568 for ( i = 0; i < iNumEncoded; i++ ) 1569 { 1570 --iterPicYuvRec; 1571 } 1572 1573 for ( i = 0; i < iNumEncoded; i++ ) 1574 { 1575 TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); 1576 if (m_pchReconFile) 1577 { 1679 if (m_isField) 1680 { 1681 //Reinterlace fields 1682 Int i; 1683 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.end(); 1684 list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin(); 1685 1686 for ( i = 0; i < iNumEncoded; i++ ) 1687 { 1688 --iterPicYuvRec; 1689 } 1690 1691 for ( i = 0; i < iNumEncoded/2; i++ ) 1692 { 1693 TComPicYuv* pcPicYuvRecTop = *(iterPicYuvRec++); 1694 TComPicYuv* pcPicYuvRecBottom = *(iterPicYuvRec++); 1695 1696 if (m_pchReconFile) 1697 { 1698 m_cTVideoIOYuvReconFile.write( pcPicYuvRecTop, pcPicYuvRecBottom, m_confLeft, m_confRight, m_confTop, m_confBottom, m_isTopFieldFirst ); 1699 } 1700 1701 const AccessUnit& auTop = *(iterBitstream++); 1702 const vector<UInt>& statsTop = writeAnnexB(bitstreamFile, auTop); 1703 rateStatsAccum(auTop, statsTop); 1704 1705 const AccessUnit& auBottom = *(iterBitstream++); 1706 const vector<UInt>& statsBottom = writeAnnexB(bitstreamFile, auBottom); 1707 rateStatsAccum(auBottom, statsBottom); 1708 } 1709 } 1710 else 1711 { 1712 Int i; 1713 1714 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.end(); 1715 list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin(); 1716 1717 for ( i = 0; i < iNumEncoded; i++ ) 1718 { 1719 --iterPicYuvRec; 1720 } 1721 1722 for ( i = 0; i < iNumEncoded; i++ ) 1723 { 1724 TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); 1725 if (m_pchReconFile) 1726 { 1578 1727 #if SYNTAX_OUTPUT 1579 m_cTVideoIOYuvReconFile.write( pcPicYuvRec, m_confLeft, m_confRight, m_confTop, m_confBottom ); 1580 #endif 1581 } 1582 1583 const AccessUnit& au = *(iterBitstream++); 1584 const vector<UInt>& stats = writeAnnexB(bitstreamFile, au); 1585 rateStatsAccum(au, stats); 1728 m_cTVideoIOYuvReconFile.write( pcPicYuvRec, m_confLeft, m_confRight, m_confTop, m_confBottom ); 1729 #endif 1730 } 1731 1732 const AccessUnit& au = *(iterBitstream++); 1733 const vector<UInt>& stats = writeAnnexB(bitstreamFile, au); 1734 rateStatsAccum(au, stats); 1735 } 1586 1736 } 1587 1737 } … … 1602 1752 case NAL_UNIT_CODED_SLICE_TRAIL_R: 1603 1753 case NAL_UNIT_CODED_SLICE_TRAIL_N: 1604 case NAL_UNIT_CODED_SLICE_T SA_R:1754 case NAL_UNIT_CODED_SLICE_TLA_R: 1605 1755 case NAL_UNIT_CODED_SLICE_TSA_N: 1606 1756 case NAL_UNIT_CODED_SLICE_STSA_R: -
branches/SHM-3.1-dev/source/App/TAppEncoder/TAppEncTop.h
r313 r431 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.