- Timestamp:
- 2 Apr 2013, 17:21:58 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComSlice.cpp
r101 r102 115 115 m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = m_aiNumRefIdx[2] = 0; 116 116 117 #if REF_LIST_BUGFIX 118 m_aiNumILRRefIdx = 0; 119 #endif 117 120 initEqualRef(); 118 121 … … 156 159 m_aiNumRefIdx[0] = 0; 157 160 m_aiNumRefIdx[1] = 0; 158 161 #if REF_LIST_BUGFIX 162 if(layerId) 163 { 164 m_aiNumILRRefIdx = 1; // to be set to NumDirectRefLayers[LayerIdInVps[nuh_layer_id]] 165 } 166 else 167 { 168 m_aiNumILRRefIdx = 0; 169 } 170 #endif 159 171 m_colFromL0Flag = 1; 160 172 … … 358 370 } 359 371 360 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic 372 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic) 361 373 { 362 374 #if REF_IDX_FRAMEWORK … … 489 501 } 490 502 503 #if REF_LIST_BUGFIX 504 Void TComSlice::setRefPicListModificationSvc() 505 { 506 if( !this->getPPS()->getListsModificationPresentFlag()) 507 { 508 return; 509 } 510 511 if(this->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA && this->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) 512 return; 513 514 TComRefPicListModification* refPicListModification = this->getRefPicListModification(); 515 Int numberOfRpsCurrTempList = this->getNumRpsCurrTempList(); // total number of ref pics in listTemp0 including inter-layer ref pics 516 517 assert(m_aiNumRefIdx[REF_PIC_LIST_0] > 1); 518 assert(m_aiNumRefIdx[REF_PIC_LIST_1] > 1); 519 520 //set L0 inter-layer reference picture modification 521 Bool hasModification = (m_aiNumRefIdx[REF_PIC_LIST_0] == numberOfRpsCurrTempList) ? false : true; 522 refPicListModification->setRefPicListModificationFlagL0(hasModification); 523 if(hasModification) 524 { 525 for(Int i = 0; i < min(m_aiNumRefIdx[REF_PIC_LIST_0], numberOfRpsCurrTempList); i++) 526 { 527 refPicListModification->setRefPicSetIdxL0(i, i); 528 } 529 if(m_aiNumRefIdx[REF_PIC_LIST_0] > numberOfRpsCurrTempList) 530 { 531 // repeat last ref pic when the number of active ref idx are more than RPS entries 532 for (Int i = numberOfRpsCurrTempList; i < m_aiNumRefIdx[REF_PIC_LIST_0]; i ++) 533 { 534 refPicListModification->setRefPicSetIdxL0(i, numberOfRpsCurrTempList - 1); 535 } 536 } 537 else 538 { 539 for(Int i = m_aiNumILRRefIdx; i > 0; i-- ) 540 { 541 refPicListModification->setRefPicSetIdxL0(m_aiNumRefIdx[REF_PIC_LIST_0] - i, numberOfRpsCurrTempList - i); 542 } 543 } 544 } 545 546 //set L1 inter-layer reference picture modification 547 hasModification = (m_aiNumRefIdx[REF_PIC_LIST_1] == numberOfRpsCurrTempList) ? false : true; 548 refPicListModification->setRefPicListModificationFlagL1(hasModification); 549 if(hasModification) 550 { 551 for(Int i = 0; i < min(m_aiNumRefIdx[REF_PIC_LIST_1], numberOfRpsCurrTempList); i++) 552 { 553 refPicListModification->setRefPicSetIdxL1(i, i); 554 } 555 if(m_aiNumRefIdx[REF_PIC_LIST_1] > numberOfRpsCurrTempList) 556 { 557 for (Int i = numberOfRpsCurrTempList; i < m_aiNumRefIdx[REF_PIC_LIST_1]; i ++) 558 { 559 // repeat last ref pic when the number of active ref idx are more than RPS entries 560 refPicListModification->setRefPicSetIdxL1(i, numberOfRpsCurrTempList - 1); 561 } 562 } 563 else 564 { 565 for(Int i = m_aiNumILRRefIdx; i > 0; i-- ) 566 { 567 refPicListModification->setRefPicSetIdxL1(m_aiNumRefIdx[REF_PIC_LIST_1] - i, numberOfRpsCurrTempList - i); 568 } 569 } 570 } 571 return; 572 } 573 574 Void TComSlice::setRefPicListSvc( TComList<TComPic*>& rcListPic, TComPic** ilpPic ) 575 { 576 assert(getLayerId() > 0); 577 578 m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0); 579 m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1); 580 581 TComPic* pcRefPic= NULL; 582 TComPic* RefPicSetStCurr0[16]; 583 TComPic* RefPicSetStCurr1[16]; 584 TComPic* RefPicSetLtCurr[16]; 585 UInt NumPocStCurr0 = 0; 586 UInt NumPocStCurr1 = 0; 587 UInt NumPocLtCurr = 0; 588 Int i; 589 590 //temporal reference pictures 591 if( !(getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA && getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) ) 592 { 593 for(i=0; i < m_pcRPS->getNumberOfNegativePictures(); i++) 594 { 595 if(m_pcRPS->getUsed(i)) 596 { 597 pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pcRPS->getDeltaPOC(i)); 598 pcRefPic->setIsLongTerm(0); 599 pcRefPic->getPicYuvRec()->extendPicBorder(); 600 RefPicSetStCurr0[NumPocStCurr0] = pcRefPic; 601 NumPocStCurr0++; 602 pcRefPic->setCheckLTMSBPresent(false); 603 } 604 } 605 for(; i < m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures(); i++) 606 { 607 if(m_pcRPS->getUsed(i)) 608 { 609 pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pcRPS->getDeltaPOC(i)); 610 pcRefPic->setIsLongTerm(0); 611 pcRefPic->getPicYuvRec()->extendPicBorder(); 612 RefPicSetStCurr1[NumPocStCurr1] = pcRefPic; 613 NumPocStCurr1++; 614 pcRefPic->setCheckLTMSBPresent(false); 615 } 616 } 617 for(i = m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()+m_pcRPS->getNumberOfLongtermPictures()-1; i > m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()-1 ; i--) 618 { 619 if(m_pcRPS->getUsed(i)) 620 { 621 pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i)); 622 pcRefPic->setIsLongTerm(1); 623 pcRefPic->getPicYuvRec()->extendPicBorder(); 624 RefPicSetLtCurr[NumPocLtCurr] = pcRefPic; 625 NumPocLtCurr++; 626 } 627 if(pcRefPic==NULL) 628 { 629 pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i)); 630 } 631 pcRefPic->setCheckLTMSBPresent(m_pcRPS->getCheckLTMSBPresent(i)); 632 } 633 } 634 635 //inter-layer reference picture 636 #if REF_IDX_MFM 637 assert(m_aiNumILRRefIdx == 1); 638 if(!(getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA && getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) && getSPS()->getMFMEnabledFlag()) 639 { 640 ilpPic[0]->copyUpsampledMvField(getBaseColPic()); 641 } 642 else 643 { 644 ilpPic[0]->initUpsampledMvField(); 645 } 646 #endif 647 ilpPic[0]->setIsLongTerm(1); 648 649 // ref_pic_list_init 650 UInt cIdx = 0; 651 UInt num_ref_idx_l0_active_minus1 = m_aiNumRefIdx[0] - 1; 652 UInt num_ref_idx_l1_active_minus1 = m_aiNumRefIdx[1] - 1; 653 TComPic* refPicListTemp0[MAX_NUM_REF+1]; 654 TComPic* refPicListTemp1[MAX_NUM_REF+1]; 655 Int numRpsCurrTempList0, numRpsCurrTempList1; 656 657 numRpsCurrTempList0 = numRpsCurrTempList1 = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr + m_aiNumILRRefIdx; 658 if (numRpsCurrTempList0 <= num_ref_idx_l0_active_minus1) 659 { 660 numRpsCurrTempList0 = num_ref_idx_l0_active_minus1 + 1; 661 } 662 if (numRpsCurrTempList1 <= num_ref_idx_l1_active_minus1) 663 { 664 numRpsCurrTempList1 = num_ref_idx_l1_active_minus1 + 1; 665 } 666 667 assert(numRpsCurrTempList0 <= MAX_NUM_REF); 668 assert(numRpsCurrTempList1 <= MAX_NUM_REF); 669 670 cIdx = 0; 671 while (cIdx < numRpsCurrTempList0) 672 { 673 for ( i=0; i<NumPocStCurr0 && cIdx<numRpsCurrTempList0; cIdx++,i++) 674 refPicListTemp0[cIdx] = RefPicSetStCurr0[ i ]; 675 for ( i=0; i<NumPocStCurr1 && cIdx<numRpsCurrTempList0; cIdx++,i++) 676 refPicListTemp0[cIdx] = RefPicSetStCurr1[ i ]; 677 for ( i=0; i<NumPocLtCurr && cIdx<numRpsCurrTempList0; cIdx++,i++) 678 refPicListTemp0[cIdx] = RefPicSetLtCurr[ i ]; 679 for ( i=0; i<m_aiNumILRRefIdx && cIdx<numRpsCurrTempList0; cIdx++,i++) 680 refPicListTemp0[cIdx] = ilpPic[ i ]; 681 } 682 cIdx = 0; 683 while (cIdx<numRpsCurrTempList1 && m_eSliceType==B_SLICE) 684 { 685 for ( i=0; i<NumPocStCurr1 && cIdx<numRpsCurrTempList1; cIdx++,i++) 686 refPicListTemp1[cIdx] = RefPicSetStCurr1[ i ]; 687 for ( i=0; i<NumPocStCurr0 && cIdx<numRpsCurrTempList1; cIdx++,i++) 688 refPicListTemp1[cIdx] = RefPicSetStCurr0[ i ]; 689 for ( i=0; i<NumPocLtCurr && cIdx<numRpsCurrTempList1; cIdx++,i++) 690 refPicListTemp1[cIdx] = RefPicSetLtCurr[ i ]; 691 for ( i=0; i<m_aiNumILRRefIdx && cIdx<numRpsCurrTempList1; cIdx++,i++) 692 refPicListTemp1[cIdx] = ilpPic[ i ]; 693 } 694 ::memset(m_bIsUsedAsLongTerm, 0, sizeof(m_bIsUsedAsLongTerm)); 695 for (Int rIdx = 0; rIdx <= (m_aiNumRefIdx[0]-1); rIdx ++) 696 { 697 m_apcRefPicList[0][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL0() ? refPicListTemp0[ m_RefPicListModification.getRefPicSetIdxL0(rIdx) ] : refPicListTemp0[rIdx % numRpsCurrTempList0]; 698 m_bIsUsedAsLongTerm[0][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL0() ? (m_RefPicListModification.getRefPicSetIdxL0(rIdx) >= (NumPocStCurr0 + NumPocStCurr1)) 699 : ((rIdx % numRpsCurrTempList0) >= (NumPocStCurr0 + NumPocStCurr1)); 700 } 701 if ( m_eSliceType == P_SLICE ) 702 { 703 m_aiNumRefIdx[1] = 0; 704 ::memset( m_apcRefPicList[1], 0, sizeof(m_apcRefPicList[1])); 705 } 706 else 707 { 708 for (Int rIdx = 0; rIdx <= (m_aiNumRefIdx[1]-1); rIdx ++) 709 { 710 m_apcRefPicList[1][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL1() ? refPicListTemp1[ m_RefPicListModification.getRefPicSetIdxL1(rIdx) ] : refPicListTemp1[rIdx % numRpsCurrTempList1]; 711 m_bIsUsedAsLongTerm[1][rIdx] = m_RefPicListModification.getRefPicListModificationFlagL1() ? 712 (m_RefPicListModification.getRefPicSetIdxL1(rIdx) >= (NumPocStCurr0 + NumPocStCurr1)): ((rIdx % numRpsCurrTempList1) >= (NumPocStCurr0 + NumPocStCurr1)); 713 } 714 } 715 716 return; 717 } 718 #endif 719 491 720 Int TComSlice::getNumRpsCurrTempList() 492 721 { 493 722 Int numRpsCurrTempList = 0; 494 723 724 #if REF_IDX_FRAMEWORK 725 if( m_eSliceType == I_SLICE || ( getSPS()->getLayerId() && 726 (getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA) && 727 (getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) ) ) 728 #else 495 729 if (m_eSliceType == I_SLICE) 496 { 730 #endif 731 { 732 #if REF_LIST_BUGFIX 733 return m_aiNumILRRefIdx; 734 #else 497 735 return 0; 736 #endif 498 737 } 499 738 for(UInt i=0; i < m_pcRPS->getNumberOfNegativePictures()+ m_pcRPS->getNumberOfPositivePictures() + m_pcRPS->getNumberOfLongtermPictures(); i++) … … 504 743 } 505 744 } 745 #if REF_LIST_BUGFIX 746 if(getLayerId()) 747 { 748 numRpsCurrTempList += getNumILRRefIdx(); 749 } 750 #endif 751 506 752 return numRpsCurrTempList; 507 753 }
Note: See TracChangeset for help on using the changeset viewer.