Changeset 651 in 3DVCSoftware
- Timestamp:
- 21 Oct 2013, 17:52:23 (11 years ago)
- Location:
- branches/HTM-8.2-dev0-Cleanup
- Files:
-
- 72 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/encoder_intra_main.cfg
r608 r651 3 3 ReconFile : rec.yuv 4 4 5 #======== Profile /Level================5 #======== Profile ================ 6 6 Profile : main 7 Level : 6.28 7 9 8 #======== Unit definition ================ -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/encoder_intra_main10.cfg
r608 r651 3 3 ReconFile : rec.yuv 4 4 5 #======== Profile /Level================5 #======== Profile ================ 6 6 Profile : main10 7 Level : 6.28 7 9 8 #======== Unit definition ================ -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/encoder_lowdelay_P_main.cfg
r608 r651 3 3 ReconFile : rec.yuv 4 4 5 #======== Profile /Level================5 #======== Profile ================ 6 6 Profile : main 7 Level : 6.28 7 9 8 #======== Unit definition ================ -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/encoder_lowdelay_P_main10.cfg
r608 r651 3 3 ReconFile : rec.yuv 4 4 5 #======== Profile /Level================5 #======== Profile ================ 6 6 Profile : main10 7 Level : 6.28 7 9 8 #======== Unit definition ================ -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/encoder_lowdelay_main.cfg
r608 r651 3 3 ReconFile : rec.yuv 4 4 5 #======== Profile /Level================5 #======== Profile ================ 6 6 Profile : main 7 Level : 6.28 7 9 8 #======== Unit definition ================ -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/encoder_lowdelay_main10.cfg
r608 r651 3 3 ReconFile : rec.yuv 4 4 5 #======== Profile /Level================5 #======== Profile ================ 6 6 Profile : main10 7 Level : 6.28 7 9 8 #======== Unit definition ================ -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/encoder_randomaccess_main.cfg
r608 r651 3 3 ReconFile : rec.yuv 4 4 5 #======== Profile /Level================5 #======== Profile ================ 6 6 Profile : main 7 Level : 6.28 7 9 8 #======== Unit definition ================ -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/encoder_randomaccess_main10.cfg
r608 r651 3 3 ReconFile : rec.yuv 4 4 5 #======== Profile /Level================5 #======== Profile ================ 6 6 Profile : main10 7 Level : 6.28 7 9 8 #======== Unit definition ================ -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/per-sequence/BQMall.cfg
r608 r651 7 7 SourceHeight : 480 # Input frame height 8 8 FramesToBeEncoded : 600 # Number of frames to be coded 9 10 Level : 3.1 -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/per-sequence/BQSquare.cfg
r608 r651 7 7 SourceHeight : 240 # Input frame height 8 8 FramesToBeEncoded : 600 # Number of frames to be coded 9 10 Level : 2.1 -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/per-sequence/BQTerrace.cfg
r608 r651 7 7 SourceHeight : 1080 # Input frame height 8 8 FramesToBeEncoded : 600 # Number of frames to be coded 9 10 Level : 4.1 -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/per-sequence/BasketballDrill.cfg
r608 r651 7 7 SourceHeight : 480 # Input frame height 8 8 FramesToBeEncoded : 500 # Number of frames to be coded 9 10 Level : 3.1 -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/per-sequence/BasketballDrillText.cfg
r608 r651 7 7 SourceHeight : 480 # Input frame height 8 8 FramesToBeEncoded : 500 # Number of frames to be coded 9 10 Level : 3.1 -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/per-sequence/BasketballDrive.cfg
r608 r651 7 7 SourceHeight : 1080 # Input frame height 8 8 FramesToBeEncoded : 500 # Number of frames to be coded 9 10 Level : 4.1 -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/per-sequence/BasketballPass.cfg
r608 r651 7 7 SourceHeight : 240 # Input frame height 8 8 FramesToBeEncoded : 500 # Number of frames to be coded 9 10 Level : 2.1 -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/per-sequence/BlowingBubbles.cfg
r608 r651 7 7 SourceHeight : 240 # Input frame height 8 8 FramesToBeEncoded : 500 # Number of frames to be coded 9 10 Level : 2.1 -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/per-sequence/Cactus.cfg
r608 r651 7 7 SourceHeight : 1080 # Input frame height 8 8 FramesToBeEncoded : 500 # Number of frames to be coded 9 10 Level : 4.1 -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/per-sequence/ChinaSpeed.cfg
r608 r651 7 7 SourceHeight : 768 # Input frame height 8 8 FramesToBeEncoded : 500 # Number of frames to be coded 9 10 Level : 3.1 -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/per-sequence/FourPeople.cfg
r608 r651 7 7 SourceHeight : 720 # Input frame height 8 8 FramesToBeEncoded : 600 # Number of frames to be coded 9 10 Level : 4 -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/per-sequence/Johnny.cfg
r608 r651 7 7 SourceHeight : 720 # Input frame height 8 8 FramesToBeEncoded : 600 # Number of frames to be coded 9 10 Level : 4 -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/per-sequence/Kimono.cfg
r608 r651 7 7 SourceHeight : 1080 # Input frame height 8 8 FramesToBeEncoded : 240 # Number of frames to be coded 9 10 Level : 4.0 -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/per-sequence/KristenAndSara.cfg
r608 r651 7 7 SourceHeight : 720 # Input frame height 8 8 FramesToBeEncoded : 600 # Number of frames to be coded 9 10 Level : 4 -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/per-sequence/NebutaFestival_10bit.cfg
r608 r651 7 7 SourceHeight : 1600 # Input frame height 8 8 FramesToBeEncoded : 300 # Number of frames to be coded 9 10 Level : 5 -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/per-sequence/ParkScene.cfg
r608 r651 7 7 SourceHeight : 1080 # Input frame height 8 8 FramesToBeEncoded : 240 # Number of frames to be coded 9 10 Level : 4.0 -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/per-sequence/PartyScene.cfg
r608 r651 7 7 SourceHeight : 480 # Input frame height 8 8 FramesToBeEncoded : 500 # Number of frames to be coded 9 10 Level : 3.1 -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/per-sequence/PeopleOnStreet.cfg
r608 r651 7 7 SourceHeight : 1600 # Input frame height 8 8 FramesToBeEncoded : 150 # Number of frames to be coded 9 10 Level : 5 -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/per-sequence/RaceHorses.cfg
r608 r651 7 7 SourceHeight : 240 # Input frame height 8 8 FramesToBeEncoded : 300 # Number of frames to be coded 9 10 Level : 2 -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/per-sequence/RaceHorsesC.cfg
r608 r651 7 7 SourceHeight : 480 # Input frame height 8 8 FramesToBeEncoded : 300 # Number of frames to be coded 9 10 Level : 3 -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/per-sequence/SlideEditing.cfg
r608 r651 7 7 SourceHeight : 720 # Input frame height 8 8 FramesToBeEncoded : 300 # Number of frames to be coded 9 10 Level : 3.1 -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/per-sequence/SlideShow.cfg
r608 r651 7 7 SourceHeight : 720 # Input frame height 8 8 FramesToBeEncoded : 500 # Number of frames to be coded 9 10 Level : 3.1 -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/per-sequence/SteamLocomotiveTrain_10bit.cfg
r608 r651 7 7 SourceHeight : 1600 # Input frame height 8 8 FramesToBeEncoded : 300 # Number of frames to be coded 9 10 Level : 5 -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/per-sequence/Traffic.cfg
r608 r651 7 7 SourceHeight : 1600 # Input frame height 8 8 FramesToBeEncoded : 150 # Number of frames to be coded 9 10 Level : 5 -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/per-sequence/Vidyo1.cfg
r608 r651 7 7 SourceHeight : 720 # Input frame height 8 8 FramesToBeEncoded : 600 # Number of frames to be coded 9 10 Level : 4 -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/per-sequence/Vidyo3.cfg
r608 r651 7 7 SourceHeight : 720 # Input frame height 8 8 FramesToBeEncoded : 600 # Number of frames to be coded 9 10 Level : 4 -
branches/HTM-8.2-dev0-Cleanup/cfg/HEVC/HM/per-sequence/Vidyo4.cfg
r608 r651 7 7 SourceHeight : 720 # Input frame height 8 8 FramesToBeEncoded : 600 # Number of frames to be coded 9 10 Level : 4 -
branches/HTM-8.2-dev0-Cleanup/source/App/TAppDecoder/TAppDecTop.cpp
r648 r651 60 60 #endif 61 61 { 62 ::memset (m_abDecFlag, 0, sizeof (m_abDecFlag));63 62 #if H_MV 64 63 for (Int i = 0; i < MAX_NUM_LAYER_IDS; i++) m_layerIdToDecIdx[i] = -1; … … 148 147 149 148 // main decoder loop 150 Bool recon_opened= false; // reconstruction file not yet opened. (must be performed after SPS is seen)149 Bool openedReconFile = false; // reconstruction file not yet opened. (must be performed after SPS is seen) 151 150 #else 152 151 #if H_3D … … 176 175 #endif 177 176 AnnexBStats stats = AnnexBStats(); 178 #if !H_MV179 Bool bPreviousPictureDecoded = false;180 #endif181 182 177 vector<uint8_t> nalUnit; 183 178 InputNALUnit nalu; … … 246 241 #endif 247 242 } 248 249 250 243 #else 251 244 if( (m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer) || !isNaluWithinTargetDecLayerIdSet(&nalu) ) 252 245 { 253 if(bPreviousPictureDecoded) 254 { 255 bNewPicture = true; 256 bPreviousPictureDecoded = false; 257 } 258 else 259 { 260 bNewPicture = false; 261 } 246 bNewPicture = false; 262 247 } 263 248 else … … 290 275 #endif 291 276 } 292 #if !H_MV293 bPreviousPictureDecoded = true;294 #endif295 277 } 296 278 } … … 321 303 if ( m_pchReconFiles[decIdxLastPic] && !m_reconOpen[decIdxLastPic] ) 322 304 #else 323 if ( m_pchReconFile && ! recon_opened)305 if ( m_pchReconFile && !openedReconFile ) 324 306 #endif 325 307 { … … 334 316 #else 335 317 m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode 336 recon_opened= true;318 openedReconFile = true; 337 319 } 338 320 if ( bNewPicture && … … 462 444 { 463 445 TComList<TComPic*>::iterator iterPic = pcListPic->begin(); 464 Int not_displayed = 0; 465 466 while (iterPic != pcListPic->end()) 467 { 468 TComPic* pcPic = *(iterPic); 469 #if H_MV 470 if(pcPic->getOutputMark() && pcPic->getPOC() > m_pocLastDisplay[decIdx]) 471 #else 472 if(pcPic->getOutputMark() && pcPic->getPOC() > m_iPOCLastDisplay) 473 #endif 474 { 475 not_displayed++; 476 } 477 iterPic++; 478 } 479 iterPic = pcListPic->begin(); 446 Int numPicsNotYetDisplayed = 0; 480 447 481 448 while (iterPic != pcListPic->end()) 482 449 { 483 450 TComPic* pcPic = *(iterPic); 484 485 #if H_MV 486 if ( pcPic->getOutputMark() && (not_displayed > pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_pocLastDisplay[decIdx])) 487 #else 488 if ( pcPic->getOutputMark() && (not_displayed > pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_iPOCLastDisplay)) 489 #endif 490 { 491 // write to file 492 not_displayed--; 451 #if H_MV 452 if(pcPic->getOutputMark() && pcPic->getPOC() > m_pocLastDisplay[decIdx]) 453 #else 454 if(pcPic->getOutputMark() && pcPic->getPOC() > m_iPOCLastDisplay) 455 #endif 456 { 457 numPicsNotYetDisplayed++; 458 } 459 iterPic++; 460 } 461 iterPic = pcListPic->begin(); 462 if (numPicsNotYetDisplayed>2) 463 { 464 iterPic++; 465 } 466 467 TComPic* pcPic = *(iterPic); 468 if (numPicsNotYetDisplayed>2 && pcPic->isField()) //Field Decoding 469 { 470 TComList<TComPic*>::iterator endPic = pcListPic->end(); 471 endPic--; 472 iterPic = pcListPic->begin(); 473 while (iterPic != endPic) 474 { 475 TComPic* pcPicTop = *(iterPic); 476 iterPic++; 477 TComPic* pcPicBottom = *(iterPic); 478 479 #if H_MV 480 if ( pcPicTop->getOutputMark() && (numPicsNotYetDisplayed > pcPicTop->getNumReorderPics(tId) && !(pcPicTop->getPOC()%2) && pcPicBottom->getPOC() == pcPicTop->getPOC()+1) 481 && pcPicBottom->getOutputMark() && (numPicsNotYetDisplayed > pcPicBottom->getNumReorderPics(tId) && (pcPicTop->getPOC() == m_pocLastDisplay[decIdx]+1 || m_pocLastDisplay[decIdx]<0))) 482 #else 483 if ( pcPicTop->getOutputMark() && (numPicsNotYetDisplayed > pcPicTop->getNumReorderPics(tId) && !(pcPicTop->getPOC()%2) && pcPicBottom->getPOC() == pcPicTop->getPOC()+1) 484 && pcPicBottom->getOutputMark() && (numPicsNotYetDisplayed > pcPicBottom->getNumReorderPics(tId) && (pcPicTop->getPOC() == m_iPOCLastDisplay+1 || m_iPOCLastDisplay<0))) 485 #endif 486 { 487 // write to file 488 numPicsNotYetDisplayed = numPicsNotYetDisplayed-2; 493 489 #if H_MV 494 490 if ( m_pchReconFiles[decIdx] ) 495 491 #else 496 if ( m_pchReconFile ) 497 #endif 498 { 499 const Window &conf = pcPic->getConformanceWindow(); 500 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 492 if ( m_pchReconFile ) 493 #endif 494 { 495 const Window &conf = pcPicTop->getConformanceWindow(); 496 const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window(); 497 498 const Bool isTff = pcPicTop->isTopField(); 499 #if H_MV 500 assert( conf .getScaledFlag() ); 501 assert( defDisp.getScaledFlag() ); 502 m_tVideoIOYuvReconFile[decIdx]->write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), 503 #else 504 m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), 505 #endif 506 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 507 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 508 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 509 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff ); 510 } 511 512 // update POC of display order 513 #if H_MV 514 m_pocLastDisplay[decIdx] = pcPic->getPOC(); 515 #else 516 m_iPOCLastDisplay = pcPicBottom->getPOC(); 517 #endif 518 519 // erase non-referenced picture in the reference picture list after display 520 if ( !pcPicTop->getSlice(0)->isReferenced() && pcPicTop->getReconMark() == true ) 521 { 522 #if !DYN_REF_FREE 523 pcPicTop->setReconMark(false); 524 525 // mark it should be extended later 526 pcPicTop->getPicYuvRec()->setBorderExtension( false ); 527 528 #else 529 pcPicTop->destroy(); 530 pcListPic->erase( iterPic ); 531 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised! 532 continue; 533 #endif 534 } 535 if ( !pcPicBottom->getSlice(0)->isReferenced() && pcPicBottom->getReconMark() == true ) 536 { 537 #if !DYN_REF_FREE 538 pcPicBottom->setReconMark(false); 539 540 // mark it should be extended later 541 pcPicBottom->getPicYuvRec()->setBorderExtension( false ); 542 543 #else 544 pcPicBottom->destroy(); 545 pcListPic->erase( iterPic ); 546 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised! 547 continue; 548 #endif 549 } 550 pcPicTop->setOutputMark(false); 551 pcPicBottom->setOutputMark(false); 552 } 553 } 554 } 555 else if (!pcPic->isField()) //Frame Decoding 556 { 557 iterPic = pcListPic->begin(); 558 while (iterPic != pcListPic->end()) 559 { 560 pcPic = *(iterPic); 561 562 #if H_MV 563 if ( pcPic->getOutputMark() && (numPicsNotYetDisplayed > pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_pocLastDisplay[decIdx])) 564 #else 565 if ( pcPic->getOutputMark() && (numPicsNotYetDisplayed > pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_iPOCLastDisplay)) 566 #endif 567 { 568 // write to file 569 numPicsNotYetDisplayed--; 570 #if H_MV 571 if ( m_pchReconFiles[decIdx] ) 572 #else 573 if ( m_pchReconFile ) 574 #endif 575 { 576 const Window &conf = pcPic->getConformanceWindow(); 577 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 501 578 #if H_MV 502 579 assert( conf .getScaledFlag() ); … … 504 581 m_tVideoIOYuvReconFile[decIdx]->write( pcPic->getPicYuvRec(), 505 582 #else 506 m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(), 507 #endif 508 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 509 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 510 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 511 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() ); 583 m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(), 584 #endif 585 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 586 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 587 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 588 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() ); 589 } 590 591 // update POC of display order 592 #if H_MV 593 m_pocLastDisplay[decIdx] = pcPic->getPOC(); 594 #else 595 m_iPOCLastDisplay = pcPic->getPOC(); 596 #endif 597 598 // erase non-referenced picture in the reference picture list after display 599 if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true ) 600 { 601 #if !DYN_REF_FREE 602 pcPic->setReconMark(false); 603 604 // mark it should be extended later 605 pcPic->getPicYuvRec()->setBorderExtension( false ); 606 607 #else 608 pcPic->destroy(); 609 pcListPic->erase( iterPic ); 610 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised! 611 continue; 612 #endif 613 } 614 pcPic->setOutputMark(false); 512 615 } 513 616 514 // update POC of display order 515 #if H_MV 516 m_pocLastDisplay[decIdx] = pcPic->getPOC(); 517 #else 518 m_iPOCLastDisplay = pcPic->getPOC(); 519 #endif 520 521 // erase non-referenced picture in the reference picture list after display 522 if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true ) 523 { 524 #if !DYN_REF_FREE 525 pcPic->setReconMark(false); 526 527 // mark it should be extended later 528 pcPic->getPicYuvRec()->setBorderExtension( false ); 529 530 #else 531 pcPic->destroy(); 532 pcListPic->erase( iterPic ); 533 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised! 534 continue; 535 #endif 536 } 537 pcPic->setOutputMark(false); 538 } 539 540 iterPic++; 541 } 542 } 543 617 iterPic++; 618 } 619 } 620 } 544 621 /** \param pcListPic list of pictures to be written to file 545 622 \todo DYN_REF_FREE should be revised … … 554 631 { 555 632 return; 556 } 633 } 557 634 TComList<TComPic*>::iterator iterPic = pcListPic->begin(); 558 635 559 636 iterPic = pcListPic->begin(); 637 TComPic* pcPic = *(iterPic); 560 638 561 while (iterPic != pcListPic->end()) 562 { 563 TComPic* pcPic = *(iterPic); 564 565 if ( pcPic->getOutputMark() ) 566 { 567 // write to file 639 if (pcPic->isField()) //Field Decoding 640 { 641 TComList<TComPic*>::iterator endPic = pcListPic->end(); 642 endPic--; 643 TComPic *pcPicTop, *pcPicBottom = NULL; 644 while (iterPic != endPic) 645 { 646 pcPicTop = *(iterPic); 647 iterPic++; 648 pcPicBottom = *(iterPic); 649 650 if ( pcPicTop->getOutputMark() && pcPicBottom->getOutputMark() && !(pcPicTop->getPOC()%2) && (pcPicBottom->getPOC() == pcPicTop->getPOC()+1) ) 651 { 652 // write to file 568 653 #if H_MV 569 654 if ( m_pchReconFiles[decIdx] ) 570 655 #else 571 if ( m_pchReconFile ) 572 #endif 573 { 574 const Window &conf = pcPic->getConformanceWindow(); 575 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 656 if ( m_pchReconFile ) 657 #endif 658 { 659 const Window &conf = pcPicTop->getConformanceWindow(); 660 const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window(); 661 const Bool isTff = pcPicTop->isTopField(); 662 #if H_MV 663 assert( conf .getScaledFlag() ); 664 assert( defDisp.getScaledFlag() ); 665 m_tVideoIOYuvReconFile[decIdx]->write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), 666 #else 667 m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), 668 #endif 669 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 670 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 671 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 672 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff ); 673 } 674 675 // update POC of display order 676 #if H_MV 677 m_pocLastDisplay[decIdx] = pcPic->getPOC(); 678 #else 679 m_iPOCLastDisplay = pcPicBottom->getPOC(); 680 #endif 681 // erase non-referenced picture in the reference picture list after display 682 if ( !pcPicTop->getSlice(0)->isReferenced() && pcPicTop->getReconMark() == true ) 683 { 684 #if !DYN_REF_FREE 685 pcPicTop->setReconMark(false); 686 687 // mark it should be extended later 688 pcPicTop->getPicYuvRec()->setBorderExtension( false ); 689 690 #else 691 pcPicTop->destroy(); 692 pcListPic->erase( iterPic ); 693 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised! 694 continue; 695 #endif 696 } 697 if ( !pcPicBottom->getSlice(0)->isReferenced() && pcPicBottom->getReconMark() == true ) 698 { 699 #if !DYN_REF_FREE 700 pcPicBottom->setReconMark(false); 701 702 // mark it should be extended later 703 pcPicBottom->getPicYuvRec()->setBorderExtension( false ); 704 705 #else 706 pcPicBottom->destroy(); 707 pcListPic->erase( iterPic ); 708 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised! 709 continue; 710 #endif 711 } 712 pcPicTop->setOutputMark(false); 713 pcPicBottom->setOutputMark(false); 714 715 #if !DYN_REF_FREE 716 if(pcPicTop) 717 { 718 pcPicTop->destroy(); 719 delete pcPicTop; 720 pcPicTop = NULL; 721 } 722 #endif 723 } 724 } 725 if(pcPicBottom) 726 { 727 pcPicBottom->destroy(); 728 delete pcPicBottom; 729 pcPicBottom = NULL; 730 } 731 } 732 else //Frame decoding 733 { 734 while (iterPic != pcListPic->end()) 735 { 736 pcPic = *(iterPic); 737 738 if ( pcPic->getOutputMark() ) 739 { 740 // write to file 741 if ( m_pchReconFile ) 742 { 743 const Window &conf = pcPic->getConformanceWindow(); 744 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 576 745 #if H_MV 577 746 assert( conf .getScaledFlag() ); … … 579 748 m_tVideoIOYuvReconFile[decIdx]->write( pcPic->getPicYuvRec(), 580 749 #else 581 m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),582 #endif 583 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),584 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),585 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),586 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );587 }588 589 // update POC of display order750 m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(), 751 #endif 752 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 753 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 754 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 755 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() ); 756 } 757 758 // update POC of display order 590 759 #if H_MV 591 760 m_pocLastDisplay[decIdx] = pcPic->getPOC(); 592 761 #else 593 m_iPOCLastDisplay = pcPic->getPOC();594 #endif 595 596 // erase non-referenced picture in the reference picture list after display597 if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true )598 {762 m_iPOCLastDisplay = pcPic->getPOC(); 763 #endif 764 765 // erase non-referenced picture in the reference picture list after display 766 if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true ) 767 { 599 768 #if !DYN_REF_FREE 600 pcPic->setReconMark(false);601 602 // mark it should be extended later603 pcPic->getPicYuvRec()->setBorderExtension( false );604 605 #else 606 pcPic->destroy();607 pcListPic->erase( iterPic );608 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!609 continue;610 #endif 611 }612 pcPic->setOutputMark(false);613 }769 pcPic->setReconMark(false); 770 771 // mark it should be extended later 772 pcPic->getPicYuvRec()->setBorderExtension( false ); 773 774 #else 775 pcPic->destroy(); 776 pcListPic->erase( iterPic ); 777 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised! 778 continue; 779 #endif 780 } 781 pcPic->setOutputMark(false); 782 } 614 783 #if !H_MV 615 784 #if !DYN_REF_FREE 616 if(pcPic) 617 { 618 pcPic->destroy(); 619 delete pcPic; 620 pcPic = NULL; 621 } 622 #endif 623 #endif 624 iterPic++; 785 if(pcPic) 786 { 787 pcPic->destroy(); 788 delete pcPic; 789 pcPic = NULL; 790 } 791 #endif 792 #endif 793 iterPic++; 794 } 625 795 } 626 796 #if H_MV -
branches/HTM-8.2-dev0-Cleanup/source/App/TAppDecoder/TAppDecTop.h
r608 r651 72 72 #endif 73 73 // for output control 74 Bool m_abDecFlag[ MAX_GOP ]; ///< decoded flag in one GOP75 74 #if H_MV 76 75 Int m_pocLastDisplay [ MAX_NUM_LAYERS ]; ///< last POC in display order -
branches/HTM-8.2-dev0-Cleanup/source/App/TAppEncoder/TAppEncCfg.cpp
r648 r651 418 418 ("FramesToBeEncoded,f", m_framesToBeEncoded, 0, "Number of frames to be encoded (default=all)") 419 419 420 //Field coding parameters 421 ("FieldCoding", m_isField, false, "Signals if it's a field based coding") 422 ("TopFieldFirst, Tff", m_isTopFieldFirst, false, "In case of field based coding, signals whether if it's a top field first or not") 423 420 424 // Profile and level 421 425 ("Profile", m_profile, Profile::NONE, "Profile to be used when encoding (Incomplete)") … … 812 816 const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv); 813 817 818 if(m_isField) 819 { 820 //Frame height 821 m_iSourceHeightOrg = m_iSourceHeight; 822 //Field height 823 m_iSourceHeight = m_iSourceHeight >> 1; 824 //number of fields to encode 825 m_framesToBeEncoded *= 2; 826 } 827 814 828 for (list<const Char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++) 815 829 { … … 930 944 m_aiPad[1] = m_confBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight; 931 945 m_iSourceHeight += m_confBottom; 946 if ( m_isField ) 947 { 948 m_iSourceHeightOrg += m_confBottom << 1; 949 m_aiPad[1] = m_confBottom << 1; 950 } 932 951 } 933 952 if (m_aiPad[0] % TComSPS::getWinUnitX(CHROMA_420) != 0) … … 1692 1711 Bool errorGOP=false; 1693 1712 Int checkGOP=1; 1694 Int numRefs = 1;1713 Int numRefs = m_isField ? 2 : 1; 1695 1714 Int refList[MAX_NUM_REF_PICS+1]; 1696 1715 refList[0]=0; 1716 if(m_isField) 1717 { 1718 refList[1] = 1; 1719 } 1697 1720 Bool isOK[MAX_GOP]; 1698 1721 for(Int i=0; i<MAX_GOP; i++) … … 2213 2236 printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_confLeft - m_confRight, m_iSourceHeight - m_confTop - m_confBottom, m_iFrameRate ); 2214 2237 printf("Internal Format : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate ); 2238 if (m_isField) 2239 { 2240 printf("Frame/Field : Field based coding\n"); 2241 printf("Field index : %u - %d (%d fields)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded ); 2242 if (m_isTopFieldFirst) 2243 { 2244 printf("Field Order : Top field first\n"); 2245 } 2246 else 2247 { 2248 printf("Field Order : Bottom field first\n"); 2249 } 2250 } 2251 else 2252 { 2253 printf("Frame/Field : Frame based coding\n"); 2215 2254 printf("Frame index : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded ); 2255 } 2216 2256 printf("CU size / depth : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth ); 2217 2257 printf("RQT trans. size (min / max) : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize ); -
branches/HTM-8.2-dev0-Cleanup/source/App/TAppEncoder/TAppEncCfg.h
r648 r651 139 139 UInt m_FrameSkip; ///< number of skipped frames from the beginning 140 140 Int m_iSourceWidth; ///< source width in pixel 141 Int m_iSourceHeight; ///< source height in pixel 141 Int m_iSourceHeight; ///< source height in pixel (when interlaced = field height) 142 143 Int m_iSourceHeightOrg; ///< original source height in pixel (when interlaced = frame height) 144 145 bool m_isField; ///< enable field coding 146 bool m_isTopFieldFirst; 147 142 148 Int m_conformanceMode; 143 149 Int m_confLeft; -
branches/HTM-8.2-dev0-Cleanup/source/App/TAppEncoder/TAppEncTop.cpp
r648 r651 756 756 } 757 757 758 Void TAppEncTop::xInitLib( )758 Void TAppEncTop::xInitLib(Bool isFieldCoding) 759 759 { 760 760 #if H_MV … … 762 762 { 763 763 #if KWU_RC_MADPRED_E0227 764 m_acTEncTopList[layer]->init( this );765 #else 766 m_acTEncTopList[layer]->init( );767 #endif 768 } 769 #else 770 m_cTEncTop.init( );764 m_acTEncTopList[layer]->init( isFieldCoding, this ); 765 #else 766 m_acTEncTopList[layer]->init( isFieldCoding ); 767 #endif 768 } 769 #else 770 m_cTEncTop.init( isFieldCoding ); 771 771 #endif 772 772 } … … 799 799 xInitLibCfg(); 800 800 xCreateLib(); 801 xInitLib( );801 xInitLib(m_isField); 802 802 803 803 // main encoder loop … … 824 824 825 825 // allocate original YUV buffer 826 if( m_isField ) 827 { 828 pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeightOrg, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 829 } 830 else 831 { 826 832 pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 833 } 827 834 828 835 #if H_MV … … 900 907 for(Int layer=0; layer < m_numberOfLayers; layer++ ) 901 908 { 902 m_acTEncTopList[layer]->printSummary( m_acTEncTopList[layer]->getNumAllPicCoded() );909 m_acTEncTopList[layer]->printSummary( m_acTEncTopList[layer]->getNumAllPicCoded(), m_isField ); 903 910 } 904 911 #else … … 914 921 m_iFrameRcvd++; 915 922 916 bEos = (m_i FrameRcvd == m_framesToBeEncoded);923 bEos = (m_isField && (m_iFrameRcvd == (m_framesToBeEncoded >> 1) )) || ( !m_isField && (m_iFrameRcvd == m_framesToBeEncoded) ); 917 924 918 925 Bool flush = 0; … … 927 934 928 935 // call encoding function for one frame 936 if ( m_isField ) 937 { 938 m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, m_cListPicYuvRec, outputAccessUnits, iNumEncoded, m_isTopFieldFirst); 939 } 940 else 941 { 929 942 m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, m_cListPicYuvRec, outputAccessUnits, iNumEncoded ); 943 } 930 944 931 945 // write bistream to file if necessary … … 937 951 } 938 952 939 m_cTEncTop.printSummary( );953 m_cTEncTop.printSummary(m_isField); 940 954 #endif 941 955 … … 1048 1062 #endif 1049 1063 { 1050 Int i; 1051 1064 if (m_isField) 1065 { 1066 //Reinterlace fields 1067 Int i; 1052 1068 #if H_MV 1053 1069 if( iNumEncoded > 0 ) … … 1055 1071 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_picYuvRec[layerId]->end(); 1056 1072 #else 1057 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.end(); 1058 list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin(); 1059 #endif 1060 1061 for ( i = 0; i < iNumEncoded; i++ ) 1062 { 1063 --iterPicYuvRec; 1064 } 1065 1066 for ( i = 0; i < iNumEncoded; i++ ) 1067 { 1068 TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); 1073 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.end(); 1074 list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin(); 1075 #endif 1076 1077 for ( i = 0; i < iNumEncoded; i++ ) 1078 { 1079 --iterPicYuvRec; 1080 } 1081 1082 for ( i = 0; i < iNumEncoded/2; i++ ) 1083 { 1084 TComPicYuv* pcPicYuvRecTop = *(iterPicYuvRec++); 1085 TComPicYuv* pcPicYuvRecBottom = *(iterPicYuvRec++); 1086 1069 1087 #if H_MV 1070 1088 if (m_pchReconFileList[layerId]) 1071 1089 { 1072 m_acTVideoIOYuvReconFileList[layerId]->write( pcPicYuvRec, m_confLeft, m_confRight, m_confTop, m_confBottom ); 1073 } 1074 } 1075 } 1090 m_acTVideoIOYuvReconFileList[layerId]->write( pcPicYuvRecTop, pcPicYuvRecBottom, m_confLeft, m_confRight, m_confTop, m_confBottom, m_isTopFieldFirst ); 1091 } 1092 } 1076 1093 if( ! accessUnits.empty() ) 1077 1094 { … … 1079 1096 for( aUIter = accessUnits.begin(); aUIter != accessUnits.end(); aUIter++ ) 1080 1097 { 1098 const vector<UInt>& stats = writeAnnexB(bitstreamFile, *aUIter); 1099 rateStatsAccum(*aUIter, stats); 1100 } 1101 } 1102 #else 1103 if (m_pchReconFile) 1104 { 1105 m_cTVideoIOYuvReconFile.write( pcPicYuvRecTop, pcPicYuvRecBottom, m_confLeft, m_confRight, m_confTop, m_confBottom, m_isTopFieldFirst ); 1106 } 1107 1108 const AccessUnit& auTop = *(iterBitstream++); 1109 const vector<UInt>& statsTop = writeAnnexB(bitstreamFile, auTop); 1110 rateStatsAccum(auTop, statsTop); 1111 1112 const AccessUnit& auBottom = *(iterBitstream++); 1113 const vector<UInt>& statsBottom = writeAnnexB(bitstreamFile, auBottom); 1114 rateStatsAccum(auBottom, statsBottom); 1115 } 1116 #endif 1117 } 1118 else 1119 { 1120 Int i; 1121 #if H_MV 1122 if( iNumEncoded > 0 ) 1123 { 1124 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_picYuvRec[layerId]->end(); 1125 #else 1126 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.end(); 1127 list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin(); 1128 #endif 1129 1130 for ( i = 0; i < iNumEncoded; i++ ) 1131 { 1132 --iterPicYuvRec; 1133 } 1134 1135 for ( i = 0; i < iNumEncoded; i++ ) 1136 { 1137 TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); 1138 #if H_MV 1139 if (m_pchReconFileList[layerId]) 1140 { 1141 m_acTVideoIOYuvReconFileList[layerId]->write( pcPicYuvRec, m_confLeft, m_confRight, m_confTop, m_confBottom ); 1142 } 1143 } 1144 } 1145 if( ! accessUnits.empty() ) 1146 { 1147 list<AccessUnit>::iterator aUIter; 1148 for( aUIter = accessUnits.begin(); aUIter != accessUnits.end(); aUIter++ ) 1149 { 1081 1150 const vector<unsigned>& stats = writeAnnexB(bitstreamFile, *aUIter); 1082 1151 rateStatsAccum(*aUIter, stats); … … 1084 1153 } 1085 1154 #else 1086 if (m_pchReconFile)1087 {1088 m_cTVideoIOYuvReconFile.write( pcPicYuvRec, m_confLeft, m_confRight, m_confTop, m_confBottom );1089 }1090 1091 const AccessUnit& au = *(iterBitstream++);1092 const vector<UInt>& stats = writeAnnexB(bitstreamFile, au);1093 rateStatsAccum(au, stats);1094 } 1095 #endif 1096 }1097 1155 if (m_pchReconFile) 1156 { 1157 m_cTVideoIOYuvReconFile.write( pcPicYuvRec, m_confLeft, m_confRight, m_confTop, m_confBottom ); 1158 } 1159 1160 const AccessUnit& au = *(iterBitstream++); 1161 const vector<UInt>& stats = writeAnnexB(bitstreamFile, au); 1162 rateStatsAccum(au, stats); 1163 #endif 1164 } 1165 } 1166 } 1098 1167 /** 1099 1168 * -
branches/HTM-8.2-dev0-Cleanup/source/App/TAppEncoder/TAppEncTop.h
r648 r651 96 96 Void xCreateLib (); ///< create files & encoder class 97 97 Void xInitLibCfg (); ///< initialize internal variables 98 Void xInitLib ( );///< initialize encoder class98 Void xInitLib (Bool isFieldCoding); ///< initialize encoder class 99 99 Void xDestroyLib (); ///< destroy encoder class 100 100 -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibCommon/CommonDef.h
r648 r651 61 61 #if H_MV 62 62 #define NV_VERSION "8.1" ///< Current software version 63 #define HM_VERSION "1 1.0" ///<63 #define HM_VERSION "12.0" ///< 64 64 #else 65 #define NV_VERSION "1 1.0" ///< Current software version65 #define NV_VERSION "12.0" ///< Current software version 66 66 #endif 67 67 -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibCommon/TComMv.h
r622 r651 40 40 41 41 #include "CommonDef.h" 42 #include <cstdlib> 42 43 43 44 //! \ingroup TLibCommon -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibCommon/TComPic.cpp
r647 r651 50 50 , m_bUsedByCurr (false) 51 51 , m_bIsLongTerm (false) 52 , m_bIsUsedAsLongTerm (false)53 52 , m_apcPicSym (NULL) 54 53 , m_pcPicYuvPred (NULL) -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibCommon/TComPic.h
r647 r651 61 61 Bool m_bUsedByCurr; // Used by current picture 62 62 Bool m_bIsLongTerm; // IS long term picture 63 Bool m_bIsUsedAsLongTerm; // long term picture is used as reference before64 63 TComPicSym* m_apcPicSym; // Symbol 65 64 … … 83 82 Window m_defaultDisplayWindow; 84 83 84 bool m_isTop; 85 bool m_isField; 86 85 87 std::vector<std::vector<TComDataCU*> > m_vSliceCUDataLink; 86 88 … … 208 210 TComPicYuv* getYuvPicBufferForIndependentBoundaryProcessing() {return m_pNDBFilterYuvTmp;} 209 211 std::vector<TComDataCU*>& getOneSliceCUDataForNDBFilter (Int sliceID) { return m_vSliceCUDataLink[sliceID];} 212 213 214 /* field coding parameters*/ 215 216 Void setTopField(bool b) {m_isTop = b;} 217 bool isTopField() {return m_isTop;} 218 Void setField(bool b) {m_isField = b;} 219 bool isField() {return m_isField;} 210 220 211 221 #if H_MV -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibCommon/TComPicSym.cpp
r608 r651 61 61 ,m_uiNumAllocatedSlice (0) 62 62 ,m_apcTComDataCU (NULL) 63 ,m_iTileBoundaryIndependenceIdr (0)64 63 ,m_iNumColumnsMinus1 (0) 65 64 ,m_iNumRowsMinus1(0) -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibCommon/TComPicSym.h
r608 r651 99 99 UInt m_uiNumAllocatedSlice; 100 100 TComDataCU** m_apcTComDataCU; ///< array of CU data 101 102 Int m_iTileBoundaryIndependenceIdr; 101 103 102 Int m_iNumColumnsMinus1; 104 103 Int m_iNumRowsMinus1; -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibCommon/TComPrediction.cpp
r647 r651 1261 1261 Int k, l, bottomLeft, topRight; 1262 1262 Int horPred; 1263 Int leftColumn[MAX_CU_SIZE ], topRow[MAX_CU_SIZE], bottomRow[MAX_CU_SIZE], rightColumn[MAX_CU_SIZE];1263 Int leftColumn[MAX_CU_SIZE+1], topRow[MAX_CU_SIZE+1], bottomRow[MAX_CU_SIZE], rightColumn[MAX_CU_SIZE]; 1264 1264 UInt blkSize = width; 1265 1265 UInt offset2D = width; -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibCommon/TComRdCost.h
r647 r651 148 148 private: 149 149 // for distortion 150 Int m_iBlkWidth;151 Int m_iBlkHeight;152 150 153 151 #if AMP_SAD -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibCommon/TComRom.cpp
r647 r651 55 55 ::memset( g_aucConvertToBit, -1, sizeof( g_aucConvertToBit ) ); 56 56 c=0; 57 for ( i=4; i< MAX_CU_SIZE; i*=2 )57 for ( i=4; i<=MAX_CU_SIZE; i*=2 ) 58 58 { 59 59 g_aucConvertToBit[ i ] = c; 60 60 c++; 61 61 } 62 g_aucConvertToBit[ i ] = c;63 62 64 63 c=2; … … 292 291 293 292 #if FAST_UDI_USE_MPM 294 const UChar g_aucIntraModeNumFast[ 7] =293 const UChar g_aucIntraModeNumFast[MAX_CU_DEPTH] = 295 294 { 296 295 3, // 2x2 … … 299 298 3, // 16x16 300 299 3, // 32x32 301 3, // 64x64 302 3 // 128x128 300 3 // 64x64 303 301 }; 304 302 #else // FAST_UDI_USE_MPM 305 const UChar g_aucIntraModeNumFast[ 7] =303 const UChar g_aucIntraModeNumFast[MAX_CU_DEPTH] = 306 304 { 307 305 3, // 2x2 … … 310 308 4, // 16x16 33 311 309 4, // 32x32 33 312 5, // 64x64 33 313 4 // 128x128 33 310 5 // 64x64 33 314 311 }; 315 312 #endif // FAST_UDI_USE_MPM -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibCommon/TComRom.h
r647 r651 56 56 // ==================================================================================================================== 57 57 58 #define MAX_CU_DEPTH 7// log2(LCUSize)58 #define MAX_CU_DEPTH 6 // log2(LCUSize) 59 59 #define MAX_CU_SIZE (1<<(MAX_CU_DEPTH)) // maximum allowable size of CU 60 60 #define MIN_PU_SIZE 4 … … 136 136 // ==================================================================================================================== 137 137 138 extern const UChar g_aucIntraModeNumFast[ 7];138 extern const UChar g_aucIntraModeNumFast[ MAX_CU_DEPTH ]; 139 139 140 140 // ==================================================================================================================== -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibCommon/TComSlice.cpp
r648 r651 302 302 if (!pocHasMsb) 303 303 { 304 poc = poc % pocCycle;304 poc = poc & (pocCycle - 1); 305 305 } 306 306 … … 313 313 if (!pocHasMsb) 314 314 { 315 picPoc = picPoc % pocCycle;315 picPoc = picPoc & (pocCycle - 1); 316 316 } 317 317 … … 806 806 } 807 807 808 Void TComSlice::checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA, TComList<TComPic *>& rcListPic)808 Void TComSlice::checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, NalUnitType& associatedIRAPType, TComList<TComPic *>& rcListPic) 809 809 { 810 810 for(Int i = 0; i < pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures(); i++) … … 832 832 { 833 833 pocCRA = getPOC(); 834 prevRAPisBLA = false;835 834 } 836 835 else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ) // CRA picture found 837 836 { 838 837 pocCRA = getPOC(); 839 prevRAPisBLA = false;838 associatedIRAPType = getNalUnitType(); 840 839 } 841 840 else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP … … 844 843 { 845 844 pocCRA = getPOC(); 846 prevRAPisBLA = true;845 associatedIRAPType = getNalUnitType(); 847 846 } 848 847 } … … 869 868 { 870 869 TComPic* rpcPic; 870 setAssociatedIRAPPOC(pocCRA); 871 871 Int pocCurr = getPOC(); 872 872 … … 1054 1054 } 1055 1055 1056 Int TComSlice::m_prev POC = 0;1056 Int TComSlice::m_prevTid0POC = 0; 1057 1057 1058 1058 /** Function for setting the slice's temporal layer ID and corresponding temporal_layer_switching_point_flag. … … 1109 1109 } 1110 1110 1111 1112 Void TComSlice::checkLeadingPictureRestrictions(TComList<TComPic*>& rcListPic) 1113 { 1114 TComPic* rpcPic; 1115 1116 Int nalUnitType = this->getNalUnitType(); 1117 1118 // When a picture is a leading picture, it shall be a RADL or RASL picture. 1119 if(this->getAssociatedIRAPPOC() > this->getPOC()) 1120 { 1121 // Do not check IRAP pictures since they may get a POC lower than their associated IRAP 1122 if(nalUnitType < NAL_UNIT_CODED_SLICE_BLA_W_LP || 1123 nalUnitType > NAL_UNIT_RESERVED_IRAP_VCL23) 1124 { 1125 assert(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || 1126 nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R || 1127 nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || 1128 nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R); 1129 } 1130 } 1131 1132 // When a picture is a trailing picture, it shall not be a RADL or RASL picture. 1133 if(this->getAssociatedIRAPPOC() < this->getPOC()) 1134 { 1135 assert(nalUnitType != NAL_UNIT_CODED_SLICE_RASL_N && 1136 nalUnitType != NAL_UNIT_CODED_SLICE_RASL_R && 1137 nalUnitType != NAL_UNIT_CODED_SLICE_RADL_N && 1138 nalUnitType != NAL_UNIT_CODED_SLICE_RADL_R); 1139 } 1140 1141 // No RASL pictures shall be present in the bitstream that are associated 1142 // with a BLA picture having nal_unit_type equal to BLA_W_RADL or BLA_N_LP. 1143 if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || 1144 nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R) 1145 { 1146 assert(this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_BLA_W_RADL && 1147 this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_BLA_N_LP); 1148 } 1149 1150 // No RASL pictures shall be present in the bitstream that are associated with 1151 // an IDR picture. 1152 if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || 1153 nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R) 1154 { 1155 assert(this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_IDR_N_LP && 1156 this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_IDR_W_RADL); 1157 } 1158 1159 // No RADL pictures shall be present in the bitstream that are associated with 1160 // a BLA picture having nal_unit_type equal to BLA_N_LP or that are associated 1161 // with an IDR picture having nal_unit_type equal to IDR_N_LP. 1162 if(nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || 1163 nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R) 1164 { 1165 assert(this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_BLA_N_LP && 1166 this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_IDR_N_LP); 1167 } 1168 1169 // loop through all pictures in the reference picture buffer 1170 TComList<TComPic*>::iterator iterPic = rcListPic.begin(); 1171 while ( iterPic != rcListPic.end()) 1172 { 1173 rpcPic = *(iterPic++); 1174 if (rpcPic->getPOC() == this->getPOC()) 1175 { 1176 continue; 1177 } 1178 1179 // Any picture that has PicOutputFlag equal to 1 that precedes an IRAP picture 1180 // in decoding order shall precede the IRAP picture in output order. 1181 // (Note that any picture following in output order would be present in the DPB) 1182 if(rpcPic->getSlice(0)->getPicOutputFlag() == 1) 1183 { 1184 if(nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP || 1185 nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP || 1186 nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL || 1187 nalUnitType == NAL_UNIT_CODED_SLICE_CRA || 1188 nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP || 1189 nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL) 1190 { 1191 assert(rpcPic->getPOC() < this->getPOC()); 1192 } 1193 } 1194 1195 // Any picture that has PicOutputFlag equal to 1 that precedes an IRAP picture 1196 // in decoding order shall precede any RADL picture associated with the IRAP 1197 // picture in output order. 1198 if(rpcPic->getSlice(0)->getPicOutputFlag() == 1) 1199 { 1200 if((nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || 1201 nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R)) 1202 { 1203 // rpcPic precedes the IRAP in decoding order 1204 if(this->getAssociatedIRAPPOC() > rpcPic->getSlice(0)->getAssociatedIRAPPOC()) 1205 { 1206 // rpcPic must not be the IRAP picture 1207 if(this->getAssociatedIRAPPOC() != rpcPic->getPOC()) 1208 { 1209 assert(rpcPic->getPOC() < this->getPOC()); 1210 } 1211 } 1212 } 1213 } 1214 1215 // When a picture is a leading picture, it shall precede, in decoding order, 1216 // all trailing pictures that are associated with the same IRAP picture. 1217 if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || 1218 nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R || 1219 nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || 1220 nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R) 1221 { 1222 if(rpcPic->getSlice(0)->getAssociatedIRAPPOC() == this->getAssociatedIRAPPOC()) 1223 { 1224 // rpcPic is a picture that preceded the leading in decoding order since it exist in the DPB 1225 // rpcPic would violate the constraint if it was a trailing picture 1226 assert(rpcPic->getPOC() <= this->getAssociatedIRAPPOC()); 1227 } 1228 } 1229 1230 // Any RASL picture associated with a CRA or BLA picture shall precede any 1231 // RADL picture associated with the CRA or BLA picture in output order 1232 if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || 1233 nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R) 1234 { 1235 if((this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_BLA_N_LP || 1236 this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_BLA_W_LP || 1237 this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL || 1238 this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_CRA) && 1239 this->getAssociatedIRAPPOC() == rpcPic->getSlice(0)->getAssociatedIRAPPOC()) 1240 { 1241 if(rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N || 1242 rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_R) 1243 { 1244 assert(rpcPic->getPOC() > this->getPOC()); 1245 } 1246 } 1247 } 1248 1249 // Any RASL picture associated with a CRA picture shall follow, in output 1250 // order, any IRAP picture that precedes the CRA picture in decoding order. 1251 if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || 1252 nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R) 1253 { 1254 if(this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_CRA) 1255 { 1256 if(rpcPic->getSlice(0)->getPOC() < this->getAssociatedIRAPPOC() && 1257 (rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP || 1258 rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP || 1259 rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL || 1260 rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || 1261 rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || 1262 rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA)) 1263 { 1264 assert(this->getPOC() > rpcPic->getSlice(0)->getPOC()); 1265 } 1266 } 1267 } 1268 } 1269 } 1270 1271 1272 1111 1273 /** Function for applying picture marking based on the Reference Picture Set in pReferencePictureSet. 1112 1274 */ … … 1115 1277 TComPic* rpcPic; 1116 1278 Int i, isReference; 1279 1280 checkLeadingPictureRestrictions(rcListPic); 1117 1281 1118 1282 // loop through all pictures in the reference picture buffer … … 1151 1315 else 1152 1316 { 1153 if(rpcPic->getIsLongTerm() && (rpcPic->getPicSym()->getSlice(0)->getPOC()%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC())) == pReferencePictureSet->getPOC(i)%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC()))1154 1317 { 1155 1318 isReference = 1; … … 1211 1374 else 1212 1375 { 1213 if(rpcPic->getIsLongTerm() && (rpcPic->getPicSym()->getSlice(0)->getPOC()%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC())) == pReferencePictureSet->getPOC(i)%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC()) && rpcPic->getSlice(0)->isReferenced())1214 1376 { 1215 1377 isAvailable = 1; … … 1230 1392 if (!pReferencePictureSet->getCheckLTMSBPresent(i)) 1231 1393 { 1232 curPoc = curPoc % pocCycle;1233 refPoc = refPoc % pocCycle;1394 curPoc = curPoc & (pocCycle - 1); 1395 refPoc = refPoc & (pocCycle - 1); 1234 1396 } 1235 1397 … … 2437 2599 TComScalingList::TComScalingList() 2438 2600 { 2439 m_useTransformSkip = false;2440 2601 init(); 2441 2602 } -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibCommon/TComSlice.h
r648 r651 155 155 Void setScalingListPresentFlag (Bool b) { m_scalingListPresentFlag = b; } 156 156 Bool getScalingListPresentFlag () { return m_scalingListPresentFlag; } 157 Bool getUseTransformSkip () { return m_useTransformSkip; }158 Void setUseTransformSkip (Bool b) { m_useTransformSkip = b; }159 157 Int* getScalingListAddress (UInt sizeId, UInt listId) { return m_scalingListCoef[sizeId][listId]; } //!< get matrix coefficient 160 158 Bool checkPredMode (UInt sizeId, UInt listId); … … 182 180 UInt m_predMatrixId [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< reference list index 183 181 Int *m_scalingListCoef [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< quantization matrix 184 Bool m_useTransformSkip; //!< transform skipping flag for setting default scaling matrix for 4x4185 182 }; 186 183 … … 1617 1614 #endif 1618 1615 Int m_iLastIDR; 1619 static Int m_prevPOC; 1616 Int m_iAssociatedIRAP; 1617 NalUnitType m_iAssociatedIRAPType; 1618 static Int m_prevTid0POC; 1620 1619 TComReferencePictureSet *m_pcRPS; 1621 1620 TComReferencePictureSet m_LocalRPS; … … 1776 1775 Void setRPSidx ( Int iBDidx ) { m_iBDidx = iBDidx; } 1777 1776 Int getRPSidx () { return m_iBDidx; } 1778 Int getPrev POC () { return m_prevPOC; }1777 Int getPrevTid0POC () { return m_prevTid0POC; } 1779 1778 TComRefPicListModification* getRefPicListModification() { return &m_RefPicListModification; } 1780 1779 Void setLastIDR(Int iIDRPOC) { m_iLastIDR = iIDRPOC; } 1781 1780 Int getLastIDR() { return m_iLastIDR; } 1781 Void setAssociatedIRAPPOC(Int iAssociatedIRAPPOC) { m_iAssociatedIRAP = iAssociatedIRAPPOC; } 1782 Int getAssociatedIRAPPOC() { return m_iAssociatedIRAP; } 1783 Void setAssociatedIRAPType(NalUnitType associatedIRAPType) { m_iAssociatedIRAPType = associatedIRAPType; } 1784 NalUnitType getAssociatedIRAPType() { return m_iAssociatedIRAPType; } 1782 1785 SliceType getSliceType () { return m_eSliceType; } 1783 1786 Int getPOC () { return m_iPOC; } … … 1824 1827 Void checkColRefIdx (UInt curSliceIdx, TComPic* pic); 1825 1828 Bool getIsUsedAsLongTerm (Int i, Int j) { return m_bIsUsedAsLongTerm[i][j]; } 1829 Void setIsUsedAsLongTerm (Int i, Int j, Bool value) { m_bIsUsedAsLongTerm[i][j] = value; } 1826 1830 Bool getCheckLDC () { return m_bCheckLDC; } 1827 1831 Bool getMvdL1ZeroFlag () { return m_bLMvdL1Zero; } … … 1830 1834 Void setReferenced(Bool b) { m_bRefenced = b; } 1831 1835 Bool isReferenced() { return m_bRefenced; } 1832 Void setPOC ( Int i ) { m_iPOC = i; if(getTLayer()==0) m_prevPOC=i; } 1836 Bool isReferenceNalu() { return ((getNalUnitType() <= NAL_UNIT_RESERVED_VCL_R15) && (getNalUnitType()%2 != 0)) || ((getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP) && (getNalUnitType() <= NAL_UNIT_RESERVED_IRAP_VCL23) ); } 1837 Void setPOC ( Int i ) { m_iPOC = i; if ((getTLayer()==0) && (isReferenceNalu() && (getNalUnitType()!=NAL_UNIT_CODED_SLICE_RASL_R)&& (getNalUnitType()!=NAL_UNIT_CODED_SLICE_RADL_R))) {m_prevTid0POC=i;} } 1833 1838 Void setNalUnitType ( NalUnitType e ) { m_eNalUnitType = e; } 1834 1839 NalUnitType getNalUnitType () const { return m_eNalUnitType; } … … 1836 1841 Bool getIdrPicFlag () { return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP; } 1837 1842 Bool isIRAP () const { return (getNalUnitType() >= 16) && (getNalUnitType() <= 23); } 1838 Void checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA, TComList<TComPic *>& rcListPic);1843 Void checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, NalUnitType& associatedIRAPType, TComList<TComPic *>& rcListPic); 1839 1844 Void decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic); 1840 1845 Void setSliceType ( SliceType e ) { m_eSliceType = e; } … … 1912 1917 Void setTLayerInfo( UInt uiTLayer ); 1913 1918 Void decodingMarking( TComList<TComPic*>& rcListPic, Int iGOPSIze, Int& iMaxRefPicNum ); 1919 Void checkLeadingPictureRestrictions( TComList<TComPic*>& rcListPic ); 1914 1920 Void applyReferencePictureSet( TComList<TComPic*>& rcListPic, TComReferencePictureSet *RPSList); 1915 1921 #if H_MV -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibCommon/TComWeightPrediction.h
r608 r651 53 53 class TComWeightPrediction 54 54 { 55 wpScalingParam m_wp0[3], m_wp1[3];56 57 55 public: 58 56 TComWeightPrediction(); -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibDecoder/SEIread.cpp
r608 r651 315 315 316 316 /* restore primary bitstream for sei_message */ 317 getBitstream()->deleteFifo(); 317 318 delete getBitstream(); 318 319 setBitstream(bs); -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibDecoder/SyntaxElementParser.cpp
r622 r651 58 58 if (length < 10) 59 59 { 60 fprintf( g_hTrace, "%-50s u(%d) : % d\n", pSymbolName, length, rValue );60 fprintf( g_hTrace, "%-50s u(%d) : %u\n", pSymbolName, length, rValue ); 61 61 } 62 62 else 63 63 { 64 fprintf( g_hTrace, "%-50s u(%d) : % d\n", pSymbolName, length, rValue );64 fprintf( g_hTrace, "%-50s u(%d) : %u\n", pSymbolName, length, rValue ); 65 65 } 66 66 fflush ( g_hTrace ); … … 77 77 #endif 78 78 fprintf( g_hTrace, "%8lld ", g_nSymbolCounter++ ); 79 fprintf( g_hTrace, "%-50s ue(v) : % d\n", pSymbolName, rValue );79 fprintf( g_hTrace, "%-50s ue(v) : %u\n", pSymbolName, rValue ); 80 80 fflush ( g_hTrace ); 81 81 } -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibDecoder/TDecCAVLC.cpp
r649 r651 1441 1441 READ_CODE(sps->getBitsForPOC(), uiCode, "pic_order_cnt_lsb"); 1442 1442 Int iPOClsb = uiCode; 1443 Int iPrevPOC = rpcSlice->getPrev POC();1443 Int iPrevPOC = rpcSlice->getPrevTid0POC(); 1444 1444 Int iMaxPOClsb = 1<< sps->getBitsForPOC(); 1445 Int iPrevPOClsb = iPrevPOC %iMaxPOClsb;1445 Int iPrevPOClsb = iPrevPOC & (iMaxPOClsb - 1); 1446 1446 Int iPrevPOCmsb = iPrevPOC-iPrevPOClsb; 1447 1447 Int iPOCmsb; … … 1572 1572 rps->setDeltaPOC(j, - rpcSlice->getPOC() + pocLsbLt); 1573 1573 rps->setCheckLTMSBPresent(j,false); 1574 1575 // reset deltaPocMSBCycleLT for first LTRP from slice header if MSB not present 1576 if( j == offset+(numOfLtrp-numLtrpInSPS)-1 ) 1577 { 1578 deltaPocMSBCycleLT = 0; 1579 } 1574 1580 } 1575 1581 prevDeltaMSB = deltaPocMSBCycleLT; -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibDecoder/TDecSlice.h
r608 r651 65 65 TDecEntropy* m_pcEntropyDecoder; 66 66 TDecCu* m_pcCuDecoder; 67 UInt m_uiCurrSliceIdx;68 67 69 68 TDecSbac* m_pcBufferSbacDecoders; ///< line to store temporary contexts, one per column of tiles. -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibDecoder/TDecTop.cpp
r648 r651 347 347 #endif 348 348 #endif 349 m_associatedIRAPType = NAL_UNIT_INVALID; 349 350 m_pocCRA = 0; 350 m_prevRAPisBLA = false;351 351 m_pocRandomAccess = MAX_INT; 352 352 m_prevPOC = MAX_INT; 353 353 m_bFirstSliceInPicture = true; 354 354 m_bFirstSliceInSequence = true; 355 m_prevSliceSkipped = false; 356 m_skippedPOC = 0; 355 357 #if H_MV 356 358 m_layerId = 0; … … 686 688 m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder); 687 689 690 // set POC for dependent slices in skipped pictures 691 if(m_apcSlicePilot->getDependentSliceSegmentFlag() && m_prevSliceSkipped) 692 { 693 m_apcSlicePilot->setPOC(m_skippedPOC); 694 } 695 696 m_apcSlicePilot->setAssociatedIRAPPOC(m_pocCRA); 697 m_apcSlicePilot->setAssociatedIRAPType(m_associatedIRAPType); 698 688 699 #if H_MV 689 700 TComVPS* vps = m_apcSlicePilot->getVPS(); … … 699 710 if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay)) 700 711 { 712 m_prevSliceSkipped = true; 713 m_skippedPOC = m_apcSlicePilot->getPOC(); 701 714 return false; 702 715 } … … 704 717 if (isSkipPictureForBLA(iPOCLastDisplay)) 705 718 { 719 m_prevSliceSkipped = true; 720 m_skippedPOC = m_apcSlicePilot->getPOC(); 706 721 return false; 707 722 } 723 724 // clear previous slice skipped flag 725 m_prevSliceSkipped = false; 708 726 709 727 //we should only get a different poc for a new picture (with CTU address==0) … … 766 784 xGetNewPicBuffer (m_apcSlicePilot, pcPic); 767 785 786 Bool isField = false; 787 Bool isTff = false; 788 789 if(!m_SEIs.empty()) 790 { 791 // Check if any new Picture Timing SEI has arrived 792 SEIMessages pictureTimingSEIs = extractSeisByType (m_SEIs, SEI::PICTURE_TIMING); 793 if (pictureTimingSEIs.size()>0) 794 { 795 SEIPictureTiming* pictureTiming = (SEIPictureTiming*) *(pictureTimingSEIs.begin()); 796 isField = (pictureTiming->m_picStruct == 1) || (pictureTiming->m_picStruct == 2); 797 isTff = (pictureTiming->m_picStruct == 1); 798 } 799 } 800 801 //Set Field/Frame coding mode 802 m_pcPic->setField(isField); 803 m_pcPic->setTopField(isTff); 804 768 805 // transfer any SEI messages that have been received to the picture 769 806 pcPic->setSEIs(m_SEIs); … … 904 941 if (bNextSlice) 905 942 { 906 pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_ prevRAPisBLA, m_cListPic );943 pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_associatedIRAPType, m_cListPic ); 907 944 // Set reference list 908 945 #if H_MV … … 1003 1040 pcSlice->setScalingList ( pcSlice->getPPS()->getScalingList() ); 1004 1041 } 1005 pcSlice->getScalingList()->setUseTransformSkip(pcSlice->getPPS()->getUseTransformSkip());1006 1042 if(!pcSlice->getPPS()->getScalingListPresentFlag() && !pcSlice->getSPS()->getScalingListPresentFlag()) 1007 1043 { … … 1168 1204 Bool TDecTop::isSkipPictureForBLA(Int& iPOCLastDisplay) 1169 1205 { 1170 if (m_prevRAPisBLA && m_apcSlicePilot->getPOC() < m_pocCRA && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N)) 1206 if ((m_associatedIRAPType == NAL_UNIT_CODED_SLICE_BLA_N_LP || m_associatedIRAPType == NAL_UNIT_CODED_SLICE_BLA_W_LP || m_associatedIRAPType == NAL_UNIT_CODED_SLICE_BLA_W_RADL) && 1207 m_apcSlicePilot->getPOC() < m_pocCRA && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N)) 1171 1208 { 1172 1209 iPOCLastDisplay++; -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibDecoder/TDecTop.h
r648 r651 176 176 Int m_iMaxRefPicNum; 177 177 178 NalUnitType m_associatedIRAPType; ///< NAL unit type of the associated IRAP picture 178 179 Int m_pocCRA; ///< POC number of the latest CRA picture 179 Bool m_prevRAPisBLA; ///< true if the previous RAP (CRA/CRANT/BLA/BLANT/IDR) picture is a BLA/BLANT picture180 180 Int m_pocRandomAccess; ///< POC number of the random access point (the first IDR or CRA picture) 181 181 … … 211 211 Bool m_bFirstSliceInPicture; 212 212 Bool m_bFirstSliceInSequence; 213 Bool m_prevSliceSkipped; 214 Int m_skippedPOC; 215 213 216 #if H_MV 214 217 // For H_MV m_bFirstSliceInSequence indicates first slice in sequence of the particular layer -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncAnalyze.cpp
r608 r651 52 52 TEncAnalyze m_gcAnalyzeP; 53 53 TEncAnalyze m_gcAnalyzeB; 54 55 TEncAnalyze m_gcAnalyzeAll_in; 54 56 #endif 55 57 -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncAnalyze.h
r608 r651 116 116 } 117 117 118 Void printOutInterlaced ( Char cDelim, Double bits ) 119 { 120 Double dFps = m_dFrmRate; //--CFG_KDY 121 Double dScale = dFps / 1000 / (Double)m_uiNumPic; 122 123 printf( "\tTotal Frames | " "Bitrate " "Y-PSNR " "U-PSNR " "V-PSNR \n" ); 124 //printf( "\t------------ " " ----------" " -------- " " -------- " " --------\n" ); 125 printf( "\t %8d %c" "%12.4lf " "%8.4lf " "%8.4lf " "%8.4lf\n", 126 getNumPic(), cDelim, 127 bits * dScale, 128 getPsnrY() / (Double)getNumPic(), 129 getPsnrU() / (Double)getNumPic(), 130 getPsnrV() / (Double)getNumPic() ); 131 } 132 133 Void printSummaryOutInterlaced (Int bits) 134 { 135 FILE* pFile = fopen ("summaryTotal.txt", "at"); 136 Double dFps = m_dFrmRate; //--CFG_KDY 137 Double dScale = dFps / 1000 / (Double)m_uiNumPic; 138 139 fprintf(pFile, "%f\t %f\t %f\t %f\n", bits * dScale, 140 getPsnrY() / (Double)getNumPic(), 141 getPsnrU() / (Double)getNumPic(), 142 getPsnrV() / (Double)getNumPic() ); 143 fclose(pFile); 144 } 145 146 118 147 Void printSummary(Char ch) 119 148 { … … 155 184 extern TEncAnalyze m_gcAnalyzeP; 156 185 extern TEncAnalyze m_gcAnalyzeB; 186 187 extern TEncAnalyze m_gcAnalyzeAll_in; 157 188 #endif 158 189 -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncCavlc.cpp
r648 r651 1130 1130 if( !pcSlice->getIdrPicFlag() ) 1131 1131 { 1132 Int picOrderCntLSB = (pcSlice->getPOC()-pcSlice->getLastIDR()+(1<<pcSlice->getSPS()->getBitsForPOC())) %(1<<pcSlice->getSPS()->getBitsForPOC());1132 Int picOrderCntLSB = (pcSlice->getPOC()-pcSlice->getLastIDR()+(1<<pcSlice->getSPS()->getBitsForPOC())) & ((1<<pcSlice->getSPS()->getBitsForPOC())-1); 1133 1133 WRITE_CODE( picOrderCntLSB, pcSlice->getSPS()->getBitsForPOC(), "pic_order_cnt_lsb"); 1134 1134 TComReferencePictureSet* rps = pcSlice->getRPS(); … … 1927 1927 { 1928 1928 // Bool state = true, state2 = false; 1929 Int lsb = ltrpPOC % (1<<pcSlice->getSPS()->getBitsForPOC());1929 Int lsb = ltrpPOC & ((1<<pcSlice->getSPS()->getBitsForPOC())-1); 1930 1930 for (Int k = 0; k < pcSlice->getSPS()->getNumLongTermRefPicSPS(); k++) 1931 1931 { -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncCu.cpp
r650 r651 432 432 433 433 // variables for fast encoder decision 434 Bool bEarlySkip = false; 435 Bool bTrySplit = true; 436 Double fRD_Skip = MAX_DOUBLE; 434 #if H_3D_QTLPC 435 Bool bTrySplit = true; 436 Bool bTrySplitDQP = true; 437 #endif 437 438 438 439 // variable for Early CU determination … … 443 444 Bool earlyDetectionSkipMode = false; 444 445 445 Bool bTrySplitDQP = true;446 446 #if H_3D_VSP 447 447 DisInfo DvInfo; … … 453 453 #endif 454 454 #endif 455 static Double afCost[ MAX_CU_DEPTH ];456 static Int aiNum [ MAX_CU_DEPTH ];457 458 if ( rpcBestCU->getAddr() == 0 )459 {460 ::memset( afCost, 0, sizeof( afCost ) );461 ::memset( aiNum, 0, sizeof( aiNum ) );462 }463 464 455 Bool bBoundary = false; 465 456 UInt uiLPelX = rpcBestCU->getCUPelX(); … … 529 520 } 530 521 // variables for fast encoder decision 531 bEarlySkip = false; 522 #if H_3D_QTLPC 532 523 bTrySplit = true; 533 fRD_Skip = MAX_DOUBLE; 524 #endif 534 525 535 526 rpcTempCU->initEstData( uiDepth, iQP ); … … 633 624 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 634 625 #endif 635 // fast encoder decision for early skip636 if ( m_pcEncCfg->getUseFastEnc() )637 {638 Int iIdx = g_aucConvertToBit[ rpcBestCU->getWidth(0) ];639 if ( aiNum [ iIdx ] > 5 && fRD_Skip < EARLY_SKIP_THRES*afCost[ iIdx ]/aiNum[ iIdx ] )640 {641 bEarlySkip = true;642 bTrySplit = false;643 }644 }645 626 646 627 if(!m_pcEncCfg->getUseEarlySkipDetection()) 647 628 { 648 629 // 2Nx2N, NxN 649 if ( !bEarlySkip )650 {651 630 #if H_3D_IC 652 631 rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth); … … 664 643 doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0; 665 644 } 666 }667 645 } 668 646 #if H_3D_IC … … 671 649 } 672 650 673 #if H_3D_QTLPC 651 #if H_3D_QTLPC 674 652 if(depthMapDetect && !bIntraSliceDetect && !rapPic && sps->getUseQTL()) 675 653 { 676 654 bTrySplitDQP = bTrySplit; 677 }678 else679 {680 #endif681 if( (g_uiMaxCUWidth>>uiDepth) >= rpcTempCU->getSlice()->getPPS()->getMinCuDQPSize() )682 {683 if(iQP == iBaseQP)684 {685 bTrySplitDQP = bTrySplit;686 }687 }688 else689 {690 bTrySplitDQP = bTrySplit;691 }692 #if H_3D_QTLPC693 655 } 694 656 #endif … … 750 712 { 751 713 // 2Nx2N, NxN 752 if ( !bEarlySkip )753 {754 714 if(!( (rpcBestCU->getWidth(0)==8) && (rpcBestCU->getHeight(0)==8) )) 755 715 { … … 771 731 } 772 732 } 773 }774 733 775 734 // 2NxN, Nx2N … … 1046 1005 // do normal intra modes 1047 1006 #if H_3D_DIM_ENC 1048 if ( !bEarlySkip || ( rpcBestCU->getSlice()->getIsDepth() && rpcBestCU->getSlice()->isIRAP() ) ) 1049 #else 1050 if ( !bEarlySkip ) 1007 if (( rpcBestCU->getSlice()->getIsDepth() && rpcBestCU->getSlice()->isIRAP() ) ) 1051 1008 #endif 1052 1009 { … … 1146 1103 #endif 1147 1104 rpcBestCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcBestCU->getTotalBits(), rpcBestCU->getTotalDistortion() ); 1148 1149 // accumulate statistics for early skip1150 if ( m_pcEncCfg->getUseFastEnc() )1151 {1152 if ( rpcBestCU->isSkipped(0) )1153 {1154 Int iIdx = g_aucConvertToBit[ rpcBestCU->getWidth(0) ];1155 afCost[ iIdx ] += rpcBestCU->getTotalCost();1156 aiNum [ iIdx ] ++;1157 }1158 }1159 1105 1160 1106 // Early CU determination -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncGOP.cpp
r648 r651 355 355 #endif 356 356 #if H_MV 357 Void TEncGOP::compressPicInGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP, Int iGOPid )358 #else 359 Void TEncGOP::compressGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP )357 Void TEncGOP::compressPicInGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP, Int iGOPid, bool isField, bool isTff) 358 #else 359 Void TEncGOP::compressGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP, bool isField, bool isTff) 360 360 #endif 361 361 { … … 371 371 372 372 #if !H_MV 373 xInitGOP( iPOCLast, iNumPicRcvd, rcListPic, rcListPicYuvRecOut ); 373 xInitGOP( iPOCLast, iNumPicRcvd, rcListPic, rcListPicYuvRecOut, isField ); 374 374 375 375 376 m_iNumPicCoded = 0; … … 443 444 444 445 /////////////////////////////////////////////////////////////////////////////////////////////////// Initial to start encoding 445 Int pocCurr = iPOCLast -iNumPicRcvd+ m_pcCfg->getGOPEntry(iGOPid).m_POC; 446 Int iTimeOffset = m_pcCfg->getGOPEntry(iGOPid).m_POC; 447 if(iPOCLast == 0) 446 Int iTimeOffset; 447 Int pocCurr; 448 449 if(iPOCLast == 0) //case first frame or first top field 448 450 { 449 451 pocCurr=0; 450 452 iTimeOffset = 1; 453 } 454 else if(iPOCLast == 1 && isField) //case first bottom field, just like the first frame, the poc computation is not right anymore, we set the right value 455 { 456 pocCurr = 1; 457 iTimeOffset = 1; 458 } 459 else 460 { 461 pocCurr = iPOCLast - iNumPicRcvd + m_pcCfg->getGOPEntry(iGOPid).m_POC - isField; 462 iTimeOffset = m_pcCfg->getGOPEntry(iGOPid).m_POC; 451 463 } 452 464 if(pocCurr>=m_pcCfg->getFramesToBeEncoded()) … … 467 479 accessUnitsInGOP.push_back(AccessUnit()); 468 480 AccessUnit& accessUnit = accessUnitsInGOP.back(); 469 xGetBuffer( rcListPic, rcListPicYuvRecOut, iNumPicRcvd, iTimeOffset, pcPic, pcPicYuvRecOut, pocCurr 481 xGetBuffer( rcListPic, rcListPicYuvRecOut, iNumPicRcvd, iTimeOffset, pcPic, pcPicYuvRecOut, pocCurr, isField); 470 482 471 483 // Slice data initialization … … 477 489 478 490 #if H_MV 479 m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, m_pcEncTop->getVPS(), m_pcEncTop->getSPS(), m_pcEncTop->getPPS(), getLayerId() ); 480 #else 481 m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, m_pcEncTop->getSPS(), m_pcEncTop->getPPS() ); 482 #endif 491 m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, m_pcEncTop->getVPS(), m_pcEncTop->getSPS(), m_pcEncTop->getPPS(), getLayerId(), isField ); 492 #else 493 m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, m_pcEncTop->getSPS(), m_pcEncTop->getPPS(), isField ); 494 #endif 495 496 //Set Frame/Field coding 497 pcSlice->getPic()->setField(isField); 498 483 499 pcSlice->setLastIDR(m_iLastIDR); 484 500 pcSlice->setSliceIdx(0); … … 500 516 pcSlice->setLFCrossSliceBoundaryFlag( pcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag() ); 501 517 pcSlice->setScalingList ( m_pcEncTop->getScalingList() ); 502 pcSlice->getScalingList()->setUseTransformSkip(m_pcEncTop->getPPS()->getUseTransformSkip());503 518 if(m_pcEncTop->getUseScalingListId() == SCALING_LIST_OFF) 504 519 { … … 554 569 if(pcSlice->getTemporalLayerNonReferenceFlag()) 555 570 { 556 if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_TRAIL_R) 571 if (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_R && 572 !(m_iGopSize == 1 && pcSlice->getSliceType() == I_SLICE)) 573 // Add this condition to avoid POC issues with encoder_intra_main.cfg configuration (see #1127 in bug tracker) 557 574 { 558 575 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TRAIL_N); … … 1356 1373 } 1357 1374 } 1358 pictureTimingSEI.m_auCpbRemovalDelay = std::m ax<Int>(1, m_totalCoded - m_lastBPSEI); // Syntax element signalled as minus, hence the .1375 pictureTimingSEI.m_auCpbRemovalDelay = std::min<Int>(std::max<Int>(1, m_totalCoded - m_lastBPSEI), static_cast<Int>(pow(2, static_cast<double>(pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getCpbRemovalDelayLengthMinus1()+1)))); // Syntax element signalled as minus, hence the . 1359 1376 pictureTimingSEI.m_picDpbOutputDelay = pcSlice->getSPS()->getNumReorderPics(0) + pcSlice->getPOC() - m_totalCoded; 1360 1377 Int factor = pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getTickDivisorMinus2() + 2; … … 1884 1901 xCalculateAddPSNR( pcPic, pcPic->getPicYuvRec(), accessUnit, dEncTime ); 1885 1902 1903 //In case of field coding, compute the interlaced PSNR for both fields 1904 if (isField && ((!pcPic->isTopField() && isTff) || (pcPic->isTopField() && !isTff))) 1905 { 1906 //get complementary top field 1907 TComPic* pcPicTop; 1908 TComList<TComPic*>::iterator iterPic = rcListPic.begin(); 1909 while ((*iterPic)->getPOC() != pcPic->getPOC()-1) 1910 { 1911 iterPic ++; 1912 } 1913 pcPicTop = *(iterPic); 1914 xCalculateInterlacedAddPSNR(pcPicTop, pcPic, pcPicTop->getPicYuvRec(), pcPic->getPicYuvRec(), accessUnit, dEncTime ); 1915 } 1916 1886 1917 if (digestStr) 1887 1918 { … … 2016 2047 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI, pcSlice->getTLayer()); 2017 2048 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 2049 pictureTimingSEI.m_picStruct = (isField && pcSlice->getPic()->isTopField())? 1 : isField? 2 : 0; 2018 2050 m_seiWriter.writeSEImessage(nalu.m_Bitstream, pictureTimingSEI, pcSlice->getSPS()); 2019 2051 writeRBSPTrailingBits(nalu.m_Bitstream); … … 2136 2168 2137 2169 #if !H_MV 2138 assert ( m_iNumPicCoded == iNumPicRcvd);2170 assert ( (m_iNumPicCoded == iNumPicRcvd) || (isField && iPOCLast == 1) ); 2139 2171 #endif 2140 2172 } 2141 2173 2142 2174 #if !H_MV 2143 Void TEncGOP::printOutSummary(UInt uiNumAllPicCoded )2175 Void TEncGOP::printOutSummary(UInt uiNumAllPicCoded, bool isField) 2144 2176 { 2145 2177 assert (uiNumAllPicCoded == m_gcAnalyzeAll.getNumPic()); … … 2147 2179 2148 2180 //--CFG_KDY 2181 if(isField) 2182 { 2183 m_gcAnalyzeAll.setFrmRate( m_pcCfg->getFrameRate() * 2); 2184 m_gcAnalyzeI.setFrmRate( m_pcCfg->getFrameRate() * 2); 2185 m_gcAnalyzeP.setFrmRate( m_pcCfg->getFrameRate() * 2); 2186 m_gcAnalyzeB.setFrmRate( m_pcCfg->getFrameRate() * 2); 2187 } 2188 else 2189 { 2149 2190 m_gcAnalyzeAll.setFrmRate( m_pcCfg->getFrameRate() ); 2150 2191 m_gcAnalyzeI.setFrmRate( m_pcCfg->getFrameRate() ); 2151 2192 m_gcAnalyzeP.setFrmRate( m_pcCfg->getFrameRate() ); 2152 2193 m_gcAnalyzeB.setFrmRate( m_pcCfg->getFrameRate() ); 2194 } 2153 2195 2154 2196 //-- all … … 2173 2215 m_gcAnalyzeB.printSummary('B'); 2174 2216 #endif 2217 2218 if(isField) 2219 { 2220 //-- interlaced summary 2221 m_gcAnalyzeAll_in.setFrmRate( m_pcCfg->getFrameRate()); 2222 printf( "\n\nSUMMARY INTERLACED ---------------------------------------------\n" ); 2223 m_gcAnalyzeAll_in.printOutInterlaced('a', m_gcAnalyzeAll.getBits()); 2224 2225 #if _SUMMARY_OUT_ 2226 m_gcAnalyzeAll_in.printSummaryOutInterlaced(); 2227 #endif 2228 } 2175 2229 2176 2230 printf("\nRVM: %.3lf\n" , xCalculateRVM()); … … 2216 2270 // Protected member functions 2217 2271 // ==================================================================================================================== 2272 2273 2274 Void TEncGOP::xInitGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, bool isField ) 2275 { 2276 assert( iNumPicRcvd > 0 ); 2277 // Exception for the first frames 2278 if ( ( isField && (iPOCLast == 0 || iPOCLast == 1) ) || (!isField && (iPOCLast == 0)) ) 2279 { 2280 m_iGopSize = 1; 2281 } 2282 else 2283 { 2284 m_iGopSize = m_pcCfg->getGOPSize(); 2285 } 2286 assert (m_iGopSize > 0); 2287 2288 return; 2289 } 2218 2290 2219 2291 Void TEncGOP::xInitGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut ) … … 2239 2311 TComPic*& rpcPic, 2240 2312 TComPicYuv*& rpcPicYuvRecOut, 2241 Int pocCurr ) 2313 Int pocCurr, 2314 bool isField) 2242 2315 { 2243 2316 Int i; 2244 2317 // Rec. output 2245 2318 TComList<TComPicYuv*>::iterator iterPicYuvRec = rcListPicYuvRecOut.end(); 2246 for ( i = 0; i < iNumPicRcvd - iTimeOffset + 1; i++ ) 2319 2320 if (isField) 2321 { 2322 for ( i = 0; i < ( (pocCurr == 0 ) || (pocCurr == 1 ) ? (iNumPicRcvd - iTimeOffset + 1) : (iNumPicRcvd - iTimeOffset + 2) ); i++ ) 2323 { 2324 iterPicYuvRec--; 2325 } 2326 } 2327 else 2328 { 2329 for ( i = 0; i < (iNumPicRcvd - iTimeOffset + 1); i++ ) 2247 2330 { 2248 2331 iterPicYuvRec--; 2249 2332 } 2250 2333 2334 } 2335 2336 if (isField) 2337 { 2338 if(pocCurr == 1) 2339 { 2340 iterPicYuvRec++; 2341 } 2342 } 2251 2343 rpcPicYuvRecOut = *(iterPicYuvRec); 2252 2344 … … 2582 2674 } 2583 2675 2676 2677 Void reinterlace(Pel* top, Pel* bottom, Pel* dst, UInt stride, UInt width, UInt height, bool isTff) 2678 { 2679 2680 for (Int y = 0; y < height; y++) 2681 { 2682 for (Int x = 0; x < width; x++) 2683 { 2684 dst[x] = isTff ? (UChar) top[x] : (UChar) bottom[x]; 2685 dst[stride+x] = isTff ? (UChar) bottom[x] : (UChar) top[x]; 2686 } 2687 top += stride; 2688 bottom += stride; 2689 dst += stride*2; 2690 } 2691 } 2692 2693 2694 Void TEncGOP::xCalculateInterlacedAddPSNR( TComPic* pcPicOrgTop, TComPic* pcPicOrgBottom, TComPicYuv* pcPicRecTop, TComPicYuv* pcPicRecBottom, const AccessUnit& accessUnit, Double dEncTime ) 2695 { 2696 #if H_MV 2697 assert( 0 ); // Field coding and MV need to be aligned. 2698 #else 2699 Int x, y; 2700 2701 UInt64 uiSSDY_in = 0; 2702 UInt64 uiSSDU_in = 0; 2703 UInt64 uiSSDV_in = 0; 2704 2705 Double dYPSNR_in = 0.0; 2706 Double dUPSNR_in = 0.0; 2707 Double dVPSNR_in = 0.0; 2708 2709 /*------ INTERLACED PSNR -----------*/ 2710 2711 /* Luma */ 2712 2713 Pel* pOrgTop = pcPicOrgTop->getPicYuvOrg()->getLumaAddr(); 2714 Pel* pOrgBottom = pcPicOrgBottom->getPicYuvOrg()->getLumaAddr(); 2715 Pel* pRecTop = pcPicRecTop->getLumaAddr(); 2716 Pel* pRecBottom = pcPicRecBottom->getLumaAddr(); 2717 2718 Int iWidth; 2719 Int iHeight; 2720 Int iStride; 2721 2722 iWidth = pcPicOrgTop->getPicYuvOrg()->getWidth () - m_pcEncTop->getPad(0); 2723 iHeight = pcPicOrgTop->getPicYuvOrg()->getHeight() - m_pcEncTop->getPad(1); 2724 iStride = pcPicOrgTop->getPicYuvOrg()->getStride(); 2725 Int iSize = iWidth*iHeight; 2726 bool isTff = pcPicOrgTop->isTopField(); 2727 2728 TComPicYuv* pcOrgInterlaced = new TComPicYuv; 2729 pcOrgInterlaced->create( iWidth, iHeight << 1, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); 2730 2731 TComPicYuv* pcRecInterlaced = new TComPicYuv; 2732 pcRecInterlaced->create( iWidth, iHeight << 1, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); 2733 2734 Pel* pOrgInterlaced = pcOrgInterlaced->getLumaAddr(); 2735 Pel* pRecInterlaced = pcRecInterlaced->getLumaAddr(); 2736 2737 //=== Interlace fields ==== 2738 reinterlace(pOrgTop, pOrgBottom, pOrgInterlaced, iStride, iWidth, iHeight, isTff); 2739 reinterlace(pRecTop, pRecBottom, pRecInterlaced, iStride, iWidth, iHeight, isTff); 2740 2741 //===== calculate PSNR ===== 2742 for( y = 0; y < iHeight << 1; y++ ) 2743 { 2744 for( x = 0; x < iWidth; x++ ) 2745 { 2746 Int iDiff = (Int)( pOrgInterlaced[x] - pRecInterlaced[x] ); 2747 uiSSDY_in += iDiff * iDiff; 2748 } 2749 pOrgInterlaced += iStride; 2750 pRecInterlaced += iStride; 2751 } 2752 2753 /*Chroma*/ 2754 2755 iHeight >>= 1; 2756 iWidth >>= 1; 2757 iStride >>= 1; 2758 2759 pOrgTop = pcPicOrgTop->getPicYuvOrg()->getCbAddr(); 2760 pOrgBottom = pcPicOrgBottom->getPicYuvOrg()->getCbAddr(); 2761 pRecTop = pcPicRecTop->getCbAddr(); 2762 pRecBottom = pcPicRecBottom->getCbAddr(); 2763 pOrgInterlaced = pcOrgInterlaced->getCbAddr(); 2764 pRecInterlaced = pcRecInterlaced->getCbAddr(); 2765 2766 //=== Interlace fields ==== 2767 reinterlace(pOrgTop, pOrgBottom, pOrgInterlaced, iStride, iWidth, iHeight, isTff); 2768 reinterlace(pRecTop, pRecBottom, pRecInterlaced, iStride, iWidth, iHeight, isTff); 2769 2770 //===== calculate PSNR ===== 2771 for( y = 0; y < iHeight << 1; y++ ) 2772 { 2773 for( x = 0; x < iWidth; x++ ) 2774 { 2775 Int iDiff = (Int)( pOrgInterlaced[x] - pRecInterlaced[x] ); 2776 uiSSDU_in += iDiff * iDiff; 2777 } 2778 pOrgInterlaced += iStride; 2779 pRecInterlaced += iStride; 2780 } 2781 2782 pOrgTop = pcPicOrgTop->getPicYuvOrg()->getCrAddr(); 2783 pOrgBottom = pcPicOrgBottom->getPicYuvOrg()->getCrAddr(); 2784 pRecTop = pcPicRecTop->getCrAddr(); 2785 pRecBottom = pcPicRecBottom->getCrAddr(); 2786 pOrgInterlaced = pcOrgInterlaced->getCrAddr(); 2787 pRecInterlaced = pcRecInterlaced->getCrAddr(); 2788 2789 //=== Interlace fields ==== 2790 reinterlace(pOrgTop, pOrgBottom, pOrgInterlaced, iStride, iWidth, iHeight, isTff); 2791 reinterlace(pRecTop, pRecBottom, pRecInterlaced, iStride, iWidth, iHeight, isTff); 2792 2793 //===== calculate PSNR ===== 2794 for( y = 0; y < iHeight << 1; y++ ) 2795 { 2796 for( x = 0; x < iWidth; x++ ) 2797 { 2798 Int iDiff = (Int)( pOrgInterlaced[x] - pRecInterlaced[x] ); 2799 uiSSDV_in += iDiff * iDiff; 2800 } 2801 pOrgInterlaced += iStride; 2802 pRecInterlaced += iStride; 2803 } 2804 2805 Int maxvalY = 255 << (g_bitDepthY-8); 2806 Int maxvalC = 255 << (g_bitDepthC-8); 2807 Double fRefValueY = (Double) maxvalY * maxvalY * iSize*2; 2808 Double fRefValueC = (Double) maxvalC * maxvalC * iSize*2 / 4.0; 2809 dYPSNR_in = ( uiSSDY_in ? 10.0 * log10( fRefValueY / (Double)uiSSDY_in ) : 99.99 ); 2810 dUPSNR_in = ( uiSSDU_in ? 10.0 * log10( fRefValueC / (Double)uiSSDU_in ) : 99.99 ); 2811 dVPSNR_in = ( uiSSDV_in ? 10.0 * log10( fRefValueC / (Double)uiSSDV_in ) : 99.99 ); 2812 2813 /* calculate the size of the access unit, excluding: 2814 * - any AnnexB contributions (start_code_prefix, zero_byte, etc.,) 2815 * - SEI NAL units 2816 */ 2817 UInt numRBSPBytes = 0; 2818 for (AccessUnit::const_iterator it = accessUnit.begin(); it != accessUnit.end(); it++) 2819 { 2820 UInt numRBSPBytes_nal = UInt((*it)->m_nalUnitData.str().size()); 2821 2822 if ((*it)->m_nalUnitType != NAL_UNIT_PREFIX_SEI && (*it)->m_nalUnitType != NAL_UNIT_SUFFIX_SEI) 2823 numRBSPBytes += numRBSPBytes_nal; 2824 } 2825 2826 UInt uibits = numRBSPBytes * 8 ; 2827 2828 //===== add PSNR ===== 2829 m_gcAnalyzeAll_in.addResult (dYPSNR_in, dUPSNR_in, dVPSNR_in, (Double)uibits); 2830 2831 printf("\n Interlaced frame %d: [Y %6.4lf dB U %6.4lf dB V %6.4lf dB]", pcPicOrgBottom->getPOC()/2 , dYPSNR_in, dUPSNR_in, dVPSNR_in ); 2832 2833 pcOrgInterlaced->destroy(); 2834 delete pcOrgInterlaced; 2835 pcRecInterlaced->destroy(); 2836 delete pcRecInterlaced; 2837 #endif 2838 } 2584 2839 /** Function for deciding the nal_unit_type. 2585 2840 * \param pocCurr POC of the current picture -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncGOP.h
r648 r651 147 147 #if H_MV 148 148 Void initGOP ( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP); 149 Void compressPicInGOP ( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP, Int iGOPid );149 Void compressPicInGOP ( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP, Int iGOPid, Bool isField, Bool isTff ); 150 150 #else 151 Void compressGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRec, std::list<AccessUnit>& accessUnitsInGOP );151 Void compressGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRec, std::list<AccessUnit>& accessUnitsInGOP, Bool isField, Bool isTff ); 152 152 #endif 153 153 Void xAttachSliceDataToNalUnit (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect); … … 168 168 169 169 #if !H_MV 170 Void printOutSummary ( UInt uiNumAllPicCoded );170 Void printOutSummary ( UInt uiNumAllPicCoded , bool isField); 171 171 #endif 172 172 #if H_3D_VSO … … 187 187 188 188 protected: 189 Void xInitGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, bool isField ); 190 189 191 Void xInitGOP ( Int iPOC, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut ); 190 Void xGetBuffer ( TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, Int iNumPicRcvd, Int iTimeOffset, TComPic*& rpcPic, TComPicYuv*& rpcPicYuvRecOut, Int pocCurr );192 Void xGetBuffer ( TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, Int iNumPicRcvd, Int iTimeOffset, TComPic*& rpcPic, TComPicYuv*& rpcPicYuvRecOut, Int pocCurr, bool isField ); 191 193 192 194 Void xCalculateAddPSNR ( TComPic* pcPic, TComPicYuv* pcPicD, const AccessUnit&, Double dEncTime ); 195 Void xCalculateInterlacedAddPSNR( TComPic* pcPicOrgTop, TComPic* pcPicOrgBottom, TComPicYuv* pcPicRecTop, TComPicYuv* pcPicRecBottom, const AccessUnit& accessUnit, Double dEncTime ); 196 193 197 #if H_3D_VSO 194 198 Dist64 xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1); -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncSlice.cpp
r649 r651 188 188 */ 189 189 #if H_MV 190 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComVPS* pVPS, TComSPS* pSPS, TComPPS *pPPS, Int layerId )191 #else 192 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS )190 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComVPS* pVPS, TComSPS* pSPS, TComPPS *pPPS, Int layerId, bool isField ) 191 #else 192 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS, bool isField ) 193 193 #endif 194 194 { … … 334 334 Int NumberBFrames = ( m_pcCfg->getGOPSize() - 1 ); 335 335 Int SHIFT_QP = 12; 336 Double dLambda_scale = 1.0 - Clip3( 0.0, 0.5, 0.05*(Double) NumberBFrames);336 Double dLambda_scale = 1.0 - Clip3( 0.0, 0.5, 0.05*(Double)(isField ? NumberBFrames/2 : NumberBFrames) ); 337 337 #if FULL_NBIT 338 338 Int bitdepth_luma_qp_scale = 6 * (g_bitDepth - 8); -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncSlice.h
r648 r651 118 118 #if H_MV 119 119 Void initEncSlice ( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, 120 Int iGOPid, TComSlice*& rpcSlice, TComVPS* pVPS, TComSPS* pSPS, TComPPS *pPPS, Int layerId );120 Int iGOPid, TComSlice*& rpcSlice, TComVPS* pVPS, TComSPS* pSPS, TComPPS *pPPS, Int layerId, bool isField ); 121 121 #else 122 122 Void initEncSlice ( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, 123 Int iGOPid, TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS );123 Int iGOPid, TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS, bool isField ); 124 124 #endif 125 125 #if RATE_CONTROL_LAMBDA_DOMAIN -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncTop.cpp
r648 r651 293 293 294 294 #if KWU_RC_MADPRED_E0227 295 Void TEncTop::init(TAppEncTop* pcTAppEncTop )295 Void TEncTop::init(TAppEncTop* pcTAppEncTop, Bool isFieldCoding) 296 296 #else 297 Void TEncTop::init( )297 Void TEncTop::init(Bool isFieldCoding) 298 298 #endif 299 299 { … … 313 313 m_cPPS.setSPS(&m_cSPS); 314 314 xInitPPS(); 315 xInitRPS( );315 xInitRPS(isFieldCoding); 316 316 317 317 xInitPPSforTiles(); … … 444 444 #if H_MV 445 445 } 446 m_cGOPEncoder.compressPicInGOP(m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, accessUnitsOut, gopId );446 m_cGOPEncoder.compressPicInGOP(m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, accessUnitsOut, gopId, false, false ); 447 447 448 448 if( gopId + 1 == m_cGOPEncoder.getGOPSize() ) … … 450 450 #else 451 451 // compress GOP 452 m_cGOPEncoder.compressGOP(m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, accessUnitsOut );452 m_cGOPEncoder.compressGOP(m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, accessUnitsOut, false, false); 453 453 #endif 454 454 … … 467 467 #endif 468 468 } 469 /**------------------------------------------------ 470 Separate interlaced frame into two fields 471 -------------------------------------------------**/ 472 void separateFields(Pel* org, Pel* dstField, UInt stride, UInt width, UInt height, bool isTop) 473 { 474 if (!isTop) 475 { 476 org += stride; 477 } 478 for (Int y = 0; y < height>>1; y++) 479 { 480 for (Int x = 0; x < width; x++) 481 { 482 dstField[x] = org[x]; 483 } 484 485 dstField += stride; 486 org += stride*2; 487 } 488 489 } 490 491 #if H_MV 492 Void TEncTop::encode(Bool flush, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded, bool isTff, Int gopId ) 493 { 494 assert( 0 ); // Field coding and multiview need to be furhter harmonized. 495 } 496 #else 497 Void TEncTop::encode(Bool flush, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded, bool isTff) 498 { 499 /* -- TOP FIELD -- */ 500 501 if (pcPicYuvOrg) 502 { 503 504 /* -- Top field initialization -- */ 505 506 TComPic *pcTopField; 507 xGetNewPicBuffer( pcTopField ); 508 pcTopField->getPicSym()->allocSaoParam(&m_cEncSAO); 509 pcTopField->setReconMark (false); 510 511 pcTopField->getSlice(0)->setPOC( m_iPOCLast ); 512 pcTopField->getPicYuvRec()->setBorderExtension(false); 513 pcTopField->setTopField(isTff); 514 515 int nHeight = pcPicYuvOrg->getHeight(); 516 int nWidth = pcPicYuvOrg->getWidth(); 517 int nStride = pcPicYuvOrg->getStride(); 518 int nPadLuma = pcPicYuvOrg->getLumaMargin(); 519 int nPadChroma = pcPicYuvOrg->getChromaMargin(); 520 521 // Get pointers 522 Pel * PicBufY = pcPicYuvOrg->getBufY(); 523 Pel * PicBufU = pcPicYuvOrg->getBufU(); 524 Pel * PicBufV = pcPicYuvOrg->getBufV(); 525 526 Pel * pcTopFieldY = pcTopField->getPicYuvOrg()->getLumaAddr(); 527 Pel * pcTopFieldU = pcTopField->getPicYuvOrg()->getCbAddr(); 528 Pel * pcTopFieldV = pcTopField->getPicYuvOrg()->getCrAddr(); 529 530 // compute image characteristics 531 if ( getUseAdaptiveQP() ) 532 { 533 m_cPreanalyzer.xPreanalyze( dynamic_cast<TEncPic*>( pcTopField ) ); 534 } 535 536 /* -- Defield -- */ 537 538 bool isTop = isTff; 539 540 separateFields(PicBufY + nPadLuma + nStride*nPadLuma, pcTopFieldY, nStride, nWidth, nHeight, isTop); 541 separateFields(PicBufU + nPadChroma + (nStride >> 1)*nPadChroma, pcTopFieldU, nStride >> 1, nWidth >> 1, nHeight >> 1, isTop); 542 separateFields(PicBufV + nPadChroma + (nStride >> 1)*nPadChroma, pcTopFieldV, nStride >> 1, nWidth >> 1, nHeight >> 1, isTop); 543 544 } 545 546 if (m_iPOCLast == 0) // compress field 0 547 { 548 m_cGOPEncoder.compressGOP(m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, accessUnitsOut, true, isTff); 549 } 550 551 /* -- BOTTOM FIELD -- */ 552 553 if (pcPicYuvOrg) 554 { 555 556 /* -- Bottom field initialization -- */ 557 558 TComPic* pcBottomField; 559 xGetNewPicBuffer( pcBottomField ); 560 pcBottomField->getPicSym()->allocSaoParam(&m_cEncSAO); 561 pcBottomField->setReconMark (false); 562 563 TComPicYuv* rpcPicYuvRec = new TComPicYuv; 564 if ( rcListPicYuvRecOut.size() == (UInt)m_iGOPSize ) 565 { 566 rpcPicYuvRec = rcListPicYuvRecOut.popFront(); 567 } 568 else 569 { 570 rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); 571 } 572 rcListPicYuvRecOut.pushBack( rpcPicYuvRec ); 573 574 pcBottomField->getSlice(0)->setPOC( m_iPOCLast); 575 pcBottomField->getPicYuvRec()->setBorderExtension(false); 576 pcBottomField->setTopField(!isTff); 577 578 int nHeight = pcPicYuvOrg->getHeight(); 579 int nWidth = pcPicYuvOrg->getWidth(); 580 int nStride = pcPicYuvOrg->getStride(); 581 int nPadLuma = pcPicYuvOrg->getLumaMargin(); 582 int nPadChroma = pcPicYuvOrg->getChromaMargin(); 583 584 // Get pointers 585 Pel * PicBufY = pcPicYuvOrg->getBufY(); 586 Pel * PicBufU = pcPicYuvOrg->getBufU(); 587 Pel * PicBufV = pcPicYuvOrg->getBufV(); 588 589 Pel * pcBottomFieldY = pcBottomField->getPicYuvOrg()->getLumaAddr(); 590 Pel * pcBottomFieldU = pcBottomField->getPicYuvOrg()->getCbAddr(); 591 Pel * pcBottomFieldV = pcBottomField->getPicYuvOrg()->getCrAddr(); 592 593 // Compute image characteristics 594 if ( getUseAdaptiveQP() ) 595 { 596 m_cPreanalyzer.xPreanalyze( dynamic_cast<TEncPic*>( pcBottomField ) ); 597 } 598 599 /* -- Defield -- */ 600 601 bool isTop = !isTff; 602 603 separateFields(PicBufY + nPadLuma + nStride*nPadLuma, pcBottomFieldY, nStride, nWidth, nHeight, isTop); 604 separateFields(PicBufU + nPadChroma + (nStride >> 1)*nPadChroma, pcBottomFieldU, nStride >> 1, nWidth >> 1, nHeight >> 1, isTop); 605 separateFields(PicBufV + nPadChroma + (nStride >> 1)*nPadChroma, pcBottomFieldV, nStride >> 1, nWidth >> 1, nHeight >> 1, isTop); 606 607 } 608 609 if ( ( !(m_iNumPicRcvd) || (!flush && m_iPOCLast != 1 && m_iNumPicRcvd != m_iGOPSize && m_iGOPSize)) ) 610 { 611 iNumEncoded = 0; 612 return; 613 } 614 615 // compress GOP 616 m_cGOPEncoder.compressGOP(m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, accessUnitsOut, true, isTff); 617 618 iNumEncoded = m_iNumPicRcvd; 619 m_iNumPicRcvd = 0; 620 m_uiNumAllPicCoded += iNumEncoded; 621 } 622 #endif 623 624 469 625 470 626 // ==================================================================================================================== … … 821 977 822 978 //Function for initializing m_RPSList, a list of TComReferencePictureSet, based on the GOPEntry objects read from the config file. 823 Void TEncTop::xInitRPS( )979 Void TEncTop::xInitRPS(Bool isFieldCoding) 824 980 { 825 981 TComReferencePictureSet* rps; 826 982 827 m_cSPS.createRPSList(getGOPSize()+m_extraRPSs );983 m_cSPS.createRPSList(getGOPSize()+m_extraRPSs+1); 828 984 TComRPSList* rpsList = m_cSPS.getRPSList(); 829 985 … … 922 1078 printf("Warning: number of negative pictures in RPS is different between intra and inter RPS specified in the config file.\n"); 923 1079 rps->setNumberOfNegativePictures(numNeg); 924 rps->setNumberOfP ositivePictures(numNeg+numPos);1080 rps->setNumberOfPictures(numNeg+numPos); 925 1081 } 926 1082 if (numPos != rps->getNumberOfPositivePictures()) … … 928 1084 printf("Warning: number of positive pictures in RPS is different between intra and inter RPS specified in the config file.\n"); 929 1085 rps->setNumberOfPositivePictures(numPos); 930 rps->setNumberOfP ositivePictures(numNeg+numPos);1086 rps->setNumberOfPictures(numNeg+numPos); 931 1087 } 932 1088 RPSTemp.setNumberOfPictures(numNeg+numPos); … … 992 1148 #endif //INTER_RPS_AUTO 993 1149 } 994 1150 //In case of field coding, we need to set special parameters for the first bottom field of the sequence, since it is not specified in the cfg file. 1151 //The position = GOPSize + extraRPSs which is (a priori) unused is reserved for this field in the RPS. 1152 if (isFieldCoding) 1153 { 1154 rps = rpsList->getReferencePictureSet(getGOPSize()+m_extraRPSs); 1155 rps->setNumberOfPictures(1); 1156 rps->setNumberOfNegativePictures(1); 1157 rps->setNumberOfPositivePictures(0); 1158 rps->setNumberOfLongtermPictures(0); 1159 rps->setDeltaPOC(0,-1); 1160 rps->setPOC(0,0); 1161 rps->setUsed(0,true); 1162 rps->setInterRPSPrediction(false); 1163 rps->setDeltaRIdxMinus1(0); 1164 rps->setDeltaRPS(0); 1165 rps->setNumRefIdc(0); 1166 } 995 1167 } 996 1168 … … 1037 1209 } 1038 1210 } 1211 #if H_MV 1212 } 1213 #endif 1214 if(POCCurr == 1 && slice->getPic()->isField()) 1215 { 1216 slice->setRPSidx(m_iGOPSize+m_extraRPSs); 1217 } 1039 1218 1040 1219 slice->setRPS(getSPS()->getRPSList()->getReferencePictureSet(slice->getRPSidx())); 1041 1220 slice->getRPS()->setNumberOfPictures(slice->getRPS()->getNumberOfNegativePictures()+slice->getRPS()->getNumberOfPositivePictures()); 1042 #if H_MV1043 }1044 #endif1045 1046 1221 } 1047 1222 … … 1156 1331 } 1157 1332 #if H_MV 1158 Void TEncTop::printSummary( Int numAllPicCoded ) 1159 { 1333 Void TEncTop::printSummary( Int numAllPicCoded, Bool isField ) 1334 { 1335 assert ( !isField ); // Multiview and field coding need to be further unified 1160 1336 assert (numAllPicCoded == m_cAnalyzeAll.getNumPic()); 1161 1337 -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncTop.h
r635 r651 145 145 146 146 Void xInitPPSforTiles (); 147 Void xInitRPS ( );///< initialize PPS from encoder options147 Void xInitRPS (Bool isFieldCoding); ///< initialize PPS from encoder options 148 148 149 149 public: … … 154 154 Void destroy (); 155 155 #if KWU_RC_MADPRED_E0227 156 Void init ( TAppEncTop* pcTAppEncTop );157 #else 158 Void init ( );156 Void init ( TAppEncTop* pcTAppEncTop, Bool isFieldCoding ); 157 #else 158 Void init (Bool isFieldCoding); 159 159 #endif 160 160 … … 228 228 #if H_MV 229 229 Void encode( Bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded , Int gopId ); 230 231 /// encode several number of pictures until end-of-sequence 232 Void encode( bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, 233 std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded, bool isTff , Int gopId ); 234 230 235 #else 231 236 Void encode( Bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, 232 std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded ); 233 #endif 234 235 #if H_MV 236 Void printSummary ( Int numAllPicCoded ); 237 #else 238 void printSummary() { m_cGOPEncoder.printOutSummary (m_uiNumAllPicCoded); } 237 std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded ); 238 /// encode several number of pictures until end-of-sequence 239 Void encode( bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, 240 std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded, bool isTff); 241 242 #endif 243 244 #if H_MV 245 Void printSummary ( Int numAllPicCoded, bool isField ); 246 #else 247 Void printSummary(bool isField) { m_cGOPEncoder.printOutSummary (m_uiNumAllPicCoded, isField); } 239 248 #endif 240 249 -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibVideoIO/TVideoIOYuv.cpp
r608 r651 339 339 } 340 340 341 static Bool writeField(ostream& fd, Pel* top, Pel* bottom, Bool is16bit, 342 UInt stride, 343 UInt width, UInt height, bool isTff) 344 { 345 Int write_len = width * (is16bit ? 2 : 1)*2; 346 UChar *buf = new UChar[write_len]; 347 for (Int y = 0; y < height; y++) 348 { 349 if (!is16bit) 350 { 351 for (Int x = 0; x < width; x++) 352 { 353 buf[x] = isTff ? (UChar) top[x] : (UChar) bottom[x]; 354 buf[width+x] = isTff ? (UChar) bottom[x] : (UChar) top[x]; 355 } 356 } 357 else 358 { 359 for (Int x = 0; x < width; x++) 360 { 361 buf[2*x] = isTff ? top[x] & 0xff : bottom[x] & 0xff; 362 buf[2*x+1] = isTff ? (top[x] >> 8) & 0xff : (bottom[x] >> 8) & 0xff; 363 364 buf[width+2*x] = isTff ? bottom[x] & 0xff : top[x] & 0xff; 365 buf[width+2*x+1] = isTff ? (bottom[x] >> 8) & 0xff : (top[x] >> 8) & 0xff; 366 } 367 } 368 369 fd.write(reinterpret_cast<Char*>(buf), write_len); 370 if (fd.eof() || fd.fail() ) 371 { 372 delete[] buf; 373 return false; 374 } 375 top += stride; 376 bottom += stride; 377 } 378 delete[] buf; 379 return true; 380 } 341 381 /** 342 382 * Read one Y'CbCr frame, performing any required input scaling to change … … 501 541 } 502 542 543 544 /** 545 * Write one Y'CbCr frame. No bit-depth conversion is performed, pcPicYuv is 546 * assumed to be at TVideoIO::m_fileBitdepth depth. 547 * 548 * @param pPicTop input top field YUV buffer class pointer 549 * @param pPicBottom input bottom field YUV buffer class pointer 550 * @param aiPad source padding size, aiPad[0] = horizontal, aiPad[1] = vertical 551 * @return true for success, false in case of error 552 */ 553 Bool TVideoIOYuv::write( TComPicYuv* pPicTop, TComPicYuv* pPicBottom, Int cropLeft, Int cropRight, Int cropTop, Int cropBottom , bool isTff) 554 { 555 // compute actual YUV frame size excluding padding size 556 Int iStride = pPicTop->getStride(); 557 UInt width = pPicTop->getWidth() - cropLeft - cropRight; 558 UInt height = pPicTop->getHeight() - cropTop - cropBottom; 559 Bool is16bit = m_fileBitDepthY > 8 || m_fileBitDepthC > 8; 560 561 TComPicYuv *dstPicTop = NULL; 562 TComPicYuv *dstPicBottom = NULL; 563 564 Bool retval = true; 565 566 if (m_bitDepthShiftY != 0 || m_bitDepthShiftC != 0) 567 { 568 dstPicTop = new TComPicYuv; 569 dstPicTop->create( pPicTop->getWidth(), pPicTop->getHeight(), 1, 1, 0 ); 570 pPicTop->copyToPic(dstPicTop); 571 572 dstPicBottom = new TComPicYuv; 573 dstPicBottom->create( pPicBottom->getWidth(), pPicBottom->getHeight(), 1, 1, 0 ); 574 pPicBottom->copyToPic(dstPicBottom); 575 576 Pel minvalY = 0; 577 Pel minvalC = 0; 578 Pel maxvalY = (1 << m_fileBitDepthY) - 1; 579 Pel maxvalC = (1 << m_fileBitDepthC) - 1; 580 #if CLIP_TO_709_RANGE 581 if (-m_bitDepthShiftY < 0 && m_fileBitDepthY >= 8) 582 { 583 /* ITU-R BT.709 compliant clipping for converting say 10b to 8b */ 584 minvalY = 1 << (m_fileBitDepthY - 8); 585 maxvalY = (0xff << (m_fileBitDepthY - 8)) -1; 586 } 587 if (-m_bitDepthShiftC < 0 && m_fileBitDepthC >= 8) 588 { 589 /* ITU-R BT.709 compliant clipping for converting say 10b to 8b */ 590 minvalC = 1 << (m_fileBitDepthC - 8); 591 maxvalC = (0xff << (m_fileBitDepthC - 8)) -1; 592 } 593 #endif 594 scalePlane(dstPicTop->getLumaAddr(), dstPicTop->getStride(), dstPicTop->getWidth(), dstPicTop->getHeight(), -m_bitDepthShiftY, minvalY, maxvalY); 595 scalePlane(dstPicTop->getCbAddr(), dstPicTop->getCStride(), dstPicTop->getWidth()>>1, dstPicTop->getHeight()>>1, -m_bitDepthShiftC, minvalC, maxvalC); 596 scalePlane(dstPicTop->getCrAddr(), dstPicTop->getCStride(), dstPicTop->getWidth()>>1, dstPicTop->getHeight()>>1, -m_bitDepthShiftC, minvalC, maxvalC); 597 598 scalePlane(dstPicBottom->getLumaAddr(), dstPicBottom->getStride(), dstPicBottom->getWidth(), dstPicBottom->getHeight(), -m_bitDepthShiftY, minvalY, maxvalY); 599 scalePlane(dstPicBottom->getCbAddr(), dstPicBottom->getCStride(), dstPicBottom->getWidth()>>1, dstPicBottom->getHeight()>>1, -m_bitDepthShiftC, minvalC, maxvalC); 600 scalePlane(dstPicBottom->getCrAddr(), dstPicBottom->getCStride(), dstPicBottom->getWidth()>>1, dstPicBottom->getHeight()>>1, -m_bitDepthShiftC, minvalC, maxvalC); 601 } 602 else 603 { 604 dstPicTop = pPicTop; 605 dstPicBottom = pPicBottom; 606 } 607 // location of upper left pel in a plane 608 Int planeOffset = 0; //cropLeft + cropTop * iStride; 609 //Write luma 610 if (! writeField(m_cHandle, dstPicTop->getLumaAddr() + planeOffset, dstPicBottom->getLumaAddr() + planeOffset, is16bit, iStride, width, height, isTff)) 611 { 612 retval=false; 613 goto exit; 614 } 615 616 width >>= 1; 617 height >>= 1; 618 iStride >>= 1; 619 cropLeft >>= 1; 620 cropRight >>= 1; 621 622 planeOffset = 0; // cropLeft + cropTop * iStride; 623 624 //Write chroma U 625 if (! writeField(m_cHandle, dstPicTop->getCbAddr() + planeOffset, dstPicBottom->getCbAddr() + planeOffset, is16bit, iStride, width, height, isTff)) 626 { 627 retval=false; 628 goto exit; 629 } 630 631 //Write chroma V 632 if (! writeField(m_cHandle, dstPicTop->getCrAddr() + planeOffset, dstPicBottom->getCrAddr() + planeOffset, is16bit, iStride, width, height, isTff)) 633 634 { 635 retval=false; 636 goto exit; 637 } 638 639 exit: 640 if (m_bitDepthShiftY != 0 || m_bitDepthShiftC != 0) 641 { 642 dstPicTop->destroy(); 643 delete dstPicTop; 644 dstPicBottom->destroy(); 645 delete dstPicBottom; 646 } 647 return retval; 648 } -
branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibVideoIO/TVideoIOYuv.h
r608 r651 72 72 Bool read ( TComPicYuv* pPicYuv, Int aiPad[2] ); ///< read one YUV frame with padding parameter 73 73 Bool write( TComPicYuv* pPicYuv, Int confLeft=0, Int confRight=0, Int confTop=0, Int confBottom=0 ); 74 Bool write( TComPicYuv* pPicYuv, TComPicYuv* pPicYuv2, Int confLeft=0, Int confRight=0, Int confTop=0, Int confBottom=0 , bool isTff=false); 74 75 75 76 Bool isEof (); ///< check for end-of-file
Note: See TracChangeset for help on using the changeset viewer.